uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
58fdb780-2755-411a-a17d-f75e26ce78ed | mpgaillard/SolvedProblems | UVA/Probability/Hats.cpp | #include <iostream>
#include <cstring>
using namespace std;
#define MAX 13
typedef long long ll;
ll Po[MAX+1][2];
ll BC[MAX+1][MAX+1];
void binomialCoefficient(int nMax, int kMax) {
for (int i=0; i<=nMax; i++) BC[i][0] = 1;
for (int j=0; j<=kMax; j++) BC[j][j] = 1;
for (int i=1; i<=nMax; i++)
... | ALGO | 0.999713 | 4.353337 |
1011a812-901b-4d61-a349-a28f280201b4 | HermanChen/Rockchip_4.1_release_libstagefright | 4.1_jb_release/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.999595 | 6.233352 |
67f6e05c-5e92-49f8-9d22-add4a90f2110 | gitcrusher/Cpp_codes | call_by_refference04.cpp | #include <iostream>
using namespace std;
void updateValue(float& num) {
num += 514.24;
}
int main() {
float number = 5.0;
updateValue(number);
cout << number;
return 0;
} | ALGO | 0.98698 | 3.487548 |
f266f766-d769-4516-9a59-4dac7e8bcd7e | satyamtiwari736182/CP | pepcoding/Level 2/Array_&_Strings/64_Meeting Rooms I.cpp | // 1. Question will be provided with "n" meeting-schedules. A meeting-schedule is defined as (sp,ep) i.e. sp --> starting point & ep --> ending point of an meeting. Some meeting-schedules may or maynot overlap each other.
// 2. MeetingIntervals[i] = [startingPointi,endingPointi]
// 3. A meeting-schedule represents mee... | ALGO | 0.99993 | 5.577455 |
4cb48eb4-51c1-4cf0-9188-df7ca48105d0 | exbluesbreaker/test-repo | 3rdparty/OpenCV-2.4.2/modules/imgproc/src/cornersubpix.cpp | #include "precomp.hpp"
CV_IMPL void
cvFindCornerSubPix( const void* srcarr, CvPoint2D32f* corners,
int count, CvSize win, CvSize zeroZone,
CvTermCriteria criteria )
{
cv::AutoBuffer<float> buffer;
const int MAX_ITERS = 100;
const float drv_x[] = { -1.f, 0.f, 1.f... | ALGO | 0.999916 | 5.927304 |
c839ca2b-6304-4b0f-877f-b2605e81a8d4 | Kishaihd/cpp17 | STL/simple_functor.cpp | #include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
template <class T>
class Printer {
public:
void operator() (const T& element) {
std::cout << element << "\t";
}
};
int main() {
std::vector<int> v = {1, 2, 10, 20, 100, 1000, -59};
std::cout << "Print the vector entrie... | TOOL | 0.894555 | 5.534892 |
d8aacfd6-b61f-4a4b-8ba5-66ca1a3609a3 | wolfapple/CarND-Extended-Kalman-Filter-Project | src/kalman_filter.cpp | #include "kalman_filter.h"
using Eigen::MatrixXd;
using Eigen::VectorXd;
KalmanFilter::KalmanFilter() {}
KalmanFilter::~KalmanFilter() {}
void KalmanFilter::Init(VectorXd &x_in, MatrixXd &P_in, MatrixXd &F_in,
MatrixXd &H_in, MatrixXd &R_in, MatrixXd &Q_in) {
x_ = x_in;
P_ = P_in;
F_ =... | ALGO | 0.983267 | 6.172327 |
92b49708-f338-4730-b887-928d99bba5fb | Sumon-Ict/UVA-Problem-Solution | UVA and URI Problem solution/soben11.cpp | #include<iostream>
using namespace std;
int value(long long int m)
{
int d=0;
for(int i=1;i<=m;i++)
if((i%400==0)||((i%4==0)&&(i%100!=0)))
d++;
return(d);
}
int main()
{
long int y,m,d,y1,m1,d1,t,t1;
int n,result;
cin>>y>>m>>d;
if(m<=5)
{
t=y*365+m*31+d+value(y);
... | ALGO | 0.999931 | 4.037511 |
38ba4d3b-7000-45b4-b4db-59e278a49601 | seonghwan7694/BOJ_solved | c++/1615번.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll N, M;
struct node{
int u1, u2;
node(int u1, int u2){
this->u1 = u1;
this->u2 = u2;
}
};
vector<node> v;
const int SIZE = 2000;
ll seg[4 * (SIZE + 10)];
ll sum(int node, int start, int end, int left, int right){
if(e... | ALGO | 0.999942 | 4.25359 |
6c7663f1-ac8e-421f-bcd2-224d92e377f0 | TanviKapurwan23/BinarySearch | vector.cpp | #include <iostream>
#include <vector>
using namespace std;
void display(vector<int> &v)
{
for (int i = 0; i < v.size(); i++)
{
cout << v[i] << " ";
}
cout << endl;
}
int main()
{
vector<int> vect1; // dynamic array
int element, size;
cout << "Enter the size of the vector: ";
... | ALGO | 0.960391 | 3.691483 |
937d6136-0a4f-49fa-bb84-ec14629d39c5 | PushkarWaykole/Leetcode-Solved-questions | Easy/Strings/Valid_Anagram.cpp | #include<bits/stdc++.h>
#include<vector.h>
#include<set.h>
#include<string.h>
class Solution {
public:
bool isAnagram(string s, string t) {
if (s.length() != t.length()) return false;
int n = s.length();
unordered_map<char, int> counts;
for (int i = 0; i < n; i++) {
coun... | ALGO | 0.999974 | 5.809566 |
648592b8-2a49-4a6d-945e-6a814adc888f | amiteshvsth/DSA-C-Plus-Plus | reverseAstring.cpp | #include <iostream>
using namespace std;
int getLength(char ch[]){
int count = 0;
for (int i = 0; ch[i] != '\0'; i++)
{
count++;
}
return count;
}
void reverse(char ch[], int n){
int s = 0;
int e= n-1;
while (s<=e){
swap(ch[s++],ch[e--]);
}
}
int main(){
ch... | ALGO | 0.958874 | 4.225038 |
8e1beb1e-90d3-4ca3-945d-477bab94792c | vengateshsubramaniyan/Spoj-Solutions | BENEFACT.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
void findlong(vector< vector< pair<ll,ll> > > &arr,vector<bool> &visit,ll src,ll &rl,ll &result)
{
ll m1=0,m2=0;
visit[src]=true;
for(ll i=0;i<arr[src].size();i++)
{
ll w=arr[src][i].second;
ll v=arr[src][i].first;
if(visit[v]==false)
{
fi... | ALGO | 0.99991 | 4.454034 |
97d0efa6-fcdc-46f4-ae82-e70801eeb208 | issp-center-dev/TeNeS | src/iTPS/core/full_update.cpp | /*
*
Basic routines independent on unit cell structures.
Using mptensor libraries
(Test version)
2015 Dec. Tsuyoshi Okubo
*/
#include "full_update.hpp"
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <mptensor/complex.hp... | ALGO | 0.999663 | 4.451601 |
ad05bc57-e128-4522-8396-c8efd89c20dd | S-reyapandey/Dsa-course | findarrIntersection.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
vector<int> findArrayIntersection(vector<int> &arr1, int n, vector<int> &arr2, int m)
{
// Write your code here.
int i = 0, j = 0;
vector<int>ans;
while(i<n && j<m)
{
if(arr1[i] == arr2[j])
{
ans.push_back(arr1[i]);
i++;
j++;
}
... | ALGO | 0.99991 | 3.754828 |
7357bb1a-5a26-4e4a-8665-52d196b9cef3 | king-yyf/cpcode | google/metaHackerCup/round2/1.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define f0(e) for(int i = 0; i < (e); ++i)
#define f1(e) for(int i = 1; i <= (e); ++i)
#define f2(i,e) for(int i = 0; i < (e); ++i)
#define fr(i,a,b) for (int i=(a... | ALGO | 0.99974 | 4.550087 |
d639457c-ae03-4898-8340-ffa2a60ec607 | harshgaikwad8208/Practice-Coding-Assignment-CPP-Language | Assignment for C++ Pro/Malloc/Question6.cpp | //Accept array and print only prime numbers of array.
#include<stdio.h>
#include<stdlib.h>
void prime(int*, int);
int main()
{
int b[5];
int* ptr;
ptr = b;
prime(b,5);
}
void prime(int* b, int m)
{
int i = 0,n,j,counter;
//b = (int*)malloc(m);
b = new int[m];
printf("Enter the number.\n... | ALGO | 0.997042 | 3.072143 |
d3866a88-04e7-4b0c-9fec-6b3a010d9a09 | Sid532001/c-c- | add_x_to_last.cpp | #include<string>
#include<bits/stdc++.h>
using namespace std;
string addlast(string s)
{
if(s.length()==0)
return"";
char ch=s[0];
string ans=addlast(s.substr(1));
if(ch=='x')
{
return ans+ch;
}
}
int main()
{
cout<<addlast("ssvbshscxxkjhsxxddzz");
} | ALGO | 0.99838 | 3.431672 |
95e97ac4-6955-4977-ba2d-b0e1bee6d538 | Tamim-saad/LeetCode-Solutions | 0155-min-stack/0155-min-stack.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
typedef tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag,
tree_order_statistics_node_update>
indexed_multiset;
class MinStack {
private:
public:
index... | ALGO | 0.9998 | 5.248308 |
379aa02a-f0cc-471c-b8c6-16cc23431a57 | ishandutta2007/codeforces | doped.silicon/normal/1491/D.cpp | // clang-format off
#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;
#ifndef bhartiya
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx... | ALGO | 0.99996 | 5.433316 |
15b9fac5-264b-4dfd-aa49-ccba82606136 | raincross7/code-similarity | codes/train_code/problem410/problem410_176.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
#define ALL(x) x.begin(),x.end()
#define... | ALGO | 0.999905 | 4.00257 |
af71e59d-1f99-47cd-9fc5-f7d3dda1a28b | Henrik-Yao/NEUQ-ACM-Solution | winter-day1/刘天阳/7-8 括号配对.cpp | #include <bits/stdc++.h>
using namespace std;
stack<char>q;
int ju(char a, char b)
{
if(a == '[' && b == ']') return 1;
else if(a == '{' && b == '}') return 1;
else if(a == '(' && b == ')') return 1;
return 0;
}
int main()
{
string s;
cin >> s;
for(int i = 0; i < s.length(); i++)
{
if(s[i] == '{' || s[i] == '... | ALGO | 0.999909 | 4.491019 |
46a005ff-d2e4-41a8-808a-87c4abba14fd | DarylDixonbigfans/testgit | bustub-master/third_party/libpg_query/src_common_keywords.cpp | /*--------------------------------------------------------------------
* Symbols referenced in this file:
* - ScanKeywords
* - NumScanKeywords
* - ScanKeywordLookup
*--------------------------------------------------------------------
*/
#include "pg_functions.hpp"
#include <string.h>
#include <string>
#include ... | TOOL | 0.956593 | 6.24166 |
6439746f-3df1-49a3-a34d-4eb1c064062f | changyubiao/data_structure-immoc-course | Reverse-Pair/main.cpp | #include <iostream>
using namespace std;
template<typename T>
int getReversePair(T arr[], int n) {
/*
* 获取数组的逆序对 数量
* 暴力解法
* */
int i, j = 0;
int count = 0;
for (i = 0; i < n; i++) {
for (j = i + 1; j < n; j++) {
if (arr[j] < arr[i]) {
count++;
... | ALGO | 0.999352 | 4.509819 |
d2a64ff3-80eb-4d00-bed1-7354a4fe021e | GMAP/GSParLib | examples/pattern_api/matrix_multi_map_cm.cpp | #include <iostream>
#include <chrono>
#include <iomanip>
std::chrono::steady_clock::time_point tInitialization;
std::chrono::steady_clock::time_point tComputation;
std::chrono::steady_clock::time_point tFinishing;
std::chrono::steady_clock::time_point tEnd;
#ifdef GSPARDRIVER_CUDA
#include "GSPar_CUDA.hpp"
n... | ALGO | 0.997703 | 4.032566 |
cb774117-b5b6-4d92-9a8a-9b2f9c94df71 | j232suya/code_C- | B-1.cpp | #include <iostream>
#include <algorithm>
#include <climits> // LLONG_MAX を使用するために必要
using namespace std;
int main() {
long long H, W;
cin >> H >> W;
// 初期値として大きな値を設定
long long min_area = LLONG_MAX;
// 縦に切った場合
for (int i = 1; i <= W / 2; ++i) {
long long area1 = H * i;
long lon... | ALGO | 0.999949 | 4.917539 |
0a1d27f6-3e5c-4cb5-bb59-4cb012629ba6 | juanplopes/icpc | uva/273.cpp | //273
//Jack Straws
//Graphs;DFS
#include <iostream>
#include <cstring>
#define MAX 100002
using namespace std;
static bool segment(int xi, int yi, int xj, int yj,
int xk, int yk) {
return (xi <= xk || xj <= xk) && (xk <= xi || xk <= xj) &&
(yi <= yk || yj <= yk) && (yk <= yi || yk <... | ALGO | 0.999442 | 4.276317 |
00203eb6-cb70-48d6-8066-02d8cf0ea84d | dabinchiii/Algorithm | SWEA/D2/1961. 숫자 배열 회전/숫자 배열 회전.cpp | #include <iostream>
using namespace std;
int n;
int board[7][7];
int r90[7][7], r180[7][7], r270[7][7];
void solve(){
cin >> n;
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
cin >> board[i][j];
}
}
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
r90... | ALGO | 0.99975 | 4.082247 |
73970a7b-a11d-46ad-b544-9d34b2115eb0 | ArseniyKholod/stce_ss24_ex12 | thirdParty/dcl6i38ngl_v381/examples/ga1s_Jacobian/driver.cpp | #include <vector>
#include "dco.hpp"
using namespace std;
using namespace dco;
typedef double AD_BASE_TYPE;
typedef ga1s<AD_BASE_TYPE> AD_MODE;
typedef AD_MODE::type AD_TYPE;
typedef AD_MODE::tape_t AD_TAPE_TYPE;
#include "f.hpp"
void a1s_driver(const vector<double>& xv, vector<double>& yv, vector<vector<double>>& ... | ALGO | 0.99503 | 4.825435 |
0d04f3d1-aa75-439f-92b1-ac7698c8b1a3 | ishandutta2007/codeforces | yasugongshang/normal/757/E.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<queue>
using namespace std;
typedef long long LL;
#define sqr(x) ((x)*(x))
#define mp make_pair
inline char gc(){
static char buf[100000],*p1=buf,*p2=buf;
return p1==p2&&(p2=(p1=buf)+fr... | ALGO | 0.999926 | 3.760804 |
1a4360e0-555a-4f1a-b611-c9e1e969a49a | Arthur-St-06/SapiensParametricHeadReconstruction | flame-fitting/eigen/doc/examples/tut_arithmetic_dot_cross.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
Vector3d v(1,2,3);
Vector3d w(0,1,2);
cout << "Dot product: " << v.dot(w) << endl;
double dp = v.adjoint()*w; // automatic conversion of the inner product to a scalar
cout << "Dot product via a matrix product... | ALGO | 0.99899 | 4.042919 |
3d1c29c2-44df-47bb-a554-84f3a12674b8 | NobelSS/CP-Problems | SPOJ/ZSUM.cpp | #include<stdio.h>
typedef long long LL;
const int MOD = 10000007;
LL modexp(LL b, LL e, LL m) {
LL r = 1;
while (e > 0) {
if ((e & 1) == 1) {
r = (r * b) % m;
}
e >>= 1;
b = (b * b) % m;
}
return (LL) r;
}
int main(){
LL n, k;
while(true){
scanf("%lld %lld", &n, &k);
if(n == 0 && ... | ALGO | 0.999886 | 3.862364 |
60254215-89ce-42e1-8989-1d0f7fd3a610 | dvansari65/codsoft | CodeSoft/tictac.cpp | #include <iostream>
using namespace std;
char board[3][3]; // 3x3 grid for the game
char currentPlayer = 'X'; // 'X' starts the game
// Function to initialize the board
void initializeBoard() {
char num = '1';
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
board[i][j] = num++... | ALGO | 0.998408 | 7.082661 |
52783f1f-b768-4fb5-957a-06f872d7bbe7 | raincross7/code-similarity | codes/train_code/problem352/problem352_273.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main() {
int n;
scanf("%d", &n);
vector<int> a(n + 2);
a[0] = 0, a[n + 1] = 0;
for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
int max_cost = 0;
rep(i, n + 1) max_cost += abs(a[i] - a[i + 1])... | ALGO | 0.999179 | 3.58053 |
5ab0b489-0977-48dd-89d0-9e976dc182e0 | oCreaCo/LOCATOR | PostgreSQL/llvm-project/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | #include "llvm/Analysis/ModuleSummaryAnalysis.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llv... | TOOL | 0.953264 | 6.127198 |
7c4a10b0-940b-4fc3-bb70-a3c616a10b40 | deep-blu109/Algorithm_Practice | programmers/coloringBook/coloringBook.cpp | #include <vector>
#include <queue>
#include <algorithm>
using namespace std;
// 전역 변수를 정의할 경우 함수 내에 초기화 코드를 꼭 작성해주세요.
// 범위 체크
bool outOfRange(int r, int c, int m, int n){
if(r < 0 || c < 0 || r >= m || c >= n){
return true;
}
return false;
}
int bfs(vector<vector<int>> &picture, vector<vector<b... | ALGO | 0.999844 | 6.319649 |
2d2724c8-6b5c-4055-9960-aa8264d9fff3 | Coach-Academy/Winter-1-2023 | Level 2 Class 1/Practice G4/Week 13/I.cpp | #include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
void doWork() {
int n,k;
cin >> n >> k;
vector<int> v(n);
for (int i = 0; i < n; ++i) {
cin >> v[i];
}
sort(v.begin(), v.end());
int ans =0 ;
while (v[(v.size()+1)/2 - 1] != k)
{
v... | ALGO | 0.999893 | 4.507959 |
ca22bb56-2fe3-4bbd-bf33-6a49de2f94c7 | kosy318/algorithm | 프로그래머스/014. lv2 튜플.cpp | // https://jolly-note.tistory.com/39?category=1025701
#include <string>
#include <vector>
#include <regex>
using namespace std;
vector<vector<int>> split(string str){
smatch match;
vector<vector<int>> res;
while(regex_search(str, match, regex("(\\d|,)+"))){
string matched = match.str();
s... | ALGO | 0.999819 | 4.71898 |
89981cba-b29d-4567-b66d-427c8cc16aeb | yukinagae/Armadillo | frameworks/cocos2d-x/cocos/math/Vec2.cpp | #include "math/Vec2.h"
#include "math/MathUtil.h"
#include "base/ccMacros.h"
NS_CC_MATH_BEGIN
// returns true if segment A-B intersects with segment C-D. S->E is the ovderlap part
bool isOneDimensionSegmentOverlap(float A, float B, float C, float D, float *S, float * E)
{
float ABmin = std::min(A, B);
float A... | TOOL | 0.972735 | 6.886364 |
2cc179b3-5e49-4791-acdd-5454070ab62f | dotSlash-Adwitiya/Dynamic-Programming | DP on Grids/minGridPathSum.cpp | #include<bits/stdc++.h>
using namespace std;
// * Recursive Approach
// * T.C : O (2ⁿ) because there are 2 calls.
int helper(int row, int col, vector<vector<int>> &grid) {
if(row == 0 && col == 0){
return grid[row][col];
}
if(row < 0 || col < 0)
return 1e9;
int left = grid[row][col... | ALGO | 0.999946 | 5.723615 |
526cee28-9e8d-4fa1-81c8-59139a663484 | chinoll/freebsdsrc | contrib/llvm/lib/Transforms/Utils/LoopUnroll.cpp | #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopIterator.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Transforms/Ut... | ALGO | 0.943377 | 7.243209 |
aeb60050-01f1-46ee-abdd-4371394a5260 | Able2002/GFG-POTD | July 2023/Kth Ancestor in a Tree.cpp |
//User function Template for C++
/*
Structure of the node of the binary tree is as
struct Node
{
int data;
struct Node *left, *right;
};
*/
// your task is to complete this function
bool findallans(Node *root, vector<int> &v, int node){
if(root==NULL)
return false;
if (root ->data==node)
return true... | ALGO | 0.999993 | 5.285987 |
c06f1e27-2415-41d4-a0eb-74c9a442b7f5 | mukuldeep/cs | cp/CodeForces/cdfr_1538C_pre.cpp | //
// Created by me on 10-06-2021.
//
#include <bits/stdc++.h>
#define SYNC ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define DRIVER int main(){SYNC ll t=1;I_ t;W_(t)soln(t);return 0;}
#define TEST_DRIVER int cc_main(){SYNC ll t=1;I_ t;W_(t)soln(t);return 0;}
#define FR_(a,c) for (ll (a)=0;(a)<(c); (a)++)
#... | ALGO | 0.999917 | 4.196046 |
132c299e-ceb7-4ee7-95b7-9c0969da15a0 | tripathidivyansh/leetcode_question | 515-find-largest-value-in-each-tree-row/find-largest-value-in-each-tree-row.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.999985 | 6.087389 |
49f6a722-e572-486b-a428-fcfc134dbb9c | kosalvireak/C-Plus-Plus | RUPP_Y1S2/Pointer/pointer_practice_24_08.cpp | #include <iostream>
using namespace std;
int main()
{
// int number = 20;
// int *pvalue;
// pvalue = &number;
// cout << number << endl; //call by value
// cout << pvalue << endl;
// cout << *pvalue; //call by reference
const char *word = "hello";
const char *pproverb2 = "Hello ... | TOOL | 0.882752 | 3.152954 |
f8ea68d7-cd23-4e09-b638-bbec644a6683 | SunZhiguo19/MG-MixF-PPP-AR-software | software/MG-MixF PPP-AR/resources/myeigen/bench/quat_slerp.cpp | #include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Q>
EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t)
{
return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized());
}
template<typename Q>
EIGEN_DONT_INL... | ALGO | 0.995359 | 6.251058 |
ad9f5bc8-c594-4197-94d5-92940f0eddbb | ssinghal04/DSA_PRACTICE | stack_1.cpp | #include<iostream>
using namespace std;
int size = 10;
int top = -1;
int a[10];
void push()
{
if(top == size-1)
cout<<" stack overflow "<<endl;
else
{
int x;
cout<<"enter element which u want to push into stack : "<<endl;
cin>>x;
top++;
a[top] = x;
}
}
void pop()
{
if(top == -1)
cout<<"stack underfl... | ALGO | 0.99571 | 3.795385 |
5c1b6899-c0bd-441c-89c5-18deefea427c | Mythili007/CodePractice | LeetCode/EASY/TREES/findSecondMinInBT.cpp | /*
* https://leetcode.com/problems/second-minimum-node-in-a-binary-tree/
* 671. Second Minimum Node In a Binary Tree
*/
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
/**
* Definition for a binary tree node.
*/
struct TreeNode
{
int val;
Tr... | ALGO | 0.999993 | 5.487702 |
e573d4f6-3a0e-41b6-979a-9299c02b9cd6 | hansh0101/Algorithm_BaseCamp | c++_ps/programmers/level2/92335.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int solution(int n, int k) {
int answer = 0;
string str = "";
while (n != 0) {
str += to_string(n % k);
n /= k;
}
reverse(str.begin(), str.end());
string substr = "";
vector<lo... | ALGO | 0.99984 | 5.050442 |
6f0c06d0-b6ba-493d-afcb-69d8e1c162b3 | luolaihua/pcl-project | pcl_surface/1_resampling/source/resampling.cpp | #include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/surface/mls.h>
#include<pcl/visualization/cloud_viewer.h>
int
main (int argc, char** argv)
{// һʵ͵ļصPointCloud
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ> ());
// bun0.pcdļ... | ALGO | 0.973836 | 3.210244 |
ea4c12c1-b03f-48fc-9866-d277e6c1872c | ajtowns/bitcoin-deb | src/rpc/blockchain.cpp | #include "amount.h"
#include "chain.h"
#include "chainparams.h"
#include "checkpoints.h"
#include "coins.h"
#include "consensus/validation.h"
#include "main.h"
#include "policy/policy.h"
#include "primitives/transaction.h"
#include "rpc/server.h"
#include "streams.h"
#include "sync.h"
#include "txmempool.h"
#include "u... | WEB | 0.859422 | 4.69883 |
64c411e0-2011-4ff7-af68-dcce3eae89f5 | WhiteCells/code | algo/lc/8_greedy/9-135-candy.cpp | #include "D:/distake/Coding/head_file.h"
/*
* @Author: WhiteCells
* @Date: 2023-05-22 20:48:52
* @Last Modified by: WhiteCells
* @Last Modified time: 2023-05-22 20:48:52
* @Description: 135.分发糖果
* https://leetcode.cn/problems/candy/
*/
class Solution {
public:
int candy(vector<int>& ratings) {
vecto... | ALGO | 0.999999 | 6.22631 |
52c40749-12fd-436c-8fc1-94f6ab13efc8 | LeoVargass/Programacion-Competitiva | HACKER RANK/roads_and_libraries.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
vector<vector<ll>>grafo;
vector<ll>id;
vector<vector<ll>>grupos;
bool find(ll nodo_a, ll nodo_b){
if(id[nodo_a] == id[nodo_b]) return true;
return false;
}
void merge(ll a, ll b){
ll tam_g_a = grupos[id[a]].size();
... | ALGO | 0.999901 | 3.982688 |
80a18f6f-a006-4f0c-96b0-0adeb82baf93 | sanskarsinghh/Strivers-A2Z-DSA-Course-Sheet | Step 4 - Binary search/Step - 4.1/BinarySearch.cpp | #include <bits/stdc++.h>
using namespace std;
// Iterative implementation
void BinarySearch(int arr[], int n, int k) // Time complexity - O(log(n)) Space complexity - O(1)
{
int start = 0;
int end = n - 1;
int mid, loc = -1;
while (start <= n - 1)
{
mid = (start + end) / 2;
if (arr... | ALGO | 0.999951 | 5.771196 |
fb7895ba-9ea7-442c-8e47-fe743743e1ba | doblerk/graph-matching | third_party/boost/libs/sort/example/int64.cpp | // See http://www.boost.org/libs/sort for library home page.
#include <boost/sort/spreadsort/spreadsort.hpp>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
using namespace boost::sort::spreadso... | ALGO | 0.978528 | 4.607142 |
726e0bec-9ce2-4542-a36f-cf5ff552bec5 | PrernaSingh587/Leetcode-questions | 2196-create-binary-tree-from-descriptions/2196-create-binary-tree-from-descriptions.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.999894 | 5.914433 |
ada89a6e-c499-43a1-b5ce-8795e1d2096c | Henserk/CPP_2023 | S_42.cpp | #include <iostream>
using namespace std;
void sort(int arr[]) { //изменил тип функции sort на void, так как она не возвращает никакого значения.
for (int i=0; i<10; i++) {
for (int j=0; j<10-1-i; j++) {
if(arr[j]<arr[j+1]) {
//Вместо использования функции swap, создал временную переменную temp... | ALGO | 0.999867 | 4.008701 |
4271b6a0-57a4-4573-b791-2b1ed693e90f | aliverobotics/Pumas-SmallSize | PUMA_Clips/clips/emathfun.cpp | /*******************************************************/
/* "C" Language Integrated Production System */
/* */
/* CLIPS Version 6.22 06/15/04 */
/* */
/* ... | TOOL | 0.886402 | 4.574937 |
67656c3f-0e2f-4472-aa8f-970f9f8361c3 | k1nd-cat/os-labs | shell/src/benchmark/multi_bench.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include <thread>
#include <iomanip>
#include "bench1.h"
#include "bench2.h"
void workerThreadShortPath(const std::vector<std::vector<int>> &graph, const int &startNode, const int &repetitionsCount, double &totalTime) {
totalTime += measureShortPathTime(graph... | ALGO | 0.999401 | 5.635361 |
f06e7537-e055-4785-9f77-2024d771578a | 1tav0/TranslatingDsa | C++/Graphs/40-maximumStoneRemoval.cpp | class Solution {
public:
class DisjointSet{
public:
vector<int> parent, size, rank;
DisjointSet(int n){
parent.resize(n+1);
rank.resize(n+1, 0);
size.resize(n+1, 1);
for(int i=0; i<n; i++){
parent[i] ... | ALGO | 0.999531 | 5.406308 |
f2a8c396-2c56-494b-b1aa-d7ad3f510b76 | David012345678/BIGMAN | rev.cpp | #include<iostream>
using namespace std;
int main()
{
int a,b,c,d,e;
cout<<"Enter the first element=\n";
cin>>a;
cout<<"Enter the second element=\n";
cin>>b;
cout<<"Enter the third element=\n";
cin>>c;
cout<<"Enter the fourth element=\n";
cin>>d;
cout<<"Enter the fifth element=\n";
cin>>e;
cout<<"The sum... | ALGO | 0.983405 | 3.141172 |
6dbdd5cb-efa3-4d18-8527-dc90f0d7a3e2 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/july/ChefAndDragonDens_20200712230444.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<unordered_map>
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ... | ALGO | 0.999986 | 4.525051 |
77443582-04bb-4273-94af-aeff48b830e5 | Wave-Project/system_core-old | libutils/JenkinsHash.cpp | /* Implementation of Jenkins one-at-a-time hash function. These choices are
* optimized for code size and portability, rather than raw speed. But speed
* should still be quite good.
**/
#include <stdlib.h>
#include <utils/JenkinsHash.h>
namespace android {
#ifdef __clang__
__attribute__((no_sanitize("integer")))
... | ALGO | 0.984629 | 7.082112 |
5f758ad4-6739-4371-b466-82ba54381f57 | kaziikram678/CodeChef-Solutions | Starters 163/Minimum_Types.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n, x;
cin >> n >> x;
vector<int> v;
for (int i = 0; i < n; i++)
{
int x;
cin>>x;
v.push_back(x);
}
for (int i = 0; i... | ALGO | 0.999259 | 3.762443 |
c0dab23f-d315-4f7a-a0e6-d9a4bb0ac2b0 | Mesks/FPNforV-PCC | dataExtracting/dependencies/SHM-12.4/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp | /** \file TComRdCostWeightPrediction.cpp
\brief RD cost computation class with Weighted-Prediction
*/
#include <math.h>
#include <assert.h>
#include "TComRdCost.h"
#include "TComRdCostWeightPrediction.h"
static Distortion xCalcHADs2x2w( const WPScalingParam &wpCur, const Pel *piOrg, const Pel *piCurr, Int ... | ALGO | 0.999297 | 3.656881 |
147e91ae-0959-4e70-8757-affe0b9725cc | alexandraback/datacollection | solutions_5669245564223488_0/C++/gotto/B.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int T;
int N;
string s[111];
int bit_count(long long bit){
int c = 0;
for(; bit; bit>>=1){
c += bit&1;
}
return c;
}
int dp[1<<11][11][2];
int solve(int bit,int a,int b){
if(bit+1 == 1<<N... | ALGO | 0.999901 | 4.534188 |
db9be28c-2ea1-432a-b303-c8472b01aa8b | lyz508/GPE | problems/10409-mid-summer-night.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int tmp, n, mid[2], m;
vector<int> v;
while (cin >> n){
v.clear();
m = 0;
for (int i=0; i<n; i++){
cin >> tmp;
v.push_back(tmp);
}
... | ALGO | 0.998879 | 3.208248 |
7f27c900-9a1c-4b66-b221-1adef2c8eb41 | Code-OS/packages_inputmethods_LatinIME | native/jni/src/dictionary/structure/pt_common/dynamic_pt_updating_helper.cpp | #include "dictionary/structure/pt_common/dynamic_pt_updating_helper.h"
#include "dictionary/property/unigram_property.h"
#include "dictionary/structure/pt_common/dynamic_pt_reading_helper.h"
#include "dictionary/structure/pt_common/dynamic_pt_writing_utils.h"
#include "dictionary/structure/pt_common/patricia_trie_read... | TOOL | 0.934238 | 7.507117 |
a63e71df-dd23-4a40-99ca-65e5d8f9dfca | jaredramey/AutomationTest_Playground | Engine/Source/Developer/MaterialBaking/Private/MaterialBakingHelpers.cpp | #include "MaterialBakingHelpers.h"
#include "Math/Color.h"
#include "Async/ParallelFor.h"
namespace FMaterialBakingHelpersImpl
{
static FColor BoxBlurSample(FColor* InBMP, int32 X, int32 Y, int32 InImageWidth, int32 InImageHeight, uint32 BackgroundDWColor)
{
int32 PixelsSampled = 0;
int32 CombinedColorR = 0;
i... | ALGO | 0.902566 | 7.658558 |
b0437a7b-bb1b-4b49-9b2f-85b2429fe7a6 | Valet78/skillbox | 11-20/14 Two-dimensional arrays/14.6_z2/main_14-2.cpp | // Задание 14.6.2 Крестики-нолики
#include<iostream>
std::string CheckInputOfEmpty(std::string); // Проверка ввода строки и пустого ввода
int InputNumber(std::string); // Ввод числа
// Функция вывода матрицы (для контроля действий)
template <int rows, int col, typename type_m>
void PrintMass(type_m (&i... | ALGO | 0.973629 | 4.794662 |
7074c203-5d8c-424c-a57c-8f021a2a4e76 | ung-steven/competitive_programming | Olympiads Work/Week 5/CCC '09 S4 - Shop and Ship.cpp | #include <bits/stdc++.h>
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define endl '\n'
#define exists(s, e) (s.find(e)!=s.end())
#define WHILE(n)
#define pb push_back
#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(... | ALGO | 0.999968 | 4.076324 |
f9ae4417-e0a3-49b5-885b-0ac99dd7daa2 | krzywy-ziemniak/informatyk | lekcja 4/liczenie.cpp | #include <iostream>
using namespace std;
int main(){
int a, b;
cout << "Podaj liczbe: ";
cin >> a;
cout << "Podaj druga liczbe: ";
cin >> b;
int suma = a + b;
int roznica = a - b;
int iloczyn = a * b;
cout << "Suma: " << suma << endl;
cout << "Roznica: " << roznica << endl;
cout << "Iloczyn: " << iloc... | ALGO | 0.951346 | 3.883768 |
219cccf0-e954-440e-b8b3-aa558294600b | CarloNicolini/GibbsGibbs | src/eigen/doc/examples/DenseBase_template_int_middleRows.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(1..3,:) =\n" << A.middleRows<3>(1) << endl;
return 0;
}
| ALGO | 0.915268 | 3.245548 |
8db28d73-4bfa-4245-abbc-fabe49600164 | nationalbitcoin/russianbitcoin | src/crypto/sha3.cpp | // Based on https://github.com/mjosaarinen/tiny_sha3/blob/master/sha3.c
// by Markku-Juhani O. Saarinen <<EMAIL>>
#include <crypto/sha3.h>
#include <crypto/common.h>
#include <span.h>
#include <algorithm>
#include <array> // For std::begin and std::end.
#include <stdint.h>
// Internal implementation code.
namespace... | ALGO | 0.999185 | 7.67463 |
920d81c1-73c4-4c56-85b5-652cfd357a79 | GoodGuySteve/SchoolProjects | CS140/final/finalProject/finalProject/Bag.cpp | //Author 1: Steven Cabral
//Bag and Pennant classes based on the classes found in the paper by Leiserson
//and Schardl linked to on the BFS project page
#include "Bag.h"
Pennant::Pennant() : left(nullptr), right(nullptr) {
}
Pennant::Pennant(ULLI d) : data(d), left(nullptr), right(nullptr) {
}
Pennant::~Pennant() ... | ALGO | 0.971404 | 4.03028 |
d28c83b8-4648-4053-828c-b57d4eb15e96 | Lucielpuma/a | intercambio.cpp | #include <iostream>
using namespace std;
void intercambio(int &a , int &b){
int tmp=a;
a=b;
b=tmp;
}
int main(){
int x=10;
int y=20;
intercambio(x,y);
cout<<x<<endl;
cout<<y<<endl;
return 0;
} | ALGO | 0.991341 | 3.612013 |
70be1c37-1064-4bfa-bf5f-e3bc87f3b8ce | shubsolos19/LEETCODE-DSA | 594-longest-harmonious-subsequence/longest-harmonious-subsequence.cpp | class Solution {
public:
int findLHS(vector<int>& nums) {
sort(nums.begin(), nums.end());
int j = 0, maxLength = 0;
for (int i = 0; i < nums.size(); ++i) {
while (nums[i] - nums[j] > 1) {
++j;
}
if (nums[i] - nums[j] == 1) {
... | ALGO | 0.999923 | 5.885401 |
530fa009-714a-4b17-8d7f-9a7a1e4968dd | Abhi2839/cipher-school | day 22 2.cpp | using namespace std;
#include <iostream>
#include<climits>
class stacks {
int capacity;
int *arr;
int top;
// all these prop are private by default
public:
stacks(int c){
this->capacity=c;
arr=new int[c];// size of array; dynamic memory allocation
this->top=-1;
}
... | ALGO | 0.991186 | 4.344275 |
5fc9a5f4-cea5-454c-9e3a-eb7834003380 | ChenSR-72/AP4.5.6 | libraries/AP_HAL_SITL/DSP.cpp | #include <AP_HAL/AP_HAL.h>
#if HAL_WITH_DSP
#include "AP_HAL_SITL.h"
#include <AP_Math/AP_Math.h>
#include <GCS_MAVLink/GCS.h>
#include "DSP.h"
#include <cmath>
#include <assert.h>
using namespace HALSITL;
extern const AP_HAL::HAL& hal;
// The algorithms originally came from betaflight but are now substantially mo... | ALGO | 0.983412 | 5.869491 |
fd9d9a2f-c6d0-47aa-829a-920386aed49b | Tamim-Mahmud/Compititive-Programming | Codeforces Problem/1747A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
ll n;cin>>n;
ll lessZero=0,greaterZero=0;
for(ll i=0;i<n;i++){
ll a;cin>>a;
if(a<0)lessZero+=a;
else greaterZero+=a;
}
ll temp=abs(lessZero);
if(abs(temp>greaterZero)) cout<<temp-greaterZero<<... | ALGO | 0.999924 | 4.564843 |
265da7be-e6d3-4307-8018-08b73af4ecf7 | mtnitcode/deitel | ch22/ch22/fig22_08/fig22_08.cpp | // Fig. 22.8: fig22_08.cpp
// Bitwise AND, inclusive OR,
// exclusive OR and complement operators.
#include <iostream>
#include <iomanip>
using namespace std;
void displayBits(unsigned); // prototype
int main() {
// demonstrate bitwise &
unsigned number1{2179876355};
unsigned mask{1};
cout << "The result... | ALGO | 0.980243 | 7.150582 |
835149a0-7ab2-4cc1-8f8b-43ca7323a368 | tejas-sangale01/6-Companies-30-Days | Goldman Sachs/Q1_Solution.cpp |
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
class Solution{
public:
vector<vector<string> > Anagrams(vector<string>& string_list) {
//code here
vector<vector<string>> v;
map<string,vector<string>> m;
for(int i=0; i<string_list.size();i++)
{
... | ALGO | 0.999992 | 5.077641 |
276a83f5-482d-4a7a-959f-003f25a1f679 | parth-jangam/Gfg_to_git | Medium/Sort an array of 0s, 1s and 2s/sort-an-array-of-0s-1s-and-2s.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
void sort012(int a[], int n)
{
// code here
int low=0;
int mid=0;
int high=n-1;
while(mid<=high){
if(a[mid]==0){
swap(a[mid]... | ALGO | 0.999858 | 6.234526 |
1053a930-49cd-45b6-8633-5c2522da6fe7 | yoshiya-usui/femtic | src/Forward2DTriangleElement1stOrderNodeBased.cpp | // Constructer
Forward2DTriangleElement1stOrderNodeBased::Forward2DTriangleElement1stOrderNodeBased( const int planeID, const int iPol ):
Forward2DTriangleElementNodeBased( planeID, iPol )
{}
// Destructer
Forward2DTriangleElement1stOrderNodeBased::~Forward2DTriangleElement1stOrderNodeBased(){
}
// Calculate EM fiel... | ALGO | 0.996995 | 5.182266 |
ac770d97-ce3a-4e2d-9556-44cdb7d84e44 | 53ningen-learning/snippets | atcoder/tessoku-book/tessoku_book_dy.cpp | #include <iostream>
#include <queue>
using namespace std;
char BLACK = '#';
char WHITE = '.';
char BLUE = '@';
int main()
{
int N, X;
string A;
cin >> N >> X >> A;
queue<int> q;
q.push(X - 1);
A[X - 1] = BLUE;
while (!q.empty())
{
int pos = q.front();
q.pop();
... | ALGO | 0.99998 | 4.272592 |
968705e7-2a90-4c28-a878-f0f8187304a1 | devilegdeknife/Programming_learning | hello-algo-main/zh-hant/codes/cpp/chapter_heap/my_heap.cpp | /**
* File: my_heap.cpp
* Created Time: 2023-02-04
* Author: LoneRanger (<EMAIL>), what-is-me (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 大頂堆積 */
class MaxHeap {
private:
// 使用動態陣列,這樣無須考慮擴容問題
vector<int> maxHeap;
/* 獲取左子節點的索引 */
int left(int i) {
return 2 * i + 1;
}
/* 獲取右子節... | ALGO | 0.999708 | 5.292484 |
d66b114a-1d70-4188-ab06-6b2ace68cea4 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4356_124.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int M;
cin >> M;
cout << 24 + M;
}
| ALGO | 0.983927 | 3.533226 |
2373fc02-33a8-4707-af6a-6aa79db318b1 | okkjoo/okj-algo-template | code/blueCup/acw1229.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int> PII;
#define FOR(i, n, m) for (int i = n; i < m; ++i)
int months[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
bool isLeap(int year){
if(year % 400 == 0 || (year%100 != 0 && year%4 == 0)) return true;
return false;
}
int y,... | ALGO | 0.999881 | 3.807585 |
d06826b1-1d9c-4903-93f3-1c91af7a595a | xLLLxLLLx/xLLLx | cf/1196/D.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 10;
int a[N], qz[N][3][3], nm[N][3];
char lx[N];
int zh(char ch) {
if(ch == 'R') return 0;
if(ch == 'G') return 1;
if(ch == 'B') return 2;
}
int main() {
int q;
scanf("%d", &q);
for(int o = 1; o <= q; ++o) {
int n, len;
s... | ALGO | 0.999719 | 3.839847 |
55e99c18-9b21-45e2-b8a2-14f02c162571 | diohabara/competitive_programming | ac/prev/abc123_b.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#define endl '\n'
using namespace std;
int dy[4] = {1, 0, -1, 0}, dx[4] = {0, 1, 0, -1};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int num[5];
rep(i, 5) { cin >> num[i]; }
int rest = 10, min = 0;... | ALGO | 0.99984 | 4.028039 |
12d6d8cb-ae8f-47c2-b65a-fa5d4345e599 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_9695_10.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, cnt = 0;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (int i = 0; i < n; i++) {
cnt += (a[i + 1] - a[i]);
}
cout << cnt;
return 0;
}
| ALGO | 0.999766 | 3.929364 |
3ac7bcaf-91c6-4b10-a646-8c4222ed0d8f | rockoman3/unreal4.17.2withtiffsupport | Engine/Source/ThirdParty/PhysX/PhysX_3.4/Source/PhysXCooking/src/Quantizer.cpp | #include "Quantizer.h"
#include "foundation/PxVec3.h"
#include "foundation/PxBounds3.h"
#include "PsUserAllocated.h"
#include "PsAllocator.h"
#include "PsArray.h"
#include "CmPhysXCommon.h"
using namespace physx;
PxU32 kmeans_cluster3d(const PxVec3 *input, // an array of input 3d data points.
PxU32 inputSize,... | ALGO | 0.996515 | 6.429296 |
4c5e5da9-b88d-46b6-baf4-8e2079ea6097 | LyTruongsinh/DSA | test/src/Priority_Queue.cpp | #include <iostream>
using namespace std;
#define MAX 100
void minHeapify(int heap[], int n, int i)
{
int smallest = i;
int left = 2 * i + 1; // Vị trí con trái
int right = 2 * i + 2; // Vị trí con phải
// Kiểm tra con trái
if (left < n && heap[left] < heap[smallest])
smallest = left;
... | ALGO | 0.999742 | 4.980222 |
3d8092d8-fefe-499c-ae43-81e8034c60da | arunthe01/problem_solving | remove_duplicate _from_sorted_array.cpp | int remove_duplicate(int arr[],int n){
// code here
int count=0,k=0;
while(k<n){
int i = k;
arr[count++] = arr[i];
while(arr[i] == arr[k]){
++k;
}
}
return count;
}
| ALGO | 0.999808 | 5.213717 |
7584a4d7-dca8-48fc-b8d3-f9fef6d47181 | farabimahmud/booksim-bst-unican | booksim2/networks/qtree.cpp | // $Id$
////////////////////////////////////////////////////////////////////////
//
// QTree: A Quad-Tree Indirect Network.
//
//
////////////////////////////////////////////////////////////////////////
//
// RCS Information:
// $Author: jbalfour $
// $Date: 2007/05/17 17:14:07 $
// $Id$
//
///////////////////////... | ALGO | 0.98281 | 5.571465 |
02ed8dd7-d445-4118-86e8-8bedac45c4ad | knightrishi/800codeforces | gamewithint.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
if(n%3==0)
cout<<"SECOND"<<endl;
else{
cout<<"FIRST"<<endl;
}
}
return 0;
} | ALGO | 0.999492 | 3.784103 |
bb93a5bd-6502-4fb0-98a5-65c4cf18a48d | Mahedi-hasan1/DSA-codes | Contest/F_Shift_and_Reverse.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios::sync_with_stdio(false); \
cin.tie(nullptr)
#define ll long long int
#define pb push_back
#define show(x) cout << #x << " : " << x << endl;
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define ff f... | ALGO | 0.998782 | 4.221892 |
1f093b20-a54d-4094-8c12-b078f4d82116 | BHUPENDRA28D/DSA-Bootcamp | 02.C++/Assignment 26(member, static , consturcter)/02_Questions/reves.cpp | #include <stdio.h>
#include <stdlib.h>
void input(int *p, int size)
{
for (int i = 0; i < size; i++)
{
printf("Value of elemetn %d::", i);
scanf("%d", (p + i));
}
}
int largest(int *p, int size)
{
int max = *(p + 0);
for (int i = 0; i < size; i++)
{
if (*(p + i) > max)... | ALGO | 0.999511 | 3.461538 |
8408b9e5-cd9c-49da-ad59-f6bd68b7c10d | ib13/Coding-Practice | GFG 2/array-pair-sum-divisibility.cpp | #include <bits/stdc++.h>
using namespace std;
int isPairSumDivisible(int *arr, int n, int k)
{
if (n % 2 == 1)
return 0;
int hashmap[100000];
memset(hashmap, 0, sizeof(hashmap));
for (int i = 0; i < n; i++)
{
hashmap[arr[i] % k]++;
}
for (int i = 0; i < n; i++)
{
... | ALGO | 0.999428 | 4.63588 |
5ef9f136-74ae-48d3-97f2-a9dc31940c7a | DevGautam2000/dsa | array/longest-consecutive-sequence.cpp | #include "io/io.h"
class Solution{
public:
vector<int> longestband(vector<int> nums){
//* TC: O(n), SC: O(n)
vector<int> ans;
unordered_set<int> uniq(nums.begin(),nums.end()); //for lookup
for(int i=0; i<nums.size()-1; i++){ //takes n
vector<int> temp;
if(uniq.find(nums[i]-1) == uniq.end()){
... | ALGO | 0.999891 | 5.089448 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.