uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
33dfa279-d934-41ee-8ac2-7807c5122832 | ArushNandankar/cp-templates | code-library/Dynamic Programming Optimizations/Subset Union of Bitsets.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 9;
int x[N], y[N], c[N], dp[1 << 20], msk[N], ans[N];
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m, r; cin >> n >> m >> r;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
// total m bitsets and size of each ... | ALGO | 0.999996 | 4.094747 |
cb76cb1b-9646-4b66-9a80-7c1a509026a3 | flyheart/LeetCode | 22_GeneraeParentheses/GenerateParentheses.cpp | /*
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
"((()))", "(()())", "(())()", "()(())", "()()()"
*/
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
vector... | ALGO | 0.999566 | 6.407526 |
4dd94346-7510-40f4-9b96-800d2881f3a4 | zmdong/hello-world | datastructure/Single_LinkedList.cpp | #include <iostream>
using namespace std;
struct LinkedList{
int data;
struct LinkedList *next;
};
typedef struct LinkedList *node;
node createNode(){
node temp; // declare a node
temp = (node)malloc(sizeof(struct LinkedList)); // allocate memory using malloc()
temp->next = NULL;// make next point t... | ALGO | 0.99944 | 4.25509 |
2f3b36d3-385a-426f-b84e-cbe7b646081e | this-mkhy/Algorithm-and-Data-structures | 1-Algorithmic Toolbox/Week4-Divide-and-Conquer/Assignment/4-How Close a Data is To Being Sorted(Inversion).cpp | //Accepted code
#include <iostream>
#include <vector>
using namespace std;
long long mergeSort(vector<int> &arr, vector<int> &adds, size_t left, size_t m, size_t right)
{
size_t i=left , j=m , k=left;
long long counts = 0;
while (i<=m-1 && j<=right)
{
if (arr[i]<=arr[j]... | ALGO | 0.999977 | 4.585988 |
bfc88269-d55c-4a40-9e79-62a146f3dac9 | AshuChoudharystd/GDSC_2024 | Task_2.cpp | //
// Created by DELL-PC on 1/27/2024.
//
//Ques 2:-Input the digits of square matrix [of order that is input by the user] and sort the non-boundary
//elements of the matrix.
//Also find the sum of diagonal elements of the matrix after sorting.
//Example:
//Enter the Order: 4
//Enter the Matrix:
//1 7 8 0
//9 6 5 3
//... | ALGO | 0.999567 | 5.247906 |
1be60e41-4acd-4dcf-a6cc-9c3ad44ab8df | PrakharTiwariaiml/Mission-DSA | Leetcode/979-DistributeCoinsinBinaryTree.cpp | class Solution {
public:
int distributeCoins(TreeNode* root) {
return dfs(root)[1];
}
array<int, 3> dfs(TreeNode* node) {
if (!node) return {0, 0, 0};
auto left = dfs(node->left);
auto right = dfs(node->right);
return {left[1] + right[1] + node->val - 1, abs(left... | ALGO | 0.999994 | 6.783967 |
087a89cc-1057-4d2b-8bf5-3ee6db54081c | shyamgssr/LetsUpgrade | newpattern12.cpp | #include <iostream>
using namespace std ;
int main()
{
int i ;
int j ;
for(i=1 ; i<=5 ; i++)
{
for(j=1 ; j<=i ; j++)
{
cout << i ;
}
cout << endl ;
}
} | ALGO | 0.99923 | 3.480933 |
1059e8ad-14c0-4b7b-a4b2-a65c01731c21 | StartAt24/leetcode | basic_algorithm/sort_algorithm/quick_sort.cpp | #include <vector>
// quick sort n*log(n)
using std::vector;
void QuickSort(vector<int>& arr, int L, int R) {
if (L>=R)
return;
int l = L, r = R;
int pivot = arr[l];
while (l < r) {
// the first step should be right go first in order to match the last switch operation
while(l<r &... | ALGO | 0.999976 | 5.089823 |
7d8889de-38f7-4f35-b94e-e4b0b8e82774 | YrWaifu/olymp | 3_lesson/contest/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int l, r;
cin >> l >> r;
vector<int> dp(r + 1);
dp[1] = 1;
for (int i = 1; i <= r; i++) {
for (int j = 2 * i; j <= r; j += i) {... | ALGO | 0.99989 | 4.843082 |
09321588-05c8-4e28-84de-df9ae54ec7e1 | ZunaedSifat/acm | notebook/Data Structures/Trie.cpp | const int K = 2;
struct Vertex {
int next[K], cnt = 0;
Vertex() { fill(begin(next), end(next), -1); }
};
vector<Vertex> trie(1);
void add(string s) {
int v = 0; trie[v].cnt++;
for (char ch : s) {
int c = ch - '0';
if (trie[v].next[c] == -1) {
trie[v].next[c] = trie.size();
... | ALGO | 0.999901 | 4.64364 |
c737c962-7069-457f-a713-afb81c2fcaf7 | vatsalcode/DSA_Algo | 713-subarray-product-less-than-k/subarray-product-less-than-k.cpp | class Solution {
public:
int numSubarrayProductLessThanK(vector<int>& nums, int k) {
if(k<=1)return 0;
int p=1,res=0;
int start=0;
for(int end=0;end<nums.size();end++){
p*=nums[end];
while(p>=k){
p/=nums[start];
start++;
... | ALGO | 0.999929 | 5.271278 |
0f576ae7-e091-4bc6-9e21-ad9a600440b1 | Jihunn-Kim/Coding-Test-Practice | BAEKJOON/15653.cpp | #include <iostream>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <cstring>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
using namespace std;
int n, m;
char arr[11][11];
bool check[11][11][11][11];
int dx[] = {0, 1, ... | ALGO | 0.999842 | 4.345253 |
2de783f8-45be-4051-9193-dd970371042f | culturecoin-dev/Culture-coin | src/rpc/mining.cpp | #include "base58.h"
#include "amount.h"
#include "chain.h"
#include "chainparams.h"
#include "consensus/consensus.h"
#include "consensus/params.h"
#include "consensus/validation.h"
#include "core_io.h"
#include "init.h"
#include "validation.h"
#include "miner.h"
#include "net.h"
#include "pow.h"
#include "rpc/server.h"... | WEB | 0.992968 | 5.806979 |
11d95475-e117-48a1-9eed-d746cc6691bd | RegisBondidier/cpp-experiments | codeforces.com/800/Boy or girl/boy_or_girl.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
// get input from user
string s;
cin >> s;
// count distict characters of s
vector<int> alphabet(26, 0);
for (int i = 0; i < s.length(); ++i) {
int index = s[i] - 'a';
alphabet[index] = 1;
}
int u... | ALGO | 0.998595 | 4.707116 |
85ce91cf-4191-4de4-b72b-5c8d98d5fb75 | amamchur/pvrmre | ThirdParty/PowerVR/PVRTShadowVol.cpp | /******************************************************************************
@File PVRTShadowVol.cpp
@Title PVRTShadowVol
@Version
@Copyright Copyright (c) Imagination Technologies Limited.
@Platform ANSI compatible
@Description Declarations of functions relating to shadow vo... | TOOL | 0.853296 | 6.574227 |
58a7de22-d4c2-4f3f-8398-8c21d6f4348a | Kunal-agrawall/GFG-Daily-Solutions | Problem of the day/Find All Triplets with Zero Sum.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<vector<int>> findTriplets(vector<int> &arr) {
// Code here
vector<vector<int>> ans;
int n = arr.size();
for(int i=0; i<n; i++){
int a = arr[i];
... | ALGO | 0.994962 | 6.647347 |
a822bcd4-bddd-4cbd-b109-9b825eb38d7e | walkccc/LeetCode | solutions/1161. Maximum Level Sum of a Binary Tree/1161-2.cpp | class Solution {
public:
int maxLevelSum(TreeNode* root) {
// levelSums[i] := the sum of level (i + 1) (1-indexed)
vector<int> levelSums;
dfs(root, 0, levelSums);
return 1 + ranges::max_element(levelSums) - levelSums.begin();
}
private:
void dfs(TreeNode* root, int level, vector<int>& levelSums... | ALGO | 0.999965 | 6.509367 |
aff8e1a1-3c11-4bc5-95d5-72081cbe6b06 | LIT2019046-HritikSoni/Hacktoberfest2022 | DSA(C++ codes)/binary_heap.cpp | // A C++ program to demonstrate common Binary Heap Operations
#include<iostream>
#include<climits>
using namespace std;
// Prototype of a utility function to swap two integers
void swap(int *x, int *y);
// A class for Min Heap
class MinHeap
{
int *harr; // pointer to array of elements in heap
int capacity; // maxim... | ALGO | 0.999956 | 5.831065 |
c48d5bc1-0cef-44b7-9224-8b97a3cfeb62 | Dv1101/cplusplus_freecodecamp | 22.FunctionsTheMisfits/22.4RecursiveFunctions/main.cpp | #include <iostream>
size_t sum_up_to_zero(size_t value){
if(value!=0)
return value + sum_up_to_zero(value-1);
return 0;
}
int main(){
std::cout << "result : " << sum_up_to_zero(10) << std::endl;
return 0;
} | ALGO | 0.999451 | 5.037447 |
3a33f2bb-7990-4d08-9743-b11c759f3bc8 | AdityaSah2030/DSAwithCPP | Standard Template Library/01 Vector/10_vector_erase.cpp | #include <iostream>
#include <vector>
using namespace std;
/*
* Program: 10_vector_erase.cpp
* Description:
* Demonstrates how to remove elements from a vector using erase().
* erase() can remove a single element by iterator or a range of elements.
*
* Steps to Compile and Run (Linux/Mac):
* g++ 10_vector... | ALGO | 0.995805 | 6.469244 |
46836b19-6270-425f-8ced-ed76c04eef75 | StolasIn/leetcode_Submissions | content/smallest-subtree-with-all-the-deepest-nodes/Wrong Answer/7-31-2021, 10_00_53 AM/Solution.cpp | // https://leetcode.com/problems/smallest-subtree-with-all-the-deepest-nodes
/**
* 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(n... | ALGO | 0.99991 | 6.787407 |
2727e747-7f69-4d70-a2eb-2b26dadca4a7 | PhillipDiCarlo/The-Corruptor | ASRC Systems Simulation Driver/boost_1_74_0/libs/spirit/classic/example/fundamental/more_calculators/primitive_calc.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A primitive calculator that knows how to add and subtract.
// [ demonstrating phoenix ]
//
// [ JDG 6/28/2002 ]
//
///////////////////////////////////////////////////////////////////////////////
#include <boost/spirit/include/class... | TOOL | 0.938384 | 6.313574 |
a6ab27bd-009e-4f29-bdbb-bda40ccca795 | mosabbeer/Problem_Solving | A_Antipalindrome.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
string str;
cin >> str;
int i, count = 0, pal = 0, n = str.length();
for (i = 0; i < str.length() / 2; i++)
{
if (str[i] == str[n - i - 1])
pal++;
}
for (i = 0; i < n; i++)
{
if (... | ALGO | 0.999969 | 3.945625 |
a15288d6-f34c-48ea-b676-9e29efeebba2 | sarvex/leetcode-emoji-code | solution/1000-1099/1080.Insufficient Nodes in Root to Leaf Paths/Solution.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.999995 | 6.388229 |
efc9496e-3d7e-4904-a38a-4e9ae8531313 | adong001/C-DS-CPP | C++_Test0618/C++_Test0618/main1.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cmath>
using namespace std;
bool IsPrefectNum(int n)
{
int cnts = 0;
for (int i = 1; i <= sqrt(n); i++)
{
if (n % i == 0)
{
if (n / i != i && i != 1)
{
cnts += n / i;
}
cnts += i;
}
}
return (cnts == n) ? true : false;
}
int coun... | ALGO | 0.999651 | 4.202084 |
512859de-2fa7-4b17-88ba-cca7b22d62ce | HCYshawn/test_cpp | 2025/4 month/4_22_1/test.cpp | #include <iostream>
using namespace std;
#include "RBTree.h"
int main()
{
RBTree<int, int> t;
int a[10] = {4, 2, 6, 1, 3, 5, 15, 7, 16, 14};
for (auto e : a)
{
t.Insert({e, e});
}
t.InOrder();
cout << t.IsBalance() << endl;
return 0;
} | ALGO | 0.99755 | 5.10441 |
454c29af-e3d0-4cc2-b08a-a319c4c9512a | Sanjay-Thangavel/Programming-and-Datastrucutures | opload.cpp | #include <bits/stdc++.h>
using namespace std;
class complexn
{
float real,img;
public :
complexn(int r=0, int i=0)
{
real=r;
img =i;
}
complexn operator + (complexn const & obj)
{
complexn res;
res.real = real + obj.img ;
res.img =img + obj.img;... | ALGO | 0.889176 | 4.11693 |
797a5656-7cd3-4835-b9eb-0f68fdc9f360 | Raghavgupta2003/GFG | Difficulty: Medium/Directed Graph Cycle/directed-graph-cycle.cpp | class Solution {
public:
bool dfs(int node, vector<vector<int>> &adj, vector<int>& visited, vector<int>& pathvisited){
visited[node] = 1;
pathvisited[node] = 1;
for(auto it: adj[node]){
if(!visited[it]){
if(dfs(it, adj, visited, pathvisited)) return tru... | ALGO | 0.999967 | 6.227502 |
34b2f957-e196-4604-b6ec-610d88d506d7 | Kamna16/DSA-codes | searching/BinarySearch/floor.cpp | #include<iostream>
using namespace std;
int ceiling(int arr[],int n, int target)
{
int s =0;
int e = n-1;
while(s<=e)
{
int mid = s +(e-s)/2;
if(arr[mid] < target) s= mid+1;
else if(arr[mid] > target) e= mid-1;
else return mid;
}
return e;
}
int main(){
int ... | ALGO | 0.999932 | 5.366105 |
270ce885-5c87-4f80-b9d3-97410c301e9a | Masterroy1210/algorithms | atcoder forgb.cpp |
/*
DYNAMIC PROGRAMMING
*/
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int forg(int ind,int arr[],int dp[],int n,int k){
if(ind==n-1)return 0;
if(dp[ind]!=-1) return dp[ind];
int cost =1e9;
for(int i=1;i<=k;i++){
if(ind+i<n){
cost = min(cost,((abs(arr[ind]-arr[i... | ALGO | 0.999902 | 4.366537 |
4fbe4d87-bdce-4713-bbff-cf565c750124 | singhaditya8499/Codeforces | 493B.cpp | #include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define mod 1000000007
#define PI 3.14159265358979323846264338327950
#define eps 1e-9
typedef long long ll;
using namespace std;
// using namespace __gnu_pbds;
int... | ALGO | 0.999992 | 4.121197 |
312b634d-e21c-4edb-9297-bef15855c447 | Rohan-Chinchwade/CppPrograms | mergeSortedArrays.cpp | // Online C++ compiler to run C++ program online
#include <iostream>
#include<vector>
void mergeSortedArr(int arr1[],int arr2[],int n1,int n2,std::vector<int>& arr)
{
//std::vector<int> arr(n1+n2);
int i=0,j=0,k=0;
while(i<n1 && j<n2)
{
if(arr1[i]<arr2[j])
arr[k++]=arr1[i++];
... | ALGO | 0.999857 | 4.446144 |
15ae4de9-0afc-4af8-9a82-d101e2378b45 | qianyanglm/qianyang_LeetCode_debug | leetcode/editor/cn/701-insert-into-a-binary-search-tree.cpp | /**
<p>You are given the <code>root</code> node of a binary search tree (BST) and a <code>value</code> to insert into the tree. Return <em>the root node of the BST after the insertion</em>. It is <strong>guaranteed</strong> that the new value does not exist in the original BST.</p>
<p><strong>Notice</strong> that ther... | ALGO | 0.999997 | 6.514145 |
10be326a-12a9-48ea-97df-ed054dcf0e0b | amarrr11/DSA-questions | Tree/constructBinaryTreeFromInorderAndPostorderTraversal.cpp | /*Binary Tree from Inorder and Postorder
Difficulty: Medium
Given inorder and postorder traversals of a binary tree(having n nodes) in the arrays in[] and post[] respectively. The task
is to construct a unique binary tree from these traversals.
Driver code will print the preorder traversal of the constructed tree.
N... | ALGO | 0.999977 | 6.254021 |
f9afd806-9144-47b0-bbc9-aca3d28920d9 | zungry/leetcodeCode | N-Queens.cpp | class Solution {
public:
vector<vector<string> > re;
//测试在第row行,第row列放置皇后是否有效
int isValid(int *a, int n, int row, int col)
{
int tmpcol=0;
for(int tmprow=0;tmprow<row;tmprow++)
{
tmpcol = a[tmprow];
if(tmpcol == col)// 同列
return 0;
if((tmpcol-col) == (tmprow - r... | ALGO | 0.999072 | 4.423378 |
c3c1ad89-9719-4cf4-ad84-96b63b950e0b | wslee/popl21_artifacts | euphony/thirdparty/z3/src/ast/rewriter/bit2int.cpp | #include "ast/ast_pp.h"
#include "ast/ast_ll_pp.h"
#include "ast/for_each_ast.h"
#include "ast/rewriter/bit2int.h"
#define CHECK(_x_) if (!(_x_)) { UNREACHABLE(); }
bit2int::bit2int(ast_manager & m) :
m_manager(m), m_bv_util(m), m_rewriter(m), m_arith_util(m), m_cache(m), m_bit0(m) {
m_bit0 = m_bv_util.m... | ALGO | 0.912976 | 6.280325 |
14795a80-0f1b-468d-9b01-5adb19619d9b | rsotani/AtCoder | RegularContest/100-109/103/D.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
long long N;
cin >> N;
vector<vector<long long> > XY(N, vector<int>(2));
for (int i=0; i<N; i++) cin >> XY[i][0] >> XY[i][1];
if ((XY[0][0]+XY[0][1]+1e10)%2=0){
for (int i=0; i<N; i++){
if ((XY[i][0]+XY[i][1]+1e10)%2==1){
cout << "-1... | ALGO | 0.999911 | 4.097229 |
048d6078-7cda-41bf-a86d-f5ce2ca78ad1 | MaybelShaw/AcWingClass-Code | 蓝桥杯C++ AB组辅导课/第十一届蓝桥杯省赛第一场C++AB组真题/2066 解码.cpp | #include<iostream>
#include<cstring>
using namespace std;
int main()
{
string str;
cin >> str;
for(int i=0;i+1<str.size();i++)
{
if((str[i+1]-'0')>=1&&(str[i+1]-'0'<=9))
{
int c = str[i+1] - '0';
while(c--) printf("%c",str[i]);
i++;
}else pr... | ALGO | 0.998471 | 3.572189 |
6210cbad-8b8c-4074-bf11-0da8c07abae3 | v2v3v4/xray-csky | SDK/sources/MagicSoftware/FreeMagic/Source/Intersection2D/MgcIntr2DBoxBox.cpp | #include "MgcIntr2DBoxBox.h"
using namespace Mgc;
//----------------------------------------------------------------------------
bool Mgc::TestIntersection (const Box2& rkBox0, const Box2& rkBox1)
{
// convenience variables
const Vector2* akA = rkBox0.Axes();
const Vector2* akB = rkBox1.Axes();
const R... | TEST | 0.951228 | 5.847665 |
44a8f65d-5298-4949-9e39-9757a5f48451 | ishandutta2007/codeforces | ngfam/normal/779/C.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, k;
pair < int, int > a[N];
bool cmp(pair < int, int > u, pair < int, int > v){
return u.second - u.first > v.second - v.first;
}
int main(){
#ifdef pts
freopen("1.inp", "r", stdin);
// freopen("1.out", "W", stdout);
#endif //... | ALGO | 0.99997 | 3.394591 |
341de9f2-50ad-4bea-b901-52e748556727 | shun2029/atcoder | lib/graph/topological_sort.cpp | #include <algorithm>
#include <stack>
#include <vector>
using Graph = std::vector<std::vector<int>>;
// topological sort トポロジカルソート
std::vector<int> topologicalSort(const Graph &G) {
int n = (int)G.size();
std::vector<int> cntIn(n);
for (auto vec : G) {
for (int x : vec) {
++cntIn[x];
... | ALGO | 0.99997 | 6.050788 |
67dff672-818c-4135-95dc-1fd546baa5a2 | ishandutta2007/codeforces | lzr010506/normal/306/A.cpp | #include <bits/stdc++.h>
using namespace std;
inline int read()
{
int x = 0, f = 1; char ch = getchar();
while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
return x * f;
}
int n, m, a[110];
int main()
{
n = read();
m... | ALGO | 0.99996 | 3.285551 |
91ef341e-e4d8-4954-ad19-eabaa91be616 | Loris-Moreau/RayTracing | RayTracing/Perlin.cpp | #include "Perlin.h"
Perlin::Perlin()
{
ranvec = new Vector3[pointCount];
for (int i = 0; i < pointCount; ++i)
{
ranvec[i] = Unit(Vector3::Random(-1, 1));
}
permX = PerlinGeneratePerm();
permY = PerlinGeneratePerm();
permZ = PerlinGeneratePerm();
}
Perlin::~Perlin()
{
delete[]... | ALGO | 0.993345 | 5.058756 |
5677af83-aa6d-4902-b72f-b5d51cbe6d54 | searleser97/competitive-programming-reference | Reference/Geometry/Sort Points Along Line With Direction.cpp | // 8
#include "Data Structures/Point.cpp"
void sortAlongLine(Point& a, Point& b,
vector<Point>& ps) {
sort(ps.begin(), ps.end(), [&](Point& u, Point& v) {
return u.dot(b - a) < v.dot(b - a);
});
} | ALGO | 0.998994 | 3.851678 |
741950d6-bbfd-414e-971b-3103021eaa4d | Mohammed-BENHAMMOUTE/Competitve-programming- | B_Hopscotch.cpp | /*
* Author: Mohammed BENHAMMOUTE
* Created: 2025-02-28 16:50:37
*/
#include <bits/stdc++.h>
using namespace std;
// Debug macros
#define debug(x) cerr << #x << " = " << x << endl
#define debugv(v) cerr<<#v<<" = ";for(auto e:v)cerr<<e<<" ";cerr<<endl
#define debugm(m) cerr<<#m<<endl;for(auto e:m)cerr<<e.first<<" "<... | ALGO | 0.999926 | 3.68985 |
78d890c2-ec62-47ed-8ff7-333c1413a3ad | openvinotoolkit/openvino | src/frontends/tensorflow_common/src/op/segment_sum.cpp | #include "common_op_table.hpp"
#include "helper_ops/complex_type_mark.hpp"
#include "openvino/op/add.hpp"
#include "openvino/op/constant.hpp"
#include "openvino/op/embedding_segments_sum.hpp"
#include "openvino/op/range.hpp"
#include "openvino/op/reduce_max.hpp"
#include "openvino/op/shape_of.hpp"
#include "openvino/op... | TOOL | 0.943242 | 7.466895 |
9405f131-bbb4-4e95-8835-444f6c32255a | isVoid/Leet_codebase | 692topkfreqwords.cpp | #include <iostream>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include "dbg.hpp"
using namespace std;
struct ListNode;
struct TreeNode;
bool comp(const map<string, int>::iterator a, const map<string... | ALGO | 0.999989 | 5.70922 |
9a266a9f-aa42-4cbd-90fb-ff1883f288de | PrathameshJadhav30/Top-100-Codes | Top 100 Codes/01-Getting Started/06-Greatest of two numbers/Greatestoftwonumbers.cpp | #include <iostream>
using namespace std;
int main()
{
// Declare variables to hold user input
int num1, num2;
// Prompt the user to input two numbers
cout << "Enter the first number: ";
cin >> num1;
cout << "Enter the second number: ";
cin >> num2;
// Compare the two numbers and disp... | ALGO | 0.999769 | 5.586422 |
5880acbf-be99-4555-b9b7-2c39cd2e1c08 | webturing/ahACMSolutions | 2015/D.cpp | #include<iostream>
using namespace std;
int main() {
int T;
double a[6][6];
int i = 0;
int j = 0;
int n, m;
double max;
cin >> T;
while (T--) {
cin >> n;
for (i = 1; i < 6; i++) {
for (j = 1; j < 6; j++) {
cin >> a[i][j];
}
... | ALGO | 0.999622 | 3.449756 |
466cf102-4be1-40a6-98a5-bc818079e942 | mealsOrder/SW | baekJoon/02304_창고다각형.cpp | #include <iostream>
#include <stack>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n;
cin >> n;
int ans = 0;
vector<pair<int, int>>v(n);
for (int i = 0; i < n; i++) {
cin >> v[i].first >> v[i].second;
}
sort(v.be... | ALGO | 0.999956 | 4.363828 |
54d9e352-5e17-4ef6-a9f8-a4e057f72989 | yujin1292/Solved-Algorithm-problem | BOJ/[백준] 17144 미세먼지 안녕!/[백준] 17144 미세먼지 안녕!/소스.cpp | #include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
using namespace std;
int map[1001][1001];
int dc[4] = { 0, 1, 0,-1 };
int dr[4] = { -1,0,1,0 };
int R, C, T, dustInAir;
vector<int> ac;
queue<pair<in... | ALGO | 0.99926 | 4.703214 |
a5ced653-56f3-43f9-beb3-606bc980e295 | huan-end/p4c | backends/p4tools/common/options.cpp | #include "backends/p4tools/common/options.h"
#include <cstdlib>
#include <cstring>
#include <string>
#include <tuple>
#include <vector>
#include "backends/p4tools/common/compiler/compiler_target.h"
#include "backends/p4tools/common/lib/logging.h"
#include "backends/p4tools/common/lib/util.h"
#include "frontends/commo... | TOOL | 0.857662 | 7.856265 |
3f3b6a66-0989-45f8-8fd2-27837f099fbb | codingbbq/problem-solving | codeforces-practice/August2021/021_love_triangle.cpp | //
// Codeforces - A. Love Triangle
// https://codeforces.com/problemset/problem/939/A
//
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
bool found = false;
for(int i = 1; i <= n; i++) ... | ALGO | 0.999997 | 4.230351 |
15cdecef-e8e4-4101-8d5a-61ae2a903df0 | kmjp/procon | codeforce/851-900/876/e2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999894 | 3.526634 |
61ba3b18-a2f2-4acf-b559-4e3a98d20e20 | M680x0/M680x0-mono-repo | libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class student_t_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <cassert>
#include <vector>
#include <numeric>
#include "test_macros.h"
template <class T>
inline
T
sqr(T x)
{
return x ... | TEST | 0.879004 | 4.990874 |
a123eaef-3695-41ba-89ce-512f018d96be | Severus25/Data-Structures_Algorithms_Programs | Array/Programs/5. Kth smallest element.cpp | // Problem Statement:
// Given an array arr[] and an integer K where K is smaller than size of array,
// the task is to find the Kth smallest element in the given array.
// It is given that all array elements are distinct.
// Note :- l and r denotes the starting and ending index of the array.
// Example 1:
// Input... | ALGO | 0.99998 | 6.23604 |
82ee61a4-1434-4f85-ab95-b70f2474e52b | ethz-asl/libfactplusplus | src/lib/DLConceptTaxonomy.cpp | /*******************************************************\
|* Implementation of taxonomy building for the FaCT++ *|
\*******************************************************/
#include <queue>
#include <iostream>
#include <fstream>
#include "Reasoner.h"
#include "DLConceptTaxonomy.h"
#include "procTimer.h"
#include "gl... | ALGO | 0.995998 | 4.584204 |
72dad609-091f-434b-a672-1fdce691d221 | Ankit0225/Leetcode-and-gfg-solution | Merge 2 sorted linked list in reverse order - GFG/merge-2-sorted-linked-list-in-reverse-order.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
/* Link list Node */
struct Node
{
int data;
struct Node* next;
};
void print(struct Node *Node)
{
while (Node!=NULL)
{
cout << Node->data << " ";
Node = Node->next;
}
}
struct Node * mergeResult(struct Node *node... | ALGO | 0.999822 | 4.755556 |
53bbfe45-b7e2-4b0f-9e1b-73be89dcb141 | CerberusX99/LifeEngine | LifeEngine/imgui-docking/misc/fonts/binary_to_compressed_c.cpp | // dear imgui
// (binary_to_compressed_c.cpp)
// Helper tool to turn a file into a C array, if you want to embed font data in your source code.
// The data is first compressed with stb_compress() to reduce source code size,
// then encoded in Base85 to fit in a string so we can fit roughly 4 bytes of compressed data i... | TOOL | 0.951362 | 6.762869 |
65488ac2-8351-4cbe-b749-b7d67b390094 | ShreyasSkandanS/cuda_image_filters | src/main.cpp | #include <opencv2/core/core.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/gpu/gpu.hpp>
#include <stdio.h>
#include <iostream>
#include <ctime>
#include <sys/time.h>
extern void median_filter_wrap... | ALGO | 0.988667 | 5.212767 |
118efc7a-a7d7-4d09-a07f-a5840b305c37 | EdlinLink/LeetCode | AddTwoNumbers.cpp | /*
Author: Edlin(LIN Junhao) <EMAIL>
Date: Oct. 14, 2014
Problem: Add Two Numbers
Source: https://oj.leetcode.com/problems/add-two-numbers/
Note:
You are given two linked lists representing two non-negative numbers.
The digits are stored in reverse order and each of their... | ALGO | 0.99989 | 5.967559 |
bbf65e5c-7e3d-4872-805c-ff3030db9489 | VijayPandey08/LeetCode | 40-combination-sum-ii/combination-sum-ii.cpp | class Solution {
public:
vector<vector<int>> ans;
int n;
void solve(vector<int>& candidates, int target, int index, vector<int>& temp) {
// standard base cases
if (target == 0) {
ans.push_back(temp);
return;
}
if (target < 0) {
return;
... | ALGO | 0.999987 | 6.596521 |
001fc74e-d561-4c2e-813d-4c30f51dea19 | dcmoyer/Contagion | timing.cpp | #include "world.h"
#include "helper_fcns.h"
#include <fstream>
#include <iostream>
#include <ctime>
#include <string>
#include <cmath>
using std::cout;
using std::endl;
int main()
{
//Set file path for output
std::ofstream str;
std::string filepath = "C:\\Users\\dougyd\\Desktop\\test.txt";
str.open(filepath.c_str... | ALGO | 0.990848 | 3.554892 |
29880438-b42a-48a0-8c91-12cefa5a20be | voutcn/megahit | src/localasm/local_assemble.cpp | #include "local_assemble.h"
#include <algorithm>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include <omp.h>
#include "idba/contig_graph.h"
#include "idba/hash_graph.h"
#include "idba/sequence.h"
#include "kmlib/kmbit.h"
#include "hash_mapper.h"
#include "mapping_result_collector.h"
#... | ALGO | 0.987745 | 6.291502 |
61751156-a5fa-40d7-8f9d-f3d147af9d77 | MiniMarvin/studies | algorithms/lists/list_4/q2.cpp | #include <bits/stdc++.h>
using namespace std;
// prototypes
int comp_num(char arr[100][100], int m, int n);
void join(int arr[100][100], int xa, int ya, int xb, int yb, int m, int n);
int find(int arr[100][100], int x, int y, int m, int n);
void printarr(int arr[100][100], int m, int n) {
for (int i = 0; i < m; ++i... | ALGO | 0.999247 | 4.457353 |
359a9c94-618f-4c02-8d83-a2ca32493d73 | Justinshao33/competitive_programming | done/PCCA/C_2014_2015_ACM_ICPC_Asia_Xian_Regional_Contest_The_Problem_Needs_3_D_Arrays.cpp | #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx,popcnt,sse4,abm")
#include<bits/stdc++.h>
using namespace std;
#define ZTMYACANESOCUTE ios_base::sync_with_stdio(0), cin.tie(0)
#define ll long long
#define ull unsigned long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(... | ALGO | 0.999798 | 4.568276 |
d3187b82-f9cf-437e-a07a-3b891772f6e2 | firoorg/firo | src/crypto/MerkleTreeProof/mtp.cpp | #include "mtp.h"
#include "util.h"
#include "arith_uint256.h"
extern "C" {
#include "blake2/blake2.h"
#include "blake2/blake2-impl.h"
#include "blake2/blamka-round-ref.h"
#include "core.h"
#include "ref.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
}
#include <iostream>
#include <sstream>
#include <io... | ALGO | 0.995769 | 5.243736 |
7d135ea2-091a-40f3-9d3e-f02e0adaccab | zhixiongruan/MPC-Project | src/Eigen-3.3/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp | MatrixXd X = MatrixXd::Random(5,5);
MatrixXd A = X + X.transpose();
cout << "Here is a random symmetric 5x5 matrix, A:" << endl << A << endl << endl;
SelfAdjointEigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << ... | ALGO | 0.999389 | 3.056724 |
ebae530d-8dcb-492d-931f-12a4f6c11c15 | rocket3989/hackerEarth2019 | october data structure/count.cpp | #include <bits/stdc++.h>
using namespace std;
int MAX = 20;
vector<int> phi(MAX);
vector<int> primes;
int main(){
for(int p = 1; p < MAX; p++)
phi[p] = p;
for(int p = 2; p < MAX; p++){
if (phi[p] == p){
primes.push_back(p);
phi[p] = p - 1;
... | ALGO | 0.999867 | 4.524941 |
f76f3676-f2e7-4a30-9011-836b97f9c88c | BieremaBoyzProgramming/bbpPairings | src/tournament/generator.cpp | #include <algorithm>
#include <cassert>
#include <cmath>
#include <limits>
#include <list>
#include <ostream>
#include <random>
#include <stdexcept>
#include <utility>
#include <vector>
#include <swisssystems/common.h>
#include <utility/random.h>
#include <utility/typesizes.h>
#include <utility/uintfloatconversion.h>
... | ALGO | 0.985241 | 7.595905 |
28421493-25bd-4f64-8359-9c14dfd4249a | imon-n/phitron | Data_Structure/module_7_linklist/input.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 print_linklist(Node* head)
{
while (head!=NULL)
{
cout<<head->value<<" ";
head=head->next;
}
cout<<endl;
}
void insert_... | ALGO | 0.999051 | 4.450159 |
040fe152-efba-492c-ab6e-3266b1611d44 | IULOVE/openedr | edrav2/eprj/boost/libs/math/example/policy_ref_snip6.cpp | // Note that this file contains quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
//[policy_ref_snip6
#include <boost/math/distributions/negative_binomial.hpp>
using boost::math::negative_binomial;
// Use the default rounding policy integer_round_outwards.
// Lower ... | ALGO | 0.997948 | 4.85992 |
1fc47ced-79e3-431c-9f4c-6f6df33bc531 | rlabrecque/Source2007SDKTemplate | src/utils/vrad/vradstaticprops.cpp | #include "vrad.h"
#include "mathlib/vector.h"
#include "UtlBuffer.h"
#include "UtlVector.h"
#include "GameBSPFile.h"
#include "BSPTreeData.h"
#include "VPhysics_Interface.h"
#include "Studio.h"
#include "Optimize.h"
#include "Bsplib.h"
#include "CModel.h"
#include "PhysDll.h"
#include "phyfile.h"
#include "collisionuti... | TOOL | 0.953058 | 6.361424 |
5c768df5-b3e0-4180-9b38-e410328e4db4 | refatK/P3_Mass_Spring_Euler | dependencies/eigen-eigen-323c052e1731/bench/dense_solvers.cpp | #include <iostream>
#include "BenchTimer.h"
#include <Eigen/Dense>
#include <map>
#include <vector>
#include <string>
#include <sstream>
using namespace Eigen;
std::map<std::string,Array<float,1,8,DontAlign|RowMajor> > results;
std::vector<std::string> labels;
std::vector<Array2i> sizes;
template<typename Solver,type... | TOOL | 0.998723 | 6.326138 |
8c8aaeb6-4e80-458c-bcc9-812063dc3e86 | sark245/AtCoderEducationalDP | r.cpp | //
// Created by sark2 on 19-10-2019.
//
#include "bits/stdc++.h"
#define pb push_back
using namespace std;
#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cases int t;cin>>t;while(t--)
typedef long double ld;
typedef long long ll;
ll mod = 1e9 + 7;
int n;
void add_self(int &a, int b) {
a += b... | ALGO | 0.99997 | 4.159944 |
1299af8c-0446-4dca-965c-9dc97aa5ccb0 | vucongtuanduong/cpp-codeptit | self/practice_final/16/3/3.cpp | #include <bits/stdc++.h>
using namespace std;
void testCase() {
long long n;
cin >> n;
long long a[n][n];
map<long long,long long> m2;
for (long long i = 0; i < n; i++) {
set<long long> se;
for (long long j = 0; j < n; j++) {
cin >> a[i][j];
se.insert(a[i][j]... | ALGO | 0.995297 | 3.388783 |
21e9f110-d09d-40da-b10a-286abf2bb648 | ranjan0346/leetcode | Check Arithmetic Progression - GFG/check-arithmetic-progression.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
bool checkIsAP(int arr[], int n)
{
// code here
sort(arr, arr+n);
int diff= arr[1]-arr[0];
// unordered_map<int,int> diff;
for (int i=0; i<n-1; i++){
... | ALGO | 0.999667 | 5.406559 |
4a19ee24-0ec2-41e2-942e-6fcc59fdb445 | Scyrc/777 | leetcode/hot100/70_ClimbingStairs.cpp | //
// Created by sc on 2023/3/7.
//
#include <vector>
using namespace std;
class Solution {
public:
int climbStairs(int n) {
if(n==1) return 1;
vector<int> dp(n, 0);
dp[0] = 1;
dp[1] = 2;
for(int i=2;i<n;++i)
{
dp[i] = dp[i-2] + dp[i-1];
}
... | ALGO | 0.999838 | 6.026304 |
6603ee54-3438-43a5-8ee4-f92646a0f9b9 | ishandutta2007/codeforces | lycmd/normal/545/E.cpp | #include<bits/stdc++.h>
#define int long long
using namespace std;
typedef array<int,4> node;
int const N=300010;
int n,m,s,sum,cur,d[N],vis[N];
vector<node>e[N];
vector<int>ans;
priority_queue<node,vector<node>,greater<node> >q;
signed main(){
ios::sync_with_stdio(0);
cin>>n>>m;
for(int i=1;i<=m;i++){
int x,y,w;
... | ALGO | 0.999992 | 3.427768 |
5273834c-c365-4aca-bce9-95de58574b0c | Akm007git/gfg_coding | Difficulty: Easy/Count distinct elements in every window/count-distinct-elements-in-every-window.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
vector <int> countDistinct (int nums[], int n, int k)
{
//code here.
unordered_map<int,int>mp;
vector<int>v;
// calculate the first window
for(i... | ALGO | 0.999825 | 5.994637 |
e295a69f-adab-4152-9bb7-52b24e5e94c8 | QuangKhieu/Bring_up | planner_plugin_test/src/Astar_planner.cpp | #include <unordered_set>
#include <queue>
#include <functional>
#include <cmath>
#include <vector>
#include <limits>
#include <set>
#include "rclcpp/rclcpp.hpp"
#include "nav_msgs/msg/occupancy_grid.hpp"
#include "geometry_msgs/msg/pose_stamped.hpp"
#include "nav_msgs/msg/path.hpp"
#include <iostream>
uint32_t GRID_W... | ALGO | 0.998416 | 3.435488 |
163df307-9463-4ba4-b780-543d128e8470 | sahanics06/POTD_LeetCode | Queue/2462. Total Cost to Hire K Workers.cpp | /*
You are given a 0-indexed integer array costs where costs[i] is the cost of hiring the ith worker.
You are also given two integers k and candidates. We want to hire exactly k workers according to the following rules:
You will run k sessions and hire exactly one worker in each session.
In each hiring session, choos... | ALGO | 0.999992 | 6.127843 |
382db4d6-9414-4a13-a2d1-ac55a862d4b7 | Scrackc/loans_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
85025ef9-a115-4973-88d6-a5dd9e1d5562 | Shikhar-Bisht/competitive-programming | codeforces/Magical Calendar.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
long long n,r;
cin>>n>>r;
long long ans=0;
if(n<=r)
{
n=n-1;
ans=((n+1)*n)/2;
cout<<ans+1<<endl;
}
else
{
... | ALGO | 0.999684 | 4.222412 |
2f8c8fcc-2443-4a0b-af96-65bc39deff05 | glq30/miniob-glq | src/observer/sql/optimizer/predicate_pushdown_rewriter.cpp | //
// Created by Wangyunlai on 2022/12/30.
//
#include "sql/optimizer/predicate_pushdown_rewriter.h"
#include "sql/operator/logical_operator.h"
#include "sql/operator/table_get_logical_operator.h"
#include "sql/expr/expression.h"
RC PredicatePushdownRewriter::rewrite(std::unique_ptr<LogicalOperator> &oper, bool &chan... | ALGO | 0.974768 | 5.800646 |
bf760ec1-2de5-4dfc-9fb0-57376fb1da7e | Yuelinfeng/DataStructure | 02.TreeStruct/1.binaryTree/main.cpp | //
// Created by 25328 on 2023/2/5.
//
#include <iostream>
#include "BinaryTree.h"
using namespace std;
int main()
{
TreeNode *a = createTreeNode('A');
TreeNode *b = createTreeNode('B');
TreeNode *c = createTreeNode('C');
TreeNode *d = createTreeNode('D');
TreeNode *e = createTreeNode('E');
Tre... | ALGO | 0.994818 | 5.14009 |
9c21907c-cecb-47aa-8724-0e74e6223d45 | Avinash-choubey-4719/CPP_TREES_programs | possibleBinaryTrees.cpp | #include<bits/stdc++.h>
using namespace std;
int possibleBinaryTrees(int n){
int bt[n + 1];
memset(bt, 0, sizeof(bt));
bt[0] = 1;
bt[1] = 1;
bt[2] = 2;
bt[3] = 5;
bt[4] = 14;
if(n < 4 && n > -1){
return bt[n];
}
for(int i = 5;i<=n;i++){
int j = 0;
int... | ALGO | 0.999986 | 5.694985 |
93a69f32-8499-4385-beaa-5d966b0f2ced | ValeriiKoniushenko/VaKon2D | dependencies/boost_1_80_0/libs/math/example/hyperexponential_snips.cpp | // Caution: this file contains Quickbook markup as well as code
// and comments, don't change any of the special comment markups!
#ifdef _MSC_VER
# pragma warning (disable : 4996) // disable -D_SCL_SECURE_NO_WARNINGS C++ 'Checked Iterators'
#endif
#include <boost/math/distributions/hyperexponential.hpp>
#include <io... | ALGO | 0.936876 | 3.697333 |
78300c78-02da-45a4-89ff-529d8156b36e | talwindersinghprof/MicrosoftPrep | IncreasingTriplet subsequence.cpp |
class Solution {
public:
bool increasingTriplet(vector<int>& nums)
{
int n=nums.size();
if(n<3)return false;
int low=INT_MAX, mid=INT_MAX;
for(int i=0;i<n;i++)
{
if(nums[i]>mid) return true;
else if(nums[i]<low) low=nums[i];
else if(nums[i]> low and nums[i]<mid) mid=nums[i];... | ALGO | 0.999986 | 5.815176 |
8c222b71-9f12-44e5-a94d-7a1eca34bafc | ayush-gupta2002/Datastructures-and-Algorithms | majority-element-II.cpp | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
int votes_1 = 0;
int votes_2 = 0;
int candidate_1 = -1;
int candidate_2 = -1;
vector<int> res;
int n = nums.size();
for(auto i:nums){
if(i == candidate_1){
... | ALGO | 0.99998 | 5.413258 |
2d6cc477-baf5-4120-98cd-c23112ce74ed | crg85-ua/PracticasPED | 2024/prac3/corrector/pruebadf/TCalendario/otras/tad01.cpp | #include <iostream>
#include "tcalendario.h"
using namespace std;
int main(){
TCalendario f(3, 2, 2000, NULL);
int i;
for(i = 1; i <= 5; i++){
f--;
cout << f << endl;
}
return 0;
}
| TOOL | 0.971742 | 3.400902 |
ac9765a0-b393-45aa-9901-313cb960cd5c | habiburrahmantalha/UVA-online-Judge | 443Humble_number.cpp | #include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
set<long long> H;
void humblen()
{
H.insert(1);
set<long long> :: iterator it=H.begin();
int i=0;
while(H.size()<7000)
{
H.insert(*it*2);
H.insert(*it*3);
H.insert(... | ALGO | 0.999832 | 3.550636 |
c3eacc20-e2a3-4ff1-9733-8b034b4c021c | SohamDuttae/klinker | Codeforces/1368/andorsquare.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int powers[21] = {};
//we compile the amount of "powers" of two present in total, then create numbers based on passing through the array and taking at most one of each power if present.
//this is because of the nature of AND and OR - we can think of the OR re... | ALGO | 0.999919 | 4.936857 |
1607e4a3-e133-4367-a8d9-97fc2df5b8f4 | sanjiv0286/Leetcode-Problem-Submissions | 0367-valid-perfect-square/0367-valid-perfect-square.cpp | class Solution {
public:
bool isPerfectSquare(int num) {
int l = 1;
int r = num / 2;
if (num == 1) {
return true;
}
while (l <= r) {
int mid = (l + r) / 2;
long long int sq = (long long int)mid * mid;
if (sq == num) {
... | ALGO | 0.999887 | 5.761889 |
9c7a6c74-72c5-4ce5-9b4c-ddf73033757a | abhinavjdwij/poc | algorithms/Palindrome Check.cpp | /*input
abccba
*/
/*~ @author = dwij28 (Abhinav Jha) ~*/
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
bool pal(string s) {
int n = s.size();
for (int i = 0; i <= n/2; i++) {
if (s[i] != s[n-i-1])
return false;
}
return true;
}
int main() {
st... | ALGO | 0.999853 | 5.224163 |
5135184e-1952-4350-981d-b8f23be55dcc | Mayur-Tingare/DSA_SUPREME_1.0 | DSA_LOVE/WEEK_4/singleinsorted.cpp | class Solution {
public:
int singleNonDuplicate(vector<int>& nums) {
int start=0;
int end=nums.size()-1;
int mid=start+(end-start)/2;
while(start<=end){
if(start==end){
return nums[start];
}
if(mid%2==0){
... | ALGO | 0.999948 | 5.766817 |
808d8073-6619-4ccb-85a3-0443d9f52581 | PCY00/BOJ_Project | BOJ/1978.cpp | #include <iostream>
using namespace std;
bool ck(int p) {
int cut = 0;
for (int i = 1; i <= p; i++) {
if (p % i == 0) {
cut++;
}
}
if (cut == 2) {
return true;
}
else {
return false;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, num;
int cut = 0;
cin... | ALGO | 0.999925 | 4.30908 |
de8f3dcb-670c-4cd2-a2ad-dbaa5f423838 | Zeal-L/UNSW | COMP6771/Labs/lab03/lab301/src/sort_descending.cpp | #include "sort_descending.h"
#include <algorithm>
auto sort_descending(std::vector<int>& numbers) -> void {
std::sort(numbers.begin(), numbers.end(), std::greater<int>());
}
| ALGO | 0.999349 | 4.90766 |
6892764c-cc71-4278-b08b-e9702ed534ff | sprkrd/codeforces | contests/1989/E/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef int64_t i64;
constexpr i64 M = 998244353;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
i64 n;
cin >> n;
i64 k;
cin >> k;
vector<i64> dp((n+1)*(k+1)*2);
dp[0] = dp[1] = 1;
for (i64 i = 1; i <= n; ++i)
{
f... | ALGO | 0.999971 | 4.32459 |
c3256525-ebef-490b-9492-09c54e453612 | tanmoy-OG/striver-a-z-sheet-old-dropped | 3_arrays/3.3_hard/1_print-pascal-s-triangle_6917910.cpp | vector<vector<int>> pascalTriangle(int N) {
// Write your code here.
vector<vector<int>> triangle;
for (int i = 0; i < N; i++) {
int temp = 1;
vector<int> row = {temp};
for (int j = 1; j <= i; j++) {
temp = temp * (i + 1 - j) / j;
row.push_back(temp);
}
triangle.push_back(row);
}... | ALGO | 0.999827 | 6.856978 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.