uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5e420095-1caa-490e-b2b2-af7fd6e24c5b | ishandutta2007/codeforces | noimi/normal/1400/D.cpp | #pragma region Macros
#pragma GCC optimize("O3")
#pragma GCC target("avx2,avx")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= ... | ALGO | 0.999956 | 4.544182 |
71cbf298-8f9e-46a0-9b42-bb94c478c2de | Arnav17Sharma/CodeForces | B_Sakurako_and_Water.cpp | #include<bits/stdc++.h>
using namespace std;
long long minn() {
int n;
cin >> n;
vector<vector<int>> a(n, vector<int>(n));
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
cin >> a[i][j];
}
}
long long ans = 0;
for(int i = 0; i < n; i++) {
... | ALGO | 0.999801 | 3.891165 |
c5026fda-ae21-451f-a115-543d1df1f148 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_1409_4.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m, k, x, y, v, u, ans;
vector<vector<int> > adj(10005);
bool visited[10005];
map<long long, long long> lf, rt;
map<pair<long long, long long>, long long> mp;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x >> y;
lf[x]++, rt[y]++, mp[{x, y}]+... | ALGO | 0.999834 | 3.861892 |
610af6a3-0564-4376-82ae-cd29c25c980f | taekungkub/flutter-test-component | 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.998784 | 6.761023 |
dc37ea6b-c296-4df3-b54d-788b1c28276e | russaltang88/leetcode-solutions | cpp/1822-sign-of-the-product-of-an-array.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
int arraySign(vector<int>& nums) {
int neg = 0;
for (int i : nums) {
if (i == 0) {
return 0;
} else {
neg += (i < 0) ? 1 : 0;
}
}
return (neg % 2 == 0) ? 1 : -1... | ALGO | 0.999989 | 5.916205 |
cf1848c4-d07e-4581-b6fd-fbf4bb92d17a | walwald/TIL-Today-I-Learned | C++algorithm/Doit!/ch1-19.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
vector<int> A; // 함수에서 사용할 값 미리 선언
vector<int> tmp(1000004, 0);
void mergesort(int S, int E){
if(E - S < 1) {
return;
}
int M = S + ((E - S) / 2);
mergesort(S, M);
mergesort(M + 1, E);
for(int i = S; i <= E; i++){
tmp[i] = A[i];
} // 필요한 구역만... | ALGO | 0.999986 | 4.815127 |
38fb2a88-6d2e-45d5-9b58-62ab10b03e09 | rsln-s/aggregative-coarsening-for-multilevel-hypergraph-partitioning | packages/anasazi/epetra/example/BlockDavidson/BlockDavidsonEpetraExGenPrecIfpack.cpp | #include "AnasaziConfigDefs.hpp"
#include "AnasaziBasicEigenproblem.hpp"
#include "AnasaziBlockDavidsonSolMgr.hpp"
#include "AnasaziBasicOutputManager.hpp"
#include "AnasaziEpetraAdapter.hpp"
#include "Epetra_CrsMatrix.h"
#include "Epetra_InvOperator.h"
#include "Teuchos_CommandLineProcessor.hpp"
// Include header for... | ALGO | 0.999297 | 5.044071 |
28ea2ae4-55de-4ba1-9e66-09de4b3e6dca | stuti2/CPP_Practice | Bit_Manipulation/Diff_char_in_2Strings.cpp | #include<bits/stdc++.h>
using namespace std;
char findTheDifference(string s, string t);
char findTheDifference(string s, string t)
{
char random=t[s.size()];
for(int i=0;i<s.length();i++)
random^=s[i]^t[i];
return random;
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdi... | ALGO | 0.99995 | 4.626524 |
fb461910-b3d8-463c-9766-356390888d9b | SLIIT-FacultyOfComputing/tutorial-03b-IT21257568 | exercise02.cpp | #include <iostream>
using namespace std;
//function declaration
int volume(int height, int width, int length);
int main() {
int box1Height, box1Width, box1Length;
int box2Height, box2Width, box2Length;
int totalVolume, totalSurface;
cout << "Enter Box 1 Height : ";
cin >> box1Height;
cout ... | TOOL | 0.939428 | 3.721594 |
9703fccc-78ad-46d1-85fc-9579476e448c | Jeongmin4869/Algorithm | 프로그래머스/최소직사각형.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<vector<int>> sizes) {
int w = 0, h = 0;
for (int i = 0; i < sizes.size(); i++) {
h = max(h, max(sizes[i][0], sizes[i][1]));
w = max(w, min(sizes[i][0], sizes[i][1]));
}
return w * h;
} | ALGO | 0.998159 | 5.47717 |
ad3ce80c-0fa8-463f-9351-97fae1b41c2a | IrakozeLoraine/data_structures_with_c- | quick_sort.cpp | #include<iostream>
using namespace std;
void swapArr(int *first, int *second){
int temp = *first;
*first = *second;
*second = temp;
}
int partition(int arr[], int start, int end){
int pivot = arr[end];
int pindex = start;
//format the array so that the values smaller than pivot are under it
// and the great... | ALGO | 0.999832 | 4.718797 |
7916f48c-e6e1-43fb-8010-d68802e0f187 | Parvejprv/CPP-DSA-180-Days | Day 028 (Revision) - Sorting algorithms (above)/selection sort/SortTheCharacterArrayUsingSelectionSortInIncreasingOrderOfSizeN.cpp | /*
Question: - Sort the given Character array using the selection sort in increasing order, With the help of the Function.
*/
#include<iostream>
using namespace std;
void SortTheArrayUsingSelectionSort(char arr[], int n) {
for(int i=0; i<n; i++){
int index = i;
for(int j=i+1; j<n; j++){
if(arr... | ALGO | 0.999884 | 4.946674 |
cc2c8d8a-b4ea-45ab-9270-5694e436ea12 | DCTewi/AlgorithmTemplates | 3.数论 - Number Theory/矩阵快速幂.cpp | // HDU - pid=5015 - 233 Matrix
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 10000007;
const int MAXM = 1e9 + 5;
const int MAXN = 1e1 + 5;
ll n, m, a[MAXN], ans = 0;
// mat begin //
struct Matrix
{
ll dat[MAXN][MAXN];
Matrix()
{
memset(dat, 0, sizeof(da... | ALGO | 0.999844 | 3.660754 |
87fe3e55-1264-40fe-8278-e26240b829cd | Danielc2016/LeetCodeCpp | 0011_Container_With _Most_Water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int size = height.size();
int left = 0, right = size-1;
//int left_h = height[left], right_h = height[right];
int maxArea = (right - left) * min(height[left], height[right]);
while(left < right)
{
... | ALGO | 0.999981 | 6.56609 |
5a95f22c-f804-403e-99f6-377f22983667 | GreyManuel/GreyHacks | Recursion and backtracking/isPalindrome.cpp | #include <iostream>
using namespace std;
bool isPalindrome(string s, int l, int n)
{
if(s[l]!=s[n-l-1])
return false;
if(l>=n/2)
return true;
return isPalindrome(s, l + 1, n);
}
int main()
{
string s = "MADAN";
int n = s.length();
if(isPalindrome(s, 0, n))
cout << "YE... | ALGO | 0.999977 | 4.481 |
e3d281f7-ef5f-4ac0-b8e5-b727cd980c16 | heeung/baekjoon__c__cpp | silver/sil3/11659/11659.cpp | #include <iostream>
int main()
{
int N, M, i, a, b, num;
int arr[100001] = {0, };
int dp[100001] = {0, };
scanf("%d %d", &N, &M);
for (i = 1 ; i <= N ; i++) {
scanf("%d", &num);
arr[i] = num;
dp[i] = num + dp[i - 1];
}
while (M--)
{
scanf("%d %d", &a, &b);
printf("%d\n", dp[b] - dp[a - 1]);
}
}
| ALGO | 0.999946 | 3.989841 |
74847519-62a1-4ce4-b086-d9414ccb52dd | mt-shihab26/courses | 06_phase1_youknowwho-academy/short-contests/contest-01/C_Easy.cpp | #include <bits/stdc++.h>
using namespace std;
#define ed '\n'
#define gp ' '
#define ll long long int
#define vec vector
#define str string
#define all(x) x.begin(), x.end()
const int mod = 1e9 + 7;
const int inf = 1e9;
bool solve(int ti = 0)
{
str s;
cin >> s;
int sub_len = s.size() - 1;
map<str, i... | ALGO | 0.999868 | 4.353493 |
756afc7b-7b4b-46c6-8198-a0ebe8803cb9 | trannguyenducan/trannguyenducan_MonC | Chapter_3/Ex_3.24.cpp | // This program asks for the lengths of the two sides of a
// right triangle. The length of the hypotenuse is then
// calculated and displayed.
#include <iostream>
#include <iomanip> // For setprecision
#include <cmath> // For the sqrt and pow functions
using namespace std;
int main()
{
double a, b, c;
cout << ... | ALGO | 0.99789 | 4.075294 |
b5a3d595-8570-4569-8e99-587657dc7f10 | Ishaan-27/100daysofcode | Day 30/Max_consecustive_ones.cpp | #include <iostream>
#include <vector>
class Solution {
public:
int findMaxConsecutiveOnes(std::vector<int>& nums) {
int i, count=0, max=0;
for(i=0 ; i<nums.size() ; i++)
{
if(nums[i]==1)
{
count++;
if(count>max)
{
... | ALGO | 0.999992 | 7.014682 |
43034e9c-9db1-4813-8af8-938b1c09b25a | bpowers/boost | libs/numeric/ublas/test/test_triangular.cpp | #include <iostream>
#include <stdlib.h>
#include <cmath>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/timer/timer.hpp>
namespace ... | ALGO | 0.999692 | 4.725535 |
e0a30b1f-4d57-40c3-9ae0-4925f2bfa45c | abhijeet-talaulikar/Algorithms | Cryptography/RabinCryptosystem.cpp | #include<iostream>
#include<stdlib.h>
#include<time.h>
#include<cmath>
using namespace std;
class Rabin {
long int N, P, Q, a, b;
public:
Rabin() {
KeyGen();
}
int solveCongruence(int c, int a, int n) {
int i = 0;
while(1) if((c * (i++)) % n == 1) return i-1;
return 0;
}
Rabin(long int P, long int Q)... | ALGO | 0.999964 | 3.47987 |
bb742405-13d6-40ea-b9e4-7699dd4545e5 | mkk96/DSA-Assignment | 2021201064_A4/2021201064_Q1b.cpp | #include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
const int n =1000001;
int *suffixRank=new int[n], gap, len;
bool cmp(int x, int y)
{
if(suffixRank[x]==suffixRank[y])
{
x=x+gap;
y=y+gap;
return (x<len&&y<len)?suffixRank[x]<suffix... | ALGO | 0.999994 | 3.646165 |
d2d24a4a-45a8-4768-9756-719b5a995072 | wide777/AtCoder | ABC/ABC002/D.cpp | #include <iostream>
#include <vector>
using namespace std;
using Graph = vector<vector<int> >;
int main() {
int N, M;
cin >> N >> M;
Graph G(N);
for(int i = 0; i < M; ++i) {
int x, y;
cin >> x >> y;
--x, --y;
G[x].push_back(y);
G[y].push_back(x);
}
int a... | ALGO | 0.999863 | 4.490958 |
52fd9e9a-d349-4f3e-ae12-ebced63e74b2 | no0bAuntor/Data-Structures-and-Algorithm | T31_Delete_Node_BST.cpp | #include <iostream>
#define SPACE 10
using namespace std;
class TreeNode
{
public:
int value;
TreeNode *left;
TreeNode *right;
TreeNode()
{
value = 0;
left = NULL;
right = NULL;
}
TreeNode(int v)
{
value = v;
left = NULL;
right = NULL;
... | ALGO | 0.998675 | 4.740376 |
5b0eab10-298e-45f4-ad97-e0a0d7ebcc2a | nikohoffren/lens-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.998859 | 6.785645 |
a8851706-8483-4849-8ef1-6d050962c8aa | jsren/llvm-detex | llvm/lib/Support/DAGDeltaAlgorithm.cpp | #include "llvm/ADT/DAGDeltaAlgorithm.h"
#include "llvm/ADT/DeltaAlgorithm.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <iterator>
#include <map>
using namespace llvm;
#define DEBUG_TYPE "dag-delta"
namespace ... | TEST | 0.965385 | 7.719363 |
3e4fe87f-f196-4b50-86c9-9041a4920386 | raincross7/code-similarity | codes/train_code/problem158/problem158_499.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0... | ALGO | 0.999486 | 3.25883 |
a7b53ae9-4bc8-41d3-b083-9f08c7854558 | syncfusion/SfQtWebKit | qtwebkit/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.cpp | #include "config.h"
#include "SVGResourcesCycleSolver.h"
// Set to a value > 0, to debug the resource cache.
#define DEBUG_CYCLE_DETECTION 0
#if ENABLE(SVG)
#include "RenderSVGResourceClipper.h"
#include "RenderSVGResourceFilter.h"
#include "RenderSVGResourceMarker.h"
#include "RenderSVGResourceMasker.h"
#include "SV... | TOOL | 0.8761 | 7.249879 |
7ad09772-c92d-4d3f-8cb4-39e4a4e2b216 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2460_5.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 40010;
int n, m, ans;
bool a[2][maxn];
int par[maxn];
int find(int x) { return par[x] == x ? x : (par[x] = find(par[x])); }
int merge(int x1, int x2) {
int f1 = find(x1);
int f2 = find(x2);
if (f1 != f2) {
par[f1] = f2;
return 1;
}
return ... | ALGO | 0.999922 | 3.853838 |
f1bcc7e4-78c3-42f6-a154-256a1aeeb934 | Fremoqq/Informatyka | Lekcja 5 Wyjaśnienie pętli for/Zadanie 3 - Liczby nieparzyste od 1 do N.cpp | #include <iostream>
using namespace std;
int main(){
int N;
cout << "Podaj liczbe N: ";
cin >> N;
cout << "liczby nieparzyste od N: " << endl;
for(int L = 1; L <= N; L += 1){
if(L % 2 != 0)
cout << L;
else{
cout << endl;
}
}
} | ALGO | 0.998234 | 3.871698 |
f4055bc5-71f6-4e7d-be96-8e1c59c5a173 | chickly/Arch | src/LearnCpp/11.数组,字符串和动态内存分配/11.4/std::sort.cpp | #include <algorithm>
#include <iostream>
#include <iterator>
int main() {
int array[]{8, 5, 2, 6, 3, 7, 5, 1, 0};
std::sort(std::begin(array), std::end(array));
for (int i = 0; i < std::size(array); ++i) {
std::cout << array[i] << '\n';
}
std::cout << "\n";
return 0;
}
| ALGO | 0.999754 | 5.050879 |
2e24867c-068a-4df5-82c6-0d62cda7d43e | raincross7/code-similarity | codes/train_code/problem173/problem173_398.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007
vector<long long> divisor(... | ALGO | 0.999986 | 4.850176 |
6ada379b-6ae1-4640-9823-0ab007b19edd | cinarteker/leetcode | 268-missing-number/missing-number.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
int ans = 0;
for(int i = 0; i < nums.size(); i++) {
ans ^= nums[i] ^ i;
}
ans ^= nums.size();
return ans;
}
}; | ALGO | 0.999953 | 5.658186 |
34db0a92-c2e3-40d0-9ff4-c5022a9e8776 | Tervicke/cp | codeforces/1931C.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n;
cin >> n;
int ar[n];
for(int i = 0 ; i < n ; i++){
cin >> ar[i];
}
int f=0;
int l=0;
for(int i = 0 ; i < n ; i++){
if(ar[0] == ar[i] ){
f++;
}else{
break;
}
}
reverse(ar,ar+n);
for(... | ALGO | 0.999927 | 3.967013 |
ab10f6e3-21ce-4718-a7a0-4d8ad5e036ad | hsiuqnav/LeetCode | LeetCode/String to Integer.cpp | #include <iostream>
using namespace std;
class Solution{
public:
const int MAX = 0x7fffffff;
const int MIN = 0x80000000;
const int MAXBITS = 11;
int myAtoi(string str){
return myAtoiCore(str);
}
private:
string _DeletaFrontSpace(string str){
int len = str.length();
int pos = 0;
for (int i = 0; i < len; ... | ALGO | 0.994159 | 4.577796 |
6739fdcb-0f4c-4002-a549-02bdd68c4509 | newcleanbird/CodingInterview | src/52_FirstCommonNodesInLists/FirstCommonNodesInLists.cpp | // 《剑指Offer——名企面试官精讲典型编程题》代码
// 本书原作者:何海涛
// 仓库作者:淡定但丁
//==================================================================
// 面试题52:两个链表的第一个公共结点
// 题目:输入两个链表,找出它们的第一个公共结点。
#include <cstdio>
#include "..\Utilities\List.h"
unsigned int GetListLength(ListNode* pHead);
ListNode* FindFirstCommonNode(ListNode *pHead1, L... | ALGO | 0.998601 | 4.745213 |
e391393f-e913-4a00-8812-e105934ec333 | aashitsoni/Algorithms | Templates/Backtracking Aggregation.cpp | int dfs(int startIndex, std::vector<T>& target) {
if (isValid(target[startIndex:])) {
return 1;
}
for (auto edge : getEdges(startIndex, [...additional states])) {
if (additional states) {
update([...additional states]);
}
ans = aggregate(ans, dfs(startIndex + edge... | ALGO | 0.999928 | 5.70864 |
bb1b67d5-f27a-41c8-8167-56c1534c3fcb | ishandutta2007/codeforces | cdkrot/normal/583/A.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stdint.h>
#include <assert.h>
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using std::vector;
using std::string;
using std::pair;
using std::make_pair;
using std::min;
using std::max;
usin... | ALGO | 0.9995 | 3.440297 |
6337f5c2-3195-4880-9b36-16fa1734a44b | srele96/sk-experiments | cpp/experiments/algorithms/src/long_jumps.cpp | #include <bits/stdc++.h>
using namespace std;
// https://codeforces.com/problemset/problem/1472/C
void solve() {
int n;
scanf("%d", &n);
vector<int> a(n);
for (int &i : a) {
scanf("%d", &i);
}
vector<int> dp(n, -1);
for (int i = n - 1; i >= 0; --i) {
int sum = 0;
int j = i;
while (j < ... | ALGO | 0.999733 | 4.849731 |
62670ac5-7d8e-42e4-8090-9100372b3711 | ThapaVinay/LeetCode | 0410-split-array-largest-sum/0410-split-array-largest-sum.cpp | class Solution {
public:
int check(vector<int> nums, int sum)
{
int res = 1;
int x = 0;
for(int i=0; i<nums.size(); i++)
{
x += nums[i];
if(x > sum)
{
x = nums[i];
res++;
}
}
... | ALGO | 0.999947 | 5.607393 |
898590e7-4021-4080-b00a-91070b69e000 | shoaibrayeen/Programmers-Community | Dynamic Programming/Count Number of Subsets having Given XOR Value/SolutionByAshutosh.cpp | /*
Program Description:Given an array arr[] of n numbers and a number K, find the number of subsets of arr[] having XOR of elements as K
Input: n=4, arr[] = {6, 9, 4,2}, k = 6
Output: 2
The subsets are {4, 2} and {6}
Input: n=5, arr[] = {1, 2, 3, 4, 5}, k = 4
Output: 4
The subsets are {1, 5}, {4}, {1, 2, 3, 4} ... | ALGO | 0.999989 | 5.68337 |
ef8cc0ed-24e7-47cd-9cd4-9b02cec3ac14 | SEEWON/Algorithm | BOJ/10828.cpp | #include <iostream>
#include <stack>
using namespace std;
int main(void) {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
stack<int> s;
for (int i = 0; i < t; i++) {
string str;
cin >> str;
if (str == "push") {
int x;
cin >> x;
s.push(x);
}... | ALGO | 0.998932 | 4.611365 |
80e3c325-5f36-46c2-be9d-8f9720c7c024 | khushaalsharma/my-dsa-codes | ReducingDishes.cpp | /*
LeetCode Hard problem on Dynamic Programming
Approach: use knapsack pattern of including and excluding dish
Steps:
1) sort the given satisfaction array
2) Apply the knapsack approach
*/
class Solution {
public:
int solve(vector<int> &satis, int dishIndex, int time, vector<vector<int>> &dp){
if(dishInd... | ALGO | 0.99984 | 6.079698 |
bbbd7bcf-6a55-456b-aa78-b0945283c70b | ngthanhtrung23/CompetitiveProgramming | codeforces/22/A.cpp | #include <set>
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <complex>
#include <iostream>
#include <algorithm>
#include <ctime>
#include <deque... | ALGO | 0.999459 | 3.775346 |
d368466a-d01e-4691-9a82-cb2c1da44f1e | vuquangsang/VQS | r2.cpp | /* Vu Quang Sang from Le Khiet High School for Gifted */
#include <bits/stdc++.h>
using namespace std;
//#define ll int
#define lg(x) __lg(x)
#define alla(a,n) a+1,a+n+1
#define el "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ll long long
#define fi first
#define ... | ALGO | 0.99996 | 4.18957 |
5160e649-ddd6-4adc-8895-d1ebed045ad2 | zeroy0410/OI-Code | CSP/contest33/number/number.cpp | #include<bits/stdc++.h>
#define M 1000005
#define LL long long
const int mod=998244353;
const int base=97;
using namespace std;
int n,m,h[M],tt;
struct edge{
int nxt,to,co;
}G[M];
void Add(int a,int b,int c){
G[++tt]=(edge){h[a],b,c};
h[a]=tt;
}
int in[M];
queue<int>Q;
int dis[M];
LL ans[M],fa[M][21],key[M][21],pw[M... | ALGO | 0.999997 | 4.268074 |
86b63382-a919-43fd-8f97-1eb9915dc91b | arifhosan/SolvedProblems | UVa 12279/Source.cpp | #include<iostream>
using namespace std;
int main() {
int i, n, x, no = 0;
int count;
while (1) {
count = 0; no++;
cin >> n;
if (!n) break;
for (i = 0; i < n; i++) {
cin >> x;
if (x > 0 && x < 100) count++;
if (!x) count--;
}
cout << "Case " << no << ": " << count << endl;
}
return 0;
} | ALGO | 0.995646 | 3.612502 |
8aba64ad-7ac0-4b1d-86e4-cdbe302d9a0a | sun9166/Planning | robotaxi-bus-planning/src/planning/planning/src/algorithm/optimizer/smoothing_spline/piecewise_linear_constraint.cpp | /**
* @file piecewise_linear_constraint.cpp
* @brief: Implementation of PiecewiseLinearConstraint class
**/
//#include "ros/ros.h"
#include "piecewise_linear_constraint.h"
#include "common/base/log/include/log.h"
namespace acu {
namespace planning {
namespace math {
namespace {
Eigen::MatrixXd MergeMaxtrices(con... | ALGO | 0.997798 | 5.856524 |
6bfec204-9f50-4493-a527-e8332d812f23 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-cot-gpt4/Codenet/p02405/596649259/response_8.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int H, W;
while (cin >> H >> W && H != 0 && W != 0) {
string line1, line2;
for (int j = 1; j <= W; j++) {
line1 += ".#"[(j % 2 == 0)];
line2 += ".#"[(j % 2 != 0)];
}
for (int i = 1; i <= H; i++) {
if(i % 2 == 0... | ALGO | 0.99943 | 3.443565 |
c11a69b5-2269-4848-ad9f-16e18d6189aa | prathm16/Application-Programs-cpp | program440.cpp | #include<iostream>
using namespace std;
template <class T>
struct NodeS
{
T data;
struct NodeS *next;
};
template <class T>
class SinglyLL
{
public:
struct NodeS<T> * first;
int iCount;
SinglyLL();
void Display();
int Count();
void InsertFirst(T);
void InsertLast... | ALGO | 0.998484 | 4.385929 |
b55dba62-cead-46b6-b4f1-739f0e1f6a2a | thomasian06/udacity-self-driving-car | behavior-planning/project/starter_files/eigen-3.3.7/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
m << 1,-2,
-3,4;
cout << "1-norm(m) = " << m.cwiseAbs().colwise().sum().maxCoeff()
<< " == " << m.colwise().lpNorm<1>().maxCoeff() << endl;
cout << "infty-norm(m... | ALGO | 0.999836 | 4.076589 |
3fa6fab0-9f8f-4e1d-9f0e-308e2e21c4fa | SonuLohani-1/LeetcodeProblems | LeetCode150/502.cpp | #include<bits/stdc++.h>
using namespace std;
// This is the solution of the problem 502 on leetcode - IPO
// https://leetcode.com/problems/ipo/
// First we can make pairs of profit and capital and then sort them according to the capital.
// Now we can use a priority queue to store the profits of the projects which hav... | ALGO | 0.999977 | 5.131327 |
eb41cb86-84b7-4cd2-baa6-9f1d4d51dc31 | alejandroroseroc/taller_maps_flutter | 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 |
198ec9e1-5ade-4c3d-b7ad-e283090a4cfd | doocs/leetcode | solution/0800-0899/0881.Boats to Save People/Solution.cpp | class Solution {
public:
int numRescueBoats(vector<int>& people, int limit) {
sort(people.begin(), people.end());
int ans = 0;
for (int i = 0, j = people.size() - 1; i <= j; --j) {
if (people[i] + people[j] <= limit) {
++i;
}
++ans;
... | ALGO | 0.999998 | 5.933006 |
e4ac9313-f9b7-441f-9f6e-16f382323a43 | cuber201/parall_5_1 | parall_5_1/parall_5_1.cpp | #include <iostream>
#include <vector>
#include <omp.h>
#include <chrono>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
using namespace std;
using namespace cv;
const int ROWS = 200;
const int COLS = 200;
const int side = 800;
void printBoard(const vector<vector<bool>>& board, Mat& frame) {
int d ... | ALGO | 0.999152 | 6.225574 |
35984ecd-0cc4-4994-b8f8-8fc3f9cb19af | 0xm4yo/compro | atcoder/asakatsu/asakatsu20231125/G.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
#define rep(i, a, b) for(ll i=a; i<b; i++)
#define rrep(i, a, b) for(ll i=a; i>=b; i--)
#define all(a) (a).begin(), (a).end()
#define YesNo(bool) if(bool){cout<<"Yes"<<en... | ALGO | 0.9999 | 4.858401 |
a1924482-a356-418a-9ec6-c416336e8b6f | Rabinkhulimuli/discrete | Lab 13 Symmetric Properties of relation.cpp | #include <stdio.h>
// Function to check if a relation is symmetric
int isSymmetric(int relation[][2], int n) {
for (int i = 0; i < n; i++) {
int a = relation[i][0];
int b = relation[i][1];
int found = 0;
// Check if (a, b) is symmetric
for (int j = 0; j < n; j++) {
... | ALGO | 0.999941 | 5.817076 |
a2a07f73-3b33-4ce8-abea-665faa3acb02 | miroslavmadzharov02/Practicum-Intro-To-Programming | Week04/(3) reverse int/(3) reverse int.cpp | using namespace std;
#include <iostream>
int main()
{
int number, reverseNumber = 0;
cin >> number;
do
{
reverseNumber = (reverseNumber * 10) + (number % 10);
number /= 10;
} while (number != 0);
cout << reverseNumber;
}
| ALGO | 0.99993 | 5.156271 |
1d31e25a-b545-4216-ac2c-905dbb249179 | bobowang2333/FSE19 | LLVM/llvm/lib/Support/DAGDeltaAlgorithm.cpp | #include "llvm/ADT/DAGDeltaAlgorithm.h"
#include "llvm/ADT/DeltaAlgorithm.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <iterator>
#include <map>
using namespace llvm;
#define DEBUG_TYPE "dag-delta"
namespace ... | TEST | 0.971794 | 7.722412 |
464ccb42-9a4d-4628-8635-2428d260ff40 | ggml-org/llama.cpp | ggml/src/ggml-sycl/norm.cpp | #include "norm.hpp"
#include "ggml-sycl/common.hpp"
#include "ggml-sycl/presets.hpp"
static void norm_f32(const float* x, float* dst, const int ncols, const int64_t stride_row, const int64_t stride_channel,
const int64_t stride_sample, const float eps, const sycl::nd_item<3>& item_ct1, sycl::float2* s_sum, int... | ALGO | 0.956076 | 6.036808 |
59d9aa93-70ce-48b8-a53e-b14d05737118 | scalaris-project/scalaris | src/wallet/rpcdump.cpp | #include <chain.h>
#include <core_io.h>
#include <interfaces/chain.h>
#include <key_io.h>
#include <merkleblock.h>
#include <rpc/server.h>
#include <rpc/util.h>
#include <script/descriptor.h>
#include <script/script.h>
#include <script/standard.h>
#include <sync.h>
#include <util/bip32.h>
#include <util/system.h>
#incl... | WEB | 0.955772 | 7.588593 |
7321a55e-fb6c-4d20-93d0-338568ffb997 | Priyans1727C/LPU_Colab | DSA/lecture_18/priority_queue.cpp | // You are using GCC
#include <iostream>
#include <vector>
const int MAX_SIZE = 100;
class PriorityQueue {
private:
std::vector<int> elements;
std::vector<int> priorities;
int size;
public:
PriorityQueue() {
elements.resize(MAX_SIZE);
priorities.resize(MAX_SIZE);
size = 0;
... | ALGO | 0.999946 | 6.221846 |
041e4dd8-3d6c-440e-a52e-6850ef0106e3 | L-dana/limited | hanoi/hanoiqueue.cpp | #include "hanoiqueue.h"
#include <iostream>
hanoi::hanoi(int size) {
numof = 1;
hanoi_size = size;
hanoi_page = (hanoi_size + 1) * 3;
hanoi_state = (int*)calloc(1 * hanoi_page, sizeof(int)); //memory assign(hanoi tower A,B,C)
//calloc ( page * ( tower * ( size +1 ) ) )
for (int i = 1; i <= h... | ALGO | 0.999775 | 4.949357 |
89cd07ab-3545-4248-aa00-8a760f7e2c54 | hanil12/Algorithm | Algorithm/Perfect Search/Recursive_1.cpp | #include <iostream>
using namespace std;
// 1부터 n까지의 합을 계산하는 재귀 함수
int Sum(int n)
{
int result = 0;
if (n == 1)
return 1;
return n + Sum(n - 1);
}
int main()
{
cout << Sum(5) << endl;
return 0;
} | ALGO | 0.99989 | 5.086297 |
20c573e1-01d5-4f64-9d1d-8c36bb0cdc36 | amosr/limp-cbc | cbits/coin/CbcHeuristicDiveGuided.cpp | /* $Id: CbcHeuristicDiveGuided.cpp 1902 2013-04-10 16:58:16Z stefan $ */
#if defined(_MSC_VER)
// Turn off compiler warning about long names
# pragma warning(disable:4786)
#endif
#include "CbcHeuristicDiveGuided.hpp"
#include "CbcStrategy.hpp"
// Default Constructor
CbcHeuristicDiveGuided::CbcHeuristicDiveGuided()
... | ALGO | 0.995181 | 5.986717 |
d7e4dc38-f180-41e9-876b-e40767d9dfbd | ishandutta2007/codeforces | se1ka2/normal/1601/B.cpp | #include <functional>
#include <iostream>
#include <queue>
using namespace std;
typedef pair<int, int> P;
const int INF = 10000000;
template <typename T>
struct SegmentTree
{
using F = function<T(T, T)>;
const F f;
const T e;
int n;
vector<T> seg;
SegmentTree(int nn, const F f, ... | ALGO | 0.999994 | 3.413628 |
ebbab122-7116-4767-8a7a-b8c4094a23c0 | patrick-gu/cses-problem-set | Sorting and Searching/Concert_Tickets.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
multiset<int> hs;
for (int i = 0; i < n; i++) {
int h;
cin >> h;
hs.insert(h);
}
for (int i = 0; i < m; i++) {
int ... | ALGO | 0.999985 | 3.937764 |
6002b792-5eba-4d45-aeae-daa219d4afa3 | raoprer/cpp-programs | StructStudentMarks.cpp | #include<iostream>
using namespace std;
struct student
{
char name[20];
int rno;
int marks[10];
int tot=0;
}s[20];
int main()
{
int s_no,m_no;
cout<<"Enter the number of students: ";
cin>>s_no;
cout<<"Enter the number of subjects: ";
cin>>m_no;
for(int i=0;i<s_no;i++){
... | ALGO | 0.99961 | 3.670693 |
12fcdf69-59b5-412c-830d-ea281c2f53a1 | stwc/OJ | LeetCode/cpp/814 - Binary Tree Pruning.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution
{
public:
TreeNode *pruneTree(TreeNode *root)
{
if (!root)
return NULL;
r... | ALGO | 0.999829 | 6.269242 |
2c2925e4-746a-4625-8364-589629bc1a70 | takuma1229/atcoder | src/abc/abc315/b.cpp | #include <bits/stdc++.h>
using namespace std;
int m;
int d[109];
int cumSum[109];
int main() {
cin >> m;
for (int i = 1; i <= m; i++) {
cin >> d[i];
}
cumSum[0] = 0;
for (int i = 1; i <= m; i++) {
cumSum[i] = cumSum[i-1] + d[i];
}
for (int i = 1; i <= m; i++) {
if (cumSum[i-1] <= (cumSum[m... | ALGO | 0.999987 | 3.963367 |
4a6114a5-766e-4ecb-88b1-6f7964b0b865 | issuran/OCR-demo-app | libraries/tess-two/jni/com_googlecode_tesseract_android/src/textord/underlin.cpp | #ifdef __UNIX__
#include <assert.h>
#endif
#include "underlin.h"
#define PROJECTION_MARGIN 10 //arbitrary
#define EXTERN
EXTERN double_VAR (textord_underline_offset, 0.1, "Fraction of x to ignore");
EXTERN BOOL_VAR (textord_restore_underlines, TRUE,
"Chop underlines & put back");
/*************... | TOOL | 0.989966 | 5.618581 |
d7a9016a-91f4-4c16-ab11-ab2e8ae0f8c1 | Luckman-Syr/cozyapp | 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.99887 | 6.783439 |
b9562110-e473-4467-b3cd-63f8780eacd9 | 18ivan18/IntroductionToProgramming2023 | week3 - if statements and ternary operator/solutions/3.cpp | #include <iostream>
int main()
{
int number;
std::cin >> number;
int lastDigit = number % 10;
int secondDigit = number / 10 % 10;
int firstDigit = number / 100;
// if (firstDigit == secondDigit || firstDigit == lastDigit ||
// secondDigit == lastDigit)
// {
// std::cout << "... | ALGO | 0.999679 | 5.290142 |
bc945c24-205f-4630-8bb7-bb5fc0030b88 | zwl995/Ceres-Solver_learning | Cere-Solver/study3.cpp | #if 0
//ʹӲCeres-Solver
#include <iostream>
#include <ceres/ceres.h>
//using namespace std; //˴Ϊstddata²ȷ
using namespace ceres;
//ʹһ´
// randn('seed', 23497);
// m = 0.3;
// c = 0.1;
// x=[0:0.075:5];
// y = exp(m * x + c);
// noise = randn(size(x)) * 0.2;
// y_observed = y + noise;
// data = [x', y_o... | ALGO | 0.999874 | 4.084205 |
81153436-b781-4e6e-b100-71b32b481c3c | Lucifero-debug/Data-Structure-and-algorithm | binaryTrees/boundaryTraversal.cpp | #include <iostream>
using namespace std;
#include <vector>
struct Node
{
int data;
Node* left, * right;
};
void left(Node *root,vector<int>&ans){
if(root==NULL || root->left==NULL && root->right==NULL){
return;
}
ans.push_back(root->data);
if(root->left){
left(root->left,ans);
... | ALGO | 0.999993 | 5.118228 |
3cce2b8c-7aa7-4589-99c4-aa44a6df24bc | eugenn/CarND-Path-Planning-Project | src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
VectorXf v(2);
MatrixXf m(2,2), n(2,2);
v << -1,
2;
m << 1,-2,
-3,4;
cout << "v.squaredNorm() = " << v.squaredNorm() << endl;
cout << "v.norm() = " << v.norm() << endl;
cout << "v.lpN... | ALGO | 0.991424 | 4.03798 |
00e47d7f-339d-4972-824e-9feb8491eee7 | proteus-core/libra | libra-llvm/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14
// <memory>
// template <class InputIt, class Size, class ForwardIt>
// pair<InputIt, ForwardIt> uninitialized_move_n(InputIt, Size, ForwardIt);
#include <memory>
#include <cstdlib>
#include <cassert>
#include "test_macros.h"
#include "test_iterators.h"
struct Counted {
static... | TEST | 0.890079 | 7.31166 |
b0cf038c-c908-4005-bb17-77d14148a305 | yeonuk99/opencv_study | opencv-4.x/opencv-4.x/samples/cpp/points_classifier.cpp | #include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/ml.hpp"
#include "opencv2/highgui.hpp"
#include <stdio.h>
using namespace std;
using namespace cv;
using namespace cv::ml;
const Scalar WHITE_COLOR = Scalar(255,255,255);
const string winName = "points";
const int testStep = 5;
Mat img, im... | ALGO | 0.905324 | 4.174309 |
bc3e9be9-0310-4a42-b906-278192459b50 | AndreGC13/PrograTareas1 | Capitulo 4/Ejercicio 4.29.cpp | #include <iostream>
#include <cmath>
//Ejercicio 4.29 capitulo 4
using namespace std;
int main() {
cout << "Bienvenido al programa para calcular potencias de un nmero!" << endl;
int base = 2;
double resultado = 0;
int exponente = 1;
do {
resultado = pow(base, exponente++);
cout << "... | ALGO | 0.998866 | 4.261008 |
3f2f2cfb-77de-448c-9943-40eebc6653d1 | Piyush13-ambure/DSA | Maximum Number of Events That Can Be Attended II.cpp | /*You are given an array of events where events[i] = [startDayi, endDayi, valuei]. The ith event starts at startDayi and ends at endDayi, and if you attend this event, you will receive a value of valuei. You are also given an integer k which represents the maximum number of events you can attend.
You can only attend o... | ALGO | 0.999953 | 6.549731 |
5295f28a-e9f5-46f6-a3dd-6593a9bdd94e | raincross7/code-similarity | codes/train_code/problem241/problem241_342.cpp | #include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996)
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b... | ALGO | 0.999981 | 3.408056 |
07471652-a3ee-445b-ac81-63f25103cd4e | arungangaji/codelib | Data Structures/Top Tree.cpp | #include <bits/stdc++.h>
using namespace std;
// credit: ecnerwala
struct top_tree_node {
mutable top_tree_node* p = nullptr;
top_tree_node* c[3] = {nullptr, nullptr, nullptr};
int d() const {
assert(p);
if (this == p->c[0]) {
return 0;
} else if (this == p->c[1]) {
return 1;
} else ... | ALGO | 0.999243 | 5.012934 |
1c6622d1-ab70-43bc-a49e-d44628a98ac7 | isaaflor/beecrowd | 1050.cpp | #include <stdio.h>
int main(){
int D;
scanf("%d", &D);
if (D == 61) printf("Brasilia\n");
else if (D == 71) printf("Salvador\n");
else if (D == 11) printf("Sao Paulo\n");
else if (D == 21) printf("Rio de Janeiro\n");
else if (D == 32) printf("Juiz de Fora\n");
else if (D == 19) printf(... | ALGO | 0.99989 | 4.970873 |
711724c5-be50-489b-b992-da1c5f39c1ff | sanghoon21/cpp | week_10/Chapter_8/8-9_VectorBasicErr2OK/08└х-VectorBasicErr2OK.cpp | #include <iostream>
using namespace std;
class Vector {
int dim; //
double* arr; //
public:
Vector(int d = 0) : dim(d) { arr = new double[dim]; }
~Vector() { delete[] arr; }
void setRand(int max = 100) {
for (int i = 0; i<dim; i++)
arr[i] = rand() % (max * 10) / 10.0;
}
void print(char *str = "Vect... | ALGO | 0.969282 | 3.528826 |
5ca0e813-dc4f-4a0b-a120-2d1f4adc4eb7 | aniketmdinde/DSA | 15.BinaryTree/4.LevelorderTraversal/LevelOrderTraversal.cpp | #include <iostream>
#include <queue>
using namespace std;
// Input: 1 2 4 -1 -1 5 7 -1 -1 -1 3 -1 6 -1 -1
// Preorder: 1 2 4 5 7 3 6
// Inorder: 4 2 5 7 1 3 6
// Postorder: 4 7 5 2 6 3 1
/*
Level order
1
2 3
4 5 6
7
*/
class Node
{
public:
int data;
Node *left;
Node *right;
Node(i... | ALGO | 0.99995 | 5.165299 |
9319e8e6-753b-4ab0-9be5-59e198062377 | SyNSec-den/5GBaseChecker | StateSynth/Trace2Model/cbmc/src/goto-symex/memory_model_sc.cpp | /*******************************************************************\
Module: Memory model for partial order concurrency
Author: Michael Tautschnig, <EMAIL>
\*******************************************************************/
/// \file
/// Memory model for partial order concurrency
#include "memory_model_sc.h"
#... | ALGO | 0.998748 | 6.142778 |
c96e6a2e-317e-4366-8fbf-eaad71dd9183 | xuanhuang1/topo_reader | StreamingTopology/src/SplitTree.cpp | #include "SplitTree.h"
SplitTree::SplitTree(TopoGraphInterface* graph) : UnionTree<UnionVertex> (graph)
{
this->mAlgorithm = new UnionAlgorithm<UnionVertex>(new VertexCompare(0));
}
| ALGO | 0.885587 | 3.159167 |
93d24e43-5169-4f7a-a9e3-3363f11e5447 | MANISHDUTT224/LeetCode | 0004-median-of-two-sorted-arrays/0004-median-of-two-sorted-arrays.cpp | class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
int n1=nums1.size(),n2=nums2.size();
if(n1>n2){
return findMedianSortedArrays(nums2,nums1);
}
int n=n1+n2;
int left=(n+1)/2;
int low=0,high=n1;
while(l... | ALGO | 0.999991 | 6.248716 |
1737a022-1b24-4115-9e6b-b4a36ae5d887 | Willu12/AiSD | Trees/Instert_to_RST_with_counters.cpp |
//zad2 insert to rst
#define maxb = 10
struct node
{
int key;
int counter;
node * left ,*right;
} * root;
node ** search(int v, int &h)
{
return nullptr;
}
struct maxCounter
{
int hcount[100];
int hM;
int maxCount[100];
node * max;
}*maxC;
void insertRST(int v)
{
int h;
... | ALGO | 0.999746 | 3.512814 |
ebe80553-5ea6-4851-9636-b806a6d339c3 | debopriyadey/DSA | Algorithm/MergeSort.cpp | #include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
void merge(int arr[], int l, int m, int r);
void mergeSort(int arr[], int l, int r)
{
if (l < r)
{
int m = l+(r-l)/2;
mergeSort(arr, l, m);
mergeSort(arr, m+1, r);
merge(arr, l, m, r);
}
}
void printArray(in... | ALGO | 0.99996 | 4.658842 |
bdd61520-c5fb-4855-869f-212a0bbb4dea | jasonliu0704/bogglegame | boggleutil.cpp | #include "boggleutil.h"
#include <iostream>
using namespace std;
bool WordTrie::search(string word) {
int i = 0;
TNode* cur = root;
while(1){
if(cur == 0 || i > word.length()){
return false;
}else if(cur->EOW && i == word.length()){
return true;
}else{
cur = (cur->children).at(w... | ALGO | 0.999229 | 4.937126 |
377b204f-882d-4519-a127-9f41bee68738 | berkeley-pie/android_frameworks_base | core/jni/com_android_internal_os_Zygote.cpp | #define LOG_TAG "Zygote"
// sys/mount.h has to come before linux/fs.h due to redefinition of MS_RDONLY, MS_BIND, etc
#include <sys/mount.h>
#include <linux/fs.h>
#include <list>
#include <sstream>
#include <string>
#include <fcntl.h>
#include <grp.h>
#include <inttypes.h>
#include <malloc.h>
#include <mntent.h>
#inc... | TOOL | 0.920791 | 7.490079 |
9ab8f500-9bcd-4781-ab58-aa9307c4549e | KHvic/uva-online-judge | 10249-The Grand Dinner.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int m,n,v;
while(scanf("%d %d",&m,&n),m){
priority_queue<pair<int,int>> tables;
vector<pair<int,int>> teams;
vector<vector<int>> res(m);
for(int i=0;i<m;i++){
cin >> v;
teams.push_back({v,i});
... | ALGO | 0.999979 | 3.433681 |
c9758be4-2574-4a5b-bae3-0c9c1c1cd282 | ISOLDE-Project/riscv-llvm | llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp | #include "Views/BottleneckAnalysis.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MCA/Support.h"
#include "llvm/Support/Format.h"
namespace llvm {
namespace mca {
#define DEBUG_TYPE "llvm-mca"
PressureTracker::PressureTracker(const MCSchedModel &Model)
: SM(Model),
ResourcePressureDistribution(Model.getNumP... | ALGO | 0.995818 | 7.033047 |
dce4117c-1091-4564-b778-6b841c9da6bf | pointer-authentication/pcan-llvm | llvm/utils/TableGen/SearchableTableEmitter.cpp | #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "CodeGenIntrinsics.h"
#include <algorithm>
#include <set>
#include <st... | TOOL | 0.857581 | 6.771925 |
37823293-4dab-4887-a006-b22c214ab7a5 | shubham452/ds | bst/13_Check if given sorted sub-sequence exists in binary search tree.cpp | #include<bits/stdc++.h>
using namespace std;
struct node
{
int data;
struct node *left,*right;
};
struct node *newnode(int val)
{
struct node *ptr=(struct node*)malloc(sizeof(struct node));
ptr->data=val;
ptr->left=ptr->right=NULL;
return ptr;
}
struct node *insert(struct node *root, int val)
{
... | ALGO | 0.999994 | 3.949518 |
fa209178-2eef-4854-acae-2ec358c2f239 | IgorMacedo4/tg_despejo_ilegal | mobile_app/teste_tela_login/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.998059 | 6.76073 |
09dd044e-7525-4310-8e10-9653ccb27689 | AdityaPratap007/LeetCode | 1437-minimum-insertion-steps-to-make-a-string-palindrome/1437-minimum-insertion-steps-to-make-a-string-palindrome.cpp | class Solution {
public:
int minInsertions(string s) {
int n = s.length();
std::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++){
dp[i][j]=s[i-1]==s[n-j]?1+dp[i-1][j-1]:std::max(dp[i-1][j],dp[i][j-1])... | ALGO | 0.99998 | 6.094962 |
fcbe0229-9827-4bae-9134-a594485d6dc2 | doneni/boj_study | 4948/main.cpp | #include <iostream>
#define MAX 246913
using namespace std;
bool o[MAX] = { 0, };
int a[MAX] = { 0, };
void eratos()
{
for(int i = 2; i < MAX; i++)
o[i] = true;
for(int i = 2; i < MAX; i++)
{
if(o[i])
{
for(int j = 2 * i; j < MAX; j += i)
o[j] = false;
... | ALGO | 0.999669 | 3.605207 |
7fcaa33e-b6b8-41b4-986f-257194b34358 | eechava6/NumericalAnalysisMethods | C++/gaussSimple.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include "utils.h"
using namespace std;
vector<vector<vector<double>>> gaussSimple(vector<vector<double>> matrix){
vector<vector<vector<double>>> pivots;
vector<double> indexes;
pivots.push_back(matrix);
if(!isSqua... | ALGO | 0.996077 | 3.612636 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.