uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
8cb8ec80-d9ab-4077-b628-a335cad0a747 | Vaibhav4228/my-dsa-codes | 38. CLASS CODE/Order_Traversal_Line_Wise.cpp | // 6. Level order traversal in level wise
/*
Time Complexity: O(N), where N is total number of nodes in binary tree
Space Complexity: O(L), where L is maximum number of nodes in the level of binary tree
*/
#include<iostream>
#include<queue>
using namespace std;
class Node{
public:
int data;
... | ALGO | 0.999986 | 5.969014 |
81a125e1-ac32-40ce-a7b1-8dddcf03db51 | UrviGoel/Apna-College-CppCourse | 30.1 LinkedList/llintro.cpp | #include <iostream>
using namespace std;
class node{
public:
int data;
node* next;
node(int val){
data=val;
next=NULL;
}
};
void insertAthead(node* &head, int val){
node* n=new node(val);
n->next=head;
head=n;
}
void insertAtTail(node* &head, int val){
node* n = ... | ALGO | 0.999813 | 4.461802 |
95f501bf-b2ce-495e-84e7-9168d9732028 | Alex7D3/Codility-Solutions | 07_Stacks_and_Queues/Nesting.cpp | #include <string>
int solution(std::string &S) {
int N = S.size();
int polarity = 0;
for (int i = 0; i < N; i++) {
if (S[i] == '(') polarity++;
else if (S[i] == ')') polarity--;
if (polarity < 0) return false;
}
return polarity == 0;
} | ALGO | 0.971716 | 5.587111 |
a68cd5ea-86dd-48af-9c03-0d1befeff513 | kulu123-z/SORTING-PROGRAM | SELECTION SORT.cpp | // C++ program for implementation of selection sort
#include <bits/stdc++.h>
using namespace std; //standard input output
//swap function for swap two element with pointer
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
//this function will sort element
void selectionSort(int arr[], ... | ALGO | 0.999819 | 5.000475 |
dd5ef8f6-ec0b-4e5f-9039-dbef8ca66228 | lbenc135/Cpp_codes | Instrukcije/main.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> niz;
niz.push_back(0);
for(int i=1;i<50;i++)
for(int j=0;j<i;j++)
niz.push_back(i);
int a, b, rez=0;
cin >> a >> b;
for(int i=a;i<=b;i++)
rez+=niz[i];
cout << rez;
}
| ALGO | 0.999076 | 3.78803 |
0c855f91-cfcd-4de1-9101-68a34732c564 | ishandutta2007/codeforces | serotonin/normal/1364/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 1e5+5;
int depth[sz], par[sz], cyc = sz, bg, ed;
vector <int> g[sz];
bitset <sz> vis;
void dfs(int u = 1, int f = 1)
{
depth[u] = f;
if(f & 1) vis[u] = 1;
for(int v : g[u]) if(v ^ par[u]) {
if(depth[v]) {
int d ... | ALGO | 0.999996 | 4.256462 |
a0ffc80b-0138-4a40-b192-ee855b19f57b | supernalu/CP-solutions-and-templates | rozwiazania/cf-829-factorial-divisiblity/x.cpp | #include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 5e5 + 10;
int n;
unsigned long long x, il[MAXN];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> x;
for (int i = 1; i <= n; i++)
{
int a; cin >> a;
il[a]++;
}
bool res = 1;
... | ALGO | 0.999998 | 3.874338 |
92b9944b-ff36-4a10-97c7-f65a95b4ab67 | Benves-7/Skeleton | exts/imgui/misc/fonts/binary_to_compressed_c.cpp | // 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 into 5 by... | TOOL | 0.944738 | 6.190477 |
759378dd-3ae1-4093-80da-2a3371fbaa2d | ishandutta2007/codeforces | neko_nyaaaaaaaaaaaaaaaaa/normal/839/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long double ld;
const int maxn = 2e5 + 17, maxv = 1e6 + 17, mod = 1e9 + 7;
int n;
vector<int> g[maxn];
ld dfs(int v = 0, int p = -1){
ld sum = 0;
for(auto u : g[v])
if(u != p)
sum += dfs(u, v) + 1;
return sum ? sum / (g[v].size() - (p != -1)) : 0;
}
int mai... | ALGO | 0.999134 | 4.385672 |
7df64491-eeaf-4529-9ab5-ea85b8e73ef5 | SebAmb/ORB_SLAM2 | Thirdparty/g2o/g2o/core/optimization_algorithm_with_hessian.cpp | #include "optimization_algorithm_with_hessian.h"
#include "solver.h"
#include "optimizable_graph.h"
#include "sparse_optimizer.h"
#include <iostream>
using namespace std;
namespace g2o {
OptimizationAlgorithmWithHessian::OptimizationAlgorithmWithHessian(Solver* solver) :
OptimizationAlgorithm(),
_solver(s... | ALGO | 0.991705 | 6.811634 |
38726907-86c9-4909-bb8f-624b8e48a1b7 | inerydev/inery-dev | libraries/wasm-jit/Test/Benchmark/Benchmark.cpp | #include <vector>
#include <iostream>
struct point
{
double x;
double y;
};
int main()
{
// Generate a lot of uniformly distributed 2d points in the range -1,-1 to +1,+1.
enum { numXSamples = 10000 };
enum { numYSamples = 10000 };
std::vector<point> points;
points.reserve(numXSamples * numYSamples);
for(int x... | ALGO | 0.9856 | 5.39281 |
76acc679-1597-424f-bd01-d3435e74a98f | 2016mehrab/problem_solving_randomly | dfsOnMatrix.cpp | #include <bits/stdc++.h>
#include <chrono>
#include <vector>
using namespace std;
using namespace std::chrono;
// find number of unique paths
int dfs(vector<vector<int>> &path, int row, int col,
vector<vector<int>> &visited_points) {
int ROWS{(int)path.size()}, COLS{(int)path[0].size()};
if (row == ROWS -... | ALGO | 0.998825 | 5.338186 |
a1e68d2d-ccce-4c00-b531-6b33b068b1d7 | gurnoorsingh8/Pepcoding-Basics | Foundation/Basics/benjaminbulb.cpp | #include<iostream>
using namespace std;
void benjbulb(int n)
{
for(int i= 1; i * i < n; i++)
{
cout<<i*i<<endl;
}
}
int main()
{
int n;
cin>>n;
benjbulb(n);
return 0;
} | ALGO | 0.999125 | 3.81381 |
775e883e-e932-442b-93ae-dd20d55a6300 | paul2705/OI | OJ/poj/p3208.cpp | #include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
const int MAXN=1e3+5;
const int MAXS=10;
ll dp[MAXN][5],n;
int g[4][12]={{0},{3,3,3,3,3,3,0,3,3,3},{3,3,3,3,3,3,1,3,3,3},{3,3,3,3,3,3,2,3,3,3}};
int main(){
dp[0][0]=1;
for (int i=1;i<=MAXS;i++){
dp[i][0]=(dp[i-1][0]+dp[i-1][1]+dp[i-1][2... | ALGO | 0.999847 | 3.708845 |
d6ca8b33-1ce7-42f8-97d1-ad4958c41fea | kakeru-one/algorithms_and_data_structures | books/subjects_in_book/chapter3/ex3_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// 入力を受け取る
int N, v;
cin >> N >> v;
vector<int> a(N);
for (int i = 0; i < N; ++i) cin >> a[i];
// 線形探索
int find_count = 0; // 初期値は -1 などありえない値に
for (int i = 0; i < N; ++i) {
if (a[i] == v) {
find_count++; // 見つかったらインクリメントする。
... | ALGO | 0.999942 | 5.041206 |
bda34a82-b7fc-4a1e-8e9f-f474329e53e5 | Kevinchaudhary/SE_Assignment_M3 | Sum_of_two_digits.cpp | //Sum of two numbers
#include<iostream>
using namespace std;
main()
{
int a,b;
cout<<"\n\n\t Enter First Number : ";
cin>>a;
cout<<"\n\n\t Enter Secound Number : ";
cin>>b;
float sum = a + b;
cout<<"\n\n\t Sum = "<<sum;
cout<<"\n\n\t Ave = "<<sum/2;
}
| TOOL | 0.862357 | 3.3536 |
a39cf21c-1495-4ae9-905a-c32503847b65 | CyberKnight-cmd/cpp-dsa | 6-Arrays/Problems/Medium/Problem2.cpp | /*
75. Sort Colors
Given an array arr with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue.
We will use the integers 0, 1, and 2 to represent the color red, white, and blue, respectively.
You must solve this p... | ALGO | 0.999718 | 6.19912 |
15e25dd9-0b81-4998-b56f-a3a71e5ceabb | ishandutta2007/codeforces | yousef_salama/normal/1089/L.cpp | #include<bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define pb push_back
#define mp make_pair
#define mt make_tuple
//#define Y imag()
//#define X real()
#define ... | ALGO | 0.99992 | 3.101372 |
2d6bfd6f-a6f2-4e53-8807-0e4a3d8f4be1 | 07ritvik/DSA-practice | 973-k-closest-points-to-origin/973-k-closest-points-to-origin.cpp | class Solution {
public:
vector<vector<int>> kClosest(vector<vector<int>>& points, int k) {
// priority_queue<pair<int,vector<int>>,vector<pair<int,vector<int>>>,greater<pair<int,vector<int>>>> minh;
priority_queue<pair<int,vector<int>>> maxh;
for(auto i:points){
int d=... | ALGO | 0.999998 | 5.873207 |
c3d9faf2-15e9-49da-a7da-ebd7c04f7a5e | donla34110/Programing-C | test38.cpp | #include <stdio.h>
int main(){
int num,sum = 1;
printf("enter a integer:");
scanf("%d",&num);
for (int i= 1; i < num;i++){
sum = sum * i;
}
printf("result:%d\n",sum);
return 0;
} | ALGO | 0.999922 | 3.548552 |
b98f7984-669f-4025-8cc3-053c00f973e9 | jjaroztegi/AOC_2024 | Day 10/day10.cpp | #include <fstream>
#include <iostream>
#include <vector>
using namespace std;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
bool isCorrect(const vector<vector<int>> &matrix, int x, int y, int new_x,
int new_y) {
int rows = matrix.size();
int cols = matrix[0].size();
if (new_x >= 0 &&... | ALGO | 0.999926 | 5.940516 |
4ff38a42-e6ff-433f-95e8-4cbd37e8c280 | joydip007x/CompetitiveCodeArchive | SPOJ/ONP/17656149_RE_0ms_0kB.cpp | ///*/////////////////// /// *
/*// author-joydip007x /// *
/ */// <^> <^ <^> <^> /// *
///*<^> Never tired :)<^>:V*///
//*/*** Never Give UP ***///
/// Date<^>XX/08/2018 *///
#include<bits/stdc++.h>
using namespace std;
#define loop(i,L,U) for(long long int i=(long long int)L;i<U;i++)
#define l... | ALGO | 0.999041 | 4.096832 |
b59476a5-828e-45df-9627-efa0899c6afb | alexandraback/datacollection | solutions_1480487_0/C++/Goblin911/A.cpp | #include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<stdlib.h>
using namespace std;
int i,n,a[1000],m,x;
double ans[1000];
bool v[1000],f;
int main(){
freopen("A.in","r",stdin);
freopen("A.out","w",stdout);
int t,T;cin>>T;
for (t=1;t<=T;t++){
cin>>n;a[0]=0;m=n;
for (i=1;i<=n;i++)... | ALGO | 0.999553 | 3.025954 |
8403f931-3310-43c1-a29c-f3f25dababe7 | KaziAmitHasan/Face-Detection-with-Image-Enchantments | opencv-master/3rdparty/carotene/src/template_matching.cpp | #include "common.hpp"
#include <vector>
#include <cstring>
namespace CAROTENE_NS {
#define ENABLE4LINESMATCHING false //Disabled since overall time for simultaneous 4 lines matching is greater than
//time for simultaneous 2 lines matching for the same amount of data
bool isMatch... | ALGO | 0.996509 | 5.252957 |
cf0af357-2a89-4031-8565-e9543ebc0ff3 | novo1985/Leetcode | Easy/111. Minimum Depth of Binary Tree/MinimumDepthofBinaryTree.cpp | #include <iostream>
using namespace std;
/*Given a binary tree, find its minimum depth.
*The minimum depth is the number of nodes along the shortest path from the root node
*down to the nearest leaf node.*/
struct TreeNode{
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x): val(x), left(Nullptr), ri... | ALGO | 0.999904 | 6.570636 |
588c43c0-c27a-4bf8-a208-7e7a4bc7ff7b | naman-doshi/Learning | CSES/Chapter 9/BIT.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <... | ALGO | 0.999889 | 4.303631 |
39cff015-273a-47a4-8bd3-9db30159eba3 | rayssamorei/curso-cpp | capitulos/capitulo07/Questao07.cpp | /*
Faça um programa que preencha uma matriz 20 x 10 com números inteiros, e some cada uma das colunas,
armazenando o resultado da soma em um vetor. A seguir, o programa deverá multiplicar cada elemento da
matriz pela soma da coluna e mostrar a matriz resultante.
*/
#include <iostream>
using namespace std;
int main() {... | ALGO | 0.998314 | 4.604712 |
57de994b-9443-42cf-a4e5-0339f2bf24b3 | DDGRCF/DFDet | mmdet/ops/nms/src/cuda/nms_cuda.cpp | #define CHECK_CUDA(x) TORCH_CHECK(x.device().is_cuda(), #x, " must be a CUDAtensor ")
at::Tensor nms_cuda_forward(const at::Tensor boxes, float nms_overlap_thresh);
at::Tensor nms_cuda(const at::Tensor& dets, const float threshold) {
CHECK_CUDA(dets);
if (dets.numel() == 0)
return at::empty({0}, dets.options(... | TOOL | 0.869446 | 6.67566 |
121263e0-b02b-447b-8f95-7169f98d27b3 | QIQIZHENDE/qiqiehenao | Project1/Project1/源.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include<graphics.h>
#include <conio.h>
#include<time.h>
#include<math.h>
#include<stdlib.h>
struct Point {
double x, y;
COLORREF color;
};
COLORREF colors[256] = { RGB(255,32,83),RGB(252,222,250) ,RGB(255,0,0) ,
RGB(255,0,0) ,RGB(255,2,2) ,RGB(255,0,8) ,RGB(255... | ALGO | 0.933587 | 3.372572 |
68257bc8-2e32-452f-a7db-6a475099eae0 | ishandutta2007/codeforces | sankear/normal/229/D.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <queue>
#include <complex>
#include <cassert>
using namespace std;
#define pb push_back
#define mp make_pair
#de... | ALGO | 0.999979 | 3.622685 |
605dad8e-deef-489f-9234-c81571a7db3c | janvimulani/janvi | mathpow.cpp | #include<iostream>
#include<math.h>
#include<stdlib.h>
using namespace std;
int main()
{
cout<<"ans:"<<pow(2,3)<<endl;
} | ALGO | 0.998699 | 3.066591 |
c40ead35-36bb-4d14-b8ab-4971762abdc3 | kundan6930/coding_contest | atcoder/SuntoryProgrammingContest2023(AtCoder Beginner Contest 321/A_321_like_Checker.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main (){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
int n1=n;
vector<int>a;
while(n1>0)
{
a.push_back(n1%10);
n1/=10;
}
int f=0;
for(int i=0;i<a.size()-1;i++)
{
if(a[i+1]<=a[i])
{
f=1;
break;
... | ALGO | 0.999958 | 4.083486 |
5102383c-de91-4b86-b92e-b7251266f1d4 | xiaohu-art/Mocap2SMPL | mesh/mesh/src/visibility.cpp | #define CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES 1
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_triangle_primitive.h>
#include <CGAL/centroid.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/intersections.h>
#include <CGAL/Bbox_3.h>
#include <boost/cstdint.hpp>
#include <boost/array.h... | ALGO | 0.999632 | 7.472333 |
a50727ce-f26d-4363-8767-841e65abf815 | newUser1337/cplusplus | practice/fenwick/Fenwick.cpp | #include <cstdlib>
#include <iostream>
#include "Fenwick.h"
Fenwick::Fenwick(int *in_array, int in_size)
{
size = in_size;
array = new int[size];
for (int i = 0; i < size; i++)
Update(i, in_array[i]);
}
Fenwick::~Fenwick()
{
delete[] array;
}
void Fenwick::Update(int pos, int value)
{
wh... | ALGO | 0.999456 | 4.484469 |
fa98cbfc-acff-41fd-a7fc-4c85884f7929 | Tzion-ben/CPP_Fifth_assignment_PartB | Demo.cpp |
#include <iostream>
#include <stdexcept>
#include <vector>
#include "BinaryTree.hpp"
using namespace std;
using namespace ariel;
enum class _order {
inorder,
postorder,
preorder,
};
template <typename T>
bool isEqual(BinaryTree<T> &tree, vector<T> const &v2, _order order) {
// This function checks i... | TEST | 0.995479 | 5.830442 |
293ad540-3684-4cf1-b26b-bd0e04e9dcb7 | adhishanand9/ADI | Stack/tagsValidator.cpp | #include<iostream>
#include<stack>
using namespace std;
bool tags(const string& code) {
if (code.size() < 2 || code[0] != '<' || code[1] < 'A' || code[1] > 'z') return false;
stack<string> tagname_stack;
int i = 0, j = 0, n = code.size();
while (i < n) {
while (i < n && code[... | ALGO | 0.955848 | 3.463454 |
275ca17b-2019-4d81-b549-a3d09b9f6eff | jccooper1/leetcode | decode_ways.cpp | class Solution {
public:
int numDecodings(string s) {
int n=s.size();
if(s[0]=='0') return 0;
vector<int>dp(n+1,0);
dp[0]=1;
dp[1]=1;
for(int i=2;i<=n;i++) {
if(s[i-1]!='0') dp[i] += dp[i-1];
if (s[i-2]=='1'||(s[i-2]=='2'&&s[i-1]<='6')) dp[i] +... | ALGO | 0.999901 | 6.267723 |
ad2f5a0f-07d1-4b60-b63d-77b6da2829e3 | ishandutta2007/codeforces | theoneyouwant/normal/1081/E.cpp | //By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;whi... | ALGO | 0.999961 | 3.257479 |
2c93ab91-63eb-42f5-9d5d-9a9f77ca2ac4 | papagiannakis/CPP-PP-Edu | Resources/Code/Programming-code/Chapter25/chapter.25.5.2.cpp |
//
// This is example code from Chapter 25.5.2 "Bitset" of
// "Programming -- Principles and Practice Using C++" by Bjarne Stroustrup
//
#include <bitset>
#include <iostream>
using namespace std;
//------------------------------------------------------------------------------
void test()
{
bitset<4> flags = 0x... | ALGO | 0.956669 | 5.911618 |
a8f0ec66-477f-4940-9a76-43a9decb676e | Merligus/problem-solving | src/problems/BinarySearchInterval.cpp | #include <iostream>
#include <algorithm>
#include <vector>
// O(3lgn)
std::pair<int, int> FindLowHighIndex(std::vector<int> arr, int value)
{
std::pair<int, int> tuple(-1, -1);
std::vector<int>::iterator left, right;
// O(lgn)
if (std::binary_search(arr.begin(), arr.end(), value))
{
// O(lgn)
left = std::low... | ALGO | 0.999451 | 5.551577 |
e1c41a68-b3e1-460a-888f-c838a365a329 | HosseinDahaei/CodeForces_Solutions | Solutions/58649802.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int val=0;
int a;
cin>>a;
while(a%2==0 || a%3==0)
{
if(a%2==0)
a/=2;
else
a/=3;
}
val=a;
bool ok=true;
for(int i=1;i<n;i++)
{
cin>>a;
while(a%2==0... | ALGO | 0.999979 | 3.480527 |
f06efa1e-020f-4129-a5ef-8a11ae5e07f5 | ishandutta2007/codeforces | phirasit/normal/273/A.cpp | #include <stdio.h>
#define N 100010
#define LL long long
LL tree[N];
LL arr[N];
int n, m;
LL max(LL a, LL b) {
return a > b ? a : b;
}
void update(int idx, LL val) {
while(idx <= n) {
tree[idx] = max(tree[idx], val);
idx += idx & (-idx);
}
}
LL query(int idx) {
LL ans = 0;
while(idx > 0) {
ans = max(ans, ... | ALGO | 0.999923 | 4.057362 |
c785a0fd-bfe2-4682-8fd6-319c534c5a1f | valida-xyz/valida-compiler | clang/lib/Tooling/Refactoring/Rename/RenamingAction.cpp | #include "clang/Tooling/Refactoring/Rename/RenamingAction.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/Basic/FileManager.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/Preprocessor.h"
... | TOOL | 0.866166 | 7.856019 |
b04db790-9a2e-47c0-91f5-8a59a7be0a4a | ishandutta2007/codeforces | shik/normal/855/F.cpp | // {{{ by shik
#if !defined(YCM) && 1
#define _FORTIFY_SOURCE 0
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx,tune=native")
#include <stdio.h>
#endif
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#define SZ(x) ((int)(x).size())
#define ALL(x) be... | ALGO | 0.999789 | 4.03212 |
cb36f6c3-554a-4e9a-94e7-7594c41e3ef4 | sarvex/leetcode-perl | solution/1100-1199/1155.Number of Dice Rolls With Target Sum/Solution.cpp | class Solution {
public:
int numRollsToTarget(int n, int k, int target) {
const int mod = 1e9 + 7;
int f[n + 1][target + 1];
memset(f, 0, sizeof f);
f[0][0] = 1;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= min(target, i * k); ++j) {
for (in... | ALGO | 0.99999 | 6.175041 |
f43e1a41-d48d-4929-abd0-86d8b2546da3 | Masternodesguru/xczm | src/sync.cpp | #include "sync.h"
#include <memory>
#include <set>
#include "util.h"
#include "utilstrencodings.h"
#include "util/threadnames.h"
#include <stdio.h>
#ifdef DEBUG_LOCKCONTENTION
#if !defined(HAVE_THREAD_LOCAL)
static_assert(false, "thread_local is not supported");
#endif
void PrintLockContention(const char* pszName, ... | TOOL | 0.943465 | 6.495807 |
c3fc506f-e184-431f-a8fd-4a49607f2de1 | hyunJIN7/PRACTICE_CODDINGTEST | SW Expert Academy/D5/3947_가장 짧은 길 전부 청소하기.cpp | #include<iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <climits>
#define N_MAX 500000
using namespace std;
int N;
vector<pair<int,int> > edge[N_MAX];
int pre_cost[N_MAX];
long long accu_cost[N_MAX];
bool visited[N_MAX];
long long solve(){
queue<int> q; //현재 노드 번호
int curr_node = 0;
q.... | ALGO | 0.99979 | 4.391298 |
f8b1bb73-d10b-47d1-9f9f-f77fdcc72753 | KDE/kpublictransport | src/lib/geo/pathfilter.cpp | #include "pathfilter_p.h"
#include <QDebug>
#include <QLineF>
#include <QPolygonF>
using namespace KPublicTransport;
[[nodiscard]] static double turnAngle(const QPolygonF &path, qsizetype i)
{
QLineF l1(path[i], path[i+1]);
QLineF l2(path[i+1], path[i+2]);
const auto turnAngle = l1.angleTo(l2);
retur... | TOOL | 0.990822 | 6.697105 |
f60ef0b2-4e07-4585-86f8-8b8fdfa70480 | sl1296/acm-code | gym-101572E-1 Accepted.cpp |
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
#define N 510
typedef long long ll;
const int fx[][2]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
struct rec{
int x,y,w;
rec(){}
rec(int x,int y,int w):x(x),y(y),w(w){}
bool operator<(const rec ... | ALGO | 0.999965 | 4.387715 |
b7754cfc-21e6-4b86-a6e4-e63fcf9b423e | Stmxlt/DataStructureAlgorithmProblems | 王道408/5.3 二叉树的遍历和线索二叉树.cpp | #include<iostream>
#include<cstdlib>
#include<cstring>
#define MaxSize 50
using namespace std;
typedef struct BiTNode{
int data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
typedef struct LNode{
BiTree data;
struct LNode *next;
} LinkNode,*LinkList;
typedef struct{
BiTree data[MaxSize];
int top;
}SqStac... | ALGO | 0.999918 | 3.407259 |
1754ae9b-84b6-4337-8e64-a20a95977a99 | antwoor/multi_ddpg-quadruped | third_party/eigen3/include/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.995248 | 6.22153 |
1248a03e-73cd-4db1-9884-c5d4e23c7698 | Arhan13/seanprashad-leetcode-patterns | Algo Monster/Binary Search/Sorted Array/template.cpp | #include <bits/stdc++.h>
using namespace std;
int binary_search(std::vector<int> arr, int target)
{
int left = 0;
int right = arr.size() - 1;
int firstTrueIndex = -1;
while (left <= right)
{
int mid = left + (right - left) / 2;
// if (feasible(mid))
// {
// first... | ALGO | 0.997911 | 5.295477 |
2ec40600-fb1a-4290-ba66-7b1e53a92f95 | ThePixelMoon/OpenMod | src/utils/vrad/vraddisps.cpp | #include "vrad.h"
#include "utlvector.h"
#include "cmodel.h"
#include "BSPTreeData.h"
#include "VRAD_DispColl.h"
#include "CollisionUtils.h"
#include "lightmap.h"
#include "Radial.h"
#include "CollisionUtils.h"
#include "mathlib/bumpvects.h"
#include "utlrbtree.h"
#include "tier0/fasttimer.h"
#include "disp_vrad.h"
cl... | ALGO | 0.988035 | 3.172664 |
0b70bdf9-b35b-4afc-b10a-d3b22a977fa9 | Himanshurajput4884/6_Companies_30_days | Microsoft/Largest_Divisible_Subset.cpp | // Largest Divisible Subset
// Given a set of distinct positive integers nums, return the largest subset answer such that every pair (answer[i], answer[j]) of elements in this subset satisfies:
// answer[i] % answer[j] == 0, or
// answer[j] % answer[i] == 0
// If there are multiple solutions, return any of them.
//... | ALGO | 0.999986 | 5.301816 |
45e75a2f-ee61-4762-9c1a-c8338be67d4a | nshipochka/fmi-ip-23-24 | p-04-pointers-functions/Solutions/Task13.cpp | #include<iostream>
void print_pascal_triangle(int row) {
int binomial_coeff = 1;
for (int i = 1; i <= row; ++i) {
for (int j = 1; j <= row - i; ++j)
std::cout << ' ';
for (int j = 1; j <= i; ++j) {
if (i == 1 || j == 1)
binomial_coeff = 1;
else
binomial_coeff = binomial_coeff * (i - j + 1) /... | ALGO | 0.999954 | 5.891186 |
f3b914da-e274-4667-8d25-a1e8cd0860e4 | wesc111/cpp_examples_2025 | src/pascal.cpp | // example for calculation of pascal triangle in cpp
// from Francis Buontempo "Learn C++ by Examples"
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <format>
#include <fmt/format.h>
#include <cassert>
#include <numeric>
std::vector<int> get_next_row(const std::vector<int> &la... | ALGO | 0.998619 | 7.107296 |
e8411941-6575-4382-95dd-beea418c7c0b | Joe-hunter99/Rubik-s-Cube-Solver | PatternDatabases/CornerDBMaker.cpp | #include "CornerDBMaker.h"
using namespace std;
CornerDBMaker::CornerDBMaker(string _fileName) {
fileName = _fileName;
}
CornerDBMaker::CornerDBMaker(string _fileName, uint8_t init_val) {
fileName = _fileName;
cornerDB = CornerPatternDatabase(init_val);
}
bool CornerDBMaker::bfsAndStore() {
RubiksCu... | ALGO | 0.877439 | 4.286434 |
07c11586-edc2-49c5-89ef-f3b67d2df374 | ljupchel/Strukturno | Vtor_Kol/zad_16.cpp | /*
* Да се напише рекурзивна функција за наоѓање на максималната цифра од даден цел број.
Од стандарден влез се внесуваат непознат број цели броеви се додека не се внесе нешто што не е број. За секој од нив да се испечати максималната цифра во посебен ред.
Забелешка: Решението со рекурзивна функција носи 100% од пое... | ALGO | 0.999593 | 5.618084 |
1334ca79-8fb7-4f5d-a2ce-9ab9c1adf67f | thebesttv/00.ACM | 16.NCnt/17385.cpp | // Tag: 数位DP
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<ctime>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=(a);... | ALGO | 0.998275 | 3.986439 |
8cfd8118-6100-4177-92e9-44ffbe547a83 | shazzing/dummyepiP | graphs/main.cpp | #include <iostream>
#include "shortestLineProg.h"
#include "teamPhoto.hpp"
using namespace std;
int main(int argc, const char * argv[]) {
// insert code here...
vector<int> retVec = getShortestStraightLine(15);
for(const int& a: retVec){
cout << a << " " ;
}
cout << endl;
return 0... | ALGO | 0.994037 | 3.342916 |
3dd123ea-92aa-4d5e-b34f-fe846ef801ff | sagebekelian/CompProgrammingSolutions | codeforcesproblems/BerlandMusic/BerlandMusic.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string str;
cin>>str;
}
return 0;
}
| ALGO | 0.998206 | 4.083807 |
9eab4802-2da1-45e0-9323-5f7706f564db | Alemediii/Fundamentals-of-Programming | examsPractice/final/21/highestSerie.cpp | #include <iostream>
#include <array>
using namespace std;
const int SIZE = 10;
typedef array<int, SIZE> Numbers;
Numbers read();
int highest(Numbers n);
int main(){
Numbers data = read();
int highestSerie = highest(data);
cout << "the highest serie is: " << highestSerie;
}
Numbers read(){
Numbers ... | ALGO | 0.999499 | 4.266691 |
6b4718e1-2715-48c7-9064-7309a878d17c | justmohit/mycaptainc- | number as prime1.cpp | //created by Mohit Sheopuri on 11/2/2020
//program to check whether a number can be expressed as a sum of prime and then expressing as a sum of
//prime if possible
#include <iostream>
using namespace std;
bool checkP(int n) //function to check prime
{
int i;
bool isPrime = true;
for(i = 2; i <= n/2; ++i)
... | ALGO | 0.999668 | 5.087001 |
ea935972-3361-40c3-b948-7a7ccc0a6205 | luliyucoordinate/Leetcode | src/0122-Best-Time-to-Buy-and-Sell-Stock-II/0122.cpp | #include <iostream>
#include <vector>
using namespace std;
static int x = []() {std::ios::sync_with_stdio(false); cin.tie(0); return 0; }();
class Solution
{
public:
int maxProfit(vector<int>& prices)
{
int result = 0;
if (prices.empty()) return result;
for (unsigned int i = 0; i < ... | ALGO | 0.997982 | 5.62421 |
6fa0e964-4c9d-4743-8105-0499fdbc60aa | yang48699997/code | lanqiao/aaa/c.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n;
cin >> n;
ll ans = 0;
for (int i = 0; i < n; i++) {
ll x;
cin >> x;
ans += x * (i + 1) * (n - i);
}
cout << ans << "\n";
}
int main() {
ios::sync_with_stdio(false);
cin.... | ALGO | 0.999914 | 4.620428 |
e2a3252d-cda2-4d0f-8b5a-d49de815d8d8 | niexiaokun/my_solutions_to_leetcode | 00659-Split-Array-into-Consecutive-Subsequences.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
using namespace std;
//659. 分割数组为连续子序列
//
//给你一个按升序排序的整数数组 num(可能包含重复数字),请你将它们分割成一个或多个子序列,其中每个子序列都由连续整数组成且长度至少为 3 。
//
//如果可以完成上述分割,则返回 true ;否则,返回 false 。
//
//
//
//示例 1:
//
//输入: [1,2,3,3,4,5]
//输出: True
// 解释:
//你可以分割出这样两个连续子序列... | ALGO | 0.999965 | 5.400256 |
25ecae84-0c6c-4714-be74-8c0b8adce75b | brobat6/competitive | Lazy/Codechef/START33/Stable_Mex.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
int find_mex(deque <int> &v, int sub) {
// Return MEX, assuming v is sorted.
int curr = 0;
for(auto i : v) {
if(curr == i - sub) curr++;
else return curr;
}
return (int)v.size();
}
int32_t main() ... | ALGO | 0.999828 | 4.433856 |
bbda2a7f-7424-4cef-a505-6b64839d354c | aryan083/ICP | matrixmultiply.cpp | #include<stdio.h>
int main ()
{
int a[2] [2],b[2][2],c[2][2],i,j;
for(j=0;j<2;j++)
{for(i=0;i<2;i++)
{printf("enter the %d %d element of matrix A",j,i);
scanf("%d",&a[j][i]); }}
for(j=0;j<2;j++)
{for(i=0;i<2;i++)
{printf("enter the %d %d element of matrix B",j,i);
scanf("%d",&b[j][i]); }}
c[0][0]=a[0][0]*b[0]... | ALGO | 0.998869 | 3.017603 |
4a5ec22d-4d3e-4f4b-ba79-bae2e073ef78 | RahmanMoshiur00/Problem-Solving | Contests/hstu 17 1st C.cpp | #include<bits/stdc++.h>
using namespace std;
#define intt long long
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);
intt t, x, y, GCD, LCM;
cin>>t;
while(t--){
cin>>x>>y;
if(x==0 && y==0){
cout<<"0 0"<<endl;
continue;
}
else if(x==1... | ALGO | 0.999956 | 4.590006 |
0ebcae65-c958-448e-9b59-2c2c9be0e089 | Mahbub20/UVA-Solutions | 543 - Goldbachs Conjecture.cpp | #include<bits/stdc++.h>
using namespace std;
bool isprime(int n)
{
bool flag = false;
for(int i = 2;i<=sqrt(n);i++)
{
if(n%i==0)
{
flag = true;
break;
}
}
if(flag==false)return true;
else return false;
}
int main()
{
int n,i,j;
while(cin >> n && n)
{
for(i = 3;i<n-2;i++)
{
... | ALGO | 0.999819 | 3.47723 |
1cfd6f1f-4f9f-4960-aa60-e35a636334e7 | lihongzheshuai/yummy-code | gesp/1/bcqm/3021.cpp | #include <iostream>
using namespace std;
int main() {
int a, b, c, d;
cin >> a >> b >> c >> d;
cout << a + b + c + d;
return 0;
}
| ALGO | 0.997496 | 3.42547 |
14729d36-d7a1-4cec-ab52-be9973258100 | wanghua1120/subconverter | src/utils/file.cpp | #include <string>
#include <fstream>
#include <sys/stat.h>
#include "string.h"
bool isInScope(const std::string &path)
{
#ifdef _WIN32
if(path.find(":\\") != path.npos || path.find("..") != path.npos)
return false;
#else
if(startsWith(path, "/") || path.find("..") != path.npos)
return false;
#... | TOOL | 0.937894 | 4.548276 |
5b8f1a1e-fd8d-4f7a-8855-861813bcd1d6 | Coder-Vippro/Code | Archived/Thaytuong/06052023/DINHDAY/DINHDAY.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int a[100001];
vector <int> kq;
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
freopen("DINHDAY.inp","r",stdin);
freopen("DINHDAY.out","w",stdout);
cin>>n;
for (int i = 1; i <= n; i++)
{
cin>>a[i];
}
fo... | ALGO | 0.999997 | 3.766713 |
a5b96448-78b7-4dfb-a7de-efa5fdcc4acb | shah-zx/plus-plus-C | .history/GFG/alterposneg_20220828120914.cpp | #include <bits/stdc++.h>
#include <stack>
#include <queue>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
using namespace std;
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define rep(i, a, b) for (int i = a; i < b; i+... | ALGO | 0.99993 | 4.086919 |
230b5277-627d-4064-9e02-555b1c1b031a | arpitamittal/Leetcode | Remove Element.cpp | /* Given an array nums and a value val, remove all instances of that value in-place and return the new length.
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
The order of elements can be changed. It doesn't matter what you leave beyond the... | ALGO | 0.99993 | 5.919882 |
9f239577-186c-4a2c-97b0-d4d53ecc4869 | postironix/project_image_processor | base_filters.cpp | #include "base_filters.h"
#include <cstdint>
#include <cmath>
#include <ctime>
void CropFilter::Apply(Image &image, std::vector<std::size_t> params) const {
size_t a = params[0];
size_t b = params[1];
image.SetWidth(std::min(a, image.GetWidth()));
image.SetHeight(std::min(b, image.GetWidth()));
for... | TOOL | 0.975002 | 5.945074 |
f4b810db-d118-4760-8d26-342d1c3e77ea | neal2018/oj_env | atcoder/arc129/e.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
constexpr ll MOD = 998244353;
ll power(ll a, ll b, ll MOD = MOD, ll res = 1) {
a %= MOD;
for (; b; b /= 2, (a *= a) %= MOD)
if (b & 1) (res *= a) %= MOD;
return res;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
ll n, k, m;
c... | ALGO | 0.999984 | 5.275777 |
9c401b67-588e-4cf5-b72f-5c6678a50be6 | ishandutta2007/codeforces | kevinxiehk/normal/1400/E.cpp | #include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define int long long
using namespace std;
int n;
int arr[5005];
int dfs(int l,int r,int k){
if(l==r){
if(arr[l]==k)return 0;
else return 1;
}
int m=min_element(arr+l,arr+r+1)-arr;
int ta... | ALGO | 0.999942 | 4.507227 |
a90d205d-3f51-446d-b789-555cb1da0f42 | zoomkoding/Baekjoon | 구글Kickstart/2019RoundH/ProblemC/solution.cpp | #include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
int t, arr[10], dp[5000000000][10];
int main(){
scanf("%d", &t);
for(int k = 1; k <= t; k++){
printf("Case #%d: ", k);
for(int i = 1; i <= 9; i++)scanf("%d", arr[i]);
... | ALGO | 0.994709 | 3.60363 |
b56faf86-6b6a-4636-be38-a7d00515056c | aaruagarwal15/CP-codes | little_elephant&permutation.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t, n;
cin>>t;
while(t--){
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int cnt1 = 0, cnt2 = 0;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(a[i] > ... | ALGO | 0.999986 | 3.918969 |
7f888f43-e68d-442f-bbad-cb7ac0b3b1a2 | TonChan0828/AtCoder | ABC/ABC297/A.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
template <typename T>
bool chmax(T &a, const T &b) {
if (a < b) {
a = b; // aをbで更新
return true;
}
return false;
}
template <typename T>
bool chmin(T &a, const T &b) {
if (a > b) {
a... | ALGO | 0.999982 | 4.149307 |
048d011d-2b90-4ea3-8009-7f43554b59c5 | hieupham1103/TINHOC | ONLINE OJ/CODEFORCES/Contest kho dam/CF ROUND/DIV 2/Codeforces Round #831 div 2/A.cpp | #include<bits/stdc++.h>
#define ii pair <int,int>
#define fi first
#define se second
#define int long long
#define double long double
#define endl '\n'
using namespace std;
signed main(){
//freopen("input.INP", "r", stdin);
//freopen("output.OUT", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie... | ALGO | 0.999638 | 4.310968 |
ce16d83c-451c-4a5d-9045-aadbc73dd806 | jinjoh/NOOR | blender/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp | #include "btConvexPlaneCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
//#include <stdi... | ALGO | 0.999635 | 7.186503 |
9595a3df-c04b-45c4-8692-f052030f10b4 | Karan-Veer-Singh/Leetcode | Strings/345. Reverse Vowels of a String.cpp | class Solution {
private:
bool isVowel(char c) {
return c == 'a' || c == 'i' || c == 'e' || c == 'o' || c == 'u'
|| c == 'A' || c == 'I' || c == 'E' || c == 'O' || c == 'U';
}
public:
string reverseVowels(string s) {
int start = 0;
int end = s.size() - 1;
whi... | ALGO | 0.999976 | 6.704278 |
748a4281-d143-425d-856e-3079bf78bdb8 | adriines/IOI2025 | Spoj/Fibosum.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
ll binpow(vector<vector<ll>>a,ll b){
vector<vector<ll>>res;
res.push_back({1,0});
res.push_back({0,1});
while(b){
if(b&1){
vector<vector<ll>>aux(2,vector<ll>(2));
for(int i=0;i<2;i++){... | ALGO | 0.999943 | 4.242466 |
78776472-9b99-46f9-8d1d-80ebe10353b6 | riddhip23/OOPs | huffmann.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
map<string,char>mp;
mp["100100"]='a';
mp["111111"]='\n';
mp["100101"]='b';
string encoded="100100111111100101";
string decoded="";
string currentcode="";
for(char c:encoded)
{
currentcode+=c;
... | ALGO | 0.99785 | 3.576975 |
9d5ef33c-6c70-4960-a917-ad53a309536d | ishandutta2007/codeforces | kczno1/normal/1428/D.cpp | #include<bits/stdc++.h>
using namespace std;
template <typename T> void chmin(T&x,const T &y)
{
if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
if(x<y)x=y;
}
typedef int64_t s64;
typedef uint64_t u64;
typedef uint32_t u32;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define ... | ALGO | 0.999747 | 3.507769 |
894fedd3-8b07-48d7-9eec-80fd84001268 | luliyucoordinate/Leetcode | src/1358-Number-of-Substrings-Containing-All-Three-Characters/1358.cpp | class Solution
{
public:
int numberOfSubstrings(string s)
{
int cnt[3] = {0, 0, 0},res = 0 , l = 0, n = s.length();
for (int r = 0; r < n; ++r)
{
++cnt[s[r] - 'a'];
while (cnt[0] && cnt[1] && cnt[2])
{
res += n - r;
cn... | ALGO | 0.999946 | 5.512226 |
da515873-3107-4a5b-af8a-2c64b507d00b | Badcreature/sagcg | Engine/Externals/IrrBullet/source/bheaders/Bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp | #include "btPoint2PointConstraint.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
#include <new>
btPoint2PointConstraint::btPoint2PointConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3& pivotInA,const btVector3& pivotInB)
:btTypedConstraint(POINT2POINT_CONSTRAINT_TYPE,rbA,rbB),m_pivotInA(pivotInA),m_pi... | ALGO | 0.856547 | 5.244775 |
3be8626d-8633-48f9-b6ec-85e03edd2d29 | SidGit195/Competitive-Programming | STL C++/maps.cpp | // it+1 is not allowed but it++ allowed
// map pairs are in key: value formet
// .size(), .find(), .erase(), .clear() ---> works in all almost
#include <bits/stdc++.h>
using namespace std;
void printMap(map<int, string> &m){
cout << m.size() << endl;
for(auto &pr: m)
cout << pr.first << " " << pr.s... | ALGO | 0.976302 | 4.718039 |
399d9e87-fd16-414f-8aca-7022f6a72b05 | zhun0922/CppCodingTest_BarkingDog | BarkingDogCpp/BarkingDogCpp/0x01/1_4.cpp | #include <iostream>
using namespace std;
//복잡도는 2의 k승이니까 O(log N)이다
//내가푼
//int func4(int n) {
// int mul2 = 1;
// for (int i = 0; mul2 <= n; i++) {
// mul2 *= 2;
// }
// return mul2 / 2;
//}
//정답
int func4(int n) {
int val = 1;
while (val * 2 <= n) {
val *= 2;
}
return val;
}
int main() {
cout << func4(9... | ALGO | 0.999885 | 5.064452 |
d02c38cd-7e6f-49dc-9b72-5d91772178a3 | abeesh/llvm-wine-patched | mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp | #include "mlir/Dialect/Affine/LoopUtils.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/... | ALGO | 0.97693 | 8.098573 |
b51d9adc-e842-41e1-a800-5f1c24690e27 | bluewhitesheen/Leetcode | validate-binary-search-tree/Wrong Answer/1-29-2023, 4_16_53 PM/Solution.cpp | // https://leetcode.com/problems/validate-binary-search-tree
/**
* 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) {}
* ... | ALGO | 0.99998 | 6.250987 |
c49e8ced-e1ef-44f3-8faf-10ae0fa32c0e | RanjithECE24/hackerrank-solutions | class_template.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cassert>
using namespace std;
/*Write the class AddElements here*/
template <class T>
class AddElements {
public:
AddElements(T element) : element_{element} {}
T const& add(T element) {
... | ALGO | 0.967208 | 4.572409 |
8ab51409-10ed-41b8-ac5f-8387db626f5a | kurokin-project/kurokin | src/pow.cpp | #include "pow.h"
#include "arith_uint256.h"
#include "chain.h"
#include "primitives/block.h"
#include "uint256.h"
#include "util.h"
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{
unsigned int nProofOfWorkLimit = UintToArith256(params.... | ALGO | 0.998843 | 7.270952 |
978a966c-6ef5-49c0-a6ce-e5e00da0d552 | Project-Nyanpasu/frameworks_av | media/codecs/amrnb/dec/src/d4_17pf.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/d4_17pf.c
Functions: decode_4i40_17bits
Date: 01/28/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Modified to place file in t... | ALGO | 0.999534 | 5.510615 |
5ad94c5f-2f90-474d-aaca-0b2d4f0fa2c7 | strengthen/LeetCode | C++/1093.cpp | __________________________________________________________________________________________________
using VI = vector< int >;
using VD = vector< double >;
class Solution {
public:
VD sampleStats( VI& cnt ){
double mind{ 256.0 }, maxd{ -1.0 }, mode{ 0.0 }, sum{ 0.0 };
const auto N = cnt.size();
... | ALGO | 0.999613 | 4.619626 |
4e07b2ca-47e9-4ec2-99ef-171aee691178 | tratitude/algorithm-problems | LeetCode/LeetCode278_First_Bad_Version.cpp | // Time complexity: O(logN)
// Space complexity: O(1)
class Solution {
public:
int firstBadVersion(int n) {
// [i, j)
int left = 1, right = n;
while (left < right) {
int mid = left + (right - left) / 2;
bool badMid = isBadVersion(mid);
if (badMid) {
... | ALGO | 0.999899 | 7.035387 |
6cd43004-a93f-40d2-aec8-13199aba6c19 | Tesfamichael12/A2SV | A2SV-Community-Education/Div-3-Group-3-2024/LeetCode/Easy/944. Delete Columns to Make Sorted/C++ solution/944. Delete Columns to Make Sorted.cpp | class Solution {
public:
int minDeletionSize(vector<string>& strs) {
int n = strs.size();
int c = strs[0].size();
int delete_count = 0;
string all_strs = "";
for (int i = 0; i < n; i++)
all_strs += strs[i];
for (int i = 0; i < c; i++)
{
... | ALGO | 0.999971 | 6.09146 |
bc75dfa8-e753-4f22-92e1-443e3abb0bfe | wisdompeak/CodeForces | Good-Bye-2019/C.Make-Good/C.Make-Good_v1.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<ll> solve()
{
int n;
cin>>n;
ll Sum = 0;
ll Xor = 0;
for (int i=0; i<n; i++)
{
ll x;
cin>>x;
Sum += x;
Xor ^= x;
}
return {Xor,Sum+Xor};
}
int main()
{
int T;
... | ALGO | 0.999568 | 3.527558 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.