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 |
|---|---|---|---|---|---|---|
52c72e5c-7f06-4349-84ee-23e14624f50b | ishandutta2007/codeforces | skyqwq/normal/1606/D.cpp | // Skyqwq
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef pair<int, int> PII;
typedef long long LL;
template <typename T> void chkMax(T &x, T y) { if (y > x) x = y; }
template <typename T> void chkMin(T &x, T y) { if (y < x) x = y; }... | ALGO | 0.999912 | 3.589342 |
5a94b4fa-5be2-42e8-ae71-66e64afe0bce | bioexcel/bioexcel-code-releases | GROMACS/gromacs-2018.3/src/gromacs/pbcutil/boxutilities.cpp | /*! \internal \file
* \brief
* Implements routines in boxutilities.h.
*
* Utility functions for handling boxes.
*/
#include "gmxpre.h"
#include "boxutilities.h"
#include <algorithm>
#include "gromacs/math/utilities.h"
#include "gromacs/math/vec.h"
#include "gromacs/math/vectypes.h"
void do_box_rel(int ndim, co... | TOOL | 0.999279 | 6.71512 |
090e341c-00a5-4bfa-b85b-fb4cd3cacb3a | GOR-OM/DSA-Problem-for-placement | Array/Intersection of Two Arrays.cpp | // Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order.
// Example 1:
// Input: nums1 = [1,2,2,1], nums2 = [2,2]
// Output: [2]
// Example 2:
// Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
// Output: [9,... | ALGO | 0.999946 | 6.042362 |
3a0ca2e3-860e-4c21-af4a-4afd4473276f | arunkalher/DSA | Binary Tree/preorder_traversal_iter.cpp | #include <bits/stdc++.h>
/*
Following is the structure of Tree Node
class TreeNode
{
public:
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int val)
{
this->val = val;
left = NULL;
right = NULL;
}
};
*/
typedef TreeNode Node;
vector<int> preorderTraversal(Tr... | ALGO | 0.999974 | 5.789155 |
f7a2b317-17ad-4ad7-893c-11ac0ac9a279 | blckroot/freeimage | Source/OpenEXR/Imath/ImathFun.cpp | #include "ImathFun.h"
IMATH_INTERNAL_NAMESPACE_SOURCE_ENTER
float
succf (float f)
{
union {float f; int i;} u;
u.f = f;
if ((u.i & 0x7f800000) == 0x7f800000)
{
// Nan or infinity; don't change value.
}
else if (u.i == 0x00000000 || u.i == 0x80000000)
{
// Plus or minus zer... | ALGO | 0.965257 | 7.054082 |
3c1320b4-2d7e-4e55-8ae6-ad7a01cc26d6 | laliluielo/programming_problems | Easy/OddGnome/gnome.cpp | //Odd Gnome https://open.kattis.com/problems/oddgnome
#include <iostream>
#include <iomanip>
#include <limits>
using std::cin;
using std::cout;
using std::endl;
void gnome(){
int g, start;
cin >> g >> start;
int match = start;
int temp;
for(int i = 2; i < g; i++){
cin >> temp;
i... | ALGO | 0.999459 | 3.472716 |
aad827cd-eb7c-4cd1-92ae-5f4f3a87036b | srijon-32/CP-Library | Graph/Week 2 - Graph Algorithm/Module 4 - Bellman Ford & Floyd Warshall/Floyd_Warshall_Directed.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,e; cin>>n>>e;
vector<vector<int>>adj(n,vector<int>(n,INT_MAX));
for(int i=0;i<n;i++) adj[i][i]=0;
for(int i=0;i<e;i++)
{
int u,v,w; cin>>u>>v>>w;
adj[u][v]=w;
}
for(int k=0;k<n;k++)
{
for(i... | ALGO | 0.999996 | 4.405112 |
88b45718-430c-41c3-9d9f-44a5c214d950 | DionysiosB/CodeForces | 2070A-FizzBuzzRemixed.cpp | #include <cstdio>
int main(){
long t; scanf("%ld", &t);
while(t--){
long n; scanf("%ld", &n);
long a = (n / 15);
long b = (n % 15) + 1;
b = (b < 3 ? b : 3);
printf("%ld\n", 3 * a + b);
}
}
| ALGO | 0.999723 | 3.767604 |
7a2de2f9-911c-4090-9be2-0d627d025438 | XIAOYAOYITAN/C_leraning | LeetCode/Leetcode刷题/896. 单调数列/664. 奇怪的打印机.cpp | ///********************************************************************
//1. ĿԴhttps://leetcode-cn.com/problems/strange-printer/
//
//2. ԭ
//664. ֵĴӡ
//ֵ̨ĴӡҪ
//
//ӡÿֻܴӡ ͬһַ ɵС
//ÿοʼͽλôӡַһḲǵԭеַ
//һַ s ǼӡӡҪٴӡ
//
//
//ʾ 1
//
//룺s = "aaabbb"
//2
//ͣȴӡ "aaa" Ȼӡ "bbb"
//ʾ 2
//
//룺s = "aba"
//2
//ͣȴӡ "aaa" Ȼڵڶλôӡ "b" ǵԭַ 'a'
... | ALGO | 0.999943 | 5.231555 |
35945445-65ad-4114-928e-a38f00d44a09 | Sowmik23/CompetitiveProgramming | LeetCode/Hash Table/1656. Design an Ordered Stream.cpp | // 1656. Design an Ordered Stream
class OrderedStream {
public:
unordered_map<int, string> mp;
int i;
int n;
OrderedStream(int n) {
this->n = n;
this->i = 1;
}
vector<string> insert(int idKey, string value) {
vector<string> res;
mp[idKey] = value;
whi... | ALGO | 0.997304 | 6.249522 |
6092ffe7-ed40-4bce-8b4e-09b936764d0b | peterspackman/occ | src/qm/hf.cpp | #include <occ/core/constants.h>
#include <occ/core/log.h>
#include <occ/core/molecule.h>
#include <occ/core/parallel.h>
#include <occ/core/units.h>
#include <occ/qm/hf.h>
namespace occ::qm {
void HartreeFock::set_density_fitting_basis(
const std::string &density_fitting_basis) {
occ::qm::AOBasis dfbasis =
... | ALGO | 0.99659 | 6.007148 |
774ff332-0fea-4dfb-9410-f7173d275003 | gaowenliang/fsrk | src/sfreak/sfreak.cpp | #include "fsrk/sfreak/sfreak.hpp"
#include "fsrk/sfreak/sfreak_impl.h"
#include <algorithm>
#include <code_utils/sys_utils/tic_toc.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <opencv2/opencv.hpp>
#include <sstream>
#include <stdlib.h>
#include <string.h>
namespace cv
{
// -------------------... | TOOL | 0.880911 | 4.525546 |
615bea23-71b2-49c4-b523-b0c19692e141 | ishandutta2007/codeforces | wild_hamster/normal/1195/D1.cpp | #include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <utility>
#include <iostream>
#include <cmath>
#include <deque>
#include <string>
#include <time.h>
#include <stack>
#define pii pair<ll,ll>
#define X first
#define Y second
#define mp make_pair
typedef ... | ALGO | 0.999813 | 4.192864 |
cbb9822e-684c-48b0-81db-cb297342de57 | shamaill/DSA | Binary Search Tree/FindHeight.cpp | #include <iostream>
using namespace std;
struct Node
{
int data;
Node *left, *right;
Node(int val)
{
data = val;
left = right = nullptr;
}
};
int height(Node *root)
{
if (!root)
return -1;
return 1 + max(height(root->left), height(root->right));
}
int main()
{
... | ALGO | 0.999534 | 6.251497 |
ae0a0fe9-4cb3-428c-8992-a2560584db55 | imtahirabatool/Leetcode | 2163-kth-distinct-string-in-an-array/kth-distinct-string-in-an-array.cpp | class Solution {
public:
string kthDistinct(vector<string>& arr, int k) {
unordered_map<string, int> map;
for (auto& s : arr) {
++map[s];
}
for (auto& s : arr) {
if (map[s] == 1) {
--k;
if (k == 0)
return s;
... | ALGO | 0.999906 | 6.030128 |
078f73e3-9e6a-48db-bc3a-c46eb0f2e246 | manikanta2901/ubuntu | .history/codingChallenges/cpp/codeforcesCp/Contest719/NotAdjacentMatrix_20210507125340.cpp | #include <bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define trav(dataType,DataStruct,name) for(dataType<DataStruct>::itt ip = name.bb(); ip != name.ee(); ip++)
//Pre processors & typedefs
... | ALGO | 0.999593 | 4.223527 |
8dfd8cd1-a1c5-4d28-88a6-0aad12a54ca5 | yczddgj/Trajectory-Aware-Animated-Transitions | backend/utils/box2d/src/dynamics/b2_contact.cpp | #include "b2_chain_circle_contact.h"
#include "b2_chain_polygon_contact.h"
#include "b2_circle_contact.h"
#include "b2_contact_solver.h"
#include "b2_edge_circle_contact.h"
#include "b2_edge_polygon_contact.h"
#include "b2_polygon_circle_contact.h"
#include "b2_polygon_contact.h"
#include "box2d/b2_contact.h"
#include... | ALGO | 0.991818 | 7.564944 |
05cb51c3-1dfe-449f-ae59-72fc66d348a5 | LarsenClose/basicCplusplus | Display-user-generated-number-of-Fibonnaci-series.cpp | //CSC 160 PROJECT #1
//Purpose: A grade level edition to display a user designated number of terms
// of the Fibonacci series
//Author: Larsen J Close Most recent changes: 2/18/2016 9:11PM
#include <iostream> // preprocessor directive
#include <iomanip> // needed for most manipulators
#include <cmat... | ALGO | 0.997595 | 3.676653 |
33964e7b-0387-457f-a787-0b6664e58428 | Blubmin/unreal_shooter_sample | ThirdParty/Eigen/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)
{
return v.sta... | TEST | 0.982542 | 6.666052 |
4cbb1dcc-aac5-4e09-ba8d-b4f9d735cd7e | AbhinandanBM/180DaysofDSA | 14.Queue/queue_ll.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int value)
{
data = value;
next = NULL;
}
};
class Queue
{
public:
Node *front;
Node *rear;
Queue()
{
front = rear = NULL;
}
bool isEmpty()
{
retu... | ALGO | 0.996128 | 4.831599 |
7489ce81-9a0a-4634-82cd-520703b21c5a | leungll/NENU-Courses | 算法分析与设计/17级软件/ebook/源代码/ch9/Exam9-2.cpp | #include <stdio.h>
#define MAXV 1010
#define INF 0xffffff //
int n,m;
int Dist[MAXV][MAXV],Cost[MAXV][MAXV];
int s,t;
void Dijkstra(int s) //ҿ˹㷨
{ int dist[MAXV];
int cost[MAXV];
int S[MAXV];
int mindist,mincost,u;
int i,j;
for(i=1;i<=n;i++) //distcostSʼ
{ dist[i]=Dist[s][i];
... | ALGO | 0.999747 | 3.675864 |
aabb9894-3a27-4e96-be23-cc6026d9bb9a | iamdin/leetcode | math-medium/921.使括号有效的最少添加.cpp | /*
* @lc app=leetcode.cn id=921 lang=cpp
*
* [921] 使括号有效的最少添加
*/
#include <bits/stdc++.h>
using namespace std;
// @lc code=start
class Solution {
public:
int minAddToMakeValid(string S) {
int left = 0, ret = 0;
for (auto c : S) {
if (c == '(')
left++;
else... | ALGO | 0.99961 | 6.221323 |
6bc2de98-9bd7-4030-a6b0-a17ddc655927 | Musa-Mahmoud/Coach_Academy | Level1/sheet_06/C - Translation/main.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
string s, t;
cin >> s >> t;
reverse(t.begin(), t.end());
(s == t)? cout << "YES\n" : cout << "NO\n";
return 0;
}
| ALGO | 0.999994 | 3.89915 |
c99f25a9-04e0-4b4b-9845-206b0331d69d | GUTS-W/MiniOB | src/observer/sql/optimizer/comparison_simplification_rule.cpp | //
// Created by Wangyunlai on 2022/12/13.
//
#include "sql/optimizer/comparison_simplification_rule.h"
#include "sql/expr/expression.h"
#include "common/log/log.h"
RC ComparisonSimplificationRule::rewrite(std::unique_ptr<Expression> &expr, bool &change_made)
{
RC rc = RC::SUCCESS;
change_made = false;
if (expr... | TOOL | 0.968796 | 5.691233 |
ba0aad8b-996b-4cda-b416-0ff1274c5430 | AFeiYA/cpp | algorithms/trees/trees.cpp |
#include <iostream>
#include "Tree.h"
#include "BST.h"
#include "AVL.h"
int main()
{
BST t;
t.Insert(10);
t.Insert(5);
t.Insert(20);
t.Insert(8);
t.Insert(30);
//t.CreateTree();
std::cout << "Preorder: ";
t.Preorder();
std::cout << std::endl;
std::cout << "Inorder: ";
t... | ALGO | 0.98492 | 4.129337 |
920c2f6e-cbb8-41ba-84cd-a9d67257ce82 | KBOHYUN/CodingTest | Baekjoon/BJ2887.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#define MAXN 30001
using namespace std;
int count[MAXN] = { 0, };
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int N;
cin >> N;
for (int i = 2; i <= N; i++) {
count[i] = count[i - 1] + 1;
if (i % 2 == 0) {
count[i] = min(c... | ALGO | 0.999981 | 4.233605 |
bc655680-05c7-4d4f-bc6d-28c6a4df6b2b | HMBlankcat/CPPLEARNING | mywork/22运算符重载.cpp | #include <iostream>
using namespace std;
//Ӻ
class Person
{
public:
//1/Ա+
// Person operator+(Person &p)
// {
// Person temp;
// temp.m_A=this->m_A+p.m_A;
// temp.m_B=this->m_B+p.m_B;
// return temp;
// };
int m_A;
int m_B;
};
//2ȫֺ+
Person operator+(Person &p1,Pers... | ALGO | 0.977268 | 3.783796 |
d66fd727-be9c-48d2-bd3d-bc117d17c6c3 | tushar-3549/Problem_Solving | Codeforces/C - Vasilije in Cacak.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll sum(ll x)
{
return x * (x + 1) / 2;
}
ll sumR(ll l ,ll r)
{
return sum(r) - sum(l - 1);
}
void solve()
{
ll n , k , x;
cin >> n >> k >> x;
if(x >= sumR(1 , k) && x <= sumR(n - k + 1 , n)) {
cout << "YES\n";
... | ALGO | 0.999824 | 4.027123 |
1d1637da-45ed-44aa-8277-a5eb66ea6c0c | KirilApostolov/CPP_Problems | candies.cpp | #include <iostream>
using namespace std;
int main () {
int a, b, c;
cin >> a >> b >> c;
if(2 * a < b || 2 * c < b)
if (a > c) cout << c * 4 + 2;
else cout << a * 4;
else if ( 2 * a == b) cout << a * 4;
else if ( 2 * c == b) cout << c * 4 + 1;
else cout << b / 2 * 4 + 1 + (b % 2)... | ALGO | 0.999307 | 3.592104 |
3e4b19e0-e746-4a71-98e4-6594562e2b5b | Saif502/CP_Hunter | C & c++ code/Codeforces/1294a.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--)
{
long long int a,b,c,d,m,n;
cin>>a>>b>>c>>d;
m=max(a,max(b,c));
n=(m-a)+(m-b)+(m-c);
if(n>d)
{
cout<<"NO"<<endl;
}
else
{
... | ALGO | 0.999727 | 3.958449 |
49787088-e917-45cf-a0b4-7edd09239f33 | Vishal8236/DSA-Practice-vishal8236 | Sliding-window/Easy/find larget k size group.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
//code
int arr[] = {1,2,3,7,5,6,8,4};
int n = 8;
int k=4;
int window_sum = 0;
int maxi;
for(int i=0; i<k; i++)
{
window_sum += arr[i];
}
maxi = window_sum;
for(int i=k; i<n; i++)
{
window_sum -=... | ALGO | 0.999947 | 4.193614 |
3f62d14c-9e5c-4278-ac89-3947bcf62ecd | AylinResendiz/3erparcial | arreglo9.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cout << "Digite el numero de paises: ";
cin >> n;
string paises[n];
for (int i = 0; i < n; i++) {
cout << "Digite pais " << i + 1 << ": ";
cin >> paises[i];
}
int pos;
cout << "Digite la posicion: ";
cin >> pos... | TOOL | 0.969376 | 4.064749 |
3abfe6b7-054a-4b22-bbe0-8730ae81d385 | HeronGuerrieri/Anotacoes | 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 |
f247ce86-4713-4167-8624-ae4a2bb6f849 | Lightninghkm/Uriah | Library/libcxx/test/std/algorithms/alg.modifying.operations/alg.transform/binary_transform.pass.cpp | // <algorithm>
// template<InputIterator InIter1, InputIterator InIter2, class OutIter,
// Callable<auto, const InIter1::value_type&, const InIter2::value_type&> BinaryOp>
// requires OutputIterator<OutIter, BinaryOp::result_type> && CopyConstructible<BinaryOp>
// constexpr OutIter // constexpr after C... | TEST | 0.990947 | 6.919359 |
63622037-b882-45c7-927e-e1df00f96e60 | ishandutta2007/codeforces | zoli9/normal/474/B.cpp | #include <iostream>
using namespace std;
int n, m;
long long t[100009];
long long a[100009];
int main()
{
cin>>n;
t[0]=0;
for(int i=1; i<=n; i++)
{
cin>>t[i];
t[i]+=t[i-1];
}
cin>>m;
for(int i=1; i<=m; i++)
{
cin>>a[i];
}
for(int i=1; i<=m; i++)
{
... | ALGO | 0.999989 | 3.813251 |
8210799d-a3ca-40fd-a306-c778192db908 | bachtran02/competitive-prog | Codeforces/Contests/148/B_Maximum_Sum.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
void solve(){
int n, k; cin >> n >> k;
vector<ll> arr(n);
ll cur = 0, res = -1;
for (auto &i : arr)
cin >> i;
sort(arr.begin(), arr.end());
for (int i = 0; i < n - k; i++)
... | ALGO | 0.999967 | 4.797324 |
6fae78f0-3c57-423e-9541-b62a17597023 | TKRchamak/Phitron_Course | course_2/Exam/Array_theory_exam/Bubble Sort/BubbleSort.cpp | #include<bits/stdc++.h>
using namespace std;
void swap(int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}
void bubble_sort(int a, int arr[])
{
for(int j=0; j<a; j++)
{
cout<<j+1<<"st iteration: "<<endl;
// cout<<j+1<<"st step: ";
// for(int j=0; j<a; j++)
// {
// ... | ALGO | 0.999936 | 4.69321 |
0c7e165b-8dbd-4afb-85da-50927ac09013 | sgovil5/competitive-programming | CodeForces/1400/762B.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#define f first
#define s second
int a,b,c; //USB, PS/2, Both
int m; //num mouses
vector<pair<int,string>> mouses;
int main(){
cin>>a>>b>>c>>m;
for(int i=0; i<m; i++){
int val;
string port;
... | ALGO | 0.994017 | 4.147299 |
b9ad6831-bac8-4f8f-b6e8-ec83bb717b55 | ishandutta2007/codeforces | gustav/normal/403/B.cpp | #include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
#include <string>
#include <algorithm>
#include <function... | ALGO | 0.999901 | 3.527326 |
0967caff-1022-4fca-a878-6c0f31e08e99 | RoBiUlHaSaNj/My_Codefroces | A - Flipping Game.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
int sum = 0, maxSum = INT_MIN, oneCount = 0, hold = 0;
for (int i = 0; i < t; i++) {
cin >> hold;
if (hold == 0) {
sum++;
} else {
... | ALGO | 0.99996 | 5.363263 |
50c5dd87-1033-40b7-8a60-21d0318d9c9e | ishandutta2007/codeforces | nweeks/normal/1542/C.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
vector<int> primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
vector<int> candidats;
void solve() {
int n;
cin >> n;
int nbCandidats = candidats.size();
int sol = 0;
for (int i = 0; i < nbCandidats... | ALGO | 0.999658 | 4.662087 |
a853ac24-49f8-4ec9-9fa4-1548a91f7fa8 | juuso-oskari/VisualSLAM | libs/opencv/modules/ml/src/svmsgd.cpp | #include "precomp.hpp"
#include "limits"
#include <iostream>
using std::cout;
using std::endl;
/****************************************************************************************\
* Stochastic Gradient Descent SVM Classifier *
\***************************************... | DATA | 0.950558 | 7.319478 |
fb540a9d-f71e-4369-bbed-abd09adedb48 | AnasRaxa/LeetCode-Questions | Binary Search/Ceiling in a sorted array.cpp | int find_ceil(int arr[], int size, int key){
int start=0, end=size-1;
int mid, res;
while(start<=end){
mid = start + (end-start)/2;
if(key==arr[mid]) return arr[mid];
else if(arr[mid]<key){
start = mid+1;
}else if(arr[mid]>key){
res = arr[mid];
end = mid-1;
}
}
return res;
} | ALGO | 0.99996 | 3.506786 |
4c87fb6b-1a5a-4526-8bca-3ae2e1b2ac4b | invariantfields/Active_particles-LAMMPS | src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "pair_lj_cut_coul_cut_kokkos.h"
#include "kokkos.h"
#include "atom_kokkos.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "update.h"
#include "integrate.h"
#inc... | ALGO | 0.996379 | 6.308649 |
720eb0f6-30e6-416a-9946-d445147123ab | bvlgah/leetcode-solution | hard/problem_3008_find_beautiful_indices_in_the_given_array_ii/Solution.cpp | #include <algorithm>
#include <cassert>
#include <string>
#include <vector>
class KMPMatcher {
public:
explicit KMPMatcher(const std::string &Str)
: Pattern(Str), LongestPrefixLength(Str.size()), Pos(),
PatternSize(static_cast<unsigned>(Str.size())) {
init();
}
void consume(char Ch) {
if (... | ALGO | 0.999907 | 5.622047 |
84e4f52c-aa28-4fd6-839d-9750312d37ba | palilo815/ps | baekjoon/10000/10749.cpp | #include <bits/stdc++.h>
#define loop(i,n) for(int i=0;i<n;++i)
using namespace std;
const int mxN = 2e3;
int id[mxN], dist[mxN];
bool conn[mxN];
int main() {
cin.tie(0), cout.tie(0);
ios::sync_with_stdio(0);
int N; cin >> N;
loop(i, N) cin >> id[i];
long long ans = 0;
loop(_, N) {
... | ALGO | 0.999978 | 3.947169 |
f1496faa-0f98-4b83-ab5a-ec96dd5ce383 | nmecham27/UnderWaterProject | Part 3/Matlab_version/mex/function4Binary.cpp | #include "function4Binary.hpp"
void ArrayMultiply4Binary(int *res, const int *a, const int* b, int n, int l)
/**
a: m x n
b: n x l
res: m x l
*/
{
//static int add[4][4]={{0, 1, 2, 3},{1, 0, 3, 2},{2, 3, 0, 1},{3, 2, 1, 0}};
//static int mul[4][4]={{0, 0, 0, 0},{0, 1, 2, 3},{0, 2, 3, 1},{0, 3, 1, 2}};
int j, k;
... | ALGO | 0.99983 | 5.123346 |
3706492c-5ee6-47e4-b82c-5f05a0818fd1 | cmangos/mangos-svn | tags/0.7/contrib/map_extractor/libmpq/parser.cpp | #define _CRT_SECURE_NO_DEPRECATE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "mpq.h"
#include "common.h"
#include <ctype.h>
/*
* This function deletes the specified characters, but leaves
* escape sequences unaffected. This means that " would be
* deleted but \" would not.
*/
char *libm... | TOOL | 0.867413 | 4.211851 |
d7bfdf58-53bd-419e-8b5a-842b832dda51 | linusyue/calibStereo | stereo_calib.cpp | #include "opencv2/calib3d.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
using namespace cv;
using namespace s... | TOOL | 0.97364 | 6.328636 |
cbb65202-fdb8-4dae-ab41-bc92199800b2 | assem2002/Problem_Solving | CSES/cses-DiceCombination.cpp |
#include <bits/stdc++.h>
#include<iostream>
using namespace std;
typedef long long ll;
#define MOD 1000000007
int n;
int main() {
std::cin>>n;
std::vector<int> v(n+2,0);
v[0] = 1;
for(int i = 1; i<=n;i++){
for(int j=1;j<=6;j++){
if(j>i) break;
v[i] += v[i-j];
... | ALGO | 0.999962 | 4.313251 |
4f9f47a9-b0fd-478f-a989-93130eb17dec | RazerRom/system_core | libutils/VectorImpl.cpp | #define LOG_TAG "Vector"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <cutils/log.h>
#include <utils/Errors.h>
#include <utils/SharedBuffer.h>
#include <utils/VectorImpl.h>
/*****************************************************************************/
namespace android {
// ---------------... | TOOL | 0.976489 | 7.354373 |
6920844e-0c7a-41d0-9932-fa9a022a4ca9 | Lenakeiz/LSystem | octet/open_source/bullet/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp | #include "btConvexTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
#include "BulletCollision/CollisionShapes/btStridingMeshInterface.h"
btConvexTriangleMeshShape ::btConvexTriangleMeshShape (btStridingMeshInterface* meshInterface, bool calcAabb)
... | ALGO | 0.97281 | 7.530622 |
58f1d1bb-b5de-4cc4-a1e9-4e1fbed78a0a | Tovrik/ECS158Homework1 | Problem2.cpp | // Authors:
// Agahi, Bijan
// Bharadwaj, Arjun
// Peterson, Stefan
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <sstream>
#include <unordered_map>
#include <omp.h>
#include <cstring>
using namespace std;
int nth, //number of threads
chunk, //number of verticies handled... | ALGO | 0.999721 | 3.855004 |
17a7f929-5338-40ff-86f0-026c6ad36892 | teresis/2016_2nd_semester | algorithm/algorithm/connected_commponent.cpp | #include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
int numV;
int * list;
int * Qlist;
int * rep;
typedef struct _vertex;
typedef struct _vertex
{
int groupname;
int value;
int rank;
struct _vertex * parent;
} Vertex;
Vertex * vertex;
void MAKE_SET(Vertex * x, int value)
{
x->value = valu... | ALGO | 0.999975 | 3.963061 |
2cd9b66b-d884-4077-ae5f-994d8907ff70 | naziikk/Algorithms | Тренировки по алгоритмам/Тренировки 2/Сортировка событий/A. Закраска прямой.cpp | #include <iostream>
#include <vector>
#include <algorithm>
int main() {
int n;
std::cin >> n;
std::vector<std::vector<int>> intervals(n);
for (int i = 0; i < n; i++) {
int l, r;
std::cin >> l >> r;
intervals[i] = {l, r};
}
std::sort(intervals.begin(), intervals.end());
... | ALGO | 0.999946 | 5.37233 |
9e5ad7f7-2d3a-4658-83a4-6695b7241f3b | masum200119/Schedulling-Algorithms | OptimalPage.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
int a=arr[0];
int b=arr[1];
int c=arr[2]... | ALGO | 0.999893 | 3.619473 |
207a5bb2-d5eb-4d27-b0f7-2b25cbf43af9 | HongYoungGee/Algorithm | BOJ/02775/2775.cpp14.cpp | #include <stdio.h>
#include <iostream>
using namespace std;
int cache[16][16] = { 0 };
int how_people(int a, int b)
{
if (cache[a][b] != 0) return cache[a][b]; //cache hit
if (a == 0) return cache[a][b] = b; //조건
if (b == 1) return cache[a][b] = 1;
return cache[a][b] = how_people(a - 1, b) + how_people(a , b -... | ALGO | 0.999933 | 5.179022 |
74fd0516-5a37-4ab6-8e8a-c5e422989bc7 | dheerajnandigama/DSA | DSA/Arrays/MaxSubSequenceSum.cpp | // Find the max subsequence sum of all subsequences
// Complexity : 2^N, 1
#include <bits/stdc++.h>
using namespace std;
int powerset(vector<int> nums, int n, int idx, int sm, int ans)
{
int x = 0, y = 0;
if (idx == n)
{
ans = max(sm, ans);
return ans;
}
x = powerset(nums, n, idx ... | ALGO | 0.999941 | 5.290281 |
edc68e6b-4237-472c-890c-43e5ca5a7ed4 | nishantbhardwaj2004/DSA-in-Cpp | Loops 1/GP.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cout<<"Enter a number : ";
cin>>n;
// 1 2 4 8 16 ...n terms
// 2 6 18 54
int a = 2;
for(int i=1;i<=n;i++){
cout<<a<<endl;
a = a*3 ;
}
} | ALGO | 0.999418 | 3.315836 |
8553f91a-093e-48c2-a631-21661634d332 | vinhnguyen1182002/baitap | BT10/A3.cpp | #include<iostream>
using namespace std;
struct Point{
int x;
int y;
};
Point mid_point(Point d1, Point d2)
{
Point mid;
mid.x = (d1.x + d2.x)/2;
mid.y = (d1.y + d2.y)/2;
return mid;
}
int main()
{
Point d1;
Point d2;
cin>>d1.x>>d1.y>>d2.x>>d2.y;
cout<<"Trung diem: ("<<mid_point(d1,d2).x<<","<<mid_point(d1,d2)... | ALGO | 0.994518 | 4.682816 |
f656ed6b-04f8-47e9-ab32-8c9f27b3b292 | GaisaiYuno/OI-Record-exe-deleted | Grade 10-12/2018 autumn/NOIP/NOIP2018提高组Day2程序包/answers/GD-0023/game/game.cpp | #include<cstdio>
using namespace std;
int f[10][10],s[1000],n,m,ans,t[1000];
bool p;
int sss(int x,int y,int w){
s[w]=f[x][y];
if (x==n&&y==m){
bool c=true;
if (!p)
for (int i=1;i<=w;i++)
if (s[i]<t[i]){
c=false;
break;
}
p=false;
if (!c) return false;
for (int i=1;i<=w;i++)
t[i]=s[... | ALGO | 0.999991 | 3.921033 |
60799c68-1796-4b9f-848b-7e58ea9b47bd | ishandutta2007/codeforces | andreinet/normal/512/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long i64;
const int Nmax = 205;
int A[Nmax];
class MaxFlowNetwork {
private:
typedef long long i64;
class Edge {
public:
int to;
i64 cap, flow;
Edge* rev;
Edge(const int _to, const i64 _cap, const i64 _flow):
... | ALGO | 0.999975 | 3.569786 |
7e030b3f-c11d-46a1-b4db-d2881968e394 | vermagaurav8/Algo-DS-Notes | AmazonTestSeries/Stack/Parenthesis.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to check if brackets are balanced or not.
bool ispar(string str)
{
// Your code here
stack<char>st;
for(int i=0;i<str.size();i++)
{
if(st.emp... | ALGO | 0.999258 | 6.266856 |
4919f78c-d8d0-41e4-96d2-926c657cbdce | KratomCoin/KratomCoin | src/checkpoints.cpp | #include <boost/assign/list_of.hpp> // for 'map_list_of()'
#include <boost/foreach.hpp>
#include "checkpoints.h"
#include "txdb.h"
#include "main.h"
#include "uint256.h"
static const int nCheckpointSpan = 10;
namespace Checkpoints
{
typedef std::map<int, uint256> MapCheckpoints;
//
// What makes a good... | TOOL | 0.946111 | 7.36436 |
b1267c12-b5c9-4e47-8205-730b54903f60 | ckeshava/cp-solutions | ib/binary_search/painter.cpp | // https://www.interviewbit.com/problems/painters-partition-problem/
#define MOD 10000003
bool check(const vector<int> &board_lengths, int num_painters, int max_possible_len)
{
int req_num_painters = 0, temp_sum = 0, i;
if (*max_element(board_lengths.begin(), board_lengths.end()) > max_possible_len)
re... | ALGO | 0.999852 | 5.018275 |
99e7b941-5b88-47b0-b59e-2b92b4aee648 | Toneyisnow/PixelPoem | cocos2d/cocos/platform/winrt/CCFileUtilsWinRT.cpp | #include "CCFileUtilsWinRT.h"
#include <regex>
#include "CCWinRTUtils.h"
#include "platform/CCCommon.h"
using namespace std;
NS_CC_BEGIN
static std::string s_pszResourcePath;
// D:\aaa\bbb\ccc\ddd\abc.txt --> D:/aaa/bbb/ccc/ddd/abc.txt
static inline std::string convertPathFormatToUnixStyle(const std::string& path)
{... | TOOL | 0.902107 | 6.452617 |
9076d989-6a37-4604-bccb-3c323b345e19 | alex-kity/optimization-Registration | plugins/core/Standard/qCSF/src/Cloud2CloudDist.cpp | #include "Cloud2CloudDist.h"
//system
#include <cmath>
// For each lidar point, we find its neibors in cloth particles by Rounding operation.
//use for neighbor particles to do bilinear interpolation.
#if 1
bool Cloud2CloudDist::Compute(const Cloth& cloth,
const wl::PointCloud& pc,
double class_threshold,
std:... | ALGO | 0.998725 | 5.523951 |
c66fbb24-20be-4b84-9107-c77257af9f23 | ecoli-hit/ASC2022 | source/lmp/pppm_dplr.cpp | #include <math.h>
#include "pppm_dplr.h"
#include "atom.h"
#include "domain.h"
#include "force.h"
#include "memory.h"
#include "error.h"
#include "math_const.h"
#include "pppm.h"
#include "gridcomm.h"
using namespace LAMMPS_NS;
using namespace MathConst;
enum{REVERSE_RHO};
enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATO... | ALGO | 0.998887 | 3.697813 |
58e31ba5-c54f-4b38-a042-6036009ea37e | xrayFan/xray_history | xr_3da/xrGame/alife_communication_manager.cpp | ////////////////////////////////////////////////////////////////////////////
// Module : alife_communication_manager.cpp
// Created : 03.09.2003
// Modified : 14.05.2004
// Author : Dmitriy Iassenev
// Description : ALife communication manager
//////////////////////////////////////////////////////////////////////... | TOOL | 0.879198 | 4.581627 |
dbe6e9c4-c436-4686-91da-844940c4f388 | mitjmcc/rayertracer | src/main.cpp | #include <iostream>
#include <fstream>
#include "stdlib.h"
#include "sphere.h"
#include "hitable_list.h"
#include "camera.h"
#include "material.h"
#include "float.h"
using namespace std;
string filename = "hello.ppm";
hitable *random_scene() {
int n = 500;
hitable **list = new hitable*[n+1];
list[0] = ne... | TOOL | 0.883012 | 5.204994 |
94b11015-90f0-406e-a2e8-2c10a80d760a | BangKartavya/HackerRank-Problems-CPP | Cpp Exception Handling/main.cpp | #include <iostream>
#include <stdexcept>
using namespace std;
int largest_proper_divisor(int n) {
if (n == 0) {
throw invalid_argument("largest proper divisor is not defined for n=0");
}
if (n == 1) {
throw invalid_argument("largest proper divisor is not defined for n=1");
}
for (i... | ALGO | 0.998868 | 5.5198 |
8233be3b-9ba7-4a99-8306-755a4d1b129a | heemankv/LeetCode-Solutions | Sudoku_Solver/Sudoku_Solver.cpp | class Solution {
public:
bool isBoardFilled(const vector<vector<char>>& board) {
for (const auto& row : board) {
for (const char& digit : row) {
if (digit == '.') {
return false;
}
}
}
return true;
}
bool i... | ALGO | 0.999479 | 6.866017 |
e188c2c9-2a2b-4b52-80d5-f7594165e627 | Hasin-Ishrak/CodeFolio | vscode(c++)/cinema_line.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(nullptr);
#define prb cin.exceptions(ios::badbit | ios::failbit);
#define ll long long
#define el '\n'
#define pb push_back
#define pp pop_back
ll gcd(ll a, ll b) { return __gcd(a, b); }
ll lcm(ll a, ll b) { return (a * b)... | ALGO | 0.999947 | 3.995048 |
f98148c8-3d18-4bd7-a097-1118d2ac9d83 | caomincan/leectcode | 236Lowest_Common_Ancestor_Binary_Tree.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* ans = nullptr;
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNo... | ALGO | 0.999976 | 6.174512 |
98aa7b12-93ff-4c3a-8a09-e6c2b813e2f7 | hanyucrocks/DSA | 3747-maximum-difference-between-adjacent-elements-in-a-circular-array/maximum-difference-between-adjacent-elements-in-a-circular-array.cpp | class Solution {
public:
int maxAdjacentDistance(vector<int>& nums) {
int n = nums.size();
int maxi = INT_MIN;
for(int i = 0; i < n - 1; i++)
maxi = max(maxi, abs(nums[i+1] - nums[i]));
maxi = max(maxi, abs(nums[n-1] - nums[0]));
return maxi;
}
}; | ALGO | 0.999854 | 5.876085 |
74aaa5bf-b529-4446-9601-7c1ea7d64f19 | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J02207/sticks/sticks.cpp | #include<bits/stdc++.h>
using namespace std;
int T,n;
int a[15]={6,2,5,5,4,5,6,3,7,6};
int num[15]={-1,-1,1,7,4,2,0,8};
int main(){
freopen("sticks.in","r",stdin);
freopen("sticks.out","w",stdout);
scanf("%d",&T);
for(int i=1;i<=T;i++){
scanf("%d",&n);
if(n<=7&&n!=6){
printf(... | ALGO | 0.999564 | 3.593872 |
187e366b-7d3b-4cbb-bfce-0effa4986099 | timothyshull/epicode | cpp/palindrome_number.cpp | #include <cassert>
#include <cmath>
#include <iostream>
#include <random>
#include <string>
#include <vector>
using std::cout;
using std::default_random_engine;
using std::endl;
using std::random_device;
using std::stoi;
using std::to_string;
using std::uniform_int_distribution;
using std::vector;
// @include
bool Is... | ALGO | 0.999093 | 5.641315 |
c61d6405-1198-480e-8141-0ac4a5d293b0 | manikanta2901/ubuntu | .history/SRM/elab/DAA/SearchingTechniques/SuperPrime_20210130161338.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e7 + 5;
int Exist[N];
int main(){
Exist[0] = Exist[1] = 0;
for(int i = 2; i <= N; i++){
Exist[i] = 1;
}
for(int i = 2; i <= N; i++){
if(Exist[i] == true && i * i < N){
for(int j = i * i; j <= N; j += i){
... | ALGO | 0.999351 | 4.738405 |
d9e14db1-00c2-40bb-9186-b8052aef86bb | ishandutta2007/codeforces | andreasyan/normal/920/A.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
using namespace std;
const int N=202;
struct ban
{
int l,r;
};
int n,m;
ban a[N];
bool c[N];
bool stg()
{
for(int i=1;i<=n;++i)
if(!c[i])
return false;
return true;
}
int main()
{
int tt;... | ALGO | 0.999961 | 4.094475 |
1ef83e64-a5b4-4990-939d-9fe7db967b86 | tinatiansjz/algorithm-learning-2019 | codeforces/R578_1200_div2/F.cpp | #include <cstdio>
#include <cstring>
using namespace std;
const int maxn = 1000+5;
// (x, y): x refers to the number and y the value
// (y+2520)%m = y%m
const int maxs = 2520+5; // maximum amount of states of one vertex
const int mod = 2520;
int K[maxn], M[maxn];
int G[maxn][15];
int S[maxn][maxs];
bool vis[maxn][maxs]... | ALGO | 0.999944 | 3.584333 |
51a8a789-1672-41d2-a6be-8f835e67d90a | danny0628/algo_bj | Project1/bj_1331.cpp | #include<iostream>
#include<string>
using namespace std;
bool flag;
int dx[8] = { -2, -2, -1, -1, 1, 1, 2, 2 };
int dy[8] = { -1, 1, -2, 2, -2, 2, -1, 1 };
bool visited[6][6];
int main()
{
string str;
cin >> str;
int start_x = 5 - (str[1] - '1');
int start_y = str[0] - 'A';
int temp_x = start_x;
... | ALGO | 0.999641 | 4.889756 |
0ad4fefa-014e-4984-9fab-9c999d22fed2 | Elyy27/LapTrinhNangCao | Week4/bt9t4.cpp | void sort(float array[], int size, bool isAscending) {
if (isAscending) sort(array, array + size);
else sort(array, array + size, greater<float>());
} | ALGO | 0.99926 | 5.774253 |
49589bc7-fd24-4768-84d5-b113d68fad4e | rezaulk/Online-Judge | CodeForces/935B. Fafa and the Gates.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,sum=0,x=0,y=0;
cin>>n;
char pre;
bool check=false;
for(int i=0; i<n; i++)
{
char k;
cin>>k;
if(k=='U')
{
x=x;
y=y+1;
if(pre=='R')
{
che... | ALGO | 0.999785 | 3.582069 |
c7a5babc-f488-4b17-ac26-730d95d2b210 | cesar-borba/beecrowd-leetcode-questions | beecrowd/1500-1999/bee_1632.cpp | #include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define dbg(x) cout << #x << " = " << x << endl
#define print(x) cout << x << "\n"
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f... | ALGO | 0.998964 | 4.115782 |
1e7e3454-464b-47dd-9a8b-50a85a43128c | machelreid/afromt | training/fairseq/clib/libbleu/libbleu.cpp | #include <map>
#include <array>
#include <cstring>
#include <cstdio>
typedef struct
{
size_t reflen;
size_t predlen;
size_t match1;
size_t count1;
size_t match2;
size_t count2;
size_t match3;
size_t count3;
size_t match4;
size_t count4;
} bleu_stat;
// left trim (remove pad)
vo... | ALGO | 0.992062 | 5.382121 |
58dd813f-d678-46ee-ada6-504e27046046 | SharifdotG/SharifdotG-s-CodeVault | Kattis/1.7/Bus/bus.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int testCases;
cin >> testCases;
while (testCases--) {
int stops, passengers = 0;
cin >> stops;
while (stops--) {
passengers *= 2; // As 2x passengers get off
passengers++;
}
cout ... | ALGO | 0.999731 | 4.303705 |
f81d292d-ec83-4a90-b5cc-86a93e06d59f | kasa021/atcoder-archives | diverta2019/diverta2019_b_43180379_AC.cpp | /*
* Author: kAsA02
* Submission URL: https://atcoder.jp/contests/diverta2019/submissions/43180379
* Submitted at: 2023-07-02 09:12:49
* Problem URL: https://atcoder.jp/contests/diverta2019/tasks/diverta2019_b
* Result: AC
* Execution Time: 22 ms
*/
#include <bits/stdc++.h>
#include <cmath>
#if __has_include(<... | ALGO | 0.999668 | 4.590806 |
7f3b6d2d-4208-4747-8ca8-106705fa5166 | ishandutta2007/codeforces | skuecrk/normal/930/E.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
inline int read()
{
int x;char c;
while((c=getchar())<'0'||c>'9');
for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
return x;
}
const int MOD=1e9+7;
struct mint{int x;mint(int x=0):x(x){}};
inline mint operator+ (mint a,mint b){return a.x+b.x<MOD?a.x+b... | ALGO | 0.999919 | 3.542441 |
a53de63e-05ac-496c-aace-0be914efb538 | joshbindels/AdventOfCode2020 | day03/p2.cpp | #include <iostream>
#include <fstream>
#include <vector>
using namespace std;
void printVector(const vector<vector<char> >* v)
{
for(const vector<char>& l: *v) {
for(const char& c: l) {
cout << c;
}
cout << endl;
}
}
int GetNumOfTrees(const vector<vector<char> >& v, int m... | ALGO | 0.999923 | 4.39417 |
441db138-706e-4a0a-8544-e08c9e6c8609 | oneapi-src/SYCLomatic | libc/src/math/generic/fmaximum_mag.cpp | #include "src/math/fmaximum_mag.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, fmaximum_mag, (double x, double y)) {
return fputil::fmaximum_mag(x, y);
}
} // namespace LIBC_N... | TOOL | 0.994183 | 6.409603 |
a8d8effa-faae-41b7-b9fe-59fd154c9ee1 | PRYNSHU/DSA_Practice | striver_AtoZ_sheet/rec3.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(int oc , int cc , vector<string> &ans , string s, int n){
if(oc == n && cc == n){
ans.push_back(s);
return;
}
//add open bracket
if(oc < n){
s += '(';
solve(oc +1 , cc , ans , ... | ALGO | 0.999022 | 4.443038 |
e2007741-3d82-4d8a-a9b3-dfb8cbd60ea8 | Morningstar618/programming_languages | C/data_structures/DSA/L1-20/array/maxMinArray.cpp | #include<iostream>
using namespace std;
void minMax(int arr[], int size) {
int maxi=INT32_MIN;
for (int i=0; i<size; i++) {
// if (arr[i] > max) max = arr[i];
maxi = max(maxi, arr[i]);
}
int mini=INT32_MAX;
for (int i=0; i<size; i++) {
// if (arr[i] < min) min = arr[i];
... | ALGO | 0.998776 | 4.521111 |
f4d2d41b-8aef-466a-8cc2-3a49787df179 | UtsavKadecha10/DSA | Lecture22/length_of_string.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
int lengthOf(char str[]){
int count = 0;
for(int i=0; str[i] != '\0'; i++){
count++;
}
return count;
}
int main()
{
char str[] = "Utsav";
cout<<lengthOf(str);
return 0;
}
| ALGO | 0.99575 | 3.809884 |
73f67e1f-1f15-4a56-835f-5ab1ce4b9f75 | mapcrafter/mapcrafter | src/mapcraftercore/mc/worldentities.cpp | #include "worldentities.h"
#include "../util/picojson.h"
namespace mapcrafter {
namespace mc {
/**
* Checks whether a line from the sign entity is in the new json format (>= mc 1.8).
* We assume a line is in the new format if it starts and ends with '"', '{'/'}'
* or if it is 'null'.
*/
bool isJSONLine(const std... | TOOL | 0.871999 | 6.98723 |
31312bf7-f6a8-4e99-9edb-a57eca23c74f | teche74/Daily_Practise | 1505-create-target-array-in-the-given-order/1505-create-target-array-in-the-given-order.cpp | class Solution {
public:
vector<int> createTargetArray(vector<int>& nums, vector<int>& index) {
int size = index.size();
vector<int>res;
for(int i =0;i < size;i++){
res.insert(res.begin() + index[i], nums[i]);
}
return res;
}
}; | ALGO | 0.999978 | 6.399521 |
56efb6a7-b5af-4fd0-9f09-b8539d76c92f | samarth015/DataStructures-Algorithms-Cpp | Data Structures/expression_tree.cpp | #ifndef SAMARTH_EXPRESSION_TREE
#define SAMARTH_EXPRESSION_TREE
#include <cmath>
#include <stack>
#include <utility>
#include <stdexcept>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <string_view>
namespace samarth {
class expr_tree
{
private:
class tree_node
{
p... | ALGO | 0.915832 | 5.753125 |
e10a9346-6053-4446-b760-c066851408ac | ishandutta2007/codeforces | nikolapesic2802/normal/118/E.cpp | #include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define dec(x, y) fixed << setprecision((y)) << (x)
#define xx first
#define yy second
#define srt(v) sort((v).begin(), (v).end())
#define srtr(v) sort((v).rbegin(), (v).rend())
#define pb push_back
#define popb pop_back
#define s... | ALGO | 0.999988 | 4.124868 |
da2d6dc2-5c70-4d3d-aa11-640ab2ff0f65 | nishtha-dev/DSA_Learning | recursion/taylorSeries.cpp | #include <iostream>
using namespace std;
int pow2(int a, int n)
{
if(n==0)
return 1;
int ans = pow2(a, n/2);
if(n%2==0)
{
return ans*ans;
}
else
{
return a*ans*ans;
}
}
int factorial(int n)
{
if(n>1)
{
return factorial(n-1)*n;
}
return 1;
}
... | ALGO | 0.999897 | 4.225429 |
e023aadd-b5f5-45cd-9ecd-b1a7c64043c2 | ayushichoudhary-19/DSA | 0199-binary-tree-right-side-view/0199-binary-tree-right-side-view.cpp | class Solution {
public:
vector<int> rightSideView(TreeNode* root) {
vector<int> result;
if (!root) return result;
queue<TreeNode*> q;
q.push(root);
while (!q.empty()) {
int levelSize = q.size();
int rightmostVal = 0;
for (int i = 0; i <... | ALGO | 0.999961 | 6.503878 |
578f2cad-1a05-4664-aa91-32d4acfcb7f1 | ishandutta2007/codeforces | qwqcorz/normal/1696/C.cpp | #include<bits/stdc++.h>
#define int long long
#define ll long long
using namespace std;
ll read(){static ll x;scanf("%lld",&x);return x;}
void write(ll x){printf("%lld",x);}
void print(ll x,char c='\n'){write(x),putchar(c);}
void work()
{
int n=read(),m=read();
vector<pair<int,int>>A,B;
for (int i=1;i<=n;i++)
{
... | ALGO | 0.999729 | 4.501907 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.