uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a8eb3645-aac8-4649-a174-8a9390246ba2 | Anantm007/Algorithms-CPP | Merge Sort.cpp | #include<iostream>
using namespace std;
void merge(int ar[],int s,int e)
{
int m=(s+e)/2;
int j=m+1;
int i=s;
int temp[100000];
int k=s;
while(i<=m && j<=e)
{
if(ar[i]<ar[j])
temp[k++]=ar[i++];
else
temp[k++]=ar[j++];
}
while(i<=m)
temp[k++]=ar[i++];
while(j<=e)
temp[k++]=ar[j++];
for... | ALGO | 0.999991 | 4.392461 |
ec53d512-92bf-4e60-958a-640a07f9393a | hwangs12/network_programming | learning/fork_and_wait.cpp | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
// wait - after child process terminates, parent continues its execution after wait system call instruction.
// if the child process executes first, would the wait still be active?
int main(void)
{
pid_t pid =... | TOOL | 0.944688 | 5.650501 |
bb81d440-c980-420a-84e9-7de9c2de0582 | HIMANSHU-SARASWAT-2004/CP-TACTICS | Graph/Basic_representation_fo_graph.cpp | // Author: YOGI
// Created on: 2024-09-13_20-37-58
// Your code goes here
#include <bits/stdc++.h>
using namespace std;
#define IOS \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl "\n"
#define int long long
#define repeat(i, st, n) for (in... | ALGO | 0.999922 | 5.814593 |
b60d2333-627c-4b1c-9c16-0743733c7433 | sujitchandra/Leetcode | 0054-spiral-matrix/0054-spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& MATRIX) {
int n = MATRIX.size();
if (n == 0) return {};
int m = MATRIX[0].size();
int left = 0, right = m - 1;
int top = 0, bottom = n - 1;
vector<int> ans;
while (top <= bottom && left <= right) {
// Traverse... | ALGO | 0.999995 | 6.650263 |
90bc9860-72aa-48d6-9d42-4cc49f800307 | zouliping/ACM | 2364.cpp | #include <iostream>
using namespace std;
int length[1000]={0};
int partition(int* array, int left, int right)
{
int index = left;
int pivot = array[index];
swap(array[index], array[right]);
for (int i=left; i<right; i++)
{
if (array[i] > pivot)
swap(array[index++], array[i]);
}
swap(array[righ... | ALGO | 0.99972 | 3.69368 |
a4e1c217-8fc9-49a1-9070-f7a26775ee5c | SetsunaChyan/OI_source_code | 2012-2013 Northwestern European Regional Contest (NWERC 2012)/K.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=105;
typedef unsigned long long ll;
int k,l;
char a[N],b[N];
ll fac[N];
set<int> pos[N];
int cha[26];
bool chk(){
for(int t=0; t<l; t+=k){
memset(cha,0,sizeof(cha));
for(int i=0;i<k;++i){
cha[a[i+t]-'a']--;
cha[b[i+t... | ALGO | 0.999956 | 3.78158 |
88406237-0f51-4682-bd76-ec37f5285896 | ShivamMaru/LeetCode | 0057-insert-interval/0057-insert-interval.cpp | class Solution {
public:
vector<vector<int>> insert(vector<vector<int>>& v, vector<int>& n) {
vector<vector<int>> ans;
int sz = v.size();
for(int i=0; i<sz; i++){
if(n[1] < v[i][0]){
ans.push_back(n);
while(i < sz)
... | ALGO | 0.999982 | 5.967186 |
23678e0c-698f-48b7-9580-d9622b81767c | raincross7/code-similarity | codes/train_code/problem158/problem158_95.cpp | #include <bits/stdc++.h>
#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int X, Y;
cin >> X >> Y;
cout << X + Y / 2 << endl;
... | ALGO | 0.999065 | 3.558533 |
5d2acb4e-b15b-4f6e-828e-4dc0f79225de | DarsVader666/-C- | CS1502H-01 C++ programming Yuan Ye/Han Shu 2/11.cpp | #include<iostream>
using namespace std;
int GetApple(int a[], int height, int n)
{
int sum = 0;
for (int i = 0; i < n; i++) {
if (a[i] <= height + 30) sum++;
}
return sum;
}
int main()
{
int a[100],n,height;
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
cin >> height;
cout << GetApple(a, height, n);
... | ALGO | 0.999871 | 3.78659 |
dcc69610-41e9-470a-89a3-bc625305bf63 | RealityRipple/UXP | intl/icu/source/tools/genrb/prscmnts.cpp | // Safer use of UnicodeString.
#ifndef UNISTR_FROM_CHAR_EXPLICIT
# define UNISTR_FROM_CHAR_EXPLICIT explicit
#endif
// Less important, but still a good idea.
#ifndef UNISTR_FROM_STRING_EXPLICIT
# define UNISTR_FROM_STRING_EXPLICIT explicit
#endif
#include "unicode/regex.h"
#include "unicode/unistr.h"
#include "un... | TOOL | 0.86657 | 5.533516 |
1b652cea-fcc9-43a9-9e96-06e9b3ee2645 | lds217/lds | LUYENCODE & JUNK/CHUOI/test2.cpp | #include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int arr[100];
int n;
int arrtemp;
void input_arr()
{
for(int x=0;x<n;x++)
cin>>arr[x];
}
void xuly()
{
int brk=1;
int count=0;
int count_bang=0;
while(brk>0)
{
count_bang=0;
for(int x=0;x<n-... | ALGO | 0.999929 | 3.445809 |
b4b95a8a-7a3c-4c5a-834b-6796262947ca | jfangah/AI | Z3 reasoning/z3-master/src/test/simplex.cpp | #include "math/simplex/sparse_matrix_def.h"
#include "math/simplex/simplex.h"
#include "math/simplex/simplex_def.h"
#include "util/mpq_inf.h"
#include "util/vector.h"
#include "util/rational.h"
#include "util/rlimit.h"
#define R rational
typedef simplex::simplex<simplex::mpz_ext> Simplex;
typedef simplex::sparse_matri... | ALGO | 0.969561 | 5.478022 |
018a45a4-2dc2-4337-8947-642bc6387b24 | cran/HDclust | src/modal.cpp | /*==========================================================================================*/
/* */
/* */
/* Unauthorized copying of this fi... | ALGO | 0.999984 | 5.285755 |
a134f26c-6b3e-46cf-8e60-84506860755b | Moongss/ps | Baekjoon/20000-29999/20530.cpp | #include <iostream>
#include <queue>
#include <vector>
int N, Q;
int a, b, u, v;
std::vector<int> connect[200001];
int parent[200001];
bool visited[200001] = {
false,
};
bool isCycle[200001] = {
false,
};
bool isFindCycle = false;
void denoteCycle(int start, int end) {
while (start != end) {
isCycle[start] = tr... | ALGO | 0.999932 | 4.34792 |
7a0ae1b1-1995-46d9-86de-43dc8bd041c2 | mdnazisharman2803/leetcode-challenge | Day-64/MinimumDeletionstoMakeCharacterFrequenciesUnique.cpp | class Solution {
public:
int minDeletions(string s) {
int n=s.size();
unordered_map<char,int>mp;
for(int i=0;i<n;i++)
mp[s[i]]++;
int ans=0;
set<int>st;
for (auto[i,j] :mp)
{
while(st.find(j)!=st.end())
... | ALGO | 0.999963 | 5.990773 |
45c648c8-7e09-48b5-863d-6c7e8594b08b | mikekks/PS | 2023_5/11660.cpp | #include <iostream>
#include <vector>
#define MAX 1025
using namespace::std;
int N,M;
int b[MAX][MAX];
int dp[MAX][MAX];
int main(){
scanf("%d %d", &N, &M);
for(int i=1; i<=N; i++){
for(int j=1; j<=N; j++){
scanf("%d", &b[i][j]);
}
}
for(int i=1; i<=N; i++){
fo... | ALGO | 0.999803 | 3.85104 |
87ccc6a0-ded8-4567-94da-dd79ef729f31 | ishandutta2007/codeforces | emilan/normal/1374/D.cpp | #include <bits/stdc++.h>
using namespace std;
// #define int ll
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define dotc() int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz... | ALGO | 0.99994 | 3.944368 |
81361c35-13be-425e-afe7-332262d2d9d4 | PanVOUniversity/GameLab2sem | AI.cpp | #include "AI.h"
// Forward declarations
bool tryAIAttack(Unit* unit, int x, int y, std::vector<std::vector<Field*>>& board);
void tryAIMove(Unit* unit, int x, int y, std::vector<std::vector<Field*>>& board);
void tryAICreateUnits(Unit* unit, int x, int y, std::vector<std::vector<Field*>>& board, Player* aiPlayer);
vo... | ALGO | 0.899383 | 6.691477 |
bb363803-bee8-4d1c-8eb5-f2d845c7391f | thefcraft/cp-algorithms | cses/problemset/task/1070/main.cpp | // author: [Laksh Kumar Sisodiya](https://github.com/thefcraft)
// please run `git clone https://github.com/thefcraft/fmt-display-cpp.git`
// and then copy pase `test.assert.h` file and `fmt` dir to the current folder
// and rename .cp.base_template.cpp to main.cpp and modify it to make your own template and enjoy :-)
... | ALGO | 0.999956 | 4.185882 |
bf6c84c8-68aa-48f6-9a80-701356457cc0 | Yaseungho/myCodes | Baekjoon_Solving/Baekjoon_10026.cpp | #include <iostream>
#include <vector>
using namespace std;
int N;
char map[100][100];
bool visited[100][100] = { false };
const int Dx[4] = { 1,-1, 0, 0 };
const int Dy[4] = { 0, 0, 1,-1 };
void DFS(int y, int x) {
visited[y][x] = true;
for (int i = 0; i < 4; i++) {
int nx = x + Dx[i];
int ny = y + Dy[i];
if (... | ALGO | 0.998958 | 3.942675 |
34300ef1-4b21-449d-9a9a-6c675814a56d | Lizhmq/Introduction2Computing-Hw | 第三阶段/第三阶段编程练习3/7-BoolExp.cpp | #include <iostream>
#include <stack>
#include <cstring>
#include <algorithm>
using namespace std;
struct op {
char c;
int level; // 0-2 | & !
op(char _c, int _level) : c(_c), level(_level) {}
};
void cal(stack<op> &ops, stack<int> &vals)
{
op cur = ops.top();
ops.pop();
switch (cur.c)
{
bool tmp;
case '!':
... | ALGO | 0.999945 | 4.097589 |
fee3e57b-4366-45ce-83e2-dae14f7e1393 | TanviKapurwan23/DataStructuresAlgorithms_GFG | Strings/anaGram.cpp | bool areAnagram(string &s1, string &s2)
{
if(s1.length() != s2.length()){
return false;
}
sort(s1.begin(), s1.end());
sort(s1.begin(), s2.end());
return(s1 == s2);
}
//O(N LOG N) as sort function takes n log n time
const int CHAR = 256;
bool anaGram(string &s1, string &s2){
if(s1.lengt... | ALGO | 0.999989 | 5.651794 |
6d754447-4c52-4c7f-b7eb-dd8718668890 | HusseinYoussef/Interview-Preparation | leetcode/Easy/Min Stack.cpp | #include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
class MinStack {
public:
vector<pair<int, int>> st;
MinStack()
{
}
void push(int val)
{
if(!st.size())
st.push_back({val, val});
else
st.push_back({v... | ALGO | 0.999558 | 5.455211 |
4174327e-1dc9-4dd8-b6c0-76699f6a6a4e | akueisara/leetcode | P349 Intersection of Two Arrays/Solution.cpp | class Solution {
public:
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
std::set<int> set;
std::set<int> intersect;
for(int i=0;i<nums1.size();i++) {
set.insert(nums1[i]);
}
for(int i=0;i<nums2.size();i++) {
if (set.find(nums2[i]) ... | ALGO | 0.999884 | 5.673507 |
8e4d4275-93ac-4413-acb6-a43e63955061 | UnsEmp/C_Note | dong text/7-37.cpp | #include <iostream>
using namespace std;
int sum = 0;
int n,count = 0,pos = -1;
int result[31];
void DFS(int x)
{
if(sum == n)
{
count++;
cout << n << '=';
for(int i = 0;i < pos;i++)
cout << result[i] << '+';
if(count % 4 == 0 || result[pos] == n)
cout << result[... | ALGO | 0.999784 | 3.770266 |
94d002a0-20a1-4c2d-821b-e3432683a3f9 | bhargavi290504/Leetcode | 0230-kth-smallest-element-in-a-bst/0230-kth-smallest-element-in-a-bst.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.999993 | 6.199314 |
5ea2d55d-6fde-4741-b6ac-45cc3320a85e | devparthgarg/STRIVER | Day 17 Binary Trees/07 Bottom View of Binary Tree.cpp | //time: O(n)
//space: O(n)
vector<int> bottomView(Node *root)
{
vector<int> res;
map<int,int> m;
queue<pair<Node*,int>> q;
q.push({root,0});
while(q.size())
{
auto temp=q.front();
q.pop();
Node* node=temp.first;
int level=temp.second;
m[leve... | ALGO | 0.999987 | 6.179448 |
fa4f8baf-1bb1-4be7-91a1-c5d9aadb5341 | pratyushpriyadarshanmallik/pw-codes | 2-D Array/sum-of-rectangle-from-given co-ordinate(bruteforce-approach) .cpp | #include<iostream>
using namespace std;
int main(){
int arr[3][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12}};
int l1,r1,l2,r2;
cin>>l1;//1
cin>>r1;//1
cin>>l2;//2
cin>>r2;//2
int sum =0;
for(int i=l1;i<=l2;i++){
for(int j=r1;j<=r2;j++){
sum+=arr[i][j]; //23+11=34
}
... | ALGO | 0.999767 | 3.040223 |
9d079e0b-79ee-42be-9360-d4100ac64ba3 | johanna0626/SensorsCalibration-Copy | online_calib/vins_camera2imu/eigen3/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.999582 | 4.076589 |
fb3feeed-2be2-40a1-88a7-d9479ef246a9 | kaushik27mishra/Daily_Practice_CP-DSA | leetcode/path_sum.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999935 | 6.146999 |
a458faaf-9276-4238-8347-0ac26f1fbd7c | mackrugeri/C- | DVR.cpp | #include<iostream>
using namespace std;
class DVR{
private:
int graph[50][50];
char ch[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int final[50][50];
int via[50][50];
int i,j,k,t;
int nn;
public:
int printing()
{
/* Display ... | ALGO | 0.999877 | 4.436311 |
b9b6b7ee-eaa3-4b64-968c-fd2c2986808e | ishubhranshu/code_soln | 1684-count-the-number-of-consistent-strings/1684-count-the-number-of-consistent-strings.cpp | class Solution {
public:
int countConsistentStrings(string allowed, vector<string>& words) {
unordered_set<char> st;
for(auto i: allowed)
st.insert(i);
int ans=0;
for(auto s: words)
{
int flag=1;
for(auto i: s)
{
... | ALGO | 0.999955 | 5.696162 |
8333abbc-6f57-41de-babb-c894ca85f11f | gebrial/seam-carving | IndexedHeap.cpp | // g++ -std=c++11 -c IndexedHeap.cpp -pg
// IndexedHeap.cpp
#ifndef _INDEXEDHEAP_CPP
#define _INDEXEDHEAP_CPP
#include "IndexedHeap.hpp"
#include <utility>
#include <iostream>
IndexedHeap::IndexedHeap(){
size = 0;
}
IndexedHeap::~IndexedHeap(){}
// return and delete min from heap
// and set index = -1
Pix* Indexe... | ALGO | 0.980629 | 4.40122 |
a9b8619e-35e6-4a98-9032-22bce6dc953c | kmjp/procon | yuki/2601-2700/2685.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999907 | 3.405007 |
fc106129-e741-4e34-8596-5056b6326547 | ishandutta2007/codeforces | tadijasebez/normal/1185/C2.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=200050;
const int M=105;
int a[N],cnt[M];
int Get(int t){
int ans=0;
for(int i=1;i<M;i++){
int take=min(cnt[i],t/i);
t-=take*i;
ans+=take;
}
return ans;
}
int main(){
int n,m;
scanf("%i %i",&n,&m);
for(int i=1;i<=n;i++){
scanf("%i",&a[i]);
print... | ALGO | 0.999989 | 3.410534 |
b0796690-774d-45db-884d-05d85ec03bdc | bzzak/SimpleGraphicsEngine | sources/PointLight.cpp | #include "../headers/PointLight.h"
#include "../headers/Mesh.h"
#include "../headers/Rasterizer.h"
#include <cmath>
Math::float3 PointLight::calculate(Vertex& vertex, const Material& material, const Math::float3& cameraPos) const {
Math::float3 fragPos = vertex.position;
Math::float3 L = position - fragPos;
... | TOOL | 0.93828 | 6.008824 |
fd40786a-4f77-42e2-b0e8-6833c43b3f0f | danielhO9/PS | BOJ/16992.cpp | #include <bits/stdc++.h>
using namespace std;
const double K = 0.5;
int N, M;
vector<tuple<int, int, int>> v;
random_device rd;
mt19937 gen(rd());
uniform_real_distribution<> dist(0.0, 1.0);
bool state[100];
int opt_val;
bool opt_state[100];
int score[100];
bool f(int x) {
if (x > 0) return state[abs(x) - 1];
... | ALGO | 0.999991 | 4.471836 |
9995475e-4311-429c-99c0-29015a3c4d7b | ShubhamG009/C_Language | bubble_sort.cpp | #include<stdio.h>
void bublesort(int a[],int n);
int main()
{
int a[5] = {15,16,6,8,5};
int n = 5;
bublesort(a,n);
for(int i = 0; i<n; i++)
{
printf(" %d ",a[i]);
}
}
void bublesort(int a[],int n)
{
int i,j;
for(i = 0; i < n-1 ; i++)
{
for(j = 0; j < n-i-1;j++)
{
if(a[j] > a[j+1])
{
int... | ALGO | 0.999894 | 3.595605 |
f3876cd9-27ff-4ccc-b712-649f1cf6f21b | KushagraKatiha/2D-Arrays | 2D-Vectors/sumOfCoordinaters.cpp | #include<iostream>
#include<vector>
using namespace std;
// Function to print the sum
void printSumOfCoordinates(vector<vector<int>> v, int row, int col, int l1, int r1, int l2, int r2){
int sum = 0;
for(int i = l1; i <= l2; i++){
for(int j = r1; j <= r2; j++){
sum += v[i][j];
}
... | ALGO | 0.999917 | 4.925729 |
b5770703-f92a-4d8d-9c1d-9fc9a5575497 | ajayp1717/Mission_DS-Algo | Find duplicates in an array - GFG/find-duplicates-in-an-array.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
vector<int> duplicates(int arr[], int n) {
// code here
map<int,int>Mp;
for(int i=0;i<n;i++){
Mp[arr[i]]++;
}
vector<int>ans;
for... | ALGO | 0.999453 | 6.030322 |
1f3cd9f5-61b7-4a31-a777-def12a8ac2a3 | ugogon/gaussStylization | libigl/include/igl/intrinsic_delaunay_triangulation.cpp | template <
typename Derivedl_in,
typename DerivedF_in,
typename Derivedl,
typename DerivedF>
IGL_INLINE void igl::intrinsic_delaunay_triangulation(
const Eigen::MatrixBase<Derivedl_in> & l_in,
const Eigen::MatrixBase<DerivedF_in> & F_in,
Eigen::PlainObjectBase<Derivedl> & l,
Eigen::PlainObjectBase<Deriv... | ALGO | 0.999157 | 7.533316 |
5e92abc6-067d-4d04-b19e-92e71c764ac7 | HarshadThorat/CPP-Langauge | Programs/program22.cpp | // Write a program which accept Three number from user and print its Multiplication.
// input = 5 4 7
// output = 140
#include<iostream>
using namespace std;
class Numbers
{
public:
int iNo1;
int iNo2;
int iNo3;
Numbers(int A,int B,int C)
{
iNo1 = A;
... | ALGO | 0.999643 | 4.007564 |
b86b10f8-d940-4ac0-a39f-97c51154bbe4 | matteo-giri/computer-graphics-projects | LAB_01/LAB_01/LAB_01.cpp | /*
* Lab-01_students.c
*
* This program draws straight lines connecting dots placed with mouse clicks.
*
* Usage:
* Left click to place a control point.
* Maximum number of control points allowed is currently set at 64.
* Press "f" to remove the first control point
* Press "l" to remove the last contr... | ALGO | 0.977617 | 4.095168 |
6cc9dec1-58c2-44b9-b762-772dab937498 | PixelOS-AOSP/frameworks_native | cmds/installd/utils.cpp | #include "utils.h"
#include <errno.h>
#include <fcntl.h>
#include <fts.h>
#include <poll.h>
#include <stdlib.h>
#include <sys/capability.h>
#include <sys/pidfd.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/wait.h>
#include <sys/xattr.h>
#include <unistd.h>
#include <uuid/uuid.h>
#include <android-ba... | TOOL | 0.947158 | 7.275375 |
e8c4eee9-d224-42d3-9ee7-8dceb5f505dd | Keshab1113/Code-with-Keshab | c++/GCD number.cpp | #include<iostream>
using namespace std;
int gcd(int a, int b){
if(a==0){
return b;
}
if(b==0){
return a;
}
while(a!=b){
if(a>b){
a=a-b;
}
else{
b=b-a;
}
}
return a;
}
int main(){
int n,m;
cout<<"Enter two number... | ALGO | 0.999519 | 4.774517 |
fb625786-8ec6-40a8-b0e3-09fee8a40a56 | zhukovdm/contest | cses/graph-algorithms/round-trip-ii.cpp | /**
* https://cses.fi/problemset/task/1678
*/
#include <algorithm>
#include <bit>
#include <cassert>
#include <chrono>
#include <cmath>
// #include <ext/pb_ds/assoc_container.hpp>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <optional>
#incl... | ALGO | 0.999987 | 4.761041 |
5155ae60-5336-4c78-b27b-2d627d1c2149 | zhen9420/cpp_learning | 1-16-7.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
scanf("%d",&n);
int m = 1;
for(int i = 2;i < n ;i ++){
if(n%2 == 0){
m = 0;
break;
}
}
if( m == 1){
printf("yes");
}
else
printf("no");
return 0;
}
| ALGO | 0.999908 | 3.755338 |
606b0f57-6f28-43be-86f5-d28a4815a2aa | iamsaquib2508/Competitive-Programminng | Codeforces/CF 1471 A.cpp | #include <bits/stdc++.h>
#define ffr(i,a,b) for(i=a;i<b;i++)
#define mm(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define plolo pair<ull,ull>
#define xx first
#define yy second
#define mp make_pair
#define ll long long int
using namespace std;
int main()
{
int cc=1, tt;
cin >> tt;
while(tt--... | ALGO | 0.9997 | 3.788399 |
355eec4d-c32f-4e3c-ac32-1a07b5a62fb4 | pedrozbm/EstudosCpp-LearnCpp | Cap.21/21.14_OperadoresSobrecargaEModelosDeFuncao.cpp | // Obrigado learncpp
// https://www.learncpp.com/cpp-tutorial/overloading-operators-and-function-templates/
#include <iostream>
// Vamos criar uma classe do tipo Cents
class Cents
{
private:
int m_cents{};
public:
Cents(int cents) : m_cents{cents} {}
// Sobrecarregar nosso operador para printar
frie... | ALGO | 0.947806 | 6.100332 |
3bd46986-7945-4032-9aec-a260cf8ef867 | approjecthub/CP_practice | trees/leftView.cpp | // https://practice.geeksforgeeks.org/problems/left-view-of-binary-tree/1/
// https://www.udemy.com/course/cpp-data-structures-algorithms-levelup-prateek-narang/learn/quiz/5232132#questions
#include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int key;
Node *left;
Node *right;
Node(int k... | ALGO | 0.999961 | 5.752939 |
116eb129-7ede-4df5-a4f2-da042be90ace | Paresh2578/flutter_Diplom_Sem_5_Leb | 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.998799 | 6.776823 |
742e44a5-8480-43cb-a38e-8262f1da0544 | shuta13/cpp | Something/Recursion.cpp | #include <iostream>
using namespace std;
int n;
int fib(int n);
int main() {
cout << "数字を入力してね:";
cin >> n;
cout << fib(n) << endl;
}
int fib(int n) {
if (n == 1 || n == 2) {
return 1;
} else {
return fib(n-1) + fib(n-2);
}
}
| ALGO | 0.99949 | 4.661245 |
fa512654-0b26-4d99-adf3-2b9057f0dd54 | henryzera/abstract-data-type | recursao-1.cpp | #include <iostream>
int contarDigitos(int num){
if(num < 10){
return 1;
}
return 1 + contarDigitos(num/10);
}
int main() {
std::cout << contarDigitos(10000);
return 0;
} | ALGO | 0.99799 | 5.04795 |
cff768da-374b-45de-b308-f80afb8b244f | sujkovic/leetcodes | medium/347-Top-K-Frequent-Elements.cpp | // create frequency map of how many of each number there are
// create priority queue, adding all of them to it
// pop off the top k elements of the priority queue and return them
class Solution
{
public:
vector<int> topKFrequent(vector<int> &nums, int k)
{
unordered_map<int, int> freq;
prio... | ALGO | 0.999979 | 6.023026 |
139565ea-8550-430a-844f-0f31f665d306 | arasHi87/OnlineJudgeExercise | cf1191c.cpp | #include <cstdio>
using namespace std;
typedef long long LL;
const int maxN=1e5+10;
int n, k, m, cnt, idx, ans, qs[maxN];
int main() {
#ifdef local
freopen("in", "r", stdin);
#endif
scanf("%d%d%d", &n, &m, &k);
for (int i=1;i<=m;i++)
scanf("%d", qs+i);
while (idx<=m) {
}... | ALGO | 0.99993 | 3.089096 |
b3a93e07-3e64-4437-92d0-f7b14d68568b | baragan30/Meditatii | Olimpiada/XI/grafuri/2019_conexidat/conexidad.cpp | /**
* @brief
* Simple KRUSKAL
*
*/
#include<iostream>
#include <fstream>
#include <vector>
#include <limits>
using namespace std;
const int MAXN = 101;
vector< pair <int, int> >edges;
vector< pair <int, int> >addedEdges;
vector<int> dad;
vector<int> extra;
int n, m;
void read(){
ifstream in("conexidad.in")... | ALGO | 0.99989 | 4.883454 |
02167f43-f636-477c-9bec-c75a91802133 | codeAligned/CodingProblems | KMostFrequentWords_WithTrieAndMaxHeap.cpp | #include <iostream>
#include <vector>
#include <memory>
#include <queue>
#include <string>
#include <fstream>
#include <algorithm> // std::transform
#include <cctype> // to lower
/*
You have to consider below questions before make the right decision:
(1) Will the word contain letter only, how about "Pre–Civil" ?
(2) S... | ALGO | 0.999739 | 6.612613 |
2d898577-d3b5-409d-b827-8a31b222c410 | DamianArado/LeetCode-tracker | 0034-find-first-and-last-position-of-element-in-sorted-array/0034-find-first-and-last-position-of-element-in-sorted-array.cpp | class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
int first = -1, last = -1, left = 0, n = size(nums), right = n - 1;
while (left <= right) {
int mid = left + (right - left) / 2;
if (nums[mid] == target) {
first = mid;
... | ALGO | 0.999892 | 6.731461 |
dc9f811c-2bb7-4526-a2cc-9f648fd3255b | Aryan-chaudhry/DSA-SUPREME-3.O | Recursion/printEven.cpp | #include<iostream>
using namespace std;
void printEven(int arr[], int size, int index){
// base case
if(index >= size){
return;
}
// recursive call
// ek case me solve karunga
if(!(arr[index]&1)){
cout << arr[index] << " ";
}
// ab recursion tum sambhalo
printEven(ar... | ALGO | 0.999837 | 5.06254 |
acabfc1b-37a1-4240-9372-4620b698d430 | bhawan0407/leetcode | Easy/single-number.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int res = 0;
for(auto num: nums)
{
res ^= num;
}
return res;
}
}; | ALGO | 0.999928 | 5.651949 |
038ad8c1-73a2-453a-acb5-1489a3b2848c | rajprem4214/LeetCode | 1498-number-of-subsequences-that-satisfy-the-given-sum-condition/1498-number-of-subsequences-that-satisfy-the-given-sum-condition.cpp | class Solution {
public:
int MOD = 1e9+7;
int numSubseq(vector<int>& nums, int target) {
vector<int> powerof2(nums.size());
powerof2[0]=1;
for(int i=1;i<nums.size();i++){
powerof2[i]=powerof2[i-1]*2%MOD; //power of 2 in range of integer:
}
int cnt = 0;
... | ALGO | 0.999998 | 6.004485 |
d3d46cd9-982e-414f-b055-88f6c90c0e2a | Jingzheng-Li/Houdini_MPM_Codimensional | MPMCOD/SolidForce/Force.cpp | #include "Force.h"
Force::~Force() {}
void Force::addAngularHessXToTotal(const VectorXs& x, const VectorXs& v,
const VectorXs& m,
TripletXs& hessE,
int hessE_index, const scalar& dt) {}
int Force::numAngularHess... | ALGO | 0.869619 | 5.414004 |
2fdaedad-fcfc-457a-b503-3bf6718a6e53 | whquddn55/Algorithm_BojSolves | 14000/14444.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename a, typename b>
ostream& operator<<(ostream& os, const pair<a, b>& pai) {
os << pai.first << ' ' << pai.second;
return os;
}
template<typename a, typename b>
istream& oper... | ALGO | 0.999685 | 3.679806 |
bc49aa60-3fb0-4117-9152-0d52f3214ba2 | ishandutta2007/codeforces | j.t.j.l/normal/466/B.cpp | #include<iostream>
#include<cmath>
using namespace std;
long long n,a,b,c;
long long i;
int work(long long m){
for (i=a;i<=sqrt(m);i++){
if ((m%i==0)&&(m>=i*b)){
cout<<m<<endl;
if (c==0){
cout<<i<<' '<<m/i<<endl;
}
else{
cout<<m/i<<' '<<i<<endl;
}
return 1;
}
}
return 0;
}
int... | ALGO | 0.999876 | 3.386616 |
a9e62017-1b7a-443e-a1d3-d2b00974a623 | MRpanda02/study-notes | C++homework/room1/20100059文楚童.cpp | /*
程序说明:在二维数组中找出最大值,并显示行和列。
日期:2021年3月6日
姓名:文楚童
*/
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
void max_array(int array[3][4],int &line,int &row,int &max)
{
max = array[0][0];
int i,j;
for(i = 0;i<3;i++)
{
for(j=0;j<4;j++)
{
if(max<array... | ALGO | 0.998141 | 3.092854 |
d764b866-3485-4b6f-801b-f598fa536b7b | Prathamesh-Mandiye-0423/Coding-for-the-summer | contest/atcoder/upsolve/352_d.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ll n,k;cin>>n>>k;
vector<ll>v(n);
for(int i=0;i<n;i++){
int x;cin>>x;
v[x-1]=i;
}
set<ll>s;
for(ll i=0;i<k;i++){
s.insert(v[i]);
}
ll res=*s.rbegin()-*s.begin();//initial difference
for(int i=k;i<n;i++){
s.e... | ALGO | 0.999968 | 3.651425 |
ffb74867-725d-441f-929c-eb8a6d139c82 | IcedSoul/My-CPP-Code | 杂乱/4.17.f.cpp | #include <iostream>
#include <algorithm>
#include <string.h>
#include <cstdio>
#include <math.h>
#include <queue>
using namespace std;
const int maxn=100005;
int t,n,a,ans;
int main(){
scanf("%d",&t);
while(t--){
scanf("%d",&n);
ans=0;
for(int i=0;i<n;i++){
scanf("%d",&a);
if(a>0)
ans++;
if(a>ans)
... | ALGO | 0.99971 | 3.811727 |
e8bc3f80-a921-4a04-a7d2-fa20c3d71f93 | xjubep/Problem-Solving | sorting/boj_11651.cpp | // 좌표 정렬하기 2
#include <iostream>
#include <algorithm>
using namespace std;
const int MX = 100000 + 5;
pair<int, int> point[MX];
bool cmp(pair<int, int> a, pair<int, int> b) {
if (a.second < b.second) {
return true;
}
else if (a.second > b.second) {
return false;
}
else {
r... | ALGO | 0.999925 | 4.725142 |
9f9d474a-bf97-43da-914c-9850e8a665c6 | llvm/clangir | libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, class T>
// requires OutputIterator<Iter, const T&>
// constexpr void // constexpr after C++17
// fill(Iter first, Iter last, const T& value);
#include <algorithm>
#include <array>
#include <cassert>
#include <cstddef>
#include <vector>
#include "sized_allo... | TEST | 0.952281 | 7.157019 |
f5b8f343-88f8-49a7-8aa6-bf416c81ce1e | NIKHILL0393/Cpp-DSA | CppLearning/2d-array/create.cpp | #include<iostream>
using namespace std;
int main(){
int arr[3][3]={{1,11,11},{2,22,222},{3,33,333}};
// for(int row=0;row<3;row++){
// for(int col=0;col<3;col++){
// cin>>arr[row][col];
// }
// }
for(int row=0;row<3;row++){
for(int col=0;col<3;col++){
co... | ALGO | 0.994563 | 3.158858 |
e812fe34-0005-4dbd-b4a9-498102644995 | algozenith-iiitsonepat/coding-quest | November2023/18th November/1838-V.cpp | class Solution {
public:
int maxFrequency(vector<int>& nums, int k) {
// Will use sliding window algo
// Check whether a particular length of array can be made equal to max element or not
// If not reduce length from start else increase from right
int n=nums.size();
sort(nums... | ALGO | 0.999971 | 5.850418 |
688ad23b-16ce-44d0-bd8d-ca2a144052f0 | pavellevap/code_antiplagiat | final_test/24/9477.cpp | // 1.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <map>
using namespace std;
int l;
string s;
bool a[3];
int ans;
bool check1(int k){
for (int i = 0; i < s.size(); ++i)
... | ALGO | 0.999961 | 3.051661 |
2fb1dcf5-f00c-4468-af42-e71399e7a208 | slitvinov/lammps-swimmer | src/fix_wall.cpp | #include "math.h"
#include "stdlib.h"
#include "string.h"
#include "fix_wall.h"
#include "atom.h"
#include "input.h"
#include "variable.h"
#include "domain.h"
#include "lattice.h"
#include "update.h"
#include "modify.h"
#include "respa.h"
#include "error.h"
#include "force.h"
using namespace LAMMPS_NS;
using namespace... | TOOL | 0.963274 | 5.301341 |
b990d04f-9a71-45b8-b434-93e2c31587b8 | muhzii/CarND-Path-Planning-Project | src/Eigen-3.3/doc/examples/TutorialLinAlgSetThreshold.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2d A;
A << 2, 1,
2, 0.9999999999;
FullPivLU<Matrix2d> lu(A);
cout << "By default, the rank of A is found to be " << lu.rank() << endl;
lu.setThreshold(1e-5);
cout << "With threshold 1e-5... | ALGO | 0.999677 | 4.090376 |
ce7469b8-ceb4-45e7-b253-7145acc9fa4c | openalea/plantgl | src/cpp/plantgl/algo/base/skelcomputer.cpp | #include "skelcomputer.h"
#include "discretizer.h"
#include <plantgl/pgl_geometry.h>
#include <plantgl/pgl_transformation.h>
#include <plantgl/scenegraph/container/pointarray.h>
#include <plantgl/scenegraph/container/geometryarray2.h>
PGL_USING_NAMESPACE
using namespace std;
/* --------------------------------------... | TOOL | 0.887684 | 7.202216 |
50ac1f1d-7a5a-4eba-834b-40f1d0c9225c | alexvelea/competitive | infoarena/color/color.cpp | #include <fstream>
using namespace std;
const int max_n = 4005;
long long rez = 0;
int Edge[max_n];
ifstream in("color.in");
ofstream out("color.out");
#define MaxChar 1000000
#define verf ( (++CharB==MaxChar) ? ( in.read(Buffer,MaxChar),CharB=0 ) : (1) )
long CharB=MaxChar-1;
char Buffer [ MaxChar ];
void cit ( ... | ALGO | 0.999814 | 4.189164 |
80e9a98b-19bf-4472-9774-cba0e81af410 | 16BitNarwhal/Competitive-Programming | codeforces/166E.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, dp[4], tmp[4];
void add(int &a, int b) {
a += b;
if (a >= mod) a -= mod;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n;
dp[0] = 1;
for (int i=0;i<n;i++) {
for (int j=0;j<4;j++) tmp[j] = dp[j];
for (int j=0;j... | ALGO | 0.999974 | 4.052371 |
3a4368db-a340-4020-b678-66010b663169 | sarvex/leetcode-prolog | solution/0500-0599/0514.Freedom Trail/Solution.cpp | class Solution {
public:
int findRotateSteps(string ring, string key) {
int m = key.size(), n = ring.size();
vector<int> pos[26];
for (int j = 0; j < n; ++j) {
pos[ring[j] - 'a'].push_back(j);
}
int f[m][n];
memset(f, 0x3f, sizeof(f));
for (int j :... | ALGO | 0.999999 | 5.563651 |
aa1324b2-ce7e-40a9-8590-7325d5a23f9b | SaladDais/lscript-tailslide | indra/llcommon/llcriticaldamp.cpp | /**
* @file llcriticaldamp.cpp
* @brief Implementation of the critical damping functionality.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under th... | ALGO | 0.992858 | 5.364661 |
337c3483-2afb-40ba-81df-80616850917e | Imp0scar/CSE100 | Labs/Lab07/obenitez3.cpp |
#include <iostream>
#include <vector>
#include <list>
using namespace std;
int hashSize;
vector<list<int>> hashTable;
void insert(int key) {
int index = key % hashSize;
hashTable[index].push_front(key);
}
bool remove(int key) {
int index = key % hashSize;
list<int>& bucket = hashTable[index];
fo... | ALGO | 0.994606 | 4.288136 |
ebad001c-d795-400d-b961-7d690478e953 | DungHoangLeIT/CTDL-GT2021-2022 | DayNgoacDungDaiNhat.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
string str;
cin >> str;
string s = "";
for(char i : str){
if(i == '(' || i == ')') s += i;
}
stack<int> x;
int ans = 0;
for(int i = 0; i < s.lengt... | ALGO | 0.999549 | 4.292712 |
00dd2d1c-2fa9-4977-accc-68c0fb888450 | shubs99/Cpp-Tutorials | Searching/pivotelement.cpp | // min element in array
#include<iostream>
using namespace std;
int getPivot(int arr[], int n){
int s = 0;
int e = n-1;
int mid = s+(e-s)/2;
while(s<e){
if(arr[mid] >= arr[0]){
s = mid+1;
}
else{
e = mid;
}
mid = s + (e-s)/2;
}
return s;
}
int main(){
int arr[5] = {8,10,17,1,3};
... | ALGO | 0.999943 | 5.034666 |
5d45ca84-fd86-4063-a6fd-c230588ed683 | takashigoto1207/atcoder | abc1xx/abc146/abc146_a.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using namespace atcoder;
using ll = long long;
int main() {
string S;
cin >> S;
if (S == "SUN")
cout << 7 << endl;
else if (S == "MON")
cout << 6 << endl;
else if (S == "TUE")
cout... | ALGO | 0.999781 | 3.986907 |
a841559f-c857-4491-bb83-3bb2c0d25364 | Gnaroshi/practice-algorithm-solvedac | With_Levels/Silver/Silver_5/16212.cpp | // problem: 정열적인 정렬
// id: 16212
// tag:
// time taken:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
using ll = long long... | ALGO | 0.999868 | 4.593131 |
f994b195-919d-4bca-a949-0fdc1178c21a | Ana-CM/Ed2-Parte1 | cenarios/cenario2/cenario2.cpp | #include "cenario2.h"
#include "vetorTitulo.h"
#include "quicksortInsercao.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void cenario2(int vectorSize[], int n)
{
ofstream exitArq("saidaCenario2.txt");
long long int copies, totalCopies, comparisons, totalComparisons;
do... | ALGO | 0.996673 | 4.553358 |
bfa1f158-aa37-4eaa-81b8-fb7ef608c49a | chaeonee/Programmers | level2/최솟값만들기.cpp | #include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int solution(vector<int> A, vector<int> B){
sort(A.begin(),A.end());
sort(B.begin(),B.end(),greater<int>());
int len = A.size();
int answer = 0;
for(int i = 0; i < len; i++){
answer += A[i]*B[i];
}
re... | ALGO | 0.999962 | 4.330008 |
665ca8be-3691-450d-b49d-40439a95b4c3 | canyucelb/Project1 | main.cpp | #include <iostream>
#include <random>
#include <set>
#include <unordered_map>
#include "City.h"
#include "Car.h"
#include "Util.h"
// The main function - entry point of the program.
int main() {
int width, height, numCars;
// Read the dimensions of the city and the number of cars from the standard input.
scanf(... | ALGO | 0.995555 | 6.312143 |
3b464151-02ca-47bc-8b97-bc4efd3f21c5 | adityarathore063/cpp-ds-and-algo | Array/2D Array/searching.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n, m;
cin>>n>>m;
int x;
cin>>x;
int arr[n][m];
for(int i = 0; i<n; i++){
for(int j = 0; j<m; j++){
cin>>arr[i][j];
}
}
bool flag = false;
for(int i = 0; i<n; i++){
for(int j = 0; j<m; j... | ALGO | 0.999793 | 4.420614 |
0ab6eb02-62da-48bf-98cc-d119b250266f | GrootTheDeveloper/OLP-ICPC | 800+BAI_CODE_HAY/Code/dyslexia.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int mode = 1e9 + 7;
string s;
int x[100005],y[100005],n;
int calc(int n)
{
return n * (n + 1) * (2 * n +1) / 6;
}
int sum(int n)
{
return n * (n + 1) / 2;
}
void sub1()
{
int res = 0;
for (int i = 1; i <= n; i++) for(int j = i; j <= n; j++)
... | ALGO | 0.999964 | 3.91349 |
98853297-0526-4a4d-8e3b-769842ae689b | lockie/HiveGame | HiveGame/Bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp | #include "btMultiSapBroadphase.h"
#include "btSimpleBroadphase.h"
#include "LinearMath/btAabbUtil2.h"
#include "btQuantizedBvh.h"
/// btSapBroadphaseArray m_sapBroadphases;
/// btOverlappingPairCache* m_overlappingPairs;
extern int gOverlappingPairs;
/*
class btMultiSapSortedOverlappingPairCache : public btSortedOv... | ALGO | 0.989106 | 4.5585 |
bda435ec-879d-4357-8be3-cf617d17f9c6 | uberjuice/marlin_2.0.x_Chiron | Marlin/src/libs/least_squares_fit.cpp | /**
* Least Squares Best Fit by Roxy and Ed Williams
*
* This algorithm is high speed and has a very small code footprint.
* Its results are identical to both the Iterative Least-Squares published
* earlier by Roxy and the QR_SOLVE solution. If used in place of QR_SOLVE
* it saves roughly 10K of program memory. I... | ALGO | 0.998603 | 5.046912 |
cebe1e2a-0610-4f1c-856e-c479605fd3b9 | danieldidiobalsamo/concurrent_execution_models | cpp/src/ReadersWriters.cpp | #include "ReadersWriters.hpp"
#include <vector>
namespace ReadersWriters {
int readCount = 0;
boost::fibers::mutex readMutex{};
boost::fibers::mutex writeMutex{};
boost::fibers::mutex
serviceQueue{}; // this mutex avoids writers or readers starvation
int sharedInt = 0;
void write() {
while (true) {
std::... | TOOL | 0.95762 | 5.784452 |
58e7e2c0-6a0e-4ba9-8c9d-2c9d38ca84d0 | novpeter/Parallel-programming | Other/Параллельное_программирование_Гимазова2/Task8.cpp | #include <iostream>
#include <omp.h>
#include <time.h>
#define NUM 3
int main() {
int A[NUM][NUM], B[NUM], C[NUM];
int i, j;
for (i = 0; i < NUM; i++) {
for (j = 0; j < NUM; j++) {
A[i][j] = 1 + rand() % 10;
B[i] = 1 * (i + 1);
C[i] = 0;
}
}
pr... | ALGO | 0.99988 | 3.352281 |
94b8db20-6511-4eb3-915a-795e837da81d | Esperanzalukas/my-abacus-develop-fork | source/module_hamilt_general/module_surchem/corrected_energy.cpp | #include "surchem.h"
double surchem::cal_Ael(const UnitCell &cell, const int& nrxx, const int& nxyz)
{
double Ael = 0.0;
for (int ir = 0; ir < nrxx; ir++)
{
Ael -= TOTN_real[ir] * delta_phi[ir];
}
Parallel_Reduce::reduce_pool(Ael);
Ael = Ael * cell.omega / nxyz;
// cout << "Ael: " <... | ALGO | 0.976563 | 3.329073 |
95c273e3-13b0-435a-ad95-e8c260bfb7e8 | dangxiaobin123/leetcodeAC | leetcode/0110. 平衡二叉树/cpp/TEST.cpp | #define CATCH_CONFIG_MAIN
#include <catch.hpp>
#include "solution.h"
TEST_CASE("0107. 二叉树的层次遍历 II", "[levelOrderBottom]")
{
SECTION("给定二叉树 [3,9,20,null,null,15,7]") {
TreeNode root(3);
TreeNode node1(9);
TreeNode node2(20);
TreeNode node3(15);
TreeNode node4(7);
roo... | TEST | 0.932244 | 6.579848 |
0556014c-848a-4c55-9b91-8a49a135ee49 | jonatas57/maratona | uva/12504-UpdatingADictionary.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef map<int, int> mii;
typedef pair<int, int> ii;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f... | ALGO | 0.999702 | 4.232004 |
98b078af-40b7-49d9-9b3f-ded53ac684ea | ulhaspawar/DSA | src/youngest_common_ancestor.cpp | #include <vector>
#include <math.h>
using namespace std;
class AncestralTree
{
public:
char name;
AncestralTree *ancestor;
AncestralTree(char name)
{
this->name = name;
this->ancestor = nullptr;
}
void addAsAncestor(vector<AncestralTree *> descendants);
};
AncestralTree *get... | ALGO | 0.99463 | 4.337341 |
163fd3e4-fa29-40d7-9f76-8d3beb9c7482 | chu-siang/problem_solve | UVA/p900/p10929.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
while(cin >> s && s != "0"){
int sum1 = 0, sum2 = 0, l = s.length();
for(int i = 0 ; i < l; i++){
if(i&1)sum2 += (s[i]-'0');
else sum1 += (s[i]-'0');
}
if(abs(sum1-sum2) % 11 == 0)cout << ... | ALGO | 0.999441 | 3.965179 |
b6e3746d-bfdb-4533-b408-ca3072f678f3 | Silvanosky/ardupilot_test | libraries/AC_PID/AC_PI_2D.cpp | /// @file AC_PI_2D.cpp
/// @brief Generic PID algorithm
#include <AP_Math/AP_Math.h>
#include "AC_PI_2D.h"
const AP_Param::GroupInfo AC_PI_2D::var_info[] = {
// @Param: P
// @DisplayName: PID Proportional Gain
// @Description: P Gain which produces an output value that is proportional to the current error... | ALGO | 0.999133 | 5.874112 |
165c20d8-98de-4ef0-bd1c-946c15d5866b | UihwanLee/PROGRAMMERS_PROBLEM | Level0/29_양꼬치.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int n, int k) {
int answer = 0;
answer = 12000*n + 2000*(k-(n/10)) ;
return answer;
}
| ALGO | 0.996738 | 3.044591 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.