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 |
|---|---|---|---|---|---|---|
eaa2eb03-5d68-4811-8a4d-069a34ce3dae | SSMC-Lab/GestureRecognition | app/src/main/jni/RangeFinder.cpp | #include "MatrixProcess.h"
#include "RangeFinder.h"
#include <cstdlib>
#include <cmath>
//#include <cstring>
RangeFinder::RangeFinder( UInt32 inMaxFramesPerSlice , UInt32 inNumFreq, float inStartFreq, float inFreqInterv )
{
//Number of frequency
mNumFreqs = inNumFreq;
//Buffer size
mBufferSize = inMaxF... | ALGO | 0.996091 | 4.526646 |
e7b491e9-c764-4cc6-bbbd-7158007bcc3a | heimaclh/ROS1_RRT | src/navigation-noetic-devel/base_local_planner/src/twirling_cost_function.cpp | /*
* twirling_cost_function.cpp
*
* Created on: Apr 20, 2016
* Author: Morgan Quigley
*/
#include <base_local_planner/twirling_cost_function.h>
#include <math.h>
namespace base_local_planner {
double TwirlingCostFunction::scoreTrajectory(Trajectory &traj) {
return fabs(traj.thetav_); // add cost for m... | ALGO | 0.992716 | 5.978807 |
32841da0-3d58-459a-ac79-aabe180076d2 | ramiro-menendez/AEDD | Guía 4/Problemas complementarios/Complementario B - Guía 4.cpp | #include<iostream>
using namespace std;
string diasMes(int);
int main() {
int mes;
cout << "Ingrese un mes (número del 1 al 12): ";
cin >> mes;
cout << diasMes(mes);
return(0);
}
string diasMes(int mes) {
string result;
switch(mes) {
case 1: result="ENERO tiene 31 días.";
... | ALGO | 0.96062 | 3.830076 |
247c8e9d-f3bf-4e8b-a821-43a81175faf0 | yagnik158/sdesheetchallenge | Arrays3/15_Majority element.cpp | #include <bits/stdc++.h>
int findMajorityElement(int arr[], int n) {
// Write your code here.
int cnt=0,x=0;
for(int i=0;i<n;i++){
if(cnt==0)x=arr[i];
if(arr[i]==x)cnt++;
else cnt--;
}
cnt=n/2;
for(int i=0;i<n;i++)if(arr[i]==x)cnt--;
if(cnt<0)return x;
return -1;
}
| ALGO | 0.999992 | 4.795632 |
c59be08e-6112-4157-b801-7c152e83639f | khc41/algorithm_study | backjoon/graph/9466.cpp | #include <iostream>
#include <vector>
#include <memory.h>
using namespace std;
bool visited[100001];
bool done[100001];
int map[100001];
int n, cnt;
void dfs(int v) {
visited[v] = true;
int next = map[v];
if (!visited[next]) dfs(next);
else if (!done[next]){
for (int i = next; i != v; i = map[i]) {
cnt++;
... | ALGO | 0.999915 | 4.199022 |
756ba076-d943-4456-97d8-909e59a16bb6 | rvgpu/rvgpu-llvm | mlir/lib/Query/QueryParser.cpp | #include "QueryParser.h"
#include "llvm/ADT/StringSwitch.h"
namespace mlir::query {
// Lex any amount of whitespace followed by a "word" (any sequence of
// non-whitespace characters) from the start of region [begin,end). If no word
// is found before end, return StringRef(). begin is adjusted to exclude the
// lexe... | TOOL | 0.879065 | 4.95237 |
9f057ad7-2357-41cc-b000-37dbf1351f70 | Ecolash/Data-Structures-Algorithms | Tries/trie6.cpp | // BIT TRIE APPLICATION
// Create a data structure that performs following operations
// + X --> add X to DS
// - X --> remove X from DS
// ? Y K --> no. of X s.t (X ^ Y) <= K
// X = --(already processed)---a---(to process)---
// Y = --(already processed)---b---(to process)---
// K = --(already processed)---c---(to pr... | ALGO | 0.999874 | 4.770018 |
d8fedc09-5afc-48bc-a9f1-00116ac2393c | rehmeee/Linear-DSA-Problems | Array Problems/sliding window/maximum_sum_of_distinct_subarray_with_sum_equals_k.cpp | #include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<vector>
#include<unordered_map>
using namespace std;
long long maximumSubarraySum(vector<int>& nums, int k) {
long long sum =0;
unordered_map<int,int> ma;
int i = 0, j = 0;
while(j<k){
ma[nums[... | ALGO | 0.999973 | 4.942323 |
38808ad2-f466-494d-92de-3bf0b8d1391a | Hodosi/FacultyProjectsYear1 | GraphAlgorithms/RepresentationOfGraphs/adjacencyList.cpp | //
// Created by Hodosi on 3/12/2021.
//
#include "adjacencyList.h"
#include <iostream>
#include <vector>
using namespace std;
void fromAdjacencyMatrixToAdjacencyList(vector<vector<int>> &adjacency_list, vector<vector<int>> adjacency_matrix, int nodes){
int predecessor, successor;
for(predecessor = 1; pred... | ALGO | 0.99879 | 5.822481 |
a9a28223-739a-480c-804e-9c8b55db5d4a | ehnryx/acm | asia-jakarta-2018-cf102001/virtual/e.cpp | #include <bits/stdc++.h>
using namespace std;
#define nl '\n'
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int INF = 0x3f3f3f3f;
#define POINT 0
#define WALL 1
#define QUERY 2
ll sgn(ll n) {
if (n == 0) return 0;
return n<0 ? -1 : 1;
}
ll basex, basey;
struct Point {
ll x, y;... | ALGO | 0.999772 | 4.184065 |
8640aa01-f839-4bdb-bb76-fbf3eeef9240 | ShubhamSharma1309/Interview-DSA-Questions | Arrays/Binary Search/Most Profit Assigning Work.cpp | /* Scroll below to see JAVA code also */
/*
MY YOUTUBE VIDEO ON THIS Qn : https://www.youtube.com/watch?v=_HptwlLP8sI
Comoany Tags : Netease Games
Leetcode Link : https://leetcode.com/problems/most-profit-assigning-work/description/
*/
/*******************************... | ALGO | 0.998213 | 6.454941 |
93d8f418-b6c1-4d81-acf1-56b117e966d3 | czheng4/neuralNet | src/net.cpp | /* Libraries for simple N.N.
2019 chaohui zheng */
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <chrono>
#include <random>
#include <cmath>
#include "net.h"
#include "mat.h"
#include <cstdlib>
#include <cstdio>
using namespace zzh;
using namespace std;
namespace zzh
{
shape::... | DATA | 0.991515 | 4.045831 |
c039db38-3497-48a5-a344-724e1ce83a02 | debosmita212/LeetCode-Problems | 703-kth-largest-element-in-a-stream/703-kth-largest-element-in-a-stream.cpp | class KthLargest {
public:
priority_queue<int,vector<int>,greater<int>> pq;//minHeap
int cnt;
KthLargest(int k, vector<int>& nums) {
cnt=k;
for(int i=0;i<nums.size();i++)
pq.push(nums[i]);
//so that it contains only k maximum elements
while(pq.size()>cnt)
... | ALGO | 0.999961 | 5.697027 |
5b13ea59-631c-4e14-b14f-7cb91dbf732c | aSongDai/AlgorithmPractice | cs_view/code/lemonadeChange.cpp | #include <vector>
#include <unordered_map>
class Solution
{
public:
bool lemonadeChange(std::vector<int>& bills)
{
std::unordered_map<int, int> have;
for (const int bill : bills)
{
if (bill == 5)
{
++have[5];
continue;
}
else if (bill == 10)
{
if (!have[5])
{
return false... | ALGO | 0.998214 | 6.0016 |
b12f68f7-80cc-4d39-82a7-ffd5c9107fc8 | obaidulsaiki/Competitive-programming | Codeforce/ICPC Assiut University Community c1/E_interval_sweep.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
if (a == 0 && b == 0)
{
cout << "NO" << endl;
}
else if (abs(a - b) == 1 || (a - b) == 0)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
return 0;
}
| ALGO | 0.999942 | 3.744676 |
36a6fde9-dc66-4db7-bdb6-5a0b8d83ddb3 | roubo/openAPM | libraries/Filter/DerivativeFilter.cpp | /// @file Derivative.cpp
/// @brief A class to implement a derivative (slope) filter
/// See http://www.holoborodko.com/pavel/numerical-methods/numerical-derivative/smooth-low-noise-differentiators/
//
#include <inttypes.h>
#include <math.h>
#include <Filter.h>
#include <DerivativeFilter.h>
template <class T, uint8_t... | ALGO | 0.954447 | 7.001516 |
14c601f9-cda0-4ee4-b6fc-428fc5fa417f | mihailrc/selfDrivingCarTerm2 | modelPredictiveControl/src/Eigen-3.3/doc/examples/TutorialInplaceLU.cpp | #include <iostream>
struct init {
init() { std::cout << "[" << "init" << "]" << std::endl; }
};
init init_obj;
// [init]
#include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A(2,2);
A << 2, -1, 1, 3;
cout << "Here is the input matrix A before decompositi... | ALGO | 0.999144 | 3.804785 |
8315cbd0-e2e4-485b-bc41-19ca4aae1738 | VijayKYadav/LeetCode-2025 | March/GCD of two numbers.cpp | I Approach (Using Euclidean Algorithm)
class Solution {
public:
int gcd(int a, int b) {
int na=min(a,b);
int nb=max(a,b);
while(b!=0)
{
int r=a%b;
a=b;
b=r;
}
return a;
}
};
Time Complexity=O(log(min(a,b)))... | ALGO | 0.999998 | 6.34071 |
9a7f9e30-9b78-47ea-9e5c-2b814d81db0a | ayushisambyal/StriverSDESheetChallenge-2023 | Day24: Graphs P-II/2. Dijkstra's shortest path Algorithm.cpp | #include <bits/stdc++.h>
vector<int> dijkstra(vector<vector<int>> &vec, int vertices, int edges, int source) {
vector<pair<int,int>> adj[vertices]; //Node, dis between
for(int i=0;i<edges;i++)
{
int u=vec[i][0];
int v=vec[i][1];
int w=vec[i][2];
adj[u].push_back({v,w});
... | ALGO | 0.999895 | 4.909107 |
02434314-4843-475f-bcb2-7a2a87e91d8b | rafaeelaudibert/AlgorithmSolving.random | PoQueMao/PoQueMao.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int doces, pqm[3];
cin >> doces;
for (int i=0; i<3; i++){
cin >> pqm[i];
}
sort(pqm, pqm+3);
if(pqm[0]+pqm[1]+pqm[2]<=doces){
cout << 3;
}else if (pqm[0]+pqm[1]<=doces){
cout << 2;
}el... | ALGO | 0.999922 | 3.851902 |
90a0ae65-1ea0-4f43-b50c-25ca0725f57a | 97joseph/Robotic_Motion | Project2-Animation&CGI-Krusty'sCrazyCollision/t2m1/include/eigen/doc/examples/Tutorial_BlockOperations_corner.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf m(4,4);
m << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10,11,12,
13,14,15,16;
//print first two columns
cout << "-- leftCols(2) --" << endl
<< m.leftCols(2) << endl << endl;
//print ... | ALGO | 0.999014 | 4.0818 |
5a544903-09fa-40b9-adc9-5bad15304f3d | IshaanGaba97/LeetCode-Solutions | 0714-best-time-to-buy-and-sell-stock-with-transaction-fee/0714-best-time-to-buy-and-sell-stock-with-transaction-fee.cpp | class Solution {
public:
int f(int i, vector<int>& prices, int buy, vector<vector<int>> &dp, int fee){
if(i == prices.size()){
return 0;
}
if(dp[i][buy] != -1) return dp[i][buy];
int profit = 0;
if(buy){
profit = max(-prices[i] + f(i+1, prices, 0, dp, ... | ALGO | 0.999968 | 5.663137 |
ea1be8ce-e892-4d07-92c2-b17112fd121b | amg28nozomi/AppFrame | source/Math/Vector4.cpp | /*****************************************************************//**
* @file Vector4.cpp
* @brief lxNgNX̒`
*
* @author ؊C
* @date December 2021
*********************************************************************/
#include "Vector4.h"
#include <cmath>
namespace AppFrame {
namespace Math {
Vector4... | TOOL | 0.960089 | 5.696647 |
649b9e9e-7309-430d-9b2a-31f1822724fb | beyondlte/CLRS_Algorithms | ReverseWords/ReverseWords/ReverseWords.cpp | // ReverseWords.cpp : Defines the entry point for the console application.
// Question: given a string, reverse each word in the string
// Example: I am a student. ---> .tneduts a ma I
#include "stdafx.h"
#include <string.h>
void ReverseWord(char *s, int m, int n)
{
char temp;
while (m < n)
{
temp = s[m];
s[m+... | ALGO | 0.998168 | 4.772235 |
7f3af5c5-4cd3-4e93-936d-f3cf0cc6d749 | SyedaShafi/C_programming | CPP/almost_prime.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int N = 3e3 + 7;
vector<int> primes;
bool mark[N];
void sieve()
{
for (int i = 2; i * i <= N; i++)
{
if (!mark[i])
{
for (int j = i * i; j <= N; j += i)
{
mark[j] = true;
... | ALGO | 0.999781 | 4.90808 |
f185be8c-b6f6-48b3-bb1e-872b71ff8cd8 | uta-noki/AtCoder-by-Docker | atcoder/other/hitachi2020/b/hitachi2020_b.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i, start, n) for (int i = start; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a... | ALGO | 0.999963 | 4.223491 |
84ae4eaf-0363-4326-9551-1c6c3bf7bcaf | gabriel-dp/Maratona-Mineira-Roteiros | roteiro-02/12-madeira.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, counter;
string read;
map<string, int> trees;
cin >> n;
while (n--) {
trees.clear();
counter = 0;
while (getline(cin, read)) {
if (read.size() > 0) {
trees[read]++;
... | ALGO | 0.995048 | 4.540228 |
8e104435-842e-456b-963f-ebee27ed159c | onera/Fast | Fast/FastS/FastS/Compute/DTLOC/dtlocal2para_mpi.cpp | #include <iostream>
# include "FastS/fastS.h"
# include "FastS/param_solver.h"
# include <string.h>
# include <omp.h>
using namespace std;
using namespace K_FLD;
//=============================================================================
// Idem: in place + from zone + tc compact au niveau base
//================... | ALGO | 0.999235 | 4.233126 |
666f779b-a648-4b58-ae1a-d201fb04845a | neilpradhan/Leet_code_monthly_challenge | May_challenge/Sort_Characters_By_Frequency.cpp | class Solution {
public:
string frequencySort(string s) {
unordered_map<char,int> m;
for(char c : s){
m[c]++;
}
typedef unordered_map<char,int> my_map;
map<int,string> u;
for (auto v : m){
char c = v.first;
int x... | ALGO | 0.999963 | 5.663814 |
1449064e-c6cf-4597-b560-2a05ebbd535a | Wang-Theo/Camera_Calibration | src/line_extract.cpp | // Jun 12 created by Wang Renjie //
#include "cam_cali/line_extract.hpp"
namespace calibration {
void LineExtract::LineExtractSubscriber(ros::NodeHandle nh)
{
subscriber_image1 = new message_filters::Subscriber<sensor_msgs::Image>(nh, img1_topic.c_str(), 1);
subscriber_image2 = new message_filters::Subscribe... | TOOL | 0.9782 | 4.959978 |
0276d409-d4c3-4b22-9028-97b517bc2a88 | qkrtjdrbs/algorithm | 4673.cpp | #include <bits/stdc++.h>
using namespace std;
bool num[10001];
int cal(int x){
string tmp = to_string(x);
int sum = x;
for(int i=0;i<tmp.size();i++){
sum += (tmp[i]-'0');
}
return sum;
}
void d(int x){
if(x >= 10000) return;
num[x] = 1;
d(cal(x));
}
int main(){
cin.tie(NU... | ALGO | 0.999411 | 5.033746 |
18c00edb-52ab-46ca-91ff-2b2c4c513953 | hessamderakhshan/SP-cpp | intermediate_c++/pointer/2_02_pinter_arrfunc.cpp | #include <iostream>
using namespace std;
//array of pointers to functions
int sum(int,int); //prototype of function
int product(int,int); //prototype of function
int main()
{
int (*p[2])(int,int)={sum,product};
cout<< (*p[0])(6,2)<<endl; //8
cout<< (*p[1])(6,2)<<endl; //12
return 0;
}
int sum(in... | ALGO | 0.966971 | 5.315441 |
18af273a-5ca4-4ced-a0d8-c459ffffd432 | aospa-whyred/android_external_sqlite | android/OldPhoneNumberUtils.cpp | // Old implementation for phone_number_compare(), which has used in cupcake, but once replaced with
// the new, more strict version, and reverted again.
#include <string.h>
namespace android {
static int MIN_MATCH = 7;
/** True if c is ISO-LATIN characters 0-9 */
static bool isISODigit (char c)
{
return c >= '0... | TOOL | 0.892799 | 6.327506 |
c8bb7424-5a71-4597-a246-3acc2a093ad2 | anonymint/Path-Planning | src/Eigen-3.3/doc/examples/Tutorial_ArrayClass_mult.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(2,2);
ArrayXXf b(2,2);
a << 1,2,
3,4;
b << 5,6,
7,8;
cout << "a * b = " << endl << a * b << endl;
}
| ALGO | 0.990518 | 3.527115 |
ff728f3e-9990-4196-9602-81613b3d0671 | kevins3204/OpenCV_LAB | opencv/modules/photo/src/denoising.cuda.cpp | #include "precomp.hpp"
#include "opencv2/photo/cuda.hpp"
#include "opencv2/core/private.cuda.hpp"
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_CUDAARITHM
# include "opencv2/cudaarithm.hpp"
#endif
#ifdef HAVE_OPENCV_CUDAIMGPROC
# include "opencv2/cudaimgproc.hpp"
#endif
using namespace cv;
using names... | ALGO | 0.992332 | 6.02358 |
3b51b032-5e82-4ea5-a6ba-4bb041dde03a | umair-666/DSA-everyday | DSA questions/POTD/Leetcode/3rd_July - Minimum Difference Between Largest and Smallest Value in Three Moves.cpp | // 1509. Minimum Difference Between Largest and Smallest Value in Three Moves
// https://leetcode.com/problems/minimum-difference-between-largest-and-smallest-value-in-three-moves/description/?envType=daily-question&envId=2024-07-03
class Solution {
public:
int minDifference(vector<int>& nums) {
int numsSi... | ALGO | 0.9999 | 5.918121 |
29760efe-3be2-44d6-86da-fae7e30230f7 | tokotoko9981/AtCoder | ABC/ABC248/A.cpp | #include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vs = vector<string>;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),... | ALGO | 0.998942 | 3.616607 |
cb0d0951-9848-4a00-91c4-0c6db70b4c7d | thepluck/CP-Training | Private/AnhDuc/School/ski-level.cpp | #include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
using ll = long long;
const int N = 505;
int h[N][N], n, m, t; bool st[N][N];
struct node{
int x, y;
node(): x(0), y(0){}
node(int x, int y): x(x), y(y){}
bool operator != (const node &o){
return x != o.x || y != o.y;
... | ALGO | 0.9998 | 4.041965 |
c192f82e-c07b-4d1b-a654-e11096446296 | bbrooks37/RAY_TRACER | src/Sphere.cpp | // src/Sphere.cpp
#include "Sphere.h" // Include the header for Sphere class, which also includes Ray.h and Object.h (for IntersectionInfo)
#include <cmath> // For std::sqrt
// Implements the ray-sphere intersection test.
// This uses the quadratic formula to find intersection points.
// A ray is defined as P(t) = ... | ALGO | 0.995877 | 7.447585 |
42ab6046-c5eb-4694-97c4-ea110fd5e5b6 | DanilishinArtem/neetcode | advancedGraphs/cppRealizations/swimInRisingWater.cpp | #include <vector>
#include <iostream>
#include <map>
#include <set>
#include <queue>
using namespace std;
class Solution {
public:
int swimInWater(vector<vector<int>>& grid) {
int N = grid.size();
set<tuple<int, int>> visited;
priority_queue<vector<int>, vector<vector<int>>, greater<vector... | ALGO | 0.99995 | 6.021102 |
f70e3715-dd75-44cf-b6df-83ad1cf184d0 | Mavi2001/CPP-Problems | ones.cpp | #include <iostream>
using namespace std;
int main() {
int t,n;
cin>>t;
while(t--)
{
cin>>n;
cout<<n/2<<endl;
}
return 0;
}
| ALGO | 0.999247 | 4.445842 |
da21b435-dade-44a5-ba57-77e81072427d | Ziad-Fahmy/ICPC-Assiut-Materials | B. Prime checking.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main()
{
long long n;cin>>n;
bool isPrime=true;
if(n<2) isPrime=false;
for(int i=2;i<=sqrt(n);i++)
{
if(n%i==0)
{
isPrime=false;
break;
}
}
if(isPrime) cout<<"YES"<<endl;
else... | ALGO | 0.999862 | 4.723531 |
f7b61bf3-378f-42cd-a453-c868854ab67d | aestesis/elektronika | src/STLport/test/regression/merge0.cpp | // STLport regression testsuite component.
// To compile as a separate example, please #define MAIN.
#include <algorithm>
#include <iostream>
#ifdef MAIN
#define merge0_test main
#endif
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
using namespace std;
#endif
int merge0_test(int, char**)
{
cout<<"Result... | TEST | 0.902054 | 5.695201 |
791ca139-eeaf-4f6c-82c5-26388e391716 | rohan3004/LeetCode-Solutions | 2221-check-if-a-parentheses-string-can-be-valid/2221-check-if-a-parentheses-string-can-be-valid.cpp | class Solution {
public:
bool canBeValid(string s, string locked) {
int n = s.length();
if (n % 2 != 0) {
return false; // Odd length cannot form valid parentheses
}
// Left-to-right pass: Ensure there are enough open brackets
int openCount = 0;
for (int ... | ALGO | 0.999608 | 6.272857 |
f49350ee-2710-4dc4-99df-1b1d5beb67e0 | zcobell/hmdf | thirdparty/proj-7.2.0/src/projections/tmerc.cpp | /*
* Transverse Mercator implementations
*
* In this file two transverse mercator implementations are found. One of Gerald
* Evenden/John Snyder origin and one of Knud Poder/Karsten Engsager origin. The
* former is regarded as "approximate" in the following and the latter is "exact".
* This word choic... | ALGO | 0.999789 | 3.983067 |
36607f07-3c91-47dc-aa24-1b7ba5143712 | Willgxnzalez/data-structures-algorithms | hash-table/roman-numbers.cpp | #include <iostream>
#include <string>
#include <unordered_map>
int romanToInt(std::string s) {
std::unordered_map<char, int> roman = {
{'I', 1},
{'V', 5},
{'X', 10},
{'L', 50},
{'C', 100},
{'D', 500},
{'M', 1000}
};
int len = s.length();
if (len =... | ALGO | 0.997903 | 6.449712 |
17a19dab-0313-4255-9c7d-cf21e7b9dff9 | SmartCGMS/Eigen3 | doc/examples/TutorialLinAlgSetThreshold.cpp | #include <iostream>
#include <Eigen/Dense>
int main()
{
Eigen::Matrix2d A;
A << 2, 1,
2, 0.9999999999;
Eigen::FullPivLU<Eigen::Matrix2d> lu(A);
std::cout << "By default, the rank of A is found to be " << lu.rank() << std::endl;
lu.setThreshold(1e-5);
std::cout << "With threshold 1e-5, the ran... | ALGO | 0.999898 | 4.377453 |
d21f707d-1f00-413a-ad4b-2dc59b048f19 | AndresVillalba1/Ojoconelojo | HeatDistributionMFEM/HeatDistribution.cpp |
#include "mfem.hpp"
#include <fstream>
#include <iostream>
using namespace std;
using namespace mfem;
class MyMatrixCoefficient:public mfem::MatrixCoefficient
{
public:
//constructor
MyMatrixCoefficient(int dim,double a_,double b_):mfem::MatrixCoefficient(dim)
{
a=a_;
b=b_;
}
virt... | ALGO | 0.999468 | 4.067659 |
9ccde419-7b93-4c12-bdf1-6cefd61c5092 | sacsachin/programing | ABCDEF.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long solve(std::vector<long> &v, int n)
{
long ans = 0, count=0, count1=0;
std::vector<long> ab;
std::vector<long> ef;
for (int i=0; i < n; i++)
{
for (int j=0; j < n; j++)
{
for (int ... | ALGO | 0.999963 | 3.782382 |
e00a6018-5cb6-45fc-9da4-f5f4ba193ccd | yunho-c/Live-Braille | paddleocr/deploy/cpp_infer/src/postprocess_op.cpp | #include <include/clipper.h>
#include <include/postprocess_op.h>
namespace PaddleOCR {
void PostProcessor::GetContourArea(const std::vector<std::vector<float>> &box,
float unclip_ratio, float &distance) {
int pts_num = 4;
float area = 0.0f;
float dist = 0.0f;
for (int i = 0;... | ALGO | 0.989999 | 5.65367 |
d528843d-0402-4266-8e1b-b749afe994eb | m4rm0k/foobar2000-plugins | foo_dsp_deemph/dsp_iir.cpp | #define _WIN32_WINNT 0x0501
#include "../SDK/foobar2000.h"
#include "../ATLHelpers/ATLHelpers.h"
#include "iirfilters.h"
DECLARE_COMPONENT_VERSION("De-emphasis postprocessor and DSP set", "0.1", "Copyright(C) 2017 mudlord\n"
"Usage: create tag PRE_EMPHASIS or PRE-EMPHASIS with value \"1\", \"on\" or \"yes\"\n"
);
// ... | TOOL | 0.869338 | 5.470056 |
d23c2f65-e9b8-4f70-b7f0-6bbacd5eb348 | demondragon07/New-DSA | 69-sqrtx/sqrtx.cpp | class Solution {
public:
int mySqrt(int x) {
int s=0;
int e=x;
while(s<=e){
long long mid=s+(e-s)/2;
long long prod=mid*mid;
if(prod==x){
return mid;
}
if(prod>x){
e=mid-1;
}else{
... | ALGO | 0.999962 | 5.343159 |
c88ef72f-91e0-4544-845f-63f572e3a86c | PerfectLifeG/Algorithm-Competition | PracticeMakesPerfect/2023Winter/1.1/t3.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=10010;
int main(){
int a,b;
cin>>a>>b;
printf("Age: %d\nHealthy Index: %d\n",a,b);
if(a>=1&&a<60&&b>=0&&b<30||a>=60&&a<80&&b>=0&&b<50||a>=80&&a<200&&b>=0&&b<60)printf("Red Alert!!");
else if(a>=1&&a<60&&b>=30&&b<60||a>=60&&a<80&&b>=50&&b<70||a... | ALGO | 0.874019 | 3.733571 |
29123167-780b-4e3c-8d4b-14e9bd9212ae | Rkda8071/PS | BOJ/22xx/2261/main.cpp | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> p;
p a[100100];
int main(){
int n;
for(int i=1;i<=n;i++){
int x,y;
scanf("%d %d",&x,&y);
a[i] = p(x,y);
}
sort(a+1,a+n+1);
for(int i=1;i<n;i++){
}
}
| ALGO | 0.999658 | 3.560473 |
d8182353-cc1c-44f8-a3f4-43830b85b71b | b2tine/GasRiemannSolver | Gas/gas1d.cpp | #include "riemann_problem.h"
#include <util.h>
int main()
{
std::ifstream infile("in-gas");
std::vector<double> init;
while (!infile.eof())
{
double val;
infile >> val;
init.push_back(val);
}
double tfinal = 0.1;
int max_tstep = 2000;
double default_dt = 0.0005... | ALGO | 0.999982 | 4.102883 |
c6c59767-3e08-4701-9dc0-317e1639c309 | zack714/COE322---Scientific-Computation | hw5/fizzBuzz.cpp | #include <iostream>
using namespace std;
int main() {
int x;
cin>>x;
if(x%3==0 && x%5==0){
cout<<"Fizzbuzz!"<<endl;
}else if(x%3==0){
cout<<"Fizz!"<<endl;
}else if (x%5==0){
cout<<"Buzz!"<<endl;
}
}
| ALGO | 0.999868 | 4.642313 |
85064893-47cd-41b2-bd82-e048db92a9da | PiusLim373/leetcode_and_hackerrank | leetcode/algo2/day12/55_jump_game.cpp | #include <iostream>
#include <vector>
bool canJump(std::vector<int> &nums)
{
int goal = nums.size() - 1;
for (int i = goal; i >= 0; i--)
{
if (i + nums[i] >= goal)
goal = i;
}
if (!goal)
return true;
return false;
}
bool canJump_bugged(std::vector<int> &nums)
{
i... | ALGO | 0.999972 | 5.544248 |
e8deced7-2fd6-4b28-aa10-dca82e5264fe | ishandutta2007/codeforces | scott_wu/normal/219/D.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int MAXN = 200100;
int N;
vector <pair <int, bool> > edge[MAXN]; //true = [] to int, false is other way
int ans;
vector<int> alist;
int count(int node, int prev) {
int t = 0;
for (int i=... | ALGO | 0.999994 | 4.230556 |
42205bca-538c-440c-b4d2-b4490df89464 | Kancharlavamsikrishna143/csa0270-c-programming-for-quantum-computing | Day-3 Programe-10.cpp | #include <stdio.h>
// Function to find the power of a given number using recursion
int power(int base, int exponent) {
if(exponent == 0) {
return 1;
} else {
return base * power(base, exponent-1);
}
}
int main() {
int base, exponent;
printf("Enter base number: ");
scanf("%d", &... | ALGO | 0.999676 | 6.059514 |
10c0909f-0a5a-4d5e-a425-f296a940a84f | sahuankit010/LeetCode-Solutions | 3. Count 1's in binary array - GFG/3.-count-1s-in-binary-array.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
// Function to count number of Ones
// arr: input array
// n: size of input array
int countOnes(int arr[], int n)
{
// Your code here
int l=0, h=n-1;
... | ALGO | 0.99973 | 6.273784 |
87bb8333-e66b-4646-a1df-51c7424209af | IL98/Algrorithms | Graphs/Floyd-Warshall/main.cpp | #include <fstream>
#include <vector>
using std :: vector;
using std :: ifstream;
using std :: ofstream;
class CMatrixGraph
{
public:
vector<vector<int> > Matrix;
int vertices_count;
int VerticesCount() const;
CMatrixGraph(int count);
void AddEdge(int from, int in, int weight) ;
void GetNextVer... | ALGO | 0.999942 | 4.195576 |
9400b069-13e7-4406-9e32-5959540cd199 | Dan13llljws/CP-Solutions | CSES/1084-apartments.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m, k;
cin >> n >> m >> k;
vector<int> a(n), b(m);
for (int &x : a) cin >> x;
for (int &x : b) cin >> x;
sort(a.begin(), a.end()), sort(b.begin(), b.end());
int ans = 0;
for (int i = 0, j = 0; i < n... | ALGO | 0.999979 | 3.764253 |
6d613108-2fce-4876-bf39-7d2966447410 | GSGFs7/algorithm | atcoder/abc367D Pedometer.cpp | #include <iostream>
#include <vector>
using namespace std;
/*
给出一个圆,圆上每隔a[i]段距离就有一个点,求有多少对点的距离是m的倍数
最多有2e5个点
数据范围过大,使用常规方法肯定行不通
将整个圆拆开拉直,假想成一条数组,计算两个点的长度也就变成了计算两个点的前缀和之差
也就是转化成了找 (pre[s]-pre[t]) % m == 0 的个数
上面的式子也可以转化为 pre[s] % m == pre[t] % m
也就是说只要找 s的前缀和模上m 与 t的前缀和模上m 相等的个数就可以了
*/
#define int lo... | ALGO | 0.999972 | 5.257854 |
20c3ca89-0636-4e58-a86b-95fbb9f6cf25 | prameetu/CP_codes | Leetcode/3sum.cpp | //LEETCODE - 15
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> threeSum(vector<int>& nums)
{
vector<vector<int>> res;
sort(nums.begin(), nums.end());
int i = 0;
while(i < nums.size())
{
int target = -nums[i];
int low = i + 1;
... | ALGO | 0.999966 | 4.842807 |
fa1c5989-4ac1-4ac3-ac67-90d114d8cbea | chenzeyin9867/algorithm | 2021_3/merge/merge.cpp |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
if (intervals.size() == 0) {
return {};
}
sort(intervals.begin(), intervals.end());
vector<vector<int>> me... | ALGO | 0.999984 | 5.783782 |
e8113ccb-3dd7-4ecd-bdf1-6e67e460d090 | Siquicecode/barbershopapp | 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.998799 | 6.776823 |
00e19218-b29a-4cd7-8caa-97d28cf97d6a | VuNA2k2/SPOJ_PTIT | P152PROI.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int tu, mau =180;
cin >> tu;
tu%=360;
int a =__gcd(tu,mau);
tu/=a;
mau/=a;
if(tu==0)cout << "0$";
else if(tu==1)
{
if(mau==1)cout <<... | ALGO | 0.998919 | 3.885129 |
b12a1232-8005-46ae-a5cd-20515a403bb6 | Mahesh-R-Mesta/hover_overlay_popup | example/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.998848 | 6.76073 |
9225db1a-26a3-42e0-ba82-73d7e7b151bd | Ankit8607/Best-Leetcode-problems-solutions | string/Repeated Substring Pattern.cpp | // https://leetcode.com/problems/repeated-substring-pattern/
class Solution {
public:
string st(string s, int t){
string ans;
while(t--) ans+=s;
return ans;
}
bool repeatedSubstringPattern(string s) {
int n=s.size();
vector<int>fact;
if(n>1) fact.push_back(... | ALGO | 0.99973 | 5.856991 |
d6868529-332a-423b-8efe-aaf598cf6fa1 | flix/benchmarks | src/fibonacci/fibonacci.cpp | #include <cstdio>
#include <chrono>
const long N = 35;
long fib(long n) {
if (n == 0) {
return 0;
} else if (n == 1) {
return 1;
} else {
return fib(n - 1) + fib(n - 2);
}
}
int main(int, char**) {
auto start = std::chrono::high_resolution_clock::now();
auto result = f... | ALGO | 0.999571 | 5.475797 |
375fd9b7-51fc-4080-aa4b-ac6b4a610b6e | ITIS-mphuong169/SS_TTNC | HOI_CHO_XUAN.cpp | //
// Created by Macbook on 13/07/2024.
//
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <string>
#include <iomanip>
#include<sstream>
#include <queue>
#include<math.h>
#include<string.h>
#include <fstream>
#includ... | ALGO | 0.999742 | 4.10708 |
e8340721-6011-45e3-8bed-9ae142e24b47 | Subhraneel77/Leetcodes-Solutions | 0232-implement-queue-using-stacks/0232-implement-queue-using-stacks.cpp | class MyQueue {
public:
// Push element x to the back of queue...
void push(int x) {
in_stk.push(x);
}
// Remove the element from the front of the queue and returns it...
int pop() {
peek();
const int val = out_stk.top();
out_stk.pop();
return val;
}
// Get ... | ALGO | 0.996566 | 5.407757 |
f5586160-9b02-4898-a613-91916a860389 | slym1v98/flutter_boilerplate_project | 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.998784 | 6.761023 |
97cceea8-4186-42cf-8ab9-9694189cf7a5 | Ahnuf-Karim-Chowdhury/Algorithms | 12.LCS/Rccursive Approach/all_common.cpp | #include <bits/stdc++.h>
#include <cstring>
using namespace std;
void buildLCSTable(string S1, string S2, int m, int n, int LCS_table[][100]) {
for (int i = 0; i <= m; i++) {
for (int j = 0; j <= n; j++) {
if (i == 0 || j == 0)
LCS_table[i][j] = 0;
else if (S1[i - 1]... | ALGO | 0.999961 | 5.395905 |
f2b3be54-871c-4521-aa30-a6f623c71fa8 | Sobzav/csstests | mybulma/node-v12.14.0/deps/icu-small/source/tools/toolutil/uparse.cpp | #include "unicode/utypes.h"
#include "unicode/uchar.h"
#include "unicode/ustring.h"
#include "unicode/utf16.h"
#include "cstring.h"
#include "filestrm.h"
#include "uparse.h"
#include "ustr_imp.h"
#include <stdio.h>
U_CAPI const char * U_EXPORT2
u_skipWhitespace(const char *s) {
while(U_IS_INV_WHITESPACE(*s)) {
... | TOOL | 0.977291 | 6.184056 |
7f81d93e-eaa0-46f1-9f22-6cb1a357389e | yu-community-os/android_external_skia | src/gpu/GrRectanizer_skyline.cpp | #include "GrRectanizer_skyline.h"
#include "SkPoint.h"
bool GrRectanizerSkyline::addRect(int width, int height, SkIPoint16* loc) {
if ((unsigned)width > (unsigned)this->width() ||
(unsigned)height > (unsigned)this->height()) {
return false;
}
// find position for new rectangle
int best... | TOOL | 0.942597 | 5.081875 |
71fbe86a-9ae9-4636-86c9-029d1e0e0a6f | Fawwad-Abdul-Ahad/flutter_assignment_periodicUI | 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 |
e1ba2a82-302f-4bea-a4f7-b150d421e3d4 | Hafiz-Sakib/Algorithm-Design-and-Analysis | STL/STL Mines/STL Codes/Map/3_count__frequency__with__map.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define Boost \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
int main()
{
Boost;
vector<long long int> v = {1564874541897, 1564874541897, 1564874541897, 658498798, 8978... | ALGO | 0.998478 | 3.406229 |
cafa2d44-10a6-422f-9513-b77294bd994d | Jody-Lu/Array | 135_Candy/candy.cpp | class Solution {
public:
int candy(vector<int>& ratings) {
int n = ratings.size();
vector<int> candies(n, 0);
candies[0] = 1;
// left -> right
for(int i = 1; i < n; i++) {
if(ratings[i] > ratings[i - 1]) {
candies[i] = 1 + candies[i - 1];
... | ALGO | 0.999996 | 6.09227 |
2c154b96-add8-47d6-a63a-5ca588a8d33f | visheshmadan678/DSA- | 2316-count-hills-and-valleys-in-an-array/count-hills-and-valleys-in-an-array.cpp | class Solution {
public:
int countHillValley(vector<int>& nums) {
//one apporach can be creating a new vector and not taking the same elements or duplicates
vector<int>ans;
for(auto it:nums){
if(ans.empty() || ans.back()!=it){
ans.push_back(it);
}
... | ALGO | 0.999969 | 5.512661 |
677c6c40-87f6-48a9-98cc-373de563374c | ZhouWeikuan/zoj | zju.finished/2565.cpp | #include<iostream>
using namespace std;
enum {
SIZ = 1002,
ALP = 30,
};
struct Node {
unsigned val, ptr;
};
int len, num;
Node cost[SIZ][ALP];
int mat[ALP][ALP];
int dat[SIZ];
char buf[SIZ];
void fun(){
int i,j,k,t;
memset(cost[len-1], 0, sizeof(cost[0]));
for(i=len-1; i>0; i--){
memset... | ALGO | 0.99993 | 3.07603 |
91872ed5-93e6-42df-9f21-1949457aa86e | Volgarenok/spbspu-labs-2024-tp-a | timchishina.anastasia/T3/commands.cpp | #include "commands.hpp"
#include <functional>
#include <map>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <streamGuard.hpp>
struct HasNumOfVertexes
{
size_t vertexNum;
explicit HasNumOfVertexes(size_t num);
bool operator()(const timchishina::Polygon& poly) const;
};
std::pair< timchishina... | ALGO | 0.971213 | 5.687466 |
474e2798-7d17-4b98-a391-ee956acdd942 | AlbanGauthier/IGR205projet | extern/eigen3/doc/examples/class_FixedVectorBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::VectorBlock<Derived, 2>
firstTwo(MatrixBase<Derived>& v)
{
return Eigen::VectorBlock<Derived, 2>(v.derived(), 0);
}
template<typename Derived>
const Eigen::VectorBlock<const Derived, 2>
firstTwo(c... | TOOL | 0.966939 | 5.212729 |
be5b1059-fdf0-4d00-a590-0a6432822834 | Shawn0630/CompressedTreeEditDistance | src/Tree.cpp | #include "Tree.h"
#include "Node.h"
#include <iostream>
#include <vector>
#include <string>
using namespace std;
//using namespace FPM;
Tree::Tree(string label, int treeSize) {
label_ = label;
treeSize_ = treeSize;
keyRoot_L_size = 0;
keyRoot_R_size = 0;
preL_to_preR = new int[treeSize_];
preR_to_preL = new... | ALGO | 0.96657 | 3.549269 |
dbb95213-023f-4f36-9004-a9c4f2b04fbf | P-M-Balaji/Cpp-Programming | TwoSum.cpp | #include <bits/stdc++.h>
using namespace std;
void findPairs(int arr[], int arr_size, int sum)
{
unordered_set<int> s;
for (int i = 0; i < arr_size; i++)
{
int temp = sum - arr[i];
if (s.find(temp) != s.end())
cout << temp << " " << arr[i] << endl;
s.insert(arr[i]);
... | ALGO | 0.999827 | 4.524475 |
4c8fd73a-fdfd-4938-aa37-c9b0da5b19d9 | i12gafej/ALGORITMICA | p1/GarciaFernandez/GarciaFernandez_Completa/funcionesBasicas.cpp | #include "funcionesBasicas.hpp"
void
rellenarVector(std::vector<int> &v){
std::srand(time(nullptr));
for(int i = 0; i < v.size(); i++){
v[i] = rand() % 10000000;
}
}
void imprimirColumnasTRTEyNE(std::string filename, std::vector <double> &numeroElementos, std::vector <double>
&tiemposReales, std::... | TOOL | 0.908224 | 3.555004 |
3c669ec9-6099-4bdc-8ddb-7a5907bf41bd | koralkulacoglu/CompetitiveProgramming | DMOJ/CCC/2015/S3.cpp | #include <iostream>
#include <set>
using namespace std;
int main() {
int g, p, curr;
set<int> d;
cin>>g>>p;
for (int i=0; i<p; i++) {
cin>>curr;
d.insert(curr);
}
int low = *d.upper_bound(g);
cout<<low;
}
| ALGO | 0.99997 | 3.428718 |
e4ab8934-8d51-409c-b6c9-04118df1f328 | febrianjoyo/Alpro-4208 | Pertemuan 8/Tugas Teori/pembagian.cpp | #include <iostream>
using namespace std;
int pembagian(int c, int o) {
if (o == 0){
cout << "Error: pembagian oleh angka 0 tidak terdefinisikan" << endl;
return 0;
} else if (c < o){
return 0;
} else {
return 1 + pembagian(c - o, o);
}
}
int main() {
int bil1 = 488... | ALGO | 0.999152 | 4.768986 |
afe67ca4-0ab9-4472-9cb4-9b676eaef9ba | nishgpt/competitive_programming | atcoder/abc169/C.cpp | /*
Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>
#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 100005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr... | ALGO | 0.999657 | 3.09866 |
94105178-59ee-4c87-bc4c-31ab2dd8d465 | laloxxx20/Parallel | lab-1/main.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int size = 3;
void multiplication(int a[size][size], int b[size][size], int c[size][size]){
for (int i = 0; i < size; ++i)
for (int j = 0; j < size; ++j)
for (int k = 0; k < size; ++k)
c[i][j] += a[i][k] * b[k... | ALGO | 0.999864 | 3.722716 |
2f63a4be-4fae-431a-89e5-3457adceda72 | sanma-icfpc/icfpc2018 | src/graph.cpp | #include "graph.h"
#include <deque>
#include <gtest/gtest.h>
const Vec3 unitX(1, 0, 0);
const Vec3 unitY(0, 1, 0);
const Vec3 unitZ(0, 0, 1);
TEST(Graph, SingleNode) {
int R = 20;
NGraph::World wld(R);
auto bot = wld.get_root();
wld.SMove(bot, unitZ);
NGraph::BotNode::Ptr b1, b2;
std::tie(b... | TEST | 0.994321 | 6.142724 |
41ce093d-d91a-41cd-8159-d14f631e3288 | seung-lab/znn-release | src/cpp/measurements/measure_mp.cpp | using namespace znn::v4;
int main(int argc, char** argv)
{
std::ofstream ofs;
ofs.open (argv[1], std::ofstream::out | std::ofstream::app);
std::vector<options> nodes, edges;
int64_t W = atoi(argv[2]);
int64_t D = atoi(argv[3]);
nodes.resize(D+1);
edges.resize(D);
nodes[0].push("name... | ALGO | 0.878481 | 5.252489 |
e0dcc273-9de5-4bd3-8a02-b217867001ea | graceemlin/codeforces | 2040/2040b.cpp | #include <bits/stdc++.h>
#include <climits>
#include <cstdint>
using namespace std;
int main(int argc, char* argv[]) {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int64_t n;
cin >> n;
int64_t ops = 1;
int64_t product = 1;
while (product < n) {
++produ... | ALGO | 0.999764 | 5.043346 |
48835c2f-be70-4f76-b5fb-4f33b6ce8def | JustHoang/IINT1306_CAU_TRUC_DU_LIEU_VA_GIAI_THUAT_HK20222 | LEETCODE/LEETCODE PRACTCE/2864. MAXIMUM ODD BINARY NUMBER.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
string maximumOddBinaryNumber(string s) {
int dem0 = 0, dem1 = 0;
for(char x: s){
if(x=='0') dem0++;
else dem1++;
}
string ans = "";
if(dem1>1) ans = string(dem1 - 1, '1') + string(dem0, '0') + "1";
else ans = string(dem1, '1... | ALGO | 0.999993 | 5.254978 |
f22f1623-3f32-4212-85cf-65d194da677e | anuj2001310/Leetcode- | 2690-house-robber-iv/2690-house-robber-iv.cpp | class Solution {
public:
bool check(int cap, vector<int>& nums, int k) {
int n = nums.size();
int i = 0;
while (i < n) {
if (nums[i] <= cap) {
if (--k == 0)
return true;
i += 2;
}
else
i+... | ALGO | 0.999978 | 5.773915 |
a077c4d9-ae73-42c3-bbf4-6293e9f9de90 | AAlkamel/Algorithms-level-2 | 29/ArrFullWithRandomCopyPrmeToAntherArray.cpp | #include <iostream>
#include <cmath>
#include <string>
using namespace std;
enum enPrime
{
prime,
notPrime
};
bool CheckPrime(int number)
{
int half = round(number / 2);
for (int i = 2; i <= half; i++)
{
if (number % i == 0)
return false;
}
return true;
}
int RandomNumber(int from, int to)
{
i... | ALGO | 0.999666 | 3.967643 |
069fe31a-db26-4977-85dc-a9c3fea4af22 | akap-04/RiYa | 0094-binary-tree-inorder-traversal/0094-binary-tree-inorder-traversal.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999992 | 6.426513 |
22cd3a65-e755-4061-a0e8-7a7c73c32870 | yok939/ZeroJudge-Code | TOI Beginner/m583.cpp | #include <bits/stdc++.h>
using namespace std;
int portal[100005];
int main(){
int k, largest=INT_MIN;
cin >> k;
memset(portal, 0, 100005);
for(int i=0;i<k;i++){
cin >> portal[i];
}
for(int i=0;i<k;i++){
int counter=0, next=0;
if(portal[i]!=0){
counter=0, ne... | ALGO | 0.999804 | 3.464636 |
05680e3b-289f-4970-a59a-e140194c727e | FranciscoMoretti/coding-challenges | hackerrank/making_candies.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
struct status
{
unsigned long long m;
unsigned long long w;
unsigned long long c;
};
void distribute_investment(unsigned long long &m, unsigned long long &w, unsigned long long inc)
{
unsigned long long m_plus_w_inc ... | ALGO | 0.999925 | 4.198531 |
b4b73668-c9ca-4f2f-b0d4-6343552f03df | nguyenhoang4875/CompetitiveProgramming | codeforces/edu_itmo_academy_pilot/segment_tree/step2/C_FirstElementAtleastX.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define For(i, a, b) for (int i = (int)a; i <= (int)b; i++)
#define Ford(i, a, b) for (int i = (int)a; i >= (int)b; i--)
#define Fore(it, x) for (auto it = x.begi... | ALGO | 0.99998 | 5.21008 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.