uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
d5a865d0-9808-4ed1-951b-09d754559a2f | ishandutta2007/codeforces | ecnerwala/normal/455/A.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXA = 2e5;
const int MAXN = 2e5;
int N;
ll A[MAXN];
ll cnt[MAXA];
ll dp[MAXA];
int main() {
ios_base::sync_with_stdio(0);
cin >> N;
for(int i = 0; i < N; i++) cin >> A[i];
for(int i = 0; i < N; i++) {
cnt[A[i]] ++;
}
dp[0] = 0;
... | ALGO | 0.999749 | 3.918026 |
068334ca-cdf1-465b-bd8e-76eb090fa2d5 | Alok-kumar-Maurya/codes | 1471c.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
#define debugxy(x,y) cout<<"[ "<<x<<" "<<y<<" ]"<< endl
#define debugx(x) cout <<"[ "<< x <<" ]"<<endl
int32_t ma... | ALGO | 0.99982 | 3.393413 |
fd81974b-4cf3-47e6-b1b8-17f64b912938 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_9907_8.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> a;
vector<int> p[1020];
int f[1020][1020];
int DP(int l, int r) {
int i, v;
int x, y;
if (l > r) return 1;
if (f[l][r] != -1) return f[l][r];
v = *min_element(a.begin() + l, a.begin() + r + 1);
for (i = 0; i < (int)p[v].size(); i++)
if (p[v][i] <... | ALGO | 0.999993 | 4.131818 |
18e164e4-2e2a-4241-8edc-bb0749e54087 | pradipta2017/CarND-11.PathPlanning | src/Eigen-3.3/bench/bench_reverse.cpp |
#include <iostream>
#include <Eigen/Core>
#include <bench/BenchUtil.h>
using namespace Eigen;
#ifndef REPEAT
#define REPEAT 100000
#endif
#ifndef TRIES
#define TRIES 20
#endif
typedef double Scalar;
template <typename MatrixType>
__attribute__ ((noinline)) void bench_reverse(const MatrixType& m)
{
int rows = m.r... | TEST | 0.913165 | 5.595998 |
204c8b50-5056-4288-b49a-5c17698052df | JakubLem/find-subgraph-problem | cpp_iter/main.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <chrono>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
using namespace std;
using namespace std::chrono;
const int MAX_GRAPHS = 100000;
const int MAX_VERTICES = 1000;
const int MAX_EDGES = 10;
class Graph {
private:
int V;
... | ALGO | 0.996108 | 5.901999 |
e54b5319-5a54-4cf6-9fef-e829a653fecc | owao/HighSchool | Coding/C/C언어및실습/함수 1.cpp | #include <stdio.h>
#include <stdlib.h>
void checkChar(){
char c;
while(true){
scanf(" %c", &c);
if(c=='q'){
return;
}
else if (c>='a' && c <='z'){
printf("Lowercase \n");
}
else if (c>='A' && c<='Z'){
printf("Uppercase \n");
}
else{
printf("Etc\n");
}
}
}
int main(int argc, char *ar... | ALGO | 0.920658 | 3.43999 |
c17247f5-8db1-4a26-846a-570f6bbe5dd6 | harshitagarwal2/CS122 | LAB/recursion/bubblesort.cpp | #include <iostream>
using namespace std;
void sortR(int lst[], int ln){
int i, tmp, j;
cout<<endl;
for(int j=0;j<ln;j++) cout<<lst[j]<<" ";
if (ln == 1)
return;
/* find index of smallest no */
for(i = 0; i < ln-1; i++)
for(j=0;j<ln-1-i;j++)
{
if(lst[j]>lst[j+1])
{
tmp=lst[j];
l... | ALGO | 0.999945 | 3.860034 |
9acb62ea-387e-4e91-92ea-4c3fd31cc510 | exposedtalent/CodingBlocks | inClass Coding/BalancedParenthesesStack.cpp | // https://leetcode.com/problems/valid-parentheses/solution/
#include<iostream>
#include<stack>
using namespace std;
bool isValid(string str){
stack<char> s;
for(char ch : str){
switch(ch){
case '(':
case '[':
case '{': s.push(ch); break;
case ')':
... | ALGO | 0.999347 | 6.761098 |
409b57e3-0afd-45c2-bdf2-a0785320a179 | Ishit-024/Leetcode | 0381-insert-delete-getrandom-o1-duplicates-allowed/0381-insert-delete-getrandom-o1-duplicates-allowed.cpp | class RandomizedCollection {
public:
RandomizedCollection() {
// RandomizedCollection obj=new RandomizedCollection();
}
bool insert(int val) {
values.push_back(val);
mp[val]++;
if(mp[val]==1){
return true;
}
return false;
}
bool remove(... | ALGO | 0.999211 | 5.912373 |
986ca46d-8601-474d-88b6-285525131321 | AlexHPGrall/LeetCodeSolutions | problems/maximum_product_of_splitted_binary_tree/solution.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.999985 | 6.091042 |
74914682-d80b-46bd-a475-6ad714f2d4b8 | prajwalbayari/C_plus_plus | Apna college/String Algorithms/hash.cpp | //Hashing in strings
//Final time complexity O(nm+ nlog(n))
// #include"bits/stdc++.h"
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<string>
using namespace std;
int p=31;
const int N=1e5+3,m=1e9+7;
vector<long long> power(N);
long long calculate(string s)
{
... | ALGO | 0.99992 | 5.260464 |
a10b65b2-3ec7-447f-88ad-688307eb853e | sonapraneeth-a/competitive-programming_submissions | platforms/binarysearch/practice/medium/1286__cpu-scheduling/solutions.cpp | // clang-format off
/**
* FILE DESCRIPTION
*
* Filename: 1286__cpu-scheduling/solutions.cpp
* Created on: 05 September 2021
* Last modified: 05 September 2021
* Author: sonapraneeth_a
* Description: BinarySearch submission for 'CPU Scheduling' problem
*/
/**
* CHANGELOG
*
* Date ... | ALGO | 0.999987 | 5.483205 |
d3fd35b5-de1b-4449-aa6a-8559d1530702 | YanWQ-monad/monad | Cpp/Exam-answer/smoj.nhedu.net/1049.cpp | // 1049.cpp
#include <cstdio>
#define mod 10007
int n,ans;
int main() {
freopen("1049.in","r",stdin);
freopen("1049.out","w",stdout);
scanf("%d",&n);
for (int i=0,temp;i<n;i++) {
scanf("%d",&temp);
ans+=temp>0? temp:0;
}
printf("%d\n",ans);
return 0;
}
| ALGO | 0.999981 | 3.620741 |
9790c5fc-6681-46fb-a2fc-072c05be0878 | yifen9/algo-notes | src/template/cpp/segtree/segtree.cpp | #include <vector>
using namespace std;
struct SegTree {
int n;
vector<long long> t;
SegTree(int _n): n(_n), t(2*_n, 0) {}
void update(int p, long long v) {
p += n;
t[p] += v;
for (p >>= 1; p; p >>= 1)
t[p] = t[p<<1] + t[p<<1|1];
}
long long query(int l, int r... | ALGO | 0.999793 | 4.161798 |
98693a69-58e1-4cdc-9c4b-35f3a0151b66 | rockstarchik/vector-middle | fun3.cpp | #include "middle_list.h"
#include <vector>
#include <string>
using namespace std;
void itc_pos_neg_analysis_lst(const vector <int>& lst) {
int kolpos = 0;
int kolneg = 0;
int nulls = 0;
int maxpos = 0;
int maxneg = -2147483648;
int minpos = 2147483647;
int minneg = 0;
int sumpos = 0;
... | ALGO | 0.994446 | 4.322748 |
54500eb7-3a31-4b5d-bd19-2fa069330013 | Rwan00/News_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.99874 | 6.767714 |
f3a68a0a-09e2-419c-8cfe-31ef51e6abcd | jinsootree/C-coding-dojang | c_coding_dojang/string_compare_abc/string_compare_abc.cpp | #include <stdio.h>
#include <string.h> // strcmp Լ
int main()
{
// aaa ASCII ڵ 97 97 97
// aab ASCII ڵ 97 97 98
// aac ASCII ڵ 97 97 99
printf("%d\n", strcmp("aaa", "aaa")); // 0: aaa aaa Ƿ 0
printf("%d\n", strcmp("aab", "aaa")); // 1: aab aaa ߿ aab ũǷ 1
printf("%d\n", strcmp("aa... | ALGO | 0.998643 | 3.186672 |
6c784ef1-bb91-42e6-be77-8604d926febf | Twilight-Shadow/HSEC2025 | demos/cpp/main.cpp | #include <cstdio>
#include <cassert>
#include <cstdlib>
#define MAX_DISK_NUM (10 + 1)
#define MAX_DISK_SIZE (16384 + 1)
#define MAX_REQUEST_NUM (30000000 + 1)
#define MAX_OBJECT_NUM (100000 + 1)
#define REP_NUM (3)
#define FRE_PER_SLICING (1800)
#define EXTRA_TIME (105)
typedef struct Request_ {
int object_id;
... | ALGO | 0.996173 | 3.860224 |
8791a1f2-9e1b-4d73-afc2-df2858ecd36c | zzhmu/CodeProjects | VS_Projects/CodePractice/Cplusplus/BM/BM10.cpp | //#include<iostream>
//using namespace std;
//struct ListNode {
// int val;
// struct ListNode *next;
// ListNode(int x) :
// val(x), next(NULL) {
// }
//};
//class Solution {
//public:
// ListNode* FindFirstCommonNode(ListNode* pHead1, ListNode* pHead2) {
// ListNode* cur1 = pHead1;
// ListNode* cur2 = pHead2;
// ... | ALGO | 0.99993 | 4.584627 |
96194244-22fc-4edb-ade2-b23934685570 | SHAIMA-HAQUE/LeetCode-Solve | 206-reverse-linked-list/206-reverse-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseList... | ALGO | 0.999624 | 5.676823 |
e63a49d5-dcce-4471-9d17-85c2f185061c | jmichaelmoore/CSCE120-Spring2025 | 504-507/recursion/fibonacci/fib.cpp | #include <iostream>
using std::cin, std::cout, std::endl;
int fib(int n) {
// base cases
if (n == 0)
return 0;
if (n == 1)
return 1;
// recursive
return fib(n-1) + fib(n-2);
}
int main() {
int n = 0;
while (n >= 0) {
cout << "enter: ";
cin >> n;
co... | ALGO | 0.99966 | 5.124958 |
87e2bbbb-3e5a-46c3-92ea-349c44874d1d | lsmmay322/cadet | somoim/hwalee/1주차_입출력/별찍기_17.cpp | #include <iostream>
using namespace std;
int main()
{
int i, j, n;
cin >> n;
i = 1;
while (i <= (n - 1))
{
j = 1;
if (n % 2 == 1)
{
while (j <= (n + i - 1))
{
if (j <= n - i)
printf(" ");
else
{
if (j == (n - i + 1) || j == (n + i - 1))
printf("*");
else
printf(... | ALGO | 0.999981 | 3.217033 |
136dc9c7-2f44-4137-a78e-c4f9f0669d80 | flaviu2001/High-School-Small-Projects | ONI/ONI 2016/origami.cpp | #include <fstream>
#define MAX 175
using namespace std;
int v[MAX][MAX], r[MAX][MAX];
int main()
{
freopen ( "origami.in", "r", stdin );
freopen ( "origami.out", "w", stdout );
int d, j, i, n, t, how, where, height, widht, depth = 0, help;
scanf ( "%d%d", &n, &t ), height = n, widht = n;
for ( i ... | ALGO | 0.999887 | 3.156517 |
77bb4cd2-bb28-419a-a102-d65c7e73b914 | elguneminov/E-Olymp-2 | 0518.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t, a, b;
cin >> t;
while(t != 0) {
cin >> a >> b;
cout << a + b << endl;
t--;
}
return 0;
}
| ALGO | 0.996747 | 4.796911 |
ed6b03a7-3b6c-4a7f-a855-710fdd980d44 | masonarchhsieh/Training_LeetC | 1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit.cpp | class Solution {
public:
int longestSubarray(vector<int>& nums, int limit) {
int res = 0;
multiset<int> s;
for (auto l = 0, r = 0; r < size(nums); r++) {
s.insert(nums[r]);
while (!s.empty() && *(s.rbegin()) - *(s.begin()) > limit) {
s.erase(s.find(num... | ALGO | 0.999994 | 6.03699 |
f200c2fa-8a39-4f51-a11b-17c25bd5532b | zenoalbisser/chromium | buildtools/third_party/libc++/trunk/test/containers/associative/map/map.ops/upper_bound.pass.cpp | // <map>
// class map
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
#include <map>
#include <cassert>
#include "min_allocator.h"
#include "private_constructor.hpp"
int main()
{
{
typedef std::pair<const int, double> V;
typedef std::map<int, do... | TEST | 0.862543 | 4.192291 |
92af9795-0225-4919-9921-c4a4a26b07aa | CodingEnthusiastic/LEETCODE-PROBLEM-SOLVER | 2358-number-of-ways-to-split-array/number-of-ways-to-split-array.cpp | class Solution {
public:
int waysToSplitArray(vector<int>& n) {
vector<long long int>nums(n.size(),0);
long long int sum=n[0];
nums[0]=n[0];
for(int i=1;i<nums.size();i++)
{
nums[i]=n[i];
nums[i]+=nums[i-1];
sum+=n[i];
}
int... | ALGO | 0.999916 | 4.049204 |
f719f181-6564-4315-86f9-d264a03d50f6 | tmadeira/icpc-reference | src/maxflow.cpp | //OBSERVACAO: Sempre colocar as arestas de ida e volta.
using namespace std;
vector<int> grafo[MAX];
int cap[MAX][MAX];
int parnt[MAX];
int flow(int s, int t) {
int f = 0;
while(true) {
memset(parnt,-1,sizeof(parnt));
parnt[s] = -2;
queue<int> q;
q.push(s);
while(!q.empty... | ALGO | 0.999037 | 4.083471 |
ed048593-8942-44c5-b246-2ede62c31e0a | seungbin0619/BOJ | 1092.cpp | #include <bits/stdc++.h>
using namespace std;
int l[50], p[50];
int w[10000], ok[10000];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, M, ans = 0;
cin >> N;
for(int i = 0; i < N; i++) {
cin >> l[i];
l[i] *= -1;
}
cin >> M;
for(int i = 0; i < M... | ALGO | 0.999983 | 3.706095 |
93868e47-f297-4d00-8a82-6cedef4ab9e2 | sumaiya-cmd/leetcode-solved-questions | Count number of free cell - GFG/count-number-of-free-cell.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
vector<long long int> countZero(int n, int k, vector<vector<int>>& arr){
//Code Here
vector<long long int> ans;
unordered... | ALGO | 0.999768 | 4.751977 |
9ae9b522-3c31-4f62-a638-b5f2a979b361 | SonuKanwal/Omron_bottle_sorting_tm12 | node_3.cpp | // ROS headers
#include <ros/ros.h>
#include <std_msgs/String.h>
#include <fstream> // Include for file I/O
#include <vector>
#include <tm_msgs/SetPositions.h>
#include <tm_msgs/FeedbackState.h>
#include <cmath>
// Global variables to store feedback states
std::vector<double> current_joint_positions(6, 0.0);
bool posi... | ALGO | 0.875263 | 6.502931 |
aed3e667-6703-47e1-a716-86709b3c2456 | riturajkumar01/DSA-Advance-concept-of-c | deletionheap.cpp | #include<iostream>
using namespace std;
class heap{
public:
int arr[100];
int size;
heap()
{
arr[0] = -1;
size = 0;
}
void insert(int val){
size = size + 1;
int index = size;
arr[index] = val;
while(index < 1){
int parent = index/2... | ALGO | 0.999919 | 3.97353 |
e5c2becf-5185-4123-a8dd-a35cf0b21822 | Pratik-Jodgudri/DSA-Codes | CodeForces/110A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long n;
cin >> n;
int c = 0;
while (n > 0){
if (n % 10 == 4 || n % 10 == 7){
c++;
}
n /= 10;
}
if (c == 4 || c == 7){
cout << "YES" << endl;
}
else{
cout <<... | ALGO | 0.999114 | 4.574083 |
bc894df1-1f5e-483c-9919-a2a1e7fb3b87 | siddharth30jan/leetcode-prob | First Unique Character in a String.cpp | class Solution {
public:
int firstUniqChar(string s) {
pair<int,int> V[256];
for(int i=0;i<s.length();i++){
V[s[i]].first++;
V[s[i]].second=i;
}
int ans=INT_MAX;
for(char i='a';i<='z';i++){
if(V[i].first==1){
ans=min(ans,V[i... | ALGO | 0.999829 | 5.656562 |
b629682a-13c0-47f5-8c42-ea2206ac5408 | cchiragjain/leetcode-solutions | 134-gas-station/gas-station.cpp | class Solution {
// think of gas like earning and cost like spending
// we can not traverse if our earning is less then our cost
// but if it is more or equal then it is possible
public:
int canCompleteCircuit(vector<int>& gas, vector<int>& cost) {
int n = gas.size();
int totalGas = 0;
... | ALGO | 0.999988 | 6.019709 |
9d37813e-e02c-41dc-8f82-27061257179a | s0m-aosp/frameworks_rs | cpu_ref/rsCpuExecutable.cpp | #include "rsCpuExecutable.h"
#include "rsCppUtils.h"
#include <fstream>
#include <set>
#include <memory>
#ifdef RS_COMPATIBILITY_LIB
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
#else
#include "bcc/Config/Config.h"
#endif
#include <dlfcn.h>
namespace android {
namespace renderscript {
namespace {
... | TOOL | 0.904924 | 3.945341 |
54f17ed4-4b1b-48fe-9d7e-141200abea45 | matpx/blendini | src/extern/libigl/include/igl/rigid_alignment.cpp | template <
typename DerivedX,
typename DerivedP,
typename DerivedN,
typename DerivedR,
typename Derivedt
>
IGL_INLINE void igl::rigid_alignment(
const Eigen::MatrixBase<DerivedX> & _X,
const Eigen::MatrixBase<DerivedP> & P,
const Eigen::MatrixBase<DerivedN> & N,
Eigen::PlainObjectBase<DerivedR> & R,
... | ALGO | 0.997409 | 5.899469 |
f4c02f10-029c-4789-a3ac-d04f7d653742 | fireclouu/competitive_programming | cpp/IsSubsequence.cpp | #include <iostream>
#include <string>
bool isSubsequence(std::string s, std::string t) {
if (t.size() < s.size()) return false;
int satisfy = 0;
for (char item : t) {
if (satisfy == s.size()) break;
if (item == s[satisfy]) satisfy++;
}
return satisfy == s.size();
}
int main() {
std::string input... | ALGO | 0.999745 | 5.812575 |
4666c2e3-b9c2-47dd-9b23-fa3c7e63b597 | teodoraa22/Strukturno-programiranje | Auditoriski/Aud7/nizi8.cpp | //
// Created by Teodora on 14.1.2024.
//
#include<iostream>
using namespace std;
int main(){
int niza1[100], niza2[100];
char niza3[100];
int size;
cin>>size;
for (int i = 0; i < size; ++i) {
cin>>niza1[i];
}
for (int i = 0; i < size; ++i) {
cin>>niza2[i];
}
for ... | ALGO | 0.999983 | 4.148093 |
c61521b1-8187-4d79-ae74-e3a7b9bcc00b | FennelDumplings/leetcode-maxed_out | algorithm/cpp/prob1-500/prob36_medium_Valid-Sudoku.cpp | // prob36: Valid Sudoku
/*
* Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:
* Each row must contain the digits 1-9 without repetition.
* Each column must contain the digits 1-9 without repetition.
* Each of the 9 3x3 sub-boxes of the grid must... | ALGO | 0.999515 | 7.272174 |
026cfdd8-598c-4df0-a48f-d0256b24affe | Aditya-mor-007/DSA | Number Pattern/pascalsTri.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter number of rows: ";
cin >> n;
for (int i = 0; i < n; i++) {
int a = 1;
for (int j = 0; j <= i; j++) {
cout << a << " ";
a = a*(i - j)/(j + 1); // Formula for Pascal's triangle
... | ALGO | 0.999688 | 6.081545 |
305dcbdc-5f78-4ed3-b898-a370eee67ea8 | vsharkovski/Competitive-Programming | Programs/Mendo/Train.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int maxn = 100010;
int n, m;
int L[maxn], R[maxn], C[maxn];
int order[maxn];
int num_unique;
vector<int> unique_stations;
unordered_map<int, int> newid;
int bestlast;
int dp[maxn], ps[maxn];
int tree[4*maxn]; // fo... | ALGO | 0.999913 | 3.741974 |
7d5b570a-cb17-4140-bce9-08f1da584e10 | kerembay9/Xrai | robotic/rai/src/Perception/pclPlaneExtraction.cpp | #ifdef RAI_PCL
#include "pclPlaneExtraction.h"
void extractPlanes(pcl::PointCloud<PointT>::Ptr inCloud, pcl::PointCloud<PointT>::Ptr outCloud, std::vector<pcl::ModelCoefficients::Ptr>& outCoefficients, std::vector<pcl::PointIndices::Ptr>& outInliers, uint numPlanes) {
pcl::PointCloud<PointT>::Ptr cloud_be(inCloud);... | ALGO | 0.936748 | 3.955782 |
d61eb0d9-45bc-4963-8d84-7b84314e802f | LucaTheSorcerer/Data-Structures-and-Algorithms | DataStructures/LinkedListOnArrays/DLLA/DLLA.cpp | #include "DLLA.h"
#include "DLLAIterator.h"
#include <stdexcept>
DLLA::DLLA() {
capacity = 10;
size = 0;
firstEmpty = 0;
head = -1;
tail = -1;
array = new DLLANode[capacity];
for (int i = 0; i < capacity; i++) {
array[i].next = i + 1;
}
array[capacity - 1].next = -1;
}
DL... | TOOL | 0.882806 | 5.090596 |
22e739e7-6fac-48b1-a77e-a6e7d1b65777 | doomsday861/Allofit | %SystemDrive%/Allofit/1285C.cpp | /**
* 1285C
**/
#include<bits/stdc++.h>
#define ll long long
#define testcase ll t;cin>>t;while(t--)
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define run ios_base::sync_with_st... | ALGO | 0.999822 | 5.121899 |
efa9b0c9-5d43-442a-a5a9-a340103236bf | Harsh23Kashyap/LeetCode | 120-triangle/120-triangle.cpp | class Solution {
public:
int minimumTotal(vector<vector<int>>& triangle)
{
int n=triangle.size();
for(int i=n-2;i>=0;i--)
{
for(int j=0;j<triangle[i].size();j++)
{
triangle[i][j]+=min(triangle[i+1][j],triangle[i+1][j+1]);
}
}
... | ALGO | 0.999979 | 6.165016 |
43e4d99a-024b-4079-bc5b-e668ff74d6ed | devjatinrawat/Cpp_Programs | p109_while09.cpp | #include<iostream>
#include<conio.h>
using namespace std;
void main()
{
int n,m,f,sum,t,i;
cout<<"\nEnter the number which you want to check:=";
cin>>n;
sum=0;
t=n;
while(n>0)
{
m=n%10;
sum=sum+m*m*m;
n=n/10;
}
if(t==sum)
cout<<"\nNumber is armstrong number";
else
cout<<"\nNumber is not a armstrong number";
getch();
}... | ALGO | 0.999087 | 3.666542 |
e52edb32-3382-44fb-a86e-5b6f4bbd51ed | RC-MODULE/nmpp | app/examples/nmpli/IMG_Median3x3/main.cpp | // ImgDiff.cpp : Defines the entry point for the console application.
//-------------------------------------------------------------------
#include "nmpli.h"
#define MAX_WIDTH 128 //
#define MAX_HEIGHT 128 //
bool malloc32error = false;
void* malloc32(unsigned sizeInt32 ){
#ifdef __NM__
void* p=malloc(s... | ALGO | 0.980163 | 4.345026 |
f2a65486-dbed-4c9e-9897-f2b3698ceda4 | swatimry/leetcode-practice | 28-find-the-index-of-the-first-occurrence-in-a-string/find-the-index-of-the-first-occurrence-in-a-string.cpp | class Solution {
public:
int strStr(string haystack, string needle) {
if (needle.length() == 0)
return 0;
if (haystack.length() == 0)
return -1;
vector<int> lps(needle.size());
lps[0]=0;
int i=1;
int length=0;
while(i<needle.size... | ALGO | 0.999965 | 5.623392 |
992da668-31a8-4252-b809-ce954ec876ea | nxplatform/nx-mobile | thirdparty-cpp/boost_1_62_0/libs/intrusive/example/doc_list.cpp | using namespace boost::intrusive;
class MyClass : public list_base_hook<> //This is a derivation hook
{
int int_;
public:
//This is a member hook
list_member_hook<> member_hook_;
MyClass(int i)
: int_(i)
{}
};
//Define a list that will store MyClass using the public base hook
typedef list... | ALGO | 0.964258 | 5.792928 |
57637135-6fb8-49cc-9073-08120de2cd28 | ZDVokoun/kseminare_23_24 | ksp/Z3/1.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define nl '\n'
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<int> vint;
typedef vector<bool> vbool;
typedef pair<int, int> pint;
signed main(int argc, char *argv[]) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll N, J;... | ALGO | 0.999692 | 3.456459 |
ce0c7387-b46e-4507-818e-08e53a2a35eb | VarunArora14/code | cpp/heap1.cpp | #include<iostream>
using namespace std;
int main()
{
/* fns are
1. getMax() - gets the root of the element
2. extractMax() - extracts the root of the element but maintains the heap property O(log n)
3. Decreases value of key. The time complexity of this operation is O(Logn).
If the decrease... | ALGO | 0.999642 | 4.147526 |
b544e648-52bd-4013-baec-8c44d54d47eb | sweetholly/Baekjoon_Algorithm_Cpp | BaekJoon_algorithm/Doit_cpp_class/5-1.DFS/DFS/11724.cpp |
#include<iostream>
#include<vector>
using namespace std;
static vector<vector<int>> graph;
static vector<bool> check;
void DFS(int x);
int main()
{
int point, line;
int dfs_count = 0;
cin >> point >> line;
graph.resize(point + 1);
check.resize(point +1);
check.push_back(false);
for(int i = 0; i < line; i... | ALGO | 0.999573 | 3.92523 |
70e705d7-eade-4e58-9920-25d7af37ad58 | yongyucode/imx6-dual-core-frameworks | base/media/libstagefright/codecs/amrnb/dec/src/dec_gain.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/dec_gain.c
Funtions: dec_gain
Date: 01/31/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updating include file lists, and othe... | ALGO | 0.999608 | 5.641545 |
95bbb674-20aa-4396-a8e2-fd0675dc7cff | mihaicrisan04/comp-programming | leetcode/5LongestPalindromicSubstring/main.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
string longestPalindrome(string s) {
int maxStart = 0;
int maxLength = 1;
for (int i = 0; i < s.size(); i++) {
expand(s, i, i, maxLength, maxStart); // for palindromes of form "aba"
expa... | ALGO | 0.999957 | 6.472188 |
cce7421e-1cb4-4429-a922-4ace907d028d | smadi0x86/Hallucina | obfuscator-llvm/libcxx/test/std/containers/sequences/vector.bool/append_range.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2000000
// template<container-compatible-range<bool> R>
// constexpr void append_range(R&& rg); // C++23
#include <vector>
#include "../insert_range_sequence_containers.h"
#include "test_macros.h"... | TEST | 0.976366 | 6.840341 |
f5683b0e-ccfd-49c9-b252-9899b89b35bb | SPARCS-Service-Hackathon-2024/A4-App | app_front/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.998855 | 6.761023 |
15df5f78-85c5-406c-8bf3-9420b293fd29 | ngthanhtrung23/CompetitiveProgramming | codeforces/546/E.cpp |
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
#define EACH(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define DEBUG(x) { cout << #x << " = "; cout << (x) << en... | ALGO | 0.999944 | 3.353042 |
41ec9859-b4c6-4fea-8b88-5fdcd5cf2b2c | Clo91eaf/CodeForces | Codeforces_old/1956/b.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int a[maxn];
void solve() {
int n;
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
int ans = 0;
for (int i = 1; i < n; i++) {
if (a[i] == a[i-1]) ans++;
}
cout << ans << "\n";
}
int main() {
std::ios::sy... | ALGO | 0.999641 | 5.252581 |
92d46a43-d06c-4313-a61d-7c180993b821 | DroidTh3ory-xx/platform_frameworks_av | media/libstagefright/codecs/amrwb/src/isf_extrapolation.cpp | /*
------------------------------------------------------------------------------
Filename: isf_extrapolation.cpp
Date: 05/08/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-------------------------------------------------------------------... | ALGO | 0.999586 | 5.482253 |
dd4910db-3278-4c9a-8214-0ee9fa0e00de | ishandutta2007/codeforces | maksim1744/normal/1368/D.cpp | /*
author: Maksim1744
created: 18.06.2020 17:57:46
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sum(a) ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a) (*mi... | ALGO | 0.999922 | 4.417839 |
996f20bf-24e9-4ddd-844a-ab83f3e68ccc | jonstewart/boost-svn | libs/graph/test/core_numbers_test.cpp | #include <vector>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/core_numbers.hpp>
#include <boost/property_map/property_map.hpp>
#include <stdio.h>
using namespace boost;
const char* errstr = "";
int test_1() {
// core numbers of sample graph
typedef adjacency_list<vecS,vecS,undirectedS> Gr... | TEST | 0.964052 | 5.381161 |
d0a132d9-f442-4b78-9db0-41441ce3eb77 | allansoria/ECS158_Parallel_Programming | MPI/transgraph.cpp | # include <mpi.h>
# include <stdlib.h>
# include <stdio.h>
int myrows[2];
int total[1];
int NNodes,Me;
MPI_Status status;
int temp[1];
#define SENDROWS 0
#define SENDADJM 1
#define SENDRESULT 2
#define SENDRESULT1 3
#define SENDRESULT2 4
void print(int* adjm , int r,int c, int n){
for(int i = 0; i < r; i++){
... | ALGO | 0.999812 | 3.423622 |
76507ef8-1ffc-4b2a-a15b-8c31393b6125 | BingHan0458/PU-GACNet | data_preprocessing/prep_data/MeshSegmentation/source code/eigen3/blas/double.cpp | #define SCALAR double
#define SCALAR_SUFFIX d
#define SCALAR_SUFFIX_UP "D"
#define ISCOMPLEX 0
#include "level1_impl.h"
#include "level1_real_impl.h"
#include "level2_impl.h"
#include "level2_real_impl.h"
#include "level3_impl.h"
double BLASFUNC(dsdot)(int* n, float* x, int* incx, float* y, int* incy)
{
... | ALGO | 0.998152 | 5.119097 |
f854c5f1-eed5-4601-a43f-cd4860121bca | sriharisundar/GPUspectralsolver | eigen/unsupported/doc/examples/MatrixSinh.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXf sinhA = A.sinh();
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
MatrixXf coshA = A.cosh();
std::cout << "cosh(A) = \n"... | ALGO | 0.992496 | 5.882721 |
8e94e005-8ab3-4441-b5cd-f285393366d3 | jc4250/coding | ccl/marrun.cpp | //https://www.codechef.com/COOK129C/problems/MARARUN
#include<bits/stdc++.h>
using namespace std;
#define cerr if(false) cerr
#define ll long long
const int MOD = 1e9 + 7;
void solve();
int main() {
ios_base::sync_with_stdio(false);cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen(... | ALGO | 0.999812 | 3.99539 |
93658acc-7ea2-479c-8b2c-84a6b4dd6d34 | ishandutta2007/codeforces | ljc00118/normal/1214/B.cpp | #pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define Fast_cin ios::sync_with_stdio(false), cin.tie(0);
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
using namespace std;
typedef unsigned long long ull;
typedef pair <int, ... | ALGO | 0.998981 | 3.095123 |
0a006705-a25e-4294-bd6b-fa9ac3e7a015 | wawanwidiantara/Inventory-Management-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.998776 | 6.763923 |
9e55bf9f-3bde-4ddb-aae0-d0bfcbb0eebf | raincross7/code-similarity | codes/train_code/problem227/problem227_448.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
using ll = long long;
using namespace std;
int gcd(int a, int b) {
if(b == 0) return a;
return gcd(b, a % b);
}
int main(){
ll a,b;
cin>>a>>b;
ll ans=a*b/gcd(a,b);
cout<<ans<<end... | ALGO | 0.999859 | 4.292449 |
efd3753b-9746-49d2-9fe9-a2b06afb8402 | wyattgill9/cpp_dsa | trie.cpp | #include <array>
#include <string>
struct TrieNode {
std::array<TrieNode*, 26> children;
bool is_terminal = false;
TrieNode(): children{} {}
~TrieNode() {
for (TrieNode* child : children) {
delete child;
}
}
};
struct Trie {
TrieNode* root;
Trie() {
... | ALGO | 0.998553 | 5.970418 |
5e80076a-5430-4286-b777-32a1b96761b8 | ww-driving/nd013-c6-control-starter | project/pid_controller/eigen-3.3.7/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp | MatrixXd A = MatrixXd::Random(6,6);
cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
EigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
complex<double> l... | ALGO | 0.999461 | 3.058228 |
56736294-9615-4bdd-af0f-de3193432d6d | urawa72/procon | atcorder/abc134/b/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
int main() {
int n, d; cin >> n >> d;
d *= 2;
d++;
cout << (n + d - 1) / d << endl;
return 0;
}
| ALGO | 0.999346 | 3.099406 |
a3b57f87-a659-44fa-bbfb-3d7ee7fee67c | harsmaur/DSA-LoveB | LinkedLists/detectLoop.cpp | #include <iostream>
#include<map>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
};
bool detectLoop(Node *head)
{
if (head == NULL)
{
return false;
}
map<Node *, bool> visited;
... | ALGO | 0.999928 | 4.483165 |
7cd5518b-56fb-4143-9f9d-a2202ec41ff4 | akpahari03/Data-Structures-and-Algorithms | LinkedList/Circular LinkedList/circularLinkedList.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node *next;
Node(int data) {
this->data=data;
this->next=NULL;
}
~Node() {
int value=this->data;
if(this->next!=NULL){
delete next;
this->next=NULL;
}
... | ALGO | 0.999724 | 4.545918 |
f03c34fa-9d97-421c-a1c2-29e51b69b3cf | electro1rage/Problems_Solved_2016 | Problems_2016/A_AchromaticNumber.cpp | /*
reality, be rent!
synapse, break!
Van!shment Th!s World !!
*/
#include <bits/stdc++.h>
using namespace std;
const int MN = 1010;
int have[MN][MN];
vector<int> ans;
void euler(int node, int n) {
int i;
for (i = 1; i <= n; ++i) {
if (have[node][i]) {
--have[node][i], --have[i][node], euler(i, n);
}
}
ans... | ALGO | 0.999395 | 3.666733 |
7d621499-b1bf-4bee-8291-8f04b6590fd7 | TrentWells5/ProgrammingLanguages | project2/parser.cpp | #include "parser.hpp"
Parser::Parser(const vector<Token>& tokens) : tokens(tokens) {}
bool Parser::parse() {
try {
program();
return true;
} catch (const runtime_error& error) {
return false;
}
}
void Parser::program() {
consume(TokenType::Begin, "Expected 'begin' at the start... | TOOL | 0.933878 | 6.689325 |
7fbff60a-8eab-4581-9233-adc7756e84ac | NovemberChopin/myLeetcode | dataStructure/Queue/CirQueue.cpp | /**
* Circle Queue
* Init: front = rear = 0
* Queue Empty: front == rear
* Queue full: (rear + 1) % MaxSize == front
* EnQueue: rear++, element enQueue
* DeQueue: front++, get the first element in the head.
*/
#include <stdio.h>
#include <stdlib.h>
#define MaxSize 5
typedef char Elem;
typedef struct {
Elem... | ALGO | 0.998092 | 4.507078 |
2903b026-a8b8-4999-bb58-548fe09a8060 | Tieucuc2210/DSA-written-by-Cplus | ThuatToanSInh/b27Spoj.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define MAX_SIZE 1e7
#define MIN_SIZE -1e7
const int MOD = (int) 1e9+7;
const int INF = (int) 1e9+1;
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
bool check(int a[]... | ALGO | 0.999957 | 4.444644 |
d72954a4-156c-4711-83e7-144e11d2ddbd | JannatulLima9575/competitive-programming | Dimik OJ/Dimik-p8.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
long long n;
cin >> n;
if (n % 2 == 0)
cout << "even" << endl;
else
cout << "odd" << endl;
}
return 0;
} | ALGO | 0.999836 | 4.870574 |
c48719f2-2baa-44fb-b304-87d5c7f4062f | wilsjame/CS475 | project4/grainville.cpp | /*********************************************************************
** Author: James G Wilson
** Date: 5/14/2018
** Description: Project 4 CS 475
** Grainville and graindeer simulation.
**
** A month-by-month simulation of a grain-growing operation.
** The amount the grain grows is affected by the temperature,
** am... | ALGO | 0.999661 | 4.881816 |
18751e86-32d4-433a-8831-6e7acd8191b7 | rakib3903/datastructure | hashLearning/Hashing.cpp | #include<bits/stdc++.h>
#define minValue -99999999
using namespace std;
int main() {
int x;
cin>>x;
int hsh[11];
for(int i = 0; i < 11; i++) {
hsh[i] = minValue;
}
for(int i = 0; i < x; i++) {
int element;
cin>>element;
int slot = element % 11;
if(hsh... | ALGO | 0.999731 | 3.733415 |
4bf8574d-1314-47cb-bab6-5c0d6d53313d | bobokisskiss/Cpp-tutorial | c++tutorial/lecture8/calculator.cpp | #include <iostream>
using namespace std;
int main()
{
float num1, num2;
char operation;
cout<<"CodeBeauty Calculator"<<endl;
cin>>num1>>operation>>num2;
switch(operation)
{
case '-':cout<<num1<<operation<<num2<<"="<<num1-num2;break;
case '+':cout<<num1<<operation<<num2<<"="<<n... | ALGO | 0.983113 | 3.601943 |
42932dfc-21ed-483d-9b60-c7e2dae3c522 | deker104/archiver | src/compressor.cpp | #include "compressor.h"
#include <algorithm>
#include <fstream>
#include <functional>
#include <memory>
#include <string_view>
#include "binary_trie.h"
#include "constants.h"
#include "huffman.h"
#include "priority_queue.h"
Compressor::Compressor(std::filesystem::path archive_name) : os_(archive_name, std::ios::bina... | ALGO | 0.984617 | 6.359179 |
a2417cab-6102-4bce-afa1-46dc47231bf3 | dimitrijepanic/leetcode_tasks_may24 | beautiful_subsets/solution_vector.cpp | // solution with vectors
#include <vector>
using namespace std;
class Solution {
public:
int beautifulSubsets(vector<int>& nums, int k) {
vector<int> curr;
return helper(nums, curr, k, 0);
}
int helper(vector<int>& nums, vector<int>& curr, int k, int start){
if(start >= nums.size()... | ALGO | 0.999914 | 5.822124 |
c1d69a00-52f7-4cb2-a3e3-96a75deff06a | Zhenhanyijiu/psi3_github | thirdparty/win/miracl/miracl_osmt/source/palin.cpp | /*
* Program to investigate palindromic reversals.
* Gruenberger F. Computer Recreations, Scientific American. April 1984.
*
* Requires: big.cpp
*
*/
#include <iostream>
#include "big.h" /* include MIRACL system */
using namespace std;
Miracl precision(120,10);
BOOL rever(Big &x,Big &y)
{ /* reverse d... | ALGO | 0.998771 | 5.342393 |
6ada06ab-9c76-426b-951d-6b4f56aac442 | sachinsurendran/neural-network-classes | Flood/ObjectiveFunctional/RosenbrockFunction.cpp | /****************************************************************************************************************/
/* */
/* Flood: An Open Source Neural Networks C++ Library ... | ALGO | 0.867933 | 7.029236 |
12afb6b5-ab6f-4a29-98cf-6cbe1675f0b1 | chaudharygitesh/geeksforgeeks | Medium/Non Repeating Numbers/non-repeating-numbers.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
vector<int> singleNumber(vector<int> nums)
{
// Code here.
// set<int> s;
int n=nums.size();
// for(int i = 0 ; i< n;i++){
// s.insert(nums[i]);
... | ALGO | 0.999728 | 5.343489 |
9347cb16-be09-4c79-9502-f53c67eca97b | ersawant/CarND-P11-Path-Planning-Project | src/Eigen-3.3/bench/sparse_dense_product.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.99348 | 4.386344 |
951ed265-8b05-4f31-abc2-e5fc4dd171df | HarshrajDesai/WScubeTech-Projects | wscude_notes_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.99817 | 6.76775 |
7d069097-c43e-4930-979b-022af23a1e9d | palilo815/ps | baekjoon/14000/14912.cpp | #include <iostream>
using namespace std;
int count_d(int n, int d)
{
int ret = 0;
while (n) {
if (n % 10 == d) ++ret;
n /= 10;
}
return ret;
}
int main()
{
int n, d; cin >> n >> d;
int ans = 0;
for (int i = 1; i <= n; ++i)
ans += count_d(i, d);
cout << ans;
r... | ALGO | 0.999499 | 4.31189 |
29074150-00bd-433a-bcd1-ccc5f71b335b | HarukaMa/android_frameworks_av | media/module/codecs/mp3dec/src/pvmp3_imdct_synth.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_imdct_synth.cpp
Date: 09/21/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------... | ALGO | 0.999661 | 4.135145 |
ac135aa9-65b0-4e93-9708-3e248e9bf81d | keqhe/leetcode | round1/leetcode210.cpp |
class Solution {
public:
//DFS or BFS
//first, BFS, ref: http://www.programcreek.com/2014/06/leetcode-course-schedule-ii-java/
vector<int> findOrder_bfs(int numCourses, vector<pair<int, int>>& prerequisites) {
vector<int> res;
if (numCourses == 0)
return res;
vector<int... | ALGO | 0.999997 | 5.869393 |
a49b7240-991c-4d60-b668-798bfa230c95 | AMosa3d/ProblemSolving | Greedy Problems/Codeforces/1400/C_vanya_and_exams.cpp | // Problem Link : https://codeforces.com/problemset/problem/492/C
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include<iostream>
#include<vector>
#include<deque>
#include<set>
#include<map>
#include<string>
#include<fstream>
#include<algorithm>
#include<math.h>
#include<iomanip>
#define ll long long
... | ALGO | 0.999211 | 3.815166 |
f0f3214c-d9cb-401c-8478-c9732f057979 | harsh-priyam/CPP-Concept-Codes | STL-FunctionObjects.cpp | #include<iostream>
#include<functional>
#include<algorithm>
using namespace std;
int main()
{
int arr[] = {4,9,7,1,55,625};
//sort(arr,arr+5); This is in default mode and it will sort in ascending order
sort(arr,arr+5,greater<int>()); /* This is in manual mode and it will sort as u command */
for (... | ALGO | 0.998424 | 3.944218 |
1c0e7b66-9a27-45a3-8222-a46c58c3b894 | Ryoga-itf/programming-challenges | week05/A-wheresmyinternet/main.cpp | #include <iostream>
#include <vector>
using namespace std;
struct UnionFind {
vector<int> par;
UnionFind(const size_t n) : par(n, -1) {}
int root(const size_t x) noexcept { return (par[x] < 0 ? x : par[x] = root(par[x])); }
bool unite(size_t x, size_t y) noexcept {
x = root(x);
y = root... | ALGO | 0.999873 | 4.831561 |
0c82ddeb-b31f-44e2-a6de-bb2f941e589f | VIKASRAPARTHI/Cipher-Schools | Lecture-5.cpp | #include <iostream>
using namespace std;
int main() {
int x; // variable name x of type int---> It can store a single integer which means x only one
//arrays can be used to store multiple variable names
inta[5]; //This means it is array of name a which can store multiple integers
//Note: Thw ind... | ALGO | 0.989349 | 3.580399 |
ac1cf89f-865a-41b6-8efd-d0e859ce903b | Kriti2019/GFG_ | Difficulty: Hard/Median in a row-wise sorted Matrix/median-in-a-rowwise-sorted-matrix.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
int upperBound(vector<int> &arr, int x, int n) {
int low = 0, high = n - 1;
int ans = n;
while (low <= high) {
int... | ALGO | 0.999954 | 5.797784 |
5ea564c3-12bf-4359-94d2-f77b941a8f87 | SoumyaDeori/GeeksforGeeks | Shortest Common Supersequence :- Given two strings X and Y of lengths m and n respectively, find the length of the smallest string which has both, X and Y as its sub-sequences.cpp | class Solution
{
public:
//Function to find length of shortest common supersequence of two strings.
int shortestCommonSupersequence(string X, string Y, int m, int n)
{
vector<vector<int>> dp(m+1,vector<int>(n+1,0));
for (int i=1;i<=m;i++)
{
for (int j=1;j<=n;j+... | ALGO | 0.999982 | 5.578147 |
27ee9e79-9566-48c9-8a84-61858472b63e | openeuler-mirror/bishengjdk-11 | src/hotspot/share/opto/regmask.cpp | #include "precompiled.hpp"
#include "opto/ad.hpp"
#include "opto/chaitin.hpp"
#include "opto/compile.hpp"
#include "opto/matcher.hpp"
#include "opto/node.hpp"
#include "opto/regmask.hpp"
#define RM_SIZE _RM_SIZE /* a constant private to the class RegMask */
//-------------Non-zero bit search methods used by RegMask--... | ALGO | 0.919195 | 6.426092 |
402fb58a-927d-45e3-b24e-88e5f7cf19bb | linux4life798/llvm-project-ci-test | libc/src/math/amdgpu/nearbyint.cpp | #include "src/math/nearbyint.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, nearbyint, (double x)) {
return __builtin_nearbyint(x);
}
} // namespace LIBC_NAMESPACE_DECL
| TOOL | 0.986162 | 5.864414 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.