uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0aeea2fe-dbe0-48f5-8a3e-60add3ba2e87 | kniefliu/skia | third_party/externals/icu/source/i18n/search.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/brkiter.h"
#include "unicode/schriter.h"
#include "unicode/search.h"
#include "usrchimp.h"
#include "cmemory.h"
// public constructors and destructors -----------------------------------
U_NAMESPACE_BEGIN
SearchIt... | TOOL | 0.887707 | 4.234629 |
ba496999-622f-478f-b1cd-5891e94ec83b | DyogoBendo/cp | subject/introductory/palindrome_reorder.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s;
cin >> s;
int n = s.size();
map<char, int> ms;
for (int i = 0; i < n; i++)
{
ms[s[i]] ++;
}
bool allow_impar = n % 2;
int impar = 0... | ALGO | 0.999998 | 4.22119 |
66f95d19-d27c-43b1-924d-52be26593b05 | Amankapil/code-chef | COUPUN2.cpp | #include <iostream>
using namespace std;
int main()
{
// your code goes here
int t;
cin >> t;
while (t--)
{
int d, c, a1, a2, a3, b1, b2, b3;
int day1 = 0;
int day2 = 0;
int withCupan = 0;
int without = 0;
cin >> d >> c;
cin >> a1 >> a2 >> a3;... | ALGO | 0.999674 | 4.182693 |
f2ed84c1-e44f-4290-a8b9-26f0b3846697 | dorian-gabIer/Klasa_2AG | Zajęcia 05.02.2021/aip.cpp | #include <bits/stdc++.h>
using namespace std;
string bin2dec(string n)
{
string res;
int numb = 0;
for (int j = 0; j < 4; j++) {
numb = 0;
for (int i = j * 8; i < j * 8 + 8; i++)
{
numb = numb * 2 + int(n[i] - '0');
}
res = res + to_string(numb);
i... | ALGO | 0.999873 | 3.075008 |
ec24cca4-b6c2-4eaa-b1c2-675723023775 | SAYAN-DEV-NATH/Phitron_Course | C++ FOR DSA/W-1 Introduction to C++/M-2 Dynamic Memory Allocation/Increae_size.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
/*
int *arr = new int[3];
for (int i = 0; i < 3; i++)
cin >> arr[i];
for (int i = 0; i < 3; i++)
cout << arr[i] << " \n";
delete[] arr;
for (int i = 0; i < 3; i++)
cout << arr[i] << " ";
*/
int *arr1 =... | ALGO | 0.998251 | 3.00638 |
601a74a6-6fec-4b57-9fc1-9684477827ff | pflyly/citron-mirror | src/core/debugger/gdbstub.cpp | #include <atomic>
#include <codecvt>
#include <locale>
#include <numeric>
#include <optional>
#include <thread>
#include <boost/algorithm/string.hpp>
#include <fmt/ranges.h>
#include "common/hex_util.h"
#include "common/logging/log.h"
#include "common/scope_exit.h"
#include "common/settings.h"
#include "common/string... | TOOL | 0.853806 | 7.180129 |
78015e26-9f87-4ac3-8b1c-d8efbbdba057 | ishandutta2007/codeforces | ttklwxx/normal/1281/B.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
inline int read()
{
int n=0,f=1,ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')
{
n=n*10+ch-'0';
ch=getchar();
}
return n*f;
}
char c[100001],s[100001];
int clen,slen,cmin,smin;
bool... | ALGO | 0.99999 | 3.056291 |
666004cd-a6e2-4e06-aef4-0b8478d4c4fb | arlechann/atcoder | AtCoder/ABC191/C.cpp | #include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string... | ALGO | 0.999943 | 4.713848 |
55e3b0ba-4a10-4d6b-b7ea-718d3d63a8dd | BanRuoBoLuo/LeetCodeSolution | Graph/207_Course_Schedule.cpp | /*************************************************************************
207. Course Schedule
Medium
There are a total of n courses you have to take, labeled from 0 to n-1.
Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
Given t... | ALGO | 0.999849 | 6.708622 |
ad740829-e119-43e3-b10e-273faa4b0529 | laurenegerton/creature-tournament | Game.cpp | /***********************************************************************************
**Program Filename : Game.cpp
**Author : Lauren Egerton
**Date : 02/28/16
**Description : Implementation file for Game class.
**Input : This program needs Creature.cpp, Creature.hpp, Medusa.cpp, Medusa.hpp,
Barbarian.cpp, Barbari... | TOOL | 0.862682 | 3.365288 |
02df41b0-1a51-46eb-a564-4e8dcb79d13e | KivalEvan/Homework-Assignment | 2021/algorithm-design-assignment/code/distance.cpp | #include <iostream>
#include <iomanip>
#include <chrono>
#include <math.h>
#include <cmath>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
using namespace std;
int edges[10][10];
string arr[60];
int Xcords[10];
int Ycords[10];
int Zcords[10];
float weight[10];
float profit[10];
float value[10]... | ALGO | 0.999653 | 4.047945 |
a191bb20-9091-4b21-b482-761d4a2e3370 | diabasecoin/diabase | src/evo/specialtx.cpp | #include <chainparams.h>
#include <consensus/validation.h>
#include <hash.h>
#include <primitives/block.h>
#include <validation.h>
#include <evo/cbtx.h>
#include <evo/deterministicmns.h>
#include <evo/specialtx.h>
#include <llmq/quorums_commitment.h>
#include <llmq/quorums_blockprocessor.h>
bool CheckSpecialTx(const... | ALGO | 0.917913 | 6.033751 |
66801a5f-b4e1-485b-9cac-52bd18acdee8 | jeete121/Coding | Programs/Practice/Prac/GraphAlgorithms/all_permutation_string.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> ans;
//function to find all the permutaions of the
//given string
void permutations(string str,int l,int r)
{
//base case if l and r same
//then push the string into the
//vector of strings
if(l==r)
{
ans.push_back(str);
... | ALGO | 0.999892 | 4.91762 |
e258e8b1-eb59-42e6-9e55-c3ffe070e4c6 | DrTECHNIC/RTU_MIREA | 2 семестр/Структуры и алгоритмы обработки данных/Практическая работа №5/CiAOD_1.5.cpp | #include <iostream>
using namespace std;
struct list;
struct Node {
int val;
Node* next;
list* list_ptr;
Node(int _val) : val(_val), next(nullptr) {}
};
struct list {
Node* first;
Node* last;
Node* array[10];
list() : first(nullptr), last(nullptr) {}
bool is_empty()
{
re... | ALGO | 0.986665 | 3.566347 |
ba0e063b-d64c-4933-a3ef-6542694f569c | sarvex/leetcode-hack | solution/0100-0199/0161.One Edit Distance/Solution.cpp | class Solution {
public:
bool isOneEditDistance(string s, string t) {
int m = s.size(), n = t.size();
if (m < n) return isOneEditDistance(t, s);
if (m - n > 1) return false;
for (int i = 0; i < n; ++i) {
if (s[i] != t[i]) {
if (m == n) return s.substr(i + ... | ALGO | 0.999992 | 6.220073 |
970a58e6-2a67-4fb7-be89-58645c905a1b | ArutoriaWhite/Competitive-programming | toj41.cpp | #include <bits/stdc++.h>
#define de(x) cout << #x << "=" << x << ", "
#define dend cout << '\n'
#define Eriri ios::sync_with_stdio(0), cin.tie(0);
#define F first
#define S second
using namespace std;
typedef pair<int,int> Pii;
const int N = 5e5+10;
struct Edge {int u, v, w; } edges[N];
int res, p[N], k, n, m;
inline ... | ALGO | 0.999923 | 4.218439 |
f3c881ba-ec70-42c3-9d97-2be84ee08801 | ShinsuSenju/Practice-Questions | my-folder/0146-lru-cache/solution.cpp | class Node {
public:
Node* next;
Node* prev;
int key;
int val;
Node() : next(nullptr), prev(nullptr), key(0), val(0) {}
Node(int k, int x) : next(nullptr), prev(nullptr), key(k), val(x) {}
};
class LRUCache {
public:
unordered_map<int, Node*> mp;
int size;
int currSize = 0;
Nod... | ALGO | 0.999843 | 6.248061 |
2ca8cfce-83db-4b21-979d-ae2adffcf5fe | jaimonvarghese/stock_trading_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
9fdc7e91-25ef-4323-b987-ef461e8ed278 | knockcat/Leetcode | 2293. Min Max Game.cpp | // 2293.✅ Min Max Game
class Solution
{
public:
int minMaxGame(vector<int> &nums)
{
int n = nums.size();
if (nums.size() == 1)
return nums[0];
if (nums.size() == 2)
return min(nums[0], nums[1]);
list<int> l;
while (n / 2 > 1)
{
... | ALGO | 0.999995 | 5.35562 |
b03ed527-cb6c-4fd8-bf23-16d542cbd9d0 | anilchoudhary/DSA | GFG__2/graph/DFS.cpp | #include<bits/stdc++.h>
using namespace std;
void addEdge(vector<int> adj[], int u, int v)
{
adj[u].push_back(v);
adj[v].push_back(u);
}
void printGraph(vector<int> adj[], int V)
{
for (int v = 0; v < V; ++v)
{
cout << "\n Adjacency list of vertex "
<< v << "\n head ";
for (auto x : adj[v])
cout << ... | ALGO | 0.99989 | 4.76492 |
0c1df6c4-7656-4f68-9e12-1b485a42f94b | withaarzoo/LeetCode-Solutions | Algorithms/src/729. My Calendar I/Code/solution.cpp | #include <vector>
using namespace std;
class MyCalendar
{
private:
// Vector to store pairs of start and end times for booked events
vector<pair<int, int>> bookings;
public:
// Constructor to initialize the MyCalendar object
MyCalendar() {}
// Function to book an event in the calendar
bool bo... | ALGO | 0.999622 | 6.556685 |
73c9437c-18af-44e4-bb01-7804c9862325 | marioyc/Online-Judge-Solutions | TJU/3216 - Minimum Heap.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int left[1001],right[1001],C[1001][1001],M;
long long memo[1001];
long long f(int N){
if(N<=2) return 1;
if(memo[N]!=-1) return memo[N];
//we can put the second lowest element at the left or right of the lowest element(father)
memo... | ALGO | 0.999859 | 4.328899 |
122d3913-639a-4949-b153-87a1d8357189 | VolandJohan/PRG1 | labo/labo31/Uint.cpp | #include "Uint.hpp"
#include <cctype>
#include <cmath>
#include <functional>
#include <random>
#include <sstream>
#include <stdexcept>
#include <algorithm>
#include <iostream>
/* constructeurs */
Uint::Uint() { *this = "0"; }
Uint::Uint(const uint64_t &val) { *this = val; }
Uint::Uint(const string &val) { *this = val... | TOOL | 0.953 | 6.260495 |
825e9bf4-75d7-4ba7-826a-e3e84e93d423 | yukikamome316/atcoder-archive | abc307/abc307_a_42902707_AC.cpp | /*
* Author: yukikamome316
* Submission URL: https://atcoder.jp/contests/abc307/submissions/42902707
* Submitted at: 2023-06-24 21:13:56
* Problem URL: https://atcoder.jp/contests/abc307/tasks/abc307_a
* Result: AC
* Execution Time: 5 ms
*/
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n)... | ALGO | 0.998193 | 3.979153 |
1e9bc088-eac2-46ad-a42a-e83670318edf | HL2303/coding-ninjas-Harshit | assignment 1/Sum of even & odd.cpp | /*
Write a program to input an integer N and print the sum of all its even digits and sum of all its odd digits separately.
Digits mean numbers, not the places! That is, if the given integer is "13245", even digits are 2 & 4 and odd digits are 1, 3 & 5.
*/
#include<iostream>
using namespace std;
int main() {
int n,ev... | ALGO | 0.999756 | 5.229354 |
a7b540f9-25c5-4044-82e8-6d910b2da25b | mohamedali559/Problem-Solving | CodeForces/C_Clock_and_Strings.cpp | /* بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
قَالَ رَبِّ اشْرَحْ لِي صَدْرِي (25) وَيَسِّرْ لِي أَمْرِي (26) وَاحْلُلْ عُقْدَةً مِّن لِّسَانِي (27) يَفْقَهُوا قَوْلي */
#include <bits/stdc++.h>
#define ln "\n"
typedef long long ll;
using namespace std;
void solve()
{
in... | ALGO | 0.999871 | 4.351232 |
34a8e01e-219c-4cb6-b050-fd049ad21d1d | sia162/LeetcodeQuestions | 389-find-the-difference/389-find-the-difference.cpp | class Solution {
public:
char findTheDifference(string s, string t) {
if(s.length() == 0)
return t[0];
int i;
for(i=0;i<t.length();i++){
if(count(s.begin(),s.end(),t[i]) != count(t.begin(),t.end(),t[i]))
break;
}
... | ALGO | 0.99984 | 6.248745 |
7600e30f-414f-4cd2-a10b-66ca54fb8724 | Ayushman444/Notes-and-Learnings | DSA&CP/Trie1.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
Node *links[26];
bool flag = false;
bool containsKey(char ch){
return (links[ch-'a']!=NULL);
}
void put(char ch, Node* node){
links[ch-'a']=node;
}
Node* get(char ch){
return links[ch-'a'];
}
void se... | ALGO | 0.999617 | 4.379582 |
457a9517-20fd-42c8-9b9c-67b652388f23 | Tarikjai/Cpp_Level1 | App/Files/Problem_11.cpp | #include <iostream>
#include <string>
using namespace std;
void readInput(int& Mark1, int& Mark2, int& Mark3)
{
cout << "Please insert input1: " << endl;
cin >> Mark1;
cout << "Please insert input2: " << endl;
cin >> Mark2;
cout << "Please insert Mark3: " << endl;
cin >> Mark3;
}
void PrintResult(int Mark1, ... | TOOL | 0.996748 | 4.030072 |
6c92f181-fded-4c40-8931-bd7c1d1999a3 | fmomos/MajorAbility | function/code4.cpp | // 6-4 2017final友元函数之全班同学的平均绩点
// 分数 15
// 作者 east
// 单位 福州大学
// 一个学生类,有三个私有成员:名字name、课程学分指针score、课程成绩指针grade。
// 定义一个友元函数,求全班同学的平均绩点。单门课程的学分绩点=学分*绩点=学分*(成绩/10-5) ;
// 全班同学的平均绩点是 所有同学的全部课程的学分绩点之和/所有同学学分数之和。
// 单个同学的课程数不超过100门。全班同学人数不超过100名。
// 输入说明:
// 输入若干行。
// 每行一个学生的信息:第一个输入是学生的名字,第二个输入是第一门课程的学分,
// 第三个输入是第一门... | ALGO | 0.997166 | 3.509571 |
5946fd27-df91-4880-b598-2ce61f1ea1bb | wynnie/hashrank | hashRank.cpp | #include "hashRank.h"
//The hash function
inline ub4 phash(ub4 val)
{
ub4 a, b, rsl;
val += 0xcfa2b1c8;
val ^= (val >> 16);
val += (val << 8);
val ^= (val >> 4);
b = val & 0x1fff;
a = (val + (val << 15)) >> 16;
rsl = rankLookup[(a^scramble[tab[b]])];
return rsl;
}
uint32 getRank (uint32 * cardU, uin... | ALGO | 0.998693 | 3.71913 |
7d288fa1-f9f8-427f-84c5-5ef6b242bcfc | Sourabh2001-dec/cp | string/4.cpp | #include <bits/stdc++.h>
using namespace std;
void getReverseSent(string str)
{
char *ch = new char[str.length()];
for (int i = 0; i < str.length(); i++)
{
ch[i] = str[i];
int found = 0;
for (int j = 0; j < i; j++)
{
if (str[i] == ch[j])
{
... | ALGO | 0.999499 | 3.866501 |
f04c3029-db23-4825-9714-96c3f2e02d6f | raincross7/code-similarity | codes/train_code/problem457/problem457_54.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(i... | ALGO | 0.999956 | 3.078568 |
05a21666-66cf-4b69-ae90-14439aebe911 | f1nalspace/final_game_tech | demos/dependencies/Box2D/Dynamics/b2World.cpp | #include <Box2D/Dynamics/b2World.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Dynamics/b2Island.h>
#include <Box2D/Dynamics/Joints/b2PulleyJoint.h>
#include <Box2D/Dynamics/Contacts/b2Contact.h>
#include <Box2D/Dynamics/Contacts/b2ContactSolver.h>
#include <Box2D/Collision... | ALGO | 0.96746 | 3.527572 |
b73d50c6-00e9-420e-9579-89cf6fd56f3c | sakurmoti/atcoder | ARC/112A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(){
int L,R;
cin >> L >> R;
//R-L=x, R-(L+1)=x-1, ... R-x=L の x-L+1個
//つまり(R-L)-L+1 = R-2L+1個
int count = (R-2L)+1;
long long sum = (1 + (R-2*L+1))*count/2;
cout << sum << endl;
return;
}
int main(){
int T;
cin >> T;
... | ALGO | 0.999952 | 4.080179 |
7d987fcc-0be8-4966-80e8-8923e8d91bc6 | ishandutta2007/codeforces | bigbag/normal/489/D.cpp | #include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
const int max_n = 3033, inf = 1111111111;
long long ans, x;
int n, m, a[max_n][max... | ALGO | 0.999795 | 3.983104 |
49fc0e1f-71b3-4f19-9f5c-e2a2b32a379a | MaximePremont/R-Type_Epitech | libs/boost/libs/math/src/tr1/cyl_bessel_jl.cpp | extern "C" long double BOOST_MATH_TR1_DECL boost_cyl_bessel_jl BOOST_PREVENT_MACRO_SUBSTITUTION(long double nu, long double x) BOOST_MATH_C99_THROW_SPEC
{
return c_policies::cyl_bessel_j BOOST_PREVENT_MACRO_SUBSTITUTION(nu, x);
}
| TOOL | 0.954052 | 3.014922 |
2e57edf7-586c-4404-91f4-6592e1f1292b | ketankauntia/dsa-questions | striver-sheet/4-array-medium/3-majority-element.cpp | // LC-169
//moores voting algo.
// add freq for same elems, subtract for diff.
class Solution {
public:
int majorityElement(vector<int>& nums) {
int freq=0, currElem=nums[0];
for(int i=0;i<nums.size();i++){
if(freq==0){
currElem=nums[i];
}
... | ALGO | 0.999895 | 5.8523 |
3dfdbe39-8278-46c8-8026-5f15a6dd9666 | axelu/leetcode | cpp/00500-00999/couplesholdinghands.cpp |
// 765. Couples Holding Hands
// https://leetcode.com/problems/couples-holding-hands/
class Solution {
public:
int minSwapsCouples(vector<int>& row) {
int n2 = row.size(); // n couples in 2xn seats
int n = n2/2;
unordered_map<int,int> um; // ID,seat
for(int i = 0; i < n2; ++i)
... | ALGO | 0.999906 | 5.660048 |
66e15102-0e3a-423f-9578-0f2286e46a10 | ishandutta2007/codeforces | zoli9/normal/1146/A.cpp | #include <bits/stdc++.h>
using namespace std;
string s;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>s;
int h=s.size();
int ac=0;
for(int i=0; i<h; i++)
{
if(s[i]=='a') ac++;
}
if(ac*2>h) {
cout<<h<<endl;
return 0;
}
cout<<2*ac-1<<endl;
... | ALGO | 0.999578 | 3.065592 |
6eb10679-53e9-4fe0-ad3f-b615e3261129 | mirtaba/ACMICPC-INOI_Archive | Olympiad Programs/Codeforces Contest/177/1.cpp | /*
ID: ghoolha1
PROG: greetings
LANG: C++
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#incl... | ALGO | 0.999857 | 3.245156 |
b1ea715e-d8d3-4059-abed-741e823dd651 | ANYCUBIC-3D/Kobra2_Neo | buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.cpp | #include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
// Pin number
const PinName digitalPin[] = {
PA_0, //D0
PA_1, //D1
PA_2, //D2
PA_3, //D3
PA_4, //D4
PA_5, //D5
PA_6, //D6
PA_7, //D7
PA_8, //D8
PA_9, //D9
PA_10, //D10
PA_11, //D11
PA_12, //D12
PA_13, //D13
PA_14,... | CONFIG | 0.898856 | 3.666803 |
779595d3-bfb7-4f88-8619-999aac3b9c32 | ishandutta2007/codeforces | zhouyuyang/normal/875/A.cpp | #include<bits/stdc++.h>
using namespace std;
int n,tot,mx;
int ans[100005],p[15],a[15],pre[15];
void dfs(int x,int v,int y){
if (v>pre[x]||v<0) return;
if (x==1){
if (v%p[1]==0)
ans[++tot]=y*10+v/p[1];
return;
}
for (int i=0;i<=9;i++)
dfs(x-1,v-p[x]*i,y*10+i);
}
int main(){
p[1]=1; scanf("%d",&n);
for (i... | ALGO | 0.999564 | 3.814197 |
be8ae6b6-d0a5-4bd0-8f31-a4655e12c540 | parkdoyun/algorithm_practice | dijkstra/baekjoon_9370.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
// 9370 - Ȯ
// dijkstra
// 2
// ִܰ ؾ
// gh θ ̼ϰ ־(1 ) ִ gh Ե ΰ ä ǵ
int n, m, t, g, h, a, b, d, x;
struct vertex
{
int num;
int dist = 100000000;
int visit = 0;
vector<int> path;
};
struct bus
{
int ... | ALGO | 0.999715 | 4.104487 |
b2ebe1a4-d3d1-45a8-8757-80641277d9b2 | lekhansh174a/Networking-Of-Nodes | Chocolates.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
long long int n;
cin>>n;
long long int a[n];
for(long long int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
long long int a1=a[0];
long long int b1=a[n-1];
long long int count1=0;
lo... | ALGO | 0.99936 | 3.752298 |
4ac2fa39-0d81-4dd6-9478-44f7731e0bd0 | currentnine/backjoon_solution | exercise/16964.cpp | #include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
using namespace std;
int n, a, b;
int order[100001];
bool check[100001];
vector<int> v[100001];
vector<int> dfs_v;
void dfs(int x) {
if(check[x]==true)
{
return ;
}
check[x] = true;
dfs_v.push_back(x);
for(aut... | ALGO | 0.999964 | 4.237096 |
477ca563-f6bd-42ad-b9cb-88487434976f | sofa-framework/issofa-merge | modules/SofaMiscCollision/DefaultCollisionGroupManager.cpp | #include <SofaMiscCollision/DefaultCollisionGroupManager.h>
#include <sofa/core/visual/VisualParams.h>
#include <SofaMiscCollision/SolverMerger.h>
#include <sofa/core/CollisionModel.h>
#include <sofa/simulation/Node.h>
#include <sofa/simulation/Simulation.h>
#include <sofa/core/ObjectFactory.h>
namespace sofa
{
names... | TOOL | 0.9957 | 6.69707 |
16a9228e-64b8-4eaf-98a4-12d1f9f3f442 | uvhw/uvhw.bitcoin.js | src/support/lockedpool.cpp | #include <support/lockedpool.h>
#include <support/cleanse.h>
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#ifdef WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
#else
#include <sys/mman.h> // for mmap
#include <sys/resource.h> // for getrlimit
#include <limits.h> // for PAG... | TOOL | 0.868023 | 7.546585 |
b3d6d824-9fb6-4aa0-940d-f9b1a59f0b43 | nenuon/CompetitiveProgramming | Atcoder/AGC010/B.cpp | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I... | ALGO | 0.999993 | 3.700195 |
1e563143-82d0-40f5-a16f-9bf8bfeb4c88 | SyedaFakhiraSaghir/Data-Structures | deletion AVL.cpp | class Node
{
public:
int key;
Node *left;
Node *right;
int height;
};
// A utility function to get maximum
// of two integers
int max(int a, int b);
// A utility function to get height
// of the tree
int height(Node *N)
{
if (N == NULL)
return 0;
return N->height;
}
// A utilit... | ALGO | 0.999993 | 6.301912 |
00ceabba-0b9c-4c1a-a981-6f40358fa7f6 | gouravmarch20/journey-javascript | dsa/advanceDsa/nl-dsa/w2-practice/buySellStock/i.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
int main()
{
// Your code here
vector<int> prices = {7, 1, 5, 3, 6, 4};
int maxProfit = 0;
int minPrice = INT_MAX;
for (int i = 0; i < prices.size(); i++)
{
minPrice = min(minPrice, price... | ALGO | 0.996211 | 4.944203 |
172dee8b-d7f2-4962-847c-7e3b22772fc5 | dharmesh-kashyap/MCA | MCA Semester 2/DSA/DSA lab/Week2/SparseMatrix.cpp | #include<iostream>
using namespace std;
struct array1 {
int arr[100];
};
int main() {
int row, column, size = 0; // Initialize size to 0
cout << "Enter row: " << endl;
cin >> row;
cout << "Enter column: " << endl;
cin >> column;
int M[row][column];
// Input matrix elements
cout... | ALGO | 0.99982 | 4.635524 |
263261f3-52e7-4cfc-b8b7-54ddd76d45f6 | MShahbazh/24K-0884_OOP-Lab | Lab 02/Task 3.cpp | #include<iostream>
using namespace std;
struct Employees{
string name;
int hoursWorked;
int hourlyRate;
};
Employees* Input(Employees* data, int num){
int i;
cout<<"\n--- Input Data ---"<<endl;
for(i=0;i<num;i++){
cout<<"\nEnter the Data of Employee "<<i+1<<":"<<endl;
cout<<"En... | TOOL | 0.920695 | 3.832424 |
4d6de468-2ad2-472c-950a-577ad62d1fbe | agpmilli/3D-geometry | Project/code/3d_project/externals/nanogui/ext/eigen/doc/examples/DenseBase_template_int_middleRows.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(1..3,:) =\n" << A.middleRows<3>(1) << endl;
return 0;
}
| ALGO | 0.972818 | 3.245548 |
d2c99cc9-dc2d-4918-898a-88ed8493f65f | vfolunin/archives-solutions | LeetCode/2315.cpp | class Solution {
public:
int countAsterisks(string s) {
int in = 0, res = 0;
for (char c : s) {
if (c == '|')
in ^= 1;
else if (c == '*')
res += !in;
}
return res;
}
}; | ALGO | 0.999527 | 5.35499 |
5028d68d-7a06-498f-a21b-19faab937747 | ishandutta2007/codeforces | hank55663/normal/888/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define LL long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x... | ALGO | 0.999886 | 3.880533 |
50420299-8822-4592-8abf-b31e288d3a6a | SoumikSarkar24/DSA-in-Cpp-Assignment-Solutions | Special Algorithms Assignment Solutions/Prefix Sum Assignment Solution/Q_3_Score_Of_All_Prefixes_of_an_Array.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<long long> findPrefixScore(vector<int>& nums) {
int n = nums.size();
vector<long long int>res(n,0);
res[0] = 2*nums[0];
int maxi = nums[0];
// maxi = max(maxi , a[0]);
for(int i=1;i<... | ALGO | 0.999846 | 4.070155 |
48d34a8e-f510-4b82-9487-92f7487a8601 | sarvex/leetcode-f-sharp | lcci/17.19.Missing Two/Solution.cpp | class Solution {
public:
vector<int> missingTwo(vector<int>& nums) {
int n = nums.size() + 2;
int eor = 0;
for (int v : nums) eor ^= v;
for (int i = 1; i <= n; ++i) eor ^= i;
int diff = eor & -eor;
int a = 0;
for (int v : nums)
if (v & diff) a ^= ... | ALGO | 0.999674 | 5.375541 |
dcd12b25-1791-474d-89bb-6ef80d2c629b | DLLeslie/Reverse-Engineering | Module 6 Repaired C++ Code/Module 6 Repaired C++ Code.cpp | #include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
double v1 = 0.0; //changed to double so if user enters a decimal the application works
while (v1 != 4) { //changed to v1 != 4 instead of 5 so the user can quit by entering 4
//displaying menu to user
puts(" ");
puts("E... | TOOL | 0.926729 | 3.236852 |
f762767c-cbdc-482d-aaef-2cf48ff347d8 | Pentacode-IAFA/Quad-Remeshing | libs/quadwild/libs/libigl/include/igl/normalize_row_sums.cpp | template <typename DerivedA, typename DerivedB>
IGL_INLINE void igl::normalize_row_sums(
const Eigen::MatrixBase<DerivedA>& A,
Eigen::MatrixBase<DerivedB> & B)
{
#ifndef NDEBUG
// loop over rows
for(int i = 0; i < A.rows();i++)
{
typename DerivedB::Scalar sum = A.row(i).sum();
assert(sum != 0);
}
#e... | ALGO | 0.989751 | 3.816028 |
25050c5c-700a-40a9-bd9a-da6e785857ef | thangitus/LeetCode-Solution | C++/Sorting/164. Maximum Gap.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int maximumGap(vector<int> &nums) {
sort(nums.begin(), nums.end());
int result = 0;
for (int i = 1; i < nums.size(); ++i)
result = max(result, nums[i] - nums[i - 1]);
return result;
}
}; | ALGO | 0.999701 | 4.540082 |
1f5764e5-bf38-428b-99fe-d30b71b649ca | ankitjainhere/Data-Structures-and-Algorithms | DataStructures/Array/AddOneToNumber | InterviewBit.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> plusOne(vector<int> &A) {
int n = A.size();
A[n - 1] += 1;
int carry = A[n - 1] / 10;
A[n - 1] = A[n - 1] % 10;
for (int i = n - 2; i >= 0; i--) {
if (carry == 1) {
A[i] += 1;
carry = A[i] / 10;
... | ALGO | 0.999854 | 4.828691 |
3c2202a4-5236-43fa-8e31-cb9fcadf0709 | ishandutta2007/codeforces | square1001/normal/789/A.cpp | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int n, m, x;
int main() {
scanf("%d %d", &n, &m);
long long ret = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &x);
ret += (x + m - 1) / m;
}
printf("%lld\n", (ret + 1) / 2);
retur... | ALGO | 0.999938 | 3.514281 |
9abe18af-5c8a-4b89-9dd3-ea05c14dd8b4 | ishandutta2007/codeforces | bmerry/normal/622/A.cpp | //#pragma GCC optimize("O3")
//#pragma GCC target("arch=corei7-avx")
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
# include <sys/time.h>
# include <sys/resource.h>
#endif
/*** TEMPLATE CODE STARTS HERE ***/
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795028841971693993751
#endif
using namespace std;
ty... | ALGO | 0.999608 | 3.686538 |
63111ae8-2a58-461c-ade9-e1b219c4a2ba | aichitudou123/k230_SDK | src/big/unittest/testcases/cpp_tc/src/condition_variable/1.cpp | #include <condition_variable>
#include <iostream>
#include <mutex>
#include <sstream>
#include <thread>
#include <vector>
using namespace std;
std::mutex mtx;
std::condition_variable cv;
bool ready = false;
void string_split(const string &str, const char split, vector<string> &res)
{
... | TEST | 0.870674 | 4.147996 |
b4c9f185-84e7-4dfe-8f23-dbc961931ed2 | biorobaw/EagleEyeVision-S2019 | Pi UDP Networking/PiBot (Python)/opencv-4.0.1/modules/objdetect/src/qrcode.cpp | #include "precomp.hpp"
#include "opencv2/objdetect.hpp"
#include "opencv2/calib3d.hpp"
#ifdef HAVE_QUIRC
#include "quirc.h"
#endif
#include <limits>
#include <cmath>
#include <iostream>
#include <queue>
namespace cv
{
using std::vector;
class QRDetect
{
public:
void init(const Mat& src, double eps_vertical_ = 0... | ALGO | 0.997521 | 4.643571 |
ceba0d83-1f27-48c9-b724-77e9984d819e | st094830/2023-cpp-autumn | 2023-13.10-Test/2023-10.10-Test/Task2f/Source2f.cpp | #include <iostream>
#include <cstdlib>
int main(int argc, char* argv[])
{
int n = 0;
std::cin >> n;
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < n; ++j)
{
std::cout << (abs((n + 1) * (i % 2) - (j + 1))) << " ";
}
std::cout << std::endl;
}
return EXIT_SUCCESS;
}
| ALGO | 0.999881 | 3.768983 |
befe8432-d810-44ad-94f3-e9ba65c8bcb5 | CyberChic7/SoC-24 | assigment_1/q5.cpp | #include<iostream>
#include<vector>
using namespace std;
int main()
{
int t;
cin>>t;
int n,k;
for (int i=0;i<t;i++)
{
cout<<"Enter test case no:"<<i+1<<endl;
cin>>n>>k;
vector<int>numbers(n); //vector of size n is created
... | ALGO | 0.999771 | 4.142844 |
56afd1f1-5e13-42db-af07-1725fde66658 | lionkor/forces | main.cpp | #include <SFML/Graphics.hpp>
#include <ctime>
#include <fstream>
#include <glm/ext.hpp>
#include <glm/glm.hpp>
#include <glm/gtx/rotate_vector.hpp>
#include <glm/gtx/vector_angle.hpp>
#include <iostream>
#include <random>
#include <sstream>
using glm::vec2;
sf::RenderWindow window(sf::VideoMode(1280, 720), "forces");... | TOOL | 0.900959 | 4.864525 |
09c769d6-abe5-4af8-91e1-7ad4f7563e34 | ThomasZapel/Aerospace-Coding | DataStructures_CSCI2270/FinalProject_MovieDatabase_HashTable_SkipList/MovieHashTable.cpp | #include<iostream>
#include <vector>
#include "MovieHashTable.hpp"
using namespace std;
// Constructor for MovieHashTable with default size
/*
* MovieHashTable - Default Hash Table constructor
*
*/
MovieHashTable::MovieHashTable() {
table_size = DEFAULT_HTABLE_CAPACITY;
n_collisions = 0;
table = new Movie... | ALGO | 0.994189 | 4.880417 |
82d2c5ae-a498-4ae9-835e-dcf822798043 | Yash59ops/Leetcode-Solution | Allocate minimum number of pages - GFG/allocate-minimum-number-of-pages.cpp | //{ Driver Code Starts
// Initial template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template in C++
class Solution
{
public:
//Function to find minimum number of pages.
bool ispossible(int a[],int size,int total_stu,int mid){
int stu=1;
i... | ALGO | 0.999945 | 6.275898 |
d1fb42dd-3a57-4ebb-ace0-44b753363b58 | gabrielboisvert/Portal3 | Dependencies/Bullet/include/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp | #include "btSoftBodyConcaveCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btMultiSphereShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionShapes/btConcaveShape.h"
#include "Bulle... | ALGO | 0.998883 | 6.983976 |
249bcbfc-546d-4f97-909c-cf71b4782b4e | oscarjgv24/LaguerreMPC | MPC Class/MPC.cpp | #include "MPC.h"
void MPC::begin(float theta0[3],float r0, float a0, float dt0) {
for(int i=0;i<3;i++){
theta[i]=theta0[i];
osi.theta[i]=0;
}
osi.theta[3]=0;
dt=dt0;
r=r0;
a=a0;
GetLaguerre(a,L);
GetSS(theta,dt,A,B,C);
// LQR(P,A,B,C,r,100,1,Kx);
Laguerre_MPC(A,B,C,r,L,Kx);
}
void MPC::move... | ALGO | 0.988235 | 3.599167 |
f56daad4-c0fd-4d77-a64b-34495dc009e9 | Kawser-nerd/CLCDSA | Source Codes/AtCoder/abc050/A/3336109.cpp | #include<iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
int a, b;
string op;
cin >> a >> op >> b;
if(op == "+") cout << a+b << endl;
else cout << a-b << endl;
} | ALGO | 0.999874 | 4.166933 |
c162e060-29d1-4676-9e60-c9d5dee2dc27 | tejasekhande1/PPA_C_CPP_DS | Cpp/ExceptionHandling/Demo1.cpp |
#include <iostream>
using namespace std;
class Divide{
int x,y ;
// float ans;
public:
Divide(int x , int y){
this->x = x ;
this->y = y ;
}
void fun(){
try {
if(y == 0){
throw "Divide by zero";
} else {
cout<< x/y <<endl;
}
} catch(const char *str){
cout <<"Exception : "... | TOOL | 0.944444 | 4.382005 |
022a66d3-332b-4092-951f-89d9989af6a5 | huylq1808/Leetcode | Day0-9/Day3_16-07-24/lec7_ReverseInterger/main.cpp | #include <iostream>
class Solution {
public:
int reverse(int x) {
int reverseNum = 0;
int temp = 0;
while(x != 0){
temp = x % 10;
x /= 10;
if (reverseNum > INT_MAX / 10 || (reverseNum == INT_MAX / 10 && temp > 7)) {
return 0; //... | ALGO | 0.999328 | 5.352013 |
d3369d9f-82cd-4f4c-b9a5-22fb5b3b5669 | khalidsr/1337_projects | all_cpp/cpp_08/ex01/Span.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Span.cpp :+: :+: :+: ... | ALGO | 0.885679 | 4.689199 |
37bb89f3-65a5-479a-890f-7ae6431ac671 | mazen-tech/WebSer_new | src/server_config/find_file.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* find_file.cpp :+: :+: :+: ... | TOOL | 0.89066 | 5.425828 |
c8fd090c-f367-43d3-bcac-2e6e195ed1fa | mwashief/step | Codeforces/1251-1500/1491/1491D.cpp | /*
Washief Hossain Mugdho
21 March 2021
Codeforces 1491 1491D
*/
#ifndef DEBUG
#pragma GCC optimize("O2")
#endif
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define fastio ios_base::sync_with_stdio(0)
#define untie cin.tie(0)
#define rep(i, n) for ... | ALGO | 0.999893 | 5.026085 |
08e9049b-7b2b-4554-b637-852bf2d52881 | iov-one/wallet-core-wip | src/PrivateKey.cpp | #include "PrivateKey.h"
#include "PublicKey.h"
#include <TrezorCrypto/bignum.h>
#include <TrezorCrypto/ecdsa.h>
#include <TrezorCrypto/ed25519-donna/ed25519-blake2b.h>
#include <TrezorCrypto/memzero.h>
#include <TrezorCrypto/nist256p1.h>
#include <TrezorCrypto/rand.h>
#include <TrezorCrypto/schnorr.h>
#include <Trezo... | TOOL | 0.868824 | 7.011595 |
6f665af3-b9ef-4803-a3d3-ae823a0693ff | TomaSajt/prog-solutions | NT-Online/2023/round-5/Monoton rendezes.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0), ios::sync_with_stdio(0);
int n;
cin >> n;
vector<pair<int, int>> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i].first;
v[i].second = i;
}
sort(v.begin(), v.end());
int res = 1;
for (int i = 1; i < n; i++) {
if (v[i - ... | ALGO | 0.999945 | 4.687013 |
550fc764-554f-498d-afc1-17d10e24338c | keirond/problems | cfs/done/961E.cpp | #include <bits/stdc++.h>
using namespace std;
constexpr char nl [[maybe_unused]] = '\n';
// --------------------------------------------------------------------------
template <typename T> void __info(const T &x);
template <typename T, typename V> void __info(const pair<T, V> &x);
template <typename T, typename V, ... | ALGO | 0.999975 | 5.126853 |
0f46debc-979b-48c6-b6be-e5758c440c74 | liubang/leetcode | src/144.binary-tree-preorder-traversal.cpp | // Authors: liubang (<EMAIL>)
#include <gtest/gtest.h>
#include <vector>
#include "tree.h"
namespace {
class Solution {
public:
using TreeNode = leetcode::tree::TreeNode;
std::vector<int> preorderTraversal(TreeNode* root) {
std::vector<int> ret;
visit(&ret, root);
return ret;
}
... | ALGO | 0.999502 | 7.131715 |
8305a420-5ea3-4cc4-bf74-43ecc092bad0 | pranavsindura/CompetitiveProgramming | codeforces/B/520b.cpp | #include<bits/stdc++.h>
#define ll long long int
#define pii pair<int,int>
#define mod 1000000007
#define eps 0.000000001
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define mp make_pair
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)... | ALGO | 0.999997 | 3.179763 |
f6b23f28-dbd0-4220-a833-60c3878832d7 | phight305/llvm-porting | lib/CodeGen/MachineBranchProbabilityInfo.cpp | #include "llvm/Instructions.h"
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
INITIALIZE_PASS_BEGIN(MachineBranchProbabilityInfo, "machine-branch-prob",
... | ALGO | 0.958422 | 7.545897 |
745aff3d-4ca0-4799-8b32-5593a5fb27e5 | animesh-singhal/SDC_Path_Planning | src/main.cpp | #include <uWS/uWS.h>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include "Eigen-3.3/Eigen/Core"
#include "Eigen-3.3/Eigen/QR"
#include "helpers.h"
#include "json.hpp"
#include "spline.h"
// for convenience
using nlohmann::json;
using std::string;
using std::vector;
using std::cout;
usin... | WEB | 0.962871 | 3.399711 |
4650e512-baf8-491d-9050-bd980f0a6eb1 | yadavikash19/dsa_withCPlusPLus | array.cpp | #include <iostream>
using namespace std;
//Function for Pass by Reference
void changeArr(int arr[], int size){
for(int i=0; i<size; i++){
arr[i]=arr[i]*2;
}
}
int main(){
//Finding max in array
int marks[3]={10,-1,2};
int max=0;
for(int i=0; i<3; i++){
if(max<marks[i]){
... | ALGO | 0.96952 | 3.924112 |
c3afad72-9de0-4d21-9982-f4af8d6a2f99 | amenoyoya/old-project | c/shooting/C++lua/old/龍神録/番外2章/mydat/source/out_lazer.cpp | #include "../include/GV.h"
#include <math.h>
#include <stdio.h>
/* QxNg */
typedef struct {
double x, y;
} Vector2_t;
/* diff xNg p - q */
void Vector2Diff(Vector2_t *diff, const Vector2_t *p, const Vector2_t *q){
diff->x = p->x - q->x;
diff->y = p->y - q->y;
}
/* xNg p q ̓ */
double Vector2InnerProduc... | ALGO | 0.99972 | 3.697775 |
4bda7e88-c607-4191-be18-ef81ddf6ee51 | LINGLI97/CPM | stxxl/tests/common/test_winner_tree.cpp | #include <stxxl/bits/common/winner_tree.h>
#include <stxxl/bits/verbose.h>
#include <stxxl/random>
#include <stxxl/types>
using stxxl::unsigned_type;
//! Comparator interface for the winner tree: takes two players and decides
//! which is smaller. In this implementation the players are the top elements
//! from an ar... | TEST | 0.931007 | 6.368845 |
9bb1795e-f565-4da2-90ce-b77b762ba477 | HarshSantoshi/DSA | Trees/Kpathsum.cpp | //https://practice.geeksforgeeks.org/problems/k-sum-paths/1
#include<bits/stdc++.h>
#include<iostream>
#include <map>
#define ll long long
class Node {
public:
int data;
Node * left ;
Node * right;
Node (int data){
this->data = data;
left = NULL ;
right = NULL;
}
};
int ... | ALGO | 0.99991 | 4.767811 |
591c50d6-9bac-43e5-8069-b5f2f9ed4f40 | wlf1998/Algorithm | OptimalSchedule/OptSd.cpp | #include <iostream>
#include <ctime>
#include <random>
#include <iomanip>
#define INFINITY 999999999 //INFINITY=999999999
#define MAXSIZE 100 //
using namespace std;
//ȫֱ
//int N, K; //NK:
//int taskTime[MAXSIZE];
int taskTime1[MAXSIZE] = { 47, 20, 28, 44, 21, 45, 30, 39, 28, 33 };
int ... | ALGO | 0.999798 | 3.273787 |
6aaa869b-0ab8-4637-8381-7e8079e75cb1 | Amitten77/IML-Paintability | c/src/board_apply_moves.cpp | #include "board.h"
bool Board::apply(const PusherMove& move) {
size_t n = this->n_;
size_t k = this->k_;
bool result = false;
for (size_t encodedIndex : move) {
size_t c = encodedIndex / k;
size_t idx = encodedIndex % k;
// Skip invalid chip
if (c >= n || idx >= k) {
... | ALGO | 0.938302 | 6.275674 |
a5552d62-bb54-440e-9029-f58b44697572 | hameem008/DSA_1 | List_and_LRU_Cache/LRU_Cache_implementation.cpp | #include <iostream>
#include "ArrayBasedMyList.h"
// #include "LinkedListBasedMyList.h"
using namespace std;
template <class K, class V>
class LRUCache
{
private:
int lruSize;
int lruCapacity;
MyList<K> keyList;
MyList<V> valueList;
public:
LRUCache(int capacity)
{
lruCapacity = capaci... | ALGO | 0.990323 | 5.161733 |
7b545483-d491-4c14-9b9b-fab833d36a89 | drgavrikov/leetcode-cpp | Problem1915/src/Problem1915.cpp | #include <string>
#include <cassert>
/**
* @author Aleksandr Gavrikov
* @url https://leetcode.com/problems/number-of-wonderful-substrings/solutions/5093288/bit-manipulation-solution-with-linear-complexity/
*/
class Problem1915 {
public:
long long wonderfulSubstrings(std::string word) {
const int size = ... | ALGO | 0.999743 | 6.451558 |
a55b7054-5a0e-44d2-b639-c51a4769386e | Xtarii/OSSE-Core | src/algorithm/Algorithm.cpp | #include "../../headers/algorithm/Algorithm.h"
#include "../../headers/core.h"
using namespace OSSE;
string_set Algorithm::analyzeText(std::string text, string_list &config) {
string_set result;
for(std::string tag : config) {
std::string a = OSSE::toLower(text);
std::string b = OSSE::toLower... | WEB | 0.922975 | 5.158678 |
1eb1cc43-acb7-48ae-b454-1ea03d999730 | arifaulakh/Competitive-Programming | USACO/2019-2020/December/P2/main.cpp | #include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define MAXN 1000006
#define endl "\n"
#define readln(x) getline(cin, x);
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef ma... | ALGO | 0.999975 | 3.800597 |
0e5688f8-9b29-4386-8a50-2ce259d6efea | Krysed/Codewars | C++/nthSmallestElement(ArraySeries#4)/nthSmallestElement(ArraySeries#4)/nthSmallestElement(ArraySeries#4).cpp | /*
Introduction and warm-up (highly recommended): Playing With Lists/Arrays Series
Task
Given an array/list of integers, find the Nth smallest element in the array.
Notes
Array/list size is at least 3.
Array/list's numbers could be a mixture of positives , negatives and zeros.
Repetition in array/list's numbers could... | ALGO | 0.999945 | 6.347918 |
4a4620b8-69a8-4ef3-a846-b44e45b61e05 | CodewithAsh10/CPP | factorial.cpp | #include <iostream>
using namespace std;
int fact(int n) {
if (n==0 or n==1) {
return 1;
}
return n*fact(n-1);
}
int main() {
// Factorial using Loops
int n;
cout<<"Enter the number: ";
cin>>n;
int fac = 1;
int i = 1;
while (i<=n) {
fac = fac*i;
i++;
}
... | ALGO | 0.999846 | 4.490485 |
ccfa2ad2-66d7-4c03-ad7d-16dec4d92162 | SAITARUN55/CodeChef | August 2020 Long Challenge/CRDGAME3/Another Card Game Problem.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
ll tc;
cin>>tc;
while(tc--)
{
ll cpc,rpr;
cin>>cpc>>rpr;
ll resC=ceil((double)cpc/9.0);
ll resR=ceil((double)rpr/9.0);
if(resR<=resC)
cout<<"1 "<<resR<<"\n";
else
cout<<"0 "<<resC<<"\n";
}
}
| ALGO | 0.999298 | 3.844412 |
7d4bac84-220b-4583-821f-c9641d784ec5 | ishandutta2007/codeforces | dancho/normal/158/A.cpp | #include <cstdio>
#include <cstring>
int n, k, a[1024];
int main()
{
int i, j;
scanf( "%d %d", &n, &k );
for ( i = 1; i <= n; i++ )
{
scanf( "%d", &a[i] );
}
if ( a[k] > 0 )
{
j = k;
while ( ( j+1 <= n ) && ( a[j+1] == a[k] ) )
{
j++;
}
printf( "%d\n", j );
}
else if ( a[k] == 0 )
{
j =... | ALGO | 0.999958 | 4.095218 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.