uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
8db0969c-c7e3-4683-8a2e-29716682c7a0 | sarvex/leetcode-ada | solution/0000-0099/0045.Jump Game II/Solution.cpp | class Solution {
public:
int jump(vector<int>& nums) {
int ans = 0, mx = 0, last = 0;
for (int i = 0; i < nums.size() - 1; ++i) {
mx = max(mx, i + nums[i]);
if (last == i) {
++ans;
last = mx;
}
}
return ans;
}
}; | ALGO | 0.999997 | 6.180237 |
dabc9825-06f7-4687-805a-f9e96fb2584f | mano-ranjan/values_web_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
600f1ce3-3ee7-4ec7-938c-947c13f6b8f3 | oanasabau1/Algorithm-Analysis | Algorithm Analysis/Iterative tree traversal BT + OuickSort hybrid/Iterative tree traversal BT + OuickSort hybrid.cpp | /*Sabau Oana-Maria, grupa 30222/2
*
* Pentru aceasta tema am implementat: 1) algoritmii de parcurgere iterativa si recursiva a arborilor binari
* 2) algoritmii de sortare QuickSort si QuickSort Hybridizat
*
* 1) Un arbore binar se poate parcurge in: Preordine (se viziteaza radacin... | ALGO | 0.999811 | 4.947056 |
93ff4ffd-d0e6-4547-aa34-8ad58a093986 | SequoiaDB/SequoiaDB | thirdparty/boost/libs/geometry/doc/index/src/examples/rtree/mapped_file.cpp | //[rtree_mapped_file
#include <iostream>
#include <boost/interprocess/managed_mapped_file.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/index/rtree.hpp>
namespace bi = boost::interprocess;
namespace bg = boost::geometry;
namespace bgm = bg::model;
namespa... | ALGO | 0.94942 | 5.736688 |
c3cf4bfc-d104-46a0-8765-716ea4b83c89 | lemoneid/1.do-exercises | Algorithm/Luogu/temp.cpp | /*************************************************************************
> File Name: P1629.cpp
> Author: wei
> Mail: <EMAIL>
> Created Time: 2020年10月29日 星期四 19时44分12秒
************************************************************************/
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <... | ALGO | 0.999954 | 4.073998 |
1c03f608-16a6-4d69-8567-23f2d7a7366c | pvplpt/h0mew0rk | Cpp/Массивы и Указатели в C++/Урок6/Задача2/main.cpp | /* Задача 2
Что нужно сделать:
Написать функцию, которая принимает указатель на тип int, по которому размещены
10 переменных типа int. Функция ничего не возвращает, но по тому же указателю
элементы должны лежать в обратном порядке.
Чек-лист для проверки задачи:
• Функция принимает корректные типы данных, тип возвраща... | ALGO | 0.991883 | 4.369948 |
a6ef86e4-72cd-4cd8-afb3-1862a7ccaf61 | May722115/1 | generate_function.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <random>
#include <cmath>
#include <cstring>
#include <ctime>
#include <bitset>
#include "generate_function.h"
int resultNum = 0;
int answer[9][9] = {0};
int tempSudoku[9][9] = {0};
int copy[9][9] = {0};
bool hasSingleSolution(int sudoku[][9], int leve... | ALGO | 0.998648 | 4.6448 |
69eee762-54f1-4d20-b1a8-0303c15a98f9 | zf-w/mini_problem_collection_before_y2023m11 | Leetcode/Leetcode.1061.lexicographically-smallest-equivalent-string/Leetcode.1061.lexicographically-smallest-equivalent-string.cpp | // @lc app=leetcode id=1061 lang=cpp
#include <string>
using namespace std;
// @lc code=start
class Solution {
public:
char mp[26];
char find(char a) {
int a_idx = a - 'a';
if (mp[a_idx] == a) {
return a;
}
mp[a_idx] = find(mp[a_idx]);
return mp[a_idx];
}... | ALGO | 0.999944 | 6.703679 |
78fd0c72-a08d-44d0-9886-e6c4a58fcce9 | ishandutta2007/codeforces | kevinwan/normal/1361/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mn=1e6+10;
const ll inf=0x3f3f3f3f3f3f3f3f;
const ll mod=1e9+7;
ll k[mn];
ll lmul(ll a,ll b){
if(a>inf/b)return inf;
return a*b;
}
ll po(ll a,ll b){
ll ans=1;
for(;b;b>>=1,a*=a,a%=mod)if(b&1)ans*=a,ans%=mod;
return ans;
}
l... | ALGO | 0.999991 | 3.683643 |
a078bdbb-e5f5-4d86-ba86-bfa6aa4f5de2 | splucs/Competitive-Programming | Macacário/Math/simpson.cpp | #include <cmath>
/*
* Simpson Rule for integration
*/
double f(double x) { return cos(x); }
double simpson(double a, double b, int n = 1e6) {
double h = (b - a) / n, s = f(a) + f(b);
for (int i = 1; i < n; i += 2) s += 4*f(a+h*i);
for (int i = 2; i < n; i += 2) s += 2*f(a+h*i);
return s*h/3;
}
/*
* TEST MATR... | ALGO | 0.992434 | 5.932711 |
c3227ea0-9e7b-44f8-b93f-28ff63e7edf8 | RaresC21/USACO-Training-Ch.-1 | Combination Lock.cpp | /*
ID: RaresC
LANG: C++
TASK: combo
*/
#include <iostream>
#include <fstream>
using namespace std;
int N, farmer[3], master[3];
bool comp(int a, int b) {
if (abs(a-b) <= 2) return true;
if (abs(a-b) >= N-2) return true;
return false;
}
bool close (int i, int k, int j) {
if (comp(i, farme... | ALGO | 0.999952 | 4.330735 |
65ef4ca5-0ba8-497b-8e31-2bef08df6a84 | ISOLDE-Project/riscv-llvm | llvm/lib/Analysis/StackLifetime.cpp | #include "llvm/Analysis/StackLifetime.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/AssemblyAnnotationWriter.h"
#include "llv... | TOOL | 0.973059 | 7.51832 |
d5c18884-72e3-4def-ae54-4ae531ec5684 | pavanbaloju/data-structures-and-algorithms | linkedlist/25.RemoveGreaterNodes.cpp | #include <iostream>
using namespace std;
// Node structure
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
// Function to reverse a linked list
ListNode *reverseLinkedList(ListNode *head)
{
ListNode *prev = nullptr;
ListNode *current = head;
while (curr... | ALGO | 0.999996 | 6.402887 |
53e6b0fa-48b0-4a38-bcc6-041e418d9041 | nileshsah/Algorithms | PT07Y.cpp | #include <iostream>
#include <set>
#include <queue>
#define ll int unsigned
#define get(a) scanf("%ld", &a)
//using namespace std;
std::set<ll> v[100000+5];
int main() {
ll n, m;
get(n); get(m);
bool flag = true;
while(m--) {
ll x, y;
get(x); get(y);
v[x].insert(y);
v... | ALGO | 0.999987 | 4.319557 |
023e6ddd-d07e-4518-8bbf-ce1de146b891 | ArutoriaWhite/Competitive-programming | poj3977.cpp | #include <bits/stdc++.h>
#define de(x) cout << #x << "=" << x << ", "
#define dend cout << '\n'
#define yukari ios::sync_with_stdio(0), cin.tie(0)
#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define exi(x,s) (s.find(x)!=s.end())
#define fi first
#define se second
#define Uset unordered_set
#define Umap ... | ALGO | 0.999882 | 3.543761 |
ea2e6340-e42e-42d8-a40a-994cd10c5748 | Riddhi12349/GFG_CODES | Hard/LFU cache/lfu-cache.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class LFUCache {
public:
int size , minfreq;
unordered_map<int,pair<int,int>> keyval;
unordered_map<int,list<int>::iterator> address;
unordered_map<int,l... | ALGO | 0.999744 | 5.426502 |
643fce45-d888-41d5-ba34-5dc072db7909 | wewe231223/ComputerGraphics_Wramingup | P1/MatrixClass.cpp | #include "MatrixClass.h"
#include <iostream>
#include <random>
#define EXEPT_ROW 0
using namespace std;
random_device rd;
mt19937 gen(rd());
//----------------------------------------------------FUNCTIONS---------------------------------------------------------------------
void Matrixrun::Run() {
Matrix m1;
Matri... | ALGO | 0.942476 | 3.555827 |
060d30f7-fa96-4c09-95ad-f8b5a31bf0ca | Joonior-Programmer/Leetcode | LeetCode/Easy/0171-excel-sheet-column-number/0171-excel-sheet-column-number.cpp | class Solution {
public:
int titleToNumber(string columnTitle) {
int ret = 0;
int power = columnTitle.length() - 1;
for (int i = 0; i < columnTitle.length(); ++i){
ret += (columnTitle[i] - 64) * pow(26, power);
--power;
}
return ret;
}
}; | ALGO | 0.999838 | 6.361866 |
82f19fb5-ac1e-424f-ba5d-94ab03bba27e | Embattled/CodeTraining | atcoder/ZONe/B.cpp | #include <stack>
#include <queue>
#include <set>
#include <vector>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <utility>
#include <climits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <iostream>
#include <fstream>
#include <iomanip... | ALGO | 0.999752 | 3.454851 |
b5848541-dab4-4e1d-b456-0be525e0a828 | ishandutta2007/codeforces | changle_cyx/normal/1244/D.cpp | #include <bits/stdc++.h>
template <class T>
inline void read(T &x)
{
static char ch;
static bool opt;
while (!isdigit(ch = getchar()) && ch != '-');
x = (opt = ch == '-') ? 0 : ch - '0';
while (isdigit(ch = getchar()))
x = x * 10 + ch - '0';
if (opt)
x = ~x + 1;
}
template <class T>
inline void putint... | ALGO | 0.999976 | 3.899852 |
8a2b5b4a-24a8-46a6-9293-e5836c5d0cef | ishandutta2007/codeforces | maximumshot/normal/311/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define vec vector
#define ALL(x) (x).begin(), (x).end()
#define mp make_pair
typedef pair< int , int > pii;
typedef long long ll;
int const inf = 1000 * 1000 * 1000;
ll const inf64 = 1ll * inf * inf;
int const mod = 95542721;
inline int sum(ll a, ll b) { return (a % ... | ALGO | 0.999967 | 4.534566 |
dc4ee911-cdd4-4dda-bc1e-9aa9990d7bdc | ishandutta2007/codeforces | chemthan/normal/1090/I.cpp | #include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
#define ... | ALGO | 0.999753 | 3.560398 |
8755d19d-0056-47ef-8ead-fd7da0473d33 | Rebellion-167/Strings-Problems | Easy/IsomorphicStrings.cpp | /**
* Given two strings s and t, determine if they are isomorphic.
*
* Two strings s and t are isomorphic if the characters in s can be replaced to get t.
*
* All occurrences of a character must be replaced with another character while
* preserving the order of characters. No two characters may map to the same... | ALGO | 0.999727 | 6.05001 |
0e36ad3c-ab32-4880-aa99-4a95ecd5e16c | kavita121/Coding | BestTimeToBuySellStock_Leetcode.cpp | //121. Best Time to Buy and Sell Stock
//LEETCODE ACCEPTED
class Solution
{
public:
int maxProfit(vector<int>& prices)
{
int ans = 0, min_val = 1e9;
int i=0;
for(; i<prices.size(); i++)
{
min_val = min(min_val, prices[i]);
ans = max(ans, prices[i]-... | ALGO | 0.999764 | 5.786472 |
dd970089-bdfa-4365-ad98-39d679e3329d | sarvex/leetcode-csh | solution/2400-2499/2466.Count Ways To Build Good Strings/Solution.cpp | class Solution {
public:
const int mod = 1e9 + 7;
int countGoodStrings(int low, int high, int zero, int one) {
vector<int> f(high + 1, -1);
function<int(int)> dfs = [&](int i) -> int {
if (i > high) return 0;
if (f[i] != -1) return f[i];
long ans = i >= low &... | ALGO | 0.999979 | 5.946511 |
0241524b-468f-49d3-a4fd-b5eab221b310 | Sixzeroo/CodingInterviews | C++/052.cpp | class Solution {
public:
vector<int> multiply(const vector<int>& A) {
int sum1 = 1, sum2 = 1, len = A.size();
vector<int> res(A.size(), 1);
// 两边下手,使得时间复杂度变为O(n)
for(int i = 1; i < A.size(); i++)
{
sum1 *= A[i - 1];
sum2 *= A[len - i];
res[... | ALGO | 0.999992 | 5.069663 |
623b0b81-add0-46cc-a4bc-f50e1763116b | Amaima-Salim/15-Days-Of-LeetCode-Challenge- | 541-reverse-string-ii/reverse-string-ii.cpp | class Solution {
public:
string reverseStr(string s, int k) {
int n=s.size();
for(int i =0;i<n;i+=2*k){
int start=i;
int end=min(i+k-1,n-1);
while(start<end){
swap(s[start],s[end]);
start++;
end--;
}
}
return s;
}
}; | ALGO | 0.999954 | 5.934599 |
63ff76aa-04e9-4414-8945-87c3f2944600 | sarveshwar-singhal/LC | wc/wc311_3.cpp | #include<bits/stdc++.h>
using namespace std;
/**
* 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,... | ALGO | 0.999996 | 5.514473 |
bd937128-6bf2-4168-8f81-3da955fd0908 | vivekkushwaha373/assignment44 | question03.cpp | #include<bits/stdc++.h>
// #include<algorithm>
using namespace std;
int main()
{
set<int>x;
x.insert(8);
x.insert(2);
for(auto i=x.begin();i!=x.end();i++)
cout<<*i<<" ";
cout<<endl;
x.erase(2);
for(auto i=x.begin();i!=x.end();i++)
cout<<*i<<" ";
return 0;
} | ALGO | 0.983541 | 3.786833 |
26bd9230-5f18-4aec-8275-bb6a6d03293d | Rohit-Yadav-47/DSA-Questions | k-th smallest element in BST.cpp | int val=-1;
int c=0;
int KthSmallestElement(Node *root, int K) {
if(!root)return 0;
KthSmallestElement(root->left,K);
c++;
if(K==c)val=root->data;
KthSmallestElement(root->right,K);
return val;
}
| ALGO | 0.999998 | 3.881462 |
aaafe317-26ca-4409-a202-4cdce439604f | kuangmeng/MLProbs | baseMSA/C_P_NP_Aln/MSAPartProbs.cpp | ////////////////////////////////////////////////////////////////
// MSAPartProbs.cpp
//
// Utilities for computation on global pair-HMM based on partition function
/////////////////////////////////////////////////////////////////
#include "SafeVector.h"
#include <iostream>
#include <string.h>
#include <stdlib.h>
#incl... | ALGO | 0.999333 | 4.924417 |
bc0e87e2-641c-4de8-a3b2-588d65d06a26 | amanjain200/gfg_potd | 29thApr23.cpp | /*
Find Number
MediumAccuracy: 79.17%Submissions: 4K+Points: 4
Win Vouchers, 2X Geekbits & much more! Register for GFG Weekly #100 Now!
Click here to Enter
Given an integer N, You need to find the Nth smallest number which only contains odd digits i.e. 1,3,5,7,9 means no even digits are allowed on that number (12 wil... | ALGO | 0.999854 | 5.957063 |
4da657f2-8003-42dc-aff7-621d47d4565b | Sadi-Hurayv/Competitive-Programming | DSA/Algorithm/Bit Manupulation/Builtin Function/Check if an integer is a power of 2.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL), cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("/media/shuvra/New Volume/IIT/Programming/CP/IO/input.txt", "r", stdin);
freopen("/media/shuvra/New Volume/IIT/Programming/CP/IO/output.txt", "w", st... | ALGO | 0.999623 | 4.030647 |
4608bcb9-19c4-4a7b-85d7-6f1f3fe02a10 | gifsyn/AtCoder | ABC/ABC143/abc143b.cpp |
#include <iostream>
#include <vector>
using namespace std;
int main(){
int N;
cin >> N;
vector<long long> d(N);
for(int i = 0; i < N; i++){
cin >> d[i];
}
long long ans = 0;
for(int i = 0; i < N; i++){
for(int j = i + 1; j < N; j++){
ans += d[i] * d[j];
... | ALGO | 0.99993 | 4.209124 |
d1114152-44b6-44d2-968a-417aecd0ead8 | sarvex/leetcode-crystal | solution/1300-1399/1337.The K Weakest Rows in a Matrix/Solution.cpp | class Solution {
public:
int search(vector<int>& m) {
int l = 0;
int h = m.size() - 1;
while (l <= h) {
int mid = l + (h - l) / 2;
if (m[mid] == 0)
h = mid - 1;
else
l = mid + 1;
}
return l;
}
vector... | ALGO | 0.999958 | 6.027086 |
fd7c4de3-4654-4653-8991-94ff9ce0dcec | jordan9587/MSU_STARX_SYSTEMINTEGRATION_2021 | Arduino/libraries/emgToolbox/MyopulsePercentageRate.cpp | /**
* \file MyopulsePercentageRate.cpp
*
* \author Jordan Hybki (@jh9587)
*
* Pseudocode referenced from MATLAB EMG Feature Extraction Toolbox:
* https://www.mathworks.com/matlabcentral/fileexchange/71514-emg-feature-extraction-toolbox
*
*/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <i... | ALGO | 0.955322 | 3.24231 |
73ecbb68-44a2-4803-a57b-ffbd7a8f9547 | tamm2904/C-plus-plus | C16_HIT/TEST/B.cpp | #include <iostream>
using namespace std;
int sum_check(int i, int j, int arr[]) {
int sum = 0;
for (int x=i; x<=j; x++)
sum += arr[x];
return sum;
}
int sum_max(int arr[], int n) {
int max = arr[0], cs;
for (int i = 0; i<n; i++)
if (arr[i] > max) {
max = arr[i];
... | ALGO | 0.999914 | 4.248922 |
6feec77d-2a74-4b33-b243-34e0f778be94 | yapatta/ant_book | 2/2-5/kruskal.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAX_V 1005
#define MAX_E 1005
typedef struct {
int u, v, cost;
} edge;
int par[MAX_V], depth[MAX_V];
edge es[MAX_E];
int V, E;
void init_union_find() {
for(int i=0;i<V;i++) {
par[i] = i;
depth[i] = 0;
}
}
int find(int x) {
if(par[x... | ALGO | 0.999587 | 4.192638 |
7944aca7-d2a6-4664-8a6e-8ca61e326358 | magnyon/bitcoind | src/policy/truc_policy.cpp | #include <policy/truc_policy.h>
#include <coins.h>
#include <consensus/amount.h>
#include <logging.h>
#include <tinyformat.h>
#include <util/check.h>
#include <algorithm>
#include <numeric>
#include <vector>
/** Helper for PackageTRUCChecks: Returns a vector containing the indices of transactions (within
* package)... | TOOL | 0.870311 | 7.342567 |
9a4d6e96-29b2-4e19-b0b3-d03c128b3b9a | sulmone/boost_1_53_0 | libs/proto/example/calc2.cpp | #include <iostream>
#include <boost/proto/core.hpp>
#include <boost/proto/context.hpp>
namespace proto = boost::proto;
using proto::_;
template<typename Expr>
struct calculator_expression;
// Tell proto how to generate expressions in the calculator_domain
struct calculator_domain
: proto::domain<proto::generator<ca... | TOOL | 0.872196 | 7.547581 |
466f3392-95f4-4508-ad62-ede5a1b15a83 | snykk/Competitive-Programming | LeetCode/First Missing Positive.cpp | class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
int n = nums.size();
// move all non-positive numbers to the end of the array
int i = 0;
while (i < n) {
if (nums[i] <= 0) {
swap(nums[i], nums[n-1]);
n--;
... | ALGO | 0.99992 | 5.559623 |
e38743aa-5e3f-4659-94b5-9917bc693328 | rgsk/search-system-backend | binding.cpp | #include <napi.h>
#include <iostream>
using namespace Napi;
using namespace std;
bool search(string word);
bool startsWith(string word);
void populate(vector<string>& words);
vector<string> getMatches(string prefix);
typedef pair<string, long int> entry;
void populateMap(vector<entry>& countries);
pair<vector<entry>,... | TOOL | 0.915011 | 5.799016 |
9a29f820-2fd8-46a7-afbf-7e8c8ad01df7 | EveSunMaple/Code | luogu/P2986.cpp | #include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <cmath>
#define MAX 100005
#define ll long long
using namespace std;
ll head[MAX * 2];
ll down[MAX * 2];
ll edge[MAX * 2];
ll ver[MAX * 2];
bool up[MAX];
ll cow[MAX];
ll num[MAX];
ll sum[MAX];
l... | ALGO | 0.999961 | 3.724799 |
51a016f0-e89d-4fee-b558-a3d92323487f | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Mixtral/top0-100/sum-of-floored-pairs-Solution.sumOfFlooredPairs/177815_Bypass.cpp | void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
{
struct map_struct *buf;
OFF_T i, len = st_p->st_size;
md_context m;
int32 remainder;
int fd;
memset(sum, 0, MAX_DIGEST_LEN);
fd = do_open(fname, O_RDONLY, 0);
if (fd == -1)
return;
buf = map_file(fd, len, MAX_MAP_SIZE, CSUM_CHUNK)... | ALGO | 0.970504 | 5.860347 |
84b7be20-825c-405b-82ae-21221471da98 | hjiang13/LLMs-in-IR | POJ-104/103/1142.cpp | #include <iostream>
using namespace std;
main()
{
int i,n;
char str[1100];
int a[26]={
0}
;
cin >> "%s",str);
str[strlen(str)]=str[strlen(str)-1]+1;
for(i=0; i<strlen(str)-1; i++)
{
if(str[i]==str[i+1]||abs(str[i]-str[i+1])=='a'-'A')
{
if(str[i]-'A'<26)
a[str[i]-'A']++;
else
a[str[i]-'a']++;
}
else
{
if(str[i]-'A'<26)
... | ALGO | 0.99885 | 3.006008 |
4e2ecc9b-967b-4aa0-b746-5f6059dd3929 | raincross7/code-similarity | codes/train_code/problem189/problem189_311.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long GCD(long long a, long long b) {
if (b == 0) return a;
else return GCD(b, a % b);
}
ll lcm(ll x, ll y) {
return x / GCD(x, y) * y;//先に割り算をして掛けられる数を小さくして掛け算を行う
}
int main() {
int N, M;
cin >> N >> M;
vector<int> a(M), b(M);
s... | ALGO | 0.999969 | 4.463071 |
3f4cba69-ba69-45e9-a7a8-fac47a546563 | tjx01/CProject | Exercise/剑指Ofeer第二版/offer09.cpp | #include"util.h"
class CQueue {
public:
stack<int> inStack, outStack;
CQueue() {
}
void in2out() {
while (!inStack.empty()) {
outStack.push(inStack.top());
inStack.pop();
}
}
void appendTail(int value) {
inStack.push(value);
}
int deleteHead() {
if (outStack.empty()) {
if (inStack.empty... | ALGO | 0.999626 | 4.914045 |
5654a21a-cf27-4792-96dc-0f0b04f7cd42 | wuqiongjin/LeetCode | LC/数组/56. 合并区间.cpp | class Solution {
public:
//整体思路:
//首先根据区间的左边界进行排序
//创建二维数组ans,用来存放合并后的区间
//start表示判断区间的起始下标,end是正要进行比较的下标,curlen是可以合并的区间的终止下标
//maxborder就是合并区间的右边界的最大值了
vector<vector<int>> merge(vector<vector<int>>& intervals)
{
int sz = intervals.size();
if(sz == 1)
return inte... | ALGO | 1 | 5.934321 |
bf560037-d5b8-4da6-a947-a646f33ef9f4 | vivektiwari777/Codeforces--Solution-DIV3-DIV2-Contest- | A_Twin_Permutations.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template <typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::... | ALGO | 0.999896 | 4.118186 |
073e6c5b-724c-4c69-acb8-d637cc10a07e | sasank-chindirala/COS568-LI-SP25-M3 | competitors/PGM-index/lib/sdsl-lite/examples/sd_vector_benchmark.cpp | #include <sdsl/bit_vectors.hpp>
#include <random>
#include <iostream>
#include <chrono>
using namespace sdsl;
using namespace std;
using namespace std::chrono;
using timer = std::chrono::high_resolution_clock;
template<class t_vec>
uint64_t test_inv_random_access(const t_vec& v, const int_vector<64>& rands, uint64_t... | TEST | 0.981908 | 5.300079 |
bcab684f-005a-45af-a7a1-5b3c685947c1 | Kushala01/DSA | 2ptrOrsliding/fruitsInBasket/fruitsintoBasketBrute.cpp | class Solution {
public:
int totalFruits(int N, vector<int> &fruits) {
int maxlen=0;
for(int i=0;i<N;i++)
{
set<int>st;
for(int j=i;j<N;j++)
{
st.insert(fruits[j]);
if(st.size()>2) break;
maxlen = ... | ALGO | 0.999963 | 5.864957 |
ebfce4ef-1256-42fa-a35a-25c1f4c8d622 | fazrigading/NumericalMethods | 1b-secant.cpp | #include<iostream>
#include<iomanip> /* setprecision */
#include<math.h> /* fabs */
// Fungsi f(x): x^3 + 2x^2 + 10 x = 20
#define f(x) pow(x, 3) + pow(2*x, 2) + 10*x - 20
using namespace std;
int main(){
float x0, x1, x2, f0, f1, f2, e;
int step = 1, N;
cout << setprecision(6) << fixed;
cout << "M... | ALGO | 0.999907 | 3.854661 |
7a129d0b-1db9-4ef1-9c57-527f98778a11 | comentorid/demo-flutter-web | 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.9988 | 6.76073 |
622d5452-b360-4d1f-97e2-833e0e978b83 | getwister/exerciciosAlgoritmos | Exercícios em C/exercicios 1_semestre/calculadora.cpp | #include <stdio.h>
#include <stdlib.h>
int main() {
char ch;
int a, b, c, d, e, f;
printf("Digite uma operacao matematica (+, -, *, /) :\n");
ch = getchar();
printf("Digite dois numeros inteiros:\n");
scanf("%d %d", &a, &b);
switch (ch){
case '+':{
int c = a + b;
printf("Soma: %d\n",c);}
break;
... | ALGO | 0.878904 | 3.224437 |
02d32fa8-4cb0-450a-bdb3-6e5bf7aecb51 | yatharthg07/Leetcode_dsa | 1753-path-with-minimum-effort/path-with-minimum-effort.cpp | class Solution {
public:
int minimumEffortPath(vector<vector<int>>& grid) {
vector<int> cord={-1,0,1,0,-1};
int n = grid.size();
int m=grid[0].size();
// if (grid[0][0] != 0 || grid[n - 1][n - 1] != 0) {
// return -1;
// }
vector<vector<int>> dist (n,vect... | ALGO | 0.999985 | 5.767297 |
8279cdb8-1b77-4a5a-98ad-9806a677bafd | creatorarno/task_app | frontend/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.998303 | 6.76775 |
ce9cd5c6-945b-4dd2-8a05-ac981b2d5d41 | prateekshyap/DSA | Bit-Magic/LC_260_SingleNumber_III.cpp | /*
https://leetcode.com/problems/single-number-iii/
260. Single Number III
Given an integer array nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in any order.
You must write an algorithm th... | ALGO | 0.999906 | 5.189527 |
b2f728ff-1dd8-4ef8-81c0-418baa272db7 | YupengSu/HiBao | Taurus_workspace/ai_sample/third_party/src/opencv/modules/ml/src/testset.cpp | #include "precomp.hpp"
namespace cv { namespace ml {
struct PairDI
{
double d;
int i;
};
struct CmpPairDI
{
bool operator ()(const PairDI& e1, const PairDI& e2) const
{
return (e1.d < e2.d) || (e1.d == e2.d && e1.i < e2.i);
}
};
void createConcentricSpheresTestSet( int num_samples, in... | TEST | 0.96028 | 6.616804 |
593d958f-d977-46c2-8dbf-5b56fd9a5b3d | YeezB/MagicWond | lib/magic-xhl_inferencing/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/micro_tensor_utils.cpp | #include "edge-impulse-sdk/tensorflow/lite/micro/kernels/micro_tensor_utils.h"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <limits>
#include <utility>
#include "edge-impulse-sdk/third_party/gemmlowp/fixedpoint/fixedpoint.h" // from @gemmlowp
#include "edge-impulse-sdk/tensorf... | ALGO | 0.98945 | 7.534788 |
8ab2d57d-eb05-4bb9-ae6f-75708636a8b4 | 9yutae/CODE-KATA | 프로그래머스/0/181875. 배열에서 문자열 대소문자 변환하기/배열에서 문자열 대소문자 변환하기.cpp | #include <string>
#include <vector>
using namespace std;
vector<string> solution(vector<string> strArr) {
for(int i=0;i<strArr.size();i++) {
if(i%2) {
for(auto& w:strArr[i]) w = toupper(w);
}
else {
for(auto& w:strArr[i]) w = tolower(w);
}
}
ret... | ALGO | 0.998868 | 6.261807 |
08446e2f-fb1b-4e56-bef8-3f809e5c3144 | vikramkumar14/DSA0180-OOPS-USING-C- | XOROPE.cpp | #include <iostream>
using namespace std;
int main() {
int num1, num2;
cout << "Enter two integers: ";
cin >> num1 >> num2;
// Swap values using bitwise XOR
num1 ^= num2;
num2 ^= num1;
num1 ^= num2;
cout << "Values after swapping: " << endl;
cout << "num1: " << num1 << endl;
cout << "num2: " << num2 << en... | ALGO | 0.999803 | 5.674105 |
f5e785d5-0536-48d6-a939-14edecc7aa16 | Ziklon/algorithms | tc/testprograms/FixTheAverage.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.999215 | 5.493634 |
5c012b5e-99a3-4f9c-b25a-3a2c16f079c2 | pratapaditya1997/leetcode | hard/1269/Solution.cpp | /*
* Author: aps
* Time: 2019-11-24 20:38:49
**/
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
... | ALGO | 0.999999 | 4.929971 |
b3168130-477b-4f2f-8147-5b55363c8f58 | aryan29/Competetive-Programming-codes | codechef/CROWD.cpp | // Author: Ishaan Gupta
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vll = std::vector<ll>;
using pll = std::pair<ll, ll>;
using vvll = std::vector<vll>;
using vpll = std::vector<pll>;
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#de... | ALGO | 0.99992 | 4.258147 |
55a3f0ef-65f0-4d0a-a48a-107deafb8fa9 | Quffen/QuffenCoin | src/merkleblock.cpp | #include <merkleblock.h>
#include <hash.h>
#include <consensus/consensus.h>
std::vector<unsigned char> BitsToBytes(const std::vector<bool>& bits)
{
std::vector<unsigned char> ret((bits.size() + 7) / 8);
for (unsigned int p = 0; p < bits.size(); p++) {
ret[p / 8] |= bits[p] << (p % 8);
}
return... | ALGO | 0.999415 | 6.296853 |
1005f197-d4b3-40e4-8085-f39ffabe9730 | 1337DaKL/Bai_Tap_C_Plus_Plus | baitaphacker28tech/mang1chieucoban.cpp/demchanletongchanle.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int demchan = 0, demle = 0, tongchan = 0, tongle = 0;
while (n--)
{
int x;
cin >> x;
if (x % 2 == 0)
{
demchan++;
tongchan += x;
}
else
{
... | ALGO | 0.998471 | 3.461991 |
c6428064-d732-4120-a0d4-c17aa2030555 | aridome222/atcoder | join_abc_beginner_contest/ABC390to399/ABC399/c.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep3(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define repR(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rep3R... | ALGO | 0.999862 | 4.728396 |
39dd7708-7b64-4596-bf37-ca7f57663f6f | Tushar2009/DSA | Striver Dsa sheet solve/Day17/12_maximum_width_of_Binary_tree.cpp | #include <bits/stdc++.h>
using namespace std;
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), left(left), right(... | ALGO | 0.999773 | 5.142112 |
cef321c2-851f-46d1-b757-93b4e2aaa5ff | sazzadhossain143/Beecrowd_Problem_Solve | 1180 Lowest Number and Position.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int x[1000],n,p;
cin>>n;
for(int i=0; i<n; i++)
{
cin>>x[i];
}
int lowest=x[0];
for(int i=0; i<n; i++)
{
if(x[i]<lowest){
lowest=x[i];
p=i;}
}
cout<<"Menor valor: "<<lowest<<endl;... | ALGO | 0.999968 | 4.553567 |
f615e4ee-6e94-46f7-a8db-0ab569924cb8 | shuoxuanli/USACO | Bronze/2015-2016/Jan/promotion counting.cpp | #include<bits/stdc++.h>
using namespace std;
int input[4][2];
int main() {
freopen("promote.in", "r", stdin);
freopen("promote.out", "w", stdout);
for(int i = 0; i < 4; i++) {
for(int j = 0; j < 2; j++) {
cin>>input[i][j];
}
}
int gp = input[3][1] - input[3][0];
int sg = input[2][1] + gp -... | ALGO | 0.999237 | 3.03969 |
0a56b26f-124d-4f8d-a207-90198fc79e73 | honndaj/algorithm-template | old/Disjoin-Set-Union.cpp | int fa[N],rk[N],n,m,p;
void init(){
for(int i=1;i<=n;++i){
fa[i]=i;
rk[i]=0;
}
}
int find(int x){
if(fa[x]==x) return x;
return fa[x]=find(fa[x]);
}
void unite(int x,int y){
x=find(x);
y=find(y);
if(x==y) return;
if(rk[x]<rk[y]){
fa[x]=y;
}
else{
fa[y]=x;
if(rk[x]==rk[y]){
rk[x]++;
}
}
}
b... | ALGO | 0.999907 | 3.970819 |
06e816ef-0d61-46af-83dd-d0efbf764321 | NicolasDxy/data_structure_assignment | week2/93_6and94_9/Polynomial.cpp | #include "Polynomial.h"
#include"term.h"
#include<stdio.h>
#include<math.h>
#include<iostream>
using namespace std;
int Polynomial::capacity = 100;
term *Polynomial::termArray=new term[100];
int Polynomial::free = 0;
Polynomial::Polynomial()
:Start(free),Finish(free-1)
{
}
float Polynomial::Cal(int x)
{
float c = 0... | ALGO | 0.992325 | 3.42927 |
777bce02-64be-4449-bc1c-d4a3dedd7906 | ishandutta2007/codeforces | liouzhou_101/normal/1200/D.cpp | #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double ld;... | ALGO | 0.999955 | 3.909158 |
2fd18eaa-2059-4dcf-81d6-ffc0cd387fc1 | alexandraback/datacollection | solutions_5766201229705216_0/C++/joud/ACO.cpp | # include <iostream>
# include <cmath>
# include <algorithm>
# include <queue>
# include <stack>
# include <algorithm>
# include <iomanip>
# include <string>
# include <cstring>
# include <cstdio>
# include <stdio.h>
using namespace std;
int ans=10100;
int now;
vector<int> adj[1000];
bool visited[1000];
int depth[1000]... | ALGO | 0.999593 | 4.323537 |
17f59156-cccb-4080-958f-55e3c983ab0e | Arkaenaz/GDPARCM | Shared/OpenCV/sources/3rdparty/carotene/src/threshold.cpp | #include "common.hpp"
namespace CAROTENE_NS {
void thresholdBinary(const Size2D &size,
const u8 *srcBase, ptrdiff_t srcStride,
u8 *dstBase, ptrdiff_t dstStride,
u8 threshold, u8 trueValue, u8 falseValue)
{
internal::assertSupportedConfiguration();
#if... | ALGO | 0.993218 | 6.735572 |
63f32179-042d-441c-b14a-5796b2ad6174 | NMLT-NTTMK-K18/2-167-func-B-K | Bai005/Source.cpp | #define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
using namespace std;
float tinhTheTichHinhCau(float);
int main()
{
cout << "Nhap ban kinh r = ";
float r;
cin >> r;
float v;
v = tinhTheTichHinhCau(r);
cout << "The tich cua hinh cau = " << v;
return 0;
}
float tinhTheTichHinhCau(float rr)
{
ret... | ALGO | 0.992014 | 3.464651 |
84b7a500-7150-4882-b7d7-1086009cbeb4 | shirohebiui/BAEKJOON | #String/B/5598.cpp | #include <iostream>
using namespace std;
#define FOR(val, start, end) for(int val=(start); val<(end); ++val)
char str[1001];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> str;
char *ptr = str;
while(*ptr != '\0') {
*ptr -= 3;
if(*ptr < 'A') *p... | ALGO | 0.999541 | 3.837023 |
9b647351-5b8d-47f7-997d-a544181f2128 | liaoliveiralps/tecnicas-de-programacao-2 | HerancaPolimorfismo/C++/ProgramaFigurasGeometricasHeranca01.cpp | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
class FiguraGeometrica
{
public:
FiguraGeometrica(float r=0 ):raio(r){};
float obterRaio() {return raio;}; // Normal
void atribuirRaio(float r ) {raio = r;}; // Normal
virtual float areaTotal() = 0; // Virtual Pura
virtual float... | TOOL | 0.93185 | 4.323778 |
20ed14a7-e0ab-4e97-b63d-26d9dc41d931 | nitishrudra3510/Data-Structure-Algorithms | Stack/pushAtbottomRec.cpp | // push at bottom using recursion..
#include<iostream>
#include<stack>
using namespace std;
// using recursion
void displayRev(stack<int> st){
if(st.size()==0) return;
int x = st.top();
cout<<x<<" ";
st.pop();
displayRev(st);
st.push(x);
}
void display(stack<int> st){
if(st.size()==0) r... | ALGO | 0.999367 | 4.660131 |
a8dece0a-0917-4be6-9423-5ff7f97dbe69 | wafiqpuyol/DSA-C- | ARRAY/Find First Repeating Element.cpp | /**
* In this approach, vector won't be sorted. But still problem will be solved
*/
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main()
{
vector<int> arr{10, 1, 3, 4, 3, 5, 6};
unordered_map<int, int> myHash;
for (int i = 0; i < arr.si... | ALGO | 0.999946 | 5.1627 |
07e6ef83-fc43-41b2-965d-6c9713d8fdf7 | Anxi77/.Algorithms | BaaarkingDog/0x0C/solutions/15652.cpp | // Authored by : BaaaaaaaaaaarkingDog
// Co-authored by : -
// http://boj.kr/a237cd7949004a76aa9ac3cf1b13c03c
#include <bits/stdc++.h>
using namespace std;
int n, m;
int arr[10];
void func(int k){ // 현재 k개까지 수를 택했음.
if(k == m){ // m개를 모두 택했으면
for(int i = 0; i < m; i++)
cout << arr[i] << ' '; // arr에 기록해둔 ... | ALGO | 0.999953 | 3.854509 |
dd7d25ac-f002-4d2e-ae3e-ddc14891a033 | Yamami1221/261102-labs | lab13-for-261102/lab13_1.cpp | #include <iostream>
#include <ctime>
using namespace std;
long long int fibonacci(long long int);
int main(){
clock_t start, end;
start = clock();
cout << "Result: " << fibonacci(50ll) << "\n";
end = clock();
double elapsed = double(end - start) / CLOCKS_PER_SEC;
cout << "Elapsed Time: " << el... | ALGO | 0.999801 | 4.953614 |
bc1446e7-5db8-474f-8c3b-6c2ea1aec0c8 | starrydeca/luoGu | 数据结构1-2_二叉树/07/1.cpp | #include <iostream>
using namespace std;
const int maxL = 30;
struct node {
char left;
char right;
}tree[maxL];
void dfs(char root) {
if (root == '*') return ;
cout << root;
dfs(tree[root].left);
dfs(tree[root].right);
}
int main() {
string str[30];
char root;
int n;
cin >> n;
for (int i = 1; i <= n; i++) ... | ALGO | 0.999951 | 4.082066 |
11b242d9-8780-4373-94c8-4a28d3b34825 | bendeanwilly/BenClone2 | ALGORITHMS/Sorting/Bubble Sort/Bubble_Sort.cpp | // C++ program for implementation of Bubble sort
#include <bits/stdc++.h>
using namespace std;
void swap(int xp, int yp)
{
int temp = xp;
xp = yp;
yp = temp;
}
// A function to implement bubble sort
void bubbleSort(int arr[], int n)
{
int i, j;
for (i = 0; i < n-1; i++)
// Last i elements are already in place... | ALGO | 0.999897 | 5.309566 |
0222d78d-af83-4b7c-a65b-ced7210a963f | tomwisniewskiprv/Dynamic_data_structures | Dynamic_data_structures/queue.cpp | // Dynamic Data Structures
// Tomasz Wisniewski 10.03.2018
// Part II of Algorithms and Data Structures
// Uniwersytet Slaski
// Exercise 2 , 6 , 12 , 13 - Queue
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include "queue.h"
#include "randomInt.h"
// enqueue
// dodanie elementu do k... | TOOL | 0.901903 | 4.073716 |
5f54f454-f372-4aab-abf9-823e8f294680 | TheRodkaiser/IA-Explorer-Robot | Comportamientos_Jugador/jugador.cpp | #include "../Comportamientos_Jugador/jugador.hpp"
#include "motorlib/util.h"
#include <iostream>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <limits.h>
#include <random>
// Este es el método principal que se piden en la practica.
// Tiene como entrada la información de lo... | ALGO | 0.994378 | 3.541636 |
6694524a-519a-4484-a3d9-3a9c7f54eb67 | SakibulMowla/leetcode-solutions | solutions/0150. Evaluate Reverse Polish Notation.cpp | class Solution {
private:
bool isOperator(string& token) {
return token == "+" ||
token == "-" ||
token == "*" ||
token == "/";
}
int tokenToNumber(string& token) {
int sign = 1;
int number = 0;
for (char ch: token) {
... | ALGO | 0.999968 | 6.670636 |
5654b864-a56e-4618-bc60-064247e64893 | akudrinsky/algorithms-3sem | 2-contest/a.cpp | #include <cstdio>
#include <climits>
#include <vector>
#include <queue>
#include <ostream>
#include <iostream>
//#define DEBUG
#ifdef DEBUG
#define ON_DEBUG(...) __VA_ARGS__
#define LOGS(...)\
printf(__VA_ARGS__);\
printf("\t\tin file %s, line %d, function %s\n\n", __FILE__, __LINE__, __func... | ALGO | 0.999897 | 4.556429 |
108e2104-9550-4fe2-abe4-bcdf13391119 | abhi-glitchhg/leetcode_prep | 797-all-paths-from-source-to-target/797-all-paths-from-source-to-target.cpp | class Solution {
public:
vector<vector<int>> allPathsSourceTarget(vector<vector<int>>& adc) {
//vector<int> visited(adc.size(), 0);
vector<vector<int>> ans;
vector<int>path;
path.push_back(0);
//unordered_map<int,bool>
dfs(0,adc,ans,path);
return ans;
}
... | ALGO | 0.999321 | 6.093999 |
f92e2732-5b42-44fe-ba10-1bfdca428aa1 | DragonBackGames/BookCocos2DX | CHAPTER_7/Final/TapAPlane/cocos2d/cocos/2d/CCTextFieldTTF.cpp | #include "CCTextFieldTTF.h"
#include "CCDirector.h"
#include "CCGLView.h"
NS_CC_BEGIN
static int _calcCharCount(const char * text)
{
int n = 0;
char ch = 0;
while ((ch = *text))
{
CC_BREAK_IF(! ch);
if (0x80 != (0xC0 & ch))
{
++n;
}
++text;
}
... | TOOL | 0.883986 | 6.757761 |
011b83b9-83f3-4202-b3dd-385be611fafc | Chaplier/inagoni | Primivol/FacetGenerator.cpp | #include "FacetGenerator.h"
#include "Utils.h"
FacetGenerator::FacetGenerator()
{
mSmoothDistance = 0;
mSmoothPercent = 0;
mSquaredDistance = 0;
mMaxLenght = 0;
}
void FacetGenerator::Initialize(I3DShInstance* instance)
{
mInstanceWithMesh = instance;
ComputeBBox();
ComputeSmoothingDistance();
}
void Facet... | ALGO | 0.992419 | 6.497019 |
65e4046d-f37b-4a7e-8aa0-4e2d3b688a0f | Wim426F/Superman-Firmware | src/Ewma.cpp | #include "Ewma.h"
Ewma::Ewma(double alpha) {
this->alpha = alpha;
}
Ewma::Ewma(double alpha, double initialOutput) {
this->alpha = alpha;
this->output = initialOutput;
this->hasInitial = true;
}
void Ewma::reset() {
this->hasInitial = false;
}
double Ewma::filter(double input) {
if (hasInitial) {
output = a... | ALGO | 0.999754 | 5.369866 |
fc4aaf93-7c2f-4232-833d-66070fc405c6 | thiru31/daily-coding | college wallah/basic/num-triangle.cpp | #include <iostream>
using namespace std;
int main()
{
int i, j, k, l, n;
cout << "Enter the rows triangle: ";
cin >> n;
for (i = 1; i <= n; i++)
{
for (j = 1; j <= n - i; j++)
{
cout << "";
}
for (k = 1; k <= i; k++)
{
cout << k;
... | ALGO | 0.998258 | 4.30922 |
ec5e088c-3f9f-4b84-9f19-b9ae5ab11941 | abhiXsliet/DSA-SHEETS | SDE Sheet Striver/Arrays-IV/003-longest-consecutive-sequence.cpp | // https://leetcode.com/problems/longest-consecutive-sequence/
#include <bits/stdc++.h>
using namespace std;
class Solution {
private:
bool linearSearch(int tar, vector<int>& nums) {
for (int num : nums)
if (num == tar) return true;
return false;
}
// TC = O(N^2)
// SC = ... | ALGO | 0.999676 | 5.517528 |
19c31011-d7a8-4628-8add-55e4da2f4061 | YUPlayGodDev/platform_frameworks_av | media/libstagefright/codecs/amrnb/enc/src/inter_36.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/inter_36.c
Date: 01/31/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description:
1. Eliminated unused include files.
... | ALGO | 0.999472 | 5.616278 |
0c4b60f8-4445-4501-93bb-abaf433c43b9 | tiwariDhawal/100Days_of_Code | Medium/Intersection Point in Y Shaped Linked Lists/intersection-point-in-y-shaped-linked-lists.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
/* Link list Node */
struct Node
{
int data;
struct Node *next;
Node(int x)
{
data = x;
next = NULL;
}
};
Node* inputList(int size)
{
if (size == 0) return NULL;
int val;
c... | ALGO | 0.999858 | 5.348099 |
12383d73-77f6-4e1e-90e0-a3a452b43e3a | Shrutikatyal/Interview-Preparation | Arrays & Strings/L566. Reshape the Matrix.cpp | /*
* Author : Shruti Katyal
* Date : 15 May, 2020
*
* Compiler : g++ 5.1.0
* Flags : -std=c++14
*
*/
class Solution {
public:
vector<vector<int>> matrixReshape(vector<vector<int>>& nums, int r, int c) {
if(nums.size() == 0 || r * c != nums.size()*nums[0].size()) return nums;
vector<vect... | ALGO | 0.9969 | 6.303656 |
460ca89a-47ea-485d-b1c3-b01b7b20d39c | LegendROM-N/android_external_skia | tools/skdiff_image.cpp | #include "skdiff.h"
#include "skdiff_utils.h"
#include "SkBitmap.h"
#include "SkData.h"
#include "SkImageDecoder.h"
#include "SkImageEncoder.h"
#include "SkOSFile.h"
#include "SkTDArray.h"
#include "SkTemplates.h"
#include "SkTypes.h"
#include <stdio.h>
/// If outputDir.isEmpty(), don't write out diff files.
static v... | TOOL | 0.86125 | 7.118707 |
ba3055c8-5374-4fe9-b0c6-b009bee1bfe2 | ShubhamYadav25/LeetCode-Problem-Solution | 240-search-a-2d-matrix-ii/search-a-2d-matrix-ii.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int m = matrix.size();
int n = matrix[0].size();
int row = 0;
int col = n - 1;
while(row < m && col >= 0) {
if(matrix[row][col] == target) {
re... | ALGO | 0.999976 | 6.406784 |
0db373d7-5453-49fb-9be5-e9a8c8df0ee9 | Drchamyoung/Mathematical-programming-For-Students | 0001-two-sum/0001-two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int, int> hashMap;
for (int i = 0; i < nums.size(); ++i) {
int complement = target - nums[i];
if (hashMap.find(complement) != hashMap.end()) {
return {hashMap[complement... | ALGO | 0.999868 | 6.518982 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.