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 |
|---|---|---|---|---|---|---|
5d8c7407-40cb-40ad-a798-39974593f404 | garimachhikara128/DTU-2024-25-Even-DS-Sec3 | HeapDS/MinHeap.cpp | #include<iostream>
#include<queue>
using namespace std ;
class MinHeap
{
vector<int> data ;
public :
void add(int item)
{
data.push_back(item) ;
upheapify(data.size()-1) ;
}
void upheapify(int ci)
{
int pi = (ci-1)/2 ;
if(data[ci] < data[pi])
{
... | ALGO | 0.999965 | 3.647974 |
452da607-f5d1-40c3-9095-076b20afc6c0 | adrian-budau/work | Kattis/ACM-ICPC - World Finals 2013/Factors/main.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <limits>
using namespace std;
const long long kInfinite = numeric_limits<long long>::max();
vector<int> primes;
const int kMaxP = 65;
long long comb[kMaxP][kMaxP];
long long pows[kMaxP][kMaxP];
vector< pair<long long, long long> > n... | ALGO | 0.999873 | 4.074495 |
a9ed1a67-81e1-4010-b314-ec24c42d78e6 | Alokverma878/DSA | duplicate.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int main() {
vector<int> arr = {0,0,0,0,1, 2, 3, 4, 5, 2, 3, 6, 7, 3};
unordered_map<int, int> freqMap;
vector<int> duplicates;
for (int num : arr) {
freqMap[num]++;
}
for (auto& pair : freqMap) {
... | ALGO | 0.999559 | 4.900396 |
44335d52-d7bf-4dbe-be0a-c0c354ddb358 | pemmy/gporca | libgpopt/src/operators/CPhysicalSplit.cpp | #include "gpopt/operators/CPhysicalSplit.h"
#include "gpos/base.h"
#include "gpopt/base/CColRefSetIter.h"
#include "gpopt/base/CDistributionSpecAny.h"
#include "gpopt/base/CDistributionSpecHashed.h"
#include "gpopt/base/CDistributionSpecRandom.h"
#include "gpopt/base/CUtils.h"
#include "gpopt/operators/CExpressionHan... | TOOL | 0.962699 | 7.351841 |
a807687c-0759-4f41-9fa6-9a1c61b56e54 | shsy323102/C-Language-Programming | 首字母单词大写.cpp | #include<stdio.h>
int main()
{
char a[1000];
gets(a);
int i;
for(i=1;a[i]!='\0';i++)
{
if('a'<=a[0]&&a[0]<='z')
{
a[0]=a[0]-32;
}
if(a[i-1]==' '&&'a'<=a[i]&&a[i]<='z')
{
a[i]=a[i]-32;
}
}
puts(a);
}
| ALGO | 0.9996 | 3.308906 |
a6365e03-7934-4d58-bfe4-7292cc04e8b5 | MaTb3a/Leetcode | 0516-41-3223-minimum-length-of-string-after-operations/0516-41-3223-minimum-length-of-string-after-operations.cpp | class Solution {
public:
int minimumLength(string s) {
int mask1 = 0,mask2 = 0;
int removes = 0;
for(char ch : s){
if(!(mask1&(1<<(ch-'a'))))mask1|=(1<<(ch-'a'));
else if(!(mask2&(1<<(ch-'a'))))mask2|=(1<<(ch-'a'));
else
removes+=2,mask1&=~... | ALGO | 0.999878 | 5.635938 |
476a4858-e71e-4a1c-a151-13781b64d231 | chaerrad/baekjoon_algorithm | DP/11722(DP).cpp | #include <iostream>
using namespace std;
int N[1001];
int D[1001];
int main()
{
int num;
cin >> num;
for (int i = 1; i <= num; i++)
{
cin >> N[i];
}
for (int i = num; i > 0; i--)
{
D[i] = 1;
for (int j = num; j > i; j--)
{
if (N[i] > N[j] && D[i] <= D[j])
D[i] = D[j] + 1;
}
}
int result = 0;
... | ALGO | 0.999966 | 3.820588 |
3f5ee47e-8b90-455f-be95-585e15869a65 | Aman87099/Data-Structures-and-Algorithms-by-Aman | 0031-next-permutation/0031-next-permutation.cpp | #include<bits/stdc++.h>
class Solution {
public:
void nextPermutation(vector<int>& nums) {
int n = nums.size(),k,l;
for( k = n-2; k>=0; k--){
if(nums[k]<nums[k+1]){
break;
}
}
if(k<0){
reverse(nums.begin(), nums.end());
... | ALGO | 0.999978 | 5.083656 |
e1c78710-c104-43ad-b3c7-ca3cd6bd1f81 | invictus89/Algorithm | Part07_Advanced Brute_Force(Back_Tracking)/inequal.cpp | //문제 : inequal
//<>(부등호)를 입력받아 적용 가능한 숫자 출력
//방법1. 모든 경우를 다 배열에 넣고, 조건에 맞는 결과만 출력하기
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <vector>
using namespace std;
int K; //부등호 개수
char arrEqual[9]; //부등호 저장 배열
int arrNum[10]; //부등호에 맞는 입력 가능한 배열
bool check[10]; // 중복 제거를 위한 배열
vect... | ALGO | 0.999958 | 3.83095 |
a8c399cd-2021-4872-a22d-1d8aa86f0443 | CMU-BeanBurrito/comp-prog | AC/ABC405/C.cpp | /*
Author: BeanBurrito
*/
#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
#define MOD 1'000'000'007
#define divceil(n, m) (n+m-1)/m
int gcdExt(int a... | ALGO | 0.999882 | 3.83057 |
6cb9aa28-a4e1-4a12-8fd4-9c0efda13129 | IronD414/BOJ | 7576.토마토/7576.cpp | #include <iostream>
#include <queue>
using namespace std;
typedef struct{
int x;
int y;
}xy;
int M,N,s;
int **T;
queue<xy> Q;
// up, down, left, right
int dx[4] = {0, 0, -1, 1};
int dy[4] = {1, -1, 0, 0};
void bfs(){
int day = 0;
while (!Q.empty()){
xy root = Q.front();
Q.pop();
int x=root.x, y=root.y;
in... | ALGO | 0.999699 | 3.779096 |
3b44f692-525c-47cd-ae94-f26b79614933 | rishabh27goel/DSA-Extra-Questions | CSES Problem Set/Graph/High_Score.cpp | #include <iostream>
#include <vector>
#include <limits.h>
using namespace std;
#define ll long long int
ll findShortestDistance(int n, vector< vector<ll> > &edges) {
vector<ll> maxDistance(n, LLONG_MIN);
maxDistance[0] = 0;
for(int i = 1; i <= n - 1; i++) {
for(int j = 0; j < edges.size(); j++) {... | ALGO | 0.999961 | 4.625782 |
23d0acae-b9e5-483a-bd12-f3800f4458b8 | JstMonika/VC | Virtual Contest/World_Final_2007_Tokyo/pA.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
// template<typename T> using p = pair<T, T>;
template<typename T> using vec = vector<T>;
template<typename T> using deq = deque<T>;
#ifndef dbg
#define endl '\n'
#endif
#define yccc ios_base::sync_with_stdio(false), cin.tie(0)
#define al(a) a.begin... | ALGO | 0.999719 | 4.214565 |
bddea191-2566-4168-9fe6-13a4a7bc4067 | TheFenrisLycaon/DSA-C-- | cp/CodeForces/0700-0799/703A.cpp | #include <cstdio>
int main(){
long n; scanf("%ld\n", &n);
long long sumX(0), sumY(0);
while(n--){
long x, y; scanf("%ld %ld\n", &x, &y);
if(x > y){++sumX;}
else if(x < y){++sumY;}
}
if(sumX > sumY){puts("Mishka");}
else if(sumX < sumY){puts("Chris");}
else if(sumX ... | ALGO | 0.999836 | 3.665562 |
e9cab12b-0a85-4251-81ef-09792471784b | coolyuyuyu/leetcode | algorithm_2000-2999/2532-Time to Cross a Bridge/main.cpp | class Solution {
public:
int findCrossingTime(int n, int k, vector<vector<int>>& time) {
priority_queue<pair<int, int>> lftWait, rhtWait;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> lftWork, rhtWork;
for (int id = 0; id < k; ++id) {
lftWait.emplace(time[id][... | ALGO | 0.999921 | 5.841438 |
4b52011b-e5e1-4427-b475-1c6a7b1cf426 | H-Shen/MyCodeCollection | Kattis/ghostbusters3.cpp | // https://open.kattis.com/problems/ghostbusters3
#include <bits/extc++.h>
using namespace std;
using ll = long long;
constexpr ll MAXN = 1005;
constexpr ll MOD = 1e9+7;
ll fact[MAXN];
void exgcd(ll a, ll b, ll& x, ll& y) {
if (b == 0) {
x = 1; y = 0;
return;
}
exgcd(b, a % b, y, x);
... | ALGO | 0.999997 | 5.750298 |
06c5c649-3770-4767-964e-bfa43b74ba43 | doum1004/code_assessment | leetcode/leetcode_cpp/minimum-absolute-difference-in-bst.cpp | /*
https://leetcode.com/problems/minimum-absolute-difference-in-bst
Solution1. DFS. get sorted list from DFS
time: o(n)
space: o(n)
*/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr... | ALGO | 0.999989 | 6.630581 |
502e8d6f-3989-4dd2-a34c-310a011d16d2 | jtham1511/opencv | modules/imgproc/src/samplers.cpp | #include "precomp.hpp"
namespace cv
{
static const uchar*
adjustRect( const uchar* src, size_t src_step, int pix_size,
Size src_size, Size win_size,
Point ip, Rect* pRect )
{
Rect rect;
if( ip.x >= 0 )
{
src += ip.x*pix_size;
rect.x = 0;
}
else
{
... | ALGO | 0.990051 | 5.696206 |
7d17dceb-ace0-4840-9b70-f1065cf64919 | wzm9856/e-star | bx/src/os.cpp | #include <bx/string.h>
#include <bx/os.h>
#include <bx/uint32_t.h>
#if BX_CRT_MSVC
# include <direct.h>
#else
# include <unistd.h>
#endif // BX_CRT_MSVC
#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif // WIN32_LEAN_AND_MEAN
# include <windows.h>
# includ... | TOOL | 0.882387 | 5.909643 |
275aa931-aff1-48b7-a30c-8aa5fa391650 | ThoseBygones/ACM_Code | CodeForces Gym/2016-2017 ACM-ICPC Pacific Northwest Regional Contest (Div. 2)/Gym 101291D.cpp | //#pragma comment(linker,"/STACK:102400000,102400000")
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <ctime>
#include <numeric>
#include <vector>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <complex>
#in... | ALGO | 0.99989 | 3.147512 |
388f2e80-ec25-4698-b06c-14262ca47999 | cxy1997/SJTU-OnlineJudge | 1205.cpp | #include <iostream>
using namespace std;
int ack(int m,int n)
{
if (m==0) return (n+1);
if (n==0) return ack(m-1,1);
return ack(m-1,ack(m,n-1));
}
int main()
{
int m,n;
cin>>m>>n;
cout<<ack(m,n);
}
| ALGO | 0.999991 | 4.323406 |
8ce65042-70d3-4929-bb2e-5a3096796f96 | eaclix/DsaBasics | Number/Abundant.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cout<<"Enter the number: ";
cin>>n;
int sum = 0;
for(int i=1; i<n; i++){
if(n%i==0){
sum += i;
}
}
if(sum>n){
cout<<"It is abundant";
}
else cout<<"It is not abundant";
return 0... | ALGO | 0.999906 | 4.156977 |
3db98545-3eea-4450-bac1-62f112fd7d53 | C-2024-1-3/2401xikai-8209240128- | 实验四 - 3.cpp | #include<iostream>
using namespace std;
int main(){
bool L[100] = {false};
for(int student = 1;student <=100;student++){
for(int a = student - 1; a < 100; a += student){
L[a] =! L[a];
}
}
for(int i = 0; i < 100 ; i++){
if(L[i]){
cout << i + 1 << " ";
}
}
system("pause");
return 0;
}
| ALGO | 0.999034 | 3.555976 |
7701c9e7-60d0-4b91-b42a-fd34f134a8c1 | 123shanawaz/Striver-SDE-SHEET- | Day2/Rightview.cpp | class Solution {
public:
void Rview(TreeNode *root,set<int>&s,vector<int>&ans,int currlavel){
if(root==NULL){
return ;
}
if(s.find(currlavel)==s.end()){
s.insert(currlavel);
ans.push_back(root->val);
}
Rview(root->right,s,ans,currlavel+1);
Rview(root->left,s,ans,currl... | ALGO | 0.999938 | 5.992328 |
057e8323-ac90-4f2c-a963-60f7a42d606b | inshayaqoob/AI-Code-Summarize | transcoder/transcoder/data/evaluation/geeks_for_geeks_successful_test_scripts/cpp/SUM_MATRIX_ELEMENT_ABSOLUTE_DIFFERENCE_ROW_COLUMN_NUMBERS.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( int n ) {
int arr [ n ] [ n ];
for ( int i = 0;
i < n;
i ++ ) for ( int j = 0;
j < n;
j ++ ) arr [ i ] [ j ] = abs ( i - j );
int sum ... | ALGO | 0.996159 | 4.845036 |
aaf1836d-951a-44cd-bfbd-77f97446bd5a | keelanstuart/Celerity | Source/C3Utility.cpp | #include "pch.h"
#include <C3Utility.h>
#include <C3Positionable.h>
#include <filesystem>
using namespace c3;
void util::ComputeFinalTransform(Object *proot, glm::fmat4x4 *pmat)
{
assert(pmat);
if (!proot)
return;
static glm::fmat4x4 imat = glm::identity<glm::fmat4x4>();
Positionable *ppos = (Positionable *)... | TOOL | 0.918357 | 6.492734 |
63bcf998-7934-4cf6-a8c3-19cb25c3579a | arkadiusz-papaj/HackerRank | problem-solving/data-structures/linked-lists/compare-two-linked-lists.cpp | // Complete the compare_lists function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
[[nodiscard]] auto compare_lists(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) -> bool {
while (head1 != nullptr && head2 != nullptr) {
... | ALGO | 0.982272 | 5.259035 |
368dc960-54f2-4ef2-96ff-30bd5141f2e7 | Soumik-Paul/Samsung-Pre-employment-Coding-Test | Cycle_Detection_Directed_Graph.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> adj[20];
int vis[20];
int path[20];
bool dfs(int node)
{
vis[node]=1;
path[node]=1;
for(auto it: adj[node])
{
//for non visited node
if(!vis[it])
{
bool check = dfs(it);
if(check)
return true;
}
//if node is visited but it is in same pat... | ALGO | 0.999988 | 5.016853 |
5228f03f-9e70-454c-9545-e2789d6907cc | joshua-lauwrich98/my-uva-submission | C,C++/p10887.cpp | #include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
using namespace std;
int main () {
int kasus, banyak, banyak1;
cin >> kasus;
for (int i = 0; i < kasus; i++) {
vector<string> data;
vector<string> data1;
set<string> res;
data.cl... | ALGO | 0.996866 | 3.595567 |
77636543-f413-4311-a999-cdec28b9328e | JarkkoPFC/mini_sxp | sxp_extlibs/nvtexturetools/src/nvthread/ParallelFor.cpp | // This code is in the public domain -- Ignacio Castao <<EMAIL>>
#include "ParallelFor.h"
#include "Thread.h"
#include "Atomic.h"
#include "ThreadPool.h"
#include "nvcore/Utils.h" // toI32
using namespace nv;
#define ENABLE_PARALLEL_FOR 1
static void worker(void * arg) {
ParallelFor * owner = (ParallelFor *)ar... | TOOL | 0.949552 | 5.972511 |
060d587b-5f9f-4df5-9c69-9087885196a1 | hktamzid/Cpp-Basic-to-advance | if_else.cpp | #include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int num;
cout << "Enter a number: ";
cin >> num;
if(num>0)
{
cout << "Positive number";
}
else if(num<0)
{
cout << "Negative number";
}
else
{
cout << "Zero";
}
return 0;
... | ALGO | 0.976182 | 3.305508 |
d78414e4-c8f5-4f6e-b339-e862bd0b372d | LearnerShreya/Strivers-A2Z-DSA | Step 1 Learn the basics/Lec 1 Things to Know in C++JavaPython or any language/9_while_loop.cpp | #include<iostream>
using namespace std;
int main() {
int x = 1;
while(x<=5){
cout<<"Striver "<<x<<endl;
x+=1;
}
} | ALGO | 0.9718 | 3.273624 |
7d402bc2-ffa8-4ba0-b26f-9f6a9a81dac8 | Mrsandman327/windows-book-code-c- | 从算法到程序(第2版)/Chapter05/MST-Prim.cpp | #include <iostream>
using namespace std;
#define NUM 1000
#define maxint 10000000
void Prim(int n, int c[][NUM])
{
int lowcost[NUM];
int closest[NUM];
bool s[NUM] = {false};
for (int i = 1; i <= n; i++) {
lowcost[i] = c[1][i];
closest[i] = 1;
s[i] = false;
}
s[1] = t... | ALGO | 0.99999 | 4.01908 |
5688a7db-e346-49ce-8d59-53a34f14db43 | fithisux/FSL | extras/include/boost/libs/dynamic_bitset/example/example3.cpp | #include "boost/dynamic_bitset.hpp"
#include <ostream>
#include <iostream>
int main()
{
boost::dynamic_bitset<> mask(12, 2730ul);
std::cout << "mask = " << mask << std::endl;
boost::dynamic_bitset<> x;
std::cout << "x.size() = " << x.size() << std::endl;
std::cout << "Enter a bitset in binar... | TOOL | 0.90867 | 5.873268 |
6d39556f-68bb-47bd-8c2f-da4cf5cab2e9 | fgwu/leetcode-cpp | p010-regular-expression-matching.cpp | class Solution {
public:
/*20171118 1728*/
/*AC 1759*/
bool isMatch(string s, string p) {
if (!s.size() && !p.size()) return true;
if (!p.size()) return false;
if (p.size() > 1 && p[1] == '*') {
if (p[0] == '.') {
for (int i = 0; i <= s.size(); i++) {
if (isMatch(s.substr(i), p.substr(2))) r... | ALGO | 0.999822 | 4.766857 |
b5d1e9f2-8034-4057-90da-a3e2bef96a45 | YongHoonJJo/BOJ | 2577.cpp | #include <stdio.h>
int cnt[10];
int main()
{
int i, m;
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
m = a*b*c;
while(m) {
cnt[m%10]++;
m /= 10;
}
for(i=0; i<10; i++)
printf("%d\n", cnt[i]);
return 0;
}
| ALGO | 0.999916 | 3.659956 |
93d341c2-9229-4479-82a6-8489bc443636 | Harshvardhan6367/C-_DSA | 23_Binary_Search_Tree/03_Check_BST.cpp | #include<iostream>
#include<vector>
using namespace std;
class Node
{
public:
int data;
Node * left, *right;
Node(int value)
{
data = value;
left = right = NULL;
}
};
class Solution {
public:
// Function to check whether a Binary Tree is BST or not.
// Methord1
... | ALGO | 0.99998 | 6.073071 |
244d1a81-b48f-4450-b54c-870bfc809468 | Harshit1123/Codeforces | Solutions/26/734A_Anton and Danik.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n,t=0,p=0;
string s;
cin>>n;
cin>>s;
for (int i = 0; i < s.size(); i++) {
if(s[i]=='A')
p++;
else if(s[i]=='D')
t++;
}
if(p>t)
cout<<"Anton";
else if(t>p)
cout<<"Danik";
else if(t==p)
cout<<"Friendship";
return 0;
}
| ALGO | 0.999982 | 3.921613 |
2cfa07f6-7b51-412c-8c3d-aa99a256bc34 | BerlinUnited/NaoTH | NaoTHSoccer/Source/Cognition/Modules/VisualCortex/BallDetector/CNNBallDetector.cpp | #include "CNNBallDetector.h"
#include "Tools/CameraGeometry.h"
#include "Tools/PatchWork.h"
#include "Tools/BlackSpotExtractor.h"
#include "Classifier/Fy1500_Conf.h"
#include "Classifier/FrugallyDeep.h"
#include "Classifier/mbc_36k.h"
#include "Classifier/mbc_36ksm.h"
#include "Classifier/mbc_36ksm_finetuned.h"
#incl... | ALGO | 0.966608 | 5.585586 |
1f7cb299-ecaf-4b51-a1cb-3aecb85fc53c | sarvex/leetcode-nativescript | solution/0700-0799/0708.Insert into a Sorted Circular Linked List/Solution.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* next;
Node() {}
Node(int _val) {
val = _val;
next = NULL;
}
Node(int _val, Node* _next) {
val = _val;
next = _next;
}
};
*/
class Solution {
public:
Node* insert(Node* head, int insertVal... | ALGO | 0.999995 | 5.941455 |
4fec1e42-ea41-4fb8-b06d-2f194ba65b86 | setak482/2022_BOJ_solved | Gold/G3/1516 게임 개발.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> graph[501];
int linked[501];
int tms[501], dp[501];
int vertex, edge;
int main(){
cin >> vertex;
queue<int> q;
for(int i = 1; i <= vertex; i++){
cin >> tms[i];
dp[i] = tms[i];
while(1){
int b; cin >> b;
... | ALGO | 0.999954 | 4.100451 |
9a88cdd8-9011-4a9f-b031-f02154ec0c9c | issyu39/competitive-programming | AtCoder/2021/zone2021/zone2021_d.cpp | #include<iostream>
#include <string>
using namespace std;
string dedupe(std::string ans) {
for (int i=0; i<ans.length()-1; i++) {
// 同じ文字が2つ連続で並んでいたら、その2文字を取り除く
if (ans[i] == ans[i+1]) {
ans.erase(i, 2);
break;
}
}
return ans;
}
int main()
{
// 入力を変数に格... | ALGO | 0.999944 | 5.027551 |
16bdb735-741c-484c-be60-5db927ae7096 | ryo-manba/AtCoder | ABC/ABC210/c/main.cpp | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct fast_ios { fast_ios(){ cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); }; } fast_ios_;
const int INF = (int)1e9;
const ll INFL = (ll)1e18;... | ALGO | 0.999949 | 3.829855 |
8bf32b12-198f-46c5-bc10-487dc1c39ef0 | asrjy/dsa | smurf/codeforces/165A.cpp | #include<iostream>
using namespace std;
int main(){
int n, ans(0), a, b, lmin(1001), lmax(0), rmin(1001), rmax(0), i;
cin >> n;
int ln[1001], rn[1001], nums[n][2];
for(i =0; i < n; i++){
cin >> a >> b;
if(a > lmax) lmax = a;
if(a < lmin) lmin = a;
if(b > rmax) rmax = b;
if(b < rmin) rmin = b;
ln[a] = 1... | ALGO | 0.999883 | 3.75849 |
0ff19650-0902-4862-b588-ff6e7a1dd6bb | xjsXjtu/leetcode | LongestSubStr/LongestSubStr/main.cpp | #include <string>
#include <map>
#include <iostream>
using namespace std;
class Solution {
public:
int lengthOfLongestSubstring(string s)
{
if(s.size() == 0)
{
return 0;
}
int maxlen = 1;
map<char, int> mp;
//printf("map['a'] = %d\n", mp['a']); // 0 ... | ALGO | 0.999837 | 5.372491 |
3d1d5543-6ad5-4c2b-8cc8-e9d658f7064d | TheSebgon/Kattis | Grading/Grading.cpp | #include <iostream>
#include <string>
int main()
{
int grades[5];
int score;
for (int i = 0; i < 5; i++)
std::cin >> grades[i];
std::cin >> score;
if (score >= grades[0])
std::cout << "A";
else if (score >= grades[1])
std::cout << "B";
else if (score >= grades[2])
std::cout << "C";
else if (score >=... | ALGO | 0.998497 | 3.807958 |
a5d82e86-c2b0-42c8-949b-e974172037d7 | ZmnSCPxj/clboss | tests/boss/test_channelcreator_planner.cpp | #undef NDEBUG
#include"Boss/Mod/ChannelCreator/Planner.hpp"
#include"Ev/Io.hpp"
#include"Ev/start.hpp"
#include"Ln/Amount.hpp"
#include"Ln/NodeId.hpp"
#include<algorithm>
#include<assert.h>
#include<iterator>
#include<map>
namespace {
auto A = Ln::NodeId("02000000000000000000000000000000000000000000000000000000000000... | TEST | 0.860926 | 4.491511 |
808713af-d202-4031-8463-8ac42fed487e | rehanashraf/CodingPractice | C++/src/linkedlist/alllinkedlist.cpp | /*
* alllinkedlist.cpp
*
* Created on: Sep 30, 2020
* Author: rehanashraf
*/
#include <stdio.h>
#include "print.h"
/*
Reverse Linked List
Delete Node from Linked List
Detect loop in linked list
Find/Insert middle of linked list
Check where linked list is even or odd without using counter
Get k node from the... | ALGO | 0.969697 | 4.232623 |
5e6d8da6-e944-4bc7-9941-24e44cb9e133 | 594422814/UDT | tracker/UDT+/external_libs/matconvnet/matlab/src/bits/impl/roipooling_cpu.cpp | // @file roipooling_cpu.cpp
// @brief Pooling block implementation (CPU)
// @author Hakan Bilen
// @author Abishek Dutta
// @author Andrea Vedaldi
#include "matrix.h"
#include "../data.hpp"
#include "roipooling.hpp"
#include <limits>
#include <algorithm>
#include <cmath>
using std::max ;
using std::min ;
/* -------... | DATA | 0.996744 | 7.670905 |
620a24a2-1339-483c-8790-46e7b1cdca08 | umarfaruk2/code_forces | basic_problem/consecutive_sum_riddle.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for(int i = 0; i < n; i++) {
ll x;
cin >> x;
}
return 0;
}
| ALGO | 0.996067 | 3.506042 |
e1950a0d-5d07-43ae-bf52-0bdb4065ecbb | sunnnyy04/competitive_programming | A_To_Zero.cpp | #include <bits/stdc++.h>
using namespace std;
//--------------------------------------------------------------//
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<long long> vl;
typedef vector<vector<long long> > vvl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
t... | ALGO | 0.999892 | 3.720206 |
ac12b077-1622-48cc-acc6-53c9920a19cc | kraverken/DSA | Search&Sort/BinarySearch/Sqrt.cpp | // To find the sqrt of a num using binary search
#include <iostream>
using namespace std;
long long int sqrtBinSearchInteger(int n)
{
int s = 0;
int e = n - 1;
long long int mid = (s + e) / 2;
long long int ans = -1;
while (s <= e)
{
long long int square = mid * mid;
if (square =... | ALGO | 0.999989 | 4.31664 |
ba25ecab-4d63-480b-936b-670cf1442440 | darrylteo/cp4-solutions | 4 Graph/1. Graph traversal/b. Flood Fill, Easier/11953 - Battleships.cpp | #include <bits/stdc++.h>
using namespace std;
char line[105], grid[105][105];
int R, C, RC;
int dr[] = {1, 0, -1, 0,};
int dc[] = {0, 1, 0, -1};
void floodfill(int r, int c) {
if ((r < 0) || (r >= R) || (c < 0) || (c >= C)) return; // outside grid
if (grid[r][c] == '.') return; // does not ha... | ALGO | 0.998789 | 4.444196 |
7505048e-bf0a-4700-876a-8fbe93c577f8 | SadmanHafizShuvo21/Schaum-s_Outline_of_Theory_and_Problems_of_Data_Structures_Seymour | Chapter 8/Graph_Representation.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int>v[100001];
int main(){
int nodes,edges;
cin>>nodes>>edges;
while(edges--){
int x,y;
cin>>x>>y;
v[x].push_back(y);
v[y].push_back(x);
}
for(int i=1;i<=nodes;i++){
cout<<i<<" ";
for(int j=0;... | ALGO | 0.999938 | 4.515454 |
926a6088-449d-4f80-887f-86eeedfc04a7 | Congee/leetcode | src/1674.minimum-moves-to-make-array-complementary.cpp | #ifdef __LOCAL__
#include <leetcode.h>
#endif
class Solution {
public:
int minMoves(vector<int>& nums, int limit) {
// [4,2,3,1] 4 -> 0
// [100,0] 10 -> 2
// [100,0] 100 -> 1
// [1,100,0,1]
// [1,2,4,3] limit = 4 range=[2, 8]
// [1,3] -> 1 + 1 <= T < 4
// 4 < T < 3+... | ALGO | 0.999923 | 5.768025 |
39eb49a1-9362-4db5-8394-e6c38a97b804 | MAKIYAMA-ma/AtCoder | tessoku/C12.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#if 1
using mint = modint1000000007;
#else
using mint = modint998244353;
#endif
using ll = long long;
using ull = unsigned long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = v... | ALGO | 0.999971 | 4.112259 |
00c3a017-2ced-4d08-8cdf-731d6806288c | xingkongtianyu/MyFiles | 数据结构与算法/数据结构代码(高一凡)含源码/数据结构代码(高一凡)/BC/CH3/Bo3-6.cpp | // bo3-6.cpp õĻʵ(洢ṹc3-2.h)Ļ(9)
typedef QElemType ElemType;
#define LinkList QueuePtr // 嵥Ӧеͬ
#define LNode QNode
#include"bo2-2.cpp" // Ļ
void InitQueue(LinkQueue &Q)
{ // һնQ
InitList(Q.front); // õĻ
Q.rear=Q.front;
}
void DestroyQueue(LinkQueue &Q)
{ // ٶQ(ۿշ)
DestroyList(Q.front);
Q.rear=Q.fro... | TOOL | 0.941376 | 3.992141 |
830208ff-5915-4632-b8f5-2c5a2ca66525 | jaimin1618/data_structures_and_algorithms | important_algorithms/heap/heap_parent_problems/7_frquency_sort.cpp | #include<bits/stdc++.h>
using namespace std;
using pi = pair<int, int>;
/**
* This question is interesting, because.
* Here we need to understand how we can implement Heap here
*
* solution is easy,
* 1st make element => frequency MAP
* 1 => 3
* 2 => 2
* 3 => 1
* 4 => 1
*
* prioritize frequency,
* usi... | ALGO | 0.999993 | 5.32895 |
150554a1-d414-49e6-a4b3-36598b288ce0 | raincross7/code-similarity | codes/train_code/problem013/problem013_261.cpp | #include <iostream>
#include <vector>
#include <utility>
#include <queue>
#define llint long long
using namespace std;
llint N, M;
vector<llint> G[100005];
vector< pair<bool, llint> > cmp;
bool used[100005];
int color[100005];
bool check(int v)
{
queue<int> Q;
Q.push(v);
color[v] = 1;
int u;
while(Q.size()){
... | ALGO | 0.999823 | 5.126473 |
3d8b3cbb-fffe-4f75-bf34-a2d77e13433c | Amdev-5/Leetcode-Algorithmic-Problems | 802-find-eventual-safe-states/802-find-eventual-safe-states.cpp | class Solution {
public:
vector<int> eventualSafeNodes(vector<vector<int>>& graph) {
int n = graph.size();
vector<int> adj[n];
vector<int> res;
vector<int> indegree(n,0);
for(int i = 0;i<graph.size();i++)
{
indegree[i]+= graph[i].size();
for(in... | ALGO | 0.999997 | 5.894651 |
6f871064-c1eb-444e-b26d-a676405c5654 | cafenoctua/at-corder | contest/AGC/47/A.cpp | #include <bits/stdc++.h>
using namespace std;
using pll = pair<long long, long long>;
const int N = 2e5 + 10;
const int L = 19;
int n, dp[L][L];
long long a[N];
long long gcd(long long a, long long b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
int cntFact(long long x, long long d) {
int ans = 0;
while... | ALGO | 0.997386 | 3.912025 |
8c51716c-4a83-4ad0-a05a-2c23e57e0e11 | brightwellt/CarND-Path-Planning-Project | src/Eigen-3.3/bench/sparse_lu.cpp |
// g++ -I.. sparse_lu.cpp -O3 -g0 -I /usr/include/superlu/ -lsuperlu -lgfortran -DSIZE=1000 -DDENSITY=.05 && ./a.out
#define EIGEN_SUPERLU_SUPPORT
#define EIGEN_UMFPACK_SUPPORT
#include <Eigen/Sparse>
#define NOGMM
#define NOMTL
#ifndef SIZE
#define SIZE 10
#endif
#ifndef DENSITY
#define DENSITY 0.01
#endif
#ifnd... | ALGO | 0.996381 | 4.187482 |
5c0a9551-a1e3-481b-87a9-65fd3a8407bb | Bingurrr/algorithm_pratice | 프로그래머스/unrated/152995. 인사고과/인사고과.cpp | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<pair<int, int>> s;
bool cmp(vector<int> a, vector<int> b){
if(a[0]+a[1] != b[0]+b[1])
return a[0]+a[1] > b[0]+b[1];
else
return abs(a[0]-a[1]) < abs(b[0]-b[1]);
}
int solution(vector<vec... | ALGO | 0.999933 | 4.624115 |
59aff9a7-d899-45d5-ac51-2ddaeef91763 | GOOTEAKIM/algo | C++/Cpp_Baekjoon/Cpp_Baekjoon/b_18232.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int n, m;
vector<vector<int>> alis;
vector<bool> visited;
int ans = 0;
void bfs(int start, int finish) {
queue<pair<int, int>> q; // ġ, ð
visited[start] = true;
q.push({ start, ans });
while (!q.empty()) {
... | ALGO | 0.999972 | 4.025332 |
51a27bd7-c92c-4d43-9e9b-89c9193ddb66 | ishandutta2007/codeforces | kewth/normal/1284/C.cpp | #if 0
2020.01.04
l x x - l + 1 x
n l n - l + 1
l! (n - l)!
l, x O(n^2) l x
l x (n - l + 1)
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)
typedef long long ll;
struct {
inline operator int () { int x; return scanf("%d", &x), x; }
inline operator l... | ALGO | 0.999991 | 4.248452 |
c4b896a2-7e0d-4f17-9bbb-869a0e2b255c | google/monster-mash | third_party/libigl/include/igl/readDMAT.cpp | #include "verbose.h"
#include <cstdio>
#include <iostream>
#include <cassert>
#include <memory>
// Static helper method reads the first to elements in the given file
// Inputs:
// fp file pointer of .dmat file that was just opened
// Outputs:
// num_rows number of rows
// num_cols number of columns
// Returns
... | TOOL | 0.872063 | 5.958801 |
2c82bb10-c31c-41b0-afe5-019a13af2907 | haoel/leetcode | algorithms/cpp/h-Index/h-Index.II.cpp | // Source : https://leetcode.com/problems/h-index-ii/
// Author : Hao Chen
// Date : 2015-11-08
/***************************************************************************************
*
* Follow up for H-Index: What if the citations array is sorted in ascending order?
* Could you optimize your algorithm?
* ... | ALGO | 0.999966 | 6.337637 |
2c44d354-fbdf-4889-be2d-a82999c26cd9 | DPD85/LLVM-clang-parser | lib/CodeGen/RegAllocBasic.cpp | #include "llvm/CodeGen/Passes.h"
#include "AllocationOrder.h"
#include "LiveDebugVariables.h"
#include "RegAllocBase.h"
#include "Spiller.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/CalcSpillWeights.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/LiveRangeEdit.h"
#include... | ALGO | 0.91492 | 7.853822 |
36e7c073-c77c-4e12-945a-f8e49d8d6263 | lip6/Louvain-BinaryBuild | louvain-generic/src/condora.cpp | #include "condora.h"
using namespace std;
CondorA::CondorA(Graph & gr, long double sum):Quality(gr,"A-weighted Condorcet"),sum_se(sum) {
n2c.resize(size);
in.resize(size);
// initialization
for (int i=0 ; i<size ; i++) {
n2c[i] = i;
in[i] = g.nb_selfloops(i);
}
}
CondorA::~CondorA() {
in.clea... | ALGO | 0.998033 | 4.666916 |
fb271c7f-f83c-412c-b516-5a4bf9ff2eb8 | ishandutta2007/codeforces | burnoutag7/normal/543/C.cpp | #pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
int n,m;
char s[20][21];
int a[20][20];
int g[20][20],cost[20][20];
int dp[1<<20];
int main(){
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)scanf("%s",s[i]);
for(int i=0;i<n;i++)for(int j=0;j<m;j++)scanf("%d",a[i]+j);
for(int i=0;i<n;i+... | ALGO | 0.999893 | 3.794113 |
0e072972-c43f-49fd-bd12-7a0ad285cea0 | bennettliu/fluid | deps/libigl/include/igl/trackball.cpp | #include "EPS.h"
#include "dot.h"
#include "cross.h"
#include "axis_angle_to_quat.h"
#include "quat_mult.h"
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <iostream>
// Utility IGL_INLINE functions
template <typename Q_type>
static IGL_INLINE Q_type _QuatD(double w, double h)
{
... | ALGO | 0.903066 | 5.687743 |
5e60dcb1-9b8e-4e76-b4b6-fff8a364c851 | taleingar/meta | eigen3.2.9/doc/examples/tut_matrix_resize.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
MatrixXd m(2,5);
m.resize(4,3);
std::cout << "The matrix m is of size "
<< m.rows() << "x" << m.cols() << std::endl;
std::cout << "It has " << m.size() << " coefficients" << std::endl;
VectorXd v(2);
v.resize(5);
... | ALGO | 0.968686 | 3.882785 |
cc580f2b-8e80-4a84-b091-9cbfe49451eb | sarvex/solution-cpp | 0293.flip_game.cpp | class Solution {
public:
vector<string> generatePossibleNextMoves(string currentState) {
vector<string> ans;
for (int i = 0; i < currentState.size() - 1; ++i) {
if (currentState[i] == '+' and currentState[i + 1] == '+') {
currentState[i] = '-';
currentStat... | ALGO | 0.999756 | 5.578686 |
de56698c-9f06-4e94-bad6-100fb8617d8f | Kakoli333/phitron | week 5/day 1/day 5/first_search.cpp | //Hare Krushn//
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n;
cin>>n;
vector<ll>v(n);
for(ll i=0; i<n; i++)
{
cin>>v[i];
}
s... | ALGO | 0.999986 | 4.337512 |
2180307e-3ca8-448e-b36a-5ebf1ad13c41 | AayushPratapBansal/DSA-QUESTION | 202-happy-number/happy-number.cpp | class Solution {
public:
int solve(int digit){
int sum=0;
while(digit>0){
int k=digit%10;
sum+=k*k;
digit=digit/10;
}
return sum;
}
bool isHappy(int n) {
unordered_map<int,int>map;
while(n!=1&&map.find(n)==map.end()){
... | ALGO | 0.999988 | 6.372579 |
ac9ff0b5-cad4-45e9-8c45-93fcf94abbc0 | openu-cs-degree/20407-Data-Structures-and-Introduction-to-Algorithms | src/main.cpp | /**
@file main.cpp
@author Yehonatan Simian
@date June 2024
\verbatim
+-----------------------------------------------------------------------------------+
| 20407 - Data Structures - Maman 13 |
| ... | ALGO | 0.920398 | 5.560627 |
13136993-06f9-402f-8492-4f7a5a18a4ba | ashishranjan738/Competitive-Programming | c++/interviewbit/Hashing/Largest Continuous Sequence Zero Sum.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<int> Solution::lszero(vector<int> &A);
};
// Find the largest continuous sequence in a array which sums to zero.
// Example:
// Input: {1 ,2 ,-2 ,4 ,-4}
// Output: {2 ,-2 ,4 ,-4}
// NOTE : If there are multiple correct answers, ret... | ALGO | 0.999952 | 5.082793 |
e5e38f39-15d1-4cbf-a0d1-5c00e0695e57 | kndtty/ProCon | AtCoder/abc/098/abc098_b.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
using namespace std;
typedef long long ll;
long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}
int main() {
int N; cin >> N;
string S; cin >>... | ALGO | 0.999949 | 4.127058 |
57cf31aa-363a-4f98-a42f-3067432e3803 | aaboshaisha/Cpp | 10_recursion/easy_to_medium/power_func.cpp | #include <iostream>
using namespace std;
/*
There was a bug in this code where I had the base case be p = 1 returing >> value.
*/
int my_pow(int value, int p = 2)
{
if(p == 0)
return 1;
return value * my_pow(value, --p);
}
int main()
{
int value;
int p;
cin >> value >> p;
cout << my_pow... | ALGO | 0.999989 | 4.699846 |
52935b61-d207-4390-adbb-2f462a322211 | tarek-adam/runtrackCPP | jour02/job14.cpp | #include <iostream>
#include <cmath>
#include <stdio.h>
#include <math.h>
using namespace std;
int main(){
int ArmNr, ArmNrA=0, ArmNrB=0, ArmNrC=0;
int A = 0, B = 0, C = 0;
cout << "Enter a number: "<< endl;
cin >> ArmstrongNr;
if( ArmstrongNr % 100> 1){
A = ArmstrongNr % 10... | ALGO | 0.99953 | 4.018829 |
38d42493-76c7-457c-8f7f-cca489d0258f | raincross7/code-similarity | codes/train_code/problem387/problem387_160.cpp | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef... | ALGO | 0.999989 | 4.669982 |
62601a37-52ae-4c76-afb4-1c26d56c7cbc | Algorithms-and-Data-Structures-2022/cpp-basics-assignment-BulatSabirzyanov | main.cpp | #include <iostream>
#include "assignment/code.hpp"
using namespace std;
using namespace assignment;
int main() {
int task1=assignment::squared_diff(3,5);
cout<<task1;
int n;
cin>>n;
int mass[n];
int* point_on_mass = &mass[0];
for(int j = 0 ; j<n;j++)
{
cin>>mass[j];
}
int task5=assignment::a... | ALGO | 0.995193 | 3.738081 |
d057f06d-4eea-465f-a03b-adec7fa33e3b | chauhansatyam3112/DSA-problems | 3121-count-the-number-of-special-characters-ii/3121-count-the-number-of-special-characters-ii.cpp | class Solution {
public:
int numberOfSpecialChars(string word) {
multimap<char, pair<int, bool>> mp;
for(int i = 0; i < word.length(); i++) {
mp.insert({word[i], {i, false}});
}
vector<int> v(26, 0);
for(auto it = mp.begin(); it != mp.end(); ++it... | ALGO | 0.999664 | 5.571034 |
9fd96fc9-8e28-466d-b59a-2f75c98e10a1 | Ollsoft-ai/fleet-manager | CarAlgo/TreeNode.cpp | #include "TreeNode.h"
#include <algorithm>
TreeNode::TreeNode(const std::string& nodeName, const float Nodeweight)
: name(nodeName), weight(Nodeweight) {}
std::vector<std::shared_ptr<TreeNode>> getChildren(std::shared_ptr<TreeNode> root) {
return root->children;
}
void TreeNode::addChild(std::shared_ptr<Tre... | ALGO | 0.975357 | 5.391919 |
dd54731b-c296-4ae3-834e-5205746eb3f2 | Patrick360X/CPP_Codes | 1. Arrays and Sorting/Matrix_Search.cpp | #include<iostream>
using namespace std;
int main() {
int n,m;
cin >> n >> m;
int target;
cin>>target;
int mat[n][m];
cout<<"Enter Matrix Elements:"<<endl;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cin>> mat[i][j];
}
... | ALGO | 0.999949 | 4.22525 |
9036fdc6-b363-44b1-9822-2a1abeecfacb | zaalang/zacc | src/lifetime.cpp | #include "lifetime.h"
#include "lower.h"
#include "diag.h"
#include <deque>
#include <iostream>
using namespace std;
namespace
{
enum State
{
ok,
dangling,
consumed,
poisoned,
};
struct Context
{
Diag &diag;
struct Storage
{
bool live = false;
bool consumed = false;... | TOOL | 0.917014 | 5.582998 |
b841b8bd-d6e2-42c8-b7af-696170b0da4d | Ajeetsoni2002/Leetcode-question-practice | 1765. Map of Highest Peak.cpp | class Solution {
public:
vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {
constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
const int m = isWater.size();
const int n = isWater[0].size();
vector<vector<int>> ans(m, vector<int>(n, -1));
queue<pair<int, int>> q;
for ... | ALGO | 0.99999 | 6.707199 |
8a21f5de-624a-4e8f-a81d-fab2ff10d3e1 | Gallasko/GameOff | import/taskflow-3.6.0/benchmarks/graph_traversal/omp.cpp | #include <iostream>
#include <chrono>
#include <omp.h>
#include "levelgraph.hpp"
void traverse_regular_graph_omp(LevelGraph& graph, unsigned num_threads){
omp_set_num_threads(num_threads);
#pragma omp parallel
{
#pragma omp single
{
for(size_t l=0; l<graph.level(); l++){
for(size_t i=0; ... | ALGO | 0.998788 | 6.391327 |
1fa2542c-b9ab-46b9-b7a0-615270fb97c8 | zhengzp2019/algorithm | CCF/201909-1.cpp | #include<iostream>
using namespace std;
int main()
{
int have = 0, cnt_have, cnt_lost = 0, l, max_lost = 0, lable = 0;
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
cin >> cnt_have;
cnt_lost = 0;
for (int j = 1; j <= m;j++)
{
cin >> l;
... | ALGO | 0.999914 | 3.180703 |
e9f8d948-3a88-4919-8dc2-67355d38e5bb | Nithin-Peter-Jesuraj-12/C-CPP | TRIANGLE.CPP | #include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int a,b,c;
printf("Enter the sides of the triangle \n");
scanf("%d %d %d",&a,&b,&c);
if(((a+b)>c)&&((a+c)>b)&&((c+b)>a))
{
if(a==b && b==c && c==a)
printf("Equilateral Triangle \n");
else if((a==b&&b!=c)||(b==c&&c!=a)||(c==a&&a!=b))
printf("Isoceles ... | ALGO | 0.999599 | 3.527851 |
2ef8d7fc-3ee3-4e50-bc7a-6439310218d7 | caiji853/leetcode | erfen.cpp | //
// Created by niuyb on 2021/4/26.
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=110,inf=0x3f3f3f3f;
ll n,a[N],ans=0;
bool use[N];
unordered_map<ll,bool>vis;
void dfs(ll x)
{
for(ll i=1;i<=n;i++)
{
if(!use[i])
{
use[i]=1;
// 加
... | ALGO | 0.999839 | 3.407429 |
8d43574e-1a56-4b6b-9fc5-9b28c55d2975 | AncungAulia/TLX-TOKI-Solution | angka_tahun_baru.cpp | #include<iostream>
using namespace std;
int main(){
int N;
cin >> N;
if(N < 7 && N > 1){
bool temp = true;
for(int i = 2; i*i <= N; i++){
if(N % i == 0){
temp = false;
break;
}
}
if(temp == true){
... | ALGO | 0.999966 | 4.299834 |
c49f86ac-d74a-46a3-a4c7-b7aa7e654eb9 | ishandutta2007/codeforces | alex_wei/normal/37/A.cpp | #include<bits/stdc++.h>
using namespace std;
int n,a,m,t[1020];
set <int> x;
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
cin>>a,t[a]++,m=max(m,t[a]),x.insert(a);
cout<<m<<" "<<x.size();
return 0;
} | ALGO | 0.999338 | 3.814136 |
a563c36d-3bd4-48c8-a140-124ddd29f8d5 | JawwadUmar/Coding | Codeforces/B_Two_Large_Bags.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int MOD = 1e9+7;
#define endl '\n'
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_up... | ALGO | 0.999959 | 4.76199 |
fc4efb1f-4747-40a1-8068-42aa4004f2f7 | FXTD-ODYSSEY/cppreference | cppreference/algorithm/ranges/min_element.cpp | // cppreference link https://en.cppreference.com/w/cpp/algorithm/ranges/min_element
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
int main()
{
std::vector<int> v { 3, 1, -14, 1, 5, 9 };
namespace ranges = std::ranges;
auto result = ranges::min_element(v.begin(), v.end());
... | ALGO | 0.999534 | 5.690154 |
94103b11-4514-4c22-b2b0-7b9bb75b6580 | cdq9509/AlgoCpp101 | AssignCookies.cpp | /*
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a cookie that the child will be content with; and each cookie j has a size sj. If sj >= gi, we can assign the cookie j to... | ALGO | 0.999985 | 5.871825 |
0fac6751-8404-45a0-9386-6e532d4bda45 | amd48/Programacion-y-Estructuras-de-Datos | PED/p/p1/AYUDA/TADS CUAD2/OFFICIALES/tad10.cpp | #include <iostream>
#include "tabbcalendario.h"
using namespace std;
int
main(void)
{
/***************************************************/
/***************** RESTA, INORDEN */
/***************************************************/
TABBCalendario a,b, resta;
TVectorCalendario vec;
TCalendario c1(1,1,... | ALGO | 0.943197 | 4.406404 |
89a99efe-9c23-4b02-9cd6-e1f0abeeb6d9 | prabhatkr007/leetcode-GFG-Problems | 1051-height-checker/1051-height-checker.cpp | class Solution {
public:
int heightChecker(vector<int>& heights) {
vector<int> h = heights;
sort(h.begin(), h.end());
int count = 0;
for(int i = 0; i < heights.size(); i++){
if(h[i] != heights[i]){
count++;
}
}
... | ALGO | 0.999832 | 5.833452 |
27717068-41c1-47cd-967d-3b961f1bae38 | FacerAin/Algorithm-Study | Baekjoon/Math/9613/9613.cpp | //9613번 GCD합
#include <iostream>
using namespace std;
int gcd(int a,int b){
return !b ? a : gcd(b,a%b);
}
int main(){
int T,n,sum,cnt;
int arr[101];
cin >> T;
while(T--){
sum = 0;
cin >> n;
for(int i=0; i<n;i++){
cin >> arr[i];
}
for(int i=0; i<n;... | ALGO | 0.999887 | 3.62776 |
07c9d117-0dd2-4b01-b53c-a4a7ea3b0450 | lms0806/Baekjoon_Cpp | 30001-35000/30552.cpp | #include<bits/stdc++.h>
using namespace std;
void fastio() {
cin.tie(0)->sync_with_stdio(0);
}
void solve() {
int n;
cin >> n;
bool flag = false;
vector<string> v;
while (n-- > 0) {
string s;
cin >> s;
if (s == "Present!") {
for (int i = 0; i < v.size()... | ALGO | 0.999554 | 5.022392 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.