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 |
|---|---|---|---|---|---|---|
b973f2fb-319b-4a7d-9549-8fc4c8ad1a29 | brightGarden02/Coding-Test | leetcode/easy/BFS DFS/cpp/653_Two Sum IV - Input is a BST.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.999988 | 6.146053 |
785e8432-96d5-4204-9015-88bca02317fa | narendra632/DSA-CP-CPP | DSA/Sorting_Techniques/bubble.cpp | #include<bits/stdc++.h>
using namespace std;
void bubble_sort(int arr[], int n){
for(int i = n-1; i>=0; i--){
int didswap = 0;
for(int j = 0; j <= i -1; j++){
if(arr[j] > arr[j+1]){
int temp = arr[j+1];
arr[j+1] = arr[j];
arr[j] = temp;
... | ALGO | 0.999937 | 5.537848 |
bf3edc30-c16d-4f58-9956-9bcc554d04d2 | phm1231/Algorithm-Practice | baekjoon/covenant_kit/16953_2.cpp |
// based problem:
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
#define MAX 100001
void init();
void input();
void solve();
ll a, b, answer;
void bfs(ll, ll);
void init()
{
cin.tie(NULL); cout.tie(NULL); ios::sync_with_stdio(false);
}
vo... | ALGO | 0.999892 | 3.710684 |
b0c1b88b-dd2f-4a0f-baf1-b18fbb5c4861 | DinhThanh-20021582/All-Labs | Lab 4/Tong doi.cpp | #include <iostream>
using namespace std;
int main()
{
int a[10000000];
int n;
cin >> n;
for (int i=0; i<n; i++)
cin >> a[i];
for (int i=0; i<n-1; i++){
for (int j=i+1; j<n; j++){
if(a[i]+a[j]==0)
cout << "(" << a[i] << "," << a[j] << ")" << endl;
}
}
return 0;
}
| ALGO | 0.995186 | 3.589769 |
b998d161-7728-43a7-a97a-f1c16a77c48a | Hong-JinSuk/AlgorithmSolving | BaekJoon/[2024][03-14][G3]BaekJoon_1609, 집으로.cpp | #include <iostream>
#include <cmath>
using namespace std;
int X, Y;
double D, T, dist;
double Time = 0;
void init()
{
cin >> X >> Y >> D >> T;
dist = sqrt(pow(X, 2) + pow(Y, 2)); // 현재 위치에서 목적지까지의 거리
}
// 2번 점프하는 거리보다 아직 멀리 떨어져있나? 묻는 조건식
bool Jump()
{
if (dist > 2 * D)
{
return true;
}
... | ALGO | 0.999542 | 3.792577 |
fb041e44-6539-4528-bbff-ac10f35b41b7 | munzir/10d-3DHighLevelControllerC-2Ddart | eigen/bench/benchmark.cpp | // g++ -O3 -DNDEBUG -DMATSIZE=<x> benchmark.cpp -o benchmark && time ./benchmark
#include <iostream>
#include <Eigen/Core>
#ifndef MATSIZE
#define MATSIZE 3
#endif
using namespace std;
using namespace Eigen;
#ifndef REPEAT
#define REPEAT 40000000
#endif
#ifndef SCALAR
#define SCALAR double
#endif
int main(int ar... | ALGO | 0.991052 | 3.675187 |
db3faf7d-19f4-49f2-8c57-62666de604e0 | ishandutta2007/codeforces | maspy/normal/798/B.cpp | #line 1 "/home/maspy/compro/library/my_template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<ll, ll>;
using vi = vector<ll>;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;
template <class T>
using vc = vector<T>;
template <class T>
using v... | ALGO | 0.999927 | 4.373437 |
6e65ea7f-e58e-40f6-ad59-f48c8457e598 | Asbaq/DSA | DSA & Codes/C++,C & DSA/Pattern/DiamondPattern.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter the No:";
cin>>n;
for(int i=1;i<=n;i++)
{
int space= n - i;
for(int j=1;j<=space;j++)
{
cout<<" ";
}
for(int j=1;j<=i;j++)
{
cout<<"*";
} ... | ALGO | 0.999803 | 3.829345 |
b9672a06-a406-45ce-82d6-b8704064bb19 | daviddaigithub/IGESS | src/IGESSRcpp.cpp | #define ARMA_DONT_USE_WRAPPER
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::depends(BH)]]
#include <RcppArmadillo.h>
#include <R.h>
#include <Rinternals.h>
#include "Rcpp_aux.hpp"
#include "IGESS_aux.hpp"
#include "IGESS.hpp"
#include "readPlink.hpp"
using namespace Rcpp;
using namespace arma;
// [[Rcpp::export]]
Rc... | ALGO | 0.948908 | 6.927878 |
3907d086-ce01-4d3b-bf5d-80d51055ddff | IZeIke/problem_solve_lab | HW C++/next_prime.cpp | #include <iostream>
using namespace std;
bool check_prime(int p)
{
if (p <= 1) {
return false;
}
int x = 0;
for(int i = 2;i < p;i++){
if(p % i == 0){
x = 1;
}
}
if(x == 0)
{
return true;
}else
{
return false;
}
}
int main()
{
int x;
cin >> x;
for(int i=1;i<100;i++)
{
x += ... | ALGO | 0.999718 | 4.148323 |
cc68bb6a-b0de-444e-97d2-f164c2b718e6 | maajidAwol/EVALUATION | assesment_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.998857 | 6.76775 |
03538f73-2b59-449e-b834-32ce25c8a2a5 | version0chiro/Ace-The-Code | Leet-Code-Question/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix.cpp | class Solution {
public:
string serialize(vector<vector<int>>& mat) {
string s;
int m = mat.size(), n = mat[0].size();
for(int i=0; i<m; i++) {
for (int j=0; j<n; j++) {
s = s + to_string(mat[i][j]);
}
s = s + "#";
}
retur... | ALGO | 0.999987 | 5.947587 |
3b70c233-c622-4f79-91f8-33a2e95f00eb | zhanghx0905/undergraduate-archive | 05.DSA/MOOC/MOOC PA2/C.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn = 1000002;
int dis[maxn]; //
struct node {
int index = 0, time = 0, in = 0, out = 0;
int* succ;//ֹڴ棬ֻѡö̬
}nodes[maxn];
int pre[maxn], suc[maxn], suc_count[maxn]; //Ԥȡ
template<typename T>
class Queue { //
int ... | ALGO | 0.99975 | 3.787219 |
c4e9cf13-3ce5-4066-ad9a-7b44567313f4 | Nijitha100604/Leetcode | Day 17/49.Group Anagrams.cpp | class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
unordered_map<string, vector<string>> m;
for(auto s: strs)
{
string key = s;
sort(key.begin(), key.end());
m[key].push_back(s);
}
vector<vector<string>> a... | ALGO | 0.999995 | 6.453069 |
90684d94-e63a-4fe8-b104-118cbd0172a8 | JaeNew/Leetcode-MySubmit | 142.环形链表-ii.cpp | /*
* @lc app=leetcode.cn id=142 lang=cpp
*
* [142] 环形链表 II
*
* https://leetcode-cn.com/problems/linked-list-cycle-ii/description/
*
* algorithms
* Medium (36.53%)
* Total Accepted: 12.3K
* Total Submissions: 33.7K
* Testcase Example: '[3,2,0,-4]\n1'
*
* 给定一个链表,返回链表开始入环的第一个节点。 如果链表无环,则返回 null。
*
* 为了... | ALGO | 0.999949 | 5.10749 |
553c570f-5f27-4912-adf1-25be14679da2 | jackeddaniel/leetcode_solutions | graphs/133_clone_graph.cpp | //so what I have to do is deep copy of a tree
//what I will do is perform a dfs on the graph and creat new nodes using new and structure them as present in the graph
class Solution {
public:
Node* dfs(Node* node, unordered_map<Node*,Node*>& visited) {
if(!node) return nullptr;
if(visited.count... | ALGO | 0.999879 | 6.54703 |
fc4ce89e-0b10-4a25-b512-8d35b87d2bf5 | QinHongZhe/hongzhe-leetcode | solution/1300-1399/1313.Decompress Run-Length Encoded List/Solution.cpp | class Solution {
public:
vector<int> decompressRLElist(vector<int>& nums) {
vector<int> res;
for (int i = 1; i < nums.size(); i += 2) {
for (int j = 0; j < nums[i - 1]; ++j) {
res.push_back(nums[i]);
}
}
return res;
}
}; | ALGO | 0.999934 | 5.741111 |
215cc02a-7677-4d87-9c1a-b9279ed61d11 | ed-w/cses-solutions | introductory_problems/bit_strings.cpp | // #1617
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll b = pow(10, 9) + 7;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
ll x = 1;
for (int i=1; i <= n; i++) {
x = (x * 2) % b;
}
cout << x << "\n";
}
| ALGO | 0.999963 | 4.647936 |
7d4642d3-064f-4260-9074-ed4f03327daf | rhidoyhasanmahmud/Online-Judge-Problem-Solutions | UVa Archive/10195 - The Knights Of The Round Table.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
double a,b,c,s,result;
while(cin>>a>>b>>c)
{
if(a<=0 && b<=0 && c<=0)
printf("The radius of the round table is: 0.000\n",result);
else
{
s=0,result=0;
s=(a+b+c)/2;
result=sqrt(((... | ALGO | 0.999794 | 3.850937 |
d1cd8202-77ea-4257-9089-2f313072eed3 | dTCTb/my_path_to_conquer_c_cpp | leetcode/1277_count_square_submatrices_with_all_ones.cpp | // clang-format off
#include <iostream>
#include <vector>
using namespace std;
typedef std::vector<std::vector<int>> input;
class Solution {
public:
static int countSquares(input &matrix) noexcept
{
int result{};
for (size_t i{}; i < matrix.size(); ++i)
for (size_t j{}; j < mat... | ALGO | 0.998977 | 5.975041 |
9b2536fb-1bc3-448e-a5f1-6f997af749a5 | Nullray/ICT | software/workload/firesim/host/firesim-lib/lib/boost/libs/math/example/lambert_w_graph.cpp | /*! \brief Graph showing use of Lambert W function.
\details
Both Lambert W0 and W-1 branches can be shown on one graph.
But useful to have another graph for larger values of argument z.
Need two separate graphs for Lambert W0 and -1 prime because
the sensible ranges and axes are too different.
One would get too s... | ALGO | 0.923342 | 6.347035 |
f0aa0f34-a1dc-4417-bde3-c132efd0f50e | kailasspawar/DS-ALGO-PROGRAMS | Strings/SortTheArrayOfStrings.cpp | #include<iostream>
#include<cstdlib>
#include<string.h>
using namespace std;
static int compare(const void *a,const void *b)
{
return strcmp(*(const char**)a,*(const char**)b);
}
void sort(const char *arr[],int n)
{
qsort(arr,n,sizeof(const char *),compare);
}
int main()
{
const char *arr[] = {"Geeksforgeeks","... | ALGO | 0.999881 | 4.198295 |
1848d414-404a-4e66-bcbb-ffd90aefb4b4 | chaossky/it_cookbook_c_programming | 5장/ch5-21.cpp | #include <stdio.h>
int main()
{
int i, n, sum, multi;
printf(" n : "); scanf("%d", &n);
i = 1; sum = 0; multi = 1;
do
{
sum += i;
multi *= i;
i++;
} while (i <= n);
printf("1 %d %dԴϴ.\n", n, sum);
printf("1 %d %dԴϴ.\n", n, multi);
return 0;
} | ALGO | 0.998937 | 3.817704 |
34d1ab90-349a-4b7f-9249-bdf889bf41f7 | abhikumr7248/CodeInCpp | B_Queue_at_the_School.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int m,n;
cin>>m>>n;
string s;
for(int i=0;i<m;++i)
cin>>s;
for(int j=0;j<n;++j)
{
for(int i=0;i<m;++i)
{
if (s[i] == 'B' && s[i + 1] == 'G')
{
s[i] = 'G';
s[i + 1... | ALGO | 0.999549 | 3.334232 |
b041afc2-153c-470c-8824-46a81b56f37b | Artur-Mkrtchyann/CHP | Lab8/Huffman.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
#include <queue>
using namespace std;
class Node {
public:
char character;
int count;
Node* left;
Node* right;
Node(char c, int co) : character(c), count(co), left(nullptr), right(nullptr) {}
// Modify comparison to dereference N... | ALGO | 0.999981 | 6.845541 |
72152ca4-6ee7-4f01-abdd-f99a5906778b | ishandutta2007/codeforces | ftiasch/normal/1129/D.cpp | #include <bits/stdc++.h>
constexpr int sqrt(int n) {
int r = 0;
while (r * r < n) {
r++;
}
return r;
}
const int N = 100002;
const int B = sqrt(N);
const int MOD = 998244353;
void update(int &x, int a) {
x += a;
if (x >= MOD) {
x -= MOD;
}
}
int n, limit, blocks, bdelta[B], value[N], sum[B], s... | ALGO | 0.999908 | 4.517087 |
345fb491-8918-4beb-a755-cfaa08f9299b | mohamadalsalty/cpp | 1742-A.cpp | // https://codeforces.com/problemset/problem/1742/A
#include <iostream>
using namespace std;
int main()
{
int qnt;
cin >> qnt;
for (int i = 0; i < qnt; i++)
{
int a, b, c;
cin >> a >> b >> c;
if (a + b == c || a + c == b || b + c == a)
cout << "YES" << endl;
... | ALGO | 0.999857 | 5.192624 |
8dd70ef3-9c75-4615-bc2c-21b3c17b93a1 | Cobb-Yoo/Algorithms | BOJ/5532 방학 숙제/5532 방학 숙제.cpp | #include <iostream>
using namespace std;
int main(){
int l,a,b,c,d;
cin >> l >> a >> b >> c >> d;
int math = l-(a/c);
int lang = l-(b/d);
if(a%c) math-=1;
if(b%d) lang-=1;
cout << min(math,lang) << endl;
}
| ALGO | 0.999586 | 3.21524 |
d21f4edd-7424-4831-95f7-924aa7458f93 | JoonUTS05/cppRoadMap2025 | week01_basics/RPS.cpp | #include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
std::string getRandom(){
srand(time(0));
int num = rand() % 3 + 1;
switch(num){
case 1:
return "r";
case 2:
return "p";
case 3:
return "s";
}
return 0;
}
void showChoice(co... | TOOL | 0.994902 | 4.450067 |
3efa7712-1189-4226-a921-ec0711dcd355 | BLBT1/MyLeetcodeSolution | 1801.number-of-orders-in-the-backlog.cpp | /*
* @lc app=leetcode id=1801 lang=cpp
*
* [1801] Number of Orders in the Backlog
*/
// @lc code=start
class Solution
{
public:
int getNumberOfBacklogOrders(vector<vector<int>> &orders)
{
using PII = pair<int, int>;
priority_queue<PII, vector<PII>, less<>> buy_pq; //{price,amount}
p... | ALGO | 0.999956 | 6.238039 |
8fd5d390-19e0-4ffa-b5bb-b2710e6a3a6a | tactop/AtCoder | ABC/abc168/e.cpp | #include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 50;
const int MOD = 1000000... | ALGO | 0.999957 | 3.748685 |
5fc8695e-673f-4752-a279-cf3fc7ffee9e | TayabAmir/LeetCode_Problems | 1538-maximum-points-you-can-obtain-from-cards/1538-maximum-points-you-can-obtain-from-cards.cpp | class Solution {
public:
int maxScore(vector<int>& a, int k) {
int sum = 0, n = a.size();
for(int i = 0; i < k; i++) sum += a[i];
if(k == n) return sum;
int maxi = sum, r = n - 1;
for(int i = k - 1; i >= 0; i--)
sum += (a[r]-a[i]), r--, maxi = max(maxi,sum);
... | ALGO | 0.999916 | 5.360033 |
da176b99-3d1e-459c-bc26-17d757885dcd | VasilP202/PRL-Project2 | life.cpp | /**
* Paralelní a distribuované algoritmy (PRL)
* Project 2: "Game of Life"
* Author: Vasil Poposki (xpopos00)
* Year: 2024
*
* Description:
* Parallel implementation of the Game of Life using MPI library.
* Program should be run using test.sh script.
* The program takes an input file with the... | ALGO | 0.999996 | 6.171991 |
93fb1582-2ed9-4407-affd-7db40fbf90f6 | Abhay-Singh245/Standard-DSA-templates | rabin_carp.cpp |
# include<bits/stdc++.h>
# define ll long long
# define lld long double
#define M 1000000007
#define all(arr) arr.begin(),arr.end()
#define CODE_BY_ABHAY_SINGH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
void pv(vector<ll>v){ for(ll i=0;i<(ll)v.size();i++) cout<<v[i]<<" ";cou... | ALGO | 0.999615 | 5.554865 |
6aff816f-6f68-46d8-82f5-f4c01b52676c | Apress/beginning-cpp20 | Exercises/Modules/Chapter 05/Soln5_01.cpp | // Exercise 5-1 Squaring odd numbers
import <iostream>;
import <format>;
int main()
{
int limit {};
std::cout << "Enter the upper limit for squared odd numbers: ";
std::cin >> limit;
for (int i {1}; i <= limit; i += 2)
{
std::cout << std::format("{:4} squared is {:8}\n", i, i * i);
}
} | ALGO | 0.949059 | 5.34213 |
e94ddbd5-dcbe-43f8-ac88-2c219326270e | shah-zx/plus-plus-C | .history/TCS/team_20220722184907.cpp | #include <bits/stdc++.h>
#include <stack>
#include <queue>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
using namespace std;
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define rep(i, a, b) for (int i = a; i < b; i+... | ALGO | 0.998876 | 4.653217 |
b3ac368a-0c42-4c80-b16f-964002dce94c | athrav138/C-plus-plus | C++/array2.cpp | # include <iostream>
using namespace std;
int main(){
int n;
cout<<"Enter n:";
cin>>n;
int std[n];
cout<<"Enter elements of array: \n";
for(int i=0;i<n;i++){
cout<<"Enter element "<<i<<" :";
cin>>std[i];
}
for(int i=1;i<n;i++){
if(i%2==0){
std[i]+=10;
}
... | ALGO | 0.999556 | 4.168304 |
c3f3015c-eea5-4562-b208-431ad48aef81 | Gottiee/42 | cpp/module_9/ex02/src/PmergeMe.cpp | #include "../header/PmergeMe.hpp"
int PmergeMe::K = 5;
PmergeMe::PmergeMe(std::vector<unsigned int> numbers, u_de deque):_numb(numbers), _que(deque)
{
try
{
print_vec("Before:");
result = clock();
sort(0, _numb.size() - 1);
_time_vec = (float)(clock() - result) / CLOCKS_PER_SEC;
result = clock();
sort_d... | ALGO | 0.998108 | 4.914014 |
19b8d039-1e5b-4c9c-9d65-97838497f36b | Tosun0/C-Learning | _Old/#5_Operators_02/test_condition.cpp | #include <stdio.h>
int main()
{
int x = -50;
int y = 30;
int absoluteX = (x > 0) ? x : -x;
int max = (x > y) ? x : y;
int min = (x < y) ? x : y;
printf("x's absolute value is %d.\n", absoluteX);
printf("x & y's max value is %d.\n", max);
printf("x & y's min value is %d.\n", min);
re... | ALGO | 0.999321 | 4.067048 |
7ffd2e36-ae33-43fc-881a-74a7a4746ead | ishandutta2007/codeforces | abitstochastic/normal/1612/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define ld long double
vector < int > pot[200003] , ans; int N; ld mx;
int main(){
ios::sync_with_stdio(0); cin >> N;
for(int i = 1 ; i <= N ; ++i){int P , K; cin >> P >> K; pot[P].push_back(K);}
for(int i = 1 ; i <= min(N , 20) ; ++i){
static pair < ld , int > mxv[23... | ALGO | 0.999952 | 3.51513 |
f3c40a94-eda9-41bb-bd69-9cb579ef3b85 | LikimiaD/Training-Yandex-Algorithms-3.0 | 22.cpp | #include <iostream>
#include <vector>
int main() {
int n, k;
std::cin >> n >> k;
std::vector<long long> LIST(n + 1, 0);
LIST[1] = 1;
for (int i = 2; i <= n; i++) {
for (int j = 1; j <= k; j++) {
if (i - j >= 1) {
LIST[i] += LIST[i - j];
}
}
... | ALGO | 0.999964 | 4.182445 |
08e76664-ed1b-4c3e-b928-b3f8c0d3f2fb | manikanta2901/ubuntu | .history/practice/cpp/codeforces/StringLcm_20210115134136.cpp | #include <bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define trav(dataType,DataStruct,name) for(dataType<DataStruct>::itt ip = name.bb(); ip != name.ee(); ip++)
//Pre processors & typedefs
... | ALGO | 0.999915 | 4.362982 |
5068a008-adde-4d66-8050-589ff886f7e8 | mankotia412vishal/DSA-Conqueror | DSA 4th Year/Gfg POTD/Prajwal/23.cpp | #include <iostream>
#include <string>
#include <set>
using namespace std;
bool is_vowel(char c) {
return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
}
int solve(string S) {
int count = 0;
int n = S.length();
for (int i = 0; i < n; i++) {
for (int j = i; j < n; j++) {
... | ALGO | 0.999863 | 6.093735 |
474bce26-8c28-4d78-913d-b9a2c44ef816 | Kamrul785/XPSC- | Week 4/Day 1/A_Mainak_and_Array.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define fl float
#define faster ios::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
int main()
{
faster;
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n... | ALGO | 0.999878 | 4.272131 |
dd702cc5-a586-4072-93c9-957736f1bd42 | anisarambelieva/Data-Structures-and-Algorithms | 10-Graphs/Implementations/Kruskal.cpp | #include <iostream>
#include <list>
#include <vector>
#include <algorithm>
using namespace std;
struct Pair
{
int index;
int weight;
};
struct Node
{
list<Pair> neighbours;
bool hasNeighbour(int i)
{
for (auto n : neighbours)
{
if (n.index == i)
{
... | ALGO | 0.999983 | 5.038221 |
be3b2f62-34b5-4943-b819-c229c8d93b84 | rouholah/melting | ElmerGUI/netgen/libsrc/linalg/densemat.cpp | #include <mystdlib.h>
#include <linalg.hpp>
namespace netgen
{
DenseMatrix :: DenseMatrix ()
{
data = NULL;
height = 0;
width = 0;
}
DenseMatrix :: DenseMatrix (int h, int w)
{
if (!w) w = h;
width = w;
height = h;
if (h*w)
data = new double[h*w];
else
data = 0... | ALGO | 0.993875 | 3.563406 |
612f196d-4a01-4673-9e27-e6d168540818 | a7mddra/CompetitiveProgramming | Codeforces/Round 957 (Div. 3)/A.cpp | /*************************************************
https://codeforces.com/problemset/problem/1992/A
**************************************************/
#include "bits/stdc++.h"
using namespace std;
void solve()
{
int n[3];
cin >> n[0] >> n[1] >> n[2];
for (int i=0; i<5 ; i++) {
sort(n, n+3);
n[0]++;
}
... | ALGO | 0.999599 | 4.861367 |
2cf4f1a4-a496-4e24-aae9-5b83e190408b | TobiasRoikjer/PtDAlgorithms | examples/rabbit_construction_c.cpp | /*
* Clone or download the code, and include these files in the repository!
* Make SURE that the version of the downloaded code is the same as the
* installed R library!! Otherwise it may crash randomly.
*
* The path is currently ../ as we are in the same repository. This path
* should be something like [full or ... | ALGO | 0.999913 | 6.676875 |
7732b8bb-3da6-48da-a750-604bb11df6a8 | HaoCuii/DMOJ-Solutions | Back to School '19 Harambe.cpp | #include <iostream>
using namespace std;
int main(){
string s;
string t;
int k;
getline(cin,s);
getline(cin,t);
cin >> k;
int ans = 0;
for (int i = 0; i < s.length(); i++){
if ((s[i] == ' ' & t[i] != ' ') or (t[i] == ' ' & s[i] != ' ')){
cout << "No plagiarism";
... | ALGO | 0.999835 | 3.387836 |
4b5d177e-135e-45df-9d39-69f368b73579 | jancokOS/android_frameworks_av | media/libstagefright/codecs/m4v_h263/dec/src/get_pred_outside.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
xpos = x half-pixel of (x,y) coordinates within a VOP; motion
compensated coordinates; native data type
ypos = y half-pixel of (x,y) coordinates within a VOP; motion
co... | ALGO | 0.999719 | 6.728376 |
a31163aa-52db-4b59-a2fe-20590c2d68d1 | srikaran3004/Summer-PEP-25 | Day 1/cses1619.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int>s(n),e(n);
for(int i=0;i<n;i++){
cin>>s[i]>>e[i];
}
sort(s.begin(),s.end());
sort(e.begin(),e.end());
int pcnt=0,ans=0,x=0,y=0;
while(x<n){
if(s[x]<e[y]){
pcnt++;
... | ALGO | 0.999978 | 3.949093 |
685644b4-2176-4554-89c8-adcefd8f20e1 | YongqianGit/DataStructure_and_Algorithm | ConvertSortedArrayToBST.cpp | TreeNode* gen_BST (vector<int>& nums, int l, int r) {
if (l > r) return NULL;
int m = l + (r - l) / 2;
TreeNode* root = new TreeNode (nums[m]);
TreeNode* tr_l = gen_BST(nums, l, m - 1);
TreeNode* tr_r = gen_BST(nums, m + 1, r);
root->le... | ALGO | 0.999984 | 6.08819 |
00673e3d-bcd7-494a-97a4-15d5c7254536 | adoptium/aarch32-jdk8u_hg | hotspot/src/share/vm/services/diagnosticFramework.cpp | #include "precompiled.hpp"
#include "memory/oopFactory.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "services/diagnosticArgument.hpp"
#include "services/diagnosticFramework.hpp"
#include "services/management.hpp"
CmdLine::CmdLine(const char* line, size_t len, bool no_command_name) ... | TOOL | 0.914998 | 7.48927 |
36b85477-2962-4b6f-b902-0d05ba9e0fce | haagen/SP25_Spelutveckling_CPP | exercise03/excericise03/excericise03.cpp |
#include <iostream>
#include <random>
#include <Windows.h>
using namespace std;
int getRandom() {
// Konstanter för min och max till slumptals distribution
const int MIN = 1;
const int MAX = 10;
// Skapa en slumptals generator
random_device dev;
mt19937 rng(dev());
// Skapa en slump... | TOOL | 0.995463 | 3.612498 |
b2ea1888-d326-4ca5-bcdb-d23f708a02bf | likunjk/LeetCode | Find_Minimum_in_Rotated_Sorted_Array.cpp | class Solution {
public:
// 很简单的旋转数组,没有重复元素
int findMin(vector<int> &num)
{
int n = num.size();
int left = 0;
int right = n-1;
while(num[left] > num[right]) //这句话可以确保当前的[left, right]区间是有旋转的
{
int mid = (left+right)/2;
if(num[mid] >=... | ALGO | 0.999988 | 5.771132 |
7762b2b0-01cc-48bb-ac8f-b491c6c8fe44 | Lchuxian/SLAM-Environment | OpenCV3_and_OpenCV4_coexist/opencv-3.4.6-build/opencv_contrib-3.4.6/modules/ximgproc/samples/graphsegmentation_demo.cpp | #include "opencv2/ximgproc/segmentation.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace cv::ximgproc::segmentation;
Scalar hsv_to_rgb(Scalar);
Scalar color_mapping(int);
static void help() {
std::cout << std::e... | ALGO | 0.986134 | 5.966039 |
c7312809-ca71-4e68-8d0f-5d43bf683830 | Aman18111625/LeetCode-Solutions | 621-task-scheduler/621-task-scheduler.cpp | class Solution {
public:
int leastInterval(vector<char>& tasks, int n) {
int mpp[26];
memset(mpp,0,sizeof(mpp));
int cnt=0,res=0;
for(int i=0;i<tasks.size();i++) mpp[tasks[i]-'A']++;
for(int i=0;i<26;i++)
cnt=max(cnt,mpp[i]);
for(int i=0;i... | ALGO | 0.999992 | 6.786604 |
469b2673-0853-4212-9b89-9253a1865db5 | Shubham28/SPOJ | PARTY.cpp | #include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <set>
#include <numeric>
#define FOR(A,B,C) for(int A=B;A<C;A++)
#define EFOR(A,B,C) for(int A=B;A<=C;A++)
#define RFOR(A,B,C) for(int A=B;A>=C;A... | ALGO | 0.999785 | 3.507593 |
02b7fc9e-7d74-4f44-97aa-c2256950d768 | OctoGramApp/OctoGram | TMessagesProj/jni/third_party/openh264/src/codec/decoder/core/src/mv_pred.cpp | #include "mv_pred.h"
#include "ls_defines.h"
#include "mb_cache.h"
#include "parse_mb_syn_cabac.h"
namespace WelsDec {
static inline void SetRectBlock (void* vp, int32_t w, const int32_t h, int32_t stride, const uint32_t val,
const int32_t size) {
uint8_t* p = (uint8_t*)vp;
w *=... | ALGO | 0.99931 | 5.096836 |
f352a8a1-4cfd-4300-8656-e0ac8ceab335 | adarshgiri125/practiceQuestion_CPP | Easy/Nth Fibonacci Number/nth-fibonacci-number.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int M = 1e9 + 7;
long long int solve(vector<long long int> &dp,long long int n){
if(n <= 1) return n;
if(dp[n] ... | ALGO | 0.999956 | 6.288648 |
ac0d9d4c-56e8-4364-bad5-946f120c3f8d | shkwak-co/ESP32_Camera_Module_Test | components/openthread/openthread/src/core/thread/link_metrics_types.cpp | /**
* @file
* This file includes definitions for Thread Link Metrics.
*/
#include "link_metrics_types.hpp"
#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE || OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
#include "common/code_utils.hpp"
#include "mac/mac_frame.hpp"
namespace ot {
namespace LinkMetr... | TOOL | 0.881612 | 7.821663 |
af1f6019-9b27-4a5d-9270-d3030946ad7f | asahinobori/leetcode | Algorithms/21_Merge_Two_Sorted_Lists/mergeTwoLists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
if (l1 == nullptr) return l2;
if (l2 == nullptr) return l1;
... | ALGO | 0.999975 | 5.974746 |
b90fe6c8-e0ba-410d-af89-b2b2c521b5b9 | Yada0863/lab15 | lab15_5.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void shuffle(int *,int *, int *, int *);
int main(){
int a = 50, b = 100, c = 500, d = 1000;
srand(time(0));
for(int i = 0;i < 10;i++){
shuffle(&a,&b,&c,&d);
cout << a << " " << b << " " << c << " " << d << "\n";
}
retu... | ALGO | 0.996576 | 3.077221 |
04b656bf-9f25-434c-89d7-7a754e55dd36 | whynotdeep7/DSA-Solutions | 2216-delete-the-middle-node-of-a-linked-list/delete-the-middle-node-of-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* deleteMiddl... | ALGO | 0.999916 | 5.723848 |
f02a5b60-7203-4352-a2b7-654a404ac317 | divyanshusharma3031/leetcode | 0 - 1 Knapsack Problem - GFG/0-1-knapsack-problem.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return max value that can be put in knapsack of capacity W.
int solve(int W,int wt[],int val[],int n,vector<vector<int>> &dp)
{
if(W<0)
{
return... | ALGO | 0.999997 | 5.773904 |
88ae35d5-7dc5-4539-83e5-4dba87743b54 | asad-shuvo/ACM | Contest/Practice Contest - Number Theory/X.cpp | #include <bits/stdc++.h>
using namespace std;
#define mx 10000005
bool status[mx];
vector<int>prime;
void sieve()
{
int i, j, sqrtN;
for( i = 2; i <= mx; i++ ) status[i] = 0;
sqrtN = int( sqrt((double) mx )); // have to check primes up to (sqrt(N))
for( i = 3; i <= sqrtN; i += 2 ) {
if( status[i] == 0 ) {
// so, i is ... | ALGO | 0.997915 | 3.960673 |
fd3bf3f2-fab4-49d6-882d-c607a96b4864 | WesamMahgoub/Cpp | data structurs lab/main.cpp | #include <iostream>
using namespace std;
struct link
{
double data;
int row;
int column;
link* next;
};
class SMat
{
private:
link* first;
int counter;
public:
SMat(): first(NULL), counter(0)
{
}
SMat(double array[][3],int n)
{
first = NULL;
counter = 0;
... | ALGO | 0.979932 | 3.440912 |
4e4904df-431e-401a-8ff8-4d3106b1ef5b | Deepti675/Competitive_CB | Graph/Topological sortDFS.cpp | class solution{
public:
//Function to return list containing vertices in Topological order.
vector<int> topoSort(int V, vector<int> adj[])
{
// code here
queue<int>q;
vector<int>indegree(V,0);
for(int i=0;i<V;i++)
{
for(auto it:adj[i])
{
indegree[it]++;
... | ALGO | 0.999994 | 5.729794 |
a4249822-045b-4388-a0ae-66a50796eba2 | Takatochi/Hybrid-Cache-Library_CB | СS_LRU_WITH_MRU/main_example_using.cpp | #include "AdaptiveCache.hpp"
#include "LRU_Cache.hpp"
#include "MRU_Cache.hpp"
#include "ConcreteCacheStrategy.hpp"
int main() {
using namespace cache_library;
// Initialize caches and strategy
auto lruCache = std::make_shared<lru_cache>(5);
auto mruCache = std::make_shared<mru_cache>(5);
// TODO ... | TOOL | 0.952973 | 5.208542 |
2372bf46-852f-4cac-a21e-5ff31f7d0b6c | icelemon233/ECH-Leetcode | 单调栈/2866.美丽塔-ii.cpp | /*
* @lc app=leetcode.cn id=2866 lang=cpp
*
* [2866] 美丽塔 II
*/
// @lc code=start
#include <stack>
#include <vector>
using namespace std;
class Solution
{
public:
// 美丽塔一句话总结:
// 必须有一个峰顶,峰顶左右两侧必须单调向两边递减,且峰顶可以是最左边或最右边
// 图像解释:
// *
// * *
// * *
long long maximumSumOfHeights(vector<... | ALGO | 0.999953 | 6.032438 |
093a8afc-3c32-4940-833b-5199a4fe7229 | EEEEEatWhat/TARS-GO-sentry | src/navigation2/nav2_costmap_2d/plugins/inflation_layer.cpp | #include "nav2_costmap_2d/inflation_layer.hpp"
#include <limits>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include "nav2_costmap_2d/costmap_math.hpp"
#include "nav2_costmap_2d/footprint.hpp"
#include "pluginlib/class_list_macros.hpp"
#include "rclcpp/parameter_events_filter.hpp"
PLUGI... | TOOL | 0.943849 | 7.593248 |
573fd80a-f26c-4c16-8a69-2e0f8b9a5261 | solfrak/Render | ext/eigen/doc/examples/Tutorial_ArrayClass_accessors.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf m(2,2);
// assign some values coefficient by coefficient
m(0,0) = 1.0; m(0,1) = 2.0;
m(1,0) = 3.0; m(1,1) = m(0,1) + m(1,0);
// print values to standard output
cout << m << endl << endl;
... | ALGO | 0.975438 | 3.536336 |
c5d034b4-8d3b-4a06-9dde-bd4ab2de173e | anurag95/MyCodes | codechef/divgold.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define si(x) scanf("%d", &x);
#define sii(x,y) scanf("%d%d", &x, &y);
#define sll(x) scanf("%lld", &x);
#define pi(x) printf("%d\n", x);
#define pll(x) printf("%lld\n", x);
char str[53], res[53], temp[53], ch... | ALGO | 0.999997 | 3.561713 |
02760e1e-686c-41c7-bc3c-256d172fd5ee | Praveenanand333/IT-2nd-yr | OOPS-and-ADS/opover/complex.cpp | #include<iostream>
#include<math.h>
using namespace std;
class complex
{ double real,img;
public:
void read()
{
cout<<"\nEnter the REAL PART : ";
cin>>real;
cout<<"\nEnter the IMAGINARY PART : ";
cin>>img;
}
complex operator +(complex c2)
{
complex c3;
c3.real=real+c2.real;
c3.img=img+c2.img;
return c3;... | ALGO | 0.977353 | 3.691044 |
e0c47bef-5081-48fa-b32e-1884f5440d3d | ponderbb/cpp02383 | 01-helloworld/ex5.cpp | #include <iostream>
#include <vector>
using namespace std;
int printSum(int n)
{
vector<float> values;
float input;
float result;
if (n <= 0)
{
result = 0;
}
for (int i = 0; i < n; i = i + 1)
{
cin >> input;
result = result + input;
}
cout << result << e... | ALGO | 0.887567 | 3.710148 |
12ae309f-f51e-4911-8180-a888f841126c | yb23/HySCDG | src/arch/MambaCD/kernels/selective_scan/csrc/selective_scan/cusnrow/selective_scan_nrow.cpp | #include <ATen/cuda/CUDAContext.h>
#include <c10/cuda/CUDAGuard.h>
#include <torch/extension.h>
#include <vector>
#include "selective_scan.h"
#define MAX_DSTATE 256
#define CHECK_SHAPE(x, ...) TORCH_CHECK(x.sizes() == torch::IntArrayRef({__VA_ARGS__}), #x " must have shape (" #__VA_ARGS__ ")")
using weight_t = float;... | ALGO | 0.987541 | 6.159021 |
59ecafe1-47df-40be-b3d0-17b88b495651 | Porlain/Cpp-Primer | ch01/ex1_9.cpp | #include <iostream>
using namespace std;
int main()
{
int sum = 0;
int n = 50;
while (n < 100)
{
sum += n;
n++;
}
// if you want to use for rather than while, you can use the following code:
// int sum = 0;
// for (int i = 50; i <100;i++){
// sum += i;
// }
... | ALGO | 0.99566 | 3.08925 |
4e992a48-312f-4ff5-a00d-aad3cc0bc40f | morris821028/UVa | volume125/12534 - Binary Matrix 2[opt2].cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXV = 4096;
const int MAXE = MAXV * 200 * 2;
typedef struct Edge {
int v, cap, cost;
Edge *next, *re;
} Edge;
class MinCost {
public:
const int INF = 0x3f3f3f3f;
Edge edge[MAXE], *adj[MAXV], *arc[MAXV];
int e, n, st, ed;
int8_t inq[MAXV];
... | ALGO | 0.999946 | 4.568628 |
c23af520-5026-4124-aa9d-2b8832f9fd7e | changmu/StructureAndAlgorithm | HDOJ/1014.cpp | ////////////////////System Comment////////////////////
////Welcome to Hangzhou Dianzi University Online Judge
////http://acm.hdu.edu.cn
//////////////////////////////////////////////////////
////Username: changmu
////Nickname: ľ
////Run ID:
////Submit time: 2014-03-11 08:00:21
////Compiler: GUN C++
///////////////////... | ALGO | 0.998217 | 3.261632 |
ac0d995f-86ae-42bc-9f2d-0119af4f9845 | yonghaekim/AOS-llvm | llvm/lib/CodeGen/LiveRegMatrix.cpp | #include "llvm/CodeGen/LiveRegMatrix.h"
#include "RegisterCoalescer.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervalUnion.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#includ... | ALGO | 0.943934 | 7.650435 |
625ccd4c-e121-46c5-b285-ce46e29fcb9f | DreamChaser-luzeyu/NKDataTypeNew | Data-Structures-Algorithms-and-Applications-in-cpp-master/exercise solutions/codes/etraver.cpp |
// preorder traversal
// nonrecursive code
#include <iostream.h>
#include "lstack.h"
#include "btnode1.h"
#include "xcept.h"
template <class T>
void Visit(BinaryTreeNode<T> *x)
{// Visit node *x, just output data field.
cout << x->data << ' ';
}
template <class T>
void PreOrder(BinaryTreeNode<T> *t)
{// Preorder... | ALGO | 0.999995 | 5.321825 |
f53f607d-73c3-4754-9352-2ec2d68219bf | dhruvdabhi101/LeetCode | 28-implement-strstr/28-implement-strstr.cpp | class Solution {
public:
int strStr(string haystack, string needle) {
if(needle == ""){
return 0;
}
int n1= haystack.length();
int n2= needle.length();
for(int i=0;i<=n1-n2;i++){
int j;
for(j=0;j<n2;j++){
if(haystack[i+j] !=... | ALGO | 0.999887 | 5.657169 |
a9d0b42c-f013-4d25-bbf4-706204688f91 | apurba667/flutter_Signin_SignUP_Registration | firebasedemo/fireabsedemo/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.998462 | 6.785645 |
0fa7a65c-722f-4621-90aa-3dafa33b5282 | saurabhkurve/Daily-CPP-Practice | Week 3/Week 3.1/nine.cpp | // Write a program to print out all Armstrong numbers between 1 and 500. If the sum of cubes of
// each digit of the number is equal to the number itself, then the number is called an Armstrong
// number. For example, 153 = ( 1 * 1 * 1 ) + ( 5 * 5 * 5 ) + ( 3 * 3 * 3 )
// Output :
// 1
// 153
// 370
// 371
// 407
#... | ALGO | 0.99988 | 4.807873 |
44d2d365-3d40-46db-9e0b-6d8f98970ddc | myscale/faiss | faiss/MatrixStats.cpp | // -*- c++ -*-
#include <faiss/MatrixStats.h>
#include <stdarg.h> /* va_list, va_start, va_arg, va_end */
#include <faiss/utils/utils.h>
#include <cmath>
#include <cstdio>
namespace faiss {
/*********************************************************************
* MatrixStats
**************************************... | ALGO | 0.993082 | 7.723938 |
0cb0e5ee-adab-45a4-8088-5485d2d2c4ee | ksuperal/Flutter-Shoe-Shop | flutter_application_1/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.997883 | 6.76073 |
3b53c34c-78fe-4d86-a00d-079e7e6bc453 | shadab16/CodeChef | src/piggy_bank.cpp | #include <iostream>
#include <vector>
struct coin_t {
unsigned int value: 16;
unsigned int weight: 16;
};
int main() {
int cases = 0;
std::cin >> cases;
while (cases--) {
int empty, full, N, W;
std::cin >> empty >> full >> N;
W = full - empty;
std::vector<coin_t> coins(N);
for (int i = 0; i < N; ++i... | ALGO | 0.999688 | 4.070178 |
70ec41da-d9d9-475a-b19c-9ad9f038697c | Pranavdixit24/Binary-Trees | boundaryTraversal.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
... | ALGO | 0.999803 | 6.165473 |
d17e1bdf-6453-40cd-9925-f3634a54f012 | suchitnavghare13/C_Coding | day8/set_code_count_unique_by_vector.cpp | //{11,22,11,33,11,22,11,44,11,55,11,33,22,11,22,33}
//each element with it frequency
#include<iostream>
using namespace std;
#include<vector>
#include<set>
int main()
{
//vector has all data
vector<int> v={11,22,11,33,11,22,11,44,11,55,11,33,22,11,22,33};
//copy each element of vector to set
set<int> s;
for(in... | ALGO | 0.997958 | 3.980572 |
666c9379-9463-432d-8a30-c4812b47a52a | mehedihasan722/CSES-PROBLEM-SET | Subarray_Sums_I.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define PI 2*acos(0)
#define torad(x) (x)*((2*acos(0))/180.0)
#define eps 1e-15
#define PQ priority_que... | ALGO | 0.999951 | 5.050301 |
88df71c8-12f4-4d4c-a201-c5b4c89f2404 | IvorLipic/FunkyFilter | Source/PluginProcessor.cpp | #include "PluginProcessor.h"
#include "PluginEditor.h"
//==============================================================================
FunkyFilterAudioProcessor::FunkyFilterAudioProcessor()
#ifndef JucePlugin_PreferredChannelConfigurations
: AudioProcessor (BusesProperties()
#if ! JucePlugin... | TOOL | 0.932558 | 6.023592 |
4d13728e-322a-4a8b-a41e-cfd8650e3470 | Dolfinstein/Algorithm | Script/19_Remove_Nth_Node_From_End_of_List.cpp |
// 19_Remove_Nth_Node_From_End_of_List
#include <iostream>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std;
// Definition for a Node.
// Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x)... | ALGO | 0.999867 | 5.515999 |
447ef697-16ea-4ba1-b098-d9d29ba08c64 | ishandutta2007/codeforces | bidzilya/normal/633/B.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int m;
cin >> m;
int curPow2 = 0;
int curPow5 = 0;
vector<int> result;
for (int i = 1; ; ++i) {
int x = i;
while (x % 2 == 0) {
++cur... | ALGO | 0.99999 | 4.232904 |
fc9911b3-1860-46fa-abf2-01cb8cdb2dc7 | Bxiaoyu/CPlusPlusLearn | c++学习/模板/模板/01_函数模板语法.cpp | #include <iostream>
using namespace std;
// һģ
template<typename T>
void mySwap(T& a, T& b)
{
T temp = a;
a = b;
b = temp;
}
//int main()
//{
// int a = 10;
// int b = 20;
// // ַʽʹúģ
// // 1.ԶƵ
// mySwap(a, b);
// cout << "a = " << a << endl;
// cout << "b = " << b << endl;
//
// // 2.ʾָ
// int c = 20;
// int d ... | ALGO | 0.954083 | 3.043482 |
dcab6e1d-f9f2-433d-8a5f-5148d98fafd7 | cheryllyt/orca-sketch | cms-simd/ORCAS.cpp | #include "ORCAS.hpp"
#include "Defs.hpp"
using namespace std;
template<int number_of_options_ind>
ORCASketch<number_of_options_ind>::ORCASketch()
{
}
template<int number_of_options_ind>
ORCASketch<number_of_options_ind>::~ORCASketch()
{
delete[] array_counter_vec_lookup_table;
delete[] array_counter_ind_loo... | ALGO | 0.913227 | 5.49601 |
4c9d8469-6dc4-4768-863a-ed36efb8a005 | LSQsjtu/lsqlsq | oj/4117.cpp | #include <iostream>
#include <cstdio>
using namespace std;
const int MAXN = 100001;
typedef long long ll;
ll a[MAXN], ans[4 * MAXN], tag[4 * MAXN];
inline int ls(int p)
{
return p << 1;
}
inline int rs(int p)
{
return p << 1 | 1;
}
inline void push_up(int p)
{
ans[p] = ans[ls(p)] + ans[rs(p)];
}
void bui... | ALGO | 0.999704 | 3.834619 |
cf869b32-0c9e-484a-9c7f-bc7817189ff6 | shwilks/rmarchingcubes | src/MarchingCubes.cpp | /**
* @file MarchingCubes.cpp
* @author Thomas Lewiner <<EMAIL>>
* @author Math Dept, PUC-Rio
* @version 0.2
* @date 12/08/2002
*
* @brief MarchingCubes Algorithm with modifications by Samuel H. Wilks <<EMAIL>>
*/
//________________________________________________
#include <math.h>
#include <time.h>
... | ALGO | 0.998117 | 4.979794 |
69e097cc-aed2-4db1-a12c-ab2464ba9c5c | KaranTalreja/LeetCode | src/game-of-life/solution.cpp | class Solution {
public:
void gameOfLife(vector<vector<int>>& board) {
int arr[][2] = {{-1,-1}, // top left
{-1, 0}, // left
{-1, 1}, // bottom left
{ 0, 1}, // bottom
{ 1, 1}, // bottom right
{ 1, 0}, // right
{ 1,-1}, // top right
{ 0,-1}};// top
... | ALGO | 0.999933 | 6.422199 |
7afb84a5-eac1-46fa-a359-f084d198a35d | pm306/procon | ABC/148/F.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<long long, long long>;
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
constexpr long long INF = 1000000000 + 100;
constexpr long long LINF = 1000000000000000000 + 100;
#define al... | ALGO | 0.999817 | 5.04755 |
59d95e52-3dda-4568-98e3-9749b7596ae5 | CollegicoinCLG/collegicoin | src/rpcnet.cpp | #include "rpcserver.h"
#include "clientversion.h"
#include "main.h"
#include "net.h"
#include "netbase.h"
#include "protocol.h"
#include "sync.h"
#include "timedata.h"
#include "util.h"
#include "version.h"
#include <boost/foreach.hpp>
#include <univalue.h>
using namespace std;
UniValue getconnectioncount(const Un... | WEB | 0.933841 | 5.952229 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.