uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
830e6617-bfc3-41a2-8111-5916c0be71ba | ishandutta2007/codeforces | shmilyty/normal/1607/F.cpp | //#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#define int long long
#define rg register int
#define elif else if
#define ALL(x) x.begin(),x.end()
using namespace std;
const int N=2003,S=N*N;
int t,n,m,cnt,rt,tot,dfn,dx[26],dy[26],to[S],dis[S],vis[S];
bool ok[S];
string s[N];
int hsh(int x,int y)
{
return ... | ALGO | 0.999968 | 3.321873 |
de31327a-86e5-4b81-b742-6caebf325a26 | willjhliang/usa-computing-olympiad | competition/gold/usaco2018/P3_Shortcut.cpp |
#include <bits/stdc++.h>
#define MAX_N 10000
#define f first
#define s second
using namespace std;
long long a[MAX_N + 1];
long long from[MAX_N + 1], dist[MAX_N + 1];
vector<pair<long long, long long>> c[MAX_N + 1];
long long sum[MAX_N + 1];
struct State {
long long at, from, len;
bool operator<(const State &a) ... | ALGO | 0.999978 | 4.290026 |
db844e39-6b7c-44be-9b13-b24698b5a17b | THTBSE/Stability | stable/stable.cpp | #include "stable.h"
#include "../GeoToolkit/GeoToolkit.h"
stability::stability(TriMesh* mesh):volumes(0.0),area(0.0),modelMesh(mesh)
{
splane.second = vec(0,0,1);
}
void stability::getBaseData()
{
if (!modelMesh || modelMesh->vertices.empty() || modelMesh->faces.empty())
{
printf("error mesh ");
return;
}
c... | TOOL | 0.935246 | 5.382794 |
d448dfee-2e0c-4061-9149-6f2a21374104 | VedantKaulgekar/CollegeDSAL | Assignment_11.cpp | #include <iostream>
#include <climits>
#include <vector>
#include <stack>
using namespace std;
#define MAX_CITIES 100 // Define the maximum number of cities
// Struct to store information about each node in the BFS queue
struct QueueNode
{
int stops; // Number of stops made so far
int node; //... | ALGO | 0.999656 | 6.438161 |
ed1b7be6-4fa3-4c83-968c-f83ac09348c7 | rocket3989/hackerEarth2019 | october circuits/countOfInt.cpp | #include <bits/stdc++.h>
using namespace std;
const long N = 100000001;
char *sieve;
void get_primes(unsigned long max){
sieve = new char[max/8+1];
memset(sieve, 0xFF, (max/8+1) * sizeof(char));
for(unsigned long x = 2; x <= max; x++)
if(sieve[x/8] & (0x01 << (x % 8)))
for(unsigned lo... | ALGO | 0.998049 | 4.054223 |
327c0dcf-2234-4c80-8671-55ae9ba2e74a | phoenixGit228/cpp | cpp_primer_plus_6th/chapter04/4-14-address.cpp | // ///////////////////////////////////////////////////////
// 名称: address.cpp
// 描述: 使用&运算符找到变量地址
// 日期: 2021-05-04 09:29:12
// ///////////////////////////////////////////////////////
#include <iostream>
int main(void)
{
using namespace std;
int donuts = 6;
double cups = 4.5;
cout << "donuts value = " ... | TOOL | 0.956346 | 5.384277 |
a1cc4e42-d08c-4f1e-9aaa-7a9c02877a7e | akhil11101997/Striver-SDE-Sheet | Binary Search/Single Element in a Sorted Array.cpp | class Solution {
public:
int singleNonDuplicate(vector<int>& nums) {
int low=0,high=nums.size()-2;
while(low<=high){
int mid=low+(high-low)/2;
if(nums[mid]==nums[mid^1]){
low=mid+1;
}
else{
high=mid-1;
}
... | ALGO | 0.999908 | 5.910195 |
b8fce86a-bfd9-4630-8009-8403830a8821 | king-yyf/algo_template | string/StringHash.cpp | #include<bits/stdc++.h>
using namespace std;
template<const unsigned &MOD>
struct _m_uint {
unsigned val;
_m_uint(int64_t v = 0) {
if (v < 0) v = v % MOD + MOD; if (v >= MOD) v %= MOD;
val = unsigned(v);
}
_m_uint(uint64_t v) { if (v >= MOD) v %= MOD; val = unsigned(v);}
_m_uint(int... | ALGO | 0.999589 | 4.73486 |
3ea9b0ec-e46e-41e8-babc-3558c32d093d | amessing/grstaps | src/Search/UniformCostSearch.cpp | #ifndef GRSTAPS_UNIFORMCOSTCPP
#define GRSTAPS_UNIFORMCOSTCPP
// internal
#include "grstaps/Search/UniformCostSearch.h"
#include "grstaps/Graph/Graph.h"
#include "grstaps/Graph/Node.h"
#include "grstaps/Search/GoalLocator.h"
#include "grstaps/Search/NodeExpander.h"
#include "grstaps/Search/SearchComparators.h"
#inclu... | ALGO | 0.998479 | 7.105773 |
e26375fe-f0ad-4bba-8843-82ad8b741975 | andrefakhoury/competitive-programming | problems/solutions/Brazilian Summer School/Summer School 2019/Dia 4/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef long long ll;
const int MAXN = 100005;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
int memo[MAXN];
int solve(int n) {
if (n ==)
}
int main() {
// ios::sync_with_stdio(false); c... | ALGO | 0.999641 | 4.129241 |
915bfb23-5d94-49c1-8b5c-f1e65e459ac3 | MarcusSamuelsson/1TD317 | Task3/Calculator.cpp | #include <iostream>
using namespace std;
//***************************************************************************
//Funktion skrivInfo
//Syfte: Skriver ut information om programmets funktion.
void skrivInfo()
{
cout << "This program performs simple calculations given two numbers and an operator." << endl << ... | ALGO | 0.992484 | 4.399379 |
16d36ccb-18a3-4fe4-928e-7e2aff2f4312 | mejibyte/competitive_programming | URI/1412 - Code Lock/1.cpp | // Stolen from https://github.com/gustavosm/uri/blob/master/1412.cpp
// Accepted
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v;
string aux;
string s;
int pos1, pos2;
int ans = 0;
while (getline(cin, s))
{
if (s == "*") return 0;
aux.push_back('a');
aux += s;
aux.push_back('a... | ALGO | 0.999656 | 3.626749 |
c8dd5c2d-b6ec-4fae-9ae7-7d7c7d2ee886 | sud-dev/Algorithm-DS-Practice | CodingNinjas/Prerequisite/target_marbles.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,target,index=-1;
cin>>n>>target;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
unordered_set<int> ss;
int flag=0;
string output="false";
for(int i=0;i<n;i++){
if(a[i]==0){
output="true";
cout<<output<<endl;
cout<<a[i]<<" ";
}
... | ALGO | 0.999507 | 3.596213 |
fd15bdfc-1547-4289-ba35-814a4bb546dc | AndreiAlbert/http_cpp | src/utils.cpp | #include "../include/utils.hpp"
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <filesystem>
#include <stdexcept>
#include <unordered_map>
namespace fs = std::filesystem;
namespace utils {
std::string get_mime_type(const std::string& file_name) {
size_t pos = file_nam... | TOOL | 0.925665 | 5.849433 |
1b17e61f-92c7-4b1b-8b7b-8ddfab302eb1 | Saran-sama/leetcode-solutions | Intersection_of_Two_Arrays.cpp | class Solution {
public:
vector<int> intersection(vector<int>& nums1, vector<int>& nums2)
{
vector<int> result;
for (auto& num1 : nums1)
{
for (auto i = 0; i < nums2.size(); i++)
{
if (num1 == nums2[i])
{
if (st... | ALGO | 0.99983 | 5.872365 |
7f05093d-b2ed-48a1-a96b-251eebc5555e | danieltrt/SBFL | TransCoder_tokenized_test_set_functions/cpp/NUMBER_SUBSEQUENCES_AB_STRING_REPEATED_K_TIMES.cpp | int countOccurrences ( string s, int K ) {
int n = s . length ( );
int C, c1 = 0, c2 = 0;
for ( int i = 0;
i < n;
i ++ ) {
if ( s [ i ] == 'a' ) c1 ++;
if ( s [ i ] == 'b' ) {
c2 ++;
C += c1;
}
}
return C * K + ( K * ( K - 1 ) / 2 ) * c1 * c2;
} | ALGO | 0.998717 | 4.597018 |
c38507e5-9f54-423c-9afd-ffe07c37fa76 | jwseph/competitive-programming | usaco/15/dec/p2.cpp | #include <bits/stdc++.h>
using namespace std;
const int N =5e4+5;
int n;
int ar[N], l[N], r[N];
set<int> b1, b2;
int main() {
ifstream cin("cardgame.in");
ofstream cout("cardgame.out");
cin >> n;
for (int i = 1; i <= 2*n; ++i) {
b1.insert(i);
b2.insert(i);
}
for (int i = 0; i <... | ALGO | 0.999829 | 3.947136 |
950776d1-e2ee-4890-8402-575ce83c53a3 | majorgabor/leetcode | 1_two_sum.cpp | #include <iostream>
#include <vector>
#include <map>
#include "my_utils.h"
std::vector<int> twoSum(std::vector<int> &nums, int target)
{
std::map<int, int> seen{{target - nums[0], 0}};
for (int i = 1; i < nums.size(); i++)
{
if (auto it = seen.find(nums[i]); it != seen.end())
{
... | ALGO | 0.999445 | 6.245098 |
84187684-614f-4a13-880b-3b98eca97a62 | tudelft/CUAHN-VIO | cuahn_ros/ov_eval/src/alignment/AlignTrajectory.cpp | #include "AlignTrajectory.h"
using namespace ov_eval;
void AlignTrajectory::align_trajectory(const std::vector<Eigen::Matrix<double, 7, 1>> &traj_es,
const std::vector<Eigen::Matrix<double, 7, 1>> &traj_gt, Eigen::Matrix3d &R, Eigen::Vector3d &t,
... | ALGO | 0.996787 | 4.949715 |
e719ca92-941d-4f6b-96f9-b49288e7fcc7 | RPComputer/Epidemiological-BioPEPA-Model | BioPEPA workbench/stochkit/test/old/pdimer/DimerStats.cpp | //******************************************************************************
//* FILE: DimerStats.cpp
//*
//* AUTHOR: HongLi
//*
//* CREATED: Mar 06, 2005
//*
//* LAST MODIFIED:
//* BY:
//* TO:
//* SUMMARY:
//*
//*
//* NOTES:
//*
//*
//*
//* TO DO:
//*
//*
//************************... | ALGO | 0.993305 | 5.377337 |
1153d747-4697-4d78-963a-e773b62a6536 | wit221/pedsimpar | libpedsim/examples/example04.cpp | #include "ped_includes.h"
#include <iostream>
#include <cstdlib>
#include <chrono>
#include <thread>
#include <cmath>
#include <algorithm>
using namespace std;
int main(int argc, char *argv[]) {
cout << "PedSim Example using libpedsim version " << Ped::LIBPEDSIM_VERSION << endl;
Ped::OutputWriter *ow = new P... | TOOL | 0.96015 | 4.215766 |
92bf3ac7-9f5e-4aae-83bd-2abf835c3b4c | ingenieursaurav/Platform_External_Skia | src/pathops/SkOpBuilder.cpp | #include "SkArenaAlloc.h"
#include "SkMatrix.h"
#include "SkOpEdgeBuilder.h"
#include "SkPathPriv.h"
#include "SkPathOps.h"
#include "SkPathOpsCommon.h"
static bool one_contour(const SkPath& path) {
SkSTArenaAlloc<256> allocator;
int verbCount = path.countVerbs();
uint8_t* verbs = (uint8_t*) allocator.make... | TOOL | 0.996873 | 7.33532 |
a6754124-38a5-4a42-98d1-eecbffec3f6d | chenquan16/PL-track-VIO | vins_estimator/src/initial/initial_aligment.cpp | #include "initial_alignment.h"
void solveGyroscopeBias(map<double, ImageFrame> &all_image_frame, Vector3d* Bgs)
{
Matrix3d A;
Vector3d b;
Vector3d delta_bg;
A.setZero();
b.setZero();
map<double, ImageFrame>::iterator frame_i;
map<double, ImageFrame>::iterator frame_j;
for (frame_i = all... | ALGO | 0.939907 | 3.13961 |
56fa2697-85b7-4850-aee4-7c64cc16c626 | Gabyyi/highschool-code | Proiecte_92.cpp | #include<iostream>
#include<fstream>
using namespace std;
struct
{
int ord,t;
}v[1001];
int main()
{
ifstream cin("proiecte.in");
ofstream cout("proiecte.out");
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>v[i].t;
v[i].ord=i;
}
for(int i=1;i<n;i++)
for(int j=i... | ALGO | 0.999932 | 3.686065 |
a3d79a67-583d-4d74-8995-bf2cc94feebf | mihneadinik/LFA | checker/tema30.cpp | #include <iostream>
#include <vector>
#include <string>
void read_args(int &n, int &m, int &s, int ***transitions, int **sources) {
std::cin >> n >> m >> s;
// create and read transition matrix
*transitions = new int*[n];
for (int i = 0; i < n; i++) {
(*transitions)[i] = new int[m];
for (int j = 0; j < m; j++... | ALGO | 0.998416 | 5.454554 |
f40011a8-9d30-402b-b043-5a7dfe18c6b6 | tibovanheule/pds | HWA1/matmatB.cpp | // Your name: ...
#include <cstdlib>
#include <iostream>
#include <chrono>
#include <ctime>
#include <cstring>
#include <cmath>
using namespace std;
using namespace std::chrono;
// ==========================================================================
// TIMING ROUTINES
// =======================================... | ALGO | 0.998955 | 4.955832 |
52a1beb4-c8b0-43b4-b00e-bae75f581beb | harsh-malik-0803/bop | if else/12solution.cpp | /* Without using && etc, find max as well as min out of 3 numbers. Same if should be
used to find max as well as min. Aim to use minimum number of if statements */
#include<stdio.h>
int main()
{
float a,b,c;
printf("enter the three numbers ");
scanf("%f%f%f",&a,&b,&c);
float max,min;
if(a>b){
if(a>c){
max=a... | ALGO | 0.999661 | 3.292485 |
9ff282ca-6e54-4b7b-b5f7-3df66ccbd253 | solisjose46/my_dsa_cpp | linkedlist/sll/SLL.cpp | #include "Node.cpp"
/**
* This is my generic implementation of singly linked list
*
* Jose Salazar 1/14/22
* **/
template <class T>
class SLL {
Node<T>* head;
int size;
public:
SLL() : head(NULL), size(0) {}
SLL(T data);
int getSize() const;
void insert(T data);
bool find(T data);
void remove(T data... | ALGO | 0.986764 | 3.944901 |
d30c2809-5afb-4990-b892-6e98825b3d02 | amirhossainalif/COMPILER_DESIGN | findFirst.cpp | /*E -> TE'
E' -> +TE'| #
T -> FT'
T' -> *FT' | #
F -> (E) | id | a | b
Write a C/C++ program to calculate the First set only.*/
#include<iostream>
#include<vector>
#include<set>
using namespace std;
void findFirst(char, int, int);
vector<set<char>> calc_first(10);
vector<string> production{"E=TE'", "... | ALGO | 0.998728 | 3.952067 |
097a000c-cfeb-4779-a8d8-369fc4e56ea6 | perera69/Paddycare-frontend | 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.998762 | 6.786404 |
ed418b62-d56a-4be2-89f0-6c769794b25a | ilaypaz/Portfolio | Data-Structures-Algorithms/WeightedGraph-Project/src/main.cpp | #include "WeightedGraph.h"
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <climits> // For INT_MAX
using namespace std;
int main() {
// Create an adjacency matrix to represent the graph
vector<vector<int> > adjacencyMatrix = {
{0, 1, 3, 0, 0},
{1, 0, 1,-6,0},
... | ALGO | 0.999667 | 5.549594 |
0a1a9418-ae6d-464c-8eaf-7f431ecbd71a | CBETbl4/ITAP---2024-2025 | VII - Строки/VII - Строки/IV.cpp | using namespace std;
#include <iostream>
#include <string>
<<<<<<< HEAD
bool incl_num(string s)
{
for (int i = 0;i <= s.size();i++)
if (isdigit(s[i])) return true;
return false;
}
=======
//bool incl_num(string s)
//{
// for (int i = 0;i <= s.size();i++)
// if (isdigit(s[i])) return true;
// return false;
//}
>>>>... | ALGO | 0.999723 | 3.719055 |
3201af64-3567-4239-89db-f4e9817da31b | bdqnghi/bi-tbcnn | code/bfs/cpp/22.cpp | #include "Bfs.hpp"
void Bfs::set_target_graph(graph* c_graph, const std::string& c_vertex)
{
target_graph = c_graph;
target_vertex = c_vertex;
}
std::vector<vertex*>* Bfs::get_traversal_path()
{
return &m_travers;
}
void Bfs::show_traversal()
{
std::vector<vertex*>::iterator it_begin = m_travers.begin();
st... | ALGO | 0.98863 | 4.322873 |
455a59ad-e093-43f7-9ab9-df56428177d8 | MuhammadAmitHasan/XPSC | Practices/Week_2_Practice/N_Minor_Change.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s, t;
int change = 0;
cin >> s >> t;
for (int i = 0; i < s.length(); i++)
{
if (s[i] != t[i])
change++;
}
cout << change;
return 0;
}
// https://atcoder.jp/contests/abc172/submissions/me | ALGO | 0.999938 | 4.497437 |
b302ac41-dec9-404d-9245-10798693d067 | ishandutta2007/codeforces | gabrielwu/normal/1558/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define mp make_pair
// #define MOD 1000000007
int MOD;
#define f first
#define s second
#define rand(i, j) uniform_int_distribution<ll>((ll)(i), (ll)(j))(rng)
mt19937 rng(std::chrono::steady_clock::now(... | ALGO | 0.999967 | 4.864345 |
f539f2f6-5b37-4b17-8c4a-f55d1c3cac00 | st128757/2024-autumn-cpp | 2024.10.09_HW_4/Project4/Source.cpp | #include<cstdio>
int main(int argc, char* argv[])
{
int a[1000] = { 0 };
int n = 0;
scanf_s("%d", &n);
for (int i = 0; i < n; ++i)
{
scanf_s("%d", &a[i]);
}
int maxsum = a[n - 1] + a[0] + a[1];
for (int i = 1; i < n; ++i)
{
if (maxsum < a[i - 1] + a[i] + a[i + 1])
{
maxsum = a[i - 1] + a[i] + a[i ... | ALGO | 0.99978 | 3.971342 |
c49c6440-5849-4d6c-88fa-b682d4d5cf29 | shreyaag25/Leetcode | 0343-integer-break/0343-integer-break.cpp | class Solution {
public:
int integerBreak(int n) {
//DP solution - O(n^2) SC- O(n)
// int dp[59] = {-1};
// if(n==2)
// return 1;
// if(n==3)
// return 2;
// dp[1] = 1;
// dp[2] = 2;
// dp[3] = 3;
// int maxi = INT_MIN;
... | ALGO | 0.999995 | 5.892194 |
8938c2e7-2c91-43e3-9bb2-5f2ca406b1d1 | ShelpAm/competitive_programming | competitest/NowCoder/unknown_contest/小红的01串(五)/main.cpp | #pragma once
// Problem: 小红的01串(五)
// Contest: unknown_contest
// Judge: NowCoder
// URL: https://ac.nowcoder.com/acm/contest/98256/E
// Start: Sun 15 Dec 2024 07:45:10 PM CST
// Author: ShelpAm
// #include <bits/stdc++.h>
#include <algorithm>
#include <bit>
#include <bitset>
#include <cassert>
#include <chrono>
#inc... | ALGO | 0.999978 | 5.534873 |
9ecf24d1-876c-4500-8760-4c589e7fd28c | ishandutta2007/codeforces | monogon/normal/1536/D.cpp |
#include <bits/stdc++.h>
#define ll long long
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pii pair<int, int>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
using namespace std;
template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
... | ALGO | 0.999621 | 4.812673 |
db78b7ab-2b2c-4114-a9f9-e64a6a09047f | supersupercoconut/leetcode | leetcode/editor/cn/leetcode_num_513.cpp | //import universal *.h
#include "../../../stdc.h"
using namespace std;
namespace solution513{
//leetcode submit region begin(Prohibit modification and deletion)
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0),... | ALGO | 0.999993 | 5.937331 |
0cd5fdf5-b081-462b-9f27-665380cc5805 | PawanKumar85/DSA | left_rotate.cpp | #include <iostream>
#include <vector>
using namespace std;
int display(vector<int>a)
{
for (auto value : a)
cout << value << " ";
return 0;
}
int left(vector<int>a,int d)
{
for (int i = 0; i < d; i++)
{
int temp = a[0];
for (int j = 0; j < (a.size() - 1); j++)
{
... | ALGO | 0.999874 | 4.563637 |
136f7813-2ce2-49bd-81c6-dbe0b6655e2c | dzhang1024/CodingChallenges | LeetCode/morseCode.cpp | //super naive solution
class Solution {
public:
int uniqueMorseRepresentations(vector<string>& words) {
string morse[26] = {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};
string alphabet ... | ALGO | 0.999963 | 6.368361 |
618e24fc-fdcd-49d8-958d-1a7974e776fb | ccameron07/CSE380_Project | FEM/src/solvers.cpp | #include "./eigen3/Eigen/Dense"
#include "./eigen3/Eigen/Sparse"
#include <iostream>
#include "solvers.hpp"
#include <grvy.h>
using namespace Eigen;
using namespace GRVY;
Solver::Solver(int method_init, double tol_init, int max_iter_init, int report_interval_init, bool report_init) {
method = method_init ;
tol = ... | ALGO | 0.999931 | 4.687352 |
81cdb519-da22-45aa-81dd-0b5c613f982a | Raquelcuartero/C- | numero_entero.cpp | /*Este prograama sirve para leer 10 numeros enteros y devolver
el mayor*/
#include<iostream>
int main(){
//Definicion de variable
int cont;
int numero;
int mayor;
int salir;
//Bucle tipo for*cont=cont+1 es lo mismo que poner cont++
//for(cont=10;cont>=0;cont--{....
std::cout<<"dim... | ALGO | 0.904843 | 3.286567 |
f41b34aa-603e-457c-8c3d-ac52f7db192a | addRajj/Leet-Code | Reverse a Stack - GFG/reverse-a-stack.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
void insert_better(stack<int>&st , int val)
{
if(st.size()==0)
{
st.push(val);
return;
... | ALGO | 0.999912 | 6.199086 |
45b34849-869f-4c49-af46-ebc653dcec38 | wakita/agi3d | src/reprojection18.cpp | #include <stdio.h>
#include <math.h>
#include <lbfgs.h>
#include <iostream>
using namespace std;
struct coefficients{
lbfgsfloatval_t * _new_pos;
lbfgsfloatval_t * _pre_pos;
lbfgsfloatval_t norm_f0;
};
//Set Objective-function & Gradient Vector
static lbfgsfloatval_t evaluate(
void *instance,
... | ALGO | 0.999975 | 3.21764 |
d6d9e093-c00d-4ae4-9a97-0bc48429fd56 | sjtu-imperishable-night/code-library | Template/Template of Other Teams/Spear-of-Longinus/template/template_limited/source/data-structure/mo-teamontree.cpp | bool operator<(qes a,qes b){
if(dfn[a.x]/B!=dfn[b.x]/B)return dfn[a.x]/B<dfn[b.x]/B;
if(dfn[a.y]/B!=dfn[b.y]/B)return dfn[a.y]/B<dfn[b.y]/B;
if(a.tm/B!=b.tm/B)return a.tm/B<b.tm/B;
return a.tm<b.tm;
}
void vxor(int x){
if(vis[x])ans-=(LL)W[cnt[col[x]]]*V[col[x]],cnt[col[x]]--;
else cnt[col[x]]+... | ALGO | 0.999947 | 4.255898 |
ede0b95c-1012-44df-9ca0-e67d312a7431 | NickAmels/orbslam-windows | Thirdparty/eigen/doc/examples/class_CwiseUnaryOp_ptrfun.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define function to be applied coefficient-wise
double ramp(double x)
{
if (x > 0)
return x;
else
return 0;
}
int main(int, char**)
{
Matrix4d m1 = Matrix4d::Random();
cout << m1 << endl << "becomes: " << endl << ... | ALGO | 0.98749 | 4.120226 |
e2ba9584-a0f6-43a9-80b7-1ef21f52c00f | Joby-John/strivers_dsa_list | Studies/recurssion/fibonacciRecurssion.cpp | #include<bits/stdc++.h>
using namespace std;
int fibonacci(int n)
{
if(n<=1)
{
return n;
}
//int last = fibonacci(n-1);
//int secondLast = fibonacci(n-2);
return(fibonacci(n-1)+fibonacci(n-2));
}
int main()
{
int n;
cin>>n;
int result = fibonacci(n);
cout<<result;
... | ALGO | 0.999942 | 5.020543 |
42c1725a-90cf-48fb-aa9b-0d7ec07029be | yashparmar15/Cpp-Codes | Employee_Importance.cpp | /*You are given a data structure of employee information, which includes the employee's unique id, their importance value and their direct subordinates' id.
For example, employee 1 is the leader of employee 2, and employee 2 is the leader of employee 3. They have importance value 15, 10 and 5, respectively. Then emplo... | ALGO | 0.999974 | 6.14044 |
2e659640-3358-49e2-97be-450900db9e53 | raincross7/code-similarity | codes/train_code/problem016/problem016_462.cpp | #include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll... | ALGO | 0.999993 | 4.314888 |
41b130b9-df35-4070-b65a-a5d2c987439e | burhankangsi/Hackerrank_Solutions_Problem_Solving | The Time in Words.cpp | #include <bits/stdc++.h>
using namespace std;
string hourName(int h)
{
char hour[100];
if(h == 1)
{
return "one";
}
else if(h == 2)
{
return "two";
}
else if(h == 3)
{
return "three";
}
else if(h == 4)
{
return "four";
}
e... | ALGO | 0.991945 | 6.233627 |
a8aaff88-916e-49a0-b371-5c350a7f11cf | vp1099/My-CSES-Solutions | Message Route.cpp | #include <bits/stdc++.h>
using namespace std;
constexpr int maxn = 200000;
vector<int> G[maxn];
int dist[maxn], parent[maxn];
int main() {
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++)
dist[i] = maxn, parent[i] = -1;
while (m--) {
int u, v;
cin >> u >> v;
G[u].push_back(v);
G[v].push_back(u);
... | ALGO | 0.999986 | 4.883638 |
ae4fe23a-9204-4e3c-905a-714f63ea0aec | athlon4011/H.O.M.E.R. | Arduino/libraries/Robot_Control/arch/avr/Squawk.cpp | // Squawk Soft-Synthesizer Library for Arduino
//
// Davey Taylor 2013
// <EMAIL>
#include "Squawk.h"
// Period range, used for clamping
#define PERIOD_MIN 28
#define PERIOD_MAX 3424
// Convenience macros
#define LO4(V) ((V) & 0x0F)
#define HI4(V) (((V) & 0xF0) >> 4)
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#... | TOOL | 0.861234 | 6.239051 |
e4bd3099-0de9-412e-9ff6-ed4335386aa6 | HellicarAndLewis/ProjectDonk | addons/ofxBullet/lib/bullet/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp | #include "LinearMath/btScalar.h"
#include "SphereTriangleDetector.h"
#include "BulletCollision/CollisionShapes/btTriangleShape.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
SphereTriangleDetector::SphereTriangleDetector(btSphereShape* sphere,btTriangleShape* triangle,btScalar contactBreakingThreshold)
... | ALGO | 0.998363 | 7.268291 |
00b63bd9-bfdc-4291-be86-a0774adb4c0c | trilinos/Trilinos | packages/trilinoscouplings/examples/scaling/HybridIntrepidPoisson3D_Pamgen_Tpetra_main.cpp | /** \file HybridIntrepidPoisson3D_Pamgen_Tpetra_main.cpp
\brief Example: Discretize Poisson's equation with Dirichlet
boundary conditions on a hexahedral mesh using nodal
(Hgrad) elements. The system is assembled into Tpetra data
structures, and optionally solved.
This... | ALGO | 0.999336 | 6.46556 |
ae16284b-5c15-4aa8-ba1e-c38904b18249 | Adityasharma15/Data-Structures | Graph-Prateek_Narang.cpp/Snakes-ladder.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
class Graph
{
ll V;
list<int> *adjlist;
public:
Graph(ll v)
{
V = v;
adjlist = new list<int>[V];
}
void add(ll a, ll b)
{
adjlist[a].push_back(b);
}
ll bfs()
{
bool visited[30];
ll parent[30];
ll distance[3... | ALGO | 0.999864 | 4.581485 |
9f15f85d-2bbe-496a-8427-66cc7e795d6f | DanilishinArtem/code_to_time | neetcode/trees/cppRealizations/constructBinaryTreeFromPreorderAndInorderTraversal.cpp | #include "btf.h"
#include <vector>
#include <algorithm>
class Solution {
public:
TreeNode* buildTree(vector<int>& preorder, vector<int>& inorder) {
if(preorder.size() == 0 || inorder.size() == 0) return nullptr;
TreeNode* root = new TreeNode(preorder[0]);
int mid = find(inorder.begin(), in... | ALGO | 0.999992 | 6.633646 |
409f7628-1af2-44e7-8d77-d87428f82781 | arpu-nagar/Coding | codeforces/1451/C.cpp | // author: arpunagar
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
#define inv(v) \
for (auto &it : v) \
cin >> it;
#define MOD 1000000007
#define pb push_back
#define popb... | ALGO | 0.999941 | 4.716924 |
c6cbd198-08b9-4222-a0fc-2dc2d2197250 | zitengzela/LegionCore-7.3.5 | dep/recastnavigation/Recast/Source/RecastFilter.cpp | #define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
#include "Recast.h"
#include "RecastAssert.h"
/// @par
///
/// Allows the formation of walkable regions that will flow over low lying
/// objects such as curbs, and up structures such as stairways.
///
/// Two neighboring spans are walkable if: <tt>rcAb... | ALGO | 0.983283 | 6.925026 |
f0f4712a-5b18-4fc0-a5f8-7c2e7b3533f0 | CedricKuang/LeetCode | easy/110.balanced-binary-tree.cpp | /*
* @lc app=leetcode id=110 lang=cpp
*
* [110] Balanced Binary Tree
*/
// @lc code=start
/**
* 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(... | ALGO | 0.99983 | 7.113524 |
8fbb882e-3656-4223-8f75-e1578394fdb3 | aashitsoni/Algorithms | Sorting and Searching/divideTwoIntegers.cpp | /*
Divide Two Integers
Solution
Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator.
Return the quotient after dividing dividend by divisor.
The integer division should truncate toward zero, which means losing its fractional part. For example, truncat... | ALGO | 0.999928 | 6.765782 |
a65ce857-94af-4661-ba33-fa52f8a6e852 | sajeebju/ds-algo | Codeforces/Football.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
char str[100];
cin>> str;
int flag = 1;
for(int i = 1; i < strlen(str); i++){
if(str[i] == str[i-1]){
flag++;
if(flag == 7){
cout << "YES";
return 0;
}
}
els... | ALGO | 0.999947 | 3.684212 |
73c22dba-5e66-4bbe-8eb2-d0b91184d599 | MahinAshraful/CodeWatch_Data | sample-data/p00013/s887595023.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#define INF 100000000
using namespace std;
typedef long long ll;
int main(){
stack<int> st;
while(1){
int n;
if(!(cin>>n))break;
... | ALGO | 0.999711 | 3.896244 |
a0ebd9ab-a8de-4789-bc1c-e728a87c3280 | zxyDEDIRE/ACM_CODE | 多校/The 2021 ICPC Asia Macau Regional Contest/I.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pp(x) array<int,x>
using ull=unsigned long long;
using ll=long long;
using pii=pair<int,int>;
using pdd=pair<double,double>;
const int dx[]={0,0,1,-1,1,-1,1,-1};
const int dy[]={1,-1,0,0,1,-1,-1,1};
const int mod=998244353;
const int inf=0x3f3f3f3f;... | ALGO | 0.999966 | 4.150138 |
63b0f4a2-82fe-4148-a7e1-9d98f99c3b28 | 0xK3rn3lP4n1c/Cpp_Programming_Notes | Codes/Lec.72 - string substrings, swapping, and finding.cpp | #include <iostream>
#include <string>
using namespace std;
// Substring is a function for writing smaller strings from bigger strings
// Swap function basically takes a string and swaps it with another
// Find function finds the first occurrance of the character you have given in a string
int main()
{
string s1("I... | ALGO | 0.986051 | 4.178157 |
52b216f2-2309-46a2-bbb7-4dbb08fd2d46 | SenpaiPlz/Forritun-1.-HR-Vetur-2015. | Skil/hv1_3.cpp | #include <iostream>
using namespace std;
int main ()
{
int num1 = 0;
int num2 = 0;
int sum = 0;
cin >> num1 >> num2;
sum = num1 + num2;
cout << sum;
return 0;
} | ALGO | 0.992372 | 3.45115 |
6a54400d-edc3-4a0f-958a-f4fef8dcbfbd | durgirajesh/Leetcode | Goal Parser Interpretation.cpp | class Solution {
public:
string interpret(string command) {
int l = command.length();
string st;
for(int i=0;i<l;i++){
while(command[i]=='G'){
st.append("G");
i++;
}
if(command[i]=='(' && c... | ALGO | 0.999267 | 4.969794 |
685cfecc-70a8-47b5-a74e-3e16cd279710 | r4pidstart/problems | by_category/dp/14846.cpp | // https://www.acmicpc.net/problem/14846
// 2024-04-01 22:27:05
#include"bits/stdc++.h"
using namespace std;
int get_area(int x1, int y1, int x2, int y2, int k, const vector<vector<vector<int> > >& table)
{
assert(x1<=x2 and y1<=y2);
return table[x2][y2][k]-table[x1-1][y2][k]-table[x2][y1-1][k]+table[x1-1][y1-... | ALGO | 0.997478 | 5.467336 |
691b5c87-3635-4e34-b3ed-a882451fc382 | Sri-Hasini/leetcode-sync | 3455-minimum-length-of-string-after-operations/minimum-length-of-string-after-operations.cpp | class Solution {
public:
int minimumLength(string s) {
unordered_map <char, int> m;
for (int i = 0; i < s.size(); i++) {
m[s[i]]++;
}
int ans = 0;
for (auto i : m) {
if (i.second & 1) ans += 1;
else if (i.second > 1) ans += 2;
}
... | ALGO | 0.999921 | 5.775319 |
2980d0e8-b146-47c8-9a4e-5d009a83fd3a | Shaf3eii/CSES-Solutions | Dynamic_Programming/Two Sets II.cpp | // ﷽
// وَأَنْ لَيْسَ لِلْإِنْسَانِ إِلَّا مَا سَعَى
// فَالجُهدُ يُثمِرُ إنْ تَضافَرَ صَفوُهُ، والعَزمُ يَرفعُ صَرحَ كُلِّ بُنيانِ.
//#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
// 48-57 -> 0-9 65-90 -> A-Z 97-122 -> a-z
#define Wl3_ElNor ios::sync_with_stdio(0),cin.ti... | ALGO | 0.999979 | 4.972863 |
344b2cbe-dea6-4445-b17d-08fca90f98d2 | sinian666/codes_41_1 | cpp_副本6/chapter_searching/two_sum.cpp | /**
* File: two_sum.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 方法一:暴力枚举 */
vector<int> twoSumBruteForce(vector<int> &nums, int target) {
int size = nums.size();
// 两层循环,时间复杂度 O(n^2)
for (int i = 0; i < size - 1; i++) {
for (int j = i + 1; j ... | ALGO | 0.999774 | 6.084116 |
898ca221-1368-4091-bec5-73fd627b1f84 | HonsChon/Godot4.1_CoOperation | thirdparty/meshoptimizer/overdrawoptimizer.cpp | #include <assert.h>
#include <math.h>
#include <string.h>
// This work is based on:
// Pedro Sander, Diego Nehab and Joshua Barczak. Fast Triangle Reordering for Vertex Locality and Reduced Overdraw. 2007
namespace meshopt
{
static void calculateSortData(float* sort_data, const unsigned int* indices, size_t index_cou... | ALGO | 0.999867 | 7.733637 |
53c43878-8e51-48e4-be1d-889aa41e4347 | jevinskie/llvm-project-jev-embedded | libc/src/time/time_utils.cpp | #include "src/time/time_utils.h"
#include "src/__support/common.h"
#include <limits.h>
namespace __llvm_libc {
namespace time_utils {
using __llvm_libc::time_utils::TimeConstants;
static int64_t computeRemainingYears(int64_t daysPerYears,
int64_t quotientYears,
... | ALGO | 0.969967 | 7.5373 |
0ee91b60-d9cd-4449-9fb4-955501a00794 | Rudraksh-Upadhyay/DATA-STRUCTURES-CPP | 09.Binary_Search_Tree/kthSmallest_LL230.cpp | #include<iostream>
#include<vector>
using namespace std;
class Node{
public:
int data;
Node* left;
Node* right;
Node(int value){
this->data = value;
this->left = NULL;
this->right = NULL;
}
};
Node* builtBST(int value, Node* root){
... | ALGO | 0.999992 | 4.355743 |
1f25227f-bbd2-487c-9557-59b652aadebd | jh2496097/HoltJonathan_CIS17a_48130 | jh2496097/Hmwk/assignment4/chapt 13 probs/13.10numAry/numbers.cpp | /**
* Jonathan Holt
* numbers cpp file
*/
#include "numbers.h"
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
Numbers::Numbers(int s){
if (s < 1)
s = 1;
else
size =s;
nums = fill();
}
Numbers::~Numbers(){
delete []nums;
}
float *Numbers::fill(){
nums ... | TOOL | 0.941376 | 3.694354 |
07da0635-f97c-4b12-8b29-3b1084dcd2d1 | shucshin/DailyCodingChallenge | January-2023/HelpAPhDcandidateOut.cpp | #include <iostream>
#include <sstream>
using namespace std;
#define rep(i,a,b) for(int i = a; i < b; i++)
int main() {
int n; cin >> n; cin.ignore();
string s,sub;
rep(i,0,n) {
cin >> s;
if(s == "P=NP") {
printf("skipped\n"); continue;
}
stringstream ss(s);
... | ALGO | 0.999094 | 3.47449 |
76b67f9a-c1f7-41da-bae0-89d56ea749e6 | aviral-mishra-1008/DSA_ML_WebD_Learning | DSA/spiral.cpp | #include <bits/stdc++.h>
using namespace std;
void printSpiral(int arr[][3], int n, int m){
vector<int> v;
int strow = 0;
int endrow = n-1;
int stcol = 0;
int endcol = m-1;
int count = 0;
while(count<n*m){
cout<<"count is: "<<count<<endl;
//First Row
for(int i=stco... | ALGO | 0.999907 | 4.047036 |
67fc99cf-64da-4617-b5c7-e030f861ff6f | Abhisolanki16/talkr_main_updated | examples/api/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.998395 | 6.797273 |
ada28201-6120-4ced-9340-90b04a850800 | raincross7/code-similarity | codes/train_code/problem037/problem037_259.cpp | #include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii v... | ALGO | 0.999921 | 4.018586 |
d9f6e8bf-9063-4898-9b76-2758a18c1d2c | FaisalMahi/CPP_Codeforces_Solutions | B_Penchick_and_Satay_Sticks.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int test;
cin >> test; // Read number of test cases
while (test--) {
int n;
cin >> n; // Read the size of the permutation
vector<int> p(n);
for (int i = 0; i < n; i++) {
cin >> p[i]; // Read the permut... | ALGO | 0.999994 | 5.450394 |
d52c7207-9899-420a-be15-026dca691cec | sonugiri1043/Cracking-The-Coding-Interview | 8-Recursion-And-Dynamic-Programming/PaintFill.cpp | /*
Paint Fill:
Implement the "paint fill" function that one might see on many image editing programs.
That is, given a screen (represented by a two-dimensional array of colors), a point,
and a new color, fill in the surrounding area until the color changes from the original
color.
*/
#include <iostream>
en... | ALGO | 0.882765 | 6.376439 |
5581e244-a4a5-4a76-861b-f012d2b2bf34 | weidongguo/ecs175_computer_graphics | p1/polygon.cpp | #include "polygon.h"
#include <cstdlib>
#include <cstring>
Polygon::Polygon(Point * listOfPts, int _numberOfPoints, Graph *ptr_graph){
listOfPoints = listOfPointsOriginal = new Point[_numberOfPoints];
for(int i = 0; i < _numberOfPoints; i++)
listOfPoints[i] = listOfPts[i];
numberOfPoints = numberOfPointsO... | ALGO | 0.985943 | 4.647264 |
97faf391-60e5-490a-80fd-652d26a5908b | ishandutta2007/codeforces | aestas16/normal/1438/C.cpp | /*
I will never forget it.
*/
// 392699
#include <bits/stdc++.h>
using namespace std;
void fr(int &a, bool f = 0, char ch = getchar()) {
for (a = 0; ch < '0' || ch > '9'; ch = getchar()) ch == '-' ? f = 1 : 0;
for (; ch >= '0' && ch <= '9'; ch = getchar()) a = a * 10 + ch - '0';
a = f ? -a : a;
}
in... | ALGO | 0.999908 | 3.688601 |
8522cbcf-5f12-4cd7-99f6-fc1a2efea24c | HEltim7/cpcode | AtCoder/ARC/138/B.cpp | #include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
#define endl '\n'
using LL=long long;
const int N=2e5+10;
int arr[N];
int suf[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(nullptr);
int n;
cin>>n;
for(int i=1;i<=n;i++) cin>>arr[i];
for(int i=n;i>=1;i--) suf[i]=... | ALGO | 0.999996 | 3.703278 |
c986504b-0531-4b69-a066-ab043178987e | gauravpundir14/Leetcode-Soluctions | Get Minimum Squares - GFG/get-minimum-squares.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
int solve(vector<int>&dp,int n)
{
if(n==0) return 0;
if(dp[n]!=-1) return dp[n];
int ans=n;
... | ALGO | 0.999868 | 6.086535 |
704137e9-5b91-419e-90ea-4c8b5e5e4b18 | Tommylee1013/Cplusplus | Chapter06/prg06_03.cpp | //
// Created by Junghun Lee on 1/19/24.
//
#include <iostream>
#include <cmath> // derived from C language
#include <cstdio>
using namespace std;
int main() {
const double PI = 3.14159265358979323846;
double degree = PI / 4;
cout << "sin(45) = " << sin(degree) << endl;
printf("cos(45) = %f\n", cos(de... | ALGO | 0.88491 | 5.484004 |
03ffd368-45f6-49aa-9b7a-6bde9c2f0480 | Annoyshah/Cp-Dsa-Solutions | C_2_k_LCM_hard_version.cpp | /*ॐ श्री गणेशाय नमः || */
/* ॐ नमः पार्वती पतये हर हर महादेव */
/* कर्पूरगौरं करुणावतारं संसारसारं भुजगेन्द्रहारम्। सदा बसन्तं हृदयारविन्दे भवं भवानीसहितं नमामि।। */
/* ॐ नमो भगवते वासुदेवाय */
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
u... | ALGO | 0.999874 | 4.148806 |
d7db622f-63ec-4f76-9269-892dacbef839 | NaOHCC/discopop-ParEval | src/code/50_stencil_xor_kernel.cpp | /* Set every cell's value to 1 if it has exactly one neighbor that's a 1. Otherwise set it to 0.
Note that we only consider neighbors and not input_{i,j} when computing output_{i,j}.
input and output are NxN grids of ints in row-major.
Example:
input: [[0, 1, 1, 0],
[1, 0, 0, 0],
[0, ... | ALGO | 0.99989 | 5.043358 |
9c3abc56-bca0-4c7c-bc50-024e0638395f | leexsh/LeetCode | 05_easily/14-LongestCommonPrefix.cpp |
#include "bits/stdc++.h"
using namespace std;
/*
LeetCode-14 题目:最长公共前缀
编写一个函数来查找字符串数组中的最长公共前缀。
如果不存在公共前缀,返回空字符串 ""。
示例 1:
输入: ["flower","flow","flight"]
输出: "fl"
示例 2:
输入: ["dog","racecar","car"]
输出: ""
解释: 输入不存在公共前缀。
说明:
所有输入只包含小写字母 a-z
*/
/*
思路:
... | ALGO | 0.99968 | 3.89273 |
701223e2-5683-4d82-b9e4-14fc74e9f4b9 | patmarion/boost-build | boost_1_45_0/libs/graph/example/dfs-parenthesis.cpp | char name[] = "abcdefghij";
struct parenthesis_visitor : public boost::default_dfs_visitor
{
template <class Vertex, class Graph> void
start_vertex(Vertex v, const Graph &)
{
std::cout << ' ';
}
template <class Vertex, class Graph> void
discover_vertex(Vertex v, const Graph &)
{
std::cout << "(" ... | ALGO | 0.999579 | 6.13034 |
44ac3b61-46a2-46e1-8373-2b1df0c7301b | OversizedSunCoreDev/ArtilleryEco | Barrage/Source/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.cpp | #include <Jolt/Jolt.h>
#include <Jolt/Physics/Collision/Shape/TaperedCapsuleShape.h>
#include <Jolt/Physics/Collision/Shape/SphereShape.h>
#include <Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h>
#include <Jolt/Physics/Collision/Shape/ScaleHelpers.h>
#include <Jolt/Physics/Collision/TransformedShape.h>
#includ... | TOOL | 0.895887 | 3.211203 |
9e483390-14b3-45a3-80c8-b3b373728937 | dlvguo/NoobOJCollection | LeetCode/Normal/1300-1399/1337.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
struct node
{
int k, v;
bool operator<(const node &other) const //升序排序
{
if (v == other.v)
return k < other.k;
return v < other.v;
}
};
vector<int> kWeakestRows... | ALGO | 0.999897 | 4.940763 |
31eb127e-08d1-4cee-be53-2052c935ffa9 | vazanthhub/Vasanth | double_linked.cpp |
/* double linked list
creation of Node (dynamic data type- pointer variable)
Node consist of three parts (value, Next pointer, Previous pointer )
use head and tail, which are the special node, (copied the nodes), only the reference and use
pointers alone head and tail are useful for the traversa... | ALGO | 0.999968 | 4.868303 |
01efc6a9-dd1f-40fc-bba1-0ebbe6f178ed | Priyanshi662/DSA | 07-Graph/28-ShortestPathinUndirectedGraph.cpp | #include <vector>
#include <queue>
#include <unordered_map>
#include <limits.h>
using namespace std;
class Solution {
public:
vector<int> shortestPath(vector<int> adj[],int src,int dest)
{
unordered_map<int,vector<int>> mp;
queue<pair<int,int>> q;
q.push({src,0});
while(!q.empty(... | ALGO | 0.999974 | 5.277272 |
817c2e9d-47fb-4818-958a-74c8d5e7325b | satish-2002/Arrays | delement.cpp | //cpp program to delete elements in an array
#include<bits/stdc++.h>
using namespace std;
int main()
{
int cap,element,count=0;
cout<<"Enter capacity of array:";
cin>>cap;
int a[cap];
int n;
cout<<"How many numbers do you want in Array:";
cin>>n;
if(n>cap)
{
cout<<"Capacity is only:"<<cap;
exit(0);
}
el... | ALGO | 0.998577 | 3.968401 |
6a0ce897-4d7c-4ed8-9074-b10c0d65571f | beekeeb/vial-qmk-piantor-pro | lib/usbhost/arduino-1.0.1/cores/arduino/USBCore.cpp | #include "Platform.h"
#include "USBAPI.h"
#include "USBDesc.h"
#if defined(USBCON)
#define EP_TYPE_CONTROL 0x00
#define EP_TYPE_BULK_IN 0x81
#define EP_TYPE_BULK_OUT 0x80
#define EP_TYPE_INTERRUPT_IN 0xC1
#define EP_TYPE_INTERRUPT_OUT 0xC0
#define EP_TYPE_ISOCHRONOUS_IN 0x41
#define EP_TYPE_ISOCHRONOUS_OUT... | TOOL | 0.854289 | 5.934809 |
9dcd004f-5304-46d9-8ccb-864338e0ed98 | JN513/codigosc- | c++/maiorancestralcomum.cpp | #include <bits/stdc++.h>
#define nl endl
#define NMAX 1002
using namespace std;
int n, m, s1[NMAX], s2[NMAX], dp[NMAX][NMAX];
int lcs(int a, int b){ // declaro a função da DP, de nome lcs
// se já calculamos esse estado da dp antes
if(dp[a][b]>=0) return dp[a][b]; // retornamos o valor salvo para ele
// se uma... | ALGO | 0.999994 | 4.401199 |
233af621-87b5-4db7-a617-1a5de6155809 | arbitrarymahi/striverSheet | Arrays/Maximum Subarray Sum.cpp | #include <bits/stdc++.h>
long long maxSubarraySum(int arr[], int n)
{
long long ans = 0;
long long currSum = 0;
for(int i=0;i<n;i++){
currSum+= arr[i];
if(currSum <0){
currSum = 0;
}
ans = max(ans,currSum);
}
return ans;
}
| ALGO | 0.999727 | 5.215678 |
da3bc303-1573-47ad-8cf3-1f2e54234108 | Kouros26/Animator | dependencies/ASSIMP/code/AssetLib/IFC/IFCOpenings.cpp | /// @file IFCOpenings.cpp
/// @brief Implements a subset of Ifc CSG operations for pouring
/// holes for windows and doors into walls.
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h"
#include "Common/PolyTools.h"
#include "PostProcessing/ProcessHelper.h"
#include "contrib/poly2tri/poly2tri/poly2tri.... | TOOL | 0.962218 | 4.488625 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.