uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
28d2f3a5-9660-4165-828e-f058d30691fb | kogehipo/atcoder | ABC001-200/C問題/abc007_c.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define range(i, s, e) for (int i = (s); i <= (int)(e); i++)
struct Point { int y, x; };
bool operator<(const Point &p1, const Point &p2){
if (p1.x != p2.x) return p1.x < p2.x;
else return p1.y < p2.... | ALGO | 0.999951 | 3.328472 |
fda51e2d-68f0-45d0-b110-595d6b4eb597 | xu-weizhen/OJ_Codes | NowCoder(牛客网)/剑指Offer/反转链表.cpp | /*
**链接:https://www.nowcoder.com/questionTerminal/75e878df47f24fdc9dc3e400ec6058ca
**描述:输入一个链表,反转链表后,输出新链表的表头。
**时间:2019.8.8
**思路:略
*/
/*
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};*/
class Solution {
public:
ListNode* ReverseList(ListNode* pHead) {
... | ALGO | 0.998494 | 4.478337 |
fe1c10c9-c139-4baf-9b93-ca1b7e0638f1 | gopaljha16/100Days-of-Dsa-Learning | Day 67/Largest_rectange_in_histogram.cpp | // Largest Rectangle in histogram leetcode hard level question
// method 1
// class Solution {
// public:
// int largestRectangleArea(vector<int>& heights) {
// int n = heights.size();
// vector<int>right(n);
// vector<int>left(n);
// stack<int>st;
// //Next smallest right ... | ALGO | 0.999968 | 6.320472 |
e6de8557-6efd-490c-9fab-3ae71f6aa78a | ishandutta2007/codeforces | ylwang/normal/1288/D.cpp | #pragma GCC optimize(3)
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define reaD() read()
#define pb push_back
#define mkp make_pair
#define mst(a,b) memset(a,b,sizeof(a))
#define foR(i, k, j) for(register int i = (k); i >= (j); i--)
#define For(i, k, j) for(register int i = (k); i <= (j); i++)... | ALGO | 0.999955 | 3.739259 |
62597287-6357-46a3-877c-3b0c9d02f25c | Otherwa/Data-Structures-and-Algorithm | Stack Questions/6MaximumConsecutive1sWithKzeroes.cpp | /*
we have to find longest subarray which contains atmost k 0s.
so to find this we have to do:
for each A[j], try to find longest subarray.
- If A[i] to A[j] has zeros <=K, then there is no problem, we can expand our array.
- If A[i] to A[j] has zeros >k, then we have to shrink our array.(we increment i as well as j)
... | ALGO | 0.999873 | 5.249112 |
00f9e7f8-9d60-49e0-a997-45447989c580 | VixenLights/Vixen | src/Vixen.Common/Box2D/Dynamics/Joints/b2WheelJoint.cpp | #include <Box2D/Dynamics/Joints/b2WheelJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
#pragma warning( disable : 4456 )
// Linear constraint (point-to-line)
// d = pB - pA = xB + rB - xA - rA
// C = dot(ay, d)
// Cdot = dot(d, cross(wA, ay)) + dot(ay, vB + cross(wB, rB) - vA - cros... | ALGO | 0.930524 | 6.979097 |
b05aeb1f-5ae4-468e-8ae5-0716e69124f7 | sayandip20/GeeksForGeeks | Difficulty: Basic/Sorted Array Search/sorted-array-search.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
// Function to find element in sorted array
// arr: input array
// N: size of array
// K: element to be searche
int searchInSorted(int arr[], int N, int K)
{
// Your... | ALGO | 0.999923 | 5.639717 |
76936b46-08c9-4aeb-baf2-26bec7fe3db7 | hentaiOS/platform_system_core_old | libcutils/config_utils.cpp | #include <cutils/config_utils.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <cutils/misc.h>
cnode* config_node(const char *name, const char *value)
{
cnode* node = static_cast<cnode*>(calloc(sizeof(cnode), 1));
if(node) {
node->name = na... | CONFIG | 0.898435 | 4.770034 |
5697f3b2-6789-41cd-ad6d-30e7f8002e3e | MhammedAhmmed/LeetCode-Solutions | 1500-count-largest-group/1500-count-largest-group.cpp | class Solution {
int sumDigits(int num) {
int sum = 0;
while (num) {
sum += (num % 10);
num /= 10;
}
return sum;
}
public:
int countLargestGroup(int n) {
unordered_map<int, int> freq;
int maxSize = 0;
for (int i = 1; i <= ... | ALGO | 0.999917 | 6.678318 |
78eeac99-50b6-4567-9bcb-ba68897fac21 | MMorana094/Prog2 | esercizi/treno.cpp | /*
Si crei una classe treno, la classe treno sarà caratterizzata dal numero di vagoni; tutti i vagoni possono contenere al massimo lo stesso numero di viaggiatori.
Creare un treno in cui il numero di vagoni e il numero massimo di viaggiatori per vagone siano scelti dall’utente e per 5 volte far chiedere all’utente se ... | ALGO | 0.994904 | 4.710886 |
d6ba60b0-ea7e-4f38-8a42-272b6adf9e4d | Apurba94/10-Years-of_Competitive-Programming-Resources-Collection | Codeforces From 2011-2023/1669B-Triple.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
int main(){
long t; scanf("%ld", &t);
while(t--){
long n; scanf("%ld", &n);
std::vector<long> v(n); for(long p = 0; p < n; p++){scanf("%ld", &v[p]);}
sort(v.begin(), v.end());
long res(-1);
for(long p = 2; p < n; ... | ALGO | 0.999894 | 3.442196 |
9707f8e4-7ff9-4111-91f1-3c4ed5283b1b | hankkkwu/SDCND-Model_Predictive_Control_Quizzes | mpc_to_line/src/Eigen-3.3/bench/benchmark.cpp | // g++ -O3 -DNDEBUG -DMATSIZE=<x> benchmark.cpp -o benchmark && time ./benchmark
#include <iostream>
#include <Eigen/Core>
#ifndef MATSIZE
#define MATSIZE 3
#endif
using namespace std;
using namespace Eigen;
#ifndef REPEAT
#define REPEAT 40000000
#endif
#ifndef SCALAR
#define SCALAR double
#endif
int main(int ar... | ALGO | 0.989037 | 3.675187 |
21935b16-dcd7-4b28-9ff6-d68cdcfa4b53 | longvuu/Cpp-Code | yendinh1/quay lui/vinhdinhcoder/btkcow1.cpp | /*
@author longvuuuu
*/
#include <bits/stdc++.h>
#define taskname "btkcow1"
using namespace std;
int n, M, a[25];
int res = 0, minCow = 1e9;
void Try(int i, int sum, int cnt) {
if (sum > M) return;
if (i > n) {
if (sum == M) {
res++;
minCow = min(minCow, cnt);
}
... | ALGO | 0.999996 | 4.557846 |
b9364ef3-17de-44dd-92d4-36cf00ae13eb | s-m-arafat/online-judge-problems | codeforces/Practice problems/677A.cpp | //Auth:Shakil Mahmud Arafat, AUST, Dept. of EEE
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll>vll;
typedef vector<int>vi;
typedef vector<vll>vvl;
typedef vector<vi>vvi;
#define nl '\n'
#define get cin>>
#define imn INT_MIN
#define imx INT_MAX
//vectors
#define all(a) a.begin(),... | ALGO | 0.999652 | 3.57482 |
7b152420-49d7-4546-a2db-c4f9b6a969e4 | raincross7/code-similarity | codes/train_code/problem492/problem492_320.cpp | /*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define ... | ALGO | 0.99997 | 4.185474 |
032865d3-619e-49ab-958c-2741d6d48d12 | Checkmate50/cpp99problems | p1120/17.cpp | #include<iostream>
//(*) Split a list into two parts; the length of the first part is given.
// So since this is trivial in C++, I'm instead going to do it for example strings with pointer / string magic
// Note that this is bad form, but is an interesting solution nonetheless
// Requires that `s` have initialized s... | TOOL | 0.947939 | 4.819017 |
27ba21e6-a434-4ecd-9a9e-ff1cad84c93e | faisalAkhtar/Algo | BFS.cpp | #include<iostream>
#include<list>
using namespace std;
class Graph
{
int V;
list<int> *adj;
public:
Graph(int V);
{
this->V = V;
adj = new list<int>[V];
}
void addEdge(int v, int w);
{
adj[v].push_back(w);
}
void BFS(int s);
{
bool *visited = new bool[V];
for(int i = 0; i < V; i++)
visited[i... | ALGO | 0.999816 | 4.423928 |
b55aae1c-0281-4adb-96ce-7e67555b50b3 | mnlgdn/Homework2_RL | orocos_kinematics_dynamics/orocos_kdl/src/treejnttojacsolver.cpp | /*
* TreeJntToJacSolver.cpp
*
* Created on: Nov 27, 2008
* Author: rubensmits
*/
#include "treejnttojacsolver.hpp"
#include <iostream>
#include "kinfam_io.hpp"
namespace KDL {
TreeJntToJacSolver::TreeJntToJacSolver(const Tree& tree_in) :
tree(tree_in) {
}
TreeJntToJacSolver::~TreeJntToJacSolver() {
}... | ALGO | 0.995996 | 6.121388 |
631d9d66-ce38-4a23-bdf7-48ec54e3d95d | ludamad-test-org/xmodules-test | barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp | #include "blake2s_constraint.hpp"
#include "round.hpp"
namespace acir_format {
void create_blake2s_constraints(Composer& composer, const Blake2sConstraint& constraint)
{
// Create byte array struct
byte_array_ct arr(&composer);
// Get the witness assignment for each witness index
// Write the witnes... | ALGO | 0.979042 | 6.363872 |
62433c3e-8408-4b2d-8342-dfc862037e67 | wiless/IMTAphy | modules/phy/imtaphy/src/lsParams/LSCorrelation.cpp | #include <IMTAPHY/lsParams//LSCorrelation.hpp>
#include <WNS/evaluation/statistics/moments.hpp>
#include <IMTAPHY/Channel.hpp>
#include <IMTAPHY/StationPhy.hpp>
#include <IMTAPHY/ChannelModuleCreator.hpp>
#include <IMTAPHY/Link.hpp>
#include <IMTAPHY/linkManagement/LinkManager.hpp>
#include <iostream>
#include<itpp/i... | ALGO | 0.987757 | 5.35381 |
def3b05d-d8a3-40d1-815d-82d046b353b2 | dongyi-kim/10weeks-codingtest | chapter04/problem_f/solution.cpp | #include <cstdio>
#include <vector>
using namespace std;
//소인수 분해를 빠르게
class Sieve {
public:
int maximumValue; // 에라토스테네스의 체에서 다룰 가장 큰 범위의 값
vector<bool> isPrime; // 각 숫자별 소수 여부
Sieve(int maximumValue) {
this->maximumValue = maximumValue;
this->isPrime.assign(maximumValue + 1, false);
this->fillSieve();
... | ALGO | 0.999897 | 4.501343 |
f59b66a2-34fa-4452-9b71-b8478d4dc439 | saranshrawat/Data-structure-and-algorithms | hacker rank/find floor and ceil of a given number in array.cpp | //find floor and ceil in agiven array...O(n)
//find floor and ceil of a given number in a given sorted array...O(log n)
#include<iostream>
using namespace std;
void floor_ceil(int arr[],int n,int data)
{
int low=0,high=n-1;
int f=0,c=0;
while(low<=high)
{
int mid=(low+high)/2;
if(arr[mid]>data)
{
... | ALGO | 0.999803 | 4.091888 |
17618ba7-5f49-4c14-91c6-eae2089df56f | DGermano8/DeformableTissue | src/BoxModel/TissueSlabSimulation.cpp | #include "TissueSlabSimulation.hpp"
#include "Debug.hpp"
bool SortVectorAccordingToXCoordinate(const c_vector<double, 2> lhs, const c_vector<double, 2> rhs)
{
return lhs[0] < rhs[0];
}
bool SortVectorAccordingToYCoordinate(const c_vector<double, 2> lhs, const c_vector<double, 2> rhs)
{
return lhs[1] < rhs[1];... | ALGO | 0.997737 | 6.34792 |
db7695bf-7a3b-45f5-8cad-496baf473441 | checkoutb/LeetCodeCCpp | ge2400/LT2493_2022-12-15_Divide_Nodes_Into_the_Maximum_Number_of_Groups.cpp |
#include "../header/myheader.h"
class LT2493
{
public:
// D D
//Runtime490 ms
// Beats
// 75.45 %
// Memory50.8 MB
// Beats
// 37.98 %
// ÿ㶼һbfstle
// DzֻҪһbfs Ϳ֪ -1
// 1 bfs + 1dfs dfs
// δӡ Ҫuf ÿͨ gp
int lt2493a(int n, vector<vector<int>>& edges... | ALGO | 0.99992 | 5.418767 |
d846c857-d625-4835-a683-8c57a5720ff4 | nandinitak/Interview_pep | 0006-zigzag-conversion/0006-zigzag-conversion.cpp | class Solution {
public:
string convert(string s, int numRows) {
if (numRows == 1 || numRows >= s.length()) {
return s;
}
int idx = 0, d = 1;
vector<vector<char>> rows(numRows);
for (char c : s) {
rows[idx].push_back(c);
if (idx == 0) {
... | ALGO | 0.999994 | 6.784034 |
82478021-306b-4599-a4b8-92d2802fef5f | 1664334426/leetcode | 202501/20250201-lc81/Solution.cpp | class Solution {
public:
bool search(vector<int>& nums, int target) {
while (nums.size() > 1 && nums.front() == nums.back())
nums.pop_back();
if (nums.size() == 1)
return nums[0] == target;
int x = 0, y = nums.size() - 1;
while (x < y){
int mid = (... | ALGO | 0.999989 | 5.707648 |
6434093a-6035-49da-888a-338b3c53403d | wwar-lock/codes | cses/repititions.cpp | #include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define int long long int
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define... | ALGO | 0.99998 | 4.466392 |
63b55b85-1d5c-404b-a7fa-5c8b6c9a5751 | otavioon/COLA-2022-Tools | datasets/src/algo/poj/0/1957.cpp | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
int main()
{
int n=0,k=0,i=0,j=0,a[1000]={0},q=0; //???a??????
cin>>n>>k;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++) //???????????? ?????k
{
for(j=0;... | ALGO | 0.999957 | 3.909271 |
46693d91-93b2-4cc6-ab8e-0aa93f06492e | jiachenwei/eigen | doc/examples/class_CwiseBinaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using Eigen::Matrix4d;
// define a custom template binary functor
template<typename Scalar> struct MakeComplexOp {
EIGEN_EMPTY_STRUCT_CTOR(MakeComplexOp)
typedef std::complex<Scalar> result_type;
result_type operator()(const Scalar& a, const Scalar& b) const { return re... | ALGO | 0.976198 | 6.840831 |
cacb328f-0b1a-451b-9b4b-8b0652dfdde7 | mt-shihab26/online_judges | codeforces/difficulty-0800/1541A.Pretty_Permutations.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define endn "\n"
void test(void) {
int n;
cin >>n;
if (n % 2) {
for (int i = 2, j = 1; i <= n-3 and j <= n-3; i += 2, j += 2) {
cout <<i <<" ";
cout <<j <<" ";
}
cout <<n <<" " <<n-2 <... | ALGO | 0.999763 | 4.735373 |
7bcb34f8-a0f3-4c07-a68e-440695cb19aa | Higherorbit/Leetcode-and-gfg-solutions | 990-satisfiability-of-equality-equations/990-satisfiability-of-equality-equations.cpp | class Solution {
public:
vector<int> parent;
int find(int x){
if(parent[x]==x){
return x;
}
parent[x]=find(parent[x]);
return parent[x];
}
bool equationsPossible(vector<string>& v) {
for(int i=0;i<26;i++){
parent.push_back(i);
}
... | ALGO | 0.999975 | 5.916997 |
c2ad627d-0712-4af3-a1bb-ea6eaa661b14 | KYENS/gem5_InCache | src/systemc/tests/systemc/misc/user_guide/chpt4.2/stage3.cpp | /*****************************************************************************
stage3.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************... | ALGO | 0.99948 | 4.191345 |
a3169caf-9330-45cb-81c0-6d0f5e58b5d7 | skye2077/rvv_gem5 | base_rvv/src/systemc/tests/systemc/misc/examples/a2901/a2901_alu_inputs.cpp | /*****************************************************************************
a2901_alu_inputs.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*******************************************************************... | TOOL | 0.940413 | 4.668721 |
bbd32302-0266-410b-b28b-39ec453d8fcb | Amitkumar-007/face_recognition | opencv-master/modules/imgproc/src/resize.sse4_1.cpp | /* ////////////////////////////////////////////////////////////////////
//
// Geometrical transforms on images and matrices: rotation, zoom etc.
//
// */
#include "precomp.hpp"
#include "resize.hpp"
namespace cv
{
namespace opt_SSE4_1
{
class resizeNNInvokerSSE2 :
public ParallelLoopBody
{
public:
resizeNNI... | ALGO | 0.993108 | 7.037607 |
0b463914-779b-41af-8397-b95f0f5e7652 | GroupOfLPSLAM/LP_SLAM | lp/src/OCR.cpp | #include<iostream>
#include<fstream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp>
#include "opencv2/imgcodecs.hpp"
#include <cmath>
#include <cstring>
#include <OCR.h>
#include <sys/time.h>
#include <unistd.h>
using namespace std;
using namespace cv;
using namesp... | TOOL | 0.896785 | 3.554456 |
37ecbe9f-578f-465b-a767-2468034c8bda | hwannow/PS | BOJ/26767.cpp | #include<bits/stdc++.h>
#define x first
#define y second
using namespace std;
int n;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
if (i % 7 == 0 && i % 11 != 0) cout << "Hurra!\n";
else if (i % 7 != 0 && i % 11 == 0) cout ... | ALGO | 0.999796 | 3.380675 |
b0abf80a-1b04-4e43-aaa0-8e4039c4b01a | Muqaddas-Mehboob/LeetCode-Problems | product_of_array_except_self.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
// This will be the Brute Force Approach but it will give you TLE
// (Time Limit Exceed) because in constraints, it is clearly
// mentioned that th... | ALGO | 0.999934 | 5.662114 |
9bfea444-48d4-40d6-bd0a-7860d9bca802 | dpkk1/leetcode | 814-binary-tree-pruning/814-binary-tree-pruning.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.999865 | 5.802683 |
fc75392f-2d32-444a-9cad-1cbd1ed17c26 | devraj2018/Programming_Pathshala | Grid_Path/2)-Rotten_Orange.cpp | class Solution {
public:
int orangesRotting(vector<vector<int>>& grid) {
int row=grid.size();
int col=grid[0].size();
queue<pair<int,int>>q;
int fresh=0;
for(int i=0;i<row;i++)
{
for(int j=0;j<col;j++)
{
if(gri... | ALGO | 0.999953 | 6.098414 |
1fc7b89d-ff0c-42ff-bc9c-023ccd6d0cbb | kedonaghey/QuantLibAdjoint | ql/models/marketmodels/callability/bermudanswaptionexercisevalue.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <ql/models/marketmodels/callability/bermudanswaptionexercisevalue.hpp>
#include <ql/models/marketmodels/utilities.hpp>
#include <ql/models/marketmodels/curvestate.hpp>
#include <ql/payoff.hpp>
namespace QuantLib {
BermudanSw... | ALGO | 0.998276 | 7.60666 |
d750d8a6-c3f3-4b79-a297-0b3a73925606 | abhinav-193/Codes | C++/kthsmall.cpp | #include <bits/stdc++.h>
using namespace std;
void bubbleSort(int arr[], int n)
{
int i, j;
for (i = 0; i < n-1; i++)
{
for (j = 0; j < n-i-1; j++)
{
if (arr[j] > arr[j+1])
{
int temp = arr[j];
arr[j] = arr[j+1];
arr[j... | ALGO | 0.99996 | 3.45556 |
44e6b666-875b-466a-afb2-506878c34afe | SanaUllah04/Analysis_of_Algorithm | Merge_Sort.cpp | #include <iostream>
#include <vector>
using namespace std;
// Function to merge two sorted halves of the array
void merge(vector<int>& arr, int left, int middle, int right) {
int n1 = middle - left + 1;
int n2 = right - middle;
// Create temporary arrays to hold the two halves
vector<int> leftHalf(n1... | ALGO | 0.999996 | 6.343436 |
68ce3b02-1fa4-45ef-ae99-62d165825424 | shivang1305/DSA_Foundations | Recursion & Backtracking/last_occurence.cpp | #include<iostream>
using namespace std;
int lastOccurence(int A[], int idx, int ele, int N) {
if(idx > N-1)
return -1;
int lisa = lastOccurence(A, idx+1, ele, N);
if(lisa != -1)
return lisa;
else
if(A[idx] == ele)
return idx;
else
return -1;
}
int main() {
int N;
cout<<"enter ... | ALGO | 0.999675 | 5.273979 |
98ccf145-2ee2-49e6-8c20-a1ca9e8c1ee0 | GGanj/LeetCode | 338.counting-bits/main.cpp | #include <iostream>
#include "counting-bits.cpp"
int main() {
// Solution mySol;
// int n = 2;
// std::vector<int> res = mySol.countBits(n);
// for(int i : res) {
// std::cout << i << " ";
// }
// std::cout << std::endl;
std::cout << (10 & 9) << std::endl;
return 0;
} | ALGO | 0.999587 | 5.580209 |
8d940f42-3d83-4058-9d7b-0bb5d5a17848 | siddharthagarwal543/Sunyul-Hossen-DSA-Questions | Given a binary tree, check whether it is a mirror of itself.cpp | //Problem link:https://leetcode.com/problems/symmetric-tree/
class Solution {// TC O(min(N,M)) SC O(min(N,M)) for rec call stack
public:
bool check(TreeNode* head1,TreeNode* head2)
{
if(head1==NULL&&head2==NULL)//both tree should have same length and same number of nodes
return true;
if(... | ALGO | 0.999979 | 6.851106 |
55290873-268c-4cc7-88db-28526a24b6dd | sarvex/solution-cpp | 2940.find_building_where_alice_and_bob_can_meet.cpp | #include <vector>
#include <algorithm>
#include <numeric>
using std::vector;
using std::swap;
using std::sort;
class BinaryIndexedTree {
private:
int inf = 1 << 30;
int size_;
vector<int> children_;
public:
BinaryIndexedTree(int n) {
this->size_ = n;
children_.resize(n + 1, inf);
}
void update(i... | ALGO | 0.999983 | 6.32343 |
c5608553-c6c4-4337-b3bb-24a8ec5248e0 | dysuby/Learn-ds | 刷题/soj/1007.cpp | template <typename Node_entry>
struct Node {
Node_entry entry;
Node *next;
Node();
Node(Node_entry item, Node *add_on = NULL);
};
template <typename Node_entry>
Node<Node_entry>::Node() {
next = NULL;
}
template <typename Node_entry>
Node<Node_entry>::Node(Node_entry item, Node *add_on) {
entry = item;
... | ALGO | 0.999983 | 5.406174 |
a574765c-0d7c-4c2b-bebf-22a798be6956 | gitGNU/gnu_gnash | libcore/Geometry.cpp | #include "Geometry.h"
#include <cmath>
#include <algorithm>
#include <cstdint>
#include "log.h"
#include "LineStyle.h"
namespace gnash {
namespace geometry {
namespace {
// TODO: this should be moved to libgeometry or something
// Finds the quadratic bezier curve crossings with the line Y.
// The function can have... | ALGO | 0.998596 | 6.238297 |
be822f21-4af2-4024-b25d-1f17815da1ae | Sahib-Aujla/DSA_in_Cpp | vectors/vector2SumAndDiff.cpp | //difference between Sum of even indices and odd indices
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector <int> v={1,2,1,2,1,2,1,3};
int evenSum=0;
int oddSum=0;
for(int i=0; i<v.size(); i+=2){
if(i+1<v.size()){
oddSum+=v[i+1];
}
... | ALGO | 0.999803 | 4.851717 |
aa9d8fd3-75f1-45ac-bed1-c115b597df9a | Seungchan0325/ioikorea | winter2025/day 5/B.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MAXN = 20;
const ll INF = 1e18;
ll N, w[MAXN][MAXN], cache[1<<MAXN][MAXN];
ll dp(ll taken, ll now)
{
if(taken == (1<<N)-1) return w[now][0] == 0 ? INF : w[now][0];
ll& ret = cache[taken][now];
if(ret != -1) return ret;
re... | ALGO | 0.999962 | 3.904924 |
20abbcaa-dcbe-4553-8a1e-d1867c25b0e0 | Not-Mostafa/CP | E_Same_Map_in_the_RPG_World.cpp | #include <bits/stdc++.h>
using namespace std;
#define FIO ios ::sync_with_stdio(false), cin.tie(nullptr), cout.tie(NULL)
#define ll long long
#define ld long double
#define all(container) (container).begin(), (container).end()
#define cl(x,y) (x + y - 1) / y
#define lp(size) for (int i = 0; i < size; i++)
#define rlp(... | ALGO | 0.999882 | 4.596786 |
6f70706c-7fdb-496c-8969-d3c5fc08f5fc | OpenDigitalTwin-Dev/FENGSim | toolkit/Geometry/smesh/src/StdMeshers/StdMeshers_CompositeSegment_1D.cpp | #include "SMESH_Gen.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_HypoFilter.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_subMeshEventListener.hxx"
#include "SMESH_Comment.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include "utilities.h"
#include <BRepAdaptor_CompCurve.hxx>
#include <BRe... | ALGO | 0.998658 | 6.036007 |
ac257235-6c59-4b8d-8700-e82e72944892 | anuragbnrj/competitive | library/segmentTree/pointUpdateRangeSum.cpp | // Problem Link:
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
long double PI = acos(-1.0);
ll MOD = 1e9 + 7;
int INF = 1e9;
vector<ll> a;
vector<ll> seg;
void build(int idx, int l, int r) {
// cout << "l: " << l << ", r: " << r << endl;
if (l == r) {
seg[id... | ALGO | 0.999747 | 5.159134 |
7d92a669-3295-4ab0-9df4-a106d2ea7721 | 0alfajar/LeetCode | 2706-buy-two-chocolates/2706-buy-two-chocolates.cpp | class Solution {
public:
int buyChoco(vector<int>& prices, int money) {
sort(prices.begin(), prices.end());
if(prices[0] + prices[1] <= money) return money - (prices[0] + prices[1]);
else return money;
}
}; | ALGO | 0.999279 | 5.35339 |
998c715e-ef0f-4ec3-be51-d7baa956b80b | STF-OSS/python | venv/Lib/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.9982 | 7.198757 |
d8a03cd3-7cfe-4a96-9078-e045bbd37ac9 | Mi-Przystupa/PendulumSimulator | C++/eigen/unsupported/bench/bench_svd.cpp | // Bench to compare the efficiency of SVD algorithms
#include <iostream>
#include <bench/BenchTimer.h>
#include <unsupported/Eigen/SVD>
using namespace Eigen;
using namespace std;
// number of computations of each algorithm before the print of the time
#ifndef REPEAT
#define REPEAT 10
#endif
// number of tests of t... | TEST | 0.992622 | 6.26191 |
7123a6d3-86f3-4de1-b68d-f0b99a381fbb | ishandutta2007/codeforces | lucina/normal/1208/B.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+10;
int n,a[maxn];
bool ch(int x){
map<int,int> s;
for(int i=x+1;i<=n;i++){
s[a[i]]++;;
}
if((int)s.size()==n-x)return true;
for(int i=1;i<=n-x;i++){
s[a[i+x]]--;
if(s[a[i+x]]==0)s.erase(s.find(a[i+x]));
... | ALGO | 0.999959 | 3.968459 |
9790251d-a3e8-4dd2-83b2-23a67ee04ad0 | GideokKim/algorithm | 프로그래머스/0/181835. 조건에 맞게 수열 변환하기 3/조건에 맞게 수열 변환하기 3.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<int> arr, int k) {
vector<int> answer;
answer.resize(arr.size());
if (k % 2) {
for (size_t index = 0; index < answer.size(); ++index) {
answer[index] = arr[index] * k;
}
} else {
fo... | ALGO | 0.999821 | 5.171728 |
f02d037f-d776-40e5-a9c3-71089a934d4e | kwroczek/Gitrepo | wroczek_petla2.cpp | /*
* wroczek_petla2.cpp
*
*/
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
int n;
cin >> n;
int suma = 0;
int ile_parzystych;
for(int i=0; i<n; i++){
int liczba;
cin >> liczba;
if(liczba % 2 == 0)
{
suma ... | ALGO | 0.999645 | 4.627074 |
79a1ea70-6d6e-4223-8366-311ef74ee8af | michaelbrownuc/egalito-gadgets | src/pass/instrumentinstr.cpp | #include <iomanip>
#include "pass/instrumentinstr.h"
#include "disasm/disassemble.h"
#include "instr/register.h"
#include "instr/semantic.h"
#include "instr/linked-x86_64.h"
#include "operation/mutator.h"
#include "log/log.h"
#include "log/temp.h"
void InstrumentInstructionPass::visit(Function *function) {
if(!s... | TOOL | 0.894347 | 6.435939 |
224471c8-7266-4cda-82ae-254defc656fd | RossErskine/AstarPathfinding | Pathfinding_Algorithms/Pathfinding_Algorithms/Map.cpp | #include "Map.h"
#include <iostream>
#include <random>
namespace MyLib
{
// ================================member functions =============================================//
// =============================== constructor ======================================= //
/* ==================================================... | ALGO | 0.992858 | 4.40351 |
be23a95b-ddcc-4235-abe8-55e8656f13d9 | kaskr/adcomp | tmb_syntax/multivariate_distributions.cpp | /** \file
\ingroup Examples
\brief Shows multivariate distributions
*/
#include <TMB.hpp>
template<class Type>
Type objective_function<Type>::operator() ()
{
PARAMETER(dummy_par)
// Load namespace which contains the multivariate distributions
using namespace density;
Type res; ... | TEST | 0.993553 | 5.153993 |
e6202a72-c2eb-49c9-ae28-53ae169a6bb3 | priojeetpriyom/competitive-programming | code chef/Blocked websites WSITES01 string processing .cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<string> pluss, minuss;
set<string> ans;
unordered_map<string, int> prefix;
int main()
{
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
std::ios_base::sync_with_stdio(false);
cin.tie(0);
string s;
... | ALGO | 0.999688 | 3.697481 |
9fa50496-1299-4540-8856-fd372a05c2e3 | GoyalRohan/DSA-Topiwise-Practice | Sorting/RADIX_SORT.CPP | #include <iostream>
using namespace std;
class RADIX
{
int data;
RADIX **top;
RADIX *next;
public:
RADIX();
void INSERT(int, int);
int DELETE(int);
bool CHECK(int);
};
RADIX::RADIX()
{
top = new RADIX *[10];
for (int i = 0; i < 10; i++)
top[i] = NULL;
}
void RADIX::INSERT... | ALGO | 0.999963 | 4.401465 |
3640a6fd-ae33-4483-82dc-98f15de2f2a6 | abdullahalsazib/Basic-Data-Structures | Module 7 SinglyLL/singly_revarce_print.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int value;
Node *next;
Node(int value)
{
this->value = value;
this->next = NULL;
}
};
void input_linked_list(Node *&head, Node *&tail, int val)
{
Node *newNode = new Node(val);
if (head == NULL)
{
... | ALGO | 0.999721 | 4.622634 |
f3f6b570-294e-404d-9f95-43e215022fec | arshsaini15/cpp-language | Backtracking/RatInAMaze.cpp | #include<iostream>
#include<vector>
using namespace std;
bool isSafe(int newx, int newy, vector<vector<int>> maze, vector<vector<bool> > &vis, int n){
if((newx >=0 && newx < n) && (newy >= 0 && newy < n) && vis[newx][newy] != 1 && maze[newx][newy] == 1){
return true;
}
return false;
}
void solve(i... | ALGO | 0.999964 | 4.871212 |
bebe8407-8ee5-4a6d-9f3a-5c6a99e24a62 | firoball/Bouncer | newton/sdk/customJoints/CustomDryRollingFriction.cpp | // CustomUpVector.cpp: implementation of the CustomUpVector class.
//
//////////////////////////////////////////////////////////////////////
#include "CustomDryRollingFriction.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
////////////////////////////////////////... | ALGO | 0.911371 | 5.235583 |
2c3d51a9-485f-4360-bc47-60a8cad355f7 | Koynovigor/-pp | complex.cpp | #include <iostream>
#include <cmath>
using namespace std;
class Complex
{
double re = 0;
double im = 0;
public:
Complex(double r = 0, double i = 0) {re = r; im = i;}
Complex(Complex&);
void Input();
void Output();
double Mod();
double& Re() {return re;}
double& Im() {return im;}... | ALGO | 0.994395 | 4.128105 |
fbebca9e-be0d-4c01-a6c6-30117dacb9ee | ashishpatel626/C-Drexel | Encryption_&_dectyption.cpp | #include <iostream>
#include <string>
using namespace std;
char encryption1(char, int);
char decryption1(char, int);
char encryption2(char, int);
char decryption2(char, int);
char encryption3(char);
char decryption3(char);
using namespace std;
char encryption1(char map, int wheelPos1)
{
return ((7 * wheelPos1 + ... | ALGO | 0.999595 | 3.579242 |
273cb465-f250-4144-9c28-d3ae0e283021 | chenshi5858/Tarea3PBN | bus.cpp | #include "Bus.h"
Bus::Bus(int id, int posicion) : bus_id(id), posicion(posicion), tiempo_de_espera(0) {}
void Bus::mover() {
if (tiempo_de_espera > 0) {
--tiempo_de_espera;
return;
}
posicion = (posicion + 5) % 10000;
}
void Bus::detener(Parada& parada) {
tiempo_de_espera = 5;
baj... | TOOL | 0.953302 | 4.719232 |
733c5b2c-6a92-45c1-a1df-9bfd73951e4b | htbkoo/cplusplus | src/onlinePlatform/leetcode/leetcoding_challenge/2023/jun2023/week4/path_with_maximum_probability.cpp | #include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <limits>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iterator>
#include <sstream>
#include <iostream> // includes cin to read from stdin and cout to write to stdout
using namespace std; // since cin and cout a... | ALGO | 0.999959 | 5.484923 |
d72b368a-4607-486b-9cf2-5594c96dad18 | signalkinetics/vab | txrx/src/libeigen/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)
{
return v.sta... | TEST | 0.986857 | 6.694365 |
914825cc-3923-4365-a5c8-dbdd1be1847c | TroyAchilles/c-11-notes | src/Matrix.cpp | /**
* @file Matrix.cpp
* @brief
* @author dcl
* @version <IP_ADDRESS>
* @date 2020-02-27
*/
#include "Matrix.h"
#include <stdio.h>
#include <iostream>
//constexpr int MAX_ROW = 4;
//constexpr int MAX_COL = 4;
//int iMatrix[MAX_ROW][MAX_COL] = {
//1, 3, 5, 9,
//8, 1, 3, 4,
//5, 0, 6, 1,
//8, 8, 4,... | ALGO | 0.998352 | 3.396793 |
3629c6de-74ad-4449-8de6-d5ec44f823cf | CharlesLakes/dynamic-arrays | test/stack/main_stack_list.cpp | #include "../debug.h"
#include <bits/stdc++.h>
using namespace std;
int main(){
stack<int, list<int>> st;
int number_of_element;
cin >> number_of_element;
while(number_of_element--){
int number;
cin >> number;
st.push(number);
}
int queries;
cin... | ALGO | 0.999348 | 4.809786 |
df04ff37-66e7-45c1-9766-fbb0a29a8097 | kylegibson15/cpp-algorithms | src/multiply/multiply.cpp | int multiply(int a, int b)
{
int x = a, y = b, z = 0;
while(x > 0)
{
z = z + y;
x = x - 1;
}
return z;
}
| ALGO | 0.999803 | 3.951389 |
6a0816d1-fb17-4a65-9b3a-1da20972e99a | juneharold/USACO | Codeforces/#915/A.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <random>
#include <chrono>
#include <numeric>
#include <iomanip>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;... | ALGO | 0.999873 | 4.942692 |
64ac7d8b-7418-425f-ab38-4fd229b24fe5 | ttylinux/cppPrimer | chapter9/9_31_forwardList.cpp | #include<iostream>
#include<forward_list>
using namespace std;
int main() {
forward_list<int> vi = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
auto iter = vi.begin(), prev = vi.before_begin();//ָԪ֮ǰλ
while (iter != vi.end()) {
if (*iter % 2) {
iter = vi.insert_after(prev, *iter);//뵽prev֮صiterָԪ
advance(iter, 2);
... | ALGO | 0.999132 | 3.251581 |
8ad11860-aa2d-4d3a-ae9a-ce1a8e962678 | ShubhamAgarwal-11/Leetcode | 0448-find-all-numbers-disappeared-in-an-array/0448-find-all-numbers-disappeared-in-an-array.cpp | class Solution {
public:
vector<int> findDisappearedNumbers(vector<int>& nums) {
unordered_map<int,int>umap;
for(auto&x : nums)
umap[x]++;
vector<int>ans;
for(int i=1;i<=nums.size();i++){
if(umap.find(i) == umap.end())
ans.push_back(i);
... | ALGO | 0.999471 | 5.021489 |
ca5ba1a7-c7e2-4bde-bd15-7e23965e25b4 | DarkSevence/EntryCore | entry_bin/EterBase/Stl.cpp | #include "StdAfx.h"
#include "stl.h"
static std::list<std::string> s_stList;
char korean_tolower(const char c)
{
char ret = c;
if (c >= 'A' && c <= 'Z')
ret = c - 'A' + 'a';
assert(ret == tolower(c));
return ret;
}
std::string& stl_static_string(const char * c_sz)
{
std::string str;
str.assign(c_sz);
s_st... | TOOL | 0.926535 | 4.837397 |
5d03b76b-19d1-4fc0-b225-125973b6bc8d | EdimarJunior/CompositionalTioco | symbolrt/CVC4/src/theory/strings/regexp_entail.cpp | /********************* */
#include "theory/strings/regexp_entail.h"
#include "theory/rewriter.h"
#include "theory/strings/theory_strings_utils.h"
#include "theory/strings/word.h"
using namespace std;
using namespace CVC4::kind;
namespace CVC4 {
namespace theory... | ALGO | 0.995765 | 6.992669 |
ce4f40da-601d-411b-b7a1-9ae1d8034078 | Mosina916/CB-ND-DEC21-C- | Lecture25/dictionaryorderlarger.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<string>v;
void permuation(char in[],int i){
// base case
if(in[i]=='\0'){
// cout<<in<<endl;
v.push_back(in);
return;
}
// recursive case
for(int j=i;in[j]!='\0';j++){
swap(in[i],in[j]);
permuation(in,i+1);
swap(in[i],in[j]); //backtrac... | ALGO | 0.999856 | 3.860426 |
8bd849a5-2c25-4714-a28f-8610402089b3 | logan0501/LeetCode-solutions | 209-minimum-size-subarray-sum/209-minimum-size-subarray-sum.cpp | class Solution {
public:
int minSubArrayLen(int target, vector<int>& nums) {
int sum=0,l=0,r=0,n=nums.size(),minl=INT_MAX;
while(r<n){
sum+=nums[r++];
while(sum>=target){
minl=min(minl,r-l);
sum-=nums[l];
l++;
}
... | ALGO | 0.999995 | 6.4079 |
fc03289c-9eb4-4130-958b-82d8a23f58d0 | javierlopm/proy1Inteligencia | global/wida_pdb.cpp | //Necesito cost, generated, time
#include <vector>
#include <iostream>
#include <tuple>
#include <time.h>
#include <csignal>
#include <algorithm>
using namespace std;
//VARIABLES GLOBALES
state_map_t *pdb[3];
abstraction_t *abst[3];
unsigned nodos_gen = 0;
float k = 1 + 0; //0 = gap
void signalHandler( int signum )
... | ALGO | 0.999757 | 3.05156 |
98a7410e-0609-4ad0-a5c3-ae85f29db8c4 | raincross7/code-similarity | codes/train_code/problem169/problem169_205.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int A,B,area;
scanf("%d %d",&A,&B);
area=(A-1)*(B-1);
printf("%d\n",area);
}
| ALGO | 0.994492 | 4.01959 |
65153468-183d-4b9a-9287-239eeb4e5b10 | astpy/imashime | cpp/day06/9_B_shuffle.cpp | #include<iostream>
#include<string>
using namespace std;
int main(){
string cards;
char tmp;
unsigned int num_of_shuffle, i, j, top;
while(1){
cin >> cards;
if( cards == "-") break;
cin >> num_of_shuffle;
for( i = 0; i < num_of_shuffle; i++ ){
... | ALGO | 0.994732 | 3.746636 |
f6967229-f162-47d1-9816-3d05e321fb5a | Offliners/ZeroJugde-writeup | UVa/Contents/d255/d255.cpp | #include<iostream>
# define MAX 501
using namespace std;
void init(void);
int phi[MAX] = {0};
int G[MAX] = {0};
int main(void)
{
int N;
init();
while(1)
{
cin >> N;
if(!N)
break;
cout << G[N] << endl;
}
return 0;
}
void init()
{
for(int i = 2; i < MAX; i++)
phi[i] = i;
for(int i = 2;... | ALGO | 0.999762 | 3.645983 |
adfdf256-b6e0-4d07-ae96-f3518174a705 | alexandraback/datacollection | solutions_5630113748090880_0/C++/KainanWang/Source.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
bool visited[2600];
void solve(int test) {
int n;
memset(visited, 0, sizeof(visited));
cin >> n;
for (int i = 0; i < 2 * n - 1; ++i)
for (int j = 0; j < n; ++j) {
int data;
cin >> data;
visit... | ALGO | 0.999019 | 3.446973 |
c1de5676-100b-47c0-94d4-a178ba5f6123 | aishwaryasingh-svnit093/lab-7 | Q76.cpp | #include<stdio.h>
//WRITE A FUNCTION TO CHECK WHETHER A NUMBER IS EVEN OR ODD
int check(int n);
int main(){
int n;
printf("enter a number: ");
scanf("%d" , &n);
check(n);
return 0;
}
int check(int n){
if (n%2==0){
printf("it is even number");
}
else{
printf("it is odd number");
}
}
| ALGO | 0.99906 | 3.24838 |
2fa2ebf2-cec3-415a-9710-42007088a0db | UniLauX/SPR | libs/flann-1.8.4-src/src/cpp/flann/mpi/flann_mpi_client.cpp | #include <stdio.h>
#include <time.h>
#include <cstdlib>
#include <iostream>
#include <flann/util/params.h>
#include <flann/io/hdf5.h>
#include <flann/mpi/client.h>
#define IF_RANK0 if (world.rank()==0)
timeval start_time_;
void start_timer(const std::string& message = "")
{
if (!message.empty()) {
printf("%s", me... | ALGO | 0.997252 | 4.708591 |
d9f0fdf8-ef9f-4cc6-b463-73ff4ffaec7b | bangseungho/Pokemon_Flight_Network | Utils.cpp | #include "Utils.h"
Vector2 Rotate(Vector2 vector, float degree)
{
Vector2 result = { 0, };
float theta = DEGREE_TO_RADIAN(degree);
result.x = (vector.x * cos(theta)) - (vector.y * sin(theta));
result.y = (vector.x * sin(theta)) + (vector.y * cos(theta));
return result;
}
void Rotate(const Vector2& vSrc, const ... | TOOL | 0.99029 | 6.312585 |
123c9ad5-9639-4259-8e91-d94dbb31e011 | raincross7/code-similarity | codes/train_code/problem382/problem382_434.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
template <class T>
usi... | ALGO | 0.99981 | 5.587502 |
6677a14b-8745-4e1f-b159-4a77339841a9 | xconfigurator/test_20200428_c_cpp | 02_C++/04_tju_144_081-100/090.cpp | /**
* @file 090.cpp
* @author your name (<EMAIL>)
* @brief
* @version 0.1
* @date 2022-06-27
*
* @copyright Copyright (c) 2022
*
*/
#include <iostream>
using namespace std;
int sub(int x, int &y, int *z) {
int t = y;
y = x > y ? x : y;
if (y < *z) {
y = *z;
}
x = x + t + *z;
... | ALGO | 0.999486 | 3.941589 |
ba0b0eec-244e-43c0-b67b-cf51aed19f68 | ysxGitHub/Cplusplus | DataStructure/数学/分数到小数.cpp | /*
给定两个整数,分别表示分数的分子 numerator 和分母 denominator,以 字符串形式返回小数 。
如果小数部分为循环小数,则将循环的部分括在括号内。
如果存在多个答案,只需返回 任意一个 。
对于所有给定的输入,保证 答案字符串的长度小于 10^4 。
*/
#include<vector>
#include<iostream>
#include<unordered_map>
using namespace std;
string fractionToDecimal(int numerator, int denominator) {
string ans;
unordered_map<... | ALGO | 0.999836 | 6.355617 |
12db8420-95f0-4ac3-8cb7-a073bfc42ef4 | sakshisahu612/Leetcode | BFS of graph - GFG/bfs-of-graph.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to return Breadth First Traversal of given graph.
vector<int> bfsOfGraph(int V, vector<int> adj[]) {
int vis[V] = {0};
queue<int> q;
vector<int> bfs;
... | ALGO | 0.999948 | 6.33847 |
cc832615-ed81-4487-bb3f-f003aab3266f | player0/ArduCopter2015 | libraries/APM_PI/APM_PI.cpp | // -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
/// @file ACM_PI.cpp
/// @brief Generic PI algorithm
#include <math.h>
#include "APM_PI.h"
const AP_Param::GroupInfo APM_PI::var_info[] PROGMEM = {
AP_GROUPINFO("P", 0, APM_PI, _kp, 0),
AP_GROUPINFO("I", 1, APM_PI, _ki, 0),
... | ALGO | 0.988441 | 5.762349 |
116747de-6ac8-45bf-9a30-a42e4cda8aeb | saif1642/Competitive-Programming-Solving | sieve 1.cpp | #include<stdio.h>
#include<math.h>
using namespace std;
bool status[1100002];
int main()
{
int N=1000000;
int sq=sqrt(N);
for(int i=4;i<=N;i+=2)
status[i]=1;
for(int i=3;i<=sq;i+=2){
if(status[i]==0)
{
for(int j=i*i;j<=N;j+=i) status[j]=1;
}
else
... | ALGO | 0.998886 | 3.689019 |
6c3b538b-d264-4008-9c90-9af7561dcd06 | Nevil844/codeForces | Implementation-50/donutShops.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
long long a,b,c;
cin>>a>>b>>c;
if(a<c){
cout<<1<<" ";
}else{
cout<<-1<<" ";
}
if(c<a*b){
cout<<b<<endl;
}else{... | ALGO | 0.999472 | 3.899102 |
997af954-2b8f-4a86-9c78-1d680e186c69 | zxf-work/GraphProfile | boost_1_63_0/libs/polygon/test/gtl_boost_unit_test.cpp | #include <iostream>
#define BOOST_POLYGON_NO_DEPS
#include <boost/polygon/polygon.hpp>
namespace gtl = boost::polygon;
using namespace boost::polygon::operators;
#include <time.h>
#include <stdlib.h>
void assert_s(bool c, std::string msg) {
if(!c) {
std::cout << msg << std::endl;
exit( 1);
}
}
namespace ... | ALGO | 0.973251 | 5.405974 |
8c5ba579-9e88-4d2c-8524-5f67328a8fda | Saanvi26/GeeksForGeeks_DSA | Difficulty: Easy/Swap and Maximize/swap-and-maximize.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// long long int maxSum(int arr[], int n);
// } Driver Code Ends
class Solution {
public:
long long maxSum(vector<int>& arr) {
vector<int>temp;
long long ans=0;
sort(arr.begin(),arr.end());
int i=0;
int ... | ALGO | 0.998869 | 6.263849 |
18f4adfd-0948-4471-901f-965f1d14d46b | gabrielrussoc/competitive-programming | hackerearth/cataratas.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define GNU __gnu_pbds
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
namespace GNU { typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update... | ALGO | 0.999989 | 3.706854 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.