uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
28f75129-bedd-4653-a2bd-8ad3b0daea64 | dl8sd11/online-judge | codeforces/768B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;++i)
#define REP1(i,n) for(int i=1;i<=n;++i)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"#%d: %s = ",__LINE__,#__VA_ARGS__),_do(__VA_ARGS__);
template<typename T> void _do(T &... | ALGO | 0.999784 | 3.819391 |
6196086e-3649-45e7-96e8-4dfc6663889e | zhuoyuchen936/Stereo_CalibRectify_rSGM | stereo_rectify/stereo_rectify.cpp | // #include <pcl/io/pcd_io.h>
// #include <pcl/point_types.h>
// #include <pcl/kdtree/kdtree_flann.h>
// #include <pcl/surface/mls.h>
// #include <pcl/visualization/cloud_viewer.h>
// #include <pcl/visualization/pcl_visualizer.h>
// #include <pcl/search/kdtree.h>
// #include <Eigen/Dense>
#include "stereo_rectify.h"
#... | TOOL | 0.898565 | 5.151793 |
585571ba-020b-4378-a02f-1650d6afd981 | mraksoll4/litecoinfinance2 | src/bloom.cpp | #include <bloom.h>
#include <primitives/transaction.h>
#include <hash.h>
#include <script/script.h>
#include <script/standard.h>
#include <random.h>
#include <streams.h>
#include <math.h>
#include <stdlib.h>
#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
#define LN2 0.693147180559945309417... | ALGO | 0.944604 | 7.157103 |
1759802e-6ea4-4c66-a248-e8a27889d02c | wzj5530/Vision | stereo_match/main.cpp | #include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/utility.hpp"
#include <stdio.h>
#include <cctype>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <iostream>
using namespace cv... | ALGO | 0.970288 | 5.897508 |
b5b535d9-3c6c-4fae-91e5-96a6e896bb40 | Henrik-Yao/NEUQ-ACM-Solution | week5/左明柯/7-5.cpp | #include <stdio.h>
const int maxn=1e5+10;
int n;int a[maxn];int start;int vis[maxn];int flag;
bool dfs(int now){
int next1,next2;
vis[now]=1;
if(!a[now]) return true;
next1=now+a[now];
next2=now-a[now];
if(next1<n&&!vis[next1])
if(dfs(next1)) return true;
if(next2>=0&&!vis[next2])
if(dfs(next2)) r... | ALGO | 0.999961 | 3.74539 |
6fc59b48-3a82-4136-95ee-4fecee551091 | Jett59/prime-finder | primes.cpp | #include <algorithm>
#include <atomic>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>
#include <thread>
template <typename IntType>
static constexpr inline bool isDivisible(IntType dividend, IntType divisor) {
return dividend % divisor == 0;
}
template... | ALGO | 0.999165 | 5.419382 |
f96d13ff-75cf-48fe-9d9b-93e37cefafa5 | mnathali/yandex_contests | testing24/plot.cpp |
#include <iostream>
int main(int argc, char const *argv[])
{
int x1, y1, x2, y2, x, y;
std::cin >> x1 >> y1 >> x2 >> y2 >> x >> y;
if (x <= x1)
{
if (y >= y2)
std::cout << "NW";
else if (y <= y1)
std::cout << "SW";
else
std::cout << "W";
... | ALGO | 0.999207 | 3.561466 |
75315bec-39b6-45cb-9aa6-9a8e47880b7f | ashwath7/Codeforces | Implementation_problems/Amusing Joke.cpp | #include<bits/stdc++.h>
#define int int64_t
#define pb push_back
#define endl '\n'
#define pll pair<int,int>
#define vll vector<int>
#define all(a) (a).begin(),(a).end()
#define x first
#define y second
#define sz(x) (int)x.size()
#define hell ... | ALGO | 0.999942 | 3.712589 |
73e709b4-a571-42e1-9050-8330ae4ee3c7 | sourav-islam/CplusPlus-codes | DSA with Babbar/Lecture 3&4 If-Else, While loop & Lots of Patterns Part1/Invideo/patterns/5thpattern.cpp | //5:14s
// 1 2 3
// 4 5 6
// 7 8 9
#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int row = 1;
int count = 1;
while(row<=n)
{
int col = 1;
while (col<=n)
{
cout << count;
count++;
col++;
}
c... | ALGO | 0.999986 | 3.750505 |
7c464fc8-0e7c-4e18-b32b-3d4d609a603e | jgit26hubessie/cpp-level1-expanded | cpp-level1-expanded/fibonacci_expanded.cpp | #include<iostream>
using namespace std ;
long long fibonacci(int n){
if (n == 0) return 0 ;
else if(n == 1) return 1 ;
else return fibonacci(n-1) + fibonacci(n-2) ;
}
void printIterative(int n){
long long a = 0, b = 1, next ;
cout << "Iterative sequence:\n" ;
... | ALGO | 0.999676 | 5.051491 |
5ce1575d-7228-4f08-a092-4965a08fd632 | otavioon/COLA-2022-Tools | datasets/src/optz/codenet/0/p02936_s006557230.cpp | #include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#define N 2000005
#define NIL -1
using namespace std;
struct Node{
long l;
long r;
long long s;
};
long n,q;
struct Node node[N];
void ope(long p, long c){ //pが親 cが足す値
if (node[p].l!=NIL){
node[node[p].l].s+=c;... | ALGO | 0.999454 | 3.872062 |
f0cb4f7d-6dbf-4144-b191-76ecbe67344f | LegendGraphics/FastMassSpring | 3rdParty/eigen/lapack/cholesky.cpp | #include "lapack_common.h"
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info))
{
*info = 0;
if(UPLO(*uplo)==INVALID) *info = -1;
else if(*n<0) ... | ALGO | 0.999178 | 5.971703 |
6168123f-9bb6-4610-9d01-360ff0633b04 | hopo/hpCcpp | pmiz_exam-cpp/002_Decision-and-Loop/04_all-roots-of-a-quadratic-equation/main.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
float a, b, c, x1, x2, discriminant, realPart, imaginaryPart;
cout << "Enter coefficients a, b and c: ";
cin >> a >> b >> c;
discriminant = b*b - 4*a*c;
if(discriminant > 0) {
x1 = (-b + sqrt(discriminant)) / (2*a);
x2 = (-b - sqrt(discr... | ALGO | 0.998607 | 3.658615 |
b4c56fd7-a60b-4617-921f-5deceb23fcd7 | AreebAhmadSiddiqui/DSA-Prep | Leetcode Daily/April/11)-Removing-Stars-From-String.cpp | Removing Stars From a String
You are given a string s, which contains stars *.
In one operation, you can:
Choose a star in s.
Remove the closest non-star character to its left, as well as remove the star itself.
Return the string after all stars have been removed.
class Solution {
public:
// Approach 1
// ... | ALGO | 0.999881 | 6.306408 |
580c7147-c73b-4f68-9f60-cbabf7193686 | YidanDeng/PrisPack | source/Preconditioner/IncompleteLU.cpp | /*
* @author 刘玉琴、邓轶丹
* @date 2024/6/12
* @details ILU分解预条件
*/
#include "../../include/Preconditioner/IncompleteLU.h"
#include "../../include/VectorClass/VectorTools.h"
namespace HOST {
template<typename LowPrecisionType, typename HighPrecisionType>
IncompleteLU<LowPrecisionType, HighPrecisionType>::Inc... | ALGO | 0.983557 | 3.264655 |
4d99793c-d75d-4900-b650-7cf38b91fa95 | Gaurav-20/LeetCode-Solutions | 1235-maximum-profit-in-job-scheduling/1235-maximum-profit-in-job-scheduling.cpp | bool comp(const vector<int> &a, const vector<int> &b) {
return (a[0] <= b[0]); // compare as per start time
}
class Solution {
public:
int n;
vector<vector<int>> arr;
vector<int> dp;
int find(int i) {
if (i >= n) {
return 0;
}
if (dp[i] != -1) {
retu... | ALGO | 0.999978 | 6.012023 |
cc1d7319-017b-4434-a98b-0589b52f9537 | upesacm/21DaysOfCode-2023 | C&C++/Avni/day21/1.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cout<<"enter the number"<<endl;
cin>>n;
if(n==0)
{
cout<<"tell number other than 0"<<endl;
}
for(int i=1;i<=10;i++)
{
cout<<n<<"x"<<i<<"= "<<n*i<<endl;
}
} | ALGO | 0.997356 | 3.423259 |
753cc5a3-d310-430d-b03c-caa7ac15c565 | Yichar/SStudy | OJ/bin_Tree/101对称二叉树_递归法.cpp | class Solution {
public:
bool isSymmetric(TreeNode* root) {
if(root == NULL) return true;
queue<TreeNode *> Q;
Q.push(root->left);
Q.push(root->right);
while(!Q.empty()){
TreeNode *left = Q.front();Q.pop();
TreeNode *right = Q.front();Q.pop();
... | ALGO | 0.999977 | 6.318482 |
917457a4-b633-47bc-9fac-3025b0822f2c | alexuglav/Labs | Lab18/Lab18_11/1/main.cpp | #include <iostream>
#include <deque>
#include <cstdlib>
using namespace std;
typedef deque<int> Deq;
Deq make_deque(int n)
{
Deq d;
for (int i = 0; i < n; i++)
{
int a = rand() % 100 - 50;
d.push_back(a);
}
return d;
}
void print_deque(Deq d)
{
for (int i = 0; i < d.size(); i++)
cout << d[i] << " ";
co... | ALGO | 0.998233 | 3.591219 |
f583fa7f-07f4-4965-aa4c-309d31036c9b | SparshBansal/CompetitiveProgramming | AprilChallenge/SJ1.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <map>
using namespace std;
typedef long long int lli;
#define MAXL 100001
lli v[MAXL], m[MAXL], ans[MAXL];
lli gcd (lli a , lli b) {
if (a%b == 0) return b;
else return gcd(b, a%b);
}
void dfs(vector<int... | ALGO | 0.999955 | 4.260144 |
2b21f2c1-fd87-4936-8989-7c270f11a2c2 | grybd/Algorithms | 剑指offer/剑指offer07.重建二叉树.cpp | #include <vector>
#include <unordered_map>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
unordered_map<int,int>map;
TreeNode* buildTree(vector<int>& preorder, vector<i... | ALGO | 0.999989 | 6.363371 |
c09f5f61-312a-4f3c-800d-66a973567965 | Tabassum-Yunus/Performance-Analysis-of-CPU-Scheduling-Algorithm_-Priority-and-SRT | Priority.cpp | #include<stdio.h>
#include<stdlib.h>
typedef struct process1{
char name1[5];
int bt1;
int at1;
int prt1;
int wt1,ta1;
int flag1;
}processes1;
void b_sort1(processes1 temp1[],int n1)
{
processes1 t1;
int i1,j1;
for(i1=1;i1<n1;i1++)
for(j1=0;j1<n1-i1;j1++){
if(temp1[j1].at1 > temp1[j1+1].at1){
t1 = t... | ALGO | 0.999976 | 3.23002 |
5e77c28e-b65f-49a6-9906-9d67dd8047d3 | nitrieu/libFPE | thirdparty/linux/miracl/miracl_osmt/source/curve/pairing/ipk_enc.cpp | /*
Cock's Identity Based Encryption
Encryption phase
Generates a random AES session key, and uses it to encrypt a file.
Outputs ciphertext <filename>.ipk
The session key is ID_PKC encrypted, and written to <filename>.key
Requires : big.cpp
*/
#include <iostream>
#include <fstream>
#include ... | ALGO | 0.954059 | 4.473773 |
684e8070-358d-410f-8fdb-35c4866d795f | Hinski2/CP | codeforces/problems/Mocha and Hiking/cpp1601.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;
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& v){
for(const auto &u: v){
os << u << ' ';
}
return os;
}
te... | ALGO | 0.999596 | 4.28974 |
529e5729-76c5-422c-8308-ab22c869ae7e | semistrict/jdk8-hotspot | src/os/posix/vm/os_posix.cpp | #include "utilities/globalDefinitions.hpp"
#include "prims/jvm.h"
#include "runtime/frame.inline.hpp"
#include "runtime/os.hpp"
#include "utilities/vmError.hpp"
#include <signal.h>
#include <unistd.h>
#include <sys/resource.h>
#include <sys/utsname.h>
#include <pthread.h>
#include <signal.h>
PRAGMA_FORMAT_MUTE_WARNIN... | TOOL | 0.965367 | 6.714272 |
6a27b7fb-f3b4-467e-bf5f-f1e44dd94928 | NitinDarker/LeetCode-is-Hard | Arrays/TwoSum.cpp | /* 1. Two Sum
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
*/
class Solution {
public:
vect... | ALGO | 0.999808 | 6.307914 |
a6b3e7bd-7a61-4b22-a3d8-d1e237d5bb83 | cofls6581/hongjangal | 백준_코테연습/브루트포스_재귀/두_동전/hyejun.cpp | #include <iostream>
#include <string>
using namespace std;
int N, M;
string arr[20];
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
int solve(int x1, int y1, int x2, int y2, int cnt) {
// 실패한 경우1 (버튼을 10번보다 많이 눌러야하는 경우)
if (cnt == 11) return -1;
// 성공한 경우 검사(둘 중 하나만 밖으로 떨어지면 성공)
bool fall1 = false, fall2 = ... | ALGO | 0.999931 | 4.455589 |
f46f891c-f401-402e-92b6-3d95b2ff4d27 | DEmmaRL/CPP | C_Not_Adjacent_Matrix.cpp | #include <bits/stdc++.h>
#define ENDL '\n'
#define lli long long
#define pb push_back
#define ff first
#define ss second
#define fore(i,a,b) for(int i=a;i<b;i++)
#define all(s) begin(s), end(s)
#define sz(s) int(s.size())
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;
using v... | ALGO | 0.999516 | 4.280615 |
35c72073-9855-409d-8a8c-2cd2fa51e918 | majid171/COMP-3520-Final-Project | SDL2TemplateCMake/main.cpp | /*
Demonstrating 2D objects and clipping
*/
#include <cstdio>
#include <iostream>
#include <unistd.h>
#include <vector>
#include <SDL.h>
#include <SDL_ttf.h>
#include <cstdlib>
#include <ctime>
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define BLACK 0x000000FF
#define WHITE 0xFFFFFFFF
using namespace ... | TOOL | 0.989774 | 5.483428 |
c2d9b8de-e2f9-4fc3-80ed-dafc1c34d7bb | pharick/cpp | 2-year/1-recap/6.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
int max = n % 10;
n /= 10;
while (n) {
int dig = n % 10;
if (dig > max) {
max = dig;
}
n /= 10;
}
cout << max << endl;
return 0;
} | ALGO | 0.998522 | 4.256118 |
bf21f65c-d3b3-48ef-a43a-6d05ff64e462 | has2/Problem-Solving | codeforces/Round734-Div.3/B-1.cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstring>
using namespace std;
int tc,n,a,b,cnt[26];
int main(){
cin >> tc;
while(tc--){
string s;
cin >> s;
memset(cnt,0,sizeof(cnt));
for(char c : s){
cnt[c-'a'... | ALGO | 0.99981 | 4.505987 |
0f9cc88d-76a1-45e5-af6f-6d6475161e26 | NEITGNART/On-the-way-home | On the way home/Source.cpp | #include <iostream>
#include <vector>
using namespace std;
int solve(vector<vector<int>> grid) {
int row = grid.size();
int col = grid[0].size();
for (int i = 0; i < row; ++i) {
grid[i][col - 1] = 1;
}
for (int j = 0; j < col; ++j) {
grid[row - 1][j] = 1;
}
for (int i = row - 2; i >= 0; i--) {
for (in... | ALGO | 0.999917 | 5.175281 |
ddb820f3-d0a6-4484-aae6-1a1377e76334 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_8655_1.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int s = 0, s1 = 0;
string k;
cin >> k;
int i;
for (i = 0; i < k.size(); i++) {
if (k[i] == 'a') {
s++;
}
if (k[i] != 'a') {
s1++;
}
}
if (((s1 + s) / 2) < s) {
cout << s1 + s;
}
if (((s1 + s) / 2) >= s) {
co... | ALGO | 0.999573 | 3.386759 |
062a5743-cb0a-4064-871d-dd68532ee613 | costaricadigitalcoin/cococr-coin | src/llmq/quorums_dkgsession.cpp | #include "quorums_dkgsession.h"
#include "quorums_commitment.h"
#include "quorums_debug.h"
#include "quorums_dkgsessionmgr.h"
#include "quorums_utils.h"
#include "evo/specialtx.h"
#include "activemasternode.h"
#include "chainparams.h"
#include "init.h"
#include "net.h"
#include "netmessagemaker.h"
#include "spork.h"... | TOOL | 0.895202 | 3.624369 |
a5976d36-266d-4b97-9099-df861df5757f | yugkhokhar/DSA | DSA/DynamicProg/Edit Distance.cpp | class Solution {
public:
int SolveMem(string&s1,string&s2,int i,int j, vector<vector<int>>&dp){
if(i==s1.length()){
return s2.length()-j;
}
if(j==s2.length()){
return s1.length()-i;
}
if(dp[i][j]!=-1) return dp[i][j];
int ans=0;
if(s1[i]==s2[j]){
return SolveMem(s1,s2,i+1,j+1,dp);
}
else{
//Insert A ... | ALGO | 0.999998 | 5.790188 |
272a5b19-4e1d-437d-b9f8-ff22b4303b35 | ltw0781/Flutter_TEST_LTW | 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 |
96a06fba-5e1e-4371-a798-0113a916c3ec | Lqs66/arducopter-4.4 | libraries/AP_NavEKF/AP_NavEKF_core_common.cpp | #include "AP_NavEKF_core_common.h"
NavEKF_core_common::Matrix24 NavEKF_core_common::KH;
NavEKF_core_common::Matrix24 NavEKF_core_common::KHP;
NavEKF_core_common::Matrix24 NavEKF_core_common::nextP;
NavEKF_core_common::Vector28 NavEKF_core_common::Kfusion;
/*
fill common scratch variables, for detecting re-use of va... | TOOL | 0.91853 | 4.542403 |
6b9dfaa1-e80d-4574-a334-81d040f4833b | SameerJain/CSC-Courses-CSI- | CS211/Labs/Lab_3.cpp | #include <iostream>
#include <cmath>
using namespace std;
enum triangletype{scalene,isosceles, equilateral, noTriangle};
void triangleshape(double x,double y,double z){
triangletype trianglecheck;
if ( x + y < x || y + z < x || z + x < y) {
trianglecheck = noTriangle;
}
else if (x == y && y ==z && z ==x )
{
tri... | ALGO | 0.998432 | 4.308854 |
9520b4e9-4b79-4cc9-9df2-2de2e552093b | 18520597-DiemNgoc/OOP_UIT_CODE | BTLT05/BT8/BT8/BT8.cpp | #include <iostream>
#define Max 100
using namespace std;
typedef int item;
struct Queue
{
int Front, Rear;
item Data[Max];
int count;
};
void Init(Queue& Q) {
Q.Front = 0;
Q.Rear = -1;
Q.count = 0;
}
int IsEmpty(Queue Q) {
if (Q.count == 0)
return 1;
return 0;
}
int IsFull... | ALGO | 0.994595 | 3.79552 |
cf780fae-a833-4136-9bf5-183b92f38519 | alexandraback/datacollection | solutions_5631989306621952_0/C++/yefllowers/a.cpp | #include <iostream>
#include <string>
using namespace std;
#define FOR(i, a, b) for(int i(a);i<=(int)(b);i++)
#define REP(i,n) FOR(i,0,n-1)
void Prepare() {
}
void Work(int casenum) {
string s;
cin >> s;
string t;
REP(i, s.length()) {
string e;
e.push_back(s[i]);
if (t + e <=... | ALGO | 0.999961 | 4.074221 |
d9f551a5-245a-433a-94d7-9466c21cc14e | ishandutta2007/codeforces | rns_mhb/normal/708/B.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int a[4];
for(int i = 0; i < 4; i ++) scanf("%d", a + i);
int x = (1 + sqrt(8ll * a[0] + 1)) / 2;
if(x * (x - 1) != 2 * a[0]) {
puts("Impossible");
return 0;
}
int y = (1 + sqrt(8ll * a[3] + 1)) / 2;
if(y * (y - 1) !=... | ALGO | 0.999833 | 3.319713 |
4527afa7-5306-4162-9c9e-e52fbf7defef | yashchauhan00/Programming-with-C-plus | Q9.cpp | /* ||Q.9||
* Write a program in C++ Program to Print Alphabet Triangle.
*/
#include <iostream>
using namespace std;
int main()
{
int i, j, k,n,m,l;
char ch='A';
cout<<"The number of triangles the user wants to print=";
cin>>n;
cout<<"Alphabet Triangle : \n"; ... | ALGO | 0.990922 | 4.550013 |
8c6020af-4636-48ed-b3e8-1083e6da8c6f | UnnamedOrange/OI | Problems/GCD/source/std/gcd2.cpp | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <list>
typedef long long INT;
using std::cin;
using std::cout;... | ALGO | 0.999915 | 4.781272 |
835f1ce5-ac60-4e4a-a435-17230eed6a44 | emmTGB/cloudCode | cpp/leetcode/2583.cpp | #include<bits/stdc++.h>
using namespace std;
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), left(left), right(... | ALGO | 0.999948 | 5.228085 |
427c8919-85c0-48b5-882a-49a686bb2506 | shay-ff/cpp-files | Atcoder/389/D_Squares_in_Circle.cpp | /**
* created: 2025-01-18 17:44:10
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifndef ONLINE_JUDGE
#include "../debug.cpp"
#else
#define debug(...)
#define debugArr(...)
#endif
#define int long long
#def... | ALGO | 0.99624 | 4.036967 |
89acfe07-3a49-410d-951f-744b7280fc29 | MathProgrammer/CodeForces | C Programs/C Programs 17/New Year's Eve.cpp | #include <cstdio>
int no_of_bits(long long n)
{
int bit_count = 0;
while(n)
{
n = n >> 1;
bit_count++;
}
return bit_count;
}
int main()
{
long long n, k;
scanf("%I64d %I64d", &n, &k);
long long answer;
if(k == 1)
{
answer = n;
}
else
{
... | ALGO | 0.999963 | 4.241739 |
0a4e23f9-27ac-417c-834b-ec3c1ad8066f | VasilLendyo/homeWorkC-for_24.02 | task_1/task_1/task_1.cpp | #include <iostream>;
using namespace std;
int main() {
int a, sum = 0;
cout << "Enter the value of a: ";
cin >> a;
for (int i = a; i <= 500; i++) {
sum += i;
}
cout << "The sum integers from " << a << " to 500: " << sum << endl;
} | ALGO | 0.997816 | 3.112337 |
124c2ab2-6844-41b2-a088-97288ebca05b | kunal114/LeetCode | 28-implement-strstr/28-implement-strstr.cpp | class Solution {
public:
/*int simple(string s,string pat){
int m = pat.size();
int n = s.size();
for(int i=0;i<n-m+1;i++){
if(pat==s.substr(i,m)){
return i;
}
}
return -1;
}
*/
/*vector<int> computeLPSArray(string needle) {... | ALGO | 0.999967 | 5.598065 |
20d3cc9a-a1e4-4bb5-9b07-9751a41df9b3 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5595_12.cpp | #include <bits/stdc++.h>
using namespace std;
const int OO = (int)1e8;
const double EPS = 1e-11;
string f(string a) {
string res = "";
int c = 1;
for (int i = (int)a.size() - 1; i >= 0; --i) {
int d = a[i] - '0';
d += c;
if (d > 10)
res += ('0' + (d % 10)), c = d / 10;
else
res += ('0'... | ALGO | 0.999548 | 3.890419 |
20bbbfb9-fa10-4850-a6e6-de15c7e546f0 | Sim-CAD/MustDo | Set-1/String/Longest Common Subsequence.cpp | //Problem Name: Longest Common Subsequence
//Source : LeetCode
/****************************************/
int longestCommonSubsequence(string text1, string text2) {
int m = text1.length();
int n = text2.length();
vector<vector<int>> lcs(m+1, vector<int>(n+1, 0)); //As empty string ... | ALGO | 0.999533 | 5.862137 |
85c39b02-ee0b-4320-aa42-2cceadf22e78 | Muhammad78633/Projects | Linear_Search.cpp | #include <iostream>
using namespace std;
int main()
{
int array[10] = {1,2,3,4,5,6,7,8,9,10};
int num;
cout<<"Please enter any number 1 to 10: ";
cin>>num;
for(int i=0; i<10; i++){
if(array[i] == num){
cout<<"Your entered number located at the index: "<<i;
return 1;
}
}
cout<<"You entered a wrong ... | ALGO | 0.963181 | 3.162404 |
9c24ca88-0333-4537-9570-be1007c57467 | kagasan/atcoder | abc/abc139/4.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
void Say(bool say, string a = "Yes", string b = "No"){cout << (say ? a : b) << endl;};
int main(){
ll N;
cin >> N;
ll M = N - 1;
ll ans = 0;
// for(ll i = 1; i < N; i++){
// ans += i % (i + 1);
// }
ans = M * (M - 1... | ALGO | 0.999895 | 3.217337 |
0eba0bbf-a9d0-478c-af40-4af25600d61a | Natzaum/Beecrowd | MediasPonderadas.cpp | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
double a,b,c,media;
int N;
cout << fixed << setprecision(1);
cin >> N;
for (int i = 0;i<N; i++){
cin >> a >> b >> c;
media = (a*2 + b*3 + c*5) / 10;
cout << media << endl;
}
... | ALGO | 0.999616 | 3.980625 |
2a25132a-71dc-48e4-bcf9-f916cc67f89b | MunyDaren/Cpp.io | changetime.cpp | #include<iostream>
using namespace std;
int main()
{
int second = 12000 ;
int hours;
int minute;
int remain;
hours = second / 3600;
minute = second / 60;
remain = second % 60;
cout << hours << " H " << minute << "mn" << second << " S " << endl;
return 0;
} | ALGO | 0.881806 | 3.020987 |
43cdecb6-0d38-47c8-8a9e-98ae673b0866 | VoidUI/frameworks_av | media/codecs/amrnb/enc/src/pitch_ol.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/pitch_ol.c
Funtions: Pitch_ol
Lag_max
------------------------------------------------------------------------------
MODULE DESCRIPTION
The modules in this file compute the open loop pitch... | ALGO | 0.999846 | 5.885815 |
99edfd89-0004-4799-8b5d-7614f3491e8a | anhdoandeptrai/quanlydoisong | 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.99874 | 6.767714 |
93a1d2f6-cd86-4fd4-9e9f-057d498e1c67 | Shahraaz/CP_S5 | codeforces/practice/DIV2_63E.cpp | //Optimise
#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 MULTI_TEST
#ifdef LOCAL
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typen... | ALGO | 0.999961 | 3.226671 |
2b0c0d05-c0c9-403c-bfa8-c918f98a3c17 | deysanjay285/light_oj | 1020_childhood_game.cpp | #include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<string>
#include<algorithm>
#include<iterator>
using namespace std;
#define ll long long int
#define ull uknsigned long long int
#define pi 2*acos(0.0)
int main()
{
ll t,n,cases=1;
char a[10],alice[]= {"Alice... | ALGO | 0.999764 | 3.069661 |
01bb5a14-653b-4963-877e-7990e6d6fd13 | lyonjuniper/critterding | dependencies/bullet/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp | #include "btSphereTriangleCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "SphereTriangleDetector.h"
#include "BulletCollision/CollisionDispatch... | ALGO | 0.996959 | 6.826073 |
c0d14ea0-21c2-4326-8477-fad82a71f4d7 | atrainag/code-repo | Codeforces/CodeChef/STARTERS38/DOMINANT.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <cmath>
#include <iomanip>
#include <map>
#include <stack>
#include <string>
#define all(x) x.begin(),x.end()
#define last(x) x.size()-1
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define m... | ALGO | 0.999899 | 4.363227 |
1ddf441d-cfe9-484e-89de-9a3adb16db65 | kmuratori/C-Cpp-funds | projects/basic/str_manip.cpp | #include <iostream>
using namespace std;
bool isAlpha(char c) {
int _c = (int) c;
if( (_c < 65) || (_c > 122)) return false;
else if((_c > 90) && (_c < 97)) return false;
return true;
}
char* toLower(char* lowStr) {
for(int i = 0; lowStr[i] != '\0'; i++ )
if(isAlpha(lowStr[i]) && (int) lowStr[i] < 91) l... | TOOL | 0.978901 | 5.893197 |
8178b76f-ed7c-43ef-b31a-9c4801abfd92 | sin-heng/I2P_2023spring | cs_hw3/13485/function.cpp | // 13485 - String Calculator(class)
// all accepted
#include<iostream>
#include<string>
#include "function.h"
#include<algorithm>
using namespace std;
String_Calculator::String_Calculator(const string a){this->s = a;}
String_Calculator& String_Calculator::Add(const string b){
this->s += b;
return *this;
}
Stri... | ALGO | 0.9997 | 4.43618 |
8deef80e-1dfe-4ebf-bfe5-739aa94ddd63 | shahriar-mohim007/datastructure-algorithm | datastructure/Dynamic Programming/mcm/mix.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n;
while (cin >> n) {
vector<int> colors(n);
vector<vector<int>> dp(n, vector<int>(n, INT_MAX));
for (int i = 0; i < n; ++i) {
cin >> colors[i];
}
for (int i = 0; i < n; ++i) {
dp[i]... | ALGO | 0.999532 | 5.172647 |
7181ede1-1247-4ac7-a46c-3925b0ea8e2d | ayushh201/codechef | largestDivisibleSubset.cpp | class Solution {
public:
vector<int> largestDivisibleSubset(vector<int>& arr) {
sort(arr.begin(),arr.end());
int n=arr.size();
int lastIndex=0, maximum=1;
vector<int> dp(n,1), hash(n);
for(int i=0;i<n;i++){
hash[i]=i;
for(int prev=0;prev<i;prev++){
if(arr[i]%arr[prev]... | ALGO | 0.999983 | 5.472497 |
7257c256-56de-4231-b157-c970010edb80 | CoderHermano/Data-Structures-CPP | GFG/Maths/RangeSumQueries.cpp | #include<bits/stdc++.h>
using namespace std;
void rangSum(int arr[], int n) {
}
int main() {
int arr[] = {4, 5, 3, 2, 5};
return 0;
} | ALGO | 0.99975 | 3.80334 |
81fc1810-709b-4a81-a4bc-ff7e7abc5742 | yonghaekim/AOS-llvm | libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp | // <vector>
// vector(size_type n, const value_type& x, const allocator_type& a);
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "asan_testing.h"
template <class C>
void
test(typename C::size_type n, const typename C::value_type& x,
const typename C::allocator... | TEST | 0.884382 | 6.512844 |
7ca1dc1b-f4cc-44be-9f7c-c44de5268369 | YimingPan/Standard-Code-Library | Algorithms-and-Data-Structures/Sparse_Table.cpp | const int MAXN = 1e6+3;
int ST[MAXN][21];
void init(int N)
{
for(int j=1; (1<<j) <= N; j++)
for(int i=1; i+(1<<j)-1 <= N; i++)
ST[i][j] = min(ST[i][j-1], ST[ i+(1<<(j-1)) ][j-1]);
}
// return minimum element in [L,R]
int query(int L, int R)
{
int len = R-L+1, k = 0;
while( 1<<(k+1) <=... | ALGO | 0.999711 | 3.850939 |
6059b6fe-25b3-44a9-8d6e-c321d06f1ba6 | ishandutta2007/codeforces | sw2000/normal/1228/E.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=255;
const ll mod=1e9+7;
const int inf=0x3f3f3f3f;
const ll linf=0x3f3f3f3f3f3f3f3f;
ll C[maxn][maxn],dp[maxn][maxn];
ll mm[maxn],mmm[maxn];
int main()
{
ll n,m;
cin>>n>>m;
for(int I=0;I<maxn;I++)
{
C[I][0]=C[I][I]=1;
for(in... | ALGO | 0.999996 | 4.304357 |
c1837179-ecd5-48b7-b912-5df0c6c65db8 | aminjonshermatov/competitive_programming | cses/Mathematics/ThrowingDice.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#define _GLIBCXX_DEBUG
#else
#define dbg(...) 42
#endif
using namespace std;
template <typename T>
T inverse(T a, T m) {
T u = 0, v = 1;
while (a != 0) {
T t = m / a;
m -= t * a; swap(a, m);
u -= t * v; swap(u, v);
}
ass... | ALGO | 0.999875 | 5.407511 |
e25469fe-aa6c-4213-bff6-c0db5d329829 | wtain/LeetCodeCpp | NaryTreePreorderTraversal/NaryTreePreorderTraversal.cpp |
#include <iostream>
#include <vector>
#include <stack>
//#include <algorithm>
//#include <iterator>
using namespace std;
/*
https://leetcode.com/problems/n-ary-tree-preorder-traversal/
Given an n-ary tree, return the preorder traversal of its nodes' values.
Nary-Tree input serialization is represented in their lev... | ALGO | 0.999993 | 6.745637 |
934181f8-a1e6-4005-862e-a4ef5bebfb6f | reshmak726/competitive-programming | sum3.cpp | #include<bits/stdc++.h>
using namespace std;
// normal sum problem
// int sum(int n,int a[]){
// if(n<0) return 0;
// return sum(n-1,a)+a[n];
// }
// int main(){
// int n;
// cin>>n;
// int a[n];
// for(int i=0;i<n;i++){
// cin>>a[i];
// }
// cout<<sum(n-1,a);
// // return ... | ALGO | 0.999839 | 4.594941 |
a6d564f2-cbae-4fa1-bc3c-3c67654d01a0 | Jaswanth03-cyber/Competitive-Programming | NeetCode/trees/easy/construct_string.cpp | #include<bits/stdc++.h>
using namespace std ;
/*
https://leetcode.com/problems/construct-string-from-binary-tree/description/
*/
/*
we need to add the brackets if left child is not present but right child is present, so thats why even though left child is null and right child
is existing we are having a reccursive ca... | ALGO | 0.999907 | 6.750494 |
5190a1a8-ef28-4625-83f6-6adeb891b4e4 | stwind/atcoder | contests/abc079/D/main.cpp | #include <bits/stdc++.h>
using namespace std;
// clang-format off
#define REP(i, x, y) for(int i = x; i < y; i++)
#define REPR(i, x, y) for(int i = x; i >= y; i--)
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define MOD 998244353
#def... | ALGO | 0.99984 | 4.490265 |
390ef69f-0947-4f84-bc70-be52ac539cc0 | donghuna/Expert | Sort/[200201 기출] Fast sort/22_12_Solution1.cpp | /*
19_FAST_SORT_user_ver01
hw_sort() ʴ version
score : 2**
1. :
(1) 16bit(0~65535) 2048 (Ϻ )
(2) 2048 ̿Ͽ 32bit(16bit, 16bit) 1048576
(3) ڴ 1M ѵ ̿Ͽ ؾ .
ڴ main.cpp hw_sort(short data[1024])Լ .
[hw_sort]
hw_sort()ð ݿ ʴ´.
hw_sort() signed_short Ѵ.
hw_... | ALGO | 0.999648 | 4.130714 |
d6300342-00e7-4cfe-8f3a-efad6df06f3c | ShaydenNaidoo/COS214 | Practical 4/Files/dfTravel.cpp | #include <iostream>
#include <string>
#include <stack>
#include "FarmUnit.h"
#include "FarmUnitComposite.h"
#include "dfTravel.h"
using namespace std;
dfTravel::dfTravel(FarmUnitComposite* root) {
farmUnits.push(root);
current = root;
}
dfTravel::~dfTravel() {
while (!farmUnits.empty()) {
farmUni... | ALGO | 0.990104 | 4.981582 |
80fb76ee-a39c-4bde-82d7-d373d033809e | ishandutta2007/codeforces | heno239/normal/536/A.cpp | #pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>... | ALGO | 0.999972 | 4.576817 |
eec85075-3fc5-406f-b585-278d01c85b71 | Hansil-Chapadiya/Leet_Code_Problems | Medium/CheckIfArrayPairsDivisibleByk_1497.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
/* Produce wrong result */
/* class CheckIfArrayPairsDivisibleByk_1497
{
public:
bool canArrange(std::vector<int> &arr, int k)
{
std::unordered_map<int, int> h_map;
for (int i = 0; i < (arr.size()/2); i++)
{
for ... | ALGO | 0.999627 | 5.636727 |
d6c59f5a-4f0f-49e5-9814-e1fd867fa9b4 | fli217/LeetCode | #239.cpp | /*============================================================
Problem: Sliding Window Maximum
==============================================================
Given an array nums, there is a sliding window of size k which
is moving from the very left of the array to the very right.
You can only see the k numbers in th... | ALGO | 0.999989 | 6.449458 |
b7b40a49-50d9-474b-9a20-c9dbb59a9f98 | dhruvpeter/cpp-programs | sort.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int arr[] = {10,9,5,1};
int n = sizeof(arr)/sizeof(arr[0]);
sort(arr,arr+n);
cout<<"Ascending order"<<endl;
for(int x: arr)
cout<<x<<" ";
cout<<endl<<"Descending order"<<endl;
sort(arr,arr+n,greater<int>());
... | ALGO | 0.99964 | 4.311191 |
e61e2b46-18ac-4c96-8fa6-9e2c95e8a53e | zhangsj96/athena_phase_transition | src/field/ct.cpp | // C headers
// C++ headers
#include <algorithm> // max(), min()
// Athena++ headers
#include "../athena.hpp"
#include "../athena_arrays.hpp"
#include "../bvals/bvals.hpp"
#include "../coordinates/coordinates.hpp"
#include "../mesh/mesh.hpp"
#include "field.hpp"
// OpenMP header
#ifdef OPENMP_PARALLEL
#include <omp... | ALGO | 0.999625 | 4.950315 |
93f9f960-d380-40a3-8c70-deac2b014f87 | Whatisloovee/1-sem | Лабораторные работы/Fundamentals-of-algorithmization-and-programming-1-sem/Лабораторная работа 6/dopy/d6/Source.cpp | #include <stdio.h>
#include <iostream>
int main()
{
setlocale(LC_CTYPE, "Russian");
int t, i = 2;
printf("vvedite chislo\n");
scanf_s("%d", &t);
printf("%d = ", t);
while (i <= t)
{
if (t % i == 0)
{
printf("%d", i);
t = t / i;
if (t > 1)
printf("*");
}
else
i = i + 1;
}
} | ALGO | 0.999787 | 3.460004 |
ccab2012-8e4f-4072-939c-b803baee0d35 | sarvex/leetcode-mini-kanren | solution/0300-0399/0304.Range Sum Query 2D - Immutable/Solution.cpp | class NumMatrix {
public:
vector<vector<int>> s;
NumMatrix(vector<vector<int>>& matrix) {
int m = matrix.size(), n = matrix[0].size();
s.resize(m + 1, vector<int>(n + 1));
for (int i = 0; i < m; ++i) {
for (int j = 0; j < n; ++j) {
s[i + 1][j + 1] = s[i + 1][... | ALGO | 0.999854 | 6.685531 |
296fdb20-b7c9-4641-a51f-6d5adff57578 | openeuler-mirror/bishengjdk-11 | src/hotspot/share/opto/live.cpp | #include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "opto/callnode.hpp"
#include "opto/chaitin.hpp"
#include "opto/live.hpp"
#include "opto/machnode.hpp"
// Compute live-in/live-out. We use a totally incremental algorithm. The LIVE
// problem is monotonic. ... | ALGO | 0.980671 | 7.302055 |
9234f579-2ce5-4406-b688-f83c39a224f8 | AnketKohak/Mastering-DSA-Cpp | Loops/primeNumber.cpp |
#include<iostream>
using namespace std;
int main(){
cout<<"enter the number :";
int N;
cin>>N;
int i=2;
while(i<=N){
if(N%i==0){
cout<<0;
}
i=i+1;
}
cout<<1;
}
| ALGO | 0.999952 | 3.248068 |
7c991b7c-a645-4c2a-9936-bdd52ccb99d5 | brianhsu7476/CF | 2018/D.cpp | #include <bits/stdc++.h>
#define int long long
#define double long double
#define endl '\n'
#define rep(i,n) for(int i=0; i<(int)(n); ++i)
#define fup(i,a,b) for(int i=(a); i<(int)(b); ++i)
#define fdn(i,a,b) for(int i=(a); i>(int)(b); --i)
#define vi vector<int>
#define pb push_back
#define ins insert
#define SZ(a) (i... | ALGO | 0.999783 | 3.835614 |
85a1a67f-bc2d-4b41-b577-eeb506ffe968 | kanekisaneki1234/tutorials | tut_C++/lc_longest_substring.cpp | #include <cstddef>
#include <iostream>
#include <string>
// #include <vector>
#include <set>
using namespace std;
int lengthOfLongestSubstring(string s) {
set<char> seen;
int left = 0, right = 0;
int longest = 0;
while (right < s.size()) {
if (seen.find(s[right]) == seen.end()) {
... | ALGO | 0.999813 | 4.741821 |
0a3ab4e7-9342-41d3-b1f0-62515aa1ce4a | erwincoumans/boost | libs/graph/example/dfs_parenthesis.cpp | #include <boost/config.hpp>
#include <assert.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include "boost/graph/visitors.hpp"
#include "boost/graph/adjacency_list.hpp"
#include "boost/graph/breadth_first_search.hpp"
#include "boost/graph/depth_first_search.hpp"
using namespace boo... | ALGO | 0.998752 | 5.543301 |
754526e6-c453-489d-9203-df306996ef21 | Prashantkumar210/GeeksForGeeks | Difficulty: Easy/Count Digits/count-digits.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to count the number of digits in n that evenly divide n
int evenlyDivides(int n) {
int count = 0;
int temp = n;
while(temp>0){
... | ALGO | 0.999424 | 6.366921 |
9219ff57-d9f0-4462-9ee7-94501cfb24d3 | kmjp/procon | leetcode/351-400/366/2894.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a)... | ALGO | 0.999946 | 4.23679 |
81764cc6-b2f3-4789-8d41-3fbdb9495b98 | harshsamoliya/Algorithms | KMP.cpp | using namespace std;
bool knuthMorrisPrattAlgorithm(string str, string substr) {
// cses string matching
// preporecissing substr O(m)
// then find pattern in main string O(n)
// total time complexity -> O(n+m);
// step -> 1 preproccing
vector<int> pattern(substr.size(),-1);
int j = 0;
int i = 1;
while(i < su... | ALGO | 0.999903 | 5.199105 |
9671e910-2f78-4876-81a4-ca609c996541 | vantuan0128/DSA_PTIT | DSA06004.cpp |
/*
Cho mảng A[] gồm n phần tử, mảng B[] gồm m phần tử khác nhau. Các phần tử của mảng A[] và B[] đã được sắp xếp.
Hãy tìm mảng hợp và giao được sắp giữa A[] và B[]. Ví dụ với A[] = {1, 3, 4, 5, 7}, B[]={2, 3, 5, 6}
ta có mảng hợp Union = {1, 2, 3, 4, 5, 6, 7}, mảng giao Intersection = {3, 5}. In ra đáp án theo giá t... | ALGO | 0.999982 | 4.002219 |
d68eb859-923c-4861-8528-79719553711e | ssalinaa/Introduction-to-programming | Цикли/Supermajority.cpp | #include <iostream>
/*
You are given a positive number n and n consecutive integers,
one of which appears more than the rest of the numbers combined.
Find that number (You aren't allowed to use arrays).
Example:
Input Output
5
1 2 1 3 1 1
4
1 2 1 3 ???
Explanation:
In the first example there are three 1s which is m... | ALGO | 0.999926 | 3.910279 |
f3f7b952-c612-486b-8e1e-73921c19b6e9 | bongmiin/Language | C++/12주차 수업/포인터나 클래스로 구체화.cpp | #include<iostream>
#include<string>
using namespace std;
template <class T>
class MyStack {
int tos; // T 타입의 배열, 스택의 크기는 100
T data[100];
public:
MyStack();
void push(T element); // element를 data[] 배열에 삽입
T pop(); // 스택의 탑에 있는 데이터를 data[] 배열에서 리턴
};
template <class T>
MyStack<T>::MyStack() { // 생성자
tos = -1;
}... | ALGO | 0.978874 | 4.127922 |
acf285a2-8b72-4e01-a783-422140073f7b | arasHi87/OnlineJudgeExercise | toj29.cpp | #include <set>
#include <queue>
#include <cstdio>
#include <cstring>
using namespace std;
const int maxN=1e6+10, maxM=50+5;
struct Node {
Node *next[26];
Node *fail;
vector<int> id;
Node() {
memset(next, 0, sizeof next);
fail=NULL;
id.emplace_back(0);
}
} *root;
int t, n;
cha... | ALGO | 0.999911 | 4.312838 |
4b51c877-feeb-4ce6-8a71-86bfb876927d | JAlthea/Algorithm | Math/BOJ 1193 분수찾기.cpp | #import <ios>
int n, i, s, c;
int main()
{
scanf("%d", &n);
while (s < n)
s + = i++;
i--;
c = 1;
while (s != n)
s--, c++;
i % 2 == 0 ? printf("%d/%d", i - c + 1, c) : printf("%d/%d", c, i - c + 1);
}
| ALGO | 0.999685 | 3.323141 |
10943751-a2c3-4b46-bdde-eaab362b4556 | Jeanlukas1/Engenharia-de-Software | Estrutura de Dados/Aula 7/Aula 7 - P2 Exercicio.cpp | #include <iostream>
using namespace std;
// Implementao simples de deque usando array
class Deque {
private:
char data[100]; // Tamanho mximo de 100 caracteres
int front;
int rear;
public:
Deque() {
front = -1;
rear = -1;
}
bool isEmpty() {
return front == -1;
}
... | ALGO | 0.999826 | 6.400956 |
a0313e29-5145-4ac2-bc80-d256aa61b25b | bala-chandar12/DSA-C- | easy/[317] How Many Vowels_ [E].cpp | /*
#### How Many Vowels? ####
Create a function that takes a string and returns the number (count) of vowels contained within it.
[Examples]
___
countVowels("Celebration") ➞ 5
countVowels("Palm") ➞ 1
countVowels("Prediction") ➞ 4
_____
[Notes]
___
*) a, e, i, o, u are considered vowels (not y).
*) All test cas... | TEST | 0.948724 | 5.993493 |
bf7a69aa-4bb9-44b5-992d-378249b8b174 | Sookmyung-Algos/2021algos | algos_assignment/2nd_grade/김채연_chaeyeon20/9663.cpp | #include <iostream>
#define MAX 15
using namespace std;
int col[MAX];
int N, total = 0;
bool check(int level)
{
for(int i = 0; i < level; i++)
if(col[i] == col[level] || abs(col[level] - col[i]) == level - i)
return false;
return true;
}
void nqueen(int x)
{
if(x == N)
... | ALGO | 0.999884 | 4.782468 |
60bf9fc6-d182-4ea0-81a6-9f07b2a70930 | JuliusIsPerfect/leetcode | hot100/142.cpp | #include <iostream>
#include <vector>
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
auto slow = head;
auto fast = head;
while (fast->next && fast->next->next) {
... | ALGO | 0.999962 | 5.851788 |
1c16f1e9-5aec-42a6-b4e2-583ad380f181 | ygx2011/AR_course | AR_for_Win/FinalPlaneSLAM_ygx/orbslam_depthar/include/g2o/examples/interactive_slam/g2o_incremental/g2o_incremental.cpp | #include <iostream>
#include <cassert>
#include <csignal>
#include "g2o/stuff/macros.h"
#include "g2o/stuff/command_args.h"
#include "g2o/stuff/string_tools.h"
#include "g2o/stuff/tictoc.h"
#include "slam_parser/interface/parser_interface.h"
#include "g2o/examples/interactive_slam/g2o_interactive/g2o_slam_interface.... | ALGO | 0.908169 | 6.474952 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.