uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
12b1b300-b00a-462d-b1ac-d48f45b91556 | sarvex/leetcode-nim | lcof/面试题43. 1~n整数中1出现的次数/Solution.cpp | class Solution {
public:
int countDigitOne(int n) {
int a[12]{};
int f[12][12];
memset(f, -1, sizeof f);
int i = -1;
for (; n; n /= 10) {
a[++i] = n % 10;
}
function<int(int, int, bool)> dfs = [&](int pos, int cnt, bool limit) -> int {
... | ALGO | 0.999932 | 6.502571 |
25b1c283-69a2-491a-9b90-d196eefc8b62 | MrMefodij/LeetCode | 83_deleteDuplicates/main.cpp | #include <iostream>
#include "../test_runner/ListNode.h"
#include "../test_runner/test_runner.h"
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
if (head == NULL || head->next == NULL) {
return head;
}
ListNode *result;
ListNode *first;
boo... | ALGO | 0.998269 | 5.862446 |
ae1c6e49-1ed3-4bac-8d12-df3f291e9c12 | DrZhang818/my-first-project | Problems/Codeforces/Contests/Round1005/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> PII;
void solve(){
int n;
cin >> n;
vector<int> a(n);
unordered_map<int,int> mp;
for(int i = 0; i < n; i++) {
cin >> a[i];
mp[a[i]]++;
}
int mx = 0, l = 0, r = 0;
... | ALGO | 0.999954 | 4.26983 |
8ba7e2af-84fd-41b7-8c83-1ac6fd77d725 | vinodindi8701/CodeLibrary | 1631A.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define pi pair<in... | ALGO | 0.999965 | 3.672438 |
769c0c84-bf53-44c6-bc34-448904048bff | pdeitel/CPlusPlus20FullThrottlePart1 | examples/libraries/math-boost-1.81.0/example/cardinal_cubic_b_spline_example.cpp | #include <iostream>
#include <limits>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <iterator>
#include <cmath>
#include <random>
#include <cstdint>
#include <boost/random/uniform_real_distribution.hpp>
#include <boost/math/tools/roots.hpp>
//[cubic_b_spline_example
/*`This example demonstrates h... | ALGO | 0.99995 | 7.066696 |
7daf229d-d406-4cf1-bdf9-af2f070904ce | DongTao/DataStructurePractice | heapsort/heapsort_unittest.cpp | #include <vector>
#include "heapsort.h"
#include "gtest/gtest.h"
using namespace std;
TEST(HeapSort, Empty) {
vector<int> vec;
EXPECT_TRUE(HeapSort(vec).empty());
}
TEST(HeapSort, SingleValue) {
vector<int> vec = {67};
vector<int> result = HeapSort(vec);
EXPECT_TRUE(result.size() == 1 && result[0... | TEST | 0.8742 | 6.331361 |
a6108a81-44fd-4d83-ab9c-211a02901dc5 | tahshina01/C | Stack/mulParen.cpp | #include<bits/stdc++.h>
using namespace std;
bool areBracketsBalanced(string expr){
stack<char> s;
char x;
for (int i = 0; i < expr.length(); i++){
if (expr[i] == '(' || expr[i] == '[' || expr[i] == '{'){
s.push(expr[i]);
continue;
} if (s.empty()) return false;... | ALGO | 0.993604 | 4.969687 |
43ba7ab5-a170-4a1d-a814-cfd86d579aca | dgonzalezwu/Computer-Science-1 | Lab-2/problem5.cpp | #include <iostream>
using namespace std;
int main()
{
int num1, num2, total;
cout<<"Please input the first number to be used to find the sum."<<endl;
cin >> num1;
cout<<"Please input the second number to be used to find the sum."<<endl;
cin >> num2;
total = num1 + num2;
cout<<"The sum of th... | TOOL | 0.921043 | 3.853614 |
64b7de84-66d7-4d00-9e7e-b24fb4205b83 | anan416/c-secundario | C++ ejercicios/LPOO2023_S03_01_Culeddu_Ana_Clara/Archivos.cpp | #include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <stdio.h>
#include <ctype.h>
#include <fstream>
#include <algorithm>
#include <cstring>
#include "Archivos.h"
using namespace std;
void Archivos::guardar(string palabras[], string palindromas[]){
ofstream verbos, palabra, capicuas;... | TOOL | 0.976937 | 3.583844 |
865f9078-68ab-4043-8c5c-1f7339b525dd | taliBerman5/despot_automatedExperiments | examples/cpp_models/tag/src/tag_no_opp_observation/tag_no_opp_observation.cpp | #include <queue>
#include "tag_no_opp_observation.h"
#include <despot/util/coord.h>
#include <despot/util/floor.h>
using namespace std;
namespace despot {
/* =============================================================================
* Tag class
* ================================================================... | ALGO | 0.998917 | 5.337229 |
35cbec80-e814-42a0-aa4c-982a103aa6e5 | daliziBest/leetcode | solution114v1.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.999981 | 5.809927 |
efd8e36f-0e46-4135-9b2e-c34a954a6244 | StarN2uk/Algorithm-Theory | 보충2/Untitled6.cpp |
#include<stdio.h>
int main()
{
int i, j, n, max = 0, d[1001], a[1001]; scanf("%d", &n);
for (i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
}
for (i = 1; i <= n; i++)
{
d[i] = 1;
for (j = 1; j < i; j++)
{
if (a[j] < a[i] && d[i] < d[j] + 1)
{
d[i] = d[j] + 1;
}
}
if (max < d[i])
{
max =... | ALGO | 0.99969 | 3.427663 |
0f72b582-b52d-431d-8838-443c1a4c8834 | guillaumemilitello/cpp_utils | lib/design_patterns/behavioral/visitor.cpp | #include <iostream>
#include <vector>
#include <memory>
struct A1;
struct A2;
// The Visitor interface declares a set of visiting methods that correspond to the exact class of the component
struct Visitor
{
virtual ~Visitor() = default;
virtual void visitA1(const std::shared_ptr<const A1>& a1Ptr_) const = 0;... | TOOL | 0.969757 | 7.674919 |
0b0c42fe-39c0-4850-aef8-eb707da85c91 | luisacaetano/Fundamentos-da-Programacao-de-Computadores-3-edicao | Cap03_Luisa_Caetano/Res20_Cap03.cpp | /*
Faça um programa que receba a medida do ângulo (em graus) formado por uma escada apoiada no
chão e encostada na parede e a altura da parede onde está a ponta da escada. Calcule e mostre a medida dessa escada.
Observação: as funções trigonométricas implementadas nas linguagens de programação trabalham
com medidas d... | ALGO | 0.961588 | 4.666513 |
8114fa91-8316-4076-8337-c876e6fd6a16 | wyf2552/c-learn | pku-c++/array_overload.cpp | #include <iostream>
#include <array>
using namespace std;
class Array {
private:
string name;
int count;
int * data;
public:
Array();
Array(string name, const int * data, int count);
~Array();
void print();
void order();
Array add(const Arr... | ALGO | 0.999383 | 4.235721 |
cbe7aab6-a685-4aa3-b61c-63dcf67546ec | SanaKamboj/Interviews | MinElementQueue.cpp | std::priority_queue<int, std::vector<int>, std::greater<int> > my_min_heap;
#include <bits/stdc++.h>
using namespace std;
int main(void) {
priority_queue<int, vector<int>, greater<int> > pq;
pq.push(40);
pq.push(320);
pq.push(42);
pq.push(42);
pq.push(65);
pq.push(12);
pq.push(245);
cout<<pq.top()<<endl... | ALGO | 0.998899 | 4.423122 |
572ceb06-0bcd-4554-9951-1d73688b0a94 | Sachinooo7/DSA-problems | 0520-detect-capital/0520-detect-capital.cpp | class Solution {
public:
bool detectCapitalUse(string word) {
int c=0;
for(int i=0;i<word.size();i++){
if(word[i]>='A' && word[i]<='Z'){
c++;
}
}
if(c==word.size() || c==0) return true;
if(c==1 && (word[0]>='A' && word[0]<='Z'... | ALGO | 0.99986 | 6.160803 |
34c87f37-1f4d-4cc1-af6b-f517e1734a96 | zhoucatcat/support_cpu0 | libc/src/math/remainder.cpp | #include "src/math/remainder.h"
#include "src/__support/common.h"
#include "utils/FPUtil/DivisionAndRemainderOperations.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(double, remainder, (double x, double y)) {
int quotient;
return fputil::remquo(x, y, quotient);
}
} // namespace __llvm_libc
| TOOL | 0.986622 | 6.430557 |
9ac98abc-5969-407a-ae05-615647a6f16e | ttamx/Competitive-Programming | codeforces/2080B.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n,m;
ll t;
cin >> n >> m >> t;
vector<ll> a(n+1),b(m+1);
for(int i=1;i<=n;i++){
cin >> a[i];
}
for(int i=1;i<=m;i++){
cin >> b[i];
}
aut... | ALGO | 0.999988 | 4.492735 |
dba5fb48-1cd7-4b34-8991-299c550f93f4 | Sunny-178/DSA | DSA/1. Data Structures/03.Stack/05.inToPost.cpp | #include <bits/stdc++.h>
using namespace std;
int outpre(char c)
{
if(c=='+' || c=='-')
return 1;
else if(c=='/' || c=='*')
return 3;
else if(c=='^')
return 6;
else if(c=='(')
return 7;
else
return -1;
}
int inpre(char c)
{
if(c=='+' || c=='-')
ret... | ALGO | 0.999956 | 4.710739 |
9126e12c-8c8d-4e0f-9e19-73ec8d19a22b | Nellaoui/CPP-Module-09 | ex01/RPN.cpp | #include "RPN.hpp"
/*
** ------------------------------- CONSTRUCTOR --------------------------------
*/
RPN::RPN()
{
}
RPN::RPN( const RPN & src )
{
*this = src;
}
/*
** -------------------------------- DESTRUCTOR --------------------------------
*/
RPN::~RPN()
{
}
/*
** --------------------------------- OVERLO... | ALGO | 0.995573 | 4.415462 |
0f0966bb-0633-44aa-910f-3ee28bb2e035 | harshitspakhariya/CP.begin-- | temp.cpp | #include <iostream>
using namespace std;
template <typename T> T myMax(T x,T y)
{
return x>y?x:y;
}
int main()
{
cout<<myMax(3,7)<<endl;
cout<<myMax('g','e')<<endl;
cout << myMax<int>(3, 7) << endl; // Call myMax for int
cout << myMax<double>(3.0, 7.0)<< endl; // call myMax for double
cout << my... | ALGO | 0.967229 | 4.110157 |
c92ce52b-cd4e-4d25-8de9-63b6103fb796 | dbdxnuliba/controller_agv_good | src/modules/tracker/adrc/adrc_base.cpp | #include "adrc_base.h"
namespace adrc
{
adrc_base::adrc_base(const double &h,const double &r)
{
state_td_v1_ = 0.0;
state_td_v2_ = 0.0;
para_td_r_ = r;
para_h_ = h;
limit_up_ = 1e9;
limit_down_ = -1e9;
}
adrc_base::~adrc_base()
{
}
int adrc_base::Sign(double val)
{
if (val > DBL_EPSILON)
... | ALGO | 0.9983 | 4.82526 |
5d999cfd-b7cd-4935-ab9a-e7de5508ed3c | ICTMubarak/XPSC_Batch-3_Practice | Week-2/Day-3/U-Marathon.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
int a,b,c,d; cin>>a>>b>>c>>d;
int count=0;
if(b>a) count++;
if(c>a) count++;
if(d>a) count++;
cout<<count<<endl;
}
return 0;
} | ALGO | 0.99285 | 3.5125 |
94f85cd7-180b-47e4-915b-5f4c9792bf80 | Chinhpham204719/LeetCode | Math/Maximum Number of Groups With Increasing Length.cpp | class Solution {
public:
int maxIncreasingGroups(vector<int>& lim) {
sort(lim.begin(),lim.end());
int cnt=0;
long long sm=0;
for(auto x:lim){
sm+=x;
if(sm >= cnt+1){
sm-=(cnt+1);
cnt++;
}
}
return cn... | ALGO | 0.999953 | 5.37082 |
cbf27dea-d939-41a7-944f-2a8d8a147bcf | alipha/cpp | misc/integer_set.cpp | #include <cstddef>
#include <set>
struct integer_range {
integer_range(std::size_t value) : first(value), last(value) {}
mutable std::size_t first;
mutable std::size_t last;
};
bool operator<(integer_range left, integer_range right) {
return left.first < right.first;
}
struct integer_set {
integ... | ALGO | 0.991796 | 5.578023 |
fa1df2f5-0b65-4331-8b9d-56b8c8d47b81 | mizripov/developer | dz/файловая база данных, рекурсия, бинарные деревья/3/dz_2.3.cpp | #include <iostream>
#include <iomanip>
using namespace std;
class Stack
{
public:
Stack()
{
top = nullptr;
size = 0;
}
~Stack()
{
clear();
}
void push(const double value)
{
if (top == nullptr)
{
top = new Node(value);
}
else
{
top = new Node(value, top);
}
size++;
}
void pop()
{
... | ALGO | 0.998555 | 4.281666 |
7217cdd9-7361-4e53-85b7-45efd81b3a4d | koulurybenarji123/DSA | trees/VerticalOrder.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
Node(int val)
{
data=val;
left=NULL;
right=NULL;
}
};
int main()
{
struct Node *root=new Node(1);
root->left=new Node(2);
root->right=new Node(3);
... | ALGO | 0.999994 | 3.739123 |
ba831b2a-e8bb-4b50-b079-01f9fe86ba02 | VarunArora14/Pepcoding | level1/trees/iterative_traversal.cpp | // https://www.geeksforgeeks.org/iterative-preorder-traversal/
// https://www.youtube.com/watch?v=5ry6gRrzPqc&list=PL-Jc9J83PIiFj7YSPl2ulcpwy-mwj1SSk&index=306
// TODO:Unable to Solve in C++ as top_node variable copied the s.top() and any change in it didn't make it through
#include <iostream>
#include "stack"
#include... | ALGO | 0.999955 | 4.588053 |
d801817e-32b4-4df8-baca-42c42fc02dda | Eg-Nickname/cpp_uni | kol/Jakub_Kurek_Kol1/ZADANIE3/zad3.cpp | // ZADANIE 3
/*
Ponizej podana jest lista stringow, zainicjalizowana kilkoma wartosciami.
Dodaj do tej listy na poczatek i na koniec kilka slow - patrz dokumentacja
kontenera list i lista jego funkcji.
Nastepnie wypisz na ekran cala liste dowolna metoda.
Wlacz potrzebne naglowki.
*/
#include <iostream>
#include <list>... | TOOL | 0.854222 | 4.268812 |
2b862885-f3e4-4b00-ae06-f3256fa58e4c | laukik29/DSA | Questions/swapalternate.cpp | // arr[5]={1,2,7,8,5}
// op = {2,1,8,7,5}
#include<iostream>
using namespace std;
void printarray(int arr[], int size)
{
for(int i=0;i<size;i++)
{
cout<<arr[i]<< " ";
}
cout<<endl;
}
void swapaltewrnate(int arr[], int size )
{
for(int i=0;i<size; i+=2)
{
if(i<=size)
{
... | ALGO | 0.999742 | 4.333167 |
0a3c08fe-d302-44b8-89d1-8a1c63f08468 | arafat1802/Code-Template | singleHash.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define F first
#define S second
#define pb push_back
#define si set <int>
#define vi vector <int>
#define pii pair <int, int>
#define vpi vector <pii>... | ALGO | 0.9998 | 4.850663 |
9b136539-bfc2-4b04-a6df-26c7da4fde79 | vikram-rathore1/competitive_programming | usaco/transform.cpp | /*
ID: rathore1
PROG: transform
LANG: C++
*/
#include<bits/stdc++.h>
using namespace std;
int n;
vector<string> before, after;
bool isTransform1() {
// 90 deg
bool is_it = true;
for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) if (before[i][j] != after[j][n - 1 - i]) is_it = false;
return is_it... | ALGO | 0.99999 | 3.739328 |
41a6bb8e-eebe-413b-a4ef-dd07385b4658 | kahowang/sensor-fusion-for-localization-and-mapping | 第九章 基于优化的建图方法/shenlan_ws/three_party/g2o-20200410_git/g2o/examples/bal/bal_example.cpp | #include <Eigen/Core>
#include <Eigen/Geometry>
#include <iostream>
#include "g2o/stuff/command_args.h"
#include "g2o/core/batch_stats.h"
#include "g2o/core/sparse_optimizer.h"
#include "g2o/core/block_solver.h"
#include "g2o/core/solver.h"
#include "g2o/core/optimization_algorithm_levenberg.h"
#include "g2o/core/base... | ALGO | 0.966013 | 6.403811 |
647ad706-376e-493b-8228-a910cc33158f | ishandutta2007/codeforces | 18michael/normal/773/E.cpp | #pragma GCC optimize("O3")
#pragma GCC target("avx2")
#include<bits/stdc++.h>
#define LL long long
#define Mx 1000005
#define inf 0x3f3f3f3f
using namespace std;
int n;
typedef pair<int,int> P;P p;
inline int lson(int x)
{
return (x<<1);
}
inline int rson(int x)
{
return ((x<<1)|1);
}
struct SegTree
{
int sum[800004... | ALGO | 0.99999 | 3.825808 |
60e3fdc5-39c9-4d52-973e-63d3e8a0f7e4 | yuyichao/cs-doc | Programming/C_C++/C++_Primer_Plus中文第四 五版 源码+习题/C++_Primer_Plus中文第四 五版 源码+习题/C++_Primer 第四版 习题解答 源码/源码/2/pow_tbl.cpp | #include <iostream>
extern int pow(int,int);
int main()
{
int val = 2;
int exp = 15;
std::cout << "The Powers of 2" << std::endl;
for (int cnt = 0; cnt <= exp; ++cnt)
{
std::cout << cnt << ":"
<< pow(val,cnt) << std::endl;
++cnt;
}
return 0;
}
| ALGO | 0.932825 | 5.27473 |
2263b231-f77d-485d-ba65-01c410c08b0a | sudhanshuthakurr/Hackerrank-Problems-in-cpp | Algorithms/02-Implementation/Drawing Book .cpp | #include <bits/stdc++.h>
using namespace std;
int solve(int n, int p){
int min=0;
// Complete this function
min=(n/2)-(p/2);
if(min>p/2)
min=p/2;
//cout<<min;
return min;
}
int main() {
int n;
cin >> n;
int p;
cin >> p;
int result = solve(n, p);
cout << result << endl;
return 0;
}
| ALGO | 0.999887 | 3.149457 |
fb3f4254-b3fb-46b2-bf03-dac34386ff12 | Ezzatbalah/task4route | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998799 | 6.776823 |
56f0dc37-f0e7-4b0e-87f0-8fb8d975c4f1 | Francis070/LeetCode-concise-and-optimal-solutions | 2636-maximum-subsequence-score/maximum-subsequence-score.cpp | class Solution {
public:
static bool comp(pair<int, int> a, pair<int, int> b){
return a.first > b.first;
}
long long maxScore(vector<int>& nums1, vector<int>& nums2, int k) {
int n = nums1.size();
vector<pair<int, int>> v(n);
for(int i = 0; i < n; i++){
... | ALGO | 0.999991 | 4.581484 |
90fa7fe5-cc3c-445d-ab84-346a7ee84172 | Bowie-State-University/CS-Courses | COSC214_Data_Structure/Source Code/Chapter 3 Source Code/Ch3_VirtualFunction4_ValueParameter/mainProgram.cpp |
//*******************************************************
// Author: D.S. Malik
//
// This program illustrates how virtual functions and a
// pointer variable of base class as a formal parameter
// work.
//*******************************************************
#include <iostream> //Line 1
#i... | TOOL | 0.920739 | 5.775252 |
6181e626-f3b0-48ae-8614-99769b8d20dc | RaduNovac/ripetizioni | anna/funzioni/es_1.cpp | #include <iostream>
#include <cstdlib> // per rand() e srand()
#include <ctime> // per time()
#include <cmath> //Serve per usare la funzione di libreria abs()
/*
Dati due vettori di dimensione uguale, ritornare la somma di tutti i valori
Dati due vettori di dimensione uguale, inserire in un terzo vettore la somma de... | ALGO | 0.993234 | 4.100392 |
53154391-94c1-4854-a121-3b8df546cdc8 | akshajchainani/Cpp-DSA | LeetCode/complimentBase10Integer.cpp | class Solution {
public:
int bitwiseComplement(int n) {
int m = n;
int mask = 0;
if(n == 0)
return 1;
while( m!=0) {
mask = (mask << 1) | 1;
m = m >> 1;
}
int ans = (~n) & mask;
r... | ALGO | 0.999954 | 6.197396 |
cf332f7e-20d2-4843-8ee1-dc7414cab316 | camerondurham/leetcode | 2022/k-closest-points/Solution.cpp | //
// Created by cam on 7/15/22.
//
#include "Solution.h"
#include<vector>
#include<algorithm>
#include<functional>
#include <iostream>
int main() {
// [[3,3],[5,-1],[-2,4]]
std::vector<std::vector<int>> numbers = {{3,3},{5,-1},{-2,4}};
auto euclidian = [](const std::vector<int>& elem) {
return (e... | ALGO | 0.999927 | 4.954358 |
12fed56c-8ed2-4ce2-bd49-1812d235fd37 | ishandutta2007/codeforces | okwedook/normal/1498/E.cpp | #pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("sse4.2")
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <sstream>
#include <deque>
... | ALGO | 0.999978 | 3.828194 |
979f0372-18ee-463b-8b5b-c642973d3369 | o-zhongchong/leetcode | Leetcode/946.cpp | class Solution {
public:
bool validateStackSequences(vector<int>& pushed, vector<int>& popped) {
if(pushed.size() != popped.size()) return false;
stack<int> st;
int len = pushed.size();
int j = 0;
for(int i=0; i<len; ++i) {
while(!st.empty() && st.top() == popped[... | ALGO | 0.999758 | 6.085718 |
c44be996-856d-4ada-8de7-e1b91fb1498d | IRedDragonICY/Programming-Algorithms | Praktikum/Pertemuan 10/Langkah Praktikum/prak2.cpp | #include <iostream>
using namespace std;
int main(){
string names[3] = {"aludin", "cipta", "semesta"};
for (int i = 0; i < 3; i++){
cout << names[i] << " ";
}
} | ALGO | 0.866717 | 3.605215 |
0dac3277-8199-4164-8ccb-879271dc064c | zyanya217/Data_Structures | Algorithms/Sort/MergeSort.cpp | #include <iostream>
using namespace std;
// S 陣列 : 將要被排序,用mid切開分成左右兩部分
// U 陣列 : 臨時陣列,用來裝i與j比較後排序的結果
void merge(int low, int mid, int high, int S[]) {
int i, j, k;
int U[high - low + 1];
i = low; j = mid + 1; k = 0;
// S 陣列中 i在左半部從low到mid,j在右半部從mid+1到high
// U 陣列中 k從low開始跑,陸續i與j比較結果依序填入
whil... | ALGO | 0.999982 | 4.732629 |
cce6a939-7e73-490a-83ab-bfb98e049ea1 | ybouret/yttrium | src/core/tests/calculus/prime32.cpp | #include "y/calculus/prime.hpp"
#include "y/utest/run.hpp"
#include "y/type/utils.hpp"
#include "y/stream/libc/output.hpp"
#include "y/calculus/bit-count.hpp"
#include <cstring>
using namespace Yttrium;
static int width = 12;
Y_UTEST(calculus_prime32)
{
size_t count = 2; // 2 and 3
uint64_t p = Prime64::N... | ALGO | 0.997524 | 4.689119 |
c82c20e2-111f-4f01-a158-b92a0c1fef67 | MindulMendul/problem-solving | baekjoon/1005.cpp | #include <iostream>
#include <vector>
using namespace std;
int edge[1001][1001];
int delay[1001];
int dp[1001];
int visited[1001];
int dfs(int ind){
visited[ind]=1;
for(int i=1; i<=edge[ind][0]; i++){
if(visited[edge[ind][i]]==0) dfs(edge[ind][i]);
dp[ind]=max(dp[ind], dp[edge[ind][i]]);
}
return dp[... | ALGO | 0.999956 | 4.393195 |
d7130fa0-568b-4d77-8d76-91402f6be100 | PrnvGiri/DSA-CPP | Algorithms/sortingAlgorithms/selectionSort.cpp | #include <iostream>
using namespace std;
void selectionSort(int arr[], int n) {
for (int i = 0; i < n - 1; ++i) {
int minIndex = i;
for (int j = i + 1; j < n; ++j) {
if (arr[j] < arr[minIndex]) {
minIndex = j;
}
}
if (minIndex != i) {
... | ALGO | 0.999987 | 5.036442 |
230b93d1-4f07-40f5-bcc3-597b5f7462a2 | anubhawbhalotia/Competitive-Programming | LeetCode/654. Maximum Binary Tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* constructMaximumBinaryTree(vector<int>& nums) {
stack <TreeNode*> s;
... | ALGO | 0.99998 | 6.542875 |
33105921-9dfd-4ff0-a02e-8546269f9e5c | jjwatt/higan-debian | higan-094/sfc/chip/spc7110/decompressor.cpp | //SPC7110 decompressor
//original implementation: neviksti
//optimized implementation: cydrak
struct Decompressor {
SPC7110& spc7110;
Decompressor(SPC7110& spc7110) : spc7110(spc7110) {}
uint8 read() {
return spc7110.datarom_read(offset++);
}
//inverse morton code transform: unpack big-endian packed p... | ALGO | 0.995829 | 3.398953 |
b75055a2-e8e3-491f-9140-11459bf43803 | MuvvalaKaran/summer_20_data_structures | Exams/Exam 1/Early Starter Code/StacksQueue/STACKARR.cpp | #include <iostream>
#include "STACKARR.hpp"
using namespace std;
Stack_Arr::Stack_Arr(){
arr = NULL;
top = -1;
}
Stack_Arr::~Stack_Arr(){
while(!isEmpty())
{
pop();
}
delete[] arr;
arr = NULL;
top = -1;
}
void Stack_Arr::initialise(int cap){
arr = new int[cap];
top = 0;
capacity = cap;
}
b... | TOOL | 0.983034 | 4.055151 |
7890fb73-51c3-4ace-9c89-b3c775f77140 | ishandutta2007/codeforces | ivan100sic/normal/1547/G.cpp | // Retired?
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = long unsigned long;
using ld = double long;
int n, m;
vector<int> e[400005];
int t[400005];
int st[400005];
void dfs1(int x);
void dfs2(int x);
void dfs3(int x);
void dfs1(int x) {
st[x]++;
for (int y : e[x]) {
... | ALGO | 0.999913 | 4.587322 |
dfddce59-bf7f-460c-aa5b-9b23e86099e9 | xiyanykt/code | Nowcoder/2024_Nowcoder_Multi_University_Training_Contest_6/I.cpp | #include<bits/stdc++.h>
using i64 = int64_t;
using u64 = uint64_t;
using f64 = long double;
#ifndef ONLINE_JUDGE
#include "algo\debug.hpp"
#else
#define debug(...) (void)42
#endif
constexpr i64 inf = 1E17;
template<class Tp>
void chmax(Tp& x, Tp y) {
x = std::max(x, y);
}
template<class Tp>
void chmin(Tp& x, Tp y)... | ALGO | 0.999835 | 5.0093 |
77af27aa-3aa5-4ffb-bbad-03e544837d3d | phamtiep/HardwareDesign | final_project/arr_par_sol/syn/systemc/matrix_conv.cpp | #include "matrix_conv.h"
#include "AESL_pkg.h"
using namespace std;
namespace ap_rtl {
const sc_logic matrix_conv::ap_const_logic_1 = sc_dt::Log_1;
const sc_logic matrix_conv::ap_const_logic_0 = sc_dt::Log_0;
const sc_lv<8> matrix_conv::ap_ST_fsm_state1 = "1";
const sc_lv<8> matrix_conv::ap_ST_fsm_state2 = "10";
con... | TOOL | 0.97156 | 3.395178 |
ea140256-03df-488b-bb83-ab2d8263c210 | Falicitas/Code_Template | 数学/类欧几里得.cpp | namespace class_gcd {
const int P = 998244353;
int i2 = 499122177, i6 = 166374059; //模数不同另算逆元
struct data {
int f, g, h;
data() { f = g = h = 0; }
}; // 三个函数打包
data calc(int n, int a, int b, int c) {
int ac = a / c, bc = b / c, m = (a * n + b) / c, n1 = n + 1, n21 = n * 2 + 1;
data d;
if (a == 0) ... | ALGO | 0.999965 | 4.568699 |
00cc1410-581a-4037-b258-d5c81aca488b | ac001/arduino-core-2010 | libraries/Tween/examples_c/tween_test.cpp | // gcc -Wall -o tween_chase tween_chase.c
#include <stdio.h>
#include "Tween.h"
int main(int argc, char **argv)
{
int t;
int i;
int num_chases = 3;
Tween_t chase[3];
float res;
float targets[3] ={1,0,1};
for (i=0;i<num_chases;i++)
{
Tween_init(&chase[i]);
Tween_setType(&chase[i], (i<1)?0:1);
Tween_l... | ALGO | 0.894369 | 3.751425 |
8f96e151-c432-4119-8824-9dd2d44c88a7 | greenbeanpie/OI-training | NOIP2023-ZJ/ZJ-0244/dict/dict.cpp | #include<bits/stdc++.h>
#define ll long long
#define all(x) x.begin(),x.end()
using namespace std;
const int N=3007;
int n,m;
unsigned ll hs1[N][N],hs2[N][N];
string a[N],b[N];
inline bool cmp(int x,int y){
int l=1,r=m,mid;
while(l<r){
mid=(l+r)>>1;
if(hs1[x][mid]==hs2[y][mid])l=mid+1;
else r=mid;
}
return a[... | ALGO | 0.999973 | 3.702302 |
91137853-d6fe-4c25-bd77-397ed7020dca | ytsaurus/ytsaurus-cpp-sdk | contrib/libs/icu/common/unistr.cpp | #include <string_view>
#include "unicode/utypes.h"
#include "unicode/appendable.h"
#include "unicode/putil.h"
#include "cstring.h"
#include "cmemory.h"
#include "unicode/ustring.h"
#include "unicode/unistr.h"
#include "unicode/utf.h"
#include "unicode/utf16.h"
#include "uelement.h"
#include "ustr_imp.h"
#include "umut... | TOOL | 0.877116 | 3.070791 |
e875a0cb-9918-4008-bcb9-9763ad1dc9df | Krasztana/project-euler | level_55/problem_220.cpp | #include <math.h>
#include <array>
#include <iostream>
/*
Problem 220.
A D_n dragon will take 2^n steps in total. Using this fact and trig identities, to tell the dragon's position in step 1e12, we can fill the coordinates for a narrow range of steps between
step 2^39 (even closer actually) and step 2^40, as 2^39 < ... | ALGO | 0.999869 | 4.7262 |
4ad8de35-4520-4b1e-8b31-36c83cad0afa | AlapanDas/DSA-Roadmap | Arrays/Majority Element/Bruteforce.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;cin>>n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin>>arr[i];
}
int max = 0;
int index = -1;
for (int i = 0; i < n; i++) {
int cnt = 0;
for (int j = 0; j < n; j++) {
if (arr[i] == arr[j]... | ALGO | 0.999977 | 4.497941 |
757235f2-a289-4bc0-b933-1b59c6ded807 | Sowmik23/CompetitiveProgramming | Codeforces/A_The_Rank.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,a,b,c,d;
scanf("%d",&n);
int temp1,temp2,cnt=1;
scanf("%d%d%d%d",&a,&b,&c,&d);
temp1 = a+b+c+d;
for(int i=0;i<n-1;i++)
{
scanf("%d%d%d%d",&a,&b,&c,&d);
temp2 = a+b+c+d;
if(temp2>temp1) cnt++;
}
printf("%d\n",cnt);
return 0;
}
| ALGO | 0.999532 | 3.532299 |
26e207f0-7436-4226-bdc0-75870bc101dc | Shubhodaya/Leetcode | 0912-random-pick-with-weight/0912-random-pick-with-weight.cpp | class Solution {
private:
int total;vector<int> csum;
public:
Solution(vector<int>& w) {
int c=0;
for( auto it: w){
c+=it;
csum.push_back(c);
}
total=c;
}
int pickIndex() {
int t= rand()%total+1;
int l=0,h=csum.size();
... | ALGO | 0.999897 | 5.645511 |
d80c5478-4e18-4b2d-aa61-343c7cdd35cf | The-Coder-Kishor/CSES_Problem_Set_Solutions | 1.Intoductory Problems/apple_division.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long int n, total=0, ans=INT_MAX;
cin >> n;
long long int arr[n];
for(long long int i = 0; i < n; i++) {
cin >> arr[i];
total += arr[i];
}
for(long long int i = 0; i < 1<<n; i++) {
long long int s = 0;
for(long long int j = 0; j < n; j++) {
... | ALGO | 0.999985 | 4.087195 |
448b7f0c-871e-4030-bc2a-5d0cad88fff2 | cwang588/algorithms | Codejam/2022/Qualification Round 2022/D.cpp | #include<bits/stdc++.h>
using namespace std;
long long a[100005];
struct edge{
int from,to,nxt;
}e[200005];
int Head[100005],cnt;
void add(int x,int y){
++cnt;
e[cnt].from=x;
e[cnt].to=y;
e[cnt].nxt=Head[x];
Head[x]=cnt;
}
long long sum[100005];
long long dfs(int now){
sum[now]=0;
long long Min1=1e18;
for(int ... | ALGO | 0.999848 | 3.765904 |
44d2f0ff-1757-4f7d-a071-81d78ea99f2d | shyu61/program-competition | code/problems/022.cpp | // E - Weighted Tic-Tac-Toe
// https://atcoder.jp/contests/abc349/tasks/abc349_e
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> a;
vector<vector<int>> pat{{0,1,2},{3,4,5},{6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}};
bool f(vector<int> s) {
// 勝敗判定
// 1. 3つ揃う
for (auto... | ALGO | 0.999933 | 5.356413 |
17b5ce62-c396-4b9d-ab63-be6d08e8f3f7 | shirishbahirat/algorithm | quesrt.cpp | #include <iostream>
using namespace std;
void swap(int arr[], int idx, int idy)
{
if (idx != idy)
{
int temp = arr[idx];
arr[idx] = arr[idy];
arr[idy] = temp;
}
}
int partition(int arr[], int lo, int hi)
{
int i = lo, j = hi;
int pivot = arr[lo];
while (j > i)
{
while (arr[i] <= pivo... | ALGO | 0.999904 | 5.127421 |
9e8522bc-4424-4f6b-b61f-fb8b83ec45e2 | Yogsther/kattis | CD.cpp | /*
Sample data
8 7
1
10
60
70
240
250
34536
1000000000
1
10
60
34536
345734
24572458
1000000000
0 0
#Correct answer 5
*/
#include "pch.h"
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
long long n, m;
cin >> n >> m;
vector<long long> nVector;
v... | ALGO | 0.999752 | 3.345239 |
1a7eec45-fdad-4839-93f5-67839a533292 | ProbablyButter/aoc | 2020/day7/part2.re.cpp | /*!re2c re2c:flags:utf-8 = 1;*/
/*!max:re2c*/
/*!re2c
re2c:define:YYCTYPE = "char";
re2c:yyfill:enable = 0;
re2c:flags:tags = 1;
re2c:yyfill:check = 1;
*/
#include "aoc.hpp"
#include <fstream>
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
void parse_rule(co... | ALGO | 0.973508 | 6.13302 |
782e108f-f979-4f23-8cbc-85fcd80585fc | jakehsiao/Highway-path-planning | src/Eigen-3.3/bench/sparse_randomsetter.cpp |
#define NOGMM
#define NOMTL
#include <map>
#include <ext/hash_map>
#include <google/dense_hash_map>
#include <google/sparse_hash_map>
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef DENSITY
#define DENSITY 0.01
#endif
#ifndef REPEAT
#define REPEAT 1
#endif
#include "BenchSparseUtil.h"
#ifndef MINDENSITY
#define M... | TOOL | 0.864243 | 4.487392 |
2648d2c0-9f33-4f88-bbaf-60a3bd2c6c36 | ishandutta2007/codeforces | rosed/normal/1759/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define ls(p) (p<<1)
#define rs(p) (p<<1|1)
#define mid ((l+r)>>1)
#define lowbit(i) ((i)&(-i))
#define eps (1e-8)
void solve()
{
int n,h;
cin>>n>>h;
vector<int> a(n+1);
for(int i=1;i<=n;++i)
{
cin>>a[i];
}
sort(a.begin()+1,a.end());
vector dp... | ALGO | 0.99988 | 4.151077 |
4c51459c-0b2b-48b5-8596-5c7d5e860686 | ruiwng/program | leetcode/698.cpp | #include <vector>
#include <numeric>
using namespace std;
class Solution {
public:
bool dfs(vector<int>& nums, vector<bool>& used, int sum, int target, int index, int k) {
if(k == 1) {
return true;
}
if(index == nums.size()) {
return false;
}
if(sum ... | ALGO | 0.999988 | 5.758095 |
edb54701-7e5c-47ac-812f-d4401f409cd2 | chenzeyin9867/algorithm | 2021_9/minMoves.cpp | #include "head.h"
class Solution {
public:
int minMoves(vector<int>& nums) {
int movCnt = 0;
int min = nums[0];
for(int i = 0; i < nums.size(); i++){
int delta = 0;
if(min > nums[i]){
delta = (min - nums[i])*(i);
min = nums[i];
... | ALGO | 0.999916 | 5.887717 |
45e13df9-cf0b-4bc3-a72a-933c5b32c020 | mpivtoraiko/playground | cpp/src/int_to_roman.cpp | // g++ -g -O0 -std=c++20 int_to_roman.cpp -o int_to_roman
#include <string>
#include <iostream>
#include <unordered_map>
using namespace std;
class IntToRomanConverer {
public:
IntToRomanConverer() {
// init the lookup map
_lookup_map[0][1] = 'I';
_lookup_map[0][5] = 'V';
_lookup_... | ALGO | 0.919683 | 7.207001 |
7a6da9ff-ca9d-43bc-a15c-9b91ca5aa447 | cdkersey/harptool | src/instruction.cpp | /*******************************************************************************
HARPtools by Chad D. Kersey, Summer 2011
*******************************************************************************/
#include <iostream>
#include <stdlib.h>
#include "include/instruction.h"
#include "include/obj.h"
#include "include... | TOOL | 0.906456 | 6.610855 |
7b7e1d01-b7c2-4f6a-9692-9a0cdc939b1e | ishandutta2007/codeforces | nutella3000/normal/1737/D.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define all(a) a.begin(), a.end()
template <typename T> bool chmin(T& a, T b) { if (a <= b) return false; a = b; return true; }
template <typename T> bool chmax(T& a, T b) { if (a >= b) return false; a = b; return true; }
cons... | ALGO | 0.999985 | 5.040945 |
84445935-0b81-478e-bc06-7fb87e431e27 | ishandutta2007/codeforces | crh380bl-2339/normal/1252/A.cpp | #include<bits/stdc++.h>
using namespace std;
int gcd(int n,int m){
return m==0?n:gcd(m,n%m);
}
int main(){
int T;
int n,m;
scanf("%d",&T);
while(T--){
scanf("%d",&n);
m=100-n;
int g=gcd(n,m);
printf("%d\n",100/g);
}
return 0;
} | ALGO | 0.999351 | 3.733617 |
d232cad9-4242-4d07-a333-68759904af1a | Atta-UrRehman/flutter_1st | myapp/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.998627 | 6.785645 |
898bd2b7-dee3-404a-b55c-fe67e54ef1b1 | jitender1222/ineuronPPT-Assignment-DSA- | Assignment-24 Basics of Dsa/Q2.cpp | #include <iostream>
#include <unordered_set>
using namespace std;
int lengthOfLongestSubstring(string s)
{
int n = s.length();
int maxLength = 0;
int i = 0, j = 0;
unordered_set<char> uniqueChars;
while (j < n)
{
if (uniqueChars.find(s[j]) == uniqueChars.end())
{
u... | ALGO | 0.999769 | 6.22094 |
6ee0fbbd-9c56-4bd5-afee-f7409b702aa9 | Mokuroh54/Comp_Prog | Codeforces/1501-2000/1601-1700/1691-1700/1699_D_Almost_Triple_Deletions.cpp | /*
___
(o,o)
< . >
--"-"---
Rowlet is orz
_ _ _
>(.)__ <(.)__ =(.)__
(___/ (___/ (___/
I am dum duck
Praise to the Cow God
*/
#include <bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define pb push_back
#define ll long long
#define ld long double
#define ull unsigned ll
ll... | ALGO | 0.999705 | 4.608685 |
4e839a8b-118e-4544-872b-f5f7f4319d48 | yagyeshgoyal/LeetCode | 1938-minimum-operations-to-make-the-array-increasing/1938-minimum-operations-to-make-the-array-increasing.cpp | class Solution {
public:
int minOperations(vector<int>& nums) {
int lastnum = nums[0];
int ans = 0;
for(int i=1; i<nums.size(); i++){
if(lastnum>=nums[i]){
ans = ans + (lastnum - nums[i] + 1);
lastnum++;
}
else{
... | ALGO | 0.999961 | 6.311316 |
e683706c-65b5-4dfe-a0c4-e5124425e88d | mazurcaionut/C-programs | S3V40_4.cpp | #include<iostream>
#include<math.h>
using namespace std;
int n,i;
int pr(int x)
{
int i,ok=1;
for(i=2;i<=x/2 && ok;i++)
if(x%i==0) ok=0;
if(ok==0) return 0;
else return 1;
}
int div(int y)
{
int s,i;
s=1+abs(y);
for(i=2;i<=y/2;i++)
if(y%i==0) s=s+i;
return s;
}
int main()
{
cout<<"n=";cin>>n;
for(i=2;... | ALGO | 0.99892 | 3.99735 |
52c59879-c96c-47bc-bd33-4fc4ebb60d15 | vicinity-zw/Practise | Leetcode/leetcode8.cpp | // leetcode.cpp : ̨Ӧóڵ㡣
//
#include <iostream>
#include <stack>
#include <vector>
#include <string>
#include <sstream>
#include <map>
#include <limits>
#include <iomanip>
#include <algorithm>
using namespace std;
/*
class Solution {
public:
bool isValid (string const& s)
{
string left = "([{";
string right =... | ALGO | 0.998747 | 4.664779 |
ba1cd7e8-774f-482c-842c-87b309e2748e | ARLM-Attic/vart | core/source/vpdofmover.cpp | /// \file vpdofmover.cpp
/// \brief Implementation file for VPDofMover VPAT class.
/// \version $Revision: 1.1 $
// ChangeLog
// Mar 23, 2006 - Bruno de Oliveira Schneider
// - File created.
#include "vpdofmover.h"
#include "vpinterpolator.h"
#include "vpdof.h"
//#include <iostream>
using namespace std;
float VPDo... | TOOL | 0.978019 | 5.825113 |
4a530a8e-3a4a-4c11-aa4c-8770877258ed | Eduard0Castro/object-oriented | STL/Examples/Deque/example.cpp | #include <iostream>
#include <deque>
#include <algorithm>
using namespace std;
//Deque permite que se coloque elementos na primeira posição
//o que o vector não permite
template <typename T>
void show(deque<T> &dados){
//typename, nesse caso, é pra mostrar para o compilador que se trata de um tipo
//e n... | TOOL | 0.897414 | 4.912257 |
2c2ea261-d386-4f64-a0ec-8bb38c88a7b5 | devanshtyagi26/TheoryOfComputation | pdaWxWr.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
class PDA {
private:
stack<char> st;
void pushToStack(char c) {
st.push(c);
cout << "Pushed '" << c << "' to the stack\n";
}
void popFromStack() {
if (!st.empty()) {
char popped = st.top()... | ALGO | 0.999329 | 6.055056 |
9db7f1c1-196c-49f5-a423-868b757ef7d5 | akshatchhabra/TransLRPL | CodeGen/data/transcoder_evaluation_gfg/cpp/CHOCOLATE_DISTRIBUTION_PROBLEM.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( int arr [ ], int n, int m ) {
if ( m == 0 || n == 0 ) return 0;
sort ( arr, arr + n );
if ( n < m ) return - 1;
int min_diff = INT_MAX;
in... | ALGO | 0.999871 | 5.611345 |
f0382cba-96ad-40dd-9e50-b463045d717a | MonoGame/FreeImage | Source/OpenEXR/Imath/ImathMatrixAlgo.cpp | //----------------------------------------------------------------------------
//
// Implementation of non-template items declared in ImathMatrixAlgo.h
//
//----------------------------------------------------------------------------
#include "ImathMatrixAlgo.h"
#include <cmath>
#include <algorithm>
#if defined(OPENE... | ALGO | 0.999731 | 6.941531 |
220c3ab3-52cc-4a82-8d96-b83267f47a4b | RoseAlice2018/Algorithm2024 | 分类/二叉树/652..cpp | #include<vector>
#include<stack>
#include<queue>
#include<string>
#include<unordered_map>
#include<unordered_set>
using namespace std;
struct ListNode{
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x):val(x), next(nullptr) {}
ListNode(int x, ListNode *next):val(x), next... | ALGO | 0.999642 | 6.164932 |
9cd262ff-fe60-41c5-a052-84179bfb3b05 | jusex/TesraSupernet | src/crypto/rfc6979_hmac_sha256.cpp |
#include "crypto/rfc6979_hmac_sha256.h"
#include <string.h>
#include <algorithm>
static const unsigned char zero[1] = {0x00};
static const unsigned char one[1] = {0x01};
RFC6979_HMAC_SHA256::RFC6979_HMAC_SHA256(const unsigned char* key, size_t keylen, const unsigned char* msg, size_t msglen) : retry(false)
{
... | ALGO | 0.940382 | 6.563017 |
bea263ea-5713-4cc2-9e78-a83804a08636 | delhomer/advent_of_code | 2021/day1.cpp | #include <iostream>
#include <fstream>
#include <vector>
int part1() {
std::fstream day1_file;
int decreasing_depths = 0;
day1_file.open("day1.txt", std::ios::in);
if(day1_file.is_open()){
int last_depth = 1000000;
int depth;
while(day1_file >> depth){
if(last_depth < depth)
decreasing_depths... | ALGO | 0.99747 | 5.518748 |
6797aba7-cfd2-4be1-82cb-839d42116c32 | shivam2146/Learning-C- | vector.cpp | #include<iostream>
#include<vector>
using namespace std;
int main() {
vector<int> vec(5); //creates a vector of size 5 initilized with zeroes
cout<<"\ninitial size of vector "<<vec.size()<<endl; // remarks:size() is unsigned
vec.push_back(25); //pushes 25 at end of vector increasing... | ALGO | 0.860891 | 3.404195 |
7decc312-6a9d-4c3e-97b2-97642e5f0bf3 | yadavsuraj999/cpp | pratice/pratice.cpp | #include <iostream>
using namespace std;
int main(){
int i,count=0,r;
cout<<"Enter Number : ";
cin>>i;
while(i != 0){
r = i%10;
count++;
i = i/10;
}
cout<<"Your Diget is : "<<count;
return 0;
} | ALGO | 0.998756 | 3.306896 |
8e8e687e-ba50-4a08-bfa9-24e03be1fe77 | hyeonseong0917/Codeforces | random/1729D.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
using namespace std;
#define ll long long
int main() {
// your code goes here
int o=1;
cin>>o;
while(o--){
// 1003
ll n;
cin>>n;
vector<ll> a(n,0), b(n,0);
for(ll i=0;i<n;++i){
cin>>a[i];
}
... | ALGO | 0.999925 | 4.059933 |
68360d6d-f52f-4fe7-88ac-8c2f879c0cfc | tejaslomate/OOPs_Assignment | assignment5.cpp | #include<iostream>
using namespace std;
int n;
#define size 10
template<class T>
void sel(T A[size])
{
int i,j,min;
T temp;
for(i=0;i<n-1;i++)
{
min=i;
for(j=i+1;j<n;j++)
{
if(A[j]<A[min])
min=j;
}
temp=A[i];
A[i]=A[min];
A[... | ALGO | 0.999522 | 3.804486 |
d5d62aa1-c6b6-4b02-a46b-038c4e735b22 | HaotengYang/LeetCute | Legacy/Linked_List/206_Reverse_Linked_List/206_Shiwei_He.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseList... | ALGO | 0.999647 | 5.676013 |
7ae37990-abcd-451c-9aba-1f79f7bb7742 | KleversDC/csm9 | csm9/csm9.cpp | #include <iostream>
using namespace std;
class String {
private:
char* str;
int length;
public:
String() : str(nullptr), length(0) {}
String(const char* s) {
length = 0;
while (s[length] != '\0') {
length++;
}
str = new char[length + 1];
for (int i... | TOOL | 0.865293 | 5.334805 |
dacf3b49-2119-45c5-aa19-d3f6a3e02547 | heavenMOJANG/ICPC | .history/2024牛客多校/牛客多校1/A_20240716143133.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int inf=0x7fffffff;
constexpr int N=5010;
int n,m,q;
vector<int>f(2*N,1),inv(2*N);
signed main(){
cin.tie(0)->sync_with_stdio(0);
cin>>n>>m>>q;
... | ALGO | 0.99999 | 4.144995 |
01b591d8-c710-466c-b64e-925b7b2d126d | ashutosh-0907/Cpp | basics_c++/namespace.cpp | #include<iostream>
namespace first{
int x=11;
}
namespace second{
int x=14;
}
int main(){
std::cout<<second::x;
}
//Namespace provide solution to name conflict
//A namespace allows for identical name entities | TOOL | 0.976431 | 5.096031 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.