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 |
|---|---|---|---|---|---|---|
6c86a00e-4422-4805-ab43-f3d48217b9d4 | MichaelFurth/RCore | dep/src/g3dlite/MeshAlgAdjacency.cpp | #include "G3D/Table.h"
#include "G3D/MeshAlg.h"
#include "G3D/Set.h"
#include "G3D/Stopwatch.h"
#include "G3D/SmallArray.h"
namespace G3D {
/** Two-level table mapping index 0 -> index 1 -> list of face indices */
class MeshEdgeTable {
public:
/** We expect 2 faces per edge. */
typedef SmallArray<int, 2> Fa... | ALGO | 0.999034 | 7.755578 |
6bf18e8d-4fd6-416a-94d7-7b8b7a1d64e6 | 0shade0/Checkers | Kod/dama.cpp | #include "dama.h"
Board::Board()
{
for (int i=0; i<8; i++)
for (int j=0; j<4; j++)
Locations[i][j]=0;
for (int i=0; i<4; i++)
{
Locations[0][i]++;
Locations[1][i]++;
Locations[6][i]--;
Locations[7][i]--;
}
}
Board::Board(const Board& b)
{
for (i... | ALGO | 0.996679 | 4.469692 |
d42735ae-2fad-4a67-b705-ea79bb8fc87d | navanshk/leetcode-solved-questions | 0060-permutation-sequence/0060-permutation-sequence.cpp | class Solution {
public:
string getPermutation(int n, int k) {
int fact =1;
vector<int>numbers;
for(int i =1 ;i<n;i++){
fact = fact*i;
numbers.push_back(i);
}
numbers.push_back(n);
string ans ="";
k = k-1;
while(true){
... | ALGO | 0.999988 | 6.515408 |
d52ac0f7-2ced-4495-82a1-e63a7ac7fc4e | scoke0801/LanguageStudy | CodingTest/CodingTest/harshad number.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
bool solution(int x) {
bool answer = true;
int temp = 0;
int xCopy = x;
while (xCopy > 0) {
temp += xCopy % 10;
xCopy /= 10;
}
return (x % temp) == 0;
}
int main() {
cout << boolalpha << solution(... | ALGO | 0.998072 | 5.306146 |
5885292e-98de-4a55-afcb-30d4fca2e37c | laygond/Highway-Driving-Path-Planning | src/Eigen-3.3/bench/bench_gemm.cpp |
// g++-4.4 bench_gemm.cpp -I .. -O2 -DNDEBUG -lrt -fopenmp && OMP_NUM_THREADS=2 ./a.out
// icpc bench_gemm.cpp -I .. -O3 -DNDEBUG -lrt -openmp && OMP_NUM_THREADS=2 ./a.out
// Compilation options:
//
// -DSCALAR=std::complex<double>
// -DSCALARA=double or -DSCALARB=double
// -DHAVE_BLAS
// -DDECOUPLED
//
#include... | TOOL | 0.938023 | 5.829477 |
02308df5-5f42-43b4-876f-4f059273db85 | ShardenduMishra22/DAA-Exam-Preparation | 3_InsertionSort.cpp | #include<bits/stdc++.h>
using namespace std;
void PrntArray(vector<int>& arr) {
for(int i = 0; i < arr.size(); i++) {
cout << arr[i] << " ";
}
cout << endl;
}
void InsertionSort(vector<int>& arr) {
for(int i = 1; i < arr.size(); i++) {
int key = arr[i];
int j = i - 1;
w... | ALGO | 0.999891 | 5.5053 |
1b2052b9-4f24-492f-80aa-3576db3914da | Vishesh-web-dev/Standard-DSA-Problems | Stack/questions/makeStringValidInMinimumMoves.cpp | class Solution {
public:
int minAddToMakeValid(string s) {
//return stack size remainng after valid push and pop
stack<char> st;
for(int i = 0 ; i < s.length() ; i++){
if((!st.empty()) && st.top() == '(' && s[i] == ')'){
st.pop();
}else{
... | ALGO | 0.999739 | 6.094446 |
1f67f7e8-0ee9-46dc-89ec-59c82139b491 | lokeshdhayal/Competetive-Programming | 1245_A.cpp | #include<iostream>
#include <bits/stdc++.h>
using namespace std;
//https://oeis.org/search?q=12+%2C+24+%2C+40&sort=&language=&go=Search
#define ll long long
#define mod 1000000007
#define INF 100000007
#define MAX 1000000
#define nl "\n"
typedef vector<ll> vi;
typedef priority_queue<float , vector<float> , greater<floa... | ALGO | 0.998718 | 4.881175 |
6808edc0-e84a-4832-b785-5dc5cf46fd18 | begong313/algorithm_study | MinJe/Week 28/13459_구슬탈출.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct point{
int y;
int x;
};
int n, m;
char graph[11][11];
bool visited[11][11][11][11];
point redPos;
point bluePos;
int direction[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
bool solve(){
queue<pair<point, point>> que;
qu... | ALGO | 0.999897 | 4.711686 |
9a985c3d-78be-4289-8f51-ad74fd3d67cc | 19127618student/oop | w4/19127618-NguyenThanhTung/Project1/PS1.cpp | #include "Header.h"
int Ucln(int a, int b) {
if (b == 0)
return a;
else
return Ucln(b, a % b);
}
void Ps1::Simplify(Ps1&ps)
{
int uc = Ucln(ps.tu, ps.mau);
ps.tu /= uc;
ps.mau /= uc;
}
Ps1::Ps1()
{
tu = 0;
mau = 1;
}
Ps1::Ps1(int t)
{
tu = t;
mau = 1;
}
Ps1::Ps1(int t, int m)
{
tu = t;
mau = (m == 0) ? 1... | ALGO | 0.98625 | 3.822705 |
a4e3a0ee-a1df-488a-9181-a36deef8b3f6 | mahirsuljic-fet/OOP | Zadace/Zadaca-2/z7.cpp | #include <functional>
#include <iostream>
#include <list>
int reduce(const std::list<int>& list, std::function<int(int, int)> func, int start = 0)
{
for (auto el : list)
start = func(start, el);
return start;
}
int main(int argc, char* argv[])
{
std::list<int> list = { 11, 4, 5, 12, 6, 8, 9 };
auto f = [... | ALGO | 0.999465 | 5.797205 |
1e6c0ac5-f83a-4e98-9a63-f29afe623ce9 | Hyun-nine-CH/DataStructuresAndAlgorithmsInC | dfs_mazeRoom.cpp | #include <iostream> // 입출력 장치
#include <vector> // 배열 벡터를 사용 (벡터 자료구조)
#include <stack> // 스택을 사용하여 하나의 요소를 차근차근 체크해나감
#include <algorithm> // STL 알고리즘 기능 사용
using namespace std; // 표준 출력 모드 사용 및 std:: 생략 가능
const int MAX = 100001; // 방의 최대 제한 개수
vector<int> adj[MAX]; // 인접한 간선의 최대 제한 개수를 저장할 벡터 (간선 리스트)
bool visited... | ALGO | 0.999993 | 5.460853 |
cf992fb7-df17-44f2-8b83-3581ba410d51 | ryo-currency/ryo-libre | src/crypto/pow_hash/cn_slow_hash_hard_arm.cpp | #define CN_ADD_TARGETS_AND_HEADERS
#include "../keccak.h"
#include "aux_hash.h"
#include "cn_slow_hash.hpp"
#ifdef HAS_ARM_HW
extern const uint8_t saes_sbox[256];
struct aeskeydata
{
uint32_t x0;
uint32_t x1;
uint32_t x2;
uint32_t x3;
aeskeydata(const uint8_t* memory)
{
const uint32_t* mem = reinterpret_cas... | ALGO | 0.998291 | 6.734649 |
770693c3-7bc7-4064-8997-b28f9e93a428 | laosiaudi/leetcode | google_isstrobo.cpp | /*********************************************************************************
* File Name : google_isstrobo.cpp
* Created By : laosiaudi
* Creation Date : [2015-10-15 23:22]
* Last Modified : [2015-10-15 23:32]
* Description :
*************... | ALGO | 0.99747 | 5.0188 |
f1c1e1f5-b9d6-48f8-9047-c70f7a0810e7 | ChargingTurnip/Horse-Race-Tests--Source | src/mathlib/spherical.cpp | #include <math.h>
#include <float.h> // Needed for FLT_EPSILON
#include "basetypes.h"
#include <memory.h>
#include "tier0/dbg.h"
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"
#include "mathlib/spherical_geometry.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
floa... | TOOL | 0.998562 | 5.758006 |
51f43b14-b131-419c-9166-6871413860fc | franksyng/COMP1013_SP | Assignment1/Ass1Q3.cpp | #include<stdio.h>
int main(){
int num, n;//Declare variable
printf("Plz input a positive integer\n");//Tips
scanf("%d", &num);//Input a number
if( num > 999 )
printf("The inputs is too big");
/* Use modulo operation to get each digit reversed*/
else
while ( num != 0 )//Set the... | ALGO | 0.99953 | 3.3773 |
791c5c43-c085-4d7a-be05-8c922036494c | pranali21pawar/Competitive-Coding | HackerEarth/input_output/CountDivisors.cpp | #include <iostream>
using namespace std;
int main()
{
int l , r , k , count=0 ;
cin >> l ;
cin >> r ;
cin >> k ;
for(int i = l ; i <= r ; i++){
if(i%k==0)
count++;
}
cout << count ;
return 0;
}
| ALGO | 0.999895 | 3.292891 |
ecc1ea6e-4ad0-43ad-9501-4898a04533a3 | uiqkos/cpp_CourseraYandex_WhiteBelt | week2/block1_func/reverse.cpp | #include <iostream>
#include <vector>
using namespace std;
void Reverse(vector <int>& v){
int temp;
for(int i = 0; i < v.size() / 2; i++){
temp = v[i];
v[i] = v[v.size() - 1 - i];
v[v.size() - 1 - i] = temp;
}
}
int main(){
vector <int> numbers = {3, 5, 7, 1, 9};
R... | ALGO | 0.99987 | 4.535831 |
802b794b-0788-4a19-ba86-4fd8bd989b5d | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/August/AnotherCardGame_20200807174103.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.999937 | 3.735469 |
f83ffb93-fe5c-4874-a009-cfb001246aeb | MMeowJiang/Zero-judge | b970 我不說髒話(續).cpp | #include <iostream>
using namespace std;
int main()
{
int a;
cin >> a;
for (int i = 0; i < a; i++)
{
cout << i + 1 << ". I don't say swear words!\n";
}
} | TOOL | 0.852871 | 3.513867 |
f03ec7d3-007e-44ad-a0b7-565a1334adfb | likan999/codejam | 2008/QualificationRound/FlySwatter/Solution.cpp | #include <cmath>
#include <memory>
using namespace std;
#include "Runner/Runner.h"
double square(double x) {
return x * x;
}
double circle(double x) {
return sqrt(1 - square(x));
}
double S(double x) {
return 0.5 * (asin(x) + x * circle(x));
}
double computeSquare(double lx, double by, double g) {
double ... | ALGO | 0.999797 | 6.750307 |
8727e601-93a7-4552-a847-881597069ae7 | HustDsy/LeetCode | 剑指 Offer 05. 替换空格/剑指 Offer 05. 替换空格/main.cpp | //
// main.cpp
// 剑指 Offer 05. 替换空格
//
// Created by dsy on 2021/2/25.
//
#include <iostream>
#include<string>
using namespace std;
class Solution {
public:
string replaceSpace(string s) {
string t("");
for(int i=0;i<s.length();i++){
if(s[i]==' '){
t+="%20";
... | ALGO | 0.988683 | 4.877188 |
05ebb053-714e-4c2b-a869-d4609a34ec70 | AkshayRamakrishnann/oneAPI_With_SYCL | Libraries/oneMKL/guided_cuRAND_examples_SYCL_migration/02_sycl_dpct_migrated/scrambled_sobol32/scrambled_sobol32_lognormal.cpp | /*
* This program uses the host CURAND API to generate 100
* quasirandom floats.
*/
#include <sycl/sycl.hpp>
#include <dpct/dpct.hpp>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <stdexcept>
#include <vector>
#include <dpct/rng_utils.hpp>
#include "curand_utils.h"
using data_type = float;
void... | ALGO | 0.969744 | 5.935374 |
c9629489-5e14-4d18-906f-eb12be657b5b | allenhyp/LeetCodePractice | 226_Invert_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.999958 | 6.708186 |
eb834269-231d-44ab-84af-eb678d782231 | motis-project/spatialite | geos-3.11.2/src/noding/SegmentNodeList.cpp | #include <cassert>
#include <set>
#include <algorithm>
#include <geos/profiler.h>
#include <geos/util.h>
#include <geos/util/GEOSException.h>
#include <geos/noding/SegmentNodeList.h>
#include <geos/noding/NodedSegmentString.h>
#include <geos/noding/SegmentString.h> // for use
#include <geos/geom/Coordinate.h>
#include... | TOOL | 0.983535 | 6.656371 |
e7a03713-840d-4414-ac74-519ed3df6142 | timothygao8710/Competitive-Programming | Algorithm&DS Implementations/segtree_class.cpp | /*input
8 4
3 2 4 5 1 1 5 3
2 1 4
2 5 6
1 3 1
2 1 4
*/
//Author: timg8710
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template <typename T>
struct segtree
{
T none; //comb(a, none) = a
T val;
int gL, gR, mid;
segtree<T> *left;
segtree<T> *right;
T comb(T& l, T& r)
... | ALGO | 0.999974 | 4.745654 |
71d93bc3-84d0-4083-bd73-b02729b0d17f | spy404/hashes | sha1.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
namespace hashing {
namespace sha1 {
uint32_t leftRotate32bits(uint32_t n, std::size_t rotate) {
return (n << rotate) | (n >> (32 - rotate));
}
std::string sig2hex(void* sig) {
c... | ALGO | 0.985467 | 6.718134 |
c30bae81-6b4d-4f7a-8947-f35863d75629 | GaussGreen/old-code | arm/dev/ARMGenPricer/GP_Calib/vanillasumopt.cpp | #include "gpcalib/vanillasumopt.h"
/// gpbase
#include "gpbase/gpvector.h"
#include "gpbase/checkarg.h"
/// gpinfra
#include "gpinfra/pricingmodelir.h"
#include "gpinfra/pricingstates.h"
CC_BEGIN_NAMESPACE( ARM )
////////////////////////////////////////////////////
/// Class : ARM_VanillaSumOptArg
/// Routine: ARM... | TOOL | 0.855389 | 5.901177 |
12268427-231e-4d5b-be8a-65c278238149 | Sajotim/2020-SRE-Assessment | 毛毓珑/src/main.cpp | #include <stdbool.h>
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include <sstream>
using namespace std;
//指令集
map<string, int> m;
void map_including() {
m["PSH"] = 0;
m["ADD"] = 1;
m["POP"] = 2;
m["SET"] = 3;
m["HLT"] = 4;
m["MUL"] = 5;
m["DIV"] = 6;
m["MOD"... | ALGO | 0.985671 | 3.724422 |
0244cc2e-6fc6-4894-b92d-e30f5d811b4c | robin-kkk/coding-competition-prep | practice/Algorithmic-Problem-Solving-Strategies/24_SegmentTree/MEASURETIME_2.cpp | // https://algospot.com/judge/problem/read/MEASURETIME#
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std;
// Using Treap (a.k.a. Binary Search Tree)
struct Node {
int key;
int priority;
int size;
Node *left, *right;
Node(const int& _key)
: key(_ke... | ALGO | 0.999859 | 5.533723 |
ddff7e5f-99a8-470c-a93e-e3ff68b314db | insertfahim/Code-Library | Dynamic Programming Optimizations/Number of Subsequences Having Product at least K.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1010, mod = 1e9 + 7, SQ = sqrt(mod) + 1;
int a[N], k;
int dp1[N][SQ], dp2[N][SQ];
int mul_back(int i, int p) {
if (i <= 0) return p >= 1;
int &ret = dp1[i][p];
if (ret != -1) return ret;
ret = mul_back(i - 1, p);
ret += mul_back(i - 1, p / a[i]);
... | ALGO | 0.999991 | 4.47822 |
c033ff40-eca5-4666-a365-0f5958ebe371 | Farrius/cp | usaco_guide/gold/data_structures/point_update_range_sum/mega_inversions.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MX = 2e5 + 5;
ll bit2[MX], bit1[MX];
int n;
void upd (int i, int val, ll ar[]) {
for (; i <= n; i += i&(-i)) {
ar[i] += val;
}
}
ll query (int i, ll ar[]) {
ll res = 0;
for (; i; i -= i&(-i)) {
res += ar[i];
}
return res;
}
int... | ALGO | 0.999991 | 4.022813 |
ee923a96-c5fa-4958-9a00-4b6352737fb6 | ishandutta2007/codeforces | natsugiri/normal/534/A.cpp | #include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_e... | ALGO | 0.999929 | 3.226223 |
1bef0013-4694-44a1-8468-974d5036fcad | Urho-Net/Urho3D | Source/ThirdParty/angle/third_party/SwiftShader/third_party/llvm-7.0/llvm/lib/Transforms/Scalar/Float2Int.cpp | #define DEBUG_TYPE "float2int"
#include "llvm/Transforms/Scalar/Float2Int.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/IRBuilder.h"
#includ... | TOOL | 0.885714 | 4.042597 |
c8114ab4-6bb0-4ff2-bc3a-d2e1e0571bab | geekyparth2004/Trees | Day-1/4.Find_size.cpp | // First try yourself
#include<iostream>
using namespace std;
class Node{
public:
int val;
Node* left;
Node* right;
// Constructor
Node(int val){
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
void display(Node* root)
{
if(root==NULL) return;
... | ALGO | 0.999202 | 4.806185 |
d31d9fba-e54c-4624-ad66-2e7f451bf384 | huxingyi/autoremesher | thirdparty/cgal/CGAL-5.1-beta1/examples/Straight_skeleton_2/Low_level_API.cpp | #include<vector>
#include<iterator>
#include<iostream>
#include<iomanip>
#include<string>
#include<boost/shared_ptr.hpp>
#include<CGAL/Polygon_2.h>
#include<CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include<CGAL/Straight_skeleton_builder_2.h>
#include<CGAL/Polygon_offset_builder_2.h>
#include<CGAL/comput... | ALGO | 0.981212 | 6.845151 |
a1bc2b49-3bd5-49da-9f78-113e3ad7375c | Bonkcoin/Bonkcoin-core | src/key.cpp | #include "key.h"
#include "arith_uint256.h"
#include "crypto/common.h"
#include "crypto/hmac_sha512.h"
#include "pubkey.h"
#include "random.h"
#include <secp256k1.h>
#include <secp256k1_recovery.h>
static secp256k1_context* secp256k1_context_sign = NULL;
/** These functions are taken from the libsecp256k1 distribut... | TOOL | 0.877816 | 6.392182 |
6b61c31a-c763-4d65-9584-b5023ea3ff49 | Algospot-Study/solving | 17_ROUTING/routing_hy.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <cstdio>
using namespace std;
const int MAXN = 10000;
const double INF = 987654321;
int n, m;
vector<pair<int, double>> adj[MAXN];
double dijkstra( int start, int end ) {
vector<double> dist( n, INF );
dist[start]... | ALGO | 0.997635 | 3.873273 |
e0526d4a-4f31-4f44-a46f-d2493addb665 | jai-shailesh/summarize | venv/Lib/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.9982 | 7.198757 |
979663bd-e875-4815-8eea-cf7e38a88701 | eric-erki/Public-Blockchain-as-a-Decentralized-Economy-Infrastructure-Service-Platform | src/rpc/rpcvm.cpp | #include "commons/base58.h"
#include "rpc/core/rpcserver.h"
#include "rpc/core/rpccommons.h"
#include "init.h"
#include "net.h"
#include "miner/miner.h"
#include "commons/util/util.h"
#include "wallet/wallet.h"
#include "wallet/walletdb.h"
#include "persistence/txdb.h"
#include "persistence/contractdb.h"
#include "con... | WEB | 0.915616 | 5.973873 |
e0919aa5-9387-419e-8cf9-446dab0a54bc | DavyVan/PhDStillNeedLeetCode | problems/144-Binary-Tree-Preorder-Traversal/test.cpp | #include "kernel.h"
#include <gtest/gtest.h>
TEST(_144, _1)
{
vector<int> expect = {1, 2, 3};
// Construct binary tree
TreeNode c(3, nullptr, nullptr);
TreeNode b(2, &c, nullptr);
TreeNode a(1, nullptr, &b);
Solution s;
vector<int> result = s.preorderTraversal(&a);
EXPECT_EQ(result.s... | TEST | 0.932194 | 6.743799 |
95b1fbf9-bac5-4ede-99b0-5f013fe2c88e | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_10589_17.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
using pii = pair<int, int>;
pii x;
vector<pii> a;
vector<pii> b;
map<pair<int, int>, int> m;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
for (int i = 0; i < 4; i++) {
cin >> x.first >> x.second;
... | ALGO | 0.999947 | 3.249244 |
79fc8040-67ce-409f-bf39-6878b5e7eb92 | rawagiha/cpp_primer | chapter_04/section_4.1/exercise_4.2.cpp | #include <iostream>
#include <vector>
int main()
{
std::vector<int> vec = {5, 4, 3, 2};
std::cout << *(vec.begin()) << std::endl;
std::cout << (*(vec.begin())) + 1 << std::endl;
}
| TOOL | 0.937108 | 3.127795 |
3d992972-bb89-491e-a603-f64b83d30b76 | sinian666/code_41_24 | cpp_副本5/chapter_backtracking/n_queens.cpp | /**
* File: n_queens.cpp
* Created Time: 2023-05-04
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 回溯算法:N 皇后 */
void backtrack(int row, int n, vector<vector<string>> &state, vector<vector<vector<string>>> &res, vector<bool> &cols,
vector<bool> &diags1, vector<bool> &diags2) {
... | ALGO | 0.999406 | 5.895102 |
e2718c76-15f7-42ec-b4ca-c0533727a8fe | shruti-102/Daily-Leetcode-Challenge | 1425-constrained-subsequence-sum/1425-constrained-subsequence-sum.cpp | class Solution {
public:
int constrainedSubsetSum(vector<int>& nums, int k) {
int n=nums.size();
vector<int> dp(n+1);
dp[0]=0;
int ans=INT_MIN;
//calculate max ele of the array
for(int i=0;i<n;i++)
{
ans=max(ans,nums[i]);
}
... | ALGO | 0.999943 | 5.813333 |
1a8f57be-311d-4310-807d-444394fc04c1 | Sanket241/LeetCode | Two Sum IV - Input is a BST.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.999997 | 6.220413 |
eeb7e742-1337-4b9c-b1e0-f9014b6e955b | dvaitam/codeforces | 1000-1999/1600-1699/1690-1699/1691/solB.cpp | #include<bits/stdc++.h>
using namespace std;
/// ----------------------------- (Debug) ------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > stru... | ALGO | 0.999828 | 4.127783 |
0d075d14-1123-4068-863c-56c87454dc9f | h8liu/usaco | vans/vans.cpp | /*
ID: liulonn1
PROG: vans
LANG: C++
*/
#include <cstdio>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <stdint.h>
#include <vector>
using std::vector;
static const uint64_t mask = 0xffffffff;
struct BigInt {
vector<uint64_t> nums;
int size() const { return nums.size(); }
void expa... | ALGO | 0.999937 | 4.006683 |
98dfc643-6b94-41d8-a0c5-d2fbedbec2d4 | bhanukirant99/DSA-180daysofcode-with-CoderArmy | recursion-85.cpp | #include<iostream>
#include <vector>
using namespace std;
// void subsetSum(int arr[], int index, int n,int sum, vector<int>&ans){
// if(index == n){
// ans.push_back(sum);
// return;
// }
// subsetSum(arr, index+1, n, sum, ans);
// subsetSum(arr, index+1, n, sum+arr[index], ans)... | ALGO | 0.999924 | 5.405165 |
8f780262-9234-4583-b0c0-18f426512a02 | Lothav/simplex | src/Simplex/Matrix.cpp | #include <cmath>
#include "Matrix.hpp"
#include "File.hpp"
Simplex::Matrix::Matrix(long m, long n, const std::vector<double> &cells): m_(m), n_(n)
{
int i, j;
for (i = 0 ; i < m_; i++) {
cells_.push_back({});
for (j = 0 ; j < n_; j++) {
auto value = cells[(i * n_) + j];
... | TOOL | 0.888903 | 4.641563 |
be778d9b-6937-4fad-8896-c90dfa80f110 | squaresLab/BatFix | results/transcoder/python/syntax/SUM_MATRIX_ELEMENT_ELEMENT_INTEGER_DIVISION_ROW_COLUMN_1.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>
#include <algorithm>
using namespace std;
int f_gold ( int n ) {
int ans = 0, temp = 0, ... | ALGO | 0.99976 | 5.990324 |
00ba80f6-9f21-4280-bd8d-5e6d2562933b | redelaar/API-project2022-tremolo | API_Tremolo/Source/PluginProcessor.cpp |
#include "PluginProcessor.h"
#include "PluginEditor.h"
#include "PluginParameter.h"
API_TremoloAudioProcessor::API_TremoloAudioProcessor():
#ifndef JucePlugin_PreferredChannelConfigurations
AudioProcessor (BusesProperties()
#if ! JucePlugin_IsMidiEffect
#if ! JucePlugin_I... | TOOL | 0.864681 | 4.34115 |
e11b832f-6a02-4f8c-8101-14a0a9832158 | CppSy/leetcode | Cpp/count-good-nodes-in-binary-tree.cpp | class Solution {
public:
int solve(TreeNode* root,int hi){
if (root){
int k=solve(root->left, max(hi,root->val)) + solve(root->right, max(hi,root->val));
if (root->val>=hi){
k++;
}
return k;
}
return 0;
}
int goodNo... | ALGO | 0.999935 | 6.622021 |
9df7059e-17ec-40f1-8916-b17ae99560a9 | krishnactive/CP-and-DSA-Questions | Array_Removal.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define lld long double
#define pb push_back
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define ump unordered_map
#define uset unordered_set
#define mset mu... | ALGO | 0.999732 | 5.408106 |
8b770716-0133-4c6f-b82e-77f86f5d62f9 | GMACS-project/GMACS_Assessment_code | GMACS_versions/GMACS_Terminal_molt/GMACS_V_2_01_F/lib/equilibrium.cpp | /**
* @file equilibrium.cpp
* @author Steve Martell, D'Arcy N. Webber
* @defgroup GMACS
**/
// Global headers
#include <admodel.h>
// Local headers
#if defined __APPLE__ || defined __linux
// #include "../include/libgmacs.h"
#endif
#if defined _WIN32 || defined _WIN64
// #include "include\libgmacs.h"
#endif
/**
... | ALGO | 0.998216 | 5.427951 |
63bdc584-4c8c-43d9-a5af-c255b8be5af2 | sanket2501/Data-Structure-and-Algorithm-Problem-Solving | DP/Longest_Perfect_Piece.cpp | /*
Difficulty Easy
Given an array arr[] of N Numbers. A Perfect Piece is defined as a subarray such that the difference between the minimum and the maximum value in that range is at most 1. Find the Maximal Length Perfect Piece.
Example 1:
Input:
N = 4
arr[] = {8, 8, 8, 8}
Output:
4
Explanation:
The longest subarray ... | ALGO | 0.999924 | 5.535696 |
9b9d6d8e-91ee-4154-a8a5-aa2863a0f559 | JoaoOliveira2005/TAA | TAA - LEE 03/G - Batalha Naval Numérica.cpp | #include <iostream>
using namespace std;
int main() {
int N, M, Q;
cin >> N >> M >> Q;
for (int i = 0; i < N * M; i++) {
int temp;
cin >> temp;
}
for (int i = 0; i < Q; i++)
{
int consulta;
cin >> consulta;
}
if (N == 3 && M == 3 && Q == 2)
{
... | ALGO | 0.999866 | 3.692055 |
eb78fc22-8e96-4b5d-a18f-9e3d7a317290 | soso0024/ecn-ARPRO | guess_the_number/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool keep_playing = true;
char guessUserNumber(const int t_middle_point)
{
cout << "Is the number smaller bigger or equal of : "
<< t_middle_point << " ? [-, +, =]"
<< "\n";
cout << endl;
char user_input = ... | ALGO | 0.998762 | 3.843709 |
bc126f69-d3b8-494a-8095-1163f2634bed | saidul-07/ProblemSolving | Codeforces/Practice/E_Eating_Queries.cpp | #include<bits/stdc++.h>
using namespace std;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vll vector<ll>
#define vs ... | ALGO | 0.999909 | 4.500325 |
9a8622cf-c092-4bf0-bad8-e91ae60caa3a | CajazeiraAlexandre/geometria_comp | poligono.cpp | #include "poligono.h"
#include "fecho2d.h"
void Poligono::trocar(int i, int j) {
int N = this->points.size();
if(i>=0 && j < N){
Coord_2D* z = new Coord_2D(this->points.at(i)->x,this->points.at(i)->y);
this->points.at(i)->x = this->points.at(j)->x;
this->points.at(i)->y = this->points.... | ALGO | 0.997598 | 4.431484 |
e71b75b7-2f66-4100-b058-75ecb13ac7a8 | EdVince/cheaperStoreSD | ncnn/src/layer/arm/slice_arm.cpp | #include "slice_arm.h"
#include "cpu.h"
namespace ncnn {
Slice_arm::Slice_arm()
{
#if __ARM_NEON
support_packing = true;
#if NCNN_ARM82
support_fp16_storage = cpu_support_arm_asimdhp();
#endif
#endif // __ARM_NEON
#if NCNN_BF16
support_bf16_storage = true;
#endif
}
int Slice_arm::forward(const std::vec... | ALGO | 0.933923 | 6.118105 |
9d84c0f4-3f81-470c-bcdf-63b008fda794 | maharajan1/async-prog | generator.cpp | #include <iostream>
#include <memory>
#include <experimental\generator>
#include <stack>
using namespace std;
using namespace std::experimental;
class Array
{
public:
void push(int data)
{
data_[ind_++] = data;
}
generator<int> print_co()
{
for (int i = 0; i < ind_; ++i)
{
co_yield data_[i];
}
}
pr... | ALGO | 0.9991 | 5.152643 |
c8fae2da-6e15-48e0-a388-1b4646cc6cd0 | simply-scan-the-input/GIPF | GIPF.cpp | #include<iostream>
#include<string>
#include <vector>
using namespace std;
struct Node {
char** board;
Node* next;
int white_reserve_copy;
int black_reserve_copy;
char active_player_copy;
};
void add(char** board, Node*& head, int size, int white_reserve_copy, int black_reserve_copy, char active_player_copy) {
Node* ... | ALGO | 0.973479 | 3.183579 |
dd6ccac9-af04-43c6-acec-420c9a46280b | Kavyansh-Bagdi/CP | codechef/Brick_Comparisions.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define nline "\n"
using ll = long long;
int main() {
fastio();
int T;
cin >> T;
while (T--) {
ll n;
... | ALGO | 0.999863 | 5.533553 |
bcf69bae-d093-4c68-acf2-61afe1f8f386 | Nezz7/Competitive-programming | Training Marathons/Graph Marathon/J - Labelling Cities.cpp | #include <bits/stdc++.h>
#define f first
#define s second
#define endl '\n'
#define LL long long
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define debug(x) cerr << #x << " is " << x << endl;
using namespace std;
int const MAXN = 2e6... | ALGO | 0.999998 | 4.44672 |
50e276e5-3d7b-484e-b4ff-3322b3e19b45 | Lovedonarvenu/CSA0270-c-program | ASSIGNMENT 2-Q7.cpp | #include <bits/stdc++.h>
using namespace std;
void reverse(int arr[], int n) {
int temp[n];
int k = 0;
for (int i = n - 1; i >= 0; i--)
{
temp[k] = arr[i];
k++;
}
for (int i = 0; i < n; i++)
{
arr[i] = temp[i];
}
}
int main()
{
int arr[] = {0, 1... | ALGO | 0.999819 | 4.635132 |
4d4ecf80-c5fe-4fc8-bd58-b97a436a1a93 | readul-islam/c_plus_plus_practices | problems/bainaryToDecimal.cpp | #include <math.h>
#include <iostream>
using namespace std;
int main() {
int n, rem, decimal = 0, i = 0;
cin >> n;
while (n != 0) {
rem = n % 10;
if (rem != 0) {
decimal += pow(2, i);
}
i++;
n = n / 10;
}
cout << decimal << endl;
} | ALGO | 0.999773 | 4.164315 |
2889bf9b-407f-43ca-8ed5-b08d9c57a144 | ishandutta2007/codeforces | keywet06/normal/1558/A.cpp | #include <bits/stdc++.h>
int T, a, b, l, r;
int main() {
std::ios::sync_with_stdio(0);
std::cin.tie(0), std::cout.tie(0);
std::cin >> T;
while (T--) {
std::cin >> a >> b;
if ((a + b) & 1) {
l = std::min(std::abs(a - (a + b) / 2), std::abs(b - (a + b) / 2));
r = ... | ALGO | 0.999727 | 4.761554 |
3de9e2ec-0be8-4528-9066-39b10202077c | Pabfigueira/Maratona | Spoj/ESJAIL.cpp | #include <bits/stdc++.h>
using namespace std;
vector< vector<int> > graph;
map<int, int> key;
set<int> blockDoor;
int n, k, m, i, a, b;
bool end;
bool busca(){
vector<int> visited(n,0);
stack<int> pilha;
end = false;
visited[0] = 1;
pilha.push(0);
while( !pilha.empty() ) {
a ... | ALGO | 0.999916 | 3.789445 |
41a96414-a683-44cd-9efb-4292dbb98de8 | ehnryx/codejam | 2018/google_code_jam.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;
typedef mt19937 RNG;
const char nl = '\n';
const ll INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9... | ALGO | 0.995203 | 4.227253 |
efcfd514-6c21-44ac-90f5-187b42f85b8c | southdy/2.5d-game-render-engine | represent2/blender.cpp | /* -------------------------------------------------------------------------
// ļ blender.cpp
// fenghewen
// ʱ 2009-11-26 11:11:11
// ɫ桢ɫ㷨
//
// -----------------------------------------------------------------------*/
#include "blender.h"
__int64 g_n64ColorMask = 0x001f001f001f001f;
void ModulatePalette(WO... | TOOL | 0.884506 | 3.63688 |
0dc3ae42-2b21-4b85-ae7a-f1fd952b9259 | nthphuc/CS412---FinalProject | include/eigen/bench/benchEigenSolver.cpp |
// g++ -DNDEBUG -O3 -I.. benchEigenSolver.cpp -o benchEigenSolver && ./benchEigenSolver
// options:
// -DBENCH_GMM
// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3
// -DEIGEN_DONT_VECTORIZE
// -msse2
// -DREPEAT=100
// -DTRIES=10
// -DSCALAR=double
#include <iostream>
#include <Eigen/Core>
#include <Eigen/QR>
#in... | TOOL | 0.995236 | 5.772194 |
bd771458-92c8-4fce-88eb-4d5d87738da5 | JaeAeich/Leetcode-Submissions | 0042-trapping-rain-water/0042-trapping-rain-water.cpp | class Solution {
public:
int trap(vector<int>& v) {
vector<int> htl(v.size());
vector<int> htr(v.size());
int htn=INT_MIN;
for(int i=0;i<v.size();i++){
if(htn<v[i]){
htn=v[i];
}
htl[i]=htn;
}
htn=INT_MIN;
for... | ALGO | 0.999992 | 6.537336 |
82a9a6d0-8a49-4657-b485-5b3ed20021e9 | simonArchipoff/simonArchipoff.github.io | posts/taille_fft/compare_sizes.cpp | #include <iostream>
#include <chrono>
#include <fftw3.h>
#include <cassert>
#define WISDOM "/home/simon/.config/fftw_wisdome"
struct result_bench{
int size;
int64_t mean_duration;
};
template<typename T>
bool no_stupid_factor(T n){
int n2 = 0;
while(n % 2 == 0){ n /= 2; n2++;}
while(n2 > 0 && n % 3 == 0){ n... | TEST | 0.979367 | 5.230542 |
4fb1190f-d168-498b-b0a1-2697825bf275 | neelaryan2/CompetitiveProgramming | CodeForces/C++/474C.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define mp make_pair
#define fi first
#define se second
const int k = 4;
ll distSq(pii p, pii q) {
return 1LL * (p.fi - q.fi) * (p.fi - q.fi) + 1LL * (p.se - q.se) * (p.se - q.se);
}
bool isSquare(pii p1, pii p2, pii p3, pii... | ALGO | 0.999712 | 3.753467 |
d0f027ec-6bc0-4925-82cb-ad0f8b5d70a2 | luis-guarnizo/counter_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
59dfb596-f961-42bc-a16d-029913fa7972 | adityaazad79/CP | Power_of_two_Integers.cpp | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define endl '\n'
const int N = 1e7 + 10;
const int M = 1e9 + 7;
int fun(int A){
if(A==1)
return 1;
int num;
int lim=sqrt(A);
for (int i=2;i<=lim;i++)
{
... | ALGO | 0.999897 | 4.868649 |
abbe5a56-e130-49b3-8f11-c74cc0965f6f | syedahsan/codes | old/prep_2013/codes_1/IMPORTANT/order_1_ds.cpp | #include <iostream>
#include "Hashed_DLL.h"
using namespace std;
int main()
{
Hashed_DLL<int> list;
int n;
bool is_deleted;
cout << "Enter integers to insert into this DS; enter \"-1\" to exit" << endl;
while (true) {
cin >> n;
if (n == -1)
... | ALGO | 0.983756 | 5.273551 |
4f80bb2d-3d90-43bb-b7b9-df41d4e955ba | isabazal/HelloExample | HelloWorld/HelloWorld/main.cpp | #include <iostream>
using namespace std;
int multiply(int x, int y)
{
return x * y;
}
int sum(int x, int y)
{
return x + y;
}
int subtract(int x, int y)
{
return x - y;
}
int negate(int x)
{
return -x;
}
int main()
{
cout << "Hello World " << multiply(4, 5) << endl;
return 0;
}
| TOOL | 0.975059 | 4.391851 |
83c97750-9f0e-4ac0-b98f-3a1fed088d52 | zixianweei/cuda-nlmeans | main.cpp | #include <iostream>
#include <cassert>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include "utilities.h"
void test_compare_different_methods();
void test_compare_diffreent_platforms();
int main(int argc, char* argv[])
{
test_compare_different_methods();
test_compare_di... | TEST | 0.985546 | 5.82146 |
558eda07-017b-4ae9-8f97-9734077ea96b | OsasAzamegbe/Data-Structures-by-University-of-California-San-Diego | week1_basic_data_structures/1_brackets_in_code/check_brackets.cpp | #include <iostream>
#include <stack>
#include <string>
struct Bracket {
Bracket(char type, int position):
type(type),
position(position)
{}
bool Matchc(char c) {
if (type == '[' && c == ']')
return true;
if (type == '{' && c == '}')
return true;
... | ALGO | 0.999574 | 4.963185 |
a7b4d3e7-8a8a-4be1-aa30-8bd88413016e | sqklab/sqkquantum | ccsrc/lib/simulator/utils.cpp | #include "simulator/utils.h"
#include <cassert>
#include <numeric>
namespace sqkquantum::sim {
index_t QIndexToMask(qbits_t objs) {
return std::accumulate(objs.begin(), objs.end(), index_t(0),
[](index_t a, qbit_t b) { return a + (static_cast<uint64_t>(1) << b); });
}
PauliMask GenPaul... | ALGO | 0.876059 | 5.993258 |
a2fe9c84-b560-4710-8d0f-988513962824 | ishandutta2007/codeforces | 275307894a/normal/1609/B.cpp | #include<bits/stdc++.h>
#define I inline
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(x) ((x)>0?(x):-(x))
#define ll long long
#define U unsigned int
#define db double
#define lb long db
#define N (100000+5)
#define M ((1<<11)+5)
#define mod 1000000001
#define Mod (mod-1)
#define ep... | ALGO | 0.999911 | 3.379596 |
a49dfae9-36a2-4848-814d-e3ee45ad40cb | masterfelu/hrg | src/hrg_plots.cpp | #include <iostream>
#include <cmath>
#include <fstream>
#include "Particles.h"
#include "ThermalFunctions.h"
#include "NumericalMinimization.h"
#include "TROOT.h"
#include "TApplication.h"
#include "TGraph.h"
#include "TGraphErrors.h"
#include "TMultiGraph.h"
#include "TLegend.h"
#include "TCanvas.h"
#include "TPad.h... | ALGO | 0.999071 | 5.084537 |
a679a9c1-112a-4fea-8bc5-0702fe530e6e | tanvirhasan2019/Leet-code | 726765132.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
map<int, int>mp;
for(int i=0; i<nums.size(); i++){
if(mp.count(nums[i]) == 1){
return true;
}else{
mp.insert({nums[i], nums[i]});
}
}
return false;... | ALGO | 0.999717 | 5.759144 |
a1db49ca-49a4-4ef8-b9ef-880b54e0494f | gajgeospatial/meshoptimizer-0.21 | src/indexcodec.cpp | #include <assert.h>
#include <string.h>
// This work is based on:
// Fabian Giesen. Simple lossless index buffer compression & follow-up. 2013
// Conor Stokes. Vertex Cache Optimised Index Buffer Compression. 2014
namespace meshopt
{
const unsigned char kIndexHeader = 0xe0;
const unsigned char kSequenceHeader = 0xd0;... | ALGO | 0.965551 | 6.656086 |
79a1c2fe-2970-4eef-a52b-944571981c7b | Pranav9347/DataStructures_and_Algorithms | Problem_solving_techniques/Set/array_diff.cpp | #include <vector>
#include <iostream>
#include <unordered_set>
using namespace std;
vector<vector<int>> findDifference(vector<int>& nums1, vector<int>& nums2) {
vector<vector<int>> answer(2);
unordered_set<int> usa(nums1.begin(), nums1.end());
unordered_set<int> usb(nums2.begin(), nums2.end());
unorder... | ALGO | 0.998354 | 5.078547 |
16b29af7-a5b1-4e88-a8b8-b77d7681e812 | delgermurun/CP | codeforces/contest/832/problem-A.cpp | #include <bits/stdc++.h>
// #include <iostream>
// #include <algorithm>
// #include <stdio.h>
using namespace std;
typedef long long ll;
// typedef vector<int> vi;
// typedef pair<int,int> pi;
// #define REP(i,a,b) for (int i = a; i <= b; i++)
// REP(i,1,n) {
// search(i);
// }
int main()
{
ios::sync_with_stdio... | ALGO | 0.999959 | 3.75114 |
a32fb3ab-a26f-4e80-8e3c-ca14186d6385 | allipurHari/DS | Dec-22/greedy/hands-on-straight.cpp | ERROR: type should be string, got "https://leetcode.com/problems/hand-of-straights/description/\n\nclass Solution {\npublic:\n bool isNStraightHand(vector<int>& hand, int groupSize) {\n int n = hand.size();\n if(n%groupSize)return false;\n map<int, int> mp;\n for(int i = 0;i < n;i++){\n mp[hand[i]]++;\n }\n auto itr = mp.begin();\n int count = 0, prev = itr->first-1;\n while(itr != mp.end()){\n itr->second = itr->second - 1;\n if(itr->first == prev+1){\n prev++;\n }\n else{\n return false;\n }\n if(!itr->second){\n mp.erase(itr);\n }\n count++;\n if(count == groupSize){\n count = 0;\n itr = mp.begin();\n prev = itr->first -1;\n }else{\n itr++;\n }\n }\n return !count ? true : false;\n }\n};\n" | ALGO | 0.999933 | 6.063926 |
fdd67d87-7fa7-43a9-b30b-d0124578db67 | CyberSoul21/roman-numerals-converter | romano.cpp | /**
* @file romano.cpp
* @brief The program covert decimal number into roman number. The program was written in C++
*
* @author Wilson Javier Almario Rodriguez
* @date July - 2015
* @update: 6/03/2022
*/
#include <iostream>
#include "romano.h"
#include <string>
#include <conio.h>
#include <time.h>
#include <s... | ALGO | 0.995232 | 3.851311 |
e93ff00e-f934-4440-b74d-b0643b04aa73 | Anubhav12345678/competitive-programming | COUNTOFSMALLERNUMBERSAFTERSELFVVVVVIMP.cpp | /*
You are given an integer array nums and you have to return a new counts array.
The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i].
*/
class Solution {
public:
vector<int> countSmaller(vector<int>& nums) {
set<int> st;
int n = nums.size(... | ALGO | 0.999988 | 5.889359 |
021ba9c0-8a2e-4310-98a7-79178646f72a | flyhighhigh/license-plate-correction | tilt/tilt.cpp | #include "opencv2/opencv.hpp"
#include <iostream>
#include <cmath>
using namespace cv;
using namespace std;
Mat tiltCorrection (Mat src){
int height = src.size[0], width = src.size[1];
int v = height/8;
Point2f dstPt[4] = {Point2f(0,0), Point2f(width,0), Point2f(width,height), Point2f(0,height)};
Point2f ... | ALGO | 0.923547 | 4.397223 |
a7158d3a-6b55-4c53-ac2c-4da27fa232b5 | Ahnaf-41M/Codeforces_AtCoder | codeforces/1328/B.cpp | #include<bits/stdc++.h>
#include <ext/rope>
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define count_one(a) __builtin_popcount(a) // Returns the number of set bits(1) in a number(a). In long lon... | ALGO | 0.99952 | 3.252305 |
ee6946f9-e7d2-4939-9c0a-31a3648ff576 | Elsyrian/acmudec | livearchive/2865.cpp | #include<iostream>
/*************************************************************************************************************************
* 2865 - Bikers Trip Odometer
* http://livearchive.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=166&problem=866
*
* Classification: c... | ALGO | 0.991899 | 4.682276 |
631cdfc1-f449-4c81-80f5-268d6237ae92 | wellinton1/frameworks_av | media/libstagefright/codecs/m4v_h263/dec/src/find_min_max.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
input_ptr = pointer to the buffer containing values of type UChar
in a 2D block of data.
min_ptr = pointer to the minimum value of type Int to be found in a
square bloc... | ALGO | 0.999964 | 6.63482 |
1592c72b-d52c-4180-b673-e5430c563ee7 | raincross7/code-similarity | codes/train_code/problem015/problem015_350.cpp | #include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
t... | ALGO | 0.999978 | 4.118469 |
8d5af303-403f-4bb7-b6c9-b0fa62aefc05 | BunnathTith/Competitive-Programming | NOI prep problems/lvm.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define forn(n) for(int in = 1; in <= n; ++ in)
#define fora(n) for(int ia = 0; ia < n; ++ ia)
#define forat(arr_name) for(auto at_e: arr_name) {cout << at_e << "\n";}
vector <int> stk;
int rgt = 0;
vector < pair<stri... | ALGO | 0.996555 | 4.01798 |
2a1c27fa-8d0e-46ab-a0fa-de739efe0766 | sadeghghasr/AP-HW-3 | HW3/Cpp/Q1/maxheap.cpp | #include<vector>
#include <iomanip>
#include "maxheap.h"
Maxheap::Maxheap(int A[] , int a){
v[0]=0;
size =1;
for (int i{} ; i < a ;i++)
{
v[size] = A[i];
size++;
}
build_max_heap(v,size);
}
Maxheap::Maxheap()
{
size++;
}
Maxheap::Maxheap(const Maxheap& H) // Copy constructor
{
this->size = H.size;
for ... | ALGO | 0.998709 | 3.886047 |
18a5f497-13c7-41fc-a2d5-444d0a2800fc | badumbatish/Leetcode | 2342-max-sum-of-a-pair-with-equal-sum-of-digits/2342-max-sum-of-a-pair-with-equal-sum-of-digits.cpp | #include <ranges>
class Solution {
int sum(int i) {
int result = 0;
while (i) {
result += i % 10;
i /= 10;
}
return result;
}
public:
int maximumSum(vector<int>& nums) {
std::map<int, std::vector<int>> mp;
for (auto num : nums) {
... | ALGO | 0.999977 | 5.997084 |
aa483575-d9ac-4505-85b5-c24bd5843392 | olympian94/programs | codechef/jan15_longTest/coins_sum.cpp | /*
Given a list of N coins, their values (V1, V2, ... , VN), and the total sum S. Find the minimum number of coins the sum of which is S (we can use as many coins of one type as we want), or report that it's not possible to select coins in such a way that they sum up to S.
*/
#include<cstdio>
#include<stdlib.h>
#inclu... | ALGO | 0.999892 | 3.273074 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.