uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
28fb0439-68e3-4726-bf16-402c1677e527 | jhaamankumar/DSA-practice | kthmininarray.cpp | class Solution{
public:
// arr : given array
// l : starting index of the array i.e 0
// r : ending index of the array i.e size-1
// k : find kth smallest element and return using this function
int kthSmallest(int arr[], int l, int r, int k) {
//code here
sort(arr,arr+r+1);
... | ALGO | 0.999983 | 5.074332 |
3c449efa-e1a3-4727-8e6e-175d2b7d13a5 | Grzech17/Gothic | GOTHIC_GAME_Kopalnia_tlina.cpp | //lokacje - Kopalnia; Kotlina
#include<iostream>
#include "GOTHIC_GAME_postac.h"
#include "GOTHIC_GAME_item.h"
using namespace std;
extern postac *wja, *wscierwojad, *wgoblin1, *wgoblin2;
extern item *wstary_m, *wniewykonczony_m;
extern int loot, nek;
int mech(postac *dobry, postac *zly, bool musisz = 0);
int zaloz_bro... | TOOL | 0.854375 | 3.911455 |
6dc93d02-8009-4fa1-b333-1a817f03e151 | darele/Darwin-Piche | Codeforces/global-9/a.cpp | #include <bits/stdc++.h>
#define ll long long
#define vi vector <int>
#define vl vector <ll>
#define dl pair <ll, ll>
#define ii pair <int, int>
#define vii vector <ii>
#define graph vector <vi>
#define inf 1000000000
using namespace std;
bool comp(ll a, ll b) {
return a > b;
}
int main() {
ios_base::sync... | ALGO | 0.999632 | 3.95156 |
92ba3ac5-8b94-46ee-b05f-0644d9b498d9 | rhagenson/muscle | glbalign352.cpp | #include "muscle.h"
#include "pwpath.h"
#include "timing.h"
#include "textfile.h"
#include "msa.h"
#include "profile.h"
#if VER_3_52
#if TIMING
TICKS g_ticksDP = 0;
#endif
SCORE GlobalAlign(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
unsigned uLengthB, PWPath &Path)
{
#if TIMING
TICKS t1 = GetClockT... | ALGO | 0.975761 | 4.593627 |
48e00f18-907b-4fec-8d60-36459a19e649 | akashsaini3032/c-classlearning | Loop/function6.cpp | #include <iostream>
using namespace std;
bool isPalindrome(int number) {
int rv = 0;
int cpy = number;
while (number != 0) {
rv = rv * 10 + number % 10;
number = number / 10;
}
return rv == cpy;
}
int main() {
int number = 121;
if (isPalindrome(number)) {
cout << "... | ALGO | 0.999929 | 5.3468 |
21bb45c7-9460-4c10-bb11-1bf76d873ee4 | ImTurtle35/DataStructure | Week3_Q2.cpp | #include <iostream>
#include <string>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int e){
this->data = e;
this->next = NULL;
}
};
class SLinkedList{
public:
Node* head;
Node* tail;
SLinkedList() {
head = NULL;
tail = NULL;
}
void addFront(int x) {
Nod... | ALGO | 0.997957 | 4.191144 |
582bc682-3871-4345-a83b-e5ad5be0b53d | anurag-111/allSubmissions | happy-number/Accepted/4-5-2023, 2_27_06 PM/Solution.cpp | // https://leetcode.com/problems/happy-number
class Solution {
private:
int next_number(int n) {
long new_num = 0;
while(n) {
int num = n % 10;
new_num += num * num;
n = n/10;
}
return new_num;
}
public:
bool isHappy(int n) {
... | ALGO | 0.999978 | 6.474914 |
0f13553a-1d5f-4373-a590-ade6e2dc294b | llvm-pic/llvm-pic | llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp | #include "llvm/DebugInfo/CodeView/TypeIndexDiscovery.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/Endian.h"
using namespace llvm;
using namespace llvm::codeview;
static inline MethodKind getMethodKind(uint16_t Attrs) {
Attrs &= uint16_t(MethodOptions::Meth... | TOOL | 0.93093 | 4.192162 |
70f02333-dde6-4b8c-bfd9-a66ecf3b181f | Phantasm-Studios/UnrealEngine | Engine/Source/ThirdParty/hlslcc/hlslcc/src/hlslcc_lib/opt_algebraic.cpp | /**
* \file opt_algebraic.cpp
*
* Takes advantage of association, commutivity, and other algebraic
* properties to simplify expressions.
*/
#include "ShaderCompilerCommon.h"
#include "ir.h"
#include "ir_visitor.h"
#include "ir_rvalue_visitor.h"
#include "ir_optimization.h"
#include "glsl_types.h"
/**
* Visitor class ... | TOOL | 0.96694 | 7.127303 |
834d2cec-084b-49c6-bf3a-e8309631aa52 | CJSBinder-User/CJSBinder | experiment/correctness_efficiency/groundtruth/cpp/SUM_OF_ALL_ELEMENTS_UP_TO_NTH_ROW_IN_A_PASCALS_TRIANGLE_1.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
long long int f_gold ( int n ) {
long long int sum = 0;
sum = 1 << n;
return ( sum - 1 );
}
//TOFILL
int main() {
vector<int> param0 {53,3,28,44,84,8... | ALGO | 0.998936 | 4.99742 |
4be84b29-ad64-4a9f-baa7-c58efda3fd96 | HongSon28/Training | Contest training/VOI25 Training/Algorithm Review/KnuthDivision.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=5e3;
int n;
long long a[N+5],sum[N+5];
long long dp[N+5][N+5],inf=1e18;
int opt[N+5][N+5];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin>>n;
for (int i=1;i<=n;i++) {
cin>>a[i];
sum[i]=sum[i-1]+... | ALGO | 0.999915 | 3.746105 |
30f5cd8c-c655-44dd-b35a-7cbce5dc3f34 | Lavanyarekkala/PreCourse_1_copy | Exercise_2.cpp | #include <bits/stdc++.h>
using namespace std;
// A structure to represent a stack
class StackNode {
public:
int data;
StackNode* next;
};
StackNode* newNode(int data)
{
StackNode* stackNode = new StackNode();
stackNode->data = data;
stackNode->next = NULL;
return stackNode;
}... | ALGO | 0.99734 | 4.827492 |
160c63b1-ab62-4348-b672-4dde93fbb284 | Kaminyou/MyLeetcode | cpp_solutions/237.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void deleteNode(ListNode* node) {
ListNode* temp = node->next;
*node = *temp;
delete temp;
}
};
class S... | ALGO | 0.999905 | 5.845851 |
c53b1d57-3c56-4eaa-b106-77d776478cf7 | Vertexwahn/FlatlandRT | third_party/eigen-3.4.0/doc/examples/tut_arithmetic_redux_basic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::Matrix2d mat;
mat << 1, 2,
3, 4;
cout << "Here is mat.sum(): " << mat.sum() << endl;
cout << "Here is mat.prod(): " << mat.prod() << endl;
cout << "Here is mat.mean(): " << mat.mean() ... | ALGO | 0.998504 | 3.872858 |
77d1c5bc-0ad7-412c-b71e-ca0ac8141539 | HtetYalKyaw/C | enums.cpp | #include<iostream>
using namespace std;
enum Day{sunday = 0, monday = 1, tuesday = 2,wednesday = 3, thursday = 4, friday = 5, saturday = 6};
int main(){
Day today = friday;
switch (today)
{
case sunday : cout << "This is sunday" << endl;
break;
case monday : cout << "This is... | TOOL | 0.963096 | 3.187762 |
c5e565b7-847a-4a9c-a23f-80470175415a | pankajski/Training-Materials-Of-CDAC | Objected Oriented Programming Concepts Using C++ & Data Structures/Programs/Session1/returnExample.cpp | #include <iostream>
using namespace std;
int max ( int a, int b )
{
return ( a > b ? a : b );
}
int main()
{
int nOne = 5;
int nTwo = 7;
int result = max(nOne,nTwo);
cout<<"Result is : "<<result;
cout<<"\n\n\n";
return 0;
}
| ALGO | 0.998133 | 4.482611 |
a2864e83-d01f-48ce-ab84-7b8786cf6061 | yangjufo/LeetCode | 2024/94. 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.999977 | 6.646478 |
00736ad4-e145-42ae-a00d-6691b0580f50 | georgecatalin/Learn_CPP_Programming_Deep_Dive | Learn_CPP_Programming_Deep_Dive/Section 7 Loops/Check_for_armstrong_number/main.cpp | /* A number is an Amstrong number if the sum of the cube of the digits is equal with the number itself e.g 153 -> 1*1*1 + 5*5*5+3*3*3 = 153 */
#include <iostream>
using namespace std;
int main()
{
cout<<"Enter the number you wish to check if it is Armstrong number"<<endl;
int initial_number, n;
cin>>ini... | ALGO | 0.999557 | 4.460767 |
81fb8a17-fb60-4c03-993e-379b3bd1613e | chandradeepkumar16/LeetCode-Ques | 417-pacific-atlantic-water-flow/417-pacific-atlantic-water-flow.cpp | class Solution {
public:
void dfs(vector<vector<int>>& h,vector<vector<bool>> &vis,int i,int j)
{
int m=h.size();
int n=h[0].size();
vis[i][j]=true;
//up
if(i-1>=0 && vis[i-1][j]!=true && h[i-1][j]>=h[i][j])
dfs(h,vis,i-1,j);
//left
if(j-1>=0 && vis[i][j-1]!=true && h[i][j-1]>=h[i][j])
dfs(h... | ALGO | 0.999966 | 6.033077 |
382fa18f-71ba-4b73-bd63-aab9eb6c5d77 | raincross7/code-similarity | codes/train_code/problem162/problem162_262.cpp | #include <stdio.h>
int main(void) {
int a,b;
scanf("%d %d",&a,&b);
if(a<b)printf("a < b\n");
else if(a>b)printf("a > b\n");
else printf("a == b\n");
return 0;
} | ALGO | 0.999905 | 3.156657 |
2929d42b-87ad-4df1-b279-572210f367fa | KiranMMorpalle/Beginners-Code | Functionss/PrimeRange.cpp | #include <iostream>
using namespace std;
void primeRange(int start, int end){
for(int i=start; i<=end; i++){
bool flag=true;
for(int j=2; j<start; j++){
if(i%j==0){
flag=false;
break;
}
}
if(flag)
cout<<i<<" ";
... | ALGO | 0.999584 | 4.628328 |
42f73017-68ca-4fc2-a927-a9ee75b4eb91 | EvgenyPinezhanin/global_optimization_methods | samples/incr_test.cpp | #if defined( _MSC_VER )
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <fstream>
#include <iostream>
#include <vector>
#if defined( _MSC_VER )
#define _USE_MATH_DEFINES
#include <math.h>
#else
#include <cmath>
#endif
#include <omp.h>
#include <mggsa.h>
#include <map.h>
using namespace std;
// #defi... | ALGO | 0.997994 | 5.213165 |
e12d995b-6e72-4b8c-9221-949d6283625a | willemfrishert/pbrtbssrdf | integrators/directlighting.cpp | // directlighting.cpp*
#include "pbrt.h"
#include "transport.h"
#include "scene.h"
// DirectLighting Declarations
enum LightStrategy { SAMPLE_ALL_UNIFORM, SAMPLE_ONE_UNIFORM,
SAMPLE_ONE_WEIGHTED // NOBOOK
};
class DirectLighting : public SurfaceIntegrator {
public:
// DirectLighting Public Methods
DirectLighting(Li... | ALGO | 0.988447 | 6.637228 |
c305ea46-1f43-438f-bda3-39a06227187e | Adityasharma15/Agorithms | DFS/tree_coin_distribution.cpp | // 979. Distribute Coins in Binary Tree
class Solution {
// the idea is that of dfs only, int dfs function, the node
// will try to satisfy coins needed to receive/send by any
// of its parent node, and then will return the coins needed
// to send/receive by itself to the parent
// we count moves as when a req for s... | ALGO | 0.999945 | 6.254625 |
bdbb4ba3-7a10-4c0e-9c07-71499942559d | Anurag9458/Leetcode | 2236-maximum-twin-sum-of-a-linked-list/maximum-twin-sum-of-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
ListNode* reverse(ListNode *... | ALGO | 0.999997 | 5.551985 |
603a5086-4196-4046-8ebc-484f58eff8a9 | wzh1998/ACM-ICPC | ACM/2017秋集训_2002.cpp | #include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;
typedef struct Course{
int start;
int end;
}Course;
bool compare(Course a,Course b){
return (a.end < b.end);
}
int main(void){
Cour... | ALGO | 0.999909 | 3.888706 |
f6953a45-f095-496e-a90b-d2163a1e6cba | WhatTheAncient/db-labs | array/main.cpp | #include <iostream>
#include "array.cpp"
int main() {
int* my_array;
size_t size = 5;
my_array = rut::initialize_array(size);
std::cout << "Array: ";
rut::printArray(my_array, size);
int minVal = rut::find_min(my_array, size);
int maxVal = rut::find_max(my_array, size);
... | ALGO | 0.990086 | 4.945326 |
d509755f-52db-4d86-a193-d77b4b75685e | Pooja23494/DSA-21-05-2025 | Day16-UDF/Prog3.cpp | // TSRN
#include<iostream>
using namespace std;
void multiplication(int a,int b)
{
cout<<"Multiplication: "<<a*b;
}
int main()
{
int a,b;
cout<<"Enter A: ";
cin>>a;
cout<<"Enter B: ";
cin>>b;
multiplication(a,b);
return 0;
} | TOOL | 0.970037 | 3.799435 |
27242818-8a68-4aae-a05b-228758dec9e5 | joalen/HS_Codewars | pyramidarray.cpp | #include <vector>
#include <cstdlib>
std::vector<std::vector<int>> pyramid(std::size_t n) {
std::vector<std::vector<int>> pymid;
int r = n;
while (n-- > 0) {
std::vector<int> slice;
for (int i = 0; i < r; i++) { slice.push_back(1); }
pymid.push_back(slice);
r = n;
}
reverse(pymid.begin(... | ALGO | 0.998895 | 5.019477 |
7669d7d9-41d5-4b4b-b51f-ab1311ebace6 | Gemechu-Asfaw/Leetcode-Problems | Sort_List/submission1.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
int getLength(ListNod... | ALGO | 0.999984 | 5.626355 |
d668cb11-1f92-4fcc-8cf0-3132c8356e49 | MehulGarg22/Algo_Engineering | Program/Array/Array_I&O_CharacterArrays.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter Number of Words"<<endl;
cin>>n;
cout<<"Enter Words: "<<endl;
char arr[n+1];
cin>>arr;
cout<<endl;
int i=0;
while (arr[i]!='\0')
{
cout<<arr[i]<<endl;
i++;
}
re... | ALGO | 0.981971 | 3.387104 |
7a0c5181-61da-4ee3-9fb5-e3c7b2ccef2f | komalkvy/LEET_CODE | 936-rle-iterator/rle-iterator.cpp | class RLEIterator {
private:
vector<int> encoding;
int index = 0;
public:
RLEIterator(vector<int>& encoding){
this->encoding = encoding;
}
int next(int n) {
while (index < encoding.size() && n > encoding[index]) {
n -= encoding[index];
index += 2;
}
... | ALGO | 0.999608 | 4.690818 |
90e667ed-71bd-4a86-8766-0222167c8bcb | intervalrain/Cpp | leetcode/DP/70.climbing-stairs.cpp | #include <bits/stdc++.h>
using namespace std;
/*
* @lc app=leetcode id=70 lang=cpp
*
* [70] Climbing Stairs
*/
// @lc code=start
class Solution {
public:
int climbStairs(int n) {
if (n <= 3) return n;
int dp[2];
dp[0] = 2;
dp[1] = 3;
for (int i = 4; i <= n; i++){
... | ALGO | 0.999979 | 6.090712 |
89774543-16a7-4660-a72e-0fc0a827e2a5 | 1ndahous3/study | T-BMSTU/discrete_math/MaxComponent/main.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
using namespace std;
class MaxComponent {
private:
map<int, vector<int> *> *bridges = new map<int, vector<int> *>;
vector<pair<int, set<int> *> *> *comps;
void splitComponents() {
comps =... | ALGO | 0.99674 | 5.032787 |
431bd4ed-e0fd-4822-98c3-6586bacfb871 | dhivakar9361/c-program | Untitled2.cpp | 2 #include <stdio.h>
int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);
if(num % 5 == 0 && num % 11 == 0) {
printf("Number is divisible by 5 and 11");
}
else {
printf("Number is not divisible by 5 and 11");
}
return 0;
}
| ALGO | 0.998039 | 4.140151 |
41e6fb31-88a0-4589-907f-47786f68fb39 | quyetkaito68/SPOJ-completed-code | Summer-2020/P202PROJ_demcap.cpp | //P202PROJ_demcap
//xanh
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;cin>>s;
string str="";
int check=0,dem1=0;
for(int i=0 ; i<s.length() ; i++){
if(s[i]=='1') {str+='1';check=1;dem1++;}
else if(check!=0 && s[i]=='2') {str+='2';}
}
int len = str.length()-1;
while(str[len]=='1'){
len-... | ALGO | 0.999736 | 3.840703 |
58664491-5b1b-4eed-b85d-55cfb446001e | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3306_17.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
class MinPq : public priority_queue<T, vector<T>, greater<T> > {};
template <typename T>
class MaxPq : public priority_queue<T, vector<T>, less<T> > {};
int a[100000];
int main() {
int i, n, pos, mn = INT_MAX;
multimap<int, int> bstree;
ios_base:... | ALGO | 0.999998 | 3.936739 |
5b4e25e4-5086-415e-82d3-d5c0203c09e3 | diwyanshuprasad19/DSA_Coding | 2.matrix/46.search/optimal.cpp | // C++ program to search an element in row-wise
// and column-wise sorted matrix
#include <bits/stdc++.h>
using namespace std;
/* Searches the element x in mat[][]. If the
element is found, then prints its position
and returns true, otherwise prints "not found"
and returns false */
//start from right most col and 1s... | ALGO | 0.999976 | 5.140707 |
b8f13d00-79e9-4413-9017-6d0534e70a8b | devanob/TicTacToeA.I | AIPlayerTicTacToe.cpp | #include "AIPlayerTicTacToe.h"
/**
* @brief Construct a new AIPlayerTicTacToe::AIPlayerTicTacToe object
*
* @param playeSymbol - the char symbol of the current player
* @param opponetSymbol -the char symbol of the opposing player
* @param maxDept - the maximuim depth search of the user (search space)
*/
AIPla... | ALGO | 0.989641 | 5.955778 |
dbc41b6a-9ab8-4d92-be48-a74fcbeafd3d | AmineZarouane/CompetitiveProgramming | Codechef/JULY19B/Minimum and Maximum.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=1e6+5;
const int dx[]={0,1,-1,0},
dy[]={1,0,0,-1};
using ll = long long;
int n,m,tc,k,ans,a[N];
char s[N];
int mod(char* num, int a)
{
int res = 0;
for (int i = 0; num[i]; i++)
res = (res*10 + (int)num[i] - '0') %a;
r... | ALGO | 0.999952 | 4.187603 |
6cf5927f-154e-4cd0-a837-684c5f26e530 | kiro1973/carpooling_mobile_app | driver-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.999028 | 6.76073 |
2413fd3e-1454-4fec-8084-72141c45095f | zjma/codegames | cf-round-372/c.cpp | // template.cpp : Defines the entry point for the console application.
//
#include <climits>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <unordered_set>
#in... | ALGO | 0.999516 | 3.643546 |
2f842761-2724-4ebe-b442-5190874d6aed | Kileniass/TEST | Task5.cpp | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
void output(double otvet) {
cout << otvet;
}
void solution(double summa, double first_pay, double crok) {
double otvet = (summa - first_pay) / (11 + (crok - 1)*12);
output(otvet);
}
void input() {
double summa, first_pay, crok... | ALGO | 0.996291 | 3.33921 |
7352842b-8bcd-4f97-9ef1-291ce56849da | Wayne-Yang-Crosshair/code | f607 3. 切割費用.cpp | //ѦҧOH{X
#include<iostream>
#include<algorithm>
#include<stdlib.h>
using namespace std;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(0);
int n,L;
cin>>n>>L;
pair <int,int> a[n];
for(int k=0;k<n;k++){
cin>>a[k].first>>a[k].second;
}
sort(a,a+n);
long long sum = 0;... | ALGO | 0.999858 | 3.109224 |
9403b49d-206b-485a-9059-1f6506c13dae | Shahraaz/CP_P_S5 | ICPC_Mirrors/Nitc_13.0/problems/problems/ideal/solutions/ideal_iz.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 4e18;
int main() {
int n;
cin >> n;
vector<ll> x(n), y(n), h(n);
for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> h[i];
ll min_x = INF, max_x = -INF, min_y = INF, max_y = -INF;
for (int i = 0; i < n; i++) {
min_x = mi... | ALGO | 0.999397 | 4.173135 |
c6d73279-30e1-45cf-8caf-997d05ad37a6 | SnehaBakshi14/LeetCode | 1044-find-common-characters/find-common-characters.cpp | class Solution {
public:
void fillCountArray(string &word, int count[26])
{
for(char &ch : word) {
count[ch-'a']++;
}
}
vector<string> commonChars(vector<string>& words)
{
vector<string> result;
int n = words.size();
int count[2... | ALGO | 0.999968 | 6.051489 |
6a16765b-ed22-4998-a89d-ae8e6da60407 | BigFFFF/lvgl_st7789_stm32 | Drivers/lvgl/src/libs/thorvg/tvgSwImage.cpp | #include "../../lv_conf_internal.h"
#if LV_USE_THORVG_INTERNAL
#include "tvgMath.h"
#include "tvgSwCommon.h"
/************************************************************************/
/* Internal Class Implementation */
/**********************************************************... | ALGO | 0.873551 | 6.741437 |
676ef3e5-e813-48a5-a217-9f5e92778487 | pippi0057/Competitive-Programming | AtCoder/ABC/-180/166/C.cpp | #include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979;
#define setup\
cin.tie(0);\
ios::sync_with_stdio(false);\
cout << setprecision(20) << fixed;
#define int long long int
#define db double
#define P pair<int,int>
#define F first
#define S second
#define dtor(deg) (((deg)/360)*2... | ALGO | 0.99996 | 3.761573 |
37f43663-1759-40b9-b02a-bc7672eeb0f1 | CAPDGroup/CAPD | capdExt/cxsc-2-5-4/src/l_cmath.cpp | /* CVS $Id: l_cmath.cpp,v 1.11 2014/01/30 17:23:46 cxsc Exp $ */
#include "l_cmath.hpp"
namespace cxsc {
l_complex sqrt(const l_complex& z)
// Computation of sqrt(z); stagprec <= stagmax=19 determines the maximum
// accuracy of about 16*19 = 304 decimal digits.
// The branch cut of this sqrt-function is the negat... | ALGO | 0.997364 | 4.600612 |
bf993b1f-8a64-46de-97d9-57ec44353ae7 | samnoonabrar/samnoon-cp-journey | codeforces/1209/B.cpp | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
/// faster.
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define samnoon ... | ALGO | 0.999982 | 4.145112 |
5e949464-7844-4755-9307-6c30d54f21e8 | SkyLoaderr/xray-last-days | xray/xrCDB/ISpatial_q_ray.cpp | #include "stdafx.h"
#include "ISpatial.h"
#pragma warning(push)
#pragma warning(disable:4995)
#include <xmmintrin.h>
#pragma warning(pop)
// can you say "barebone"?
#ifndef _MM_ALIGN16
# define _MM_ALIGN16 __declspec(align(16))
#endif // _MM_ALIGN16
struct _MM_ALIGN16 vec_t : public Fvector3 {
float pad;
};
//s... | ALGO | 0.998303 | 5.469628 |
f5557c44-a7c0-47ac-a0f3-28bd4d1ba69f | neocoretechs/libedgetpu | tensorflow/eigen/doc/examples/TutorialLinAlgSetThreshold.cpp | #include <iostream>
#include <Eigen/Dense>
int main()
{
Eigen::Matrix2d A;
A << 2, 1,
2, 0.9999999999;
Eigen::FullPivLU<Eigen::Matrix2d> lu(A);
std::cout << "By default, the rank of A is found to be " << lu.rank() << std::endl;
lu.setThreshold(1e-5);
std::cout << "With threshold 1e-5, the ran... | ALGO | 0.999876 | 4.340173 |
61c74d70-7486-49cc-adce-b6009a700c6f | ruizhang1996/optimal-sparse-regression-tree-public | src/encoder.cpp | #include "encoder.hpp"
Encoder::Encoder(void) {}
// Construct an encoder which converts a non-binary data set into a binary-encoded dataset
Encoder::Encoder(std::istream & input) {
std::vector< std::vector< std::string > > tokens;
tokenize(input, tokens); // Produce string tokens from the input
parse(toke... | DATA | 0.864647 | 6.141275 |
2014c070-769b-439c-9345-84a7af611a7d | kailanefelix/data-structures | hastable.cpp | #include <iostream>
#include <stdexcept>
#include <string>
using T = std::string;
template<class T>
class hashtable {
struct node {
int hash;
std::string key;
T value;
};
public:
bool empty() const {
return size_ == 0;
}
int size() const {
return size_;
... | ALGO | 0.986008 | 4.628977 |
57275611-92e1-4597-824a-7886bf039e90 | mewhotheboss/CodeForces | 1873A_Short_Sort.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
string row;
cin >> row;
if(row=="bca" || row=="cab")
{
cout<<"no"<<endl;
}
else cout<<"yes"<<endl;
}
return 0;
}
| ALGO | 0.999805 | 4.366886 |
5012f632-c9fc-452d-af77-9aa20736459f | SRHridoy/Cpp-Program | C++ CP/Competitive Programming(DSA)/Basic CPP && DSA/17_STL_MOST_USEFUL/7_SET, UNORDERED SET & MULTISET.cpp | #include<bits/stdc++.h>
#define int long long
using namespace std;
void printSet(set<string>&s){
for(auto it : s){
cout << it << endl;
}
}
signed main(){
set<string>s_s;
s_s.insert("abc");//log(n)
s_s.insert("zsdf");
s_s.insert("bcd");
s_s.insert("bcd");
auto it = s_s.find("a... | ALGO | 0.99862 | 3.867433 |
7b026552-fa6c-47ad-84f4-df670997201f | sarahorsak/STRUMPACK | src/sparse/ordering/MatrixReorderingMPI.cpp | #include <unordered_map>
#include <algorithm>
#include "MatrixReorderingMPI.hpp"
#include "StrumpackConfig.hpp"
#include "sparse/CSRGraph.hpp"
#include "sparse/SeparatorTree.hpp"
#include "sparse/fronts/FrontalMatrix.hpp"
#if defined(STRUMPACK_USE_SCOTCH)
#include "ScotchReordering.hpp"
#endif
#if defined(STRUMPACK_US... | ALGO | 0.999226 | 6.02397 |
dc027119-6b60-4abe-a0c2-f630f7af7d4f | dongheuw/ICPC-related | 2015-summer/0717/c.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <map>
#define fo(i,a,b) for (int i = a;i <= b;i ++)
using namespace std;
const int maxn = 2005;
int T,ind,cnt;
int tot,a[maxn],b[maxn],c[maxn];
map<string,int> A,B;
char s[maxn];
string v[10];
void Insert(int x,int y)
{
tot ++;
b... | ALGO | 0.999335 | 3.493848 |
ce40e395-a5e4-4bdc-a2a7-3b7331c24fad | TaftProject/cointaft | src/bls/bls_ies.cpp | #include <bls/bls_ies.h>
#include <hash.h>
#include <random.h>
#include <crypto/aes.h>
template <typename Out>
static bool EncryptBlob(const void* in, size_t inSize, Out& out, const void* symKey, const void* iv)
{
out.resize(inSize);
AES256CBCEncrypt enc((const unsigned char*)symKey, (const unsigned char*)i... | ALGO | 0.980287 | 7.277326 |
b833dfb2-6aeb-4450-8567-57b3547073fe | ishandutta2007/codeforces | cldp/normal/750/A.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 1010;
const int INF = 1000000007;
int main() {
ios_base::sync_with_stdio(false);
int N, K;
cin >> N >> K;
for (int i = 1; i <= N; ++i... | ALGO | 0.999727 | 3.446263 |
12458319-db5c-433f-97a2-ae962f2dc9fd | rupav/cp | competitive_coding/contests/547/547A.cpp | #include<bits/stdc++.h>
using namespace std;
#define fr(i,n) for(int i=0; i<n; i++)
#define rep(i, st, en) for(int i=st; i<=en; i++)
typedef long long ll;
typedef pair<int, int> pii;
ll mod = 1e9+7;
int main(){
int n, m;
cin>>n>>m;
if(m%n != 0){
cout<<-1;
return 0;
}
int ans = m/n;... | ALGO | 0.999991 | 4.002769 |
3f7cf2e0-c6f1-495a-9d93-d0bed6c489a1 | sakshieng/DSA-Sheet | STL in C++/24.cpp | #include<bits/stdc++.h>
/* Sakshi */
using namespace std;
// by using comparator fuc^n we can define custom sorting algorithm from inbult algorithm
// sort(from which sorting has to be started,next element upto which sorting is done)
/* this inbulit algo is combi of
1.quick sort
2.heap sort
3.in... | ALGO | 0.999983 | 4.318231 |
fbafe0bd-1860-48ed-9d4d-70e31d81f942 | a0165897/parallel | DBSCAN-master/DBSCAN-master/main.cpp | #include <iostream>
#include <fstream>
#include <math.h>
#include <queue>
#include <vector>
#include "stdlib.h"
#include"time.h"
using namespace std;
struct Point{
double x;
double y;
int lable; // -1 unvisited, 0 noise, >0 cluster index
};
double euclidean_distance(Point a, Point b)
{
double x = a.x-... | ALGO | 0.999768 | 4.498116 |
427844e1-aa28-4615-9ca9-4a3a54252a5e | Lynares/Algoritmica | 2012/Practica 3/kruskal.cpp | #include <iostream>
#include <vector>
using namespace std;
int cn=4; //cantidad de nodos
const int INF=999999;
int adyacencia[4][4]={{INF,2,INF,3},
{2,INF,INF,INF},
{INF,INF,INF,3},
{3,INF,3,INF}
}; //matriz de adyacencia
// Devuelve la matriz de adya... | ALGO | 0.999934 | 3.826256 |
3e3a8090-87da-49fa-8ce6-8926ec39f82a | leanhtu2k6/TuleC.github.io | 14.bài 14 vòng lặp for/14.bài 14 vòng lặp for.cpp | // 14.bài 14 vòng lặp for.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
using namespace std;
int main()
{
// xuất các số chắn từ 0-10
for (int i = 0; i <= 10; i += 2) {
cout << "i= " << i << endl;
}
//tổng các số chẵn từ 0-10
... | ALGO | 0.989226 | 3.433456 |
b47576b9-c489-4990-af5b-38dce156c916 | ericwindmill/gemini_recipe_generation | 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.998799 | 6.776823 |
72601104-a97f-4703-9629-0ad2a427d3e8 | AGILESCIENCE/WTOOLS | C++WTOOLS/CCL/Main.cpp | #include <stdio.h>
#include "GetOptions.h"
#include "Labeling.h"
#include "ConnectedComponent.h"
using namespace std;
void copyPlane(const gsl_matrix *m, int *p) {
double *pm = m->data;
for(unsigned int i = 0; i < m->size1; i++) {
for(unsigned int j = 0; j < m->size2; j++)
*p++ = (int)*pm++;
pm += m->tda - ... | TOOL | 0.857852 | 6.257721 |
b77bd2ea-f720-4b5c-be13-e635d891b3b1 | agrawal-ris/competitive | Codeforces/Codeforces - 520B.cpp | #include <bits/stdc++.h>
using namespace std;
void edge (vector <int> graph[], int a, int b) {
graph[a].push_back(b);
}
void BFS(vector <int> graph[],int size,int source, vector <int> &levels, int m) {
vector <bool> visited(size, false);
vector <int> queue;
queue.push_back(source);
visited[sour... | ALGO | 0.999703 | 3.421113 |
4364dc0e-17c7-47fe-8785-984986d9a6fb | sajurr/PYTHIA | test_FB_corr2.cpp | // #include <iostream>
// #include <vector>
// #include "Pythia8/Pythia.h"
// #include "TFile.h"
// #include "TTree.h"
// #include "TH1D.h"
// #include "TCanvas.h"
// #include "TBrowser.h"
// int main() {
// Pythia8::Pythia pythia;
// pythia.readString("Beams:eCM = 13000.");
// pythia.readString("SoftQCD:all = o... | ALGO | 0.998966 | 6.708098 |
7572a8db-6cac-4dee-9f50-b91bc6a859e6 | yfuka86/pc | atcoder/arcold/arc133/d/arc133_d.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep_r(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rep2(i,sta,n) for(ll i=sta;i<(ll)(n);i++)
#define rep2_r(i,sta,n) for(ll i=(ll)(n)-1;i>=sta;i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp ... | ALGO | 0.999683 | 4.143775 |
75999b77-5854-40ad-96e3-1e37962c47b3 | VerySadJoy/BOJ | BOJ/Questions/Q17144.cpp | //Question No: 17144
//Title: 미세먼지 안녕!
//Tier: Gold IV
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
int R, C, T;
int board[51][51];
int cleaner[2];
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
void spread_dust() {
int temp... | ALGO | 0.999847 | 4.985969 |
e515fbc3-8741-4475-bba2-fa834e8e92dc | sanjiv0286/CP-Daily-Practice-Problems | Important/Three_Powers_of_Two.cpp |
// =======================================================================
// ************************* MTRL ****************************************
// GOOD LUCK
// | | | k
// ( | k
// | | |k
// ) | k
// | | • | k
// DATE: 27-01-2023
// TIME: 00-14-31
#includ... | ALGO | 0.99907 | 5.583845 |
f91fdfb1-e4ed-4de6-b372-d6d66adb1020 | roshan-Kawale/DSA | array/reverseArray.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<int> reverse(vector<int> v) {
int s = 0 , e = v.size()-1;
while(s<=e) {
swap(v[s] , v[e]);
s++;
e--;
}
return v;
}
void print(vector<int> v) {
for(int i:v) {
cout<<i<<" ";
}
cout<<endl;
}
int ... | ALGO | 0.99956 | 5.046693 |
ccdeb650-5829-488a-b3ef-9576eb00e056 | dasinlsb/Algorithm-Contest-Records | PersonalTraining/nowcoder/牛客国庆集训派对Day1/E.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn=1000005;
int n,m,a[maxn];
int main(){
freopen("aa.in","r",stdin);
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
scanf("%d",a+i);
}
sort(a+1,a+1+n);
int ans=n;
for(int i=1;i<n;i++){
if(abs(a[i]-a[i+1])<=m){
ans--;
}
}
printf(... | ALGO | 0.999978 | 3.865754 |
470e05c4-6a52-445e-bc43-85b93e6752a4 | kklaoss/Lab6_Task2.2 | Calculation.cpp | #include <iostream>
#include "Calculation.h"
void Calculation::Operate(Function* pFunc) {
std::cout << "Calculation for function y = " << pFunc->GetName() << std::endl;
pFunc->SetCoeff();
double x;
std::cout << "Enter x = ";
std::cin >> x;
std::cin.ignore();
pFunc->SetArg(x);
std::cout << "y = " << pFunc->GetV... | TOOL | 0.899927 | 5.014923 |
599c3fa9-4ae7-4acd-9199-010017bd7829 | FALL1N1/434OMFG.GG | src/server/game/Movement/Spline/Spline.cpp | #include "Spline.h"
#include <sstream>
#include <G3D/Matrix4.h>
namespace Movement{
SplineBase::EvaluationMethtod SplineBase::evaluators[SplineBase::ModesEnd] =
{
&SplineBase::EvaluateLinear,
&SplineBase::EvaluateCatmullRom,
&SplineBase::EvaluateBezier3,
(EvaluationMethtod)&SplineBase::UninitializedSp... | ALGO | 0.956981 | 6.404049 |
606dc52b-a06c-48db-b263-d7ec3c93a153 | RahulScripted/CodeChef | CodeChef-Problems/Rating Less 500/OctoberMarathon.cpp | // Chef organized a 30 kilometers marathon in Chefland. The participants receive medals on completing the marathon as following:
// 1. If the total time taken is less than 3 hours, they receive a GOLD medal.
// 2. If the total time taken is greater than equal to 3 hours but less than 6 hours, they receive a SILVER m... | ALGO | 0.94585 | 4.607369 |
3449ef09-20ba-4868-8028-5d3b42fc7f7c | prabhxjottsingh/leetcode-practise-problems | Bit Manipulation/1829 - Maximum XOR for Each Query.cpp | // Problem Link: https://leetcode.com/problems/maximum-xor-for-each-query/
class Solution
{
public:
vector<int> getMaximumXor(vector<int> &nums, int maximumBit)
{
int n = nums.size();
int m = maximumBit;
vector<int> prevXOR;
prevXOR.push_back(nums[0]);
for (int i = 1; i ... | ALGO | 0.999973 | 5.674021 |
f2f6fa7e-92dd-4de4-93f8-52c2a2491364 | imjnnanna/USACO-solutions | Gold/superbull.cpp | /*
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
long long cow[2005];
long long n;
long long arr[2005];
bool vis[2005];
long long len = 0;
long long grid[2005][2005];
long long mst() {
for(long long i = 1; i <= n; i++) arr[i] = 1000000000;
arr[1] = 0;
for(long long i = 1; i <= ... | ALGO | 0.999989 | 3.789047 |
b8333ce7-5ce1-4674-b903-ec12e6ec6c93 | manishkhilnani2911/leetcode | 32_longest_valid_parentheses.cpp | /*Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
Example 1:
Input: "(()"
Output: 2
Explanation: The longest valid parentheses substring is "()"
Example 2:
Input: ")()())"
Output: 4
Explanation: The longest valid parentheses substri... | ALGO | 0.999748 | 5.255935 |
f6d82286-ace8-48fd-b37a-219134c2b3eb | Aubstract/CISP400_ChaosGame | Chaos/Chaos.cpp | //Chaos game by Aubrey Fields and William Garica-Cortes
#include <SFML/Graphics.hpp>
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <vector>
using namespace sf;
using namespace std;
CircleShape getPosBetweenPoints(CircleShape current, CircleShape vertex, float ratio)
{
float x1 = current.getPositio... | TOOL | 0.865552 | 4.055465 |
f1224f7d-853d-467a-a145-6f94da4e275c | PhantomGamesDevelopment/Galactic-2D | Source/EngineCore/Tools/huffman.cpp | #include "huffman.h"
namespace Galactic {
namespace Core {
//Declare the static reference
HuffCoder HuffCoder::G_HuffCoder;
bool HuffCoder::compressStringToBitStream(UTF16 string, Streams::BitStream *stream, S32 maxLength) {
if(!string) {
//We handle empty strings by sending a false flag (compressed),... | ALGO | 0.968686 | 6.261285 |
ab29a149-1af1-40a2-bf9b-5046b85f38c0 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/july/DoctorChef_20200706191221.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.999985 | 3.762778 |
3eacfdcb-6a13-48cb-9ebd-09b01a0ce30d | IshaanGaba97/LeetCode-Solutions | 0876-middle-of-the-linked-list/0876-middle-of-the-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* middleNode(... | ALGO | 0.999891 | 5.851234 |
660e1ad8-a40d-405d-ad9f-58667b9887a1 | ishandutta2007/codeforces | alexluchianov/normal/1423/J.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
void solve() {
long long x;
scanf("%lld", &x);
int sol;
long long a = x / 2 + 2;
if (a % 2 == 0) sol = 1LL * a / 2 % MOD * (a / 2 % MOD) % MOD;
else sol = (1LL * a / 2 % MOD * (a / 2 % MOD) % MOD + a / 2) % MOD;
printf("%d\n", sol);
}
... | ALGO | 0.999892 | 4.774911 |
06a87d88-7861-431d-b5b8-dfa0c10517b7 | hyeonseong0917/BOJ | random_silver/24479.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
using namespace std;
#define ll long long
ll check[100000+1];
ll n,m,r;
priority_queue<ll> g[100000+1];
ll cnt=1;
void dfs(ll cur_num){
while(!g[cur_num].empty()){
ll next_num=g[cur_num].top()*-1;
g[cur_num].pop();
... | ALGO | 0.999909 | 3.80303 |
1598f648-962d-4995-b159-667cb00957e8 | CJSBinder-User/CJSBinder | experiment/correctness_efficiency/cjsbinder/SMALLEST_DIFFERENCE_PAIR_VALUES_TWO_UNSORTED_ARRAYS/SMALLEST_DIFFERENCE_PAIR_VALUES_TWO_UNSORTED_ARRAYS_GLUECODE.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include "include/libplatform/libplatform.h"
#include "include/v8.h"
#include "CQuesHeader.h"
using namespace v8;
void Print(const FunctionCallbackInfo<Value>& args){
v8::Isolate* isolate = args.GetIsolate();
v8::Str... | ALGO | 0.987025 | 4.726897 |
fcabd16c-37ff-4e58-b51c-29e47bccaf45 | yukina-t156/step2022 | homework1/homework1_anagram2_2.cpp | //宿題2 おまけ(手動入力して調べる)
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <string>
#include <queue>
using namespace std;
#define all(x) (x).begin(), (x).end()
int score(string word)
{
int point = 0;
for (int i = 0; i < word.size(); i++)
{
switch (word[i])
{... | ALGO | 0.99712 | 4.338823 |
0942b7cc-b9d8-482e-ad27-f084a0c9f396 | MyCodeBattle/LeetCode | Sort Colors/solution.cpp | /*
* 常见的思路是遍历两次。
* 有种很巧妙的思路,碰到0往左放,2往右放,剩下来的就是1.
*/
class Solution {
public:
void sortColors(vector<int>& nums) {
int left = -1, right = nums.size();
int pos = 0;
while (pos < right) {
if (pos == left)
++pos;
else if (nums[pos] == 0)
... | ALGO | 0.999997 | 5.645881 |
fa047299-ec40-4caf-9f50-e2f34953011f | HarshTanwar143/Harsh-Tanwar_22BCS10007 | linked list/707. Design Linked List.cpp | struct MyList
{
int val;
MyList* next;
MyList(int x) : val(x), next(nullptr) {}
};
class MyLinkedList
{
private:
MyList* _head;
MyList* _tail;
int len;
MyList* createNode( int val )
{
MyList* temp = new MyList(val);
return temp;
}
public:
MyLinkedList() : _... | ALGO | 0.999785 | 5.135845 |
480183ef-4dbb-4bb4-8d4d-eb01e39feb81 | Vaibhav4228/my-dsa-codes | 14. CLASS CODE/Homework10.cpp | // HW 10: Find SQRT of Integer N using Binary Search with K point decimal precision
#include <iostream>
#include <vector>
using namespace std;
// INTEGER PART OF SQRT
int mySqrt(int n)
{
int s = 0, e = n;
int ans = 0;
while (s <= e)
{
int mid = (e - s) / 2 + s;
// predicate fn
... | ALGO | 0.999938 | 4.629205 |
70e2a20a-fb0c-4f5e-b082-231250ced0df | hanhpd/cocos2d-x-3.17.2-x64 | external-x64/box2d-2.3.0/Box2D/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp | #include <Box2D/Dynamics/Joints/b2RevoluteJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Point-to-point constraint
// C = p2 - p1
// Cdot = v2 - v1
// = v2 + cross(w2, r2) - v1 - cross(w1, r1)
// J = [-I -r1_skew I r2_skew ]
// Identity used:
// w k % (rx i + ry j) = w * (-r... | ALGO | 0.982319 | 7.730262 |
4bd71080-9193-4bb0-9acd-4242756ae366 | nvdungyb/DSA | B2.cpp | #include<bits/stdc++.h>
using namespace std;
int count(int a[], int n)
{
int l = 1, r = n;
int ans = 0;
while(l < r)
{
int mid = (l+r)/2;
if(a[mid] == 0)
{
ans = mid;
l++;
}else{
if(a[mid] == 1)
{
r = mid;
}else{
ans = mid;
l = mid;
}
}
}
return ans;
}
int main()
{
int t... | ALGO | 0.999825 | 4.770228 |
77a59341-6c0c-4df6-ad1a-9c8f57ddeea7 | KunalNarkhedePatil/LogicBuilding | ProblemsOnArrays/SeachLastOccurrenceOfNo.cpp | // search last occurrence of element in the array
#include "MyArray.h"
class Demo : public MyArray // here we inherite the MyArray class from MyArray.h header file
{
public:
int iSize;
Demo(int iSize) : MyArray(iSize) // base member initialisation
{
this->iSize = iSize;
}
int searchLastOccu... | ALGO | 0.998894 | 4.139716 |
123683a8-7a76-4784-8662-2136ffd86163 | thehobster1/AEM-520 | AEM520HW6.cpp | #define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <cmath>
#include <fstream>
#include <string>
#include <algorithm>
#include <math.h>
#include <filesystem>
#include <sstream>
#include <iomanip>
#include <ctime>
std::stringstream ss;
using namespace std;
//namespace fs = std::filesystem;
cl... | ALGO | 0.982888 | 3.71047 |
8937e022-f359-4ce8-adce-450315d3abf9 | m1n1tea/MISIS-programming | makurov_m_p/hw-05-02.cpp |
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
int main()
{
long double a, b, d, e, summ, x,y, si;
int i;
a = 0;
b = 1;
d = 0.05;
e = 0.001;
std::cout << " x | s(x) | f(x)" << "\n";
while (a < b + d/2) {
x = a;
if (std::abs(x) < d/2)
x = 0;
a += d;
summ = 0;
si = 1;
i = 0;
... | ALGO | 0.99963 | 3.200694 |
15dc4e4a-c9e9-4a6a-bbe3-f627c6d2cf6b | hieupm123/Hieu | code/C++/CSES-Solutions/String Algorithms/Finding Borders (1732)/catkl.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
vi Z(string S) {
vi z(sz(S));
int l = -1, ... | ALGO | 0.999976 | 3.933608 |
0e926f2d-6679-49dc-ac9d-d2cf495e2483 | vedanth2001/Leetcode-Submissions | 0127-word-ladder/0127-word-ladder.cpp | class Solution {
public:
int ladderLength(string beginWord, string endWord, vector<string>& wordList) {
queue<pair<string, int>>q;
q.push({beginWord, 1});
unordered_set<string>s(wordList.begin(), wordList.end());
while(!q.empty()){
string word = q.front().first;
... | ALGO | 0.999991 | 5.748326 |
8704db71-6c7e-4eaf-8507-dfbd2332f134 | ishandutta2007/codeforces | marckess/normal/672/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define FOR(i,n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int... | ALGO | 0.99991 | 4.711842 |
02dc98fe-db39-4acd-a5aa-c4eac6fa9ecd | w41ter/LeetCodePractice | 37-Sudoku-Solver.cpp | class Solution {
public:
typedef vector<vector<char>> matrix;
void solveSudoku(vector<vector<char>>& board) {
find(board, 0, 0);
}
bool find(matrix &board, int x, int y) {
for (int i = x; i < 9; ++i) {
for (int j = y; j < 9; ++j) {
if (board[i][j] != '.') con... | ALGO | 0.999615 | 7.010659 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.