uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
28d9fbb6-8272-433e-8aff-1456bfe7e932 | damsehgal/codes | others/minimalSpanningTree.cpp | #include <bits/stdc++.h>
using namespace std;
#define s(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%lld",&n)
#define sf(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
#define forall(i,... | ALGO | 0.999928 | 4.069289 |
0ad45c0b-ebe1-40b7-a287-70dfaebb35f1 | ZehuaZhang/cs-fundamentals | data-structure-and-algorithm/cpp/perfect-rectangle.cpp | // 391. Perfect Rectangle
// Difficulty : Hard
// Given N axis-aligned rectangles where N > 0
// determine if they all together form an exact cover of a rectangular region.
// Each rectangle is represented as a bottom-left point and a top-right point.
// For example, a unit square is represented as [1,1,2,2].
// (co... | ALGO | 0.998418 | 7.44114 |
c1edde0b-7d12-4a14-93db-d284e5087ed8 | feimenggo/flutter_menu_panel | example/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.998771 | 6.797273 |
2873cf05-9ed8-43c7-996d-357b21c4115d | xw6666/c-primer | 第一章练习/test1.4.cpp | //#include <iostream>
//using namespace std;
//#include <string>
//int test1()
//{
// int sum = 0;
// for (int i = -100; i <= 100; i++)
// {
// sum += i;
// }
//
// return sum;
//}
//cinȡһ
//int test2()
//{
// int sum = 0;
// int temp = 0;
// for (int i = 0; i < 5; i++)
// {
// cin >> temp;
// sum += temp;
// }
//... | ALGO | 0.998747 | 3.702133 |
5ab22281-745e-480b-847a-68a9245e5a97 | MayankSaxena2214/LEETHUBV3 | 0086-partition-list/0086-partition-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* partition(L... | ALGO | 0.999997 | 5.436018 |
b57f29a2-4c62-44ea-a931-cc999e0a54b2 | Zannatul-Naim/Competitive-Programming | URI/Beginner/1045.cpp | #include<bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
double a,b,c,temp;
cin >> a >> b >> c;
if(a < b)
{
temp = a;
a = b;
b = temp;
}
if (b < c)
{
temp = b;
b = c;
c = temp;
... | ALGO | 0.999957 | 4.781184 |
522e284d-ce85-4969-a9b5-b762aeeda70b | usatie/csc746-tp-ray-tracing-omp | src/bvh.cpp | #include "bvh.h"
#include "aabb.h"
#include <algorithm>
bvh_node::bvh_node(const std::vector<std::shared_ptr<hittable>> &src_objects,
size_t start, size_t end, double time0, double time1) {
auto objects =
src_objects; // Create a modifiable array of the source scene objects
int axis = ran... | ALGO | 0.998211 | 7.059514 |
11d9ccbe-5aa4-4090-96da-b54811aaed2d | bindaldhara/DSA-Practice | 0416-partition-equal-subset-sum/0416-partition-equal-subset-sum.cpp | class Solution {
public:
bool subsetSum(vector<int>&nums,int n,int sum,vector<vector<int>>&dp) {
if (sum == 0) return true;
if (n == 0)
return false;
if (dp[n][sum] != -1)
return dp[n][sum];
if (nums[n - 1] <= sum)
return dp[n][sum] = subsetSum(nums,n - 1,sum-nums[n - 1],dp) || subsetSum(nums,n ... | ALGO | 0.999947 | 5.768285 |
9f23874a-ffa4-4495-b016-1646cd56949f | looke/CPP_Projects | GeneralMatrix/src/matrix/dynamic/util/DynamicMatrixSingularValueDecomposition.cpp | /*
* DynamicMatrixSingularValueDecomposition.cpp
*
* Created on: 2017324
* Author: looke
*/
#include <dynamic/util/DynamicMatrixSingularValueDecomposition.h>
#include <dynamic/DynamicMatrix.h>
#include <iostream>
#include "math.h"
using namespace std;
/*
* SVDֽ 캯
*/
DynamicMatrixSingularValueDecompositio... | ALGO | 0.998876 | 3.66399 |
4a26dcde-1a11-4c1f-9ed6-9c5b5ab81e5e | adityapranavbhuvanapalli/leetcodes | 140-word-break-ii/word-break-ii.cpp | class Solution {
public:
vector<string> wordBreak(string s, vector<string>& wordDict) {
int n = s.size();
return solve(0, n, s, wordDict);
}
vector<string> solve(int i, int n, string& s, vector<string>& dict) {
if(i >= n)
return {""};
vector<string> res;
... | ALGO | 0.999852 | 6.332629 |
445a62ba-24be-4ca1-8a85-893af4490c42 | wypchlo/school | PAD/labs/lab2/zad2/zad2_input.cpp | #include<iostream>
#include<cstdlib>
#include<ctime>
#include<cmath>
void print_2d_table(float** arr, short height, short width) {
std::cout << std::endl << '[' << std::endl;
for (int y = 0; y < height; y++) {
std::cout << " |";
for (int x = 0; x < width; x++) std::cout << arr[y][x] << '|';
... | ALGO | 0.995676 | 3.970658 |
2b3a75ec-b4ac-4cd7-b6db-72aa5d01b3ac | ishandutta2007/codeforces | shmilyty/normal/1534/D.cpp | #pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
int x=0;
bool flag=1;
char c=getchar();
while(c<'0'||c>'9')
{
if(c=='-')
flag=0;
c=getchar();
}
while(c>='0'&&c<='9')
{
x=(x<<1)+(x<<3)+c-'0';
c=getchar();
}
return (flag?x:~(x-1));
... | ALGO | 0.999985 | 3.608341 |
b7dd634e-4272-46af-be74-3116e69673d8 | vkd01/100-DAYS-of-C0DE | Get_Subscription.cpp | // Life Goes on and you Learn from it !! -Steve Jobs
#include<bits/stdc++.h>
using namespace std;
#define testLoop int t; cin>>t; while(t--)
#define ll long long int
#define loop(k,b,a) for(ll k=b;k<a;k++)
#define rloop(k,b,a) for(ll k=b;k>a;k--)
#define ff first
#define ss second
#d... | ALGO | 0.999581 | 3.523253 |
042f7662-1ff0-4c2b-877e-fd57a8950fd4 | Dongry-96/Algorithm | 프로그래머스/1/42840. 모의고사/모의고사.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> solution(vector<int> answers)
{
vector<int> p1 = {1,2,3,4,5};
vector<int> p2 = {2,1,2,3,2,4,2,5};
vector<int> p3 = {3,3,1,1,2,2,4,4,5,5,};
vector<int> result(3);
vector<int> answer;
for(int i = 0; i < an... | ALGO | 0.99995 | 5.580371 |
b0e79011-2861-4fda-be37-446b23d6f58b | gotoa1234/LeetCodeProblemSolvingBy_C_Double_Plus | Medium/0056.Merge_Intervals.cpp | #include <iostream>
#include <unordered_map>
#include <algorithm>
using namespace std;
namespace Solution56
{
#pragma region Paste to execute
/*
#include "0056.Merge_Intervals.cpp"
using namespace Solution56;
using namespace std;
int main()
{
Solution56::Merge_Intervals useClass;
Solution56::Merge_Interval... | ALGO | 0.999994 | 5.846193 |
75869aeb-91f7-4ffd-a927-f878c09a8bd4 | therohit777/Hacktober_algo_bucket | Stacks and Queues/Reverse_Queue.cpp | // C++ code for reversing a queue
#include <bits/stdc++.h>
using namespace std;
// Utility function to print the queue
void printQueue(queue<long long int> Queue)
{
while (!Queue.empty()) {
cout << Queue.front() << " ";
Queue.pop();
}
}
// Recursive function to reverse the queue
void reverseQueue(queue<long lon... | ALGO | 0.9997 | 5.316603 |
5e498ebb-3b99-429d-9886-f5bd0674ead0 | samyak2405/MY-LeetCoding | 337-house-robber-iii/337-house-robber-iii.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.999931 | 6.418877 |
d490a804-1c1b-462e-9fd7-5906fd07b0e2 | Harishi0375/Fundamentals | Bachelors/Algorithm_and_data_structures/CODES/sorting_algorithm/merge_sort/example1.cpp | #include <iostream>
#include <vector>
void merge(std::vector<int>& arr, int l, int m, int r) {
int n1 = m - l + 1;
int n2 = r - m;
std::vector<int> L(n1), R(n2);
for (int i = 0; i < n1; ++i)
L[i] = arr[l + i];
for (int j = 0; j < n2; ++j)
R[j] = arr[m + 1 + j];
int i = 0, j =... | ALGO | 0.999996 | 6.157422 |
119bb15d-3504-40d0-9b34-998f05464840 | kishanrajput23/Coding-Buddies-Community-Contributions | Love_Babbar_DSA_busted.c/array/find_whether_an_array_is_a_subset_of_another_array.cpp | #include <bits/stdc++.h>
using namespace std;
// write a program to know whether an array is subset of another array
// approach 1:
// time compelxity: O(N^2)
// space complexity: O(1)
// approach 2 :
// algor : sort them and use the binary search.
// time complexity: O(Nlog(N)+ Mlog(M))
// space compelxity: O(1)
... | ALGO | 0.999938 | 4.73763 |
8b407cdb-fd6e-431e-b6b4-20db647427bd | rodribat/ctci | lc/july/island_perimeter.cpp |
/*
Island Perimeter
Link: https://leetcode.com/explore/challenge/card/july-leetcoding-challenge/544/week-1-july-1st-july-7th/3383/
*/
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
int countNeighbors(int lin, int col, const vector<vector<int>>& grid)
{
retu... | ALGO | 0.999913 | 5.986577 |
99e83ce7-110d-4980-8f20-4a1914038e0a | DevOpsAraj/Striver-SDESheet-Challenge2023 | 81_maximumXORWithanElementFromArray.cpp | // Code Studio - Maximum XOR with an Element From Array
#include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *child[2];
Node(int data)
{
this->data = data;
for (int i = 0; i < 2; i++)
{
child[i] = NULL;
}
}
};
class Trie
{
p... | ALGO | 0.999945 | 5.10674 |
6458b3d7-1c74-488a-b71e-c00172e04de1 | AshishS-1123/Data-Structures | Linked_List/Singly_Linked_List/reverse_list.cpp | #include <iostream>
#include <stack>
using namespace std;
/*
Function: reverse_list
Args: head -> head pointer of list to be reversed
Desc: Reverses the given list and returns it
Returns: new_head -> head pointer to the reversed list
*/
node* reverse_list(node* head)
{
// create a stack to keep track of items pre... | ALGO | 0.999885 | 5.635325 |
cf149968-f4f4-409c-87eb-e23d8035996b | andreaswanninger/Kratos_conservative_levelset-contact_line | applications/OptimizationApplication/custom_utilities/filtering/integrated_neareset_entity_explicit_damping.cpp | // System includes
#include <numeric>
// Project includes
#include "includes/model_part.h"
#include "expression/literal_flat_expression.h"
#include "utilities/model_part_utils.h"
// Application includes
#include "custom_utilities/optimization_utils.h"
// Include base h
#include "integrated_neareset_entity_explicit_d... | ALGO | 0.999092 | 7.57076 |
fcf728b8-754d-481d-840d-429f8f1fabf3 | Pan-Peach/My-code | cpp/luogu/P3366.cpp | #include<bits/stdc++.h>
using namespace std;
class DSU{
public:
vector<int> pa;
DSU(int n){
pa.resize(n+1);
for(int i=0;i<=n;i++){
pa[i] = i;
}
}
int find(int x){
if(pa[x] == x){
return x;
... | ALGO | 0.999949 | 4.231776 |
6f246c29-8c27-4708-9acc-505d0c2d510b | Mulab11/cntt2016-hw1 | TC-SRM-563-div1-300/WrongAnswer.cpp | #include <string>
#include <cstdio>
using namespace std;
class FoxAndHandle{
public:
string lexSmallestName(string S){
string H;
int n=S.length(),c[26]={0},g[26]={0},q[26]={0},l=0,r=0,tot=0;
bool flag=0;
for(int i=0;i<n;i++)c[S[i]-='a']++;
for(int i=0;i<26;i++)tot+=(g[i]=c[i]/2);
while(tot--){
for(;r<n&... | ALGO | 0.999968 | 3.645676 |
e194b8db-a767-483a-895c-6ca49e393720 | paka-00/atcoder | submissions/typycal90/001.cpp | #include <bits/stdc++.h>
#include <cassert>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using namespace std;
using ll =long long;
#define rep(i, n) for (ll i = 0;... | ALGO | 0.99997 | 3.238744 |
1b8657e2-52ab-4a98-86eb-acb76e1dd5c8 | John-PS3/RPCPS3 | 3rdparty/llvm/llvm/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter>
// requires ShuffleIterator<Iter> && LessThanComparable<Iter::value_type>
// constexpr void // constexpr in C++20
// make_heap(Iter first, Iter last, Compare comp);
#include <algorithm>
#include <cassert>
#include <functional>
#include "test_macros.h"
#inc... | TEST | 0.915759 | 6.653802 |
c457070f-3f64-448c-af04-922387f142bc | sangyun01/Data_Structure | final_exam_code/ch.7.cpp | #include <iostream>
#include <list>
typedef std::list<Position> PositionList;
typedef int Elem;
class LinkedBinaryTree {
protected:
struct Node {
Elem elt;
Node *par;
Node *left;
Node *right;
Node() : elt(), par(NULL), left(NULL), right(NULL) {}
... | ALGO | 0.999075 | 4.153674 |
f903b585-b335-4ec5-871a-442143f4bc6b | Beman/boost-trunk-git-svn | libs/graph/example/edge-function.cpp | using namespace boost;
template < typename Graph, typename VertexNamePropertyMap > void
read_graph_file(std::istream & graph_in, std::istream & name_in,
Graph & g, VertexNamePropertyMap name_map)
{
typedef typename graph_traits < Graph >::vertices_size_type size_type;
size_type n_vertices;
typena... | ALGO | 0.963453 | 5.35629 |
6a4801e5-2272-437c-b484-b75d616e2444 | seclab-ucr/IncreLux | llvm/llvm-9.0.0.src/lib/CodeGen/MachineDominanceFrontier.cpp | #include "llvm/CodeGen/MachineDominanceFrontier.h"
#include "llvm/Analysis/DominanceFrontierImpl.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/Passes.h"
using namespace llvm;
namespace llvm {
template class DominanceFrontierBase<MachineBasicBlock, false>;
template class DominanceFrontierBase<M... | ALGO | 0.98923 | 7.476534 |
170e62d0-7206-40ca-86e7-01ba209cd9b5 | fscdc/Parallel-Lab | LAB1/windows/2-conbine-common-recursion.cpp | #include <iostream>
#include <windows.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
int a[262200], sum;
// ʼ
void init(int n) {
for (int i=0; i<n; i++) {
a[i] = i;
}
}
// ƽ㷨
void common(int n) {
// #pragma UNROLL(4)
for (int i=0; i<n; i++) {
sum += a[i];
}
}
// ˫... | ALGO | 0.998946 | 3.140306 |
e4976042-d66e-4f21-bef3-0338bee58d84 | mateusedival/AdventOfCode | 2020/9_2.cpp | #include <iostream>
#include <deque>
#include <set>
int main()
{
long long x;
std::deque<long long> s;
while(std::cin >> x)
{
s.push_back(x);
}
for (int z = 0; z < (int)s.size(); z++)
{
int soma = s[z];
std::set<long long> c;
c.insert(s[z]);
for (int j = z+1; j < (int)s.size(); j++)
{
soma+=s... | ALGO | 0.999096 | 3.676507 |
e2eb06c0-7dbd-41e7-b29b-8a3d200fcf3a | fxsound2/fxsound-app | audiopassthru/src/pstr/pstr.cpp | #include "codedefs.h"
/* Standard includes */
#include <windows.h>
#include <winbase.h>
#include <dos.h>
#include <conio.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "slout.h"
#include "pstr.h"
#include "pt_defs.h"
/*
* FUNCTION: pstrCalcLocationOfCharInStr()
* DESCRIPT... | TOOL | 0.957196 | 4.696589 |
a5dc360c-7430-47ff-ad86-3a9a0eb001a1 | REXWindW/ACM_CODES_NEW | 20summer/hdu/2020 Multi-University Training Contest 7/Game2.cpp | #pragma GCC optimize(2)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-m... | ALGO | 0.999658 | 3.909936 |
064e9865-572b-49be-a4b5-19fadcc59c29 | 1337DaKL/Bai_Tap_C_Plus_Plus | cpp01test1/chusodunggiualonnhat.cpp | #include <bits/stdc++.h>
using namespace std;
bool ok(int n)
{
int maxo = INT_MIN, dem = 0;
int o = n;
while (n)
{
int m = n % 10;
maxo = max(maxo, m);
dem++;
n /= 10;
}
int demm = 0, nho = 0;
while (o)
{
demm++;
if (demm == dem / 2 + 1)
... | ALGO | 0.999965 | 3.724413 |
477b9bc1-13c0-4624-99c2-ad203b192eae | jnava1612/Teambook-Sindicato-de-Transporte-2880 | DP/atcoder/Y - Grid 2.cpp | const int md = 1e9 + 7, mxN = 2e6+6;
int F[mxN], I[mxN];
int exp(int x, int y, int md){
int ans = 1;
x = x%md;
while (y > 0) {
if (y&1)
ans = ans*x%md;
y = y>>1;
x = x*x%md;
}
return ans;
}
int C(int n, int k) {
if (k > n) return 0;
return F[n] * I[k] % m... | ALGO | 0.999992 | 4.841968 |
01d2ceb8-1827-4686-ac72-3a2766d8900b | rakibislam1996/Competitive-Programming | Online Judges/SPOJ/PRINT - Prime Intervals.cpp | #include<bits/stdc++.h>
#define mem(x,y) memset(x,y,sizeof(x))
#define all(v) (v).begin(),(v).end()
#define vSort(v) sort(all(v))
#define maxSort(v) sort(all(v),greater<int>())
#define sqr(x) ((x)*(x))
#define deci(n) cout<<fixed<<setprecision(n)
#define For(i,k,n) fo... | ALGO | 0.997711 | 3.790173 |
b9b8f0f5-5759-4c7e-bb50-9104c522285c | enihsyou/C-Learning-Exercises | 分离整数的各个数位.cpp | #include <iostream>
using namespace std;
int main() {
int input;
cin >> input;
int hundred = input / 100;
int dec = input % 100 / 10;
int unit = input % 100 % 10;
cout << hundred << endl << dec << endl << unit;
return 0;
} | ALGO | 0.987276 | 3.777137 |
576e9209-8cf1-4571-be1a-0ff8b10ba544 | gopoma/competitive-programming | events/18IEEExtreme/KingsOrder.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 0
#define chk(...) 0
#define RAYA 0
#endif
const auto beg_time = std::chrono::high_resolution_clock::now();
double time_elapsed() { return chrono::duration<double>(std::chrono::high_re... | ALGO | 0.999988 | 4.617723 |
84c06503-182d-4782-835e-c68c128463e3 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5268_16.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m, q, flag[15][100005];
int l, r;
struct Node {
int l[15], r[15];
int sum;
};
Node tree[500005];
Node ans;
int fa[2000005];
int getfa(int x) {
if (fa[x] != x) fa[x] = getfa(fa[x]);
return fa[x];
}
Node update(Node lson, Node rson, int l, int mid, int r) {
N... | ALGO | 0.999955 | 4.076385 |
c7d2afc0-b2a9-47f3-83ef-f66c18354a56 | Kamna16/DSA-codes | Trees/MaxDepthOfTree.cpp | #include<bits/stdc++.h>
using namespace std;
class TreeNode {
public:
int data;
TreeNode* left;
TreeNode* right;
TreeNode() {
}
TreeNode(int data) {
this->data = data;
}
TreeNode(int data, TreeNode* left, TreeNode* ri... | ALGO | 0.999644 | 5.768504 |
ddbec08f-a04f-4f66-a47c-501c39c969f5 | ishank007/Data-Structures-Codes | recursion/recursion_tail_head.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
void fun(int k){
if(k>0){
fun(k-1);
cout<<k<<endl;
}
}
int main(){
int x=3;
fun(x);
}
| ALGO | 0.999956 | 4.020137 |
958fd850-ab97-4373-b01a-0f482e3c77e0 | Kunal3453/GfgSolutions | Hard/Allocate minimum number of pages/allocate-minimum-number-of-pages.cpp | //{ Driver Code Starts
// Initial template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template in C++
class Solution
{
public:
int func(int A[],int n,int mid)
{
int stu=1;
long long pages=0;
for(int i=0;i<n;i++)
{
... | ALGO | 0.999963 | 6.567247 |
b8d12e26-c027-4a91-9692-7e91e4095605 | LINMOH/algo_code | code/P5736.cpp | #include<iostream>
#include<cmath>
using namespace std;
int nums[10005];
bool isZh(int n)
{
if (n < 2) return 0;
for (int i = 2; i * i <= n; i++)
if (n % i == 0) return 0;
return 1;
}
int main()
{
int n = 0;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> nums[i];
... | ALGO | 0.999943 | 3.356206 |
2915a17b-80af-452d-aa7b-aa58a807b1a7 | igorjoz/cpp-course | !!!!!! algorithms/pierwiastek - metoda połowienia.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
double n, eps, a, b;
cout << "liczba do pierwiastokowania: ";
cin >> n;
cout << "Jaka ma być dokładność? ";
cin >> eps;
a = 0;
b = n;
while (abs(b - a) > eps) {
double c = (a + b) / 2;
if (c * c >... | ALGO | 0.999929 | 4.403181 |
5d1b296d-4508-4438-b790-883aef5fa8d7 | Fly0307/dtee_ncnn_face_recognition | src/host/secure/secure_include/ncnn.x64/layer/argmax.cpp | #include "argmax.h"
#include <functional>
namespace ncnn {
ArgMax::ArgMax()
{
one_blob_only = true;
}
int ArgMax::load_param(const ParamDict& pd)
{
out_max_val = pd.get(0, 0);
topk = pd.get(1, 1);
return 0;
}
int ArgMax::forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const
{
... | ALGO | 0.982217 | 5.784177 |
edd1a1f8-46e1-4398-82e5-8ad85aa9b389 | Gamer64ytb/Yuzu-Backup | citra-master/src/core/arm/skyeye_common/armsupp.cpp | #include "core/arm/skyeye_common/armsupp.h"
// Unsigned sum of absolute difference
u8 ARMul_UnsignedAbsoluteDifference(u8 left, u8 right) {
if (left > right)
return left - right;
return right - left;
}
// Add with carry, indicates if a carry-out or signed overflow occurred.
u32 AddWithCarry(u32 left,... | ALGO | 0.999325 | 6.886919 |
d9dfab38-e505-4485-8539-82d5feded880 | himanshusisodiya6377/DSA-QUESTIONS | 1020-number-of-enclaves/1020-number-of-enclaves.cpp | class Solution {
public:
void bfs(vector<vector<int>>& grid,vector<vector<bool>>&visit,int r,int c,int row,int col,int &ans){
if(row<0 || row==r || col<0 || col==c || visit[row][col]==true || grid[row][col]==0) return;
visit[row][col]=true;
bfs(grid,visit,r,c,row+1,col,ans);
bfs(grid,vis... | ALGO | 0.999986 | 6.165564 |
0f0a5788-1eb4-463d-8495-b9e9733f01e6 | version0chiro/Ace-The-Code | Leet-Code-Question/serialize-and-deserialize-bst/serialize-and-deserialize-bst.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 Codec {
public:
inline void inorderDFS(TreeNode* root,string &order){
if(!root) return;
char buff... | ALGO | 0.999924 | 6.365171 |
3eadbdba-f7b6-4860-893b-8b920df674d4 | harsh4677/Daily_DSA | Binary_Search/General.cpp | #include<bits/stdc++.h>
using namespace std;
int iterative_code(vector<int>& arr, int n, int target){
int low =0, high = n-1;
while(low <= high){
// int mid = (low + high)/2; Can cause OverFlow
int mid = low + (high - low)/2;
if(arr[mid] == target) return mid;
else if(target >... | ALGO | 0.999964 | 5.884379 |
93894fad-6645-44dd-8866-1e57aaf52b42 | goodthebest/setup-digibyte-dgb-algo-Groestl-mining-pool | src/arith_uint256.cpp | #include <arith_uint256.h>
#include <uint256.h>
#include <utilstrencodings.h>
#include <crypto/common.h>
#include <stdio.h>
#include <string.h>
template <unsigned int BITS>
base_uint<BITS>::base_uint(const std::string& str)
{
static_assert(BITS/32 > 0 && BITS%32 == 0, "Template parameter BITS must be a positive ... | ALGO | 0.970623 | 6.601957 |
c2224518-967d-4f0d-a47b-a63ff48d15e2 | Binsal/Leetcode | 2593-find-score-of-an-array-after-marking-all-elements/2593-find-score-of-an-array-after-marking-all-elements.cpp | class Solution {
public:
static bool cmp(pair<int,int>&p1,pair<int,int>&p2){
if(p1.first==p2.first)return p1.second<p2.second;
return p1.first<p2.first;
}
long long findScore(vector<int>& nums) {
long long ans=0;
int n=nums.size();
... | ALGO | 0.999995 | 5.308226 |
d0a54246-508c-41c7-9eb6-0c42558353f5 | proModeLife/InternPrep | Leetcode/Dynamic_Programming/Burst_Balloons.cpp | class Solution {
public:
void solve(int start, int end, const vector<int>& nums, vector<vector<long long>>& dp) {
if (dp[start][end] != -1) return;
if (end < start) {
dp[start][end] = 0;
return;
}
if (end - start == 0) {
dp[start][end] = nums[start... | ALGO | 0.999994 | 5.636543 |
a34b2e40-7c88-4aa7-b050-5ebec20f262f | ishandutta2007/codeforces | filibuster/normal/1520/F2.cpp | #include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using li = long long;
using ld = long double;
using pii = pair<int, int>;
const int INF = 1e9 + 13;
const int M = 1e9 + 7;
const int N = 2e5 + 14;
const int B = 10;
//int A[6] = {1, 0, 1, 1, 0, 1};
//
//int qget(int l, int r) {
// int... | ALGO | 0.999938 | 3.655324 |
3700cae0-e2a0-46e2-9832-c0175007225f | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5362_20.cpp | #include <bits/stdc++.h>
using namespace std;
pair<double, double> x, y, w1, w2, st;
double t, v;
double Distance(pair<double, double> p1, pair<double, double> p2) {
double dis = sqrt(((p1.first - p2.first) * (p1.first - p2.first)) +
((p1.second - p2.second) * (p1.second - p2.second)));
return d... | ALGO | 0.999981 | 4.049354 |
a7d6c3cb-9611-4c22-8d55-e171dd1deb77 | ChetasShree/Striver-SDE-Sheet-Challenge | Day_13_Stack/k_greater_right.cpp | class Solution
{
public:
// Function to find the next greater element for each element of the array.
vector<long long> nextLargerElement(vector<long long> arr, int n)
{
// Your code here
stack<long long> s;
vector<long long> v;
for (int i = n - 1; i >= 0; i--)
{
... | ALGO | 0.999969 | 5.754267 |
63cd33be-3239-4f84-934c-5df35d9feff0 | ThienBao224/AI | Tuan2/TH2-02.CPP | #include<iostream>
#include<cstring>
using namespace std;
const int MAX = 100;
int n, c[MAX][MAX], dp[MAX][1 << MAX];
int tsp(int current, int mask) {
if (mask == (1 << n) - 1) {
return c[current][0];
}
if (dp[current][mask] != -1) {
return dp[current][mask];
}
int ans = INT_MAX;... | ALGO | 0.999973 | 4.455797 |
ce022579-3b9f-403b-bceb-817d5fb0dea1 | chaerishme/algorithm | 0x0B/1992.cpp | #include <bits/stdc++.h>
using namespace std;
int N;
int paper[65][65];
void solve(int x, int y, int n) {
if (n == 1) {
cout << paper[x][y];
return;
}
bool zero = true, one = true;
for (int i = x; i < x + n; i++) { // 종이 너비 3의 배수
for (int j = y; j < y + n; j++){
... | ALGO | 0.999978 | 4.3742 |
ab213fda-f9d0-4181-b3a9-a9876bcc75ad | Lianging/android_10_code | frameworks/av/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp | /*
Pathname: ./audio/gsm-amr/c/src/az_lsp.c
Funtions: Chebps
Chebps_Wrapper
Az_lsp
------------------------------------------------------------------------------
REVISION HISTORY
Description: Finished first pass of optimization.
Description: Made changes based on review comments.
Descri... | ALGO | 0.999717 | 6.1934 |
b987d167-974f-4b86-83e1-c86a1b0fc05b | Ri-Nai/CompetitionCode | OI/Ri_Nai/Test_2020/Test_10_3_1/bird/bird.cpp | #include<bits/stdc++.h>
using namespace std;
#define FCLS() fclose(stdin);fclose(stdout);
#define FILE(s) freopen(s".in","r",stdin);freopen(s".out","w",stdout);
#define ToMin(x,y) (x>(y))&&(x=y)
const int N=1e4+5,M=1e3+5,inf=0x3f3f3f3f;
int n,m,k,U[N],D[N],L[N],H[N],dp[2][N][M],is[N],pos;
bool flag=1;
int main()
{
// ... | ALGO | 0.999606 | 3.208249 |
5c0373fa-ebf7-4f3d-b841-c33fe753a78f | furret112/CS-RRT | ompl/src/ompl/control/planners/ltl/src/LTLPlanner.cpp | /* Author: Matt Maly */
#include "ompl/control/planners/ltl/LTLPlanner.h"
#include "ompl/control/planners/PlannerIncludes.h"
#include "ompl/control/planners/ltl/ProductGraph.h"
#include "ompl/control/planners/ltl/LTLProblemDefinition.h"
#include "ompl/datastructures/PDF.h"
#include "ompl/util/Console.h"
#include <algo... | ALGO | 0.999198 | 6.184365 |
246448b5-dfc7-4dc1-a34e-76b85d3c69ab | Xinghui-Wu/LeetCode | problem_1038.cpp | /**
* 1038. Binary Search Tree to Greater Sum Tree
*
* Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than the original key in BST.
* As a reminder, a binary search tree is a tree tha... | ALGO | 0.99999 | 6.487535 |
8e4fadb2-011c-4913-9006-6ae3e999c823 | toufu-24/AtCoder | MCC/2023_07_12/E.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define all(v) v.begin(), v.end()
#define sort(v) sort(v.begin(), v.end())
#define reverse(v) reverse(v.begin(), v.end())
#define ll int64_t
#define ull uint64_t
int main()
{
ll N, M, K;
cin >> N >> M >> K;
vecto... | ALGO | 0.999956 | 4.277256 |
f7adaa75-9059-4741-b1c4-119c36003df0 | MiguelCPereira/2048ReinforcementLearning | 3rdParty/Eigen-3.4.0/test/sparseLM.cpp | #include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template <typename Scalar>
struct sparseGaussianTest : SparseFunctor<Scalar, int>
{
typedef Matrix<Scalar,Dynamic,1> VectorType;
typedef SparseFunctor<Scalar,int> Base;
typedef typename Base::JacobianType JacobianT... | TEST | 0.967547 | 6.154785 |
5d4dcbe3-2294-4d31-95bd-09aae8fafeb0 | ThiagoFBastos/programacao-competitiva | atcoder/E - Who Says a Pun?.cpp | #include "bits/stdc++.h"
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using i32 = int;
using u32 = unsigned;
using i16 = short;
using u16 = unsigned short;
using ld = long double;
using ii = pair<int, int>;
vector<int> z_function(string& s) {
int n = (int)s.length();
vector<int... | ALGO | 0.999876 | 4.81591 |
af26ff45-cc70-4436-8d14-282d97efdd15 | raincross7/code-similarity | codes/train_code/problem224/problem224_287.cpp | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
int main()
{
int a, b, k;
cin >> a >> b >> k;
int ans = 0;
int cnt = 0;
for (int i=min(a,b); i >= 1; i--) {
if (a%i == 0 && b%i == 0) {
ans = i;
cnt++;
... | ALGO | 0.999971 | 4.303277 |
7f79b9c2-67ee-4c41-8662-ea18532e385b | TennousuAthena/skech | computer_graphics/exp01/DDA.cpp | #include<stdlib.h>
#include<math.h>
#include<graphics.h>
void lineDDA(int x0, int y0, int xEnd, int yEnd, COLORS color=RED){
int dx = xEnd - x0, dy = yEnd - y0;
int steps, k;
float xIncrement, yIncrement, x = x0,y = y0;
if(fabs(dx) > fabs(dy))
steps = fabs(dx);
else
steps = fabs(dy);
xIncrement = float(dx) /... | ALGO | 0.976696 | 3.718539 |
5ee6ea56-3f14-4843-95ca-83ff088a91fd | nguyennhuhung37/Competitive-Programming-Contest | Harbour.Space Scholarship Contest 2023-2024/problem C.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAX 300005
#define ii pair<int, int>
int tc, x;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> tc;
while(tc--)
{
cin >> x;
vector<int> ans;
ans.push_back(x);
for(in... | ALGO | 0.999711 | 4.582233 |
ab7b0793-b12f-464a-8cee-85280ea49b52 | ugogon/gaussStylization | libigl/tutorial/206_GeodesicDistance/main.cpp | #include <igl/readOBJ.h>
#include <igl/opengl/glfw/Viewer.h>
#include <igl/exact_geodesic.h>
#include <igl/unproject_onto_mesh.h>
#include <igl/parula.h>
#include <igl/isolines_map.h>
#include <igl/PI.h>
#include <iostream>
#include "tutorial_shared_path.h"
int main(int argc, char *argv[])
{
using namespace Eigen;
... | ALGO | 0.978149 | 6.275243 |
4b8a0848-7ff3-454c-a68d-46fba3624cba | 2024-2025-Gasal-PABI-SI5B/project-wisata-candi-si5b-Frendy675 | wisatacandi/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.998493 | 6.76775 |
fab08c20-0151-489c-8d66-9ffba944bb8f | SWAGATSWAROOP/C- | tempCodeRunnerFile.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the number of rows: ";
cin>>n;
for(int i=0;i<n-1;i++){
for(int j=0;j<=i;j++){
if((i+j)%2==0){
cout<<"1";
}
else{
cout<<"0";
}
}
... | ALGO | 0.999773 | 3.904835 |
3ae0246e-2061-4966-a44a-2ee267d91f18 | jetmuffin/algorithm | leetcode/38.cpp | #include <iostream>
using namespace std;
class Solution {
public:
string countAndSay(int n) {
string s = "1";
string next = "1";
n--;
while(n--) {
next = "";
for(int i = 0; i < s.length(); i++) {
char c = s[i];
int count = 1... | ALGO | 0.999991 | 5.050651 |
c764daf0-6659-43f0-94bc-2d27e2a66459 | ishandutta2007/codeforces | bluediamond/normal/208/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
string a;
cin>>a;
int n=a.size();
string cur;
for(int i=0;i<n;i++)
{
if(a[i]=='W' && a[i+1]=='U' && a[i+2]=='B')
{
... | ALGO | 0.999941 | 3.806573 |
30735ba2-8643-49e8-8f2d-8fa7c8eb5a80 | pavannaiik/LeetCode | 0104-maximum-depth-of-binary-tree/0104-maximum-depth-of-binary-tree.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.999519 | 6.326054 |
d584de60-4145-47ab-a8e6-ec4a609ea701 | yielding/code | cpp.boost/mpl/mplbook/chapter6/example10.cpp | #include <boost/mpl/vector.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/mpl/transform.hpp>
#include <boost/mpl/front.hpp>
#include <boost/mpl/inserter.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/static_a... | ALGO | 0.923188 | 5.670387 |
5973fe6a-4fc2-48a0-9c3e-3d0258565d03 | Apu-mirza/codeforces | 731A_NightAtMuseum.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int t,t1;
long long sum=0;
char p='a';
for(int i=0;i<s.length();i++){
t=(s[i]-p);
if(t>0) t1=t-26;
else t1=t+26;
p=s[i];
sum+=min(abs(t),abs(t1));
}
cout<<sum<<endl;
}
| ALGO | 0.999857 | 3.291418 |
94b9470c-51d3-4200-824b-9570ff84f8c0 | monhime/atcoder_charter | C++_old/beginner/090/D1.cpp | #include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
int N, M;
vector<pii> adj[100010];
int vis[100010];
ll dist[100010];
void dfs(int u) {
vis[u] = 1;
for(int i = 0; i < adj[u].size(); i++) {
int v = adj[u][i].first;
int d = adj[u][i].second;
... | ALGO | 0.999996 | 4.374478 |
8add8b9f-145f-479e-8857-c80be89b0668 | dishhaa03/Striver-CP-sheet- | Basic question/33_1141-A.cpp | # include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b; cin >>a>>b;
if(a == b){
cout << 0;
return 0;
}
if(a > b) {
cout << -1 ;
return 0;
}
int count = 0;
bool flag = false;
while(a < b){
if(b/a % 2 == 0){
count++;
... | ALGO | 0.999997 | 3.880016 |
84524918-94a0-4f23-8a01-9e4f61234f02 | Shunaze-Sherwin/All-code | 146.cpp | #include <bits/stdc++.h>
using namespace std;
#define inf 1e18
#define ll long long
#define ull unsgined ll
#define pa pair<int, int>
#define fi first
#define se second
#define pb pop_back
#define mp make_pair
#define em emplace_pack
#define endl '\n'
#define gcd __gcd
#define log __lg
#define all(a) a.begin(), a.end... | ALGO | 0.999976 | 4.554844 |
e4178233-661d-431e-90c1-61bd56b117f2 | ManglaPalak/DSA-cpp | Dynamic Programming/Count subset with K sum.cpp | void solve(int arr[],int n,int i,int k,int& ans,int& sum){
if (sum>k){
return;
}
if (i==n){
if (sum==k){
ans++;
}
return;
}
//exclude
solve(arr,n,i+1,k,ans,sum);
//include
sum+=arr[i];
solve(arr,n,i+1,k,ans,sum);
sum-=arr... | ALGO | 0.999972 | 4.872033 |
ed47896e-94bc-420f-a9f7-7f958bf18e43 | derivada/cpprac | codeforces/rounds/r160_edu/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long // 64 bits
#define ld long double // 80 bits
#define PI 3.1415926535897932384626433832795l
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<vector<int>> graph;
typedef vector<vector<pair<int, int>>> wgraph;
#define umap unordered_map
#d... | ALGO | 0.999082 | 4.288339 |
04788d5a-69bb-49ec-b134-f9948f8b358c | poseidon-code/InterviewRoom-CPP-solutions | dynamic-programming/24-palindrome.cpp | // PROBLEM: Palindrome Partitioning
// https://leetcode.com/problems/palindrome-partitioning-ii/
#include<iostream>
#include<string>
#include<vector>
using namespace std;
// SOLUTION
int min_cut (string s) {
int n = s.length();
vector<int> cut(n+1, 0);
for (int i=0; i<=n; i++) cut[i] = i-1;
for ... | ALGO | 0.999957 | 5.976668 |
cc391c0f-499d-416b-9693-7e2002535a60 | Devang-soni/GFG | Easy/Compare two fractions/Compare-two-fractions.cpp | /*
You are given a string str containing two fractions a/b and c/d, compare them and return the greater. If they are equal, then return "equal".
Note: The string str contains "a/b, c/d"(fractions are separated by comma(,) & space( )).
Examples
Input: str = "5/6, 11/45"
Output: 5/6
Explanation: 5/6=0.8333 and 11/45=... | ALGO | 0.999737 | 6.403372 |
79f336fa-db72-48c8-8e4e-3090f8c2c6bc | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_7222_8.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
char t[4][4];
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++) cin >> t[i][j];
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
int w = 0, b = 0;
for (int l = 0; l < 2; l++)
for (int k = 0; k < 2; k++)
... | ALGO | 0.999723 | 3.870107 |
b0cd0b61-209e-4c17-ba7b-b635276cebd4 | ArchishmanSengupta/lc | 740-delete-and-earn/740-delete-and-earn.cpp | class Solution {
public:
int deleteAndEarn(vector<int>& nums) {
int n = 10001;
vector<int> sum(n,0);
vector<int> dp(n,0);
for(auto i: nums){
sum[i]+=i;
}
dp[0]=0;
dp[1]=sum[1];
... | ALGO | 0.999146 | 5.848741 |
7cc19cfd-65ca-49c5-a9ad-c7c453453eba | jdoerfert/cudaomp | clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp | #include "AST.h"
#include "FindTarget.h"
#include "ParsedAST.h"
#include "Selection.h"
#include "SourceCode.h"
#include "refactor/Tweak.h"
#include "support/Logger.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Rec... | TOOL | 0.92629 | 7.011838 |
9e16ebd6-25a6-4ed9-97ee-bfc79123a82a | shz1202/eigen_first | bench/perf_monitoring/lazy_gemm.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <Eigen/Core>
#include "../../BenchTimer.h"
using namespace Eigen;
#ifndef SCALAR
#error SCALAR must be defined
#endif
typedef SCALAR Scalar;
template<typename MatA, typename MatB, typename MatC>
EIGEN_DONT_INLINE
void lazy_gemm(const MatA &A, const Ma... | TOOL | 0.989128 | 6.08404 |
465a42f2-9094-4875-8804-c70ccc35034d | sia162/LeetcodeQuestions | Find the first node of loop in linked list - GFG/find-the-first-node-of-loop-in-linked-list.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node* next;
Node(int val)
{
data = val;
next = NULL;
}
};
void loopHere(Node* head, Node* tail, int position)
{
if(position==0) return;
Node* w... | ALGO | 0.999983 | 4.444719 |
02aed602-4862-485a-8447-e0505ae18a6d | darkey91/asd | seg_tree/a/a.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
struct elem {
long long data;
long long sum;
};
long long sum(const std::vector<elem> &, int, int);
int main() {
FILE *rFile, *wFile;
rFile = fopen("sum0.in", "r");
wFile = fopen("sum0.out", "w");
long long ans = 0;
long long n, x... | ALGO | 0.999834 | 3.998293 |
1842e455-a930-472b-8b9e-9592e75b3ee2 | Thalesbjp/C-PlusPlus | Exercicios/Modularização/Ex8.cpp | /*As rampas de acesso devem ter inclinação máxima de 8%, ou seja, rampas com inclinações acima de 8% são consideradas inadequadas. O cálculo da inclinação (dado em porcentagem) de uma rampa é dada pela seguinte equação: inclinacao = altura x 100 / base (comprimento da projeção horizontal da rampa). Crie um programa que... | ALGO | 0.979329 | 4.071172 |
48fc468d-4ce9-4c94-a258-2d94b2e0f5db | Pxguin/cpp | codeforces/contests/1501_to_2000/1731/valiants_new_map.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int n, m;
vector<vector<int>> a;
bool check(int s) {
ll t = (ll)(s*s);
ll ps[n+1][m+1];
for (int i=0;i<=n;i++) {
for (int j=0;j<=m;j++) {ps[i][j] = 0;}
}
for (int i=1;i<=n;i++) {
for (int j=1;j<=m;j++) {
ps[i][j] ... | ALGO | 0.999953 | 4.707647 |
240fe2d0-a25c-42a8-8e45-702880ab9622 | aditya-sar/LeetCode | 599-minimum-index-sum-of-two-lists/minimum-index-sum-of-two-lists.cpp | class Solution {
public:
vector<string> findRestaurant(vector<string>& a, vector<string>& b) {
map<string,int> mp;
vector<string> ans;
for(int i=0; i<a.size(); i++) {
if(mp.find(a[i]) == mp.end()) {
mp.insert({a[i], i});
}
}
int mn = IN... | ALGO | 0.999984 | 5.847749 |
f4841003-5a51-4541-89a8-fdf72a974915 | Saiyangodgoku1/start-450 | Step-15(Dynamic Programming)/8.DP on squares/02.count_sqr_submatrix_on_rectangle.cpp | /*
EXAMPLE:
Input: n = 4, m = 5, arr = [
[0, 1, 1, 1, 0],
[1, 1, 1, 1, 0],
[0, 1, 1, 1, 1],
[1, 1, 1, 1, 0]
]
Output: 15
Explanation: The matrix contains 15 square submatrices with all 1's.
QUESTION:
Given a binary matrix `arr` of dimensions `n x m`, count the number of square submatrices that have all 1's.
A... | ALGO | 0.999955 | 7.403276 |
5cbcf64c-52dc-420f-b569-7773d9769af8 | imsay3m/cs-fundamentals-2023 | semester-01/introduction-to-c++-for-DSA/week-02/module-07/max-value-of-object.cpp | #include <bits/stdc++.h>
using namespace std;
class Student
{
public:
string name;
int roll;
int marks;
// array of object doesn't contain constructor
};
int main()
{
int sz;
cin >> sz;
Student a[sz];
for (int i = 0; i < sz; i++)
{
cin.ignore();
getline(cin, a[i].name... | ALGO | 0.99969 | 3.873607 |
dda601fd-ece2-4d92-9339-bf62b9fccd9b | jkpxT14/Algorithms | BackTracking (N-Queen Problem).cpp | #include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
// #include <limits>
#include <cmath>
#include <bitset>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector... | ALGO | 0.999981 | 5.137555 |
44f87845-beb9-45ec-a06b-db4fc6d38701 | LauZyHou/Algorithm-To-Practice | AcWing/LeetCode究极班/115.cpp | class Solution {
public:
int numDistinct(string s, string t) {
int n = s.size(), m = t.size();
s = ' ' + s, t = ' ' + t;
typedef long long LL;
vector<vector<LL>> f(n + 1, vector<LL>(m + 1));
// t为空时,s只要一个都不选就是一种方案
// s为空t不空时,一定是0
for (int i = 0; i <= n; i ++ )... | ALGO | 0.999974 | 5.519907 |
bec4976f-502e-4597-8fcd-d45f9d7dfd6f | lujiazho/LeetCode-Record | LeetCode/904-fruit-into-baskets.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////
// easy
////////////////
// Time Complexity: O(n)
// Space Complexity: O(n)
///////////////////////////////////////////////////////////////////////////////////////////////
class Solution {
public:
int totalFruit(vector<i... | ALGO | 0.999945 | 6.184012 |
289d6837-0d10-4538-a04c-63ac08acafb7 | dipu-bd/OJ-Codes | LightOJ/1337 - The Crystal Maze.cpp | /*============================
/\u7h0r : 5ud!p70 ch@ndr@ d@5
=============================*/
//C headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <ctype.h>
#include <assert.h>
//cpp headers
#include <iostream>
#include <iomanip>
#include <sstream>
#incl... | ALGO | 0.999913 | 3.622003 |
0715abce-7902-41c8-9daf-b0b4b50aa5ce | AbhishekGargcoder/Top-interview-problems | Minimum Operations - GFG/minimum-operations.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
int minOperation(int n)
{
int count=0;
while(n>0){
if((n&1)==0){
n=n/2;
}
else{
n=n-1;
... | ALGO | 0.999901 | 6.441763 |
f843e712-070f-4581-b756-6e1edf9a83b4 | manikanta2901/ubuntu | .history/imp/cpp/DataStructures/trees/creatingTree_20200623164506.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* left;
Node* right;
};
Node* newNode(int a){
Node* node = new Node();
node->data = a;
node->left = NULL;
node->right = NULL;
return node;
}
Node* insertLevelOrder(vector<int> arr,Node* root,int i){
if(i < arr... | ALGO | 0.999836 | 4.40825 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.