uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d1b2e407-0551-4496-8941-816763ac00f2 | Priyankgupta292/supreme_resources | Homework_Content/Searching and Sorting/Q3_Find_an_element_in_unbounded_array.cpp | #include<iostream>
using namespace std;
bool binarySearch(int arr[],int start,int end,int target){
while(start<=end){
int mid = start + (end-start)/2;
if(arr[mid] == target){
return true;
}
else if(arr[mid] > target){
end = mid - 1;
}
else{
... | ALGO | 0.99991 | 5.882987 |
3e4c70fa-2a19-4438-a100-19ed37aba6de | Fisher87/leetcode | cplus/linked-list-cycle.cpp | // Time: O(n)
// Space: O(1)
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
ListNode *slow = head, *fast = head;
while (fast && ... | ALGO | 0.999917 | 5.512399 |
2cb6e423-1f47-4a1d-bf19-be17f524ca1f | darshanshinde261/lp2 | kruskal.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int V = 5; // Number of vertices
struct Edge {
int u, v, w;
};
int parent[V];
int find(int i) {
if (parent[i] == i) return i;
return parent[i] = find(parent[i]);
}
void unionSet(int u, int v) {
parent[find(u)] = f... | ALGO | 0.999986 | 4.794937 |
ad8beb79-30f1-49a9-b610-6973a59518ab | tuhinbc/online_judge_solutions | 246B.cpp | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace ... | ALGO | 0.999638 | 3.643132 |
31a34358-04c5-4115-8d41-f80d00507417 | VanshikaAggarwal1501/code | C++/graphs.cpp/adjList2.cpp | #include<iostream>
#include<unordered_map>
using namespace std;
template<typename T>
class Graph{
public:
unordered_map<int, list<pair<int,int>>>adjList;
void addEdge(int u, int v, int wt, bool dir){
if(dir==1){
adjList[u].push_back(make_pair(v,wt));
}
else {
... | ALGO | 0.989678 | 4.131991 |
1dc6b0f1-848a-4686-8e77-cbb2d6eae169 | AshishGadiya7/leetcode | 191-Number-of-1-Bits.cpp | class Solution {
public:
int hammingWeight(int n) {
int cout=0;
while(n!=0){
int i=n&1;
cout=cout+i;
n=n>>1;
}return cout;
}
}; | ALGO | 0.999954 | 5.888919 |
7aa8295e-49c8-4c6d-953e-18ce3815a377 | mumba-org/mumba | third_party/boost/src/libs/math/example/find_location_example.cpp | // find_location.cpp
// Example of finding location (mean)
// for normal (Gaussian) & Cauchy distribution.
// Note that this file contains Quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
//#ifdef _MSC_VER
//# pragma warning(disable: 4180) // qualifier has no effe... | ALGO | 0.999786 | 6.345707 |
1d6d8852-8a1b-4aa2-9e73-4d8da2157be2 | ShantanuN8/Recursion-Functions | Factorial.cpp | #include <iostream>
using namespace std;
int factorial(int n){
if ((n==0)||(n==1))
return 1;
else
return n*factorial(n-1);
}
int main() {
int n;
cout<<"Number to find the factorial of:-";
cin>>n;
cout<<factorial(n);
}
/*OUTPUT
Number to find the factorial of:-12
479001600
*/
| ALGO | 0.999853 | 4.298446 |
dbebf2f0-f0d4-4fc1-84c9-4bcd9021c745 | rasinhas/Maratona | a2oj/cfladder/div2c/16.cpp | #include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define var(x) cerr << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int a[111111];
vector <int> sol;
int main() {
int n;
cin >> n;
for(int i=0;i<n;i++) scanf("%d", &a[i]);
... | ALGO | 0.99989 | 3.321874 |
49421900-8f60-4d61-a5e7-c28991b3baf8 | saeid-ebrahimi/Cpp | 03.loop problems/Problem38.cpp | #include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
double num;
int cnt = 1;
double sum = 0.0;
int meanCnt = 0;
while (cnt <= 5)
{
cout << " please enter an number greater than -1 : ";
cin >> num;
if (num >= 0.0 && num <= 20.0)
{
if (num > 15.00)
{
sum += num;
meanCnt+... | ALGO | 0.991219 | 3.063378 |
9d7f0613-8110-429f-8b6a-71b0afbc0aa1 | chetter14/cpp-labs | Lab3/main.cpp | #include "Person.hpp"
#include <iostream>
#include <vector>
#include <random>
#include <array>
#include <algorithm>
#include <list>
#include <memory>
#include <iterator>
#include <cmath>
int GetV1Size(std::mt19937& gen)
{
std::uniform_int_distribution<std::mt19937::result_type> sizeGenerator(500, 1000);
return sizeG... | TOOL | 0.947518 | 4.710082 |
a98f759f-8998-44f7-b384-49bbaa7ef11b | Trietptm-on-Coding-Algorithms/online-judge | codeforces/593/a.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
#include <utility>
using namespace std;
int main() {
int n;
string s;
int ans[26][26];
memset(ans, 0, sizeof(ans));
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> s;
sort(s.begin(), s.end());
int l = s.size();... | ALGO | 0.999949 | 3.982116 |
46555a33-642f-45a2-b512-d9cf5a7f2f01 | yukirin/coder | atcoder/abc178/C/main.cpp | #include <bits/stdc++.h>
#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " -> " << #x << " = " << x << endl
#else
#define debug(x)
#endif
#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a,... | ALGO | 0.99987 | 4.675817 |
5c9ef549-888e-4dab-ab8b-994d2950dbbf | ishandutta2007/codeforces | maxplus/normal/1553/F.cpp | #include <iostream>
#include <numeric>
using namespace std;
bool online_judge =
#ifdef ONLINE_JUDGE
1;
#else
0;
#endif
struct { using X = int; template <typename T = X> T operator()() { T t; cin >> t; return t; } opera... | ALGO | 0.999986 | 3.806837 |
f6ffad38-c02f-4a6a-a1c6-bc8403291a2d | firiexp/contest_log | atcoder/ARC/081F.cpp | #include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
static const int MOD = 1000000007;
using ll = int64_t;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;
templa... | ALGO | 0.999918 | 4.759968 |
915bc094-4483-460e-acf8-fc4591cab588 | HanpyBin/CP-Note | leetcode/搜索/576. 出界的路径数/my_bfs.cpp | class Solution
{
public:
int findPaths(int m, int n, int maxMove, int startRow, int startColumn)
{
int res = 0;
vector<vector<int>> cnt(m, vector<int>(n));
vector<vector<int>> nxt(4, vector<int>(2));
// (1, 0), (0, 1), (-1, 0), (0, -1)
nxt[1][1] = nxt[0][0] = 1;
n... | ALGO | 0.999922 | 5.137417 |
37e7ef45-b942-4714-a188-769ce512b5f5 | snichols/boost_1_61_0 | libs/spirit/example/karma/calc2_ast_vm.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A Calculator example demonstrating generation of AST from which we generate
// a simple byte code representation being interpreted by a similar virtual
// machine.
//
// [ JDG April 28, 2008 ]
// [ HK May 05, 2008 ]
//
////////... | TOOL | 0.955389 | 7.502585 |
6992b977-f80d-4674-8510-b7820c5dd799 | ishandutta2007/codeforces | 3.141592653/normal/526/G.cpp | #include<cstdio>
#include<vector>
#include<algorithm>
struct pii{int p,l;};
bool operator<(const pii x,const pii y)
{return x.l>y.l;}
int n,q;
int mx(int x,int y){return x<y?y:x;}
struct tree
{
int fa[222222][22],len[222222],ds[222222],rt,
tp[222222],dep[222222];
std::vector<pii>v[222222];
void ins(int x,int y,int ... | ALGO | 0.999877 | 3.64845 |
b00e4611-97f7-4285-90d7-778e054fa2ed | aldi-balkar/pegadaian_training_job_portal | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
fb93bbd1-7e65-42d1-aca3-b3bcc613fc8a | Rayhan-Pervej/chat_application | 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.998784 | 6.761023 |
8392d2cc-131d-4c4a-8ab5-4e0072fbb618 | Glory-Day/Solutions | Baekjoon/Cpp/4803.cpp | #include <iostream>
#include <vector>
#include <unordered_set>
#include <algorithm>
using namespace std;
int map[501];
unordered_set<int> tree;
int find(int nd) {
if (nd == map[nd]) return nd;
return find(map[nd]);
}
bool join(int a, int b) {
a = find(a), b = find(b);
if (a == b) {
map[b] = ... | ALGO | 0.999899 | 5.193626 |
b81c86e2-7f1b-47ee-bca3-02e5145f8018 | beamiter/cbp | cbp/cppad/example/ipopt_solve/ode_inverse.cpp | // $Id$
/*
$begin ipopt_solve_ode_inverse.cpp$$
$spell
$$
$section ODE Inverse Problem Definitions: Source Code$$
$mindex example$$
$head Purpose$$
This example demonstrates how to invert for parameters
in a ODE where the solution of the ODE is numerically approximated.
$head Forward Problem$$
We consider the follo... | ALGO | 0.999963 | 6.302759 |
775519a2-ee45-4a4d-b43a-f4ab58c2910f | chrzhang/abc | langs/wordBreak/main.cpp | #include <iostream>
#include <string>
#include <unordered_set>
#include <vector>
// Find all ways to break a sentence into words
void wordBreakAux(const std::string & s,
const std::unordered_set<std::string> & wordDict,
std::vector<std::vector<std::string>> & results,
... | ALGO | 0.998255 | 5.418055 |
4f5e3e5d-d232-4b64-9f49-3a0d5b7e302a | SETURAJ/LeetCode-Solutions | 4sum/Accepted/6-8-2022, 7_11_53 AM/Solution.cpp | // https://leetcode.com/problems/4sum
class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target) {
vector<vector<int>>res;
if(nums.empty() || nums.size()<4)
return res;
int n=nums.size();
sort(nums.begin(),nums.end());
for(int i=0;i<n;i++... | ALGO | 0.999954 | 6.112435 |
fa28ccc8-877b-4915-88d4-4497a5bf7c3f | dseco/acmudec | DiegoCaripan/Semestre1-2017/UVA/11507.cpp | #include <stdio.h>
#include <string.h> //Bender's Rodriguez problem
int main() {
int n;
char cmd[100000][3]; //Se crea un arreglo de char, para crear strings, de un tamaño muy grande
while(scanf("%d", &n) == 1 && n) { //Se pregunta por el numero de movimientos, y si existe un valor distinto de NU... | ALGO | 0.99948 | 3.425646 |
e808ce4c-80e2-423a-b968-9c91026a1164 | maurifk/LeetCode | Cpp_LeetCode/547_NumberOfProvinces.cpp | #include <vector>
#include <queue>
#include <unordered_set>
using namespace std;
class Solution {
public:
int findCircleNum(vector<vector<int>>& isConnected) {
vector<vector<int>> g(isConnected.size());
unordered_set<int> noV;
for (int i = 0; i < isConnected.size(); i++){
for (int j = i+1; j < isConnecte... | ALGO | 0.999878 | 5.950369 |
b0547139-b32b-45f0-bb87-06605da427fe | ParkMoonJ/KaoYan | 408/数据结构/3 栈和队列/Queue.cpp | #include <iostream>
using namespace std;
#define MAXSIZE 100
struct Queue {
ElemType data[MAXSIZE];
int front, rear;
} Q;
void InitQueue(Queue &Q) {
Q.front = 0;
Q.rear = 0;
}
void ClearQueue(Queue &Q) {
while (Q.rear > Q.front) {
Q.data[Q.rear] = NULL;
}
}
bool QueueEmpty(Queue Q) {... | ALGO | 0.990025 | 3.784626 |
703f5dcd-491d-4c0b-8072-ed391b374b98 | RajdevKapoor/Leetcode-Practice | 886-possible-bipartition/886-possible-bipartition.cpp | class Solution {
public:
bool bfs(unordered_map<int,vector<int>>& adj,vector<int>& color,int src)
{
queue<int> q;
q.push(src);
color[src]=0;
while(!q.empty())
{
int front = q.front();
q.pop();
for(auto i: adj[front... | ALGO | 0.999902 | 5.846503 |
eec7ba26-7e5a-4f9f-a320-f9b6b108ff02 | majkimge/CompetitiveProgrammingCode | pros/main.cpp | #include <bits/stdc++.h>
#define lld unsigned int
#define MAX 10000
#define MOD 1000000007
#define mp make_pair
#define f first
#define s second
using namespace std;
int n,a,b,c,d,wyn,k=1;
pair<pair<int,int>, pair<int,int> >tab[MAX*2];
pair<pair<int,int>, pair<int,int> >tab1[MAX*2];
int czy[MAX*2];
pair<int,int> tre... | ALGO | 0.999688 | 3.609106 |
cc0949e4-b28e-437b-be0c-ba2d19249b2d | piDack/magma | magmablas/zhemm_vbatched.cpp | /*
-- MAGMA (version 2.7.1) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date February 2023
@precisions normal z -> s d c
@author Ahmad Abdelfattah
*/
#include "magma_internal.h"
#include "commonblas_z.h"
#define PRECI... | ALGO | 0.992571 | 6.754351 |
45eef066-5f27-43e1-bda2-df66c6010e4f | danghoangnhan/leetcode | StudyPlan/ DataStructure/DataStructureI/203.remove-linked-list-elements.cpp | /*
* @lc app=leetcode id=203 lang=cpp
*
* [203] Remove Linked List Elements
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x... | ALGO | 0.999846 | 6.28205 |
2deb4e99-fbd2-4041-944b-7425ae3f668a | KMSBisko/Cpp-pratice-learning | MORE.cpp | #include <iostream>
#include <algorithm>
using namespace std;
typedef long long s64;
const int mxN = 1e5;
int a[mxN];
int main() {
int k, n;
cin >> k >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
s64 cnt = 0, ans = 0, i = 0;
while (cnt <= k) {
cnt += a[... | ALGO | 0.999966 | 4.462876 |
5832d7ce-42e7-4594-8fe3-8d4ef328d59b | kevinzhang334455/Scout | boost_1_56_0/libs/polygon/example/voronoi_advanced_tutorial.cpp | // Boost.Polygon library voronoi_advanced_tutorial.cpp file
// See http://www.boost.org for updates, documentation, and revision history.
#include <cmath>
#include <cstdio>
#include <ctime>
#include <string>
// This will work properly only with GCC compiler.
#include <ieee754.h>
typedef long double fpt80;
// Random... | ALGO | 0.999725 | 7.206626 |
63b98a49-1aa8-4c88-bb99-61461c70386f | Sweta870/dat-structure | c++/n-queen.cpp | #include <iostream>
using namespace std;
int counter = 0;
// Function that initialize the chessboard with zero
void initilizeWithZero(int chess[20][20], int value,int size)
{
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
chess[i][j] = value;
}
}
}
//Di... | ALGO | 0.997969 | 3.924055 |
8d0030cd-3345-4ffb-aacf-7f7220adace3 | harshbhar0629/cppRepository | LB/1_Array/10_next_permuatation.cpp | // https://leetcode.com/problems/next-permutation/description/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
void nextPermutation(vector<int>& nums) {
int n = nums.size();
int idx = -1, mIdx=n;
for(int i=n-2; i>=0; i--){
if(nums[i] < nums[i+1]){
... | ALGO | 0.999964 | 5.550229 |
70e13dbf-a328-4d76-a295-60ff39f30ea1 | BrunoMor99/Taffo-VitisHLS | test/polybench-cuda/datamining/correlation/correlation.cpp | /**
* correlation.cu: This file is part of the PolyBench/GPU 1.0 test suite.
*
*
* Contact: Scott Grauer-Gray <<EMAIL>>
* Will Killian <<EMAIL>>
* Louis-Noel Pouchet <<EMAIL>>
* Web address: http://www.cse.ohio-state.edu/~pouchet/software/polybench/GPU
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h... | ALGO | 0.939564 | 4.767298 |
8049f124-0626-456b-8556-236298fc3d4e | kawsarkk1/Codes | klcm.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll t,n,k,x,y,i,j,p;
cin>>t;
while(t--)
{
cin>>n>>k;
while(k>3)
{
cout<<1<<" ";
k--;
n--;
}
if(n%2==0)
{
x=n/2;
if(x%2==0)
... | ALGO | 0.999901 | 3.597991 |
a48e767b-aabc-48f0-a825-32e72926e3dd | aliammari1/Leetcode_problems | solutions/intersection-of-two-linked-lists/Wrong Answer/8-12-2023, 11_43_06 PM/Solution.cpp | // https://leetcode.com/problems/intersection-of-two-linked-lists
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {... | ALGO | 0.9999 | 5.530932 |
d8088639-ae3a-4995-ae1d-f24b66a242d8 | mukesh2305/c-data-structure | newCommers/2.loops/prob23.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k = 0;
cin >> n;
// for(int i = 1; i<=2 *n; i++) {
// for(int j = 1; j<= spaces; j++)
// cout << " ";
// for(int k = 1; k < i*2 ; k++ )
// cout << "*";
// cout << endl;
// spaces--;
// }
for (int i = 1; i <= 2 *n; i++)
{
k = i <=... | ALGO | 0.999969 | 3.276201 |
91a43b2d-ebed-4864-835d-4970b6f76949 | steephengeorge/hackerRank-cpp | src/BitwiseAnd.cpp | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#inc... | ALGO | 0.999624 | 4.243829 |
e599df92-7f46-462b-9868-c7f3a1b4d93c | abhinavkishan/DSA | Design and Analysis of Algoritms/sequential_search.cpp | #include <iostream>
#include <vector>
#define MAX 10
using namespace std;
int seq_search(vector<int>arr, int n, int key) {
for(int i = 0; i < n; i++) {
if(arr[i] == key) {
return i;
}
}
}
int main() {
vector<int> arr;
int i, n, key;
cout << "Enter the number of elements... | ALGO | 0.999873 | 5.440129 |
7d6e5ac8-28be-4628-8f61-caaffe3ba006 | selma-19/CP- | Minimum Size Subarray Sum/main.cpp | #include <bits/stdc++.h>
using namespace std;
// https://leetcode.com/problems/minimum-size-subarray-sum/description/
int minSubArrayLen(int target, vector<int>& nums) {
int l = 0, r = 0, s = nums[0], lgth = INT_MAX;
int n = nums.size();
while (l < n && r < n && l <= r) {
if (s == target) {
... | ALGO | 0.999926 | 5.453448 |
d05a0ba5-5a5b-4d32-8bdd-c72503ea333d | ZXPrism/CP-Solutions | LeetCode/923.cpp | class Solution {
public:
int threeSumMulti(vector<int> &arr, int target) {
std::ranges::sort(arr);
int ans = 0;
constexpr int MOD = 1'000'000'007;
int n = arr.size();
for (int i = 0; i < n; i++) {
int left = i + 1, right = n - 1;
while (left < right) {... | ALGO | 0.999817 | 5.90276 |
e3e6cbc6-a5a8-4e3f-9f21-8583e61004bf | kartik3110/DSA-Lab-2023 | Assignment 2/Q2part3.cpp | #include <iostream>
using namespace std;
int main()
{
int size1 = 5;
int size2 = 4;
int arr1[50] = {1, 2, 3, 4, 5};
int arr2[50] = {2, 4, 7, 8};
cout << "intersection is:" << endl;
for (int i = 0; i < size1; i++)
{
for (int j = 0; j < size2; j++)
{
if (arr1[i] == ... | ALGO | 0.997975 | 3.741251 |
a288148f-9828-49bd-9112-0ee0ba7dd1d3 | kunalmanchanda/leetcode | 0540-single-element-in-a-sorted-array/0540-single-element-in-a-sorted-array.cpp | class Solution {
public:
int singleNonDuplicate(vector<int>& arr) {
int n = arr.size();
if(n == 1) return arr[0];
if(arr[0] != arr[1]) return arr[0];
if(arr[n-1] != arr[n-2]) return arr[n-1];
int low = 1, high = n-2;
while(low <= high) {
int mid = (low ... | ALGO | 0.999943 | 5.649402 |
43ff0292-deab-4fa1-a255-c195983bc390 | gauravk268/Competitive_Coding | Codeforces/451B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
#define f first
#define s second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define endl "\n"
#define trav(x, a) for (auto &x : a)
#def... | ALGO | 0.999707 | 3.519844 |
3f5f0450-d312-46c3-bce5-c19115f6c80a | WUPredator/hello-world | MaxCountMoney.cpp | /*
*/
#include <stdio.h>
#include<iostream>
#include<vector>
int GetMaxValue(std::vector<int> &table,std::vector<int> &cus,std::vector<float> &money)
{
int maxVal = 0;
int maxPeople = table.size();
int count = 0;
std::vector<int>::iterator it;
for (it = table.begin(); it != table.end(); it++)
{
}
}
bool compa... | ALGO | 0.999785 | 3.412103 |
faec1c57-0d7f-426f-9e2e-ba854c302799 | joshika39/elte-studies | semester_III/cpp/gyak9/01/main.cpp | #include <iostream>
int main() {
int array[7] = {12, 8, 5, 17, 9, 3, 14};
for (int i = 0; i < 7; ++i) {
std::cout << array[i] << " ";
}
std::cout << std::endl;
return 0;
} | ALGO | 0.983649 | 4.145609 |
562fe726-2670-4497-a8b4-4c04e8c637a5 | makio93/competitive-atcoder | abc253/abc253_c/main0.cpp | // 本番AC
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i, n) for (int i=0; i<(int)(n); ++(i))
#define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i))
#define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i))
#define rep3r(i, m, n) for... | ALGO | 0.998362 | 4.184057 |
bbd18a7f-e116-4d4a-a042-6f0efae9d643 | DaimleRs/HubGitHub | HubGitHub/HubGitHub.cpp | #include <iostream>
#include <algorithm>
#include "DinamicArray.hpp"
int main()
{
DinamicArray<int> q;
for (size_t i = 0; i < 20; i++) {
q.pushBack(i + 1);
}
for (auto e : q) {
std::cout << e << "\n";
}
return 0; | TOOL | 0.971397 | 3.826522 |
00d7fc9b-14dd-4e2f-832c-7d3cba4a014d | Lf0836/Programming | YaCircle/2023/Week_5/Binary_search/I.cpp | #include <iostream>
using namespace std;
int main() {
long long m, n, k;
cin >> m >> k >> n;
long long l = 1;
long long r = max(m, k) * n;
while (l < r) {
long long mid = l + (r - l) / 2;
if ((mid / m) * (mid / k) >= n) {
r = mid;
} else {
l = mid + 1;
}
}
cout << l;
}
| ALGO | 0.99999 | 3.418422 |
43a414a5-fa93-4cab-91b2-4a3cbaea4c17 | ayushmantam/DSA_codes | Graphs_1_DSA/L1_b_revision.cpp | #include<iostream>
using namespace std;
#include<unordered_map>
#include<list>
#include<vector>
class Graph{
public:
unordered_map<int, list<pair<int,int>> >adjList;
void addEdge(int u,int v,int weight,bool direction){
adjList[u].push_back({v,weight});
if(direction==0){
... | ALGO | 0.998024 | 4.850598 |
a54ce41b-3702-408f-a328-1cad20e103d3 | jeromepalayoor/competitive-programming | codeforces/contests/Div 3/Codeforces Round 881 (Div. 3)/B-Long-Long.cpp | // https://codeforces.com/contest/1843/problem/B
#include <iostream>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <array>
#include <vector>
#define sz(a) ((int)((a).size()))
#define char unsigned char
using namespace std;
typedef long long ll;
typedef long double ld;
int solve() {
ll n = 0;
ll ... | ALGO | 0.999758 | 3.857994 |
d7a82bcd-4b91-42ae-9f9a-87ec0b0381aa | graalvm/labs-openjdk-15 | src/hotspot/share/opto/ifnode.cpp | #include "precompiled.hpp"
#include "ci/ciTypeFlow.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "opto/addnode.hpp"
#include "opto/castnode.hpp"
#include "opto/cfgnode.hpp"
#include "opto/connode.hpp"
#include "opto/loopnode.hpp"
#include "opto/phaseX.hpp"
#include "opto/runti... | ALGO | 0.934875 | 5.33325 |
51cab305-7074-4041-a045-46775e0bdb5b | ishandutta2007/codeforces | rivalq/normal/192/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long long int n;
cin>>n;
long long int k=0,i=1;;
vector<long long int> v;
v.push_back(1);
while(k<=n){
k=(v[i-1]*(i+2))/i;
v.push_back(k);
i++;
}
int size=i;
for(int i=0;i<size;i++){
k=n-v[i];
... | ALGO | 0.999994 | 3.825754 |
2aead47c-1281-4711-bd24-6ca26897fc30 | NanyoungKim/Baekjoon_Algorithm_Greedy | 그리디 - 동전 (11047번)/main.cpp | #include <iostream>
using namespace std;
int main(){
int N, K;
int num = 0;
int answer = 0;//
cin >> N >> K;
int *arr = new int[N];
for(int i = 0; i<N; i++){
cin >> num;
arr[i] = num;
}
while(K != 0){
for(int i=N-1; i >= 0; ){
... | ALGO | 0.999904 | 3.911117 |
646ca97d-5de9-4893-9f22-26697e8cec58 | Akashkumar888/cpp_programming | STL in cpp/upper bound and lower bound/lower.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[]={4,5,5,25,7,8};
int n=sizeof(a)/4;
sort(a,a+n);
for(auto i:a){
cout<<i<<" ";
}
cout<<endl;
int *ptr=lower_bound(a,a+n,5);
cout<<*ptr<<endl;
cout<<endl;
int *ptr1=lower_bound(a,a+n,6);
cout<<*ptr1<<endl;
... | ALGO | 0.99988 | 3.043643 |
cc94ec94-cc3a-477a-ad19-10cbc4f6e341 | esmail1234/algorithms-problem-solving-level-3 | Problem44.cpp | #include <iostream>
#include <string>
using namespace std;
string ReadString()
{
string S1;
cout << "\nPlease Enter a string?\n";
getline(cin, S1);
return S1;
}
string RemovePunctuation(string S1)
{
int i = 0;
while (i < S1.length())
{
if (ispunct(S1[i]))
{
S1.e... | TOOL | 0.850159 | 4.948298 |
b5d03826-9ce2-4a73-952b-6427fe1372a1 | ThepokeSUST/DS_EXAM | BinarySearchTree/preOrderByStack.cpp | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
class node
{
public:
int data;
node *left;
node *right;
node(int data)
{
this->data = data;
left = right = NULL;
}
};
node *build()
{
int ele;
cin >> ele;
if (ele == -1)
return N... | ALGO | 0.999985 | 4.55445 |
2a4e5c5d-79c8-4c6e-bc52-1c833a76d141 | Ignavar/30DaysOfLeetCode | 0001-two-sum/0001-two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int> ans;
for(int i =0;i<nums.size();i++)
{
for(int y=i+1;y<nums.size();y++)
{
if(nums[i]+nums[y]==target)
{
ans.push_back(i);
... | ALGO | 0.99992 | 6.080696 |
44ef057c-d254-465c-b460-57331fe66d66 | mruegenberg/houdini-transform-matcher | eigen/doc/examples/class_CwiseUnaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template unary functor
template<typename Scalar>
struct CwiseClampOp {
CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
const Scalar operator()(const Scalar& x) const { return x<m_... | ALGO | 0.953733 | 6.417363 |
9533b391-89cd-4cfc-8dd8-304676e70709 | arijitsaha2002/CSES-SOLUTION | Graph_Algorithms/Coin_Collector.cpp | #include <bits/stdc++.h>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;",
using namespace std;
#define int long long
#define MOD 1000000007
#define INPUT(N, arr) for (int i = 0; i < N; cin >> arr[i], i++);
#define newline '\n'
#define FOR(i, a, b) for... | ALGO | 0.999918 | 4.286836 |
f198a110-7b48-42c9-a0a3-b395ad392ae7 | Monuar/Online_Judges | leetcode/fibonacci_number.cpp | class Solution {
public:
int solve(int n)
{
if(n==0||n==1) return 1;
return solve(n-1)+solve(n-2);
}
int fib(int n) {
int sum=0;
if(n==0) return 0;
sum+=solve(n-1);
return sum;
}
};
| ALGO | 0.999998 | 5.846907 |
025f3243-bdaa-4de5-bd10-3c8a50d69403 | HariPasapuleti/Leetcode-Problems | 0322-coin-change/0322-coin-change.cpp | class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
int n = coins.size();
vector<vector<int>> dp(n, vector<int>(amount + 1, 0));
for (int i = 0; i <= amount; i++) {
if (i % coins[0] == 0)
dp[0][i] = i / coins[0];
else
... | ALGO | 0.999779 | 5.7289 |
d1a6f8a1-734c-405f-a878-0cb32d6a4f16 | Jialin/ICPC | Archive/GCJ/2019Round1A/A.cpp | #include <algorithm>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
... | ALGO | 0.999839 | 4.600063 |
f0e01051-ca53-42ca-aea1-b2fa71e92a82 | sourabh59-coder/CrackYourPlacement_Arsh_Goyal | 09. Graph/36. Word Ladder/Approach1.cpp | class Solution {
public:
int ladderLength(string start, string dest, vector<string>& v) {
unordered_set<string> st;
int n = v.size();
for(int i=0;i<n;i++) st.insert(v[i]);
// if(st.count(start)!=0) st.erase(start);
st.erase(start);
if(st.count(dest)==0) return ... | ALGO | 0.999978 | 5.872185 |
472a1dd0-d256-4727-b881-56f3f7c16be1 | Utchash007/Leetcode_Solution | 0506-relative-ranks/0506-relative-ranks.cpp | class Solution {
public:
vector<string> findRelativeRanks(vector<int>& score) {
vector<int>v(score);
sort(v.begin(),v.end(),greater<int>());
map<int,string>mp;
for(int i=0; i<score.size(); i++){
if(i==0)mp[v[i]]="Gold Medal";
else if(i==1)mp[v[i]]="Silver Med... | ALGO | 0.999934 | 5.894415 |
3a01bd31-c2aa-4c1a-933b-63542f8b231d | master-hkshenoycse/CP | DailyPractice/20241225/CF_ElaCrickets.cpp | #include<bits/stdc++.h>
#include <iterator>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll long long
#define ull long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd long double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#defin... | ALGO | 0.999894 | 3.364005 |
c3928b77-09ba-4580-9d95-45db1ec2f921 | nengen6899/Coding_Interview_Guide | src/CD161.cpp | /* CD161÷ǵݹ鷽ʽʵֶͺ */
#include <iostream>
#include <stdio.h>
#include <stack>
using namespace std;
struct treeNode
{
int val;
struct treeNode *lch, *rch;
treeNode(){}
treeNode(int v):val(v), lch(nullptr), rch(nullptr){}
};
//void createTree(treeNode* root)
//{
// int r, lch, rch;
// ... | ALGO | 0.999737 | 3.276475 |
b67bd7b4-95e7-4aa2-9f97-3cc6008914f2 | rusuraluca/dsa-highschool | pbinfo/tablouri bidimensionale/#2807.cpp | /*
#2807
Scrieți un program care citește de la tastatură două numere naturale din intervalul [2,50], n și m,
și elementele unui tablou bidimensional cu n linii și m coloane, numere naturale distincte din intervalul [0,10^4].
Programul interschimbă valoarea minimă din ultima coloană a tabloului cu valoarea minimă din ... | ALGO | 0.999952 | 3.171928 |
bedcfa48-0be8-4a5d-b9d6-cda5138433f5 | zhouZH704403055/Cpp_program | LeetCode94/test.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<int> inorderTraversal(TreeNode* root) {
vector<int> v;
stack<TreeNode*> ... | ALGO | 0.999995 | 6.473341 |
6e1ab504-5800-4aa9-9893-c27e358a1904 | zzctommy/public-source-code | 码库/CF1200E Compress Words.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rint register int
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
inline int rd() {
int x=0,f=1;char ch=getchar();
while(!isdigit(ch)) {if(ch=='-')f=-1;ch=getchar();}
wh... | ALGO | 0.99999 | 3.436037 |
63bd9f6a-10d1-429b-8ba9-a0f5fec4e02a | doxncwfn/coding-stuff | Data Structure & Algorithms/.leetcode/121.best-time-to-buy-and-sell-stock.cpp | /*
* @lc app=leetcode id=121 lang=cpp
*
* [121] Best Time to Buy and Sell Stock
*/
// @lc code=start
class Solution
{
public:
int maxProfit(vector<int> &prices)
{
if (prices.empty())
return 0;
int minPrice = prices[0];
int maxProfit = 0;
for (int i = 1; i < pri... | ALGO | 0.9996 | 6.610145 |
604da939-f8b4-4c5f-9659-9cb392ef5db6 | krish736/Daily_DSA | max_sum_arr[i]Xi.cpp | // 08-04-2024
// Gfg
// Given an array A of N integers. Your task is to write a program to find the maximum value of ∑arr[i]*i, where i = 0, 1, 2,., n 1.
// You are allowed to rearrange the elements of the array.
// Note: Since output could be large, hence module 109+7 and then print answer.
//{ Driver Code Starts
#in... | ALGO | 0.999841 | 6.167359 |
b1d5afa1-5ae7-4bea-87af-eb781165c25c | wzshare/Leetcode | medium/64_Minimum_Path_Sum.cpp | #include "../libstruct.h"
using namespace std;
/*
* NO.64
* Given a m x n grid filled with non-negative numbers, find a path from top left
* to bottom right which minimizes the sum of all numbers along its path.
* Note: You can only move either down or right at any point in time.
*/
class Solution {
public:
... | ALGO | 0.99982 | 5.642129 |
ae0d29bb-1233-48d2-96fb-4da04dc8d92f | Shahid-Fahad/Online-Judge-Solution | Codeforces+Others/1370B.cpp | ///ShzFahad
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
int main()
{
ll n,x,y=1,m,i,j;
cin >> n;
m = n/2+1;
ll arr[n];
vector<ll>v;
for(i=0;i<n;i++)
{
cin >> arr[i];
}
sort(arr,arr+n);
for(i=0;i<n;i++)
{
for(j=i... | ALGO | 0.999992 | 3.287413 |
a073c480-3af5-454b-b6f6-15e214eff96c | Pragna235/Coding-Ninjas-Problems | Insertion Sort.cpp | #include <bits/stdc++.h>
void insertionSort(int n, vector<int> &arr){
// Write your code here.
for(int i=0;i<n;i++){
int j=i;
while(j>0 && arr[j-1]>arr[j]){
swap(arr[j],arr[j-1]);
//cout<<arr[j]<<arr[j]
j--;
}
}
}
| ALGO | 0.999982 | 5.864727 |
06169dee-bea5-4021-8707-63ebbc4bb0a1 | liangkang233/leetcode-cpp | 29.两数相除.cpp | /*
* @lc app=leetcode.cn id=29 lang=cpp
*
* [29] 两数相除
*/
#include <iostream>
#include <vector>
using namespace std;
/*
复习关于二进制数的知识:
正数是符号位0 和 原码 ,负数是符号位1 和 补码(反码+1)
所以8位正数范围包含[0-127] 负数范围为[-128, -1]
其中1000 0000(b)为-0即-128, 1111 1111(b)为-1
// 这道题目很多坑 水平不好
// -A 会编译器优化为算补码所以INT_MIN(即为-214... | ALGO | 0.999873 | 5.468246 |
0077c65f-c59f-4846-a0c3-ee30f8a94755 | david-owino/Flutter-Apps | twitter_clone/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.998625 | 6.76775 |
a26718a5-3b20-480e-a2d6-a4ebd400bdd0 | derek-zr/leetcode | Solution/203-remove-linked-list-elements/remove-linked-list-elements.cpp | // Remove all elements from a linked list of integers that have value val.
//
// Example:
//
//
// Input: 1->2->6->3->4->5->6, val = 6
// Output: 1->2->3->4->5
//
//
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* ... | ALGO | 0.999927 | 5.207496 |
4aedd5fd-569b-4937-902f-e02a54f7c6af | ishandutta2007/codeforces | -is-this-fft-/normal/1282/C.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
const int MAX_N = 2e5 + 5;
ll diff [MAX_N];
ll manda [MAX_N];
void solve () {
ll n;
ll maxt, a, b;
cin >> n >> maxt >> a >> b;
ll easyc = 0, hardc = 0;
for (ll i = 0; i < n; i++) {
cin >> diff[i];
... | ALGO | 0.999859 | 4.072953 |
28901bea-e501-4f43-a686-837ac28c25cf | Medhaj-Kulkarni013/DSA_Coding | C++/BinaryTrees/TreeNode.cpp | #include<bits/stdc++.h>
using namespace std;
class TreeNode{
public :
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int val){
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
void displayTree(TreeNode* root){
if(root==NULL) return;
cout<<root->val<... | ALGO | 0.999799 | 4.487777 |
97279a87-f761-43c1-b25e-7bf1e7f32083 | Tri11Paragon/COSC-4P80-Assignment-2 | lib/eigen-3.4.0/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp | MatrixXd A = MatrixXd::Random(6,6);
cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
EigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
complex<double> l... | ALGO | 0.9988 | 3.093769 |
031e54ab-e115-42f6-a0c3-314d695e627c | aosp-mirror/platform_external_opencore | codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp | /*
Pathname: ./audio/gsm-amr/c/src/weight_a.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Put file into template and first pass at optimization.
Description: Made changes based on comments from the review meeting. Used
pointers instead of inde... | ALGO | 0.999412 | 6.026228 |
2b392c86-d4f4-4336-ac27-05d82559b10b | mpmic/mel_tasks | hw04/vm.cpp | #include "vm.h"
#include <iostream>
#include "util.h"
namespace vm {
vm_state create_vm(bool debug) {
vm_state state;
// enable vm debugging
state.debug = debug;
register_instruction(state, "LOAD_CONST", [](vm_state& vmstate, const item_t number) {
vmstate.stack.push(number);
return true;
... | TOOL | 0.912335 | 6.489612 |
3bf2e1e2-66d4-48d7-841b-15bf7be26904 | Aarish-khan/learn-cpp | MultiFileProgram/main.cpp | #include<iostream>
#include<vector>
#include "increament_and_sum.hpp"
using std::vector;
using std::cout;
int main()
{
vector<int> v{1,2,3};
int total = increament_and_sum(v);
cout<<"total sum = "<<total;
return 0;
} | ALGO | 0.997299 | 5.02283 |
8d008825-e1b7-4c52-a1da-2e3d02338e5a | GriffionProject/Griffion | src/test/settings_tests.cpp | #include <common/settings.h>
#include <test/util/setup_common.h>
#include <test/util/str.h>
#include <boost/test/unit_test.hpp>
#include <common/args.h>
#include <univalue.h>
#include <util/chaintype.h>
#include <util/fs.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <fstream>
#include <map>
#in... | TEST | 0.929424 | 5.146439 |
ce2787c7-7052-4ecb-8d3f-38ca2bfaaffd | jackwillbrand/numerical-modeling-examples | interpolation/driver.cpp | /*!
* Author: Jackson Willbrand, 2/12/2020
* File: driver.cpp
* Class: CS 5201 Section A
* Instructor: Clayton Price
* Description: driver class for interpolator hw2
*/
#include "interpolator.h"
using std::cin;
using std::cout;
using std::endl;
int main()
{
cout.precision(8);
// read in number of indep... | ALGO | 0.978757 | 4.832854 |
4caeeb53-213b-43fc-8d7a-dd49041332c4 | EdXian/ur5_control | universal_robot/ur_kinematics/src/ur_kin.cpp | #include <ur_kinematics/ur_kin.h>
#include <math.h>
#include <stdio.h>
namespace ur_kinematics {
namespace {
const double ZERO_THRESH = 0.00000001;
int SIGN(double x) {
return (x > 0) - (x < 0);
}
const double PI = M_PI;
//#define UR10_PARAMS
#ifdef UR10_PARAMS
const double d1 = ... | ALGO | 0.999617 | 4.877841 |
0626b55b-949f-4acf-a11d-5c4ff50d0db8 | shjzhang/PPPBox | apps/swrx/acquire.cpp | #pragma ident "$Id$"
/*
FFT based acquisition for GPS L1 band. (Parallel Code Phase Search).
Example usage:
...$ hilbert | acquire -q 2 -x 4.092 -r 8.184 -b 1 -c 21 -p 1
= 2 bit quantization, 4.092 MHz IF, 16.368 MHz sample rate (at origin, hilbert cuts it in half), one band, PRN 21, one period.
...$ gpsSim... | ALGO | 0.999909 | 3.187117 |
695ac903-d675-447b-843b-23d1128b2767 | YerkinBS/PP1_2020 | recurs/test.cpp | #include <bits/stdc++.h>
using namespace std;
typedef string str;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fr(i, n) for(int i = 0; i < n; i++)
#define rall(x) (x).rbegin(), (x).rend()
void solve(){
string s;
cin >> s;
vector<char> v;
for(int i ... | ALGO | 0.999476 | 3.888503 |
7f8071c2-576d-40d9-a658-cd71bb722ba8 | Danyocheck/Algorithms | yandex_contest/training_contest/C/C.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
bool is_circle(double x1, double y1, double x2, double y2) {
if ((x1 * x1 + y1 * y1) == (x2 * x2 + y2 * y2)) {
return true;
} else {
return false;
}
}
bool is_straight(double x1, double y1, double x2, double y2) {
if ((x1 == 0 && ... | ALGO | 0.999773 | 4.076617 |
85a07777-7076-466a-96ec-1e2b7ee65764 | justdotheg/Algorithm | 알고리즘/백준/BFS와 DFS/[7569] 토마토/[7569] 토마토.cpp | #include <queue>
#include <iostream>
#include <vector>
#include <tuple>
using namespace std;
int M, N, H; //열, 행, 높이
int tomatoes[101][101][101] = { 0 };
bool visited[101][101][101] = { false };
queue<tuple<int, int, int, int>> q; //행, 열, 높이, 익는데 소요된 날짜
vector<vector<int>> moved = { {0, 0, 1}, {0, 0, -1}, {0, 1, 0}, {... | ALGO | 0.999921 | 4.464471 |
10c72504-8e20-4ab2-9357-bdfae7c96d5c | shreyansh28801/StriverCpSheet | Segment Tree/q2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long int li;
#define int long long int
typedef long double ld;
#define lb lower_bound
#define ub upper_bound
#define pub push_back
#define pob pop_back
#define nl endl
typedef long double ld;
template <typename ... | ALGO | 0.99991 | 4.960087 |
d635b8ba-ac10-4e9c-b3bd-9cc0f8428bdf | Ma7moudKassem/LeetCode | 2149. Rearrange Array Elements by Sign/2149. Rearrange Array Elements by Sign.cpp | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
vector<int> rearrangeArray(vector<int>& nums) {
vector<int> ans(nums.size(), 0);
int i = 0, j = 1;
for (auto num : nums)
{
if (num > 0)
{
ans[i] = num;
i += 2;
}
else
{
ans[j] = num;
j += 2;
}
}
return ans;
}
i... | ALGO | 0.999958 | 4.559175 |
1c8dd892-7bf7-43a1-b231-f38762ea91e4 | EliahKagan/old-practice-snapshot | main/tree-top-view/tree-top-view-redef-wrong.cpp | /*
class Node {
public:
int data;
Node *left;
Node *right;
Node(int d) {
data = d;
left = NULL;
right = NULL;
}
};
*/
void topView(const Node* const root) const {
map<int, int> tops;
const function<void(int, c... | ALGO | 0.99985 | 6.00326 |
0b5c4d46-c340-4f19-9c41-e262ea7708d3 | WilliamMarioAlan/Algorithms | LC/63.uniquePathsWithObstacles.cpp |
#include <iostream>
#include <vector>
using namespace std;
/*
多了障碍物 相比62.不同路径1
说明dp公式需要有前提 当有障碍时
*/
class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
int r = obstacleGrid.size();
int c = obstacleGrid[0].size();
if (obstacleGrid[0][0] == 1 || obsta... | ALGO | 0.999552 | 4.670055 |
f6a35d6a-5752-46c0-a99f-24a4fd3904f6 | Yuankai619/Mashu-Codebook | dataStructure/persistent_seg_tree.cpp | struct seg { // 加值持久化線段樹
struct Node {
int val; Node *l, *r;
};
vector<Node*> version;
void pull(Node* node) {node->val = node->l->val+node->r->val;}
Node* build(int l,int r) {
Node* node=new Node;
if(l==r) {
node->val = 0; //初始值
return node;
}
... | ALGO | 0.999837 | 3.93932 |
d4533dc5-1d16-4b1a-9310-742f74369980 | luizmaiaj/Footballer | Footballer/Mayor.cpp | #include "Mayor.h"
#include <stdio.h>
Mayor::Mayor()
{
m_pEnv = new Environment();
}
Mayor::~Mayor()
{
for (itRobot it = m_robots.begin(); it != m_robots.end(); it++)
{
Robot* pR = *it;
if (pR) delete pR;
}
if (m_pEnv) delete m_pEnv;
}
uint Mayor::loadPopulation()
{
return 0; // to be implemented when we... | ALGO | 0.992004 | 4.146098 |
4d5e22e3-2b41-45ea-b187-09c2eddf267b | HaruteGG/CPE-DS | UVA 13185.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, t;
cin >> t;
while(cin >> n) {
int ans = 0;
for(int i=1; i<n; i++) {
if (n % i == 0) ans += i;
}
if (ans < n) cout << "deficient\n";
else if(ans == n) cout << "perfect\n";
else cout << "abundant\n";
}
return 0;
}
| ALGO | 0.999207 | 4.27843 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.