uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c6c1f2ff-c3e8-4caf-b3ce-5a05b60858e8 | MetricManifold/Project_4613 | 4613_final_project/eigen-eigen-323c052e1731/doc/examples/TutorialLinAlgExComputeSolveError.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(100,100);
MatrixXd b = MatrixXd::Random(100,50);
MatrixXd x = A.fullPivLu().solve(b);
double relative_error = (A*x - b).norm() / b.norm(); // norm() is L2 norm
cout << "The ... | ALGO | 0.999716 | 3.625966 |
f43ae78b-13d2-4d9b-b59b-7a4b2e683610 | sebadorn/Physically-based-Rendering | source/ObjParser.cpp | #include "ObjParser.h"
using std::map;
using std::string;
using std::vector;
/**
* Constructor.
*/
ObjParser::ObjParser() {
mMtlParser = new MtlParser();
mLightParser = new LightParser();
}
/**
* Destructor.
*/
ObjParser::~ObjParser() {
delete mMtlParser;
delete mLightParser;
}
/**
* Get the material of ea... | TOOL | 0.878497 | 5.549382 |
4d1bda78-5219-455b-9fe7-8ef7d5c7918a | 5Bh03m1k/Leetcode | 789-kth-largest-element-in-a-stream/kth-largest-element-in-a-stream.cpp | class KthLargest {
public:
priority_queue<int ,vector<int>, greater<int>> pq;
int king;
KthLargest(int k, vector<int>& nums) {
king = k;
for(int i = 0 ; i<nums.size() ; i++)
{
if(pq.size() < k) pq.push(nums[i]);
else
{
if(pq.top()... | ALGO | 0.99998 | 5.795964 |
ac2576f4-51c1-427a-8228-133e8ca8ac77 | Mantora/mangos_old | src/game/PathFinder.cpp | #include "MoveMap.h"
#include "GridMap.h"
#include "Creature.h"
#include "PathFinder.h"
#include "../recastnavigation/Detour/Include/DetourCommon.h"
////////////////// PathInfo //////////////////
PathInfo::PathInfo(const Unit* owner, const float destX, const float destY, const float destZ, bool useStraightPath) :
... | TOOL | 0.992141 | 7.104049 |
c0952676-db51-4b59-9fca-b61df659966a | coeing/cframework | framework/ext/boost/libs/graph/example/accum-compile-times.cpp | namespace std
{
template < typename T >
std::istream& operator >> (std::istream& in, std::pair < T, T > &p)
{
in >> p.first >> p.second;
return in;
}
}
namespace boost
{
enum vertex_compile_cost_t { vertex_compile_cost };
BOOST_INSTALL_PROPERTY(vertex, compile_cost);
}
using namespace boost;
type... | ALGO | 0.995121 | 4.580579 |
9a92458f-571e-4b6a-889f-93b98efe28de | ghts2110/competitive_programing | neps_academy/Bingo/Bingo.cpp | #include <iostream>
#include <bitset>
using namespace std;
int main(){
int n, b;
while(1){
cin >> n >> b;
if(n == 0 && b == 0){
break;
}
int array[b], cont = 0;
bitset<91> bt(0);
for(int i = 0; i != b; i++){
cin >> array[i];
... | ALGO | 0.999806 | 3.477452 |
0cad7fb0-cca6-45b1-8c3d-bb59c9f8c123 | khaledalam/cpp-convo | conversations_cpp/04-2024/2024_04_26/func_LongestArrow_khaled_cpp_53_2024_26_04.cpp | /***
* Prompt:
khaled_cpp_53_2024_26_04: 202320ee-cb57-4ef0-9b1c-036464c957b6
Write a C++ function called LongestArrow, it will accept one input called text which represent some text. This function should return number of type int which represent the max arrow string length in the input. Some string called arrow i... | ALGO | 0.995639 | 6.132099 |
f4cc9a3a-ab85-42ad-9c78-2d79ccb0683d | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/ChefAndAnts_20210112164808.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.999879 | 3.687161 |
32c9370d-7414-42c5-bfb3-0183bbd61e59 | TerryKingston/schoolbloc | project_implementation/flask_app/angr-z3-angr/src/interp/iz3translate.cpp | #ifdef _WINDOWS
#pragma warning(disable:4996)
#pragma warning(disable:4800)
#pragma warning(disable:4267)
#pragma warning(disable:4101)
#endif
#include "iz3translate.h"
#include "iz3proof.h"
#include "iz3profiling.h"
#include "iz3interp.h"
#include "iz3proof_itp.h"
#include <assert.h>
#include <algorithm>
#include <s... | ALGO | 0.998326 | 6.027649 |
4be2c1e0-4053-4c75-8e98-b4ecb4ef2f06 | ishandutta2007/codeforces | qoo2p5/normal/649/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define ld long double
#define sz(x) (int) x.size()
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define eq(a, b) abs(a - b) < EPS
#ifdef DEBUG
#define debug(x) cerr << "\033[31m" << x << "\033[39m" << endl;
#... | ALGO | 0.999627 | 3.803361 |
26fee437-da60-46df-b979-9494d35c9510 | TheBoss77/Leetcode | Sum_of_Subarray_Minimums.cpp | #include<iostream>
#include<vector>
#include<stack>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
int sumSubarrayMins(vector<int>& nums) {
int length = nums.size();
vector<int> left(length, -1);
vector<int> right(length, length);
stack<int> stk;
for (int i = 0; i < length; ++i... | ALGO | 0.999971 | 4.387528 |
9e1c6a26-be25-4d24-ade4-1eaee3cb266f | jim2832/Leetcode | 0506-relative-ranks/0506-relative-ranks.cpp | class Solution {
public:
int find_max_index(vector<int>& score){
int max_index;
int max = -INT_MAX;
for(int i=0; i<score.size(); i++){
if(max < score[i]){
max = score[i];
max_index = i;
}
}
return max_index;
}
... | ALGO | 0.99995 | 6.23026 |
701f931b-6e74-4dbf-baa7-999365f707aa | Shrikant-Markali/PPA-PROGRAMS | CPP(PPA)/Operator3.cpp | #include<iostream>
using namespace std;
class Demo
{
public:
int A,B;
Demo(int i, int j)
{
cout<<"Inside constructor\n";
A=i;
B=j;
}
Demo operator + ( Demo op2)
{
cout<<"Inside operator overloading function\n";
return Demo(this->A+op2.A, this->B+op2.B)... | ALGO | 0.879174 | 5.072051 |
8e7499d2-d892-49d8-b466-3a59236393af | anant-agarwal/spoj | MMAXPER.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n;
cin>>n;
long lin1=0,lin2=0,lastlin1=0,lastlin2=0;
int a,b;
for(int i=0;i<n;i++)
{
cin>>a>>b;
if(a<b)
{
int temp=a;
a=b;
b=temp;
}
long v1,v2,v3,v4;
v1=lin1+b;
v3=lin1+a;
if(lastlin1!=0)
{
v1+=abs(lastlin1... | ALGO | 0.999964 | 3.437238 |
75d93f28-2e8a-47d2-a0d8-398c5f9785ab | Adityakaldhone/flutter_v2 | page_transitions/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.998429 | 6.76073 |
7f1c21cc-0e11-4af2-9250-093fd54c7da6 | stellar121/projects_all | 1-SM4-opt/src/sm4_gcm.cpp | #include "sm4_gcm.h"
// 伽罗瓦域乘法(GF(2^128)):使用 PCLMULQDQ 指令加速
__m128i sm4_gcm::gf_mul(const __m128i& a, const __m128i& b) {
__m128i res = _mm_setzero_si128();
__m128i tmp_a = a;
__m128i tmp_b = b;
for (int i = 0; i < 128; ++i) {
if (_mm_extract_epi64(tmp_b, 0) & 1) {
res = _mm_xor_si... | ALGO | 0.964062 | 4.748738 |
7746cee3-fcd6-4d68-bebd-8df359c4fb2e | Dts0/code | offer/5.替换空格.cpp | #include<iostream>
#include<stdlib.h>
#include<string>
using namespace std;
string replace_space(const char* in,int length){//时间复杂度O(n)
if(!in || length<=0) return "";
int cnt=0;
for(int i=0;in[i]!='\0';++i){//数有多少空格,以分配空间
if(in[i]==' ')
++cnt;
}
//cout<<cnt<<"spaces"<<endl;
char out[length+cnt*2+1];//输出数组,... | TOOL | 0.990785 | 3.433454 |
36a64cc6-f9ec-4372-ad09-0a23c1c16b08 | Asad-Bin/cf-ac-problems | codeforces/1451/D..cpp | //...Bismillahir Rahmanir Rahim...
// Code by Asad Bin Saber
#include <bits/stdc++.h>
using namespace std;
// typedefs...
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;
// ... | ALGO | 0.999351 | 4.627048 |
901404ca-1189-43bd-8790-5198e99a4336 | itskrisverse/Programming | Patterns/invertedHalfPyramid.cpp | #include<iostream>
using namespace std;
int main(){
//inverted half pyramid
int n;
cout<<"enter the value of n:";
cin>>n;
//outer loop
for(int row=0;row<n;row++){
//inner loop
for(int col=0;col<n-row;col++){
cout<<"* ";
}
cout<<endl;
}
return ... | ALGO | 0.999864 | 3.960182 |
9e5d39b6-1d72-484c-bf00-ec493b24ec89 | AniketR10/DSA | dp_with_bitmask/u_grouping_atcoder.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
vector<ll> sums(1<<16,0);
vector<ll> dp(1<<16,INT_MAX);
ll calc(vector<vector<ll>>& compat, int mask){
ll ans =0;
for(int i=0;i<=16;i++){
for(int j=i+1;j<=16;j++){
if((( mask & 1<<i) !=0) and ((mask & 1<<j) !=0)){
... | ALGO | 0.999972 | 4.147142 |
9acb0dc6-225b-406f-b72b-b0eef80dd5c3 | raincross7/code-similarity | codes/train_code/problem446/problem446_409.cpp | #include<bits/stdc++.h>
using namespace std;
typedef pair< int,int > P;
int N;
vector< vector< int > > Edge;
vector< int > Csum;
void bfs(){
Csum.assign(N+1,-1);
queue< P > que;
que.push(P(0,0));
Csum[0] = 0;
while(!que.empty()){
int now = que.front().second;
int cost = que.front().first;
que.po... | ALGO | 0.999955 | 3.833526 |
549438e9-10d6-4146-addc-a908f0831b43 | InwooLeeme/Algorithm | Boj/23286.cpp | #pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
using name... | ALGO | 0.999846 | 5.231211 |
752facb9-db71-4343-9a47-4cb225fe7f86 | JPKAAAAA/GENERAL-C-PROGRAMS | perfectNumber.cpp | #include<iostream>
using namespace std;
int main()
{
int n,i=1,sum=0;
cout<<"Enter a number: ";
cin>>n;
while(i<n)
{
if(n%i==0)
sum=sum+i;
i++;
}
if(sum==n)
cout<<i<<" is a perfect number.";
else
cout<<i<<" is not a perfect number.";
return... | ALGO | 0.9998 | 3.693306 |
0a72f109-7bc4-4c5f-94fb-77f451baf2c0 | jsong98/Algorithm | classes/production/Algorithm/B/B04_해시_분할정복/염라대왕의이름정렬.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool compare(string s1, string s2) {
if (s1.length() != s2.length()) {
return s1.length() > s2.length();
}
for (int i = 0; i < max(s1.length(), s2.length()); i++) {
char c1 = i < s1.length() ? s1[i] : 0;
... | ALGO | 0.999988 | 4.968007 |
2cb1c248-0a3d-4197-9ceb-0d3c752594d1 | Quuxplusone/tbb | examples/pipeline/square/gen_input.cpp | #include <stdlib.h>
#include <stdio.h>
#include <stdexcept>
#if _WIN32
#include <io.h>
#ifndef F_OK
#define F_OK 0
#endif
#define access _access
#else
#include <unistd.h>
#endif
const long INPUT_SIZE = 1000000;
//! Generates sample input for square.cpp
void gen_input( const char *fname ) {
long num = INPUT_SIZE;... | TOOL | 0.952432 | 3.779569 |
555044fa-9b4b-411c-94c5-0875f27b59e9 | encrypted-def/SW-Expert-Academy | 1989.cpp | #include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <functional>
#include <iostream>
#include <tuple>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
typedef long long ll;
t... | ALGO | 0.999516 | 4.072072 |
7a62cfd4-0b26-4ef2-b351-18df68839bc0 | thegamer1907/Code_Analysis | Codes/AC/1060.cpp | #include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
int main()
{
int n,m;cin>>n>>m;
vector< pair<long long int,long long int> >a;
for(int i = 0;i < n;i++)
{
long long int x,y;
cin>>x>>y;
a.push_back(make_pair(x,y));
}
... | ALGO | 0.999966 | 3.780139 |
6855bbab-2f8a-4e77-a596-6377701b9b2a | ANUJ0MUNJAL/LeetCode-POTD | 1741-sort-array-by-increasing-frequency/sort-array-by-increasing-frequency.cpp | class Solution {
public:
static bool cmp(pair<int,int>&a,pair<int,int>&b){
if(a.second == b.second){
return a.first > b.first;
}
return a.second < b.second;
}
vector<int> frequencySort(vector<int>& nums) {
map<int,int> mp;
for(int i=0;i<nums.size();i+... | ALGO | 0.999999 | 5.703304 |
5ff57c3d-9623-450f-a334-60846555f72e | duhaode520/SpatialFHE | src/tfhe_geos/geom/TFHEQuadrant.cpp | //
// Created by ubuntu on 2/10/25.
//
#include "TFHEQuadrant.h"
namespace SpatialFHE::geom {
int TFHEQuadrant::commonHalfPlane(int quad1, int quad2) {
// if quadrants are the same they do not determine a unique
// common halfplane.
// Simply return one of the two possibil... | ALGO | 0.989458 | 6.794133 |
effc454a-0d16-4936-a99b-4eeafc4208e4 | kisang0365/baekjoonAlgorithm | 7569.cpp | /*
* 7569.cpp
*
* Created on: 2017. 7. 13.
* Author: chokisang
*/
#include<iostream>
#include<queue>
using namespace std;
//위, 아래, 왼쪽, 오른쪽, 앞, 뒤
int ax[6] = {0,0, 1, -1, 0, 0};
int ay[6] = {0, 0, 0, 0, 1, -1};
int az[6] = {1,-1, 0, 0,0,0};
struct Node{
int x;
int y;
int z;
int cnt;
Node(int x, int y... | ALGO | 0.999524 | 3.900898 |
3e6effb3-742e-415d-9f17-2b8856b5d37d | Next-Gen-UI/Code-Dynamics | LoveBabbar/09_backtracking/18_partition_of_set_into_K_subset_with_equal_sum.cpp | /*
link: https://practice.geeksforgeeks.org/problems/partition-array-to-k-subsets/1
video (also possible set will be stored): https://youtu.be/rszwy53vaP0
note: here in this problem we just have to say is it possible or not ?!
but still we have included which sets
sol: https://www.geeksforge... | ALGO | 0.999936 | 5.655378 |
f4a291ec-caea-44e9-8993-799d0dc711e2 | sanyamk0/100DaysOfCode | Day41-50/Day43/removeDuplicateFromSortedArrII.cpp | // 80. Remove Duplicates from Sorted Array II - LeetCode
class Solution
{
public:
int removeDuplicates(vector<int> &nums)
{
int n = nums.size();
if (n <= 2)
{
return n;
}
int index = 2;
for (int i = 2; i < n; i++)
{
if (nums[i] != n... | ALGO | 0.999892 | 6.135454 |
967479ca-5043-4fd1-9dc5-ba3d99d5d6fa | NasiriMohsen/CPP-Codes | C++/015-Float-division.cpp | #include <iostream>
using namespace std;
int main() {
int x = 5;
float y = 0.5;
float result1;
float result2;
result1 = x / y;
result2 = y / x;
cout << "The result of x / y is: " << result1 << endl;
cout << "The result of y / x is: " << result2 << endl;
return 0;
} | ALGO | 0.980074 | 3.87399 |
77b1c699-952a-45a2-a710-a345c48dfc25 | lalithakre/STL-in-Cpp | vectorOfVector.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
vector<vector<int>> v = {{1, 5, 2}, {3, 4}};
for (int i = 0; i < v.size(); i++)
{
for (int j = 0; j < v[i].size(); j++)
{
cout << v[i][j] << endl;
}
}
} | ALGO | 0.997812 | 3.994376 |
3ffcf91f-b978-457f-8298-abde90f6ed85 | myankprad/DSA | as6/q4.cpp | /**Question 4**
Given a binary array nums, return *the maximum length of a contiguous subarray with an equal number of* 0 *and* 1.
**Example 1:**
Input:nums = [0,1]
Output: 2
*/
#include <bits/stdc++.h>
using namespace std;
int findSubArray(int arr[], int n)
{
int sum = 0;
int maxsize = -1, startindex;
// Pick ... | ALGO | 0.999967 | 5.731233 |
59020440-3540-4e50-8b67-6ef531c9408d | threalwinky/cp_library | Codeforces/ec132div2/A.cpp | #include<iostream>
using namespace std;
int main(){
int T;cin>>T;
while (T--){
int a[4], dem = 0;
bool flag = 0;
cin>>a[0];
for (int i = 1; i<=3; i++)
cin>>a[i];
for (int i = 1; i<=3; i++){
if (a[a[0]] != 0) {
dem++;
swap(a[0], a[a[0]]);
}
else{
a[a[0]] = a[0];
break;
}
}
for (int i = 1;... | ALGO | 0.99992 | 3.426165 |
ac8dfc4f-a799-428a-bc8a-88c4f6a06147 | alexandraback/datacollection | solutions_5630113748090880_0/C++/hohomu/B.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<map>
#include<queue>
#include<iterator>
using namespace std;
#define FOR(i,s,e) for(int i = (s); i < (e); i++)
#define FOE(i,s,e) for(int i = (s); i <= (e); i++)
#define FOD(i,s,e) for(int i = (s); i >= (e); i--)
#define CLR(a) memset(a,0... | ALGO | 0.999578 | 3.884588 |
5a9f32f5-bea5-46d7-b3a5-a82abdf49fe2 | raincross7/code-similarity | codes/train_code/problem277/problem277_266.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi ... | ALGO | 0.99999 | 4.157757 |
fa014501-1c8e-4688-af57-f501a0163ebd | ishandutta2007/codeforces | tute7627/normal/995/F.cpp | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define spa << " " <<
#define fi first
#... | ALGO | 0.999937 | 3.677505 |
d04c1a0e-9f6a-4c22-93a2-9acd62b88319 | dranik-by/Cocos2d-x-Snake | cocos2d/cocos/base/CCConfiguration.cpp | #include "base/CCConfiguration.h"
#include "platform/CCFileUtils.h"
#include "base/CCEventCustom.h"
#include "base/CCDirector.h"
#include "base/CCEventDispatcher.h"
#include "renderer/backend/Device.h"
NS_CC_BEGIN
extern const char* cocos2dVersion();
Configuration* Configuration::s_sharedConfiguration = nullptr;
co... | CONFIG | 0.925939 | 6.195555 |
acd55d0f-7220-41d0-98d2-4b50aa4119c5 | RiShi029/DSA-Leetcode-questions | Insert in a Sorted List - GFG/insert-in-a-sorted-list.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(Node* node)
{
while (node != NULL) {
cout << node->data <<" ";
node = node->next;
}
cout<<"\n... | ALGO | 0.999951 | 5.909976 |
dcb126fd-dffa-4158-ace7-e424009e4394 | Uttam8448/Data-Structure-and-Algorithm | 86.BuildHeapfromarray.cpp | #include<iostream>
using namespace std;
void Heapify(int arr[],int n,int i){
int index = i;
int leftChildIndex = 2 * i;
int rightChildIndex = 2 * i + 1;
int largest = index;
if(leftChildIndex <= n && arr[largest] < arr[leftChildIndex]){
largest = leftChildIndex;
}
if(rightChildIndex <= n && arr[largest] < ... | ALGO | 0.999974 | 4.318193 |
f5eb11c7-dc90-45fe-a727-d5f0fcb8c15e | AYUSH-002/COMPETITVE-CODING-450 | STRING/minNumberOfBracketReversal.cpp | // https://practice.geeksforgeeks.org/problems/count-the-reversals0401/1
//{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
int countRev (string s);
int main()
{
int t; cin >> t;
while (t--)
{
string s; cin >> s;
cout << countRev (s) << '\n';
}
}
// Contributed By: Pra... | ALGO | 0.99864 | 5.286215 |
fee55eaa-98b6-47f9-a3c4-7486e489ff22 | Divyanshu9794/LeetcodePotd | 144-binary-tree-preorder-traversal/binary-tree-preorder-traversal.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999983 | 6.08129 |
7cf52580-8da8-4911-ae86-f8ddcb5e0361 | arifuljannatarif/programming-solutions | 742__A - Arpa’s hard exam and Mehrdad’s naive cheat__Accepted.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int x[]={6,8,4,2};
int n,i;
cin>>n;
if(n==0)
{
cout<<"1";
}
else
{
for(i=0;i<4;i++)
{
if(n%4==i)
{
... | ALGO | 0.99996 | 3.119868 |
68b2a750-091d-40bb-b0b0-5c0ec0386c28 | shivanshsanoria1/LeetcodeSolutions | CPP [2001-2500]/2420.find_all_good_indices [1].cpp | class Solution {
public:
// T.C.=O(n), S.C.=O(2*n)
vector<int> goodIndices(vector<int>& nums, int k) {
int n=nums.size();
vector<bool> prefix(n, false);
vector<bool> postfix(n, false);
int count = 1;
for(int i=1; i<n; i++)
{
if(count >= k)
... | ALGO | 0.99999 | 6.077197 |
e5a6a8fb-e95b-4c77-883d-53bbe783cb19 | eemoreira/biblioteca-de-problemas | atcoder/abc303/e.cpp | #include <bits/stdc++.h>
using namespace std;
using i3 = tuple<int,int,int>;
using i64 = long long;
using ii = pair<int,int>;
#ifdef LOCAL_DEBUG
#include "debug.h"
#else
#define dbg(x...)
#endif
/* stop freaking out pls */
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
v... | ALGO | 0.999812 | 4.271857 |
28621442-5cb8-411c-848e-bf6be828de48 | rlawo0307/Algorithm | baekjoon/C++/BAEKJOON_FUNC.cpp | #include <iostream>
#include <vector>
using namespace std;
long long sum(std::vector<int>&);
int main()
{
int n, tmp;
long long res;
vector<int> v;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> tmp;
v.push_back(tmp);
}
res = sum(v);
cout << res << "\n";
return 0;
}
long long sum(std::vector<int> &a... | ALGO | 0.999918 | 4.270401 |
8ae2379c-2383-4ab7-a68c-7a32af73b960 | MihaiAnghelin/StepIT-C | 13) 20.01.2019/reverse_words.cpp | //Given a string containing a set of words separated by whitespace, we would like to transform it to a string
//in which the words appear in the reverse order.
// For example, "Alice likes Bob" transforms to "Bob likes Alice". We do not need to keep the original string.
//does not include '.' character.
#include<cstd... | ALGO | 0.99996 | 3.687475 |
95cb8e2d-fca4-41bd-b584-c5237f3fa86a | ishandutta2007/codeforces | egor_bb/normal/951/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a... | ALGO | 0.999958 | 3.259675 |
b23fcbd2-a26f-4301-9233-810e530f3d55 | varunification/graphs | Shortest_distance_topo_sort.cpp | #include<bits/stdc++.h>
using namespace std;
void topo(int node, stack<int> &st, vector<pair<int,int>> adj[], int visited[]) { // Corrected the typo in the parameter name
visited[node] = 1;
for(auto it: adj[node]) {
if(!visited[it.first]) {
topo(it.first, st, adj, visited);
}
... | ALGO | 0.999979 | 5.878386 |
782d9a91-1cf3-4364-a36b-8e841069477d | SonuRajput1010/LeetCode | Searching an element in a sorted array - GFG/searching-an-element-in-a-sorted-array.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
// Function to find element in sorted array
// arr: input array
// N: size of array
// K: element to be searche
int searchInSorted(int arr[], int N, int k)
{
// ... | ALGO | 0.999955 | 5.570803 |
3968ae35-6d50-4ea2-8c3d-32a6e1759a9c | ArcticFoox/autocommit | NGE.cpp | //17298 stack
#include<iostream>
#include<stack>
using namespace std;
stack<int> s;
int a;
int arr[1000001];
int ans[1000001];
int main(){
cin >> a;
for(int i = 0; i < a; i++){
cin >> arr[i];
}
for(int i = a - 1; i >= 0; i--){
while(!s.empty() && s.top() <= arr[i]) s.pop();
... | ALGO | 0.999981 | 3.820977 |
94612627-b82e-4591-8ee6-67039149dd9e | shelltdf/osgall | prebuild/cgal-master/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp | #include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
#include <CGAL/Three/Three.h>
#include <QApplication>
#include <QDockWidget>
#include <QObject>
#include <QAction>
#include <QMainWindow>
#include <Scene_surface_mesh_item.h>
#include <Scene_points_with_normal... | TOOL | 0.923501 | 6.737139 |
342701ec-beb4-4b0d-8bf0-53e0481319e4 | hafizsameed/datascience_website | media/patternPrinting_hU1g5Tg.cpp | #include<iostream>
using namespace std;
int main(){
for(int i=1;i<10;i++){
for(int j=0;j<i;j++){
cout<<"*";
}
cout<<endl;
}
}
| ALGO | 0.999631 | 3.536362 |
7c3d5167-3816-4c22-9b7e-e5caa1abd3c2 | KimmiGYH/LeetCode_Notes_Public | Solutions_0001-1000/0036_Valid Sudoku_有效的数独/cpp_3_数组+位运算.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
vector<int> row(9), col(9), box(9);
for (int i = 0; i < 9; i++)
for (int j = 0; j < 9; j++) {
if (board[i][j] == '.') continue;
... | ALGO | 0.999148 | 5.888731 |
8a67e5c0-e531-4e2d-b99f-d8119ff75eb2 | sasidharan10/Cpp | Leetcode/String/316_remove_duplicate.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
string removeDuplicateLetters(string s)
{
vector<int> lastIndex(26, 0);
vector<bool> seen(26, false);
stack<char> st;
for (int i = 0; i < s.length(); i++)
{
lastIndex[s[i] - 'a'] = i;
... | ALGO | 0.999993 | 6.83708 |
6fd31b19-d2ae-41cd-8584-4976bf5698bd | tyabu12/one-leetcode-a-day | search-in-rotated-sorted-array/1.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
const int n = nums.size();
if (n == 0) return -1;
// [begin, end]
int begin = 0, end = n - 1;
while (begin < end) {
const int mid = (begin + end)/2;
if (nums[mid] > nums[end])
... | ALGO | 0.999973 | 5.982198 |
da424e64-e924-4f33-be98-b6b4f53f6fbc | Simhs/simpleTLD | src/libopentld/tld/EnsembleClassifier.cpp | /*
* EnsembleClassifier.cpp
*
* Created on: Nov 16, 2011
* Author: Georg Nebehay
*/
#include "DetectorCascade.h"
#include <cstdlib>
#include <cmath>
#include <opencv/cv.h>
#include "EnsembleClassifier.h"
using namespace std;
using namespace cv;
namespace tld
{
//TODO: Convert this to a function
#defin... | ALGO | 0.971086 | 5.562009 |
3ad7cd8b-1aaf-45b5-a708-c09f8843befa | kmjp/procon | 2012-2016/2015/goodbye/a.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 ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999813 | 3.692998 |
c768a079-a891-43e2-9a75-d7e2cda08b51 | Andwerpz/Competitive-Programming-Practice | - cpp -/medimize.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef vector... | ALGO | 0.999991 | 4.863301 |
51d7d605-0759-4af0-8e32-77ff5a19edfc | Thohid/omaha | third_party/lzma/v4_65/files/CPP/Common/CommandLineParser.cpp | // CommandLineParser.cpp
#include "StdAfx.h"
#include "CommandLineParser.h"
namespace NCommandLineParser {
void SplitCommandLine(const UString &src, UString &dest1, UString &dest2)
{
dest1.Empty();
dest2.Empty();
bool quoteMode = false;
int i;
for (i = 0; i < src.Length(); i++)
{
wchar_t c = src[i];... | TOOL | 0.930773 | 5.784807 |
c32b3c27-7950-41e3-8dfe-717031bcf90d | KebioH/UVA | C語言一星題/33. Simply Emirp.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
bool isPrime(int n) { //如果兩個因數都大於n,那麼它們的乘積將會大於n //這招超好用
if (n < 2) return false;
if (n == 2) return true;
if (n % 2 == 0) return false; //記得處理偶數
for (int i = 3; i <= (int)sqrt(n); i+=2) { //只檢查奇數
if (n % i == 0) {
return... | ALGO | 0.999901 | 3.602913 |
9d06a8f0-04fc-4269-a4ca-2bd1157f970d | ishandutta2007/codeforces | yamunaku/normal/1349/A.cpp | //
// Created by yamunaku on 2020/05/12.
//
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x... | ALGO | 0.999994 | 5.257208 |
27ba32f0-be31-453e-b03e-b50e0a52843e | aniketpathak028/LeetCode | Smallest number on left - GFG/smallest-number-on-left.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:
vector<int> leftSmaller(int n, int a[]){
vector<int> ans;
stack<int> st;
for(int i=0; i<n; i++){
i... | ALGO | 0.999952 | 5.810822 |
ca1e96b5-bdca-4977-baab-1171efd75586 | Aryan-Kumar-Thakur/GFG-DSA-Submissions | Difficulty: Easy/Split Linked List Alternatingly/split-linked-list-alternatingly.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;
}
};
// } Driver Code Ends
/*
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
next = NULL... | ALGO | 0.999113 | 5.721552 |
c7f0da8f-d8b9-4d11-9ad6-ec9cc8edd7a4 | saxbophone/jagex-launcher | openjdk/hotspot/src/share/vm/compiler/methodLiveness.cpp | // The MethodLiveness class performs a simple liveness analysis on a method
// in order to decide which locals are live (that is, will be used again) at
// a particular bytecode index (bci).
//
// The algorithm goes:
//
// 1. Break the method into a set of basic blocks. For each basic block we
// also keep track of... | ALGO | 0.982443 | 7.754434 |
eee8139b-6a4a-4e97-8c91-2ee04f38e68d | lpetrich/computer_vision_project | dvo_core/src/dense_tracking.cpp | #include <iomanip>
#include <dvo/dense_tracking.h>
#include <dvo/dense_tracking_impl.h>
#include <sophus/se3.hpp>
#include <Eigen/Core>
#include <dvo/core/assert.h>
#include <dvo/core/datatypes.h>
#include <dvo/core/point_selection_predicates.h>
#include <dvo/util/revertable.h>
#include <dvo/util/stopwatch.h>
#incl... | ALGO | 0.994664 | 6.346193 |
0b9d954e-9424-4883-a7f6-aa4958496c71 | ChavaVennela/LeetCode | 1828-queries-on-number-of-points-inside-a-circle/1828-queries-on-number-of-points-inside-a-circle.cpp | class Solution {
public:
vector<int> countPoints(vector<vector<int>>& points, vector<vector<int>>& queries) {
map<pair<int, int>, int>mymap;
int i, j;
vector<int>ans;
for(i=0; i<points.size(); i++){
mymap[{points[i][0], points[i][1]}]++;
}
for(i=0; i<queri... | ALGO | 0.999899 | 5.662489 |
895293fc-fe83-4d08-85e0-9fd7a87dd0f4 | jtlap/nt2 | tools/gather_includes/gather_includes.cpp | #include <filesystem/filesystem.hpp>
#include <boost/assert.hpp>
#include <boost/foreach.hpp>
#include <boost/range/algorithm/count.hpp>
#include <boost/range/algorithm/replace.hpp>
#include <boost/range/size.hpp>
#include <boost/utility.hpp>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#inclu... | TOOL | 0.982285 | 6.645768 |
6b9ef49f-0bd1-49ce-9242-841d99df826b | mstorsjo/platform_frameworks_av | media/libstagefright/codecs/amrnb/common/src/residu.cpp | /*
Pathname: ./audio/gsm-amr/c/src/residu.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template. First attempt at
optimizing code.
Description: Deleted stores listed in the Local Stores Needed/Modified... | ALGO | 0.999938 | 4.224214 |
f1961e3f-1ca3-4691-98bd-8709edf2f8ce | NitichaiSawangsai/BUU-Y1 | 31 = 888144/lab6/ex01.cpp | #include <iostream>
#include <string>
using namespace std;
class TriangleType {
public :
TriangleType();
TriangleType(double b,double a);
double area();
void setBase(double base);
double getBase();
void setAltitude(double altitude);
double getAltitude();
void setValue(double... | ALGO | 0.983953 | 4.035788 |
70bbddf1-d73f-48fa-9c79-4cee79c51623 | ksanu1998/static_analysis_codegen_llms | feedback_pipeline/generations/cpp/files/question-107-pass-1.cpp | #include <iostream>
using namespace std ;
int count ( int arr [ ] , int N , int K ) {
int count = 0 ;
for ( int i = 0 ; i < N ; i++ ) {
if ( arr [ i ] == K )
count++ ;
}
return count ;
}
# Count of Subsets containing only the given value K.
#include <iostream>
using namespace std ;... | ALGO | 0.999448 | 4.785654 |
81f07265-23e4-47d7-82fd-590eba4a542a | girishsuthar229/Leetcode | ugly-number/ugly-number.cpp | class Solution {
public:
bool isUgly(int n) {
if (n <= 0) {
return false; // Ugly numbers are positive integers
}
while (n % 2 == 0) {
n = n/2;
}
while (n % 3 == 0) {
n = n/3;
}
while (n % 5 == 0) {
n = n/5;
... | ALGO | 0.999943 | 6.210071 |
49bf7d8f-d56c-479e-99e3-bd89b0a7982f | hjwdzh/Manifold | 3rd/igl/copyleft/cgal/outer_facet.cpp | #include "outer_facet.h"
#include "outer_element.h"
#include "order_facets_around_edge.h"
#include <algorithm>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
template<
typename DerivedV,
typename DerivedF,
typename DerivedI,
typename IndexType
>
IGL_INLINE void igl::copyleft::cgal::o... | ALGO | 0.994 | 6.414344 |
1c825e1d-216b-432a-98ce-ae39c43f1027 | agral/CompetitiveProgramming | LeetCode/2391_MinimumAmountOfTimeToCollectGarbage/lc2391.cpp | #include <cassert>
#include <string>
#include <vector>
class Solution {
public:
int calc(const std::vector<std::string>& garbage, char garbageType, const std::vector<int> travelSum) {
int furthestLocation = -1; // Note: initial location is always 0.
int totalGarbage = 0;
for (int i = 0; i < garbage.size(... | ALGO | 0.998468 | 6.195815 |
9b42d175-c9e8-4c9a-badd-090bcc31a4f2 | nitmes/C- | Algorithms and data structures/Lesson 4/Task1/main.cpp | #include <iostream>
void print_dynamic_array(int* arr, int logical_size, int actual_size) {
for (int i = 0; i < actual_size; ++i) {
if (i < logical_size) {
std::cout << arr[i] << " ";
}
else {
std::cout << "_ ";
}
}
std::cout << std::endl;
}
int main... | TOOL | 0.950265 | 3.489333 |
a3155cdf-9347-4a13-a3eb-057c31aa7ba9 | Ayush29Ayush/leetcode-gfg-problems | 2090-k-radius-subarray-averages/2090-k-radius-subarray-averages.cpp | /*
MY YOUTUBE VIDEO ON THIS Qn : https://www.youtube.com/watch?v=M_YXCATc4ro
Company Tags : AMAZON
Leetcode Link : https://leetcode.com/problems/k-radius-subarray-averages/
*/
//Approach-1 : Using Sliding Window
class Solution {
public:
vector<int> getAverages(vector<... | ALGO | 0.999953 | 6.522044 |
901204a8-5675-4f11-8727-9862a8c4719d | kmjp/procon | atcoder/abc301-350/abc341/c.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#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))
#define ... | ALGO | 0.999916 | 3.579508 |
fc1e9214-b7a6-4308-ae42-005ee9a735f0 | vogler/dbimpl | 09/db/operators/Sort.cpp | #include "Sort.hpp"
namespace operators {
//Sort::Sort(Operator* input, const std::vector<unsigned int> attributeIds, plan::Sort::Order order) : input(input), attributeIds(attributeIds), order(order) {
// this->input = input;
// this->attributeIds = attributeIds;
// this->order = order;
//}
Sort::~Sort() {
}
} /* ... | TOOL | 0.871992 | 5.190648 |
46535f17-8663-4417-9a01-2b9e2d773efc | EneruJ/maxairain | 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 |
ab0b6ab9-eff7-44ee-8a06-25ab1083464e | brccabral/Cpp_Raylib_Libtorch_AIGames | examples/dino/main.cpp | #include <cstdio>
#include <raylib.h>
#include "DinoGame.h"
#include <mlgames/GenPopulation.h>
#include <mlgames/LinearGen.h>
void draw_dinos(const DinoGame *game, const size_t screen_height)
{
for (auto &dino: game->dinos)
{
DrawTexture(
dino.sprite.textures[dino.sprite.frame_index], ... | ALGO | 0.884688 | 6.530316 |
cbf8d636-1a1b-409c-b4f9-9bb3cfbf6e8a | wizfury/catalog | 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.998693 | 6.797273 |
daab5637-9bce-4a20-aca7-458682a8120c | DeepankRx/LeetCode | 412-fizz-buzz/412-fizz-buzz.cpp | class Solution {
public:
vector<string> fizzBuzz(int n) {
vector<string> ans;
for(int i=1;i<=n;i++)
{
if(i%3==0 && i%5==0)
ans.push_back("FizzBuzz");
else if(i%3==0)
ans.push_back("Fizz");
else if(i%5==0)
ans... | ALGO | 0.999882 | 6.68054 |
2a1cacb2-9e25-4fbb-af83-dfa5cfb74686 | lienordni/ProjectEuler | 83.cpp | #include <iostream>
#include <fstream>
#include "../AVL/avl.h"
#include <vector>
const int size=80;
void fuck() {
std::cout<<"lien"<<std::endl;
}
int numbers[size][size];
struct leaf{
int i;
int j;
int minsum;
bool visited;
std::vector<leaf> neighbours;
void findneighbours();
leaf();
void set(int i, int j... | ALGO | 0.9992 | 3.068326 |
5b486632-d31d-48d0-b097-7cdd4f6eb599 | MSE0612/VampireSurviver2D | Library/PackageCache/com.unity.ide.visualstudio@2.0.22/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.94874 | 6.933585 |
f21f8baa-661f-4bbc-9aeb-ae10448908d4 | kennent/for_scsc_code_save | codeforces/925/f.cpp | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
int t, n, k;
vector<int> v0, v1, pos;
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> t;
while (t--) {
bool check = true;
cin >> n >> k;
v0.clear();
... | ALGO | 0.999943 | 3.983099 |
bcfb81b6-3fa2-499c-9ff0-b2dd28927677 | ScienceLi1125/CQU-Study | 大二下/算法分析与设计/代码/8.动态规划/8.4.凑零钱(逆向dp+滚动数组).cpp | /*凑零钱:
由于原题要求N<=10000,因此原本数组开到dp[10005][105],但数组太大导致溢出(段错误),因此
采用滚动数组解决
(注:去在线编译,VSCode不支持10005*105内存)
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(int a,int b){ //降序排列
return a > b;
}
int main(){
int N,M;
cin>>N>>M;
int coins[10005]={0};
... | ALGO | 1 | 3.95858 |
b9b4418d-0754-4c13-841a-f1c71c36a78b | Keyu-He/Enhancing-Debugging-Skills-of-LLMs-with-Prompt-Engineering | solutions_correct/algorithms/D/Delete Columns to Make Sorted III/Delete Columns to Make Sorted III.cpp | class Solution {
public:
int dp[101][101];
int dfs(vector<string>& strs,int n,int in,int last){ // in = current index, last = closest previous non-deleted index
if(in>=n) return 0;
if(dp[in][last]) return dp[in][last];
bool st = 1;
for(int i = 0; i<strs.size();++i){
... | ALGO | 0.999966 | 5.691866 |
f22df7a2-085b-43b8-a92a-c74f423f638a | hahi79/Practice | IntQueueSample/IntQueue.cpp | //=========================================================
// Intキュー
//==========================================================
#include "IntQueue.h"
#include <stdio.h> // printf()
#include <stdlib.h> // calloc(),free()
IntQueueResult Initialize(IntQueue* q, int max)
{
q->num = q->front = q->rear = 0;
q->que = (i... | TOOL | 0.9854 | 4.687289 |
0123aa53-799b-4234-a112-1a16c0ad581f | Naman-72/External-Sorting | t1.cpp | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int PageSize;
int BufferPages;
class Page
{
private:
public:
vector<int> Data;
Page *next;
bool empty;
Page()
{
next = nullptr;
empty = false;
}
};
class ExternalData
{
private:
public:
vector<Page *> Pag... | ALGO | 0.99959 | 3.827887 |
5eb5850c-b85e-4acb-a27e-5ca4312f0294 | anmoldh121/geeksforgeeks | Graph/dijkstra.cpp | #include <iostream>
#include <climits>
using namespace std;
const int V = 9;
int minDistance(int dist[], bool sptSet[]) {
int min = INT_MAX, minIndex;
for (int v=0; v<V; v++) {
if (sptSet[v] == false && dist[v] <= min)
min = dist[v], minIndex = v;
}
return minIndex;
}
void dij... | ALGO | 0.999966 | 4.503853 |
9e23aa26-b25b-4d54-adae-a41b5d979eda | berdfandrade/c-playground | url_shortener.cpp | #include <iostream>
#include <unordered_map>
#include <random>
#include <string>
class URLShortener
{
private:
std::unordered_map<std::string, std::string> urlMap;
const std::string alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const int shortUrlLength = 6; // Tamanho da URL ... | TOOL | 0.934484 | 5.695782 |
c7d255c4-d27a-46da-8e8a-301a96e42702 | syarale/LeetCode101 | chapter 3/142 环形链表2.cpp | // 1422
// solution: ָ룬Floyd Ȧ
/**
* 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 = h... | ALGO | 0.999982 | 5.67906 |
2e089621-7d83-447f-8535-1063b8ddb4c2 | FedericoMartinC/Obligatorio1 | tads/ListaDeAdyacenciaDir.cpp | #ifndef LISTA_DE_ADYACENCIA_DIR
#define LISTA_DE_ADYACENCIA_DIR
#include <cstring>
#include <string>
#include <iostream>
using namespace std;
struct Lista {
int destino;
Lista* sig;
};
class ListaDeAdyacenciaDir
{
private:
Lista** arr;
int vertices;
public:
ListaDeAdyacenciaDir(int cantV){
... | ALGO | 0.989898 | 4.284929 |
5e4a5722-bd2a-4978-aecc-d8180306b312 | trunghai95/MyCPCodes | Codeforces/609A.cpp | #include <bits/stdc++.h>
using namespace std;
int a[1000], n, m;
bool cmp(const int& x, const int& y) { return x > y; }
int main()
{
ios_base::sync_with_stdio(0);
cin >> n >> m;
for (int i = 1; i <= n; ++i)
{
cin >> a[i];
}
sort(a+1, a+1+n, cmp);
for (int i = 1; i <= n; ++i)
... | ALGO | 0.999962 | 4.587812 |
089b878a-a16a-475a-a1ad-8f3d7273fb15 | diegomarceloledezma/Algor-tmica-I | Tarea/Score.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
while(n--){
int r=0,aux=1;
string x;
cin>>x;
for(int i=0; i< x.length(); i++){
if(x[i]=='O'){
r = r + aux;
aux++;
}
else
... | ALGO | 0.998733 | 4.298478 |
cd4e3598-d3af-45de-885f-166ff0d9c10b | uofs-simlab/ChasteOS | pde/src/solver/SimpleLinearEllipticSolver.cpp | #include "SimpleLinearEllipticSolver.hpp"
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
c_matrix<double, 1*(ELEMENT_DIM+1), 1*(ELEMENT_DIM+1)>SimpleLinearEllipticSolver<ELEMENT_DIM,SPACE_DIM>:: ComputeMatrixTerm(
c_vector<double, ELEMENT_DIM+1>& rPhi,
c_matrix<double, SPACE_DIM, ELEMENT_DIM+1>& rG... | ALGO | 0.999795 | 5.765503 |
71c6c40c-5dc8-465c-93e8-0633265f4930 | BonexGoo/Boss2D | Boss2D/addon/openalpr-2.3.0_for_boss/src/openalpr/motiondetector.cpp | #include "motiondetector.h"
using namespace cv;
namespace alpr
{
MotionDetector::MotionDetector()
{
#if OPENCV_MAJOR_VERSION == 2
pMOG2 = new BackgroundSubtractorMOG2();
#else
// OpenCV 3
pMOG2 = createBackgroundSubtractorMOG2();
#endif
}
MotionDetector::~MotionDetector()
{
}
void MotionDetector::ResetMot... | ALGO | 0.908794 | 5.37546 |
b236ffca-5c95-4037-ba86-d1fa0bbde112 | zZPFei/LearnCPlusPlusPrimer | Chapter5/exe5.14/main.cpp | #include <iostream>
int main() {
std::string cur_string;
std::string pre_string;
std::string max_string;
int max_count = 0;
int cur_count = 0;
while (std::cin >> cur_string) {
if (cur_string == "quit")
break;
if (cur_string == pre_string) {
++cur_count;
if (cur_count > max_coun... | ALGO | 0.999417 | 5.402034 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.