uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
47203190-29ad-4553-a9ac-2b896db15209 | KrKush23/LeetCode | Binary Search/Search in Rotated Sorted Array(Finding Pivot First).cpp | // Here, we find the pivot, and then apply two binary searches.
// One to the left of the pivot and one to it's right
class Solution {
public:
int binarySearch(vector<int> &arr, int low, int high, int key){
if (high < low)
return -1;
int mid = (low + high)/2; /*low + (high - low)/2;*/... | ALGO | 0.999996 | 5.841971 |
f684c6bb-a969-4491-891a-6f06899f67ed | shuyeb00/XPSC_tasks | Week_6/day_1/C_Sum_of_Cubes.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define code() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int mx = 1e4;
bool check(vector<ll>&v, ll x)
{
int l=0,r=v.size()-1;
while(l<=r)
{
int mid = l+(r-l)/2;
if(v[mid] == x) return true;
else if(v[mid... | ALGO | 0.999266 | 4.685018 |
ae05deaf-cb5c-497f-8c06-d171376cda46 | niqta/niqta | week-8/src/fibonacci.cpp | #include "fibonacci.hpp"
#include "logger.hpp"
#include <ctime>
#include <iostream>
// Глобальный кеш для оптимизированной версии
std::map<int, long long> cache;
long long classic(int n) {
if (n <= 1) return n;
return classic(n - 1) + classic(n - 2);
}
long long optimized(int n) {
if (n <= 1) return n;
... | ALGO | 0.999543 | 7.121668 |
834ad437-3fe1-4e37-8a23-f901669da0ec | gunn333/CODE-CHALLENGES- | 100 Days Code/DAY 20/Find_Duplicate.cpp | //! Find The Duplicate number in an array (LeetCode 287)
// Question Link:
// https://leetcode.com/problems/find-the-duplicate-number/submissions/1174203253/?envType=daily-question&envId=2024-02-13
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int findDuplicate(vector<int> &nums) {... | ALGO | 0.999136 | 5.995427 |
79b707cb-0f28-4e1b-817d-c829cda977e1 | abhishek751982/dsa-LeetCode-GFG | 1457-pseudo-palindromic-paths-in-a-binary-tree/1457-pseudo-palindromic-paths-in-a-binary-tree.cpp | class Solution {
public:
int ans = 0;
void solve(TreeNode* root, vector<int>& count) {
if(root == NULL) {
return;
}
count[root->val]++;
if(root->left == NULL && root->right == NULL) { //leaf node
int oddFreq = 0;
for(int i = 1; i <= 9; i++) ... | ALGO | 0.999467 | 5.775971 |
52accb57-f5fa-4bf9-bbc5-b1b79be86271 | AlexandruValeanu/Competitive-Programming | Codechef/A String Game.cpp | #include <bits/stdc++.h>
#define VI vector<int>
#define VII vector<pair<int,int>>
#define QI queue<int>
#define ms(a,v) memset( a, v, sizeof( a ) )
#define FOR(i,a,b) for(int i = a; i <= b; ++i)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define foreach(v, c) for( typeof( (c).begin() ) v = (c).begin(); v != (c).e... | ALGO | 0.999868 | 5.047605 |
5dc1b4bc-37c2-4afb-bd24-f5baa9683b23 | baayerische/Labs_PSTU_2024 | Sem_2/sorting/Shell.cpp | #include <iostream>
using namespace std;
void shellSort(int arr[], int n)
{
for (int h = n / 2; h >= 1; h /= 2)
{
for (int i = h; i < n; i++)
{
int key = arr[i];
int j;
for (j = i; j >= h && arr[j - h] > key; j -= h)
{
arr[j] = arr[j - h];
}
arr[j] = key;
}
}
}
int main()
{
setlocal... | ALGO | 0.999959 | 4.273932 |
1ee206cd-e61e-4265-b82e-6f1c5d625b74 | SaurabhKaperwan/Placement-Class | Graph/01BFS.cpp | /* If weight of all edges is 0 or 1 then we can find shortest distance from source node to all other nodes*/
//TC : O(V+E)
#include <bits/stdc++.h>
using namespace std;
void insertEdge(vector <pair<int,int>> adj[], int u, int v,int w)
{
adj[u].push_back({v,w});
adj[v].push_back({u,w});
}
vector<int> zeroOneB... | ALGO | 0.999951 | 4.971823 |
9c29e064-ad5d-4cb1-8fd2-d972769079b4 | coin-or/CoinUtils | src/CoinSearchTree.cpp | #include <cstdio>
#include "CoinSearchTree.hpp"
BitVector128::BitVector128()
{
bits_[0] = 0;
bits_[1] = 0;
bits_[2] = 0;
bits_[3] = 0;
}
BitVector128::BitVector128(unsigned int bits[4])
{
set(bits);
}
void BitVector128::set(unsigned int bits[4])
{
bits_[0] = bits[0];
bits_[1] = bits[1];
bits_[2] = bi... | ALGO | 0.999765 | 5.722425 |
867a357c-c918-4497-9519-23890918a612 | saurav6719/my-codes | c++ dsa /playing with maths/hcf.cpp | #include<iostream>
using namespace std;
int hcf(int num1,int num2){ //num1 > num2
while(num2 != 0){
int temp = num2;
num2 = num1 % num2;
num1 = temp;
}
return num1;
}
int main(){
int n1,n2;
cin>>n1>>n2;
cout<<hcf(n1,n2); // n1>n2
return 0;
} | ALGO | 0.999867 | 3.848732 |
5952e529-73b8-4a93-bc22-6398c780e287 | jiaye-W/pcsc | lectures/week8/code_snippets/eigen/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp | #include <iostream>
#include <Eigen/Dense>
int main()
{
Eigen::Matrix3f A;
Eigen::Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
std::cout << "Here is the matrix A:\n" << A << std::endl;
std::cout << "Here is the vector b:\n" << b << std::endl;
Eigen::Vector3f x = A.colPivHouseholderQr().s... | ALGO | 0.999883 | 3.376862 |
b1d86346-59c3-4353-af1d-72b7fe9f7b84 | merlinepedra/MERLIN | tools/WORLD_v2/src/stonemask.cpp | #include <math.h>
#include "world/common.h"
#include "world/constantnumbers.h"
#include "world/fft.h"
#include "world/matlabfunctions.h"
namespace {
//-----------------------------------------------------------------------------
// GetIndexRaw() calculates the temporal positions for windowing.
// Since the result in... | ALGO | 0.999048 | 5.997841 |
14d9cbeb-03b9-440b-af59-a5edc64443c0 | manji369/Object-detection-using-Spatial-Pyramid-Matching | SIFT/SIFT.cpp | #include <string>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "opencv2/core.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/xfeatures2d.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/xfeatures2d/nonfree.hpp"
#include <sstream>
#include <cmath>
using namespace cv;
using namespace ... | DATA | 0.943861 | 4.952591 |
4e26f189-3e08-4be3-b602-83c25ad40aad | gAbelli/NeetCode-solutions | Two Sum.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
class Solution {
public:
std::vector<int> twoSum(std::vector<int> &nums, int target) {
std::unordered_map<int, int> pos;
int n = nums.size();
for (int i = 0; i < n; ++i) {
int diff = target - nums[i];
i... | ALGO | 0.999732 | 6.224472 |
f21af608-267e-4b03-90a8-83d585bddcf5 | nach131/CPP_C5 | Module_09/ex01/prueba/one.cpp | #include <iostream>
#include <stack>
#include <sstream>
#include <string>
#include <cstdlib> // Para la función atoi
bool isOperator(const std::string &token)
{
return token == "+" || token == "-" || token == "*" || token == "/";
}
int calculateRPN(const std::string &expression)
{
std::istringstream iss(expression)... | ALGO | 0.9998 | 6.097211 |
dd88b0bc-a350-4c02-ad14-12cba28a3bb6 | matcha-bingsu/ALGORITHM | solved.ac/1978.cpp | // https://www.acmicpc.net/problem/1978 (소수 찾기)
#include <bits/stdc++.h>
using namespace std;
int arr[101];
int cnt, n;
int is_sosu(int n)
{
if (n == 1)
return (0);
for (int i = 2; i < n; i++)
if (n % i == 0)
return (0);
return (1);
}
int main(void)
{
cin.tie(0);
i... | ALGO | 0.999907 | 4.499617 |
ba3a91a7-7644-4fc3-86d0-f48cb072d2c1 | z3rxy/LeetCode | Easy/Task_2235.cpp | class Solution {
public:
int sum(int num1, int num2) {
return num1 + num2;
}
}; | ALGO | 0.995544 | 5.667081 |
59e9c6fd-51e6-483b-967f-e194f122c60d | JNXSTJ/games202_ | Assignment2/prt/ext/eigen/unsupported/doc/examples/PolynomialUtils1.cpp | #include <unsupported/Eigen/Polynomials>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
Vector4d roots = Vector4d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,5,1> polynomial;
roots_to_monicPolynomial( roots, polynomial );
cout << "Polynomial:... | ALGO | 0.997276 | 4.015535 |
000a5002-d013-41d2-a240-37b3e465aa54 | MrBents/vroom | src/problems/vrptw/operators/relocate.cpp | #include "problems/vrptw/operators/relocate.h"
namespace vroom {
namespace vrptw {
Relocate::Relocate(const Input& input,
const utils::SolutionState& sol_state,
TWRoute& tw_s_route,
Index s_vehicle,
Index s_rank,
TWRoute& t... | TOOL | 0.87033 | 6.457054 |
1fcd7731-7117-4eb1-a378-dbaab5b384b5 | stamcenter/llvm-zeno | clang-tools-extra/clang-doc/Representation.cpp | namespace clang {
namespace doc {
namespace {
const SymbolID EmptySID = SymbolID();
template <typename T>
llvm::Expected<std::unique_ptr<Info>>
reduce(std::vector<std::unique_ptr<Info>> &Values) {
if (Values.empty())
return llvm::createStringError(llvm::inconvertibleErrorCode(),
... | TOOL | 0.956527 | 7.603121 |
c4c70fe3-02d4-4641-9945-6247bfe3d2d5 | Kamal6495/Leetcode_Solution | 0001-two-sum/0001-two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
map<int,int> mp;
for(int i=0;i<nums.size();i++){
int fin=target-nums[i];
if(mp.find(fin)!=mp.end())
return {mp[fin],i};
mp[nums[i]]=i;
}
vector<int> res;
... | ALGO | 0.99981 | 6.08103 |
e7e9b05a-b525-4869-b164-489ea5e31dcb | AlaminPu1007/leet-code | Leet-Code/467. Find All People With Secret/2092_Find_All_People_With_Secret.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<int> findAllPeople(int n, vector<vector<int>> &meetings, int firstPerson)
{
// define a unordered_map to hold the unordered as a graph
// it will hold {current_node, {connected_node, time}} vice-versa
unorder... | ALGO | 0.999996 | 5.386976 |
f8157c15-38f4-46af-9cc5-eaa1a0d31a13 | Maltysen/trd | code/geometry/in_hull.cpp | // O(lg(n)) check if point is in convex hull
bool in_hull(pt p, pair<vector<pt>, vector<pt>>& h) {
// change to true if border counts as inside
if(Z(p - *h.first.begin()) || Z(p - *h.second.begin())) return false;
if(p < *h.first.begin() || *h.second.begin() < p) return false;
auto u = upper_bound(all(h.first), ... | ALGO | 0.999777 | 4.877739 |
f2c059f7-220a-4377-9feb-e54bf9fea76c | codingNoob12/algorithm-study | cpp/백준/2023-11-05/10815_1.cpp | #include <bits/stdc++.h>
using namespace std;
const int MX = 10000000;
bool cards[2 * MX + 1];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m, x;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
cards[x + MX] = true;
}
cin >> m;
for (int i = 0; i < m; i++) ... | ALGO | 0.999927 | 4.322606 |
4cabf78e-db12-48d6-8cd0-7906516ce186 | ddangu525/AlgorithmStudy | study_algo_gangnam/박상우/CPP/DataStructure/종만북/chapter 18 조세푸스.cpp | // 종만북 chapter 18 조세퍼스 문제
#include <iostream>
#include <list>
using namespace std;
void josephus(int n, int k) {
list<int> survivors;
for (int i = 1; i <= n; i++) survivors.push_back(i);
list<int>::iterator kill = survivors.begin();
while (n > 2) {
kill = survivors.erase(kill);
if (ki... | ALGO | 0.99995 | 4.157176 |
44033162-d990-45c9-9c4b-1a7d921dbb43 | TUTvision/Online-Panoptic-3D | dlib/tools/imglab/src/flip_dataset.cpp | #include "flip_dataset.h"
#include <dlib/data_io.h>
#include <dlib/dir_nav.h>
#include <string>
#include "common.h"
#include <dlib/image_transforms.h>
#include <dlib/optimization.h>
#include <dlib/image_processing.h>
using namespace dlib;
using namespace std;
// -------------------------------------------------------... | DATA | 0.956233 | 6.886369 |
b155b488-d0e9-47f4-93b9-717c3699690c | Misiulavlad/L52Solution | Project04/logic.cpp | #include <iostream>
bool is_digit_of_first_number_equals_or_bigger_than_second(int num1, int num2) {
num1 = abs(num1);
num2 = abs(num2);
if (num1 < 10 && num2 < 10) {
return (num1 >= num2 ? true : false);
}
num1 /= 10;
num2 -= (num1 % 10);
is_digit_of_first_number_equals_or_bigger_than_second(num1, num2);
... | ALGO | 0.999242 | 4.05082 |
1050eca1-e65e-4eaf-a70f-ea9a8c7246c6 | sarvex/leetcode-clojure | lcof/面试题39. 数组中出现次数超过一半的数字/Solution.cpp | class Solution {
public:
int majorityElement(vector<int>& nums) {
int cnt = 0, m = 0;
for (int& v : nums) {
if (cnt == 0) {
m = v;
cnt = 1;
} else
cnt += (m == v ? 1 : -1);
}
return m;
}
}; | ALGO | 0.999893 | 5.687389 |
b3ca04ce-e3ae-4e84-be9e-f6649b45185a | PeterJSims/DeitelCPP | src/ch3/checkpoints/cp3_10_3.cpp | #include <iostream>
using namespace std;
int main() {
int remaining{3};
int num{0};
while (remaining > 0) {
cout << "Input an integer: ";
cin >> num;
if(num % 2 == 0) {
cout << "Even!\n";
} else {
cout << "Odd!\n";
}
--remaining;
}
return 0;
} | ALGO | 0.990876 | 4.544027 |
2d600685-7ed9-4086-983f-7c3d8c625adc | yoosofan/oss991 | src/ps/mutual_exclusion_by_message.cpp | /* program mutualexclusion */
/* const int n = number of process */
mailbox box;
void P(int i){
message msg;
while (true) {
receive (box, msg);
/* critical section */;
send (box, msg);
/* remainder */;
}
}
void main()
{
send(box, null);
cobegin{P(1); P(2);… ; P(n);}
}
| ALGO | 0.999865 | 4.192409 |
3eab9702-1b3e-4a38-ae5f-45af830cde1f | Joonking/Study_CodingTest | Study_CodingTest/BaekJoon/알고리즘분류/DFS, BFS/18352_특정거리의도시찾기.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
void BFS(const vector<vector<int>>& List, vector<bool>& VisitedList, int StartNode, int Distance)
{
vector<int> Ans;
queue<pair<int, int>> Queue; //노드, 깊이
Queue.push({ StartNode,0 });
VisitedList[StartNode] = true;
... | ALGO | 0.999954 | 4.313279 |
c5689737-13f9-4556-a6cf-fc41ca52d163 | zztiswb116/LLHP | tools/clang/lib/Frontend/DiagnosticRenderer.cpp | #include "clang/Frontend/DiagnosticRenderer.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Edit/Commit.h"
#include "clang/Edit/EditedSource.h"
#include "clang/Edit/EditsReceiver.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallS... | TOOL | 0.931038 | 7.855083 |
905fe015-e36a-4da9-a756-a9fba3e43722 | pavnvar/algo-toolbox | solutions/week2_algorithmic_warmup/7_last_digit_of_the_sum_of_fibonacci_numbers_again/fibonacci_partial_sum.cpp | #include <iostream>
#include <vector>
using std::vector;
long long get_fibonacci_partial_sum_naive(long long from, long long to) {
long long sum = 0;
long long current = 0;
long long next = 1;
for (long long i = 0; i <= to; ++i) {
if (i >= from) {
sum += current;
}
... | ALGO | 0.999949 | 4.840507 |
32a1761a-c3c1-4c88-b639-7a1146c3c3ae | JoelVStan/Calcluator-App-Flutter | 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.998833 | 6.788787 |
82fd8588-9b06-4eb9-9430-7211a1138da6 | JiaheZhi/oceanbase-2023 | src/sql/engine/expr/ob_expr_minus.cpp | #define USING_LOG_PREFIX SQL_ENG
#include "sql/engine/expr/ob_expr_minus.h"
#include "lib/oblog/ob_log.h"
#include "lib/utility/ob_macro_utils.h"
#include "sql/engine/expr/ob_expr_result_type_util.h"
#include "sql/ob_sql_utils.h"
#include "sql/session/ob_sql_session_info.h"
#include "sql/engine/ob_exec_context.h"
#inc... | ALGO | 0.890215 | 7.506312 |
68c221f1-8325-46e5-8c71-306b2e365f4c | cliarie/grind25 | leetcode/735.asteroid-collision-stack-directional.cpp | #include <stack>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> asteroidCollision(vector<int>& asteroids) {
stack<int> ast;
int n = asteroids.size();
for (auto &a : asteroids){
if (!ast.empty() && a < 0 && ast.top() > 0){
int greater =... | ALGO | 0.999986 | 5.755333 |
15fb20f4-2cbe-40bf-92a6-0f1cc6d84ca9 | abrhamkg/point2mesh | Manifold/Manifold/3rd/igl/grid_search.cpp | #include "grid_search.h"
#include <iostream>
#include <cassert>
template <
typename Scalar,
typename DerivedX,
typename DerivedLB,
typename DerivedUB,
typename DerivedI>
IGL_INLINE Scalar igl::grid_search(
const std::function< Scalar (DerivedX &) > f,
const Eigen::MatrixBase<DerivedLB> & LB,
const ... | ALGO | 0.999925 | 5.85154 |
8d5b6fac-1949-4329-8d56-bae3fc3ed07b | ml-5/homework | acwing/高精度加法.cpp | /*
ر
Ѵתȥÿһλһλ֣λǰڽλȥ
*/
#include<vector>
#include<iostream>
using namespace std;
vector<int> add(vector<int>&A,vector<int>&B)
{
if(A.size()<B.size()) return add(B,A);
vector<int>C;//
int t=0;
for(int i=0;i<A.size();i++)
{
t+=A[i];
if(i<B.size())t+=B[i];
C.push_back(t%10);
... | ALGO | 0.999982 | 4.11373 |
d7f3b69c-e8dd-4b2e-aa78-96f23d276548 | dangduongcoder/PTIT-Code | c++/CPP0501.cpp | //Duong
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int MOD = 1e9 + 7;
const ll INF = 1e18;
struct Point{
double x, y;
};
void input(struct Point &A) {
cin >> A.x >> A.y;
}
double distance(struct Point &A, str... | ALGO | 0.999275 | 4.253083 |
2ca4b0a5-6123-47b6-b55d-d2ecdc56397d | bose045/lammps | fix_restrain.cpp | /* ----------------------------------------------------------------------
Contributing author: Craig Tenney (University of Notre Dame)
support for bond and angle restraints by Andres Jaramillo-Botero (Caltech)
------------------------------------------------------------------------- */
#include "fix_restrain.h... | ALGO | 0.995467 | 5.871323 |
2341f599-cb6a-4313-9ba2-0fb8dd025676 | Rajeshnds/Competitive-Programming | codeforces/dragonmas/codeforces(c++)_old/Nearly_lucky_number.cpp | #include<iostream>
using namespace std;
int main(){
int k=0;
string s;
cin>>s;
for(int i=0;i<s.size();i++)
if(s[i]=='4'||s[i]=='7')
k++;
cout<<(k==4||k==7?"YES":"NO");
return 0;
}
| ALGO | 0.999204 | 3.347679 |
98c16685-11d1-4a62-86e8-8987e1a46862 | RecoderChris/FrontOrder | baseline/gorder/main.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <functional>
#include <climits>
#include <ctime>
#include <stdlib.h>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <chrono>
#include "Graph.h"
#include "Util.h"
us... | ALGO | 0.997908 | 4.083112 |
3f8d4b16-3e2d-4f7e-9dea-c50810e111c4 | 1184022880com/epibole | 10_(10.27)决策树/Assignment2/opencv-master/modules/core/src/batch_distance.cpp | #include "precomp.hpp"
#include "stat.hpp"
#include <opencv2/core/hal/hal.hpp>
namespace cv
{
template<typename _Tp, typename _Rt>
void batchDistL1_(const _Tp* src1, const _Tp* src2, size_t step2,
int nvecs, int len, _Rt* dist, const uchar* mask)
{
step2 /= sizeof(src2[0]);
if( !mask )
{... | ALGO | 0.999165 | 7.25598 |
7b1d703a-eb0d-405f-bb3c-daa839153bd9 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_8082_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
ios::sync_with_stdio(0);
cin.tie(0);
long long e = 0, o = 0, a, n;
cin >> n;
while (n--) {
cin >> a;
if ((a & 1) == 1) {
o += 1;
} else {
e += 1;
}
}
if (e >= o) {
cout << o;
} else {
... | ALGO | 0.999981 | 4.130866 |
c07feee7-3ea8-49ae-b660-8727dcb3829f | shiva92/Contests | UVA/Map/10295_Haypoints.cpp | #include <iostream>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <set>
#include <climits>
#include <cstdio>
#include <string>
#include <map>
#include <unordered_map>
using namespace std;
char str[100];
int mai... | ALGO | 0.993115 | 3.742845 |
3a6f8b68-1162-405b-bff8-3d1b0aef39a0 | arsbars24/C-homework | stack, queue/stack, queue/sort.cpp | #include "node.h"
void SortBox(Ptr Root, int n) {
int c = 0;
Ptr temp = Root;
Ptr fnode = Root;
Ptr snode = Root->link; //first and second nodes
while (c != n * n) { //
if (fnode->num > snode->num) {
temp->link= snode->link;
snode->link = fnode->link;
fnode->link = temp->link;
}
fn... | ALGO | 0.999955 | 3.041334 |
0dd8db59-7668-4f1c-a778-3b2a2eebbc1d | salah-sorour-dev/Stone-Paper-Scissor-Game | Stone-Paper-Scissor Game Solution/Stone-Paper-Scissor Game Solution.cpp | // Stone-Paper-Scissor Game Solution.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
enum enGameChoice { Stone = 1, Paper = 2, Scissor = 3 };
enum enWinner { Player1 = 1, Computer ... | TOOL | 0.979257 | 3.64798 |
fe90d4ff-542f-4c74-b9d8-14d191a0ed4a | Sookmyung-Algos/2023algos | algos_assignment/최예헌_honi/week1/3020.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define MAX 10002
#define INF 987654321
int main(){
cin.tie(0); cout.tie(0);
ios::sync_with_stdio(false);
int n, h, x;
vector <int> b... | ALGO | 0.999948 | 3.79061 |
9a4894e4-d03e-4ae9-a519-41df224ff5e0 | bfdyoy/CodeForces | 1000Dif/465B/main.cpp | #include<iostream>
#include <vector>
using namespace std;
int main()
{
int x, count = 0, i = 0;;
cin >> x;
vector <int> v(x + 1);
for(i=0; i<x; i++)
{
cin >> v[i];
}
for(i=0; i<x; i++)
{
if (v[i] == 1)
{
count++;
}
else if (v[i] == 0 &... | ALGO | 0.999987 | 3.988824 |
e2251a3f-a564-434b-ab76-b0a61a9d2846 | michalBilitzky1/reversi | src/PlayerHuman.cpp | #include "PlayerHuman.h"
PlayerHuman::PlayerHuman(Board &board):board(&board){
};
int PlayerHuman::playOneTurn(char player,Player player1, Steps steps, int flag){
bool choice;
Piece piece(0, 0);
player1.printWhoQueue(player);
steps.optionsToLocate(player);
int ans = steps.printOptions();
if (a... | ALGO | 0.859558 | 3.199208 |
cc89c8f5-442f-4e5f-a605-cf5d82524247 | harsh-quare/LeetRoad | 1063-best-sightseeing-pair/1063-best-sightseeing-pair.cpp | class Solution {
public:
int maxScoreSightseeingPair(vector<int>& values) {
int prevMax = values[0] + 0; //v[i] + i
int maxi = INT_MIN;
for(int j = 1; j < values.size(); j++){
maxi = max(maxi, prevMax + values[j] - j);
if(values[j] + j > prevMax){
pr... | ALGO | 0.999984 | 6.299339 |
8deba681-51e0-4d4c-aa47-0bc839025a9f | PhuongQuyen0908/NMLT | UIT_23521327/Bai002/Bai_002.cpp | #define _USE_MATH_DEFINES
#include<iostream>
using namespace std;
float Dientich(float);
int main()
{
float r;
cout << "Nhap ban kinh r: ";
cin >> r;
float s = Dientich(r);
cout << s;
return 0;
}
float Dientich(float rr)
{
float S;
S= (M_PI)*rr * rr;
return S;
}
| ALGO | 0.997554 | 3.551252 |
228538c3-0fa4-40f8-a12b-ba86c9fec83d | ishandutta2007/codeforces | riverwalk7/normal/748/D.cpp | #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
using namespace std;
#define MAXN 100100
map<string, vector<int> > m;
map<string, int> vis;
string input[MAXN];
string input2[MAXN];
int N, K;
int x;
int ans;
int b1, b2;
bool comp(int a, int b)
{
return a... | ALGO | 0.999898 | 3.806668 |
fa81c15b-ef72-43d9-ab4e-c8a2ee4cb7d9 | joaquinbian/memoria-dinamica-c- | ejercicio2/ejercicio2.cpp | #include <iostream>
using namespace std;
/*
Crear un programa que contenga un menú con las siguientes opciones:
1- Cargar Vector: El programa debe solicitar al usuario la cantidad de elementos que va a cargar,
posteriormente se solicitara cuales son dichos números para almacenarlos en un vector utilizando asignación... | TOOL | 0.909767 | 3.545298 |
9cbdfcf4-e2f9-4625-b275-c3869eff083a | ankur-vishwakarma/DSA | CODEFORCES/Simple Polygon Embedding_c.cpp | #include<bits/stdc++.h>
using namespace std;
main(){
int t;
cin>>t;
while(t--){
float n;
cin>>n;
cout << std::fixed;
cout<<setprecision(9)<<1/tan((90/n)*(2*acos(0.0) / 180))<<endl;
}
}
| ALGO | 0.997638 | 3.524305 |
05664715-6b81-4f50-b4fc-b63089d216c9 | terajh/algorithm-study | baekjoon/sol/2581_소수.cpp | #include <iostream>
#include <algorithm>
using namespace std;
bool check[10001];
bool prime[10001];
int main() {
int a, b;
cin >> a >> b;
for(int i=2 ; i<=b ; i++) {
if(check[i]) continue;
prime[i] = true;
for(int j=i+i ; j<=b ; j+= i) {
check[j] = true;
}
... | ALGO | 0.999958 | 4.347821 |
5e54c6d5-32db-4bd4-86c4-ec6174237a33 | devjwsong/algorithm-study | leetcode/454.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
class Solution {
public:
int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4) {
int n = nums1.size();
unordered_map<int, int> sums;
for (int i=0; i<n; ++... | ALGO | 0.999835 | 5.359479 |
8d327c4d-fea5-4bf4-bd3a-444387ca2b2e | Avacato/CPP_COURSE_RD_WH | HW10/2_RegFunc.cpp | bool calculateSum(const double* arr, int arrSize, double& sum) {
sum = 0.0;
if (arrSize > 0) {
for (int i = 0; i < arrSize; i++) {
sum += arr[i];
}
return true;
}
return false;
} | TOOL | 0.968598 | 5.618824 |
30c6c54a-5722-4199-ab54-e37dfa12d9c9 | hasancse91/UVaProblems | UVa 11946 - Code Number.cpp | #include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main()
{
int i,j,tCase;
string text;
cin>>tCase;
getchar();
for(j=1; j<=tCase; j++)
{
while(getline(cin,text))
{
if(text=="")
break;
for(i=0; i<text.size(); i++... | ALGO | 0.966657 | 3.591352 |
36556398-41ff-48e7-b6ea-ba805bcce0f6 | i12cu84/Unreal_Engine_Develop_Notes | content/cpp/算法/二叉空间划分BSP-Tree-Cpp.cpp | #include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
// 定义一个矩形数据结构
struct Rectangle {
int x, y, width, height;
Rectangle(int x, int y, int width, int height) : x(x), y(y), width(width), height(height) {}
};
// 定义一个节点数据结构,包括矩形和子节点
struct BSPTreeNode {
Rectangle rect;
BSPTreeNode* ... | ALGO | 0.999588 | 5.491487 |
568c3cf8-9c25-4541-9145-17049bd6039e | proghead00/LeetcodeGrind | 2095-delete-the-middle-node-of-a-linked-list/2095-delete-the-middle-node-of-a-linked-list.cpp | class Solution {
public:
ListNode* deleteMiddle(ListNode* head) {
if (!head->next) return NULL;
ListNode* s = head; ListNode* f = head->next->next;
while (f and f->next) {
f = f->next->next;
s = s->next;
}
s->next = s->next->next;
return hea... | ALGO | 0.999843 | 6.01417 |
91bec5da-648f-4dea-afa2-f808a6acd6dc | LyongJ/12345 | modules/core/src/matrix_expressions.cpp | /* ////////////////////////////////////////////////////////////////////
//
// Mat basic operations: Copy, Set
//
// */
#include "precomp.hpp"
#include <opencv2/core/utils/logger.hpp>
namespace cv
{
//This and its overload below are used in various MatExpr operator overloads
//implemented to check that Matrix operan... | TOOL | 0.929084 | 7.362061 |
01bf0cf0-7f3e-4c81-96fb-d27ab2581ab0 | CodeHarshh/DSA-Leetcode | 0539-minimum-time-difference/0539-minimum-time-difference.cpp | class Solution {
public:
int findMinDifference(vector<string>& timePoints) {
vector<int> mini;
for (int i = 0; i < timePoints.size(); i++) {
int hours =
(timePoints[i][0] - '0') * 10 + (timePoints[i][1] - '0');
// or hours=stoi(timePoints[i].substr(0,2));
... | ALGO | 0.999831 | 6.016601 |
5350cab4-ed16-4784-8e42-12bc2f190531 | Abhishek9503/Code_ | DSA LOVE BABBAR/Array/MergeSortedArray.cpp | #include <iostream>
#include <vector>
using namespace std;
void merge(int arr1[], int n, int arr2[], int m, int arr3[])
{
int i = 0, j = 0, k = 0;
while (i < n && j < m)
{
if (arr1[i] < arr2[j])
{
arr3[k] = arr1[i];
k++;
i++;
}
else
... | ALGO | 0.999976 | 4.642719 |
4e8b5444-3551-4eaa-aaf3-61ba986de66f | imutsavyadav/data-structure-algorithm | Graph 2/5_graph.cpp | #include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define rep(i,a,b) for(int i=a ; i<b ; i++)
#define repi(i,a,b) for(i=a ; i!=b ; i++)
#define ff first
#define ss second
#define setBits(x) builtin_popcount(x)
const int N ... | ALGO | 0.999999 | 4.746577 |
1bb89799-8236-4bed-8f52-9828f4e9732c | ptrLx/Advent_of_code_2020 | 14/part-2/main.cpp | #include <algorithm>
#include <bitset>
#include <fstream>
#include <iostream>
#include <map>
#include <regex>
#include <string>
using namespace std;
void recursion(vector<uint64_t> &addresses, uint64_t address, string mask) {
size_t pos = mask.find("X");
if (pos == string::npos)
addresses.push_back(ad... | ALGO | 0.985992 | 4.992318 |
7aa811cf-f94d-4772-872e-60c396d7c80b | iamkittis00/ENGCC306-COMPUTER-PROGRAMING | lab3/lab3-2.cpp | #include <stdio.h>
int main () {
int i = 0 ;
int K = 0 ;
/* printf("--|Show 'Hello World' to screen %d line(s) \n",K) ;
for (i = 0;i < K;i++){
printf("[%3d] Hello World \n",i);
}*/
char star = '*' ;
int j = 0 ;
int N ;
printf("input : ") ;
scanf("%d",&N) ;
i = 0 ;
... | ALGO | 0.999877 | 3.307773 |
3993ef97-c6d5-4cbb-aa92-8e6aa9c3c9d1 | a092devs/DSA-Practice | lecture 024 - basic maths/sieveOfEratosthenes.cpp | #include<iostream>
using namespace std;
void primeSieve(int n){
int prime[n+1] = {0};
for (int i = 2; i < n; i++){
if (prime[i] == 0){
for (int j = 2 * i; j < n; j += i){
prime[j] = 1;
}
}
}
for (int i = 2; i < n; i++){
if (prime[i] == 0){... | ALGO | 0.999632 | 5.118309 |
c22f8056-964f-4b49-9304-276367687186 | Pocketart/typhoonclawvex | Musical_Instruments_2017_2018/Musical_Glove/OLD CODE/gloves/Gloves_R/teensy/avr/libraries/Audio/filter_variable.cpp | #include "filter_variable.h"
#include "utility/dspinst.h"
// State Variable Filter (Chamberlin) with 2X oversampling
// http://www.musicdsp.org/showArchiveComment.php?ArchiveID=92
// The fast 32x32 with rshift32 discards 2 bits, which probably
// never matter.
//#define MULT(a, b) (int32_t)(((int64_t)(a) * (b)) >> 30... | ALGO | 0.985141 | 5.432045 |
74aceb42-b3c3-45f3-b8e4-805b2a0345b0 | hawkwood/cocos2dx-helloWorld-tvOS | tvapp/cocos2d/cocos/base/CCProperties.cpp | #include "CCProperties.h"
#include <string.h>
#include "platform/CCPlatformMacros.h"
#include "platform/CCFileUtils.h"
#include "math/Vec2.h"
#include "math/Vec3.h"
#include "math/Vec4.h"
#include "math/Mat4.h"
#include "base/ccUTF8.h"
#include "base/CCData.h"
#include "deprecated/CCString.h"
USING_NS_CC;
// Utilit... | TOOL | 0.897094 | 6.74651 |
8d23211a-08a5-4f8d-976c-ec6464ca270c | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_672_9.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 2e5 + 5;
const int M = 5e5 + 5;
int n, m, a[N], freq[M];
long long ans;
bool f[N];
vector<int> p[M];
void solve(int x, bool add) {
int sz = p[x].size();
for (int i = 1; i < (1 << sz); i++) {
int cnt = 0, num = 1;
for (int... | ALGO | 0.999966 | 4.108877 |
6d81b634-981d-4a8e-9d8d-787731d43f54 | EmanueleBogdanov/CPPCourseEGT | Even_Odd_homework/main.cpp | #include <iostream>
using namespace std;
int main()
{
int a = 0;
do{
cout << "Please enter number" << endl;
cin >> a;
if(a % 2 == 0){
cout << "Even" <<endl;
}else
cout << "Odd" << endl;
}while( a != 0);
//cout << "Hello World!" << endl;
}
| ALGO | 0.93772 | 3.096902 |
eb8e1787-9a89-49ba-ad37-f8900b2183d9 | eggag32/Competitive-Programming | AtCoder/ABC/1 or 2.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i... | ALGO | 0.999918 | 3.803659 |
d66a722b-4706-440c-b752-4e8a922ee69d | andyjtb/JuceGames | JuceLibraryCode/modules/juce_box2d/box2d/Collision/Shapes/b2EdgeShape.cpp | #include "b2EdgeShape.h"
#include <new>
using namespace std;
void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2)
{
m_vertex1 = v1;
m_vertex2 = v2;
m_hasVertex0 = false;
m_hasVertex3 = false;
}
b2Shape* b2EdgeShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->Allocate(sizeof(b2EdgeShap... | ALGO | 0.957521 | 7.683994 |
20af7e5a-5c84-4872-8238-3771534cfa9c | Aviral-Dwivedi-0/Leetcode | 2502-sort-the-people/sort-the-people.cpp | class Solution {
public:
vector<string> sortPeople(vector<string>& names, vector<int>& heights) {
vector<pair<int, string>> order;
for (int i = 0; i < heights.size(); i++) {
order.push_back({heights[i], names[i]});
}
sort(order.rbegin(), order.rend());
v... | ALGO | 0.999987 | 6.555156 |
24791ce3-8653-453d-847b-4d198a92a6ab | paul2705/OI | OJ/bzoj/UVA12105.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=1e3+5;
int ch[MAXN][MAXN];
int n,m,f[MAXN][MAXN];
int c[10]={6,2,5,5,4,5,6,3,7,6};
int gen(int x,int r){
int best=-1,cc=-1;
if (x<0) return -1;
if (r==0) best=0;
// if (x==0) return best;
if (f[x][r]>=0) re... | ALGO | 0.999944 | 3.233806 |
f662d5d5-c318-4be4-8758-3f00957a8030 | walkccc/LeetCode | solutions/1163. Last Substring in Lexicographical Order/1163.cpp | class Solution {
public:
string lastSubstring(string s) {
int i = 0;
int j = 1;
int k = 0; // the number of the same letters of s[i..n) and s[j..n)
while (j + k < s.length())
if (s[i + k] == s[j + k]) {
++k;
} else if (s[i + k] > s[j + k]) {
// Skip s[j..j + k) and advan... | ALGO | 0.999878 | 6.099067 |
625ebac5-6da3-4195-bc0e-529d8854807f | BitLines/simhash | example/example.cpp |
#include <string>
#include <vector>
#include <iostream>
#include "string_handler.h"
#include "hash.h"
#include "simhash.h"
#include "simhash_table.h"
using namespace simhash;
using namespace std;
int main()
{
string sentences[] = {
"I love china, I love Chengdu .",
"Today is Sunday ." ... | ALGO | 0.994339 | 5.147734 |
45da4299-d90b-4aab-83b4-cd83dff9de86 | anshyyy/CPP | Codechef/binmis.cpp | #include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define loop(i,a,n) for(int i=a;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define all1(v) (v).begin()+1,(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define allr1(v) (v).rbegin()+1,(v).rend()
typedef long long... | ALGO | 0.999941 | 4.527011 |
25af8b3a-6ef6-4bfa-aed6-bacf95c7a28b | Kandariarjun07/DAA_MANUAL | DAA_Manual/week_3/week3_second.cpp | #include <iostream>
#include <vector>
using namespace std;
void selectionSort(vector<int> &arr, int n)
{
int swaps = 0, comparison = 0;
for (int i = 0; i < n - 1; i++)
{
int idx = i;
for (int j = i + 1; j < n; j++)
{
comparison++;
if (arr[j] < arr[idx])
... | ALGO | 0.997673 | 4.649042 |
7c7c1228-341b-44e0-a577-30533a4cfcd9 | iangfernandes96/MP | release_3.4/cell_based/src/simulation/modifiers/DeltaNotchTrackingModifier.cpp | #include "DeltaNotchTrackingModifier.hpp"
#include "DeltaNotchSrnModel.hpp"
template<unsigned DIM>
DeltaNotchTrackingModifier<DIM>::DeltaNotchTrackingModifier()
: AbstractCellBasedSimulationModifier<DIM>()
{
}
template<unsigned DIM>
DeltaNotchTrackingModifier<DIM>::~DeltaNotchTrackingModifier()
{
}
template<unsi... | TOOL | 0.856824 | 7.377709 |
7d9ada4f-7b79-4219-9874-22ddbc6d5216 | ishandutta2007/codeforces | golikovnik/normal/1213/E.cpp | #include <bits/stdc++.h>
std::string solve(std::size_t n, std::string const& s, std::string const& t) {
auto sf = s[0];
auto sl = s[1];
auto tf = t[0];
auto tl = t[1];
if (sf == tf && sl != sf && tl != sf && sl != tl) {
std::string answer{};
for (auto ch = 'a'; ch <= 'c'; ++ch) {
if (ch == sf) ... | ALGO | 0.999989 | 4.842803 |
70541a25-9f55-44e1-ab2f-756423cf2cbf | CyrusThapa11/cpWithCPP | _A2OJ_1300_73.cpp |
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fr(a,b) for(int i = a; i < b; i++)
#define rep(i,a,b) for(int i = a; i < b; i++)
#define mod 1000000007
#define inf (1LL<<60)
#define all(x) (x).begin(), (x).end()
#define prDouble(x) cout << fixed << setprecision(10) << x
#define triplet pair<... | ALGO | 0.999827 | 4.514269 |
32a5f3c5-69b8-47b4-8bd1-05ba8ab5432a | FAIZ-ADI-PRANAWA/daftarmatkul | 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 |
6dc13b59-6537-49f2-a940-11f42a462887 | CarryMachineGun/Syracuse_U | 21fall/21f_CIS554_cpp/W6_2/2021_10_07_Lecture_SmartPointerSortReverseRemoveLinkedl=List.cpp | #include <iostream>//cout , cin
#include <memory>
using namespace std;
class ThreeD {
public:
int ht;
int wid;
int dep;
int vol() { return ht * wid * dep; }
};
class ThreeD1 {
public:
int ht;
int wid;
int dep;
ThreeD1(int i, int j, int k) { ht = 2 * i; wid = 3 * j; dep = 4 * k; } //constructor
int vol() { ... | TOOL | 0.984661 | 3.377767 |
d0c64f8f-b4c8-49ce-a25d-0f21ff88e877 | SUER119/Cloth-Simulation | Libs/Eigen_3_3_1/bench/quat_slerp.cpp | #include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Q>
EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t)
{
return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized());
}
template<typename Q>
EIGEN_DONT_INL... | ALGO | 0.976744 | 6.251058 |
fd3bcbd7-cbe4-4a0c-8740-3420ea1700b0 | kerautret/DGtal-forIPOL | IllustrationsArticleIPOL/illustrationAdjacency3D.cpp | #include <DGtal/base/Common.h>
#include <DGtal/helpers/StdDefs.h>
#include <QtGui/qapplication.h>
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include <DGtal/topology/helpers/Surfaces.h>
#include <DGtal/geometry/curves/FreemanChain.h>
#include <DGtal/io/colormaps/GradientColorMap.h>
#include <DGtal/topology/helper... | ALGO | 0.950636 | 4.893723 |
f951e5c3-ba1f-4d0b-b378-57113bf57970 | brunsky/WS171-frameworks-base | libs/utils/VectorImpl.cpp | #define LOG_TAG "Vector"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <utils/Log.h>
#include <utils/Errors.h>
#include <utils/SharedBuffer.h>
#include <utils/VectorImpl.h>
/*****************************************************************************/
namespace android {
// -----------------... | TOOL | 0.991521 | 7.268122 |
54643462-ba28-40f0-827a-16a32400e211 | UntitledProgrammer/PleaseWork | PleaseWork/PleaseWork.cpp | // PleaseWork.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
int main()
{
std::cout << "Hello World! Please enter two numbers\n";
int a; int b;
std::cin >> a;
std::cin >> b;
std::cout << "The numbers you've inputted are " << a << " and... | TOOL | 0.903479 | 3.117564 |
685abb43-3bb3-46a0-8319-9703bf846e59 | Solid-Wires/CSCI411BoundedBufSemaphoresProject | src/BufManip.cpp | #include "../inc/Common.h"
using namespace std;
// Defined within namespace
namespace BoundedBufProj {
// Insert an item into the first empty slot on the buffer.
// shared.in gets incremented, and Mod BUFF_SIZE wraps around
// Mutex lock makes sure that the buffer doesn't get modified everywhere
r_cod... | TOOL | 0.929076 | 5.408947 |
eeaca0be-8621-4429-8da6-3d3b935b88a0 | The-No-Hands-company/RudeBase3D | third_party/libigl/libigl-2.5.0/include/igl/embree/bone_visible.cpp | template <
typename DerivedV,
typename DerivedF,
typename DerivedSD,
typename Derivedflag>
IGL_INLINE void igl::embree::bone_visible(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F,
const Eigen::PlainObjectBase<DerivedSD> & s,
const Eigen::PlainObjectBase<Derive... | ALGO | 0.930151 | 6.163465 |
c62ac98d-0435-49ba-bc87-c299b0581dac | moisesrcastro/AppPresen-a | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
3ae05537-dd2a-45d7-a554-32232c0129ee | twezo1337/Matrix-multiplication | lab2.2/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <omp.h>
#include <windows.h>
using namespace std;
typedef double(*TestFunctTempl)(double**&, double**&, double**&, int&, int&, int&);
double fillMatrix(double**& matrix, int size1, int size2) {
double t_start = omp_get_wtime();
for (int i = 0; i < ... | TOOL | 0.997963 | 3.856364 |
ed0fec04-3887-417b-b30c-3f90b5040270 | SAP/project-foxhound | modules/fdlibm/src/s_ceil.cpp | /* @(#)s_ceil.c 5.1 93/09/24 */
/*
* ceil(x)
* Return x rounded toward -inf to integral value
* Method:
* Bit twiddling.
* Exception:
* Inexact flag raised if x not equal to ceil(x).
*/
#include <float.h>
#include "math_private.h"
static const double huge = 1.0e300;
double
ceil(double x)
{
int32_t i0,i1,j0... | ALGO | 0.999673 | 5.881606 |
058a6d70-1ca8-4cdf-a7fd-b533e3629857 | niyathi18/DSA | babbar-array/negpos.cpp | #include<iostream>
using namespace std;
void negpos(int arr[],int n){
int j=0;
for(int index=0;index<n;index++){
if(arr[index]<0){
swap(arr[index],arr[j]);
j++;
}
}
}
int main(){
int arr[]={-5,3,-6,3,8,-2};
int n=6;
negpos(arr,n);
for(int i=0;i<n;i++... | ALGO | 0.999981 | 4.048643 |
9dcc2416-4a2b-4633-9456-4801a459d3aa | umakantv/75-questions | arrays/product-except-itself.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int n = nums.size();
// if(n == 1) return {1};
vector<int> prefix(n, 1), suffix(n, 1);
prefix[0] = nums[0];
suffix[n-1] = nums[n-1];
for(int i = 0; i < n; i++) {
if(i > 0)... | ALGO | 0.99996 | 6.268152 |
12304e72-12e5-4f5e-87a2-4614f777c2da | AlexAgustin/SNN_in_FPGA | src/snn_register_file.cpp | #include "../headers/snn.h"
template <size_t N, size_t M>
void init_matrix (double (&matriz)[N][M], double valor) {
for (int i=0; i<N; i++){
for (int j=0; j<M; j++){
matriz[i][j] = valor;
}
}
}
template <size_t N>
int winner_takes_all(NeuronaLIF (&capa)[N]) {
//Entraos a la fun... | ALGO | 0.99977 | 3.427254 |
7671ffce-2893-4954-97c6-d962dd7b404b | Algo-Goer/LeetCodeSolutions | 2022/0313_6031. 找出数组中的所有 K 近邻下标find-all-k-distant-indices-in-an-array_双指针与模拟.cpp | /*
给你一个下标从0开始的整数数组nums和两个整数key和k
K近邻下标是nums中的一个下标i并满足至少存在一个下标j使得|i - j| <= k且nums[j] == key
以列表形式返回按递增顺序排序的所有K近邻下标
*/
class Solution
{
public:
vector<int> findKDistantIndices(vector<int> &nums, int key, int k)
{
vector<int> res;
vector<int> tmp; // key的下标
int n = nums.size();
in... | ALGO | 0.999988 | 5.410793 |
7891ce5a-259e-441e-a5ab-1983ff9fafa8 | Atikaaziz12/atika-aziz-repository- | PRACTICE LAB 10 PF.cpp | #include<iostream>
using namespace std;
void passByValue(int num) {
num=num+10;
cout<<"inside function(pass by value)"<<num<<endl;
}
void passmultiplicationvalue(int num){
num=num*10;
cout<<"after multiplication="<<num<<endl;
}
void passsubstractionvalue(int num){
num=num-10;
cout<<"after substraction="<<n... | ALGO | 0.999154 | 4.249852 |
ba4f5ad4-6840-40b1-a5de-91139be02b19 | XIGUAjuice/GluonIK | eigen-3.4.0/lapack/cholesky.cpp | #include "lapack_common.h"
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info))
{
*info = 0;
if(UPLO(*uplo)==INVALID) *info = -1;
else if(*n<0) ... | ALGO | 0.998014 | 6.004565 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.