uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
667755fa-cbde-4d84-abf9-c0f4dcc96cd9 | JAYKUMARGUPTA73/CODES | Advance_dsa/endsem_practicle/heapsort[1].cpp | #include <iostream>
#include <vector>
using namespace std;
// Function to heapify a subtree rooted at index i
void heapify(vector<int>& arr, int n, int i) {
int largest = i; // Initialize largest as root
int left = 2 * i + 1; // left = 2*i + 1
int right = 2 * i + 2; // right = 2*i + 2
// If ... | ALGO | 0.999968 | 5.715966 |
46229a17-9416-40af-bf52-d3f016fd4eaa | aditya-kumar-129/GFG-Practice | Merge K sorted linked lists.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node* next;
Node(int x) {
data = x;
next = nullptr;
}
};
// Method 2:- Below implmentation does not uses any space Space Complexity = O(1)
// It uses the concept of Merge Sort
// Iterative approach
// SPACE COMPLEXITY :- O(N) or O(n... | ALGO | 0.999967 | 5.662198 |
22af9ef8-451a-4157-b189-cef4df294a20 | vrinda22/DS-ALGO | TREES/sum_of_bt.cpp | /*Given a Binary Tree of size N, your task is to complete the function sumBt(), that should return the sum of all the nodes of the given binary tree.
Input:
First line of input contains the number of test cases T. For each test case, there will be two lines:
First line of each test case will be an integer N denoting... | ALGO | 0.999519 | 5.362444 |
853bcf2e-e9d9-45d7-a7a4-624ad1bedec2 | jocic/jocic | libraries/opencv/4.8.0/samples/cpp/lkdemo.cpp | #include "opencv2/video/tracking.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
#include <ctype.h>
using namespace cv;
using namespace std;
static void help()
{
// print a welcome message, and the OpenCV version
cout << "\nThis is a demo ... | ALGO | 0.981223 | 5.98176 |
5c04225a-d012-41c6-a42d-7c59729ec196 | faterazer/LeetCode | 0123. Best Time to Buy and Sell Stock III/Solution.cpp | #include <vector>
using namespace std;
class Solution {
public:
int maxProfit(vector<int>& prices)
{
int buy1 = -prices[0], sell1 = 0, buy2 = -prices[0], sell2 = 0;
for (size_t i = 1; i < prices.size(); i++) {
buy1 = max(buy1, -prices[i]);
sell1 = max(sell1, buy1 + price... | ALGO | 0.99989 | 5.888926 |
c7943242-0836-4bf7-a94a-c992e909a06d | youbeen2798/Programmers-problems | P_로또의 최고 순위와 최저 순위.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
vector<int> solution(vector<int> lottos, vector<int> win_nums) {
vector<int> answer;
sort(lottos.begin(), lottos.end());
sort(win_nums.begin(), win_nums.end());
int cnt = 0;
int zero_cnt = 0;
fo... | ALGO | 0.99988 | 4.40986 |
1b348fba-e8b3-47ee-affa-69b02132361f | Hoshinonono/cp-library | Test/yukicoder/yuki2642.test.cpp | #define PROBLEM "https://yukicoder.me/problems/no/2642"
#include <bits/stdc++.h>
#include <Graph/dsu_02_max.hpp>
using namespace std;
using ll = long long;
using T = tuple<int,int,int,int>;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll N, K, C, c = 0;
cin >> N >> K >> C;
vector<T> edge(K... | ALGO | 0.999424 | 4.257803 |
ad08f77c-8750-43d0-aa24-efcaa7c67d53 | raincross7/code-similarity | codes/train_code/problem306/problem306_178.cpp | //
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define REP(i,e,s) for(register int i=e; i<=s; i++)
#define DREP(i,e,s) for(register int i=e; i>=s; i--)
#define ll long long
#define DE(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG(a) DE("DEBUG: %d\n",a)
int read() {
int ... | ALGO | 0.999941 | 3.320148 |
84d9757b-9f3f-4c2c-b520-fec4fa1c280d | Sue217/PracticeCodeFolder | CodeForces/r784_div4/f.cpp | /**
* author: subobo
* created: 21.04.2022 23:27:22
**/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int tt;
cin >> tt;... | ALGO | 0.999659 | 5.147954 |
7bfe34b0-78c8-44c5-96f9-e04404839bc8 | Cram3r95/Late-Sensor-Fusion | src/Hungarian.cpp | #include <stdlib.h>
#include <cfloat> // for DBL_MAX
#include <cmath> // for fabs()
#include "Hungarian.hpp"
HungarianAlgorithm::HungarianAlgorithm(){}
HungarianAlgorithm::~HungarianAlgorithm(){}
//********************************************************//
// A single function wrapper for solving assignment problem.... | ALGO | 0.999901 | 5.731599 |
5f8364f8-c296-4214-9f84-4220c40b72b7 | ewized/cs-cpp | hanoi/hanoi.cpp | #include <iostream>
using namespace std;
int size;
void print(int size, int tower_one, int tower_two, int tower_three) {
for (int i = 0; i < size ; i++) {
if (--tower_one >= 0) {
cout << "[]";
}
else {
cout << " ";
}
cout << " | ";
if (--... | ALGO | 0.99946 | 5.66268 |
f66cf5f7-9a10-44f4-b03d-deee1d0fdaaa | levendlee/data-structure-and-algorithms | c++/leetcode/0050-Pow(x,_n)-M.cpp | // 50 Pow(x, n)
// https://leetcode.com/problems/powx-n
// version: 1; create time: 2020-01-30 23:20:58;
class Solution
{
public:
double myPow(double x, long n)
{
bool neg = n < 0;
if (x == 1)
return 1;
if (n == 0)
return 1;
n = abs(long(n));
doub... | ALGO | 0.999965 | 6.457677 |
de677064-3a97-49e4-ab50-2a71ef194972 | leehi0110/Algorithm | BaekjoonAlgorithm/P2001_P4000/P2490.cpp | // ProblemNumber || ProblemName : 2490 - 윷놀이
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios_base ::sync_with_stdio(false);
cin.tie(NULL);
vector<char> play = {'D', 'C', 'B', 'A', 'E'};
for (int i = 0; i < 3; i++)
{
int a, b, c, d;
... | ALGO | 0.999869 | 4.323521 |
106d28eb-fe7a-41f3-b4b0-7c51b2e0c1c9 | ishandutta2007/codeforces | gyh20/normal/1553/B.cpp | #include<bits/stdc++.h>
#define re register
using namespace std;
inline int read(){
re int t=0;re char v=getchar();
while(v<'0')v=getchar();
while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
return t;
}
const int M=998244353;
inline void add(re int &x,re int y){(x+=y)>=M?x-=M:x;}
inline int ksm(re int x,re int y){
re... | ALGO | 0.99999 | 4.952157 |
a2f52754-4c93-4a5c-aff9-ab8b466b8d77 | chaehni/AlgoLab | 2018/week7/portfolios/portfolios.cpp |
#include <iostream>
#include <cassert>
#include <CGAL/QP_models.h>
#include <CGAL/QP_functions.h>
// choose exact rational type
#include <CGAL/Gmpq.h>
typedef CGAL::Gmpq ET;
typedef CGAL::Quotient<ET> SolT;
typedef CGAL::Quadratic_program<ET> Program;
typedef CGAL::Quadratic_program_solution<ET> Solution;
using nam... | ALGO | 0.999786 | 4.621697 |
74052e90-618b-4cbc-bca6-b53aeed0b8a8 | RKGekk/vulkan_masic | src/tools/string_tools.cpp | #pragma warning(disable : 4996)
#include "string_tools.h"
std::wstring ConvertString(const std::string& string) {
static std::locale loc("");
auto& facet = std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(loc);
return std::wstring_convert<std::remove_reference<decltype(facet)>::type, wchar_t>(&... | TOOL | 0.928707 | 4.653772 |
d0bcf992-207d-4cf2-93ec-ff2bd4c00123 | BalajiKhavane/DSA | 50_Pow(x, n).cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
double myPow(double x, int n){
if(n == 0) return 1.0;
if(x == 0) return 0.0;
if(x == 1) return 1.0;
if(x == -1 && n%2 == 0) return 1.0;
if(x == -1 && n%2 != 0) return -1.0;
long bitform = n;
if(n < 0){
bitform = -bitf... | ALGO | 0.999756 | 4.09 |
a9a3b94d-e4cf-4ca0-8017-01b62d6526a0 | vanniee2401/DSA_IT003.P213 | Week1_Searching/EqualDiverse.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
#define MAX 300000
void NhapMang(int, int[]);
void EqualDiverse(int, int, int, int, int[], vector<bool> &);
int main()
{
ios_base::sync_with_stdio(false); // Tăng tốc độ nhập/xuất
cin.tie(NULL);
int T, N, K;
int a[MAX]... | ALGO | 0.999834 | 4.230357 |
d887cedd-b9d5-41df-aacf-1babbba0c190 | WinCNT-SHIM/Practice_ModernC- | RangeBasedFor/main.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
//int sumArray(int array[]) // int array[] == int* array
int sumArray(vector<int> array)
{
int sum = 0;
//for (const auto& num : array) // error
for (const auto& num : array) // error
sum += num;
return sum;
}
int main()
{
int arr[10... | ALGO | 0.977722 | 4.112594 |
63f2d7a8-6300-439b-a0bb-c81fda98b141 | hojinyun/Algorithm-and-Data-Structure | Problems/Baek Joon Problems/#2751 수 정렬하기 2(병합정렬 풀이).cpp | #include <iostream>
using namespace std;
int sorted[1000000];
void merge(int numbers[], int start, int middle, int end){
int i = start;
int j = middle + 1;
int k = start;
while(i <= middle && j <= end){
//i j ū sorted[] ϸ鼭
if(numbers[i] <= numbers[j]){
sorted[k] = numbers[i];
i++;
} else{
... | ALGO | 0.999989 | 4.827538 |
c759c0b9-bca9-4b34-a0ea-6256cd4eb26e | harry-dev98/CompetitiveCodingSolutions | DP/MinSumPartition.cpp | #include<bits/stdc++.h>
using namespace std;
int MinSubsetSumTopDown(int A[], int n, int S){
bool DP[n+1][S+1];
for(int i=0; i<=n; i++){
DP[i][0] = 1;
}
for(int i=1; i<=S; i++){
DP[0][i] = 0;
}
int a;
for(int i=1; i<=n; i++){
for(int j=1; j<=S; j++){
a = ... | ALGO | 0.999978 | 4.06396 |
d59267d8-b241-496c-8685-18e3a773b675 | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/cmap/distance_search/train/c1a29196-d53f-4aa5-9c1c-333030cf9921.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
#include <iomanip>
#include <math.h>
using namespace std;
class punct{
public:
unsigned long long x;
unsigned long long y;
bool operator <(const punct p2) const
{
return x < p2.x;
}
};
int n, i, j;
... | ALGO | 0.99985 | 3.692799 |
edafc69e-02c7-4843-ba5e-217712dafac1 | supakornPanya/CompetitiveProgramming | Data_Algo/a60b_q1_diagsum.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
int ans = INT_MIN;
vector<vector<int>> dp(n + 1, vector<int>(n + 1, 0));
for(int i = 1;i <= n;i++) {
for(int j = 1;j <= n;j++) {
cin >> dp[i][j];
ans = max(ans, dp[i][j]);
}
}
fo... | ALGO | 0.999942 | 3.757363 |
34832868-0fc8-42aa-b27c-fc4dceddffde | Tukekehaohaonuli/algorithm | LeetCode/9.cpp | #include<iostream>
using namespace std;
class Solution{
public :
bool isPalindrome(int x) {
if(x<0){
return false;
}
int value=x;
int ans=0;
while(x!=0){
int b=x%10;
x/=10;
ans=ans*10+b;
}
if(ans==value){
... | ALGO | 0.999732 | 4.86715 |
259b7de5-0a17-430e-a0e7-644cbb26dd84 | ishandutta2007/codeforces | tfg/normal/1556/C.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>
std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());
int main() {
std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
int n;
std::cin >> n;
std::vector<long long> a(n);
for(int i = ... | ALGO | 0.999957 | 4.076209 |
3e790344-4a6f-4d99-a21d-b79c3e721d20 | YousefSameh25/LeetCode | 1671-minimum-number-of-removals-to-make-mountain-array/1671-minimum-number-of-removals-to-make-mountain-array.cpp | class Solution {
public:
vector < vector < int >> dp;
int R (int i, int prvi, vector<int>& nums)
{
if (i >= nums.size())
return 0;
int &ret = dp[i][prvi];
if (~ret)
return ret;
ret = R(i + 1, prvi, nums);
if (nums[prvi] > nums[i])
... | ALGO | 0.999986 | 5.652506 |
46d459cb-d2fe-4812-8d69-e44afdf615c5 | suvarnsingrajput2004/Suvarnsing_Rajput_FBS | FBS/C/Assignment/Assignment 13/mergedArray,c.cpp | #include <stdio.h>
#include <stdlib.h>
int main() {
int n1, n2, i;
int *a, *b, *merged;
printf("Enter size of first array: ");
scanf("%d", &n1);
a = (int *)malloc(n1 * sizeof(int));
printf("Enter elements of first array:\n");
for (i = 0; i < n1; i++) {
scanf("%d", &a[i]);
}
... | ALGO | 0.999724 | 3.905154 |
d14413ca-2322-47e7-9248-0587b3d58e02 | Cgfyufsygsm/OI-Codes | Luogu/P3975.cpp | #include <cstdio>
#include <cstring>
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define DEC(i, a, b) for (int i = a; i >= b; --i)
#define il inline
typedef long long ll;
const int maxn = 5e5 + 5;
struct node {
int ch[26], fa, len;
} sam[maxn << 1];
int t, k, len, tot = 1, las = 1;
ll size[maxn << 1], sum... | ALGO | 0.999988 | 3.606445 |
3be82fe4-c183-4c02-b775-d9cdb0c73c38 | ishandutta2007/codeforces | pyqe/normal/1616/B.cpp | #include <bits/stdc++.h>
using namespace std;
long long n,a[100069];
int main()
{
long long t,rr,i,z;
char ch;
scanf("%lld",&t);
for(rr=0;rr<t;rr++)
{
scanf("%lld",&n);
for(i=1;i<=n;i++)
{
scanf(" %c",&ch);
a[i]=ch-'a';
}
if(a[1]==a[2])
{
z=1;
}
else
{
for(i=1;i<n&&a[i]>=a[i+1];i... | ALGO | 0.999963 | 3.348386 |
6e188965-eb31-489c-8ee2-473d8a027f3c | ishandutta2007/codeforces | darkkcyan/normal/1704/E.cpp | #include <bits/stdc++.h>
using namespace std;
// #define constexpr(...) (__VA_ARGS__)
using ll = long long;
using ld = long double;
const ld eps = 1e-8;
// for matching the kactl notes
#define sz(x) ((int)x.size())
#define rep(i,a,b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define pri... | ALGO | 0.999879 | 4.548914 |
0622af5c-9402-4a75-85ea-3f73c3735673 | Kiran-116/CSES-Problem-Set | Introduction Problems/07_Two_Knights.cpp | #include <bits/stdc++.h>
using namespace std;
long long solve(long long n)
{
long long totalPos = (n * n) * (n * n - 1) / 2;
long long attackPos = 4 * (n-1) * (n-2);
return totalPos - attackPos;
}
int main()
{
long long n;
cin >> n;
for (long long k = 1; k <= n; k++)
{
cout << so... | ALGO | 0.999853 | 4.491057 |
76ad443e-10a2-4503-b8d6-573187a47713 | vuicash/fake | src/net_permissions.cpp | #include <net_permissions.h>
#include <netbase.h>
#include <util/error.h>
#include <util/system.h>
#include <util/translation.h>
// The parse the following format "perm1,perm2@xxxxxx"
bool TryParsePermissionFlags(const std::string str, NetPermissionFlags& output, size_t& readen, std::string& error)
{
NetPermission... | TOOL | 0.980518 | 6.319347 |
df43a0aa-d961-4bf4-b645-e67a09ccc751 | sour-soup/zavrs-codebook | nt/ntt.cpp | extern const int MOD = 998244353;
const int LOGN = 20; // for every logn find own root
const int g = 3; // calc find_root
vector<Mint> w[LOGN];
vector<int> rv[LOGN];
int find_root() {
for (int x = 1; x < mod; ++x)
if (binpow(x, 1 << POW) == 1
&& binpow(x, 1 << (POW - 1)) != 1)
return x;
... | ALGO | 0.999671 | 4.200119 |
3d978e13-1291-461d-a40a-43fc669bccf7 | SourovCodes/c-programming | codeforces-contest/1972/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
int n, k;
bool isPos(int arr[], int mid)
{
int takaAse = k;
for (int i = 0; i < n; i++)
{
if (arr[i] < mid)
{
takaAse -= mid - arr[i];
if (takaAse < 0)
{
... | ALGO | 0.99996 | 4.67693 |
8726b802-7d33-4abb-8308-418fda805116 | Gaurav14cs17/Leetcode | Stack/2289. Steps to Make Array Non-decreasing.cpp | /*
https://leetcode.com/problems/steps-to-make-array-non-decreasing/
*/
class Solution {
public:
int totalSteps(vector<int>& nums) {
int n = nums.size();
stack<int>st;
vector<int>dp(n,0);
for( int i = n-1 ; i>=0 ; --i){
while(!st.empty()&& nums[i] > nums[st.top()]){
... | ALGO | 0.99998 | 6.279419 |
75f92b50-9e3f-4c07-b5cf-2fd7bde51f78 | Fraunhofer-AISEC/softboundcets-llvm-project | libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
// requires ShuffleIterator<Iter>
// && CopyConstructible<Compare>
// void
// sort(Iter first, Iter last, Compare comp);
#include <algorithm>
#include <functional>
#include <vector>
#include <cassert>
... | TEST | 0.983853 | 5.644898 |
d50a798b-a975-4ef1-b538-0085fb3f8938 | LeePenn/Competitive-Programming | AOAPC-II/ch5/UVa212.cpp | // Joker
#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator << (ostream& os, vector<T> v) {
for (int i = 0; i < v.size(); i++) {
os << v[i] << ' ';
}
return os;
}
enum eventType { opFree = 0, opPre = 1, reFree = 3, rePre = 4 };
struct Room {
int pat, minutes... | ALGO | 0.960194 | 4.426478 |
da13ae9e-a828-4a7d-a77d-8985259b683e | mohit701473/cpp | DSA Questions/Topic - 16 DP/Step 3 - DP on Subsequences or Subsets/Que9_coinChangePart2.cpp | // LeetCode -> 518. Coin Change II
https://leetcode.com/problems/coin-change-ii/
// Approch -> 1: Recursion
// T.C. = Exponential
// S.C. >> O(N)
class Solution {
int solveRecursive(int idx, int target, vector<int> &coins){
// Base cases
if(idx == 0)
return (target % coins[0] == 0) ;
... | ALGO | 0.999924 | 6.38393 |
6e10fed9-a922-4dac-a12a-85045763fdec | manikanta2901/ubuntu | .history/practice/cpp/Codechef/InterestingXor_20210312190640.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long int
string getBinary(ll n){
ll a =0,b = 0;
string binary = "\0";
while(n > 0){
b = n % 2 ;
binary += to_string(b);
n = n/2 ;
}
reverse(binary.begin(),binary.end());
cout << binary << endl;
return binary;
}
ll g... | ALGO | 0.999588 | 4.824837 |
2b275771-609d-467d-93c9-c827237cae71 | FrancescoMinisini/gituni | 2023/Lezione8/Esercizio1/main.cpp | #include "Models/EquazioniDifferenziali.h"
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include "TApplication.h"
#include "TAxis.h"
#include "TCanvas.h"
#include "TGraph.h"
#include <armadillo>
using namespace std;
std::string convert ( double h ) ;
int main (int argc, char** argv ) ... | ALGO | 0.99155 | 3.862454 |
9512671c-e29d-44cb-a16c-a3873b348e60 | ransherraj/DSA | Recursion/8. CheckPalindrome.cpp | /*
Check Palindrome
*****Best Approach****
Self Explainatory
*/
#include <bits/stdc++.h>
using namespace std;
bool solve3(string &s, int i, int j){
if(i > j) return true;
if(s[i] != s[j]) return false;
return solve3(s, i+1, j-1);
}
void solve(){
string s;
cin>>s;
int n = s.size();
... | ALGO | 0.999806 | 5.475619 |
0e51c4b6-7b8f-4320-8aa2-6e39d4907c9a | kweonminsung/BOJ | 1463/main.cpp | #include <bits/stdc++.h>
using namespace std;
int F[1000000];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
F[1] = 0;
for (int i = 2; i <= n; i++) {
F[i] = F[i - 1] + 1;
if (i % 2 == 0)
F[i] = min(F[i], F[i / 2] + 1);
if (i % 3 == 0)
F[i] = min(F[i], F[i / ... | ALGO | 0.999913 | 4.521075 |
d561b432-40b6-4ab8-b035-3f49eb446f4f | fransschreuder/qucs_cvs | qucs-core/src/differentiate.cpp | #if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "logging.h"
#include "complex.h"
#include "object.h"
#include "consts.h"
#include "equation.h"
#include "differentiate.h"
using namespace eqn;
// Short helper macros... | ALGO | 0.999492 | 5.262535 |
aec20363-f62a-4ec3-91ef-3313b6c83fc3 | ForzaMods/SaveTools | forza_saveswapper/encryption/tfit/CMac.cpp | //
// Created by merika on 9/17/2024.
//
#include "CMac.hpp"
#include <functional>
#include <algorithm>
#include <ranges>
namespace forza_saveswapper {
CMac::CMac(
std::span<const std::array<std::array<uint8_t, 4>, 4>, 13> keys,
std::array<std::array<std::array<std::array<uint8_t, 4>, 256>, 16>,... | ALGO | 0.971102 | 6.912169 |
5e60e02a-22c9-44fd-9d95-a26987887c2f | vfolunin/archives-solutions | MCCME/1393.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int size;
cin >> size;
vector<int> count(size + 1);
for (int i = 0; i < size; i++)... | ALGO | 0.999873 | 3.635874 |
15ce8b0e-3cd5-4e8a-81e3-4958914ac13a | KrtinN/Scion | tess-two/jni/com_googlecode_tesseract_android/src/textord/bbgrid.cpp | #include "bbgrid.h"
#include "helpers.h"
#include "ocrblock.h"
namespace tesseract {
///////////////////////////////////////////////////////////////////////
// BBGrid IMPLEMENTATION.
///////////////////////////////////////////////////////////////////////
GridBase::GridBase() {
}
GridBase::GridBase(int gridsize, cons... | ALGO | 0.988604 | 7.053885 |
3fec2967-7448-4366-b3d4-99485012d690 | bblgbr/VCM-SIMO | CompressAI/compressai/sadl_codec/range_coder.cpp | #include "range_coder.h"
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
using namespace std;
void RangeCoder::encode(int value, const Cdf &cdf, std::ostream &out) {
value -= cdf.min_val;
if (value < 0 || value > (int)cdf.cproba.size() - 1) {
c... | ALGO | 0.999246 | 5.900128 |
f0a1ce0c-e80b-44aa-815b-5fc0eb58f067 | vlluvia/algorithm | leetcode/[125]-验证回文串.cpp | class Solution {
public:
bool isPalindrome(string s) {
string s_t, s2_t;
for(int i=0; i<s.size(); i++){
if(s[i] >= 'a' && s[i] <= 'z' || s[i] >= '0' && s[i] <= '9'){
s_t += s[i];
}else if( s[i] >= 'A' && s[i] <= 'Z'){
s_t +=(s[i] - 'A' + 'a');
... | ALGO | 0.998882 | 5.860605 |
6878f8f3-b823-4a9f-923b-f5ea38702af2 | fsaadatmand/Cpp-Primer | chapter09/9.26.cpp | /*
* Exercise 9.26: Using the following definition of ia, copy ia into a vector
* and into a list. Use the single-iterator form of erase to remove the
* elements with odd values from your list and the even values from your
* vector.
*
* int ia[] = { 0, 1, 1, 2, 3, 5, 8, 13, 21, 55, 89 };
*
* By Faisal Saadatma... | ALGO | 0.994508 | 5.623811 |
d114ea08-a855-4d0b-8731-60d93f32c2bd | heavenMOJANG/ICPC | programmes_C_Cpp/.history/AtCoder/abc418/B_20250809200944.cpp | #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
void solve() {
string s; cin >> s;
int n = s.size();
vector<pair<int, int>> a(26, {0, 0});
for (int i{}; i < n; ++ i)
return;
}
signed main() {
cin.tie(n... | ALGO | 0.999874 | 4.312025 |
a1e2cc68-8023-4167-9212-44c4f45e057c | ThreeStones1029/leetcode | 18.四数之和.cpp | /*
* @Description:
* @version:
* @Author: ThreeStones1029 <EMAIL>
* @Date: 2024-04-10 22:18:22
* @LastEditors: ShuaiLei
* @LastEditTime: 2024-04-11 12:29:09
*/
/*
* @lc app=leetcode.cn id=18 lang=cpp
*
* [18] 四数之和
*/
// @lc code=start
class Solution {
public:
vector<vector<int>> fourSum(vector<int>& n... | ALGO | 0.999977 | 5.850501 |
23d8b001-41bf-436a-8bfb-542930c1e64a | onliner602/adf | esp-adf/examples/Ka_mod/components/fdk-aac-oreo-m8/libFDK/src/scale.cpp |
/* -----------------------------------------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Frderung der angewandten Forschung e.V.
All rights reserved.
1. INTRODUCTION
T... | TOOL | 0.905766 | 3.655481 |
df81d8b4-8fe6-4ba2-8d78-bb5a561c5307 | Panzer3232/Competitve-Programming | Hackerearth/MatrixSum_DP.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m, x, y;
long q;
cin>>n>>m;
long arr[n+1][m+1];
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
cin>>arr[i][j];
if(i==1 && j!... | ALGO | 0.999714 | 3.943178 |
94fdabb3-0cfb-47c5-baab-ea38df8d57c7 | Phenom-OS/system_core | init/init.cpp | #include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <keyutils.h>
#include <libgen.h>
#include <paths.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/epoll.h>
#include <sys/mount.h>
#include <sys/s... | TOOL | 0.854105 | 5.933979 |
fa8adb08-7f80-4457-8d71-369aeb077671 | RHJihan/problem-solving | UVA/490-Rotating_Sentences.cpp | // https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=431
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
(void)!freopen("input.txt", "r", stdin);
// (void)!freopen("output.txt","w",stdout)... | ALGO | 0.999824 | 3.941581 |
b9a05f96-e329-405e-9c06-5731f4a3e6e7 | Faisalahammed125/online-judge-solution | spoj/Adding Reversed Numbers.cpp | #include<bits/stdc++.h>
using namespace std;
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define unq(v) sort(v.begin(),v.end()),v.erase(unique(v.begin(),v.end()),v.end())
#define tt(x) scanf("%d",&x);while(x--)
#define rep(i,a,b) for(i=a;i<=b... | ALGO | 0.999807 | 4.715673 |
13c7c402-fc13-41b0-96c8-e6a677fbafc2 | lvyest/Algorithm | 프로그래머스/0/181830. 정사각형으로 만들기/정사각형으로 만들기.cpp | #include <string>
#include <vector>
using namespace std;
vector<vector<int>> solution(vector<vector<int>> arr) {
int i = arr.size(), j = arr[0].size();
if(i > j){
for(int t = 0; t < i; t++) {
for(int f = 0; f < i - j; f++){
arr[t].push_back(0);
}
}
}... | ALGO | 0.998788 | 4.539574 |
958c4fce-688f-4cf6-8388-5f512f64f170 | aditya1944/Scaler-Questions | largestDistancebetweenNodesofTree2.cpp | #include<vector>
#include<iostream>
#include<stack>
#include<climits>
struct Node{
int vertex;
int distance;
};
std::pair<int, int> dfs(std::vector<std::vector<int> > adjacencyList, int rootNode){
std::stack<Node> st;
std::vector<bool>visited(adjacencyList.size(),false);
int maxDistance = 0;
int... | ALGO | 0.999826 | 4.131748 |
990bbba7-f400-4ae4-ae7c-9646238d56ef | jayakanth45/Data-structures-and-Algorithms | 0592-fraction-addition-and-subtraction/0592-fraction-addition-and-subtraction.cpp | class Solution {
public:
string fractionAddition(string expression) {
int i=0;
int n=expression.size();
int num=0;
int den=1;
while(i<n){
int currnum=0;
int currden=0;
bool sign=(expression[i]=='-');
if(expression[i]=='+' or exp... | ALGO | 0.999942 | 6.019939 |
b2e99d14-2b7c-457e-b5ad-419bc2bd0fd2 | ayush-patel-78/DSA | 124-binary-tree-maximum-path-sum/124-binary-tree-maximum-path-sum.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.999979 | 6.012402 |
a885453c-c64d-46f0-b3da-6418186b2d98 | diaas14/leetcode-solutions | 98_Validate_Binary_Search_Tree.cpp | /**
* Given the root of a binary tree, determine if it is a valid binary search tree (BST).
* A valid BST is defined as follows:
* The left subtree of a node contains only nodes with keys less than the node's key.
* The right subtree of a node contains only nodes with keys greater than the node's key.
* Both the l... | ALGO | 0.999965 | 7.21314 |
75d872b5-12fd-4e3d-9ce9-04d58d89d6a7 | HPC-AI-Team/lammps-fugaku-threadpool-sc23 | src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp | // clang-format off
#include "pair_lj_class2_coul_long_kokkos.h"
#include "atom_kokkos.h"
#include "atom_masks.h"
#include "error.h"
#include "force.h"
#include "kokkos.h"
#include "memory_kokkos.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "respa.h"
#include "update.h"
#inclu... | ALGO | 0.998439 | 6.887855 |
2393dae6-be89-45de-b012-7af3749c5696 | ishandutta2007/codeforces | _guoyh_/normal/1615/F.cpp | # include <bits/stdc++.h>
# define ll long long
using namespace std;
const int MAXN = 2051;
const int P = 1000000007;
int t, n;
char s0[MAXN], s2[MAXN];
int a[MAXN], b[MAXN];
ll f[MAXN][MAXN], s[MAXN][MAXN], f1[MAXN][MAXN], s1[MAXN][MAXN];
void upd(ll &a, ll b){
a = (a + b) % P;
}
int main(){
scanf("%d", &t);
while ... | ALGO | 0.999966 | 3.830264 |
5b03045a-44e0-4fb0-8150-16c1aff672fb | ABHINAVNAUTIYAL079/DSA-lab | selectionsort.cpp | #include<bits/stdc++.h>
using namespace std;
void selectionsort(int arr[],int n){
for(int i=0;i<n;i++){
int min=i;
for(int j=i+1;j<n;j++){
if(arr[min]>arr[j]){
min = j;
}
}
swap(arr[i],arr[min]);
}
}
int main(){
int n;
cout<<"Ente... | ALGO | 0.999908 | 4.27153 |
9fcdab93-a844-4ced-ad44-e808e1e175f0 | LaurentMazare/ProjectEuler | e143.cpp | #include<stdio.h>
#include<set>
#define MAX_P 120000
using namespace std;
typedef long long int lli;
int main(int argc, char* argv[]) {
int is_torricelli[MAX_P+1];
set<int>* squares[MAX_P+1];
for (int i = 0; i <= MAX_P; i++) {
is_torricelli[i] = 0;
squares[i] = new set<int>();
}
for (lli m = 1; m <= ... | ALGO | 0.999656 | 3.788751 |
419f3aa5-b10e-4acf-8534-bbe52dcfc50b | Cheekybaby/leetcode | 941-sort-array-by-parity/sort-array-by-parity.cpp | class Solution {
public:
vector<int> sortArrayByParity(vector<int>& nums) {
int i=0, j=0;
while (j<nums.size()){
if (nums[j]%2 == 0){
swap(nums[i], nums[j]);
i+=1;
}
j+=1;
}
return nums;
}
}; | ALGO | 0.999979 | 5.60995 |
2045b04c-6f9c-4f91-ab16-46ffe263130b | d0ivanov/C-turtle | AI/Sudoku/src/SudokuImage.cpp | #include "../include/SudokuImage.h"
#include <cstdlib>
using namespace cv;
//Constructor
SudokuImage::SudokuImage(std::string filepath)
{
//Read the image
input_image = cv::imread(filepath.c_str());
//Apply adaptive thresholding
PreprocessImage();
//Hough transform parameters
int phi_bins = ... | ALGO | 0.9951 | 5.024817 |
2ede5858-6dd8-47e1-a00d-d2d45d92b819 | mb11797/FuN | Greedy Algorithms/chopsticks_CODECHEF.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int find_max_pairs(int n, int d, int L[]){
sort(L, L+n);
int pairs=0;
int i=1;
while(i<n){
if(L[i] - L[i-1] <= d){
pairs++;
i += 2;
}
else{
i += 1;
}
}
return pairs;
... | ALGO | 0.999828 | 3.704468 |
4a5627d6-a1f3-4470-9be7-08e8ce762718 | bewajafarwah/project-euler | p4.cpp | #include<iostream>
using namespace std;
bool checkPali(int val, int rval) {
if(val == rval) {
return true;
}
return false;
}
int getReverse(int val) {
int revV = 0;
while(val > 0) {
revV = (revV * 10) + (val % 10);
val = val / 10;
}
return revV;
}
int main(int argc... | ALGO | 0.999903 | 5.271191 |
344b136d-9b86-4f34-adf7-a0b5ad02877d | UtsavDonda07/CP | DSA linkedlist remove loop.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
void print(Node *root)
{
Node *temp = root;
while(temp!=NULL)
{
cout<<temp->data<<" ";
temp=temp->next;
}
}
// } Driver Code Ends
/*
The structure ... | ALGO | 0.999799 | 5.970089 |
95addfa7-3bcc-4431-907f-d801d962ede6 | jaejunha/SWExpertAcademy | 3752.cpp | /* reference: http://his130.tistory.com/298 */
#include <iostream>
using namespace std;
int main() {
int t, no = 0, n, x[101], max, sol;
bool v[10001];
v[0] = true;
cin >> t;
while (t--) {
no++;
cin >> n;
max = 0;
for (int i = 1; i <= n; i++) {
cin >> x[i];
max += x[i];
}
for (int i = 1; i <= m... | ALGO | 0.99967 | 3.581889 |
74db9f5c-f1a1-4516-9c6e-b5fe5905f257 | geekyprawins/leetcode-practice | 729-my-calendar-i/729-my-calendar-i.cpp | class MyCalendar {
public:
MyCalendar() {}
bool book(int start, int end) {
for (auto [s, e] : calendar)
if (max(s, start) < min(e, end)) return false;
calendar.push_back({start, end});
return true;
}
private:
vector<pair<int, int>> calendar;
};... | ALGO | 0.999834 | 6.297002 |
f8c72744-f501-416b-af4a-f8c0980782b2 | Subh-29/Algorithm | jobSequence.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX 100
class Job
{
public:
int jobNum, ded, profit;
};
class Greedy
{
private:
int profit[MAX], num;
Job jobs[MAX];
void sort()
{
for(int i = 1; i < num; ++i)
{
int j;
Job temp = jobs[i];
for(j = i - 1; j >= 0 && jobs[j].profit < t... | ALGO | 0.999876 | 4.448319 |
e003c2d6-2f6a-49c5-9720-1437544741a7 | Saket789/CodeChef-Codes | BREAK.CPP | #include <bits/stdc++.h>
#define ll long int
#define deb(x) cout << x << " " ;
#define endl '\n'
#define vec vector<int>
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define loop(x,n,v) for(int v=x; v<n; v++)
// map<long,long> mp ;
// set<long> st ;
using namespace std ;
int... | ALGO | 0.999968 | 3.164189 |
407bb2a6-d343-42ef-b1da-e4f456bb471a | akshaykumar89/Codeforces-Contests | B_Make_Array_Good.cpp | #include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define inf 1e18
#define ninf 1e18*(-1)
#define ff first
#define ss second
#define pb push_back
#define ppb pop_back()
#define vi vector<int>
#define mp make_pair
#define pii pair<int,int>
#define mii map<int,int>
#define pqb priority_queue<int>
#de... | ALGO | 0.99974 | 3.46137 |
fc6b4dae-099b-4b46-a463-839947a73c4b | SunilRupnoor/OOPSLAB | genericclass.cpp | //Sorting using Generic classes
#include<iostream>
#include<cstdlib>
using namespace std;
const int SIZE=10;
template<class atype>class sort
{
public: atype a[SIZE];
atype &operator[](int i)
{
if(i<0||i>SIZE-1)
{
cout<<"\nIndex value of ";
cout<<i<<" is out-of-bonds.\n";
exit(1);
}
... | ALGO | 0.994678 | 3.939245 |
470a1538-9b91-4889-af42-185c21838ea9 | heiseish/Competitive-Programming | kattis/cups/cups.cpp | /**
A trick is nothing but a puzzle mankind came up with. If you use your head, you can uncover the logical answer.
*/
#include <bits/stdc++.h>
#define forn(i, l, r) for(int i=l;i<=r;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define nd second
#define st first
#define debug(x) cout<<#x<<" -> "<... | ALGO | 0.99979 | 3.968082 |
19589f76-75b4-46e9-8902-94fbfe1d6c37 | fengjixuchui/syndicate-fortnite-internal | System/CRT/mincrt.cpp | #include "mincrt.h"
// This gives Object Error in Main
extern "C" int _fltused = 0;
#pragma data_seg()
#pragma comment(linker, "/merge:.CRT=.rdata")
#pragma intrinsic(memset) // weird fix to compile bug in release
extern void* __cdecl memset(void*, int, size_t);
#pragma function(memset)
void* memset(void* dest, int c... | TOOL | 0.949226 | 4.063422 |
6028a4c7-2550-4100-bc85-fa63cedca933 | Aime1007/Algorithm1 | dfs-Sticks.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 70;
int n,len,cnt;
int a[maxn];
int v[maxn];
bool dfs(int num, int cab, int last) {
if(num>cnt) {
return true;
}
if(cab==len) {
return dfs(num+1, 0, 1);
}
int fail = 0;
for(int i = last; i<=n; i++) {
if(!v[i] &... | ALGO | 0.999913 | 3.155992 |
87ba8147-cd74-4085-b2b8-e897f8a4e711 | colour-y/algorithm-2025_with_coloury | 2025/D_Equalization.cpp | #include<bits/stdc++.h>
using namespace std;
const char nl = '\n';
typedef long long ll;
typedef long double ld;
using i64 = unsigned long long;
using i32 = unsigned;
using i128 = unsigned __int128;
#define all(x) (x).begin(), (x).end()
constexpr int K = 60;
vector<vector<ll>> dp(100,vector<ll>(100,1e18));
ll cnt... | ALGO | 0.998957 | 4.208328 |
e1b2a3c4-dc34-4baa-aba2-ac9e4694ab4f | harukaeru/CompetitiveProgramming | abc114/B/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pp(v) \
for (auto x : v) { \
std::cout << x << ' '; \
} \
std::cout << endl;
int main() {
string S;
cin >> S;
int min_d = 999999;
for (int i = 0; i <... | ALGO | 0.998757 | 4.184234 |
ed670fcc-8b91-43e0-93fb-b9ecb72d85fa | Himanshu3198/Dynamic-Programming-DSA-Series | DP-wordBreak.cpp | // 139. Word Break
// time complexity O(n^2)
class Solution {
public:
bool wordBreak(string s, vector<string>& wordDict) {
int n=s.length();
vector<bool>dp(n+1,false);
dp[n]=true;
for(int i=n-1;i>=0;i--){
string ans="";
for(int j=i;j<n;j++){
... | ALGO | 0.999776 | 5.541997 |
827dd3e9-12eb-4f6e-b8e1-0eff9ffd4071 | JaiswalRohit13/competitive_programming | stl_containers/stack.cpp | #include <bits\stdc++.h>
using namespace std;
void displayStack(stack <int> s)
{
while(s.empty() != 1)
{
cout<<s.top()<<" ";
s.pop();
}
}
void explainStack()
{
stack <int> st;
st.push(1);
cout<<endl;
displayStack(st);
st.push(1);
st.emplace(2);
cout... | ALGO | 0.957613 | 4.468288 |
163de8a2-e5ee-43b1-b73c-34bf71c4434b | raincross7/code-similarity | codes/train_code/problem288/problem288_485.cpp | // ⚫⚫ | ⚫➖➖ ⚫⚫ ⚫➖⚫⚫ ⚫➖⚫⚫ | ➖⚫⚫⚫ ⚫ | ⚫➖ | ⚫➖⚫ ⚫ ➖⚫⚫ | ➖⚫➖⚫ ➖➖➖ ➖⚫⚫ ⚫ ⚫➖⚫
#include<bits/stdc++.h>
#define n0_nnE int main(){
using namespace std;
typedef long long ll;
n0_nnE
ll mx=0,n,an=0;cin>>n;
vector<ll> ls(n);
for(ll &x:ls) cin>>x;
for(ll x:ls){
mx=max(mx,x);an+=mx-x;
}
cout<<an;
} | ALGO | 0.999926 | 3.87005 |
e36963c4-bac7-4339-a56f-714c6bb0525d | RajaBabu15/DSA_Learning | MochaandMath.cpp | #include<bits/stdc++.h>
using namespace std;
void solve() {
int n; cin >> n;
int ans = ~0;
for (int i = 0, ele; i < n && cin >> ele; i++) ans &= ele;
cout << ans << endl;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("input1.txt", "r", stdin);
freopen("output1.txt", "w", stdout);
#endif
int t; cin >> t;
while ... | ALGO | 0.997062 | 5.389538 |
82c570f3-fb99-4063-83e3-d15bbce38fd2 | andrejjakovljevic/llvm-project-morello | libc/src/string/memcmp.cpp | #include "src/string/memcmp.h"
#include "src/string/memory_utils/memcmp_implementations.h"
#include <stddef.h> // size_t
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(int, memcmp,
(const void *lhs, const void *rhs, size_t count)) {
return inline_memcmp(static_cast<const char *>(lhs),
... | TOOL | 0.883524 | 6.471673 |
3ab62f68-135e-46d1-8fdc-96a2bfeed118 | rajgupta93/100-Days-of-Code | 75-sort-colors/75-sort-colors.cpp | class Solution {
public:
void swap(int &a,int &b){
int temp=a;
a=b;
b=temp;
}
void sortColors(vector<int>& nums) {
int start=0,mid=0,end=nums.size()-1;
while(mid<=end){
switch(nums[mid]){
case 0... | ALGO | 0.99999 | 6.037644 |
ed0d7c33-6efd-4a43-b55a-62db3bb545a5 | hoaghiepp/CTDL-GT | DSA02011.cpp | #include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FO(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define debug cout << "YES" << endl
using n... | ALGO | 0.999769 | 4.368051 |
538d2576-989f-40ef-9e5a-c6f24c410b91 | EC97B0EAB79C/PetIBM-SRDC | src/operators/creatediagmatrix.cpp | // STL
#include <functional>
#include <vector>
// here goes PETSc headers
#include <petscmat.h>
// here goes headers from our PetIBM
#include <petibm/mesh.h>
namespace petibm
{
namespace operators
{
/** \brief a short name for the signatures of kernels.
*
* A kernel is a function that can be used to calculate the ... | ALGO | 0.99856 | 5.67628 |
d4ee4c75-b63b-4c8e-8622-1401fe56fd9f | VijayPandey08/LeetCode | 2050-count-good-numbers/count-good-numbers.cpp | class Solution {
public:
int MOD;
long long modPow(long long base, long long exp) {
long long result = 1;
while (exp > 0) {
if (exp & 1)
result = (result * base) % MOD;
base = (base * base) % MOD;
exp >>= 1;
}
return result;
};
... | ALGO | 0.999982 | 6.245204 |
9a211778-5dc0-40c7-9732-806dc16a5972 | kmjp/procon | codeforce/241-260/cf253/b.cpp | #include <cstdlib>
#include <cstring>
#include <memory>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)print... | ALGO | 0.999665 | 3.563744 |
9b0075f5-7918-4d6c-87d5-06e121f5bda5 | Priya-Dholakiya/logic-lab-cpp | PR 11/Memory_Calculate.cpp | #include<iostream>
#include<vector>
using namespace std;
template <typename T>
class Student {
T name;
int id;
public:
Student() {
name = T();
id = 0;
}
Student(T n, int i) {
name = n;
id = i;
}
void display() const {
cout << "Name: " << ... | TOOL | 0.920258 | 5.006546 |
816b8e8f-8577-4ffe-9548-b2f06060f1f4 | nefrttPrabhu/SDE-sheet | 55_Queue/queue using linked list.cpp | #include <iostream>
using namespace std;
// Define a node for the linked list
struct Node {
int data;
Node* next;
Node(int val) { // Constructor to initialize a new node
data = val;
next = nullptr;
}
};
// Define the queue class
class Queue {
private:
Node* front; // Pointer to th... | ALGO | 0.990017 | 6.675517 |
ef64389a-6200-4d9d-9d53-106c5d38e165 | Nipuntank/DAA-TIET-Assignments | Assignment_4/ques_4.cpp | #include<iostream>
#define V 5
using namespace std;
void printSolution(int path[])
{
for(int i=0;i<V;i++)
{
cout<<path[i]<<" ";
}
cout<<path[0];
cout<<endl;
}
bool isSafe(int v,int i,bool graph[V][V],int path[])
{
if(graph[path[i-1]][v]==0)
{
return false;
}
for(int j... | ALGO | 0.99996 | 4.509259 |
0161efa6-9539-4ee5-911c-ea9d93ed2857 | ssashish21/Data-Structure-Algorithms | level1/01.Getting Started/11_gcd_and_lcm.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int euclidean_gcd(int a , int b){
if(b == 0) return a;
return euclidean_gcd(b , a % b);
}
int gcd(int a , int b){
while(b % a != 0){
int r = b % a;
b = a;
a = r;
}
return a;
}
int main(){
int a , b;
cin >> a >> b;
int g = euclidean_gcd(a... | ALGO | 0.999891 | 4.392135 |
9ad868cd-28ee-479c-abbd-5d4c13e0f2b0 | jacobo-mc/quake_megarepo | halflife/dlls/aflock.cpp | //=========================================================
//=========================================================
#include "archtypes.h" // DAL
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "squadmonster.h"
#define AFLOCK_MAX_RECRUIT_RADIUS 1024
#define AFLOCK_FLY... | TOOL | 0.911115 | 5.123909 |
0afb6b5f-d23e-4efd-ae1f-8e8d51e5b484 | Mat1k2211/edu24c | Tricks/Trick2.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long // <== 2 trick
int32_t main()
{
int x = 1e12 + 5;
int y = 1e10;
cout << x + y << endl;
return 0;
} | ALGO | 0.994486 | 3.501108 |
591edbcb-2f01-4c67-9170-6fbb0c3411b0 | vikrambhatla/topcoder | contest/cf hny/B.cpp | #ifdef no_compile
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<string>
using namespace std;
#define rep(i,f,t) for(int i = (f),end_##i = (t); i < end_##i; ++i)
#define _MAX 1000
typedef long long ll;
typedef vector<int> vi;
typedef pair<i... | ALGO | 0.999931 | 3.423142 |
8bca9433-9f7f-4d35-9428-d1f776027729 | Neel-132/Dynamic-Programming | 0-1 Knapsack/memoizedequalsumpartition.cpp | #include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define MAX_N 100
#define MAX_W 100
int t[MAX_N][MAX_W];
int getMemoPartitionSum(int arr[], int n, int sum)
{
if (sum == 0)
return 1;
else if (n == 0)
return 0;
else if (t[n][sum] != -1)
return t[n][sum];
else if (sum >= arr[n - 1])
{
t[n][su... | ALGO | 0.999992 | 3.795794 |
1b08af7c-4fe8-45eb-bb5f-5e8494bb9fce | thackerhelik/Topcoder | SRM254-D1-500.cpp | /*input
Greedy solution works. Constraints are small. DP also is a solution.
*/
#include <bits/stdc++.h>
#define fo(i,n) for(i=0;i<n;++i)
#define forr(i,n) for(i=n-1;i>=0;--i)
typedef long long int ll;
using namespace std;
struct Piglets
{
int choose(string trough)
{
int n = (int)trough.size();
if(trough[0] == '-... | ALGO | 0.996953 | 4.09227 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.