uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
e6503e77-7c48-4ec8-bd21-2d79c5a3bb9d | SamvelMakaryan/Games | Tetris/src/check.cpp | #include "Tetris.hpp"
bool check(std::array<std::array<int, width>, height> field, std::array<Point, 4> currentPosition) {
for (int i = 0; i < 4; i++) {
if (currentPosition[i].x < 0 || currentPosition[i].x >= width || currentPosition[i].y >= height) {
return false;
}
if (field[currentPosition[i].y][currentPo... | ALGO | 0.959436 | 4.939955 |
afda274e-e5fe-4104-99c2-667ffca4d50e | ishandutta2007/codeforces | oyjason/normal/1013/C.cpp | #include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define mid (l+r>>1)
#define M 400020
using namespace std;
LL read(){
LL nm=0,fh=1;char cw=getchar();
for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh;
for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
r... | ALGO | 0.99995 | 3.280574 |
52313407-d00e-414b-9ffa-7dde432c6f78 | Changdev5595/DSA | Sorting/SelectionVector.CPP | #include<bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<int> SelectionSort(vector<int>& nums)
{
for(int i=0; i<nums.size()-1; i++)
{
int minindex = i;
for(int j=i+1; j<nums.size(); j++)
{
if(nums[j]<nums[minindex])
... | ALGO | 0.99998 | 5.634429 |
4dc47366-2a58-4895-b4b3-5a4206b157fb | ishandutta2007/codeforces | krk/normal/1552/F.cpp | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 200005;
const int mod = 998244353;
int n;
int X[Maxn], Y[Maxn], S[Maxn];
int BIT[Maxn];
int totres;
void Add(int x, int val)
{
for (int i = x; i <= n; i += i & -i)
BIT[i] = (BIT[i] + val) % mod;
}
int Get(int x)
{
int res = 0;
for (i... | ALGO | 0.99995 | 4.355415 |
dd1686b0-6ef0-4e25-921f-86794923bcb9 | jeete121/Coding | Programs/Practice/Prac/GraphAlgorithms/roads_libraries.cpp | #include <bits/stdc++.h>
using namespace std;
vector<long long int> arr[1000001];
long long int vis[1000001];
long long int cnt;
//dfs function
void dfs(long long int node)
{
//mark as visited
vis[node] = 1;
cnt++;
for (long long int child : arr[node])
{
if (vis[child] == 0)
df... | ALGO | 0.999675 | 3.720695 |
95df487c-2ece-41f4-9dca-71a41bfc1632 | rihammisuk/DA-Goal-365 | DSA Beginner to Advanced Roadmap by Sandeep Jain/1-Array/1_SEARCH_INSERT_DELETE/5_Search_in_a_Sorted_Array.cpp | #include <bits/stdc++.h>
using namespace std;
int binarySearch(int arr[], int low, int high, int key){
if(high < low){
return -1;
}
int mid = (low + high) / 2;
if(arr[mid] == key){
return mid;
}
if(key > arr[mid]){
return binarySearch(arr, mid+1, high, key);
}
re... | ALGO | 0.999867 | 5.646922 |
a575d544-b4b3-47bb-8bac-e04407211fe0 | danyalmendigali/programming_scientific_codes | functions/task_num16.cpp | #include <bits/stdc++.h>
#include <windows.h>
using namespace std;
#define ll long long
#define ar array
#define FOR(i, a, b) for(int i = a; i < b; i++)
string palindrome(const string& s);
int main() {
cin.tie(0);
SetConsoleOutputCP(CP_UTF8);
SetConsoleCP(CP_UTF8);
string s;
cout << "Введите стр... | ALGO | 0.999955 | 5.489563 |
8586a5b4-ae53-40b7-8292-d819e2e30a76 | anas20023/Code-Forces | CFs/A_Problem_Generator.cpp | //////////////// ANAS IBN BELAL /////////////////
// Test Case Template ||
// ||
// ||
// BANGLADESH UNIVERS... | ALGO | 0.999934 | 4.584441 |
cbe46f20-57e2-4709-916b-d07776907ba5 | dl8sd11/online-judge | 0contest/CF_999/pC.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) ll(i.size())
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j... | ALGO | 1 | 4.405571 |
c5ed1ac4-376d-484b-adbb-c25a1fd01870 | Debasish-1903/a_z_ques_repo | MONTH2 APRIL/WEEK5/consecutive1.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ull unsigned long long int
#define mod 1000000007
#define inf 1e9
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define f first
#define s second
#define nl "\n"
#define pi pair<... | ALGO | 0.999993 | 4.625274 |
78a6b2cc-9dac-4971-8f11-83f523d0f500 | liulilittle/openppp2-macos-amd64-environment | boost/libs/compute/perf/perf_stl_sort.cpp | #include <algorithm>
#include <iostream>
#include "perf.hpp"
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
std::vector<int> v;
perf_timer t;
for(size_t trial = 0; trial < PERF_TRIALS; trial++){
v = generate_random_vector<int... | ALGO | 0.941706 | 5.498227 |
ba4c180d-61dd-452d-95fb-d0e7e98b94c1 | sarvex/leetcode-zsh | solution/1700-1799/1737.Change Minimum Characters to Satisfy One of Three Conditions/Solution.cpp | class Solution {
public:
int minCharacters(string a, string b) {
int m = a.size(), n = b.size();
vector<int> cnt1(26);
vector<int> cnt2(26);
for (char& c : a) ++cnt1[c - 'a'];
for (char& c : b) ++cnt2[c - 'a'];
int ans = m + n;
for (int i = 0; i < 26; ++i) ans... | ALGO | 0.999991 | 5.510265 |
ea1a6458-604a-4620-b6cc-3e22e73e3756 | rajatgirotra/study | cpp/CPP_NEW/algorithms/intervals.cpp | /*Question:
A popular online retailer allows vendors to specify different prices in advance
for the same item throughout the day. We now need to design an algorithm that
helps identify the lowest price for the item at any point of the day.
Assumptions:
For the algorithm, assume all vendors are selling the same produc... | ALGO | 0.999944 | 5.959358 |
47ced60d-3207-4065-9a5e-f98fca12ba3f | pacha2880/competitive_programming_codes | 11265 - The Sultan's Problem.cpp | #include <bits/stdc++.h>
#define PI acos(-1)
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define srt(a) sort(all(a))
#define mem(a, h) memset(a, (h), sizeof(a))
#define f first
#define s second
#define MOD 1000000007
#define EPS 1e-9
int in(){int r=0,c;for(c=getch... | ALGO | 0.998216 | 3.84656 |
b2b8fc5c-584d-4fc6-9721-22f366c0b5d2 | talafarael/practiceCpp | add.cpp | #include <iostream>
struct Employee{
double a;
double b;
void sum2(){
std::cout<<(a+b)*2;
};
double sum(){
return a+b;
};
void sum3(){
std::cout<<sum();
};
};
int main()
{
Employee bob;
std::cin>>bob.a;
std::cin>>bob.b;
bob.sum3();
return 0;
} | ALGO | 0.977882 | 3.741591 |
901a8e52-0e19-46d4-9018-7527838ad56a | justcppdev/dynamic_matrix | sources/matrix.cpp | #include <iostream>
#include "matrix.hpp"
bool equal( float ** lhs_elements,
unsigned int lhs_rows,
unsigned int lhs_columns,
float ** rhs_elements,
unsigned int rhs_rows,
unsigned int rhs_columns )
{
if( lhs_rows != rhs_rows || lhs_columns != rhs_columns... | ALGO | 0.964062 | 4.714828 |
ecc3d7c2-056f-4f9c-ab0b-a80915dd6f30 | Vineet95070/HackerRank-DSA-Cpp | Get Node value.cpp |
int getNode(SinglyLinkedListNode* llist, int positionFromTail) {
int size = 0;
SinglyLinkedListNode* temp = llist;
while(temp != NULL){
size++;
temp = temp->next;
}
int i=0;
temp = llist;
while( i != size-positionFromTail-1 ){
i++;
... | ALGO | 0.999539 | 3.513649 |
6827738f-574c-47ac-80ff-f959bed5bdfb | vladzio1986/LAbs | Lab5/Lab5.3/main.cpp | #include <iostream>
using namespace std;
void zeroSmaller (int &a, int &b) {
if (a>b) {
b = 0;
cout << "First number is bigger than second. Second number = 0" << endl;
}
else {
a = 0;
cout << "Second number is bigger than first. First number = 0" << endl;
}
}
int main(... | ALGO | 0.999618 | 3.616113 |
d5e8b5e5-e040-4a85-8740-1d0346b5aec4 | Free-Denis/Timus | 1036.cpp | #include <cstdio>
#include <vector>
using namespace std;
typedef vector<int> ss;
vector<ss> a(1001), b(1001);
vector<int> la(1001), lb(1001), st(1001), r(101), h(101);
int l, lr, lh, n, i, j, s, k, m;
void main()
{
for (i = 0; i < 1001; ++i) { a[i].resize(101); b[i].resize(101); }
scanf("%d%d", &n, &s);
if (s % 2... | ALGO | 0.99987 | 3.265193 |
b74f0748-7a84-4acf-bfa1-dd16e02565dd | felipegetulio/Competitive-Programming-Subjects | Questions/Codeforces/Solutions/Oath of the Night_s Watch/q.cpp | #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);
#define MAXN 100004
using namespace std;
int st[MAXN];
int main(){_
int n, cont = 0;
cin >> n;
for(int i=0; i<n; i++)
cin >> st[i];
sort(st, st+n);
for(int i=1; i<n-1; i++)
cont += (st[i] != st[0] && st[i] != st[n... | ALGO | 0.999838 | 3.483458 |
ee69f9d6-61a0-493e-92f9-8b5e7d7b4856 | ishandutta2007/codeforces | mohamedabookail/normal/1650/A.cpp | /**
* author: Mohamed Abo Okail
* created: O8/O3/2O22
**/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define sz(x) int(x.size())
#define endl "\n";
int main() {
std::ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t; cin >> t;
while(... | ALGO | 0.999847 | 5.976882 |
52f11f36-85ea-4edc-9fd3-6529eeaf459d | Sanyam-7/Hacktoberfest2022-DSA | CPP/Array/quicksort.cpp | /* C++ implementation of QuickSort */
#include <bits/stdc++.h>
using namespace std;
// A utility function to swap two elements
void swap(int* a, int* b)
{
int t = *a;
*a = *b;
*b = t;
}
/* This function takes last element as pivot, places
the pivot element at its correct position in sorted
array, and places all sm... | ALGO | 0.999994 | 5.937927 |
6b1f8637-d74f-46fe-910d-a5dac11d6c8f | PROMIiit/DS-ALGORITHM | data structure code/insert in linear array.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int item,a[10000],n,i,k,j=0;
cout<<"Array size is: ";
cin>>n;
cout<<"The element of array is: "<<endl;
for(i=1; i<=n; i++)
{
cin>>a[i];
}
cout<<"Insert item is: ";
cin>>item;
cout<<"Insertion position is: ";
c... | ALGO | 0.99988 | 3.776891 |
1321266c-74b4-44a9-9c5e-255d4e6aec9f | k9opAA/Operator-Overload | OperatorOverload004.cpp | //Operator overloading for assignment =
#include<iostream>
using namespace std;
class demo{
int a;
public:
void getdata(){
cout<<"\nEnter a number: ";
cin>>a;
}
void putdata(){
cout<<a<<endl;
}
demo operator=(demo aa) {
a = aa.a;
}
};
int main()
{
demo ... | TOOL | 0.922719 | 4.078636 |
987eb265-0c1c-43e8-908c-ca5b624b73e1 | UnknownPoem/homework_games202 | homework2/Assignment2/prt/ext/eigen/doc/examples/TemplateKeyword_simple.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
void copyUpperTriangularPart(MatrixXf& dst, const MatrixXf& src)
{
dst.triangularView<Upper>() = src.triangularView<Upper>();
}
int main()
{
MatrixXf m1 = MatrixXf::Ones(4,4);
MatrixXf m2 = MatrixXf::Random(4,4);
std::cout << "m2 before copy:"... | TOOL | 0.987178 | 5.210898 |
f1e1b1f2-5771-42fa-80dc-eed718133e3a | Glory-Day/Solutions | Baekjoon/Cpp/1920.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v1;
for (int i = 0; i < n; i++) {
int input;
cin >> input;
v1.push_back(input);
}
cin >> n;
vector<int> v2;
for (int i = 0; i < n; i++) {... | ALGO | 0.999986 | 4.820879 |
218d530a-1486-435f-bfb0-f43c66eaab1a | khunpoum/Marlin-2-for-Sapphire-Plus-V2-gen2-Mellow-NF-BMG-AERO | Marlin/src/libs/crc16.cpp | #include "crc16.h"
void crc16(uint16_t *crc, const void * const data, uint16_t cnt) {
uint8_t *ptr = (uint8_t *)data;
while (cnt--) {
*crc = (uint16_t)(*crc ^ (uint16_t)(((uint16_t)*ptr++) << 8));
for (uint8_t i = 0; i < 8; i++)
*crc = (uint16_t)((*crc & 0x8000) ? ((uint16_t)(*crc << 1) ^ 0x1021) : (... | ALGO | 0.997264 | 4.764662 |
0a330a0e-e899-4c06-9456-6419768330f9 | gdut-lmy/leetCode | singleList/23.MergeKSortedLists.cpp | //
// Created by lmy on 2022/10/9.
//
#include "common.h"
class Solution {
struct tmp {
bool operator()(ListNode *a, ListNode *b) {
return a->val > b->val;
}
};
public:
//23.合并K个升序链表
ListNode *mergeKLists(vector<ListNode *> &lists) {
if (lists.size() == 0) return null... | ALGO | 0.999971 | 5.759624 |
2ae3d1d0-40c6-4550-926b-4e94a038a970 | ArsMasiuk/DPSE | dpse2/src/3rdParty/ogdf/src/ogdf/layered/BarycenterHeuristic.cpp | #include <ogdf/layered/BarycenterHeuristic.h>
namespace ogdf {
void BarycenterHeuristic::call(Level &L)
{
const HierarchyLevels &levels = L.levels();
for (int i = 0; i <= L.high(); ++i) {
node v = L[i];
long sumpos = 0L;
const Array<node> &adjNodes = L.adjNodes(v);
for (int j = 0; j <= adjNodes.high(); ++... | ALGO | 0.999749 | 4.597473 |
590082c4-ed27-400d-a0ba-b69374b299f9 | 220001071-satya/lab6 | lab6/q3.cpp | // satya narayan
// 220001071
// strongly connected components using kosaraju algorithm
// using dfs as a subroutine so the time complexcity is again O(V + E)
#include <bits/stdc++.h>
using namespace std;
stack<int> s;
void dfs(vector<vector<int>>& adj, vector<bool>& vis, int src){
vis[src] = true;
for(auto a... | ALGO | 0.99982 | 5.232365 |
480ce06a-b62d-4fef-a7e0-2a68a59a76b3 | ishandutta2007/codeforces | monogon/normal/1186/E.cpp |
#include <bits/stdc++.h>
#define ll long long
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pii pair<int, int>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
using namespace std;
template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
... | ALGO | 0.999649 | 4.212102 |
5d15c683-811d-48eb-9d34-4107bafcd0d2 | Vertexwahn/FlatlandRT | third_party/Imath/src/Imath/ImathMatrixAlgo.cpp | ///
/// @file ImathMatrixAlgo.cpp
///
/// @brief Functions operating on Matrix22, Matrix33, and Matrix44 types.
///
// clang-format off
/// @cond Doxygen_Suppress
#include "ImathMatrixAlgo.h"
#include <algorithm>
#include <cmath>
#if defined(IMATH_DLL)
# define EXPORT_CONST __declspec(dllexport)
#else
# defin... | ALGO | 0.999866 | 5.125656 |
0a577f32-0b42-492f-91cd-848e1627da36 | syedfahadshah-f7/OOP | lab 5/task2.cpp | #include<iostream>
using namespace std;
class Loan_helper{
float amount,amnt_of_month;
int months;
public:
static const float interest_rate;
Loan_helper(){}
Loan_helper(float amount,int months){
this->amount = amount;
this->months = months;
}
void calculate(){
... | TOOL | 0.977541 | 3.799871 |
373f358b-07af-4d7e-b6b7-cb426c7c2347 | MasterIceZ/TOI17_Practice | Additional/otog_66.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define all(x) (x).begin(), (x).end()
using ll = long long;
const int MxN = 200200;
int a[MxN], b[MxN];
void solve(){
int n;
cin >> n;
for(int i=1; i<=n; ++i){
cin >> a[i];
b[i] = a[i];
}
sort(a + 1, a + n + 1);
int cnt = 0;
for(int i=1; i<=n... | ALGO | 0.999308 | 4.108979 |
65c07a70-709e-43ee-84a7-1b30972b0f95 | shashiranjan567/leetCode-solution | 1966-frequency-of-the-most-frequent-element/1966-frequency-of-the-most-frequent-element.cpp | class Solution {
public:
int maxFrequency(vector<int>& nums, int k) {
sort(nums.begin(), nums.end());
long long total = 0;
int left = 0, result = 0;
for (int right = 0; right < nums.size(); ++right) {
total += nums[right];
// Total required if all elements b... | ALGO | 0.999988 | 6.663147 |
e6a5580a-fe85-4844-91ea-5cbd8b7dda9f | arkojeet-bera/iNeuron_Assignments | Assignment_25/Q3.cpp | #include<iostream>
using namespace std;
class Factorial{
private:
int n;
int fact;
public:
Factorial(){
this->n = 1;
this->fact = 1;
}
void setN(int n){this->n = n;}
int getN(){return this->n;}
int getFact(){return this->fact... | ALGO | 0.997341 | 5.010594 |
3edaf88f-e2a2-4b9e-bdfb-cc80605788f5 | DeepthiSai2905/LeetCoding | 2692-take-gifts-from-the-richest-pile/2692-take-gifts-from-the-richest-pile.cpp | class Solution {
public:
long long pickGifts(vector<int>& gifts, int k) {
priority_queue<int>pq;
for(int gift:gifts){
pq.push(gift);
}
while(k--){
int val = pq.top(); pq.pop();
int sqrtVal = sqrt(val); pq.push(sqrtVal);
}
long long ... | ALGO | 0.999972 | 5.677542 |
483c39f2-b311-44f0-b1d1-64bf1c317fa4 | CuriousCI/codeforces | 669A.cpp | #include <iostream>
#include <cstdint>
#include <algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(NULL);
cin.tie(NULL);
uint64_t stones;
cin >> stones;
auto modulo = stones % 3;
cout << ((stones - modulo) / 3) * 2 + bool(modulo);
} | ALGO | 0.992745 | 3.459925 |
4e29e159-1aaa-4a47-81c6-c534131f2282 | foyez-hub/Competitive-programming | Competive programing/atcodder.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll t;
cin>>t;
while (t--)
{
ll k=1111111111;
ll n;
cin>>n;
int flag=0;
while (k>=11)
{
int tem=n;
if(k<=n){
if((n-k)%11==0 || (n-k)%111==0 ){
flag=1;
break;
}
}
k/=10;
}
if(flag==1){
... | ALGO | 0.999805 | 4.434822 |
a40564d2-1a87-41d4-956a-81e02c73abab | shuxing-Long/Test-Core-cpp | 基础/B2006.cpp | #include <iostream>
using namespace std;
int main(){
// x * a = base + inc * a
// y * b = base + inc * b
// inc = z
// x * a = base + z * a
// y * b = base + z * b
// y * b - x * a = z * (b - a)
// z = (y * b - x * a) / (b - a)
double x, a, y, b;
cin >> x >> a >> y >> b;
c... | ALGO | 0.988238 | 3.585143 |
bbe5ecc4-aa73-4eb6-8e2d-ae22a57b8a34 | mohankarthik/sdcnd | projects/term3/P1-PathPlanning/src/Eigen-3.3/doc/examples/Tutorial_simple_example_fixed_size.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix3f m3;
m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9;
Matrix4f m4 = Matrix4f::Identity();
Vector4i v4(1, 2, 3, 4);
std::cout << "m3\n" << m3 << "\nm4:\n"
<< m4 << "\nv4:\n" << v4 << std::endl;
}
| ALGO | 0.885355 | 3.129515 |
a2b9527f-0d4a-4ed4-acf5-39c2d9e00958 | shobhitjawa/dsAlgos | Hashing/miniumsubsetwithdistincteleme.cpp | #include <bits/stdc++.h>
using namespace std;
int subset(int arr[], int n)
{
map<int,int> m1;
for(int i=0;i<n;i++)
{
m1[arr[i]]++;
}
int max=0;
map<int,int>::iterator itr;
for(itr=m1.begin();itr!=m1.end();itr++)
{
if(max<itr->second)
{
max=itr->second;
}
}
return max;
}
int main()
{ ... | ALGO | 0.999968 | 5.284269 |
0ec619e5-a474-4e06-8466-47e8ec198e84 | GrihsaIvanenko/code228 | Tinkoff_2019_2020/18#Потоки/Максимальный поток/Code.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 500, MAXM = 10000, INF = 1e9 + 7;
vector<vector<int>> g;
vector<int> dust(MAXN), finishs(MAXM<<1), first(MAXN), C(MAXM<<1), F(MAXM<<1);
bool bfs(int Cmin, int st = 0, int fin = g.size() - 1) {
for (int i = 0; i < g.size(); ++i)
dust[i] = INF... | ALGO | 0.999959 | 4.337162 |
108b4f3b-4fd4-4bd4-a04c-7b310f8250e5 | nikhilsinha822/CP | CP problems/B_Plus_and_Multiply.cpp | #include<bits/stdc++.h>
#define int int64_t
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
using namespace std;
bool fun(int n, int a,int b){
if(a==1) return (n-1)%b==0;
for(int i=1;i<=n;i*=a)
if((n-i)%b==0) return true;
return false;
}
int32_t main(){
ios_base::syn... | ALGO | 0.999824 | 4.334519 |
55923567-0d66-42de-8ee2-8c52e716814a | k-roychoudhury/cpp_dev | projects/Seating Arrangement Generator/uttama/combinations.cpp | # include "universal.h"
using namespace std;
int global = 0;
void SWAP_STUDENT (STUDENT &ob1, STUDENT &ob2){
STUDENT temp = ob1;
ob1 = ob2;
ob2 = temp;
}
int index_present (int *arr, int size, int index){
for (int i = 0; i < size; i++){
if (arr[i] == index)
return 1;
}
return 0;
}
void delete_index (int... | ALGO | 0.915069 | 3.252577 |
b5cdea92-1753-4536-a627-60a46bbd7754 | crazyofapple/icpcacm | 网络流EK算法poj1273.cpp | #include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#define maxn 206
#define inf 0x3f3f3f3f
using namespace std;
int n, m;
int flow[maxn], pre[maxn], a[maxn][maxn];
int bfs(int source, int sink)
{
queue<int> q;
memset(pre, -1, sizeof(pre));
pre[... | ALGO | 0.999945 | 3.962867 |
316de169-cc95-432f-b9d8-9d45c0e29196 | Kaminyou/MyLeetcode | cpp_solutions/2681.cpp | class Solution {
public:
int sumOfPower(vector<int>& nums) {
sort(nums.begin(), nums.end());
long long res = 0;
long long mod = 1e9 + 7;
long long temp = 0;
for (auto& num : nums) {
res += (((long long)num * num) % mod) * (temp + num);
res %= mod;
... | ALGO | 0.999978 | 6.098453 |
65f9c21b-4e6b-46d3-840f-c33e1a5a7895 | jerryli99/system-programming-practice | classes/classes_ch14_notes4.cpp | /*
(credit https://www.learncpp.com/cpp-tutorial/const-class-objects-and-const-member-functions/)
Chapter 14.4 -- const class objects and const member functions
I find this chapter interesting.
All const variables must be initialized at time of creation.
const int x; //compile error: not initialized
const int y{}; ... | TOOL | 0.875141 | 5.979598 |
9df621e8-3d8b-427c-a644-a0613dfbf4e1 | bbreck3/PhotoExpence | tesseract-integrated/tess-two/jni/com_googlecode_tesseract_android/src/classify/normmatch.cpp | /*----------------------------------------------------------------------------
Include Files and Type Defines
----------------------------------------------------------------------------*/
#include "normmatch.h"
#include <stdio.h>
#include <math.h>
#include "classify.h"
#include "clusttool.h"
#include "cons... | ALGO | 0.942667 | 6.035338 |
f9286d68-575c-4c61-b646-4ea0d5bdeec7 | AnimeshTalukdar/btech | year2/oop/prog43.cpp | #include<iostream>
using namespace std;
class Shape2D
{
protected:
double Area,Perimeter;
public:
virtual void area()=0;
virtual void perimeter()=0;
virtual void show()=0;
};
class Circle:public Shape2D
{
double r;
public:
Circle (double R)
{
r=R;
}
void area()
{
Area = 3.14*r*r;
}
void perimeter()
{
Perimeter=2*3.14... | ALGO | 0.985622 | 4.744765 |
15fb6fbf-d477-4807-b2e1-e4d80ee685eb | YuHyeonGeun-KOR/BaekJoon | 문자열/다이얼5622.cpp | #include<iostream>
#include<cstring>
using namespace std;
#pragma warning(disable:4996)
int main() {
char word[20] = {'a',};
int Dial[26] = { 2, 2, 2, 3 ,3, 3, 4, 4, 4 ,5 , 5 ,5 ,6 ,6 ,6 ,7 ,7 ,7 ,7 ,8 ,8 ,8 ,9 ,9 ,9 ,9 };
int time = 0;
int cnt = 0;
scanf("%s", word);
f... | ALGO | 0.997456 | 3.058461 |
09e835f0-575a-4792-a32e-d355e1a773ad | BRabbitFan/brabbit_opengl_demo | library/glm/test/gtx/gtx_simd_mat4.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentatio... | TEST | 0.988103 | 6.515547 |
d7ae6898-a9c8-403e-b25d-2f76ce360981 | HeZephyr/Awesome-Algorithm-Resources | ICPC/超级联赛4/License_Plate_Recognition.cpp | /**
*@filename:License_Plate_Recognition
*@author: pursuit
*@created: 2021-08-05 10:20
**/
#include <bits/stdc++.h>
#define debug(a) cout << (#a)<< ":" << a << endl;
#define l first
#define r second
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int N = 33 + 10;
const int P = 1e9 + 7... | ALGO | 0.999027 | 3.501984 |
9598e709-f2f2-4737-b143-b5290510d021 | Rahul-Chauhan21/LeetCode | LeetCodeMayChallenge/ImplementTrie(PrefixTree).cpp | //Day 14
/*
Implement a trie with insert, search, and startsWith methods.
Example:
Trie trie = new Trie();
trie.insert("apple");
trie.search("apple"); // returns true
trie.search("app"); // returns false
trie.startsWith("app"); // returns true
trie.insert("app");
trie.search("app"); // returns true
Note:
... | ALGO | 0.998246 | 6.160428 |
b48d3db3-2a28-4f41-903f-059afbd82839 | Githubak2002/DSA-with-cpp-all-code | L867_transpose_of_matrix.cpp | // 867. Transpose Matrix
#include<iostream>
#include<vector>
// #include<algorithm>
using namespace std;
// print 2D arr ele
void print2Darr(vector<vector<int>> arr){
int rows = arr.size(),cols = arr[0].size();
for (int row = 0; row < rows; row++)
{
for (int col = 0; col < cols; col++)
{
cout<<arr... | ALGO | 0.999987 | 5.277559 |
8e43d5f8-ed19-48c7-914f-270f4862af49 | ishandutta2007/codeforces | uryuuu/normal/1277/C.cpp | #include<iostream>
#include<stdio.h>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<time.h>
#include<cstdlib>
typedef long long ll;
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define ... | ALGO | 0.999738 | 3.003165 |
481fd383-f24c-4c53-bc6b-b7929cd0c6cf | DdingJae418/coding | Test/codingbook/09.cpp | #include <iostream>
#include <stack>
#include <string>
using namespace std;
string solution(int decimal)
{
stack<int> st;
if(decimal == 0)
return "0";
while(decimal > 0)
{
st.push(decimal % 2);
decimal /= 2;
}
string s = "";
while(!st.empty())
{
s+=to_str... | ALGO | 0.999913 | 5.565141 |
aa4b9722-7349-4d01-bfc4-1d8b81338910 | himanshugupta09/LEETCODE_SOLUTIONS | 869. Reordered Power of 2.cpp | class Solution {
public:
bool reorderedPowerOf2(int n) {
string s = to_string(n);
sort(s.begin(),s.end());
for(int i=0;i<30;i++)
{
string t = to_string(1 << i);
sort(t.begin(),t.end());
if(s == t)
... | ALGO | 0.999792 | 5.983954 |
51a50b12-c675-482a-8030-137b580b18ef | himalayaashish/CPP_REV | Lab-5/Prg-13.cpp | // Define a function that takes radius and calculate area & circumference and both to the
// caller of function.
#include <iostream>
using namespace std;
void calculate_circle(float radius, float &area, float &circumference) {
area = 3.14159 * radius * radius;
circumference = 2 * 3.14159 * radius;
}
int main(... | ALGO | 0.998074 | 6.445273 |
1ea8e3dc-e5b7-4273-99e2-4972688b02fe | zilongshanren/cp-algorithms | gold/01bfs/snow-tracks-official.cpp | #include <bits/stdc++.h>
using namespace std;
int dx[4]{1, -1, 0, 0}, dy[4]{0, 0, 1, -1};
int n, m, depth[4000][4000], ans = 1;
string snow[4000];
bool inside(int x, int y) {
return (x > -1 && x < n && y > -1 && y < m && snow[x][y] != '.');
}
int main() {
iostream::sync_with_stdio(false);
cin.tie(0);
cin >> n ... | ALGO | 0.999881 | 4.694979 |
cc9f5333-2f34-4214-abb6-ed69abe8118a | thepixelheart/PixelPusher | box2d/Box2D/Dynamics/b2WorldCallbacks.cpp | #include <Box2D/Dynamics/b2WorldCallbacks.h>
#include <Box2D/Dynamics/b2Fixture.h>
// Return true if contact calculations should be performed between these two shapes.
// If you implement your own collision filter you may want to build from this implementation.
bool b2ContactFilter::ShouldCollide(b2Fixture* fixtureA, ... | TOOL | 0.922906 | 7.142647 |
b47f669e-2c94-4fa9-900e-5d0244c74e66 | SergiuMuntean/ProblemePbInfo | Rezolvari PbInfo/Clasa a IX-a/Elemente de baza ale Limbajului/Structura de decizie/urm00/main.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
if(n%100!=0)
cout << (n/100+1)*100;
else
cout << (n/100)*100;
return 0;
}
| ALGO | 0.988678 | 3.070832 |
4aafdc79-4700-42d5-aa3c-6c81193c4aad | huhuhu1092/test-server | SEHome/seengine/src/bullet/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp | #include "btSphereBoxCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
//#include <stdio.h>
btSphe... | ALGO | 0.999683 | 6.749034 |
07ceb222-5b05-4e62-b13d-00b278f6d2d3 | krahets/hello-algo | codes/cpp/chapter_tree/array_binary_tree.cpp | /**
* File: array_binary_tree.cpp
* Created Time: 2023-07-19
* Author: krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 数组表示下的二叉树类 */
class ArrayBinaryTree {
public:
/* 构造方法 */
ArrayBinaryTree(vector<int> arr) {
tree = arr;
}
/* 列表容量 */
int size() {
return tree.size();... | ALGO | 0.999413 | 5.46974 |
df2e9843-8ef9-4f6a-9e6a-b9e6a6f0fd34 | jimgsey/native | media/codecs/amrnb/enc/src/l_extract.cpp | /*
Filename: /audio/gsm_amr/c/src/l_extract.c
Date: 09/07/2000
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template. Changed function interface to pass in a
pointer to overflow flag into the function instead of using a
... | ALGO | 0.993199 | 7.030549 |
0cb8bccd-bcf5-4ae4-b6e8-786bdbf9fd8e | Fox-Rain/C_Plus_Plus | C++/072 함수 포인터2.cpp | #include<iostream>
#include<array>
using namespace std;
bool isEven(const int &number)
{
if ((number % 2) == 0) return true;
else return false; // if ų false
}
bool isOdd(const int &number)
{
if ((number % 2) != 0) return true;
else return false; // if ų false .
}
void printNumbers(const array<... | ALGO | 0.989869 | 5.542997 |
ea2d5ea7-2349-4826-8a2e-92a185394121 | choudhary-pratham/DSA_programs | Trees_Cpp/bottom_view.cpp | #include <bits/stdc++.h>
using namespace std;
struct node
{
int data;
struct node *left;
struct node *right;
node()
{
data = 0;
left = right = NULL;
}
node(int val)
{
data = val;
left = right = NULL;
}
node(int val, node *left, node *right)
{
... | ALGO | 0.999995 | 5.066692 |
cc3ce6bb-db87-46bd-82cf-55e1fe6063aa | YinaePark/Algorithm | BJ/p1620/main.cpp | #include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
int n, m;
cin >> n >> m;
map<string, int> pocketMon;
vector<string> pocketMon2;
for(int i=1; i<=n; i++){
stri... | ALGO | 0.999617 | 4.551813 |
408da4bb-6c57-4455-82d5-ec679c7542ca | SnehaKumari3/codeforces_practice_problems | D_Permutation_Restoration.cpp | #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef int64_t ll;
typedef long double ld;
typedef double db;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector... | ALGO | 0.99998 | 3.609314 |
d5afeb09-24ba-482a-9cd6-9fce95eae831 | akash-suklabaidya/Graph---DSA | Topological Sort/G28_Shortest_path_in_Undirected_Graph_having_unit_distance.cpp | #include <bits/stdc++.h>
using namespace std;
void adjacencylist(vector<int> adj[], int V)
{
for (int i = 0; i < V; i++)
{
cout << i << "->";
for (int &x : adj[i])
{
cout << x << " ";
}
cout << endl;
}
}
int main()
{
vector<vector<int>> edges = {{0,... | ALGO | 0.999948 | 4.48555 |
9bc93289-5903-4b03-8f36-84854c996655 | Giri-25/Logic-building-programs | Logic_Building_Programs/program557.cpp | #include<iostream>
using namespace std;
template <class T>
class ArrayX
{
public:
T *Arr;
int iSize;
ArrayX(int Value);
~ArrayX();
void Accept();
void Display();
bool LinearSearch(T Value);
bool BiDirectionalSearch(T Value);
bool BinarySearch... | ALGO | 0.999785 | 3.998332 |
161c9f8d-f007-45bb-a83b-af1382148775 | ishandutta2007/codeforces | ssrs_/normal/1592/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
for (int i = 0; i < t; i++){
int n, H;
cin >> n >> H;
vector<int> a(n);
for (int j = 0; j < n; j++){
cin >> a[j];
}
int mx1 = 0, mx2 = 0;
for (int j = 0; j < n; j++){
if (a[j] > mx1){
mx2 = m... | ALGO | 0.999859 | 3.567329 |
7ff944a5-6a42-4061-a428-52568dfed883 | tinyfrog/Data-Structure-Algorithm | Easy/Q16481(원 전문가 진우).cpp | #define _CRT_SECURE_NO_WARNINGS
using namespace std;
#include <cstdio>
int main(void)
{
int r1, r2, r3;
scanf("%d %d %d", &r1, &r2, &r3);
printf("%.6f\n", (float) (r1 * r2 * r3) / (r1*r2 + r2*r3 + r3*r1));
return 0;
}
// ó : https://www.acmicpc.net/problem/16481
// 16481
// | ALGO | 0.997863 | 4.133738 |
e284b9b0-7ca1-43f9-857f-57a887c814f2 | jeyajseo/samsung-SWTest-type-A | 드래곤커브_15685.cpp | #include<stdio.h>
#include<vector>
#include<stack>
using namespace std;
int n;
int check[102][102];
vector<int> v;
int dx[5] = { 1, 0, -1, 0 };
int dy[5] = { 0, -1, 0, 1 };
void dragoncurve(int dir, int gen){
stack<int> s;
stack<int> temp_s;
s.push(dir);
for (int g = 0; g < gen; g++){
while (!s.empty()){
... | ALGO | 0.99955 | 3.962552 |
4bbf16fb-0f4c-4a2b-8f66-65337b0002a6 | congkcks/Code-C-OOP | thu phep tinh.cpp | #include<bits/stdc++.h>
using namespace std;
void tron(int a[],int l,int mid,int r){
vector<int> x(a+l,a+mid+1);
vector<int> y(a+mid+1,a+r+1);
int i=0;int j=0;
while(i<x.size()&&j<y.size()){
if(x[i]<=y[j]){
a[l]=x[i];
i++;
l++;
}
else{
a[l]=y[j];
j++;
l++;
}
}
while(i<x.size()){
a[l... | ALGO | 0.999981 | 3.985356 |
c78c787c-45c8-40e3-b2f8-2d1774438fd5 | aymanshalaby55/leetcode-dailyQuestion | 2466-Count-Ways-To-Build-Good-Strings.cpp | class Solution {
public:
int countGoodStrings(int low, int high, int zero, int one) {
// Use dp[i] to record to number of good strings of length i.
vector<int> dp(high + 1);
dp[0] = 1;
int mod = 1000000007;
// Iterate over each length `end`.
for (int end = 1; end... | ALGO | 0.999888 | 5.709688 |
a5132d10-974b-44dd-9293-9acf8b1c8698 | THeWakeSystems/fcc | tests/samples/58/code.cpp | #include <bits/stdc++.h>
using namespace std;
using U32 = unsigned int;
const U32 P = 1e8 + 7;
inline U32 add_mod(U32 a, U32 b) {
U32 ret = a + b;
return ret < P ? ret : ret - P;
}
inline U32 sub_mod(U32 a, U32 b) {
U32 ret = a - b;
return a < b ? ret + P : ret;
}
inline U32 mul_mod(U32 a, U32 b) { retu... | ALGO | 0.999936 | 4.161691 |
005f02af-48ca-45a1-bb71-2e2ec989ae43 | codebusted/Competitive-Programming | Study/GFG DSA Workshop/week 1/arrays/mergeSortedArr.cpp |
#include <iostream>
using namespace std;
void mergeSorted(int n, int m, int arr1[], int arr2[], int arr3[] ) {
int i = 0, j = 0, k = 0;
while(i < n && j < m) {
if(arr1[i] < arr2[j])
arr3[k++] = arr1[i++];
else
arr3[k++] = arr2[j++];
}
while(i < n)
arr3[k++] = arr1[i++];
while... | ALGO | 0.999982 | 3.940006 |
1e94f0a6-d37c-4a50-b46f-3cdd477db6c3 | Shivam-TyagiG/LeetCode-Solutions | 0920-number-of-music-playlists/0920-number-of-music-playlists.cpp | class Solution {
public:
int numMusicPlaylists(int n, int goal, int k) {
const int MOD = 1e9 + 7;
vector<vector<long long>> dp(2, vector<long long>(n+1, 0));
dp[0][0] = 1;
for (int i = 1; i <= goal; i++) {
dp[i%2][0] = 0;
for (int j = 1; j <= min(i, n); j++) ... | ALGO | 0.999989 | 5.53857 |
df2ca29d-b17f-4fee-945d-7ff3130c0323 | adamfisk/smartfiles | src/ScriptingCore/URI.cpp | #ifdef _WIN32
#include "win_targetver.h"
#endif
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/logic/tribool.hpp>
#include <vector>
#include <sstream>
#include <boost/asio.hpp>
#include "precompiled_headers.h" // On windows, everything ... | TOOL | 0.951346 | 6.899257 |
c49437b9-fef4-4c44-87ce-ccd3b1ec5274 | fylz1125/MoonWarriors | MoonWarriors/libs/cocos2dx/cocoa/CCAffineTransform.cpp | #include "CCAffineTransform.h"
#include <algorithm>
#include <math.h>
using namespace std;
NS_CC_BEGIN
CCAffineTransform __CCAffineTransformMake(float a, float b, float c, float d, float tx, float ty)
{
CCAffineTransform t;
t.a = a; t.b = b; t.c = c; t.d = d; t.tx = tx; t.ty = ty;
return t;
}
CCPoint __CCPoin... | TOOL | 0.851102 | 5.999494 |
09940a43-f2d0-4433-9ef8-591ec987fb2a | sogood99/cpp-comp | shopaholic/shopaholic.cpp | #include <bits/extc++.h>
#include <bits/stdc++.h>
#define LSOne(S) ((S) & -(S))
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tre... | ALGO | 0.999973 | 4.270104 |
4d617257-c0cf-42bc-a4ba-bfaeb84f5f34 | varun-thota27/Leetcoding | 2657-find-the-prefix-common-array-of-two-arrays/2657-find-the-prefix-common-array-of-two-arrays.cpp | class Solution {
public:
vector<int> findThePrefixCommonArray(vector<int>& A, vector<int>& B) {
int n = A.size();
vector<int> C(n, 0);
vector<bool> seen(n + 1, false);
int cnt = 0;
for (int i = 0; i < n; ++i) {
if (seen[A[i]]) cnt++;
if (seen[B[i]]) c... | ALGO | 0.999961 | 6.122835 |
e42d44ef-0983-4d17-8b4d-1ea787e5ded4 | PalashHawee/Data-Structures-and-Algorithms-My-Preparation-for-Software-Engineering | String/Words_Counting.cpp | //COUNTING WORDS IN A STRING
#include<stdio.h>
int main()
{
char A[]="How are you";
int i, word=0;
for(i=0;A[i]!='\0';i++)
{
if(A[i]==' '&&A[i-1]==' ')
{
word++;
}
}
printf("%d", word+1);
}
| ALGO | 0.990015 | 3.56098 |
7d70d741-a805-4a2e-abf8-5cb8864eb54b | thierrydumas/autoencoder_based_image_compression | kodak_tensorflow/hevc/HM-16.15/source/Lib/TLibCommon/TComLoopFilter.cpp | /** \file TComLoopFilter.cpp
\brief deblocking filter
*/
#include "TComLoopFilter.h"
#include "TComSlice.h"
#include "TComMv.h"
#include "TComTU.h"
//! \ingroup TLibCommon
//! \{
// ====================================================================================================================
// Cons... | ALGO | 0.932337 | 3.171092 |
4d48a664-98f5-4062-a2cc-9a70d9e51ad8 | y-aut/AtCoder | src/abc/329/e.cpp | #pragma region "Template"
#define TEMPLATE_H
#include <atcoder/all>
#include <bits/stdc++.h>
#include <gmpxx.h>
using namespace std;
using namespace atcoder;
// clang-format off
#ifndef DEBUG
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
struct Fast { Fast() { cin.tie(0); ... | ALGO | 0.999969 | 6.76373 |
14ffccee-04d1-4faa-adc2-c007ee70378c | violett-g/Vector-Similarity-Search-and-Clustering-Algorithms | method.cpp | #include "method.h"
Method::Method(int arg_k, int arg_N, double arg_r, vector<Item*>arg_data, vector<Item*> arg_queries): k(arg_k), N(arg_N), r(arg_r), data(arg_data), queries(arg_queries){}
Method::~Method(){}
vector<chrono::duration<double> > Method::get_time(){
return time;
}
double Method::get_r(){
retu... | ALGO | 0.997647 | 4.012762 |
0ee2b579-3e24-41fb-acf6-576345b48f27 | Harshvg2021/Online-Judge | Backend/code-uploads/9e864591-5d77-495a-a10a-bca128399b2c.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;cin>>t;
while(t--){
int n,k;
cin>>n>>k;
vector<int> v(n);
map<int,int> m;
for(auto &it: v){
... | ALGO | 0.999925 | 3.984024 |
f215030a-9236-4807-ae38-d45ed2691eab | jdrain/cs569 | programs/assignment1/Assignment_1/Smoothing.cpp | /**
* file Smoothing.cpp
* brief Sample code for simple filters
* author OpenCV team
*/
#include <iostream>
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <sys/timeb.h>
using namespace std;
using namespace cv;
Mat src;
Mat cp1;
Mat cp2;
Mat cp3;
char wind... | TOOL | 0.922735 | 5.190716 |
bf7aa640-ae9d-410b-9078-c824d0a8b2d8 | sarvex/leetcode-ion | solution/0800-0899/0827.Making A Large Island/Solution.cpp | class Solution {
public:
const static inline vector<int> dirs = {-1, 0, 1, 0, -1};
int largestIsland(vector<vector<int>>& grid) {
int n = grid.size();
vector<int> p(n * n);
vector<int> size(n * n, 1);
iota(p.begin(), p.end(), 0);
function<int(int)> find;
find = ... | ALGO | 0.999902 | 6.189507 |
4440fdf8-f890-4174-924e-818064b022b1 | evilmucedin/project-euler | leetcode/maximum-gap/maximum-gap.cpp | #include "../header.h"
using IntVector = vector<int>;
void radixSort(IntVector& vct) {
IntVector counts((1 << 8) + 1);
IntVector temp(vct.size());
for (auto shift : {0, 8, 16, 24}) {
const u32 mask = ((1UL << 8) - 1) << shift;
fill(counts.begin(), counts.end(), 0);
for (auto v: vct... | ALGO | 0.999822 | 5.210494 |
b58b820f-5c4b-4f3f-a17a-5445d0cbcbe5 | dimitaruzunov/oop-practicum-2015-16 | week13/solutions/problem1/sequence.cpp | #include <iostream>
class Sequence {
public:
virtual int get(int i) const = 0;
virtual int sum() const = 0;
virtual int product() const = 0;
virtual void print() const = 0;
virtual ~Sequence() {}
};
class Range : public Sequence {
int start, end, step;
public:
Range(int _start = 0, int ... | TOOL | 0.979702 | 5.669984 |
64f85207-684d-4acd-ae6a-3104cd4e5585 | toyobayashi/mp-qrcode-helper | deps/zxing-cpp/core/src/qrcode/QRMatrixUtil.cpp | #include "QRMatrixUtil.h"
#include "BitArray.h"
#include "BitHacks.h"
#include "QRDataMask.h"
#include "QRErrorCorrectionLevel.h"
#include "QRVersion.h"
#include <array>
#include <stdexcept>
#include <string>
namespace ZXing::QRCode {
// From Appendix D in JISX0510:2004 (p. 67)
static const int VERSION_INFO_POLY = ... | ALGO | 0.994008 | 6.141389 |
9445fa05-5ac1-4f13-afbd-9db1757d7256 | Masters-Akt/CS_codes | leetcode_sol/38-Count_And_Say.cpp | class Solution {
public:
string countAndSay(int n) {
if (n == 0) return "";
string res = "1";
while (--n) {
string cur = "";
for (int i = 0; i < res.size(); i++) {
int count = 1;
while ((i + 1 < res.size()) && (res[i] == res[i + 1])){
... | ALGO | 0.99999 | 7.280626 |
0409bf84-821d-456e-aa7f-0d70974bc8f3 | swapnil-tayal/DSA | 3639-zero-array-transformation-i/zero-array-transformation-i.cpp | class Solution {
public:
bool isZeroArray(vector<int>& nums, vector<vector<int>>& queries) {
int n = nums.size();
vector<int> a(nums.size(), 0);
for(auto i: queries){
int s = i[0];
int e = i[1];
a[s]++;
if(e+1 < n) a[e+1]--;
}
... | ALGO | 0.99965 | 6.029254 |
b0ccf8b6-c930-4805-9ab7-5b7dd040b30b | DudekulaRaheem/Csa5149cryptography | 21 ECB CBC CFB.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#define BLOCK_SIZE 16
void mock_block_cipher_encrypt(uint8_t *block, uint8_t *key)
{
for (int i = 0; i < BLOCK_SIZE; i++)
{
block[i] ^= key[i];
}
}
void mock_block_cipher_decrypt(uint8_t *block, uint8_t *key)
{
for ... | ALGO | 0.992757 | 4.086506 |
49dba16d-9ebc-48ad-9f14-7de830a2ca88 | upsj/ginkgo-bot-playground | dpcpp/distributed/vector_kernels.dp.cpp | #include "core/distributed/vector_kernels.hpp"
#include <ginkgo/core/base/exception_helpers.hpp>
namespace gko {
namespace kernels {
namespace dpcpp {
namespace distributed_vector {
template <typename ValueType, typename LocalIndexType, typename GlobalIndexType>
void build_local(
std::shared_ptr<const DefaultExe... | TOOL | 0.963167 | 6.396805 |
8004cd77-617e-4ebb-96e5-62cc591c7574 | Ivan-Saldarriaga/Individual_Works | Programming 1 & 2/PageRank Algorithm/Page_Rank.cpp |
#include <iostream>
#include <map>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <iterator>
using namespace std;
class AdjacencyList
{
private:
// Think about what member variables you need to initialize
map<string, int> outDegreeGraph;
map<string, vector<pair<string, float>>> ... | ALGO | 0.999844 | 4.950491 |
1294873b-275b-42fe-bb80-9760b6b3a0b3 | Daria-Donina/spbu1stYear | sem1/hw6/hw6.4/hw6.4/main.cpp | #include <iostream>
#include <fstream>
#include "list.h"
#include "mergeSort.h"
#include "test.h"
using namespace std;
void printPhonebook(List *list)
{
ListElement *current = getHead(list);
while (current != nullptr)
{
cout << getName(current) << " - " << getNumber(current) << endl;
current = getNext(current... | TOOL | 0.97524 | 4.208173 |
7a2bed9f-95ef-4f45-8a03-ef3ae4a6ac96 | jsren/llvm-detex | llvm/lib/CodeGen/StackSlotColoring.cpp | #include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveStacks.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "... | ALGO | 0.969793 | 7.843668 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.