uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
428c7393-d187-49b5-adef-4e7066b63879 | FarhanMU/Gomodo | 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.99887 | 6.783439 |
539412c8-9578-446e-bfa2-d26f03fc3796 | dandingbudanding/algorithm-CPlusPlus | 数字三角形.cpp | #include <stdio.h>
#include <memory.h>
#define MAX_NUM 100
int D[MAX_NUM + 10][MAX_NUM + 10];
int N;
int aMaxSum[MAX_NUM + 10][MAX_NUM + 10];
int MaxSum(int r, int j)
{
if (r == N) return D[r][j];
if (aMaxSum[r + 1][j] == -1) //MaxSum(r+1, j)ûм
aMaxSum[r + 1][j] = MaxSum(r + 1, j);
if (aMaxSum[r + 1][j + 1] == ... | ALGO | 0.999901 | 3.189107 |
83a47ab1-189c-4113-90f6-b7ef439bcf83 | Badhansen/code-zero | Gym - 101810B.cpp | #include<cstdio>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map... | ALGO | 0.997571 | 3.264628 |
64f6a623-da35-4712-a220-7c3126b6d849 | AMReX-Codes/amrex | Src/Base/AMReX_PhysBCFunct.cpp |
#include <AMReX_PhysBCFunct.H>
namespace amrex {
void
BndryFuncArray::operator () (Box const& /*bx*/, FArrayBox& dest,
int dcomp, int numcomp,
Geometry const& geom, Real time,
const Vector<BCRec>& bcr, int bcomp, // BCRec for this... | ALGO | 0.98959 | 7.097562 |
ca2eeb37-0b6a-4aea-8475-fce207923b91 | kuang-jy/cpp-project | algorithm/dp/1261.cpp | #include <iostream>
#include <string.h>
using namespace std;
int n,mp[1010][1010],dp[1010],path[1010];
const int INF = 0x3f;
void traceBack(int idx){
if(path[idx] == idx){
// printf("%d ",idx);
return;
}
traceBack(path[idx]);
printf("%d ",idx);
}
int main(int argc, char const *argv[])
... | ALGO | 0.999997 | 3.732318 |
7d72e594-f77c-4beb-a884-45ee242611f8 | KuangRD/Autonomous-Driving | Self-DrivingCarND/Projects/Term2/CarND-MPC-Project/src/Eigen-3.3/doc/examples/TutorialLinAlgSVDSolve.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3, 2);
cout << "Here is the matrix A:\n" << A << endl;
VectorXf b = VectorXf::Random(3);
cout << "Here is the right hand side b:\n" << b << endl;
cout << "The least-squares ... | ALGO | 0.999576 | 3.920559 |
78807e51-df24-431a-89a9-10d933764de7 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1174_9.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-all-loops")
#pragma GCC target("sse4.2")
using namespace std;
ifstream in;
ofstream out;
const long long kk = 1000;
const long long ml = kk * kk;
const long long mod = ml * kk + 7;
const long long inf = ml * ml * ml + 7;
mt19937 rng(chrono::steady_clock::now()... | ALGO | 0.999698 | 4.725338 |
ae0ef1e3-314c-45f5-961f-c53d2d57f733 | mohan120105/leetcode | 0560-subarray-sum-equals-k/0560-subarray-sum-equals-k.cpp | class Solution {
public:
int subarraySum(vector<int>& nums, int k) {
unordered_map<int,int>freq;
freq[0]=1;
int c=0;
int s=0;
for(int i=0;i<nums.size();i++){
s+=nums[i];
if(freq.find(s-k)!=freq.end()){
c+=freq[s-k];
... | ALGO | 0.999933 | 6.008923 |
ad74a2fa-88f3-4216-8fd9-0c0d9683d4a2 | Vasudeva-bit/Leet-Code-Solutions | Hard/87. Scramble String.cpp | #include <bits/stdc++.h>
using namespace std;
// tags: C++, Memoization, Hash Table
class Solution {
public:
unordered_map<string, bool> umap;
bool isScrambled(string s1, string s2) {
if(s1.size() != s2.size())
return false;
int n = s1.size();
if(s1 == s2 or n == 0)
... | ALGO | 0.999997 | 5.908737 |
94f05079-f94a-43a5-88fb-1d7a992ca465 | DevleenaBanerjee/Stock_Prediction_ds | venv/Lib/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/libs/fusion/example/performance/accumulate.cpp | #include <boost/array.hpp>
#include <boost/timer.hpp>
#include <boost/fusion/algorithm/iteration/accumulate.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/algorithm/transformation/zip.hpp>
#include <boost/fusion/sequence/intrinsic... | TEST | 0.993822 | 6.407534 |
65cbee03-6525-40ae-88e9-aeff50589e11 | Abhijit25Mishra/code-forces | R-780/A_Vasya_and_Coins.cpp | #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define pi (3.141592653589)
#define mod 1000000007
#define pb push_back
#define is insert
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define min3(... | ALGO | 0.999924 | 4.973767 |
542ac5e1-af8c-4c38-8abc-896f9149c1ff | varung18/C-Cpp-brothers | Apni College Data Structures/Lecture 4 Advanced Pattern Questions/Video/Part I/pyramid2rotate.cpp | #include <iostream>
using namespace std;
int main () {
cout<<"Kindly enter the number to view the number of lanes as pyramid\n";
int a;
cin>>a;
for(int i=1; i<=a; i++)
{
for (int j=1;j<=a; j++)
{
if (j<=a-i)
{ cout<<" "; }
else
{ c... | ALGO | 0.999832 | 3.711894 |
50036166-3202-49f6-a651-8fc457bb204c | LKJhouji/my-knowledge-repository | 离散化.cpp | vector<int> alls;
sort(alls.begin(), alls.end());
alls.erase(unique(alls.begin(), alls.end()), alls.end());
int find(int x) {
int i = 0, j = arr.size() - 1;
while (i < j) {
int mid = i + j >> 1;
if (arr[mid] >= x) r = mid;
else l = mid + 1;
}
return l + 1;
}
//重点可以看题解,解释的非常清晰
| ALGO | 0.999997 | 4.813621 |
a522ffaa-99f7-4656-9f1d-32ddcd0e8234 | ShivamK2002/leetCodeProblems | 3093-sum-of-values-at-indices-with-k-set-bits/sum-of-values-at-indices-with-k-set-bits.cpp | class Solution {
public:
int countSetBits(int num){
int count = 0;
// long long nums = num;
while(num){
if(num&1) count++;
cout<<"num is: "<<num<<endl;
cout<<count<<endl;
num = num>>1;
}
return count;
}
int sumIndicesWi... | ALGO | 0.999961 | 5.921175 |
bbc68817-6617-4691-a6f1-35a3d99b5ef8 | alexiiion/2019-ETH-ApproximatingDOGs | external code/Non-linear projection optimization (PH)/Stitching2_PH-original/libigl/include/igl/is_delaunay.cpp | template <
typename DerivedV,
typename DerivedF,
typename DerivedD>
IGL_INLINE void igl::is_delaunay(
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedD> & D)
{
typedef typename DerivedV::Scalar Scalar;
// Should use Shewchuk's predicates instea... | ALGO | 0.987721 | 7.194934 |
5d930edb-bf30-4145-8851-4b1fae3cff27 | strangedk/old-cpp-pascal-experiments | Excercises/Alcion - Language C++ (12 years of mine)/F53.cpp | #include<iostream>
#include<vector>
using namespace std;
int
main()
{
vector<int> v;
int i;
for(i=0; i<5; i++)
v.push_back(i);
cout<<"Vector 'v' size = " <<v.size() <<endl;
for(i=0; i<v.size(); i++)
cout<<v[i] <<' ';
cout<<endl;
return 0;
} | ALGO | 0.945319 | 3.378737 |
6544275f-eec9-4053-8c0e-36a8ec9f4ca8 | ecrips/Rockbox-FuzeV2 | utils/zenutils/source/shared/crypt.cpp | #include "crypt.h"
#include <stdexcept>
#include <beecrypt/hmacsha1.h>
#include <beecrypt/blockmode.h>
#include <beecrypt/blowfish.h>
bool zen::hmac_sha1_calc(const byte* key, size_t keylen, const byte* data,
size_t datalen, byte* sig, size_t* siglen)
{
hmacsha1Param param;
if (hmacsha... | TOOL | 0.902117 | 6.63235 |
ef740c53-eae8-448a-8ff6-175e9eba23eb | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10899_18.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using cd = complex<double>;
ll base = 10;
void print(vector<ll> const& a) {
for (auto it = a.rbegin(); it != a.rend(); ++it) cout << *it << ".";
cout << "\n";
}
void fft(vector<cd>& a, bool inv) {
int n = a.size();
int bits = __builtin_ctz(n);
... | ALGO | 0.999892 | 4.371933 |
7e61d172-792d-4572-a607-0c01cce6c50d | Xiarain/Navigation_using_Octomap | g2o_with_orbslam2/g2o/types/slam3d/dquat2mat.cpp | #include "dquat2mat.h"
#include <iostream>
namespace g2o {
namespace internal {
using namespace std;
#include "dquat2mat_maxima_generated.cpp"
int _q2m(double& S, double& qw, const double& r00 , const double& r10 , const double& r20 , const double& r01 , const double& r11 , const double& r21 , const d... | ALGO | 0.999618 | 5.869882 |
d72f91eb-d20a-47a4-baf3-391b2ee74971 | Jminis/Custom-llvm | my-llvm-project/llvm/unittests/ADT/EditDistanceTest.cpp | #include "llvm/ADT/StringRef.h"
#include "llvm/ADT/edit_distance.h"
#include "gtest/gtest.h"
#include <cstdlib>
using namespace llvm;
namespace {
struct Result {
unsigned NumMaps;
unsigned EditDist;
};
} // namespace
static Result editDistanceAndMaps(StringRef A, StringRef B,
u... | TEST | 0.902201 | 7.108017 |
63e51209-2a36-4c06-a92c-dacee8261dff | ex-MingNine9999/algorithm | Problems/boj10971.cpp | //Problem Number : 10971
//Problem Title : 외판원 순회 2
//Problem Link : https://www.acmicpc.net/problem/10971
#include <iostream>
#define MAXINT 2147483647
using namespace std;
int n;
int mat[12][12];
int minValue = MAXINT;
int first[12];
void dfs(const int level,int route[12], int value) {
if (level == n - 1) {
i... | ALGO | 0.999323 | 3.854098 |
77e89eca-b875-4b21-a7e9-a9ecd825f05f | zaforf/competitiveprogramming | cses/graphs/knights-tour.cpp | #include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define f first
#define s second
vector<vector<pii>> adj(64);
int nbrs[64];
int ans[64];
int k=1;
vector<pii> neighbors(int x, int y) {
vector<pii> ret;
if (x-1>=0 && y-2>=0) ret.push_back({x-1,y-2});
if (x-2>=0 && y-1>=0) ret.push_back({x-2,y... | ALGO | 0.999923 | 3.57148 |
c79f68cd-0926-491d-a128-7f2a9dd84e54 | mizan192/UVA-Solution | 11503 Virtual Friends.cpp | //Bismillahir Rahmanir Raheem
#include<bits/stdc++.h>
using namespace std;
#define sp " "
#define nl "\n"
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lop(i,n) for(i=0;i<n;i++)
#define MAX 200005
int pr[MAX], size[MAX];
map<string, int> m;
int find_parent(int u) {
if (u == pr[... | ALGO | 0.999985 | 4.504817 |
18c0d510-bdc1-460b-8c66-c4d514693ff7 | pointer-authentication/pcan-llvm | clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp | #include "clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h"
#include "llvm/ADT/FoldingSet.h"
#include ... | TOOL | 0.926159 | 7.81057 |
0cb834d6-d22f-429c-8e6c-f5d4337083c9 | Anangprasetya/Algoritma-Pemrograman | array/panjangString.cpp | #include <iostream>
#include <string>
using namespace std;
class HitungPanjang{
private :
string kalimat;
int hitung;
int panjang(string kal){
int no = 0;
for (int i = 0; i < kal[i]; i++)
no++;
return no;
}
public :
HitungPanjang(){
this->kalimat = "Anang Nur Prasetya";
this->hitung = t... | ALGO | 0.986994 | 3.637251 |
e48c9b7b-c740-4cc5-9cb5-b434e8b30da1 | Abu-Said-Akunji/OOP_Lab_3rd_Sem | 01_08_22/Akunji_Q5.cpp | //Q.5. Write a C++ program to sort characters (numbers and punctuation symbols are not included) in a string.
#include<bits/stdc++.h>
#include <iostream>
#include <string.h>
using namespace std;
void sortString(string &str)
{
sort(str.begin(), str.end());
cout << str;
}
int main()
{
string s;
cout << "Enter the ... | ALGO | 0.999569 | 5.513146 |
6e5ef886-ceef-44e4-be5a-ac7c1b5ea067 | Vedika-Agrawal/LeetCode | 0098-validate-binary-search-tree/0098-validate-binary-search-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.999928 | 6.613023 |
3296cad4-5bc5-4a15-b9dc-3c950b01be4e | iscanalara/SolarSystemOpenGL | HW2/HW2.cpp | #include <GL/glut.h>
#include<math.h>
#include <stdio.h>
#include <stdlib.h>
#pragma warning(disable:4996)
float angle[13];
float anglex = 35.0;
float angley = -35.0;
float anglez = 0.0;
float locZ = 0.0;
float locY = 0.0;
float locX = 0.0;
float scale = 1;
GLUquadric* sun;
GLUquadric* mercury;
GLUquadric* venus;
GL... | TOOL | 0.951256 | 3.703273 |
aec9b291-5bd4-41d0-bac0-931f9cc1b314 | ELEGOO-3D/ElegooSlicer | src/libigl/igl/crouzeix_raviart_massmatrix.cpp | #include "is_edge_manifold.h"
#include "doublearea.h"
#include "volume.h"
#include <cassert>
#include <vector>
template <typename MT, typename DerivedV, typename DerivedF, typename DerivedE, typename DerivedEMAP>
void igl::crouzeix_raviart_massmatrix(
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::Matri... | ALGO | 0.973868 | 6.592776 |
5040d39a-a50d-4019-809e-95e946b4c556 | HHHHao-s/algorithm | 2242.节点序列的最大得分.cpp | #include "s.h"
/*
* @lc app=leetcode.cn id=2242 lang=cpp
*
* [2242] 节点序列的最大得分
*/
// @lc code=start
class Solution {
public:
int maximumScore(vector<int> &scores, vector<vector<int>> &edges) {
int n = scores.size();
vector<vector<pair<int, int>>> g(n);
for (auto &e : edges) {
... | ALGO | 0.999955 | 5.86675 |
ee67865b-04a0-4588-a279-7cf225e33779 | actium/codeforces | 2000/40/2047b.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
void answer(const std::string& x)
{
std::cout << x << '\n';
}
void solve(std::string& s)
{
std::vector<std::pair<unsigned, char>> p(26);
for (size_t i = 0; i < 26; ++i) {
p[i].first = std::count(s.begin(), s.end(), 'a' + ... | ALGO | 0.999873 | 5.405237 |
d4b20f68-6538-47b8-92d0-01a907811dc4 | Rabotah/Coursera_C | Other projects/mpi/4_task (1).cpp | #include <mpi.h>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int rank, size, n;
int st = MPI_Init(&argc, &argv);
if (st != MPI_SUCCESS)
MPI_Abort(MPI_COMM_WORLD, 1);
st = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (st != MPI_SUCCESS)
MPI_Abort(MPI_COMM_WORLD, 2... | ALGO | 0.998554 | 3.430885 |
f8aa7bce-3a6a-4ca2-bcd8-6b4152d0756a | cygnomatic/rmdecis | src/predictor/trig_fitting.cpp | //
// Created by catslashbin on 23-2-1.
//
#include "trig_fitting.h"
using namespace ceres;
struct TrigResidual
{
TrigResidual(double x, double y)
: x_(x), y_(y) {}
template<typename T>
bool operator()(const T *const amp, const T *const omega, const T *const phase, const T *const offset,
... | ALGO | 0.998836 | 5.595704 |
b1b61776-70f4-464b-8a2b-77982bda04e7 | ishandutta2007/codeforces | pikel_rik/normal/675/D.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define all(x) (x).begin(), (x).end()
using namespace __gnu_pbds;
using namespace std;
using ull = unsigned long long;
using ll = long long;
using ordered_set = tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;
const int mo... | ALGO | 0.999996 | 3.962553 |
48484c9a-ead7-4d08-a680-d6b9cbaac2dd | TakuyaKimura/Leetcode | 149 Max Points on a Line/149.cpp | /*
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
*/
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
// Definition for a point.
struct Point {
int x;
int y;
Point() : x(0), y(0) {}
Point(int a, int b) : x(a), y(b) {}
};
... | ALGO | 0.999873 | 5.905147 |
d71aa876-e934-410c-95e7-b7b191902128 | taskinnasif144/data_structure_and_algorithms | binary tree/count_nodes.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *left;
Node *right;
Node(int val)
{
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
Node *binaryTreeInput()
{
int val;
cin >> val;
Node *root = new Node(val);
q... | ALGO | 0.999689 | 4.451542 |
7de1b480-96f7-48d8-82c1-93e469323fea | imsaurabh1998/CodeForces | Drinks.cpp | //
// Created by Saurabh on 11/8/2019.
//
#include<iostream>
#include<string>
#include<vector>
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int>list;
double sum=0.0;
int s=n;
while (n-- > 0) {
int temp;
cin >> temp;
sum+=temp;
}... | ALGO | 0.996421 | 3.497581 |
18909390-a7f8-401c-adb4-0eb06595005b | shanPic/CodeOfAcm | 分类题目/图论/floyd/FriendScore/FriendScore.cpp | #include<bits/stdc++.h>
using namespace std;
class TheAirTripDivTwo
{
public:
int find(vector<int> vec,int n)
{
int num=0;
int tmp;
for(auto ite=vec.begin();ite!=vec.end();ite++){
tmp=(*ite);
if(n>=tmp){
num++;
n-=tmp;
}... | ALGO | 0.999758 | 3.644539 |
bf7f1df4-57fc-41e4-8cd2-e7ddbe2e8447 | flwende/simd_benchmarks | src/common/benchmark.cpp | #include <iostream>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <unistd.h>
#include <omp.h>
#include "common/kernel.hpp"
// length of the arrays to be processed: default = 1024^2
#define N_DEFAULT (1 * 1024 * 1024)
// range of values stored in arrays x_1 and x_2: default = [-1.0,+1.0]
#define X... | ALGO | 0.990776 | 4.547061 |
8193d961-69ea-403f-8dc5-8b425af8f2ed | DishaKD21/DsaSolution | Stack/ValidParentheses.cpp | //Valid Parentheses
//push open bracket in stack and take one pointer for that then keep checking if the bracket
//is close then check if it is similar to the top then pop the element from the stack
//otherwise it will be false or invalid parentheses
class Solution {
public:
bool isValid(string s) {
stack... | ALGO | 0.998959 | 6.212405 |
a0fd5fe0-7ea0-4625-837a-4d9abdc4bf96 | weifish0/ALGO_DS_Practice | csie_sprout/sprout21_LinkedList.cpp | // Q: https://neoj.sprout.tw/problem/21/
// concept: linked list
// date: 2024/03/13
#include <bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node *next;
};
int main() {
int n, rounds;
cin >> n;
Node *head = new Node;
head->data = 1;
head->next = NULL;
Node *curren... | ALGO | 0.999971 | 4.484534 |
d71e4aea-8f4d-4445-b7fc-d597b55d0606 | Amatulla-Bohara/DSA_practice_questions | 1137. N-th Tribonacci Number.cpp | class Solution {
public:
int tribonacci(int n) {
vector<int> v={0,1,1};
int x=0;
for(int i=3; i<=n; i++){
x = v[i-1] + v[i-2] + v[i-3];
v.push_back(x);
}
return v[n];
}
};
| ALGO | 0.999991 | 6.1166 |
1883d798-afa5-4737-bb2c-fde8405c3c32 | marcosvcloures/maratona | URI/1959.cpp | #include <stdio.h>
int main() {
long long int a, b;
scanf("%lld %lld", &a, &b);
printf("%lld\n", a*b);
} | ALGO | 0.998963 | 3.653569 |
3ad23f1e-1abf-4794-a171-dd8498a950c1 | ratea/abc | abc79/d.cpp | #include "bits/stdc++.h"
using namespace std;
int main(){
long long int h,w;
cin>>h>>w;
vector<vector<long long int> > c(10,vector<long long int>(10));
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
cin>>c[i][j];
}
}
for(int k=0;k<10;k++){
for(int i=0;i<10;i++){
for(int j=0;j<10;j... | ALGO | 0.99965 | 3.470012 |
409bdc8f-2b6f-4475-b1fd-d84cb7da9d94 | italocoin-project/italocoin-old | src/daemon/command_parser_executor.cpp | #include "common/dns_utils.h"
#include "version.h"
#include "daemon/command_parser_executor.h"
#undef ITALOCOIN_DEFAULT_LOG_CATEGORY
#define ITALOCOIN_DEFAULT_LOG_CATEGORY "daemon"
namespace daemonize {
t_command_parser_executor::t_command_parser_executor(
uint32_t ip
, uint16_t port
, const boost::optional<... | TOOL | 0.931825 | 6.400188 |
338cd1ff-5f7c-478f-90c5-12c94b715822 | lssfau/walberla | src/blockforest/loadbalancing/StaticCurve.cpp | #include "StaticCurve.h"
#include <cmath>
namespace walberla {
namespace blockforest {
uint_t StaticLevelwiseCurveBalance::operator()( SetupBlockForest & forest, const uint_t numberOfProcesses, const memory_t /*perProcessMemoryLimit*/ )
{
// TODO: take per process memory limit into account?
std::vector< Setup... | ALGO | 0.998726 | 4.727879 |
0dad9c9a-6fda-487e-a26d-569087a2188a | nusrath0631/introduction-github | AM.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
const long long INF = 1e18;
int main() {
int n, m;
cin >> n >> m;
// Graph as adjacency list
vector<vector<pair<int,int>>> graph(n+1);
for (int i = 0; i < m; i++) {
int a, b, w;
cin >>... | ALGO | 0.999964 | 5.065958 |
0de630fc-04e4-4eef-a37a-a5abb7eae7c6 | imkshitiz/Leetcode | 0084-largest-rectangle-in-histogram/0084-largest-rectangle-in-histogram.cpp | class Solution {
private:
vector<int> nextSmallerElement(vector<int> arr,int n){
stack<int>s;
s.push(-1);
vector<int>ans(n);
for(int i=n-1;i>=0;i--){
int curr=arr[i];
while(s.top()!=-1 && arr[s.top()]>=curr){
s.pop();
}
... | ALGO | 0.999989 | 6.527247 |
4150c884-9518-4bc3-a994-de6f48b6ce30 | sotakqmf01/Programmers-CodingTest | 프로그래머스/1/12948. 핸드폰 번호 가리기/핸드폰 번호 가리기.cpp | #include <string>
#include <vector>
using namespace std;
string solution(string phone_number) {
string answer = "";
int len = phone_number.length();
for(int i = 0; i < len; i++){
if(i < len-4)
answer += '*';
else
answer += phone_number[i];
}
return... | ALGO | 0.996962 | 4.850201 |
aa869a7f-864d-4e16-a811-e234fe3dbbb3 | yohannes3030/week2_challenges | Week2_Challenge_FirstUniqueCharacterInString.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
int firstUniqChar(string s) {
unordered_map<char, int> freq;
for (char c : s) {
freq[c]++;
}
for (int i = 0; i < s.length(); i++) {
if (freq[s[i]] == 1) {
return i;
}
}
return -1;
}
int ... | ALGO | 0.999777 | 5.636498 |
71c11d04-acde-4977-97d8-be72f5253ce9 | TaQini/ctf | ACTF2020/crypto/crypto-classic1/a.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
float value; //重合指数差,与我们的标准重合指数的差值越小越好
int length;
};
vector< Node > key; //存放key可能的长度和重合指数差
set< int > key_len; //存放key可能的长度
/*
英文字母使用频率表 g
*/
double g[]={0.08167, 0.01492, 0.02782, 0.04253, 0.12702, 0.02228, 0.02015, 0.06094, 0.06966, 0.00153, 0.00772,... | ALGO | 0.99998 | 3.376426 |
1098ff16-f095-42b5-814e-f314806395ef | sparsh2002/Placement-Course-cpp | DynamicA2OJ/Div2_C/2_Team.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define rep(i,a,b) for(int i=a ; i<b ; i++)
#d... | ALGO | 0.999961 | 3.850761 |
62b6b7f9-10f1-485b-a2af-a1ccf707fef3 | luizcoelhoc1/UFLA-CPA-parallel-BFS | old/Bags.cpp | #include <iostream>
#include <math.h>
using namespace std;
template <typename Data>
class Element {
public:
Element* right;
Element* left;
Data data;
Element(Data data) {
this->right = NULL;
this->left = NULL;
this->data = data;
}
Element (Data data, Element* left, Element* right) {
this->right = r... | ALGO | 0.992673 | 4.057785 |
f121e8f6-2135-4734-8b89-3cd9f816add7 | thealchemistguild/Box2DC | Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp | #include <Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h>
#include <Box2D/Common/b2BlockAllocator.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Collision/Shapes/b2ChainShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <new>
using namespace std;
b2Contact* b2ChainAndCircleContact::Create(... | ALGO | 0.957965 | 6.351975 |
90ecf45b-18f1-4843-8a3c-4a11f48e6566 | Varun2851/DSA | Linked list/NextGreaterNode.cpp | #define node ListNode
class Solution {
public:
void solve(node* head, stack<int> &s, vector<int> &ans) {
if (head == NULL) return;
// First we need to go till the last node
solve(head->next, s, ans);
int curr_val = head->val;
while (!s.empty() and s.top() <= curr_val) {
s.pop();
}
if (s.empty()) {
... | ALGO | 0.999992 | 5.521677 |
2b45aca6-58f1-4df0-89b9-8463529e609d | samuelflores/MMB | src/ElectrostaticPotentialGridForce.cpp | #include "ElectrostaticPotentialGridForce.h"
#include "DensityMap.h"
#include "time.h"
#include <stdlib.h>
ElectrostaticPotentialGridForce::ElectrostaticPotentialGridForce (SimbodyMatterSubsystem& matter,ParameterReader& myParameterReader, DensityMap & myDensityMap ,DuMMForceFieldSubsystem & dumm , BiopolymerClassC... | ALGO | 0.98504 | 5.25214 |
0d24231b-231e-46f4-80ee-adfa3ce9c19c | imoncoc/C-and-C-plus-plus | Raj Striver/Recursion/printing subsequence whose sum is k.cpp | #include<bits/stdc++.h>
using namespace std;
void printSequences(int ind, vector<int> &ds, int s, int sum, int arr[], int n){
if(ind == n){
if(s == sum){
for(auto it: ds){
cout<<it<<" ";
}
cout<<endl;
}
return;
}
//Take or pick... | ALGO | 0.999958 | 4.639302 |
202a0245-16dd-4484-bea7-8c28ca6c3e32 | allem40306/Competitive-Programming | uva/Volume002/uva00299.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define L 60
int arr[L], buf[L];
int sol(int left, int right){
if (right - left <= 1)return 0;
int middle = (right + left) / 2;
int ans = sol(left, middle) + sol(middle, right);
int i = left, j = middle, k = left;
while (i < middle || j... | ALGO | 0.999907 | 3.770671 |
e164afe2-b86b-421b-8e1c-a8f76be047db | mkinkley/vision_final | backend/opencv/3rdparty/carotene/src/remap.cpp | #include "remap.hpp"
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace internal {
void remapNearestNeighborReplicate(const Size2D size,
const u8 * srcBase,
const s32 * map,
u8 * dstBase, ptrdiff_t dstStride... | ALGO | 0.973657 | 6.870541 |
a9c36844-b9c7-4f68-9e62-e82b7df57ae4 | raghavsheoran/Playground | divisibility_problem.cpp | #include<iostream>
using namespace std;
int main(){
int t;
cin>>t;
for(int i=0; i<t; i++){
long long m,n;
cin>>m>>n;
long long res=0;
while(true){
if((res+m)%n==0){cout<<res<<endl; break;}
else res++;
}
}
return 0;
} | ALGO | 0.99997 | 3.409219 |
d67b5fc7-fa6b-4c1d-b724-6e94899b9eaa | meesum5445/REALHUGENUMBER | realhugenum.cpp | #include<iostream>
#include<fstream>
#include"realhugenum.h"
#include"hugenumber.h"
using namespace std;
void realhugenum::insertat(int ind,int dig)
{
if(ind<=this->dec_loc+1)
{
this->dec_loc++;
this->val.insertat(ind,dig);
}
else
this->val.insertat(ind-1,dig);
}
void realhugenum... | TOOL | 0.870887 | 3.012302 |
1773c3ef-ecac-4238-87eb-c4d8023fc31e | igorpejic/graphics | v05_template/eigen-3.2.6/doc/examples/Tutorial_BlockOperations_colrow.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::MatrixXf m(3,3);
m << 1,2,3,
4,5,6,
7,8,9;
cout << "Here is the matrix m:" << endl << m << endl;
cout << "2nd Row: " << m.row(1) << endl;
m.col(2) += 3 * m.col(0);
cout << "After adding 3 times the first colu... | ALGO | 0.990571 | 3.576145 |
e295dbf6-90a7-4d8a-b1db-8c1354c27c96 | heetsz/CSES-Solutions | sudoku.cpp | #include <bits/stdc++.h>
using namespace std;
void print(vector<vector<int>> &board){
for(vector<int> x : board){
for(int x1 : x){
cout << x1 << " ";
}
cout << endl;
}
cout << endl;
}
bool isValid(vector<vector<int>> &board, int i, int j, int num... | ALGO | 0.999641 | 6.310345 |
ce5df4ad-088a-4d5a-8edc-a17e0bf2e0f4 | AndHager/SysCallStubber | llvm-project/llvm/lib/Transforms/IPO/CalledValuePropagation.cpp | #include "llvm/Transforms/IPO/CalledValuePropagation.h"
#include "llvm/Analysis/SparsePropagation.h"
#include "llvm/Analysis/ValueLatticeUtils.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Transforms/IPO.h"
using namespace llvm;
#define DEBUG_... | TOOL | 0.994591 | 7.844934 |
c46b4dce-4284-49fb-a300-693757138434 | Domain-Cmap/assignments-day-1-to-day-9-hrithik13390 | day5/hard/p1.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
using namespace std;
vector<int> sortItems(int n, int m, vector<int>& group, vector<vector<int>>& beforeItems) {
vector<vector<int>> groupGraph(m, vector<int>());
vector<vector<int>> itemGraph(n, vector<int>());
vector<int> grou... | ALGO | 0.999999 | 6.173251 |
4bada26d-153d-42e7-9594-0b506134ea2c | VijayPandey08/LeetCode | 210-course-schedule-ii/course-schedule-ii.cpp | class Solution {
public:
bool has_cycle;
void dfs(unordered_map<int,vector<int>> &adj, int i,vector<bool> &visited,vector<bool> &in_recursion, stack<int> &s ){
visited[i]=true;
in_recursion[i]=true;
for(auto v:adj[i]){
if(in_recursion[v]==true){
has_cycle=true;
return;
... | ALGO | 0.999966 | 6.214126 |
ca67f490-3776-4a0b-994b-a5549a04c2e2 | nettee/leetcode | solutions/0040.combination-sum-ii/0040.combination-sum-ii.1570946701.cpp | class Solution {
public:
vector<vector<int>> combinationSum2(vector<int>& candidates, int target) {
sort(candidates.begin(), candidates.end());
vector<vector<int>> res;
vector<int> current;
backtrack(candidates, 0, current, target, res);
return res;
}
void backtr... | ALGO | 0.99998 | 6.702031 |
c25a23ad-9405-4311-8170-af2a9a45189b | ishandutta2007/codeforces | coderanshu/normal/1329/A.cpp | #include<bits/stdc++.h>
using namespace std ;
#define M 1000000007
#define MM 998244353
#define ll long long
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define ... | ALGO | 0.999993 | 4.036491 |
2ec28e07-df45-452b-9f44-e1062e97b4d9 | Starry0/ACM | 计蒜客/ACM-ICPC 2018 徐州赛区网络预赛/aa.cpp | #include <bits/stdc++.h>
using namespace std;
int a[10];
bool ok() {
for(int i = 0; i < 5; i ++) {
if(a[i] == 0) {
if(a[(i+1)%4]==3 || a[(i-1+4)%4]==3) return false;
}
if(a[i] == 1) {
if(a[(i+1)%4]==2 || a[(i-1+4)%4]==2) return false;
}
if(a[i] == 2) {
if(a[(i+1)%4]==1 || a[(i-1+4)%4]==1) return fal... | ALGO | 0.999557 | 3.481553 |
e6b65313-3530-4384-8691-f8cf9a1cb056 | raincross7/code-similarity | codes/train_code/problem019/problem019_234.cpp | using namespace std;
int main(){
string card;
string cardBefore,cardBehind;
int h[100] = {},m = 0, len = 0;
while( cin >> card >> m){
if( card == "-" ) break;
len = card.length();
for( int i = 0; i < m; i++ ){
cin >> h[i];
cardBefore = card.substr(0,h[i]);... | ALGO | 0.988572 | 3.461603 |
820d2518-987c-4bf4-9f46-98041e529cbf | swapnil-tayal/DSA | 0070-climbing-stairs/0070-climbing-stairs.cpp | class Solution {
public:
int climbStairs(int n) {
if(n == 1 || n == 2 || n == 3) return n;
vector<int> dp(n+1, 0);
dp[1] = 1;
dp[2] = 2;
for(int i=3; i<=n; i++){
dp[i] = dp[i-1] + dp[i-2];
}
return dp[n];
}
}; | ALGO | 0.999945 | 6.01289 |
679c7f1b-c66a-4b30-87c9-e0737fcbc56e | alpha951/Algorithms | 07other-name-algo/moore-voting-majority-element.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
// Majority Element > n/2
class Solution
{
public:
int majorityElement(vector<int> &nums)
{
// optimized
int freq = 0, candidate = nums[0], n = nums.size();
for (auto &x : nums)
{
if (x == candidate)
... | ALGO | 0.999637 | 5.180753 |
ce32274c-ad6e-4e20-bf0f-22e4b667972d | bitcoinanatomy/bitcoinanatomy | src/codebase/bitcoin-0.17.0 Github/src/timedata.cpp | #if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#include <timedata.h>
#include <netaddress.h>
#include <sync.h>
#include <ui_interface.h>
#include <util.h>
#include <utilstrencodings.h>
#include <warnings.h>
static CCriticalSection cs_nTimeOffset;
static int64_t nTimeOffset GUARDED_BY(cs_nTimeOf... | TOOL | 0.856486 | 6.58726 |
0c40be71-06c1-4996-bda4-fccac6d79727 | nabil0day/Codeforces-Atcoder | codeforces/1619/B.cpp | /**********************************************************************************************************************************************************************
... | ALGO | 0.999599 | 4.53562 |
88a721bd-2592-4186-9699-e2f759a9b529 | StachuBond9/Konkurs | ZAD5/rybak.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int num_cases;
cin >> num_cases;
while (num_cases--) {
int num_fish, num_caught;
cin >> num_fish >> num_caught;
vector<int> fish_values(num_fish);
... | ALGO | 0.999784 | 4.316262 |
20410018-40e3-475b-aab3-d98286267c11 | AryanBiswas198/DSA-cpp | 37-sudoku-solver/sudoku-solver.cpp | class Solution {
public:
bool isValid(int row, int col, char c, vector<vector<char>>& board) {
for(int i=0; i<9; i++) {
if(board[row][i] == c) {
return false;
}
if(board[i][col] == c) {
return false;
}
if(board[3*... | ALGO | 0.999596 | 6.906806 |
2f30cb46-2016-4a4b-844d-da8d04e6004b | ItouKotaro/Usefly | libs/bullet/include/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp | #include "btConvex2dConvex2dAlgorithm.h"
//#include <stdio.h>
#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/Collisio... | ALGO | 0.999776 | 6.6802 |
48e0bd65-a390-4567-a229-f13927ad0e7d | ayushman17/Competitve-coding | Codechef/Contests/LRNDSA03/EXUNC.cpp | #include<bits/stdc++.h>
using namespace std;
int getItr(set<int> &s, int i)
{
auto itr = s.upper_bound(i);
--itr;
return *itr;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
set<int> s;
s.insert(1);
int n, q;
cin >> n >> q;
int a[n];
for (int i = 1; i <= n; i++) cin >> a[i]... | ALGO | 0.999927 | 3.508273 |
601312d4-34a0-493f-9853-4f0f3a1813e7 | Learner0089/Placement-Preperation-module | Week 2/Day 8/GreedyAlgorithm/MaximumActivities.cpp | #include <algorithm>
struct activity
{
int start;
int finish;
};
bool compare(activity a, activity b);
int maximumActivities(vector<int> &start, vector<int> &finish) {
// Write your code here.
int n = start.size();
activity act[n];
for(int i = 0; i < n; ++i)
{
act[i].start = ... | ALGO | 0.999805 | 5.609387 |
4d8cbcd4-554f-4fc9-989c-1f723bd0a1d3 | rangga2181/Praktikum-Struktur-Data-Assignment | MODUL 9 Graph And Tree/UNGUIDED/tempCodeRunnerFile.cpp | // Rangga Pradarrell Fathi
// 2311102200
#include <iostream>
using namespace std;
// PROGRAM BINARY TREE
// Deklarasi Pohon
struct Pohon
{
char data;
Pohon *left, *right, *parent; // pointer
};
// pointer global
Pohon *root;
// Inisialisasi
void init()
{
root = NULL;
}
bool isEmpty()
{
return root =... | ALGO | 0.997835 | 3.689476 |
aeb4f9aa-3017-4c20-96bb-e02350538d25 | sartajsehgal/DSA-Solutions | 1647-minimum-deletions-to-make-character-frequencies-unique/1647-minimum-deletions-to-make-character-frequencies-unique.cpp | class Solution {
public:
int minDeletions(string s) {
sort(s.begin(),s.end());
unordered_set<int> st;
int ans=0,curr=1;
for(int i=1;i<s.length();i++)
{
if(s[i]==s[i-1])
{
curr++;
}
else
{
... | ALGO | 0.999984 | 5.424378 |
4190d131-f5d3-49f2-9fa4-3e126382ae4f | MGanesh517/BaseProject_Responsive | 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.998799 | 6.776823 |
a7b461c4-a8bb-4dff-b9d5-392f6943c77d | hussain0613/CSE3213-14 | scheduling_algs/fcfs.cpp | #include<bits/stdc++.h>
using namespace std;
bool comparator(int a, int b);
vector<pair<int, int>> process_details;
vector<int> process_numbers, waiting_times, tats;
int main()
{
freopen("input.txt", "r", stdin);
int n, i, at, cput;
cin >> n;
for(i = 0; i < n; ++i){
cin >> at >> cput;
... | ALGO | 0.999895 | 3.868507 |
9cc4111d-6ff1-4513-bd0c-17dcf73eb1c6 | SrjAdhikari/DSA-With-CPP | 02_Basics_Of_Programming-2/Pattern_Printing/Pattern_Printing_Level-1/06_Print_Numeric_HalfPyramid.cpp | #include<iostream>
using namespace std;
void printNumericHalfPyramid(int n){
for (int row = 0; row < n; row++) {
for (int col = 0; col < row + 1; col++) {
cout << col + 1 << " ";
}
cout << endl;
}
}
int main(){
int row;
cout << "Enter the number of row : " << en... | ALGO | 0.995242 | 5.242865 |
b4099b18-54dd-4bca-807d-8ab482710e68 | iNiKe/boost | libs/polygon/benchmark/voronoi_benchmark_points.cpp | // Boost.Polygon library voronoi_benchmark.cpp file
// See http://www.boost.org for updates, documentation, and revision history.
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <numeric>
#include <vector>
#include <utility>
#include <boost/random/mersenne_twister.hpp>
#includ... | TEST | 0.963031 | 7.029484 |
e4cd48d1-88f2-4979-842c-adbdb377c710 | utkarshsingh2012/DSA-codes | bit magic/poweroftwo.cpp | #include<iostream>
using namespace std;
void poweroftwo(int n){
int count = 0;
while(n>0){
if((n & 1) != 0)
count++;
n = n>>1;
}
if(count == 1)
cout<<"the number is power of two"<<endl;
else
cout<<"the number is not a power of two"<<endl;
}
int main(){
int n;
cin>>n;
poweroftwo(n... | ALGO | 0.998976 | 4.73883 |
b094e258-b606-4d6c-b92e-d09da262c53c | saurabhs051/tech-interview-guide | 03 C++/Implementations/02_lru_cache.cpp | #include <unordered_map> // For std::unordered_map
#include <utility> // For std::pair
#include <stdexcept> // For potential exceptions (though not used here)
#include <iostream> // For potential debugging (optional)
// Represents a node in the doubly linked list
// Stores the key to allow easy removal ... | ALGO | 0.997865 | 7.352712 |
0ccbc211-10d1-4747-aaa7-77fd310359a3 | arifkhan1990/URI-accepted-solutions | uri_2450.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,j,c,m;
scanf("%d %d",&n,&m);
int ppp = 0;bool bo,ok = true;
for (i = 0; i < n; i++) {
int pp = 0;
bo = true;
for (j = 0; j < m; j++) {
scanf("%d", &c);
// count how many zero(0) in ... | ALGO | 0.999938 | 3.332055 |
f746cf85-cdac-4ffc-bbec-c656cf1c9d5a | Regalation/nvidia-mesh-tools | src/nvmesh/geometry/Bounds.cpp | // This code is in the public domain -- <EMAIL>
#include <nvmesh/geometry/Bounds.h>
#include <nvmesh/BaseMesh.h>
#include <nvmesh/halfedge/HalfEdgeMesh.h>
#include <nvmesh/halfedge/HalfEdgeVertex.h>
using namespace nv;
Box MeshBounds::box(const BaseMesh * mesh)
{
nvCheck(mesh != NULL);
Box bounds;
bounds.clearB... | TOOL | 0.980554 | 7.365651 |
bca7fd3c-93b5-4627-84fc-1395f75dc6df | GabrielFrizzo/competitive-programming | treinos/2020/27mai/A.cpp | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using vi = vector<int>;
using ll = long long;
int N, M;
vector<pii> directions = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
bool valid(int i, int j) {
return i >= 0 && j >= 0 && i < N && j < M;
}
void solve() {
vector<vi... | ALGO | 0.999862 | 3.913513 |
8ee005d0-83af-4ee2-ba12-19f84b7d4368 | thevoid3301/AlgorithmStudy | leetcode/6.z-字形变换.cpp | /*
* @lc app=leetcode.cn id=6 lang=cpp
*
* [6] Z 字形变换
*/
// @lc code=start
class Solution {
public:
string convert(string s, int numRows) {
vector<string> res(numRows, "");
string sRes;
int set = 0, f = 1;
if (numRows == 1)
{
return s;
}
for (... | ALGO | 0.999929 | 6.951706 |
e8669c42-1e90-4655-8d37-e058dba29cad | hoerldavid/chemotaxis | ChemotaxisSimulation/ChemotaxisSimulation/geometry.cpp | #include "geometry.h"
double cross2d(point2d a, point2d b)
{
return a.x * b.y - b.x * a.y;
}
bool intersect_lines(point2d& a1, point2d& a2, point2d& b1, point2d& b2, point2d& res)
{
auto va = a2 - a1;
auto vb = b2 - b1;
double denom = cross2d(va, vb);
if (denom == 0) return false; //para... | ALGO | 0.999526 | 5.405465 |
72d79fdd-9ca8-4116-8b50-97247ed4f32d | emonhassan83/practice-data-structure | Week-04. Stack_&_Queue/3. Problem Solving Using Stack & Queue/maxmimu_equal_stack_sum.cpp | //* https://www.codingninjas.com/studio/problems/maximum-equal-stack-sum_1062571
/*
#include <bits/stdc++.h>
int getSum(stack<int> s) {
int sum = 0;
while (!s.empty()) {
sum += s.top();
s.pop();
}
return sum;
}
int maxSum(stack<int> &s1, stack<int> &s2, stack<int> &s3) {
int sum1 = getSum(s1);
in... | ALGO | 0.999764 | 5.054664 |
215b228c-fc61-4514-bd9f-1fd15c9a6eba | UserBits/OI-Codes | Luogu/P2061[队列][模拟][线段树]城市的地平线City Horizon.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <cmath>
using namespace std;
const int N=40005;
struct Seg{
int l,r;
long long h;
friend bool operator < (Seg x, Seg y){
return x.h<y.h;
}
}a[N];
priority_queue<Seg> q;
int pt[N<<1];
bool cmp1... | ALGO | 0.999709 | 3.684286 |
39d3496e-d111-4ea9-a8b5-ffdc425536a1 | aayushk0250/DSA.LoveBabbar | week3-array/L-6-array1/basicQ.cpp |
#include<iostream>
using namespace std;
int main()
{
int arr1[10];
cout<<"enter the elements of array: "<<endl;
for(int i=0;i<5;i++)
{
cin>>arr1[i];
}
//sum of the array
int sum=0;
cout<<"sum of elements of the array: ";
for(int i=0;i<5;i++)
{
sum=sum+arr1[i];
... | ALGO | 0.976974 | 3.471335 |
af476489-b37d-496c-81a8-ecaad4642659 | ZWaldbusser/LeetCode | Problems/2037. Minimum Number of Moves to Seat Everyone.cpp | class Solution {
public:
int minMovesToSeat(vector<int>& seats, vector<int>& students) {
sort(seats.begin(), seats.end());
sort(students.begin(), students.end());
int total = 0;
for(int i = 0; i < seats.size(); i++) {
total += abs(seats[i] - students[i]);
}
... | ALGO | 0.999781 | 5.093348 |
f48bfdc5-ac0e-43b3-b306-c5aea2e1a3fb | Joonking/Study_CodingTest | Study_CodingTest/BaekJoon/Doit책/10_기하/097_11758_CCW.cpp | #include <iostream>
using namespace std;
int main()
{
int x1, y1, x2, y2, x3, y3;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
int result = (x1 * y2 + x2 * y3 + x3 * y1) - (x2 * y1 + x3 * y2 + x1 * y3);
int ans = 0;
if (result > 0) ans = 1;
else if (result < 0) ans = -1;
else ans = 0;
cout... | ALGO | 0.999983 | 3.859786 |
4dcad07a-c865-450e-800d-d47d8af4c266 | er-durgeshRaj/DSA---GeeksForGeeks---POTD---Solution | Buy Maximum Stocks if i stocks can be bought on i-th day.cpp | // QUESTION
// In a stock market, there is a product with its infinite stocks. The stock prices are given for N days, where price[i] denotes the price of the stock on the ith day.
// There is a rule that a customer can buy at most i stock on the ith day.
// If the customer has an amount of k amount of money initially. ... | ALGO | 0.999929 | 5.741541 |
329fca6c-d876-4cad-be77-2a9047322103 | BHOI/BHOI-Sekcije-i-Kampovi | Sekcije/Elvir 2/predavanje/topsort.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <vector>
#include <sstream>
#include <queue>
using namespace std;
const int MAXV = 100000;
const int DFS_WHITE = 0;
const int DFS_GREY = 1;
const int DFS_BLACK = 2;
string toString(vector <int> v)
{... | ALGO | 0.999999 | 4.375371 |
4333781a-170d-455e-9470-83d3518a76db | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Mixtral/top0-100/time-to-cross-a-bridge-Solution.findCrossingTime/177811_DoS.cpp | aspath_put (struct stream *s, struct aspath *as, int use32bit )
{
struct assegment *seg = as->segments;
size_t bytes = 0;
if (!seg || seg->length == 0)
return 0;
if (seg)
{
/*
* Hey, what do we do when we have > STREAM_WRITABLE(s) here?
* At the moment, we would write out a par... | ALGO | 0.99914 | 4.35751 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.