uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
aff0b31e-0fb8-4daf-ac9b-63cdc454f2d9 | alewir/Hypercube_Evo-EZ | Marlin2/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.cpp | #include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
const PinName digitalPin[] = {
PB_12,
PB_13,
PB_14,
PB_15,
PD_8,
PD_9,
PD_10,
PD_11,
PD_12,
PD_13,
PD_14,
PD_15,
PG_2,
PG_3,
PG_4,
PG_5,
PG_6,
PG_7,
PG_8,
PC_6,
PC_7,
PC_8,
PC_9,
PA_8,
PA_9,
PA_10,
PA_11,
PA_12,
PA_13,
PA_1... | CONFIG | 0.939835 | 5.010884 |
03c949c9-0751-457e-980f-8e7fc71afb39 | raincross7/code-similarity | codes/train_code/problem205/problem205_3.cpp | #include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
const st... | ALGO | 0.999835 | 3.40784 |
ab22a9e6-8f13-44f8-9814-0c0a74c38ffd | babyyu0/Programmers-BOJHub | C++/프로그래머스/0/181892. n 번째 원소부터/n 번째 원소부터.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<int> num_list, int n) {
vector<int> answer(num_list.begin() + --n, num_list.end());
return answer;
} | ALGO | 0.999634 | 5.302719 |
971fd055-09b7-4c91-ae2a-9ba5cbf7ff19 | mitkonikov/atlas | Data Structures/sparse_lazy_segtree.cpp | #include <bits/stdc++.h>
using namespace std;
#pragma once
const int inf = 1e9;
struct Node {
Node *l = 0, *r = 0;
int lo, hi, mset = inf, madd = 0, val = -inf;
void merge() {
val = max(l->val, r->val);
}
void push() {
if (!l) {
int mid = lo + (hi - lo) / 2;
l = new Node(lo, mid);
... | ALGO | 0.998939 | 4.747634 |
c92d9c92-bcff-48f7-9e2c-079903841e4d | Arnav-Sangle/FDS-or-DSA | heapSort.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
void buildMaxHeap(int a[], int n);
void heapify(int a[], int n, int i);
void heapSort(int a[], int n);
int main() {
int a[5]={5,4,3,2,1};
int n = sizeof(a)/sizeof(a[0]); //n=size
cout<<"Unsorted array is\n";
for(int i=0; i<n; i++... | ALGO | 0.99992 | 4.784775 |
c98efc93-8ff8-4422-b515-39c64ad0db80 | gustavkeller-23/UENP-Programacao | EstruturaDeDados/Hash/Listas/HashPerfeito.cpp | #include<iostream>
#include<list>
#include<string>
#include<cmath>
using namespace std;
class PerfectHash {
private:
int *table;
int m;
public:
PerfectHash(int m): m{m} {
table = new int[m];
fill(table, table + m, -1);
}
~PerfectHash() {
... | ALGO | 0.995218 | 4.448864 |
6cded803-3f8e-4ad2-a37f-1ba1870b5852 | ishandutta2007/codeforces | zeliboba/normal/163/C.cpp | #include <cstdio>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef... | ALGO | 0.999195 | 3.36259 |
d76df3f6-d9fd-4049-a7b1-eaad29c3ea69 | vilmahelander/ChatGPT_Combined_Experiements | C++/GPT-4/Math/Hard/Runtime and Memory/224. Basic Calculator/3.cpp | #include <string>
#include <stack>
using namespace std;
class Solution {
public:
int calculate(string s) {
stack<int> nums;
int num = 0;
int result = 0;
int sign = 1;
for (int i = 0; i < s.size(); ++i) {
char c = s[i];
if (isdigit(c)) {
... | ALGO | 0.99997 | 5.433326 |
05ecc7fd-31b3-473e-b6c1-8c3feb8f19f5 | noelmathen/LeetCode-Journey-CPP | LeetCode Problems/125_Valid_Palindrome.cpp | //Optimal Solution
class Solution {
public:
bool isPalindrome(string s) {
int i=0, j=s.size()-1;
while(i<j){
while(i<j && !isalnum(s[i])) i++;
while(i<j && !isalnum(s[j])) j--;
if(tolower(s[i++]) != tolower(s[j--]))
return false;
}
... | ALGO | 0.999579 | 6.102464 |
4e98ca08-f8d5-47c4-9225-af33de6f4773 | adarshsingh1706/Cpp-files | LC Contestez/ez.cpp | // class Solution {
// public:
// int numberOfAlternatingGroups(vector<int>& colors) {
// int cnt = 0;
// int n = colors.size();
// for (int i = 0; i < n; i++) {
// if (colors[i] != colors[(i + 1) % n] &&
// colors[(i + 1) % n] != colors[(i + 2) % n]) {
// ... | ALGO | 0.999704 | 5.869049 |
72522c3f-e31c-48c7-8cc1-55982238c638 | m1ke1994/djangoApp | venv/lib/python3.12/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.998223 | 7.198757 |
7f1aaff1-57ea-41db-8015-7f92e479a34d | keshav25201/data-structure-and-algo | BST/Remove-Node-From-Bst.cpp | #include <iostream>
#include <stack>
#include<limits.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int val)
{
data = val;
left = right = NULL;
}
};
struct Pair
{
Node *node;
int state;
Pair(Node *node, int state)
{
this->nod... | ALGO | 0.999954 | 4.538847 |
e0f831ca-2732-4bc7-b412-7670c0b22fc4 | gerzees/algorithm-drill | beforeBHub/prob_10093/10093_1.cpp | //10093:숫자
#include <iostream>
using namespace std;
int main(void)
{
unsigned long long int A, B, countBitween;
cin >> A >> B;
countBitween = A > B ? A - B : B - A;
if (countBitween > 0)
countBitween -= 1;
cout << countBitween << '\n';
for (size_t i = 1, num = A > B ? B : A; i <= count... | ALGO | 0.999931 | 3.631961 |
ecbe8c72-f89f-4e6a-a274-7258a1fcd300 | g-magdy/Problem-Solving | Codeforces/Div-2A/games.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int num_matches = n * (n - 1);
int **teams = new int *[n];
int req_num = 0;
for (int i = 0; i < n; i++)
{
teams[i] = new int[2];
cin >> teams[i][0] >> teams[i][1];
}
for (int i = 0; i < n; i++)
... | ALGO | 0.998953 | 4.106205 |
44b04ed0-3d6e-4f07-a986-76965e959279 | hikalium/code | codefes2017cc/a.cpp | #include <stdint.h>
#include <algorithm>
#include <bitset>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
int main(int argc, char *argv[]) {
std::string s;
std::cin >> s;
int p = 0, q = s.length() - 1;
int lastp = p, lastq = q;
while (p <= q) {
while (s[p] == 'x') p++;
... | ALGO | 0.999515 | 3.920221 |
e98c71a1-2fb8-44c6-9de5-a3aec420c209 | devgoel186/Leetcode-Solutions | first-missing-positive/Accepted/7-30-2021, 3_31_57 PM/Solution.cpp | // https://leetcode.com/problems/first-missing-positive
class Solution {
public:
int segregate(vector<int> &nums)
{
int index = 0;
for(int i = 0; i < nums.size(); i++)
{
if(nums[i] <= 0)
{
swap(nums[i], nums[index]);
index++;
... | ALGO | 0.99999 | 5.412597 |
d405e7b1-3f5d-46c6-9fd3-9f6329377aa5 | rhaps0dy/UPF-SWERC | UVa/12962_average_reuse_distance.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;
#define SIZE ((int)'z'-'a'+1)
int main() {
string s;
while(cin >> s && s != "0") {
int last_seen[SIZE];
bool seen[SIZE];
fill(seen, seen+SIZE, false);
fill(last_seen, last_seen+SIZE, 0);
int divide = 0;
in... | ALGO | 0.996415 | 3.748969 |
e686d8ae-610e-4089-959b-75e9ea13e94d | saiema/GTIITIntSystemsProgrammingWinter23 | cpp/genericity_templates/genericity_examples.cpp | #include <iostream>
#include <cassert>
template <typename T>
T max(const int size, T values[]) {
assert (size > 0);
assert (values != NULL);
T current_max = values[0];
for (int i = 1; i < size; i++) {
if (current_max < values[i]) {
current_max = values[i];
}
}
return... | ALGO | 0.997104 | 4.824257 |
6f32479a-c05a-4671-8c85-3cbd130f0e29 | amir-hosen7/Dynamic-Programming | Coin Change/UVA/Dividing coins.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define Mid(b,e) b+(e-b)/2
#define inf 1e18;
double PI=2*acos(0.0);
//---------------------------------------------------------------... | ALGO | 0.999789 | 3.833529 |
41a42888-b1b9-4373-a6b2-f304ad8c92af | aditya-agr/GeeksForGeeks-POTD | Make Binary Tree From Linked List.cpp | /*
The structure of Link list Node is as follows
struct Node
{
int data;
struct node* next;
Node(int x){
data = x;
next = NULL;
}
};
The structure of TreeNode is as follows
struct TreeNode
{
int data;
TreeNode *left;
TreeNode *right;
};
*/
// Function to make binary tree fr... | ALGO | 0.999996 | 5.736227 |
ac2a7230-739a-408f-8eac-cfa135c24007 | vishantrathi/C-plus-plus.cpp | DSA/Basics of DS/reverse_an_array.cpp | #include<bits/stdc++.h>
using namespace std;
void reverse (int arr[],int n){
int start=0;
int end=n-1;
while (start<=end)
{
swap(arr[start],arr[end]); // swap is already defined in utility
start++;
end--;
}
}
void printA... | ALGO | 0.999519 | 4.938982 |
73d21c09-bd38-4aa7-9633-58e1d7f85336 | scummvm/scummvm | engines/glk/agt/object.cpp | #include "glk/agt/agility.h"
#include "glk/agt/interp.h"
#include "glk/agt/exec.h"
namespace Glk {
namespace AGT {
/* */
/* This module contains most of the routines that implement the */
/* "physics" of the AGT world, including the scope routines... | TOOL | 0.908468 | 5.302708 |
7cffadb2-5a8c-4de0-9f7c-e21c721e4b8c | khushi-411/algorithms | sorting/cpp/insertion-sort-recursion.cpp | #include <bits/stdc++.h>
using namespace std;
int recursiveInsertion(int arr[], int n)
{
if(n <= 1)
return arr[0];
recursiveInsertion(arr, n-1);
int last = arr[n-1];
int j = n-2;
while(j >= 0 && arr[j] > last)
{
arr[j+1] = arr[j];
j--;
}
arr[j+1] = last;
}
int ... | ALGO | 0.99999 | 5.000993 |
c7bb5810-e607-4561-9a5e-46133a293f41 | ddupg/ACM_Code | kuangbin/最短路/Layout.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;
const int maxn=1100;
const int oo=0x3f3f3f3f;
struct Edge
{
int u, v, d;
Edge(int u, int v, int d):u(u), v(v), d(d){};
};
int n, ml, md, d[maxn];
vector<int> G[maxn];
vector<Edge> edge;
bool vis[maxn];
void init()
... | ALGO | 0.999871 | 4.360856 |
5619b068-3539-46d1-8b52-83d4c8b0f37c | kalyanvissamsetty/my-dsa | 1299-replace-elements-with-greatest-element-on-right-side/1299-replace-elements-with-greatest-element-on-right-side.cpp | class Solution {
public:
vector<int> replaceElements(vector<int>& arr) {
int n = arr.size()-1;
int maxi = -1;
while(n>=0){
int g = arr[n];
arr[n] = maxi;
maxi = max(g,maxi);
n--;
}
return arr;
}
}; | ALGO | 0.999975 | 5.50411 |
1e2b5d4c-43f8-4230-aae3-14dcf7794d14 | KimNamWook316/CodingTestSolved | CodingTest/Programmers/Level2/BraceConvert.cpp | #include <iostream>
#include <string>
#include <vector>
#include <stack>
using namespace std;
void reverse(string& str)
{
for (int i = 0; i < str.length(); ++i)
{
if ('(' == str[i])
{
str[i] = ')';
}
else if (')' == str[i])
{
str[i] = '(';
... | ALGO | 0.999784 | 5.557575 |
6ce46a9d-243a-4406-a885-ecc8c61950bf | apache/stdcxx | tests/algorithms/25.merge.cpp | #include <algorithm> // for merge,
#include <cstring> // for strlen, size_t
#include <rw_alg_test.h>
#include <rw_value.h> // for UserClass
#include <rw_driver.h> // for rw_test()
/**************************************************************************/
_RWSTD_NAMESPACE (std) {
#ifndef _RWSTD_NO_EXP... | ALGO | 0.999691 | 6.752526 |
de61d118-102f-439f-8fdc-95a0e76d8598 | raincross7/code-similarity | codes/train_code/problem275/problem275_327.cpp | #include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define ull unsigned long long
#... | ALGO | 0.999859 | 4.087795 |
baa30263-83a7-4f3b-92b9-4c333d1cdc93 | ishandutta2007/codeforces | magicspark/normal/217/A.cpp | /*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#i... | ALGO | 0.99957 | 3.913743 |
acb4df43-c456-48eb-94c7-807edfd0ed1b | ksanu1998/static_analysis_codegen_llms | results/feedback_pipeline/cpp_results/cpp_files_before_feedback/question-264-pass-1.cpp | #include <bits/stdc++.h>
using namespace std ;
int addNDigits(int a, int b, int n) {
int result = 0;
for (int i = 0; i < n; i++) {
result = (result + a) % b;
}
return result;
} | ALGO | 0.999877 | 4.186726 |
a98152c9-4d9d-4ff9-a72d-95796d19f11f | leoxP/leetcode | arrays/minimumcostofbuyingcandleswithdiscount.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int minimumCost(vector<int>& cost) {
sort(cost.begin(),cost.end(),greater<int>());
int sum=0;
for(int i=0;i<cost.size();i++){
if((i+1)%3==0) continue;
sum+=cost[i];
}
... | ALGO | 0.999742 | 4.913742 |
7ba3d7ea-5df1-4f49-a2e9-3bb88757cc1a | Star-Cheng/MyCppProject | slam/useEigen/eigenMatrix.cpp | #include <iostream>
using namespace std;
#include <ctime>
// Eigen 核心部分
#include <Eigen/Core>
// 稠密矩阵的代数运算(逆,特征值等)
#include <Eigen/Dense>
using namespace Eigen;
#define MATRIX_SIZE 50
/****************************
* 本程序演示了 Eigen 基本类型的使用
****************************/
int main(int argc, char **argv)
{
// Eig... | ALGO | 0.996395 | 3.358485 |
0d32a70c-157a-4490-bb7c-1729e6a08c86 | DongJunK/Algorithm | programmers/budget.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
long long dp[100001];
void insert_dp(vector<int> budgets)
{
int result = 0;
dp[0] = 0;
for(int i=0;i<budgets.size();++i)
{
result += budgets[i];
dp[i+1] = result;
}
}
int find_optimal... | ALGO | 0.999852 | 5.019336 |
14b2a279-2ac6-4b50-abe1-2687c9df4876 | sangyobe/dtCore | src/core/thread/threadImp.cpp | //* Related Headers ----------------------------------------------------------*/
#include "dtCore/src/dtThread/threadImp.h"
//* C/C++ System Headers -----------------------------------------------------*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(_WIN32) || defined(__CYG... | TOOL | 0.967435 | 4.573332 |
c187d6eb-b1ab-47e7-897f-7b685a1f5f0f | ip99202/Algorithm | 탐색/이분탐색/15810_풍선 공장.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<long long>v;
int main() {
int n, m;
long long left = 1, mid, sum = 0;
long long right = 500000000001;
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++) {
long long x;
scanf("%lld", &x);
v.push_back(x);
}
while (left <= right) {
sum = 0;
... | ALGO | 0.999996 | 4.324423 |
e708a03d-b9b2-4223-abe4-6abffb01e166 | n1khilmane/Leetcode | 0994-rotting-oranges/0994-rotting-oranges.cpp | class Solution {
public:
int orangesRotting(vector<vector<int>>& grid) {
queue<pair<pair<int,int>,int>> q;
int m = grid.size();
int n = grid[0].size();
int vis[m][n];
for(int i=0;i<m;i++){
for(int j =0; j<n;j++){
if(grid[i][j]==2){
... | ALGO | 0.999972 | 6.034503 |
393e7354-5619-47f7-bd8f-67c5766c6f6d | leslieyip02/leetcode | completed/1615.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int maximalNetworkRank(int n, vector<vector<int>>& roads) {
vector<int> r(n);
vector<vector<int>> m(n, vector<int>(n));
for (auto road : roads) {
r[road.front()]++;
r[road.back()]++;
... | ALGO | 0.999894 | 5.836398 |
a6bb158f-892a-4e43-8fd9-941ce51aef91 | GuiRossoni/PROG1 | Aula 21-5/Exercicio-2.cpp | #include <iostream>
#include <vector>
#include <limits> //Usado para gerar um ponto de referencia de maior e menor para a comparacao dos valores
using namespace std;
int main(void)
{
vector <int> Vetor(20);
cout << "\nDigite abaixo os " << 20 << " valores inteiros: " << "\n";
//camtura dos valores
... | ALGO | 0.997045 | 3.710275 |
dffc3603-8ad1-4e50-8b62-8425d00bb527 | cmangos/mangos-tbc | src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/boss_archimonde.cpp | /* ScriptData
SDName: Boss_Archimonde
SD%Complete: 100
SDComment: TODO: 2.2 patch - grip of the legion cant hit someone with air burst
SDCategory: Caverns of Time, Mount Hyjal
EndScriptData */
#include "AI/ScriptDevAI/include/sc_common.h"
#include "hyjal.h"
#include "Maps/MapManager.h"
#include "AI/ScriptDevAI/base/Co... | TOOL | 0.958648 | 5.070535 |
36fa4c32-0432-4f6e-bb32-b938b3f8b3fa | Ri-Nai-BIT-SE/Lexue-Code | Data-Structure/464654.cpp | #include <bits/stdc++.h>
int main()
{
std::cin.tie(nullptr)->sync_with_stdio(false);
auto inputArray = []()
{
std::vector<int> result;
char dot;
for (int x, y; std::cin >> x >> dot >> y;)
result.push_back(y);
return result;
};
auto Y = inputArray();
s... | ALGO | 0.99988 | 4.265401 |
5809766a-08c4-4834-b0d7-0d20641244f7 | dubey22rohit/CPP-DSA | Practice/Problems/MergeLL.cpp | #include <iostream>
#include "ListNode.cpp"
using namespace std;
ListNode<int>* mergeLL(ListNode<int>* l1, ListNode<int>* l2) {
ListNode<int>*nh, *cn, *nn;
if (l1->data < l2->data) {
nh = new ListNode<int>(l1->data);
cn = nh;
l1 = l1->next;
} else {
nh = new ListNode<int>(l... | ALGO | 0.999694 | 5.642996 |
7794baf9-f1ed-409d-be33-e16628bd3f5e | strokovok/CVRP-annealing | classes/AnnealingSolver.cpp | #pragma once
#include <iostream>
#include <vector>
#include <Python.h>
#include <cmath>
#include <cstdlib>
#include "GraphData.cpp"
#include "RouteSolution.cpp"
#include "ChartData.cpp"
#include "AdvancedTimer.cpp"
using namespace std;
typedef long double ld;
typedef long long ll;
class AnnealingSolver {
private:
R... | ALGO | 0.99408 | 5.387424 |
c58d2b6b-b9d3-4160-869c-32c02f2fab55 | Uttkarsh09/Concurrent-Huffman | src/cpu/cpuKernels.cpp | #include <iostream>
#include "configuration.hpp"
#include "cpuKernels.hpp"
#include "utils.hpp"
using namespace std;
void __calculateFrequency__(
string file_name,
u_int32_t read_offset,
u_int32_t length_to_read,
u_int32_t *char_freq
){
FILE *fptr;
openFile(&fptr, file_name, "rb");
fseek(fptr, read_offset, SE... | ALGO | 0.97754 | 4.339528 |
c2dd8bae-b2e4-4074-b8b7-f0260f5a7436 | averybiskup/CS-CPP | tests/reverse_string.cpp | #include <iostream>
#include <string>
using namespace std;
void reverse(string s) {
int length = s.size();
if (length == 0) {
;
} else {
reverse(s.substr(1, length - 1));
cout << s.substr(0, 1);
}
}
int main() {
reverse("cat");
}
| ALGO | 0.998469 | 4.824603 |
09ac1918-ae87-45c8-8203-0f6509c10eb3 | dimonrum003/SquareEquationVeryFinal | SolveEquation.cpp | #include <TXLib.h>
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include "Functions.h"
#include "Constants.h"
int SolveSquareEquation (double a, double b, double c, double* root1, double* root2)
{
if (!isfinite (a) || !isfinite (b) || !isfinite (c))
{
return BAD_ENTERED_DATA;
}
if... | ALGO | 0.999456 | 4.662507 |
c47e6c29-5bcf-4c2f-9bfa-c5321a7c8375 | nono19972020/atcoder | ABC/ABC187/d.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
bool compair(pair<long long, long long> a, pair<long long, long long> b){
if(a.first + a.second != b.first + b.second){
return a.first + a.second > b.first + b.second;
}
else{
return a.first > ... | ALGO | 0.999927 | 3.540756 |
b0a66b4b-e6db-4736-92e3-353f571dff00 | Himanshu4776/code-send | DSA/binary search/3.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
void print(string s, int l, int r, int set, int unset) {
cout<<
}
void solve()
{
int n;
cin>>n;
string s;
cin>>s;
int set = 0,unset = 0;
for (int i = 0; i < s.size(); ++i)
{
if(s[i] == '0') unset++;
else set++;
}
if(unset == 0) {
cout... | ALGO | 0.999677 | 3.369239 |
f07af07f-5a5b-43a9-8219-e51878876c5b | zhangxiaohu057/SensorsCalibration | SensorX2car/radar2car/eigen3/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the vector b:\n" << b << endl;
Vector3f x = A.colPivHouseholderQr... | ALGO | 0.999952 | 3.356631 |
df0e891d-2353-4988-b595-96e06279cf42 | sharonmei1219/LeetCodeCPP | Problem_1_to_100/10 Regular Expression Matching.cpp |
#include <string>
#include <vector>
using std::string;
using std::vector;
class Solution {
public:
bool isMatch(string s, string p) {
vector<string> patterns = partitionPattern(p);
return match(s, patterns, 0);
}
vector<string> partitionPattern(string p){
vector<string> result = {};
int pos... | ALGO | 0.999887 | 5.164428 |
9dfa07c4-af69-4881-b6bb-17382c8b8995 | learning-process/ppc-2025-threads | tasks/seq/mezhuev_m_bitwise_integer_sort_with_simple_merge/src/ops_seq.cpp | #include "seq/mezhuev_m_bitwise_integer_sort_with_simple_merge/include/ops_seq.hpp"
#include <algorithm>
#include <cstddef>
#include <vector>
namespace mezhuev_m_bitwise_integer_sort_seq {
bool TestTaskSequential::PreProcessingImpl() {
unsigned int input_size = task_data->inputs_count[0];
unsigned int output_siz... | ALGO | 0.998736 | 6.570989 |
cd8dd921-902d-42b3-b639-f48a61417ae8 | coldEr66/online-judge | CF/915D.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n... | ALGO | 0.999995 | 4.175739 |
d771e336-24f1-4baa-b1ad-8a4df98d1194 | ishandutta2007/codeforces | jjang36524/normal/1148/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
vector<pair<pair<int,int>, int>>x;
vector<pair<pair<int,int>, int>>y;
signed main()
{
int N;
cin >> N;
int i;
for (i = 0; i < N; i++)
{
int a, b;
cin >> a >> b;
if (a == b)
continue;
if (a > b)
x.push_back({ { b,a },i + 1 });
else
... | ALGO | 0.999944 | 3.684346 |
6c36fbb9-4a23-4b79-9de9-873aac6d158e | aj-abhay25/CodingSprint | Largest_Multiple_of_Three.cpp | class Solution {
public:
string largestMultipleOfThree(vector<int>& digits) {
vector<int> count(10);
vector<int> mods1 = {1, 4, 7, 2, 5, 8};
vector<int> mods2 = {2, 5, 8, 1, 4, 7};
int sum = accumulate(begin(digits), end(digits), 0);
for (const int digit : digits)
... | ALGO | 0.999961 | 6.643455 |
fffbb0a7-ad55-4ec5-be5e-65d1d4ad773b | Rajeev0651/Codeforces | Set_1/A. Minutes Before the New Yea_.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--)
{
int h,m,ans;
cin>>h>>m;
ans = (23-h)*60 + (60-m);
cout<<ans<<"\n";
}
return 0;
}
| ALGO | 0.994447 | 3.978287 |
1949d041-b353-47e8-ace0-c6d263924433 | DevashishPathrabe/LeetCode | LeetCode Solutions/Learn/Linked List/Intersection of Two Linked Lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
ListNode *head1 = headA;
ListNode *head2 = headB;
... | ALGO | 0.999014 | 5.257713 |
b5bcd2aa-28a1-4f69-a16d-29ee4e3ac769 | tridhapuku/DSP_MLIR | libc/src/math/amdgpu/remquo.cpp | #include "src/math/remquo.h"
#include "src/__support/common.h"
#include "declarations.h"
namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(double, remquo, (double x, double y, int *quo)) {
int tmp;
double r = __ocml_remquo_f64(x, y, (gpu::Private<int> *)&tmp);
*quo = tmp;
return r;
}
} // namespace LIBC_NAMESPA... | ALGO | 0.987027 | 6.025464 |
300d6afe-5975-4167-b8d3-f5bcd8f6696b | descatal/ModdedBoostSPRX | FBmod/hook_functions/burst_system/general_Burst_Damage_Check_hook.cpp | #include "general_Burst_Damage_Check_hook.h"
#include "../registers.h"
void general_Burst_Check_hook()
{
unsigned int main_unit_memory_region_pointer = temp_registers[20]; // is always stored in r20.
// Put the percentage of EX Burst gauge into the reserved mem so that it can be retrieved by unit script to calculat... | TOOL | 0.858094 | 4.553796 |
0938de12-a04f-45ea-a008-3455560a1dd8 | moondemon68/cp | ITEBE/0DIv3/C.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
int n;
cin >> n;
for (int i=n+1;i<=9999;i++) {
int x=i;
set<int> p;
while (x>0) {
p.insert(x%10);
x/=10;
}
if (p.size()==4) {
cout << i << endl;
return 0;
}
}
}
| ALGO | 0.999843 | 4.988477 |
8a2019e3-dc9c-4812-89e8-a3cf46c813df | iilloo/leetcode | 111.二叉树的最小深度.cpp | #include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <string>
using namespace std;
/*
* @lc app=leetcode.cn id=111 lang=cpp
*
* [111] 二叉树的最小深度
*/
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode... | ALGO | 0.999943 | 6.755993 |
6ef7dd1e-cb2d-4c4b-91ae-fa047ef2127e | Shauryy03/DSA-Course | p32.cpp | // C++ STL
// vector
#include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> vec;
vec.push_back(1);
vec.push_back(2);
vec.push_back(3);
vec.push_back(4);
vec.push_back(5);
vec.push_back(6);
vec.push_back(7);
vec.push_back(8);
vec.push_back(9);
vec.ins... | TOOL | 0.870707 | 3.119803 |
53f03e86-60eb-43b9-b085-847390961553 | Junaid7200/University-Labs | Data Structures/Recursion/.history/Q6_20240426125900.cpp | #include <iostream>
using namespace std;
long long FibonacciUsingRecursion(int n) {
if (n <= 1) return n;
else {
return FibonacciUsingRecursion(n-1) + FibonacciUsingRecursion(n-2);
}
}
int main () {
int n;
cout << "upto how many digits till you want the fib printed" << endl;
cin >> n;
fo... | ALGO | 0.999812 | 4.356074 |
803364d8-576d-4446-b1b9-c30ba147f87f | Bungmint/competitiveprogramming | contest/boj/1043.cpp | using namespace std;
#pragma region TEMPLATE
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpi = vector<pii>;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pll>;
using ld = long double;
template <typename T, size_t SZ>
using ar = array<T, SZ>;
template <typename... | ALGO | 0.99985 | 4.860056 |
e84ca406-137a-4c32-9094-f61057af414d | nehay2904/Data_structure_and_algorithms | Array/operations/InsertEle.cpp | #include <iostream>
#include <vector>
using namespace std;
class Arraymanager{
public:
vector<int> nums;
Arraymanager(const vector<int> &initialArr) : nums(initialArr) {}
void displayArr(){
for (int num : nums)
cout<<num <<" ";
}
void insertEle(int key){
nums.pu... | ALGO | 0.999515 | 4.339867 |
68a6c82b-ade0-4150-9395-0ef5d460732a | vidit-gaur/Data-Structures-and-Algorithms | Queue/reverseRecursive.cpp | #include<bits/stdc++.h>
#include<queue>
using namespace std;
void reverse(queue <int> &q){
if(q.empty()) return;
int x=q.front();
q.pop();
reverse(q);
q.push(x);
while(q.empty()==false){
cout<<q.front()<<" ";
q.pop();
}
}
int main(){
queue<int> q;
q.push(10);
q.... | ALGO | 0.999846 | 4.264853 |
50997035-6378-4156-8f5e-a890f48d264a | 7Dsilva/Practice | EncodeDecodeString.cpp | #include<bits/stdc++.h>
using namespace std;
// g++ -o EncodeDecodeString.exe EncodeDecodeString.cpp && ./EncodeDecodeString.exe
// 4#neet4#code4#love3#you
string encode(vector<string>& strs) {
string enc;
for(const string& s : strs){
enc += to_string(s.size()) + "#" + s;
}
return ... | ALGO | 0.999333 | 4.659332 |
6fa73ce6-958a-499a-8aee-80513df2861c | hvdieu/mycode | Cpp/ranking.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <locale>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <bitset>
using namespace std;
struct fraction
{
long long ts, ms;
fraction(long long ... | ALGO | 0.999541 | 3.012136 |
598dff8c-9bff-4044-84a8-394747b49dd4 | kimsternator/LeetCodeProblems | LeetCodeArray.cpp | #include "LeetCodeProblems.h"
using namespace std;
//Easy
//Remove Duplicates from sorted array
int removeDuplicates(vector<int>& nums) {
nums.erase(unique(nums.begin(), nums.end()), nums.end());
return nums.size();
}
//Best Time to buy and sell stock II
int maxProfit(vector<int>& prices) {
int minVal =... | ALGO | 0.954268 | 4.740582 |
4d0c6da9-4bf9-4784-995f-963a3e95138d | LarraTrinidad/LarraT | src/FtDsEdgeSrnModel.cpp | #include "FtDsEdgeSrnModel.hpp"
FtDsEdgeSrnModel::FtDsEdgeSrnModel(
boost::shared_ptr<AbstractCellCycleModelOdeSolver> pOdeSolver)
: AbstractOdeSrnModel(12, pOdeSolver)
{
if (mpOdeSolver == boost::shared_ptr<AbstractCellCycleModelOdeSolver>())
{
#ifdef CHASTE_CVODE
mpOdeSolver = CellCycleModelO... | ALGO | 0.985321 | 6.126013 |
a67d61ce-e4d6-4e62-ab06-f74176a9956b | enogrob/hackerrank-algorithms | challenges/solve-me-first.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int solveMeFirst(int a, int b) {
// Hint: Type return a+b; below
return a + b;
}
int main() {
int num1, num2;
int sum;
cin>>num1>>num2;
sum = solveMeFirst(num1,num2);
cout<<sum;
return 0... | ALGO | 0.999653 | 3.764732 |
c9628c0f-5b25-4909-84b4-169f2ea70246 | yp155136/ioicamp2022-basic-dp | code/cses2085_method2_max.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Line {
mutable ll a, b, l; // 直線為 ax + b ,有效區間的左界為 l
Line(ll _a, ll _b, ll _l): a(_a), b(_b), l(_l){}
bool operator<(const Line &rhs) const {
return a < rhs.a;
}
bool operator<(ll rhs_l) const {
return l < rhs_l;
}
};
stru... | ALGO | 0.999978 | 3.636538 |
2acf96f8-9040-46ba-9572-9076efb0ef38 | 00madwolf00/DS-TEAM-PROJECT | Graph.cpp | /*
* Graph.cpp
* Names: Allicyan Chin, Jaheem Clayton, Jasmine Heymann
* Course: COP-3415
* Last Modified: 04/20/2025
*/
#include "Graph.h"
#include <iostream>
#include <limits>
#include <stack>
#include <queue>
#include <unordered_map>
#include <functional>
#include <algorithm>
#include <unordered_set>
Graph::Graph(... | ALGO | 0.972023 | 5.191556 |
0ee8bc1f-18ae-40c5-b830-6163cca6c1e4 | Terpodia/Competitive-Programming | Problems Solved/CSES/Dynamic Programming/Removal Game.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a[5010], dp[5010][5010][2];
ll solve(int l, int r, int turn) {
if (l > r) return 0;
ll& ret = dp[l][r][turn];
if (ret != -1) return ret;
if (turn == 0) {
ret = a[l] + solve(l + 1, r, 1);
ret = max(ret, a[r] + solve(l, r - 1... | ALGO | 0.999954 | 4.137122 |
8386e2b3-cc6f-4211-ac5e-c74a0eb55ca7 | sarvex/leetcode-idris | solution/2400-2499/2415.Reverse Odd Levels of Binary Tree/Solution.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.999997 | 6.097686 |
1fbd8af9-062f-45f4-b926-c641c5fa4cf8 | bitblaster/lab-prog-assigment2 | parsers/OrderParser.cpp | /**
* Implementazione di OrderParser.h
*
* @author Roberto Mozzicato, 1236209
* @version 1.0 29/01/20
*/
#include <iomanip>
#include <chrono>
#include <iostream>
#include <algorithm>
#include "FileParser.h"
#include "OrderParser.h"
#include "../Order.h"
using namespace std;
namespace parsers {
OrderParser::... | TOOL | 0.860111 | 5.476789 |
13088967-cfbc-4975-a093-cf6320bdcae6 | bbppooii/Data-structure | 快速排序非递归实现/test.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include "t.h"
int main() {
int a[] = { 7,5,6,4,8,9,2,1,3,0 };
_printf(a, sizeof(a) / sizeof(a[0]));
printf("\n");
QuickSortNonR(a, 0, sizeof(a) / sizeof(a[0]) - 1);
_printf(a, sizeof(a) / sizeof(a[0]));
}
| ALGO | 0.999808 | 4.119491 |
9384897a-0ba6-465b-b494-ffc79abb58b0 | Meam1c/StudentCppRevisionTask02Project | StudentCppRevisionTask02Project/task03.cpp | #include "tasks.h"
/* Task 03. The Number of tens [число десятков]
*
* Дано целое число N, определите число десятков в нем (предпоследнюю цифру числа).
* Если предпоследней цифры нет, то можно считать, что число десятков равно нулю.
*
* Формат входных данных [input]
* На вход дается любое целое число N в диапазоне С++... | ALGO | 0.999714 | 4.375601 |
8459633d-1987-467c-a2d5-14b927bfad4b | xyliuke/boost_ios_mac | boost-ios/src/boost_1_55_0/libs/numeric/odeint/examples/mtl/gauss_packet.cpp | #include <iostream>
#include <complex>
#include <boost/numeric/odeint.hpp>
#include <boost/numeric/odeint/external/mtl4/mtl4_resize.hpp>
#include <boost/numeric/mtl/mtl.hpp>
using namespace std;
using namespace boost::numeric::odeint;
typedef mtl::dense_vector< complex< double > > state_type;
struct hamiltonian {
... | ALGO | 0.99977 | 4.886508 |
a9705daa-e84f-45d5-89be-c8080c518a89 | olegsmvl/Sandbox.Cpp | Alghorithm/LeetCode/323_Number of Connected Components in an Undirected Graph/app.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
class Solution {
public:
int countComponents(int n, vector<vector<int>> &edges) {
seen = vector<bool>(n, false);
for (auto &pair : edges) {
int a = pair[0];
int b = pair[1];
graph[a].push_back(b);
gr... | ALGO | 0.999942 | 6.265804 |
6d773d0a-a758-4bf4-8bee-74f6cbf19ce1 | ChuanqiXu9/clangd-for-modules | flang/lib/Evaluate/fold-integer.cpp | #include "fold-implementation.h"
#include "fold-matmul.h"
#include "fold-reduction.h"
#include "flang/Evaluate/check-expression.h"
namespace Fortran::evaluate {
// Given a collection of ConstantSubscripts values, package them as a Constant.
// Return scalar value if asScalar == true and shape-dim array otherwise.
tem... | TOOL | 0.989942 | 7.905231 |
a501f896-4a3c-47ac-9330-79aa6a934162 | geheb/cron_expression | day_of_month_field.cpp | #include <algorithm>
#include "day_of_month_field.h"
namespace geheb {
bool day_of_month_field::validate(const std::string &value) const {
if (value == "L" || value == "?") return true;
std::string weekday = parse_nearest_weekday(value);
// validate that a list don't have W, L or ?
if (has_list(value)... | TOOL | 0.901628 | 6.432638 |
f8b0c201-e57c-4898-b29b-445075c52294 | stden/lisiynos2 | 2010-nov/s3/problems/docs/docs_as.cpp | #define _CRT_SECURE_NO_DEPRECATE
#include <cstdio>
#include <cassert>
#include <algorithm>
using namespace std;
const int N = 131072 * 2;
const int INF = 2000000000;
int n, nn, m;
int inds[N], as[N], bs[N];
int ans[N];
int cmin[N];
int cpos[N];
int cmp(int a, int b){
return (as[a] < as[b]);
}
inline int min(int ... | ALGO | 0.999974 | 3.855514 |
440565b0-22bb-43c9-9185-91e952a99f13 | Shannju/njucser_helphelp | Algorithm算法/Code/7/.history/2.1_20220605204948.cpp | #include <iostream>
#include "stdio.h"
#include <vector>
using namespace std;
int nx, kx, ny, ky;
#define INT_MAX 2147483647
int dp(int k, int n)
{
vector<vector<int>> c(k, vector<int>(n + 1, INT_MAX)); // k egg n+1 floor
for (int i = 0; i < k; i++) // zero floor
c[i][0] = 0;
for (int j = 1; j <= n; j++) // ... | ALGO | 0.999589 | 3.408677 |
6216f286-feec-4517-8081-4f8e4c5d5879 | AbdoWael2003/Graduation-Project-QAgent2.0- | FlowChartGeneration/CPPSamples/Sample624/sample_code624.cpp | #include <vector>
std::pair<std::vector<int>, std::vector<int>> swap_List(std::vector<int> newList) {
int size = newList.size();
int temp = newList[0];
newList[0] = newList[size - 1];
newList[size - 1] = temp;
return {newList, newList};
}
| ALGO | 0.998147 | 5.201433 |
3eca645a-f477-4e15-9986-e80afb4b26c4 | hjiang13/LLMs-in-IR | POJ-104/60/546.cpp | #include <iostream>
using namespace std;
void print(int a)
{
cout << "%d %d\n",a,a+2);
}
int search(int b)
{
int i=2,j=1;
for(i=2; i<=sqrt(b); i++)
{
if(b%i==0)
{
j=0; break; }
}
return(j);
}
void main()
{
int n;
cin >> "%d",&n);
int i=2,sum=0;
for(i=2; i<=n-2; i++)
{
if(search(i)==1&&search(i+2)==1)
{
print(i); sum++;... | ALGO | 0.999344 | 3.049153 |
b9e69b49-8e88-4eba-a83b-ceae7ecc958f | JacqylFrost/RTCW-WSGF | src/splines/math_quaternion.cpp | #include "math_quaternion.h"
#include "math_matrix.h"
void toQuat( idVec3 &src, quat_t &dst ) {
dst.x = src.x;
dst.y = src.y;
dst.z = src.z;
dst.w = 0.0f;
}
void toQuat( angles_t &src, quat_t &dst ) {
mat3_t temp;
toMatrix( src, temp );
toQuat( temp, dst );
}
void toQuat( mat3_t &src, quat_t &dst ) {
float ... | ALGO | 0.891904 | 6.065207 |
50585aae-7338-45a3-81ec-18fb752c68d3 | sadatislam9696/CSES | 1660 - Subarray Sums I.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int n, x;
cin >> n >> x;
int a[n + 1];
for(int i = 1; i <= n; i++){
cin >> a[i];
}
int ans = 0;
ll sum = 0, l = 1;
for(int i = 1; i <= n; i++){
sum += a[i];
if(sum > x){
w... | ALGO | 0.999973 | 3.728147 |
72b6c9e7-f65b-490c-b609-f745b6edd091 | yang-xinquan-cc/C-language-programming | 第二章基础算法/基础算法/LCA-最近公共祖先LCA查询.cpp | //LCA
//LCAѯ
//https://www.lanqiao.cn/problems/4385/learning/?page=1&first_category_id=1&tag_relation=intersection&problem_id=4385
#include <bits/stdc++.h>
using namespace std;
int const N=1e5+5;
vector<int> mp[N];
int deep[N];
int dis[N][20];
void bfs(int x,int fa){
deep[x]=deep[fa]+1;
dis[x][0]=fa;
for(int i... | ALGO | 0.99987 | 4.720074 |
4680aa2f-ffba-4dd9-99bb-016d1205b9f9 | ishandutta2007/codeforces | erray/normal/126/B.cpp | // author: erray
#include<bits/stdc++.h>
using namespace std;
template<typename T, typename F> string to_string(pair<T, F> p);
string to_string(string s) {
return '"' + s + '"';
}
string to_string(char c) {
return (string) "'" + c + "'";
}
string to_string(const char* p) {
return to_string((string) p);
}
strin... | ALGO | 0.999995 | 3.399255 |
91732596-f7f3-49df-afc2-7fc1b241f478 | ishandutta2007/codeforces | sdya/normal/475/D.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <ctime>
#pragma comment (linker, "/STACK:256000000")
using namespace std;
const int maxN = 110000;
int n, m;
int ... | ALGO | 0.999835 | 3.324496 |
c4ddf989-09aa-45e7-b584-4da2860914f1 | Merisho/comprog | codeforces/round-773-div-2/c.cpp | #include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int T;
cin >> T;
for (int test_case = 0; test_case < T; ++test_case) {
int n, x;
cin >> n >> x;
map<int, int> cnt;
vector<int> unq;
for (int i = 0; i < n; ++... | ALGO | 0.999805 | 4.491704 |
15b3bcc7-36de-4f42-aab4-d759442e1ec6 | geodude1992/Leetcode | 621-task-scheduler/task-scheduler.cpp | class Solution {
/*
Greedy Solution but MATHY
maxm-1 == Number of cycles
n+1 == Number of slots per cycle
maxcount == Number of tasks having maximum frequency, fmax.
*/
public:
int leastInterval(vector<char>& tasks, int n) {
int freq[26] = {0}; // Constant amount of space regardless of the ... | ALGO | 0.999987 | 6.220283 |
4492a9bb-20af-4269-b99e-b70e982bd8c0 | Devexh/CodeHelp-Solutions | Week 11 - Stack/class_questions/custom_stack.cpp | #include <bits/stdc++.h>
using namespace std;
class Stack {
public:
int* arr;
int size;
int top;
Stack(int size) {
arr = new int[size];
this->size = size;
this->top = -1;
}
void push(int data) {
if (top == size-1) {
cout << "Stack overflow" << e... | ALGO | 0.9947 | 4.862168 |
af2c8645-8a37-4b5f-a671-76ec1dcdb26c | dilkhush05/DSA_100_Days | valid-palindrome.cpp | class Solution {
private:
bool valid(char ch) {
return isalnum(ch);
}
char lowercase(char ch) {
if (isupper(ch)) {
return tolower(ch);
} else {
return ch;
}
}
bool isPalindrom(string a) {
int s = 0;
int e = a.length() - 1;
... | ALGO | 0.999946 | 6.459587 |
14d5498e-7baf-4e73-b914-ea14ff744526 | xuunnis123/Leetcode | 973.k-closest-points-to-origin.cpp | class Solution {
public:
vector<vector<int>> kClosest(vector<vector<int>>& points, int K) {
vector<vector<int>> result;
vector<int> itemSet;
vector<int> itemKey;
multimap<int,int> calResult;
for(int i=0;i<points.size();i++){
typedef pair <int, int> Int_Pair;
... | ALGO | 0.999994 | 5.747941 |
f7b52522-212b-49d3-829f-7cf6ed0a93c6 | Stefanos-gif/Programming | Cpp_Keywords/pointers/array_of_pointers.cpp | #include <iostream>
using namespace std;
int main() {
int ar[5] ;
int* par[5];
int count = sizeof(ar)/sizeof(ar[1]);
cout << "Give me five numbers that will be put in an array:\t" ;
for (int i = 0; i < count; i++){
cin >> ar[i];
}
for (int i = 0; i < count; i++){
par[i]... | ALGO | 0.994357 | 3.294915 |
449d230c-62e1-4022-aa4d-0e167e5eb3dc | StolasIn/leetcode_Submissions | content/populating-next-right-pointers-in-each-node/Accepted/1-28-2021, 8_17_35 AM/Solution.cpp | // https://leetcode.com/problems/populating-next-right-pointers-in-each-node
/*
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) ... | ALGO | 0.999875 | 5.91485 |
cf8b44d5-a481-42ea-9b67-aaa868fd6e22 | MahinAshraful/CodeWatch_Data | sample-data/p00006/s324796910.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string A;
cin >> A;
reverse(A.begin(),A.end());
cout << A <<"\n";
return 0;
} | ALGO | 0.999872 | 4.246892 |
fea8b2d2-b11b-4a39-a86f-7ea395279f65 | liuhycn/leetcode_exercise | 字符串专题/LeetCode-38.cpp | class Solution {
public:
string numsBuf[31];
string countAndSay(int n) {
if (n < 1) return "1";
memset(numsBuf, 0, sizeof(numsBuf));
string last = "1";
numsBuf[1] = "1";
for (int i = 2; i <= 30; i++)
{
int len = last.size();
string tmp = ""... | ALGO | 0.999946 | 7.190721 |
75bd986a-fa14-42dc-93a5-0e86f4826543 | pranoyaditya/XPSC-Problem-Solve | Week 3/Day 3/A_Is_It_a_Cat.cpp | #include <bits/stdc++.h>
using namespace std;
string lower(string st, int n)
{
for(int i=0; i<n; i++)
{
if(st[i]>='A' && st[i]<='Z')
{
st[i] += ' ';
}
}
return st;
}
string solve(int n, string st)
{
if(n<4) return "NO";
st = lower(st,n);
auto new_... | ALGO | 0.999909 | 4.501452 |
b961342b-3002-471b-9f10-72bae20e163f | TravHaran/cpp_indepth_concepts | practice_problems/PracticeProblems2/problem2.cpp | /**
* Make a program that takes a word (string) from the
* user and prints that word in reverse.
*/
#include <iostream>
using namespace std;
int main() {
string word;
string result = "";
cout << "Enter a word: ";
cin >> word;
for(int i= word.length() - 1; i>=0; --i) {
result += word[i];... | TOOL | 0.93039 | 4.352837 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.