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 |
|---|---|---|---|---|---|---|
baaa61f3-4521-47da-8400-538984b27ccc | rsr180004/BRLCAD-UAT | brl-cad/brlcad/src/other/ext/gdal/frmts/vrt/vrtwarped.cpp | #include "cpl_port.h"
#include "vrtdataset.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
// Suppress deprecation warning for GDALOpenVerticalShiftGrid and
// GDALApplyVerticalShiftGrid
#define CPL_WARN_DEPRECATED_GDALOpenVerticalShiftGrid(x)
#define CPL_WARN_DE... | TOOL | 0.916213 | 3.95515 |
30fd7167-767b-49e8-a504-0da17d7ef82c | TieWay59/HappyACEveryday | 2019codes/codeforces.gym/102416/C.cpp | /*
@Author: TieWay59
@Date: 2019/11/21 22:49
@Link: https://codeforc.es/gym/102416/problem/C
@Tags: idea
*/
#include <bits/stdc++.h>
#define debug(x) cerr <<#x << " = "<<x<<endl
#define endl '\n'
#define STOPSYNC ios::sync_with_stdio(false);cin.tie(nullptr)
#define MULTIKASE int Kase=0;cin>>Kase;fo... | ALGO | 0.999481 | 3.065352 |
21d55660-25a0-4e0f-a6cf-b7e8ab763e73 | Strawberry9583/LeetCode | Leetcode1_99/Leetcode_29/LeetCode_29/leetcode29.cpp | //Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.
//
//Return the quotient after dividing dividend by divisor.
//
//The integer division should truncate toward zero.
//
//Example 1:
//
//Input: dividend = 10, divisor = 3
// Output : 3
// Example 2 :
... | ALGO | 0.999426 | 4.798497 |
9aa84625-b806-4ae1-bce8-40dde7e9fb37 | iamshafin121/Competitive_Programming | Codeforces/Practice_Problems/1535A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
/*
_______ ___ ___ ____ ______ _______ __ ___
/ ____// / / // _ | / ____//_ ___// | / /
(___ )/ /_/ // /_| |/ /___ / / / |/ /
____/ // __ // ___ / ____/__/ /__ / | | /
/______//__/ /__//_/ |_/_... | ALGO | 0.999854 | 4.30003 |
560c3881-615b-46fb-b1bb-1eb21bcdd425 | Dipesh-Budhiraja/practice | backtracking/unique_paths_leetcode_980.cpp | #include "header.h"
using namespace std;
class Solution {
public:
int xcom[4] = {-1, 0, 1, 0};
int ycom[4] = {0, -1, 0, 1};
bool isInside(int i, int j, int m, int n) {
if (i >= 0 && i < m && j >= 0 && j < n) {
return true;
}
return false;
}
void df... | ALGO | 0.998439 | 5.681458 |
e4c49daf-5425-4677-b950-996479ae6456 | JoelJimenez23/Trees | main.cpp | #include <ios>
#include <iostream>
#include "B/B.hpp"
using namespace std;
int main(){
Btree<int,3>* bcito = new Btree<int,3>();
bcito->insert(45);
bcito->insert(75);
bcito->insert(100);
bcito->insert(36);
bcito->insert(120);
bcito->insert(70);
bcito->insert(11);
bcito->insert(111);... | TEST | 0.91991 | 3.813404 |
31fa221f-ccfd-4ab3-9585-f2a932f20e8c | tanmaysahu295/TDS_proj_1_23f1002363 | venv/Lib/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.9982 | 7.198757 |
c6fb53b4-6647-41de-af39-579feeede874 | FrankenRomP/android_system_core | fs_mgr/fs_mgr_fstab.cpp | #include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <unistd.h>
#include <algorithm>
#include <utility>
#include <vector>
#include <android-base/file.h>
#include <android-base/stringprintf.h>
#include <android-base/strings... | TOOL | 0.949757 | 6.188937 |
1fe1f0a5-3b8e-4fe2-8217-d45b56ff0e49 | DakshHinger/DSAndeavour | Leetcode/2443-check-if-there-is-a-valid-partition-for-the-array/check-if-there-is-a-valid-partition-for-the-array.cpp | class Solution {
bool helper(int ind, vector<int>& nums, vector<int> &dp){
if(ind==nums.size()){
return true;
}
if(dp[ind]!=-1) return dp[ind];
if(ind+1<nums.size() && nums[ind]==nums[ind+1] && helper(ind+2,nums,dp)){
return dp[ind]=true;
}
if(... | ALGO | 0.999979 | 5.892853 |
5b42bf38-ecfd-4548-b2a2-067db26323b0 | ishandutta2007/codeforces | zdolny_kaczor/normal/579/A.cpp | # include <cstdio>
int main()
{
int n;
scanf("%d", &n);
printf("%d\n", __builtin_popcount(n));
} | ALGO | 0.999587 | 4.347787 |
b9286579-1e67-403b-af96-1a05c3c6518e | Hugo-Bo-Diaz/xml_handout_1 | handout_8/Motor2D/j1Pathfinding.cpp | #include "p2Defs.h"
#include "p2Log.h"
#include "j1App.h"
#include "j1PathFinding.h"
j1PathFinding::j1PathFinding() : j1Module(), map(NULL), last_path(DEFAULT_PATH_LENGTH),width(0), height(0)
{
name.create("pathfinding");
}
// Destructor
j1PathFinding::~j1PathFinding()
{
RELEASE_ARRAY(map);
}
// Called before quit... | ALGO | 0.998604 | 3.248574 |
8d0f6d04-b281-49c8-9987-9358a5c503a0 | karraanvesh/ProblemOfTheDay | GFGProblemOfTheDay/Matrices/ExitPointInAMatrix.cpp | // Time Complexity : O(n * m)
// Space Complexity : O(1)
// Problem Link : https://www.geeksforgeeks.org/problems/exit-point-in-a-matrix0905/1
class Solution {
private :
bool isSafe(int i , int j , int n , int m) {
return (i >= 0 and i < n and j >= 0 and j < m);
}
public:
vector<int> FindEx... | ALGO | 0.999974 | 5.951527 |
bfaf2678-c5a5-496a-ab20-958780b7b6a9 | mingweihe/codeforces | _0707_div2/A_Alexey_and_Train.cpp | #include <bits/stdc++.h>
using namespace std;
int n, k, p;
const int maxn = 1e5+1;
int a[100+1][2];
int tmm[100+1];
void solve(){
cin >> n;
for(int i = 1; i <= n; ++i)
cin >> a[i][0] >> a[i][1];
for(int i = 1; i <= n; ++i)
cin >> tmm[i];
float ans = 0;
int ai, bi, bi_1, tmi;
in... | ALGO | 0.999963 | 3.808319 |
328a059a-2a01-4cbd-96c7-3fe102e17137 | IIHS-HLDI/visibility_study_v2 | dependencies/opencv/modules/video/src/tracking/detail/tracker_model.cpp | #include "../../precomp.hpp"
#include "opencv2/video/detail/tracking.detail.hpp"
namespace cv {
namespace detail {
inline namespace tracking {
TrackerModel::TrackerModel()
{
stateEstimator = Ptr<TrackerStateEstimator>();
maxCMLength = 10;
}
TrackerModel::~TrackerModel()
{
// nothing
}
bool TrackerModel:... | ALGO | 0.964806 | 6.877041 |
5e4139a5-ef6e-44b3-97e3-d29579af8e3b | abhyudit309/ocs2 | ocs2_core/src/loopshaping/soft_constraint/LoopshapingStateInputSoftConstraint.cpp | #include <ocs2_core/loopshaping/LoopshapingPreComputation.h>
#include <ocs2_core/loopshaping/soft_constraint/LoopshapingStateInputSoftConstraint.h>
namespace ocs2 {
scalar_t LoopshapingStateInputSoftConstraint::getValue(scalar_t t, const vector_t& x, const vector_t& u,
... | ALGO | 0.976248 | 6.265007 |
c7f94e06-a4e6-4175-997c-1173840c739e | MA1ya1nk/gfg160-challenge | Difficulty: Medium/Merge two sorted linked lists/merge-two-sorted-linked-lists.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
void printList(struct Node *head) {
struct Node *temp = head;
while (temp != NULL) {
cout << temp->data << ' ';
... | ALGO | 0.999831 | 6.002111 |
4374fe01-23c5-49dc-bdc1-0dcb013da9ae | vijaymanikantareddy/LeetCode_GFG_solved | 1408-find-the-smallest-divisor-given-a-threshold/1408-find-the-smallest-divisor-given-a-threshold.cpp | class Solution {
public:
bool fun(vector<int>& nums, int threshold, int val){
int s = 0;
for(int i = 0 ; i < nums.size() ; i++){
s += ceil((double)nums[i]/val);
}
return (s <= threshold);
}
int smallestDivisor(vector<int>& nums, int threshold) {
int low = ... | ALGO | 0.999974 | 6.148742 |
8d29c70a-6d5b-4f08-8ea3-227f02f5c606 | tommy5198/acm | uva/uva642.cpp | #include<string>
#include<map>
#include<algorithm>
#include<set>
#include<iostream>
using namespace std;
int main(){
string tmp, str;
map<string, set<string> > m;
set<string>::iterator itr;
while(cin >> tmp){
if(tmp == "XXXXXX")
break;
str = tmp;
sort(tmp.begin(), tm... | ALGO | 0.997753 | 3.526181 |
772f1772-fd48-48f2-b8ad-0044880b30f2 | sky-bro/AC | leetcode.com/0129 Sum Root to Leaf Numbers/better.cpp | #include <iostream>
#include <vector>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
int ans{0};
void number(TreeNode* root, int currentSum)
{
currentSum += root... | ALGO | 0.999883 | 6.129176 |
41827ff1-7ec0-4f8e-9e45-15fba98e535a | lineageos-q-mean/android_frameworks_av | media/libstagefright/codecs/amrnb/common/src/shr_r.cpp | /*
Pathname: ./gsm-amr/c/src/shr_r.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Created separate file for the shr_r function. Sync'ed up
with the current template and fixed tabs.
Description: Passing around pOverflow as per EPOC changes... | ALGO | 0.999447 | 6.392525 |
458f0461-bb7d-47a9-a641-ac9df3f63ceb | ishandutta2007/codeforces | ecnerwala/normal/992/D.cpp | #include <iostream>
using namespace std;
typedef long long ll;
ll INF = ll(3e18);
const int MAXN = 4e5;
const int MAXK = 2e5;
int N, K;
const int MAXM = MAXN;
int M;
ll A[MAXM];
ll C1[MAXM];
int main() {
ios_base::sync_with_stdio(0);
cin >> N >> K;
for (int i = 0; i < N; i++) {
int a; cin >> a;
if (a == 1) {... | ALGO | 0.999844 | 3.705585 |
51fd4883-394c-40d3-813b-cf71933222c2 | ananthanandanan/academics | python/codeforces/leetcode/labsheet-4/con_sort_toBin.cpp | class Solution {
int length(ListNode *head)
{
int l = 0;
while(head)
{
head = head->next;
l++;
}
return l;
}
TreeNode *BST(ListNode **head, int l)
{
if(l <= 0)
return NULL;
TreeNode *le... | ALGO | 0.999956 | 5.722557 |
1aff039c-0dfc-4221-a299-ac8abebb39c6 | harshjoeyit/CP | C++ basics/sorting/insertion sort.cpp | #include<iostream>
using namespace std;
int main()
{
int sz;
cout<<"this is selection sort: "<<endl;
cout<<"enter the size of the array max(20): ";
cin>>sz;
int a[20];
int n;
cout<<"enter the array elements max(20): "<<endl;
for(int i=0; i<sz; i++)
{
cin>>n;
a[i... | ALGO | 0.999692 | 3.300072 |
76613c95-a343-486a-8ed5-5fe9e1d2b038 | DanielHaba/magma | sparse/src/zcg_res.cpp | /*
-- MAGMA (version 2.0) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date
@author Hartwig Anzt
@precisions normal z -> s d c
*/
#include "magmasparse_internal.h"
#define RTOLERANCE lapackf77_dlamch( "E" )
#define ATOLER... | ALGO | 0.999743 | 3.625882 |
44238cff-0fc3-4ad0-83c4-23f67db811f8 | ahmeddiaa6/group2---flutter | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
64cfc269-8ea1-4b68-a7b0-b57b35d14736 | Ylarod/goron | llvm/lib/CodeGen/EdgeBundles.cpp | #include "llvm/CodeGen/EdgeBundles.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
static cl::opt<bool>
View... | TOOL | 0.90324 | 7.549636 |
021b9cef-d2bf-4f5e-a19b-8598a3bd7ec6 | 113bommy/LogicalErrorFixCodeT5 | logicalErrorFix_CodeT5_Linenumber/model/cpp/CodeT5_LineNumber_cpp_source/Problem_11_source_33.cpp | #include <bits/stdc++.h>
template <class T>
void read(T &a) {
a = 0;
char x = getchar();
bool f = 0;
for (; x < '0' || x > '9'; x = getchar()) f |= x == '-';
for (; x >= '0' && x <= '9'; x = getchar()) a = (a << 3) + (a << 1) + x - '0';
if (f) a = -a;
}
template <class T, class... Args>
void read(T &a, Args &...args) {... | ALGO | 0.999967 | 3.982113 |
65832152-f37f-461d-a52e-ecd1a81de21f | Ashish-0211/Leetcode | 1385-find-the-distance-value-between-two-arrays/1385-find-the-distance-value-between-two-arrays.cpp | class Solution {
public:
int findTheDistanceValue(vector<int>& A, vector<int>& B, int d) {
// // sort(arr1.begin(),arr1.end());
// // sort(arr2.begin(),arr2.end());
// int ans = 0;
// for(int i = 0;i<arr1.size();i++)
// {
// for(int j = 0;j<arr2.size();j++)
... | ALGO | 0.999881 | 5.727869 |
8d69b3ea-5f94-45f8-a5e6-dcfe676f65b4 | zizhong/algorithm-training | codeforces/1263E.cpp | /*
using stack to maintain the max depth of a brackets.
*/
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <deque>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <ctime>
#include <q... | ALGO | 0.999901 | 3.772572 |
7548dabf-59b1-40c9-bd1d-882eb161c9b3 | alexandraback/datacollection | solutions_2692487_0/C++/ZZY/A.cpp | #include<iostream>
#include<string.h>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<stack>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define oo 1000000000
#define pi acos(-1.0)
using namespace std;
int A,N,s[1000005];
int main()
{
freopen("A-small-attempt1.in","r",stdi... | ALGO | 0.999822 | 3.268064 |
9e9bd39a-9fd2-4eb1-be28-ce11955268e6 | Giantpizzahead/comp-programming | Codeforces/Practice/708 - AIM Tech Round 3 Div 1/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define sz(x) ((int) x.size())
#define all(x) x.begin(), x.end()
const int MAXN = 4e5;
int N, C, bestN, bestS, best2N, best2S;
vector<int> adj[MAXN];
bool ans[MAXN];
int stSize[MAXN];
void dfsSize(int n, int p) {
... | ALGO | 0.999952 | 4.334429 |
50a304a3-d33d-48b9-8e38-0f8f51ca4ecf | Anshul-jolly-joshi/CSA0649---Design-And-Analysis-Of-Algorithm | 25.perfect no..cpp | #include <stdio.h>
int isPerfectNumber(int num) {
int sum = 0;
for (int i = 1; i <= num / 2; i++) {
if (num % i == 0) {
sum += i;
}
}
return sum == num;
}
int main() {
int num = 28; // Example perfect number
if (isPerfectNumber(num)) {
printf("%d is a perfec... | ALGO | 0.998652 | 4.145895 |
d7465e04-80ee-46ea-956b-f65b9269e67f | sameerisnothere/cs112L_2021451 | lab2/cs112_lab2_task3.cpp | #include<iostream>
#include<bitset>
#define read(type, var) type var; cin>>var;
using namespace std;
int add(int a, int b){
int car;
while(b != 0){
car = a & b;
a=a^b;
b=car << 1;
}
return a;
}
int bin_to_dec(int n)
{
int num = n;
int dec_value = 0;
int base = 1;
... | ALGO | 0.996943 | 4.175406 |
6ef1cf6c-0b68-4fbc-bf14-121547c95293 | ViswesB/AlgorithmsWS | TwoSumIV-InputBST.cpp | /*
653. Two Sum IV - Input is a BST
Easy
Given the root of a Binary Search Tree and a target number k, return true if there exist two elements in the BST such that their sum is equal to the given target.
Example 1:
Input: root = [5,3,6,2,4,null,7], k = 9
Output: true
Example 2:
Input: root = [5,3,6,2,4,null,7], k ... | ALGO | 0.999998 | 6.754161 |
254df850-b88f-4d46-9849-fa30bd6c1779 | khan-rasul/Codes | codeforces/local/a.cpp | /*
* Look in my eyes, what do you see?
* The cult of personality
*/
#include<bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define mod 1000000007
#define inf ((ll)1e18)
#define eps 1e-9
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
us... | ALGO | 0.999499 | 3.904114 |
75a1ea69-c06b-47a3-a00f-9af050b5bb46 | GXDE-OS/boost1.67 | libs/math/example/policy_ref_snip11.cpp | // Note that this file contains quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
#include <iostream>
using std::cout; using std::endl;
// Setting (approximate) precision 25 bits in a single function call using make_policy.
//[policy_ref_snip11
#include <boost/math... | ALGO | 0.993936 | 4.541284 |
57352728-54cd-4dd9-9415-d2a9ae08ee69 | alexandraback/datacollection | solutions_1485488_1/C++/tkociumaka/B.cpp | #include<algorithm>
#include<cassert>
#include<complex>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
#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... | ALGO | 0.999707 | 3.520669 |
542f2130-cd9b-453b-9e47-324238c9216f | Vipul1407/DSA--Leetcode-Ques.. | 3154-maximum-value-of-an-ordered-triplet-i/maximum-value-of-an-ordered-triplet-i.cpp | class Solution {
public:
//METHOD-4
//OPTIMIZED APPROACH USING NO VECTOR..
long long maximumTripletValue(vector<int>& nums)
{
int n= nums.size();
long long ans=0;
long long maxdiff=0;
long long maxi=0;
for(int i=0;i<n;i++)
{
ans= max(ans,maxdi... | ALGO | 0.999993 | 5.448597 |
ef5909fe-2d30-40d5-9edc-6bd820acdd6e | v1otusc/algo_sum | [7] 分治法/leetcode-241-different-ways-to-add-parentheses.cpp | /*
* @Description:
*
* 给定一个只包含加减和乘法的数学表达式,求通过加括号可以得到多少种不同的结果
*
* @输入示例:
*
* 2-1-1
*
* @输出实例:
*
* [0, 2]
*
* @输入输出说明:
*
* 输入是一个字符串,表示数学表达式;输出是一个数组,存储所有不同的加括号结果。
*
* @限制条件:
*
* 在这个样例中,有两种加括号结果:((2-1)-1) = 0 和 (2-(1-1)) = 2。
*
* @题目思路:
*
* 利用分治思想,我们可以把加括号转化为,对于每一个运算符号,先执行处理两侧的数学表达式
* 再处理此运算符号。
*
... | ALGO | 0.999992 | 5.237971 |
c1e65cd1-f72c-4b72-9560-1548ecde573d | ishandutta2007/codeforces | saba2000/normal/259/C.cpp | #include <iostream>
#include <string>
using namespace std;
int main ()
{string s; int k=0;
cin>>s;
for (int i=0; i<s.length(); i++)
if (s[i]=='0') {s[i]='2'; k=1; break;}
if (k==0) s[0]='2';
for (int i=0; i<s.length(); i++)
if (s[i]!='2') cout<<s[i];
return 0;
} | ALGO | 0.985984 | 3.473419 |
e1d39563-eaa8-466b-9685-00618b824623 | pukuba/Algorithm | boj/01987/01987.cpp14.cpp | #include <bits/stdc++.h>
using namespace std;
char _map[21][21];
bool check[26];
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1},n,m;
bool in(int a,int b){ return 1<=a && a<=n && 1<=b && b<=m; }
int dfs(int y,int x){
if(!in(y,x)) return 0;
if(check[(_map[y][x]-'A')]) return 0;
check[(_map[y][x]-'A')]=true;
int a... | ALGO | 0.999462 | 4.731565 |
b6a4a29a-104b-45f9-aa4b-a0d9e95dc276 | zzzzhuque/TCP-IP | chapter10/fork.cpp | //
// Created by zhuque on 2021/2/8.
//
#include <cstdio>
#include <unistd.h>
int gval = 10;
int main(int argc, char *argv[]) {
pid_t pid;
int lval = 20;
gval++, lval += 5;
pid = fork();
if (pid == 0) { ////< @note if Child Process
gval += 2, lval += 2;
} else { ////< @note if Parent Process
... | TOOL | 0.977741 | 3.553918 |
05aefa62-4406-4239-bfa9-a4519fde9b79 | bilfnous/Hacker-Rank | Week-03/EX_Big_sorting/main.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'bigSorting' function below.
*
* The function is expected to return a STRING_ARRAY.
* The function accepts STRING_ARRAY unsorted as parameter.
*/
bool cmp(const string& a , const string& ... | ALGO | 0.999851 | 5.769601 |
04e9792d-02f3-429f-ac1f-9281097107ae | mxuexxmy/2019HolidaysTrain | ICPC/ Fishermen.cpp | //
// Created by longxing on 19-7-30.
//
#include <bits/stdc++.h>
using namespace std;
const int MAX = 2000050;
int a[MAX]={0}, b[MAX] ={0};
int main(){
int n, m, l;
cin >> n >> m >> l;
int k = n, id = 0;
while (k--){
int x, y;
scanf("%d%d",&x,&y);
if(y > l) continue;
a[i... | ALGO | 0.999968 | 3.448582 |
011231bf-3e7a-4f5e-b862-1c64f4da0f8e | ishandutta2007/codeforces | serotonin/normal/1473/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 3e5+5;
void solve() {
int n, d;
scanf("%d %d", &n, &d);
vector <int> a(n);
for(int i=0; i<n; i++) scanf("%d", &a[i]);
sort(a.begin(), a.end());
int x = 0;
for(int i=0; i<n; i++) x = max(x, min(a[i], a[0] + a[1]));
... | ALGO | 0.99994 | 4.459521 |
91a7ae22-85ed-42ce-b6f4-59409b92860a | Mohitgit22/LEETCODE-Q | 268-missing-number/missing-number.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
long long arr_sum = 0;
int n = nums.size();
long long sum = (n*(n+1))/2;
for(auto it : nums) {
arr_sum += it;
}
return sum - arr_sum;
}
}; | ALGO | 0.999943 | 5.549814 |
68ad5cd5-55b2-41dc-9a15-3f980e0455e2 | Santhosh-12345/Leetcode | 0165-compare-version-numbers/0165-compare-version-numbers.cpp | class Solution {
public:
int compareVersion(string version1, string version2) {
vector<int>v1,v2;
string temp="";
for(char ch:version1)
{
if(ch=='.')
{
v1.push_back(stoi(temp));
temp="";
}
else
... | ALGO | 0.999832 | 5.468819 |
c56fc5c5-5075-4da4-b364-ceb3937b185c | zhzh2001/Learning-public | c++实用代码/test&code/Astar_k短路/Astar.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<queue>
using namespace std;
#define N 1010
struct Edge{
#define Mx N*N
int link[Mx],cost[Mx],next[Mx],son[Mx],l;
void clear(){l=0;memset(son,0,sizeof(son));}
Edge(){clear();}
void addedge(int x,int y,int z){
link[++l]=y;cost[l]=z;next[l]=son[x];son... | ALGO | 0.999969 | 4.027145 |
00f20f07-1b19-4999-98a0-2a77dc4f9f8d | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/ChefAndAnts_20210112133014.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999925 | 3.662576 |
d3ff27c2-81f2-4f55-b897-4b9165f9744a | PaukIsUha/optimizing_formating_code | predictions/supersonic_predicted_submissions/Codenet/p01128/731820531/2.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#incl... | ALGO | 0.999839 | 3.896815 |
31027ed8-f886-4477-ab68-8a4bb5bb4cbe | raincross7/code-similarity | codes/train_code/problem139/problem139_76.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=(1<<18);
int n, a[N+10];
pair<int,int> f[N+10];
inline void up(pair<int,int> &a,pair<int,int> b){
if (b.second>=a.first){
a=b;
}
else if (b.first>=a.first){
a.second=a.first;
a.first=b.first;
}
else if (b.first<a.first... | ALGO | 0.999795 | 3.703723 |
892b6cd6-528f-4fdf-aa1a-e48a64925caf | Lumyn-Labs/ConnectorX-Firmware-Starter | lib/FastLED/src/noise.cpp | /// @file noise.cpp
/// Functions to generate and fill arrays with noise.
/// Disables pragma messages and warnings
#define FASTLED_INTERNAL
#include "FastLED.h"
#include <string.h>
// Compiler throws a warning about stack usage possibly being unbounded even
// though bounds are checked, silence that so users don't s... | ALGO | 0.978817 | 6.46633 |
979e6d44-c442-4d37-a152-1a4aa92a2697 | sarakhmen/Fundamentals-of-Programming-II | lr_3/zavd5.cpp | int abs(int n){
return n < 0 ? -n : n;
}
long abs(long n){
return n < 0 ? -n : n;
}
double abs(double n){
return n < 0 ? -n : n;
} | TOOL | 0.895611 | 4.210651 |
799d53ce-364f-4490-8fb0-b1dbeb909b5a | krnbatra/SPOJ-Solutions | ETFD.cpp | /*My First Template :D*/
#include <bits/stdc++.h>
#include <limits.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define MOD (ll)1000000007
#define pb push_back
#define EPS 1e-9
#define FOR(i,n) for(int i = 0;i < n; i++)
#define FORE(a,b) f... | ALGO | 0.999971 | 3.953389 |
1e9dd5fa-8d2d-4fc0-a5e2-7c9c8fea2158 | umaidansari12/CP_Backup | codechef/nov_long_div_3_2021/A_which_fuel_is_cheaper.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while (t--) {
long long int x, y, a, b, k;
cin >> x >> y >> a >> b >> k;
long long int petrol = (x + (a * k));
long long int diesel = (y + ... | ALGO | 0.994681 | 3.542279 |
2c01f0be-eaca-4ee5-a1fa-3e9401f6c107 | shailendra40/Flutter_Projects | flutter_basics/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.998626 | 6.76775 |
6971abf1-449c-41f8-9bb3-87f871497ccc | shankersingh01/LeetCode | 0719-find-k-th-smallest-pair-distance/0719-find-k-th-smallest-pair-distance.cpp | class Solution {
public:
int smallestDistancePair(std::vector<int>& numbers, int k) {
std::sort(numbers.begin(), numbers.end());
int minDistance = 0, maxDistance = numbers.back() - numbers.front();
while (minDistance < maxDistance) {
int midDistance = minDistance + (maxDistance ... | ALGO | 0.99999 | 6.389858 |
6843ebd7-a114-4ddf-9682-3f7c13da55e8 | fortuneOS-AOSP/system_core | init/property_service.cpp | #include "property_service.h"
#include <android/api-level.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <netinet/in.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/... | TOOL | 0.975033 | 4.26477 |
c6b2af1f-dd3e-4bf1-b7d7-eff770713531 | TheFenrisLycaon/DSA-C-- | cp/CodeForces/1000-1099/1031A.cpp | #include <cstdio>
int main(){
long w, h, k; scanf("%ld %ld %ld", &w, &h, &k);
long sum(0);
while(k--){sum += 2*(w + h) - 4; w -= 4; h -= 4;}
printf("%ld\n", sum);
return 0;
}
| ALGO | 0.999016 | 3.546338 |
33c0044a-1731-4e9a-9d3f-3588a4ad8604 | Hemanthmeesala/Leetcode | 0287-find-the-duplicate-number/0287-find-the-duplicate-number.cpp | class Solution {
public:
int findDuplicate(vector<int>& nums) {
int slow = nums[0];
int fast = nums[0];
do {
slow = nums[slow];
fast = nums[nums[fast]];
} while (slow != fast);
fast = nums[0];
while (slow != fast) {
slow = ... | ALGO | 0.999983 | 6.381159 |
b1bca073-044f-4836-bf62-c1861b484ed5 | adamlamoglia/Hashing | hashEncadeado.cpp | #include "hashEncadeado.h"
using namespace std;
HashEncadeado::HashEncadeado(int tamanho){
this->tamanho = tamanho;
}
void HashEncadeado::setQuantidadeDeAcessos(int n){
this->quantidadeDeAcessos = n;
}
int HashEncadeado::getQuantidadeDeAcessos(){
return quantidadeDeAcessos;
}
int HashEncadeado::getTama... | TOOL | 0.920592 | 3.542626 |
b035b041-8363-47d3-88de-6b91b7909c45 | cyc95/Battle-Snake | CPPlinux/minmax/pthread_4snake/uct_node.cpp | //
// Created by Yuancong Chen on 2021/12/18.
//
#include "uct_node.h"
#include <cmath>
#define PI 3.1415926
void cyc::calculated_action_rate(const double *child_values, double *action_rate){
double sum;
if(*child_values > 120.8){
*action_rate = 1;
*(action_rate+1) = 0;
*(action_rate+... | ALGO | 0.999986 | 3.92517 |
df8dbab0-b394-44f7-8e85-5fd916d7a5ba | foorhad/basic-data-structure | MOD 16 Assignemt 03/Is_It_Valid.cpp | #include <iostream> // Input/output streams (cin, cout, cerr, etc.)
#include <fstream> // File streams (for file input/output)
#include <iomanip> // Input/output manipulators (for formatting)
#include <string> // String manipulation
#include <vector> // Dynamic arrays
#include <list> /... | ALGO | 0.999833 | 5.088195 |
b96ff45e-1e95-4fb3-bf74-d7a6f4322e96 | chiehfc/SpaceWording | cocos2d/cocos/math/Quaternion.cpp | #include "Quaternion.h"
#include "base/ccMacros.h"
NS_CC_MATH_BEGIN
const Quaternion Quaternion::ZERO(0.0f, 0.0f, 0.0f, 0.0f);
Quaternion::Quaternion()
: x(0.0f), y(0.0f), z(0.0f), w(1.0f)
{
}
Quaternion::Quaternion(float xx, float yy, float zz, float ww)
: x(xx), y(yy), z(zz), w(ww)
{
}
Quaternion::Quater... | ALGO | 0.950602 | 7.359225 |
bd7023b9-afae-401c-866e-5fcdcdee61fd | qbecky/DGPClass | dgp2019_exercise3/externals/nanogui/ext/eigen/bench/sparse_product.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.992243 | 4.17358 |
cab5fec7-e0a9-4e96-be2e-ffeeb42b636b | fluttermeetup/Flutter_NoteTaking_By_ChatGPT | notes_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998621 | 6.76073 |
c793fece-7676-4f32-9b2c-ebb9f119363d | lauraippolito28/ARREGLOS- | quiz_punto2.cpp | // EJERCICIO 2: Crear un vector de n posiciones de n cantidad de minas simulando el juego de buscaminas, debe mostrar cuantas minas hay.
#include <iostream>
using namespace std;
int main(){
//Entradas
int cantm;
cout << "Ingrese los numeros que desee";
cin >> cantm;
int minas[cantm];
for (int i = 0; i <(cantm);... | TOOL | 0.948042 | 3.335921 |
4511de95-4dbb-46c2-98ff-f33774d39f11 | devedu-AI/Data-Structures-and-Algorithms-in-Cpp-Mayank-Arora | 029 -C++ STL/Algorithms/Mutating/Sort/SortonArrays.cpp | // Sort in C++ STL on Array
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
int arr[] = {10,20,5,7};
int n = sizeof(arr)/sizeof(arr[0]);
sort(arr,arr + n);
for(int x :arr ){
cout << x << endl;
}
return 0;
}
// Using Cmp function Greater functi... | ALGO | 0.999924 | 5.005677 |
4b2bdc0f-7770-4a34-8dca-c0501a1e4dfa | LeeYuHwan/AlgorithmQuiz | ProgrammersT/가장큰수.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
bool check(string& a, string& b) {
return a + b > b + a;
}
string solution(vector<int> numbers) {
vector<string> answer_tmp;
string answer = "";
for (int i = 0; i < numbers.size(); i++) {
answer_tmp.... | ALGO | 0.999848 | 6.093067 |
6cde1073-68f5-48b2-9030-8f2328bea887 | goelpalak07/Dynammic-Programming | print_LCS.cpp | #include<iostream>
using namespace std;
void LCS(string x,string y,int m,int n)
{
int i,j;
int dp[m+1][n+1];
for(i=0;i<=n;i++)
dp[0][i]=0;
for(i=0;i<=m;i++)
dp[i][0]=0;
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
if(x[i-1]==y[j-1])
dp[i][... | ALGO | 0.999967 | 3.760204 |
34868fe3-68d0-494b-81c0-3e55b11be92d | ishandutta2007/codeforces | ljc00118/normal/850/A.cpp | #include <bits/stdc++.h>
#define Fast_cin ios::sync_with_stdio(false), cin.tie(0);
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
#define DEBUG(x) cerr << "DEBUG" << x << " >>> " << endl;
using namespace std;
typedef unsigned long long ull;
typedef p... | ALGO | 0.999851 | 3.055176 |
c6cd6a47-0cb3-48a5-a2e6-a81cfc5ee9c1 | mdshihabshahriar/Data_Structure | Module 21/search_in_bst.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node* left;
Node* right;
Node(int val)
{
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
Node* input_tree()
{
int val;
cin >> val;
Node* root;
if(va... | ALGO | 0.999988 | 3.883384 |
685f9bd1-f35c-40cd-9fae-243b5a31e167 | CMaybe/BOJ | 15988.cpp | #include<cstring>
#include<iostream>
using namespace std;
long long arr[1000001];
int main()
{
int n, m,s = 0;
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=0;i<n;i++){
memset(arr,0,sizeof(arr));
arr[0]=0;
arr[1]=1;
arr[2]=2;
arr[3]=4;
cin>>m;
for(int j =4;j<=m... | ALGO | 0.999974 | 3.553077 |
f99e031a-2d93-4e7d-9d48-4e1ba395f3ae | adityanjr/code-DS-ALGO | CodeForces/Complete/100-199/161D-DistanceInTree.cpp | #include <cstdio>
#include <vector>
std::vector<std::vector<long long> > count;
std::vector<std::vector<long long> > edges;
long long n, k, output;
void dfs(long long node, long long from){
count[node][0] = 1;
for(long long p = 0; p < edges[node].size(); p++){
long long v = edges[node][p];
if... | ALGO | 0.999961 | 4.208442 |
75e31cff-0335-48c9-88b9-1ce038c0a3e0 | PraffulPatel27/GFG-Solution | Easy/Find Transition Point/find-transition-point.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
int transitionPoint(int arr[], int n) {
// code here
for (int i=0; i<n; i++) {
if (i-1>=0 && arr[i]==1 && arr[i-1]==0)
return i;
}
... | ALGO | 0.999785 | 6.187572 |
1016d12c-0ad8-4e7c-94e7-8eb612fe4af4 | prashantdhaka1/LeetCode-Solutions | C++/find-the-minimum-amount-of-time-to-brew-potions.cpp | // Time: O(n * m)
// Space: O(1)
// prefix sum, greedy
class Solution {
public:
long long minTime(vector<int>& skill, vector<int>& mana) {
int64_t result = 0;
for (int i = 1; i < size(mana); ++i) {
int64_t prefix = 0, mx = 0;
for (const auto& x : skill) {
pr... | ALGO | 0.999925 | 6.673833 |
f69972e0-5e02-478a-a5ac-47887bce1553 | shengshengxiaowang/2019-summer | 算法/最大子序列.cpp | /*
对于字符串x和y, 如果擦除x中的某些字母(有可能全擦掉或者都不擦)能够得到y,我们就称y是x的子序列。例如."ncd"是"nowcoder"的子序列,而"xt"不是。
现在对于给定的一个字符串s,请计算出字典序最大的s的子序列。
写的纯c风格的emmmmmm
字典序意思就是先比较第一个,第一个大就OK,,一样再比较第二个
所以倒着遍历字符串即可
*/
#include<iostream>
#include<string.h>
#include<stdlib.h>
using namespace std;
char ss[50];
class solution
{
public:
//vector<char> fu... | ALGO | 0.99983 | 3.479824 |
39fa3b27-9187-4a03-bd98-9586f07d0f3d | tausif39/Leetcode | 120-triangle/120-triangle.cpp | class Solution {
public:
int n;
int paths(int i, int j,vector<vector<int>>& v , vector<vector<int>> &dp)
{
if(i==n-1)
{
return v[i][j];
}
if(dp[i][j]!=-1)return dp[i][j];
int down=v[i][j]+ paths(i+1,j,v,dp);
int diagonal... | ALGO | 0.999997 | 6.172873 |
d932e5c8-2791-4d76-ae03-1d9fabd002ee | codingtyro/codeforces | c_996_div3/e.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int tt;
int main(){
cin >> tt;
while(tt--){
//input
int n,m,k;
cin >> n >> m >> k;
int w;
cin >> w;
vector<int>nums(w);
for(int i = 0;i < w;i++)cin >> nums[i];
vector<int>hh;
... | ALGO | 0.999954 | 3.643368 |
2d817df2-85c1-46c7-b7c0-0f78b3498f7e | jcazevedo/leetcode | src/2824-count-pairs-whose-sum-is-less-than-target.cpp | // 2824. Count Pairs Whose Sum is Less than Target
// https://leetcode.com/problems/count-pairs-whose-sum-is-less-than-target/
#include <algorithm>
#include <vector>
using namespace std;
class Solution {
public:
int countPairs(vector<int>& nums, int target) {
sort(begin(nums), end(nums));
int N = nums.siz... | ALGO | 0.999913 | 6.521821 |
9bac2840-ceb8-43f0-a1a8-d845e781a82d | weilai1221/TMPICPANALYSISLAMSELFLEARNZ | submodules/fast_gicp/thirdparty/Eigen/doc/snippets/Triangular_solve.cpp | Matrix3d m = Matrix3d::Zero();
m.triangularView<Eigen::Upper>().setOnes();
cout << "Here is the matrix m:\n" << m << endl;
Matrix3d n = Matrix3d::Ones();
n.triangularView<Eigen::Lower>() *= 2;
cout << "Here is the matrix n:\n" << n << endl;
cout << "And now here is m.inverse()*n, taking advantage of the fact that"
... | ALGO | 0.998495 | 3.70449 |
32c40ca5-7e28-4c54-87e1-4baded33e188 | luke-miklos/nubot | bwta/src/get_voronoi_edges.cpp | #include "functions.h"
#include "Color.h"
#include "VertexData.h"
namespace BWTA
{
bool inside_a_polygon(PointD pt, const std::vector<Polygon> &polygons)
{
for(unsigned int p=0;p<polygons.size();p++)
if (polygons[p].isInside(BWAPI::Position(int(pt.x()),int(pt.y())))==CGAL::ON_BOUNDED_SIDE)
return ... | ALGO | 0.999818 | 4.406768 |
d477c886-655f-4c10-928b-105ce84c0dd9 | hzfsls/leetcode-supercrawl | data/2050.parallel-courses-iii/code_snippets/sol.cpp | class Solution {
public:
int minimumTime(int n, vector<vector<int>>& relations, vector<int>& time) {
}
}; | ALGO | 0.999895 | 6.298344 |
dfe56da1-2f49-4f75-9995-d3fb9ac5696b | Devon333/modifiedLibra | src/pot/Potentials_angles.cpp | #include "Potentials_angles.h"
/// liblibra namespace
namespace liblibra{
using namespace liblinalg;
namespace libpot{
double Angle_Harmonic(VECTOR& r1,VECTOR& r2,VECTOR& r3, /* Inputs */
VECTOR& f1,VECTOR& f2,VECTOR& f3, /* Outputs*/
double k_theta,double theta_0 /* ... | ALGO | 0.996876 | 5.168603 |
65308b26-b3a8-49d2-9640-56bba22a3306 | yuforest/contests | abc_281/b/main.cpp | // ここは競プロではサボりがちです
#include <bits/stdc++.h>
using namespace std;
// デバッグ用マクロです。詳しくは https://naskya.net/post/0002/
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
// 節操ないですが、競プロでは便利です。
using ll = long ... | ALGO | 0.999526 | 5.61924 |
07f357fa-29a8-4d64-8cb5-acc7a8aa2479 | aolle99/VJ-2d-labs | libs/glm/test/gtx/gtx_simd_mat4.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentatio... | TEST | 0.980508 | 6.443896 |
1e19aee9-f9de-4cce-9ee2-6cb42944cfbd | Pseudo-iitian/DSA_2024 | BinarySearch/21BooKAllocation.cpp | #include<bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <queue>
#include <stack>
using namespace std;
#define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
int possible(vector<int> &arr,int maxPages,int m){
in... | ALGO | 0.999983 | 4.51966 |
579942d7-d3e6-42ac-bbe2-3f6f33d1167c | TopDog01/SB_Lessons | Lesson_7/Lesson_7.1/Lesson_7.1.cpp | #include <iostream>
int main() {
setlocale(LC_ALL, "Russian");
int n;
std::cout << "Какое по счёту число Фибоначчи вы хотите увидеть? ";
std::cin >> n;
int counter = 0;
int previousNumber = 1;
int prevPreviousNumber = 1;
int currentNumber;
if (n <= 0 || n > 46) {
std::co... | ALGO | 0.999827 | 4.84811 |
332ca250-d403-44cc-882d-a495be1e148d | BALLISTICrobin/c-plus-plus-and-dsa | mergesort.cpp | #include<iostream>
using namespace std;
void merge(int *arr, int s, int e) {
int mid = (s+e)/2;
int len1 = mid - s + 1;
int len2 = e - mid;
int *first = new int[len1];
int *second = new int[len2];
//copy values
int mainArrayIndex = s;
for(int i=0; i<len1; i++) {
first[i] = a... | ALGO | 0.999982 | 4.61781 |
c990b70f-0505-48bf-8129-9d0760108a5a | GopherTeen/OJ_Code | Problems/Leetcode/001-1000/001-100/51.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
class Solution {
public:
vector<vector<string>> solveNQueens(int n) {
vector<vector<string>> ans;
vector<int> col(n), check(n), diag1(2 * n - 1), diag2(2 * n - 1);
auto dfs = [&](auto&& dfs, int r) {
if (r == ... | ALGO | 0.999714 | 5.612891 |
4604a74b-0141-4fe9-88fc-cf4c4f49821f | KimmiGYH/LeetCode_Notes_Public | Solutions_0001-1000/0131_Palindrome Partitioning_分割回文串/cpp_2_DFS_Backtracking_DP_v1.cpp | #include <vector>
#include <string>
using namespace std;
class Solution {
public:
vector<vector<bool>> f;
vector<vector<string>> ans;
vector<string> path;
vector<vector<string>> partition(string s) {
int n = s.size();
f = vector<vector<bool>>(n, vector<bool>(n));
// f[i,j] 表示从... | ALGO | 0.999955 | 5.496712 |
cd009fba-a9a3-4c2e-8a5a-f3f2ff5fd006 | amilearning/hmclmobil | acados/examples/acados_python/getting_started/env/lib/python3.7/site-packages/casadi-3.5.1-py3.7-linux-x86_64.egg/casadi/include/casadi/core/dple.cpp | #include "dple_impl.hpp"
#include <typeinfo>
using namespace std;
namespace casadi {
bool has_dple(const string& name) {
return Dple::has_plugin(name);
}
void load_dple(const string& name) {
Dple::load_plugin(name);
}
string doc_dple(const string& name) {
return Dple::getPlugin(name).doc;
}
... | TOOL | 0.871657 | 6.426668 |
55701d0c-1083-4a47-bf34-8f263791fd0a | bravepam/CLRS | chapter19/binomial_heap_implements_MST.cpp |
/*******************************************
* Author: bravepam
* E-mail:<EMAIL>
* Blog:http://blog.csdn.net/zilingxiyue
*******************************************
*/
#include<iostream>
#include<fstream>
#include<vector>
#include<utility>
#include"BinomialHeap.h"
#define NOPARENT 0
#define MAX 0x7fffffff
using nam... | ALGO | 0.999752 | 3.998007 |
630edb6a-8ed1-460b-af68-de38a881dac5 | t3nsor/SPOJ | palsec-2.cpp | // 2023-09-24
// This is an implementation of the official solution, given here:
// https://oi.edu.pl/static/attachment/20110731/oi4.pdf#page=36
// (No, there's no English version. I used Google Translate.)
// The idea is to build up palindromes starting from the ends and working toward
// the middle, adjoining a pair ... | ALGO | 0.999914 | 5.074866 |
ea291388-bf28-4112-9c59-f73a87a7b437 | lordjuacs/compe | contest6/pI.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("input.txt", "r", stdin);
/// bibliografia: guide to competitive programming
/*
revisar:
getline() ///hay distintos parametros aqui.
*/
int t;
cin >> t;
w... | ALGO | 0.999279 | 5.093406 |
ea43ca86-b361-447e-9a55-7b90c3e66047 | robertwyb/Computer-graphic-assignments | computer-graphics-shader-pipeline/eigen/doc/examples/class_FixedBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::Block<Derived, 2, 2>
topLeft2x2Corner(MatrixBase<Derived>& m)
{
return Eigen::Block<Derived, 2, 2>(m.derived(), 0, 0);
}
template<typename Derived>
const Eigen::Block<const Derived, 2, 2>
topLeft2... | TOOL | 0.878754 | 6.64346 |
f64741b0-737c-4c44-96e7-ca1a24444059 | ciwei100000/opencv | samples/tapi/bgfg_segm.cpp | #include <iostream>
#include <string>
#include "opencv2/core.hpp"
#include "opencv2/core/ocl.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/video.hpp"
using namespace std;
using namespace cv;
#define M_MOG2 2
#define M_KNN 3
int main(int arg... | TOOL | 0.935548 | 5.798064 |
0a7e736e-dbe8-4715-a390-f7127d8bd3ed | Parth-K-15/100-days-of-DSA | 2073. Time Needed to Buy Tickets.cpp | There are n people in a line queuing to buy tickets, where the 0th person is at the front of the line and the (n - 1)th person is at the back of the line.
You are given a 0-indexed integer array tickets of length n where the number of tickets that the ith person would like to buy is tickets[i].
Each person takes exac... | ALGO | 0.999995 | 6.861573 |
37484687-5a76-4813-8d2a-33743a08be7b | Maqsood6002/Practice | C++/C++ and DSA/Lecture033 Recursion Day3/sortedArray.cpp | #include<iostream>
using namespace std;
bool isSorted(int arr[], int size) {
//base case
if(size == 0 || size == 1 ){
return true;
}
if(arr[0] > arr[1])
return false;
else {
bool remainingPart = isSorted(arr + 1, size - 1 );
return remainingPart;
}
}
int main... | ALGO | 0.999891 | 5.415977 |
632530c0-e0ac-4009-94ca-6feae2d69129 | Al-amen/leetcode | 1717.Maximum_Score_From_Removing_Substrings.cpp | class Solution {
public:
int maximumGain(string s, int x, int y) {
if(x < y) {
swap(x,y);
reverse(s.begin(),s.end());
}
int a_count = 0, b_count = 0;
int total_point = 0;
for(int i = 0; i < s.size(); i++) {
char current_char = s[i];
... | ALGO | 0.999851 | 5.545485 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.