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 |
|---|---|---|---|---|---|---|
0a24500d-2c26-4f76-bad3-943eb65225a5 | ramonblancocaamano/CPP_ADVANCED | MODULE_6_MERGING_STL_ALGORITHMS/question16.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
class Pocket {
int value;
public:
Pocket(int value) : value(value) {}
int getValue() const { return value; }
bool operator<(const Pocket &_Right) const { return value < _Right.value; }
bool operator<(const int &... | ALGO | 0.999697 | 4.326469 |
d5a6478b-6fc6-4474-b726-a03c3ede8796 | 499453466/SingleCore_TC | dep/g3dlite/source/Line.cpp | /**
@file Line.cpp
Line class
@maintainer Morgan McGuire, graphics3d.com
@created 2001-06-02
@edited 2006-01-28
*/
#include "G3D/Line.h"
#include "G3D/Plane.h"
namespace G3D {
Vector3 Line::intersection(const Plane& plane) const {
float d;
Vector3 normal = plane.normal();
plane.getEquat... | TOOL | 0.915341 | 5.643387 |
e5557144-e118-4622-a45f-3f00f07a061d | ishandutta2007/codeforces | rqgao2014/normal/802/L.cpp | #include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define... | ALGO | 0.999962 | 3.728209 |
3b1753e9-c9e1-45d3-a64b-a7eb67eef905 | ishandutta2007/codeforces | pyqe/normal/150/B.cpp | #include <bits/stdc++.h>
using namespace std;
long long n,m,d,dsu[2069],dv=1e9+7;
long long fd(long long x)
{
if(dsu[x]!=x)
{
dsu[x]=fd(dsu[x]);
}
return dsu[x];
}
int main()
{
long long i,j,z=1;
scanf("%lld%lld%lld",&n,&m,&d);
for(i=1;i<=n;i++)
{
dsu[i]=i;
}
for(i=0;i<=n-d;i++)
{
for(j=1;j<d+1-j... | ALGO | 0.999994 | 4.558444 |
dcdece7d-48e6-49af-bd04-e11222a05305 | GueorguiKachan/Proyecto-Hardware | Algoritmia_basica/version.cpp | #include <map>
#include <string.h>
#include <fstream>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
void hallarCambios(string ficheroEntrada, string ficheroSalida){
ifstream t(ficheroEntrada);
stringstream buffer;
buffer << t.rdbuf();
string sEntrada = buffer.str();
ifstream ... | ALGO | 0.998178 | 3.448248 |
a69fc993-d67e-432c-ab7c-1ca76442e4e7 | Leovambarii/Codeforces | Week_8/Day_50/Bus_to_Udayland.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
bool possible = false;
string s;
string arr[n];
for(int i=0; i<n; i++) {
cin >> s;
if(s[0]=='O' && s[1]=='O' && !possible) {
possible = true;
s[0] = '+';
s[1] = '+';
... | ALGO | 0.999773 | 3.962434 |
7e9e0452-2231-4798-a911-d9a8bf19cb95 | protik0939/codeforces_problemset | 800 Ratings/B_Broken_Keyboard.cpp | /*
________________________________________________________________
Md. Sadat Alam Protik
protik0939
***********************
I Keep Craving Craving
You Don't Know it
But
it's True,
Cool Dude.
***********************
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.h... | ALGO | 0.999739 | 4.339101 |
a7b05cef-0ca2-4fab-be1c-c8f13dce840e | itzuditsharma/GFG-Solved | Difficulty: Medium/Minimum Platforms/minimum-platforms.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to find the minimum number of platforms required at the
// railway station such that no train waits.
int findPlatform(vector<int>& arr, vector<int>& dep) {
sort(arr.begi... | ALGO | 0.999927 | 6.063372 |
226b75f9-fcbd-4f83-ba17-b8618183b4c7 | javed2214/Binary-Tree | Inorder-Predecessor.cpp | // Program to Find Inorder Predecessor of any Node in BST
#include<bits/stdc++.h>
using namespace std;
typedef struct node{
int data;
struct node *left;
struct node *right;
}node;
node *createTree(node *root, int n){
if(root==NULL){
root=(node *)malloc(sizeof(node));
root->data=n;
root->left=NULL;
root->... | ALGO | 0.999998 | 4.799434 |
6e3778cc-cd4a-457e-a65c-5294b978c8e8 | pr7prashant/dsa-practice | Array/MedianOf2SortedArrays.cpp | /*
**************** Problem Description ****************
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
The overall run time complexity should be O(log (m+n)).
Example 1 :
Input: nums1 = [1,3], nums2 = [2]
Output: 2.00000
Explanat... | ALGO | 0.999983 | 6.655284 |
75629f0f-d9c1-4668-80c6-134d50843efc | ishandutta2007/codeforces | mustang98/normal/1305/F.cpp | #include <bits/stdc++.h>
#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long ll;
typedef long double ld;
const int max_n = 200111, max_v = 2e6, inf = 1000111222;
ll a[max_n];
int n;
mt19937 gen(228);
vector<ll> lsos[max_n * 2];
bool s... | ALGO | 0.999982 | 3.635288 |
ec49e33a-6333-45ea-99ca-ee409c769f7e | ishandutta2007/codeforces | degwer/normal/626/A.cpp | #include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
int main()
{
int c = 0;
int num;
scanf("%d", &num);
string s;
cin >> s;
for (int i = 0; i < num; i++)
{
for (int j = i; j < num; j++)
{
int a = 0, b = 0;
for (int k = i; k <= j; k++)
{
... | ALGO | 0.999901 | 3.4926 |
d50babde-8fb5-4f3d-bf10-89457dabaeb2 | Mr-Orme/signature.experience.engine | ThirdParty/Box2D-master/Box2D/Dynamics/b2Island.cpp | #include "Box2D/Collision/b2Distance.h"
#include "Box2D/Dynamics/b2Island.h"
#include "Box2D/Dynamics/b2Body.h"
#include "Box2D/Dynamics/b2Fixture.h"
#include "Box2D/Dynamics/b2World.h"
#include "Box2D/Dynamics/Contacts/b2Contact.h"
#include "Box2D/Dynamics/Contacts/b2ContactSolver.h"
#include "Box2D/Dynamics/Joints/b2... | ALGO | 0.999965 | 5.179876 |
a2a88ce1-a316-4003-91ff-2f72f046ce3e | galeswift/BattleBoy | Raknet/DependentExtensions/cat/src/hash/MurmurHash2.cpp | #include <cat/hash/MurmurHash2.hpp>
#include <cat/port/EndianNeutral.hpp>
using namespace cat;
#define mmix(h, k) { k *= M; k ^= k >> R; k *= M; h *= M; h ^= k; }
u32 cat::MurmurHash32(const void *key, int bytes, u32 seed)
{
const u32 M = 0x5bd1e995;
const u32 R = 24;
// Mix 4 bytes at a time into the ha... | ALGO | 0.981302 | 7.403512 |
e0511e0c-55ac-4d00-a216-15d02206472e | Payalkumari25/PlacementClasses | Question on DS/Kids with greater number of candies.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a[] = {2, 3, 5, 1, 3};
int n = sizeof(a) / sizeof(a[0]);
int extra = 3;
int max = a[0];
for (int i = 1; i < n; i++)
{
if (a[i] > max)
{
max = a[i];
}
}
for (int i = 0... | ALGO | 0.999733 | 3.463713 |
c4504021-8293-4ebd-943e-92333cfe8cf0 | ishandutta2007/codeforces | teapotd/normal/1472/E.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#ifdef LOC
#include "debuglib.h"
#else
#define deb(...)
#define DBP(...)
#endif
using namespace std;
using ll = long long;
using Vi = vector<int>;
using Pii = pair<int, int>;
#define pb push_back
#define mp make_pair
#de... | ALGO | 0.99999 | 4.288873 |
f397dc73-0586-448f-8df6-16a477ed17ce | aditya-mad/codechef-solutions | Solutions/DOTIFYPLAY.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
int main()
{
int test;
cin >> test;
for (; test--;)
{
vector<int> memo;
int maxs, lan, num;
cin >> maxs >> num >> lan;
for (int i = 0; i < maxs; i++)
{
... | ALGO | 0.998799 | 3.348711 |
52bf4f5b-e6ea-4dad-b2a6-d200b64aef9c | pavanm555/Data-Structures-Algorithms | 19_Hashing/hash_table_test.cpp | #include<iostream>
#include "hash_table.h"
using namespace std;
int main(){
Hashtable<int> h;
h.insert("Mango", 100);
h.insert("Apple", 120);
h.insert("Banana", 140);
h.insert("Orange", 200);
h.insert("Kiwi", 210);
h.insert("Papaya", 220);
h.insert("Litchi", 300);
h.print();
s... | TOOL | 0.953397 | 4.956662 |
206a57c0-47a3-4bbd-80f9-9263c4a141ba | Haruka4141/leetcode | 34.Find_First_and_Last_Position_of_Element_in_Sorted_Array.cpp | #include <vector>
#include <unordered_map>
using namespace std;
//https://stackoverflow.com/questions/68006440/find-first-and-last-position-of-element-in-sorted-array
vector<int> searchRange(vector<int>& nums, int target)
{
if (nums.size() == 1 && target == nums[0])
return { 0, 0 };
unordered_map<in... | ALGO | 0.999878 | 5.749938 |
d29e4b62-e17a-4c02-97d1-c988f1cf3793 | raincross7/code-similarity | codes/train_code/problem199/problem199_325.cpp | #include "bits/stdc++.h"
#include "math.h"
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) ... | ALGO | 0.999801 | 3.33834 |
31b4653e-0f60-4e7d-892b-5ee7c053b098 | artdevar/ProgrammingGameAIByExample | Common/boost_1_50_0/libs/geometry/example/07_a_graph_route_example.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
#include <iostream>
#include <fstream>
#include <iomanip>
#include <limits>
#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/geometry/geomet... | ALGO | 0.99852 | 5.98502 |
3d86370a-6389-4f4a-8f2f-98f20ccd1c3f | AIFanatic/three-nanite | src/meshoptimizer/src/quantization.cpp | #include <assert.h>
union FloatBits
{
float f;
unsigned int ui;
};
unsigned short meshopt_quantizeHalf(float v)
{
FloatBits u = {v};
unsigned int ui = u.ui;
int s = (ui >> 16) & 0x8000;
int em = ui & 0x7fffffff;
// bias exponent and round to nearest; 112 is relative exponent bias (127-15)
int h = (em - (112... | ALGO | 0.996249 | 6.197101 |
f1cbab18-7375-46d6-8df6-d57c33b3d790 | makio93/competitive-atcoder | arc148/arc148_a/main0.cpp | // 本番AC
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i, n) for (int i=0; i<(int)(n); ++(i))
#define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i))
#define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i))
#define rep3r(i, m, n) for... | ALGO | 0.999987 | 4.246323 |
4241613d-d442-4e64-a2f9-83e2f9d0ff9f | mahadi-zulfiker/DS-Exam | Duplicate.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> v;
for(int i = 0; i < N; i++){
int value;
cin >> value;
if(find(v.begin(), v.end(), value) != v.end()){
cout << "YES" << endl;
return 0;
}
v.push_back(va... | ALGO | 0.999969 | 4.086214 |
08a85d3b-f047-4efd-aaae-8dd368e4cea4 | melROLL/Bee_Slic3r | src/libigl/igl/isolines.cpp | #include "isolines.h"
#include <vector>
#include <array>
#include <iostream>
#include "remove_duplicate_vertices.h"
template <typename DerivedV,
typename DerivedF,
typename DerivedZ,
typename DerivedIsoV,
typename DerivedIsoE>
IGL_INLINE void igl::isolines(
const Eigen::MatrixBase<Deriv... | ALGO | 0.905721 | 5.900014 |
f4994cc4-86f4-4404-8c05-f53629bb57af | rpzhu/sa | src/3rdParty/qwt/src/qwt_raster_data.cpp | #include "qwt_raster_data.h"
#include "qwt_point_3d.h"
#include <qnumeric.h>
class QwtRasterData::ContourPlane
{
public:
inline ContourPlane( double z ):
d_z( z )
{
}
inline bool intersect( const QwtPoint3D vertex[3],
QPointF line[2], bool ignoreOnPlane ) const;
inline double z() ... | ALGO | 0.955333 | 6.683759 |
c2ce7604-84a3-4f10-90ac-d789f50c204c | ljmf00/lldb-d | clang/lib/Driver/SanitizerArgs.cpp | using namespace clang;
using namespace clang::driver;
using namespace llvm::opt;
static const SanitizerMask NeedsUbsanRt =
SanitizerKind::Undefined | SanitizerKind::Integer |
SanitizerKind::ImplicitConversion | SanitizerKind::Nullability |
SanitizerKind::CFI | SanitizerKind::FloatDivideByZero |
Sanitiz... | TOOL | 0.856215 | 7.704978 |
61d57de4-321f-4546-ad4d-16ba8a43c398 | lucelujiaming/mySoxTest | RaytraceGroundUp/Chapter29.6_linux_module/Samplers/Hammersley.cpp | #include "Hammersley.h"
#include "Maths.h"
// ---------------------------------------------------------------- default constructor
Hammersley::Hammersley(void)
: Sampler()
{}
// ---------------------------------------------------------------- constructor
Hammersley::Hammersley(const int num)
: Sampl... | ALGO | 0.88102 | 4.35985 |
2949b0f2-1f4b-4af4-a4ec-a97aeb5e3f22 | carrot729/Etiger | 1796. 最大子段和.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+9;
ll n,x[N];
ll dp[N];
int main(){
// freopen("subsequence.in","r",stdin);
// freopen("subsequence.out","w",stdout);
cin>>n;
for(int i=0;i<n;i++) cin>>x[i];
dp[0]=x[0];
for(int i=1;i<n;i++){
dp[i]=max(x[i],dp[i-1]+x[i]);
}
print... | ALGO | 0.999772 | 3.373274 |
8fafb377-7560-4b33-ac04-86ffab7d83c3 | BrowserWorks/waterfox | layout/painting/DashedCornerFinder.cpp | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
#include "DashedCornerFinder.h"
#include <utility>
#include "BorderCache.h"
#include "BorderConsts.h"
#include "nsTHashMap.h"
namespace mozilla {
using namespace gfx;
struct BestDashLength {
... | ALGO | 0.984085 | 7.568345 |
3b8ab573-aa7c-4760-b249-f1d3b420f394 | TyDunn/hacker-rank-daily-challenge | HackerRank/Data Structures/Linked Lists/insert-a-node-into-a-sorted-doubly-linked-list.cpp | // Inserting a Node Into a Sorted Doubly Linked List
// Day #135
// Wednesday, October 11, 2017
// https://www.hackerrank.com/challenges/insert-a-node-into-a-sorted-doubly-linked-list
/*
Insert Node in a doubly sorted linked list
After each insertion, the list should be sorted
Node is defined as
struct ... | ALGO | 0.999926 | 5.290355 |
23864206-3249-430e-ae9f-454862b909ac | sidjha57/Coding-Data-Transfer | Competitive/C++/CSES/DP/Minimizing_Coins.cpp | //template
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//typedef trie<strin... | ALGO | 0.999987 | 4.232509 |
26f09e89-507c-4174-a01f-33a69f9fd7a3 | Maha-2006/Leetcode_solutions | 2237-longest-palindrome-by-concatenating-two-letter-words/2237-longest-palindrome-by-concatenating-two-letter-words.cpp | class Solution {
public:
int longestPalindrome(vector<string>& words) {
unordered_map<string, int> mp;
int result = 0;
for(string &word : words){
string reversedWord = word;
swap(reversedWord[0], reversedWord[1]);
if(mp[reversedWord]>0){
result += 4;
... | ALGO | 0.999971 | 5.810534 |
190203e1-2a80-4f3b-b939-f58b4ebdba6a | rmEleven/Algorithm | level1/DataStructure/Queue.cpp | #include <iostream>
using namespace std;
const int N = 1e5 + 10;
int n;
int q[N];
int head, tail = -1;
int main()
{
cin >> n;
while (n--)
{
string op;
int x;
cin >> op;
if (op == "push")
{
cin >> x;
q[++tail] = x;
}
else i... | ALGO | 0.990157 | 4.455839 |
657fc7c6-1eae-4452-b506-999cee5cb8f4 | AnimismFudan/Animism | 2016-10-26-2016-2017 ACM-ICPC NEERC Southern Subregional Contest/A/A.cpp | #include <bits/stdc++.h>
using namespace std;
const int MaxN = 107;
const int MaxM = (int)1e4 + 7;
struct nodetype
{
int id,dt;
};
int n,m,r[MaxN],ans,p[MaxM][3];
priority_queue<nodetype, vector<nodetype>, less<nodetype> > mq;
bool operator<(nodetype A, nodetype B)
{
return (A.dt < B.dt);
}
bool Check (int d)
{
... | ALGO | 0.999971 | 3.102166 |
1f67b56b-45ae-467c-8038-b7363ee07529 | alexandraback/datacollection | solutions_5753053697277952_0/C++/Esy/a.cpp | #include <iostream>
#include <vector>
using namespace std;
typedef struct
{
int n;
char c;
} party;
void single(vector<party> &v)
{
int max=0;
for(int i=0; i<v.size(); i++)
{
if(v[i].n>v[max].n)
{
max = i;
}
}
cout<< v[max].c << " ";
v[max].n--;
... | ALGO | 0.999715 | 3.961754 |
382add41-6c7e-4ec6-9f3d-8ae1619dc765 | Ankushpanday1/Leetcode-Daily-Questions | 1656-count-good-triplets/count-good-triplets.cpp | class Solution {
public:
int countGoodTriplets(vector<int>& arr, int a, int b, int c) {
int n=arr.size();
int ans=0;
vector<int>sum(1001,0);
for(int j=0;j<n;j++){
for(int k=j+1;k<n;k++){
if(abs(arr[j]-arr[k])<=b){
int lj=arr[j]-a,rj=arr[j]+a;
... | ALGO | 0.999521 | 5.362482 |
0accabe8-41ab-4012-b16d-f8a21bf40ce4 | ankan-hazra-roni/Problem_Solving_ | Sum of nodes on the longest path from root to leaf node - GFG/sum-of-nodes-on-the-longest-path-from-root-to-leaf-node.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
Node(int x)
{
data = x;
left = NULL;
right = NULL;
}
};
void printInorder(Node *node)
{
if (node == NULL)... | ALGO | 0.999619 | 6.984545 |
2492ceb2-83af-41ff-b853-9ac324298629 | ishandutta2007/codeforces | ehnryx/normal/917/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<ld> pt;
typedef vector<pt> pol;
#define nl '\n'
inline void srand() { srand(clock() + time(nullptr)); }
template <class T, class U>
ostream& operator << (os... | ALGO | 0.999864 | 4.805762 |
2d1bd9ff-249a-4548-9bce-71079db2802a | ishandutta2007/codeforces | bohdanpastuschak/normal/146/A.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <cma... | ALGO | 0.999938 | 3.92616 |
1626a5f6-d330-4579-bd4b-c30c1fc35517 | xfu2006/zkregex | code/zkregex/jsnark/libsnark/depends/xbyak/sample/toyvm.cpp | /*
toy vm
register A, B : 32bit
PC : program counter
mem_ 4byte x 65536
٤Ƥ̿4byte
¨ͤ16bit
R = A or B
vldiR, imm ; R = imm
vldR, idx ; R = mem_[idx]
vstR, idx ; mem_[idx] = R
vaddiR, imm ; R += imm
vsubiR, imm ; R -= imm
vaddR, idx ; R += mem_[idx]
vsubR, idx ; R -= mem_[idx]
vputR ; print... | TOOL | 0.979986 | 6.708421 |
5bd1b5e7-44ed-41d7-9e36-2d616819d8a4 | Edward-Q/minimum-volume-enclosing-ellipsoid | LegacyCode/Legacy.cpp | /*
* Legacy.cpp
* LinAlg
*
* Created by Spyros Schismenos on 30/06/2012.
*
*/
#include "Legacy.h"
void initDiag(const gsl_vector* u, gsl_matrix* U) {}
/*
{
int i; size_t n = u->size;
for (i=0; i<n; i++) {
gsl_matrix_set(U,i,i,gsl_vector_get(u,i));
}
}
*/
void getSubMatrixFromColumnsAndRows(const gsl_ma... | ALGO | 0.996902 | 5.605271 |
0d2109e5-40b4-4904-909a-bb351ceed7ad | NilayBadjatya/Interview_DS_Algo | Graph/Find the Maximum Sum of Node Values.cpp | class Solution {
public:
long long maximumValueSum(vector<int>& nums, int k, vector<vector<int>>& edges) {
int n = nums.size();
vector<int> delta(n);
for(int i = 0; i < n; i++){
delta[i] = (nums[i] ^ k) - nums[i]; // storing the differences in the value of each node after perform... | ALGO | 0.999991 | 5.537707 |
7b584546-9829-429e-a190-4309e15abc4f | SeokJinB/3D-CAPTCHA | SWProject/src/pmp/algorithms/curvature.cpp | #include "pmp/algorithms/curvature.h"
#include "pmp/exceptions.h"
#include "pmp/algorithms/normals.h"
#include "pmp/algorithms/differential_geometry.h"
#include "pmp/algorithms/laplace.h"
namespace pmp {
class CurvatureAnalyzer
{
public:
//! construct with mesh to be analyzed
CurvatureAnalyzer(SurfaceMesh& me... | ALGO | 0.998843 | 7.197154 |
e4807077-cbc5-46ea-9ee6-9e3a0900e436 | akshitasrivastava29/45-Days-Plan | 637-average-of-levels-in-binary-tree/637-average-of-levels-in-binary-tree.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.99994 | 6.702568 |
50bb1929-2a2d-4629-ba08-3d7a89a172d4 | ANISHAGHOSHAL/Leetcode-solution | Number Formation - GFG/number-formation.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
const int mod=1e9+7;
public:
int getSum(int X, int Y, int Z) {
long long exactsum[X+1][Y+1][Z+1],exactnum[X+1][Y+1][Z+1];
for (int i = 0; i <... | ALGO | 0.999957 | 5.831952 |
9872bb34-ca4b-4494-8791-7919586faddb | hang245141253/HZOJ | C++11/535.cpp | #include <iostream>
using namespace std;
int h, w, sx, sy, ans = 1;
char map[55][55];
int dir[4][2] = {
0, 1,
1, 0,
0, -1,
-1, 0
};
void dfs(int x0, int y0) {
for (int i = 0; i < 4; i++) {
int x = dir[i][0] + x0;
int y = dir[i][1] + y0;
// if (x < 0 || y < 0 || x > w || y ... | ALGO | 0.999902 | 3.94923 |
0fac66a6-1c07-4f76-a85c-d38673688b8e | gladwinK/Disk-Scheduling | main.cpp | // #include <iostream>
// #include <vector>
// #include <string>
// #include <sstream>
// #include <cmath>
// #include <algorithm>
#include <iomanip>
// #include <limits>
#include "./Headers/DiskScheduling.h"
#include "./Headers/QueueGeneration.h"
#include "./Headers/InputOutput.h"
int main()
{
int startHead;
... | ALGO | 0.999176 | 5.949029 |
3871e0b3-06ac-4fb2-96b4-148d284bf3b3 | acdiorr/ApeEscape- | SuperSpecialAwesomeMonkeyZombieSim/Monkkers/SpriteLib3.0-v2.0/Matrix.cpp | #include "Matrix.h"
mat2::mat2(vec2 _row1, vec2 _row2)
{
//Sets row1 and row2
row1 = _row1;
row2 = _row2;
}
void mat2::Add(mat2 m)
{
//Adds the passed parameter to THIS matrix
this->row1 = this->row1 + m.row1;
this->row2 = this->row2 + m.row2;
}
void mat2::Subtract(mat2 m)
{
//Subtracts the passed parameter f... | TOOL | 0.955716 | 5.668957 |
71d433cd-d337-41ca-b01f-a953d35cc538 | acio-olympiad/2023Contest2 | crop/solutions/evan-sub3.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int n,q,k;
int val[100005];
int dp[100005][55][2]; // dp[a][b][c] = Best solution using cells up to a, where cells up to a use the bth (or less) crop. If c=0, the cell a is not included, otherwise the cell a is included.
int ans[55];
s... | ALGO | 0.999986 | 4.160264 |
beadf6ed-8377-4cf2-8c2b-fff2df6c79fe | FPSG-UIUC/Pandora | simulator/src/systemc/tests/systemc/misc/examples/datawidth_int_file/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.930391 | 5.296662 |
a9156a46-bf59-482e-8b8d-ec47fb55d42f | George-Creekbed/Cplusplus_Crash_Course | chapter_9/exercise_9_1.cpp | #include <cstdio>
template<typename T> struct CountOver200 {
size_t operator()(const T* input, size_t length) const {
size_t counter{};
for (auto i = 0; i < length; ++i)
input[i] > 200 ? ++counter : 0;
return counter;
}
};
template<typename Fn, typename In, typename Out>
constexpr Out fold(Fn... | TOOL | 0.980454 | 5.290222 |
496ce80d-7013-4768-90b3-a6644cc21600 | algorithm006-class02/algorithm006-class02 | Week_02/G20200343030462/LeetCode_590_462.cpp | class Solution {
public:
vector<int> postorder(Node* root) {
std::vector<int> vecRet;
postorder(root,vecRet);
return vecRet;
}
private:
//后序遍历的话就是逻辑上按照从左到右的次序依次访问当前结点的所有孩子结点,最后访问当前结点
void postorder(const Node *pCurrNode,std::vector<int> &vecRet)
{
if(nullptr == pCurrN... | ALGO | 0.999966 | 5.799275 |
66333a0f-460d-4ee2-ad14-f1f43c5d799e | WangYaohuii/CXL-SSD-Sim | src/systemc/tests/systemc/misc/user_guide/chpt3.1/fsmr.cpp | /*****************************************************************************
fsmr.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | ALGO | 0.998477 | 4.889946 |
3a7e7966-09b6-4362-8102-de17fd94e382 | Junaid7200/University-Labs | Data Structures/Heaps/.history/MaxHeap_Array_20240517200359.cpp | #include <iostream>
using namespace std;
class MaxHeap {
private:
int *heap; // dynamic array
int capacity; // the max amount of elements we can insert into the heap
int currentSize; // the current number of elements in the heap currently
void heapifyUp(int index) {
while (index > 0) {
... | ALGO | 0.998391 | 5.873735 |
825aabff-e496-47f2-8321-7cf7f4f7b5d0 | chenbei97/myLeetCode | STLTestCode/algorithms/source/search.cpp | /***
* @Author: chenbei
* @Date: 2022-04-19 13:27:27
* @LastEditTime: 2022-04-19 16:51:16
* @Description: test search.cpp
* @FilePath: \myLeetCode\STLTestCode\algorithms\source\search.cpp
* @Signature: A boy without dreams
*/
/*
g++ -o search search.cpp
.\search.exe
*/
#include <algorithm>
#include <iostream>
... | ALGO | 0.999815 | 4.307668 |
fdcbff88-8fa2-4079-83c0-c7c2d71653e1 | GomHyeok/Algorithm_Study | BOJ코드/10836_2.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstring>
using namespace std;
int m, n;
vector<vector<int>> board(700, vector<int>(700, 1));
int larva[1401];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>m>>n;
... | ALGO | 0.999617 | 3.07501 |
e18473cf-a5ac-41f3-a395-ab421dd543b5 | Lec6Cel/CuongLeHuy | onthigiuaky.cpp | #include <iostream>
#include <conio.h>
using namespace std;
struct node
{
int data;
node* link;
};
class linkedlist {
private:
node* first;
node* last;
public:
void init()
{
first = NULL;
last = NULL;
}
node* CreateNode(int x) {
node* p = new node;
if (p == NULL)
exit(1);
p->data = x;
p->link = N... | ALGO | 0.999934 | 4.121233 |
982a8802-c20d-4a1a-adb2-7e554e71729e | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3897_7.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 4000000;
bool in[N + 1], flag[N + 1];
long long a[N + 1];
int L[N + 1], R[N + 1];
pair<long long, int> vp[N];
int ri() {
int x;
scanf("%d", &x);
return x;
}
long long rll() {
long long x;
scanf("%I64d", &x);
return x;
}
int main() {
int n = ri(),... | ALGO | 0.999994 | 3.906135 |
77a0e883-75cc-4c50-b33b-093e8b188a80 | cgwu1999/c-- | template/数学/组合/subset.cpp | #include<iostream>
using namespace std;
void subset(int k, int n)
{
//枚举2^n以内的所有1个数为k个的数字
int t = (1 << k) - 1;
while (t < 1 << n) {
cout<<t<<endl;
int x = t & -t, y = t + x;
t = ((t & ~y) / x >> 1) | y;
}
} | ALGO | 0.999869 | 3.387801 |
68efed32-7afb-4627-8caf-c684b4b8f7ad | Nojgaard/DoubleTrace | src/canon/emb_brute.cpp | #include <dtrace/canon/emb_brute.h>
#include <dtrace/util.h>
namespace dtrace {
namespace canon {
EmbBrute::EmbBrute( const std::vector<std::vector<Vertex>>& emb
, const std::vector<morphism::Perm>& auts) {
for (auto& f : emb) {
std::vector<Vertex> min_face = f;
min_expr(min_face);
canon.push_ba... | ALGO | 0.999269 | 7.159457 |
0c67c8d3-49e5-47b5-a723-5f808ae107ae | sghiassy/Code-Reading-Book | OpenCL/src/cscipher.cpp | /*************************************************
* CS-Cipher Source File *
* (C) 1999-2001 The OpenCL Project *
*************************************************/
#include <opencl/cscipher.h>
namespace OpenCL {
/*************************************************
* CS-Cipher En... | ALGO | 0.995284 | 4.087451 |
6d9df3e0-1608-4528-beaa-bc65d6b3f881 | ismaelkdev/dotfiles | polybar/src/components/config.cpp | #include <climits>
#include <fstream>
#include "cairo/utils.hpp"
#include "components/config.hpp"
#include "utils/color.hpp"
#include "utils/env.hpp"
#include "utils/factory.hpp"
#include "utils/file.hpp"
#include "utils/math.hpp"
#include "utils/string.hpp"
POLYBAR_NS
/**
* Create instance
*/
config::make_type co... | CONFIG | 0.935856 | 6.859358 |
2f8c04e5-e1b5-4515-a17a-225d0c9adbd2 | ishandutta2007/codeforces | hydro-bot1/normal/22/A.cpp | // Hydro submission #62cd072de4874952a0849921@1657603885794
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
static vector<int> ivec;
int main() {
int n;
scanf("%d", &n);
ivec.resize(n);
for (int i = 0; i < n; i++) scanf("%d", &ivec[i]);
sort(ivec.begin(), ivec.end());
... | ALGO | 0.999854 | 3.713365 |
c10cf526-4aef-44a4-afaa-a507646cbccd | Drchamyoung/Mathematical-programming-For-Students | 0167-two-sum-ii-input-array-is-sorted/0167-two-sum-ii-input-array-is-sorted.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& numbers, int target) {
int l = 0;
int r = numbers.size() - 1;
while (numbers[l] + numbers[r] != target)
if (numbers[l] + numbers[r] < target)
++l;
else
--r;
return {l + 1, r + 1};
}
}; | ALGO | 0.999464 | 6.851129 |
e2b75e7f-721f-40fd-967b-c01866f2827a | FangYang970206/Accelerated-CPP | chapter7/ex7_8.cpp | #include <algorithm>
#include <map>
#include <iostream>
#include "url.h"
using namespace std;
map<string, vector<int> > xref_pro(istream& in)
{
string line;
int line_number = 0;
map<string, vector<int> > ret;
while(getline(in, line)){
++line_number;
vector<string> words = find_urls(l... | TOOL | 0.964637 | 4.008507 |
de162e65-0c51-45d0-aef6-a9f089069690 | abhi-sama/Solved-Coding-Questions | Codes in C++/Binary Tree/Maximum Path Sum in Binary Tree.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.999957 | 6.327649 |
d114b16b-5add-422a-80a0-4aa2edd152b7 | 7oSkaaa/LeetCode_DailyChallenge_2023 | 04- April/15- Maximum Value of K Coins From Piles/15- Maximum Value of K Coins From Piles (Omar Sanad).cpp | // author : Omar Sanad
class Solution {
public:
vector < vector <int> > pref, dp;
int rec(int RowIdx, int k) {
// (Base Case) if we reached the end of rows
if (RowIdx == pref.size()) return 0;
// dp step
int &ret = dp[RowIdx][k];
if (~ret) return ret;
... | ALGO | 0.999933 | 5.594085 |
f0f09c11-f980-469f-86d9-54a74ce526fd | srsaif18/Algorithm-CP-DIU | Assignment/IntLinearSearch.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, flag = 0;
cout << "How many elements : ";
cin >> n;
int A[n];
cout << "Input array elements : ";
for(int i = 0; i < n; i++) {
cin >> A[i];
}
int x;
cout << "Input element to br searched : ";
cin >>... | ALGO | 0.998476 | 5.076268 |
c6be0132-1ab2-4481-800d-6b73b0484d3d | SiddiqueSahb/DSASeries | DSA Series/DS/Search & Sort/sqrUsingBS.cpp | #include <iostream>
#include<math.h>
#include <vector>
using namespace std;
//for Integer part of square root
int squareRoot(int n){
int s = 0;
int e = n;
int mid = (s+e)/2;
int ans = -1;
while(s<=e){
int square = mid * mid;
if(square == n){
return mid;
}
... | ALGO | 0.99981 | 3.74157 |
dcdabed0-491d-4077-983a-0562dc7c1827 | Nishchaybhuker20/50daysofcode | 03-09-23__Unique_Paths.cpp | class Solution {
public:
int uniquePaths(int m, int n) {
vector<vector<int>> dp(m, vector<int>(n, 0));
for (int i = 0; i < m; ++i) {
dp[i][0] = 1;
}
for (int j = 0; j < n; ++j) {
dp[0][j] = 1;
}
for (int i = 1; i < m; ++i) {
... | ALGO | 0.999876 | 6.691005 |
a732a95f-1498-4f12-b223-3ef1f6f1b9d1 | FluoressEnt/VulkanRenderer | dependencies/glm-0.9.9.5/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <stdio.h>
#include <stdlib.h> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if (static_cast<unsigned>(n) > 63) {printf("rotat... | ALGO | 0.998877 | 4.645582 |
9747909e-d39e-47a7-8fce-d70c10eb85e2 | darchr/parsec-benchmark | pkgs/apps/facesim/src/Public_Library/Arrays/ARRAY_PARALLEL_OPERATIONS.cpp | using namespace PhysBAM;
//#####################################################################
// Function Array_Parallel_Operations_Helper
//#####################################################################
template<class T, class TS, class TV> void ARRAY_PARALLEL_OPERATIONS<T, TS, TV>::
Array_Parallel_Operation... | ALGO | 0.979873 | 5.985491 |
8dc1f2e2-029f-4138-a5ef-25765066d8d0 | mikolodz/gtsam-4.0.2 | gtsam/3rdparty/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Eigen::MatrixXf m(2,2);
m << 1, 2,
3, 4;
//get location of maximum
MatrixXf::Index maxRow, maxCol;
float max = m.maxCoeff(&maxRow, &maxCol);
//get location of minimum
MatrixXf::Index minRow, m... | ALGO | 0.999774 | 4.010038 |
aaf3aad4-4c84-4f48-8f8c-63c180d92ba4 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_542_1.cpp | #include <bits/stdc++.h>
using namespace std;
int n, q, le, ri, a[200100];
int max3[200100], max4[200100];
int ans3[200100][4], ans4[200100][5];
int st1[200100], st2[200100];
int cnt[200100];
int poi1, poi2, r1, r2, s1, s2;
int uu, vv;
set<int> s;
bool com1(int x, int y) { return a[x] < a[y]; }
bool com2(int x, int y) ... | ALGO | 0.999972 | 3.847266 |
f6fc4c1b-0d7f-4491-9807-a154d2f63dcc | theayushkaul/Data-Structures-and-Algorithms | Queues/queueintro.cpp | #include<bits/stdc++.h>
using namespace std;
queue<int> reverse(queue<int> &q)
{
if(q.empty()){
return q;
}
int n=q.front();
q.pop();
reverse(q);
q.push(n);
return q;
}
void printq(queue<int> q){
int n=q.size();
for(int i=0;i<n;i++){
cout<<q.fro... | ALGO | 0.998232 | 4.71187 |
6edb20cf-ee7f-4531-9b18-0b28ee46c336 | JohnReid/STEME | c++/FAST/fft.cpp | #include <math.h>
#include <stdlib.h>
#include "fft.h"
#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr
//
// See fft.h for comments
//
void
fft(
double data[], unsigned long nn, int isign ) {
unsigned long n, mmax, m, j, istep, i;
double wtemp, wr, wpr, wpi, wi, theta;
double tempr, tempi;
n = nn ... | ALGO | 0.999989 | 5.741385 |
5475f193-89e9-4800-b878-9a8c98474605 | randbatch-md/lammps-rbe | src/compute_slice.cpp | // clang-format off
#include "compute_slice.h"
#include "arg_info.h"
#include "error.h"
#include "fix.h"
#include "input.h"
#include "memory.h"
#include "modify.h"
#include "update.h"
#include "variable.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
Compu... | TOOL | 0.960491 | 6.319184 |
5cace0af-f38d-42af-9ac3-2c72333e4fad | pathammer/ktouch | nestk/deps/opencv/modules/legacy/src/morphing.cpp | #include "precomp.hpp"
#include <assert.h>
static CvStatus
icvMorphEpilines8uC3( uchar * first_pix, /* raster epiline from image 1 */
uchar * second_pix, /* raster epiline from image 2 */
uchar * dst_pix, /* raster epiline from dest image */
... | ALGO | 0.99753 | 5.16989 |
0a6c2783-f8fc-4949-b1f5-a082e2ab1327 | Husainbw786/LeetCode | Cyclically rotate an array by one - GFG/cyclically-rotate-an-array-by-one.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
void rotate(int arr[], int n);
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
int a[n] , i;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
rotat... | ALGO | 0.999733 | 4.999506 |
979f22a0-7fd2-4e6b-bb2f-17cbd4349406 | ntanthedev/Cpp | mrs.Minh/de hsg/de3/Bai3_10_2015_2016.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
const long long R = 1e9+7;
const long long N = 1e6+9;
ll n;
void sub1()
{
ll s = 0;
for(int i = 1; i <= n; i++){
s += i*i;
}
cout<<s;
}
void sub2()
{
ll t1, t2;
t1 = ((n+1)*n)/2;
t2 ... | ALGO | 0.999634 | 4.255445 |
4bda8e01-1feb-4bc3-b6a0-31b35a8473c0 | sangsthita/DAA_lab | week_11/2.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,amt;
cin>>n;
int i,j,a[n];
for(i=0;i<n;i++)
cin>>a[i];
cin>>amt;
int ans[amt+1];
for(i=1;i<=amt;i++)
ans[i]=0;
ans[0]=1;
for(j=0;j<n;j++)
{
for(i=1;i<=amt;i++)
{
if(a[j]<... | ALGO | 0.999849 | 3.177345 |
7282d2d5-48ee-4b53-891f-a06b1899ba81 | urdarinda/coding | cf/A/349A.cpp | #include<bits/stdc++.h>
using namespace std;
#define gc getchar
#define sci scanint
#define scli scanlong
#define FL(i,a,b) for(int i=a;i<b;++i)
#define MOD 1000000007
#define lli long long int
#define pb push_back
#define nline printf("\n");
#define mk make_pair
void sci(int &x)
{
register int c = gc();
x =... | ALGO | 0.999674 | 3.480515 |
d34533f4-7056-4a13-a308-94e32be14073 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/july/ChefAndDragonDens_20200712150514.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<unordered_map>
#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 ... | ALGO | 0.999927 | 4.19323 |
0e3638c1-bb2e-4a00-91a3-c2e640f515b2 | devraj2018/Programming_Pathshala | Graph/36)-Rate_In_A_Maze.cpp | class Solution{
public:
int dx[4]={-1,1,0,0};
int dy[4]={0,0,1,-1};
char dir[4]={'U','D','R','L'};
void dfs(int x,int y,vector<vector<int>> &m, int n,string curr_path,vector<string>&res)
{
if(x==n-1 && y==n-1)
{
res.push_back(cu... | ALGO | 0.999977 | 5.659705 |
5471cca5-f1c5-4fda-b398-df2af53698fe | JesusYou/DesignPatternDemo | DesignPatternDemo/StrategyPattern/Strategy/MultiplyStrategy.cpp | //
// MultiplyStrategy.cpp
// DesignPatternDemo
//
// Created by RedInfinity on 2022/10/28.
//
#include "MultiplyStrategy.hpp"
namespace strategy_pattern {
MultiplyStrategy* MultiplyStrategy::create()
{
MultiplyStrategy* ret = new MultiplyStrategy();
return ret;
}
int MultiplyStrategy::doWork(int firstNum... | TOOL | 0.951639 | 3.894781 |
d1212f15-fb3b-4021-8cb0-2756e394dd59 | FabienPean/VegaFEM | libraries/sparseSolver/CGSolver.cpp | #include <cmath>
#include <cstdlib>
#include <cstdio>
#include "CGSolver.h"
namespace vegafem
{
CGSolver::CGSolver(SparseMatrix * A_): A(A_)
{
numRows = A->GetNumRows();
InitBuffers();
multiplicator = CGSolver::DefaultMultiplicator;
multiplicatorData = (void*)A;
invDiagonal = NULL;
}
CGSolver::CGSolver(in... | ALGO | 0.999755 | 4.858985 |
479fbc53-a49e-4da1-b4cd-249f16fbe941 | Minion-Zhang/leetcode | 69_sqrt(x).cpp | /** Sqrt(x)
Implement int sqrt(int x).
Compute and return the square root of x.
*/
/**
* Much like binary search.
*
* Note: Must use double to store the product of two 32 bit integers, otherwise
* it may be overflow even using long(because long is 32bit too).
*/
class Solution {
public:
int sqrt(... | ALGO | 0.99994 | 5.881414 |
8f6d3278-0cec-42e0-b4c1-a8aa5d4f406d | TeoKarakashev/FMI | Algorithms/graphs/general/minimumFuelCost.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <unordered_set>
#include <cmath>
long long cost = 0;
long long dfs(std::vector<std::vector<int>>& graph, int node, std::vector<bool>& visited, int seats) {
if (visited[node]) {
return 0;
}
visited[node] = true;
... | ALGO | 0.999723 | 5.748372 |
2fe0101a-01d6-4e39-a002-353add06c5e4 | harshraj22/problem_solving | solution/geeksforgeeks/FindMedianInAStream.cpp | // https://practice.geeksforgeeks.org/problems/find-median-in-a-stream/0
#include <bits/stdc++.h>
using namespace std;
class FindMedian{
public:
void insertHeap(int &);
double getMedian();
private:
double median; //Stores current median
priority_queue<int> max; //Max heap for lower values
priority_queue<i... | ALGO | 0.999999 | 5.398063 |
04a1de07-0e2c-4258-bff2-0b4f087e9398 | b4ich3v/DSA_FMI | Previous_Exams/2021-2022/task3.cpp | #include <iostream>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <string>
#include <stack>
struct Node
{
Node* next;
int data;
};
class LinkedList
{
public:
LinkedList()
{
head = nullptr;
tail = nullptr;
}
~LinkedList... | ALGO | 0.999993 | 4.498435 |
76039934-a2c9-41c0-b812-9058f65f1ba7 | Akki1104/PIC | Ouick_Sort.cpp | #include <stdio.h>
// function to find the partition position
int partition(int arr[], int low, int high) {
// select the rightmost element as pivot
int pivot = arr[high];
// pointer for greater element
int i = (low - 1);
// traverse each element of the array
// compare them with the pivot
int temp;
for... | ALGO | 0.999961 | 4.492292 |
4596046e-0f69-470a-b424-4bfa2d9009bf | limon2009/ACM-UVA-Online-Judge-solution | 255.cpp | #include<stdio.h>
#define MAX(a, b) (a>b?a:b)
int K,Q,M,kr,kc,qr,qc,mr,mc;
int X[] = {-1,1,0,0};
int Y[] = {0,0,-1,1};
int illegal() {
return K == Q;
}
int illegal_Move() {
int i, max, min;
if(M == Q) return 1;
if(qr != mr && qc != mc) return 1;
if(qr != kr && qc != kc) return 0;
max = MAX(Q,M);
min = Q+M-max... | ALGO | 0.999157 | 3.246968 |
f56f388e-aa5e-4eaf-9efa-49d9406d2afe | AvinashShrivastav/Cpp | Cpp Practice Question/Constructors and Destructors/implementation_of_destructors.cpp | #include <iostream>
using namespace std;
int count = 0;
class alpha
{
public:
alpha()
{
count++;
cout<<"Number of objects created : "<< count<<endl;
}
~alpha()
{
cout<<"Number of objects destroyed : "<<count<<endl;
count--;
... | TOOL | 0.911003 | 4.170434 |
a74078d3-9e98-4972-a905-935707a5c8d9 | varshap17/DSA | Dynamic Programming/print first n fibonacci series.cpp | //Initial function template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution
{
public:
//Function to return list containing first n fibonacci numbers.
vector<long long> printFibb(int n)
{
vector<long long>dp(n);
... | ALGO | 0.999785 | 5.919018 |
be9ebb45-d280-4b72-acf0-e7455c1fc5c0 | alexandraback/datacollection | solutions_1483485_0/C++/Harrywy/p1.cpp | #include<fstream>
#include<iostream>
#include<string>
using namespace std;
int num = 0;
char mapping[] = {'y','h','e','s','o','c','v',
'x','d','u','i','g','l','b',
'k','r','z','t','n','w','j',
'p','f','m','a','q'};
int main() {
ifstream input ("in.txt");
ofstream output ("out.txt");
inpu... | ALGO | 0.99726 | 3.965026 |
48e0a9e7-1221-4b18-92e6-2959431b29dc | FabioVV/Codigos-e-documentos-da-faculdade | c++/3 - Estruturas de repetição/1 - FOR/For pessoa mais velha.cpp | #include <iostream>
using namespace std;
main(){
setlocale(LC_ALL,"Portuguese");
int alum;
int idade;
int sum = 0;
int sum_novo = 9999;
cout<<"Digite o nmero de alunos da sala: ";
cin >> alum;
cout<<"Digite a idade do aluno 1 "<<": ";
cin >> idade;
sum = idade;
sum_novo = idade;
for(int i = 0; i... | ALGO | 0.973758 | 3.789213 |
6597d90a-f51d-4426-8a63-f154c89fe9c2 | zeyuyun1/nanodet | demo_libtorch/main.cpp | #include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include "nanodet_libtorch.h"
struct object_rect {
int x;
int y;
int width;
int height;
};
int resize_uniform(cv::Mat& src, cv::Mat& dst, cv::Size dst_size, object_rect& e... | TOOL | 0.870389 | 5.661525 |
26fc7685-c2cb-4d08-82c1-a29402aedd5c | RaymondJiangkw/COGS | submodules/diff-gaussian-rasterization/third_party/glm/test/core/core_func_integer_find_lsb.cpp | #include <glm/glm.hpp>
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
#ifdef NDEBUG
static int pop(unsigned x)
{
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0F0F0F0F;
x = x + (x << 8);
x = x + (x << 16);
ret... | ALGO | 0.995515 | 4.289132 |
b84d8527-6580-4cee-aea4-18fe9963567d | mandeep-1/DSA_PracticeWork | Combination of factors (iterative).cpp | #include <bits/stdc++.h>
using namespace std;
void print(vector <int> vec)
{
while(vec.size()>1)
{
cout<<vec[0];
for(int i=1;i<vec.size();++i)
{
cout<<"*";
cout<<vec[i];
}
cout<<endl;
int n=vec.size();
int p=vec[n-1]*vec[n-2];
vec[n-2]=p;
vec.resize(n-1);
}
}
void fa... | ALGO | 0.999734 | 4.503071 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.