uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a65a5994-139f-4c90-8f6a-03d1c5d42132 | menon92/Competitive-Programming | 247.cpp | /**
* Problem : 247 - Calling Circles
* Writer : Mehadi Hasan Menon.
* Verdict : Accepted.
* Date : 25.01.2018
*/
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <cstdio>
#include <set>
using namespace std;
map <string, vector<string> >adjList;
map <string, vector<string>... | ALGO | 0.999905 | 4.984649 |
417cacf8-e0c1-4289-9100-b0e29ebcc0cb | reefahtasnia/codeforcesSolve | 1622A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int l1, l2, l3;
cin >> l1 >> l2 >> l3;
bool flag = false;
if (l1 == l2 + l3 || l2 == l1 + l3 || l3 == l1 + l2)
flag = true;
if ((l1 % 2 == 0 && l2 == l3) || (l2 %... | ALGO | 0.999937 | 4.256939 |
da026b7c-9034-48fd-aa2b-a228c95ab007 | wcysai/Calabash | Petrozavodsk Summer-2015. Moscow IPT Contest/G.cpp | #include<bits/stdc++.h>
#define MAXN 100005
#define MAXLOGN 18
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef long double db;
int n,q,pa[MAXLOGN][MAXN],depth[MAXN],deg[MAXN];
vector<int> G[MAXN];
db f[MAXLOGN][MA... | ALGO | 0.999921 | 4.122865 |
ee8b7a04-266e-4dbf-b3f6-218fe3c132c4 | YoungJooYoo/For_Coding_Test | leetcode/3498. Reverse Degree of a String.cpp | class Solution
{
public:
int reverseDegree(const string &s) const
{
assert(MIN_LENGTH <= s.size() && s.size() <= MAX_LENGTH);
int degree = 0;
for (size_t i = 0; i < s.size(); ++i)
{
const size_t idx = s[i] - 'a';
degree += mKReversedAlphabet[idx] * (i + 1);
}
assert(degree >... | ALGO | 0.999913 | 6.303017 |
42087b3f-9b4e-4ca3-b4ab-9cccfeafc7b7 | avilapa/vxt | src/objects/sphere.cpp | #include "../../include/objects/sphere.h"
#include "../../include/objects/aabb.h"
#include "../../include/renderer/ray.h"
namespace vxt
{
static void uv(const vec3& p, vec2& uv)
{
float phi = atan2(p.z, p.x);
float theta = asin(p.y);
uv = vec2(1 - (phi + PI) / (2 * PI), (theta + PI / 2) / PI);
}
... | ALGO | 0.969908 | 7.496744 |
f70f5bac-f5ad-46db-9bc8-65369fecbbea | Gagneja1512/Cpp-problems | Leetcode/MinElementInRotatedArray.cpp | class Solution {
public:
int findMin(vector<int>& arr) {
int n = arr.size();
int start = 1 , end = n-1;
int index = 0;
int base = arr[0];
while(start <= end)
{
int mid = (start + end)/2;
if(arr[mid] > base)
{
... | ALGO | 0.999911 | 5.631871 |
5ad2d86d-023b-48b1-8d3a-adc11f9359f8 | sentry5588/leetcode | q_054_spiral_matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int> result;
int top = 0, left = 0, right = matrix[0].size() - 1, bottom = matrix.size() - 1;
int N = (right + 1) * (bottom + 1);
int i = 0, j = 0;
while (result.size() < N) {
f... | ALGO | 0.999997 | 6.109816 |
343d7357-4eda-40e5-9841-3a2e1bd2d1e0 | Svormen/AVS | avs-proj02/parallel_builder/loop_mesh_builder.cpp | /**
* @file loop_mesh_builder.cpp
*
* @author Slavomir Svorada <<EMAIL>>
*
* @brief Parallel Marching Cubes implementation using OpenMP loops
*
* @date 29 November 2022
**/
#include <iostream>
#include <math.h>
#include <limits>
#include "loop_mesh_builder.h"
LoopMeshBuilder::LoopMeshBuilder(unsigne... | ALGO | 0.994191 | 7.64674 |
9c654fdc-ec74-45c0-a0ac-2c1d20211d2b | ArchitKumar1/LeetCode-Submissions | tuple-with-same-product/Time Limit Exceeded/1-17-2021, 3:23:37 PM/Solution.cpp | // https://leetcode.com/problems/tuple-with-same-product
class Solution {
public:
int tupleSameProduct(vector<int>& nums) {
int n = nums.size();
unordered_map<int,vector<pair<int,int>>> m1;
m1.reserve(1000001);
for(int i =0;i<n;i++){
for(int j = i+1;j<n... | ALGO | 0.99994 | 6.042546 |
e2ba9c2a-f275-4206-b3ba-bd364bc77ed8 | Jooye0n/Algorithm | BAEKJOON/CPP/1697_2.cpp | /*
https://www.acmicpc.net/problem/1697
*/
#include <cstdio>
#include <iostream>
#include <queue>
using namespace std;
bool chk[100001];
int n, k;
int BFS(){
int result = 0;
queue<int> q;
chk[n] = true;
q.push(n);
while(q.empty()==false){
int size = q.size();
while(size--){
... | ALGO | 0.999907 | 4.357786 |
8d00373b-f6bd-4743-ae64-a8ba1fe07903 | ncdejito/learn-cpp | concurrency/mutexes-and-locks.cpp | #include <iostream>
#include <thread>
#include <mutex>
int sharedCounter = 0;
std::mutex mtx; // Create a mutex
void incrementCounter() {
for (int i = 0; i < 10000; i++) {
std::lock_guard<std::mutex> lock(mtx); // Acquire the lock
sharedCounter++; // Access the shared resource
}
}
int main() ... | TOOL | 0.961564 | 6.167184 |
5ce435b6-d6ff-4991-a42d-9ac58dc92126 | 7matuag/DSA-Sheet-by-Love-Babbar-450-Questions- | Dynamic Programming/Permutation Coefficient.cpp | #include <bits/stdc++.h>
int P(int n, int k) {
// Write your code here.
long long int mod = 1e9 + 7;
long long int ans = 1;
for (int i = 1; i <= k; i++){
ans = ((ans) * (n - i + 1)) % mod;
}
return ans ;
}
| ALGO | 0.999989 | 5.371689 |
656ac834-d4b6-42a3-bba0-76f57ff012be | Kari937/Mdk-c-6-laba | 3/3.cpp | #include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
setlocale(NULL, "rus");
int N, i, Sym = 0;
cout << "Введите количество элементов: ";
cin >> N;
int a[10];
for (i = 0;i < N;i++)
{
cout << "[" << i << "] элемент: ";
cin >> a[i];
}
for (i = 0;i < N;i++)
{
cout << "[" << i << "]=... | ALGO | 0.948023 | 3.610634 |
bdbfa77b-e788-4d4a-8ca9-cd2dbfa6d98b | chenyzcs/HuaweiCodeCraft | Small_Mid_Correct_test/GA_adj.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "variable_declaration.h"
int C = consumeNode_nums;
int V = 20;
int N = 50;
const int GA_times = 20;
int apt[GA_times];
int apt_2[GA_times];
int min_idx;
const int range_const = 1;
//int min_cost;
std::vector<netNode_index> min_host, node_sort, node_sort... | ALGO | 0.999968 | 3.283674 |
d9facfac-7b04-4eaa-856e-8102873fbe8f | KhushalBorse2023/Leetcode-24 | JAYESH/Problem 22/Rotate_image.cpp | //Problem link = https://leetcode.com/problems/rotate-image/
class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
int Row = matrix.size();
int Col = matrix.size();
reverse(matrix.begin(), matrix.end());
for (int i = 0; i < Row; ++i) {
for (int j = i; j < Col; ++j)
... | ALGO | 0.999957 | 6.467619 |
7920ee14-6dd6-4fdf-8781-c2eadbaee8c1 | TakayukiTomatsuri/prac-ProgrammingContestChallengeBook | chap-3/P184-POJ3233-MatrixPowerSieries/p184-poj3233-matrixPowerSieries.cpp | #include <iostream>
#include <vector>
#include <stdio.h>
typedef std::vector<std::vector<long long> > matrix;
typedef long long ll;
void mat_print(const matrix &A){
for(int r=0; r<A.size(); r++){
for(int c=0; c<A[0].size(); c++){
printf("%lld ", A[r][c]);
}
printf("\n");
}
... | ALGO | 0.999761 | 3.34548 |
f52ce1e0-5db6-4a96-af41-7d9c322cc4f0 | josuehfa/DAASystem | CoreSystem/lib/CGAL/examples/Triangulation_2/polygon_triangulation.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Polygon_2.h>
#include <iostream>
struct FaceInfo2
{
FaceInfo2(){}
int nesting_level;
bool in_domain(){
return nesting_l... | ALGO | 0.99992 | 6.911856 |
5c094b89-f5de-429d-9991-efa8772b10f9 | VINODvoid/DSA-Journal | LeetCode/Arrays/goodpair.cpp | // https://leetcode.com/problems/number-of-good-pairs/description/
#include <bits/stdc++.h>
using namespace std;
int goodpairs(int arr[], int n)
{
int pairs = 0;
// brute force approach
// for (int i = 0; i < n; i++)
// {
// for(int j=i+1;j<n;j++)
// {
// if(arr[i]==arr[j])
... | ALGO | 0.99998 | 5.709359 |
46894555-98f4-4e13-b324-8eabfe9aa4b0 | wangguojun2018/LidarRoadBoundaryDetection | lib/road_segmentation.cpp | /*
* @Authors: Guojun Wang
* @Date: 1970-01-01 08:00:00
* @LastEditors: Guojun Wang
* @LastEditTime: 2020-09-07 20:42:23
*/
#include "road_segmentation.h"
#include<lib/log.h>
RoadSegmentation::RoadSegmentation(PointCloudType::Ptr incloud)
{
_completeCloud.reset(new PointCloudType);
*_completeCloud = *in... | DATA | 0.997315 | 4.540159 |
486d1645-f7f2-413c-b722-d60017ad41d7 | mangwonKing/Algorithm-Solve | 프로그래머스/0/120583. 중복된 숫자 개수/중복된 숫자 개수.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<int> array, int n) {
int answer = 0;
for(auto a : array)
if(a == n)answer++;
return answer;
} | ALGO | 0.99902 | 5.607302 |
bd4e2a01-58a6-4561-80ad-b9648037c7c2 | Nusrat008/C-plus-plus-Programming-basic-to-Intermediate | C++ String/string example.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
char word[80] = "polymorphism";
char rev[80];
size_t n = word.length();
size_t i = 0;
for ( ; i < n; i++ ) rev[i] = word[n - i - 1];
rev[i] = '\0';
std::cout << word << endl;
std::cout << rev << std::endl;
re... | ALGO | 0.946238 | 4.443371 |
b6a8aac5-f455-437f-9c58-d6ee96076509 | MustofaAkhyar/Pab2Karyawan | 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 |
0dbb97c8-4c8f-44dd-aff6-ec07e3d655ac | boxnos/codeforces | 1499B/main.cpp | #pragma GCC optimize("O3")
#include <cstdio>
#include <utility>
#include <cctype>
#include <functional>
#include <array>
#include <string>
#include <regex>
using namespace std;
#ifdef _WIN32
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#else
#define _U(s) s##_unlocked
#endif
#define gcu _U(getchar)... | ALGO | 0.992847 | 4.723074 |
badaf6c2-e25e-4dbd-8cb2-ef8963b1ceaf | vanny-laure-lamorte/runtrackCPP | jour01/job13/main.cpp | # include <iostream>
using namespace std;
int main(void) {
int N;
cout << "Choisir un entier N : \n";
cin >> N;
int s = 0;
for (int i = 5; i <= N; ++i) {
s += i * i * i;
}
cout << "La somme des cubes de 5^3 a N^3 est : " << s << endl;
return 0;
} | ALGO | 0.998786 | 4.052456 |
a0cb3402-9392-46da-b5f2-a7f36405c1d4 | Mercycoffee12138/guess | lab5-guess(hash-guess并行化)/train.cpp | #include "PCFG.h"
#include <fstream>
#include <cctype>
#include <algorithm>
// 这个文件里面的各函数你都不需要完全理解,甚至根本不需要看
// 从学术价值上讲,加速模型的训练过程是一个没什么价值的问题,因为我们一般假定统计学模型的训练成本较低
// 但是,假如你是一个投稿时顶着ddl做实验的倒霉研究生/实习生,提高训练速度就可以大幅节省你的时间了
// 所以如果你愿意,也可以尝试用多线程加速训练过程
/**
* 怎么加速PCFG训练过程?据助教所知,没有公开文献提出过有效的加速方法(因为这么做基本无学术价值)
*
* 但是统计学模型好就好在其数... | DATA | 0.988397 | 3.620069 |
02b47f90-46ca-4123-a639-453bf88d2353 | tranhuy105/hocdot | ll/evenOdd.cpp | #include <iostream>
#include <vector>
using namespace std;
struct ListNode {
int val;
ListNode* next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode* llFromVector(const vector<int>& nums) {
if (nums.empty()) return NULL;
ListNode* head = new ListNode(nums[0]);
ListNode* tail = head;
... | ALGO | 0.999846 | 6.051507 |
65b82d14-b8a2-43f2-a826-5e820b61622e | NanGongJin/Algorithm-Templates | Math/Combinatorics/Cantor expansion.cpp | // 康托展开
#include <bits/stdc++.h>
using namespace std;
int fact[13] { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600 };
// 只能用于元素互不相同。从0开始,0是顺序,n! - 1是逆序
int cantor(vector<int> nums) {
int n = nums.size(), res = 0;
for (int i = 0; i < n; i++) {
int smaller = 0;
for ... | ALGO | 0.999722 | 3.884404 |
47f0b225-927e-4583-bc84-25b346baa8eb | markverick/ioi-training | skgrader/touristmain.cpp | #include<stdio.h>
#include<algorithm>
using namespace std;
int n,k,c;
int h[1200000];
int jum[5000][5000];
int dp(int idx,int money)
{
if(idx<4999&&money<4999&&jum[idx][money]>=0)
return jum[idx][money];
if(money>=k)
{
return 0;
}
if(idx<4999&&money<4999)
return jum[idx][mone... | ALGO | 0.999807 | 3.075909 |
8a8fcea5-7fad-4704-b5ae-120c84c3fa1c | Chan531/BaekJoon_Online_Judge | driip.cpp | #include <iostream>
#include <string>
using namespace std;
int main(void)
{
string str;
cin >> str;
if (str.length() >= 5 && str.substr(str.length() - 5, 5) == "driip")
cout << "cute";
else
cout << "not cute";
return 0;
} | ALGO | 0.945415 | 3.914053 |
395668ef-220a-4717-a2b9-54ab90ce76ac | Ajaynyol774/DSA_ass | 16heapify.cpp | #include <iostream>
#include <vector>
using namespace std;
void heapify(vector<int>& arr, int n, int i) {
int largest = i;
int left = 2 * i + 1;
int right = 2 * i + 2;
if (left < n && arr[left] > arr[largest])
largest = left;
if (right < n && arr[right] > arr[largest])
largest ... | ALGO | 0.999946 | 5.89479 |
c49c9bb7-04ae-48f3-b183-75051bf241f9 | Nadinerodriguez/cpp | shortestPath.cpp | #include<iostream>
using namespace std;
const int rows = 5;
const int cols = 6;
int toPath[] = {6};//array for path
struct memoarray {
int value;
int direction;
};
memoarray memo[rows][cols] = {0};
int cost(int i, int j) {
int weight[rows][cols] = {
{3,4,1,2,8,6},
{6,1,8,2,7,4},
{5... | ALGO | 0.999969 | 3.597654 |
3aabb439-8bb6-40b5-bd9b-da260bda8fca | beomjunlim/codetree-TILs | 240628/돌 잘 치우기/clear-stones-well.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
int n,m,k;
int ans = 0;
int arr[101][101];
bool visited[101][101];
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};
vector<pair<int,int>> start;
vector<pair<int,int>> rock;
int rock_arr[9];
bool InRange(in... | ALGO | 0.999854 | 3.697322 |
14afb7ff-fe2e-4f57-ab58-952192f03eb9 | vfolunin/archives-solutions | Kattis/bungeejumping.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
bool solve() {
double k, l, h, m;
cin >> k >> l >> h >> m;
if (!k && !l && !h && !m)
return 0;
double g = 9.81, v;
if (l >= h) {
v = sq... | ALGO | 0.999911 | 4.087494 |
cc325e61-0509-4a83-8813-d49546b221f0 | hameem008/Competitive_Programming | Codeforces_and_others/TheGoodArray.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define gap ' '
typedef long long ll;
typedef long double lld;
const ll infinite = INT64_MAX;
void solve(int I, int T)
{
ll i, j, k, a, b, c, d, m, n, p, q;
bool flag;
// solve starts
cin >> n >> k;
vector<ll> v(n + 1, 0);
v[1] = v... | ALGO | 0.999605 | 3.317791 |
e55640c5-d7ea-4ba2-88e0-2604ada064ee | NITIN-ME/C_Plus_Plus_STL | stack_stl.cpp | #include<iostream>
#include<stack>
using namespace std;
int main(){
stack<int> s;
s.push(1);
s.push(2);
s.push(3);
s.push(4);
s.push(5);
s.push(6);
s.push(7);
s.push(8);
cout<<"size: "<<s.size()<<endl;
while(!s.empty()){
cout<<s.top()<<" ";
s.pop();
}
... | ALGO | 0.994528 | 4.039967 |
e701f13a-d81b-4b4a-87c9-5839d90382fc | Haribala-09/hyprdots | User/History/-6c266b47/pOfL.cpp | #include <bits/stdc++.h>
using namespace std;
// 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, TreeN... | ALGO | 0.99998 | 5.049134 |
85b4449f-ac75-4e96-863f-56ccdac74589 | QuantumBird/ACM_Team | gjz/contests/A.cpp | #include <iostream>
using namespace std;
int main(){
int T;
cin>>T;
while(T --){
int a, b;
cin>>a>>b;
cout<<(a & b)<<endl;
}
return 0;
} | ALGO | 0.999874 | 4.523707 |
7a3ab441-db3f-4925-96e3-7c8da1c23afa | MadoScientist97/leetcode_solutions | med/1770.maximum-score-from-performing-multiplication-operations.cpp | /*
* @lc app=leetcode id=1770 lang=cpp
*
* [1770] Maximum Score from Performing Multiplication Operations
*
* https://leetcode.com/problems/maximum-score-from-performing-multiplication-operations/description/
*
* algorithms
* Medium (34.88%)
* Total Accepted: 40.1K
* Total Submissions: 115.4K
* Testcase E... | ALGO | 0.999985 | 6.258329 |
12db74a8-776e-4347-a608-76e196ea2bbb | TranNguyenDo/DoTranNguyen_monC | Chapter 12/Programming Challenges_12.15.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
int main() {
ifstream inputFile("text.txt");
if (!inputFile) {
cerr << "Error: Unable to open the file for reading." << endl;
return 1;
}
string line;
vector<string> ... | TOOL | 0.961429 | 5.275302 |
86257adf-3ab5-4b2b-b924-17692ef07d07 | bjh5098/2019_CSE4007_12852 | assignment4/z3-master/z3-master/src/math/grobner/grobner.cpp | #include "math/grobner/grobner.h"
#include "ast/ast_pp.h"
#include "ast/ast_ll_pp.h"
#include "util/ref_util.h"
// #define PROFILE_GB
grobner::grobner(ast_manager & m, v_dependency_manager & d):
m_manager(m),
m_dep_manager(d),
m_util(m),
m_var_lt(m_var2weight),
m_monomial_lt(m_var_lt),
m_chang... | ALGO | 0.997497 | 4.507411 |
aa34389b-2bdc-488c-9f80-d6dd2aa4428a | ku3i/simloidTCP | src/basic/common.cpp |
#include "./common.h"
void common::normalizeVector3 (double v[3])
{
double len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
if (len <= 0.0) {
v[0] = 1;
v[1] = 0;
v[2] = 0;
}
else {
len = 1.0 / (double) sqrt(len);
v[0] *= len;
v[1] *= len;
v[2] *= len;
... | TOOL | 0.966337 | 4.393632 |
9aee3a35-7db0-4a3a-b961-8255cce57a1e | zeusptit/Hackerrank | 1D Array/23. Trộn 2 dãy và sắp xếp.cpp | #include <bits/stdc++.h>
using namespace std;
#define quick() ios_base::sync_with_stdio(false); cin.tie(0);
using ll = long long;
int main()
{
quick();
int n;cin >> n ;
int a[n],b[n];
for(int i = 0; i < n; i++)cin >> a[i];
for(int i = 0; i < n; i++)cin >> b[i];
sort(a,a + n);
sort(b,b + n... | ALGO | 0.999926 | 3.000354 |
a5686b16-e6f6-42eb-9b79-90bcbf5075e4 | tr0j4n034/SPOJ | DOSA.cpp | /*
O(N * log(N)) solution via Fenwick tree
The main idea is that if we are keeping the original
elements at positions i and j, then there should be enough gap
to place between these elements: data[j] - data[i] >= j - i
Or data[j] - j >= data[i] - i.
Therefore, subtract index value from each element where it wi... | ALGO | 0.999869 | 4.272533 |
b56a504b-dcb2-4516-b11a-26c1783baf49 | xiaoxistudy/work | av/media/libstagefright/codecs/amrnb/enc/src/inter_36.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/inter_36.c
Date: 01/31/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description:
1. Eliminated unused include files.
... | ALGO | 0.999484 | 5.636782 |
8bf63372-ae3b-4677-a971-971461f9b0eb | antichambre/MIOS32 | apps/synthesizers/midibox_sid_v3/juce/JuceLibraryCode/modules/juce_core/maths/juce_BigInteger.cpp | namespace
{
inline size_t bitToIndex (const int bit) noexcept { return (size_t) (bit >> 5); }
inline uint32 bitToMask (const int bit) noexcept { return (uint32) 1 << (bit & 31); }
}
//==============================================================================
BigInteger::BigInteger()
: numValues (4... | TOOL | 0.97911 | 7.464003 |
fd9d0317-f273-4c5a-8983-a6b0480a559e | nvnnv/Leetcode | 230. Kth Smallest Element in a BST.cpp | void xoo(TreeNode* cur, int& mi, int& k, int& x, int& _k, bool& openOr)
{
if(cur == nullptr) return;
if (mi > cur->val)
{
mi = cur->val;
k = 1;
x = cur->val;
}
if(openOr) xoo(cur->left, mi, k, x, _k, openOr);
if (k > 0)
{
if (k == _k)
{
ope... | ALGO | 0.999998 | 5.11135 |
ef3b9ba7-ad09-446b-ad67-911d05e64a28 | adi-rajput/learning-cpp | bubble_sort.cpp | // #include <iostream>
// using namespace std;
// int main() {
// int n,count=0;
// cin>>n;
// int arr[n];
// for(int i=0 ; i <n ; i++)
// {
// cin>>arr[i];
// }
// for (int i = 0; i < n - 1; i++) {
// for (int j = 0; j < n - i - 1; j++) {
// if (arr[j] > arr[j+... | ALGO | 0.999953 | 4.889946 |
8a7333c8-6550-4fda-911c-6308999710d6 | EthanKim8683/High-School-Competitive-Programming | Codeforces/Problemset/Graphs/232a.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
using I=int;
using B=bool;
const I K=1e5;
const I N=100;
B adjs[N][N];
I main(){
cin.tie(0)->sync_with_stdio(0);
I k;cin>>k;
I tot=0;
for(I i=0;i<N;i++){
for(I j=0;j<i;j++){
I cur=0;
for(I k=0;k<N;k++){
if(... | ALGO | 0.999527 | 3.291242 |
729ae940-6e48-415a-bccf-1ed52509d431 | Md-razvi/DSA-Sol-C-plus | three.cpp | #include <iostream>
using namespace std;
int main(){
int a;
cin >>a;
if(a>0)
{
cout<< a << " Is a positive number" << endl;
}
else {
cout<< a << " Is a negative number" << endl;
}
} | ALGO | 0.999256 | 3.588332 |
b2ded069-33ff-428e-9763-f7baca7530a1 | yaaaToT/test | src/module/buff/Detector/BuffArmor.cpp | #include "../../../../include/module/buff/Detector/BuffArmor.hpp"
#include "../../../../include/module/buff/Detector/Detector.hpp"
#include <array>
#include <iostream>
#include <cmath>
#include <opencv2/core/mat.hpp>
#include <opencv2/core/types.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#inclu... | TOOL | 0.872894 | 3.948807 |
24b851fc-a301-473a-afc1-3e44e746c238 | Fisher87/leetcode | cplus/special-array-with-x-elements-greater-than-or-equal-x.cpp | // Time: O(n)
// Space: O(1)
// counting sort solution
class Solution {
public:
int specialArray(vector<int>& nums) {
static const int MAX_NUM = 1000;
vector<int> count(MAX_NUM + 1);
for (const auto& num : nums) {
++count[num];
}
for (int n = size(nums), i = 0; ... | ALGO | 0.999888 | 6.045142 |
86e04ef5-891b-48df-8e68-77a4e9e61a65 | AbhipsaGuru1012/CrackYourPlacement | Day 27/binary-tree-level-order-traversal.cpp | // link: https://leetcode.com/problems/binary-tree-level-order-traversal/submissions/
/**
* 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)... | ALGO | 0.999885 | 6.515169 |
08d22ac2-2a44-485d-9acb-c34d144401eb | weeebdev/contests | 1859A.cpp | // Bismillahir Rahmanir Rahim
// chrono::system_clock::now().time_since_epoch().count()
#include <bits/stdc++.h>
#include <iostream>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define rep(i, a, ... | ALGO | 0.999654 | 3.838418 |
908696cc-39c6-41a6-b80f-ad900d6a1100 | ishandutta2007/codeforces | origenes/normal/1163/C1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#de... | ALGO | 0.999776 | 4.105986 |
4a8e0ccd-8413-4fbe-8c00-408b9a0cb666 | LuciferWin/Level_0 | C++/array2.cpp | #include <iostream>
using namespace std ;
int main () {
int mark [ 5 ] ={ 100 , 90 , 50 , 40 , 80 } ;
int m = mark [ 0 ] ;
cout << "m : " << m << endl ;
cout << mark [ 1 ] << endl ;
cout << mark [ 2 ] << endl ;
cout << mark [ 3 ] << endl ;
cout << mark [ 4 ] << endl ;
mark [ 4 ] =... | ALGO | 0.99728 | 3.048882 |
2ee76cfb-8b64-44b3-a12b-f7af81286d40 | Kochq/unnoba | pi/unidad4/tp4/ej12.cpp | #include <iostream>
int sumarPares(int arr[], int length, int index = 0, int suma = 0) {
if(index == length) return suma;
if(arr[index] % 2 == 0) suma += arr[index];
return sumarPares(arr, length, index+1, suma);
}
int main() {
int arr[] = {1,2,3,4,5,6,7};
std::cout << sumarPares(arr, 7);
return 0;
}
| ALGO | 0.969916 | 4.819664 |
50b5e789-2003-457a-b41b-0afd71f05a7f | EXPLORATIONSSS/mandelbrot | main.cpp |
#include <iostream>
#include<cstdint>
#include <memory>
#include "Mandelbrot.h"
#include "Bitmap.h"
using namespace std;
using namespace caveofprogramming;
int main() {
int const WIDTH=800;
int const HEIGHT=600;
Bitmap bitmap(WIDTH,HEIGHT);
double mini=999999;
double maxi=-999999;
unique_ptr<int[]> hi... | ALGO | 0.986725 | 5.29458 |
ba26d234-989a-47c0-8d29-cf8cf4786a0f | chaubey12/code_practice | epi_cpp/16_HonorsClass/37_critical_height.cpp | #include <iostream>
#include <vector>
using namespace std;
int GetHeightHelper(int cases, int drops, vector<vector<int>>* F){
if(cases == 0 || drops == 0){
return 0;
}else if(cases == 1){
return drops;
}else{
if((*F)[cases][drops] == -1){
(*F)[cases][drops] = GetHeightH... | ALGO | 0.999382 | 5.015639 |
fbf8934e-4de9-4a36-9586-ae629fd8ae0e | hjiang13/LLMs-in-IR | POJ-104/11/150.cpp | #include <iostream>
using namespace std;
int main()
{
int a[13]={
0,31,28,31,30,31,30,31,31,30,31,30,31}
;
int mun,day,year,i;
int days=0;
cin >> "%d%d%d",&year,&mun,&day);
days+=day;
for(i=1; i<mun; i++)
{
days+=a[i];
if(year%4==0&&year%100!=0||year%400==0)
days+=1;
}
cout << "%d",days);
return 0;
} | ALGO | 0.999807 | 3.711921 |
ca8fcbd7-792b-40a0-b0a0-44aca36b37ae | CGAL/cgal-dev | Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/algorithm.h>
#include <CGAL/convex_hull_3_to_face_graph.h>
#include <list>
typedef CGAL::Exact_predicates_inexact_constructions_... | ALGO | 0.99931 | 6.444261 |
151b168f-e88c-48f3-b5e9-19780d361bdb | lbzzz1016/llvm-target | Mips/MipsAnalyzeImmediate.cpp | #include "MipsAnalyzeImmediate.h"
#include "Mips.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <cstdint>
#include <iterator>
using namespace llvm;
MipsAnalyzeImmediate::Inst::Inst(unsigned O, unsigned I) : Opc(O), ImmOpnd(I) {}
// Add I to the instruction sequences.
void MipsAnalyzeImmediate::A... | ALGO | 0.981892 | 6.573182 |
0b916acd-fb3e-42e7-878a-5a791aa19286 | amankum199/Assignment-c-plus-plus | assignment24/cp10.cpp | /*Write functions using function overloading to add two numbers having different data
types*/
#include <iostream>
using namespace std;
int sum(int, int);
float sum(float, float);
float sum(int, float);
int sum(int a, int b){
return a+b;
}
float sum(float a, float b){
return a+b;
}
float sum(int a, float b){
... | ALGO | 0.865047 | 5.176865 |
e2cdd7fb-4996-47b5-89e1-cfb499ea0a42 | SiYouDi/xdoj | 完全平方数.cpp | #include<math.h>
#include<stdio.h>
int main()
{
int m,n;
scanf("%d",&m);
n=sqrt(m);
if(n*n==m)
{
printf("%d",n);
}
else
{
printf("no");
}
return 0;
}
| ALGO | 0.99998 | 3.890822 |
cceec311-994a-4d32-891a-d9f7d5955046 | himanshu-14/solutions | CPP CODE/levelordertraversal.cpp | //level order traversal of binary tree with queue using stl
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
};
void levelOrderTraverse(Node *root)
{
if (root == NULL)
return;
queue<Node *> qOfNodes;
qOfNodes.push(root);
while (!qOfNodes.... | ALGO | 0.99989 | 5.127788 |
a115eb12-61a0-409a-afba-333268f98156 | PriyanshK09/Leetcode-Discord-Bot | solutions/number-of-distinct-substrings-in-a-string.cpp | // Time: O(n^2)
// Space: O(t), t is the number of trie nodes
class Solution {
public:
int countDistinct(string s) {
vector<array<int, 26>> trie(1);
for (int i = 0; i < size(s); ++i) {
int curr = 0;
for (int j = i; j < size(s); ++j) {
if (!trie[curr][s[j] - ... | ALGO | 0.999992 | 5.955726 |
0b58a502-ac47-4cea-9a4e-74b455d01bf9 | ishandutta2007/codeforces | aropan/normal/1152/D.cpp | #include <iostream>
#include <cstdio>
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
#define dbg(x)... | ALGO | 0.999966 | 3.603792 |
bc48060a-044e-451d-af38-473eb8660f48 | ishandutta2007/codeforces | anadi/normal/1028/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long long int LL;
#define st first
#define nd second
#define pb push_back
#define PLL pair <LL, LL>
#define PII pair <int, int>
const int N = 207;
const int MX = 1e9 + 7;
const LL INF = 1e18 + 9LL;
int n, m;
char s[N][N];
int main(){
scanf("... | ALGO | 0.99992 | 3.525836 |
bd370ed6-d6e4-4d43-8e30-1ee6705902d2 | FlyingWing12138/cppPrimerPlusCode | chapter07-function/7-12-exercise/7-12-7.cpp | // arrfun3.cpp -- array functions and const
#include <iostream>
const int Max = 5;
// function prototypes
double * fill_array(double * ar, int limit);
void show_array(const double * ar, const double * endPtr); // don't change data
void revalue(double r, double * ar, const double * endPtr);
int main()
{
using name... | TOOL | 0.99733 | 5.736034 |
288eead7-60e0-4959-b3ed-803dd40fa277 | redwraithx/Cpp_Beginner_And_Beyond | LearningCPP/105_FunctionParametersAndReturnStatements/main.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
void pass_by_value1(int num);
void pass_by_value2(string s);
void pass_by_value3(vector<string> v);
void print_vector(vector<string> v);
void pass_by_value1(int num)
{
num = 1000;
}
void pass_by_value2(string s)
{
s = "Changed";
}
... | TOOL | 0.96643 | 4.684238 |
e26a6cb3-fd82-4bca-b755-ef3dad0f00d8 | strikermx/BOT | AS/script-launcher/core.cpp | #include <vector>
#include "utils.h"
using namespace std;
#define DEFAULT_ACTIVEPERL_BIN_PATH "C:\\Perl\\bin"
static const char *launchers[] = {
"start.exe",
"wxstart.exe",
"korebin.exe",
NULL
};
/**
* Find Perl in one of the directories in the PATH
* environment variable. This function guarantees that
* it ... | TOOL | 0.926517 | 6.031858 |
7922f548-a0a7-4992-b452-d6581094d373 | sonbipayacctu10namtrc/abc | engine.cpp | // engine.cpp
#include "connect4_algorithm.hpp" // định nghĩa Solver, Position, v.v. :contentReference[oaicite:0]{index=0}:contentReference[oaicite:1]{index=1}
#include <string>
#include <vector>
// g++ -O3 -std=c++17 -shared -static -static-libgcc -static-libstdc++ -lwinpthread engine.cpp Solver.cpp -o connect.... | ALGO | 0.99852 | 4.864774 |
60edaa1f-30d4-4a8d-9b81-4ee6c099e357 | 3gx/bonsaiRender | cvt2grid/cvt2grid.cpp | #include "BonsaiIO.h"
#include "IDType.h"
#include "Tree.h"
typedef float float5[5];
typedef float float4[4];
typedef float float3[3];
typedef float float2[2];
std::vector<Particle> Node::ptcl;
std::vector<Node> Node::Node_heap;
std::vector<std::pair<Node*, Node*> > Node::pair_list;
static double read(
const ... | DATA | 0.854779 | 5.294805 |
fe0b6bc2-2bad-4e96-86e0-d1b2d2c782d0 | hhsjsth/leetcode_cpp | 74.搜索二维矩阵-3.cpp | /*
* @lc app=leetcode.cn id=74 lang=cpp
*
* [74] 搜索二维矩阵
*/
// 剑指 offer 1
// @lc code=start
// 参考 LeetCode 官方题解 2 的 C 语言解法写的 C++ 解法, 两次二分查找, 左闭右开
class Solution {
private:
int binarySearchMatrixFirstColumn(vector<vector<int>> &matrix, int target) {
int l = 0, h = matrix.size();
while (l < h) {
... | ALGO | 0.999826 | 6.667318 |
aaca11b2-e37e-4dd4-9522-39dca161951d | Ahmed-Araby/Algorithms_and_Data_Structures | Graph/finding all negative cycles in a directed graph.cpp | #include <iostream>
#include <vector>
#include <utility> // std::pair, std::make_pair
#define pi pair<int , int>
using namespace std;
int getCycleWeight(int s, int e, vector<pi> prev)
{
int totWeight = 0;
while (s != e)
{
pi tmp = prev[s];
int w = tmp.second;
s = tmp.first;
totWeight += w;
}
return... | ALGO | 0.999971 | 4.277482 |
303f9348-d444-4862-a09f-cde1fa142b8c | Sid532001/c-c- | inverse.cpp | #include<iostream>
using namespace std;
int main()
{
int n,i,v;
cout<<"enter the number of elements:";
cin>>n;
cout<<"enter the elements:";
int a[n];
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
int v=a[i];
a[v]=i;
}
for ( i = 0; i < n; i++)
... | ALGO | 0.999864 | 3.492122 |
9c279378-17fc-4623-8acc-0ca5f6327e45 | didrlgus/algorithm-practice | baekjoon/10971.cpp | // 10971. 외판원 순회 2
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int n;
int a[15][15];
int min_=987987987;
vector<int> v;
void func() {
for(int i=1;i<n;i++) v.push_back(i);
do {
int sum=0;
bool flag=false;
for(int i=0;i<n-2;i++) {
if(!a... | ALGO | 0.999968 | 3.255377 |
35a4cb47-4d17-48e3-92db-690e59d44268 | zhang617-creat/zlh | host/lib/usrp/dboard/magnesium/magnesium_bands.cpp | // The band plan
#include "magnesium_constants.hpp"
#include "magnesium_radio_control.hpp"
#include <uhd/utils/math.hpp>
/*
* Magnesium Rev C frequency bands:
*
* RX IF frequency is 2.4418 GHz. Have 80 MHz of bandwidth for loband.
* TX IF frequency is 1.8-2.1 GHz (1.95 GHz is best).
*
* For RX:
* Band ... | ALGO | 0.951792 | 6.379048 |
e5af9b52-6c38-478c-966f-4ceeaaaf5347 | Aniketshah3767/LeetCode-2024 | 0416-partition-equal-subset-sum/0416-partition-equal-subset-sum.cpp | class Solution {
public:
bool isSubsetSum(vector<int>arr, int sum){
// code here
int n=arr.size();
int dp[n+1][sum+1];
for (int i = 0; i <= n; ++i) {
for (int j = 0; j <= sum; ++j) {
if (j > 0 && i == 0)
{
dp[i][j] = f... | ALGO | 0.999929 | 5.750612 |
ac5761c8-0e21-49cb-b41c-5e7100767522 | valentina-zhekova/Hack-Bulgaria-Algo-1 | week3/BirthdayRanges2/birthday_ranges.cpp | /*
Birthday ranges:
Starts with a vector of people's birthdays
(numbers in the range 0-365) and can execute the following commands:
add [day] [number_of_people] - adds number_of_people new people who have birthdays on the day.
remove [day] [number_of_people] - removes number_of_people who have birthdays on the day.
You... | ALGO | 0.99979 | 6.124844 |
d85b23f3-334a-4d54-b3f9-35b4b9d86ad6 | aadityab7/Practice | 1061. Lexicographically Smallest Equivalent String.cpp | //union the elements that belong together
class Solution {
int arr[26] = {};
int find(int num){
if(arr[num] == num) return num;
else return find(arr[num]);
}
void set(int i, int j){
int x = find(i), y = find(j);
int mn = min(x, y);
arr[x] = mn;
arr[y] = ... | ALGO | 0.999964 | 6.244878 |
1eff20f9-5af6-4d16-bfc7-7c12060894ce | sonalibante/ORE | QuantLib/ql/time/calendars/denmark.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <ql/time/calendars/denmark.hpp>
namespace QuantLib {
Denmark::Denmark() {
// all calendar instances share the same implementation instance
static ext::shared_ptr<Calendar::Impl> impl(new Denmark::Impl);
... | ALGO | 0.996194 | 5.955733 |
058bfd83-45f0-4f49-8b87-e2535bb976f5 | harsha20032020/CSES | Maximum_Subarray_Sum.cpp | //TITLE: Maximum_Subarray_Sum.cpp
//AUTHOR: N Harsha Vardhan
//DATE: 2021-08-25
//TIME: 00:33:10
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define F first
#define mp make_pair
#define pb push_back
#define S second
#define FOR(i, a, b) for (int... | ALGO | 0.999981 | 4.661283 |
9206ae97-de3e-4a40-8e93-8596e6bc1d63 | pointer-authentication/pcan-llvm | clang/test/SemaCXX/constexpr-factorial.cpp | // RUN: %clang_cc1 -std=c++11 -fsyntax-only %s
constexpr unsigned oddfac(unsigned n) {
return n == 1 ? 1 : n * oddfac(n-2);
}
constexpr unsigned k = oddfac(123);
using A = int[k % 256];
using A = int[43];
| ALGO | 0.994987 | 6.445701 |
603486c5-340b-4bbb-a306-7f6185911901 | FZU-GummyBear/Dream | Personal_Training/fb/构造/cf1141G_fb.cpp | #include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a... | ALGO | 0.99999 | 4.222436 |
2c2a3149-7ae1-4746-827d-12c87162870f | RajkumarGapat/CPP-Projects-and-Programs | Loop programs in cpp/armStrong.cpp | #include<iostream>
using namespace std;
class Armstrong
{
public:int num,sum=0,res,rem,usernum;
public:Armstrong()
{
cout<<"Enter any three digit number = ";
cin>>num;//7845
usernum=num;
}
void findSum()
{
while(num != 0)
{
rem=num%10;
res=rem*rem*rem;
sum=sum+r... | ALGO | 0.999912 | 4.364919 |
fe13e2b1-96c0-4771-87ef-c073ecd3355f | tllaw/cp | src/codechef/contests/LTIME106D/CREDCOINS.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long t, x, y;
cin >> t;
while(t--) {
cin >> x >> y;
cout << (x * y / 100) << endl;
}
return 0;
}
| ALGO | 0.99814 | 4.576669 |
55466983-8c05-4e78-91fa-9292671abed6 | dharasubhamay/365-Days-CP-Challenge | d4_mergeSortedArray.cpp | //88. Merge Sorted Array
//https://leetcode.com/problems/merge-sorted-array/
class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int endpt = m+n-1;
while(m>0 && n>0)
{
if(nums1[m-1] > nums2[n-1])
{
nums1[endpt] ... | ALGO | 0.999974 | 5.576756 |
b8a64980-d313-4f86-8e77-2079b5e65548 | ANUNAY-NALAM/interview_prep | adjacent nodes.cpp | //adjacent matrix list representation
#include<bits/stdc++.h>
using namespace std;
class Graph{
int nodes;
list<int> *adj;
public:
Graph(int n)
{
this->nodes=n;
adj=new list<int>[nodes];
}
void addEdge(int u,int v)
{
adj[u].push_back(v);
adj[v].push_back(u);
}
void print()
{
for(int i=... | ALGO | 0.99965 | 4.093342 |
25056f87-b312-487a-850c-3e7fef82763e | teaspring/problems | topics/dynamicprogramming/src/longestpath.cpp | /*
*<IntroductionToAlgorithm> chapter15 dynamic programming, exercise 15-1 longest simple path from s to t in a directed acyclic graph
* key words: directed, and acyclic
*
* good DP exercise, alternative to min path we have known already
* prove:
* if the longest path from A to F includes D, assume A->(C)->D->(E... | ALGO | 0.999972 | 4.924992 |
58eb0888-60c9-4618-a1f1-141606cf95d9 | singhsd/SPOJ-Codes | AGGRCOW.cpp | #include<bits/stdc++.h>
using namespace std;
int a[100001],n,c;
int fun(int k)
{
int nc=1,prev=a[0];
for(int i=2; i<n; i++)
{
if(nc==c) break;
if(a[i]-prev>=k)
{
prev=a[i];
nc++;
}
}
if(nc==c) return 1;
return 0;
}
int main()
{
int t;
... | ALGO | 0.999997 | 3.536447 |
84a61cee-705c-4fab-97c3-a932a33c49ea | akhila-pynam/DS-ALGOS | Dynamic Programming/climbing-stairs.cpp | #include <bits/stdc++.h>
using namespace std;
// int climbingStairs(int n, vector<int> dp){
// if( n <= 1 ) return 1;
// if(dp[n] != -1) return dp[n];
// int oneStep = climbingStairs(n-1, dp);
// int twoSteps = climbingStairs(n-2, dp);
// return dp[n] = oneStep + twoSteps;
// }
// Leetcod... | ALGO | 0.999996 | 5.399447 |
907bc599-f3ae-4ead-968d-d3aab9d7e964 | xxEBxx/CP | Book/DAT/uva_1262_pizza.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
string s;
cin>>s;
map<char,int> map1;
int n=s.size();
for(int i=0;i<n;i++){
map1[s[i]]++;
//cout<<"map de "<<s[i]<<"est"<<map1[s[i]]<<endl;
}
int c... | ALGO | 0.999548 | 4.583643 |
74c39942-a1f6-419d-8aee-4b6fd8a6f6ef | Fernandez-17/EJERCICIOS-DE-ARREGLOS-Y-CADENAS-EN-C- | Ejercicio_5_Arreglos.cpp | #include <iostream>
using namespace std;
int main() {
cout << " BIENVENIDO AL PROGRAMA " << endl;
cout << "-------------------------------------------------" << endl;
// Variables
int total_de_numeros;
cout << "Ingrese la cantidad total de numeros por favor: "<<endl;
... | ALGO | 0.999727 | 3.407469 |
758f952d-1e40-485f-bd49-a0491d8226c6 | maria2021831011/codefilecpp | m.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int t;
cin >> t; // Read number of test cases
while (t--) {
int n;
cin >> n; // Read the length of the sequence
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i]; // Read the s... | ALGO | 0.99974 | 6.092993 |
aeae58b6-3d5e-4769-9a9e-cb2bec4c4baa | ajmat6/DSA | L_Construct_the_Minimum_Bitwise_Array_I.cpp | class Solution {
public:
vector<int> minBitwiseArray(vector<int>& nums) {
vector<int> ans;
for(auto i: nums) {
bool found = false;
for(int j=0; j<=i; j++) {
if((j | (j + 1)) == i) {
found = true;
ans.push_back(j);
... | ALGO | 0.999823 | 5.831319 |
96a2ce6f-892a-4d46-87bd-ab5b07547df1 | SVA-BL00/AdvancedAlgorithms | Hash/main.cpp | #include "HashTable.hpp"
using namespace std;
int main(){
int op, num;
HashTable example;
do{
cout << "---EJEMPLO DE HASH TABLE---\n[1] INSERT\n[2] DELETE\n[3] PRINT\n[4] EXIT" << endl;
cin >> op;
switch (op) {
case 1:
cout << "Dime un numero: ";
... | ALGO | 0.929416 | 4.301913 |
91485cc2-e69b-4283-b7f0-d73121853061 | RamanSati/CPP | Codes/Chapter 6 Polymorphism/0_3_array_of_obj_using_pointer.cpp | //Array of objects can be defined as an array that’s each element is an object of the class.
#include<iostream>
using namespace std;
class ShopItem
{
int id;
float price;
public:
void setData(int a, float b){
id = a;
price = b;
}
void getData(void){
... | TOOL | 0.857455 | 4.32763 |
9ddf4991-9193-4c98-92de-0df18908ed92 | chenhui-bupt/leetcode | 172.阶乘后的0.cpp | /*
阶乘后的零
通过数学归纳可以看出,末尾为0主要有5和0决定,而0本质上是5和2决定(每隔一个5就会出现2与5的组合)
而每隔一个25又会出现两个5(即5 * 5,末尾两个0),每隔一个125会出现三个5(即5 * 5 * 5,末尾三个0)
以此类推,res = n / 5 + n / 25 + n / 125 + ...
*/
class Solution {
public:
int trailingZeroes(int n) {
int res = 0;
while (n > 0) {
res += n / 5;
n /= 5;
... | ALGO | 0.999981 | 6.457406 |
695f0903-f168-4fd7-9699-b8b37cd7fe18 | freekdh/popgen-genetic-rescue | Models/BD_Simulations/BDSimulations.cpp | /*=============================================================================================================
BDSimulations.cpp
===============================================================================================================
Simulations of genetic rescu... | ALGO | 0.998952 | 6.472743 |
e224482e-f2c9-4ab5-8a21-06c71ca23267 | YassinHemdan/leetcode | random/235_v1.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:
void getPath(vector<TreeNode*>& path,TreeNode* root, TreeNode* node){
path.push_back(root);
... | ALGO | 0.999979 | 5.999064 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.