uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
4a7c48e8-e8a8-41b5-b473-8bf616a69ff3 | tr0j4n034/SPOJ | WOWSUBSTR.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
//#include <unordered_map>
#include <utility>
#include <cassert>
#include <iomanip>... | ALGO | 0.999726 | 4.124954 |
499de322-6b27-4ac4-aea8-1ece33110cee | ishandutta2007/codeforces | cephian/normal/609/A.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int a[105];
int main() {
ios::sync_with_stdio(0);
int n, m;
cin >> n >> m;
for(int i = 0; i < n; ++i)
cin >> a[i];
sort(a, a + n);
int ans = 0;
for(int i = n-1; i>=0; --i) {
if(m <=0) break;
m -= a[i];++ans;
}
cout << ans <<... | ALGO | 0.99998 | 4.529462 |
c6b78caf-bab4-499e-9c07-03f29a28a56e | priyam3955/Interview-Prep | 0647-palindromic-substrings/0647-palindromic-substrings.cpp | class Solution {
public:
int countSubstrings(string s) {
vector<vector<int>>v(s.size(), vector<int>(s.size(), 0));
for(int i=0; i<s.size(); i++){
v[i][i]=1;
}
for(int i=1; i<s.size(); i++){
for(int j=0, k=i; j<s.size() && k<s.size(); j++, k++){
... | ALGO | 0.999951 | 5.93875 |
d0e7ecdc-33f9-4086-829b-a3f05b7a1283 | Ahdhn/EEC171 | Project/projects/DLP_Project/GPU/C/src/reduce/reduce_gold.cpp | #include <stdio.h>
#include <math.h>
#include <float.h>
////////////////////////////////////////////////////////////////////////////////
// export C interface
extern "C"
void computeGold( float* reference, float* idata, const unsigned int len);
////////////////////////////////////////////////////////////////////////... | ALGO | 0.945403 | 4.564488 |
b25453d2-754c-4268-8033-8798c89bdd4d | pikipoko/Algorithm_study | 백준/10799.cpp | #include <cstdlib>
#include <iostream>
#include <vector>
#include <string>
using std::cout;
using std::cin;
using std::endl;
using std::vector;
using std::string;
int main()
{
string str;
cin >> str;
char prev = '(';
int len = str.size();
vector<char> lines;
vector<int> line;
int pieces ... | ALGO | 0.999369 | 4.022207 |
ee53c8ee-8f05-44dd-af5d-110bf8646b30 | MoonMoohyeon/BOJ | 프로그래머스/3/43162. 네트워크/네트워크.cpp | #include <string>
#include <iostream>
#include <vector>
using namespace std;
int visit[201] = {0, };
vector<vector<int>> graph;
int N;
void DFS(int src) {
if(visit[src]) return;
visit[src] = 1;
for(int i=0; i<N; i++) {
if(graph[src][i]) {
cout << "DFS:" << i << "\n";
DFS(i)... | ALGO | 0.998836 | 4.996302 |
541d096e-492e-477a-b007-cc1006edbb8f | wazenmai/Leetcode | Medium/2971_find_polygon_with_the_largest_perimeter/solution1.cpp | /**
* Title: Find Polygon With the Largest Perimeter (Leetcode Medium 2971)
* Author: Bronwin Chen <<EMAIL>>
* Date: 15, February, 2024
* Method: Sort the array first. Then use prefix_sum[i] to store the sum of the first i numbers. Then traverse the array from the end to find the largest perimeter.
* Result: Ti... | ALGO | 0.999807 | 5.525482 |
ade2adea-3f06-4895-84b4-2f168caaf4a5 | Sumit11Rawat/Leetcode_codes | 229-majority-element-ii/majority-element-ii.cpp | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
vector<int>ans;
unordered_map<int,int>m;
set<int>st;
int s=floor(nums.size()/3);
for(int i=0;i<nums.size();i++){
m[nums[i]]++;
}
for(int i=0;i<nums.size();i++){
i... | ALGO | 0.999942 | 5.708756 |
059ca023-678d-4847-a85c-ecc9fd767178 | lokeshmogulla/SOC-CP | contests/955div2/B_Collatz_Conjecture.cpp | #include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fr(a,b,c) for(int a=b;a<c;a++)
#define rfr(a,b,c) for(int a=b;a>c;a--)
#define nl ("\n")
#define int long long
#define ... | ALGO | 0.999993 | 4.016793 |
f15eb7eb-0b94-48f6-8eaf-0c7d031d4836 | SirLex/UP | Sem.02/Pract.02/Task05.cpp | #include <iostream>
int main() {
double sideA, sideB, sideC;
std::cout << "Enter value for side a: ";
std::cin >> sideA;
std::cout << "Enter value for side b: ";
std::cin >> sideB;
std::cout << "Enter value for side c: ";
std::cin >> sideC;
if ((sideA + sideB > sideC) && (sideA + sideC > sideB) && (sideB + s... | ALGO | 0.99025 | 5.859802 |
ff13921e-a5ae-4c0b-9302-e6d74436e8b5 | yenluu2506/CODEOFLUU | Data_Structure/count_leafNode.cpp | #include <iostream>
using namespace std;
struct Node{
int data;
Node *left;
Node *right;
};
Node *insert(Node *t, int x){
if (t==NULL){
Node *tmp = new Node;
tmp->data = x;
tmp->left = NULL;
tmp->right = NULL;
return tmp;
}
else{
if(x<t->data){
... | ALGO | 0.999824 | 3.855958 |
b125bdd3-40ea-46e4-a84a-e31abf305371 | himanshu-code/AmazonTestSeries | Strings/ConvertToRomanNumerals.cpp | #include <bits/stdc++.h>
using namespace std;
string ConvertToRoman(int n)
{
string str = "";
int num[] = {1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000};
string sym[] = {"I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M"};
int i = 12;
while (n > 0)
{
int div = ... | ALGO | 0.999941 | 6.146393 |
8c675e29-dd78-485e-ab28-73d266888e71 | tnwpfh7/neokii_KR-1 | selfdrive/controls/lib/longitudinal_mpc_model/generator.cpp | #include <acado_code_generation.hpp>
const int controlHorizon = 50;
using namespace std;
int main( )
{
USING_NAMESPACE_ACADO
DifferentialEquation f;
DifferentialState x_ego, v_ego, a_ego, t;
OnlineData x_poly_r0, x_poly_r1, x_poly_r2, x_poly_r3;
OnlineData v_poly_r0, v_poly_r1, v_poly_r2, v_poly_r3;
O... | ALGO | 0.989281 | 4.897185 |
5fd693dd-a843-46ed-803f-e308b44ef300 | YoungCIoud/PracticeOfFishAcmer | Luogu/DP/P4310_dfs.cpp | #include <climits>
#include<iostream>
//#define int long long
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
using ll = long long;
const int N = 1e5, Inf = INT_MAX;
int a[N + 5];
int val[N + 5];
int dfs(int cur)
{
if (val[cur]) return val[cur];
val[cur] = 1;
for (int i = cur -... | ALGO | 0.999928 | 4.566567 |
f3e2db2f-7cbb-4669-8fc3-e3b2c6418540 | hmofrad/CodingPractice | skinnyleetcode/merge2.cpp | /*
* https://leetcode.com/problems/merge-sorted-array/solution/
* (c) Mohammad Hasanzadeh Mofrad, 2020
* (e) <EMAIL>
*/
class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int j = nums1.size()-1;
int i1 = m-1;
int i2 = n-1;
while(i1>=0 and... | ALGO | 0.999969 | 5.814543 |
2089466e-8e07-4d7f-b5dc-8c4e121503d1 | Jayendra-sharma17/codes-c-- | bin_to_dec.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main()
{
int n;
cout<<"enter n";
cin>>n;
int i=0,ans=0;
while (n!=0)
{
int dig=n%10;
if (dig==1)
{
ans=ans+pow(2,i);
}
n=n/10;
i++;
}
cout<<"answer is"<<ans;
return 0;
}
| ALGO | 0.999867 | 3.912036 |
fa6f9d44-10ea-4621-9ab4-aeb38ce1d517 | bin2415/Bitype | llvm/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp | #include "CodeGenDAGPatterns.h"
#include "CodeGenTarget.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/TableGenBackend.h"
using namespace llvm;
namespace {
class X86EVEX2VEXTablesEmitter {
CodeGenTarget Target;
// Hold all non-masked & non-broadcasted EVEX encoded instructions
std::vector<const C... | TOOL | 0.968744 | 7.511082 |
a27f054b-02de-490a-a9f8-8a4063a64638 | Sefayet-Alam/New-CP-submissions_vol_3 | icpc_h.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//VVI
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define ll long long
#define ff first
#defi... | ALGO | 0.999701 | 4.08972 |
04f1c926-b4c4-4cce-b72a-df57ae8268b9 | ishandutta2007/codeforces | tmwilliamlin168/normal/876/B.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
#ifdef __APPLE__
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n, k, m;
scanf("%d %d %d", &n, &k, &m);
vector<int> a(n);
map<int, vector<int>> q;
for (int i = 0; i < n; ++i) ... | ALGO | 0.999999 | 3.777772 |
9cb20c9b-7d0c-47d8-b9f4-19919efa4b36 | ishandutta2007/codeforces | gisp_zjz/normal/1237/C2.cpp | #include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
const int maxn=3e5+7;
struct node{
int x,y,z,id;
};
typedef vector<node> vi;
typedef vector<int> Vi;
typedef vector<pi> vii;
vector <pi> h[maxn];
vector <pi> ans;
map <int... | ALGO | 0.999994 | 3.760468 |
feef97f2-2438-462a-b2b2-37d56436a865 | raincross7/code-similarity | codes/train_code/problem068/problem068_9.cpp | #include <iostream>
using namespace std;
int main()
{
int n, m;
cin >> n;
m = 100000;
for (int i = 0; i < n; i++) {
m = m * 1.05;
if (m % 1000 != 0){
m = m - (m % 1000) + 1000;
}
}
cout << m << endl;
} | ALGO | 0.999625 | 3.159049 |
b749cf31-9244-4df8-bd6e-83a686347dcf | GiorgioZacharo/RegionSeeker | IdentifyRegions/IdentifyRegions.cpp | #include "llvm/ADT/Statistic.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/Analysis/RegionPass.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis... | ALGO | 0.968578 | 5.86951 |
cc6ff161-8e0a-4ef2-a15b-65bec91f8d59 | ProgramTraveler/leetcode | Leetcode_Question/106.从中序与后序遍历序列构造二叉树.cpp | /*
* @lc app=leetcode.cn id=106 lang=cpp
*
* [106] 从中序与后序遍历序列构造二叉树
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
/**
* Definition for a binary ... | ALGO | 0.99996 | 6.622322 |
0384b5c3-6115-4c1f-9c0d-abbda54927fe | Project-Awaken/android_frameworks_av | media/utils/MemoryLeakTrackUtil.cpp | //#define LOG_NDEBUG 0
#define LOG_TAG "MemoryLeackTrackUtil"
#include <utils/Log.h>
#include <mediautils/MemoryLeakTrackUtil.h>
#include <sstream>
#include <bionic/malloc.h>
/*
* The code here originally resided in MediaPlayerService.cpp
*/
// Figure out the abi based on defined macros.
#if defined(__arm__)
#def... | TOOL | 0.897929 | 7.116609 |
26f54552-f598-48fd-9c4e-30ee91ab6e58 | showmanlee/HowCanISolveThisQuestion | BOJ/2000/2588.cpp | // 곱셈
// https://www.acmicpc.net/problem/2588
#include <iostream>
using namespace std;
int main(void){
int a, b;
cin >> a >> b;
cout << a * (b % 10) << endl << a * (b / 10 % 10) << endl << a * (b / 100) << endl << a * b << endl;
} | ALGO | 0.99957 | 3.959366 |
6ccff92c-6e90-4877-b595-e1d6e592c49f | ishandutta2007/codeforces | hitman623/normal/1003/A.cpp | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define all(a) (a).begin(),(a).end()
#define x first
#d... | ALGO | 0.999903 | 4.286177 |
64b685b5-a13a-450d-b202-7a117fbe5bc1 | BychkovArthur/algorithms | coderun/424_benchmark.cpp | #include <bits/stdc++.h>
using namespace std;
void addOne(string& s, int i) {
int remainder = 1;
while (i >= 0) {
int sum = s[i] - '0' + remainder;
remainder = sum / 10;
s[i] = sum % 10 + '0';
--i;
if (!remainder) break;
}
}
void leftGreater(string& s, int n, int ... | ALGO | 0.999501 | 4.075197 |
7d5f211b-3fb8-4c37-940f-92c256c7fa5c | cy-org/samples-store | snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp | //<Snippet1>
#using <System.dll>
using namespace System;
using namespace System::Threading;
public ref class Example
{
public:
static void main()
{
// Create a Semaphore object that represents the named
// system semaphore "SemaphoreExample3". The semaphore has a
// maximum count of five. The i... | TOOL | 0.950332 | 5.43575 |
f473ed24-1689-4c58-b7d7-4fb396177a3d | ishandutta2007/codeforces | huangxiaohua/normal/1442/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define M 998244353
namespace IO {
const int MAXSIZE = 1 << 20;
char buf[MAXSIZE], *p1, *p2;
#define gc() \
(p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin), p1 == p2) \
... | ALGO | 0.999993 | 4.154661 |
66587bff-5ccd-4671-ac22-0f6a92d0cea6 | r4pidstart/problems | by_step/l15.5/16139.cpp | // https://www.acmicpc.net/problem/16139
// 2022-04-23 17:48:19 164ms
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
string s; cin >> s;
vector<vector<int> > alpha_cnt(26, vector<int>(s.length()+1, 0));
for(int i=0; i<s.length(); i++)
for(int j=0; j<26; j++)
alpha_cnt[j]... | ALGO | 0.999721 | 4.272893 |
60f77efc-9a54-426e-97ab-602556f33507 | yoshikiri/kyo-pro | aoj/ALDS1/2a.cpp | #include <iostream>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
void swap(int *x, int *y) {
int temp = *x;
*x = *y;
*y = temp;
}
int bubbleSort(int *A, int N) {
int cnt = 0;
for (int i = 0; i < N; i++) {
for (int j = N - 1; j > i; j--) {
if (A[j] < A[j - 1]) {
swap(&A[j], &A[j - ... | ALGO | 0.99966 | 4.43823 |
13b947cd-6a8b-41b4-bc47-51a3d2aeac22 | lumiZGorlic/leetcode | solutions/MinimumCostForTickets/solution.cpp | class Solution {
public:
int mincostTickets(vector<int>& days, vector<int>& costs) {
int sz = days.size();
vector<int> dp(sz, 0);
dp[0] = *min_element(begin(costs), end(costs));
for (int i=1; i<sz; i++){
dp[i] = costs[0] + dp[i-1];
int idx=i;
wh... | ALGO | 0.999718 | 5.745508 |
023cf0fb-fcb5-4839-ac67-c68951cb13fd | gauri-singh/LeetCodeQuestions | 0045-jump-game-ii/0045-jump-game-ii.cpp | class Solution {
public:
int jump(vector<int>& nums) {
int res=0,l=0,r=0;
//it is like BFS and each level are group of elements that can be reached from previous level
while(r<nums.size()-1){
int farthest=0;
for(int i=l;i<=r;i++){
farthest=max(farthest... | ALGO | 0.999993 | 5.793649 |
4b115b72-76a5-45f9-9767-76d3d7d18f5c | vanhaito/PTIT-Data-Structrue-and-Algorithm | Contest5/bai12.cpp | #include<bits/stdc++.h>
typedef long long ll;
ll const mod = 1e9 + 7;
using namespace std;
ll nPk(int n, int k){
ll P[k+10];
memset(P, 0, sizeof(P));
P[0] = 1;
for (int i = 0; i <= n; i++){
for (int j = min(i, k); j > 0; j--){
P[j] = (P[j] + (j * P[j-1])%mod)%mod;
}
}
return P[k];
}
int main(){
int n, k, ... | ALGO | 0.999981 | 5.414681 |
e3db2c71-2ce1-427a-84af-f89a73f00674 | allem40306/Competitive-Programming | other/sprout/sprout0037.cpp | #include <iostream>
using namespace std;
#define N 100005
int main(){
int t,ti=0,x,arr[N],qt=0,qb=0;
for(cin>>t;ti<t;ti++){
cin>>x;
if(x%2){
cin>>x;
arr[qt++]=x;
}else{
if(qt==qb)cout<<"empty!\n";
else{
cout<<arr[qb++]<<endl;
}
}
}
}
| ALGO | 0.998318 | 3.403523 |
1249fbc2-9ee6-4988-93ba-88297a66595f | Diamondsn/algorithm-programming | 20180911牛客网剑指offer刷题/矩阵中的路径.cpp | #include<string>
#include<vector>
#include<deque>
#include<iostream>
#include<algorithm>
#include"math.h"
#include<set>
using namespace std;
//题目描述
//请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。
//路径可以从矩阵中的任意一个格子开始,每一步可以在矩阵中向左,向右,向上,向下移动一个格子。
//如果一条路径经过了矩阵中的某一个格子,则之后不能再次进入这个格子。
//例如 a b c e s f c s a d e e 这样的3 X 4 矩阵中包含一条... | ALGO | 0.999644 | 4.156711 |
4e8df9c1-f27d-492e-a84f-d0e6f1598c4d | Aryashanish/DSA | Second Largest - GFG/second-largest.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
// Function returns the second
// largest elements
int print2largest(int arr[], int n) {
// code here
int lar = arr[0];
int slar = -1;
for(i... | ALGO | 0.999813 | 5.255936 |
4a24c678-50a8-46d6-b94e-0ba7f05ada27 | briansfma/CarND-Path-Planning-Project | src/Eigen-3.3/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.990505 | 6.26191 |
d013567b-9249-42eb-a321-1dc317b617e0 | iamfaisalkhan/CarND-Unscented-Kalman-Filter | src/tools.cpp | #include <iostream>
#include "tools.h"
using Eigen::VectorXd;
using Eigen::MatrixXd;
using std::vector;
Tools::Tools() {}
Tools::~Tools() {}
VectorXd Tools::CalculateRMSE(const vector<VectorXd> &estimations,
const vector<VectorXd> &ground_truth) {
/**
TODO:
* Calculate the RMSE... | ALGO | 0.975865 | 5.954269 |
740db973-2b58-4ddd-b570-6764a152674a | qLex7/Programmation-en-C- | Tp C++_2/exo 3 C++.cpp | #include <iostream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
void equation(double a, double b, double c)
{
if(a==0)
{
if(b==0)
{
if(c==0)
{
cout<<"Alors une infinité de solutions";
}
else
{
cout<<"Sinon aucune de solutions";
}
}
else
{
cout<<"S... | ALGO | 0.995894 | 3.787513 |
e98cdd8e-475e-4186-8d5e-a920daad5fc7 | AnahiSU/PracticasProgramacionCompetitiva | ejerciciosPorTemaInteresantes/D_Grafos/buildingRoads.cpp | /*
- Deja ir el pasado y camina hacia el futuro.
- El trabajo duro supera al talento cuando el talento no trabaja duro.
- Del fracaso se aprende, del éxito no mucho.
- Para sentirse vivo se necesita una meta en la que trabajar.
- ¡Demonios Rocky! No hay ningún mañana.
*/
#define srt(a) sort(a.begin(),a.end())
#include... | ALGO | 0.999985 | 4.200051 |
f0a93e2f-da52-4d12-9bfc-3f2b36428463 | Imtiaz-Rafi/Leetcode | 136-single-number/136-single-number.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int res = 0;
for(int i=0;i<nums.size();i++){
res^=nums[i];
}
return res;
}
}; | ALGO | 0.999966 | 5.574309 |
48152606-9194-4996-b772-745126f31d19 | canonical/openjdk-17-crac | src/java.base/share/native/libjimage/imageDecompressor.cpp | #include "jni.h"
#include "imageDecompressor.hpp"
#include "endian.hpp"
#ifdef WIN32
#include <windows.h>
#else
#include <dlfcn.h>
#endif
typedef jboolean (*ZipInflateFully_t)(void *inBuf, jlong inLen,
void *outBuf, jlong outLen, char **pmsg);
static ZipInflateFully_t ZipInflateFu... | TOOL | 0.897766 | 4.542898 |
06b5c44c-7cba-4d81-b565-fadd789def47 | codeWizard590/DSA-Practice | DsaPractice/BinaryTrees/Preordertraversal.cpp | #include<bits/stdc++.h>
using namespace std;
//left -> root -> right
class TreeNode{
public:
int data;
TreeNode *left;
TreeNode *right;
TreeNode(int data1){
data=data1;
left=right=nullptr;
}
};
// implement preorder traversal using iterative way
ve... | ALGO | 0.999957 | 3.783933 |
f2f152aa-4940-4eb3-b7fc-73336c08c0b6 | syw2045/MORAI_Delivery | auto_driving_ws/src/navigation/base_local_planner/src/point_grid_node.cpp | #include <base_local_planner/point_grid.h>
#include <ros/console.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <math.h>
#include <cstdio>
#include <sensor_msgs/point_cloud2_iterator.h>
using namespace std;
using namespace costmap_2d;
void printPoint(const geometry_msgs::Point& pt){
printf("(%.2f,... | ALGO | 0.97406 | 3.17187 |
1d03dd19-c44b-4c31-9c18-f6888b02f101 | ishandutta2007/codeforces | xuanyi/normal/1060/D.cpp | #include <cstdio>
#include <algorithm>
typedef long long ll;
const int MAXN=100005;
int n;
int l[MAXN],r[MAXN];
ll ans;
template <typename T>
inline void read(T &x){
int ch,fl=0;
while (ch=getchar(),ch<48 || 57<ch) fl^=!(ch^45); x=(ch&15);
while (ch=getchar(),47<ch && ch<58) x=(x<<1)+(x<<3)+(ch&15);
if (fl) x=-x... | ALGO | 0.999829 | 3.497327 |
bb2ec43c-e41e-47c1-960b-52b98ac743df | Wonkyu-Lee/CtCI-6th-cpp | ex_10_03.cpp | //
// Created by blazeq on 2017. 11. 9..
//
#include "catch.hpp"
namespace ex_10_03 {
int findIndexOfValue(int arr[], int p, int r, int value) {
if (p > r)
return -1;
int q = (p + r) / 2;
if (arr[q] == value) {
return q;
}
if (arr[p] >= arr[r]) {
int found = findIndexOfV... | ALGO | 0.999425 | 6.142372 |
3ca9cf6c-fb97-4800-a3f5-ef28d38e228a | NextThread/450-dsa | graph/DFS.cpp | #include<bits/stdc++.h>
using namespace std;
void dfs(int node, vector<bool> &vis, vector<vector<int>> &adj, vector<int> &storedfstraversal)
{
storedfstraversal.push_back(node);
vis[node] = true;
for (auto it : adj[node])
{
if (!vis[it])
dfs(it, vis, adj, storedfstraversal);
}
}
... | ALGO | 0.999995 | 4.843067 |
da12d988-cf92-4aa1-8081-8a00e0b31384 | KiwiOwnDaniel27/LENGUAJE-C- | LENGUAJE C++/EJERCICIO 20.cpp | #include <iostream>
using namespace std;
int main (){
int num, unidades, decenas, centenas, millar;
cout << "Ingresar un valor: "; cin >> num;
unidades = num%10; num /= 10;
decenas = num%10; num/= 10;
centenas = num%10; num /= 10;
millar = num%10; num /= 10;
switch (millar){
case 1: cout << "M"; break;
case 2: co... | ALGO | 0.995976 | 3.188451 |
72073c8b-ed91-42f5-b036-6a97b2fd91a8 | Sainiankushgithub/Lab-Programms | Semester1/Lab5/HA_5_1.cpp | // WAP TO SWAP THE LAST ELEMENT WITH THE FIRST ELEMENT AND SECOND LAST ELEMENT WITH SECOND ONE AND SO ON.
#include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[100];
int size;
int temp;
printf("Enter the size of an array\n");
scanf("%d",&size);
printf("Enter the numbers of an element... | ALGO | 0.999917 | 3.450614 |
e3139325-60bb-4dcd-b1cf-5a8e5b845e0d | jfellus/agpca | eigen/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.993965 | 6.26191 |
cea9c0ab-5b8d-480b-aa35-891bd97ca7fa | afirez/opencv-face-detection | app/src/main/cpp/scanner.cpp | //
// Created by danbogh on 2017/9/12.
//
#include <scanner.h>
using namespace scanner;
static bool sortByArea(const vector<Point> &v1, const vector<Point> &v2) {
double v1Area = fabs(cv::contourArea(Mat(v1)));
double v2Area = fabs(cv::contourArea(Mat(v2)));
return v1Area > v2Area;
}
Scanner::Scanner(Ma... | ALGO | 0.994445 | 3.032763 |
67c3cda3-7be1-4af7-8f16-993f4f4c2439 | Anamicca23/Leetcode-for-DSA | 0912-sort-an-array/0912-sort-an-array.cpp | class Solution {
public:
vector<int> sortArray(vector<int>& nums) {
mergeSort(nums, 0, nums.size() - 1);
return nums;
}
void mergeSort(vector<int>& nums, int left, int right) {
if (left < right) {
int mid = left + (right - left) / 2;
mergeSort(nums, left, mid... | ALGO | 0.999998 | 6.095464 |
ab1b00b6-2940-4c58-be61-da30407b6bfe | akhi1-s/Leetcode-solutions | c++2/1043. Partition Array for Maximum Sum.cpp |
class Solution {
public:
int maxSumAfterPartitioning(vector<int>& arr, int k) {
int n = arr.size();
int f[n + 1];
memset(f, 0, sizeof(f));
for (int i = 1; i <= n; ++i) {
int mx = 0;
for (int j = i; j > max(0, i - k); --j) {
mx = max(mx, arr[j ... | ALGO | 0.999814 | 5.676075 |
36114a2e-56bc-4c85-ba06-ccb0111b8ecf | alexandraback/datacollection | solutions_5769900270288896_0/C++/crappylight/b_naive.cpp | #include <iostream>
#include <fstream>
using namespace std;
fstream fin("b1.in");
fstream fout("output.txt");
int place[16], answer;
int r,c,m;
int calc() {
int cc=0;
for (int i=0;i<r*c;i++)
if (place[i])
{
if (i<(c-1)*r) cc+=place[i+r];
if ((i%r)<r-1) cc+=place[i+1];
... | ALGO | 0.999799 | 3.561923 |
8458fea3-c36e-4eb0-9d70-88676917f9ba | Rhysoshea/daily_coding_challenges | other/cpp_exercises/lower_bound.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n;
cin >> n;
vector<int> vect(n);
for (int i=0; i<n; i++) {
cin >> vect[i];
}
... | ALGO | 0.999986 | 4.081865 |
d8fd5a15-ca36-423f-9773-3590ba594262 | ChanekarSankalp/cs_theory | B_valhalla.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
ll n,q;
cin>>n>>q;
ll a[n+1],b[q+1];memset(a,0,sizeof(a));memset(b,0,sizeof(b));
for(ll id=1;id<=n;id++){cin>>a[id];}
for(ll id=1;id<=q;id++){cin>>b[id];}
for(ll i=1... | ALGO | 0.999873 | 3.483081 |
45735c33-df24-4948-ba1f-ddb6164b55a4 | kunnaal11/leetcode_problems | 1396-count-servers-that-communicate/1396-count-servers-that-communicate.cpp | class Solution {
public:
int countServers(vector<vector<int>>& grid) {
int m = grid.size();
int n = grid[0].size();
int cnt = 0;
vector<int> row(m, 0), col(n, 0);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (grid[i][j] == 1) {
... | ALGO | 0.999856 | 6.686617 |
5f8b750e-6e59-4679-8800-4efac9963842 | xcrescent/whatsapp-app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
5fc1a71c-1f12-4b50-bdca-982ac80a0788 | yuichiro-kurose/kyopro | atcoder/abc366/b/main.cpp | // author: Yuichiro Kurose
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<string> s(n);
int m = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
m = max(m, (int) s[i].size());
}
reverse(s.begin(), s.end());
vec... | ALGO | 0.999993 | 4.221511 |
e8e57411-6a96-47b0-a93c-a2245f047db6 | TheStranger512/Competitive-Programming-Stuff | SPOJ/PT07X.cpp | /* Solved
* 1435. Vertex Cover
* File: PT07X.cpp
* Author: Andy Y.F. Huang
* Created on August 10, 2012, 11:02 PM
*/
#include <cstdio>
#include <cassert>
#ifdef AZN
#include "Azn.cpp"
#endif
using namespace std;
/**
* Solved
* @author Andy Y.F. Huang
*/
namespace PT07X {
const int k_max_size = 100010;
boo... | ALGO | 0.998662 | 5.157794 |
25454b00-07c2-445f-96b9-5ad0e907518a | rokicki/rokicki.github.io | pancake/bpancake.cpp | /**
* Exhaustive exploration of pancakes
*
* No arguments. Compile defining the preprocessor symbol N.
*/
#define SGI_HASH_NAMESPACE __gnu_cxx
#include <cstdio>
#include <stddef.h>
#include <iostream>
using namespace SGI_HASH_NAMESPACE ;
using namespace std ;
#ifndef N
#define N 3
#endif
int bc[1<<N] ;
long lo... | ALGO | 0.998552 | 3.419572 |
c7a05b2a-2407-4ca6-b74c-1eecb6c2ad94 | yinzixuan126/my_udacity | CarND-Path-Planning-Project-P1/src/Eigen-3.3/doc/examples/tut_matrix_coefficient_accessors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << "Here is the matrix m:\n" << m << std::endl;
VectorXd v(2);
v(0) = 4;
v(1) = v(0) - 1;
std::cout << "Here is the vector v:\n... | ALGO | 0.995979 | 3.687909 |
9ca0a8d7-d481-4074-a526-f60260fc24d8 | shubhansu-kr/DailyChallenge-2025-LeetCode | 04_April_2025/23_CountSubArr.cpp | // https://leetcode.com/problems/count-complete-subarrays-in-an-array/?envType=daily-question&envId=2025-04-24
#include <bits/stdc++.h>
using namespace std ;
auto init = []() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
return 'c';
}();
class Solution {
public:
int countCompleteSubarrays(v... | ALGO | 0.999937 | 5.824388 |
fd8e4949-6b5d-4c52-b2b2-3bfa2b16c543 | hankshyu/PowerX | src/texo/cord.cpp | //////////////////////////////////////////////////////////////////////////////////
// Engineer: Tzu-Han Hsu
// Create Date: 02/21/2025 23:19:18
// Module Name: cord.cpp
// Project Name: PowerX
// C++(Version): C++17
// g++(Version): Apple clang version 16.0.0 (clang-160<... | ALGO | 0.985712 | 6.355902 |
01f3cfb9-4008-41fc-a15e-a3c76fd51490 | Haiga/LearningToRank | codes/functionsInC/estruturasDeDados/arvore/arvore.cpp | #include "stdafx.h"
#include "iostream"
#include "arvore.h"
#include "dynamicArrayEmatrix.h"
void Arvore::initialize()
{
raiz = NULL;
tamanho = 0;
}
//anterior esquerda
//prximo direita
void Arvore::addBlock(int value)
{
blocoDuplo* tempBlock;
tempBlock = (blocoDuplo*)malloc(sizeof(blocoDuplo));
tempBlock->da... | ALGO | 0.995801 | 3.249648 |
a7ab246b-c60b-41f8-95f7-6607ccdc8cdc | lbingbing/leetcode | Algorithms/p417_Pacific_Atlantic_Water_Flow/p417_Pacific_Atlantic_Water_Flow_1.cpp | class Solution {
public:
vector<pair<int, int>> pacificAtlantic(vector<vector<int>>& matrix) {
if(matrix.empty()||matrix[0].empty()) return {};
int m = matrix.size();
int n = matrix[0].size();
vector<vector<bool>> p_table(m,vector<bool>(n,0));
vector<vector<bool>> a_table(m,v... | ALGO | 0.999936 | 6.529978 |
2ba3f456-9c43-46ba-b332-81cc614c3d6e | Ved1103/LEETCODE-SOLUTIONS | 0113-path-sum-ii/0113-path-sum-ii.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.999982 | 6.757245 |
a70f8e1c-4629-4106-897e-11bb64435c9a | khanhnamle1994/technical-interview-prep | Pramp-Mock-Interview/2nd-largest-element-BST.cpp | // Write a function to find the 2nd largest element in a binary search tree
#include <iostream>
using namespace std;
// Binary Tree Node class
class BinaryTreeNode {
public:
int value_;
BinaryTreeNode* left_;
BinaryTreeNode* right_;
BinaryTreeNode(int value) : value_(value), left_(nullptr), right_(nullptr) {... | ALGO | 0.999998 | 7.210135 |
89684da3-75cc-4798-9c80-57e1fbda213a | XiandaChen/Handover-LTE-Sim | src/protocolStack/mac/packet-scheduler/dl-exp-packet-scheduler.cpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "dl-exp-packet-scheduler.h"
#include "../mac-entity.h"
#include "../../packet/Packet.h"
#include "../../packet/packet-burst.h"
#include "../../../device/NetworkNode.h"
#include "../../../flows/radio-bearer.h"
#include "../../../protocolStack/rr... | TOOL | 0.912453 | 4.985736 |
a68700f5-73bd-4c89-b860-931fdf964185 | suzyz/LintCode | PartitionArray/partition_array.cpp | class Solution {
public:
/*
* @param nums: The integer array you should partition
* @param k: An integer
* @return: The index after partition
*/
int partitionArray(vector<int> &nums, int k) {
int n = nums.size();
if (n==0)
return 0;
int idx=0;
... | ALGO | 0.999975 | 5.497832 |
6e1b1cfa-b7a0-4a4b-ad73-7a325a3be13e | abubakaristiak/Leetcode-Problems | Easy/_283_Move Zeroes.cpp | //TODO: https://leetcode.com/problems/move-zeroes/
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
void moveZeroes(vector<int>& nums) {
int n = nums.size();
vector<int> ar(n,0);
int j=0;
for(int i=0; i<n; i++){
if(nums[i] != 0){
ar[... | ALGO | 0.999734 | 5.99816 |
06c3950a-729e-4e2c-aeba-7d7c1fb13c3d | Chisj1/C-Course | Bai tap C tuan 3/Woman Attractiveness.cpp | #include <stdio.h>
#include<math.h>
int main()
{
int i;
float a[3];
float rva;
for (i=0;i<3;i++){
scanf("%f", &a[i]);
}
a[2] = a[2]/180*3.14;
rva=a[0] * a[1] *sin(9*a[2]);
if(rva < 0){
printf("invalid");
}
else{
printf("%.1f", rva);
}
}
| ALGO | 0.999211 | 3.553062 |
3b373aa5-4d57-4498-9a56-a5f3b01ecf40 | rpuntaie/c-examples | cpp/algorithm_ranges_all_any_none_of.cpp | /*
g++ --std=c++20 -pthread -o ../_build/cpp/algorithm_ranges_all_any_none_of.exe ./cpp/algorithm_ranges_all_any_none_of.cpp && (cd ../_build/cpp/;./algorithm_ranges_all_any_none_of.exe)
https://en.cppreference.com/w/cpp/algorithm/ranges/all_any_none_of
*/
#include <vector>
#include <numeric>
#include <algorithm>
#incl... | ALGO | 0.96694 | 5.908677 |
5702137e-93d1-4ba4-90cb-f52948fffbd1 | dschaefer/android-box2d | box2d/Source/Dynamics/Contacts/b2CircleContact.cpp | #include "b2CircleContact.h"
#include "../b2Body.h"
#include "../b2Fixture.h"
#include "../b2WorldCallbacks.h"
#include "../../Common/b2BlockAllocator.h"
#include "../../Collision/b2TimeOfImpact.h"
#include <new>
#include <string.h>
b2Contact* b2CircleContact::Create(b2Fixture* fixtureA, b2Fixture* fixtureB, b2BlockA... | ALGO | 0.996444 | 6.913221 |
f87f6b42-9d89-41c9-b3b2-f4999bf3679d | Lhaosv/C_primer_Test | Test-C/数据结构课设/danlianbiaoyingyong.cpp | #include <stdio.h>
#include <stdlib.h>
#define LEN sizeof(poly)
typedef struct term
{
int coef;
int expn;
struct term *next;
} poly, *link;
void createpolyn(link *p, int m);
void printpolyn(link p);
int cmp(link p1, link p2);
link addpolyn(link pa, link pb);
void showyingyong1()
{
link p1, p2;
int ... | ALGO | 0.987337 | 3.130755 |
ea5674c1-6fed-413c-9e00-19466e3fb73b | vivkumar2830/graph | disjoin set/kruskal_algo.cpp | #include <bits/stdc++.h>
using namespace std;
class DisjointSet {
public:
vector<int> rank, parent, size;
DisjointSet(int n) {
rank.resize(n + 1, 0);
parent.resize(n + 1);
size.resize(n + 1);
for (int i = 0; i <= n; i++) {
parent[i] = i;
size[i] = 1;
... | ALGO | 0.999977 | 5.144347 |
2efb2940-c3f3-40f4-97da-5f130f0045b3 | VillainMod/frameworks_av | media/libstagefright/codecs/amrwb/src/dec_alg_codebook.cpp | /*
------------------------------------------------------------------------------
Filename: dec_alg_codebook.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------------------------------------------------------... | ALGO | 0.99991 | 3.930405 |
9074a3c1-5c4f-4afa-84b2-17de24c1ae04 | DushyantBhardwaj07/CodeForces-DSA | A_Bear_and_Raspberry.cpp | #include<bits/stdc++.h>
using namespace std;
#define yes "YES"
#define no "NO"
#define ll long long
#define mod 1000000007
void display(vector<ll>v){ for(ll i=0;i<v.size();i++) cout<<v[i]<<' ';cout<<endl;}
void display2d(vector<vector<ll>> v){for(ll i=0;i<v.size();i++){for(ll j=0;j<v[i].size();j++){cout<<v[i][j]<<' ';}... | ALGO | 0.999986 | 3.478392 |
9a5a83f2-6da1-40d3-8fbd-7238cae9e0ab | rkdehdgns1230/Algorithm-Practice | Graph_theory/problem solving/[2623]_음악프로그램_topology sort.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#define MAX 1001
using namespace std;
int n, result[MAX];
vector<int> a[MAX];
int inDegree[MAX];
void topologySort() {
queue<int> q;
for (int i = 1; i <= n; i++) {
if (inDegree[i] == 0) q.push(i);
}
for... | ALGO | 0.999995 | 4.424782 |
4ef50c57-89df-4e95-961d-5cd5f720ed5f | ArtemRotov/LeetCode | Algorithms/Medium/LowestCommonAncestorOfABinaryTree.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:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q)
{
if (!roo... | ALGO | 0.999974 | 6.076329 |
69441a52-0573-4c74-9ffa-9b042a43c8af | ankamsriman/AZ-solutions | Foundation Maths/2. Divide the Piles.cpp | //ANKAM SRIMAN
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define fi(i, a, b) for (long long int i = a; i < b; i++)
#define fd(i, a, b) for (long long int i = a; i >= b; i--)
#define vl(a, n) vector<ll> a(n)
#define scarr(a) for (long long int... | ALGO | 0.999844 | 4.674939 |
c02714f2-b926-4259-a155-3a707253c8a4 | AherRahul/Data-Structures | C++/C-Plus-Plus-master/operations_on_datastructures/Reverse a Linked List using Recusion.cpp | #include <iostream>
using namespace std;
struct node
{
int val;
node *next;
};
node *start;
void insert(int x)
{
node *t = start;
if (start != NULL)
{
while (t->next != NULL)
{
t = t->next;
}
node *n = new node;
t->next = n;
n->val = x;
n->next = NULL;
}
else
{
node *n = new node;
n->val... | ALGO | 0.999923 | 4.345344 |
f18a342b-20fb-4eea-91b8-c0de50818020 | sofdev-ms/Codeforces | 687A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
void dfs(vector < int > adj [] , int visited[] , int z , int i , int & f)
{
visited[i] = z;
for(auto x : adj[i])
{
if(visited[x] == -1)
{
dfs(adj , visited , !visited[i] , x , f);
}
else if(v... | ALGO | 0.999796 | 3.880397 |
775141a0-b8f0-4383-98b1-661b5394feb1 | neostreet/poker_odds_calculators | flop_pct2.cpp | #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
#define MAIN_MODULE
#include "poker_hand.h"
#define MAX_FILENAME_LEN 1024
static char filename[MAX_FILENAME_LEN];
#define MAX_LINE_LEN 1024
static char line[MAX_LINE_LEN];
static char usage[] = "usage: flop_pct2 (-premium) filename\n";
... | TOOL | 0.917844 | 4.970609 |
bb25eb20-3914-48cc-bba2-ae9c0474a96c | jazzsterq/programs | CPP/newww.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int t, k;
cin >> t;
while (t--) {
int n;
cin >> n;
int arr[n];
for (int i = 0; i<n; i++) {
cin >> arr[i];
}
return 0;
} | ALGO | 0.999174 | 4.180685 |
a8643bb9-7740-4d13-a0af-5ba0231ea972 | hvlgo/2021autumn | data_structure/OJ/2/2.1.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string>
#include <math.h>
#define Max 4000100
namespace fastIO {
#define BUF_SIZE 100000 // ! 缓存区大小(应根据实际情况修改)
#define DECIMAL 6 // ! double 类型的 默认输出保留位数(应根据实际情况修改)
#define LL long long
bool IOerror = 0;//是否读到文件末尾
inline char nc() { static char buf[BUF_SIZE], *... | ALGO | 0.999985 | 3.395952 |
5528fd91-0500-4597-8bfe-5e178a75cb37 | SeanCho1996/opencv-100 | questions/Question_31_40/answers_cpp/answer_40.cpp | #include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <math.h>
#include <complex>
const int height = 128, width = 128, channel = 3;
// DCT hyper-parameter
int T = 8;
int K = 8;
// DCT coefficient
struct dct_str {
double coef[height][width][channel];
};
// Discrete Cosine transfor... | ALGO | 0.999627 | 4.44171 |
f0a0a03f-e6c8-44c5-87dc-e81350a88c60 | Prakhar-002/LEETCODE | 🎭 LEVEL wise que with solution 🎯/♻️ Easy♻️/♻️ Easy 108. Convert Sorted Array to Binary Search Tree ☃️ 🍁 🍰 🎲 💖 - Copy/🎲CPP_108_ConvertSortedArrayToBinarySearchTree.cpp | //! https://github.com/Prakhar-002/LEETCODE
// Todo 📌 QUESTION NUMBER 108
//? ⌚ Time complexity -> O(n) 👉 length of nums array
//? 🧺 Space complexity -> O(1)
#include <vector>
using namespace std;
class Solution{
private:
TreeNode *treeMaker(std::vector<int> &nums, int left, int right){
// ba... | ALGO | 0.999988 | 6.998266 |
f197c75d-3070-48d0-823a-bb66362e3d06 | cssartori/programming-challenge | 1237 - Expert Enough?/1237.cpp | //1237 - Expert Enough? - Carlo Sartori (218326)
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <sstream>
#include <stack>
#include <math.h>
#include <map>
using namespace std;
int main()
{
int T;
cin >> T;
for(int t=0;t<T;t++){
int D;
cin >> D;
map<int, vector<int> ... | ALGO | 0.999764 | 4.211386 |
f8e2af4a-6b1f-4362-8957-5ac82c2765dc | Alaxe/noi2-ranking | 2020/solutions/C/AMG-Sofia-smg/range.cpp | #include<bits/stdc++.h>
using namespace std;
int n,m,x,y,ans;
int a[100005],br[100005],pr[100005];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
br[a[i]]++;
}
for(int i=0;i<=100000;i++){
pr[i+1]+=br[i];
pr[i+1]+=pr[i];
}
cin>>m;
for(int i=0;i... | ALGO | 0.999918 | 4.029453 |
5be4b992-62c7-4865-855b-cf68eea980da | nazfisa/Problem-Solving | dynamic/lcslength.cpp | ///not understand
#include<bits/stdc++.h>
using namespace std;
///char x[100],y[100];
///int m,n;
int max (int a,int b)
{
return (a>b)?a:b;
}
int lcs(char *x,char *y,int m,int n)
{
if(m==0 || n==0)
return 0;
if(x[m-1]==y[n-1])
{
cout<<m<<" "<<n<<endl;
return 1+lcs(x,y,m-1,n-1);}
... | ALGO | 0.99995 | 3.533163 |
1e0a11ce-8983-495a-8d71-b7170e68b6b2 | lkic1625/SimpleProject | algorithm_pr/734B.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int a, b, c, d;
int main() {
cin >> a >> b >> c >> d;
long long ans = 0;
int temp = 0;
temp = min(a, c);
temp = min(temp, d);
ans += 256 * temp;
a -= temp;
temp = min(a, b);
ans += 32 * temp;
cout << ans;
} | ALGO | 0.999063 | 3.247808 |
64424156-a952-465a-9d2a-6d45a8323889 | wildcat-rocketry/llvm | libc/src/math/generic/nearbyintf.cpp | #include "src/math/nearbyintf.h"
#include "src/__support/common.h"
#include "utils/FPUtil/NearestIntegerOperations.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(float, nearbyintf, (float x)) {
return fputil::roundUsingCurrentRoundingMode(x);
}
} // namespace __llvm_libc
| ALGO | 0.991752 | 6.311573 |
3a595cdb-c564-4767-8f10-40cb48eb5640 | lzxy169/FFmpeg-script | fdk-aac-script-0.1.5/fdk-aac-0.1.5/libFDK/src/fft.cpp |
/* -----------------------------------------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Frderung der angewandten Forschung e.V.
All rights reserved.
1. INTRODUCTION
T... | ALGO | 0.999174 | 4.170866 |
869cec43-d2fe-44ae-9b08-c8871efbb690 | Natansh14687/rocking_CPP | StartingC++/Basics/adding_two_numbers_taking_input.cpp | #include<iostream>
using namespace std;
int main() {
int a,b;
cout << "Enter number a: ";
cin >> a;
cout << "Enter number b: ";
cin >> b;
cout << "The value of a + b is : " << a + b << endl;
return 0;
} | TOOL | 0.940384 | 3.852432 |
884973c3-9bd5-414d-bb39-369728873da1 | A6ad/Data_Structure | module_5/creating_a_node.cpp | #include <bits/stdc++.h>
using namespace std;
class node
{
public:
int val;
node *next;
};
int main() {
node a,b,c;
a.val=10;
b.val = 20;
c.val = 30;
a.next=&b ;
b.next = &c;
c.next = NULL;
cout<<a.val << endl;
cout<< (*a.next).val <<endl;
} | ALGO | 0.994406 | 3.045823 |
cfa87585-fe30-4d4b-8abe-206de954ac89 | Abhivic000/CF | S_Sum_of_Consecutive_Odd_Numbers.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while (t--){
int a,b;
cin>>a>>b;
int sum = 0;
if(a<b){
for(int i=a+1; i<b; i++){
if(i%2!=0){
sum += i;
}
}
}
else {
for(int ... | ALGO | 0.999804 | 4.23714 |
fd0def7a-2edd-4770-a6fc-06116e8eda39 | limyunkai19/competitive-programming-codes | Australian Informatic Traning Site/AIO/2009/Carmen Sanfrancisco.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
using namespace std;
typedef pair<int, int> ii;
vector<vector<ii> > graph;
int sequence[510], possible[510][510];
int n, e;
bool dfs(int u, int step){
if(step == e){
return possible[u][step] = true;
}
if(possible[u][step] != -1){
retu... | ALGO | 0.99997 | 3.56573 |
80ebf313-3bf9-4748-b48f-53729ab9d958 | Ahmed-Zaher/CompetitiveProgramming | SPOJ/SPOJ PROOT.cpp | /*
* Given p and a, we want to find if a is a primitive root of p
* Consider the value of a^i mod p, that value can never be 0 because
* a^i will never divide p, and it can only have p - 1 possible values [1, p - 1]
* So we can imagine a graph of p - 1 nodes where there is an edges i->j if i * a = j mod p
* If we ... | ALGO | 0.999764 | 4.439261 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.