uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2726272e-6905-44cb-a081-a01fb84e7c1f | IMRAN-5740/Programming-Contest | CodE_CheF/NovemberChallenge2021_B.cpp | /**MD AMRAN MONDOL
Department of Computer Science and Engineering
BSMRSTU
**/
#include<bits/stdc++.h>
/****** Define ******/
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair< int, int >
#define pll pair< ll, ll >
#... | ALGO | 0.999754 | 4.103006 |
417f35ba-75c2-4688-92b7-b37487cb1ac3 | yukikamome316/atcoder-archive | abc166/abc166_a_43775543_AC.cpp | /*
* Author: yukikamome316
* Submission URL: https://atcoder.jp/contests/abc166/submissions/43775543
* Submitted at: 2023-07-20 18:36:36
* Problem URL: https://atcoder.jp/contests/abc166/tasks/abc166_a
* Result: AC
* Execution Time: 8 ms
*/
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n)... | ALGO | 0.999557 | 5.12852 |
4c0c388d-322e-40c1-9e45-eaf2fc229c3d | givenone/normal_position_combination | SuiteSparse-5.7.2/SuiteSparse-5.7.2/GPUQREngine/Source/Scheduler/ssgpu_maxQueueSize.cpp |
#include "GPUQREngine_Scheduler.hpp"
#define MIN_QUEUE_SIZE 50000
size_t ssgpu_maxQueueSize // return size of scheduler queue
(
size_t gpuMemorySize // size of GPU memory, in bytes
)
{
size_t maxQueueSize ;
size_t tileSizeBytes = TILESIZE * TILESIZE * sizeof(double);
if (gpuMemorySize <=... | TOOL | 0.870949 | 5.700511 |
d1d47e3c-18f0-4960-8639-b980523c6829 | hieuthanh1999/Algorithm_Ex | testsort.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a[10001];
int n; cin>>n;
for(int i=0; i<n; i++) cin>>a[i];
sort(begin(a), end(a));
for(int i=0; i<n; i++)
{
cout<<a[i]<<" ";
}
return 0;
}
| ALGO | 0.999916 | 3.660452 |
23a94640-996e-4c60-a68a-5113ea40eaff | itzpankajpanwar/Leetcode | elimination-game/elimination-game.cpp | class Solution {
public:
int lastRemaining(int n) {
int head=1, step=1;
bool direction=true; //t for ->, f for <-;
while (n>1) {
if (direction)
head+=step;
else
head+=n%2==0?0:step;
step*=2;
n/=2;
dir... | ALGO | 0.999997 | 5.911974 |
8bd45a40-182a-4859-af02-93baee97b309 | kritika0598/codes | SPOJ/RMQSQ.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
lli Arr[100005];
lli lookup[100005][20];
void build(lli N)
{
for(lli i=0;i<N;i++)
{
lookup[i][0]=Arr[i];
}
for(lli j=1;(1<<j)<N;j++)
{
for(lli i=0 ;(i+(1<<j)-1)<N;i++)
{
lookup[i][j]=min(lookup[i][j-1],lookup[i+(... | ALGO | 0.999976 | 5.317145 |
578a245c-099f-4d08-91fc-2517888647d9 | Prakhar-002/LEETCODE | 🍄 Daily Challenge 2025 🍳/🔬 Examine Thoroughly 🧬/01 Jan 🪼/13 - 01 - 2025 --- 3223. Minimum Length of String After Operations ☃️ 🍁 🍰 🎲/🎲CPP - 3223. Minimum Length of String After Operations.cpp | //! https://github.com/Prakhar-002/LEETCODE
// Todo 💎 QUESTION NUMBER 3223
//? ⌚ Time complexity ➺ O(n) 👉🏻 n = len(s)
//? 🧺 Space complexity ➺ O(1)
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
int minimumLength(const string& s) {
// Create a vector to cou... | ALGO | 0.99971 | 6.473194 |
0ab03cd6-0d8c-45a2-bac8-638816844bcd | AkashSingh3031/The-Complete-FAANG-Preparation | 1]. DSA + CP/1]. DSA/4]. Striver Series/30 Days of SDE Sheet/C++/16]. Day-16 (String)/CodeStudio/1]. Z-Function.cpp | vector<int> calc(string pat)
{
int n=pat.length();
vector<int> z(n,0);
int L=0, R=0, i=1;
for(;i<n;i++){
if(i>R){
L=R=i;
while(R<n && pat[R-L]==pat[R]) R++;
z[i]=R-L;
R--;
}
else{
int k=i-L;
if(i+z[k]<=R) z[i... | ALGO | 0.999258 | 5.359024 |
2dc36c9c-558a-4108-8ba1-e8bf436e1600 | dkhonker/sysu | 数据结构/数据结构实验课文件/EXP16-graph(topo,scc)/EXP16-graph(topo,scc)/fortest/source/20354002/topo.cpp | #include<stdio.h>
const int maxn = 50010;
struct node{
int x;
node * next;
};
int n, m;
node * head[maxn]; // ע⣺ͷڵxȡ
void topo(){
int que[maxn], l = 0, r = 0;
for (int i = 1; i <= n; i++)
if (head[i]->x == 0) que[r++] = i;
while (l < r){
int j=que[r--];
printf("%d ",j);
node *q=head[j]->next;
while(q)
{... | ALGO | 0.999997 | 4.137238 |
7d050d58-c165-474c-9d92-c11c2a22e28b | countfizix/minAzero | minAzero/myfunctions.cpp | #include <cmath>
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
double tol = .001;
double dingo(double a, double b, double c, double d)
{
double value=0.0;
value = 1.0/(a + exp(b*(c+d)));
return value;
}
double dingojac(double a, double b, double c, double d, int n)
{
double v... | ALGO | 0.99989 | 3.911441 |
defd29ea-94a1-4053-91aa-0541e1adfc01 | lvlnaga/AtCoder | ABC/10sen/69b.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n + 1); i++)
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using mint = modint1000000007;
... | ALGO | 0.999939 | 5.492767 |
14fb8601-c841-4053-bf53-1dbafeb93022 | gtorrent/gtorrent-core | src/Settings.cpp | #include <fstream>
#include <sstream>
#include <stdexcept>
#include <libtorrent/version.hpp>
#include "Settings.hpp"
#include "Platform.hpp"
#include "Version.hpp"
#define xstrmacro(s) strmacro(s)
#define strmacro(s) #s
std::map<std::string, std::string> gt::Settings::settings;
bool gt::Settings::parse(const std::... | CONFIG | 0.974403 | 5.557828 |
5aeb89c6-2220-47b6-9f16-485626ad604f | silent-lad/GFG | course/8.Stack/largest_histogram.cpp | // C++ program to find maximum rectangular area in
// linear time
#include <bits/stdc++.h>
using namespace std;
// The main function to find the maximum rectangular
// area under given histogram with n bars
int getMaxArea(int hist[], int n)
{
// Create an empty stack. The stack holds indexes
// of hist[] array... | ALGO | 0.999961 | 7.155568 |
b7396222-f27d-41b4-83ed-9d51c1c64a2d | rafaellourenco11/Lista01-TDH | lista1-questao-22.cpp | #include <stdio.h>
int main(){
/*
** Funo : ler a altura e o raio de um cilindro circular.
** Autor : Rafael de OLiveira Loureno
** Data : 19/09/2024
** Observaes:
*/
float raio, altura, total;
//ENTRADA
printf("Informe a Altura do Cilindro Circular: ");
scanf(" %f",&raio);
printf("Informe o Raio do ... | ALGO | 0.984861 | 4.732375 |
87c1003c-0082-41af-869a-2efaf4a0d7fa | HyangRim/Algorithm_Back | 15970.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
struct node {
int pt, color;
};
int T;
int ans = 0;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
vector<node> v1;
cin >> T;
while (T--) {
int a, b;
cin >> a >> b;
v1.push_back({ a,b });
... | ALGO | 0.999761 | 4.546871 |
d6bbe1f6-152e-4335-9875-ec8ce989bee6 | Vaishnavi0903/DSA-in-CPP | bubblesort.cpp | #include<iostream>
#include<vector>
using namespace std;
void bubbleSort(vector<int>arr , int n )
{
for(int i = 0; i<n ; i++)
{
bool swapped = false;
for(int j = 0 ; j<n-i-1 ;j++)
{
if (arr[j+1]<arr[j])
{
swap(arr[j+1],arr[j]);
... | ALGO | 0.999775 | 4.394815 |
571f2f28-1a31-460b-a0bd-c750569eaca4 | ishandutta2007/codeforces | ivan100sic/normal/1359/A.cpp | // Retired?
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long unsigned long ull;
typedef double long ld;
int main() {
ios::sync_with_stdio(!cin.tie(0));
int t;
cin >> t;
while (t--) {
int n, m, k;
cin >> n >> m >> k;
int h = min(m, n/k);
int l = (m-h + (k-2)) / (k-1);
c... | ALGO | 0.999829 | 3.97164 |
b07c6c0b-6439-47ea-a605-42ed629ebadf | TinkerEdgeR-Android/external_skqp | src/utils/SkParse.cpp | #include "SkParse.h"
#include <stdlib.h>
static inline bool is_between(int c, int min, int max)
{
return (unsigned)(c - min) <= (unsigned)(max - min);
}
static inline bool is_ws(int c)
{
return is_between(c, 1, 32);
}
static inline bool is_digit(int c)
{
return is_between(c, '0', '9');
}
static inline ... | TOOL | 0.850827 | 5.819929 |
1fa60dce-b399-4815-aff9-a0274988a495 | SSUHYUNKIM/programmers | LV0/문자열 붙여서 출력하기/solution.cpp | #include <iostream>
#include <string>
using namespace std;
int main(void) {
string str1, str2;
cin >> str1 >> str2;
cout << str1 << str2;
return 0;
} | TOOL | 0.969086 | 3.046416 |
1b6c9670-b84d-4390-8939-1061e68e5416 | CryptoCoderz/INSN | src/velocity.cpp | #include "main.h"
#include "velocity.h"
#include "rpcserver.h"
/* VelocityI(int nHeight) ? i : -1
Returns i or -1 if not found */
int VelocityI(int nHeight)
{
int i = 0;
i --;
BOOST_FOREACH(int h, VELOCITY_HEIGHT)
if( nHeight >= h )
i++;
return i;
}
/* Velocity(int nHeight) ? true : false... | ALGO | 0.96893 | 4.616629 |
dd024e9d-f14a-41b2-8a75-9ebbf61e8f18 | Nikitiwe/Leetcode | 3593-find-the-maximum-factor-score-of-array/3593-find-the-maximum-factor-score-of-array.cpp | class Solution {
public:
long long maxScore(vector<int>& nums) {
if (nums.size()==1) return nums[0]*nums[0];
vector<long long> ll(nums.size(), 0), lg=ll, rl=ll, rg=ll;
long long l=nums[0], g=nums[0];
for (int i=0; i!=nums.size(); i++)
{
l=gcd(l, nums[i]);
... | ALGO | 0.999994 | 5.504591 |
14ab5bfb-3b48-42f6-9fca-c8ba948dc650 | funrace2/codetree-TILs | 240413/비교 연산/comparison-operator.cpp | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << (a>=b) << endl;
cout << (a>b) << endl;
cout << (b>=a) << endl;
cout << (b>a) << endl;
cout << (a==b) << endl;
cout << (a!=b) << endl;
return 0;
} | ALGO | 0.999391 | 3.268095 |
61e48b02-697d-4975-8de2-f30a7da03c0e | IoplachkinI/competitive | priority-queue/i-can-guess.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
while (!cin.eof()){
bool _s = true, _q = true, _pq = true;
stack<int> s;
queue<int> q;
priority_queue<int, vector<int>> pq;
while (n--){
int type, x;
cin >> type >> x;... | ALGO | 0.998732 | 4.250074 |
3ce09784-5151-4510-bdad-0d83bccc3df7 | patelalay231/Leetcode-Problem-Solutions | 0076-minimum-window-substring/0076-minimum-window-substring.cpp | class Solution {
public:
string minWindow(string s, string t) {
int n = s.length(), k = t.length(), minIdx = -1, mini = INT_MAX, cnt = 0;
if (k > n)
return "";
vector<int> hash(126, 0);
for (char c : t) {
hash[c]++;
}
int l = 0, r = 0;
... | ALGO | 0.99999 | 6.606191 |
f4ac8f11-bd9b-4cdf-a115-c48bd1c4e70c | jhanvee-khola/DataStructures-Algorithms | DynamicProgramming/MinCoinsChange.cpp | //Given an array of available denomination of coins, find the minimum no. of coins required to make the given sum of money
//recursive approach
int mcc(int n,int a[],int k){
if(n==1){
if(k%a[0]==0){
return k/a[0];
}
return 1e9;
}
int nt=mcc(n-1,a,k);
int t=INT_MAX;
if(a[n-1]<=k){
t=1+mc... | ALGO | 0.999946 | 5.537827 |
4075350c-f71d-4a99-bc0b-f48b6ba57625 | linneszyx/DSA-2 | DP 2D/count_subseq_td.cpp | #include <bits/stdc++.h>
using namespace std;
int countSubseq(string a, string b, int m, int n)
{
if ((m == -1 and n == -1) or n == -1)
return 1;
if (m == -1)
return 0;
if (a[m] == b[n])
{
return countSubseq(a, b, m - 1, n - 1) + countSubseq(a, b, m - 1, n);
}
return coun... | ALGO | 0.999973 | 4.605436 |
8fafdc56-2545-4ccf-8319-486e18d13118 | paly17/ImageStitching2 | opencv/sources/3rdparty/openexr/IlmImf/ImfLut.cpp | //-----------------------------------------------------------------------------
//
// Lookup tables for efficient application
// of half --> half functions to pixel data,
// and some commonly applied functions.
//
//-----------------------------------------------------------------------------
#include <ImfLut.h>
#incl... | TOOL | 0.989153 | 6.512328 |
b3e013d9-8534-49f5-ba48-d31f8214b08f | morsalin80/Codeforces-and-atcoder | codeforces/1391/A.cpp | /// Bismillahir Rahmanir Rahim
/* Mohammad Morsalin
Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int long long
#define f0(... | ALGO | 0.999491 | 4.422891 |
7f34573f-af61-41a8-a1b1-24e555e3c592 | ZhangshenHuang/Algorithm | 06栈与队列/06滑动窗口最大值_239.cpp | #include <iostream>
#include <queue>
#include <deque>
#include <vector>
using namespace std;
// time complexity: O(n)
// space complexity: O(k)
class Solution {
public:
vector<int> result;
deque<int> slidingWindowQueue;
public:
void largeTopPileQueuePush(deque<int>& slidingWindowQueue, const int value) {
... | ALGO | 0.999986 | 5.815006 |
de1ab722-1642-4873-829d-73888e18ef14 | hzy/alg_lab | ALG/U201613570/3/BST.cpp | #include <vector>
#define FloatTable vector<vector<float>>
#define FloatList vector<float>
#define IntTable vector<vector<int>>
constexpr float FLOAT_MAX = numeric_limits<float>::max();
using namespace std;
IntTable OptimalBST(FloatList p, FloatList q, size_t n) {
FloatTable e(n + 1, FloatList(n + 1));
FloatTable... | ALGO | 0.999912 | 3.951912 |
e2b8f998-22d3-4adf-8e5c-238abbbad71b | idkmynamereally/LeetCodeSolutions | 128-longest-consecutive-sequence/longest-consecutive-sequence.cpp | class Solution {
public:
int longestConsecutive(vector<int>& nums) {
unordered_set<int> set;
int ans = 0;
for (int i : nums)
{
set.insert(i);
}
for (int i : nums)
{
int a = 0;
while (set.contains(i))
i--;
... | ALGO | 0.999955 | 5.619272 |
8bf9879a-4939-410c-b117-3b6cfba960b7 | utpalroy2025/astrotalk-ui | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
8fcec50d-e4c3-4329-8bb7-18d65d408e67 | Rishabhcodes65536/RISHABH_CP | E/E_Binary_Inversions.cpp | #include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
#define endl '\n'
#define ff first
#define ss second
#define ... | ALGO | 0.99995 | 4.542758 |
bb1056ab-b95d-481a-94a6-bd8f252d7abd | pl80tech/CarND-MPC-Project | src/Eigen-3.3/bench/benchCholesky.cpp |
// g++ -DNDEBUG -O3 -I.. benchLLT.cpp -o benchLLT && ./benchLLT
// options:
// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3
// -DEIGEN_DONT_VECTORIZE
// -msse2
// -DREPEAT=100
// -DTRIES=10
// -DSCALAR=double
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Cholesky>
#include <bench/BenchUtil.h>
using na... | TEST | 0.990978 | 5.938015 |
df142a0f-5953-4022-8215-91ad6134a03b | tauhrick/Competitive-Programming | Contests/Codeforces/CF-R2-696/B_Different_Divisors.cpp | #ifndef LOCAL
#include <bits/stdc++.h>
using namespace std;
#define debug(...) 42
#else
#include "Debug.hpp"
#endif
const int kN = int(1e6);
vector<int> primes;
void Pre() {
auto is_prime = vector(kN + 1, true);
for (int i = 2; i <= kN; ++i) {
if (is_prime[i]) {
primes.emplace_back(i);
for (int j... | ALGO | 0.999795 | 4.624726 |
33c59d33-a00c-4b69-afe9-225814660b29 | chensx00/gem5_device | src/systemc/tests/systemc/examples/trie/trie.cpp | #include <stdio.h>
#include "systemc.h"
SC_MODULE(lc)
{
sc_out<bool> DIN_rdy;
sc_in<bool> DIN_vld;
#define LOAD_ADDR 0
#define LOAD_DATA 1
#define LOOKUP 2 // really op(1) == 1 and op(0) - don't care
sc_in<sc_uint<2> > DIN_op;
sc_in<sc_uint<32> > DIN_data_in;
sc_in<bool> DOUT_rdy;
sc_out<bool> DOUT_vld;
... | ALGO | 0.999626 | 4.281518 |
71904cf8-ceae-4dc8-9c5f-b76fe011f48e | MdSahil8130/C-Programming | Linked list/09.cpp | #include <iostream>
using namespace std;
class node
{
public:
int data;
node *next;
node(int data)
{
this->next = NULL;
this->data = data;
}
};
void print(node *&head)
{
node *ptr = head;
while (ptr != NULL)
{
cout << ptr->data << " ";
ptr = ptr->next;
... | ALGO | 0.999994 | 5.010143 |
7e1655df-c767-401c-a8d9-a5c21b050cd8 | raincross7/code-similarity | codes/train_code/problem342/problem342_118.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using Graph = vector<vector<pii>>;
const int MOD = 1e9 + 7;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string s;
... | ALGO | 0.999907 | 4.624217 |
12f756c4-599d-40d6-8ed2-14f9441f7f8e | Shahbaz898414/CP-concept | level-2/Week-1/Question/K. Divisors.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ll n,i,j;
cin>>n;
cin>>n;
for(int i=1;i<=n;i++){
if(n%i==0){
cout<<i<<endl;
}
}
return 0;
} | ALGO | 0.999864 | 3.3487 |
769bf415-a2b9-4ea7-9360-8c6f622e9811 | NoTitec/CT_Practice | C++_CT_12_1/C++_CT_12_1.cpp | // C++_CT_12_1.cpp : 이 파일에는 'main' 함수가 포함됩니다. 거기서 프로그램 실행이 시작되고 종료됩니다.
//
#include <bits/stdc++.h>
using namespace std;
//입력 점수 문자열 담을 변수
string score;
//자리수 합 담을 변수
int sum;
int main()
{
cin >> score;
//왼쪽 절반 자리수 합 구하기
for (int i = 0; i < score.size() / 2; i++)
{
sum += score[i] - '0';
... | ALGO | 0.999652 | 6.21204 |
b572a519-240a-4c79-a2b1-b2a859b65f4e | ModeBeater/Algorithms-and-Data-Structures | lab 6/F.cpp | #include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
vector<pair<pair<string,string>, double> > v;
int partition(int low, int high){
double pivot = v[high].second;
int i = low - 1;
for(int j = low; j <= high - 1; j++){
if(v[j].second < pivot){
i++;
sw... | ALGO | 0.999013 | 3.962191 |
41566048-fc3e-42af-b7de-a52ee12b614b | Himanshi1207/DSA_2022 | 2022/LeetCode/Nov/10Remove_All_Adjacent_Duplicates_In_String.cpp | // You are given a string s consisting of lowercase English letters. A duplicate removal consists of choosing two adjacent and equal letters and removing them.
// We repeatedly make duplicate removals on s until we no longer can.
// Return the final string after all such duplicate removals have been made. It can be p... | ALGO | 0.999934 | 6.450337 |
9b5e359c-2691-45b8-b48c-7e63c22f03aa | qbit-glitch/LeetCode-Top-150-Interview-Problems | Magnetic Force between 2 balls/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int maxDistance(vector<int>& position, int m) {
sort(position.begin(), position.end()); // Sort the positions
int low = 1; // Minimum possible distance
int high = position.back() - positio... | ALGO | 0.999973 | 5.994724 |
97497e4f-de4e-4a47-83bd-fd4d2e039377 | grolmus-k/funalgorithmextra | src/other.cpp | #include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include"other.h"
int getting_index(std::string key, std::vector<std::string> value, std::unordered_map<std::string,std::string> matching)
{
for(int i = 0; i < value.size(); i++)
{
if(value[i] == matching[key])
{
... | ALGO | 0.992352 | 4.152973 |
61d74108-0f59-4d8a-af4b-9cdb2547e02b | hkhetawat/SCOREP_Applications | lammps/src/MC/fix_bond_create.cpp | #include "fix_bond_create.h"
#include <mpi.h>
#include <cstring>
#include "update.h"
#include "respa.h"
#include "atom.h"
#include "force.h"
#include "modify.h"
#include "pair.h"
#include "comm.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "random_mars.h"
#include "memory.h"
#incl... | ALGO | 0.984635 | 6.861614 |
e3ecd4b4-656a-4cb6-9907-32a282ac528d | ishandutta2007/codeforces | karry5307/normal/1245/C.cpp | #include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int li;
const ll MAXN=2e5+51,MOD=1e9+7;
ll length;
ll dp[MAXN];
char str[MAXN];
inline ll read()
{
register ll num=0,neg=1;
register char ch=getchar();
while(!isdigit(ch)&&ch!='-')
{
ch=getchar();
}
if(ch=='-'... | ALGO | 0.999941 | 3.926231 |
11f86f8d-ddc5-4b21-a92a-d146d7324f0e | Rahul8320/DS_and_Algo | Array/longest_subarray.cpp | #include<bits/stdc++.h>
using namespace std;
void solution(){
int size;
cin >> size;
int arr[size];
for(int i=0;i<size;i++){
cin >> arr[i];
}
int ans = 0;
for(int i=0;i<size;i++){
int count = 0;
while(arr[i] >= 0 & i < size){
count ++;
i++;
... | ALGO | 0.999583 | 4.866121 |
5cde0985-a857-487c-b128-01ad975ea22a | musfique-anam/codeforces-problemset-practice | A_Helpful_Maths.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s,s1,s2,s3,len,plus="+";
int a,b,c,d,size;
cin>>s;
len=s.length();
for(int i=0;i<len;i++){
s1=s[i];
if(s1 == plus){
s.erase(s.begin()+i);
}
}
vector <int> v;
size=s.length();
for(int i... | ALGO | 0.999926 | 3.731767 |
2d27f8b6-df17-447c-9893-a76bf3128fa4 | yyppsk/CodeForces | From October/B_Effective_Approach.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
void solve()
{
}
int main()
{
int n;
scanf("%d", &n);
vector<int> arr;
for (int i = 0; i < n; i++)
{
int temp;
scanf("%d", &temp);
arr.push_back(temp);
}
vector<int> sear... | ALGO | 0.99997 | 3.952883 |
f4392286-1dbc-43f5-b067-9c8411a58796 | ProgramerArt123/Mathematics | number/Natural.cpp | #include <cassert>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <string>
#include "Natural.h"
#include "performance/natural/root/Guess.h"
#include "performance/natural/logarithm/Guess.h"
#include "performance/natural/logarithm/ChangeBase.h"
namespace number {
Natural::Natural(uint64_t valu... | ALGO | 0.997917 | 4.786731 |
482ac650-92b1-498b-b6e8-b4a52f25f54e | nguyenhuudatcoder/BachLieuNTUCoder | TKNP12.cpp | ///Made by Nguyễn Hữu Đạt
#include<bits/stdc++.h>
#define ll long long
#define kien main
using namespace std;
const ll inf=LLONG_MAX;
const ll mod=1e9+7;
int n,asize,bsize,x,ans;
int da[100005],a[100005]; // trai dương, gái âm
int db[100005],b[100005]; // trai âm, gái dương
void input()
{
cin>>n;
for(int i=0;i<... | ALGO | 0.999996 | 4.400907 |
90c8f111-19fc-4a27-b2e1-c0e4abbdb0ac | KMsojib/LeetCode | Array and Hashing/2439.Minimize Maximum of Array.cpp | #include<bits/stdc++.h>
using namespace std;
int minimizeArrayValue(vector<int>nums){
int total = nums[0];
int res = nums[0];
for(int i=1;i<nums.size();i++){
total += nums[i];
res = max(res, (int)ceil(total/(i+1)));
}
return res;
}
int main(){
vector<int>nums = {3,7,1,6};
c... | ALGO | 0.999971 | 4.681339 |
121bc55b-0b20-4459-8c44-568e648ac380 | Libvisual/libvisual | libvisual-plugins/plugins/actor/gforce/Common/GeneralTools/Hashtable.cpp |
#include "Hashtable.h"
#include <stdlib.h>
long Hashtable::sTableSizes[ NUM_SIZES ] = { 23, 97, 397, 797, 3203, 6421, 12853, 51437, 205759, 411527, 1646237, 3292489, 6584983, 13169977, 52679969 };
#define _MIN( a, b ) ( (a) > (b) ? (b) : (a) )
Hashtable::Hashtable( bool inKeysOwned, int inLoadFactor ) {
mKeysOwne... | ALGO | 0.962843 | 5.469996 |
64039e50-d5b8-443c-8e7c-ab724a46e162 | soso1461/TIL_Today-I-Learn | C++2022/BaekJoon/BaekJoon/Baek9613_231004.cpp | #include <iostream>
#include <vector>
using namespace std;
int gcd(int x, int y) {
if (y == 0) {
return x;
}
return gcd(y, x % y);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> numbers(n);
for (in... | ALGO | 0.99997 | 5.394849 |
eef1d369-e774-4191-84eb-55c7951d75f4 | pavank1812/LeetCode | 0409-longest-palindrome/0409-longest-palindrome.cpp | class Solution {
public:
int longestPalindrome(string s) {
int ans = 0;
vector<int> count(128);
for (const char c : s)
++count[c];
for (const int c : count)
ans += c % 2 == 0 ? c : c - 1;
const bool hasOddCount =
any_of(begin(count), end(count), [](int c) { return c & 1; })... | ALGO | 0.99982 | 6.428133 |
979573e1-686e-4e4f-a906-f73799f45b10 | Anshul407/LeetCode | 0207-course-schedule/0207-course-schedule.cpp | class Solution {
public:
bool canFinish(int n, vector<vector<int>>& pre) {
map<int,vector<int>>mp;
vector<int>in(n,0);
for(auto i:pre){
mp[i[0]].push_back(i[1]);
mp[i[1]].push_back(i[0]);
in[i[1]]++;
}
queue<int>q;
for(int i=0;i<n... | ALGO | 0.999937 | 6.060071 |
88970476-8c10-4eaf-a567-81954ce2c2ca | Shakib2002/Data_Structure | Assaiment_1/Special_Queries.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int Q;
cin >> Q;
queue<string> line;
vector<string> res1;
for (int i = 0; i < Q; ++i)
{
int com;
cin >> com;
if (com == 0)
{
string name;
cin >> name;
line.push(n... | ALGO | 0.999718 | 5.36386 |
60a36316-a9a9-4392-9c7f-09c0f10f8923 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2166_85.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int r;
cin>>r
cout<<3*r*r<<endl;
} | ALGO | 0.996679 | 3.093307 |
3b653785-1ad8-447f-b4b4-804ce1a3062d | xeenoh/GUI-Sudoku-Solver | SFML/examples/island/Island.cpp |
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#define STB_PERLIN_IMPLEMENTATION
#include <stb_perlin.h>
#include <SFML/Graphics.hpp>
#include <vector>
#include <deque>
#include <sstream>
#include <algorithm>
#include <cstring>
#incl... | TOOL | 0.871239 | 6.654213 |
a14a35d9-3dc5-4025-9da0-dfff8cda6cc5 | sxweetlollipop2912/MaCode | .SPOJ/LCA/LCA_2/LCA_2/LCA_2.cpp | // AC SPOJ
// Sparse table, nlogn preprocess, O(1) each query
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#define maxN 1002
#define maxT 2003
#define maxL 12
typedef int maxn;
maxn n, par[maxN], table[maxT][maxL], d[maxN], pos[maxN], root;
std::vector <maxn> ad[maxN], tour;
void Ini... | ALGO | 0.999966 | 4.259424 |
fa13a21d-6374-4965-99bc-44b8bc1b62a0 | adeliaputriw/ALPRO-4212-A11.2022.14426 | Tugas 6 (Pertemuan 14)/BubbleSort/main.cpp | /*
ADELIA PUTRI WIDYASARI
A11.2022.14426 | A11.4212
Dian Nuswantoro University
2023.06.26 Semarang
*/
#include <iostream>
#include <chrono>
using namespace std;
using namespace std::chrono;
void bubbleSort(int arr[], int n) {
for (int i = 0; i < n - 1; i++) {
bool swapped = false;
... | ALGO | 0.998828 | 6.248044 |
e44d6a82-728a-4af8-9500-0940aadf5d07 | aakashdhakal/NCCS | Fifth Semester/Data Analysis and Algorithm/[Lab-11]Dijkstra-algorithm.cpp | #include <iostream>
using namespace std;
#define V 9
int count = 0;
int minDistance(int dist[], bool sptSet[]) {
int min = INT_MAX, min_index = -1;
for (int v = 0; v < V; v++)
if (!sptSet[v] && dist[v] <= min)
min = dist[v], min_index = v, count += 4;
count += 4;
return min_index;
}
void printSolut... | ALGO | 0.999781 | 4.75317 |
f73b365f-e68d-494e-9792-df158ac44425 | omosan0627/library | eulerian_trail.cpp | #include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a... | ALGO | 0.999969 | 3.507759 |
9ffb3089-86b5-4c92-ba0e-c39c527c5049 | Arvln/LeetCode | Union_Find/765.Couples-Holding-Hands/765.Couples-Holding-Hands.cpp | class Solution {
vector<int>parents;
public:
int minSwapsCouples(vector<int>& row) {
int n=row.size();
parents=vector<int>(n);
for (int i=0; i<n; i+=2)
{
parents[i]=i;
parents[i+1]=i;
}
for (int i=0; i<n; i+=2)
Union(row[i], row... | ALGO | 0.999984 | 5.471493 |
c056bea5-71d4-4219-8f5b-bbb3a05a97e5 | Shoyeb45/CompetitiveProgramming | Codeforces/Contest/GroupPracticeConstes/contest2/F.cpp | #include<bits/stdc++.h>
using namespace std;
#define range(x) (x).begin(), (x).end()
#define NFS ios_base::sync_with_stdio(false); cin.tie(NULL);
typedef long long ll;
const ll mod = 1000000007;
string s, t;
void solve() {
cin >> s >> t;
int i = 0, j = 0;
while(i < s.size() && j < t.size()) {
if(s... | ALGO | 0.999969 | 4.667982 |
7b103c66-fa5c-4013-9122-a9186d429332 | yipu3/algorithm-practice | Uva/103.cpp | #include<iostream>
#include<algorithm>
#include<cstring>
#include<stack>
using namespace std;
int k,n;
int box[31][11];
int G[31][31];
int d[31];
stack<int> a;
bool cmp(int i,int j)
{
for(int k=0;k<n;k++)
if(box[i][k]<=box[j][k])
return false;
return true;
}
int dp(int i)
{
int &ans=d[i];
if(ans>0)
return an... | ALGO | 0.999966 | 3.321153 |
ac524ac5-4ab1-45c5-b65a-33264dae33f1 | morishita8256/AtCoder | ABC/001-020/ABC010/C - 浮気調査.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#defi... | ALGO | 0.999988 | 4.762299 |
03197f90-1e5c-4d79-b23d-d23d6f198216 | lucelujiaming/mySoxTest | RaytraceGroundUp/Chapter24.2.2_linux/TorusPartConvex.cpp | #include "Maths.h" // for SolveQuartic
#include "TorusPartConvex.h"
// ---------------------------------------------------------------- default constructor
TorusPartConvex::TorusPartConvex (void)
: GeometricObject(),
a(2.0),
b(0.5),
phi1(90.0 * PI / 180.0),
phi2(270.0 * PI /... | ALGO | 0.991734 | 6.018037 |
e78a7038-d786-474e-a61f-e04e47c990f1 | r-forge/gpboost | pkg/src/compute/example/copy_data.cpp | //[copy_data_example
#include <vector>
#include <boost/compute/algorithm/copy.hpp>
#include <boost/compute/container/vector.hpp>
namespace compute = boost::compute;
int main()
{
// get default device and setup context
compute::device device = compute::system::default_device();
compute::context context(d... | ALGO | 0.98145 | 5.542638 |
6bb022a0-538f-48fc-adfd-df4fd8bef873 | adilzhapar/codemode_FALL_2021 | leetcode/1704.cpp | #include <iostream>
#include <algorithm>
using namespace std;
bool isvowel(char c){
switch (c) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
return true;
default:
return false;
}
}
bool halvesAreAlike... | ALGO | 0.99996 | 5.480897 |
7074189c-bdbe-40d1-a1c4-1c9c70f4a892 | kerozou/kyopuro | 競プロ用ライブラリ各種/セグメント木_遅延セグ木LazySegTree.cpp | // LazySegTree
// ACL の遅延セグ木の前準備として必要な者たち
// 以下のサイトを参考
// https://opt-cp.com/cp/lazysegtree-aclpc-k/
/*
遅延セグ木は S[l,r) の定義の仕方と、全部で5つに分かれる条件をクリアする関数の設定の仕方が重要。
上のサイトで説明されているので、その辺をよく理解して使うこと。
*/
// コンストラクタ
lazy_segtree<S, op, e, F, mapping, composition, id> seg(int n);
lazy_segtree<S, op, e, F, mapping, composit... | ALGO | 0.995357 | 5.113497 |
63eadf5c-0a01-4845-a672-0cc30b83c908 | alexmaruichen/code | data structure/segment tree/3083.cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
const int maxn=100010;
typedef unsigned int uint;
struct seg_tree
{
seg_tree *ls,*rs;
uint mn,lazy;
seg_tree(){ls=rs=NULL,mn=~0u,lazy=0;}
void push_down()
{
if(lazy)
{
ls->lazy=ls->mn=rs->lazy=rs->mn=lazy;
lazy=0;
}
}
void update()
{
mn... | ALGO | 0.999979 | 4.194372 |
8762b905-9a30-4db8-9fbb-e2c00fefec57 | systemc/systemc-2.2.0 | src/sysc/utils/sc_pq.cpp | /*****************************************************************************
sc_pq.cpp - Simple heap implementation of priority queue.
Original Author: Stan Y. Liao, Synopsys, Inc.
*****************************************************************************/
/************************************************... | ALGO | 0.995133 | 6.202938 |
6dc26f08-0a39-48c2-ad02-8fade152e886 | Mael-zys/INF280 | TP3/self_assembly_dfs_stack_wrong.cpp | //DFS to detect if a cycle exists
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<unordered_map>
#include<string>
#include<stack>
#include<unordered_set>
using namespace std;
//change the molecule type from string to int, if t = A+, change it to 0, t = A-, change it to 1;
int moleculeType(string t) {
... | ALGO | 0.995115 | 4.611958 |
6a8b8d05-0ec3-4a75-a0f6-1db149e789d3 | abuzarkhaaan/DEEPFORGE | Flutter Code/deepforge_app/deepforge_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.997592 | 6.763549 |
5a8231e4-abf3-4893-91bd-7972ddf682b9 | y4lp/leets-easy | 746 - Min Cost Climbing Stairs.cpp | #include <vector>
using namespace std;
class Solution {
public:
int minCostClimbingStairs(vector<int>& cost) {
int dp[3] = {0};
int n = cost.size();
for (int i = 2; i < n + 1; i++) {
dp[2] = min(dp[0] + cost[i - 2], dp[1] + cost[i - 1]);
dp[0] = dp[1];
dp... | ALGO | 0.999948 | 5.907674 |
28d03a9c-3dc0-4fe6-833c-53b7ea9f7376 | adogadaev/CourseraYandexCpp | red/119_week5_SearchServerPart1/main.cpp | #include "search_server.h"
#include "parse.h"
#include "test_runner.h"
#include <algorithm>
#include <iterator>
#include <map>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
#include <random>
#include <thread>
using namespace std;
void TestFunctionality(
const vector<string>& docs,
cons... | TEST | 0.884634 | 6.983439 |
a4fbbfc4-64b6-446c-a709-cc8fbdb283c5 | geometryprocessing/geometric-contact-potential | src/polyfem/assembler/Helmholtz.cpp | #include "Helmholtz.hpp"
#include <polyfem/utils/Bessel.hpp>
namespace polyfem::assembler
{
Helmholtz::Helmholtz()
: k_("k")
{
}
Eigen::Matrix<double, Eigen::Dynamic, 1, 0, 9, 1>
Helmholtz::assemble(const LinearAssemblerData &data) const
{
const Eigen::MatrixXd &gradi = data.vals.basis_values[data.i].grad_t... | ALGO | 0.961414 | 5.697366 |
a276546f-2340-4314-bd21-725f8cd2dd54 | RealWarm/Algorithm | Dev-C++/DSLR1.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
using namespace std;
vector<string> st(10010);
int wei[10010];
int a, b;
void bfs(int ss){
queue<int> q1;
q1.push(ss);
wei[ss]=0;
while(!q1.empty()){
int nwx=q1.front();
q1.pop();
int td=(nwx*2)%10000;
if(wei[td]=... | ALGO | 0.999969 | 3.920394 |
ed34e5a5-499a-4ef8-89a1-ca8596a43ee1 | otavioon/COLA-2022-Tools | datasets/src/optz/codenet/2/p03775_s117109417.cpp | #include <bits/stdc++.h>
#define INF 100100100
#define MOD 1000000007
using namespace std;
using ll = long long;
using ull = unsigned long long ;
#define FOR(i,n) for(ll i=0;i<n;i++)
ull log_10(ull N){
ull count = 1;
double N_ = N;
while(N_>=10){
N_/=10;
count++;
}
return count;
}
vector... | ALGO | 0.999277 | 4.351922 |
d52e85b8-944a-498f-94b0-1bd89299e590 | jack41402/Cplusplus | practice test/Q/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n , temp ;
vector<int> arr ;
cin >> n ;
for (int i=0 ; i<n ; ++i)
{
cin >> temp ;
arr.emplace_back(temp) ;
}
for (int i=n-1 ; i>=0 ;... | ALGO | 0.999857 | 3.92975 |
dafd8a5c-cfee-450c-ad95-9cce6fb1eb09 | haitaibrowser/haitaibrowser | third_party/skia/src/animator/SkParseSVGPath.cpp | #include <ctype.h>
#include "SkDrawPath.h"
#include "SkParse.h"
#include "SkPoint.h"
#include "SkUtils.h"
#define QUADRATIC_APPROXIMATION 1
#if QUADRATIC_APPROXIMATION
////////////////////////////////////////////////////////////////////////////////////
//functions to approximate a cubic using two quadratics
// m... | TOOL | 0.931604 | 4.303792 |
29837381-e4d5-4354-9648-080edb446dad | krnbatra/SPOJ-Solutions | RRSCHED.cpp | /*Let's get high :D*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007LL
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define M_PI 3.14159265358979323846
template <typename T> T gc... | ALGO | 0.999817 | 3.845 |
c9390cc0-9734-49aa-8506-f481ce2bb91f | SaurabhKumar171/data_structure_and_algorithms | Binary Trees/11_VerticalTraversal.cpp |
#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
// Definition for a binary tree node.
struct TreeNode {
int data;
TreeNode *left;
TreeNode *right;
TreeNode(int val) : data(val) , left(nullptr) , right(nullptr) {}
};
// DFS approach : O(NlogN) time complexi... | ALGO | 0.999999 | 6.37265 |
c8d7d87d-17a6-44e3-bd6d-826ebf32d935 | westpenguin1125/ICPracticas | P3/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
std::cout << "Row's maximum: " << std::endl
<< mat.rowwise().maxCoeff() << std::endl;
}
| ALGO | 0.999443 | 3.881483 |
0fe65862-f5fc-4ea1-b137-ab8d16ab1133 | therooktick/indIntern | 2017 ACM-ICPC World Finals/E.cpp | #include <bits/stdc++.h>
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using ld = long double;
const int N = 1005;
const ld eps = 1e-9;
ll n, t;
ll d[N], s[N];
bool check(ld c)
{
ld sum = 0;
for (int i = 1; i <= n; ++i)
{
... | ALGO | 0.999856 | 4.694256 |
144da0c2-bb51-4833-8dfd-500e99e4ab65 | ProgramTraveler/leetcode | Leetcode_Question/739.每日温度.cpp | /*
* @lc app=leetcode.cn id=739 lang=cpp
*
* [739] 每日温度
*/
// @lc code=start
class Solution {
public:
vector<int> dailyTemperatures(vector<int>& T) {
stack<int> st;
vector<int> res(T.size(), 0);
st.push(0); //单调栈中存的是数字的下标
for (int i = 1; i < T.size(); i ++) {
if (T[i... | ALGO | 0.999958 | 6.557764 |
ab5e55ea-d896-459d-9b70-5c16b2297efd | zhy2on/practice-algorithm | BaaarkingDog/2nd/0x0d/13460.cpp | #include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define RED 1
#define BLUE 2
int N, M, ans = INT_MAX;
char board[10][10], board2[10][10];
pair<int, int> red, blue, red2, blue2;
bool is_red_fall, is_blue_fall;
int tilt_d[10];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, -1, 0, 1};
int who... | ALGO | 0.999862 | 4.583754 |
ac7fe062-e36b-4f84-a9fa-3375aa4d9406 | valderyaya/Competitive-Programming | NTHU/I2P2/I got a perfect body.cpp | //#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#include<bits/stdc++.h>
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F first
#define S second
typedef long long ll;
#define REP(i,n) for(register int i=0;i<(n);++i)
#define REP1(i,a,b) for(register int i=(a... | ALGO | 0.999981 | 3.448275 |
410ccc19-703d-4483-bc78-9e055f7fcb79 | s-a-n-dhya/Algorithms | 8beam.cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int,int>>> weightedAdj;
vector<int> heuristic;
unordered_map<int,string> nodeName;
void printPath(const vector<int>& path) {
for (size_t i=0;i<path.size();i++) {
cout << nodeName[path[i]];
if (i+1 != path.size()) cout << "->";
}
... | ALGO | 0.999997 | 5.46209 |
4627cd29-7d6b-46b0-ae67-e880033ee514 | whquddn55/Algorithm_BojSolves | 10000/10809.cpp | #include <iostream>
#include <string>
#include <cstring>
using namespace std;
#define MAXSIZE 1001
int idx[26];
int main() {
string str;
cin >> str;
int idx[26];
memset(idx, -1, sizeof(idx));
int size = str.size();
for(int i = 0; i < size; i++)
if(idx[str[i] - 'a'] == -1)
idx[str[i] - 'a'] = i;
for(in... | ALGO | 0.999947 | 3.815016 |
81283c8e-791b-4acd-a0b8-7c78c50cb75d | sorablaze11/ProjectEuler | ProjectEuler005.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int t, n;
long long int pro;
cin>>t;
for(int i=0;i<t;i++){
cin>>n;
vector<int> a;
pro = 1;
for(int j=2;j<=n;j++){
if(pro%j==0)
... | ALGO | 0.999966 | 4.599679 |
3fb0b89d-28d9-47eb-add5-d5351c36ca66 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1566_5.cpp | #include<iostream>
#include<vector>
#include<set>
using namespace std;
#define MAX 100000
vector <int> G[MAX];
int N;
bool visited[MAX];
int prenum[MAX],parent[MAX],lowest[MAX],timer;
void dfs(int current,int prev)
{
prenum[current]=lowest[current]=timer;
timer++;
visited[current]=true;
int next;
for(int ... | ALGO | 0.99999 | 4.611536 |
7e86a591-14cd-41ee-a62b-7154df569026 | Xilinx/Vitis-Tutorials | AI_Engine_Development/AIE/Design_Tutorials/08-n-body-simulator/Module_05_host_sw/host/main_animate.cpp | #include "main_xrt.hpp"
int main(int argc, char ** argv)
{
std::string msg = "";
//parse commandline args
bool profile = OFF;
int num_iter = 1;
//set log level
Logger::set_level(LMESSAGE,LINFO);
for(int i=0; i<argc; i++) {
msg = "argv[" +Logger::int2str(i,false) + "]="+argv[i];
Lo... | ALGO | 0.978184 | 4.843109 |
323e1f35-0993-4e72-ab8c-57d1501c611e | raincross7/code-similarity | codes/train_code/problem492/problem492_180.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include <bitset>
using namespace std;
const int mod=1e9+7;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,x,n) for (int i= x;i<n;... | ALGO | 0.999957 | 4.080687 |
dfe4bafb-cfb3-4a7c-a07c-4e446f4c3e3e | Risab04/DSA | recurssion/linear_search_rec.cpp | #include<iostream>
using namespace std;
// printing for ref
void print(int arr[],int size){
for(int i=0 ; i<size ; i++){
cout<<arr[i]<<" ";
}
cout<<endl;
}
bool search(int arr[],int size,int key){
print(arr,size);
// base case
if(size==0){
return false;
}
if(arr[0]==k... | ALGO | 0.999889 | 4.068852 |
d4fff4ea-b9eb-4510-bfe4-c31fd987c245 | Phong59816/Cplusplus | Chapter 5/ch5_Ex6.cpp | // ch5_Ex6.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
using namespace std;
#include <iomanip>
int main(){
cout << setw(15) << left << setw(15) << "Miles" << setw(15) << "Kilometers" << "|\t\t" << setw(15) << "Kilometers" << "Miles" << endl;
double... | TOOL | 0.928694 | 3.876635 |
25f3d60d-cc31-48fe-884c-3ca09eb24f9b | eren-mikasa/Leetcode-Parctice | Striver Sheet/Day-11/Median of Two Sorted Arrays.cpp | /*
Median of Two Sorted Arrays
===========================
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
Example 1:
Input: nums1 = [1,3], nums2 = [2]
Output: 2.00000
Explanation: merged array = [1,2,3] and median is 2.
Example 2:
Input: nums1 = [1,2... | ALGO | 0.999992 | 6.831657 |
0260e275-f4ce-479b-91e8-02736795cb62 | krishnakumarg1984/Cpp_Templates_Bill_Weinma_Lynda | 01_Templates/template_fcn_deduction.cpp | // template-function.cpp by Bill Weinman <http://bw.org/>
// updated 2018-08-18
#include <iostream>
#include <string>
#include <vector>
using namespace std;
template <typename T>
// template <class T, class X> // T & X are the template parameters
T maxof(const T& a, const T& b) {
return (a > b ? a : b);
}
int m... | ALGO | 0.994246 | 5.744781 |
31e6997c-5765-4ac1-8df0-9dd6cbcf8ce6 | MObinXIV/Foundations | algorithms/math/mathProblems/Primes/minPrime.cpp | // The problem -> we want to count the numbers than our number is minimum prime number on them
#include <bits/stdc++.h>
using namespace std;
/*
we count all the numbers that our number can create and be minimal
so we start with 2 -> 1e6
mark all factors for example mark all the factors with 2 and count them into 2 ind... | ALGO | 0.999847 | 5.385603 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.