uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
abfe588a-bd3c-4c05-a3b9-201daedbf4a8 | rahuldubey99/Data_structure_and_alogrithm | searching/binarySearch/firstOccurence.cpp | #include <iostream>
using namespace std;
int firstOccurence(int arr[], int n, int x)
{
int low = 0, high = n - 1;
while (low <= high)
{
int mid = (low + high) / 2;
cout << mid << endl;
if (arr[mid] > x)
high = mid - 1;
else if (arr[mid] < x)
low = mid... | ALGO | 0.999969 | 5.564693 |
aeecaa3a-354f-4af0-a60c-3d09a937fa61 | onyx6838/algorithm | Phan Tich Thiet Ke Thuat Toan/Bai Tap (laptrinhonline.club)/Cua so than ky list.cpp | // cai tien code (k dung` string dung so r in ra)
// duy tri queue 5 ptu
#include<iostream>
#include<complex>
#include<queue>
using namespace std;
typedef pair<string,int> spair;
int main()
{
queue<spair> Q;
string ten[]={"dangdungcntt","tienquanutc","quang123","maianh","nguyenminhduc2820"};
for(string s:ten) Q.pu... | ALGO | 0.999745 | 3.46888 |
ec3bd416-1947-47ad-a1d6-af490cd01103 | GMTonnera/tepc | contest_extra1/b.cpp | #include <bits/stdc++.h>
using namespace std;
int temp(int n, int m) {
vector<int> visited(max(n,m)*2+1, 0);
vector<int> v;
queue<vector<int>> q;
// int temp;
q.push({n,m,0});
while(true) {
v = q.front();
q.pop();
visited[v[0]] = 1;
// cout << v[0] << " " << v[... | ALGO | 0.999971 | 3.56849 |
155c8353-f22d-4ded-bb4a-01abcf345aa6 | HoChunYao/Data-structure-C- | lab 2/lab 2 q2.cpp | #include <iostream>
using namespace std;
class box{
public :
float length,breadth,height,volume;
void calculate(){
volume = length * breadth * height;
}
};
int main(){
box B1,B2;
B1.length = 5.0;B1.breadth = 6.0;B1.height=7.0;
B2.length = 10.0;B2.breadth = 12.0;B2.height=13.0;
B1.calcu... | ALGO | 0.978317 | 3.918109 |
7dcf4030-7c03-425b-82f5-f8635c04ab3f | golaced/RL_Boy | 下位机代码/Linux/control_task2/eigen/bench/benchmarkX.cpp | // g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef MATTYPE
#define MATTYPE MatrixXLd
#endif
#ifndef MATSIZE
#define MATSIZE 400
#endif
#ifndef REPEAT
#define REPEAT 100
#endif
int mai... | ALGO | 0.860598 | 3.370773 |
0ea550b6-c5ae-427f-a963-a6243466e5a6 | koksneo/MaNgOs | dep/ACE_wrappers/ace/ACE_crc_ccitt.cpp | // $Id: ACE_crc_ccitt.cpp 91286 2010-08-05 09:04:31Z johnnyw $
#include "ace/ACE.h"
namespace
{
/*****************************************************************/
/* */
/* CRC LOOKUP TABLE */
/* =======... | TOOL | 0.994323 | 6.738245 |
2e753a88-3aec-42f1-af4c-1be91ca6d3ee | JINwonLEE/genuine | BaekJoon/2167.cpp | #include <iostream>
int main() {
int n, m, num_case;
scanf("%d%d", &n, &m);
int map[300][300];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
scanf("%d", &map[i][j]);
}
}
scanf("%d", &num_case);
for (int test_case = 0; test_case < num_case; test... | ALGO | 0.999287 | 4.511537 |
be563784-162d-4b0f-b018-a01547b43635 | HJWAJ/acm_codes | PKU/3300-3399/P3302.cpp | #include<iostream>
#include<cstring>
using namespace std;
int main()
{
char s1[1001],s2[1001],s[1001];
int t;
cin>>t;
while(t--)
{
cin>>s>>s1;
int len=strlen(s);
int len1=strlen(s1);
int i,j;
for(i=0;i<len1;i++)
s2[len1-1-i]=s1[i];
j=0;
... | ALGO | 0.999949 | 3.567744 |
6dba5265-26f9-49d2-a7a7-7dff2ce766ad | serishan/LeetCode | Solutions/C++/Problem 028.cpp | /*
Question 28: Implement strStr()
Implement strStr().
Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Example 1:
Input: haystack = "hello", needle = "ll"
Output: 2
Example 2:
Input: haystack = "aaaaa", needle = "bba"
Output: -1
Clarification:
What should we ... | ALGO | 0.999335 | 6.193502 |
de15efef-9cda-470f-9c1a-33975a6f7db0 | yuchenle/ppc-bsc-llvm-taskgraph | mlir/lib/Reducer/ReductionNode.cpp | #include "mlir/Reducer/ReductionNode.h"
#include "mlir/IR/IRMapping.h"
#include "llvm/ADT/STLExtras.h"
#include <algorithm>
#include <limits>
using namespace mlir;
ReductionNode::ReductionNode(
ReductionNode *parentNode, const std::vector<Range> &ranges,
llvm::SpecificBumpPtrAllocator<ReductionNode> &allocat... | ALGO | 0.859868 | 3.794192 |
3d601aa9-435b-484f-985b-33a45bb936fd | DannyInBlack/AAST-CPC | dynamic_programming_1/josh.cpp | #include <bits/stdc++.h>
using namespace std;
int solve(int n, int k, bool m){
int r = n + m >> 1;
if(r >= k) return k * 2 - m;
return 2 * solve(n - r, k - r, (n & 1) ^ m) - !m;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--){
int n, k;
... | ALGO | 0.999943 | 4.475813 |
7c59d6eb-2afb-4738-96b6-1603e4dadf94 | KarmPatelDev/Learning-Codes | C++/Tutorial-Codes/41-Multiple-Inheritance-Deep-Dive-with-Code-Example-in-C++.cpp | #include <iostream>
using namespace std;
/*
Syntax for inheriting in multiple inheritance:-
class derived-class : visibility-mode base-1-class, visibility-mode base-2-class, ......., visbility base-n-class
{
class body of derived class
};
*/
class Base1{
protected:
int base1int;
public:
... | TOOL | 0.885823 | 5.454364 |
f0d956b3-d7b0-4e5d-b0b0-f68974f307af | Video-Streaming-Pipeline/Video-Streaming-Pipeline | opencv/sources/3rdparty/carotene/src/convert_depth.cpp | #include "common.hpp"
#include <cstring>
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
template <int shift>
void lshiftConst(const Size2D &size,
const u8 * srcBase, ptrdiff_t srcStride,
s16 * dstBase, ptrdiff_t dstStride)
{
size_t roiw16 = size.width >= 15 ? size.wi... | ALGO | 0.98185 | 6.204195 |
1c9d43f2-feb4-484c-b811-471757e76072 | harshbhar0629/CrackYourInternship | String/10_reverse_word_in_a_string.cpp | #include <bits/stdc++.h>
using namespace std;
// https://leetcode.com/problems/reverse-words-in-a-string/description/
class Solution
{
public:
string reverseWords(string s)
{
string ans = "";
vector<string> v;
stringstream ss(s);
string t;
while (ss >> t)
{
... | ALGO | 0.999839 | 6.068175 |
2a8c3f71-3f11-4557-8d64-d8db1ab8e3e7 | TRANDUYANHHH/DSA_by_DuyAnh | DSA06033.cpp | /**
* author: @tranDuyAnh
**/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(), (x).end()
const int maxn = 3e5 + 5, mod = 1e9 + 7;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t--){
int n;
cin >> n;
vector<pair<int,i... | ALGO | 0.999946 | 4.490163 |
b504134e-0ae9-4aeb-8faf-6db672804f49 | elieLeE/chessE | src/game/src/IA.cpp | /*
* IA.cpp
*
* Created on: 25 sept. 2016
* Author: le_e
*/
#include "IA.h"
#include <boost/shared_ptr.hpp>
namespace game{
//algorithme => minmax en attendant mieux...!
static datas::MovePtr nextMoveIA(Echiquier* iEchiquier){
datas::Position aPositionStart(4, 2);
datas::Position aPositionEnd(4, 4);
/... | ALGO | 0.984225 | 4.115492 |
b6d061da-8f18-4349-8f0d-4ca1c121e7ae | jinhan814/solutions | UNIV/KCPC/kcpc24_1f.cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
cin.tie(0)->sync_with_stdio(0);
int n; cin >> n;
i64 m; cin >> m;
vector v(n, 0LL);
for (int i = 0; i < n; i++) cin >> v[i];
vector rem(n, 0LL);
for (int i = 0; i < n; i++) {
i64 y = i * m + v[i];
rem[i] = y % (2 * m);
}
ve... | ALGO | 0.999906 | 3.94138 |
bc01a15b-a22b-466b-8e32-4f0613d3ac98 | PiyushDhamecha454/DSA | Recursion & Backtracking/diceRolls.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
const int MOD = 1e9 + 7;
const int INF = LLONG_MAX >> 1;
void dice(string s, int n) {
//Obviously, n should be below than 7 and more than 0
if (n == 0) {
cout << s << endl;
return;
}
for (int i = 1; i <... | ALGO | 0.998818 | 4.268772 |
f346f7c7-5d45-496b-9b96-6782fd8b3b09 | Matthew-Guba/cubeRotation | cube/main.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <chrono>
#include <thread>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
using namespace std;
const int WIDTH = 80;
const int HEIGHT = 40;
const float FOV = 3.14159 / 4; // Field of View
const float Z_DIST = 5.0f;
struct Point3D {... | ALGO | 0.867952 | 5.262534 |
0cbd43ec-871d-4390-9325-16c763bb565d | OliwierLechnik/lista3 | list3cpp/Pascal.cpp | #include <stdexcept>
#include "Pascal.hpp"
#include "Binomial.hpp"
Pascal::Pascal(const int n){
this->n = n;
this->v.resize(static_cast<std::size_t>(n+1));
}
void Pascal::generate(void){
for(unsigned long long i = 0; 2*i <= this->n; i++){
this->v[i] = this->v[this->n-i] = Binomial::binomial(this-... | ALGO | 0.977969 | 5.727113 |
0b954420-a538-4504-9d81-e7ae110535a9 | Ebrar-Orhan/ProgramlamaDilleri | 8.cpp | #include <stdio.h>
//1 ile n arasndaki asal saylarn toplamn bulan yazdran program.
int main(){
int i,j;
int a;
int n;
int toplam=0;
printf("Bir n sayisi giriniz:");
scanf("%d",&n);
for(i=1;i<=n;i++){
a=1;
for(j=2;j<i;j++){
if(i%j==0){
a=0;
break;
}
}
if(a==1){
toplam=toplam+i;
}
}
... | ALGO | 0.999883 | 3.6317 |
dcd395ba-4df3-40c9-9a7b-0c54bac42a39 | lion38925/kit | Math/remove_nth_node_from_end_of_list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* removeNthFr... | ALGO | 0.999979 | 5.913488 |
0e83b0f9-f8de-4f14-98c2-5bfb1f01e5b2 | ishandutta2007/codeforces | dorijanlendvaj/normal/1142/C.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
int MOD=1000000007;
int MOD2=99824435... | ALGO | 0.999959 | 4.417065 |
32ef1413-dff4-4d2c-b63e-166a8d9fde46 | ishandutta2007/codeforces | gshgsh/normal/1480/A.cpp | #include<iostream>
#include<queue>
using namespace std;
#define For(i,l,r) for(int i=l;i<=r;i++)
int T;int main(){cin>>T;while(T--){string s;cin>>s;int N=s.length();For(i,0,N-1)if(i+1&1)s[i]=s[i]=='a'?'b':'a';else s[i]=s[i]=='z'?'y':'z';cout<<s<<endl;}return 0;} | ALGO | 0.999697 | 3.535978 |
a8473696-d69a-4ef2-9a9f-444c5e9c036a | rparit-stacks/Decode-cpp | Array/Practice/geek_leader.cpp | #include<vector>
#include<iostream>
using namespace std;
void display(vector<int> &vec)
{
for(int i = 0; i < vec.size(); i++)
{
cout << vec[i]<< " ";
}
}
void leader(vector<int> &vec, int x, int y)
{
vector<int>leaders;
int leader = vec[x];
for(int i = x+1; i < vec.size(); i++)
{
... | ALGO | 0.999975 | 3.956809 |
dda5f236-9d0f-4a43-95d3-f30f72b26511 | hvitoi/tech-docs | language/gpl/c++/libraries/list/classes/list/insert.cpp | #include <iostream>
#include <list>
using namespace std;
int main() {
list<int> myList = {1, 2, 3};
// Insert an element at a specific position
// The other elements are then "shifted" (not exactly because it's a LL)
myList.insert(myList.begin(), 0);
for (auto it = myList.begin(); it != myList.end(); it++)... | ALGO | 0.925603 | 3.364215 |
afcc3e0f-be93-4a9b-a146-11ce306d0638 | Claudiomancinelli90/CutLocus | libs/libigl/include/igl/copyleft/cgal/piecewise_constant_winding_number.cpp | template < typename DerivedV, typename DerivedF>
IGL_INLINE bool igl::copyleft::cgal::piecewise_constant_winding_number(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F)
{
Eigen::Matrix<CGAL::Epeck::FT,Eigen::Dynamic,3> VV;
Eigen::Matrix<typename DerivedF::Scalar,Eigen::Dy... | ALGO | 0.997648 | 5.366938 |
f207a9d0-ed01-4a00-8560-d7dfbc5d4fba | brightlaboratory/llvm-project | clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp | #include "InconsistentDeclarationParameterNameCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <algorithm>
#include <functional>
#include <sstream>
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace readability {
namespace {
AST_MATCHE... | TOOL | 0.857946 | 7.894451 |
05c0d507-3e16-4ed3-8c6f-c90fefed360c | ninja1464/cplusplus | 6.1.funtors/chair.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <iterator>
#include <fstream>
#include <queue>
#include <cstring>
#include <sstream>
using namespace std;
int main()
{
vector<pair<int, int>> chair;
for (int i = 0; i < 6; i++)
{
int first, second;
cin >> fi... | ALGO | 0.992134 | 3.26081 |
b1125f06-f78a-4a2d-a433-818fd52fba2e | MauricioA/membrana | celula/eigen/unsupported/doc/examples/BVH_Example.cpp | #include <Eigen/StdVector>
#include <unsupported/Eigen/BVH>
#include <iostream>
using namespace Eigen;
typedef AlignedBox<double, 2> Box2d;
namespace Eigen {
namespace internal {
Box2d bounding_box(const Vector2d &v) { return Box2d(v, v); } //compute the bounding box of a single point
}
}
struct Poin... | ALGO | 0.999892 | 6.555463 |
25dd8fda-2274-414e-921a-e9de60dcd571 | gjfresno/Info2-Cpp-Basic | 2_ParametrosReferencia/Ej01_Referencia.cpp | #include <iostream>
void duplicar(int &x) { // Se pasa por referencia
x *= 2;
}
int main() {
int numero = 10;
duplicar(numero);
std::cout << "Numero despues de duplicar: " << numero << "\n"; // Ahora es 20
return 0;
}
| TOOL | 0.975138 | 4.7163 |
fa940b07-909d-40f0-925f-755d3437d358 | artkeep/trinity | dep/g3dlite/source/GImage_bayer.cpp | /**
@file GImage_bayer.cpp
@author Morgan McGuire, http://graphics.cs.williams.edu
@created 2002-05-27
@edited 2006-05-10
*/
#include "G3D/platform.h"
#include "G3D/GImage.h"
namespace G3D {
void GImage::BAYER_G8B8_R8G8_to_Quarter_R8G8B8(int width, int height, const uint8* in, uint8* out) {
debugAssert(... | ALGO | 0.922093 | 6.124008 |
80c2cb87-5e12-4c98-9da1-cd470975c706 | ishandutta2007/codeforces | riverhamster/normal/1707/C.cpp | #include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cassert>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define LOG(f...) fprintf(stderr, f)
#define DBG(f...) printf("%3d: ", __LINE__), printf(f)
// #define DBG(f...... | ALGO | 0.999983 | 4.433995 |
9c30031f-76a6-4964-b013-ab875adad9c3 | morshedalam3/cp-january-w1 | w-2/day-1/Student_Councils.cpp | #include<bits/stdc++.h>
using namespace std;
#define lli long long int
lli k,n,ans;
vector<lli> a;
bool good(lli x)
{
lli temp=x;
x*=k;
for(auto el : a)
x-=min(temp,el);
return x<=0;
}
int main()
{
lli l,r,mid,i;
cin>>k>>n;
a.resize(n);
for(i=0;i<n;i++)
cin>>a[i];
l=0,r=1e12;
while(l+1<r)
{
mid=(l+... | ALGO | 0.999981 | 3.844866 |
a66ee8e0-dbe4-415d-8b45-149f66d76816 | RuiqiW/fluid-simulation | extern/libigl/include/igl/covariance_scatter_matrix.cpp | IGL_INLINE void igl::covariance_scatter_matrix(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const ARAPEnergyType energy,
Eigen::SparseMatrix<double>& CSM)
{
using namespace Eigen;
// number of mesh vertices
int n = V.rows();
assert(n > F.maxCoeff());
// dimension of mesh
int dim = V.cols(... | ALGO | 0.997848 | 4.036748 |
72d17669-1c88-4c1d-9a84-0ba2f1fabc4a | Masud-Parves/FAANG-Path | NeetCode.io/Sliding Window/06. Sliding Window Maximum.cpp | //Input : k = 3
// [1,3,-1,-3,5,3,6,7]
// ans : 3,
class Solution {
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
vector<int> result;
int n = nums.size();
if(k == 1) return nums;
deque<int> dq;
for(int i=0; i<n ; i++){
if(!dq.empty() ... | ALGO | 0.999971 | 5.799224 |
81ebb233-a8ad-49a8-8674-d50b3089c081 | shamskv/codewars | 6_roman_numerals_decoder/main.cpp | #include <iostream>
#include <string>
#include <map>
int solution(std::string roman) {
std::map<char, int> values;
values['I'] = 1;
values['V'] = 5;
values['X'] = 10;
values['L'] = 50;
values['C'] = 100;
values['D'] = 500;
values['M'] = 1000;
int curr = 1, sum = 0;
for (int i = roman.length()-... | ALGO | 0.99966 | 5.991126 |
4066efb6-681f-4996-a2a8-32bc7714fe21 | neotions/CS300-SNHU | CS300 Project 1/menuFunctions.cpp | //=========================================================================
// Name : BinarySearchTree.cpp
// Author : John St Hilaire
// Version : 1.0
// Last Updated : 2/25/23
// Description : Menu helper functions for Project 1 for CS300 at SNHU
//=====================================================... | TOOL | 0.912723 | 6.059145 |
0165f509-2f6f-4a9e-a24a-824ac27ff19d | AmeerAboMukh/Assignment3 | igl/in_element.cpp | template <typename DerivedV, typename DerivedQ, int DIM>
IGL_INLINE void igl::in_element(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::MatrixXi & Ele,
const Eigen::PlainObjectBase<DerivedQ> & Q,
const AABB<DerivedV,DIM> & aabb,
Eigen::VectorXi & I)
{
using namespace std;
using namespace Eigen;... | ALGO | 0.979606 | 5.405252 |
9ccc54d5-f87a-4b32-97b4-f08be36893d5 | zshangGEO/gmsh | contrib/eigen/doc/examples/Tutorial_BlockOperations_block_assignment.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
Array22f m;
m << 1,2,
3,4;
Array44f a = Array44f::Constant(0.6);
cout << "Here is the array a:" << endl << a << endl << endl;
a.block<2,2>(1,1) = m;
cout << "Here is now a with m copied into its cent... | ALGO | 0.943221 | 3.290376 |
3229779f-495f-4c01-abf9-c3aa0f302a51 | son-of-mountain/problem-solving | codeforces/.history/icpc_mansoura/session4/A- Max Box 2_20240908111158.cpp | #include<bits/stdc++.h>
using namespace std;
#define sonic ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL);
// stopped at 1:04:37
/*
approach :
- first you should make a prefix array where results are stored
- then , take two parameters that increments along the pre array
- calculat... | ALGO | 0.999947 | 3.883928 |
7af33a88-cbc3-46e1-bc54-7f9cdae689b1 | derco19/Programming-Contest- | Educational 103/D_Journey.cpp | // Believe in yourself
#include<bits/stdc++.h>
#include<ctime>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define Pair vector<pair<ll,ll>... | ALGO | 0.999907 | 3.604733 |
198691e1-5eb1-44ce-96a7-722fea67cdbf | lorenzo-ferrari/olinfo | src/preoii_account.cpp | #include <bits/stdc++.h>
#pragma GCC optimize ("O3")
using namespace std;
int chiedi(int);
void rispondi(string);
void indovina(int n) {
char c = 'a' + n - 1;
int m = n*(n+1)/2, l;
string s(n, ' ');
while (c > 'a') {
l = chiedi(m);
s[n - l] = c--;
m -= l;
}
s[n-m] = 'a';
rispondi(s);
} | ALGO | 0.994161 | 3.296105 |
3de98626-bcc4-48fb-ba81-2b403e1fa26f | apurv-kulkarni-01/DSA101 | Arrays/left_rotate_by_one.cpp | #include<bits/stdc++.h>
using namespace std;
// inplace
// TC THETA(n)
void left_rotate(int arr[], int n){
int toRotate = arr[0];
for(int k=0;k<n-1;k++){
arr[k]=arr[k+1];
}
arr[n-1] = toRotate;
}
int main(){
int arr[5]={1,2,3,4,5};
left_rotate(arr, 5);
for(int i=0;i<5;i++){
... | ALGO | 0.999947 | 4.767896 |
3e05f957-c81a-43ca-8d45-0afc92a7305e | ferily7/csc16 | blackjack.cpp | /* Author: Farrah Lee
Program: Playing Blackjack */
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
//Function prototypes
int deal(vector<int> & deck);
int player_plays(vector<int> & player_hand, vector<int> & deck);
int dealer_plays(vector<int> & dealer... | ALGO | 0.972004 | 5.770362 |
3c9f40e9-e222-410a-a014-c22a9fb3ca8a | raincross7/code-similarity | codes/train_code/problem049/problem049_345.cpp | #include <iostream>
#include<vector>
#include<queue>
#include<list>
#include<algorithm>
using namespace std;
static const int MAX=100000;
static const int INFTY=(1<<29);
vector<int>G[MAX];
list<int>out;
bool V[MAX];
int N;
int indeg[MAX];
void bfs(int u)
{
queue<int>q;
q.push(u);
V[u]=true;
while(!q.emp... | ALGO | 0.999986 | 4.216216 |
78070778-4a6c-44a0-baa0-5f810c318d0c | thevkp/DSA | LinkedList/LinkedList/palildrome.cpp | #include <iostream>
using namespace std;
struct Node{
int data;
Node* next;
Node(int value) : data(value), next(nullptr) {}
};
class LinkedList{
private:
// function to create the node
void insertNode(int value){
Node* newNode = new Node(value);
if(head){
... | ALGO | 0.999469 | 5.404864 |
49d1f8d8-ea92-49e2-9d8e-3774e2c2d1f2 | jesuswr/cp-codes-and-problems | TCA_21_9/L.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <array>
#include <random>
#include <chrono>
using namespace std;
typedef long long ll;... | ALGO | 0.999761 | 3.609078 |
2561cf66-7b6e-491c-b994-e163e2f063f1 | DevleenaBanerjee/Stock_Prediction_ds | venv/Lib/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/libs/graph/example/reachable-loop-tail.cpp | int
main(int argc, char *argv[])
{
if (argc < 3) {
std::cerr << "usage: reachable-loop-tail.exe <in-file> <out-file>"
<< std::endl;
return -1;
}
using namespace boost;
GraphvizDigraph g_in;
read_graphviz(argv[1], g_in);
typedef adjacency_list < vecS, vecS, bidirectionalS,
GraphvizVertexPr... | ALGO | 0.958551 | 5.389316 |
5b4e0ace-86f7-458c-bb16-87dd72204f17 | sarvex/leetcode-prolog | solution/0200-0299/0253.Meeting Rooms II/Solution.cpp | class Solution {
public:
int minMeetingRooms(vector<vector<int>>& intervals) {
int n = 1000010;
vector<int> delta(n);
for (auto e : intervals) {
++delta[e[0]];
--delta[e[1]];
}
for (int i = 0; i < n - 1; ++i) {
delta[i + 1] += delta[i];
... | ALGO | 0.99999 | 6.292043 |
8df9814c-e280-4b72-911b-95b1ec7952e0 | sahadat-11/Codeforces | 347/B.Fixed_Points.cpp | //In The Name of ALLAH
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n; int a[n];
map<int, int> mp;
int cnt = 0;
for(int i = 0; i < n; i++) {
cin >> a[i];
mp[i] = a[i];
if(i == a[i]) cnt++;
}
int cnt1 =... | ALGO | 0.999899 | 3.945864 |
0906a1b1-7306-4bc7-8033-ced60dd89866 | skygupta07/DSA | 28_queue1/6_qUsingLL.cpp | #include <bits/stdc++.h>
using namespace std;
class Node{ // LL Node class
public:
int data;
Node* next;
Node(int data){
this->data = data;
this->next = NULL;
}
};
class Queue{ // Queue class
public:
Node* head; // data members
Node* tail; // head tail or front, ... | ALGO | 0.999076 | 4.894402 |
94bf0847-6fb8-497a-865d-3271688736c7 | ishandutta2007/codeforces | ra16bit/normal/1375/C.cpp | #include <bits/stdc++.h>
using namespace std;
int t,n,m,i,a[300300],s[300300];
int main() {
scanf("%d",&t);
while (t--) {
scanf("%d",&n); m=0;
for (i=1; i<=n; i++) {
scanf("%d",&a[i]);
if (m==0 || a[i]<s[m]) s[++m]=a[i]; else {
while (m>1 && a[i]>s[m-1]) --m;
}
}
//for (i=1... | ALGO | 0.99991 | 3.868323 |
30323df7-d29a-402a-aab6-b0f9b4c35cc1 | el8latspq/xbnbt-zijing-mod | src/tracker_users_v4.cpp | // =Xotic= Modified Source File
#include "bnbt.h"
#include "bnbt_mysql.h"
#include "atom.h"
#include "config.h"
#include "html.h"
#include "md5.h"
#include "sort.h"
#include "tracker.h"
#include "util.h"
void CTracker :: serverResponseUsers( struct request_t *pRequest, struct response_t *pResponse )
{
// Set the sta... | WEB | 0.863876 | 4.007288 |
e6910152-c578-490d-a6bd-e554332d8284 | Sph1nxPT/boids | niceBoids/Boid.cpp | #include "Boid.h"
#include <SDL.h>
#define PERCEPTION_RADIUS 100
unsigned int Boid::_idCount = 0;
void Boid::draw(SDL_Renderer* renderer) {
SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE);
int offsetx, offsety, d;
int status;
offsetx = 0;
offsety = _r;
d = _r - 1;
... | ALGO | 0.976438 | 5.580458 |
31bcbeed-74c4-4ea0-a629-07e33e9ee014 | Xohail69/Leetcode | Find position of set bit - GFG/find-position-of-set-bit.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int findPosition(int N) {
// code here
// int pos(1) ;
// if(N == 0 or (N & (N-1) ) ) return -1 ;
// else {
// while(N > 0 ) {
// if(N&1 ) brea... | ALGO | 0.999693 | 6.122984 |
ec2cdd29-c04e-44ba-be8c-5f833f7451c2 | slayar-yard/platform_frameworks_av | media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.cpp | #include "BIQUAD.h"
#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
/**************************************************************************
ASSUMPTIONS:
COEFS-
pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
pBiquad... | ALGO | 0.994532 | 4.04674 |
e499188e-8345-47d6-b826-4106ff965a72 | michelanthony/CloneSiconosMaster | kernel/src/modelingTools/FirstOrderLinearDS.cpp | #include "FirstOrderLinearDS.hpp"
// #define DEBUG_MESSAGES
// #define DEBUG_STDOUT
#include "debug.h"
#include <iostream>
typedef void (*computeAfct)(double, unsigned int, unsigned int, double*, unsigned int, double*);
// --- Constructors ---
// From a minimum set of data, A and b connected to a plug-in
FirstOrderLi... | ALGO | 0.99079 | 6.465253 |
c9b287ba-789d-4b27-abd4-5aaed876fb96 | skmainwal/Companies-Test-Problem-codeforce- | citrix/set-2/good-binary-strings/stupid.cpp | /* I didn't take care of non-splittable strings in the first draft. See Post below.
* Idea borrowed from
* https://leetcode.com/problems/special-binary-string/discuss/113213/12-liner-readable-clean-C%2B%2B-(with-explanation-and-comments)
* Tricky Test Case : (()(())) - Non Splittable String
*/
#include<bits/stdc+... | ALGO | 0.999965 | 5.284491 |
38496bea-d826-45a5-9a10-32d688a488ed | SedemQuame/cpp_practice | cpp_programming_from_problem_analysis_to_program_design/chapter7_user_defined_simple_data_types/comparin_floating_point_numbers/floating_num_comparison.cpp | # include <iostream>
# include <iomanip>
# include <cmath>
using namespace std;
int main(){
double x = 1.0;
double y = 3.0 / 7.0 + 2.0 / 7.0 + 2.0 / 7.0;
cout << fixed << showpoint << setprecision(17);
cout << "3.0 / 7.0 + 2.0 / 7.0 + 2.0 / 7.0 = " << 3.0 / 7.0 + 2.0 / 7.0 + 2.0 / 7.0 << endl;
... | ALGO | 0.989906 | 4.120825 |
2992a224-15a3-47e8-aa96-d9d76fadb5cb | SteveLeungYL/parserfuzz_code | MariaDB/docker/src/parser/grammar_coverage_visitor/md5.cpp | /*
* Derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm
* and modified slightly to be functionally identical but condensed into control structures.
*/
#include "md5.h"
/*
* Constants defined by the MD5 algorithm
*/
#define A 0x67452301
#define B 0xefcdab89
#define C 0x98badcfe
#define D 0x1032... | ALGO | 0.998669 | 6.702081 |
6e79bb55-7066-406c-8d0b-e88c1e033308 | mcfi/MCFI | lib/libcxx-3.5.0.src/test/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
// requires ShuffleIterator<Iter>
// && CopyConstructible<Compare>
// void
// partial_sort(Iter first, Iter middle, Iter last, Compare comp);
#include <algorithm>
#include <vector>
#include <functional... | TEST | 0.999079 | 6.370184 |
7d4d70fe-d7aa-424a-9abe-dd4533936a37 | old-yan/CP-template | TEST/oj/hdoj_1918.cpp | #include "GRAPH/BFS.h"
#include "IO/FastIO.h"
#include <array>
/*
[Frogger](https://acm.hdu.edu.cn/showproblem.php?pid=1918)
*/
/**
* 本题为分层最短路
*/
void solve_bfs() {
uint32_t t;
cin >> t;
while (t--) {
uint32_t lim, m, n;
cin >> lim >> m >> n;
std::vector<std::string> grid(m + 2)... | ALGO | 0.99991 | 5.205654 |
a9ad3c83-9d76-4e26-b45d-42bec1e8dc82 | nel215/atcoder-grand-contest | arc083/c.cpp | #include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#define REP(i,x) for(int i=0 ; i<(... | ALGO | 0.999722 | 3.005884 |
700c8f47-1744-468d-b9e6-8799de8ff0ba | seraph27/competitve-programming | atcoder/abc365/a.cpp | #include <bits/stdc++.h>
#define ll long long
#define ar array
#define all(x) x.begin(), x.end()
#define pii pair<ll, ll>
#define pb push_back
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rint(l, r) uniform_int_distribution<int>(l, r)(rng)
template<typename T> bool c... | ALGO | 0.999421 | 4.345737 |
9f35c109-62c6-4e8c-a4ff-897b7cdd7909 | nataraj2/MovingEB_CNSAMReX | CNS_EBoft_ICE/Source/CNS.cpp |
#include <CNS.H>
#include <CNS_F.H>
#include <AMReX_EBMultiFabUtil.H>
#include <AMReX_ParmParse.H>
#include <AMReX_EBAmrUtil.H>
#include <AMReX_EBFArrayBox.H>
#include <climits>
using namespace amrex;
constexpr int CNS::level_mask_interior;
constexpr int CNS::level_mask_covered;
constexpr int CNS::level_mask_notco... | ALGO | 0.988488 | 5.774561 |
12d71224-d58d-4d05-bf37-629da905fbb8 | ishandutta2007/codeforces | rniya/normal/1454/A.cpp | #include <bits/stdc++.h>
using namespace std;
const long long MOD=1000000007;
// const long long MOD=998244353;
#define LOCAL
#pragma region Macros
typedef long long ll;
typedef __int128_t i128;
typedef unsigned int uint;
typedef unsigned long long ull;
#define ALL(x) (x).begin(),(x).end()
const int INF=1e9;
const long... | ALGO | 0.999838 | 4.961011 |
c562efc4-63f2-40af-8698-89776ebaadd7 | ThaisNg1003/c-ptit | KTCOBAN215 - Tính giá trị biểu thức số lớn.cpp | #include <iostream>
using namespace std;
typedef unsigned long long ULL;
// Hàm tính S(n, k) = n! / (n - k)!
ULL tinhS(long long n, long long k) {
ULL result = 1;
// Tính tích từ n đến (n-k+1)
for (int i = 0; i < k; ++i) {
result *= (n - i); // Nhân n, n-1, n-2, ..., n-k+1
}
return result... | ALGO | 0.999957 | 6.06206 |
ec61f0cc-9b83-498d-8475-6cf368da1a7e | lavish123409/csesSolutions | Distinct_Values_Queries.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __prin... | ALGO | 0.999927 | 4.466799 |
0f3eedc4-f22b-4185-89ba-34ffcc55023c | snjumaheshwari/C-Cpp | SPOJ_FCTRL2_Small_Factorials.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
void multiply(int* arr, int num, int &n)
{
int rem=0;
for(int i=0;i<=n;i++)
{
int product= num* arr[i] + rem;
arr[i]= product%10;
rem=product/10;
}
while(rem!=0)
{
arr[++n]= rem%10;
rem=rem/10;
}
}
void factorial(int *arr,int num, in... | ALGO | 0.999852 | 5.218149 |
bb085291-e329-46d4-95f3-7aec81005b4c | shili-51/Data-Structures-and-Algorithms | Graph/Basics/Breadth First Traversal.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> breadFirstSearch(vector<int>adj[], int nodes, int srcNode) {
vector<int> bfs;
queue<int>q;
vector>bool>visited(nodes, false);
q.push(srcNode);
visited[srcNode] = true;
while(q.empty() == false){
int curr = q.front();... | ALGO | 0.999996 | 4.824939 |
8cc575e1-d2a9-4d56-9f51-3dbc2cf4af0a | leo0049l/Programming-contest | contest/Topic 6/0316211-6-B.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int array1[100001],array2[100001];
int f(int a)
{
if(a==array1[a])
return a;
else
{
int b=array1[a];
array1[a]=f(array1[a]);
array2[a]=(array2[a]+array2[b])%2;
return array1[a];
}
}
int main()
{
int input;
int n,m;
cin>>input;
... | ALGO | 0.999688 | 3.581469 |
b450d5dd-d5f6-4df0-a4e4-953e357100a0 | ned14/boost-release | libs/polygon/example/voronoi_basic_tutorial.cpp | // Boost.Polygon library voronoi_basic_tutorial.cpp file
// See http://www.boost.org for updates, documentation, and revision history.
#include <cstdio>
#include <vector>
#include <boost/polygon/voronoi.hpp>
using boost::polygon::voronoi_builder;
using boost::polygon::voronoi_diagram;
using boost::polygon::x;
using ... | ALGO | 0.999671 | 6.482969 |
46f81356-8e45-418c-9b39-3a5e71e3a2f2 | hyunsikwon/algorithm-study | Programmers/탐욕법/체육복/체육복/main.cpp | #include <iostream>
#include <vector>
using namespace std;
int solution(int n, vector<int> lost, vector<int> reserve) {
int answer = 0;
answer += n - lost.size();
for (int i = 0; i < reserve.size(); i++) {
for (int j = 0; j < lost.size(); j++) {
if (reserve[i] == lost[j]) {
... | ALGO | 0.99969 | 4.666898 |
66440ad4-aaba-4256-b48f-ebc22cc6c5ac | jakkanaga/MeshlessMethods-EFGM | Code/maxent-cpp-1.0/include/eigen/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp | MatrixXd X = MatrixXd::Random(5,5);
MatrixXd A = X + X.transpose();
cout << "Here is a random symmetric 5x5 matrix, A:" << endl << A << endl << endl;
SelfAdjointEigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << ... | ALGO | 0.999772 | 3.056724 |
fbe12022-9268-4370-b47e-84ba880ce013 | ishandutta2007/codeforces | rudradevbasak/normal/121/E.cpp | //Data Structure includes
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<string>
//Other Includes
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;
#define FOR(i,a,b... | ALGO | 0.998175 | 3.696605 |
7c34eafe-93a9-46e5-89c2-fb749c8a0c65 | sthaarwin/Maze-Solver | src/mazeSolver.cpp | #include "mazeSolver.hpp"
#include "mazeGenerator.hpp"
bool dfs(vector<vector<char>>& maze, int x, int y, int endX, int endY) {
if (x < 0 || x >= MAZE_WIDTH || y < 0 || y >= MAZE_HEIGHT || maze[y][x] != '.') {
return false;
}
if (x == endX && y == endY) {
maze[y][x] = 'E';
return t... | ALGO | 0.999613 | 5.566106 |
9f913341-ba5c-4df5-952b-77acf4fea7b7 | poorva-khatawate/Data-Structures-and-Algorithms | Length of longest substring without any repeating charater.cpp | //find the length of the longest substring without any repeating characters.
//eg: "abcabcbb" -> "abc" -> 3
#include <iostream>
#include <string>
#include <set>
using namespace std;
int main() {
string s;
cin >> s;
int n = s.length();
int maxlen = 0; // Start maxlen with 0 instead of INT_MIN
for ... | ALGO | 0.999895 | 5.455986 |
faca7e9e-496e-4f81-93c4-af47d803b4c4 | gCoccimiglio/ClusteringResearch | LocalSearchClustering.cpp | #include "LocalSearchClustering.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <map>
#include <time.h>
#include <stdlib.h>
#include <cstring>
LocalSearchClustering::LocalSearchClustering(string graphFile, string clusterFile, string outputFile) {
this->outputFile = outputFile;
vertexCount = ed... | ALGO | 0.999616 | 5.547144 |
8afde942-0084-4f43-ae92-f22a8aa72ef2 | bosecodes/CP-by-bosecodes | 30 days coding challenge/Day 15: Strings/romantoInt.cpp | // roman to integer
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string roman;
cin >> roman;
map<char, int> rmap;
rmap.insert({'I', 1});
rmap.insert({'V', 5});
rmap.insert({'X', 10});
rmap.insert({'L', 50});
rmap.... | ALGO | 0.999913 | 5.831322 |
c6c19360-cda6-489c-b52a-e9ba8537fdc4 | shunak/alg-sandbox | coin-change.cpp | #include <iostream>
using namespace std;
int main(){
int i = 0;
int data[100];
// Input datasets
while(true){
cin >> data[i];
if(data[i]==0)
break;
i++;
}
/* cout << i << endl; */
int change[100];
int noc[100]; // number of coin
for(int j=0; j<100; j++){
noc[j] = 0;
}
// process datas by greedy ... | ALGO | 0.999647 | 3.596871 |
69602b53-6a5f-42a7-986e-ce085af03087 | A-P-Shukla/LeetCode | 6.Zigzag Conversion.cpp | //Code 1:
class Solution {
public:
string convert(string s, int numRows) {
if (numRows == 1 || numRows >= s.size()) {
return s;
}
vector<string> rows(numRows);
int currentRow = 0;
bool goingDown = false;
for (char c : s) {
rows[currentRow] += c... | ALGO | 0.999921 | 6.210099 |
7e97fce5-859e-4a25-a854-371ec9a56219 | JimmyC41/TexasHoldEmV1 | server/src/Services/HandRankManager.cpp | #include "../../include/Services/HandRankManager.h"
void HandRankManager::populateHandsInfo(GameData& gameData) {
// For each player in the game
auto players = gameData.getPlayers();
for (auto& player : players) {
// Fetch the hand and get the relevant handInfo object
const auto& hand = pla... | TOOL | 0.954385 | 7.06911 |
63f69be0-f739-490c-af23-219ce9c40a0b | ishandutta2007/codeforces | bluediamond/normal/733/E.cpp | #include <bits/stdc++.h>
///#prbgmb GCC target ("sse4.2")
///#pragma GCC opimize("O1")
///#pragma GCC opimize("O2")
///#pragma GCC opimize("Os")
///#pragma GCC opimize("Ofast")
///#pragma GCC target("avx,avx2,fma")
///#pragma GCC target("avx2")
///#pragma GCC opimize("O3")
///#pragma GCC opimization ("unroint-loops"... | ALGO | 0.999981 | 3.86849 |
f1c4600c-c885-4e98-a590-d0496f74d177 | ishandutta2007/codeforces | shun_pi/normal/1427/C.cpp | #include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#d... | ALGO | 0.999955 | 3.845013 |
70d61e51-903b-4c9e-8a9b-6bafa05f33de | LuisEnilton/Maratona | CSES/Range Updates and Sums/solution.cpp | //
// Created by Luis on 09/08/2023.
//
//Template By eduardocesb
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define optimize ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define INF 1000000010
#define INFLL 1000000000000000010LL
#define ALL(x) x... | ALGO | 0.999803 | 5.662497 |
a4ad6dd5-872c-4cf4-9db0-640f5142039b | wdomitrz/Basic_algorithms | dprz2.cpp | #include <cstdio>
const int base = 1048576; //1 << 20;
int drz[2 * base];
int t[1000 * 1000 + 10]; // tablica z ciagiem
int n;
int czytaj(int x) { // x jest na najnizszym poziomie
int sum = 0;
while(x >= 1) {
sum += drz[x];
x /= 2;
}
return sum;
}
void popr(int a, int b, int x) { // miejsca w tablicy, a <= b... | ALGO | 0.997738 | 3.822066 |
aab04df0-47bf-44cd-8d28-c3aca16d5c73 | ibeastking/CP | Contest/2563_Count_the_Number_of_Fair_Pairs.cpp | //* Difficulty -> Medium
//! Weekly Contest 332
//? Given a 0-indexed integer array nums of size n and two integers lower and upper, return the number of fair pairs.
//? A pair (i, j) is fair if:
//? 0 <= i < j < n, and
//? lower <= nums[i] + nums[j] <= upper
#include <bits/stdc++.h>
using namespace std;
//! just s... | ALGO | 0.999926 | 5.726133 |
69db1f6e-5d1f-4654-afa2-e81534730047 | Silver-Sword/Competitive-Programming-Samples | 2022/pushabox.cpp | // Push a Box
// Problem credits: Nathan Pinsker
// Problem Description
/*
You are given an R by C grid, where '.' is an open cell, '#' is a blocked cell,
'A' is the starting position of the character, and 'B' is the starting position of the box.
You are then given q (<= 50,000) queries that each provide a... | ALGO | 0.999871 | 5.276674 |
6cf5dda8-5d4f-4a6c-8da2-d07b9110d959 | ReiAccept/Algorithm | Contest/2021CCPC网络赛重赛/F.cpp | #include<bits/stdc++.h>
//#include<bits/extc++.h>
#define int long long//__int128
#define mmst0(x) memset(x,0,sizeof(x))
#define mmst3f(x) memset(x,0x3f,sizeof(x))
#define pb(x) emplace_back(x)
#define mkp(x, y) make_pair(x, y)
#define fi first
#define se second
using namespace std;
//using namespace __gnu_pbds; //If u... | ALGO | 0.999519 | 3.89989 |
ffb5ed70-c03a-4d6f-a941-6c73ec5ba557 | vedprakash2017/CP_HMM | ratings/1300/5.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,q = 0;
cin>>n;
n++;
if(n<=9001 && n>=1000)
while(1)
{
string a = to_string(n);
for (int i = 0; i < 3; i++)
{
if( find(a.begin()+i+1,a.end(),a[i]) != a.end() )
{
q =1... | ALGO | 0.997823 | 3.149427 |
2c9c6136-5eaa-462f-ae46-4539df6ff131 | vikrambhatla/topcoder | contest/s2e2/s2e2_F.cpp | #ifdef do_not_compile_this_file
#include<algorithm>
#include<iterator>
#include<iostream>
#include<cstring>
#include<climits>
#include<cstdio>
#include<string>
#include<vector>
#include<deque>
#include<set>
#include<map>
using namespace std;
#define all(v) begin(v),end(v)
#define rep(i,f,t) for(int i = (f),end_##i = (t... | ALGO | 0.998734 | 3.784706 |
4e08a1d9-04f0-491f-bb46-18dbfcecb3f9 | copperspice/cs_paint | src/3rdparty/glm/test/core/core_func_integer_find_msb.cpp | #include <glm/glm.hpp>
#include <cstdio>
#include <cstdlib> // To define "exit", req'd by XLC.
#include <ctime>
#define LE 1 // 1 for little-endian, 0 for big-endian.
int pop(unsigned x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0... | ALGO | 0.998739 | 3.533907 |
c0f29b2a-d177-41d8-9066-46d86994dde9 | 2-BrainCells/Old_CPP_codes | collegecode/Opps/problem1.cpp | #include <iostream>
using namespace std;
class Arr
{
int len, *address;
public:
Arr()
{
len = 0;
address = new int;
}
Arr(int x)
{
len = x;
address = new int[len];
for (int i = 0; i < len; i++)
{
address[i] = rand() % 101;
... | ALGO | 0.985267 | 4.206005 |
1ada89cf-be05-46b5-a7cb-5a217178cdca | juneview-songdo/music_list_page | 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 |
bcb40982-062b-4480-a000-ac3de912405c | eric-mwakazi/DSAs | Data structures assignments/CIT 00090 021 week 11/CIT 00090 021 week 11.cpp | #include<iostream>
#include<stdlib.h>
using namespace std;
struct st
{
int data;
struct st *left;
struct st *right;
};
struct st *root=NULL,*temp;
void insertElements();
void preorder(struct st *);
void inorder(struct st *);
void postorder(struct st *);
int main()
{
int ch;
while(1)
{
cout<<"\n 1.insert Elements \n... | ALGO | 0.998925 | 3.997061 |
b8e25fb0-ff3d-4273-a1a8-1cc30f60741a | Abdullahbottar/C-pf | lab6/Source3.cpp | //#include <iostream>
//using namespace std;
//int main()
//{
// int arr[100];
// int size;
// cout << "Enter the size of array:";
// cin >> size;
// cout << endl;
// for (int i = 0; i < size; i++)
// {
// cout << "Enter the component of array :";
// cin >> arr[i];
// }
// cout << "The array you have entered is :" <<... | ALGO | 0.999102 | 3.447663 |
711a4c36-681f-4b26-9845-d4718a56203c | oscarpilote/LidarTerrainMesh | extern/meshoptimizer/src/indexgenerator.cpp | #include <assert.h>
#include <string.h>
// This work is based on:
// John McDonald, Mark Kilgard. Crack-Free Point-Normal Triangles using Adjacent
// Edge Normals. 2010
namespace meshopt
{
static unsigned int hashUpdate4(unsigned int h, const unsigned char *key,
size_t len)
{
// MurmurHash2
const unsigned int m... | ALGO | 0.986312 | 7.583169 |
96e42e97-a7e0-4c11-891a-29d88fa82b35 | naoki7090624/EquiCube-CUDA | EquiToCube/EquiToCube.cpp | #include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/cudawarping.hpp>
#include <chrono> // for high_resolution_clock
using namespace std;
void startCUDA(cv::cuda::GpuMat& src, cv::cuda::GpuMat& dst, double sqr);
int main(int argc, char** argv)
{
//cv::namedWindow("Original Image", cv::WINDOW_OPENGL ... | TOOL | 0.910225 | 4.977954 |
d50f61be-7be9-406d-af51-b8b5dbacadd7 | mehuloo3/gfg | Difficulty: School/Diagonal sum/diagonal-sum.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution {
public:
int DiagonalSum(vector<vector<int> >& matrix) {
// Code here
int sum1=0,sum2=0;
int n=matrix.size();
int m... | ALGO | 0.999887 | 6.118384 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.