uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
1ede5cd9-ea1b-43c5-9055-445a96a3a106 | marbl/MetaCarvel | OGDF/src/ogdf/energybased/FruchtermanReingold.cpp | #include <ogdf/internal/energybased/FruchtermanReingold.h>
#include <ogdf/internal/energybased/numexcept.h>
#include <ogdf/basic/Array2D.h>
namespace ogdf {
FruchtermanReingold::FruchtermanReingold()
{
grid_quotient(2);
}
void FruchtermanReingold::calculate_exact_repulsive_forces(
const Graph &G,
NodeArray<NodeA... | ALGO | 0.999987 | 5.258653 |
4a427fc9-96da-4518-9f23-6bb66ed29e6a | A-BCDe/random-listtool | main.cpp | #include <iostream>
#include <fstream>
#include <random>
#include <string>
#include <string_view>
#include <vector>
constexpr int swap_cnt = 5;
int main(int argc, char *argv[]) {
if(argc != 3) {
std::cerr << "Requires input and output file name." << std::endl;
return 1;
}
std::ifstream in... | TOOL | 0.986838 | 5.48263 |
6eb191d5-e27a-4280-8cd6-8f3354bb0bb2 | sarvex/leetcode-prolog | solution/2200-2299/2286.Booking Concert Tickets in Groups/Solution.cpp | class Node {
public:
int l, r;
long s, mx;
};
class SegmentTree {
public:
SegmentTree(int n, int m) {
this->m = m;
tr.resize(n << 2);
for (int i = 0; i < n << 2; ++i) {
tr[i] = new Node();
}
build(1, 1, n);
}
void modify(int u, int x, int v) {
... | ALGO | 0.999954 | 5.199092 |
81c86fae-43c4-4c28-a401-e2f629940ddf | chakravartiavinit/Atcoder | C_Frog_Jumps.cpp | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define PI 3.141592653589793238462
/*########################################### DEBUG ###############################################################################################*/
#ifndef ONLINE_JUDGE
#define debug(x) \
cerr << #x << ... | ALGO | 0.999816 | 4.096562 |
c4438892-a520-4bae-92dc-a394d3b5eb25 | itsPriyanshuhere/DSA | linkedlist/knapsack problem/second.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
struct activity
{
int start, finish;
};
bool activityComparator(activity s1, activity s2)
{
return (s1.finish < s2.finish);
}
void activitySelection(activity arr[], int n)
{
sort(arr, arr+n, activityComparator);
... | ALGO | 0.99965 | 4.66379 |
1438e9f1-02c0-426d-bac0-3c10cce01730 | Onbashira/K3D12 | K3D12/Engine/Lib/bullet/include/BulletCollision/CollisionShapes/btConvex2dShape.cpp | #include "btConvex2dShape.h"
btConvex2dShape::btConvex2dShape( btConvexShape* convexChildShape):
btConvexShape (), m_childConvexShape(convexChildShape)
{
m_shapeType = CONVEX_2D_SHAPE_PROXYTYPE;
}
btConvex2dShape::~btConvex2dShape()
{
}
btVector3 btConvex2dShape::localGetSupportingVertexWithoutMargin(const btVecto... | ALGO | 0.861513 | 7.274159 |
992c4283-b3be-48ce-9f39-0cc46eb99617 | spandan11106/DSA | codeforces/800/mex.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n, k, x;
cin >> n >> k >> x;
if(min(n , x+1) < k){
cout << "-1\n";
}
else if(k < x){
cout << (n-k)*x + k*(k-1)/2 << "\n";
}
else{
cout << (n-... | ALGO | 0.999756 | 3.870849 |
b84c878b-e0a4-40cc-807f-ab0c777d6679 | wammar/wammar-utils | SimulatedAnnealing/test.cpp | #include "optimize.hpp"
#include "simulatedAnnealing.hpp"
#include "cost_function.hpp"
#include <boost/foreach.hpp>
using namespace Optimization;
int main() {
Domain domain;
domain.push_back(std::make_pair(-10,20));
domain.push_back(std::make_pair(-30,50));
domain.push_back(std::make_pair(-70,80));
doma... | ALGO | 0.999457 | 5.723535 |
f3656b9f-e6d5-440c-9a78-5257bd3558d3 | P1ben/nanite-at-home | libraries/libigl/include/igl/edge_midpoints.cpp | template<typename DerivedV,typename DerivedF,typename DerivedE,
typename DerivedoE, typename Derivedmps>
IGL_INLINE void
igl::edge_midpoints(
const Eigen::MatrixBase<DerivedV> &V,
const Eigen::MatrixBase<DerivedF> &F,
const Eigen::MatrixBase<DerivedE> &E,
const Eigen::MatrixBase<DerivedoE> &oE,
Eigen::PlainObjectB... | ALGO | 0.997921 | 5.858176 |
eaf293be-8c27-4af3-b6ad-0271cd5977b2 | SuperiorOS-beta/android_frameworks_native | cmds/installd/otapreopt_utils.cpp | #include "otapreopt_utils.h"
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
using android::base::Join;
using android::base::StringPrintf;
namespace android {
namespace installd {
bool Exec(c... | TOOL | 0.891764 | 6.737495 |
459f026e-79ae-4b70-8bc0-9082a9808b3e | AlixYehia/ITI | 4- OOP C++/Day3/2- Stack_LIFO/main.cpp | #include <iostream>
using namespace std;
class Stack
{
///Member Data
///int stkArr[5];
int* stkArr;
int StkSize;
int tos;
public: ///Member Functions
Stack()
{
this -> StkSize = 5;
this -> stkArr = new int [StkSize]; ///Alloacte StkArr dynamically in heap with StkSize
... | ALGO | 0.962844 | 3.930114 |
99cea471-fff7-457a-8077-f5940c740316 | ershehzan/Cpp_Codes | Search in 2d array.cpp | #include <iostream>
using namespace std;
int main()
{
// Initializing a 3x4 2D array
int arr[3][4] = {1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12};
int x; // Variable to store the element to be searched
cout << "Enter the element to be searched: ";
cin >> x; /... | ALGO | 0.987295 | 5.04879 |
4915e6ed-9f75-43ef-9a47-ce691b18e2a5 | TCGBench/TCGBench | data/human_performance_code/human_performance_code_noip/P1099/ac_3.cpp | #include <assert.h>
#include <bits/stdc++.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <complex>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
... | ALGO | 0.999771 | 4.01514 |
72443d84-2841-4a14-a918-ef89549f1aa4 | DionysiosB/CodeForces | 1300-1399/1335D-AntiSudoku.cpp | #include <iostream>
int main(){
long t; std::cin >> t;
while(t--){
for(long p = 0; p < 9; p++){
std::string s; std::cin >> s;
for(long p = 0; p < 9; p++){if(s[p] == '1'){s[p] = '2';}}
std::cout << s << std::endl;
}
}
return 0;
}
| ALGO | 0.998891 | 3.941268 |
2b2f7bb5-cc12-46e3-894d-1d24e1fa2838 | Venkat2552004/-CrackYourInternship | Day 2 (15-7-2024)/875.koko-eating-bananas.cpp | /*
* @lc app=leetcode id=875 lang=cpp
*
* [875] Koko Eating Bananas
*/
// @lc code=start
class Solution {
public:
int minEatingSpeed(vector<int>& arr, int hours) {
int n = size(arr);
int l = 1;
int h = *max_element(arr.begin(), arr.end());
int ans = INT_MAX;
while(l <= h... | ALGO | 0.99997 | 6.306129 |
c7da7905-8d75-4b13-973c-0c5d28ba99bd | prajjwal295/CPP-Problems | 2032-largest-odd-number-in-string/largest-odd-number-in-string.cpp | class Solution {
public:
string largestOddNumber(string num) {
int j = num.size();
string ans = "";
while(j--)
{
int n = num[j]-'0';
if(n%2==1)
{
ans = num.substr(0,j+1);
break;
}
}
... | ALGO | 0.999888 | 5.991574 |
0001d844-0618-4f56-b0a1-b3ccbb1c509d | S1lv10Fr4gn4n1/physics-simulation-tool-ios | library.collision/ParticleLinks.cpp | //
// ParticleLinks.cpp
// Physical.Simulation.Tool
//
// Created by Silvio Fragnani on 20/08/12.
//
//
#include "ParticleLinks.h"
real ParticleLink::currentLength() const
{
Vector3 relativePos = this->particle[0]->getPosition() - this->particle[1]->getPosition();
return relativePos.magnitude();
}
unsigne... | ALGO | 0.985932 | 4.760748 |
fc5cb66d-b58d-4bf3-839b-2c3a2102b3ba | wenc13/Semantic-Object-Reconstruction | DepthSensingLabel/Include/Eigen_3.1.2/doc/examples/tut_arithmetic_scalar_mul_div.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d a;
a << 1, 2,
3, 4;
Vector3d v(1,2,3);
std::cout << "a * 2.5 =\n" << a * 2.5 << std::endl;
std::cout << "0.1 * v =\n" << 0.1 * v << std::endl;
std::cout << "Doing v *= 2;" << std::endl;
v *= 2;
std::cout << ... | ALGO | 0.994296 | 3.669638 |
21345e0b-cb2e-4c30-8cdb-f90c927ccfa5 | nitin-kumar-sde/Number-Theory | Backtracking/NQueen.cpp | #include<iostream>
using namespace std;
const int N = 15;
int board[N][N] = {0};
// check if it is safe to place given queen
bool isSafe(int row, int col, int n) {
// column check
for(int i=row-1;i>=0;i--) {
if(board[i][col]) return false;
}
// diagonal up- left check
int i=row-1,... | ALGO | 0.999666 | 5.641406 |
a7afb2fd-d19c-4331-a02a-1796cbace516 | inceptionabhishek/Leetcoding | 1143-longest-common-subsequence/1143-longest-common-subsequence.cpp | class Solution {
public:
int rec(int n,int m,string s1,string s2,vector <vector<int>> dp){
if(n<0 || m<0){
return 0;
}
if(dp[n][m]!=-1){
return dp[n][m];
}
if(s1[n]==s2[m]){
return dp[n][m]=1+rec(n-1,m-1,s1,s2,dp);
}
return ... | ALGO | 0.999989 | 6.143712 |
bb2ec80a-815c-487e-99de-ea6d9ea90a2c | Vikram8084/Data-structures-Algo | week 3/03_Array level 2/03_array.cpp | #include<iostream>
using namespace std;
int main(){
int arr[]={10,20,30};
// print all pairs
int size=3;
// using twice for loop
for(int i=0;i<size;i++)
{
for(int j=0;j<size;j++){
cout<<"("<<arr[i]<<", "<<arr[j]<<")"<<endl;
}
}
return 0;
} | ALGO | 0.901679 | 3.832867 |
8f00666d-7c5f-4101-bdc6-680af0b59822 | pingjuiliao/llvm_openssl | llvm/libcxx/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp | // <algorithm>
// template<LessThanComparable T>
// const T&
// max(const T& a, const T& b);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
template <class T>
void
test(const T& a, const T& b, const T& x)
{
assert(&std::max(a, b) == &x);
}
int main(int, char**)
{
{
int x = 0;
... | TEST | 0.924578 | 5.800577 |
316b9a00-9e5d-441a-a82b-a60f1077ea1b | vfolunin/archives-solutions | MCCME/530.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int size;
cin >> size;
int dist = 100, minDist = dist;
for (int i = 0; i < size; i... | ALGO | 0.999934 | 3.796803 |
5371122b-7410-4c2a-8adc-bfeefd7c725e | chips-blockchain/chips-qt | src/merkleblock.cpp | #include <merkleblock.h>
#include <hash.h>
#include <consensus/consensus.h>
#include <utilstrencodings.h>
CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter* filter, const std::set<uint256>* txids)
{
header = block.GetBlockHeader();
std::vector<bool> vMatch;
std::vector<uint256> vHashes;
v... | ALGO | 0.99851 | 6.175004 |
cefa9cc6-60e5-44d8-83e5-7c14cda3241c | eunbc/cWorkspace | algorithm/0x0C BackTracking/5427.cpp | #include <bits/stdc++.h>
using namespace std;
int t, w, h;
char board[1000][1000];
int fire[1000][1000], dist[1000][1000];
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
vector<string> arr;
int main(void){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> t;
while(t--) {
queue<pair<int,int>>... | ALGO | 0.999984 | 4.145958 |
9ff20285-c567-4af8-85b4-08e89516ae9b | Cryst67/KattisSolutions | src/problems/99problems2/solutions/99problems2_2.cpp | #include <iostream>
#include <vector>
#include <map>
using namespace std;
auto main() -> int {
int n ,q; cin >> n >> q;
map<int, int> m;
for(int i = 0; i < n; i++){
int d; cin >> d;
if(m.count(d)) m[d] += 1;
else m[d] = 1;
}
for (size_t i = 0; i < q; i++)
{
int t... | ALGO | 0.999572 | 4.502961 |
a16b0f7b-30af-4b88-9a1a-27f07f0c2fd2 | ouedyan/turkish-banks-detection-formatting-utils | 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.998859 | 6.785645 |
cb941095-aa3b-4319-abad-741737259b0f | Shagor71/CP-Competetive-Programming- | Dua20/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
string s;
cin >> s;
vector<int> cnt(30);
for (auto c : s) cnt[c - 'a']++;
for (char c = 'a'; c <= 'z'; c++) if (cnt[c - 'a']) cout << c << " : " << cnt[c - 'a'] << '\n';
return 0;
} | ALGO | 0.998775 | 3.773725 |
8921a3c6-e51a-48df-a7c9-079c80a5801c | nobinov/image_resizer_server | include/boost_1_75_0/libs/intrusive/example/doc_iterator_from_value.cpp | using namespace boost::intrusive;
class intrusive_data
{
int data_id_;
public:
void set(int id) { data_id_ = id; }
//This class can be inserted in an intrusive list
list_member_hook<> list_hook_;
//This class can be inserted in an intrusive unordered_set
unordered_set_member_hook<> uno... | TOOL | 0.907767 | 5.962278 |
4e994a3d-18fb-40e0-8710-1d3f8966d7ac | LordPsyan/LordPsyanBots-wotlk | src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/scarlet_monastery/boss_mograine_and_whitemane.cpp | /* ScriptData
SDName: Boss_Mograine_And_Whitemane
SD%Complete: 90
SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
#include "AI/ScriptDevAI/include/precompiled.h"
#include "scarlet_monastery.h"
enum
{
// Mograine says
SAY_MO_AGGRO = -1189005,
SAY_MO_KILL = -118900... | TOOL | 0.898369 | 6.650951 |
16880196-27f9-431a-85b6-8334d42b1116 | akotadi/Competitive-Programming | Contest/Club Ranking/2019 ⁄ 1/4/T-primes.cpp | #include <bits/stdc++.h>
#define MAXN 1000000
using namespace std;
typedef long long ll;
vector<bool> isPrime;
void calculatePrimes(){
isPrime.resize(MAXN, true);
isPrime[0] = isPrime[1] = false;
for (ll i = 2; i < MAXN; i++)
{
if (isPrime[i] == 0)
{
for (ll j = j*i; j < MAXN; j += i)
{
isPrime[j]... | ALGO | 0.998879 | 4.902127 |
9dfc193b-ddbe-4464-b4b1-367fbf0889b4 | pavankumar130/LeetCode | 2016-reduction-operations-to-make-the-array-elements-equal/reduction-operations-to-make-the-array-elements-equal.cpp | class Solution {
public:
int reductionOperations(vector<int>& nums) {
sort(nums.begin(),nums.end());
int n=nums.size();
int ans=0;
for(int i=1; i<n; i++){
if(nums[i] != nums[i-1]){
ans+=(n-i);
}
}
return ans;
}
}; | ALGO | 0.999941 | 5.747007 |
aae662dd-3728-41bf-b252-3c3201d3b9c8 | qqibrow/Dynamic-Programming | LongestCommonSeq.cpp | #include "LongestCommonSeq.h"
LongestCommonSeq::LongestCommonSeq(void)
{
}
LongestCommonSeq::LongestCommonSeq( std::vector<char>& X, std::vector<char>& Y ):
xSeq(X.begin(), X.end()), ySeq(Y.begin(), Y.end()), opt(X.size()+1, Y.size()+1),
path(X.size()+1, Y.size()+1)
{
longestLength = 0;
xSize = xSeq.size();
... | ALGO | 0.999505 | 4.055154 |
1660855f-79cf-4e50-be9e-9e5460d3b4df | Schreiry/Thread | thread.cpp |
// --- Directive Space : ---
#include <iostream>
#include <thread>
#include <chrono>
#include <mutex>
#include <condition_variable>
#include <queue>
#include <sstream>
#include <vector>
// ---- ----- -----
using std::mutex;
using std::vector;
using std::string;
// ---- ----- -----
// :::::::::Colors ::::::::::... | ALGO | 0.99591 | 5.325041 |
afa6ce7a-fbf1-468a-8ae5-27daa52c2724 | yeohj0710/algorithm-implementation | [17][Platinum IV] 회전하는 캘리퍼스 가장 먼 두 점.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
struct P { int x, y; };
P operator-(P a, P b) {
P c;
c.x = a.x - b.x;
c.y = a.y - b.y;
return c;
}
vector<P> v;
double ccw(P a, P b, P c) {
return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y);
}
bool cmp(P &a, P &b... | ALGO | 0.999972 | 4.506163 |
4aadf180-1e9b-425c-835d-5a4ce4fb9c54 | gokulcodes/leetcode | 2331-evaluate-boolean-binary-tree/2331-evaluate-boolean-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.999965 | 6.307654 |
9e671eae-fac0-4aba-a98e-57ca46cb8878 | Sonseldeep/cpp | leetcode Problems/Discrete Mathematics/cartesian.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> cartesianProduct(vector<int> set1, vector<int> set2) {
vector<vector<int>> product;
for (int i = 0; i < set1.size(); i++) {
for (int j = 0; j < set2.size(); j++) {
vector<int> temp;
temp.push_back(set1[i... | ALGO | 0.999435 | 4.442341 |
0aadcace-9a8d-47b1-8511-14d934ef3198 | priyanshsingh/Cpp-learning | DSAlgo/Data_St/stack/pr10.cpp | #include <iostream>
using namespace std;
class Stack
{
private:
int top;
int arr[10];
public:
Stack()
{
top = -1;
for (int i = 0; i < 10; i++)
{
arr[i] = 0;
}
}
bool isEmpty()
{
i... | ALGO | 0.947894 | 4.111601 |
42541025-fe6d-48dc-9d74-85157b62d409 | tyzen-tzn/tyzen | src/rpc/misc.cpp | #include <httpserver.h>
#include <index/blockfilterindex.h>
#include <index/coinstatsindex.h>
#include <index/txindex.h>
#include <interfaces/chain.h>
#include <interfaces/echo.h>
#include <interfaces/init.h>
#include <interfaces/ipc.h>
#include <key_io.h>
#include <node/context.h>
#include <outputtype.h>
#include <rpc... | WEB | 0.918016 | 6.811174 |
3f6eaab3-49c0-4dae-ba0a-a50821cac105 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-coop-gpt35/Codenet/p00041/289363595/response_8.cpp | #include <stdio.h>
int main() {
char line[256];
int sum;
while (1) {
fgets(line, sizeof(line), stdin);
sscanf(line, "%d %d %d %d", &sum, &sum, &sum, &sum); // Parse integers from the line
if (sum == 0) {
break;
}
for (int i = 0; i < 110000; ++i) {
putchar('(');
}
prin... | ALGO | 0.992181 | 3.437988 |
80971809-fd47-4a30-9192-07a47b2aef3b | ankitksh81/leetcode-challenges | December 2021/day17.cpp | /*
Maximal square
https://leetcode.com/problems/maximal-square/
*/
// Solution 1:
class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
int m = matrix.size(), n = matrix[0].size();
vector<vector<int>> dp(m+1, vector<int>(n+1));
int maxSqLen = 0;
... | ALGO | 0.999875 | 6.645966 |
09a9630b-ba07-4a40-911d-a0f056aaa388 | Mysterioucz/2110327-ALGORITHM-DESIGN- | Grader/a60b_q3_perimeter/main.cpp | #include <bits/stdc++.h>
using namespace std;
int n,e,k,res = 0;
vector<vector<int>> g;
vector<int> dist;
void bfs(int a){
dist[a] = 0;
queue<int> q;
q.push(a);
while(!q.empty()){
int u = q.front();
q.pop();
for(int v:g[u]){
int newDist = dist[u] + 1;
if... | ALGO | 0.999917 | 4.198754 |
5fc0c4c6-cf94-483e-a979-5ce1b0464202 | bigmtn1113/Baekjoon | BOJ_15651/15651.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int n, m;
int arr[8];
bool visited[8];
void dfs(int cnt) {
if (cnt == m) {
for (int i = 0; i < m; i++)
printf("%d ", arr[i]);
printf("\n");
return;
}
for (int i = 0; i < n; i++) {
if (!visited[i]) {
arr[cnt] = i + 1;
dfs(cnt + 1);
}
}... | ALGO | 0.9999 | 3.849229 |
1cf777ef-8d76-46aa-9c3a-c281edae55a3 | ffallrain/lammps_waterbox | src/min_sd.cpp | #include <math.h>
#include <mpi.h>
#include "min_sd.h"
#include "atom.h"
#include "update.h"
#include "output.h"
#include "timer.h"
using namespace LAMMPS_NS;
// EPS_ENERGY = minimum normalization for energy tolerance
#define EPS_ENERGY 1.0e-8
/* ---------------------------------------------------------------------... | ALGO | 0.999978 | 5.632362 |
036268b0-baf0-4c49-bce2-f32fe2e3dd34 | Emperor-Trillion/VU-All-CPP-Tasks | Home Work 4 Try Catch Error Handling.cpp | #include<iostream>
#include<cmath>
#include <stdexcept>
using namespace std;
double SurfaceArea(double& height, double& radius, double slant); // First Function to calculate Surface Area of a cone. Returns type double/
double Volume(double height, double radius); // Seond Function to calculate the Volume of a c... | ALGO | 0.987193 | 5.574039 |
b0991506-1658-440a-9f9e-c3286e02ad8c | Gautam5514/GFG | Difficulty: Easy/Array to BST/array-to-bst.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node* left;
Node* right;
Node(int val)
: data(val)
, left(nullptr)
, right(nullptr) {}
};
bool help(Node* root, long long int up, long long int l) {
if (root->data >= up || root->d... | ALGO | 0.999772 | 6.437197 |
b9cfdc7b-046c-4f30-b5a2-185d17b8ae6d | prathumayekar/dsa_with_cpp | Macros, Global variables etc/defaultArgs.cpp | #include <iostream>
using namespace std;
void print(int arr[], int n, int start = 0)
{
for (int i = start; i < n; i++)
{
cout << arr[i] << endl;
}
}
int main()
{
int arr[5] = {1, 4, 7, 8, 9};
int size = 5;
print(arr, size);
cout << endl;
print(arr, size, 2);
return 0;
} | ALGO | 0.985947 | 5.077864 |
bf5771d6-c47b-4724-a00c-21da8c54c943 | codingbbq/problem-solving | codeforces-practice/July2021/071_usb_flash_drives.cpp | //
// Codeforces - A. USB Flash Drives
// https://codeforces.com/problemset/problem/609/A
//
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
int m;
cin >> m;
vector<int> a(n);
for(int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end()... | ALGO | 0.999989 | 5.391928 |
77e24fff-df5f-47eb-85f8-cbc895b4c79c | ssa53/codetree_practice | 250503/N번 더하기/add-n-times.cpp | #include <iostream>
using namespace std;
int main() {
int a,n;
cin>>a>>n;
for(int i=0;i<n;i++){
a += n;
cout <<a<<endl;
}
return 0;
} | ALGO | 0.99985 | 3.201297 |
6eb4f571-12ff-4cad-aa6d-c43e126d15e6 | Yaro2709/AlgoProblems | 11/1674C.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while (t--)
{
string s1, s2;
cin >> s1 >> s2;
long long ans = 1LL << s1.size();
if (s2.size() == 1 && s2[0] == 'a')
cout << 1 << endl;
else if (s2.find('a') != -1)
cout << -1 << endl;
else
cout << ans << endl;
}
return 0... | ALGO | 0.998555 | 3.940595 |
fbaf308d-562c-48f2-a8ae-956fdb53acdb | challenger71498/Algorithm | Greedy/Project1/Project1/1120.cpp | //#include <iostream>
//#include <string>
//#include <climits>
//
//using namespace std;
//
//int main() {
// ios::sync_with_stdio(false);
// cin.tie(NULL);
//
// string a, b;
// cin >> a >> b;
//
// int min = INT_MAX;
//
// for (int i = 0; i <= b.size() - a.size(); ++i) {
// int diff = 0;
//
// for (int j = 0; j < a... | ALGO | 0.999904 | 3.711938 |
c3053be1-0d2f-4f88-9b92-3bd227c5e2c5 | stromhaug/testGeom | src/asiAlgo/editing/asiAlgo_ConvertToBezier.cpp | // Own include
#include "asiAlgo_ConvertToBezier.h"
// Asi include
#include <asiAlgo_Utils.h>
#include <asiAlgo_AppSurfUtils.h>
// OpenCascade include
#include <ShapeUpgrade_ConvertCurve3dToBezier.hxx>
#include <ShapeUpgrade_ConvertSurfaceToBezierBasis.hxx>
#include <ShapeExtend_CompositeSurface.hxx>
#include <GeomCo... | ALGO | 0.986844 | 6.556704 |
ac9bb4de-85dd-4237-8da6-14817f1e3064 | RafailSkoulos17/netflow_classification | lsh/include/eigen/bench/sparse_dense_product.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 -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.998242 | 4.386344 |
dd6cad81-17e9-4dac-95aa-f8791ab1ac78 | synthw-ve/hw02-game-of-life | hw2/game_of_life.cpp | #include "game_of_life.h"
#include <ctime>
using namespace std;
bool game_of_life::random_value() {
// Random number 0-100, if <PROBABILITY return true (PROBABILITY%)
return (rand() % 100) < PROBABILITY;
}
game_of_life::game_of_life() {
for (int i = 0; i < ROWS; i++)
for (int j = 0; j < COLS; j++)
_generation... | ALGO | 0.997412 | 4.61309 |
2efb81b5-5278-40a2-b12e-c25eeb261105 | soolabettu/cp | code_forces/745_2/a.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
using ld = double;
#define ... | ALGO | 0.999883 | 4.505128 |
90557bf4-30bf-4923-aa09-c8eed777a628 | jinlaove17/2024_SSAFY_AlgorithmStudy | Problem_Archive/WEEK_12/JongWoo/BOJ_2629.cpp | /*
문제 접근 아이디어 및 알고리즘 판단 사유
- 추의 개수가 최대 30개이므로 부분 집합으로 모든 경우를 따져보며 합이 구슬의 무게와 수평을 이루는 경우를 찾는것은 2^30의 시간 복잡도를 갖기 때문에 불가능하다고 생각하였다.
아무리 가지치기를 잘해도 10억에 도전하는 완전 탐색은 아닐 것이라는 생각이 들었지만 혹시 모른다는 미련을 남기고 DP, 이분 탐색 등의 알고리즘을 떠올리게 되었다.
- 맨 처음에는 2차원 DP로 dp[3][1]: 1개의 수를 사용하여 3을 만드는 경우의 수, 즉 dp[i][j]를 j개의 수를 사용하여 i를 만드는 경우의 수로 정의... | ALGO | 0.999867 | 5.187559 |
e4db5687-797e-4ca1-a7db-942ba51f2499 | gedeastu/GetX_Flutter | unique_id/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.998685 | 6.763549 |
e2b9f44b-ce69-4d30-a2ec-0f867d93f450 | Mattus02/Kattis | 4.1_bokforing.cpp | // Problem: https://open.kattis.com/problems/bokforing
#include <bits/stdc++.h>
using namespace std;
struct person
{
int wealth;
int time;
};
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int population, events;
cin >> population >> events;
vector<person> persons(population... | ALGO | 0.99864 | 3.763432 |
336d8494-4dc2-4268-b3f6-0d7100b58937 | jeetsavsani1173/LeetCode-Solution | Stack using two queues - GFG/stack-using-two-queues.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
class QueueStack{
private:
queue<int> q1;
queue<int> q2;
public:
void push(int);
int pop();
};
int main()
{
int T;
cin>>T;
while(T--)
{
QueueStack *qs = new QueueStack();
int Q;
cin>>Q;
... | ALGO | 0.995384 | 5.750651 |
5ce8e429-e01f-483f-9c07-bc1b653a72fd | raincross7/code-similarity | codes/train_code/problem403/problem403_420.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace... | ALGO | 0.999734 | 3.59165 |
39815be3-5a82-4878-be5a-b4ccb30b1f53 | KatsuyaKikuchi/ProgrammingContestCpp | AtCoder/Virtual/20211030/B.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
using namespace std;
using ll = long long int;
using pll = pair<ll, ll>;
#define FOR(i, n, m) for(ll i = (m);(i)<(n);++... | ALGO | 0.999928 | 5.337516 |
96ab118b-b46a-41fc-b57d-b0ab342812a6 | arodriguez282005/CS120HelloWorld | Chapter 5/CH5Ex5.cpp | #include <iostream>
using namespace std;
int main ()
{
//print the value of multipules of 3
//from 3 X 1 to 3 X 10
int i = 1;
for(i=1;i<10;i++)
{
cout << i*3 << endl;
}
cout << i << endl;
} | TOOL | 0.994397 | 3.276736 |
7f456324-df6a-44a3-a82a-4b4b3a667460 | JustAG7/Competitive_Programming | ICPC/2023/ICPC Northern 2023/D.cpp | #include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
#define ll long long
#define pb push_back
#define pf push_front
#define db double
#define X first
#define Y second
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define... | ALGO | 0.999116 | 3.527604 |
d34c8332-0a72-46cd-a2b4-b1929ca8a4fc | ganeshalamuru/prg | cses/DP/Rectangle_Cutting.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;typedef long double ld;typedef pair<int,int> pii;
#define F first
#define S second
#define PB push_back
#define MP make_pair
const ll mod = 1e9+7, N = 2e6+7, M = 2e6+7, INF = INT_MAX/10;
ll po... | ALGO | 0.999962 | 4.635014 |
b2908063-a725-41e2-8aea-378ece3dd038 | square/pysurvival | pysurvival/cpp_extensions/functions.cpp | #include <algorithm> // generate
#include <vector> // vector
#include <iterator> // begin, end, and ostream_iterator
#include <functional> // bind
#include <iostream> // cout
#include <ctime> //clock
#include <math.h> /* exp */
#include <map>
#include <utility>
#include <set>
#include <stdlib.h>
#incl... | ALGO | 0.999325 | 4.797622 |
8d5fedb2-5436-4670-87c1-070264b158cb | yash5734/6Companies30Days-Challange | 1248. Count Number of Nice Subarrays.cpp | class Solution {
public:
int subarraySum(vector<int>& nums, int k) {
map<int, int> mp;
mp[0]=1;
int sum = 0;
int ans = 0;
for (int i = 0; i < nums.size(); i++) {
sum += nums[i];
int target = sum-k;
if (mp.fin... | ALGO | 0.999935 | 5.710046 |
a4872afd-f541-47cb-b897-80ecd063f5a4 | Cpasjuste/boost | libs/sort/example/double.cpp | // See http://www.boost.org/libs/sort for library home page.
#include <boost/sort/spreadsort/spreadsort.hpp>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <iostream>
using namespace boost::sort::spreadsort;
#define DATA_T... | ALGO | 0.997508 | 4.945207 |
adddfffd-deb3-4887-b9c6-fa139520b91a | AlapanDas/DSA-Roadmap | Placement_Prep/Basic_Programming_EASY/pixel_damage.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 10000007
int main()
{
ll t;cin>>t;
while(t--)
{
ll x,y,h,w,k;
cin>>h>>w>>x>>y>>k;
ll dist=sqrt((x-h)*(x-h) +(y-w)*(y-w));
// cout<<dist<<endl;
if(dist<k)cout<<1<<endl;
... | ALGO | 0.999724 | 3.1754 |
020eec14-9358-499e-a037-baff2854505e | jhlee1108/algorithms | baekjoon-online-judge/10989/10989.cpp | #include <cstdio>
int main() {
int ans[10001] = {0,};
int n;
scanf("%d", &n);
while(n--) {
int x;
scanf("%d", &x);
ans[x]++;
}
for(int i=0; i<=10000; i++) {
if(ans[i] == 0) continue;
for(int j=0; j<ans[i]; j++)
printf("%d\n", i);
}
... | ALGO | 0.999874 | 3.606863 |
5e60dce2-a694-40d3-96fc-e9ec1f04037b | anttisalonen/projecteuler | problem10/main.cpp | #include "../lib/args.cpp"
static std::vector<ull_t> sieve(ull_t n)
{
std::vector<std::pair<ull_t, bool>> numbers;
std::vector<ull_t> primes;
for(ull_t i = 0; i <= n; i++) {
numbers.push_back({i, false});
}
ull_t p = 2;
while(p < n) {
primes.push_back(p);
ull_t multiplier = 1;
while(p * multiplier <= n... | ALGO | 0.99855 | 5.200678 |
417c68fc-05e7-45d0-8892-ee2e8ff70520 | ishandutta2007/codeforces | matrixcascade_qwq/normal/1647/E.cpp | //#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4", "avx")
#include <bits/stdc++.h>
#include<conio.h>
#define ll long long
#define ull unsigned long long
#define YES puts("YES")
#define NO puts("NO")
#define Yes puts("Yes")
#define No puts("No")
#define edl puts(... | ALGO | 0.999956 | 3.121839 |
7e7c36ff-49f0-4202-bdb3-37f3661f9949 | szekelytibi777/HackerRank | ElectronicShop/ElectronicShop.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
/*
* Complete the getMoneySpent function below.
*/
int getMoneySpent(vector<int> keyboards, vector<int> drives, int b) {
vector<int> prices(keyboards.size() * drives.size(), -1);
int most_expensive = -1;
for(int price_dr... | ALGO | 0.999857 | 4.587377 |
cada7eab-0f36-42dd-a889-c7ed202827bb | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/MixtralExpert/top0-100/maximum-number-of-upgradable-servers-Solution.maxUpgrades/177831_nan.cpp | mcid_char_imp(fz_context *ctx, pdf_filter_processor *p, tag_record *tr, int uni, int remove)
{
if (tr->mcid_obj == NULL)
/* No object, or already deleted */
return;
if (remove)
{
/* Remove the expanded abbreviation, if there is one. */
pdf_dict_del(ctx, tr->mcid_obj, PDF_NAME(E));
/* Remove ... | TOOL | 0.992418 | 5.379378 |
bcc0b96c-96e4-47ef-8cb9-e019db6f87ec | Jaimepas77/Estructuras-de-datos | 45_Eligiendo_deporte/45_Eligiendo_deporte/45_Eligiendo_deporte.cpp | // Nombre del alumno: Jaime Pastrana García
// Usuario del Juez: A56
#include <iostream>
#include <iomanip>
#include <fstream>
#include <unordered_map>
#include <vector>
#include <algorithm>
bool primeraMay(std::string word)
{
return word[0] <= 'Z' && word[0] >= 'A';//Devuelve si la primera letra es mayúscula o n... | ALGO | 0.999578 | 4.857401 |
c4edfbb2-f54b-4251-8dbc-68109c96347a | Dipankar-Kumar-Singh/Codeforces | E_Price_Maximization.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define TestCases int _test {1} ; cin >> _test ; while(_test--)
#define FAST ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin() , (x).end()
#define nl "\n"
int solveForReminders(multiset<int> &s , int k)
{
... | ALGO | 0.999717 | 4.371885 |
d2e82fcf-a369-4a50-a37b-943abd4c2fca | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Mixtral/top0-100/maximum-subarray-min-product-Solution.maxSumMinProduct/177812_Bypass.cpp | void sum_update(const char *p, int32 len)
{
switch (cursum_type) {
case CSUM_MD5:
md5_update(&md, (uchar *)p, len);
break;
case CSUM_MD4:
case CSUM_MD4_OLD:
case CSUM_MD4_BUSTED:
if (len + sumresidue < CSUM_CHUNK) {
memcpy(md.buffer + sumresi... | ALGO | 0.999818 | 5.471822 |
1691b2e1-efa3-4d40-af0a-088b3d36645b | pigeio/DSA | 0547-number-of-provinces/0547-number-of-provinces.cpp | class Solution {
public:
int n ; //global n declared
void DFS(vector<vector<int>>& isConnected , int u , vector<bool> &visited){
visited[u] = true;
for(int v=0 ; v<n;v++){
if(!visited[v] && isConnected[u][v] == 1){ //[current_node][neighbor_node]
DFS(isConnected , v... | ALGO | 0.999981 | 6.197202 |
465ef1cc-6592-4015-aa20-e2589c8c1872 | ishandutta2007/codeforces | tanphatls987/normal/397/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define INPUT freopen("draft.inp","r",stdin)
#define OUTPUT freopen("draft.out","w",stdout)
#define FOR(i,l,r) for(auto i=l;i<=r;i++)
#define REP(i,l,r) for(auto i=l;i<r;i++)
#define FORD(i,l,r) for(auto i=l;i>=r;i--)
#define REPD(i,l,r) f... | ALGO | 0.999952 | 3.312268 |
8ba225e6-0dca-4e82-bf40-e3dd9ce10f67 | ANIKETRAJ28/DSA-and-CP | Linked List/leetcode/add-two-numbers.cpp | #include<bits/stdc++.h>
#define ll long long int
#define infp INT_MAX
#define infn INT_MIN
#define pp pair<int, int>
#define mod 1000000007
using namespace std;
template<typename T>
using vec = vector<T>;
// https://leetcode.com/problems/add-two-numbers/description/
struct ListNode {
int val;
ListNode *next;... | ALGO | 0.999957 | 5.741671 |
093c13cf-56f4-4175-84af-a7065e381fe1 | MingyueX/GreenLens | 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 |
662d2ac5-4cf3-40ab-aa82-e811379431d6 | XiaolongWangChina/Projects | 数据挖掘算法/支持向量机/svm_1.1/nu_solver.cpp | #include "nu_solver.h"
int NU_Solver::select_working_set(int &out_i, int &out_j) {
double mp_alpha = -INF;
int mp_alpha_index = -1;
double mn_alpha = -INF;
int mn_alpha_index = -1;
int t;
for (t = 0; t < active_size; t++) {
if (y[t] == +1) {
if (!is_upper_bound(t)) {
if (-G[t] >= mp_alpha) {
mp_alp... | ALGO | 0.999961 | 4.666025 |
41831337-90a6-48f1-8813-3f57bedff6cf | ahnafraihan/LCS-Algorithms | program3.cpp | //Ahnaf Raihan
//program3.cpp
/* program3.cpp contains methods: int max, int lcs, and int main. program3.cpp serves to demonstrate the use of recursive programming in a top-down fashion using memoization in order to solve the LCS problem. */
#include <stdio.h>
#include <iostream>
#include <string>
#include <fstream>
... | ALGO | 0.999135 | 5.063372 |
0158144a-3399-4b1c-b44d-e3a0b0986842 | bitcoinexa/bitcoinexa | bitcoin/src/util/bip32.cpp | #include <sstream>
#include <stdio.h>
#include <tinyformat.h>
#include <util/bip32.h>
#include <util/strencodings.h>
bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypath)
{
std::stringstream ss(keypath_str);
std::string item;
bool first = true;
while (std::getline(ss, item... | TOOL | 0.906305 | 6.04334 |
414a2bfc-96e1-47e0-9ff8-c19bc437b937 | C10H16/study-notes-cpp | 剑指offer/55.cpp | #include <iostream>
#include <queue>
#include <vector>
#include <stack>
using namespace std;
struct BinaryTreeNode
{
int m_nValue;
BinaryTreeNode* m_pLeft;
BinaryTreeNode* m_pRight;
};
void addLeftCh(BinaryTreeNode* parent,int left) // 添加左孩子
{
parent->m_pLeft = new BinaryTreeNode;
parent->m_pLeft->m_nValue = left... | ALGO | 0.999999 | 4.501365 |
ee6bc118-82a1-4256-989a-0c1078e53540 | noprops/RRGCodingAndCrypto | cocos2d/cocos/3d/CCAABB.cpp | #include "3d/CCAABB.h"
NS_CC_BEGIN
AABB::AABB()
{
reset();
}
AABB::AABB(const Vec3& min, const Vec3& max)
{
set(min, max);
}
AABB::AABB(const AABB& box)
{
set(box._min,box._max);
}
Vec3 AABB::getCenter()
{
Vec3 center;
center.x = 0.5f*(_min.x+_max.x);
center.y = 0.5f*(_min.y+_max.y);
center.z = 0.5... | TOOL | 0.928058 | 7.53548 |
0ba461d5-2eb8-444f-b257-55765327e8e1 | nolan0801/Competitive-Programming | Codeforces/911G.cpp | /*
Author : vidut_206_CNH
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define gcd(a,b) (__gcd(a,b))
#define lcm(a,b) (a/gcd(a,b)*b)
#define sz(x) (int)(x.size())
#define fast_cin() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db(x) cerr << "... | ALGO | 0.999854 | 4.024709 |
972d7970-7ea5-47f0-a26c-a4119f2c0e59 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-coop-gpt35/Codenet/p02400/590715155/response_0.cpp | The provided code calculates the area and circumference of a circle based on the input radius. While the code is simple and straightforward, there are a few potential areas for optimization.
1. Reducing unnecessary precision:
- The constant `PI` is defined with a very high precision, but for most practical purpose... | ALGO | 0.999408 | 6.960411 |
0e8f34c1-e17d-43c4-9692-5b5d92c68ed4 | maria-owd/clasa9 | teza-2022-05/pseudocod2.cpp | #include <iostream>
using namespace std;
int main (){
int x, y;
cout << "x = ";
cin >> x;
while (x>0){
cout << "y = ";
cin >> y;
if (x > y){
cout << x % 10 << endl;
} else{
cout << y % 10 << endl;
}
x = y;
}
return 0;
... | ALGO | 0.992537 | 3.233887 |
99aea117-e43c-422f-894a-0cd02dda7978 | kohandy1902/Algorithms | DS/Li_Chao.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define allv(V) (V).begin(), (V).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<double> base;
const int inf = INT_MAX... | ALGO | 0.999293 | 3.530458 |
8514bd87-7234-47a3-b94b-3380c7d85667 | Hinski2/CP | codeforces/problems/Closest Point/cpp1404.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& v){
for(const auto &u: v){
os << u << ' ';
}
return os;
}
te... | ALGO | 0.999017 | 4.001728 |
3ce61e2b-7735-4b8c-a1ab-0af259f826a3 | PraneethV-cmd/Comprehensive_analysis | question-3/BellmanFord.cpp | #include <iostream>
#include <climits>
#include <vector>
#include <tuple>
#include <map>
// This class represents a graph for the Bellman-Ford algorithm
class Graph {
public:
int vertexCount; // Number of vertices in the graph
std::vector<std::tuple<int, int, int>> edges; // Stores edges as (src, dest, weight... | ALGO | 0.999938 | 6.454211 |
b22fcba2-7c7c-4e42-943f-793524c222f8 | 4maan4hmed/VitEvents | 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 |
667e6613-09b8-42b0-b434-a77eca78694c | x1nixmzeng/z3ResEx | src/cryptolib/square.cpp | // square.cpp - written and placed in the public domain by Wei Dai
// Based on Paulo S.L.M. Barreto's public domain implementation
#include "pch.h"
#include "square.h"
#include "misc.h"
#include "gf256.h"
NAMESPACE_BEGIN(CryptoPP)
// apply theta to a roundkey
static void SquareTransform (word32 in[4], word32 out[4])... | ALGO | 0.999906 | 7.150234 |
7edc0024-7aa7-480d-ab35-ffe5d895325d | Himanshu-Negi8/Data-Structure-and-Algorithms | Leetcode/String/Minimum Number of Steps to Make Two Strings Anagram 1347.cpp | class Solution {
public:
int minSteps(string s, string t) {
map<char,int>mp;
for(int i=0;i<s.length();i++){
mp[s[i]]++;
}
for(int i=0;i<t.length();i++){
if(mp.find(t[i])!=mp.end() and mp[t[i]]!=0){
mp[t[i]]--;
}
... | ALGO | 0.999979 | 6.040237 |
078263aa-50cf-44db-b827-7f13b7cb3ed7 | ologn-tech/opencv | modules/ml/src/nbayes.cpp | #include "precomp.hpp"
namespace cv {
namespace ml {
class NormalBayesClassifierImpl : public NormalBayesClassifier
{
public:
NormalBayesClassifierImpl()
{
nallvars = 0;
}
bool train( const Ptr<TrainData>& trainData, int flags ) CV_OVERRIDE
{
CV_Assert(!trainData.empty());
... | ALGO | 0.995214 | 6.525867 |
45c58391-6463-4725-92fc-e77066133146 | Noblis/INVSC-janus | src/utils/janus_evaluate_search.cpp | #include <stdlib.h>
#include <string.h>
#include <fstream>
#include "iarpa_janus.h"
#include "iarpa_janus_io.h"
using namespace std;
const char *get_ext(const char *filename) {
const char *dot = strrchr(filename, '.');
if (!dot || dot == filename) return "";
return dot + 1;
}
void printUsage()
{
prin... | TOOL | 0.941227 | 5.094529 |
2c6274dd-59f9-4920-807f-8a2ef3c20130 | Midas847/Competitive-Coding | LeetCode Submissions/sort-characters-by-frequency/Accepted/10-22-2021, 8_08_59 AM/Solution.cpp | // https://leetcode.com/problems/sort-characters-by-frequency
class Solution {
public:
string frequencySort(string s) {
int count[256] = {0};
for(auto ch:s)
++count[ch];
sort(s.begin(),s.end(),[&](char a,char b){
return count[a] > count[b] || (count[a] == count[b] &&... | ALGO | 0.999984 | 6.220883 |
ed3cf2ee-9614-4508-b0e3-d51b8e896132 | Myself-Pankaj/DSA-NOTES | graph/bfsProblem.cpp | #include <bits/stdc++.h>
using namespace std;
class bfsProblem
{
private:
/* data */
public:
//surroundedRegion
void SurroundedRegions(vector<vector<char>>& board) {
int n = board.size();
int m = board[0].size();
vector<vector<bool>>vis(n,vector<bool>(m,false));
queue<pair<i... | ALGO | 0.999919 | 5.682102 |
8f3095e4-150e-40a3-9481-262ddd615362 | rituraj0/Topcoder | Old Topcoder SRM codes/RadioRange.cpp | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <fstream>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <map>
#include <... | ALGO | 0.998195 | 3.646352 |
059a31c7-38b8-4371-8a7e-04a8b11034f9 | Werewolflsp/LeetCode | search_in_rotated_sorted_array_ii.cpp | /****************************************************************
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Write a function to determine if a given target is in the array.
*************************************************... | ALGO | 0.999977 | 6.331932 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.