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 |
|---|---|---|---|---|---|---|
590d340d-d7ea-48c6-bc67-26b301003ef4 | computervisionlearner/unimrcp_with_huaweicloud_asr | plugins/huawei-recog/huaweicloud_asr/third_party/boost-src/libs/graph/example/topo-sort-with-leda.cpp | int main()
{
using namespace boost;
typedef GRAPH< std::string, char > graph_t;
graph_t leda_g;
typedef graph_traits< graph_t >::vertex_descriptor vertex_t;
std::vector< vertex_t > vert(7);
vert[0] = add_vertex(std::string("pick up kids from school"), leda_g);
vert[1] = add_vertex(std::strin... | ALGO | 0.997873 | 4.451452 |
7c48ddb8-9f9a-46fa-9d7d-fff89d6974e2 | ishandutta2007/codeforces | waynetuinfor/normal/500/E.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10, lg = 20;
int p[maxn], l[maxn], to[maxn], nxt[lg][maxn];
long long w[lg][maxn];
struct segtree {
#define m ((l + r) >> 1)
int maxv;
segtree *lc, *rc;
segtree(int l, int r) {
maxv = 0;
if (l == r) lc = rc = nullptr;
... | ALGO | 0.999983 | 3.866893 |
84a8a41d-8420-4e3c-b058-36fce97529ac | J6pirata/EDPROVA2 | SHELL.cpp | #include <iostream>
void shellSort(int num[], int* A) {
int h = 1;
while (h < A / 3) {
h = 3 * h + 1;
}
//
while (h >= 1) {
for (int i = h; i < A; i++) {
int aux = num[i];
int j = i - h;
while (j >= 0 && num[j] > aux) {
nu... | ALGO | 0.999963 | 4.944303 |
754b1947-cbc8-45db-9a81-40047bececb9 | messhii/Atcoder | ABC326/A.cpp | #include <iostream>
using namespace std;
int main(){
int x, y;
cin >> x >> y;
int diff = y - x;
if(diff <= 2 && diff >= -3) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
} | ALGO | 0.99997 | 3.041917 |
b5e616e5-ef4c-40ca-b2d7-f45ab870e34a | kummandas/400DSA | BINARY TREE/42.cpp | /*
Time Complexity : O(N)
Space Complexity : O(N)
Where 'N' is the total number of nodes in the binary tree.
*/
// Use answer to store traversal of nodes.
vector<int> answer;
void inOrder(BinaryTreeNode<int> *node) {
// Base case.
if (node == NULL) {
return;
}
// Visit left sub... | ALGO | 0.999948 | 6.364004 |
077ffda0-e379-42ef-89cf-1ad48f3965dd | NitichaiSawangsai/BUU-Y1 | 31 = 888144/lab4.1/HW2_07.cpp | /*
TASK : LAB2_07
LANG : C++
AUTHOR : NItichai Sawangsai
STUDENTID : 59160668
MAJOR : SE
*/
using namespace std;
#include <iostream>
#include <string.h>
#include <iomanip>
struct student {
char subjects[60];
float credit;
float grader;
};
int main () {
int i,num;
float sum_credit=0,sum_grader=0,sum=0;
cin>>num... | ALGO | 0.967079 | 3.515335 |
88bd0105-fa01-4830-ad0a-9c13d2e60c73 | bradosia/Magical_RPG_graphic | libs_src/reactphysics3d/mathematics/mathematics_functions.cpp | // Libraries
#include <reactphysics3d/mathematics/mathematics_functions.h>
#include <reactphysics3d/mathematics/Vector3.h>
using namespace reactphysics3d;
/// Compute the barycentric coordinates u, v, w of a point p inside the triangle (a, b, c)
/// This method uses the technique described in the book Real-Time colli... | ALGO | 0.997689 | 6.992758 |
23fcd724-b883-473c-8ebc-db94c92b4c4b | ahmdalgendi/Problem-Solving | CodJam/A/main.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll val (string s ){
ll d , sum =0 , pw = 1, mv=0;
for (int i = 0; i < s.size(); ++i) {
if (s[i] =='S') sum+= pw;
else pw*=2;
}
return sum ;
}
int main() {
int T ;
cin >>T ;
for (int wpw = 1; wpw <= T; +... | ALGO | 0.999765 | 3.920919 |
0057647b-41cc-48c8-8646-7087f2c34791 | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/14/52/19.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <iostream>
#include <iterator>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <cassert>
#include <cstr... | ALGO | 0.999785 | 3.066432 |
d32ec97a-ccb1-4756-8c49-4fe6376a9080 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9550_3.cpp | #include <bits/stdc++.h>
using namespace std;
int v1[200005], v2[200005];
vector<int> g1[200005], g2[200005];
unsigned long long aux[20], s[200005], rasp[200005];
int main() {
int n, m;
unsigned long long a, b, c, ans = 0;
int i, x, y, j;
scanf("%d%d%llu%llu%llu", &n, &m, &a, &b, &c);
for (i = 1; i <= m; i++)... | ALGO | 0.999614 | 3.601153 |
2f7c3530-58f1-4279-bb30-3558a89af7d1 | mdtalhaba/algorithms | Week_6/Fibonacci_Series/fibonacci_mamoization.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
long long save[N];
long long fibo(int n)
{
if(n<=1) return 1;
if(save[n] != -1) return save[n];
long long ans1 = fibo(n-1);
long long ans2 = fibo(n-2);
save[n] = ans1 + ans2;
return save[n];
}
int main()
{
int n; cin>>n;
... | ALGO | 0.999994 | 4.619096 |
16578f9c-6ba2-48e5-8872-66b8b1fa7d5f | qiaobeibei/LeetCode | LeetCode/19.四数相加Ⅱ.cpp | /*
ĸ nums1nums2nums3 nums4 鳤ȶ n жٸԪ (i, j, k, l) 㣺
0 <= i, j, k, l < n
nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0
*/
#include <iostream>
#include <vector>
#include <unordered_map>
// +ϣ
// ȼa+bֵmap,Ȼ-c-dǷmapУͳkeyvalue
class Solution {
public:
int fourSumCount(std::vector<int>& nums1, std::vector<int>& nums2... | ALGO | 0.999623 | 5.972089 |
55241b97-3d0b-429a-9411-f3ebb1dd2c37 | Harpreet2004/DSA_CPP | 907-koko-eating-bananas/koko-eating-bananas.cpp | class Solution {
public:
int maximu(vector<int>& piles) {
int maxi = INT_MIN;
for(int i=0;i<piles.size();i++) {
maxi = max(maxi,piles[i]);
}
return maxi;
}
long long findTotalHours(vector<int>& piles,int hourly) {
int n = piles.size();
long long ... | ALGO | 0.99987 | 5.947785 |
be715bc3-4b95-4d30-af00-0228f632d97c | jJayyyyyyy/OJ | notes/formatted_cout.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main(){
int a = 12;
// 整数,前面补0输出
cout<<setfill('0')<<setw(4)<<a<<'\n';
double b = 3.141;
// 保留n位小数
// cout.setf(ios::fixed);
cout<<fixed<<setprecision(4)<<b<<'\n';
cout<<fixed<<setprecision(2)<<b<<'\n';
return 0;
} | TOOL | 0.898528 | 3.475 |
2761da2f-cc8d-4435-ba7e-a60e709f30c3 | wwqdrh/interview-book | code/algo/getoffer/c++/4/str_split_all_palindrom.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
int minCut(const std::string &s) {
int n = s.size();
std::vector<std::vector<bool>> g(n, std::vector<bool>(n, true));
for (int i = n - 1; i >= 0; --i) {
for (int j = i + 1; j < n; ++j) {
g[i][j] = (s[i] == s... | ALGO | 0.999921 | 6.31837 |
65dfc1d4-6d4c-4642-9daf-b982acce132b | helloobaby/llvm_msvc | llvm/lib/Support/StringRef.cpp | #include "llvm/ADT/StringRef.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/edit_distance.h"
#include "llvm/Support/Error.h"
#include <bitset>
using namespace llvm;
// MSVC emits references to this into the translation u... | TOOL | 0.900056 | 7.230619 |
607b7083-6e06-4e72-9d05-893b99964831 | coxlab/boost_patched_for_objcplusplus | libs/spirit/classic/phoenix/example/fundamental/sample8.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#define PHOENIX_LIMIT 5
#include <boost/spirit/include/phoenix1_operators.hpp>
#include <boost/spirit/include/phoenix1_primitives.hpp>
#include <boost/spirit/include/phoenix1_composite.hpp>
#include <boost/spirit/include/phoenix1_special_ops.hpp>
#include <boo... | TOOL | 0.90236 | 5.092925 |
710b4e91-c21e-4b5a-bd71-76defa6c0035 | NgTrGianz/PTIT_DSA | DSA04035.cpp | #include<bits/stdc++.h>
using namespace std;
using str = string;
using ll = long long;
int mod = 1e9 + 7;
ll bin_pow(ll n, ll k){
if (k == 0) return 1;
else {
ll x = bin_pow(n, k / 2);
if (k % 2 == 1){
return (x * x) % mod * n % mod;
} else {
return x * x % mod;
... | ALGO | 0.999701 | 4.257751 |
b9ff6c0a-53c4-4477-97e3-63848b4349dc | rishav-rk/cppPrograms | quicksort.cpp | #include<bits/stdc++.h>
using namespace std;
int quicksort(int ar[], int left, int right){
int i = left - 1;
int j = left;
int pivot = ar[right];
while(j < right){
if(ar[j] <= pivot){
swap(ar[j],ar[++i]);
}
j++;
}
swap(ar[++i],pivot);
return i;
}
void... | ALGO | 0.999698 | 4.896799 |
6c11f37a-8b84-414f-9e80-02d8aa6b3d20 | tetrisroyale/a_tetrisroyale_godot_3.1 | servers/physics_2d/area_pair_2d_sw.cpp | /*************************************************************************/
/* area_pair_2d_sw.cpp */
/*************************************************************************/
/* This file is part of: */
/* ... | ALGO | 0.99725 | 7.092694 |
bc9b67d3-6d5d-4ea2-9e2d-7b3694f29c08 | ofabriciofarias/pythonScripts | Aula 16/opencv-4.x/samples/tapi/squares.cpp |
#include "opencv2/core.hpp"
#include "opencv2/core/ocl.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int thresh = 50, N = 11;
const char* wndname = "Square Detection ... | TOOL | 0.991779 | 6.865051 |
5748dbf4-f615-4f4c-9b11-2dcd3a98228e | amoshyc/cp-code | codeforces/620/e.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX_N = 400000;
const int MAX_NN = (1 << 19); // should be bigger than MAX_N
int N, M;
int A[MAX_N];
vector<int> g[MAX_N];
// [L, R)
int idxL[MAX_N];
int idxR[MAX_N];
int dfn = 0;
void dfs(int u, int p) {
idxL[u] = dfn++;
for (int... | ALGO | 0.999883 | 5.254022 |
66512d26-5a58-4f36-9c7a-e53aec59ecc3 | mberdev/advent_of_code_2024 | day04/CMakeProject/CMakeProject.cpp | #include "CMakeProject.h"
#include "infrastructure/file_reader.hpp"
//#include "input_parser.hpp"
#include "text_based_grid.hpp"
#include <vector>
#include <filesystem>
#include <iostream>
#include <algorithm>
#include <regex>
#include <cassert>
#include <tuple>
#include <string>
using namespace std;
class App {
pub... | TOOL | 0.99225 | 5.129101 |
266bc6d4-0910-4596-953c-a4dfccdb54ef | mynamewini/tugas-praktikum-c | PERTEMUAN 5/TugasMandiri3.cpp | #include <stdio.h>
int main() {
int jam_masuk, jam_keluar, lama_parkir, biaya_parkir;
printf("Program Menghitung Biaya Parkir\n");
printf("Jam masuk (1-12): ");
scanf("%d", &jam_masuk);
printf("Jam keluar (1-12): ");
scanf("%d", &jam_keluar);
if (jam_keluar < jam_masuk) {
jam_ke... | ALGO | 0.9986 | 4.795148 |
d062fd49-4f2a-4e1b-9432-96c6f9f84d47 | Pratham-Sharda/GFG_SOLN | Easy/BFS of graph/bfs-of-graph.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to return Breadth First Traversal of given graph.
vector<int> bfsOfGraph(int V, vector<int> adj[]) {
// Code here
vector<int> ans;
queue<int> q;
q.pu... | ALGO | 0.999954 | 6.234796 |
b6ecaec1-fde9-4188-a1e5-05a3870fcb86 | omkaranu04/CP_DSA | Codeforecs/1-1998/556B.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
int n;
cin >> n;
int a[n], b[n];
bool flag = false;
for (int i = 0; i < n; i++)
{
cin >> a[i];
b[i] = i;
}
for (int i = 0; i < n; i++)
{
for (int i = 0; i < n; i++)
... | ALGO | 0.999999 | 3.684534 |
00d6b605-d3e9-4309-8a04-8fe6ef2ed553 | AOSP-10-CAF/frameworks_av | media/libstagefright/codecs/m4v_h263/dec/src/deringing_chroma.cpp | #include "mp4dec_lib.h"
#include "post_proc.h"
#ifdef PV_POSTPROC_ON
void Deringing_Chroma(
uint8 *Rec_C,
int width,
int height,
int16 *QP_store,
int,
uint8 *pp_mod
)
{
/*----------------------------------------------------------------------------
; Define all local variables
... | ALGO | 0.998677 | 3.818435 |
27450be5-6854-47c0-9ccb-e26924591996 | sailfishos-mirror/llvm-project | libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp | // UNSUPPORTED: c++03, c++11
// <vector>
// vector.bool
// template <class... Args> reference emplace_back(Args&&... args);
// return type is 'reference' in C++17; 'void' before
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
TEST_CONSTEXPR_CXX20 bool tests() {
{
typed... | TEST | 0.879732 | 6.027022 |
08e749d6-51e3-4113-abba-66dce022358b | abdul202030/cpp-docs | docs/mfc/reference/codesnippet/CPP/ctreectrl-class_46.cpp | // Sort the item in reverse alphabetical order.
int CALLBACK MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
// lParamSort contains a pointer to the tree control.
// The lParam of an item is just its handle,
// as specified with SetItemData
CTreeCtrl* pmyTreeCtrl = (CTreeCtrl*)lParamSort... | ALGO | 0.997944 | 4.292652 |
a6cd27e7-0e81-4b66-9bae-a21f84336ffe | AshWatts/CP | Buy_and_Sell_Crypto.cpp | #include <iostream>
#include <vector>
using namespace std;
// class Solution {
// public:
// int maxProfit(vector<int>& prices) {
// int M=0;
// for(int i=0;i<prices.size();i++)
// {
// for(int j=i+1;j<prices.size();j++)
// {
// int m=prices[j]-prices... | ALGO | 0.999008 | 5.488928 |
b5a6a46a-4af5-4500-bd3c-23d64a2a39a7 | mahrth/Cpp-Buch2 | 2023.03/src/Vertiefung/Templates/sortieren02.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
ostream& operator<<(ostream& os, const vector<int>& v) {
os << "[ ";
for(auto e : v) { os << e << " "; }
os << "]";
return os;
}
bool vergleich(int i,int j) {
return (i<j);
}
struct Vergleicher {
bool operator()(int i,int j) { ... | ALGO | 0.999134 | 4.991847 |
6b740491-d42a-4864-89e2-8e7933a28954 | Daa09/daa | asi.cpp | #include <iostream>
#include <climits>
using namespace std;
struct Edge {
int u, v, weight;
};
int findMinKey(int key[], bool mstSet[], int V) {
int min = INT_MAX, minIndex;
for (int v = 0; v < V; v++)
if (!mstSet[v] && key[v] < min)
min = key[v], minIndex = v;
ret... | ALGO | 0.999958 | 5.905276 |
51511f77-0272-4f49-88c1-3d144965b9f2 | BanRuoBoLuo/LeetCodeSolution | BackTracking/1254_Number_of_Closed_Islands.cpp | /*************************************************************************
1254. Number of Closed Islands
Medium
Given a 2D grid consists of 0s (land) and 1s (water). An island is a maximal 4-directionally connected group of 0s and a closed island is an island totally (all left, top, right, bottom) surrounded by 1s.
... | ALGO | 0.99997 | 6.648661 |
8b8544b5-3b1f-483c-831a-2eac9255fc5c | wolfvoid/HNU-resourses | 专业核心-算法设计与分析(89)/算法设计-实验/实验3_甘晴void/第1题扩展 Dijkstra-matrix.cpp | #include <iostream>
#include <cstring>
using namespace std;
const int N = 510;
int n, m;
int g[N][N];// 邻接矩阵
int dist[N];// 距离
bool st[N];// 是否已经确定了最短路径
int dijkstra()
{
memset(dist, 0x3f, sizeof dist);
dist[1] = 0;// 初始化第一个节点
for(int i = 0; i < n - 1; i++)// 循环n - 1次
{
int t = -1;// 找最小节点
... | ALGO | 0.999964 | 3.916219 |
f46273a3-9aee-4ec3-b173-7b491b5a3be3 | sarvex/leetcode-matlab | solution/2000-2099/2044.Count Number of Maximum Bitwise-OR Subsets/Solution.cpp | class Solution {
public:
int mx;
int ans;
vector<int> nums;
int countMaxOrSubsets(vector<int>& nums) {
this->nums = nums;
mx = 0;
ans = 0;
for (int x : nums) mx |= x;
dfs(0, 0);
return ans;
}
void dfs(int i, int t) {
if (i == nums.size())... | ALGO | 0.999972 | 5.775457 |
29eb2865-642a-4f68-9a44-de159f3bffea | DMcDe/advent-of-code-2024 | d10b-sol.cpp | using namespace std;
#include <fstream>
#include <iostream>
#include <queue>
#include <vector>
void updateNeighbors(queue<pair<int, int>> &q, const vector<vector<int>> &grid, vector<vector<int>> &paths,
vector<vector<bool>> &vis, int r, int c, int m, int n) {
vector<pair<int, int>> neighbors ... | ALGO | 0.99983 | 6.751822 |
7162c2fe-3d76-4e74-bfc3-f30169888f1c | Golden007Credentials/https-github.com-Golden007Credentials-node | deps/icu-small/source/i18n/csdetect.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_CONVERSION
#include "unicode/ucsdet.h"
#include "csdetect.h"
#include "csmatch.h"
#include "uenumimp.h"
#include "cmemory.h"
#include "cstring.h"
#include "umutex.h"
#include "ucln_in.h"
#include "uarrsort.h"
#include "inputext.h"
#include "csrsbcs.h"
#include "csrmbcs.h"... | TOOL | 0.875789 | 7.070538 |
af027125-4fec-463b-9aa7-0c50c361e9f5 | chandrusuresh/CarND-Path-Planning-Project | src/Eigen-3.3/bench/spbench/sp_solver.cpp | // Small bench routine for Eigen available in Eigen
// (C) Desire NUENTSA WAKAM, INRIA
#include <iostream>
#include <fstream>
#include <iomanip>
#include <Eigen/Jacobi>
#include <Eigen/Householder>
#include <Eigen/IterativeLinearSolvers>
#include <Eigen/LU>
#include <unsupported/Eigen/SparseExtra>
//#include <Eigen/Sp... | ALGO | 0.992317 | 4.29849 |
209f1b72-e424-4cae-8ac6-aa45af1dc832 | flyskyosg/3dvc | 数据结构/内排序/希尔排序-测试版.cpp | #include<iostream.h>
#define max 50
int st[max]={6,4,2,8,1,3,7,9,4,2}, //
top=10;
int inc[]={1,3,5}; //
void insertpx(int j,int inc)
{
int k=0,t=0,p=0,z=0;
for(k=j+inc;k<=top-1;k+=inc) //Ԫ
{
t=0;p=0;
if(st[k]<st[k-inc])
{
for(z=j;z<k;z+=inc)
{
if(st... | ALGO | 0.999982 | 3.167955 |
67e57a9c-8ecb-441e-904e-0d8dc2738346 | GianfrancoMS/Algorithms | Graph Search Algorithms/DFS.cpp | #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
using namespace std;
class AdjacencyList {
public:
AdjacencyList() = default;
~AdjacencyList() = default;
void insertVertex(int vertex) {
if (vertices.find(vertex) == vertices.end())
vertices[vertex... | ALGO | 0.999688 | 5.635495 |
ffba9d09-2fd2-450c-940e-ed2415d2042b | bibongbong/my_px4 | src/modules/ekf2/EKF/aid_sources/external_vision/ev_pos_control.cpp | /**
* @file ev_pos_control.cpp
* Control functions for ekf external vision position fusion
*/
#include "ekf.h"
static constexpr const char *EV_AID_SRC_NAME = "EV position";
void Ekf::controlEvPosFusion(const imuSample &imu_sample, const extVisionSample &ev_sample,
const bool common_starting_conditions_pas... | ALGO | 0.964601 | 3.478173 |
03c98a19-b188-4761-b2ca-1eb8f1b4c6b0 | VadimAndreich/Parallels | Homework 2/3/equations.cpp | #include <iostream>
#include <chrono>
#include <omp.h>
#include <cmath>
int THREADS = 1;
void init_arrays(double a[], double b[], double x[], int n)
{
#pragma omp parallel
{
#pragma omp for
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++)
a[i * n + j] = i =... | ALGO | 0.99973 | 4.117508 |
6bde1a6a-04e5-47c1-943f-dd222a66e013 | LuG3Zz/DScode-Cppcode | Ds/线性表/SeqList/source/Merge.cpp | #include "SeqList.cpp"
int main(int argc, char const *argv[])
{
SeqList mylist,yourlist,list;
InitSeqList(&mylist);
InitSeqList(&yourlist);
push_back(&mylist,1);
push_back(&mylist,3);
push_back(&mylist,5);
push_back(&mylist,7);
push_back(&mylist,9);
push_back(&yourlist,2);
pus... | ALGO | 0.968473 | 4.067923 |
31ec5a7a-c614-44ff-b850-d8e940c6fc31 | mateusvendramini/SimulatedAnnealing | EUL/eulkemr_.cpp | #include <stdio.h>
#ifndef __UNIX_
#include <stdlib.h>
#endif
#include "mensagem.h"
#include "memvirtu.h"
#include "lowparam.h"
#include "lowmacro.h"
#include "lowsolid.h"
#include "eulerops.h"
#include "curvgeom.h"
#include "mancommd.h"
#ifdef __Extended_Version
void MSD_execKEMR(void)
{
int sn, fn, v1, v2, op;
... | TOOL | 0.865672 | 3.60052 |
34fa405b-62d3-49b4-be6e-cd39a2eaed05 | L1SPER/SearchAlgorithms | BinarySearch/BinarySearch.cpp | #include<iostream>
using namespace std;
int BinarySearch(int arr[], int left, int right, int number)
{
if (right >= 1)
{
int mid = left+(right-left) / 2;
if (arr[mid] == number)
return mid;
if (arr[mid] > number)
return BinarySearch(arr, left, mid-1, number);
return BinarySearch(arr, left,mid+1 , num... | ALGO | 0.999767 | 5.169273 |
931de23f-03af-4df9-9aac-714ac97124be | ComputerDruid/cs4-project | water.cpp | //File: water.cpp
///Project Part 2
///4.21.2011
///Joe Hallahan
///Dan Johnson
#include "WaterConf.h"
#include "solver.h"
#include <cstdlib>
#include <iostream>
#include <algorithm>
using std::atoi;
using std::cout;
using std::cerr;
using std::endl;
using std::list;
int NUM_HOURS = 12;
int end(0);
std::vector<i... | ALGO | 0.989571 | 4.182993 |
1f16df5f-4bab-4f0f-a465-66d3d4eb6a3c | Seirisiii/submit | posn/C1Y22.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
if(n<=0 or n>100)cout<<"Error";
else{
int arr[100]={};
for(int i=0;i<n;++i){
cin>>arr[i];
if(arr[i]<-100 or arr[i]>100){
... | ALGO | 0.999658 | 4.283141 |
d975c816-9bfd-43bf-b990-ccfa58db04ed | singlarohan/leetcode_sol | 1371-minimum-remove-to-make-valid-parentheses/2022-09-04 12.12.15 - Compile Error - runtime NA - memory NA.cpp | class Solution {
public:
string minRemoveToMakeValid(string s) {
int count{};
for(int i = 0; i < s.size(); i++){
if(s[i] == '(')
count++;
if(s[i] == ')'){
if(count == 0)
s[i] = "";
else
co... | ALGO | 0.999751 | 5.750502 |
ed78626e-84e3-4ce9-b5ba-f0b6c49a5dc5 | sunnyx33/leetcode | 剑指 Offer II 029. 排序的循环链表.cpp | class Solution {
public:
Node* insert(Node* head, int insertVal) {
Node* node = new Node(insertVal);
if(head == nullptr) {
node->next = node;
return node;
}
Node* maxNode = head;
Node* curNode = head;
do {
if(insertVal >= curNode->v... | ALGO | 0.999988 | 5.724094 |
08107ac2-36b7-4217-b199-88a32ae1d2bd | khanhtc1202/cp | leetcode/prepare/1615.cpp | /*
https://leetcode.com/problems/maximal-network-rank/
*/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int maximalNetworkRank(int n, vector<vector<int>>& roads) {
int adj[101][101] = {};
int rank[101] = {};
for (auto& road: roads) {
adj[road[0]][road[1]... | ALGO | 0.999907 | 5.720621 |
522c6ba7-17f5-4db5-ab41-19a427ae3219 | kidcher1412/trituenhantao | giaidothimincost.cpp | #include <bits/stdc++.h>
using namespace std;
#define maxn 1000
#define maxf 1000000000
int a[maxn][maxn],h[maxn],F[maxn],n,m,s,t;
int f[maxn],parent[maxn],visited[maxn];
int struc[maxn][maxn],posX,posY;
void strucs()
{ int temp=1;
for(int i=1;i<=n/3;i++)
for(int j=1;j<=n/3;j++)
{
struc[i][j]=temp;
temp++;... | ALGO | 0.999963 | 3.734269 |
129676c0-3ae1-40cb-92c8-6290267b6bff | Aditya2600/DSA | binaryspace.cpp | #include<iostream>
#include<vector>
using namespace std;
int binarySearch(vector<int> &input,int target){
int lo = 0;
int hi = input.size() - 1;
while (lo <= hi){
int mid = (lo + hi)/2;
if(input[mid]==target) return mid;
else if (input[mid]<target){
lo = mid + 1 ;
}else if (input[mid>targe... | ALGO | 0.999458 | 5.183657 |
42171207-da4b-4e51-9bad-fc7be2398c2d | Pafffnutiy/LabsProgLang | laboratory-work-01-PavelZilbershteyn/NewDir/Matrix.cpp | #include "Matrix.h"
#include <vector>
#include <cassert>
#include <algorithm>
/*
Matrix::Matrix()
:size{ 0 }, coefs{ nullptr }
{}
Matrix::~Matrix()
{
if (coefs != nullptr)
{
delete[] coefs;
coefs = nullptr;
}
size = 0;
}
Matrix::Matrix(const Matrix& other)
:size{ other.size }
... | ALGO | 0.980926 | 3.780583 |
be62da8a-1b20-4aba-bf7b-3e6c27259be4 | IagoFloriano/DesafiosProg | sem9/D.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
ios_base::sync_with_stdio(0);
int n, m;
cin >> n >> m;
vector<vector<int>> empresas(n, vector<int>(m));
vector<int> in(n);
for(int i = 0; i < n; i++){
int c;
cin >> c;
while(c--){
int temp;
cin >> temp;
... | ALGO | 0.999946 | 3.195835 |
b89c458f-d51e-4aa8-9cb1-3ea1d3aebbbb | gothinc/leetcode | leetcode/coin.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
struct coin_t{
int coin_size;
int coin_val;
};
class Coin{
public:
Coin();
~Coin();
public:
int cal();
private:
void init_coin();
int excute(int num, int tj);
private:
... | ALGO | 0.999112 | 4.007848 |
8b707249-a83a-45f4-a76f-63259aeb9032 | sabbirahmedfahim/ProblemSolving | Codeforces/B_AB_Flipping.cpp | #include <bits/stdc++.h>
#define nl '\n'
#define ll long long
#define all(c) c.begin(),c.end()
#define print(c) for(auto e : c) cout << e << " "; cout << nl
using namespace std;
void solve()
{
int n; cin >> n;
string s; cin >> s;
int cntA = count(all(s), 'A');
if(cntA == n || cntA == 0)
{
co... | ALGO | 0.999677 | 5.116894 |
84c8ac99-ebf5-43db-9057-ea24bb92f0ea | SakshiI10/Cpp | Data Structure and Algorithm/Arrays/69_LargestEle.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution
{
public:
int largest(vector<int> &arr, int n)
{
vector<int> sortedArr(arr.begin(), arr.end());
sort(sortedArr.begin(), sortedArr.end());
return sortedArr[n - 1];
}
};
int main()
{
//... | ALGO | 0.999675 | 6.198994 |
42352a1a-8a96-448f-8664-548d9ea4e1be | alisha0903/LeetcodePractice | 0042-trapping-rain-water/0042-trapping-rain-water.cpp | class Solution {
public:
int trap(vector<int>& height) {
int n=height.size();
vector<int>left(n),right(n);
int mx=height[0];
for(int i=0;i<height.size();i++)
{
if(height[i]>mx)
{left[i]=height[i];
mx=height[i];
}
el... | ALGO | 0.999987 | 6.775396 |
9dde5560-9ae3-4af6-b129-b9bf6493c978 | svanegas/programming_solutions | TopCoder/SRMs/DIV 2/145/imageDithering.cpp | #include <algorithm>
#include <iostream>
#include <iterator>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#includ... | ALGO | 0.99873 | 3.866376 |
0c4a36b0-94f1-4c0e-a587-3224050c75d8 | him0727/Online-Judge-Solutions | SPOJ/SVAREA11.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int p;
scanf("%d", &p);
for (int pp = 1; pp <= p; pp++) {
int n, a;
scanf("%d %d", &n, &a);
pair<int, int> asg[a];
for (int i = 0; i < a; i++) {
scanf("%d %d", &asg[i].first, &asg[i].second);
}
sort(asg, asg + a, [](pair<... | ALGO | 0.999926 | 3.774378 |
68fe6d8a-7c2f-43d8-9770-10c6d3142764 | meraioth/EA1 | avl.cpp | #include "avl.h"
#include <iostream>
using namespace std;
BinarySearchTree::tree_node* AVL::insertar_avl(int data)
{
tree_node* nodo = insertar(data);
balance(nodo);
}
int AVL::bfactor(BinarySearchTree::tree_node* temp)
{
int l_height,r_height;
if(temp->left){
l_height = temp->left->height;
... | ALGO | 0.998667 | 4.614849 |
cb878c2b-c5e3-45dd-9a56-7224cccb8330 | EmilVega/Computer_graphics | Curva_Bezier/glm-0.9.7.1/test/core/core_func_integer_find_msb.cpp | #include <glm/glm.hpp>
#include <cstdio>
#include <cstdlib> // To define "exit", req'd by XLC.
#include <ctime>
#define LE 1 // 1 for little-endian, 0 for big-endian.
int pop(unsigned x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0... | ALGO | 0.998104 | 3.533907 |
7c57a38d-d406-4032-ab51-e8554cf011d4 | VDrift/vdrift | src/cfg/config.cpp | /************************************************************************/
/* */
/* This file is part of VDrift. */
/* */
/* VDrift is free so... | TEST | 0.914336 | 5.807812 |
f8bb0c0e-8d80-4919-855b-8da5f6a5463c | firecrushpda/superpolicegame | Polygon Fighter/Polygon Fighter/DirectX 11 Engine VS2017/DirectX 11 Engine VS2017/Includes/source/geomutils/src/distance/GuDistancePointTriangle.cpp | #include "foundation/PxVec3.h"
#include "GuDistancePointTriangle.h"
#include "GuDistancePointTriangleSIMD.h"
using namespace physx;
// Based on Christer Ericson's book
PxVec3 Gu::closestPtPointTriangle(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, float& s, float& t)
{
// Check if P in vertex r... | ALGO | 0.999216 | 6.948751 |
4d631912-ba28-4445-a981-d2677404c188 | AbhinavTiwari2705/Leetcode | 1706. Where Will the Ball Fall.cpp | class Solution {
public:
vector<int> findBall(vector<vector<int>>& grid) {
int m = grid.size(); //rows
int n = grid[0].size(); //columns
vector<int> result;
for(int ball = 0; ball<n; ball++) {
int row = 0;
int col = ball;
b... | ALGO | 0.999991 | 5.937615 |
a24f344f-fb9c-4500-b14f-aa2c182ff995 | waura/frayer | 3rdparty/OpenCV-2.3.0/modules/objdetect/src/fft.cpp | #include "precomp.hpp"
#include "_lsvm_fft.h"
int getEntireRes(int number, int divisor, int *entire, int *res)
{
*entire = number / divisor;
*res = number % divisor;
return FFT_OK;
}
int getMultipliers(int n, int *n1, int *n2)
{
int multiplier, i;
if (n == 1)
{
*n1 = 1;
*n2 = 1... | ALGO | 0.999868 | 5.257389 |
f8a5fb22-b868-4b21-89dc-33d46e7b6dfd | Shubham-js/Codes | kth_root.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
int t;
cin >> t;
while (t--)
{
ll n;
cin >> n;
ll k;
cin >> k;
ll s = 1, e = n;
ll ans = 0;
while (s <= e)
{
ll mid = (s + e) >> 1;
if (pow(mid, k) <= n)
{
ans = mid;
s = mid + 1;
}
else
{
... | ALGO | 0.999933 | 4.116445 |
a798484d-43ea-4c94-828e-295dfd1eef88 | DanyResasco/Grasp-simulation | vcglib/apps/sample/polygonmesh_quadsimpl/polygonmesh_quadsimpl.cpp | #include <sstream>
#include <vcg/complex/complex.h>
#include <vcg/complex/algorithms/clean.h>
#include <wrap/io_trimesh/import.h>
#include <wrap/io_trimesh/export_off.h>
#include <vcg/complex/algorithms/polygon_support.h>
#include <vcg/complex/algorithms/local_optimization/quad_diag_collapse.h>
#include <vcg/complex... | ALGO | 0.99163 | 5.924818 |
8ba9ea2b-bcfa-4762-91d1-11c569c4e5e7 | coderajdeep/SDE-AZ | 01--array/29--pascalTriangle--118.cpp | // Pascal Triangle
// https://youtu.be/bR7mQgwQ_o8
// Clear explanation
// If Need to return R th row and C th column element then need to return (R-1) C (C-1) element
/*
nCr value
int ans = 1;
for(int i=0; i<c; ++i) ans *= ((n-i)/(i+1));
for a single row,
In N row, there will be N element
vector<int> ans(N);
ans[0] ... | ALGO | 0.999902 | 6.336011 |
59d02f19-7ccc-424b-a30f-63183aa9b5e4 | hkhetawat/SCOREP_Applications | lammps/lib/gpu/lal_lj96_ext.cpp | /***************************************************************************
lj96_ext.cpp
-------------------
W. Michael Brown (ORNL)
Functions for LAMMPS access to lj96/cut acceleration routines.
____________________________... | TOOL | 0.890507 | 4.791157 |
fd864afa-ab75-47eb-bcfd-534ce76c461f | QuanNM-PTIT/Data_Structures_and_Algorithms_PTIT | Queue/DSA08022 - BỘI SỐ LỚN NHẤT CỦA 3.cpp | // Created by Nguyễn Mạnh Quân
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz size()
#define ll long long
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORD(i, a, b) for(int i = a; i >= b; i--)
#define F(i, a, b) for(int... | ALGO | 0.999565 | 3.93769 |
88081169-327f-49d7-8565-0bb62b2e0a60 | kmjp/procon | leetcode/401-450/405/3211.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a)... | ALGO | 0.999963 | 4.572375 |
a01467ad-8025-4d94-80a6-5b5356c6eeca | leo-drive/avte.autoware_universe | evaluator/localization_evaluator/src/metrics_calculator.cpp | #include "localization_evaluator/metrics_calculator.hpp"
#include "localization_evaluator/metrics/localization_metrics.hpp"
namespace localization_diagnostics
{
Stat<double> MetricsCalculator::updateStat(
const Stat<double> stat_prev, const Metric metric, const geometry_msgs::msg::Point & pos,
const geometry_msgs... | TOOL | 0.942281 | 6.523847 |
4522ad64-d1b5-4aeb-87a9-6ad772c059cf | kennent/for_scsc_code_save | codeforces/1012div2/e1.cpp | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
int t;
vector<int> a, b, check;
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> t;
while (t--) {
int n, w, r = 1;
ll sum = 0;
cin >> n >> w;
a = vect... | ALGO | 0.999956 | 3.851691 |
019ff59d-a166-4ff7-8f32-9a2ead83b6f6 | becastal/maratona | beecrowd/matematica/oraculoDeAlexandria.cpp | #include <bits/stdc++.h>
#define f first
#define s second
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define dbg(x) cout << #x << " = " << x << endl
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
using namespace std;
void solve()
{
int n; string f;
c... | ALGO | 0.999789 | 4.07658 |
24adccdb-1365-4a49-bf48-69d0211f6cda | Algebraic-Programming/ALP | tests/smoke/pregel_connected_components.cpp | #include <exception>
#include <iostream>
#include <vector>
#include <inttypes.h>
#include <graphblas.hpp>
#include <graphblas/algorithms/pregel_connected_components.hpp>
#include <graphblas/utils/timer.hpp>
#include <graphblas/utils/parser.hpp>
#include <graphblas/utils/singleton.hpp>
#include <graphblas/utils/ite... | TEST | 0.946665 | 6.736793 |
01f1e1c2-6ae0-4281-a58a-f3f492d50924 | sarvex/leetcode-scheme | solution/2200-2299/2222.Number of Ways to Select Buildings/Solution.cpp | class Solution {
public:
long long numberOfWays(string s) {
int n = s.size();
int cnt0 = 0;
for (char& c : s) cnt0 += c == '0';
int cnt1 = n - cnt0;
int c0 = 0, c1 = 0;
long long ans = 0;
for (char& c : s) {
if (c == '0') {
ans += c... | ALGO | 0.999983 | 6.250443 |
11a08500-9542-49e1-8a3f-85fff082b870 | susilehtola/erkale | src/trrh.cpp | #include "trrh.h"
#include "linalg.h"
#include "mathf.h"
#include "timer.h"
#include "basis.h"
#include <cfloat>
/// Throw error if eigenvalues of K^2 are bigger than (should be negative!)
#define MAXNEGEIG 1e-4
template<typename T> arma::Mat<T> make_expK(const arma::Mat<T> & kappa) {
// Amount of virtual orbitals... | ALGO | 0.999683 | 5.930801 |
8a086735-0af5-4829-ac8e-178b82fbea6f | noviciusss/LeetCode_solutions | 3372-longest-strictly-increasing-or-strictly-decreasing-subarray/3372-longest-strictly-increasing-or-strictly-decreasing-subarray.cpp | class Solution {
public:
int longestMonotonicSubarray(vector<int>& nums) {
int dec=1,maxLen =1,inc=1;
for(int i=1;i<nums.size();i++){
if(nums[i]>nums[i-1]){
maxLen+=1;
dec=1;
}
else if( nums[i]<nums[i-1]){dec+=1;maxLen=1;}
... | ALGO | 0.999926 | 6.022875 |
988cc262-5f3a-457d-9bef-8c6bfd650ad0 | twmplen/LR6 | Task_2/main.cpp | #include <iostream>
#include <cstring>
#include <cctype>
#include <vector>
using namespace std;
// Функция для удаления заданного символа из текста
void removeChar(char* text, char toRemove) {
int length = strlen(text);
int index = 0;
for (int i = 0; i < length; ++i) {
if (text[i] != toRemove) {
... | TOOL | 0.913599 | 6.000902 |
b406b75a-670e-42d6-8dec-06f9d8174ca3 | ToshikSoni/Coding | coding 3rd year/DAA/linearsearch.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, ele, res = -1;
cout << "Enter number of elements: ";
cin >> n;
vector<int> arr;
for (int i = 0; i < n; i++)
{
int temp;
cout << "Enter " << i + 1 << "th term: ";
cin >> temp;
arr.push_b... | ALGO | 0.99912 | 5.278276 |
10ca7da5-6278-4d95-9f5e-6deb79bab9ef | rathoresrikant/HacktoberFestContribute | Algorithms/NumberTheory/gcd_lcm.cpp | int gcd(int a, int b)
{
if(b == 0)
return a;
else
return gcd(b, a % b);
}
int lcm(int a, int b)
{
return (a * b) / gcd(a, b);
}
| ALGO | 0.999165 | 3.182737 |
1834d4fb-56fa-40dc-b2bf-039292edbb89 | Shazzadujaman/XPSC | Week 1/Day2/G.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
int a[26]={0};
for(char c:s){
a[c-'a']++;
}
int flag=0;
for(int i=0;i<26;i++){
if(a[i]==0){
char c=i+'a';
cout<<c<<endl;
flag=1;
break;
}
}
if(flag==0){
cout<<"None"<<en... | ALGO | 0.999922 | 4.016082 |
5ee5bb7a-e14a-4141-ab0a-b7f3fdf9bb39 | Rain-716/CS-Programming | count characters.cpp | //19min 11s
#include <iostream>
#include <string>
using namespace std;
int main()
{
int T;
cin>>T;
string waste;
getline(cin,waste);
while (T--){
string s;
int a=0,b=0,c=0;
getline(cin,s);
for (int i=0;i<s.size()&&s[i]!=0;i++){
if ((s[i]>='A'&&s[i]<='Z')||... | ALGO | 0.983354 | 3.447149 |
5e150ff0-a44f-4b39-8606-57442103fdf3 | markebbole/cloth | eigen/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.999186 | 4.69287 |
2d7345f1-a806-48f0-896f-899955f778d0 | ishandutta2007/codeforces | .tx/normal/960/D.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;
#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hb... | ALGO | 0.999521 | 4.077284 |
eeecace3-57d2-4c13-ac46-c40cb210769a | yznovyak/Olymp | Contests/CodeJam/2016-2/B-easy.cpp | #include <cstdio>
#include <ctime>
#include <iostream>
#include <vector>
using namespace std;
typedef long long int64;
#define DPRINT(x) cerr << __LINE__ << ": " << #x << " = " << x << endl;
template <class T1, class T2>
ostream& operator <<(ostream& os, const pair<T1, T2>& v);
template <class T>
ostream& operator... | ALGO | 0.999944 | 3.879094 |
5ca878e7-e53b-4dcf-b311-832cb4cbbaa4 | siddharthagarwal543/Sunyul-Hossen-DSA-Questions | Minimum number of Coins.cpp | //Problem link:https://leetcode.com/problems/coin-change/
class Solution {
public:
int t[13][10001];
int help(int idx, vector<int>& coins, int amount) {
if (amount == 0)
return 0;
if (idx == coins.size())
return INT_MAX - 1;
if (t[idx][amount] != -1)
... | ALGO | 0.99999 | 6.088594 |
94bb48b6-a4f6-4094-9166-bec27b17d0ae | 192224102/Data-Structures | missing elements in distinct integers.cpp | #include <stdio.h>
int main() {
int i;
int arr1[] = {1, 2, 3, 5};
int n1 = sizeof(arr1) / sizeof(arr1[0]) + 1;
int expectedSum1 = (n1 * (n1 + 1)) / 2;
int actualSum1 = 0;
for ( i = 0; i < n1 - 1; i++) {
actualSum1 += arr1[i];
}
int missingElement1 = expectedSum1 - actualSu... | ALGO | 0.997109 | 3.996182 |
a779a207-8877-442d-9f6f-1d08a3e0d88a | sa-y-an/leetAction | solutions/problems/diameter_of_binary_tree/solution.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.999736 | 6.377435 |
27c251e3-69f6-4db9-8fd5-e0ab15be38fe | bae1776/A4_BOJPractice | A4_BOJPractice/12851.cpp | //https://www.acmicpc.net/problem/12851
//숨바꼭질 2
//수빈이와 동생은 1~100000 중 하나의 점에 있다.
//수빈이는 이동 혹은 순간이동을 하여 동생에게 도달하는 최단 시간과 최단으로 찾는 방법의 수를 구하세요.
//수빈이가 점 X에서 이동하면 X-1 또는 X+1 로 1초만에 갈 수 있고
//수빈이가 점 X에서 순간이동하면 2*X로 1초만에 간다.
#include <iostream>
#include <queue>
using namespace std;
queue<pair<int, int>> BFSQueue;
int visi... | ALGO | 0.999897 | 3.942855 |
70baf071-41a4-4bf3-b009-51748211218b | Aquib-Nawaz/CP4-Book | UVa/12965.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int A[10001],B[10001],T,N,M;
int f(int x){
int ans=0;
ans+= N-(upper_bound(A,A+N,x)-A);
ans+= (upper_bound(B,B+M,x-1)-B);
return ans;
}
int main(){
scanf("%d",&T);
while(T--){
scanf("%d %d",&N,&M);
for(int i=0;i<N;i+... | ALGO | 0.999983 | 3.507015 |
74367630-7efa-47e5-b9a3-16d391bff3ae | yosupo06/library-checker-problems | number_theory/gcd_of_gaussian_integers/checker.cpp | #include <vector>
#include <utility>
#include <stdint.h>
#include <inttypes.h>
#include "testlib.h"
using namespace std;
int main(int argc, char* argv[]) {
setName("compare sequences of tokens");
registerTestlibCmd(argc, argv);
int T = inf.readInt();
for (int t = 0; t < T; ++t) {
int ouf_a = ouf.readInt... | TEST | 0.995924 | 5.051704 |
729a347e-6e3c-4743-92a8-90a5e4494fac | danieldingchao/stcchm | third_party/WebKit/Source/modules/canvas2d/CanvasPathMethods.cpp | #include "modules/canvas2d/CanvasPathMethods.h"
#include "bindings/core/v8/ExceptionState.h"
#include "core/dom/ExceptionCode.h"
#include "platform/geometry/FloatRect.h"
#include "platform/transforms/AffineTransform.h"
#include "wtf/MathExtras.h"
namespace blink {
void CanvasPathMethods::closePath() {
if (m_path.i... | TOOL | 0.854585 | 7.39956 |
b385da04-ac5b-4a39-914b-91bc2b182bdc | Faerbit/Saxum | extern/bullet/Extras/CUDA/btCudaBroadphase.cpp | #include "LinearMath/btAlignedAllocator.h"
#include "LinearMath/btQuickprof.h"
#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
#include "btCudaBroadphase.h"
#include "radixsort.cuh"
#define BT_GPU_PREF(func) btCuda_##func
#include "../../src/BulletMultiThreaded/btGpuUtilsSharedDefs.h"
#include... | ALGO | 0.953461 | 6.956106 |
f0d0239d-b96f-457b-8264-4830fd4e7b2c | Dipto-shaha/LeetCode-Daily-Challenge | 2009-minimum-number-of-operations-to-make-array-continuous/2009-minimum-number-of-operations-to-make-array-continuous.cpp | class Solution {
public:
int bs(vector<int>&nums,int i,int n)
{
int li=i,hi=nums.size()-1,mid,ans;
while(li<=hi)
{
mid=(li+hi)/2;
if(nums[mid]<=(nums[i]+n-1))
{
ans=mid;
li=mid+1;
}
else hi=mid-1;... | ALGO | 0.999998 | 5.719586 |
9ad82d5f-30fc-4432-97f2-9f01d46a465e | fvmassoli/Path-Planning-Self-Driving-Car | src/Eigen-3.3/bench/benchmarkXcwise.cpp | // g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef VECTYPE
#define VECTYPE VectorXLd
#endif
#ifndef VECSIZE
#define VECSIZE 1000000
#endif
#ifndef REPEAT
#define REPEAT 1000
#endif
int main(int argc, c... | ALGO | 0.953534 | 3.923817 |
c79d6776-84d2-4d33-bd01-ec50e98e6e7e | i-Sa3ed/Algorithms | Dynamic Programming/Pick or Leave Pattern/lis-problem.cpp | // longest increasing subsequence problem with DP
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
/// https://leetcode.com/problems/longest-increasing-subsequence/
int n;
vector<int> seq;
vector< vector<int> > memory2; // 2d memory
int lis(int idx, int lastIdx) {
... | ALGO | 0.99998 | 5.453639 |
70162c82-c91a-4e6f-bf5e-1adcb32fe5c2 | SnigdhaMarkanday/Learn-Cpp | Functions/max.cpp | #include<iostream>
using namesace std;
int max(int x, int y,int z){
if(x>y && x>z){
return x;
}
else{
if(y>x && y>z){
return y;
}
else{
return z;
}
}
}
int main(){
cout<<"Enter the values of the no.";
int a,b,c,m;
cin>>a>>b>>c;
m=max(a,b,c);
cout<<"Maximum of the... | ALGO | 0.999775 | 4.005885 |
ff0268cc-7750-4e0c-996a-1434f9ef3beb | LionnelT/bank-app-ui | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.