uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
1580c0a6-7070-47e7-beee-c5fa86b30372 | SairajRajput12/DSA | phase_3/Graph/FloydWarshallAlgorithm.cpp | #include<bits/stdc++.h>
using namespace std;
int floydWarshall(int n, int m, int src, int dest, vector<vector<int>> &edges) {
// Write your code here.
// approach 1: using floyd's warshall algorithm
int d[n+1][n+1];
for(int i = 1; i <= n; i ++){
for(int j = 1; j <= n; j ++){
if(... | ALGO | 0.999802 | 5.014986 |
127d2dac-4802-4c62-90d1-c229830fa512 | sbhat893/coding_questions | CPP/20_Longest_Common_Prefix.cpp | /*
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
*/
string longestCommonPrefix(vector<string>& strs) {
sort(strs.begin(), strs.end());
string common_prefix = "";
for(int i = 0; i < min(strs[0].size(), strs[st... | ALGO | 0.999855 | 6.252025 |
c430fb6f-7dc8-4e2e-a7db-eca7ba9ea301 | Elysium-Studios/godot-fork | godot/thirdparty/bullet/LinearMath/TaskScheduler/btTaskScheduler.cpp |
#include "LinearMath/btMinMax.h"
#include "LinearMath/btAlignedObjectArray.h"
#include "LinearMath/btThreads.h"
#include "LinearMath/btQuickprof.h"
#include <stdio.h>
#include <algorithm>
#if BT_THREADSAFE
#include "btThreadSupportInterface.h"
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
... | TOOL | 0.98953 | 6.206346 |
1cc5ea8c-bdad-4537-aa80-f8256eba3e4b | Inventor1937/citrus_external_skia | src/effects/SkEmbossMask.cpp | #include "SkEmbossMask.h"
#include "SkMath.h"
static inline int nonzero_to_one(int x) {
#if 0
return x != 0;
#else
return ((unsigned)(x | -x)) >> 31;
#endif
}
static inline int neq_to_one(int x, int max) {
#if 0
return x != max;
#else
SkASSERT(x >= 0 && x <= max);
return ((unsigned)(x - max)) >> 3... | ALGO | 0.864646 | 5.327305 |
6f786771-a79c-4ef1-8f6d-16fc39583608 | alexandraback/datacollection | solutions_5658282861527040_0/C++/Pranshul/1b_2.cpp | /*
Pranshul Agarwal
CSE B.tech 3rd year
MNNIT Allahabad
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <io... | ALGO | 0.995264 | 3.124358 |
8d71787f-3db9-420d-a5ee-31adbbce3128 | krotrn/CPP | Heaps/Problem/ImplementMaxHeap.cpp | #include<bits/stdc++.h>
using namespace std;
class MaxHeap{
int idx;
vector<int> heap;
int capacity;
public:
MaxHeap(int cap){
this->capacity = cap;
heap.resize(cap + 1);
this->idx = 1;
}
// MaxHeap functions
int size(){
return idx - 1;
}
int top(){
... | ALGO | 0.99964 | 4.251247 |
1a5c4e68-05c9-402e-8bf7-e2befe965225 | Keyur1284/GFG-Solutions | Rotate Bits - GFG/rotate-bits.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
vector <int> rotate (int n, int d)
{
d %= 16;
int left = (n << d | (n >> (16 - d))) & ((1 << 16) - 1);
int right = (n >> d | (n << (16 - ... | ALGO | 0.99973 | 5.942264 |
fbd6951b-df9e-4fad-a312-4db5034bb0f0 | JunBinLiang/IO-Workbook | CF/Round-926(div2)/F(combination+2300).cpp | #include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <unordered_set>
#include <string.h>
using namespace std;
using ll = long long;
const int MOD = 998244353;
const int N = 5e5 + 10;
int a[N];
ll f[N];
vector<pair<int, int>> g;
vector<int> rk;
void i... | ALGO | 0.999967 | 4.404448 |
386ba04e-7b60-4b9e-a69c-769d58bb6af4 | ohinhyuk/PS-2023 | c2_2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <queue>
using namespace std;
int answer = 999999;
int M,N , p ,q ,r;
vector<vector<int> > alpha;
vector<vector<int> > beta;
vector<int> connectingList;
map<int ,int > m_dist;
map<int,int> m;
map<int , i... | ALGO | 0.998875 | 3.878516 |
667928c7-5be5-467c-8e58-212b142c2923 | sony-string/beakjoon | Beakjoon/10538-bigPicture.cpp | #include <bits/stdc++.h>
using namespace std;
typedef struct TrieNode {
char ch;
int depth;
int output;
TrieNode* go[2];
TrieNode* fail;
TrieNode(char c, int d) : ch(c), depth(d), output(-1), fail(NULL) { go[0] = NULL; go[1] = NULL; }
} Node;
vector<int> unionFind;
int unioncnt = 0;
typedef struct Trie {
Node... | ALGO | 0.999465 | 3.875066 |
30288860-65a0-4990-a8e5-d1a13a12ca41 | SagenHansda19/Contest | LeetCode_Weekly_Contest_418/Q1_Maximum_Possible_Number_by_Binary_Concatenation.cpp | #include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
string givebinary(int num){
if(num == 0) return "0";
int n = (int)(log2(num));
return bitset<64>(num).to_string().substr(64 - n - 1);
... | ALGO | 0.999678 | 4.758365 |
ba70d683-e79e-4352-8c66-a4371c59f26e | ganeshalamuru/prg | codeforces/ed156/problems/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;typedef long double ld;typedef pair<int,int> pii;
#define F first
#define S second
#define PB push_back
#define MP make_pair
const ll mod = 1e9+7, N = 2e6+7, M = 2e6+7, INF = INT_MAX/10;
ll po... | ALGO | 0.99976 | 4.644208 |
dadffd2a-7e40-4cd3-8482-f9a465a98fd2 | GabrielCFormiga/URI-Beecrowd | Codigo/5 - Matemática/src/1240.cpp | #include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const int inf = 1e9 + 10;
int main(){ _
int tt;
c... | ALGO | 0.999828 | 5.639484 |
fd572e66-e45d-4357-bf9e-17b4702d36b4 | chandrakant100/DSA | BinaryTREE/diameterTree.cpp | #include <iostream>
#include <queue>
using namespace std;
template <typename T>
class BinaryTreeNode {
public:
T data;
BinaryTreeNode<T> *left;
BinaryTreeNode<T> *right;
BinaryTreeNode(T data) {
this->data = data;
left = NULL;
right = NULL;
}
};
BinaryTreeNode<int> *take... | ALGO | 0.999922 | 5.35482 |
7bef6efb-beaa-49d1-8f70-7a36e9bf5d95 | roniahamed/Phitron-School | First semester/Data Structure and c++/Week 3/Exam 2 lab Exam/Question no 3 C.cpp | #include<bits/stdc++.h>
using namespace std;
void Print_array(int size, int array[])
{
for(int i=0; i<size; i++)
{
cout<<array[i]<<" ";
}
cout<<endl;
}
int main()
{
int size;
cin>>size;
for(int i=0; i<size; i++)
{
int n;
cin>>n;
int array[n];
for(... | ALGO | 0.999761 | 3.271897 |
60bf7be3-6eae-4276-aa64-418f3f27f667 | NamNamju/Algorithm | DP/baekjoon_1463.cpp | #include <iostream>
#include <vector>
using namespace std;
// N ־ , ؼ 1 Ѵ. ϴ Ƚ ּڰ Ͻÿ.
int main() {
int num;
int count = 0;
int temp;
vector <int> vec; // vec -> Ƚ ּڰ
cin >> num;
// num = 1 3 Ƚ 1 ʱȭ ش.
vec.push_back(0); // num = 0
vec.push_back(0); // num = 1
vec.push_back(1); // num = 2
v... | ALGO | 0.999995 | 4.188891 |
c65c036b-0bc4-4268-ba73-2c1da168e8f8 | vidyasagar1793/Ltcde-solution | 2529-maximum-count-of-positive-integer-and-negative-integer/2529-maximum-count-of-positive-integer-and-negative-integer.cpp | class Solution {
public:
int maximumCount(vector<int>& nums) {
int a=0;
int b=0;
for (int i=0;i<nums.size();i++){
if (nums[i]>0){
a++;
}
else if (nums[i]<0){
b++;
}
}
if (a>b){
return ... | ALGO | 0.999947 | 5.420804 |
5221e0a9-2e0a-4d3a-9142-a1060311fb2a | LandAbel/Cpp | otodigyak2/otodigyak2/otodigyak2.cpp | #include <algorithm>
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
static bool AreYouValid(const char karakter)
{
//Original
//bool isUnderscore = (karakter == '_');
//bool isCapitalletter = (karakter >= 'A' && karakter <= 'Z');
//bool isLowerletter = (karakter >= 'a' && kara... | TOOL | 0.976837 | 5.075913 |
95098c23-3ffe-4267-a125-0a07f4b86145 | ashhadahmad/Competitive-Coding | CODEFORCES/1345/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
void lol(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int mxN = 25830;
ll* arr = new ll[mxN];
void fill(){
for... | ALGO | 0.999789 | 4.485688 |
78165038-0765-4f81-968c-1765cd542b3e | konnidb/bridgeDB | src/graph/structs/Vertex.cpp | #include<iostream>
#include<fstream>
#include"Vertex.h"
using namespace std;
long char_ptr_to_int(char* c);
SerializableVertex::SerializableVertex() {
this->objType = VERTEX;
}
//SerializableVertex::~SerializableVertex() {}
Serializable* Vertex::getSerializable(string path) {
SerializableVertex* serializable = ne... | ALGO | 0.886114 | 3.207009 |
a8922adc-0579-40a8-a9ce-8b9aec262bed | ChuyaoLU/CPPDauphine | tp2/tp2exo2.cpp | # include <iostream>
using namespace std;
float trouver_max(float tab[],int taille){
float max= tab[0];
for (int i=1;i<taille; i++ ){
if (tab[i]>max){
max=tab[i];
}
}
return max;
}
float trouver_min(float tab[],int taille){
float min= tab[0];
for (int i=1;i<taille; i++ ){
if (tab[i]<min){
min=tab[i]... | ALGO | 0.997002 | 3.439594 |
48b34bcc-71b6-4ffa-8b94-280f3d2c0d84 | SONGS4RI/studies | CodingTest/Cpp/Stage15/num12865-2.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n,k,w[101],v[101],dp[101][100001]={0,};
cin >> n >> k;
for(int i=1;i<=n;i++) cin >> w[i] >> v[i];
for(int i=1;i<=n;i++)
{
for(int j=1;j<=k;j++)
{
if(j-w[i]>=0) dp[i][j] = max(dp[i-1][j-w[i]]+v[i]... | ALGO | 0.99997 | 3.621506 |
a76e876d-1997-4dcd-b725-d2a9c9d94f8f | Enzofmcs/competitive-programming | Exercícios/Estrutura-de-Dados/160A.cpp | #include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false);
#define fo(i,n) for(i=0;i<n;i++)
#define si(x) cin >> x
#define pi(x) cout << x
#define pl(x) cout << x << "\n"
#define all(x) x.begin(), x.end()
#define PI 3.1415926535897932384626... | ALGO | 0.999813 | 4.277049 |
6b055228-6c3f-45e0-87a2-f921fa3176ad | Gooner1886/DSA-101 | heap/relativeRanks.cpp | // Leetcode - 506 - Relative Ranks
vector<string> findRelativeRanks(vector<int> &score)
{
priority_queue<int> maxHeap;
unordered_map<int, int> rank;
vector<string> answer;
for (auto it : score)
{
maxHeap.push(it);
}
int i = 1;
while (!maxHeap.empty())
{
rank[maxHeap.t... | ALGO | 0.999904 | 5.974831 |
6f43ed4d-adf1-4c4c-aa19-51a843b52b8e | vldcreation/CP-Train | Certification/cpp-basic2.cpp | #include <bits/stdc++.h>
using namespace std;
vector<long> findSum(vector<int> numbers, vector<vector<int>> queries){
int qlen = queries.size();
vector<long> temp(qlen);
for(int i=0;i<qlen;i++){
long sum = 0;
bool ok = true;
int start = queries[i][0];
int end = queries[i][1]... | ALGO | 0.999537 | 4.97692 |
71184b42-c034-4797-849d-299e0c629393 | adityaparmar9813/daily-leetcode | maximum_number_of_coins_you_can_get.cpp | class Solution {
public:
int maxCoins(vector<int>& piles) {
int sum = 0,n = piles.size();
sort(piles.begin(),piles.end());
for(int i = n / 3; i < n; i += 2) sum += piles[i];
return sum;
}
};
// Time Complexity : O(n*log(n))
// Space Complexity : O(1) | ALGO | 0.999959 | 6.37102 |
f4ec319e-fa39-4f01-91b3-834a0d32bfa4 | ExclusiveDisjunction/ReferenceCode | calculators/General/Calc.cpp | #include "Calc.h"
using namespace std;
double Calculation::Ans = 0.0, Calculation::X = 0.0, Calculation::Y = 0.0, Calculation::Z = 0.0, Calculation::A = 0.0, Calculation::B = 0.0, Calculation::C = 0.0;
void Calculation::CloseHandle(CalculationHandle* Handle)
{
Handle->One = 0.0;
Handle->Two = 0.0;
Handle->Command... | TOOL | 0.892557 | 4.189779 |
7ba48d92-3c2c-40c0-bfd8-9778c690ddd7 | VasoyaViraj/CodeForces-Problems | ServalAndStringTheory.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n, k;
string s;
cin >> n >> k >> s;
string rev = s;
reverse(rev.begin(), rev.end());
if (count(s.begin(), s.end(), s[0]) == n || (k == 0 && s >= rev)) cout << "... | ALGO | 0.999228 | 4.042263 |
fe2e4d97-c547-4ee5-8a75-ae3a23079529 | chocolatethundaa/vexMobileGoal--Search | src/MBGoal.cpp |
#include "mbgoal.h"
#include <vector>
#include <iterator>
#include "float.h"
#include <sstream>
void MBGoal :: setNeighbor(string name, MBGoal *current,map<string, MBGoal*> neighbor){
auto it = neighbor.begin();
while(it!= neighbor.end()){
if(current->neighbors.count(it->first)<1){
curre... | TOOL | 0.958437 | 3.861114 |
5d20780f-97ae-46aa-a05b-85713e6b5ba2 | yogi2442/repo | spoj/done/abcdef/a.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int compare(const void *a,const void *b)
{
return *(int*)a - *(int*)b;
}
int main()
{
int n,j,i,k,l,m,array[101],array1[2000000],count;
// vector<int> myvector(2);
cin >> n;
for(i=0;i<n;i++)
{
cin >> array[i];
}
m=0;
for(i=0;i... | ALGO | 0.99997 | 3.44201 |
b89b5bec-7cb9-4cbf-a9e3-23364ff296da | TRAN-THUY-NGOC/UPCODER | UPCODER/Lập trình nâng cao /9. Xử lí chuỗi/CONNECT.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
ifstream ifile;
ofstream ofile;
ifile.open("CONNECT.INP");
ofile.open("CONNECT.OUT");
vector<int> vt;
string res = "";
int test; ifile >> test;
while (test--) {
... | ALGO | 0.998625 | 5.186241 |
6d16ee98-8b23-49dc-a03a-6b7e36b30316 | ormaza/Code-Jam | HackerRank/Cracking the Coding Interview/Hash Tables: Ransom Note.cpp | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#inc... | ALGO | 0.999965 | 4.376822 |
c420d97f-54a6-4257-aae5-11a99e4becbc | MiljanMiki/Strukture | Vezbanje II kol/Jun2022/Zad3_isPerfect/QueueAsArrayInt.cpp | #include "QueueAsArrayInt.h"
#include <exception>
using namespace std;
QueueAsArrayBSTNodeInt::QueueAsArrayBSTNodeInt(long nsize)
{
size = nsize;
arr = new BSTNodeInt*[size]();
head = tail = -1;
numOfElements = 0;
}
BSTNodeInt* QueueAsArrayBSTNodeInt::getHead() const
{
if (numOfElements == 0)
throw new except... | TOOL | 0.918227 | 4.717735 |
712a0069-f598-4e16-a041-b361f12f7254 | plenilune3/problem_solving_cpp | beakjoon/BaaaaaaaarkingDog/DFS/17406_배열 돌리기.cpp | #include <iostream>
#include <climits>
#include <vector>
using namespace std;
const int MAX = 52;
struct rotate
{
int r, c, s;
};
int N, M, K, answer = INT_MAX;
int A[MAX][MAX];
rotate B[6];
bool selected[6];
vector<rotate> v;
void rotate_calculate(rotate k, int B[MAX][MAX])
{
int r = k.r;
int c = k.c;... | ALGO | 0.999768 | 4.68982 |
e41d65c1-1bb7-4f8c-8921-6f880306ee3d | mohitchandak/Love-babber-450 | 03_string/06_string_shuffle_of_other.cpp | /*
link: https://www.programiz.com/java-programming/examples/check-valid-shuffle-of-strings
*/
// ----------------------------------------------------------------------------------------------------------------------- //
/*
Check if a string is a valid shuffle of two other strings:
for eg. 1XY2 is a valid ... | ALGO | 0.998805 | 5.293701 |
b8024e17-799c-4787-b2cd-896d8d028c69 | sarvex/leetcode-wren | solution/0000-0099/0013.Roman to Integer/Solution.cpp | class Solution {
public:
int romanToInt(string s) {
unordered_map<char, int> nums{
{'I', 1},
{'V', 5},
{'X', 10},
{'L', 50},
{'C', 100},
{'D', 500},
{'M', 1000},
};
int ans = nums[s.back()];
for (int ... | ALGO | 0.999875 | 6.477838 |
41fe77c2-d50a-45db-9f5a-db436a090928 | manitbaser/LeetCode | problems/house_robber/solution.cpp | class Solution {
public:
int rob(vector<int>& nums) {
vector<int> x = nums;
if(x.empty()){
return 0;
}
if(x.size()<=2){
return *max_element(x.begin(),x.end());
}
for(int i = 2;i<x.size();i++){
x[i]+=max(x[i-2],x[i-1]-nums[i-1]);
... | ALGO | 0.999864 | 5.568303 |
9a09fbdf-cf61-4fdf-844e-d1e4325affe7 | abhishek18124/LVCPPSept2023 | Lecture 23/02 - Algorithm STL/004AlgorithmSTLPartIV.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main() {
int arr[] = {50, 40, 40, 30, 30, 30, 20, 10, 10};
int n = sizeof(arr) / sizeof(int);
// 1. searching for a key in a sequence using find()
int key = 30;
auto it = find(arr, arr + n, key); // find the key [begin, end)
cout << it << endl... | ALGO | 0.999149 | 4.034648 |
34c21ea8-e94b-40d8-a46e-0095c5f9b95c | amitkys/cp | Dec-24/26dec/checkArrayisSorted.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
bool arraySortedOrNot(vector<int>& arr) {
for(int i = 0; i < arr.size()-1; i++){
if(arr[i] > arr[i+1]) return false;
}
return ... | ALGO | 0.997642 | 5.896566 |
7a10c6c1-d07d-4fca-a2b4-8f914b6e38d6 | scp-sabuj/Programming | C-Programing/2.1 semester/New folder21/Algorithm/RadixSort.cpp | #include<iostream>
#include<vector>
using namespace std;
int NumberOfDigit(int num)
{
int cnt = 0;
while(num)
{
cnt++;
num/=10;
}
return cnt;
}
int main()
{
int n,arr[100], arr2[100], mx , factor;
while(cin>>n)
{
vector<int>vectorArr[10];
mx = -1000;... | ALGO | 0.999934 | 4.079263 |
0d016171-3051-44d6-8938-003dc5c5c3ac | Ad2712/code-help-dsa | Pattern/fancyPattern.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin >> n;
// for(int row=0; row<n; row=row+1){
// for(int col=0; col<row+1; col=col+1){
// cout << row+1;
// if(col != row){
// cout << "*";
// }
// }
// cout << endl;... | ALGO | 0.999849 | 3.54082 |
03334d7e-e19a-4b1e-8530-14d7c1912c85 | AndersonBillss/MinecraftCPU | src/utils/stringUtils.cpp | #include "stringUtils.hpp"
#include <cctype>
#include <iostream>
std::string stringUtils::trim(const std::string &text)
{
size_t start = 0;
while (start < text.length() && std::isspace(text[start]))
{
start++;
}
size_t end = text.length();
while (end > start && std::isspace(text[end - ... | TOOL | 0.973205 | 6.350329 |
606ca7e6-5805-44ff-90cf-1196cbbe49c2 | ukmaurya/leetcode | 1056-capacity-to-ship-packages-within-d-days/capacity-to-ship-packages-within-d-days.cpp | class Solution {
bool possible(int mid , vector<int>&weights ,int day){
/* int n= weights.size();
int sum = 0;
int count = 1;
for(int i=0;i<n;i++){
sum+=weights[i];
if(sum>mid){
count++;
sum=weights[i];
... | ALGO | 0.999993 | 5.471003 |
07417eee-5191-4da8-837c-8d7b41f7c2e6 | Learning-and-Intelligent-Systems/mit-ros-pkg | branches/sandbox/fastwam/src/wamtest.cpp | #include <signal.h>
#include <ros/ros.h>
#include <fastwam/MoveTo.h>
#include <barrett/systems.h>
#include <barrett/products/product_manager.h>
#include <barrett/standard_main_function.h>
using namespace barrett;
//---------------- 2-DOF Safety Controller ----------------//
#define METERS_PER_INCH .0254
const doubl... | TOOL | 0.990375 | 5.667199 |
763c02b3-9bb6-4ee0-a2e1-af6df5c2a21c | Kawser-nerd/CLCDSA | Source Codes/AtCoder/arc097/A/2500104.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
string s;
int n, k;
vector<string> v;
void solve() {
n = s.length();
string tmp;
for (int i = 0; i<n; i++) {
tmp.clear();
for (int j = 0; j<5 && i + j<n; j++) {
tmp.push_back(... | ALGO | 0.999972 | 3.586309 |
2637b19a-1129-4e87-9365-4bc8dad56a68 | suravijha/DSA | Day34/find-the-duplicate-number.cpp | // LeetCode 287
// Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive.
// There is only one repeated number in nums, return this repeated number.
// You must solve the problem without modifying the array nums and using only constant extra space.
class Solution... | ALGO | 0.99998 | 5.923727 |
adf89d58-176c-4c21-a344-ad7e1a665a18 | MostafaOmar98/competitive-programming | Algorithms/strings/Mancher.cpp |
// odd[i] means palindrome starts at i - odd[i] and ends at i + odd[i]
// even[i] means palindrome starts at i - even[i] - 1, and ends at i + even[i] iff even[i] != 0
void manacher(const string &s, vector<int> &odd, vector<int> &even)
{
int n = sz(s);
odd.clear();
even.clear();
odd.resize(n);
even.... | ALGO | 0.999979 | 5.378953 |
c2222e61-2b66-4f2c-af34-3d1b8fc685da | OscarNieto113/experto-en-programaci-n-competitiva | Individual/A_martes_1547C.cpp | #include <iostream>
#include <vector>
using namespace std;
void solution (){
int k, m, p;
cin >> k >> m >> p;
vector<int> ml(m), pl(p);
for (int i = 0; i < m; i++) cin >> ml[i];
for (int i = 0; i < p; i++) cin >> pl[i];
int i=0, j=0;
vector<int>visited;
while (i < m || j < p) {
... | ALGO | 0.999916 | 3.490115 |
62f4c3ca-7e73-405c-acb9-505ba8868cd7 | rkzthdu/leetcode-top-100-liked | 131.cpp | /*
分割回文串,回溯
*/
class Solution {
public:
void backtrack(int n, vector<vector<string>> &ans, vector<int> &pos, string &str) {
auto lastpos = pos.back();
if(lastpos == n) {
string tmp = "";
vector<string> sol;
for(int i = 0; i < pos.size() - 1; ++i) {
... | ALGO | 0.999983 | 5.826585 |
774f74de-5ffd-434b-bdd9-958cfdc4f317 | sharleenclement/Leetcode | diameter-of-binary-tree/diameter-of-binary-tree.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.999888 | 6.673932 |
6b7f4732-c1c7-4535-b0c1-35ae52f5c903 | Aques/Data-Structures-and-Algorithms | C++/Data Structure - Arrays/Merge Sorted Array.cpp | #include <iostream>
#include <vector>
using namespace std;
void MergeSortedArray(vector<int> &Array1, vector<int> &Array2, vector<int> &result)
{
int i = 0, j = 0;
int size1 = Array1.size();
int size2 = Array2.size();
while(i < size1 && j < size2)
{
if(Array1[i] <= Array2[j])
{
... | ALGO | 0.999949 | 5.166928 |
24bbdeec-fd08-4164-904a-d1829412de65 | Savithru-4/vitis-tutorial-hardware-accleration | Convolution/filter2d_hw.cpp | #include "common.h"
#include "hls_stream.h"
void ReadFromMem(
unsigned short width,
unsigned short height,
unsigned short stride,
const int *coeffs,
hls::stream<int> &coeff_stream,
const unsigned char *src,
hls::stream<U8> &pixel_... | ALGO | 0.929884 | 5.204728 |
b071f54d-5051-4363-bc79-0a01f69915cc | Kaushal-26/adventofcode | 2024/day03/1.cpp | // https://adventofcode.com/2024/day/3
#include <bits/stdc++.h>
std::string input;
void solve() {
std::string S;
while (getline(std::cin, input)) S += input;
long long result = 0;
for (int i = 0; i < (int)S.size(); ++i) {
if (S[i] == '(' && i - 3 >= 0 && S.substr(i - ... | ALGO | 0.999797 | 5.24393 |
1997709b-a775-4033-bf9a-a60ced079398 | aminjonshermatov/competitive_programming | atcoder/abc/255/F.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using namespace... | ALGO | 0.999866 | 3.895365 |
b358ce7d-7b48-46b4-804c-f9413ef865a0 | minus3theta/contest | atcoder/arc/098/c.cpp | #include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <re... | ALGO | 0.999912 | 3.555186 |
d2136446-538c-4c1f-b475-05b9913efe88 | Gurkengewuerz/microcontroller-tensorflow | lib/Arduino_TensorFlowLite/src/tensorflow/lite/micro/kernels/detection_postprocess.cpp | #include <numeric>
#include "tensorflow/lite/c/builtin_op_data.h"
#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/kernels/internal/common.h"
#include "tensorflow/lite/kernels/internal/quantization_util.h"
#include "tensorflow/lite/kernels/internal/tensor_ctypes.h"
#include "tensorflow/lite/kernels/kern... | DATA | 0.974421 | 7.057156 |
9b9bf7d0-ed33-4f03-88ca-f36192110057 | 1997priyam/Data-Structures | arrays&mix/prime.cpp | #include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int isPrime(int A) {
int N = sqrt(A);
if(A==1) return 1;
for(int i=2; i<=N; i++){
if(A%i==0){
return -1;
}
}
return 1;
}
int main(){
cout<<"Enter a number: ";
int n... | ALGO | 0.99992 | 4.053617 |
6855dfff-75c6-42f1-aeb6-1d72bf894683 | routb68/Leetcode-pratice | 2216-minimum-deletions-to-make-array-beautiful/2216-minimum-deletions-to-make-array-beautiful.cpp | class Solution {
public:
int minDeletion(vector<int>& nums) {
stack<int>s;
for(int i=nums.size()-1;i>=0;--i){
s.push(nums[i]);
}
int ans =0;
while(s.size()>1){
int x = s.top();s.pop();
while(s.size() and s.top()==x){
s.pop()... | ALGO | 0.999986 | 5.972125 |
71215a79-d9c6-426f-b1fa-8e4f633a1fc4 | KunalBahirat/DSA-Practice | apnclg/9_2_2d_array_challenges.cpp | #include <iostream>
using namespace std;
int main(){
// Transpose of Matrix
// int m=4;
// int a[4][4]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
// for(int i=0;i<m;i++){
// for(int j=i;j<m;j++){
// int temp=a[i][j];
// a[i][j]=a[j][i];
// a[j][i]=temp... | ALGO | 0.999689 | 3.918557 |
a142a171-a0f5-4753-8d6a-f8586a038183 | bhavingupta123/450Qs | Q324_QUEUE_CHECK_ANAGRAMS.cpp | bool areAnagrams(Node *root1, Node *root2)
{
if(!root1 && !root2)
return true;
if(!root1 || !root2)
return false;
queue<Node *> q1, q2;
q1.push(root1);
q2.push(root2);
while(true)
{
int n1 = q1.size();
int n2 = q2.size();
if(n1!=n2)
return false
if(n1==0)
break;
vector<in... | ALGO | 0.999638 | 4.458233 |
061cc112-5d7d-484f-b1ab-3eec447dd994 | sirkp/DSA | 7. Matrix/problems/p2.cpp | // https://practice.geeksforgeeks.org/problems/sum-of-upper-and-lower-triangles-1587115621/1/?track=SPCF-Matrix&batchId=154
void sumTriangles(int n, int arr[SIZE][SIZE]){
int up = 0;
int low = 0;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++){
if(j>=i)
up += arr[i][j];
if(j<=i)
... | ALGO | 0.999647 | 3.46476 |
2ca6c478-f23d-4ba6-b550-30dd869e57d4 | arash-ha/Cpp | Count Complete Tree Nodes.cpp | /*
Count Complete Tree Nodes
Given the root of a complete binary tree, return the number of the nodes in the tree.
According to Wikipedia, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far left as possible. It can have between 1 and 2h nod... | ALGO | 0.999938 | 7.028393 |
9afe2adf-2f5c-4fa3-a169-bbd6f9c5d67b | ishandutta2007/codeforces | savinov/normal/550/C.cpp | #include <bits/stdc++.h>
#define clr(x) memset((x), 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define in(x) int (x); input((x));
#define x first
#define y second
typedef int itn;
#define next next12345
#define prev prev12345
#define left lefdsf232
#define right rig4... | ALGO | 0.999973 | 3.682589 |
0b8b38f8-bc70-43f3-aad3-3c200c9ae9c3 | Supsource/90DaysDSA | LeetCode Problems/Two Sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target)
{
int size = nums.size();
int i = -1;
int j;
bool found=false;
vector<int> arr(2);
while(i < size-1 && found == false)
{
i++;
j = i + 1;
while (j < size && found == false)
... | ALGO | 0.999905 | 6.254508 |
7dbcb3f7-f964-4fcc-acce-022b162002ca | vladimirevsin/lp | Linphone/tool/Utils.cpp | #include "Utils.hpp"
#include "core/App.hpp"
#include "core/call/CallGui.hpp"
#include "core/conference/ConferenceInfoCore.hpp"
#include "core/conference/ConferenceInfoGui.hpp"
#include "core/friend/FriendGui.hpp"
#include "core/path/Paths.hpp"
#include "model/object/VariantObject.hpp"
#include "model/tool/ToolModel.h... | TOOL | 0.909033 | 5.743238 |
823f0ec6-a623-446f-9950-03b62df0f009 | AlbertoOS/2023-01-PCC104-UFOP | 04-dynamic-programming/04-dynamic-programming.cpp | #include "04-dynamic-programming.h"
#include <climits>
#include "../utils.h"
unsigned long long int fibonacci(int n) {
if (n <= 1) { return n; }
return fibonacci(n - 1) + fibonacci(n - 2);
}
unsigned long long int dynamic_var_fibonacci(int n) {
if (n <= 1) {
return n;
}
unsigned long long ... | ALGO | 0.999906 | 5.139262 |
59059d75-cdbd-4f16-9c34-d12b86243880 | kk-laoguo/ollvm-13 | llvm-project-13/llvm/tools/sancov/sancov.cpp | #include <set>
#include <vector>
using namespace llvm;
namespace {
// --------- COMMAND LINE FLAGS ---------
enum ActionType {
CoveredFunctionsAction,
HtmlReportAction,
MergeAction,
NotCoveredFunctionsAction,
PrintAction,
PrintCovPointsAction,
StatsAction,
SymbolizeAction
};
cl::opt<ActionType> Act... | TOOL | 0.93303 | 6.515689 |
97763f6f-5f35-417b-8ff8-415b9fda7344 | MariiaBerdnyk/securityProject | cryptopp/rabin.cpp | // rabin.cpp - originally written and placed in the public domain by Wei Dai
#include "pch.h"
#include "rabin.h"
#include "integer.h"
#include "nbtheory.h"
#include "modarith.h"
#include "asn.h"
#include "sha.h"
NAMESPACE_BEGIN(CryptoPP)
void RabinFunction::BERDecode(BufferedTransformation &bt)
{
BERSequenceDecoder... | ALGO | 0.997038 | 7.859867 |
05d5d54f-87bf-45d9-a2ef-5920da8c60f5 | Zard3017/C-FILES | while loop for alphabets.cpp | // Write a program using a loop to output all the letters of the alphabet in uppercase.
#include<iostream>
using namespace std;
int main(){
char ch = 'A';
while (ch <= 'Z') {
cout << ch << endl;
ch++;
}
return 0;
}
| TOOL | 0.862561 | 4.187207 |
d685ad09-ef0b-4679-bede-3563133d6ba9 | maceyldn/tsduck | src/libtsduck/crypto/tsSHA256.cpp | //----------------------------------------------------------------------------
//
// TSDuck - The MPEG Transport Stream Toolkit
//
// SHA-256 hash.
//
// Implementation based on LibTomCrypt (http://www.libtom.org/)
// by Tom St Denis (<EMAIL>)
//
// Usage in TSDuck allowed based on LibTomCrypt licence:
// << Li... | TOOL | 0.982155 | 7.449054 |
7c464f08-e7ad-4f6f-aa12-be2cb5347c04 | ACyming/OI | c++/动态规划/基础DP+背包/最小乘车费用.cpp | #include <bits/stdc++.h>
using namespace std;
long long c[10000], k, dp[10000];
int main() {
for (long long i = 1; i <= 10; i++) {
cin >> c[i];
}
cin >> k;
memset(dp, 114514, sizeof(dp));
dp[0] = 0;
for (long long i = 1; i <= 10; i++) {
for (long long j = i; j <= k; j++) {
dp[j] = min(dp[j], dp[j - i] + c[... | ALGO | 0.999789 | 3.352039 |
8d2ba40a-61d8-4f95-861e-b32b46ba26a4 | sakshamssr/DSA | Array/insertionSortPractice.cpp | #include<iostream>
using namespace std;
int main(){
int n = 5;
int arr[n]={2,1,3,5,4};
cout<<"Before Sort: ";
for(int i = 0; i<=n-1; i++){cout<<arr[i];}
for(int i = 1; i<=n-1; i++){
int j = i;
while(j>0 && arr[j-1]>arr[j]){
swap(arr[j],arr[j-1]);
j--;
... | ALGO | 0.999978 | 4.603833 |
2a4822ca-3ec2-44b5-b0d7-81303988b0c4 | pkparthk/DSA | 05 Linked List/19SortLL.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node *next;
Node(int data1, Node *next1)
{
data = data1;
next = next1;
}
Node(int data1)
{
data = data1;
next = nullptr;
}
};
/... | ALGO | 1 | 6.184542 |
6abd2715-7a14-44f2-b3eb-0aead15ce6a1 | KoushikBiswas909/StriverSdeSheetChallenge | Arrays/uniquePath/combinatories.cpp | #include<bits/stdc++.h>
using namespace std;
// unique paths Combinatorics approach
// Time complexity - O(m-1) or O(n-1)
// Space complexity - 0(1)
int uniquePath(int n, int m){
int N = n+m-2;
int r = m-1; // or n-1, both same
double res = 1;
for(int i=1;i<=r;i++){
res = res * (N-r+i)/i;
... | ALGO | 0.999989 | 5.22923 |
04af8551-19aa-478c-b877-1b834da75b0c | seiko9898/CarND-Path-Planning-Project | src/Eigen-3.3/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp | MatrixXd A = MatrixXd::Random(6,6);
cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
EigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
complex<double> l... | ALGO | 0.998764 | 3.093769 |
9da228cc-4e24-41e0-a6e0-d7b753e86077 | thuang86714/leetCodeCpp4th | Trie_208_Implement_Trie.cpp | #include <string>
#include <unordered_map>
using namespace std;
class Trie {
public:
Trie() {
}
void insert(string word) {
Trie *node = this;
for(char c:word){
if(!node->next[c]){
node->next[c] = new Trie();
}
node = node->ne... | ALGO | 0.999903 | 6.046747 |
be5f668d-f8d1-4ef4-96cc-3414cc657471 | jjheon0614/DSA | BFS/2206.cpp | #include <iostream>
#include <queue>
#include <tuple>
#include <string>
using namespace std;
int board[1001][1001];
int dist[1001][1001][2];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int n, m;
int bfs() {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
dist[i][j][0] =... | ALGO | 0.999933 | 5.258358 |
e4b09b90-358a-4b81-ad9e-17c534fdb515 | gametutorials/tutorials | OpenGL/BSP Loader Part4/Camera.cpp | //***********************************************************************//
// //
// - "Talk to me like I'm a 3 year old!" Programming Lessons - //
// //
// $Author: DigiBen <EMAIL> //
// //
// $Program: ... | TOOL | 0.977533 | 3.451503 |
cbd3327f-dd3d-4b28-a322-8faa612fa4e6 | ronikrana2/hackerblocks | Pattern Inverted Hourglass.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
int no=n;
int sp=4*n-2;
for(int i=0;i<=n;i++){
if(i!=n){
for(int j=0;j<=i;j++){
cout<<no<<" ";
no--;
}
for(int k=1;k<=sp;k++){
cout<<" ";
}
sp=sp-4... | ALGO | 0.999982 | 3.393546 |
05b74421-5f9b-49ea-a4a8-3a6d77abdd7d | prasad-Bhoite/Leetcode | coin-change/coin-change.cpp | class Solution {
public:
/*int solveUsingRecursion(vector<int> &coins,int amount)
{
//base case...
if(amount ==0)
{
return 0;
}
if(amount < 0)
{
return INT_MAX;
}
int mini = INT_MAX;
... | ALGO | 0.999946 | 5.792473 |
cf813380-c3ff-4c05-a943-de12bcf27b2a | theoden42/code-store | atcoder/KEYENCE Programming Contest 2023 Summer(AtCoder Beginner Contest 315)/C.cpp |
/* author: (g)theoden42 */
#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 all(a) a.begin(), a.end()
#ifdef ON_PC
#include <debug.h>
#else
#define debug(x...)
#endif
template<typename T>
using o... | ALGO | 0.999922 | 4.357821 |
5352cb43-93d7-4abc-b4d0-c90a24747ffb | manikanta2901/ubuntu | .history/practice/hackerEarth/Bsequence_20200723172038.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#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 printM... | ALGO | 0.999804 | 3.535334 |
f018a8f8-4c11-4616-8de0-fc783e3dfd2a | Souravrajvi0/LEETCODE-DSA | 51-n-queens/n-queens.cpp | class Solution {
public:
vector<vector<char>>grid;
bool canPlaceQueen(int row, int col,int n){
for(int r=row-1;r>=0;r--){
if(grid[r][col]=='Q'){
return false;
}
}
for(int r=row-1,c=col+1;r>=0&&c<n;r--,c++){
if(grid[r][c]=='Q'){
return false;
}
}... | ALGO | 0.999858 | 5.310968 |
18f2f352-b34b-4166-bdaa-680f5a671286 | wowoto9772/Hungry-Algorithm | LAVIDA/1975/solution.cpp | #include <stdio.h>
#include <memory.h>
#include <limits.h>
#include <queue>
using namespace std;
int cap[203][203], flow[203][203];
int main()
{
int M, N;
scanf("%d %d", &M, &N);
for (int i = 1; i <= M; i++){
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if(!cap[a][b])cap[a][b] = c;
else
cap[a][b] += c... | ALGO | 0.99989 | 3.964193 |
5a6bcce3-a53e-435c-ab26-e7b6c840a868 | dzungpng/material-point-method-jello-simulation | Deps/libigl/include/igl/polar_svd3x3.cpp | template<typename Mat>
IGL_INLINE void igl::polar_svd3x3(const Mat& A, Mat& R)
{
// should be caught at compile time, but just to be 150% sure:
assert(A.rows() == 3 && A.cols() == 3);
Eigen::Matrix<typename Mat::Scalar, 3, 3> U, Vt;
Eigen::Matrix<typename Mat::Scalar, 3, 1> S;
svd3x3(A, U, S, Vt);
R = U * ... | ALGO | 0.993507 | 6.992301 |
cb0d5f16-3308-4cce-9b7e-60b4c526c9db | fangjinxia/leetcodeOJ | leetcodeOJ/238_Product of Array Except Self.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
vector<int> ans(nums.size(), 0);
int product = 1;
vector<int> idxOfZero(0);
for(int i = 0; i < nums.size(); i++){
if(nums[i] == 0)
idxOfZero.push_back(i);
else
... | ALGO | 0.999914 | 6.055453 |
4a27ad95-be89-470e-ad2e-9727bf3ebf02 | upupming/algorithm | acwing/寒假每日一题(入门组)/week4/482. 合唱队形.cpp | /*
f[i] 表示结尾下标为 i 的最长上升子序列长度
f[i] = max(f[k] + 1), a[k] < a[i]
g[i] 表示开始下标为 i 的最长下降子序列长度
初始条件 f[i] = 1
*/
#include <iostream>
using namespace std;
const int N = 110;
int n, a[N], f[N], g[N], ans;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
f[i] = 1;
for (int ... | ALGO | 0.999909 | 4.341135 |
fe038bef-d2c4-4a0f-8877-328ec84f1999 | sbrus1213/Algospot_solving | 08_Pi_S.cpp | // ALGOSPOT Pi ܿ
// Dynamic programming
#include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <tuple>
#include <list>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cstring>
using namespace std;
#define ll long lon... | ALGO | 0.999929 | 4.575184 |
4fcd4227-30b2-4dfd-807d-c40775ae5cc0 | arafatmisbawebdeveloper/ProblemSolutionForCodeforcses | balanced array.cpp | #include<stdio.h> //| \n
int main()
{
int n,a;
scanf("%d",&n);
while(n--) {
scanf("%d",&a);
int c=a/2;
if(c%2==0) {
printf("YES\n");
for(int i=2;i<=a;i=i+2) {
printf("%d ",i);
}
for(int j=1;j<a;j=j+2) {
if(j==a-1) j=j+c;
... | ALGO | 0.999707 | 3.818193 |
97a66ff1-7dd8-4be9-96f2-fe939f248dea | amsraman/Competitive_Programming | LIT/2021/G.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
struct Line {
ll m, b; mutable ll ep;
bool operator<(const Line & l) const {
return m < l.m;
}
bool operator<(ll x) const {
return ep < x;
}
};
struct LineContainer : multiset<Line, less<>> { // defaults to max
... | ALGO | 0.999869 | 4.359059 |
1947bdcd-b452-4e96-b17f-8a5af1739026 | TropicG/Introduction-To-Programming-Cpp | seminarExercises/PreperationForFinalExam/longestSequence.cpp | #include <iostream>
#include <cstring>
using namespace std;
//makes all uppercase characters to be lowercase
void allLower(char str[]) {
//gets teh size of the string
int size = strlen(str);
for (int i = 0; i < size; ++i) {
//if a character is between A-Z it will be changed to respectivly a-z
if (str[i] >= '... | ALGO | 0.999699 | 3.847456 |
aca85b6e-9b93-455a-bcda-7bc2522a7a1a | makio93/competitive-atcoder | arc135/arc135_b/2/main0.cpp | // 学習2回目,自力AC
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i, n) for (int i=0; i<(int)(n); ++(i))
#define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i))
#define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i))
#define rep3r(i, m, ... | ALGO | 0.999997 | 3.360323 |
e30966f1-aef0-42ef-9e06-e8cdfe7201f4 | Nkeyka/Qt-Creator-Cpp-Book | 2.10.2 Integer arithmetic/2/main.cpp | /* Масса M задана в килограммах.
* Найти количество полных тонн
* в ней и остаток в килограммах. */
#include <iostream>
using namespace std;
int main()
{
int M, full, part;
cout << "Enter M = ";
cin >> M;
full = M / 1000;
part = M % 1000;
cout << full << " ton " << part << " kilogram" << en... | TOOL | 0.985839 | 4.567056 |
38f9df94-83bc-47d2-b128-3e13deb13d01 | varshneyanushka/leetcode | 198-house-robber/house-robber.cpp | class Solution {
public:
int rob(vector<int>& nums) {
int n=nums.size();
vector<int> dp(n,0);
if(n==0)
{
return 0;
}
if(n==1)
{
return nums[0];
}
dp[0]=nums[0];
dp[1]=max(nums[1],nums[0]);
for(int i=2;i<n... | ALGO | 0.999758 | 5.914721 |
05050924-bf6a-4868-b9a7-534f1176ba12 | ocya/PAT-Basic | 1094.cpp | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
bool isPrime( int N );
int main(int argc, const char *argv[]){
int L, K;
bool isExist = false;
string Number;
cin >> L >> K >> Number;
/*
循环中值条件是 i <= L - K ;或者写成 i <=(int) Number.length() - K;
Number.le... | ALGO | 0.991664 | 3.717646 |
7ccc29aa-b971-40c1-81c9-bf4cea6b4e9b | sawarn24/LEETCODE-questions | 0164-maximum-gap/0164-maximum-gap.cpp | class Solution {
public:
int maximumGap(vector<int>& nums) {
if(size(nums)<2)
return 0;
sort(nums.begin(),nums.end());
int res=0,maxi=INT_MIN;
for(int i=1;i<size(nums);i++)
{
res=nums[i]-nums[i-1];
maxi=max(maxi,res);
}
return max... | ALGO | 0.999961 | 5.020959 |
4a7aaa60-b2e2-4a70-a620-0de5cddea5a6 | thegamer1907/Code_Analysis | contest/1542595233.cpp | #include <bits/stdc++.h>
#define __INIT_CC__ ios::sync_with_stdio(false); \
cin.tie(0);
#ifdef __WIN32__
char getchar_unlocked() {return getchar();}
#endif
#define FOR(_i,_n,_m) for(int (_i)=(_n),_t=(_m);_i<(_t);++(_i))
#define FORN(_i,_n,_m) for(int (_i)=(_n),_t=(_m);_i<=(_t);++(_i))
#define FORD(_i,_n,_m) ... | ALGO | 0.999977 | 3.718417 |
a8d5c831-1fe1-40a1-be59-a4b395c72419 | ishandutta2007/codeforces | pavel.savchenkov/normal/35/D.cpp | //HACK ME, PLEASE! ^_^
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <utility>
#include <math.h>
#include <cstdlib>
#include <memory.h>
#include <queue>
#include <assert.h>
#define pb push_back
#define i64 long long
#define mp ... | ALGO | 0.999971 | 3.684251 |
7d2f4f7a-9876-4f53-8cf7-42d45ee9a5a0 | MPTCP-FreeBSD/FB13.1-AQM-L4S-SRC | contrib/llvm-project/llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp | #include "llvm/CodeGen/GlobalISel/CSEMIRBuilder.h"
#include "llvm/CodeGen/GlobalISel/GISelChangeObserver.h"
#include "llvm/IR/DebugInfoMetadata.h"
using namespace llvm;
bool CSEMIRBuilder::dominates(MachineBasicBlock::const_iterator A,
MachineBasicBlock::const_iterator B) const {
auto ... | ALGO | 0.984215 | 7.879613 |
35b163bf-3c6c-4518-8820-45ce1054bd43 | SHaiderM16/Undergrad-CS-Programs | Data Structures and Algorithms/Data Structures/Hashing.cpp | #include <iostream>
using namespace std;
// ---------------------------- Linear Probing ----------------------------
class HashTableEntry
{
public:
int key;
int value;
HashTableEntry(int k, int v) : key(k), value(v) {}
};
class HashMapTable
{
private:
int TABLE_SIZE;
HashTableEntry **table;
... | ALGO | 0.999647 | 5.669265 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.