uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
44db5859-fa6f-4372-93bf-3dac517435df | l2holV4l2u/ForWinterKor | Whymetrix.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
ll q,tab[100][2][2]={0};
void solve(){
ll num,mat[2][2]={0},tm[2][2];
cin>>num;
mat[0][0]=mat[1][1]=1;
num--;
for(int i=0;i<32;i++,num/=2){
if(!(num%2)){
continue;
}
memset... | ALGO | 0.999951 | 3.939205 |
3405ee7b-678f-4485-93c6-e9221695a49e | jasonkclee/csc419-cubicstyle | libigl/include/igl/unproject.cpp | #include <Eigen/Dense>
#include <Eigen/LU>
template <
typename Derivedwin,
typename Derivedmodel,
typename Derivedproj,
typename Derivedviewport,
typename Derivedscene>
IGL_INLINE void igl::unproject(
const Eigen::MatrixBase<Derivedwin>& win,
const Eigen::MatrixBase<Derivedmodel>& model,
const Eigen::... | ALGO | 0.978554 | 6.015494 |
0e82e32b-a4ac-4712-9fc7-097df7125b35 | dos-shaman/leetcode | 1463-cherry-pickup-ii/1463-cherry-pickup-ii.cpp | class Solution {
public:
int f(int i, int j1, int j2, int r, int c, vector<vector<int>>& grid, vector<vector<vector<int>>>& dp)
{
if(j1<0 || j2<0 || j1>=c || j2>=c) return -1e8;
if(i==r-1)
{
if(j1==j2) return grid[i][j1];
else return grid[i][j1]+grid[i][j2];
... | ALGO | 0.999975 | 5.793753 |
cd27f287-b271-4477-9b18-21b937c070a4 | liangkang233/leetcode-cpp | 13.罗马数字转整数.cpp | /*
* @lc app=leetcode.cn id=13 lang=cpp
*
* [13] 罗马数字转整数
*/
#include <iostream>
#include <string>
using namespace std;
// @lc code=start
class Solution {
public:
int stoi(char str) {
switch (str) {
case 'I' : return 1;
case 'V' : return 5;
case 'X' : return 10;
... | ALGO | 0.999427 | 6.092163 |
f96dc20f-ccac-4eb2-b5d2-e69405615b56 | tavishivss/cpp-practice | insertionsort.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0; i<n; i++)
{
cin>>a[i];
}
for(int i=1; i<n; i++)
{
int current=a[i];
int j=i-1;
while(a[j]>current && j>=0)
{
a[j+1]=a[j];
j--;
... | ALGO | 0.999995 | 3.655383 |
dfddf756-925b-4135-af12-140000a7e03b | LushoCallapa/Algoritmica | practica_io/id_array_manipulation/uva11679.cpp | #include <bits/stdc++.h>
#define input freopen("in.txt","r",stdin)
#define output freopen("out.txt","w",stdout)
#define ll long long int
using namespace std;
int main(){
input;
output;
int k,n,d,c,va;
while(cin>>k>>n, (n||k)){
int sw=0;
vector<int> v(k+10);
for(int i=1;i<=k;i++... | ALGO | 0.999892 | 3.168448 |
e58a39c6-6385-4dfc-b276-d3abdd3019c0 | SkyLoaderr/xray-last-days | SDK/sources/MagicSoftware/FreeMagic/Source/Curve3D/MgcCubicPolynomialCurve3.cpp | #include "MgcCubicPolynomialCurve3.h"
using namespace Mgc;
//----------------------------------------------------------------------------
CubicPolynomialCurve3::CubicPolynomialCurve3 (Polynomial* pkXPoly,
Polynomial* pkYPoly, Polynomial* pkZPoly)
:
PolynomialCurve3(pkXPoly,pkYPoly,pkZPoly)
{
assert( pk... | ALGO | 0.872598 | 5.240739 |
f8916a1c-02b8-4671-a1ef-6090ce5fb93e | somnbody/TviBit_Magicked_Signage | opencv/sources/samples/cpp/tutorial_code/xfeatures2D/LATCH_match.cpp | #include <iostream>
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_XFEATURES2D
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/imgcodecs.hpp>
#include <vector>
// If you find th... | ALGO | 0.984889 | 6.054434 |
81a01bc5-de56-4b28-80f6-c9a0dccb2278 | adwitiyagoyal/C-DSA | C-DSA-main/Array/swap_alternate.cpp | #include<iostream>
using namespace std;
void swapalt(int ar[],int n){
int i=0;
//alternate
while((2*i+1)<n){ //i+1
int x=ar[2*i+1];
ar[2*i+1]=ar[2*i]; //without using swap library function
ar[2*i]=x;
i++; //i=i+2
}
f... | ALGO | 0.999938 | 4.098519 |
5d1fdde9-29fc-4b88-bef5-2f188f685d8b | Nguyen-Hoang-Thuan-OU/ky-thuat-lap-trinh-voi-cpp | bai-tap/bai-tap-thuc-hanh/BTH01/legacy-code/BTH01_BT07 - cach 2 (Ham nhap, xuat, tinh trung binh cong, kiem tra ton tai, hoan doi, tich cac gia tri tren cot).cpp | // Xây dựng hàm
#include<iostream>
#include<iomanip>
#include<cstdlib>
using namespace std;
const int MAX = 10;
// Hàm nhập 1 mảng số nguyên
void nhap (int A[][M], int dong, int cot)
{
for (int i = 0; i < dong; i++)
for (int j = 0; j < cot; j++)
{
A[i][j] = rand()%5;
}
}
// Hàm xuất 1 mảng số nguyên
void xuat... | ALGO | 0.998043 | 3.606775 |
833982fa-fb4e-4d73-bac5-e8de5c8ddea1 | conradsoon/competitive_programming | codeforces/round765/C_Road_Optimization.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
using vvi = vector<vi>;
using vvl =... | ALGO | 0.999871 | 3.244344 |
7a237187-fc92-4d8c-a869-a96a69b209cb | mscarpiniti/ArtBook | BookSamples/Capitolo7/Overlap_and_Save/Overlap_and_Save/main.cpp | #include <iostream>
#include <fstream>
#include <math.h>
#include "audioIO.h"
#include "fftw3.h"
#define M 512
#define N 1024
#define LB 8192
using namespace std;
typedef struct {
fftw_complex *inCpx;
fftw_complex *outCpx;
fftw_complex *tempCpx;
fftw_complex *H;
fftw_plan p1;
fftw_plan ... | ALGO | 0.993161 | 4.451863 |
6328fba6-1586-4cf3-abef-caefda9a1be9 | darlinghq/darling-dmg | src/HFSBTree.cpp | #include "HFSBTree.h"
#include <stdexcept>
#include "be.h"
#include "hfsplus.h"
#include "unichar.h"
#include <iostream>
#include <cstring>
#include <set>
#include <algorithm>
#include "HFSBTreeNode.h"
#include "CacheZone.h"
#include "exceptions.h"
HFSBTree::HFSBTree(std::shared_ptr<HFSFork> fork, CacheZone* zone, con... | TOOL | 0.917108 | 4.517128 |
1466ba44-4863-4b5d-b00b-0e2ebe159382 | Riz1ahmed/Non_ACM_Program | Sabiha Tishas Task/5. Star Hash Triangle.cpp | #include<stdio.h>
int main(){
int n,i,j;
scanf("%d",&n);
for (i=1;i<=n;i++){
for (j=1; j<=i; j++)
putchar(i&1? '#':'*');
puts("");
}
}
| ALGO | 0.99996 | 3.384671 |
907f104e-9f01-49b1-8afb-34a5ced3c335 | Livvyx/ClassWork | AreaOfTriangle/AreaOfTriangle.cpp | // AreaOfTriangle.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
using namespace std;
//this program is to find the area of a right angled triangle
int main()
{
int a, b; // a refers to the base and b refers to the height
float area; //area is a decim... | TOOL | 0.979392 | 5.588439 |
8057c2ca-dd39-42a2-8e03-ed58be4b7870 | vimalvk9/CompetitiveProgrammingCodes | CPP_projects/ProjectEuler/6/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long sum1=0,sum2,s=0;
for(int i=1;i<=100;i++) sum1+=(i*i);
for(int i=1;i<=100;i++) s+=i;
sum2=s*s;
cout<<sum2-sum1<<endl;
return 0;
}
| ALGO | 0.998498 | 3.568692 |
965a2cfe-768d-48f7-9e95-bba6985ad6d9 | XingwenZhang/Leetcode | No105.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* buildTree(vector<int>& preorder, vector<int>& inorder)
{
return buildTreeHe... | ALGO | 0.999979 | 6.349551 |
b1160b67-e2c6-4eb2-93d7-d7fb50639bd3 | razimantv/leetcode-solutions | Solutions/N/number-of-ways-to-reorder-array-to-get-same-bst/Solution.cpp | // https://leetcode.com/problems/number-of-ways-to-reorder-array-to-get-same-bst/
class Solution {
public:
const int MOD = 1'000'000'007;
vector<vector<int>> ncr;
int numOfWays(vector<int>& nums) {
int n = nums.size();
ncr = vector<vector<int>>(n + 1, vector<int>(n + 1));
for (int i = 0; i <= n; ++i... | ALGO | 0.999993 | 5.836207 |
76da359a-1388-4769-a21d-121110cbdd35 | paarth-9k/DSA | linked_list/singlyll/finding_the_startOfLOOP/find_startOFLOOP.cpp | // Definition for singly-linked list
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
class Solution
{
public:
ListNode *detectCycle(ListNode *head)
{
ListNode *f = head, *s = head;
while (f != nullptr && f->next != nullptr)
{
... | ALGO | 0.999865 | 5.209284 |
36747305-5117-4864-99dc-2d461d7dd278 | keyone957/Algorithm_cpp | 프로그래머스/WeaponAttack.cpp | #include <string>
#include <vector>
#include <iostream>
#include<cmath>
using namespace std;
int solution(int number, int limit, int power) {
int answer = 0;
vector<int> attackArr;
for (int i = 1; i <= number; i++)
{
int count = 0;
/////////////////////////////
//==> ¦ Ƿ ݺ ݸ ãµ x
// Ʈi ϴ°
for (int j... | ALGO | 0.999742 | 4.80471 |
c15507ce-f122-45a2-8565-46fbfa60be14 | sanjaykukreti136/leetcode-solutions | 516-longest-palindromic-subsequence/516-longest-palindromic-subsequence.cpp | class Solution {
public:
int longestCommonSubsequence(string a, string b) {
int n = a.size(), m = b.size();
int dp[n+1][m+1];
for(int i=0;i<=n;i++){
for(int j=0;j<=m;j++){
if(i==0 || j==0) dp[i][j] = 0;
else{
if(a[i-1]==b[j-1]){... | ALGO | 0.999943 | 6.22981 |
b712ac6c-8352-4d7b-93d9-a64af940cb8f | Volgarenok/spbspu-labs-2024-aap-a | dirti.aldyn/P4/main.cpp | #include <iostream>
#include <inputStr.hpp>
#include "findMin.hpp"
#include "findTwoMin.hpp"
#include "findMinRecursed.hpp"
int main()
{
size_t capacity = 1;
char * str = dirti::inputStr(std::cin, capacity);
if (str == nullptr)
{
std::cerr << "Error" << "\n";
return 1;
}
char str_min = dirti::findM... | ALGO | 0.999369 | 4.887229 |
f6e4711a-e805-4771-b354-1eef49d950ee | IMDCGP207-1819/implementation-IablonschiEduard | S188800-EduardIablonschi/Libraries/glm/test/gtx/gtx_simd_mat4.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentatio... | TEST | 0.991075 | 6.515547 |
ea5f0a2b-0d14-4990-b791-31227ac3b879 | NafiHasan/HabiJabi | C++/Atcoder Contests/ABC 262/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define int long long
int n;
vector<int> a(105);
int dp[]
int f(int ind, int sum, int cnt){
}
int32_t main() {
FastIO;
cin >> n;
for (int i=0; i<n; i++)cin >> a[i];
int ans = f(0, ... | ALGO | 0.999463 | 3.519782 |
15b0eb89-79ed-4c20-a086-427a2b647abf | purvathnere/DSA-Preparation | HASH_TABLE_Split the Array.cpp | class Solution {
public:
bool isPossibleToSplit(vector<int>& nums) {
unordered_map<int,int>k;
for(int i=0;i<nums.size();i++)
{
k[nums[i]]++;
}
for(int i=0;i<nums.size();i++)
{
if(k[nums[i]]>2)
{
return false;
}
}
return tr... | ALGO | 0.999889 | 5.591121 |
b75fda78-6393-4582-aa8d-2542105a0254 | keynoid/school.tests | Rubbish/06_12_2019/ConsoleApplication4/task5256.cpp | #include <iostream>
using namespace std;
#define N 6
#include <iostream>
using namespace std;
#define N 6
int task5256()
{
long a[N];
long i, j, min;
for (i = 0; i < N; i++)
cin >> a[i];
min = INT_MAX;
for (i = 0; i < N - 1; i++)
{
if ((((a[i] + a[i + 1]) % 2) == 0) && (a[i] + a[i + 1] < min))
{
mi... | ALGO | 0.999958 | 3.89743 |
11506096-cbf8-4b89-a70a-d9d84fd40434 | littlebutenough/cpp_hw | hw42/main.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cout<<"Insert n:";cin >> n;
int i=1,S=0;
while(S<n){
S+=i;
i++;
}
cout<<i-2<<endl;
return 0;
} | ALGO | 0.999883 | 3.006624 |
6a9c471c-5b97-4e7c-b597-25f952e7168e | ishandutta2007/codeforces | anta/normal/682/B.cpp | #include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<... | ALGO | 0.999795 | 3.605504 |
a55f9aa7-20b0-41e1-b8ba-962d40ef523e | aryangupta02092002/May-Challenge-2023 | LeetCode/54_SpiralMatrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
int row=matrix.size(), column=matrix[0].size();
vector<int> ans;
int left=0, right=column-1, top=0, bottom=row-1;
while(left <= right && top <= bottom){
for(int i=left; i<=right; i++){
... | ALGO | 0.999997 | 6.29885 |
0c442a16-c48a-4d11-b078-e1c66692fed3 | Aakash231217/DSA-Sheet | Maximum Subarray.cpp |
// Problrm Link : https://leetcode.com/problems/maximum-subarray/
// ✔️ Solution - III (Dynamic Programming - Memoization)
// We can observe a lot of repeated calculations if we draw out the recursive tree for above solution -
// f(0, False) 🔽 =... | ALGO | 0.999962 | 6.511415 |
e9525293-d748-4fea-9ad3-07c75f684427 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Mixtral/top0-100/find-the-shortest-superstring-Solution.shortestSuperstring/177841_+Info.cpp | _PUBLIC_ char *strupper_talloc_n_handle(struct smb_iconv_handle *iconv_handle,
TALLOC_CTX *ctx, const char *src, size_t n)
{
size_t size=0;
char *dest;
if (!src) {
return NULL;
}
/* this takes advantage of the fact that upper/lower can't
change the length of a character by more than 1 byte */
dest = ... | ALGO | 0.999478 | 4.728796 |
444db006-f9ab-497d-8911-e4a7c569e8c4 | QbitQuantum/Basics | Исходники/Polyhedra.cpp | INSOLID_TYPE Polyhedra :: VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const
{
ARRAY<int> point_on_faces;
INSOLID_TYPE res(DOES_INTERSECT);
Vec<3> vn = v;
vn.Normalize();
for (int i = 0; i < faces.Size(); i++)
{
const Point<3> & p1 = points[faces[i].pnums[0]];
... | ALGO | 0.99629 | 6.149999 |
b635d894-34ac-4ac4-a948-7a0b639d161f | chun1000/problem-solving | source/old/cpp/BOJAlgorithm/22Y02M/1463.cpp | //평범한 실버 DP문제
#include <iostream>
#include <ios>
#include <vector>
using namespace std;
void use_boj_io() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
//백준 전용 입출력 속도 개선
int N;
//풀이에 사용하는 변수
void input() {
cin >> N;
}
//입력
void solve() {
vector<int> dp(N+1, 1000000);
dp[N] = 0;
for (int i ... | ALGO | 0.999958 | 4.593031 |
0bef01ff-292c-4921-9f15-5129ab187041 | jeekzhang/PDC_Project | openmp_quicksort/main.cpp | #include <iostream>
#include <vector>
#include <ctime>
#include<omp.h>
#include<algorithm>
#include<math.h>
using namespace std;
vector<int> randomIntList(int start, int stop, int length) {
vector<int> randomList;
for (int i = 0; i < length; ++i) {
randomList.push_back(rand() % (stop - start + 1) + start);
}
ret... | ALGO | 0.99934 | 4.385254 |
d6f74edf-7ce5-4796-8050-d6cce242d5b0 | hjk0761/Almumol | slimsha2dy/14428.cpp | #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int n, m, gae;
pair<int, int> arr[404040];
pair<int, int> sum(int l, int r, int num, int nl, int nr) {
if (r < nl || nr < l) return {1010101010, num};
if (l <= nl && nr <= r) return arr[num];
int mid = (nl+nr)/2;
return min(sum(l, r, ... | ALGO | 0.999944 | 4.350698 |
c506b45a-d5fe-454f-a5b9-293942a9b743 | yitianhao/gpu_sched_new | gpu-sched-centralcontrol/minor/boost_1_61_0/libs/multiprecision/example/gmp_snips.cpp | #include <boost/multiprecision/gmp.hpp>
#include <boost/math/special_functions/gamma.hpp>
#include <iostream>
void t1()
{
//[mpz_eg
//=#include <boost/multiprecision/gmp.hpp>
//=#include <iostream>
//=
//=int main()
//={
using namespace boost::multiprecision;
mpz_int v = 1;
// Do some arithmetic:
for(... | TOOL | 0.934068 | 4.264435 |
8caf460e-aaab-456c-ab57-f91e42514286 | tic40/atcoder | arc/arc160/a/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define endl '\n'
int main() {
int n,k; cin >> n >> k;
k--;
vector<int> a(n);
REP(i,n) cin >> a[i];
int snum = 0, lnum = 0;
int tot = n*(n+1)/2 - 1;
REP(i,n) {
vector<int> small,large;
for(int j = i+1; j < n; j++... | ALGO | 0.999998 | 3.029938 |
7c81b822-7eea-4c2a-a0fe-eb641b22a391 | ayeshazia99/Semester-3 | DS Lab/Lab 11/aa.cpp | //**THE CODE IS WORKING FINE IN DEV C++
//I**I HAVE SENT EMAIL FOR REFERENCE
#include<iostream>
#include<string.h>
using namespace std;
class node{
public:
string data;
node *next;
node *prev;
node(){
next=NULL;
prev=NULL;
}
};
class DLL{
public:
node *head;
node *tail;
DLL(){
head=tail=NULL;
}
DLL(node *n){
head=t... | ALGO | 0.99995 | 4.437368 |
c8604a79-5f36-4392-8e99-1327a9ae2f62 | jeroenoverman/ECC-LDPC-application | GUI/bpsk.cpp | #include <iostream>
#include <complex>
#include "bpsk.h"
void BPSK::encode(double *bpsk_samples, int *bin_samples, int n) {
for (int i=0; i<n; i++) {
if (bin_samples[i] > 0) {
bpsk_samples[i] = -1.0;
} else {
bpsk_samples[i] = +1.0;
}
}
}
void BPSK::decode(int *... | ALGO | 0.999371 | 5.376562 |
b95c6559-50e9-4ed6-87ce-54cd852ef68d | Shaik1406/CSA1415-Compiler-design | 9.Recursive descent parsing.cpp | #include<stdio.h>
int c=0;
char p[20];
void s();
void l();
void lprime();
void l()
{
s();
lprime();
}
void lprime()
{
if(p[c]=',')
{
c++;
s();
lprime();
}
}
void s()
{
if(p[c]='a')
c++;
else if(p[c]==')')
{
c++;
l();
if(p[c]==')')
c++;
else
c--;
}
}
int main()
{
printf("\... | ALGO | 0.99875 | 3.684048 |
f4752e19-e060-4c31-9c38-8221a860624f | samyakkhabiya/Leetcode | Alternate positive and negative numbers - GFG/alternate-positive-and-negative-numbers.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
void rearrange(int arr[], int n) {
// code here
vector<int> poss;
vector<int> neg;
for(int i=0;i<n;i++){
if(arr[i]>=0)
poss.pu... | ALGO | 0.9999 | 5.823635 |
52f6c9c7-e52e-481b-bcfe-661ea58cc650 | AshwinKrishn/llvm_compiler_optimizations | assignment3/DCE/Faintness.cpp | // ECE 5984 S20 Assignment 3: faintness.cpp
// Group: Ashwin and SengMing
////////////////////////////////////////////////////////////////////////////////
#include <Faintness.h>
#include <llvm/ADT/DenseMap.h>
#include <llvm/IR/InstrTypes.h>
#include <llvm/IR/Instructions.h>
#include <vector>
/**
* @brief Overload ct... | ALGO | 0.997252 | 7.890014 |
718aa475-766d-4bfd-ac8e-534dc0003c2a | yeswanth30/flutter_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.998733 | 6.76775 |
1676dc1c-e2eb-453a-a75e-28f90856bf9f | tiger0132/code-backup | Luogu/P4000~P4999/P4389 付公主的背包/1.cpp | // 被卡常,待更新
#include <algorithm>
#include <cstdio>
#include <cstring>
const int N = 6e5 + 56, P = 998244353, G = 3, GInv = 332748118;
int p(int x, int y) {
int ret = 1;
for (; y; y >>= 1, (x = 1ll * x * x % P))
if (y & 1) ret = 1ll * ret * x % P;
return ret;
}
int r[N], lim = 1, l;
void ntt(int *a, int op) {
f... | ALGO | 0.999995 | 3.627792 |
eb7da79f-0c1c-46f2-95fe-9e4fe06be64f | sjmjys954646/Algorithm | boj2000-2999/boj2559.cpp | // freopen("input.txt", "r", stdin);
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <cstring>
#include <list>
#include <set>
#include <string.... | ALGO | 0.999944 | 3.677691 |
faed8712-bbe8-47b5-be95-d41dae383a22 | santiagoHV/ciencias-1-trabajos | Pilas y colas/pilas y colas akinator/main.cpp | #include <cstdlib>
#include <iostream>
#include <ctype.h>
#include <iomanip>
#include "pila.h"
#include "cola.h"
using namespace std;
int main(int argc, char *argv[]){
cola Cola;
pila Pila[3];
int i,j, tam, grupo=0, orden[3];
char x;
do{
cout<<"Escriba un mltiplo de 3: ";
cin>> tam;
}while (t... | ALGO | 0.996197 | 3.128602 |
ccf433d2-9e29-46e4-8b60-e4217b20a550 | ahnjinwoo/projects | studyTH/leetcode/146.LRUCache.main.cpp | class LRUCache {
public:
LRUCache(int c) : capacity(c) {
}
int get(int key) {
int result(-1);
if (this->CacheHashMap.count(key)) {
result = this->CacheHashMap[key]->value;
this->CacheList.splice(this->CacheList.begin(), this->CacheList, this->CacheHashMap[key]);
this->CacheH... | ALGO | 0.999265 | 6.143493 |
7f156c6c-877d-4637-8539-08358b0c93bf | cielavenir/procon | codeeval/tyama_codeeval213.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <cstdio>
using namespace std;
#define between(a,x,b) ((a)<=(x)&&(x)<(b))
char table[10000];
int H,W,i,f;
void check(int a,int b){
int _f=0;
if(!between(0,a,W)||!between(0,b,H))return;
if(!table[b*W+a])return;
table[b*W+a]=0;
if(!f){i++;f=_f=1;}
... | ALGO | 0.999546 | 3.820861 |
663d6638-480b-436b-8bf0-bc7e80d17583 | iSEE-Laboratory/DGTR | third_party/pointnet2/_ext_src/src/sampling.cpp | #include "sampling.h"
#include "utils.h"
void gather_points_kernel_wrapper(int b, int c, int n, int npoints,
const float *points, const int *idx,
float *out);
void gather_points_grad_kernel_wrapper(int b, int c, int n, int npoints,
... | ALGO | 0.955214 | 6.57422 |
28b81a9a-c492-4c46-aa19-d51b2ff23ccd | Myuku/Leetcode | Easy-125.cpp | #include <iostream>
#include <string>
using namespace std;
bool isPalindrome(string s) {
string str;
for (int i = 0; i < s.size(); i++) {
if (isalpha(s[i]) || isdigit(s[i])) {
str.push_back(tolower(s[i]));
}
}
if (str.size() == 0) {
return true;
}
int f =... | ALGO | 0.998215 | 4.213437 |
68bc48c4-b8c8-4b38-97e9-a2a2460403bb | OpenXiangShan/gsim | src/inferWidth.cpp | #include "common.h"
#include <stack>
#include <queue>
#define w0 getChild(0)->width
#define w1 getChild(1)->width
#define w2 getChild(2)->width
#define s0 getChild(0)->sign
#define s1 getChild(1)->sign
#define s2 getChild(2)->sign
/*
* Recursively calculates the width of each ENode (DFS)
* For leaf ENodes, the widt... | ALGO | 0.997121 | 4.368298 |
1eedae41-f654-4981-9bd0-b8c7b56ca951 | Khoi55/Chuong5_6 | chuong 5/cpp/4.cpp | #include <iostream>
#include <set>
#include <vector>
#include <stack>
using namespace std;
set<string> resultSet;
vector<pair<int, int>> brackets; // Lưu vị trí các cặp dấu ngoặc
// Hàm tạo biểu thức bằng cách xóa dấu ngoặc
void generateExpressions(string expr, int index, vector<bool> removeMask) {
if (index == b... | ALGO | 0.999957 | 5.85571 |
1fa33a0c-f166-495f-ab19-cd67f50a853f | xiewende/CPlusPlus_Algorithm | dynamic-programming/Offer2-100.cpp | // 剑指 Offer II 100. 三角形中最小路径之和
#include<iostream>
#include<vector>
using namespace std;
int minimumTotal(vector<vector<int>>& triangle) {
int row = triangle.size();
int col = triangle[row - 1].size();
vector<vector<int>> dp(row, vector<int>(col, 0));
dp[0][0] = triangle[0][0];
for (int i = 1... | ALGO | 0.999965 | 5.688408 |
70649411-8322-48c7-bbca-fa794dc7c880 | Sourav61/DSA-Practice | GFG/Medium/FindLengthOfLongestSubsequence.cpp | // https://practice.geeksforgeeks.org/problems/find-length-of-longest-subsequence4905/1
//{ Driver Code Starts
#include <bits/stdc++.h>
#define MAX 1000
using namespace std;
int maxSubsequenceSubstring(string x, string y, int n, int m);
// Driver Program
int main()
{
int t;
cin >> t;
while (t--)
{
... | ALGO | 0.999933 | 5.874458 |
14ffe4f5-d28a-4f57-9a3c-a924e8790365 | Othereum/Problem-Solving | 프로그래머스/old/같은 숫자는 싫어.cpp | #include <vector>
using namespace std;
vector<int> solution(const vector<int> arr)
{
vector<int> answer;
auto last = -1;
for (const auto x : arr)
{
if (x != last)
{
last = x;
answer.push_back(x);
}
}
return answer;
}
| ALGO | 0.999916 | 5.397973 |
56a0af0d-1372-4354-87dd-e964b4d85811 | Leaves333/leetcode | cpp/643_maximum_average_subarray_i.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
double findMaxAverage(vector<int>& nums, int k) {
int sum = 0;
for (int i = 0; i < k; i++) {
sum += nums[i];
}
int big = sum;
for (int i = k; i < nums.size(); i++) {
sum += nums[i];
sum -= nums[i - k];
if (sum > big) {
... | ALGO | 0.999771 | 5.673709 |
03f8fa92-b79c-4690-9cac-652a8a248839 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_3475_8.cpp | #include <bits/stdc++.h>
using namespace std;
stringstream ss;
int a[1000010];
int main() {
int n, t, x;
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
cin >> t;
for (int i = 1; i <= t; i++) cin >> x, a[x] *= -1;
stack<int> st;
for (int i = n; i > 0; i--) {
if (a[i] < 0)
st.push(-1 * a[i]);... | ALGO | 0.999992 | 3.386283 |
2db4bc71-b411-4d96-87ff-b8f1fc1bcf20 | Tejas-Santosh-Nalawade/LEETCODE-DAILY-QUESTION-SOLVING | 2766-find-the-prefix-common-array-of-two-arrays/find-the-prefix-common-array-of-two-arrays.cpp | class Solution {
public:
vector<int> findThePrefixCommonArray(vector<int>& A, vector<int>& B) {
int n = A.size();
vector<int> prefixCommonArray(n);
unordered_set<int> elementsInA, elementsInB;
for (int currentIndex = 0; currentIndex < n; ++currentIndex) {
elementsInA.inse... | ALGO | 0.999913 | 6.572909 |
1e6bc9dd-aeda-40e5-b434-d50bc2e710c6 | jashanwarraich/DSA-LeetCode | InorderTraversal.cpp | // Q104 https://leetcode.com/problems/binary-tree-inorder-traversal/
// Iterative
vector < int > inOrderTrav(node * curr) {
vector < int > inOrder;
stack < node * > s;
while (true) {
if (curr != NULL) {
s.push(curr);
curr = curr -> left;
} else {
if (s.empty()) break;
curr = s.top... | ALGO | 0.99999 | 6.549611 |
1daeea62-a8a8-404f-8cb9-c8d94b8b5a9c | RowonChung/SSAFY21_Algorithm | 박상빈/3주차/0308/G2_1561_놀이공원.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n, m;
int rides[10001];
int answer;
bool judgement(long long time)
{
long long cnt = 0;
int maxi = -21e8;
int idx = 0;
for (int i = 0; i < m; i++)
{
cnt += (time / rides[i]);
}
if (cnt >= n - m)
{
return true;
}
else r... | ALGO | 0.999965 | 4.709627 |
0b0e8661-52f7-4d56-be76-fe15d5053afe | NolanHo/HUST-CSE-Crypto | 密码课程设计/9.数字信封/main.cpp | #include <iostream>
#include <cstring>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/sm2.h>
#include <openssl/rand.h>
#include <openssl/objects.h>
#include <openssl/x509v3.h>
using namespace std;
#include <openssl/pkcs7.h>
#include <openssl/x509.h... | TOOL | 0.965192 | 3.662524 |
2bf55e62-131e-48bb-b1bf-f78d0ad57f55 | xunyang03/Leetcode_crawl | 0094-binary-tree-inorder-traversal/0094-binary-tree-inorder-traversal.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.99998 | 6.616302 |
86d05e0e-14ff-4fa8-a008-db03150dcd37 | Rumen-Nikolaev/C-pp | Tasks5/Task9-6-Data-Structures/Linked List/Doubly-Linked-List.cpp | #include <iostream>
using namespace std;
// Node structure for doubly linked list
struct Node {
int data; // Holds the value of the node
Node* next; // Pointer to the next node
Node* prev; // Pointer to the previous node
};
// Function to create a new node
Node* createNode(int value) {
N... | ALGO | 0.999758 | 6.686341 |
3b49e840-00de-4f4a-8d26-d9f78ceb7f83 | RuiHuangNUS/MARS-FTCC | Dynamical_Trajectory/src/utils/include/igl/connect_boundary_to_infinity.cpp | template <typename DerivedF, typename DerivedFO>
IGL_INLINE void igl::connect_boundary_to_infinity(
const Eigen::MatrixBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedFO> & FO)
{
return connect_boundary_to_infinity(F,F.maxCoeff(),FO);
}
template <typename DerivedF, typename DerivedFO>
IGL_INLINE void igl::conne... | ALGO | 0.933246 | 5.620109 |
20de8275-f329-4af3-b751-f5cbc6c42dc8 | HARSHIL5OP/CodSoft | 3.cpp | #include <iostream>
#include <iomanip> // For setw
#include <cstdlib> // For system
#include <string> // For string operations
#define width 50
using namespace std;
char board[3][3]; // Game board
// Initialize the game board
void initializeBoard() {
for(int i = 0; i < 3; ++i) {
for(int j = 0; j < 3; +... | ALGO | 0.997074 | 6.25204 |
e632f368-44b8-42aa-8194-bf178062cd7f | Deepanshu-dahiya/Data-Structure-and-Algorithm | Searching & Sorting/Sticker Thief.cpp | /*Stickler the thief wants to loot money from a society having n houses in a single line. He is a weird person and follows a certain rule when looting the houses. According to the rule, he will never loot two consecutive houses. At the same time, he wants to maximize the amount he loots. The thief knows which house has... | ALGO | 0.999878 | 5.896677 |
612d2858-53a3-4037-9db7-1fb35f6b1ee0 | MueezKhalid/2d_array_programs | task5.cpp | #include<iostream>
using namespace std;
void record(int team[6][4]) {
int result[6];
bool failed_teams[6][4] = {};
for (int i = 0; i < 6; i++) {
int total_scores = 0;
cout << endl << "ENTER DATA FOR TEAM NUMBER " << i + 1 << endl << endl;
for (int j = 0; j < 4; j++) {
... | ALGO | 0.998693 | 4.75139 |
8c3c6a1d-4f88-4800-9587-299a1e276046 | sdsuvei/git_projects | lidar_stereo/src/lidar_stereo.cpp | #include "lidar_stereo.h"
int main (int argc, char** argv)
{
//const char* algorithm_opt = "--algorithm=";
//const char* maxdisp_opt = "--max-disparity=";
//const char* mindisp_opt = "--min-disparity=";
//const char* blocksize_opt = "--blocksize=";
//const char* nodisplay_opt = "--no-display=";
//const char* sc... | TOOL | 0.899547 | 3.582624 |
183b46ae-5544-43b1-b864-d339346a7954 | Apocaly-pse/Learn_C_Cpp | STL/stl-not1.cpp | #include <algorithm>
#include <functional>
#include <iostream>
#include <iterator>
#include <numeric>
#include <vector>
struct LessThan7 : std::unary_function<int, bool> {
bool operator()(int i) const { return i < 7; }
};
int main() {
std::vector<int> v(10);
std::iota(begin(v), end(v), 0);
std::cout ... | ALGO | 0.973746 | 6.34335 |
0284184d-3f3f-4b47-af6e-084514b8ddc1 | ishandutta2007/codeforces | alireza_kaviani/normal/556/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef pair<ld,ld> pld;
typedef pair<string , string>... | ALGO | 0.999945 | 3.783732 |
3178344b-42ad-4b44-b2ea-97feb30d4adf | sarvex/leetcode-jai | solution/1700-1799/1720.Decode XORed Array/Solution.cpp | class Solution {
public:
vector<int> decode(vector<int>& encoded, int first) {
vector<int> ans{{first}};
for (int i = 0; i < encoded.size(); ++i)
ans.push_back(ans[i] ^ encoded[i]);
return ans;
}
}; | ALGO | 0.999991 | 5.136662 |
0c23d0b2-1849-4acf-8f1d-093b96ac5b13 | anti-hero-amir/Embedded-Linux-Diploma | C++/Session1/Maxof3.cpp | #include<iostream>
int main(){
int x=0,y=0,z=0,max=0;
std::cin>>x>>y>>z;
if (x>y){
if(x>z){
max=x;
}
else{
max=z;
}
}
else{
if(y>z){
max=y;
}
else{
max=z;
}
}
std::cout<<"Max num... | ALGO | 0.999687 | 4.158383 |
5df56e11-fdf2-4a00-a9ed-4c66073ef424 | ShapeShiftOS-LTS/android_frameworks_av | media/libstagefright/MediaCodecList.cpp | //#define LOG_NDEBUG 0
#define LOG_TAG "MediaCodecList"
#include <utils/Log.h>
#include "MediaCodecListOverrides.h"
#include <binder/IServiceManager.h>
#include <media/IMediaCodecList.h>
#include <media/IMediaPlayerService.h>
#include <media/MediaCodecInfo.h>
#include <media/stagefright/foundation/ADebug.h>
#includ... | TOOL | 0.911028 | 7.415457 |
3af20dfe-adba-4ba6-8d4c-7ca958fed990 | swastikpratik-bit/Codeforces_practice | Jun2k24/08/B_Fox_Dividing_Cheese.cpp | // Problem Link ->
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define set_bits __builtin_popcountll
#define leadingzero __builtin_clzll
#define trailingzero __builtin_ctzll
#define bitsParity __builtin... | ALGO | 0.999556 | 4.745439 |
100466d8-fdf9-4888-a959-7bc14340b593 | karmugilan28/leetcode_problems | 0801-is-graph-bipartite/0801-is-graph-bipartite.cpp | class Solution {
public:
bool isBipartite(vector<vector<int>>& graph) {
int n = graph.size();
vector<int>vis(n,-1);
queue<int>q;
for(int g = 0; g < n; g++){
if(vis[g] == -1){
vis[g] = 0;
q.push(g);
while(!q.empty())... | ALGO | 0.999961 | 6.060274 |
b4f44a31-0648-4c09-84af-6457970f9ca5 | KantiCodes/advent-of-code | 2024/day2/part1.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <sstream>
// Time complexity: O(n*m) -> `n` is number of lines, `m` is the line length
// Space complexit: O(n)
int inplace() {
std::string input;
std::vector<int> ll;
int output=0;
int prev, curr;
bool isLineGo... | ALGO | 0.997334 | 5.36146 |
db715bd6-77d5-48e4-a0cf-6150484bcaf7 | balabit-deps/balabit-os-9-llvm-toolchain-15 | llvm/lib/CodeGen/MachineScheduler.cpp | #include "llvm/CodeGen/MachineScheduler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PriorityQueue.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/iterator_range.h"
#include "ll... | ALGO | 0.989838 | 6.638346 |
67a12c17-e186-4652-9382-41f1f18014ea | quynhdinh/cp | content/dp/lcs.cpp | bool is_subsequence(const string &sub, const string &str) {
size_t index = 0;
for (char ch : str)
if (index < sub.size() && ch == sub[index])
index++;
return index == sub.size();
}
int lcs_quadratic_memory(const string &S, const string &T) {
int n = int(S.size());
int m = int(... | ALGO | 0.999998 | 5.39527 |
d5f6fd2c-953d-4c24-8dcf-0927b90d2e28 | cubercsl/The-road-to-ACMer | Spring2019/Week03/JUST_Programming_Contest/K.cpp | #include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(args...) \
do \
{ \
cout << "\033[32;1m" << #args << " -> "; \
err(args); ... | ALGO | 0.999059 | 4.484645 |
be3e3a98-4c4c-40da-b721-210d6dda9bbb | AIABHISHEK/DataStructureAndAlgo_Problems | recursion/UNIQUEcOMBINATIONsUM.cpp | #include<bits/stdc++.h>
#define ll long long int
#define int_ unsigned int
using namespace std;
// given an array find all the unique combination whose sum is equal to target sum
void combination(vector<int> &arr, vector<vector<int>> &ans, vector<int> &v, int i, int target){
if(target == 0){
ans.push_ba... | ALGO | 0.999959 | 4.259511 |
0a33236f-1396-4d16-8e00-d5695c6c54ed | dharmendra-dxy/Learning-DSA-with-CPP | 3. Arrays/13_problem.cpp | #include<iostream>
#include<vector>
using namespace std;
// PATTERN: Prefix sum
// Return a prefix/running sum for the array without creating a new array
void runningSum(vector<int> &v){
for(int i=1; i<v.size();i++){
// running sum logic:
v[i] = v[i] + v[i-1];
}
}
int main(){
vector<int... | ALGO | 0.998294 | 4.959579 |
dbe5ad72-63c9-4aea-b451-7a34cda38bff | ishandutta2007/codeforces | ehnryx/normal/1548/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
//#define FILENAME sadcactus
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
template <typename T>
using ordered_set = __gnu_pbds::tree<T,
__gnu_pbds::null_type,
less<T>,
__gnu_pbds::rb_tree_tag,
... | ALGO | 0.999628 | 5.241686 |
d5bf6906-af19-4f11-84de-e4c8937dace4 | Parc-Ferme/LeetCode | 31-next-permutation/31-next-permutation.cpp | class Solution {
public:
void nextPermutation(vector<int>& nums) {
int n = nums.size(), k,l;
for(k = n-2; k >=0; k--){
if(nums[k] < nums[k+1]){
break;
}
}
if(k < 0) {
reverse(nums.begin(),nums.end());
}
else... | ALGO | 0.999991 | 5.738387 |
bd5f5042-5a50-447c-93d3-40d1d84f46df | mk0609/leetcode-problems | 2009-minimum-number-of-operations-to-make-array-continuous/2009-minimum-number-of-operations-to-make-array-continuous.cpp | class Solution {
public:
int minOperations(vector<int>& nums) {
sort(nums.begin(),nums.end());
int n=nums.size();
int left=0;
int maxCount=1;
int currentCount=1;
for(int right=1;right<n;++right){
if(nums[right]==nums[right-1]){
continue;
... | ALGO | 0.999993 | 6.086569 |
97501b0d-4ff5-4e34-9ccb-ef269923391a | Will-panda/Online_Semantic_SLAM | Thirdparty/g2o/g2o/core/hyper_dijkstra.cpp | #include <queue>
#include <deque>
#include <vector>
#include <assert.h>
#include <iostream>
#include "hyper_dijkstra.h"
#include "../stuff/macros.h"
namespace g2o{
using namespace std;
double HyperDijkstra::TreeAction::perform(HyperGraph::Vertex* v, HyperGraph::Vertex* vParent, HyperGraph::Edge* e){
(void) v... | ALGO | 0.999782 | 4.596799 |
bb03efe2-b171-4c69-9a4a-c049ea4f38b2 | PixelExperience-Devices/device_asus_sdm660-common | qcom-caf/display/display-commonsys/services/config/src/device_impl.cpp | #include <cinttypes>
#include <string>
#include <vector>
#include "device_impl.h"
namespace DisplayConfig {
DeviceImpl *DeviceImpl::device_obj_ = nullptr;
std::mutex DeviceImpl::device_lock_;
int DeviceImpl::CreateInstance(ClientContext *intf) {
std::lock_guard<std::mutex> lock(device_lock_);
if (!device_obj_) ... | TOOL | 0.915866 | 7.165565 |
d781a38e-60d6-448f-9274-d7268fdc12b0 | sourcegraph/lsif-clang | libc/src/math/floorl.cpp | #include "src/__support/common.h"
#include "utils/FPUtil/NearestIntegerOperations.h"
namespace __llvm_libc {
long double LLVM_LIBC_ENTRYPOINT(floorl)(long double x) {
return fputil::floor(x);
}
} // namespace __llvm_libc
| ALGO | 0.986982 | 4.810132 |
704a45f9-4b35-4d0c-a447-58809df27ed8 | lunerien/strategic_game | app/utils/Range.cpp | //
// Created by lukasz.kala on 13.07.2023.
//
#include "Range.h"
#include <climits>
#include <algorithm>
Coordinates Range::closestToMove(Coordinates from, Coordinates to, int speed, Map *map, int distanceToOpponent,
const std::vector<Unit *> &enemyUnits) {
Coordinates minDistanc... | ALGO | 0.99921 | 5.805445 |
579d0e0e-74f8-41b8-ba6f-2de00e52f6c7 | EasternMoonCN/leetcode | src/demo21.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) {}
* };
*/
/*
将两个升序链表合并为一个新的 升序 链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的... | ALGO | 0.999959 | 5.378706 |
30019693-6f4d-409e-8dd3-7e3be0e920b1 | chuanzzx/Leetcode | 437 Path Sum III.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:
int pathSum (TreeNode* root, int sum) {
if (!root) {
return 0;
}
... | ALGO | 0.999954 | 5.567929 |
19845ece-d863-469e-a227-8397cb7518cd | MAHMOUD128/leetCode_Solutions | Linear_DataStructures/844. Backspace String Compare.cpp | class Solution {
public:
bool backspaceCompare(string s, string t)
{
string one ="",two="";
stack<char>s1,s2;
for(int i =0 ; i < s.size() ; i++)
{
if((s1.empty() || !s1.empty()) && s[i] !='#')
{
s1.push(s[i]);
}
if(!s1.empt... | ALGO | 0.999897 | 6.098855 |
7b926581-8b2e-4903-9cdd-8165a45269e0 | prakashanki526/leetcode | 2336-smallest-number-in-infinite-set/2336-smallest-number-in-infinite-set.cpp | class SmallestInfiniteSet {
public:
map<int,int> mp;
SmallestInfiniteSet() {
for(int i =1;i<=1000;i++) mp[i]++;
}
int popSmallest() {
int a = mp.begin()->first;
mp.erase(a);
return a;
}
void addBack(int num) {
mp[num]++;
}
};
/**
* ... | ALGO | 0.998931 | 5.745941 |
2b9dac8b-e4b9-4f90-bca8-fd7cec13c429 | strange-tiger/Baekjoon_practice | _2024_BOJ_Practice/25682_RepaintChessboard2.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int N, M, K;
int sum[2001][2001] = { 0 };
char board[2001][2001];
void input()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> N >> M >> K;
for (int i = 0; i < N; ++i)
for (int j = 0; j < M; ++j)
cin >> board[i][j];
}
... | ALGO | 0.999862 | 4.727896 |
626cefd1-6c08-45c1-8737-a69958575b5d | prakruti95/Batch_Java_12-30to1-30 | Module1/28-5-Loop,Pyramid,Userinput/20g.CPP | #include <stdio.h>
#include <conio.h>
void main()
{
int num,lastdigit=0,rnum=0;
clrscr();
printf("Enter the number : ");
scanf("%d",&num);//12345
while (num >= 1)
{
if (num < 10)
lastdigit = num;
else
lastdigit = num%10;
rnum=(rnum*10)+lastdigit;
num=num/10;
}
printf("\nRevese Number is : %d",... | ALGO | 0.999 | 3.089602 |
c447100e-05b2-4c83-9857-0ac90f447fab | riyan069/CF-Problems | A_Presents.cpp | #include <bits/stdc++.h>
using namespace std;
#define op() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define cl cout << '\n'
#define endl '\n'
int main()
{
op();
int n;
cin >> n;
map<int, int> m;
for (int i = 1; i <= n; i++)
... | ALGO | 0.999941 | 3.578296 |
dac6fbb8-374a-427f-84cd-d98685a50389 | nathanj96/Cinnabar-Engine | MathTools/CMathTools.cpp | #include "CMathTools.h"
#include "Vect.h"
//for floating-point absolute value function
#include <cmath>
#include <string>
using namespace std;
#include "ScreenLog.h"
#include "Colors.h"
bool CMathTools::pointAxisIntervalTest(const Vect& point, float minX, float maxX, float minY, float maxY, float minZ, float maxZ)
{... | ALGO | 0.967369 | 6.50559 |
00088234-ab53-4773-a2a0-696de865558b | raincross7/code-similarity | codes/train_code/problem302/problem302_268.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t a, b;
cin >> a >> b;
//2019=3*673 672*671/2=225456
if(a%673==0 || a%673+b-a>=673) {
if(b-a>=2) cout << 0 << endl;
else cout << a*b%2019 << endl;
}
else {
int64_t ans = 2020;
for(int64_t i=a; i<=b-1; i++) {
for(int64... | ALGO | 0.999879 | 4.118601 |
cfd94060-84d5-46a7-8234-7a983587c8df | remcous/Camosun_COMP139E | Lab1/helper.cpp | #include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
// Function prototypes for forward-referenced functions
void getUserInput (double &radius, double &pegDist, double &spacing);
void outputResults (const double angles[], const double distances[], const int numLights);
/*
* Prints the resul... | TOOL | 0.999078 | 5.419557 |
7d5082c8-e93c-4a20-949a-a8b556b87b36 | GlodonOpenSrc/Qt4.8.5_Glodon | src/gui/itemviews/qbsptree.cpp | #include "qbsptree_p.h"
QT_BEGIN_NAMESPACE
QBspTree::QBspTree() : depth(6), visited(0) {}
void QBspTree::create(int n, int d)
{
// simple heuristics to find the best tree depth
if (d == -1) {
int c;
for (c = 0; n; ++c)
n = n / 10;
depth = c << 1;
} else {
depth... | ALGO | 0.981892 | 5.054604 |
02001117-c77a-422e-84b5-4e8e509e29ee | SHIVANGISINGH1/DSA-codes | sheetQs/chocolateDistributionProblem.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution{
public:
long long findMinDiff(vector<long long> a, long long n, long long m){
//code
sort(a.begin(), a.end());
long long ptr= m-1;
long long ans = 1000000000;
for (long long idx=0; idx<n && ptr<n; i... | ALGO | 0.999981 | 5.180518 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.