uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5008c6db-bd6d-4d1d-a412-07d414e29555 | SwapnilPatil77-75/Cpp-Data-Structure-and-algorithm | Binary Trees/Assingment_Q_4.cpp | #include<iostream>
#include<vector>
using namespace std;
class Node{
public:
Node* left;
Node* right;
int data;
Node(int data){
this->data = data;
left = NULL;
right = NULL;
}
};
static int inx = -1;
Node* buildTree(vector<int> nodes){
inx++;
if(nodes[inx] == -1){... | ALGO | 0.999989 | 4.957548 |
db66a517-b0fb-4f4e-bf47-6e5d0c6632a8 | WevtonZ/Sports-Programming | Problems/Graphs/2-SAT/Giant Pizza.cpp | // https://cses.fi/problemset/task/1684
#include <bits/stdc++.h>
using namespace std;
struct SAT{
int nodes;
vector<vector<int>> adj, r_adj;
vector<bool> vis;
vector<int> comp, order;
vector<bool> ans;
SAT(int n){
this->nodes = 2*n+1;
adj.resize(nodes);
r_adj.resize(nodes);
comp.assign(nodes, 0);
a... | ALGO | 0.999988 | 5.067459 |
30a17a59-b6f0-4d83-ad90-f0882d0136c6 | Amitkr-2004/CPP | CP/Constructive/Fix_You.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t-->0){
int n,m;
cin>>n>>m;
vector<vector<char>> v(n,vector<char> (m));
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>v[i][j];
}
}
int co... | ALGO | 0.999656 | 4.299963 |
37304489-1f1a-4bfb-8ae7-5bba54af1c84 | LuvKobe/StudyCode-2023 | Code_02_28/bitset12.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
using namespace std;
// Nλλͼ
template<size_t N>
class BitSet
{
public:
// 캯
BitSet()
{
// +1֤㹻ıλ˷8
_bits.resize(N / 8 + 1, 0);
}
// ָλxӳλdz1
void set(size_t x)
{
// xӳıλڵڼchar
size_t i = x / 8;
// xcharڼλ
size_t j = x % 8;
... | ALGO | 0.97722 | 4.922147 |
fa4d6501-86f5-421c-96fd-bc7a8cea80d9 | itohdak/AtCoder | others/Indeed/D.cpp | #include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)
using namespace std;
#define ll long long
ll gcd(ll x, ll y) {
if(x > y)
return gcd(y, x);
else if(x == 0)
return y;
else
return gcd(y % x, x);
}
in... | ALGO | 0.999902 | 3.604622 |
27b724a1-5085-435a-bf27-1604cda2961e | Selin-Yigit/testing_provider_project | 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 |
f473a2d6-b11a-464e-b7b5-fe909135b277 | GabrielCFormiga/Competitive-Programming | Constests/I SBC São Paulo Programming Marathon/E_Enhancing_25_de_Março_deliveries.cpp | // WA 33
/**
* @file ee.cpp
*
* Created on 2025-06-10 at 17:11:37
* @author GabrielCampelo
*/
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef unsigned long long... | ALGO | 0.999965 | 3.895124 |
910d6070-4d7b-46ee-bce1-c71f4bebd880 | kyeah/Cloth-Fluids-Solver | cloth/eigen_3.2.2/bench/sparse_trisolver.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL
// -I /home/gael/Coding/LinearAlgebra/CSparse/... | ALGO | 0.99761 | 4.874496 |
0535f884-4f0b-46a4-ba7a-3367626f15bc | squaresLab/BatFix | results/transcoder/translations/java/SWAP_TWO_NIBBLES_BYTE.cpp | int swapNibbles ( int x ) {
return ( ( x & 0x0F ) << 4 | ( x & 0xF0 ) >> 4 ) ;
}
| TOOL | 0.915248 | 4.518924 |
c0e42412-2bc6-4e5c-9a6c-22b3eba199ac | sseleman95/COJ | c++/1493 - Geometrical Task II.cpp | #include <cstdlib>
#include <iostream>
#include <string.h>
#include <stdio.h>
#define PI 3.14
using namespace std;
string s;
double a, b;
int main()
{
cin >> s;
if (s == "circle")
{
cin >> a;
printf("%.2f\n", PI * (a * a));
}
if (s == "triangle")
{
cin >> a >> b;
printf("%.2f\n", (a * b)... | ALGO | 0.991 | 3.387979 |
d38a54fe-5766-4f9f-b662-c8bc68dafa8c | officialABHI1/Graphs-DSA | Graph Traversal/AdjacencyMatrix.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long int;
int main(){
ll n,a,b,maxm = INT_MIN;
cin>>n;
vector<vector<ll>> adjM(n+1, vector<ll>(n+1, 0));
for(int i=0;i<n;i++){
cin>>a>>b;
maxm = max(maxm,max(a,b));
adjM[a][b]=1;
adjM[b... | ALGO | 0.999951 | 3.718747 |
df929949-522f-4142-b9b8-67b532ff71f0 | XDEv11/Codeforces | Round#741_div2/D1.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
class SGT {
int n;
vector<long long> t; // tree
int left(int tv) { return tv + 1; } // left child of tv
int right(int tv, int tl, int tm) { return tv + 2 * (tm - tl); }
void modify(int p, long long x, int tv, int tl, int tr) {
if (t... | ALGO | 0.999961 | 4.48516 |
a8d12416-f757-4f82-9a65-04a992832565 | ImranSarkerWeb/c-plus-plus | travarsing_linked_list.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *next;
Node(int val)
{
this->val = val;
this->next = NULL;
}
};
void create_linked_list(Node *&head, int val)
{
Node *newNode = new Node(val);
Node *temp = head;
if (head == NULL)
{
... | ALGO | 0.999553 | 4.961951 |
76496643-bcf5-4eee-ab46-1ed67224075c | qcri/data_civilizer_system | apis/rest/services/pkduck_service/code/Solver/Solver.cpp | //
// Created by Wenbo Tao on 12/26/16.
//
#include "Solver.h"
#include "../RuleGenerator/FastLCS.h"
#include "../Joiner/BruteForceJoiner.h"
#include "../Joiner/PolynomialJoiner.h"
#include "../RuleGenerator/MyRule.h"
#include "../RuleGenerator/BadBoy.h"
#include "../RuleGenerator/WildLCS.h"
#include "../RuleGenerator... | ALGO | 0.984475 | 4.643597 |
a2819388-910b-4d48-8e15-9798d943c610 | txgcwm/code_study | cplusplus/boost/boost_1_63_0/libs/spirit/classic/phoenix/example/fundamental/sample3.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include <boost/spirit/include/phoenix1_functions.hpp>
#include <boost/spirit/include/phoenix1_primitives.hpp>
using namespace std;
using namespace phoenix;
struct is_odd_ {
template <typename ArgT>
struct result { typedef bool type; };
template... | ALGO | 0.994772 | 5.420149 |
e78d9579-d02b-4a33-952a-c7366687490d | xxpcb/PnP-Camera | ConsoleApplication1/eigen/doc/examples/DenseBase_middleRows_int.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(2..3,:) =\n" << A.middleRows(2,2) << endl;
return 0;
}
| ALGO | 0.972769 | 3.307581 |
2ab4e743-7524-4298-b7f3-722abe3a64ac | manikanta2901/ubuntu | .history/SRM/DAA/Algorithms/Backtracking/pointer_20210526204649.cpp | #include<bits/stdc++.h>
using namespace std;
void solve(int *a,int *b){
int *temp ;
temp= a;
*a = *a + *b;
*b = abs(*temp - *b);
cout << *b;
}
int main(){
int a,b;
cin >> a >> b;
solve(&a,&b);
// cout << a << endl;
// cout << b << endl;
} | ALGO | 0.999722 | 3.131036 |
8a4f624d-2003-45c0-ae8e-629053cc992f | KaiChengDM/RODEO | Tests/Optimization/Himmelblau/WithOneConstraint/himmelblau.cpp | #include<stdio.h>
#include<math.h>
#include <unistd.h>
double Himmelblau(double *x){
return pow( (x[0]*x[0]+x[1]-11.0), 2.0 ) + pow( (x[0]+x[1]*x[1]-7.0), 2.0 );
}
double constraint(double *x){
return x[0]+x[1];
}
int main(void){
double x[2];
FILE *inp = fopen("dv.dat","r");
fscanf(inp,"%lf",&x[0]);
fscanf(inp,... | ALGO | 0.99979 | 3.427327 |
a17043b1-a56a-4687-954e-53fe798a2f17 | hodinkee/aaplus | src/AAPlanetPerihelionAphelion.cpp | ///////////////////////////////// Includes ////////////////////////////////////
#include "stdafx.h"
#include "AAPlanetPerihelionAphelion.h"
#include "AACoordinateTransformation.h"
#include <cmath>
using namespace std;
///////////////////////////////// Implementation //////////////////////////////
double CAAPlanetPer... | ALGO | 0.999566 | 6.254654 |
d48590cd-2eed-4c47-9306-1ae77de689af | Ujjval-dargar/Leetcode_Logs | 0518-coin-change-ii/0518-coin-change-ii.cpp | class Solution {
public:
int f(vector<int>& coins, int k, int i, int curr,
vector<vector<int>>& mem) {
int n = coins.size();
if (i == n) {
if (curr == k)
return 1;
return 0;
}
if (curr > k)
return 0;
if (mem[i][... | ALGO | 0.999945 | 5.700039 |
c6f45bbc-286d-4c26-8ac0-e1ac70a56dca | final-venture/cp | leetcode/2523.cpp | class Solution {
private:
vector<int> primes;
public:
void genPrimes(int n)
{
primes.resize(n + 1, 1);
int s = sqrtl(n);
for (int i = 2; i <= s; ++i)
{
if (!primes[i]) continue;
for (int j = i * i; j <= n; j += i)
{
primes[j... | ALGO | 0.999987 | 5.300547 |
8b001c60-5a1d-496b-8c36-110f535a72c0 | gr790/Uva | 11629/program.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
map<string, int> oper;
void pop_op()
{
oper.insert(make_pair("<", 1));
oper.insert(make_pair(">", 1));
oper.insert(make_pair("<=", 1));
oper.insert(make_pair(">=",... | ALGO | 0.998801 | 3.646783 |
ed1d70a3-d804-4035-b62f-526eaaec1484 | ShalevAsor/AlgoSolverCPP | Problems/Binary Search/binarySearch.cpp | #include "../../Utils/utils.h"
/**
* @brief Binary Search
* @param nums
* @param target
* @return int
* Time Complexity: O(log n)
* Space Complexity: O(1)
*
*/
int binarySearch(vector<int> & nums,int target){
int n = nums.size();
int left = 0;
int right = n-1;
while(left <= right){
int... | ALGO | 0.999737 | 6.120142 |
4a1b50d2-a0da-446e-bad3-42ffc661b0ad | utcs-scea/DGSF | src/apps/uniform_kmeans/kmeans14/src/sequential.cpp | #include <chrono>
#include <cmath>
#include <iostream>
#include <limits>
#include <vector>
#include "common.h"
double get_euclidean_distance_squared(
const std::vector<float> &points,
const std::vector<float> ¢roids,
int point_idx,
int centroid_idx,
int dims)
{
double dist = 0.0;
for ... | ALGO | 0.999777 | 6.701237 |
7e988538-8622-450f-8635-b01a4ebc1daf | SajalDasShovon/Data-Structure-Algo | Sorting Algorithm/SelectionSort.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
void selectionSort(vector<int>&v)
{
for (int i=0; i<n-1; i++)
{
int min=i;
for (int j=i+1; j<v.size(); j++)
{
if (v[j]<v[min]);
min=j;
}
if (min !=i)
{
int temp=v[min];
... | ALGO | 0.999853 | 4.419178 |
1b36039f-3fef-4a72-843d-56d63f51f9b0 | sKAR04/CP-Practice | Codeforces/574/574C.cpp | /*
#####################################################
# I will win.. maybe not immediately but definitely #
#####################################################
*/
#include <bits/stdc++.h>
using namespace std;
//Optimizations
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC ta... | ALGO | 0.999879 | 3.714795 |
59d9c552-de8f-4d96-8399-8001281e6628 | Apurba94/10-Years-of_Competitive-Programming-Resources-Collection | Codeforces From 2011-2023/1250A-Berstagram.cpp | #include <cstdio>
#include <vector>
int main(){
long n, m; scanf("%ld %ld", &n, &m);
std::vector<long> which(n + 1), where(n + 1), top(n + 1), bottom(n + 1);
for(long p = 1; p <= n; p++){top[p] = bottom[p] = which[p] = where[p] = p;}
for(long p = 0; p < m; p++){
long x; scanf("%ld", &x);
... | ALGO | 0.999992 | 3.744779 |
285e5c1b-def1-493e-a269-5594a5c89fc9 | CoffeeCoder3009/Data-Structures-and-Algorithms | Graphs/BipartiteGraph.cpp | #include<iostream>
#include<vector>
using namespace std;
// A graph is a bipartite graph if and only if it does not contain an odd cycle
// We check for an odd cycle in the graph by checking that whether we can colour the graph with exactly 2 colours(0 and 1) or not.
// Colouring must be in such a way that no two adj... | ALGO | 0.999844 | 5.764714 |
9ef4218b-13b5-4636-92d6-ccc106ef64ea | libairong/poker | src/ComputerPlayer.cpp | #include "ComputerPlayer.h"
#include "GameFlow.h"
ComputerPlayer::ComputerPlayer(string name, int position, shared_ptr<Scene> scene):
Player(name, position, scene), Layer(0, 0) {
Layer::setName(name);
}
// 根据场上已有牌和上一个玩家的出牌
void ComputerPlayer::action(void) {
// printf("hello! i am computer!\n");
... | TOOL | 0.916888 | 3.499456 |
4bfe02ca-aeaa-4fe7-b53b-9839d8dc3f46 | PrajwalKarale/LEETCODE | STRINGS/EASY/2490. Circular Sentence.cpp | /*
Time Complexity:
1. Since we are traversing each and every word in the given sentence
2. T.C -> O(n)
Space Complexity:
1. We have created an extra space to store the words
2. S.C -> O(n)
*/
auto fastIO = [](){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
c... | ALGO | 0.99974 | 6.159948 |
54014eb7-e579-4aad-99c3-fad09eb6e015 | Sumitkumarvikarwal/c-programming | inline_function_defaultvalue.cpp | #include<iostream>
using namespace std;
inline int product(int a, int b){
// Not recommended to use below lines with inline functions
// static int c=0; // This executes only once
// c = c + 1; // Next time this function is run, the value of c will be retained
return a*b;
}
float moneyReceived(int cur... | ALGO | 0.929211 | 3.753301 |
b182a719-aaa2-4055-9266-6ba762ad08b8 | IDA-TUBS/lwW2RP | thirdparty/boost_1_73_0/libs/intrusive/example/doc_splay_set.cpp | using namespace boost::intrusive;
class mytag;
class MyClass
: public bs_set_base_hook<>
{
int int_;
public:
//This is a member hook
bs_set_member_hook<> member_hook_;
MyClass(int i)
: int_(i)
{}
friend bool operator< (const MyClass &a, const MyClass &b)
{ return a.int_ < b.... | TOOL | 0.957467 | 5.759614 |
ac51af99-c7f3-4d74-8b13-1a368fec4fe3 | Harrix/Harrix-QtLibrary | source_library/Работа со строками и списками строк/HQt_NaturalSortingQStringList.cpp | QStringList HQt_NaturalSortingQStringList (QStringList StringList)
{
/*
Функция сортировки строк в сортировки строк QStringList в натуральном виде, например,
строки: z1, z10, z2 сортируются как z1, z2, z10.
Входные параметры:
StringList - сортируемый список строк.
Возвращаемое значение:
От... | TOOL | 0.951771 | 4.593626 |
45d2c843-e341-42e7-a518-822f3807bb8a | eqdiag/rayTraceWeekend | next_week/src/rect.cpp | #include "rect.h"
RectXY::RectXY(double z,double xmin,double xmax,double ymin,double ymax,std::shared_ptr<Material> material)
:z{z},xmin{xmin},xmax{xmax},ymin{ymin},ymax{ymax},material{material}
{
}
std::optional<Hit> RectXY::getHit(const Ray3& ray,double tmin,double tmax) const
{
double t = (z - ray.getPoint().... | ALGO | 0.860996 | 6.547167 |
71e2a8d5-2bef-4941-925e-634d43d91cca | shivanisimran/Data-Structures-Algorithms | Must-Do-GFG/Graph/No-of-Islands.cpp | /*
Given a grid consisting of '0's(Water) and '1's(Land). Find the number of islands.
Note: An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically or diagonally i.e., in all 8 directions.
Input:
grid = {{0,1,1,1,0,0,0},{0,0,1,1,0,1,0}}
Output:
2
Expanation:
The grid is-
... | ALGO | 0.999982 | 6.600823 |
900c23f6-0bf6-48b6-bc6f-4ba20400f8ee | antgwy/Competitive-Programming | AtCoder/abc328/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << " is " << x << endl
typedef long long ll;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
string s;
cin >> s;
int n = s.length();
if (n < 3) { cout << s << ... | ALGO | 0.999981 | 3.656646 |
43aa1f6f-49b6-4ba6-a54b-e20be78439d7 | ngctnnnn/evo_optim_cpp | include/boost/libs/iterator/example/shared_iterator_example1.cpp | #include "boost/shared_container_iterator.hpp"
#include "boost/shared_ptr.hpp"
#include <algorithm>
#include <iostream>
#include <vector>
typedef boost::shared_container_iterator< std::vector<int> > iterator;
void set_range(iterator& i, iterator& end) {
boost::shared_ptr< std::vector<int> > ints(new std::vector<i... | TOOL | 0.975485 | 3.427441 |
cee45e05-8554-4257-a78f-eb56e6ba1a54 | sheeluofficial/practice | OthersCode/LeetCode-Solutions-master/LeetCode-Solutions-master/C++/make-sum-divisible-by-p.cpp | // Time: O(n)
// Space: O(p)
class Solution {
public:
int minSubarray(vector<int>& nums, int p) {
int residue = 0;
for (const auto& num : nums) {
residue = (residue + num) % p;
}
if (!residue) {
return 0;
}
int result = size(nums);
un... | ALGO | 0.999982 | 6.384823 |
b0bf4525-9117-4e72-a349-f3f18a61f10e | AndrewShkrob/Courses | Coursera/Data Structures and Algorithms Specialization/Data Structures/Assignments/week3_hash_tables/6_matching_with_mismatches/matching_with_mismatches.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> solve(int k, const string &text, const string &pattern) {
vector<int> pos;
return pos;
}
int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
int k;
string t, p;
while (cin >> k >> t >> p) {
auto a = solve(k, t, p);
cout << a.size... | ALGO | 0.99852 | 3.8654 |
b5ca7e6c-b0b4-4442-a9b0-c616714a5706 | Zendq1998/program_practice | Explore/Learn/哈希表/03-实际映射-用法/03-IsomorphicStrings.cpp | /*
Given two strings s and t, determine if they are isomorphic.
Two strings are isomorphic if the characters in s can be replaced to get t.
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character m... | ALGO | 0.999541 | 6.703444 |
a5ea19ef-762a-4220-9a5b-d1fe33a69bf2 | anurag-bhadauriya/Problem-Solving | 4-Recursion-And-Backtracking/15-n-queens-ii.cpp | // https://leetcode.com/problems/n-queens-ii/
#include <iostream>
#include <vector>
#include <string>
using namespace std;
// Checks if the place we are putting the queen is valid or not
bool checkPlaceValidity(int col, int row, vector<string> &board, int n)
{
int rowii = row;
int colii = col;
// Check f... | ALGO | 0.999438 | 6.337885 |
afe6e9e8-1dd4-4c72-902b-956e347571c4 | mmz-zmm/LeetCode | 1738-Find-Kth-Largest-XOR-Coordinate-Value.cpp | class Solution {
public:
// 异或的性质 a^b ^a = b,利用前缀和来进行快速的计算
// pre[i][j] = pre[i - 1][j] ^ pre[i][j-1] ^ pre[i - 1][j-1] ^ nums[i][j],类似于面积法
int kthLargestValue(vector<vector<int>> &matrix, int k) {
int m = matrix.size();
int n = matrix[0].size();
vector<vector<int>> prefix_sum(m + 1,... | ALGO | 0.999951 | 5.570284 |
14bcdc36-13c1-4a21-a8d8-06c82b7fc15c | GustavoHenriqueFerreira/codeforces | usp-2025-try-outs/h.cpp | #include <iostream>
using namespace std;
int main() {
int W, K;
// ler dados de entrada
cin >> W >> K;
// ano que a diferenca dobre
int dobro_diferenca = 2 * K - W;
// imprimir
cout << dobro_diferenca << endl;
return 0;
} | ALGO | 0.99964 | 4.007908 |
2caedee6-3541-4858-9ca7-65d905018247 | Mosina916/AugCBND22C- | Lecture21/bubblesort.cpp | #include<iostream>
#include<climits>
using namespace std;
int main(){
int arr[]={5,4,3,2,1};
int n=sizeof(arr)/sizeof(int);
for(int i=0;i<=n-2;i++){//
for(int j=0;j<=n-i-2;j++){
if(arr[j]>arr[j+1]){
swap(arr[j],arr[j+1]);
}
}
}
// print array
for(int i=0;i<n;i++){
cout<<arr[i]<<" ";
}
return 0;
} | ALGO | 0.999922 | 3.727856 |
252208fb-7876-4423-8142-fc1f1f84abf2 | FaadCoder/Leetcode-Solutions | 924-minimize-malware-spread/924-minimize-malware-spread.cpp | class UnionFind
{
unordered_map<int, int> parent, size;
public:
UnionFind(int numberOfSets)
{
for (int set = 0; set<= numberOfSets; set++)
parent[set] = set, size[set] = 1;
}
int findParent(int child)
{
if (child == parent[child])
... | ALGO | 0.999974 | 5.737514 |
7acd7725-4674-4ae5-960a-2e3008167a14 | kaydenpham27/Competitive-Programming | Solutions/CSES/Dynamic_Programming/counting_tilings.cpp | #include <bits/stdc++.h>
#define int64_t long long
#define double long double
using namespace std;
using type = int64_t;
const long long mod = 1000000007, inf = 1e18;
const int base = 33;
const int N = 4e6 + 10;
const int LG = 20;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int n, m;
int comp[(1 << 10) + 5]... | ALGO | 0.99999 | 4.415783 |
bdc3a03d-d79c-4eb2-94b8-49a4642e21f8 | sanjeetboora/Launchpad_12Jan2020 | Lecture12/permutations.cpp | #include <iostream>
using namespace std;
void permutations(string input, string output){
if(input == ""){
cout<<output<<endl;
return;
}
for (int i = 0; i < input.length(); ++i)
{
char ch = input[i];
string ros = input.substr(0, i) + input.substr(i+1);
permutations(ros, output+ch);
}
}
int main(int argc... | ALGO | 0.999981 | 4.955619 |
26b01820-5406-4054-904c-671828b7e4e0 | itsme-swe/Cplus-_2025 | 04_Arrays/2_arrayDemo.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int arr[5] = {2, 4, 6, 8, 10};
for (int ele : arr)
{
cout << ele << " ";
}
return 0;
} | ALGO | 0.903382 | 3.853321 |
5ee3339e-e9c8-4cd0-b769-bc2d6f2dc594 | tridhapuku/DSP_MLIR | libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp | // <vector>
// explicit vector(size_type n);
// explicit vector(size_type n, const Allocator& alloc = Allocator());
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "DefaultOnly.h"
#include "min_allocator.h"
#include "test_allocator.h"
#include "asan_testing.h"
template <class C>
TEST_CONSTEXP... | TEST | 0.919512 | 7.286578 |
9aa5f464-8009-4d9e-97d8-3e071f08adb3 | ricardac1/BrickGame_v2.0 | src/brick_game/snake/model/model.cpp | #include "model.h"
namespace s21 {
Point Point::randomPoint(std::vector<Point> &snake) {
Point random;
bool isValid;
do {
isValid = true;
random.x = rand() % 10;
random.y = rand() % 20;
for (const auto &segment : snake) {
if (segment.x == random.x && segment.y == random.y) {
isVa... | TOOL | 0.978159 | 5.366388 |
19a210b3-8aa6-4ec0-b4d1-e3857ea23cad | calvinckfong/leetcode | 3000/2418.cpp | // 2418. Sort the People
class Solution {
public:
vector<string> sortPeople(vector<string>& names, vector<int>& heights) {
int n = names.size();
vector<pair<int, string>> height_name_list(n);
for (int i=0; i<n; i++) {
height_name_list[i] = {heights[i], names[i]};
}
... | ALGO | 0.99997 | 6.473119 |
3161b192-534e-446c-b275-3fc2ca815b08 | runitrupam/leetcode-automate | leet_code_solutions/Merge-Sorted-Array.cpp | #include<bits/stdc++.h>
class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int i = 0 ;
while(i < n)
{
nums1[(m+i)] = nums2[i];
i++;
}
sort(nums1.begin(), nums1.end());
}
}; | ALGO | 0.999931 | 4.988591 |
9ce72165-9e7f-4f22-aebb-c2fca0b98773 | trando46/Projects | C++/Lab6/lab6.cpp | // Bao Tran Do
// File: lab6.cpp
// November 10, 2020
// Purpose: The purpose for this is to implement a HashTable using the hash
// function h(k) = k % N and linear probing for the collision
// Input: none. (This is hardcoded)
// Process: none. (Process the hardcode. Generate 4083 unique numbers and then
// ... | ALGO | 0.956787 | 5.370213 |
3c90dee0-3fb0-478d-a449-b3de8b2ab217 | FDA12345/smart_home | sdk/boost_1_73_0/libs/sort/benchmark/parallel/benchmark_strings.cpp | //----------------------------------------------------------------------------
/// @file benchmark_strings.cpp
/// @brief Benchmark of several sort methods with strings
///
/// @author Copyright (c) 2017 Francisco José Tapia (<EMAIL> )\n
/// Distributed under the Boost Software License, Version 1.0.\n
/// ... | TEST | 0.98986 | 6.415236 |
752ad82a-f08f-4ef0-88d7-7efb38b0f748 | tylern4/aao_rad_lund | src/maidinterface.cpp | #include <iostream>
// Declare the Fotran function:
extern "C" {
void maid_( // Inputs:
float *beam_energy, float *W, float *Q2, float *costheta, float *phi,
int *helicity, int *model_opt, int *channel_opt, int *resonance_opt,
// Ouputs:
float *sigma0, float *sigma_t, float *sigma_tt, float *sigma_l,
... | ALGO | 0.994558 | 6.920573 |
9284f91b-d723-4f84-b41f-bae0d3961cfa | akeita05/artistSearch | hashtable.cpp | //
// Created by Aicha Keita on 12/1/24.
//
#include "hashtable.h"
//helper functions!
bool inRange(float low, float high, float level)
{
return (low <= level && level <= high);
}
//function to turn the parsed vector in a usable hashMap :p - aicha
std::unordered_map<std::string, Artist> HashTable::createMap(std:... | ALGO | 0.975292 | 5.331248 |
dd88ce3c-ad86-4039-9dfe-a77dbbe039ab | ChrisBQu/ThreeEyedOwl | fuzzywuzzy/test/main.cpp | #include <iostream>
#include "fuzzywuzzy.hpp"
#include "process.hpp"
int main()
{
const string a = "I'm in your mind", b = "I'm in your mind fuzz";
const string c = "fuzzy wuzzy was a bear", d = "wuzzy fuzzy was a bear";
std::cout << fuzz::ratio(a, b) << '\n';
std::cout << fuzz::partial_ratio(a, b) <... | ALGO | 0.956175 | 5.362157 |
8494cc1f-0ca6-4cd6-9b34-326a3658da9c | HimanshuDS14/String-Questions | String Intermediate/Edit Distance/main.cpp | #include <iostream>
using namespace std;
int min(int x , int y , int z)
{
return min(min(x,y),z);
}
int Edit(string s1 , string s2)
{
int m = s1.length();
int n = s2.length();
int l[m+1][n+1];
for(int i=0; i<=m;i++)
{
for(int j=0;j<=n;j++)
{
if(i==0)
... | ALGO | 0.999985 | 4.418249 |
f1d98e63-5b64-48ff-9988-ba424515751f | icf/Code | C++ code/GpBCS_S.C.CPMC/SC_afqmcConstraintPathBP_original_2_Ettore_BP_GHF/include/eigen/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.998587 | 4.659281 |
c058b667-d8e2-482d-8298-f15486265317 | rosy-y/LeetCode_2 | Integer to Roman/Solution.cpp | class Solution {
public:
const int in[13] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
const string str[13] = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
string intToRoman(int num) {
string tmp = "";
for (int i=0; num; i++) {
while (num >= in[i]... | ALGO | 0.999803 | 6.268738 |
b0701e55-fb97-4586-80d8-d79dd072b8f9 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_11182_8.cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int N = 1e5 + 5;
int n, m, p, q, root[N];
long long sum[N];
int getroot(int u) { return u == root[u] ? u : root[u] = getroot(root[u]); }
void join(int u, int v) {
u = getroot(u);
v = getroot(v);
if (u != v) {
sum[u] += sum[v];
root[v... | ALGO | 0.999967 | 3.6563 |
94e54bc7-3766-4bf8-9bcf-97477d208a09 | sakshgupta/DSA-Leetcode-Gfg-Questions | 688-knight-probability-in-chessboard/knight-probability-in-chessboard.cpp | class Solution {
public:
// for all the 8 dir knight can move in
int dir[8][8] = {{-2,-1}, {-1,-2}, {1,-2}, {2,-1}, {2,1}, {1,2}, {-1,2}, {-2, 1}};
double solve(int n, int moves, int r, int c, unordered_map<string, double> &dp){
// base cases
if(r<0 or r>=n or c<0 or c>=n) // out of boundary... | ALGO | 0.99994 | 5.021213 |
81f83999-4c4e-4fd7-9709-c26e3fd4f11c | carson-jenkins-5/cs3060 | 6.18/6.18/main.cpp | /*
Carson Jenkins
08/23/2023
Dr. Rory Lewis
6.18
*/
#include <iostream>
#include <iomanip>
using namespace std;
// wall area that one gallon of paint will cover
const int WALL_AREA_PER_GALLON = 110;
// hourly labor rate
const double HOURLY_RATE = 25;
// function prototypes
int getNumberOfRooms();
double getPaintPric... | TOOL | 0.906596 | 7.144565 |
4989b6fe-1afc-4cf5-99e2-fe18f5114b8e | azrazic/object-oriented-programming | zadatakk14.cpp | #include <iostream>
#include<iomanip>
using namespace std;
int main()
{
int i=0,j=0;
for(int i=1; i<=10; i++)
{
cout<<"\n";
for(int j=1; j<=10; j++)
{
cout<<setw(4) <<i*j;
}}
cout<<"\n";
return 0;
}
| ALGO | 0.987056 | 3.963819 |
1a87aa53-7f17-48ed-9585-6b03fa73b95c | kennent/for_scsc_code_save | codeforces/1016/f.cpp | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
int t;
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> t;
while (t--) {
int n, m, check[500] = {0}, r = 0;
string s[500];
cin >> n >> m;
for (int i =... | ALGO | 0.999925 | 4.225657 |
909290bf-1ded-4777-b852-5e526d054305 | taoyao-official/device_xiaomi_taoyao | gps/utils/LocHeap.cpp | #include <LocHeap.h>
namespace loc_util {
class LocHeapNode {
friend class LocHeap;
// size of of the subtree, excluding self, 1 if no subtree
int mSize;
LocHeapNode* mLeft;
LocHeapNode* mRight;
LocRankable* mData;
public:
inline LocHeapNode(LocRankable& data) :
mSize(1), mLeft(NU... | ALGO | 0.998238 | 6.593742 |
980d67b9-4b32-4139-82cd-a8d7dba8c49b | Ayushi140320/Sort | quick.cpp | #include<iostream>
using namespace std;
void display(int arr[],int n)
{
int i;
for(i=0;i<n;i++)
{
cout<<arr[i]<<" ";
}
}
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
int partition(int arr[],int l,int h)
{
int pivot =arr[h];
int i=l-1;
for(j=l;j<h;j++)
{
if(arr[j]<pivot)
{
i++;
... | ALGO | 0.999924 | 4.620701 |
6a933f4b-2da6-4bb1-a3f4-a2d520253831 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_11163_31.cpp | #include <bits/stdc++.h>
inline long long read() {
long long x = 0, f = 1;
char c = getchar();
for (; c > '9' || c < '0'; c = getchar()) {
if (c == '-') f = -1;
}
for (; c >= '0' && c <= '9'; c = getchar()) {
x = x * 10 + c - '0';
}
return x * f;
}
const long long mod = 1e9 + 7;
long long base[200... | ALGO | 0.999925 | 4.378161 |
963d28aa-0798-44c2-8c25-639a68798841 | YuanPengyi/Ypy-Leetcode | 173.二叉搜索树迭代器.cpp | /*
* @lc app=leetcode.cn id=173 lang=cpp
*
* [173] 二叉搜索树迭代器
*
* https://leetcode-cn.com/problems/binary-search-tree-iterator/description/
*
* algorithms
* Medium (69.82%)
* Likes: 118
* Dislikes: 0
* Total Accepted: 12K
* Total Submissions: 17K
* Testcase Example: '["BSTIterator","next","next","hasN... | ALGO | 0.999976 | 6.185396 |
71b6e63a-edfa-4f4d-898c-4330e89486ac | Harshit-Kumar-Singh/Code-Forces | A_Dense_Array.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
void solve()
{
ll n;
cin >> n;
vector<ll> v;
for (int i = 0; i < n; i++)
{
ll x;
cin >> x;
v.push_back(x);
}
ll final_ans = 0;
ll count = 0;
for (int i = 0; i < n - 1; i++)
{
l... | ALGO | 0.999612 | 3.681482 |
766de061-bb07-41ee-afb8-860610ca86a2 | PDFium/PDFium | core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | #include "../../../include/fpdfapi/fpdf_render.h"
#include "../../../include/fpdfapi/fpdf_pageobj.h"
#include "../../../include/fxge/fx_ge.h"
#include "../fpdf_page/pageint.h"
#include "render_int.h"
#define SHADING_STEPS 256
static void _DrawAxialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2Bitmap,
... | TOOL | 0.884241 | 6.003826 |
175b5ee7-1597-4a50-bde9-b6ac8dbb2e84 | ishandutta2007/codeforces | kmjp/normal/884/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999987 | 3.936086 |
785d6374-c07f-4a4c-87f8-a97480299f05 | BadagalaAdarsh/LeetCode | 941-valid-mountain-array/941-valid-mountain-array.cpp | class Solution {
public:
bool validMountainArray(vector<int>& arr) {
if(arr.size() < 3) return false;
int i =1;
int increase = 0;
for( ; i < arr.size(); i++){
if(arr[i] <= arr[i-1])
break;
increa... | ALGO | 0.999973 | 6.072568 |
cae9b5fa-27ee-4b4b-9a8c-66f5ebf105c0 | vancegroup-mirrors/sofa-framework | Sofa/modules/sofa/component/collision/MeshDiscreteIntersection.cpp | #include <sofa/component/collision/MeshDiscreteIntersection.inl>
#include <sofa/helper/system/config.h>
#include <sofa/helper/FnDispatcher.inl>
#include <sofa/core/collision/Intersection.inl>
//#include <sofa/component/collision/ProximityIntersection.h>
#include <sofa/helper/proximity.h>
#include <iostream>
#include <a... | ALGO | 0.997072 | 6.720198 |
fb18e40f-dcb8-43e4-8148-d457c9e7f9b6 | mutablealligator/scalable-ndn-forwarding | boost_1_60_0/libs/algorithm/string/example/find_example.cpp | // Boost string_algo library example file ---------------------------------//
// See http://www.boost.org for updates, documentation, and revision history.
#include <string>
#include <iostream>
#include <algorithm>
#include <functional>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/stri... | TOOL | 0.993714 | 4.969246 |
3abceb3c-098a-4b86-b86c-7b0c95fac6e7 | HPC-AI-Team/lammps-fugaku-threadpool-sc23 | src/OPENMP/pair_lj_cut_omp.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "pair_lj_cut_omp.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "ne... | ALGO | 0.999497 | 6.928494 |
b9e544f8-9335-46c1-974c-b0a9aaf416ad | Fourni-j/EpitechSpider | Server/src/Config.cpp |
#include <fstream>
#include <iostream>
#include <cstdlib>
#include "Config.hh"
namespace Spider
{
Config::Config() : _readerIni("conf/spider.ini")
{
_root = Json::nullValue;
this->parsePrimordial();
this->parseUsers();
}
/* primordial rules */
int Config::getServerPort()
{
return (_reader... | CONFIG | 0.924833 | 3.824232 |
c0003cec-5ed2-4a1a-bc9a-bc408716b659 | sailfishos/virtualbox | virtualbox/src/VBox/Frontends/VBoxAutostart/VBoxAutostartStart.cpp | /* $Id: VBoxAutostartStart.cpp $ */
/** @file
* VBoxAutostart - VirtualBox Autostart service, start machines during system boot.
*/
#include <VBox/com/com.h>
#include <VBox/com/string.h>
#include <VBox/com/Guid.h>
#include <VBox/com/array.h>
#include <VBox/com/ErrorInfo.h>
#include <VBox/com/errorprint.h>
#include ... | TOOL | 0.851439 | 6.725586 |
44ad724b-6110-4734-98eb-4af4c20c3871 | diana26/Programming-Exercises | C++/Array.cpp | #include <iostream>
using namespace std;
int main()
{
int Array[50], temp, n, i, j;
cout<<"Enter the number of elements of your array:";
cin >> n;
for(i=1; i<=n; i++){
cout<<"Element:";
cin>>Array[i];
}
for(i=1; i<n; i++){
temp = Array[i];
j = i-1;
while(Array[j] >= ... | ALGO | 0.999763 | 3.411561 |
e010fc48-b77b-4ec8-89ec-fa83483ed87e | wannabeyourfriend/THU-CST-OOP-2025spring | Report/eigen/doc/examples/TutorialLinAlgExSolveLDLT.cpp | #include <iostream>
#include <Eigen/Dense>
int main() {
Eigen::Matrix2f A, b;
A << 2, -1, -1, 3;
b << 1, 2, 3, 1;
std::cout << "Here is the matrix A:\n" << A << std::endl;
std::cout << "Here is the right hand side b:\n" << b << std::endl;
Eigen::Matrix2f x = A.ldlt().solve(b);
std::cout << "The solution ... | ALGO | 0.99993 | 4.092243 |
1c67397d-f48c-4275-83e9-97185aa0e1b6 | jahnvisrivastava100/Leetcode-Solutions | Trees/BST/Delete Node in 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.999996 | 6.444109 |
4b459d41-5fd2-4bee-ae6e-e321661a5782 | chenqwwq/_algorithm | src/top.chenqwwq/leetcode/daily/_2022/_20220312/n-ary-tree-postorder-traversal.cpp | //
// Created by 陈炳鑫 on 2022/3/12.
//
#include "bits/stdc++.h"
#include "common.h"
using namespace std;
class Solution {
public:
vector<int> postorder(Node *root) {
if (!root) return {};
vector<int> ans;
for (auto child: root->children) {
auto t = postorder(child);
... | ALGO | 0.999716 | 5.93667 |
2cf56577-4694-46cd-87aa-3a3b8ceab51a | alexandraback/datacollection | solutions_5662291475300352_0/C++/Alwahsh/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define var double
ll start[2],num[2],speed[2];
int t;
int main() {
ios::sync_with_stdio(0);
freopen("C-small-1-attempt1.in","r",stdin);
freopen("a2.out","w",stdout);
cin >> t;
for (int cntt = 1; cntt <= t; cntt++) {
cout << "Case #" << cnt... | ALGO | 0.999575 | 3.448984 |
efa30f11-2c50-4c2d-a958-3954948b11bf | hma40/Cpp-Competitive-Programming | Codeforces/2110/E.cpp | #include <bits/stdc++.h>
std::string to_string(__int128_t value) {
if (value == 0) return "0";
std::string result;
bool negative = (value < 0);
if (negative) value = -value;
while (value > 0) {
result += '0' + (value % 10);
value /= 10;
}
if (negative) result +... | ALGO | 0.999963 | 5.548141 |
39da3047-0228-4e6a-82dd-8f783b1cdd1a | jianningzhuang/CS2040C-Data_Structures_and_Algorithms | Week 3/mali.cpp | #include <bits/stdc++.h>
using namespace std;
void counting_sort(vector<int> arr, int n){
map<int, int> freqMap;
for (auto i = arr.begin(); i != arr.end(); i++) {
freqMap[*i]++;
}
int i = 0;
for (auto it : freqMap) {
int val = it.first;
int freq = it.second;
for (int... | ALGO | 0.999983 | 4.788908 |
f1b52874-92aa-4ccb-b869-75df2b156a06 | trinhminhtriet/leetcode | solutions/2900-2999/2938.separate-black-and-white-balls/Solution.cpp | class Solution {
public:
long long minimumSteps(string s) {
long long ans = 0;
int cnt = 0;
int n = s.size();
for (int i = n - 1; i >= 0; --i) {
if (s[i] == '1') {
++cnt;
ans += n - i - cnt;
}
}
return ans;
}... | ALGO | 0.999955 | 5.887853 |
1566a32b-9d99-47fa-94d5-154fc5337e96 | yymin1022/Algorithm_Study | BOJ/14916.cpp | #include <bits/stdc++.h>
using namespace std;
int dp[100001];
int main() {
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(false);
int N;
cin >> N;
dp[1] = -1;
dp[2] = 1;
dp[3] = -1;
dp[4] = 2;
dp[5] = 1;
for(int i = 6; i <= N; i++){
dp[i] = min(dp[i - 2], dp... | ALGO | 0.999982 | 4.857856 |
c892221d-520c-491a-8be6-ad960266ddce | Aditya-devp/Leetcode-DPPs | 0567-permutation-in-string/0567-permutation-in-string.cpp | class Solution {
public:
bool solve(string s,string s1){
sort(s.begin(),s.end());
sort(s1.begin(),s1.end());
return s==s1;
}
bool checkInclusion(string s1, string s2) {
int n1=s1.size(),n2=s2.size();
if(n1>n2) return 0;
int i=0;
while(i<=n2-n1){
... | ALGO | 0.999987 | 5.899348 |
9e857801-fefe-48b0-82fc-7ba010ac22af | raincross7/code-similarity | codes/train_code/problem218/problem218_143.cpp | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
double n, k;
cin >> n >> k;
double ans = 0;
... | ALGO | 0.999772 | 3.700723 |
981d229b-c39c-4fca-982d-6a06409515ad | alanMLCV/morethantechnical | ImageCloningGIMPPlugin/ImageEditingUtils.cpp | #include "ImageEditingUtils.h"
namespace ImageEditingUtils {
typedef gmm::row_matrix< gmm::rsvector<double> > SparseMatrix;
typedef std::vector<double > Vector;
int getSingleColor(int rgb, int color) {
return ((rgb >> (color * 8)) & 0x000000ff);
}
int getColorInPixel(IImage& image, int y, int x, int color) {
int ... | ALGO | 0.998944 | 5.134477 |
0d7569be-84ae-444b-ad8f-7c16b3824aec | ishandutta2007/codeforces | zbsnb/normal/1375/F.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(0);cin.tie(0);
pair<int,int> a[3];
cin>>a[0].first>>a[1].first>>a[2].first;
a[0].second=1;a[1].second=2;a[2].second=3;
cout<<"First"<<endl;
sort(a,a+3);
int q=2*a[2].first-a[1].first-a[0].f... | ALGO | 0.999791 | 3.394862 |
e24fcfc6-3352-4c24-8613-d165eaa4f49a | xuzhezhaozhao/TopCoder | 572/D23/DistinctRemainders.cpp | #include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <bitset>
#include <string>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#includ... | ALGO | 0.999967 | 4.442608 |
cd4a9255-4024-4f11-8c4a-2ef298e95e95 | MoyillaLaliteswari/leetcode | 2665-minimum-time-to-repair-cars/2665-minimum-time-to-repair-cars.cpp | class Solution {
public:
long long repairCars(vector<int>& ranks, int cars) {
long long left=1,right=(long long)*min_element(ranks.begin(),ranks.end())*cars*cars;
auto can_repair_all=[&](long long time){
long long total_cars_repaired
=0;
for(int rank:ranks){
total_cars_repair... | ALGO | 0.999968 | 5.678481 |
55aee3f0-21cc-4dfc-bbcb-32ee638873b8 | Arnab00369/CLASSES-OBJECTS-IN-CPP | ASSIGNMENT_25_PROG_10.cpp | #include <iostream>
using namespace std;
class Area
{
int len,bre,ed,ar,ar1;float rad,ba,h,ar2,ar3;
public:
Area(int w,int x,float y,int z,float a,float b)
{
len=w;
bre=x;
ed=z;
ba=a;
h=b;
rad=y;
}
void area()
{
ar=len*bre;
ar1=ed*ed;... | ALGO | 0.965627 | 3.16697 |
6a1b4b39-9468-4cdb-89cc-d0a974615749 | Sahil-2309/Leetcode | 1019-next-greater-node-in-linked-list/1019-next-greater-node-in-linked-list.cpp | class Solution {
public:
vector<int> nextLargerNodes(ListNode* head) {
if(!head) return {};
ListNode *p=head;
stack<pair<int,int>> st;
int n=0;
while(p){
p=p->next;
n++;
}
p=head;
vector<int> ans(n,0);
int k=... | ALGO | 0.999926 | 5.407023 |
30626ce5-193d-41fd-9ae9-690f1e108b59 | tboudreaux/PolytropicStellarModel | src/lane-emden-degenerate.cpp | #include<iostream>
#include<cmath>
#include<fstream>
#include<complex>
#include<string>
#include<vector>
#include "utils.h"
#include "integration.h"
#include "model.h"
// Macros to convert definitions into C type strings
#define STRINGIFY2(X) #X
#define STRINGIFY(X) STRINGIFY2(X)
using namespace std;
// function to... | ALGO | 0.996939 | 5.283416 |
2927aaca-d8da-4617-bb4b-c0f792e9d924 | GlodonOpenSrc/Qt5.4.2_Glodon | qtlocation/src/3rdparty/poly2tri/sweep/sweep_context.cpp | #include "sweep_context.h"
#include <algorithm>
#include "advancing_front.h"
namespace p2t {
SweepContext::SweepContext(std::vector<Point*> polyline) :
front_(0),
head_(0),
tail_(0),
af_head_(0),
af_middle_(0),
af_tail_(0)
{
basin = Basin();
edge_event = EdgeEvent();
points_ = polyline;
InitEdge... | ALGO | 0.997335 | 5.824019 |
be9a2a38-ef9b-417f-91ae-a39da75a89a7 | sarvex/leetcode-r | solution/2500-2599/2512.Reward Top K Students/Solution.cpp | class Solution {
public:
vector<int> topStudents(vector<string>& positive_feedback, vector<string>& negative_feedback, vector<string>& report, vector<int>& student_id, int k) {
unordered_set<string> ps(positive_feedback.begin(), positive_feedback.end());
unordered_set<string> ns(negative_feedback.be... | ALGO | 0.999924 | 5.788605 |
b6a43bc6-bbba-4089-a4f5-b2a723ac6870 | rebornstar1/Leetcode-Submissions | 952-word-subsets/word-subsets.cpp | class Solution {
public:
vector<string> wordSubsets(vector<string>& words1, vector<string>& words2) {
vector<int>freq(26,0);
for(int i = 0 ; i < words2.size() ; i++ )
{
vector<int>temp_freq(26,0);
for(int j = 0 ; j < words2[i].size() ; j++ )
{
... | ALGO | 0.999798 | 5.793775 |
8b3b5069-ff7f-4b22-a27f-399c0e9fb98d | liguigui/kamyu104-LeetCode | C++/two-sum-iv-input-is-a-bst.cpp | // Time: O(n)
// Space: O(h)
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool findTarget(TreeNode* root, int k) {
if (!root) {
... | ALGO | 0.999996 | 6.494485 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.