uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2680fd6f-796d-4b04-ba7e-dd4653a0e614 | Forte-NaoP/Note | cpp/aho_corasick.cpp | #include <cstdio>
#include <cstring>
#include <cstdint>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
using namespace std;
struct TrieNode {
TrieNode* children[26];
TrieNode* failLink;
bool isEnd... | ALGO | 0.999921 | 5.131382 |
3a828ee1-5cab-4c0f-973f-a08eefa5e6fa | iamaryankr/completeDSA | BinaryTrees/serializedeserialize.cpp | #include<bits/stdc++.h>
using namespace std;
class TreeNode{
public:
TreeNode *left, *right;
int val;
TreeNode(): val(0), left(NULL), right(NULL){};
TreeNode(int x): val(x), left(NULL), right(NULL){};
};
class Codec {
public:
// Encodes a tree to a single string.
string seria... | ALGO | 0.999966 | 4.986578 |
58057922-e654-4a18-9034-6db1f93a4cfb | sarvex/leetcode-free-pascal | solution/0200-0299/0238.Product of Array Except Self/Solution.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int n = nums.size();
vector<int> ans(n);
for (int i = 0, left = 1; i < n; ++i) {
ans[i] = left;
left *= nums[i];
}
for (int i = n - 1, right = 1; ~i; --i) {
ans[i] ... | ALGO | 0.999987 | 6.609976 |
f337e224-9266-40a3-9842-443843b33e1a | Diamond101010/RMMDF | mmdf-master/tools/compute_image_mean.cpp | #include <stdint.h>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include "boost/scoped_ptr.hpp"
#include "gflags/gflags.h"
#include "glog/logging.h"
#include "caffe/proto/caffe.pb.h"
#include "caffe/util/db.hpp"
#include "caffe/util/io.hpp"
using namespace caffe; // NOLINT(build/name... | DATA | 0.898628 | 6.438655 |
815ca350-8450-4724-a2f2-6cb98ed2570e | shelltdf/osgall | prebuild/pcl-master/tools/train_unary_classifier.cpp | #include <pcl/io/pcd_io.h>
#include <pcl/console/print.h>
#include <pcl/console/parse.h>
#include <pcl/console/time.h>
#include <pcl/segmentation/unary_classifier.h>
using namespace pcl;
using namespace pcl::io;
using namespace pcl::console;
unsigned int default_cluster_size = 10;
double default_normal_radius_search... | DATA | 0.978151 | 6.392085 |
6c26c17f-6d56-4c7d-98a1-2d5ad3f9eb9d | BhumikaBahuguna/DAA-Lab | army_recur.cpp | #include<bits/stdc++.h>
using namespace std;
int breakArmy(int n){
if(n==1)
return 0;
int mini=1+ breakArmy(n-1);
if(n%2==0){
mini=min(mini,1+breakArmy(n/2));
}
if(n%3==0){
mini=min(mini,1+breakArmy(n/3));
}
return mini;
}
int main(){
int n;
cout << "Enter the... | ALGO | 0.999944 | 5.024363 |
765b8dc7-665b-47d0-86c7-6eb0101d7efe | TheFenrisLycaon/DSA-C-- | cp/CodeForces/0400-0499/472B.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
int main(){
int n, k; scanf("%d %d\n", &n, &k);
std::vector<int> floorVec(n);
for(int p = 0; p < n; p++){scanf("%d", &floorVec[p]);}
sort(floorVec.begin(), floorVec.end());
long total(0);
for(int p = n - 1; p >= 0; p -= k){total += 2 * (... | ALGO | 0.999752 | 3.725547 |
672de913-8381-4249-8ecf-9304eb24931a | ishandutta2007/codeforces | sankear/normal/500/E.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
using namespace std;
#define pb ... | ALGO | 0.999978 | 3.830711 |
b457c8c8-10ae-4720-9fc8-541537cec0f6 | IsratJahan09/Codeforces-problem | A - Turtle and Good Strings.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
while(n--){
int t; cin >> t;
string s;
cin >> s;
if(s[0]!=s[t-1])
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
| ALGO | 0.999846 | 4.014809 |
7d821e81-3992-49b8-a807-008210580a1c | DemberS06/CSES | Interactive_Problems/Hidden_Integer.cpp | // hola soy Dember :D
#include <bits/stdc++.h>
using namespace std;
int main(){
auto Query = [](int x){
cout<<"? "<<x<<endl;
string s;
cin>>s;
return s[0]=='Y';
};
int ans;
function<void(int, int)> Binary = [&](int l, int r){
if(l>r)return;
int m... | ALGO | 0.999738 | 3.456899 |
31a4f6ec-3bab-46dd-9463-7a688835744a | dan999666/MyLuoGuCode | Array/P2141.cpp | /*珠心算测验*/
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[1000], b[1000], cnt = 0;
//get input
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
b[i] = a[i];
}
//compare value three loop
for (int j = 0; j < n; ++j) {
for (int i = j + 1; i < ... | ALGO | 0.999922 | 3.973333 |
b75f80f1-677b-4a2b-9484-b2f2e515028a | sinian666/code_102_5 | cpp_副本15/chapter_searching/two_sum.cpp | /**
* File: two_sum.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 方法一:暴力枚举 */
vector<int> twoSumBruteForce(vector<int> &nums, int target) {
int size = nums.size();
// 两层循环,时间复杂度 O(n^2)
for (int i = 0; i < size - 1; i++) {
for (int j = i + 1; j ... | ALGO | 0.999914 | 6.081783 |
67a6babd-a196-4850-9322-251af604d869 | wcchang1019/NCTU_IntroductionToAlgorithms | HW1-1. Abracadabra/main.cpp | #include <iostream>
#include <string>
using namespace std;
string RE(string s,int L,int R)
{
if((R-L)%2==1){
return s;
}
int M = (R+L)/2;
string s1=RE(s.substr(0,(R-L)/2),L,M);
string s2=RE(s.substr((R-L)/2,(R-L)/2),M,R);
if(s1>s2){
return s2+s1;
}
else{
return s... | ALGO | 0.99991 | 3.80576 |
221aa92a-c2ae-43fe-8594-2db54224777e | 3DHome/3DHome | 3DHomeEngine/src/main/jni/src/bullet/BulletCollision/CollisionShapes/btTetrahedronShape.cpp | #include "btTetrahedronShape.h"
#include "LinearMath/btMatrix3x3.h"
btBU_Simplex1to4::btBU_Simplex1to4() : btPolyhedralConvexAabbCachingShape (),
m_numVertices(0)
{
m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
}
btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0) : btPolyhedralConvexAabbCachingShape (),
m_numVert... | TOOL | 0.943206 | 6.498385 |
c01de896-0320-43fb-8116-8a59a5e9a977 | melalonso/CompetitiveProgramming | COJ/Mathematics/COJ_1115 - Sequence Sum Possibilities/main.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
/*
ACCEPTED
*/
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int T, N, idx, res;
cin >> T;
while(T--){
res = 0;
cin >> idx >> N;
for(int i=1; (i*(i+1))/2 < N; i++){
if (!((N - ((i*(i+1)... | ALGO | 0.998744 | 4.462851 |
6f2ff95c-f6ba-4195-96d1-bb75bb662f90 | ishandutta2007/codeforces | mr_spade/normal/1456/C.cpp | #include<cstdio>
#include<algorithm>
#include<queue>
#define int long long
using std::sort;
using std::priority_queue;
const int N=5e5+5;
int n,k,ans;
int a[N];
priority_queue<int> Q;
signed main()
{
int x;
register int i;
scanf("%lld%lld",&n,&k);
for(i=1;i<=n;i++)
scanf("%lld",&a[i]);
sort(a+1,a+n+1,[](int a,in... | ALGO | 0.999944 | 3.406736 |
9771d32b-0aac-4318-888c-8f86ffc63530 | BusraRafa/CP_solutions-LeetCode-GG-Codeforces-Hackerrank- | Codeforces/lec-1.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int len=(n*2)-1;
for(int i=0;i<n;i++){
for(int k=0;k<i+1;k++){
cout<<"*";
}
for(int j=i+1;j<n;j++){
cout<<"#"... | ALGO | 0.999918 | 3.621798 |
e90e4f36-b721-4ff9-9268-68b2772eee5f | igasa-KCompetitiveProgramming/Atcoder | ABC340/c.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pint = pair<int,int>;
using pll = pair<long long, long long>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i,n) for (int i = 1; i <= (int)(n); i++)
#define YesNo(bool) if(bool) cout << "Yes" <... | ALGO | 0.999873 | 3.82301 |
68509122-b8ad-469d-b81d-5c3b4221f402 | sa-y-an/leetAction | solutions/problems/count_sorted_vowel_strings/solution.cpp | class Solution {
public:
int countVowelStrings(int n) {
vector <vector <int>> dp(n*5, vector <int> (5,0));
for( int i = 0 ; i < 5 ; i++) dp[0][i] = i+1;
for( int i = 1 ; i < n ; i++){
dp[i][0] = dp[i-1][4];
for( int j = 1; j < 5 ; j++){
dp[i]... | ALGO | 0.999939 | 6.492688 |
38c63cc5-ac92-4bc3-ba70-a7813af58c97 | Nih1tGupta/Leetcode-GFG | Easy/Break a number/break-a-number.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
int waysToBreakNumber(int N){
// int count=0;
// for(int i=0;i<=N;i++){
// for(int j=0;j<=N;j++){
/... | ALGO | 0.999972 | 5.858222 |
b9cadf5f-dd82-4bc8-b087-817dce692fac | taylortao/myLeetcode | sort/147_insertion_sort_linkedlist.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* insertionSortList(ListNode* head) {
if (head == NULL)
{
return NULL;
}
ListNode first(0);
first.next... | ALGO | 0.999971 | 5.921951 |
ca8427d3-56db-4704-b4ac-3fa946d40ee1 | sarvex/solution-cpp | 0010.regular_expression_matching.cpp | #include <string>
#include <vector>
using std::string;
using std::vector;
class Solution {
public:
static auto isMatch(const std::string& s, const std::string& p) {
const int m = s.length();
const int n = p.length();
vector result(m + 1, vector<bool>(n + 1));
result[0][0] = true;
auto match = [... | ALGO | 0.999366 | 5.86581 |
2c6ad0fb-72ec-42ea-967d-d07de0018228 | Zyp1e/algorithm_model | 数据结构/莫队.cpp | /*http://oj.daimayuan.top/course/15/problem/768*/
#include<bits/stdc++.h>
#define int long long
using namespace std;
//#define endl '\n'
const int N=5e4+10,B=500;
int n,m;
int a[N];
int tmp;
int cnt[N],ans[N],bot[N];
array<int,3>que[N];
int gcd(int a,int b){
return b==0?a:gcd(b,a%b);
}
bool cmp(array<int,3>a,array<... | ALGO | 0.999952 | 4.006333 |
58391c57-7b1c-4fcb-be05-c074fb246f0a | goofoo/makoto | shared/FOCTree.cpp | #include ".\FOCTree.h"
/*
1.define global variable :
define input array's sizeconst int size = 1000
declaration determine pointXYZ val
define determine point extent const int range = 20.0
define input arrayXYZ array[size]
define output arrayXYZ gainarray[size];
define output array's indexint sizegainarray ... | ALGO | 0.999517 | 4.977976 |
2fec925c-e774-4146-8199-20cf0f7b8d89 | sinian666/codes_102_4 | cpp_副本8/chapter_backtracking/permutations_ii.cpp | /**
* File: permutations_ii.cpp
* Created Time: 2023-04-24
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 回溯算法:全排列 II */
void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &selected, vector<vector<int>> &res) {
// 当状态长度等于元素数量时,记录解
if (state.size() == choices.size... | ALGO | 0.999946 | 5.701356 |
4fd8bf8d-be23-4e00-aa33-86c0ed7e9b0b | tushar54594/LeetcodeQuestions | 2129-capitalize-the-title/2129-capitalize-the-title.cpp | class Solution {
public:
string capitalizeTitle(string title) {
string str;
for(auto a : title) str += tolower(a);
int count = 0;
int index = -1;
for(int i=0; i<str.size(); i++)
{
if(index == -1) index = i;
if(str[i] != ' ') count++;
... | ALGO | 0.999719 | 5.948145 |
70675c36-6a6e-4d93-ad10-1f17483ff20e | teaCupa/code-record | cpp_learn/thread_dir/condition_variable.cpp | //
// Created by teagm on 2023/4/18.
//
#include <iostream>
#include <string>
#include <thread>
#include <chrono>
#include <mutex>
#include <condition_variable>
std::mutex m;
std::condition_variable cv;
std::string data;
bool ready = false;
bool processed = false;
void worker_thread()
{
// Wait until main() send... | TOOL | 0.891195 | 6.295731 |
cff3c40a-e6eb-4de4-a62f-28b87bb8c76c | ThunderWolf42/instagram_clone_3 | 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 |
6661d06d-026c-4f49-8097-db3174a8b82a | nippled/drone | src/rpcdump.cpp | #include <iostream>
#include <fstream>
#include "init.h" // for pwalletMain
#include "bitcoinrpc.h"
#include "ui_interface.h"
#include "base58.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/variant/get.hpp>
#include <boost/algorithm/string.hpp>
#define print... | TOOL | 0.940036 | 6.277348 |
797562bb-d61b-4530-aa7c-262ce8cfd6e5 | HarshadThorat/CPP-Langauge | Problems_On_Recursion/program7.cpp | //write a Recursive program which display below pattern?
// output : 1 2 3 4 5
#include<iostream>
using namespace std;
class Pattern
{
public:
void DisplayR(int No)
{
static int i = 1;
if(i <= No)
{
cout<<i<<"\t";
... | ALGO | 0.999449 | 4.579467 |
41d2a9fe-25bd-4235-b884-618c447ff40b | KhoiBui16/Fullhouse_Code_Online | DSA/Contest/07. ThuatToanSinh/Bai_06/Bai6_ThamKhao.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
vector <int> a(1001);
void Solve()
{
cin >> n;
for (int i=0; i<n; i++) a[i]=n-i;
do
{
for (int i=0; i<n; i++) cout << a[i];
cout << " ";
} while (prev_permutation(a.begin(), a.begin()+n));
cout << endl;
}
int main()
{
i... | ALGO | 0.999774 | 4.193281 |
1da05861-82b4-4f83-b06b-383e59d4c517 | UdayRajput09/TOPS-ASSIGNMENT-UDAY | ASSIGNENT C++ [ UDAY ]/C++ TEMPLATES/q_01.cpp | #include <iostream>
using namespace std;
// Function template to swap two values
template <class T>
void SwapValues(T& val1, T& val2)
{
T temp = val1;
val1 = val2;
val2 = temp;
}
// Driver code
int main()
{
// Declare and initialize two integer variables
int num1 = 66, num2 = 92;
// Invoking the ... | ALGO | 0.998841 | 6.318617 |
1d9cbd31-970b-4d4e-a0d3-729472524def | seedlishifeng/LeetCode | leetcode-master/496. Next Greater Element I/C++/Solution.cpp | class Solution {
public:
vector<int> nextGreaterElement(vector<int> &findNums, vector<int> &nums) {
vector<int> result;
if (findNums.empty()) {
return result;
}
int numMax = *max_element(nums.begin(), nums.end());
vector<int> map(numMax + 1, 0);
for (int i... | ALGO | 0.99999 | 6.018492 |
0988bfc8-97bd-4d82-b696-3f059cc08bd8 | nikhiljain-413/Data_Structures_Problems_solution | code/array_partitioning.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> v ={3,10,5,20};
long long solve(int N,int K)
{
multiset<long long> ms;
for(auto value: v){
ms.insert(value);
}
long long val = *(--ms.end());
// add your code here
for(int i=0;i<K-1;i++){
ms.erase(--ms... | ALGO | 0.99973 | 3.719632 |
9a410d79-b63d-4b20-8e58-e179a43a60bc | fovtran/analysis_cplusplus | cholesky/eigen_cholesky_example.cpp | #include <iostream>
#include <Eigen/Cholesky>
#include "autodiff.h"
DECLARE_DIFFSCALAR_BASE();
int main(int argc, char **argv) {
typedef Eigen::Vector2d Gradient;
typedef Eigen::Matrix2d Hessian;
typedef DScalar2<double, Gradient, Hessian> DScalar;
/* Do a multidimensional... | ALGO | 0.999844 | 4.508782 |
30d45e5d-24f3-4a89-9988-c6d2e6f7075b | ishandutta2007/codeforces | irkstepanov/normal/936/B.cpp | #include <iostream>
#include <fstream>
#include <set>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <deque>
#include <memory.h>
#include <assert.h>
#include <cstring>
#include <cmath>
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
using names... | ALGO | 0.999977 | 3.462126 |
9747f28c-077d-45a6-847d-f091c4b5d20b | RohanKhatua/LeetcodeSolutions | l981.cpp | #include <bits/stdc++.h>
using namespace std;
class TimeMap
{
public:
unordered_map<string, map<int, string>> mp;
unordered_map<string, vector<int>> timestamp_map;
TimeMap()
{
mp = {};
}
void set(string key, string value, int timestamp)
{
mp[key][timestamp] = value;
... | ALGO | 0.999228 | 7.260548 |
d9d437de-0362-4454-beda-200dd1f31ce3 | Utkarshpurbey/LeetHub | 142-linked-list-cycle-ii/142-linked-list-cycle-ii.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *detectCycle(ListNode *head)
{
ListNode * slow=head;
ListNode * fast=head;
while(fast!=... | ALGO | 0.99994 | 5.210926 |
27f13277-fa2a-4dc4-924b-85ae2c3ca26f | thiyaguleet/LeetCode | Kth Largest Element in an Array.cpp | class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
// sort(nums.begin(), nums.end());
// return nums[nums.size()-k];
make_heap(nums.begin(), nums.end());
for(int i=0; i<k-1; i++){
pop_heap(nums.begin(), nums.end());
nums.pop_back();
... | ALGO | 0.999967 | 5.158482 |
5300312d-fb88-47fc-944a-b56614cc283d | RobLab23/Homework_3 | src/kdl_robot/src/kdl_robot.cpp | #include "kdl_ros_control/kdl_robot.h"
KDLRobot::KDLRobot()
{
}
KDLRobot::KDLRobot(KDL::Tree &robot_tree)
{
createChain(robot_tree);
n_ = chain_.getNrOfJoints();
grav_ = KDL::JntArray(n_);
s_J_ee_ = KDL::Jacobian(n_);
b_J_ee_ = KDL::Jacobian(n_);
s_J_dot_ee_ = KDL::Jacobian(n_);
b_J_dot_e... | ALGO | 0.890685 | 5.307002 |
a306e6dc-aeb1-4d4a-a081-da5c7da6bfeb | foobarjimmy/Mini-RAMPS-1.6-Marlin-2.0.7.2 | Marlin/src/libs/heatshrink/heatshrink_decoder.cpp | #include "../../inc/MarlinConfigPre.h"
#if ENABLED(BINARY_FILE_TRANSFER)
/**
* libs/heatshrink/heatshrink_decoder.cpp
*/
#include "heatshrink_decoder.h"
#include <stdlib.h>
#include <string.h>
#pragma GCC optimize ("O3")
/* States for the polling state machine. */
typedef enum {
HSDS_TAG_BIT, /* ... | ALGO | 0.921161 | 5.009073 |
c753ba2f-b678-4490-8236-c531cfdc73bf | tanus786/CP-Codes-HackOctober-Fest-2023 | Other files/knapsack.cpp | // C++ program to solve fractional
// Knapsack Problem
#include <bits/stdc++.h>
using namespace std;
// Structure for an item which stores
// weight & corresponding value of Item
struct Item {
int value, weight;
// Constructor
Item(int value, int weight)
: value(value), weight(weight)
{
}
};
// Comparison fu... | ALGO | 0.99996 | 5.754157 |
17f38a97-af16-4fbb-b3b1-d257d3a52bea | pankajkumar037/Data-Stuctures-and-Algorithm | Binary Search Tree_1/Leetcode_98-PHOENIX.cpp | class Solution {
public:
void inorder(TreeNode* root,vector<int>&v){
if(root==NULL) return;
inorder(root->left,v);
v.push_back(root->val);
inorder(root->right,v);
}
bool isValidBST(TreeNode* root) {
vector<int>v;
inorder(root,v);
bool flag=true;
f... | ALGO | 0.999981 | 6.716008 |
69395bbd-03c5-4e60-85c0-08f4be1b6bf8 | zguoch/gmsh | Mesh/meshRefine.cpp | #include "GModel.h"
#include "HighOrder.h"
#include "MLine.h"
#include "MTriangle.h"
#include "MQuadrangle.h"
#include "MTetrahedron.h"
#include "MHexahedron.h"
#include "MPrism.h"
#include "MPyramid.h"
#include "GmshMessage.h"
#include "OS.h"
#include "meshGFaceOptimize.h"
typedef std::map<MFace, std::vector<MVertex ... | ALGO | 0.922412 | 6.575974 |
b96193df-1773-436c-bc5c-9aacda261f3f | xinfeng1i/AlgorithmSolution | ProjectEuler/1_50/Problem#35.cpp | #include <iostream>
#include <string>
#include <set>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
bool isPrime(long n)
{
long mid = sqrt(static_cast<double>(n));
long i = 2;
for (i = 2; i <=mid; i++)
{
if (n % i == 0)
{
break;
}
}
... | ALGO | 0.999101 | 5.014209 |
70c85568-76a9-4ed5-85eb-c700f876658b | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/15/01/2.cpp | // by shik {{{
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(c) begin(c),end(c)
#define REP(i,n) for ( int i=0; i<(int)(n); i++ )
#define REP1(i,a,b) for ( int i=(int)(a); i<=(int)(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pai... | ALGO | 0.99924 | 3.664466 |
b5655207-3488-4cf7-a8c1-eaf655b986ac | usernameisavailablee/DigitalMediaProcessingAlgorithms | third_lab/testg++/opencv/samples/cpp/image_alignment.cpp | /*
* This sample demonstrates the use of the function
* findTransformECC that implements the image alignment ECC algorithm
*
*
* The demo loads an image (defaults to fruits.jpg) and it artificially creates
* a template image based on the given motion type. When two images are given,
* the first image is the input image... | ALGO | 0.995954 | 3.941833 |
e163e37d-6dd8-4646-a2da-205e9781f91a | soumayagrawal1234/Soumay-Agrawal | Problem-1.cpp | #include <iostream>
using namespace std;
int main() {
double a, b;
string operation;
cout << "Enter value of a: ";
cin >> a;
cout << "Enter value of b: ";
cin >> b;
cout << "Enter one of the operation in these (add, sub, mul, div): ";
cin >> operation;
if (operation == "add"){
... | TOOL | 0.970333 | 4.13198 |
e5e77585-9c08-49b1-8c5e-058a52ae7c63 | nvnamsss/leetcode | Intersection of Two Arrays II/main.cpp | /*
Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.
Example 1:
Input: nums1 = [1,2,2,1], nums2 = [2,2]
Output: [2,2]
Example 2:
Input: nums1 = [4,9,5], nums2 = [... | ALGO | 0.999986 | 6.359474 |
15d1d308-9600-4722-9a92-fc3bac305fed | plutonchain/plutonchain | src/psbt.cpp | #include <psbt.h>
#include <util/strencodings.h>
PartiallySignedTransaction::PartiallySignedTransaction(const CMutableTransaction& tx) : tx(tx)
{
inputs.resize(tx.vin.size());
outputs.resize(tx.vout.size());
}
bool PartiallySignedTransaction::IsNull() const
{
return !tx && inputs.empty() && outputs.empty(... | ALGO | 0.895341 | 7.351078 |
fe69bd2a-c7d1-4e90-a7b4-46861c8962ec | tamtamhihi/Leetcode | BFS/45. Jump Game II.cpp | class Solution {
public:
int jump(vector<int>& nums) {
int n = nums.size();
int start = 0, end = 0, reach = 0;
// We use BFS idea: traverse the range of indices
// that can be reached in 1 step, then 2 steps, etc.
// <start>, <end> acts like 2 pointers marki... | ALGO | 0.999986 | 6.114344 |
af9134d1-650c-4198-9e88-de171f50af1a | ShazaAllam2001/clean_code | 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.998687 | 6.797341 |
23655128-18e5-4a01-96d6-84f9aab4e2b5 | dudashulya/DLesson1 | 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.998859 | 6.785645 |
a5bc364f-de39-49e2-ba23-d0b959bae88f | ishandutta2007/codeforces | wygzgyw/normal/1514/E.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
t=0; char ch=getchar(); int f=1;
while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=110;
int T,n,cnt;
int p[maxn],ans[maxn][maxn];
int ... | ALGO | 0.999476 | 3.105225 |
02e367e1-0aa5-43ef-8d48-73b4dbf04119 | velicof/Programming-Cpp | solved/sortare/sortare515.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,v[1005];
int nrd[1005];
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> v[i];
}
for (int i = 1; i <= n; i++){
int sum = 0;
for (int k = 1; k*k <= v[i]; k ++){
if (v[i] % k == 0){
... | ALGO | 0.99998 | 3.665043 |
9e9d3fac-db05-49de-b18c-6b588914aabe | coding-corner-courses/Strukturno-Programiranje-Cpp | Tema4/Exercises-from-lesson/004_zadaca.cpp | #include <iostream>
using namespace std;
//Напиши програма каде ќе се избројат колку броеви во рангот од 1-100 завршуваат на 6.
//Резултатот да се отпечати.
int main()
{
int counter = 0;
for(int i=0; i<100; i++){
int onesDigit = (i+1)%10;
if(onesDigit == 6){
counter++;
}... | ALGO | 0.988148 | 3.943979 |
11460182-1b60-4793-bb13-af322e0b68a3 | yoonjaecho/Algorithm_BOJ | problem/2460/2460.cpp11.cpp | #include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
int main()
{
priority_queue<int> pq;
int in,out,sum=0;
for(int i=0; i<10; i++) {
scanf("%d %d",&out,&in);
sum = sum - out + in;
pq.push(sum);
}
printf("%d\n",pq.top());
}
| ALGO | 0.999362 | 3.29444 |
5de5173b-ff64-4731-94de-0d1724c382b1 | Schumann1237/learning-cpp | IntroductionToC++/calculating_percentage.cpp | // This program calculates the amount of pay that
// will be contributed to a retirement plan if 5%, 7%, or 10% of monthly pay is withheld.
#include <iostream>
using namespace std;
int main()
{
// Variables to hold the monthly pay and the
// amount of contribution
double monthlyPay = 6000.0, contribution... | ALGO | 0.997593 | 3.982152 |
3073b8d9-1c8b-4f1e-920e-99e053b72116 | ambarzegari/Recursive-Problems | Q1-810102409.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
const int SIZE = 8;
void InputBoard(vector<vector<char>> &Board)
{
string input;
for (int row = 0; row < SIZE; row++)
{
getline(cin, input);
for (int col = 0; col < SIZE; col++)
{
Board[row]... | ALGO | 0.999876 | 5.164165 |
a6ae3fdf-50fb-460e-8196-97531c03018b | omrajhalwa/Cpp-CodeforcesQsoln | string14.cpp | #include<iostream>
using namespace std;
//program for lenght
int main(){
string str="holiday";
int count=0;
string::iterator it;
for(it=str.begin();it!=str.end();it++){
count++;
}cout<<count;
return 0;
} | ALGO | 0.981747 | 3.227116 |
173c7295-940d-4b1e-9cb8-6448fc7298e1 | Masud-Abdullah/Phitron | Phitron/Contest/Practice_Contest_July23/Tree_Plant.cpp | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main()
{
ll n;
cin >> n;
if (n == 1)
cout << 1 << endl;
else
{
ll ans1 = pow(2, n - 1);
ll ans2 = pow(2, n - 2);
cout << ans1 * ans2 << endl;
}
return 0;
}
// #include <bits/stdc++.... | ALGO | 0.999967 | 5.513654 |
f76974d7-eab1-4d5c-9c64-5fac2059796a | zhuuuoyue/ConquerAlgo | src/LeetCode/LC1710.cpp | #include "gtest/gtest.h"
#include "LeetCode.hpp"
/*
* https://leetcode.cn/problems/maximum-units-on-a-truck/description/
*/
class Solution
{
public:
int maximumUnits(vector<vector<int>>& boxTypes, int truckSize)
{
int count = 0;
std::sort(boxTypes.begin(), boxTypes.end(),
[](const ... | ALGO | 0.999499 | 6.800303 |
13a75a55-0f58-4073-8d17-6a0ee3c4765d | Not-Mostafa/CP | A_Prime_checking.cpp | #include <bits/stdc++.h>
using namespace std;
#define FIO ios ::sync_with_stdio(false), cin.tie(nullptr), cout.tie(NULL)
#define ll long long
#define ld long double
#define all(container) (container).begin(), (container).end()
#define cl(x,y) (x + y - 1) / y
#define lp(size) for (int i = 0; i < size; i++)
#define rlp(... | ALGO | 0.999759 | 4.845091 |
ba376b7d-cb00-46fc-8f7a-70dae7e1df4c | bitcoinbtuser/bitcoinbt-source | src/wallet/test/fuzz/coinselection.cpp | #include <policy/feerate.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <test/util/setup_common.h>
#include <wallet/coinselection.h>
#include <vector>
namespace wallet {
static void AddCoin(c... | TEST | 0.994685 | 6.17468 |
0a62ca72-4df0-4d66-8dcb-2fe92e716da7 | mrque233/C-- | 2135.cpp | #include<stdio.h>
int main()
{
int x,a,b,c;
scanf("%d",&x);
a=x%10;
b=x/10%10;
c=x/100%10;
printf("%d",a+b+c);
return 0;
}
| ALGO | 0.99923 | 3.442766 |
8742291b-33f8-4fc3-ba88-e25931b75b07 | marialubeznov/event_driven_gpu_execution | gpgpu-sim/intersim2/traffic.cpp | // $Id: traffic.cpp 5188 2012-08-30 00:31:31Z dub $
#include <iostream>
#include <sstream>
#include "random_utils.hpp"
#include "traffic.hpp"
TrafficPattern::TrafficPattern(int nodes)
: _nodes(nodes)
{
if(nodes <= 0) {
cout << "Error: Traffic patterns require at least one node." << endl;
exit(-1);
}
}
vo... | ALGO | 0.97267 | 6.223171 |
69626535-62b1-4c0c-ac2e-3c16eea18532 | DennissimOS/platform_frameworks_rs | rsMatrix4x4.cpp | #include "rsMatrix2x2.h"
#include "rsMatrix3x3.h"
#include "rsMatrix4x4.h"
#include "stdlib.h"
#include "string.h"
#include "math.h"
namespace android {
namespace renderscript {
//////////////////////////////////////////////////////////////////////////////
// Heavy math functions
////////////////////////////////////... | TOOL | 0.949165 | 7.081069 |
7f561dca-b2b4-4966-986b-52f1acbee8f2 | leejuy1140/Algorithm | Algorithm/Algorithm/큰 자리수 뺄셈.cpp | #include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;
void swapString(char *str1, char *str2)
{
char tmp[105];
strcpy(tmp, str1);
strcpy(str1, str2);
strcpy(str2, tmp);
}
int main() {
//Please Enter Your Code Here
char str1[105], str2[105];
scanf("%s %s", str1, str... | ALGO | 0.999996 | 3.485482 |
b652144f-c92e-4ff2-a863-ec260d45a7f3 | lovezhangchuangxin/leetcode-problems | 120.triangle/solution.cpp | #include <bits/stdc++.h>
using namespace std;
/*
* @lc app=leetcode.cn id=120 lang=cpp
*
* [120] 三角形最小路径和
*/
// @lc code=start
class Solution
{
public:
int minimumTotal(vector<vector<int>> &triangle)
{
int n = triangle.size();
vector<int> dp(n + 1, INT_MAX);
dp[1] = triangle[0][0]... | ALGO | 0.999988 | 6.424191 |
909f7998-dc16-4514-84e1-876966a98d37 | abhinavprkash/geeksforgeeks | codeforces contest/Codeforces Round #674 (Div. 3)/1426F.cpp |
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#def... | ALGO | 0.999969 | 3.932947 |
b754ddbb-90a5-4436-9368-d0e0b6889642 | srjpatil/DataStructures | Arrays/Array13_MedianInOlogn.cpp | #include<iostream>
using namespace std;
int max(int a, int b)
{
return a > b ? a : b;
}
int min(int a, int b)
{
return a < b ? a : b;
}
int median(int *arr, int n)
{
if (n % 2 == 0)
return (arr[n / 2] + arr[n / 2] - 1) / 2;
else
return arr[n / 2];
}
int getMedian(int *arr1, int *arr2, int n)
{
if (n <= 0)... | ALGO | 0.999881 | 4.667267 |
360e5622-e391-4a71-9be9-26e463b6a6a7 | ankush-b223/C-repo | Test/Test/Source.cpp | #include <stdio.h>
int main() {
int count, test, check, left, array[100], q_size, queries[100];
int again,last_index,i, first;
int og_array[100];
// take array size and query_list size
printf("Enter array checker and number of queries ");
scanf_s("%d%d", &check, &q_size);
last_index = check - 1;
//take arr... | ALGO | 0.999077 | 4.127602 |
4a1dd567-a0c1-4f28-a22e-71d6e3d969d0 | zhangxiaohu057/SensorsCalibration | online_calib/lidar2imu/eigen3/bench/benchmark-blocking-sizes.cpp | #include <iostream>
#include <cstdint>
#include <cstdlib>
#include <vector>
#include <fstream>
#include <memory>
#include <cstdio>
bool eigen_use_specific_block_size;
int eigen_block_size_k, eigen_block_size_m, eigen_block_size_n;
#define EIGEN_TEST_SPECIFIC_BLOCKING_SIZES eigen_use_specific_block_size
#define EIGEN_T... | TOOL | 0.853567 | 5.95051 |
e83dcfa1-96fd-439f-bb2b-8fa39042cb7f | NguyenMinhThuan24112001/CPP_PTIT | test/order3.cpp | #include<bits/stdc++.h>
using namespace std;
void solve(){
int n,k;
cin>>n>>k;
int a[n][n];
priority_queue<int> q;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin>>a[i][j];
q.push(a[i][j]);
if(q.size()>k)
q.pop();
}
}
cout<<q.top()<<endl;
}
int main(){
int t;
cin>>t;
while(t--){
solve();
}
... | ALGO | 0.999734 | 3.504647 |
9f1b0da6-2345-47b1-a6db-39aa8090122b | arnavarora1710/Competitive_Programming | Codeforces/1996C.cpp | // https://codeforces.com/contest/1996/problem/C
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pi;
#define f first
#define s second
#define mp make_pair
#define MULTI_TEST (1)
const int maxn = 2e5 + 5, ... | ALGO | 0.999788 | 4.792366 |
e70c6c4b-e4ef-49d1-94fc-8a4d85bebca9 | CSPercival/University-Courses | Artificial Intelligence/Laboratories/Lab1/Zad4.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
int d,ctr1;
while(true){
cin >> s >> d;
int n=s.size();
if(n<d){
cout << "Error: Size of block is too big\n";
continue;
}
ctr1=0;
for(int i : s){
if(i=='1... | ALGO | 0.999827 | 3.940809 |
3cde146d-0778-421a-b684-b8d44db4fed5 | sarvex/leetcode-racket | solution/0400-0499/0458.Poor Pigs/Solution.cpp | class Solution {
public:
int poorPigs(int buckets, int minutesToDie, int minutesToTest) {
int base = minutesToTest / minutesToDie + 1;
int res = 0;
for (int p = 1; p < buckets; p *= base) ++res;
return res;
}
}; | ALGO | 0.997285 | 6.0089 |
f64214b5-68e6-48a9-a209-415c437b1e84 | AniGhodake/ProblemSolving_DSA | minMax2d.cpp | #include<iostream>
using namespace std;
#include<limits.h>
int minArray(int arr[3][3], int row, int col){
int min = INT_MAX;
for(int i = 0; i < row; i++){
for(int j = 0; j < col; j++){
if(arr[i][j]<min){
min = arr[i][j];
}
}
}
return min;
}
int m... | ALGO | 0.998895 | 3.802565 |
92179869-d048-409d-9c5c-60eec3cbd576 | vivekreddy1601/codeforces | 1543A-ExcitingBets.cpp | //code by Vivek Reddy
#include <iostream>
#define ll long long
using namespace std;
int main()
{
int vt;
cin >> vt;
while(vt--){
ll a,b;
cin >> a >> b;
ll d = abs(a-b);
if(a>b)
cout << d << " " << min(d-(a%d),b%d) << endl;
else if(b > a)
cout ... | ALGO | 0.999843 | 3.873457 |
ca6104e5-c212-4828-bb59-5b0e56f99c3f | mkuritsu/ConcursosProg1Sem2023 | MIUP2023/ProblemA.cpp | #include <iostream>
#include <string>
int main()
{
int numTests;
std::cin >> numTests;
for (int i = 0; i < numTests; i++)
{
int dim;
std::cin >> dim;
std::string line;
std::cin >> line;
int numGrenades = 0;
for (int j = 0; j < line.length(); j++)
... | ALGO | 0.982714 | 4.868137 |
2468956f-d84f-4eba-a6c8-a5192aa10407 | AyushVachaspati/Competitive-Coding | src/floodfill.cpp |
void floodfill(int ar[MAX][MAX],int n, int m, int i, int j, int a)
{
if(i<0||j<0||i>=n||j>=m)return;
if(ar[i][j]!=a)return;
else
{
ar[i][j]=0;
floodfill(ar,n,m,i+1,j,a);
floodfill(ar,n,m,i-1,j,a);
floodfill(ar,n,m,i,j+1,a);
floodfill(ar,n,m,i,j-1,a);
flo... | ALGO | 0.999243 | 3.892433 |
e44ee9c9-ec3c-452e-87b9-38ec8ddff6d4 | georgizk/project-euler | 0017_number_letter_counts.cpp | /*
<p>If the numbers $1$ to $5$ are written out in words: one, two, three, four, five, then there are $3 + 3 + 5 + 4 + 4 = 19$ letters used in total.</p>
<p>If all the numbers from $1$ to $1000$ (one thousand) inclusive were written out in words, how many letters would be used? </p>
<br><p class="note"><b>NOTE:</b> Do ... | ALGO | 0.999603 | 6.297086 |
6827c764-4811-4bc0-b91f-07f15f68256b | piyushd33p/DSA-Questions | 131-palindrome-partitioning/palindrome-partitioning.cpp | class Solution {
private:
bool isPal(string s, int low, int high){
while(low <= high){
if(s[low] != s[high]) return 0;
low++;
high--;
}
return 1;
}
void findPart(string s, vector<vector<string>>& ans, vector<string>& temp, int index)
{
... | ALGO | 0.999983 | 6.443225 |
d659ce16-405f-4c90-a17a-8b7a2cc17c1c | wangweicc/Data-Structure | 线性表合并运算函数.cpp | void mergeList1(SeqList LA,SeqList LB,SeqList &LC)
{
int i,j,k;
i = 0;
j = 0;
k = 0;
while(i<=LA.length-1 && j<=LB.length-1)
{
if(LA.data[i]<=LB.data[j])
{
LC.data[k]=LA.data[i];
k++;
i++;
}
else
{
LC.data[k]=LB.data[j];
j++;
k++;
}
}
while(i<=LA.length-1)
{
LC.data[k]=LA.data[i... | ALGO | 0.999055 | 3.280221 |
3f18a5d6-ff99-4e31-b7a5-3b503ffcc24c | PetterS/monolith | third-party/coin/Clp/examples/useVolume.cpp | /* $Id: useVolume.cpp 1935 2013-04-08 19:16:07Z stefan $ */
#include "ClpSimplex.hpp"
#include "ClpFactorization.hpp"
#include "VolVolume.hpp"
//#############################################################################
class lpHook : public VOL_user_hooks {
private:
lpHook(const lpHook&);
lpHook& opera... | ALGO | 0.997267 | 7.581399 |
767cbef2-f2e6-45b1-9bc9-226601edbe51 | MustangYM/ShelbyObfuscator | llvm/lib/Analysis/ScalarEvolutionNormalization.cpp | #include "llvm/Analysis/ScalarEvolutionNormalization.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
using namespace llvm;
/// TransformKind - Different types of transformations that
/// TransformForPostIncUse can do.
enum Transfor... | TOOL | 0.944759 | 6.100139 |
10e4cd68-c842-487f-ac72-77f054becc9a | clay-arras/cp-practice | codeforces/unsolved/makeaequaltob.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#define open(x) freopen(x, "r", stdin);
#else
#define debug(...)
#define open(x)
#endif
void solve(){
int n; cin >> n;
vector<int> a, b;
int a_cnt=0, b_cnt=0;
for (int i=0; i<n; i++){
int t; cin >> t;
a.push... | ALGO | 0.999907 | 4.667113 |
5237b6a6-d361-4a79-beee-e9b47f9ab123 | hjiang13/LLMs-in-IR | POJ-104/33/1463.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin >> "%d",&n);
char jianji[n][260],hubu[n][260];
for(int i=0; i<n; i++){
cin >> "%s",jianji[i]);
int len=strlen(jianji[i]);
for(int k=0; k<len; k++){
if(jianji[i][k]=='A'){
hubu[i][k]='T';
}
else if(jianji[i][k]=='T'){
hubu[i][k]='A';
}
else if(jianji[i][k]=... | ALGO | 0.999837 | 3.224151 |
fe31ef24-3eae-4cb7-be9b-f40dc682e908 | Suvarnarajugera/OWLCODER | Difficulty: Medium/Length of the longest substring/length-of-the-longest-substring.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int longestUniqueSubsttr(string S){
//code
int i = 0;
int j = 0;
int len = 0;
int n = S.size();
// unordered_map<char,int>mp;
vector<int>mp(2... | ALGO | 0.999812 | 6.313993 |
2de55317-0700-402a-9fa5-4627d5c8bc20 | shreysomu/DSA-CPP- | Patterns/23HollowInvertedhalfPyramid.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the number of Rows :";
cin>>n;
for(int row = 0;row<n;row++){
for(int col = 0;col<n;col++){
if(row==0 || col==0 || col == n-row-1){
cout<<" * ";
}
else {
cout<<" ";
}
}
cout<<endl;
}
... | ALGO | 0.999519 | 3.402374 |
bfc48953-cdb7-4ee2-8692-abd54895e3bf | Zch0414/3d-seeds | samples/cpp-3d-seeds/seeds.cpp |
#include "../../src/seeds.hpp"
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/ximgproc.hpp>
#include <ctype.h>
#include <stdio.h>
#include <random>
#include <iostream>
#include <fstream>
using namespace cv;
using n... | TOOL | 0.929889 | 4.236145 |
c9bbb599-0615-4ff6-b0d6-c1621ea4ca11 | loskyertt/cpp | 数据结构/06排序/计数排序/main.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <vector>
using namespace std;
/* 计数排序 */
void count_sort(vector<int> &nums) {
int max_val = INT_MIN;
int min_val = INT_MAX;
for (int num : nums) {
max_val = max(max_val, num);
min_val = min(min_val, num);
}
// 计数数组的大小,这种方式可以处理数组中含... | ALGO | 0.999752 | 4.966899 |
dd2389e9-d7eb-4141-85c7-fbe5a075b5a3 | sarvex/leetcode-nativescript | solution/0900-0999/0927.Three Equal Parts/Solution.cpp | class Solution {
public:
vector<int> threeEqualParts(vector<int>& arr) {
int n = arr.size();
int cnt = accumulate(arr.begin(), arr.end(), 0);
if (cnt % 3) return {-1, -1};
if (!cnt) return {0, n - 1};
cnt /= 3;
auto find = [&](int x) {
int s = 0;
... | ALGO | 0.999959 | 5.56999 |
a54034e0-998b-436f-9a0d-10dff5bc9470 | ZhangXinNan/Professional_CPP20 | Code/c20_code/03_ModifyingAlgorithms/09_replace.cpp | import <algorithm>;
import <vector>;
import <iostream>;
using namespace std;
// Function template to populate a container of ints.
// The container must support push_back().
template<typename Container>
void populateContainer(Container& cont)
{
while (true) {
cout << "Enter a number (0 to quit): ";
int value;
... | ALGO | 0.998729 | 4.817527 |
c65d6264-55b5-4d99-88da-dc3014472897 | SiddharthMaverick/CodeForces_Solutions | q711a.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int point=0;
vector<string>v;
for(int i=0;i<n;i++)
{
string st;
cin>>st;
for(int j=0;j<st.length()-1;j++)
{
if(((st[j]=='O')&&(st[j+1]=='O'))&&(point!=1))
{
... | ALGO | 0.999968 | 3.611738 |
9de76b5a-3344-429f-8a1b-a16071d460dc | ishandutta2007/codeforces | huangzirui/normal/1726/A.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=1000010;
int i,j,k,n,m,a[maxn];
int main(){
int T;
cin>>T;
while(T--){
cin>>n;
for(i=1;i<=n;i++)scanf("%d",&a[i]);
int Min=1e9,Max=0;
for(i=1;i<=n;i++)Min=min(Min,a[i]);
for(i=1;i<=n;i++)Max=max(Max,a[i]);
... | ALGO | 0.999687 | 3.96812 |
49cb08af-274a-49d0-8bdb-461cd5f7363a | xi-guo-0/leetcode-solutions | cpp/0494-target-sum.cpp | class Solution {
public:
int findTargetSumWays(const vector<int> &nums, const int S) {
array<int, 2001> dp;
fill(dp.begin(), dp.end(), 0);
dp[nums[0] + 1000] = 1;
dp[-nums[0] + 1000] += 1;
for (int i = 1; i < nums.size(); ++i) {
array<int, 2001> next;
fill(next.begin(), next.end(), 0);... | ALGO | 0.999958 | 6.058456 |
62364317-56d7-4456-b33e-b3378a860fb0 | raincross7/code-similarity | codes/train_code/problem115/problem115_323.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
int N, M;
void func()
{
cin >> N >> M;
if (M >= N)
cout << "unsafe" << endl;
else
{
cout << "safe" << endl;
}
}
int main()
{
func();
} | ALGO | 0.998958 | 4.014291 |
62e43d2a-86cb-4951-b3f2-19b0060ea0d4 | benz4416/CCMINER-SERVER | mobile-mining/ccminer/bench.cpp | /**
* Made to benchmark and test algo switch
*
* 2015 - tpruvot@github
*/
#include <unistd.h>
#include "miner.h"
#include "algos.h"
#if defined(__APPLE__) || (defined(__ANDROID__) && (__ANDROID_API__ < 24))
#include "compat/pthreads/pthread_barrier.hpp"
#else
#define pthread_barrier_init_ pthread_barrier_init
#d... | TEST | 0.967664 | 5.594963 |
127db800-6922-45d2-9a5f-70998d132d8c | lemon-lime-honey/leetcode | 0059-spiral-matrix-ii/0059-spiral-matrix-ii.cpp | class Solution {
public:
vector<vector<int>> generateMatrix(int n) {
vector<vector<int>> result(n, vector<int>(n, 0));
vector<int> dr = {0, 1, 0, -1}, dc = {1, 0, -1, 0};
int seq = 0, r = 0, c = 0;
for (int i = 1; i <= n * n; i++) {
result[r][c] = i;
r += dr[... | ALGO | 0.999941 | 6.360729 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.