uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
47b67616-8241-4c4f-90f9-e7a120cee3b4 | lclpsoz/competitive-programming | ARCHIVE/2018-06-09-1800/59A.cpp | #include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define pb push_back
typedef pair<int, int> pii;
typedef long long ll;
const int INF = 1e9;
char str[110];
int main ()
{
scanf ("%s", str);
int up = 0;
int down = 0;
for (int i = 0; str[i] != '\0'; i++)
if (str[i] >= 'a') down++;
... | ALGO | 0.999777 | 4.839411 |
fb09887d-11d5-44b5-a398-464934550d47 | nark/zanka | tags/Footagehead-1.3.5/Footagehead/unrar/crc.cpp | #include "rar.hpp"
uint CRCTab[256];
void InitCRC()
{
for (int I=0;I<256;I++)
{
uint C=I;
for (int J=0;J<8;J++)
C=(C & 1) ? (C>>1)^0xEDB88320L : (C>>1);
CRCTab[I]=C;
}
}
uint CRC(uint StartCRC,const void *Addr,uint Size)
{
if (CRCTab[1]==0)
InitCRC();
byte *Data=(byte *)Addr;
#if defi... | TOOL | 0.868146 | 5.442655 |
74253807-945d-4951-94a7-042c3e974c5f | profornnan/Problem-Solving | BOJ/시뮬레이션/18808-스티커 붙이기.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#define sws ios::sync_with_stdio(false), cin.tie(NULL);
using namespace std;
int board[40][40], sticker[10][10];
int n, m, k, r, c;
bool is_attachable(int sy, int sx) {
if (sy + r > n || sx + c > m)
return false;
for (int y = 0; y < r; y++)
for (int x ... | ALGO | 0.999479 | 3.711502 |
f9c302a8-25ee-40c1-a106-1519da8cf1a5 | sid-rh/MyLeetcode | 21.Merge-Two-Sorted-Lists/MergeTwoSortedLists.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
void insertAtEnd(ListNode *&head, int data)
{
... | ALGO | 0.999804 | 5.213876 |
e944a860-24b5-4ff7-a610-1d6304baf2f4 | Prasad-264/DSA-CP | DSA/Tree/Binary Search Tree/Delete in BST/DeleteBST.cpp | // Delete in binary search tree Problem in c++
#include <bits/stdc++.h>
using namespace std;
// A binary tree node has data, pointer to left child and a pointer to right child
struct Node {
int data;
struct Node *left;
struct Node *right;
Node(int val){
data = val;
left = NULL;
right = NULL;
}
};
... | ALGO | 0.999991 | 6.10263 |
c99d2e05-fe88-4189-ab26-6d189163fb3c | NoahsarkTaiwan2008/zerojudge-records | a006-一元二次方程式/a006.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int d = b * b - 4 * a *c;
if (d > 0) {
int root1 = int(-b + sqrt(d)) / (2 * a);
int root2 = int(-b - sqrt(d)) / (2 * a);
cout << "Two different roots x1=" << root1 << " , x... | ALGO | 0.999812 | 4.653462 |
2e63c268-6e7c-434c-9d58-e31077a63927 | saurabhshukla31/LeetCode | 2285. Maximum Total Importance of Roads.cpp | class Solution {
public:
long long maximumImportance(int n, vector<vector<int>>& roads) {
vector<int> degree(n, 0);
for (auto &vec : roads) {
int u = vec[0];
int v = vec[1];
degree[u]++;
degree[v]++;
}
sort(begin(degree), end(degree));... | ALGO | 0.999865 | 5.909175 |
65072782-4efc-450f-983d-68d8c67605c1 | ml-inory/whisper.axcl | 3rdparty/librosa/eigen3/doc/examples/TutorialLinAlgComputeTwice.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A, b;
LLT<Matrix2f> llt;
A << 2, -1, -1, 3;
b << 1, 2, 3, 1;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the right hand side b:\n" << b << endl;
cout << "Computing LLT... | ALGO | 0.999955 | 3.145425 |
a859b180-9c3d-4811-a434-233b6404f6e9 | saurabhsuman47/Online-Judge-Solutions | SPOJ/Classical/MAXLN - THE MAX LINES.cpp | #include <iostream>
using namespace std;
#include <cstring>
#include <cstdio>
#include <cmath>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
double eps=1e-8;
typedef long long ll;
typedef vector<int> vi;
const ll mod=1000000007ll;
#define sc(x) scanf("%d",&(x))
#define scl(x) scanf("%lld",&(... | ALGO | 0.983864 | 3.65577 |
fa31a621-220b-4123-9108-b5cc3c8cf195 | Vassu05/CSES | cycle_finding.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
int n, m; cin >> n >> m;
vector<vector<int>> edges(m, vector<int> (3));
for(int i = 0; i < m; i++) for(int j = 0; j < 3; j++) cin >> edges[i][j];
for(int i = 0; i < m; i++) --edges[i][0], --edges[i][1];
vector<int> d... | ALGO | 0.999992 | 3.953513 |
5837a511-fc5b-475f-9f9b-1472aa7debf9 | daybreaker42/Problem-Solve | practice/1030/19566.cpp | // Baekjoon No. 19566 - 221102 solved...
// Time Complexity
/*
* k ϴ .
* ð O(n) Ұ , ʰ ̿ ִ...
* ذ ÷ ϴ ذ ʴ
*/
#include <bits/stdc++.h>
#define fastIO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
int main() {
fastIO
int n, k;
int i;
long long ans, tmp;
cin >> ... | ALGO | 0.999985 | 3.47864 |
c66e9ead-44fd-4378-b84b-a7aa0e2e194a | desparza22/delaunay_3d | clibs/eigen-3.4.0/doc/examples/Tutorial_ArrayClass_interop.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = (m.array() + 4).matrix() * m;
cout << "-- Combination 1: --" << endl << result << endl << e... | ALGO | 0.999617 | 4.531452 |
9816b18b-bdae-4d4e-aaaf-d2a815c0136f | mrcivnmcbrr/Dev-C--learnings | CP2 Prog Exercises/Array Exercises/Selection Sorting - Output.cpp | #include <iostream>
using namespace std;
int main ()
{
int arr[5] = {3, 2, 5, 1, 4};
for (int i=0; i<5; i++)
cout<<arr[i] << " ";
cout<<endl;
for (int i=0; i<5; i++)
{
int smallest = arr[i];
int smallestIndex = i;
for (int m=i; m<5; m++)
{
if (arr[m] < smallest)
{... | ALGO | 0.999661 | 3.125017 |
df42e677-4f9d-4cb7-9d2e-64dc8e986c9e | ishandutta2007/codeforces | qoo2p5/normal/886/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int INF = (int) 1e9 + 123;
const ll LINF = (ll) 1e18 + 123;
const ld EPS = (ld) 1e-7;
const ll MOD = (ll) 1e9 + 7;
#define sz(x) (int) (x).size()
#define mp(x, y) make_pair(x, y)
#define pb push_back
#define all(x) (x)... | ALGO | 0.999983 | 4.363462 |
d6b4538d-a466-4466-a1e9-0821e9a205f4 | linneszyx/CP-Problems | 1850-minimum-length-of-string-after-deleting-similar-ends/minimum-length-of-string-after-deleting-similar-ends.cpp | class Solution {
public:
int minimumLength(string s) {
int left = 0;
int right = s.size()-1;
while(left<right and s[left]==s[right]){
char ch = s[left];
while(left<=right and s[left]==ch) left++;
while(right>=left and s[right]==ch) right--;
}
... | ALGO | 0.999957 | 6.197574 |
e7534d20-757b-4ef1-a40d-04a63f5a4296 | orlandoisay/Competitive-Programming | COJ/2069.cpp | #include <stdio.h>
#include <algorithm>
int K,T,P,A[15];
int NP,NT;
int main() {
scanf("%d",&K);
while(K--) {
scanf("%d %d",&T,&P);
NP=0;
NT=0;
for(int i=0;i<P;i++)
scanf("%d",&A[i]);
std::sort(A,A+P);
A[0]+=5;
for(int i=1;i<P;i++)
... | ALGO | 0.999461 | 3.485015 |
0e8ffbba-8a38-43d4-9983-e84fec0e7e67 | nothpy/gfg160days | Day 10 Bonus Problem Array/Repetitive Addition Of Digits.cpp | int sumOfDigit(int n)
{
int sum =0;
while(n>0){
sum=sum+n%10;
n=n/10;
}
return sum;
}
int singleDigit(int n) {
if(n<10) return n;
int sum =n;
while(sum>=10)
{
sum = sumOfDigit(sum);
}
retur... | ALGO | 0.997784 | 4.715177 |
8721fed2-63cc-485f-9ceb-bf5ee8fb937b | arwysyah/leetXode_cpp | count_sort_1.cpp |
#include <iostream>
#include <fstream>
#include <vector>
#include <sstream>
using namespace std;
vector<int> countingSort(const vector<int> &arr)
{
vector<int> temp(100);
// std::vector<int> frequency(100, 0); initial without lop
for (int value : temp)
{
value = 0;
}
for (int index ... | ALGO | 0.999585 | 5.959 |
a948b10d-4e4a-4287-813f-a8dedc0ed71e | Kawser-nerd/CLCDSA | Source Codes/AtCoder/agc003/C/2743032.cpp | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
int main(){
int n;
cin>>n;
int a[100010];
int b[100010];
rep(i,0,n){
cin>>a[i];
b[i]=a[i];
}
sort(b,b+n);
int ans=0;
rep(i,0,n){
int s=int(lower_bound(b,b+n,a[i])-b);
if... | ALGO | 0.999885 | 3.515222 |
64813a66-6a25-4a5e-b9bd-97df4d40d4f8 | sastava007/Tech-Interview-Preparation | Leetcode/Strings/Valid Parenthesis String.cpp | /*
Idea is to iterate from L2R and keep the count of unpaired '(', and here we're maintaining lower & upper bound to store range of unpaired numbers.
So whenever we encounter an '(' we know that both lower & upper value will be incremented and when we encounter ')' we know that we need to decrement both lower ... | ALGO | 0.999609 | 5.061745 |
0dda3118-957f-40ab-9aca-2d2874670a0b | ishandutta2007/codeforces | maspy/normal/1157/F.cpp | #line 1 "main.cpp"
#include <bits/stdc++.h>
#line 3 "/home/maspy/library/my_template.hpp"
using namespace std;
using ll = long long;
using ld = long double;
#define int ll
using pi = pair<int, int>;
using vi = vector<int>;
#define FOR(i, n) for (int i = 0; (i) < (int)(n); ++(i))
#define FOR3(i, m, n) for (int i = (m... | ALGO | 0.99999 | 4.179425 |
13cfd4b5-4ac7-4d45-89f4-9f44385215a7 | Mayanklakhina/Leetcode-Practice-Problems | Array Subset of another array - GFG/array-subset-of-another-array.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
string isSubset(int a1[], int a2[], int n, int m) ;
int main() {
int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;
int a1[n], a2[m];
for (int i = 0; i < n; i++) {
cin >> a1[i];
... | ALGO | 0.999945 | 5.941366 |
dc7ac35c-98a7-4fe2-ae2e-6b72b75e7d2a | awegsche/leetcode | cpp/daily/23-10-09.cpp | #include <vector>
#include <gtest/gtest.h>
using std::vector;
vector<int> searchRange(vector<int>& nums, int target) {
if (nums.size() == 0) return {-1,-1};
// binary search
//
size_t start = 0;
size_t end = nums.size();
size_t middle = (end + start) / 2;
do {
if (nums[middle]... | ALGO | 0.999873 | 6.553512 |
65d1f182-e909-47c2-8901-741109fdee96 | benyeoh/arf | Src/SceneDB/OctantOrderTableMgr.cpp | //==============================================================================
//
// OctantOrderTableMgr.cpp
//
// A description here
//
// Author: Ben Yeoh
// Date: Monday, 24 June, 2013
//
//==============================================================================
#include "SceneDBFramework.h"
_NAMESP... | TOOL | 0.916935 | 6.51587 |
171a652c-a0ee-4f86-8059-5a7283a7abff | AnkurKumarKasana/leetcode | 0239-sliding-window-maximum/0239-sliding-window-maximum.cpp | class Solution {
public:
vector<int> maxSlidingWindow(vector<int>& arr, int k) {
multiset<int> s;
for(int i=0;i<k;i++){
s.insert(arr[i]);
}
vector<int> ans;
for(int i=k;i<arr.size();i++){
ans.push_back(*s.rbegin());
s.erase(s.find(arr[i-k])... | ALGO | 0.999982 | 5.982977 |
404550a8-290d-4d22-bd79-f4ad9d68becb | android-la64/swiftshader | third_party/llvm-10.0/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp | #include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_... | ALGO | 0.915723 | 7.928714 |
86a30a12-ae8d-419f-8134-d5ec56b89e17 | bravandi/snap_3 | tutorials/demo-alg.cpp | #include "Snap.h"
template<class PGraph> void GenerateNodes(const PGraph& Graph, int NumNodes);
template<class PGraph> PGraph GenerateLoopGraph(const PGraph& Graph);
PNGraph GetTNLoopGraph();
// Dump the graph
template <class PGraph>
void PrintGraph(const char s[], const PGraph& Graph) {
printf("---- %s -----\n",s)... | ALGO | 0.937652 | 3.373278 |
6f6d6573-9fd7-4bd5-9617-4cba41b1de88 | oooooooohhh/aaib2 | week16/week16-5b.cpp | #include <stdio.h>
#include <string.h>
int main()
{
char s[20];
scanf("%s",s);
int N= strlen(s);
for(int i=0;i<N;i++){
char c = s[i];
if(c>='A' && c<='Z') c= c - 'A' + 'a';
else if(c>='a' && c<='z') c = c - 'a' + 'A';
printf("%c",c);
}
printf("\n");
}
| ALGO | 0.999249 | 4.025638 |
a1cf6ad5-ef42-47de-9d02-17bf17eb1dec | sakuralggm/algorithm_training | acwing/DP/acwing1010.cpp | // clang-format off
/**
* 题目链接:https://www.acwing.com/problem/content/1012/
* 本题耗时:
* 是否独立完成:否
* 提交次数:1
* 时间复杂度:O(n^2)
* 空间复杂度:O(n)
* 知识点:线性DP,最长上升子序列模型,贪心,Dilworth定理
* 解题思路:第一问求的是最长不下降子序列。第二问,有两种做法:贪心和DP。
1. 贪心:对于第i号导弹,要么选择末尾导弹高度最小的拦截系统,要么新创一个拦截系统,用一个数字即每套拦截系统此时所拦截的最后一个导弹高度,来表... | ALGO | 0.999971 | 4.300389 |
475bee41-d6a1-45ec-9301-c41434cc8433 | longJ91/Algorithm | Baekjoon/삼성SW역량테스트기출문제/1697_숨바꼭질.cpp | // : https://www.acmicpc.net/problem/1697
// BFS + check ؼ ּҷ ̹ ڴ ̻ ۾ ʴ´.
#include <iostream>
#include <cstring>
#include <queue>
using namespace std;
struct DATA {
DATA(const int n_, const int cnt_) {
n = n_;
cnt = cnt_;
}
int n, cnt;
};
int check[100001];
int N, K;
int main() {
memset(check, -1, sizeof(che... | ALGO | 0.999949 | 4.382357 |
1c7ee4f6-6dab-4961-ae22-d1c9f4d18eda | blazhkevych/25._Iterators._Vector._Algorithms._Predicates._Functors_Part_1 | task_2/task_2.cpp | /*2. Даны два вектора различной размерности: А[M] и B[N]. Необходимо
создать третий вектор, в котором нужно собрать элементы первых двух
векторов.*/
// ГОТОВО
#include <iostream>
#include <vector>
using namespace std;
int main()
{
srand(time(NULL));
const int min{ -100 };
const int max{ 100 };
// Создание пуст... | ALGO | 0.998675 | 3.771078 |
a776eb7f-a488-4f41-9012-1f95d9fd4d12 | Deborah-Digges/SDC-ND-term-2 | P5-Model-Predictive-Control/class-notes/CarND-MPC-Quizzes/mpc_to_line/src/Eigen-3.3/bench/perf_monitoring/gemm/lazy_gemm.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <Eigen/Core>
#include "../../BenchTimer.h"
using namespace Eigen;
#ifndef SCALAR
#error SCALAR must be defined
#endif
typedef SCALAR Scalar;
template<typename MatA, typename MatB, typename MatC>
EIGEN_DONT_INLINE
void lazy_gemm(const MatA &A, const Ma... | ALGO | 0.966851 | 6.117427 |
daf0bd3c-b9a1-45e2-9f82-c9d7aec24ea0 | SkyLoaderr/xray-engine-repo | Editor/ParticleEditor/Engine/LzHuf.cpp | // LzHuf.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#pragma hdrstop
#define MODULE
//typedef unsigned char BYTE;
unsigned textsize = 0, codesize = 0;
char wterr[] = "Can't write.";
/********** LZSS compression **********/
#define N 4096 /* buffer size */
#define F 6... | ALGO | 0.988299 | 3.123617 |
ec3baff0-6db5-4762-a402-172edef2c3a9 | ishandutta2007/codeforces | krijgertje/normal/533/B.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <cassert>
#include <ctime>
#include... | ALGO | 0.999892 | 3.620461 |
2b904ca4-3bdb-4bfd-96a6-e088dfcd5c1f | bacikiss/practice | leetcode_3.20/LinkedNode.cpp | #include <iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
class MyLinkedList {
public:
// 单链表
struct LinkedNode {
int val;
LinkedNode* next;
LinkedNode(int val):val(val), next(nullptr){}
};
int _size;
LinkedNode* _dummyHead;
MyLinke... | ALGO | 0.999802 | 4.317787 |
73cd87cb-12b1-4610-bc54-78ec3639e0ef | 1sks1/Data-Structure | 2. Bitwise Operators/Playing kth BIT/kth_bit_set_or_not.cpp | #include<bits/stdc++.h>
using namespace std;
bool check_kth_bit_set(int num,int k)
{
if((num>>(k-1))&1==1) // or if((num>>(k-1))!=0)
return true;
return false;
}
int main()
{
int num,k;
cin>>num>>k;
if(check_kth_bit_set(num,k)==true)
cout<<"Yes, it exist";
else
cout<<"No, it doesn't exist";
return 0;
}
| ALGO | 0.999923 | 3.356419 |
f982259c-a77f-4bfa-9820-2a39f7c54df9 | Yashwanth-Ramamurthi/TopoDistMF-v.1 | OGDF/src/ogdf/orthogonal/ClusterOrthoShaper.cpp | /*
* $Revision: 2963 $
*
* last checkin:
* $Author: gutwenger $
* $Date: 2012-11-05 14:17:50 +0100 (Mon, 05 Nov 2012) $
***************************************************************/
#include <ogdf/cluster/ClusterOrthoShaper.h>
#include <ogdf/basic/FaceArray.h>
#include <ogdf/graphalg/MinCostFlowReinelt.h>... | ALGO | 0.998383 | 6.155981 |
4efc533b-c4e8-46ba-81ec-8d51db7a5318 | Jescaicedo/Practicas | Practica_1/Ejercicio_18/main.cpp | #include <iostream>
using namespace std;
int main()
{
int N;
bool ban= false;
cout<<"Ingrese un numero N: ";
cin>>N;
if(N<0){
cout<<"No es un numero cuadrado perfecto"<<endl;
}
else{
for(int i; i<=N; i++){
if(i*i==N){
cout<<N<<" Es un numero cuad... | ALGO | 0.998997 | 3.814316 |
1dad13ae-39c0-41a5-ab6f-8c2eeb09f21e | PrangerStefan/TempestSynthesis | src/test/storm/solver/FullySymbolicGameSolverTest.cpp | #include "test/storm_gtest.h"
#include "storm-config.h"
#include "storm/storage/dd/DdManager.h"
#include "storm/utility/solver.h"
#include "storm/settings/SettingsManager.h"
#include "storm/environment/Environment.h"
#include "storm/solver/SymbolicGameSolver.h"
#include "storm/settings/modules/NativeEquationSolverSet... | TEST | 0.972808 | 7.598895 |
148d3be1-20a3-417a-8ab5-19bcaa7cbc26 | madnoda/test | vector3.cpp | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "vector3.h"
double Vector3::abs() const
{
double w = x * x + y * y + z * z;
if (w > 0.0 ) {
return sqrt(w);
} else {
return 0.0;
}
}
Vector3 Vector3::operator-() const
{
Vector3 r;
r.x = -x;
r.y = -y;
r.z = -... | TOOL | 0.961542 | 3.324682 |
fc7ee87e-b151-4903-ada5-c9b941d47986 | RishabhRawatt/LeetCodeSurf | 1155-number-of-dice-rolls-with-target-sum/1155-number-of-dice-rolls-with-target-sum.cpp | class Solution {
public:
int MOD=1e9+7;
//memoization
int t[31][1001];
int solve(int n,int k,int target){
//base case
if(target < 0) return 0;
//memo
if(t[n][target] != -1 ) return t[n][target];
if(n == 0 ){
return... | ALGO | 0.999995 | 5.889391 |
83fe7cce-786a-40e0-9bb4-0024d1dae9c3 | Adi-1805/LeetCode-Solved | DCP-04-25/Count-the-Hidden-Sequences.cpp | class Solution {
public:
int numberOfArrays(vector<int>& differences, int lower, int upper) {
int n = differences.size();
vector<long int> pfsum(n+1,0);
// int net_dif = 0;
for(int i = 1; i < pfsum.size(); i++){
pfsum[i] = pfsum[i-1] + differences[i-1];
// ne... | ALGO | 0.999923 | 5.283879 |
c64a4e3d-733f-4a2d-9095-c550f91e4369 | leviwixon/BinaryInput | binaryFile.cpp | #include <iostream>
#include <map>
#include <fstream>
#include <string.h>
#include <math.h>
#include <iomanip>
#include "binaryFile.h"
#include "customErrorClass.h"
using namespace std;
// Const that stores the size of each input chunk we take from the binary file. Should there be more parameters, extension of existi... | TOOL | 0.984455 | 5.354749 |
553d55b1-c5ca-4a67-81b3-9c55f1dca821 | HONGYU-LEE/TheWayToAlgorithm | Leetcode/leetcode-710/solution.cpp | class Solution {
public:
Solution(int N, vector<int>& blacklist) {
size = N - blacklist.size();
//ȼϣ
for (auto num : blacklist)
{
whiteList[num] = -1;
}
int end = N - 1; //ĩβ±
for (auto num : blacklist)
{
//ֱں棬Բӳ䣬ֱ
... | ALGO | 0.999901 | 5.888631 |
2f6b8a7f-8883-454b-a8d1-e636c2dba46a | ishandutta2007/codeforces | cookiedoth/normal/1338/C.cpp | /*
Code for problem C by cookiedoth
Generated 12 Apr 2020 at 05.25 PM
(@)(@)(@)(@)(@)
o_O
^_^
=_=
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <functional>
#include <uno... | ALGO | 0.999985 | 4.200563 |
da5a5ae8-e614-4e51-ad0c-a516017adfaa | dhanushbabuk/Leetcode | 1572-matrix-diagonal-sum/1572-matrix-diagonal-sum.cpp | class Solution {
public:
int diagonalSum(vector<vector<int>>& mat) {
int n=mat.size(),ans=0;
for(int i=0; i<n; i++)
{
ans+=mat[i][i];
if(i !=n-i-1)
ans+=mat[i][n-i-1];
}
return ans;
}
}; | ALGO | 0.99995 | 5.770865 |
0d408ccf-9e5b-4fee-83f4-1dbb398d180c | pramodkumar5921/DSA | 441. Arranging Coins.cpp | class Solution {
public:
int arrangeCoins(int n) {
long long int i;
for( i=1;(i*(i+1))/2<=n;i++){
}
return i-1;
}
};
| ALGO | 0.99995 | 6.246295 |
f44a2157-0180-4f20-9ba5-fa2d36747242 | Riyadirl/CPP-Codes | farenhite.cpp | #include<iostream>
using namespace std;
int main(){
int farn,cels;
cout<< "enter Celsius :";
cin>> cels;
farn = 1.8 * cels + 32;
cout<<"farenheit :"<<farn;
cout<<"\nEnter farenheit :";
cin >>farn;
cels= farn-32 /1.8;
cout<<"Celsius :"<<cels;
}
| ALGO | 0.904905 | 3.770684 |
8dae85d0-ec5a-432c-975a-ca8e1815492e | nut-izhan/Programs-in-cpp-introductory-classes | Octal_to_binanry_converter.cpp | #include <iostream>
using namespace std;
int main() {
int octalNumber, decimal = 0, base = 1;
cout << "Enter an octal number: ";
cin >> octalNumber;
while (octalNumber > 0) {
decimal += (octalNumber % 10) * base;
octalNumber = octalNumber / 10;
base *= 8;
}
cout << "The ... | ALGO | 0.976681 | 5.941861 |
9d7fae9d-7381-47d4-bf73-4020faaf00ce | petrohuzyk/30_Days_Code_Challenge | Day 14. Scope/task14.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Difference {
private:
vector<int> elements;
public:
int maximumDifference;
// Add your code here
Difference(vector<int> elements) {
this->elements = elements;
}
... | ALGO | 0.999741 | 4.363026 |
d1e22cdf-0167-4a0b-b5ef-50781a7980ca | syurskyi/Python_Topics | 125_algorithms/_exercises/templates/_algorithms_challenges/leetcode/leetCode/Math/43_MultiplyStrings.cpp | /*
* @Author: <EMAIL>
* @Last Modified time: 2016-07-25 20:13:40
*/
c.. Solution {
public:
/*
Simulation the manual way we do multiplication.
Start from right to left, perform multiplication on every pair of digits.
And add them together.
There is a good graph explanation. Refer to:
https... | ALGO | 0.999982 | 5.842305 |
eca2514c-66c7-4508-9c67-f9a213ebd53a | qianlihaoyue/S-FAST_LIO-ROS2 | src/IMU_Processing.cpp | #include "IMU_Processing.hpp"
ImuProcess::ImuProcess() : b_first_frame_(true), imu_need_init_(true), start_timestamp_(-1) {
init_iter_num = 1; // 初始化迭代次数
Q = process_noise_cov(); // 调用use-ikfom.hpp里面的process_noise_cov初始化噪声协方差
cov_acc = V3D(0.1, 0.1, 0.1); ... | ALGO | 0.958069 | 3.819806 |
73f074ca-7fc3-4682-88a4-dc1b8a3fdf2e | Ausale/Advent-of-Code-2024 | Day4_2024.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <exception>
enum Direction {
DiagonalLeft = -1,
Vertical = 0,
DiagonalRight = 1
};
struct GridPosition {
size_t row {0};
size_t column {0};
};
void lookForXmas(const std::vector<std::string>& grid, GridPosition pos, Di... | ALGO | 0.997534 | 6.116 |
026b1c82-7154-42d8-8177-4c481e8deaf8 | Romu-ua/Atcoder | ABC/233/D_reivew.cpp | #include <bits/stdc++.h>
using namespace std;
/*
区間の問題は累積和を考えると見通しが良くなる。
区間の和は区間の上から下を引いてあげれば良い。
区間の和が2ヶ所の差で求められる。
*/
int main() {
int n;
long long k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
// s はindexの位置にあると思えばわかりやすい。一番最後は超えちゃってるけど。
vect... | ALGO | 0.999954 | 4.757773 |
5813ba79-36bd-40f9-95a5-1d879590765f | miiitomi/atcoder | mayocon/20240108/1.cpp | // https://atcoder.jp/contests/abc164/tasks/abc164_a
#include <bits/stdc++.h>
using namespace std;
int main() {
int s, w;
cin >> s >> w;
if (w >= s) cout << "unsafe" << endl;
else cout << "safe" << endl;
}
| ALGO | 0.995297 | 4.547431 |
8131c6db-9081-4d2c-8126-4ff95960a4d6 | ProdriveTechnologies/pd_cpu_compiler | clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp | #include "AST.h"
#include "FindTarget.h"
#include "HeaderSourceSwitch.h"
#include "Logger.h"
#include "ParsedAST.h"
#include "Path.h"
#include "Selection.h"
#include "SourceCode.h"
#include "refactor/Tweak.h"
#include "clang/AST/ASTTypeTraits.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AS... | TOOL | 0.901231 | 6.775789 |
a019a54b-72e7-49cd-a1d0-98cb17435bc1 | kmchacha/ProblemSolving | Baekjoon/1330.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
// freopen("input.txt", "rt", stdin);
int A, B;
cin >> A >> B;
if(A > B) cout << ">";
else if(A < B) cout << "<";
else cout << "==";
return 0;
} | ALGO | 0.999981 | 3.983733 |
ea52e5a5-4870-43a1-b699-d1170e75ed94 | sanyagoyal2000/leetcode | edit-distance/edit-distance.cpp | class Solution {
public:
int solve(string a,string b,int m,int n){
if(m==0)return n;
if(n==0)return m;
if(a[m-1]==b[m-1])return solve(a,b,m-1,n-1);
return (1+min(solve(a,b,m,n-1),min(solve(a,b,m-1,n),solve(a,b,m-1,n-1))));
}
int editDistDP(string str1, string str2, int m, int... | ALGO | 0.999999 | 5.730092 |
2ca1a02a-8f30-4400-a225-52ff10a00012 | ishandutta2007/codeforces | killerx/normal/76/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
// freopen("c.in", "r", stdin);
// freopen("c.out", "w", stdout);
int n, m, G, S;
scanf("%d... | ALGO | 0.998271 | 3.702028 |
3e1fd9b6-8744-485d-a20e-36fdaa2eed26 | assassinlengjing/kd | kd/大备份3/fun/sub_47B7ED.cpp | #include "sub.h"
int __cdecl sub_47B7ED(int a1, int a2, LPCSTR lpString, int a4, int a5)
{
int result; // eax
int v6; // [esp+4h] [ebp-50h]
int i; // [esp+8h] [ebp-4Ch]
struct tagRECT rc; // [esp+Ch] [ebp-48h] BYREF
int v9; // [esp+1Ch] [ebp-38h] BYREF
int v10; // [esp+20h] [ebp-34h]
int v1... | TOOL | 0.887168 | 3.036482 |
24c6b56f-44e7-4ac2-98e5-63de44c22333 | KaranGulve4342/DSA | Maps and Sets/longest Substring without repeating characters.cpp | // GFG PRACTICE
//{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int longestUniqueSubsttr(string S){
int n = S.length();
int left = 0;
int right = 0;
int maxi = 0;
vector<int> umap(26, 0);
... | ALGO | 0.99976 | 6.261679 |
c9cb78a8-3528-4f6b-a64e-cbd8422a464e | Ayush8532/DSA_Preparation | Trees/test.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
vector<int>v;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
v.push_back(x);
}
int ij=INT_MIN;
int pos=0;
... | ALGO | 0.999724 | 3.610432 |
561709b3-d1db-412b-8c6e-3c6f91e85f20 | muwasifk/competitive-programming | DMOJ/examprep.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<long long int> values = {-1};
struct DSU {
vector<int> e;
DSU(int N) { e = vector<int>(N, -1); }
int get(int x) { return e[x] < 0 ? x : e[x] = get(e[x]); }
bool same_set(int a, int b) { return get(a) == get(b)... | ALGO | 0.999723 | 4.272239 |
c55b2980-c0d7-4ed8-a975-484cda00c8ab | adarshgiri125/Graph_CPP | L18Bipartite_DFS.cpp | #include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool check(int parent,int col, int color[],vector<int> adj[], int V ){
color[parent] = col;
for(auto i : adj[parent]){
if(color[i] == -1){
... | ALGO | 0.999966 | 6.073962 |
19c17d89-b613-4b61-97df-a17d9c75e0e8 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12041_12.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n == 2) {
cout << -1 << endl << 1 << " " << 2 << endl;
return 0;
}
if (n == 3) {
cout << -1 << endl;
cout << 1 << " " << 2 << endl;
cout << 1 << " " << 3 << endl;
return 0;
}
if (n == 4) {
cout << -... | ALGO | 0.99991 | 3.342017 |
1abeffcf-2251-4be6-9530-850cd581d123 | bitcoinemxmx/GCX | src/gcx-cli.cpp | #include "chainparamsbase.h"
#include "clientversion.h"
#include "rpcclient.h"
#include "rpcprotocol.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/filesystem/operations.hpp>
#define _(x) std::string(x) /* Keep the _() around in case gettext or such will be used later to translate non-UI */
using... | WEB | 0.949755 | 6.820014 |
715e7b9e-6317-4d70-a952-9c098984744b | rofi93/Codeforces | C. STL.cpp | /* -------------------------------- */
/* Name: MD. Khairul Basar */
/* Institute: HSTU */
/* Dept: CSE */
/* Email: <EMAIL> */
/* -------------------------------- */
#include <bits/stdc++.h>
/* all header files */
#define fs first
#define sc seco... | ALGO | 0.987595 | 3.775868 |
b947b42c-a998-401e-8508-066d7f9ddb28 | 8bit-nyk/hslam_ros | src/HSLAM/Thirdparty/opencv-3.4.6/opencv_contrib-3.4.6/modules/tracking/samples/tracker.cpp | #include <opencv2/core/utility.hpp>
#include <opencv2/tracking.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <cstring>
#include "samples_utility.hpp"
using namespace std;
using namespace cv;
static const char* keys =
{ "{@tracker_algorithm | | Tracker algorithm }"
... | ALGO | 0.971966 | 5.772739 |
8d30b2e4-3cb3-4c19-86f1-139190441ae3 | samidjouadi/depend_thesis | P3ARSEC/parsec-ff/pkgs/kernels/canneal/src/main.cpp | #include <iostream>
#include <math.h>
#include <stdlib.h>
#include <unistd.h>
#include <vector>
#ifdef ENABLE_THREADS
#include <pthread.h>
#endif
#ifdef ENABLE_PARSEC_HOOKS
#include <hooks.h>
#endif
#if defined(ENABLE_NORNIR) || defined(ENABLE_NORNIR_NATIVE)
#include <nornir/instrumenter.hpp>
#include <stdlib.h>
#in... | TOOL | 0.96639 | 3.859308 |
39b08ac9-38a1-4fb4-8dac-7c0e7ed658e6 | Amarjeet264/DSA-problems | 1677-matrix-diagonal-sum/matrix-diagonal-sum.cpp | class Solution {
public:
int diagonalSum(vector<vector<int>>& mat) {
int i=0;
int j=0;
int sum=0;
while(i<mat.size()&&j<mat[0].size()){
sum+=mat[i][j];
i++;
j++;
}
i=0;
j=mat[0].size()-1;
if(j==0){
// ret... | ALGO | 0.999972 | 5.834511 |
fea594c3-2c5b-4c97-ab25-45bebc96da68 | bacisback/TFG | codigo/DCOV/energy/src/projection.cpp | #include <Rcpp.h>
using namespace Rcpp;
NumericMatrix U_center(NumericMatrix);
double U_product(NumericMatrix, NumericMatrix);
// [[Rcpp::export]]
NumericMatrix projection(NumericMatrix Dx, NumericMatrix Dz) {
/*
returns the projection of A(x) distance matrix Dx onto the
orthogonal complement of C(z) dis... | ALGO | 0.999329 | 5.891601 |
35c4219d-3060-4f44-a848-61a454e9fe44 | dltmdals6718/algorithm | 백준/1로 만들기.cpp | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void) {
int N;
cin>>N;
int dp[1000001];
fill(&dp[0], &dp[1000001], 1000001);
dp[N] = 0;
for (int i=N; i>=1; i--) {
if (i % 3 == 0) {
dp[i/3] = min(dp[i/3], dp[i] + 1);... | ALGO | 0.999979 | 4.168162 |
12d9857b-46f0-4bf8-8cfb-094c1d0b3a3e | Struna1292/LeetCode | 1005-univalued-binary-tree/1005-univalued-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999881 | 6.837919 |
ed233683-eeae-4749-b24a-cd0fd36bbd20 | ishandutta2007/codeforces | laakeri/normal/653/D.cpp | #include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;
const ld eps=1e-11;
struct MaxFlow {
// Use vector<map<int, ll> > for sparse graphs
vector<vector<ll> > f;
vector<vector<int> > g;
vector<int> used;
int cc... | ALGO | 0.999929 | 4.553811 |
02eeed48-1176-4afb-be91-192d71508a44 | kiwibrowser/src | third_party/skia/src/pathops/SkPathOpsOp.cpp | #include "SkAddIntersections.h"
#include "SkOpCoincidence.h"
#include "SkOpEdgeBuilder.h"
#include "SkPathOpsCommon.h"
#include "SkPathWriter.h"
static SkOpSegment* findChaseOp(SkTDArray<SkOpSpanBase*>& chase, SkOpSpanBase** startPtr,
SkOpSpanBase** endPtr) {
while (chase.count()) {
SkOpSpanBase* s... | ALGO | 0.999254 | 6.387004 |
17222776-dea7-42e6-8152-ce1e8f8e05de | tbiehle/357 | asgn2/asgn2.cpp | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
#include <ctime>
#include <string.h>
using namespace std;
typedef unsigned char BYTE;
stru... | TOOL | 0.929537 | 3.945556 |
adfda3b8-fd05-4c63-9528-7691c05af7a9 | schreckc/StarDEM | QGLViewer/VRender/Vector2.cpp | #include "Vector2.h"
#include "Vector3.h"
#include <math.h>
#include <algorithm>
#ifdef WIN32
# include <windows.h>
#endif
using namespace vrender;
using namespace std;
const Vector2 Vector2::inf(FLT_MAX, FLT_MAX);
//! Default constructor
Vector2::Vector2 ()
{
_xyz[0] = 0.0;
_xyz[1] = 0.0;
}
// ---------------... | TOOL | 0.921383 | 5.973938 |
44622d9c-7f8a-44c3-b16f-d17d152fdac6 | tjzel/uni_cpp-embedded | 03/lambda_expressions.cpp | #include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <list>
#include <numeric>
#include <type_traits>
#include <vector>
void print(const std::vector<int> &v, const std::string &label = "") {
std::cout << label;
for (auto x : v)
std::cout << " " << x;
std... | ALGO | 0.999337 | 5.245861 |
88f10dbd-fd4f-4bc5-a160-4b308834c739 | TakashiNord/University | Minmax/minmaxWin32/minmaxWin32.cpp | // minmaxWin32.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "resource.h"
#include <commdlg.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//#include <alloc.h>
#include <string.h>
#define OPENFBUTTON 110
#define EDITFBUTTON 120
#define CALCULATING 130
#defin... | TOOL | 0.90361 | 4.542914 |
d1600f90-aa55-4adb-8e68-8d51d7b29365 | ChuangRoy/RoyChuangs-Code | Algo/CSES/1072.cpp | #include <iostream>
#define SQ(x) ((x)*(x))
using namespace std;
int main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n; cin >> n;
for (long long x = 1; x <= n; x++) {
cout << SQ(x)*(SQ(x)-1)/2 - 4*(x-1)*(x-2) << '\n';
}
return 0;
}
| ALGO | 0.999586 | 3.875558 |
6e3723f6-1c02-4c03-b637-b432ed82acf4 | shahanuralamofficial/BeeCrowd | BEE_1176.cpp |
#include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
long long fib[61];
fib[0] = 0;
fib[1] = 1;
for (int t = 0; t < T; t++) {
int N;
cin >> N;
for (int i = 2; i <= 60; i++)
{
fib[i] = fib[i - 1] + fib[i - 2];
}
cout << "Fib("... | ALGO | 0.999533 | 5.344289 |
96b43a73-5161-4a77-8c2d-a0c5ead0d3ba | CuuvuivevaSoixam/code | CodePTIT - DSA/DSA11010 - CÂY NHỊ PHÂN HOÀN HẢO.cpp | // https://code.ptit.edu.vn/student/question/DSA11010
// CÂY NHỊ PHÂN HOÀN HẢO
#include <bits/stdc++.h>
#define ll long long
#define II pair<int, int>
using namespace std;
struct Node {
int data;
Node *left, *right;
Node(int data) {
this->data = data;
this->left = NULL;
this->righ... | ALGO | 0.999947 | 4.436264 |
1518954e-11bc-4d2b-b172-4830575cee3a | ItsLucas/mahjong-qt | llk.cpp | #include <QMessageBox>
#include <algorithm>
#include <iostream>
#include <llk.h>
#include <llkmsg.h>
#include <queue>
using namespace std;
llk::llk() {}
int myrandom(int i) { return std::rand() % i; }
llk::llk(int h, int w, int types, int diff, bool multi)
{
config.h = h;
config.w = w;
this->multi = multi;
... | TOOL | 0.9462 | 3.8948 |
9c21f626-5aeb-4e3a-ae5d-0ac865b142e3 | Jair-F/Advent-of-Code | 2021/day 5/part2.cpp | #include <iostream>
#include <fstream>
#include <list>
#include <stdlib.h> // abs()
#include <vector>
// for board and point-printing
//#define DEBUG
struct Point
{
unsigned short x, y;
};
struct Line
{
Point point1, point2;
};
int main()
{
std::fstream input;
input.open("part1 - input.txt");
if... | ALGO | 0.997339 | 3.922317 |
1d4a0030-27c1-432e-a254-0a1bb1a6e6db | shubhangjyotirmay/Projects-MTE-2nd-Year | OS/SJF.cpp | #include <iostream>
#include <climits>
using namespace std;
int process[10][6];
// non - preemptive(SJF)
void sjfArrival(int process[][6], int num) {
for (int i = 0; i < num; i++) {
for (int j = 0; j < num - i - 1; j++) {
if (process[j][1] > process[j + 1][1]) {
for (int k = 0... | ALGO | 0.999928 | 3.396053 |
679ed279-0aa8-47f7-a3bc-b9562aebd8bd | ThiagoFBastos/programacao-competitiva | atcoder/F - Diameter set.cpp | #include "bits/stdc++.h"
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using i32 = int;
using u32 = unsigned;
using i16 = short;
using u16 = unsigned short;
using ld = long double;
using ii = pair<int, int>;
const int mod = 998244353;
vector<vector<int>> g;
vector<int> c;
int n, d;
au... | ALGO | 0.999819 | 5.068979 |
33b08b82-f5eb-42f1-9e1f-ca35d3d532cd | 3065190005/ScriptC_StdLibrary | math/std_math/Public/AutoObject/LetArrayMotion.cpp | #include "LetArrayMotion.h"
#include <algorithm>
namespace AutoMem {
namespace Obj {
numberT LetArrayMotion::ArrayCmp(LetObject* cmp1, LetObject* cmp2)
{
if (cmp1->getType() != LetObject::ObjT::array || cmp2->getType() != LetObject::ObjT::array) {
return 2;
}
auto numPtr1 = cmp1->getNumArrayPtr()->s... | TOOL | 0.939634 | 3.957217 |
6249df5d-005a-49a6-bcde-ee518a59683b | st117206/2023-cpp-autumn | 2023.01.10-homework-3/Task4/Task4.cpp | #include <iostream>
int main()
{
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int x = 0;
std::cin >> a;
std::cin >> b;
std::cin >> c;
std::cin >> d;
for (x; x <= 1000; x++)
{
if (a * x * x * x + b * x * x + c * x + d == 0)
{
std::cout << x << " ";
... | ALGO | 0.999593 | 3.596649 |
a982ff45-9a05-4025-8df7-1e351bfdf703 | Vinay-Rastogi/LeetCode | 4. Median of Two Sorted Arrays.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<int> mergeSortedArrays(vector<int> &arr1, vector<int> &arr2)
{
int n = arr1.size();
int m = arr2.size();
vector<int> ans(m + n);
int i = 0;
int j = 0;
int k = 0;
... | ALGO | 0.99995 | 5.750819 |
6b45042b-1d15-4d55-97df-b386a9a738b8 | maroar/scheme | tp/prim/prim.cpp | #include <iostream>
#include <stdlib.h>
#include "../graph/graph.h"
#include "../heap/heap.h"
#define MYINF 10000
using namespace std;
//heap
int *pos;
pHeap h;
//prim
bool *visited;
int *pi;
//Graph
int n, m;
void init()
{
pos = (int*) malloc((n+2)*sizeof(int));
pi = (int*) malloc((n+2)*sizeof(int));
visited... | ALGO | 0.99994 | 4.054968 |
bd382d73-94ce-43e4-b5a7-02dd0b90933b | Arman20021/Codechef | Chef_and_Stock_Prices.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int s, a, b, c;
cin >>s>> a >> b >> c;
float point = c / 100.0;
float current_price = s + (s * point);
if (current_price >= a && current_price <= b)
{
... | ALGO | 0.998418 | 3.408294 |
6c769da3-be7b-4e45-857f-dbcb250e4335 | mejibyte/competitive_programming | LeetCode/745. Prefix and Suffix Search/trie.cpp | struct Trie {
vector<vector<int>> data;
map<pair<int, char>, int> next;
Trie() : data(1, vector<int>()) { }
void add(const string &s, int t) {
int at = 0;
for (char c : s) {
assert(at < data.size());
data[at].push_back(t);
if (next.count({at, c}) == 0) {
next[{at, c}] = da... | ALGO | 0.999908 | 6.221683 |
f15a4d98-099d-4ff4-9923-0f3c3bce19db | pinegreen83/codetree-TILs | 241021/오름차순으로 정렬/sort-in-ascending-order.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
int n;
cin >> n;
int nums[n];
for(int i=0; i<n; i++) cin >> nums[i];
sort(nums, nums+n);
for(int i=0; i<n; i++) cout << nums[i] << " ";
return 0;
} | ALGO | 0.99981 | 4.679961 |
45c2c8eb-8812-4fde-8a66-955b96b9db07 | sidvarun/dsa | Leetcode Topicwise/TopologicalSorting/207. Course Schedule.cpp | https://leetcode.com/problems/course-schedule/
class Solution {
public:
bool canFinish(int numCourses, vector<vector<int>>& prerequisites) {
vector<vector<int>> adj(numCourses);
for(int i = 0; i<prerequisites.size(); i++)
adj[prerequisites[i][1]].push_back(prerequisites[i][0]);
... | ALGO | 0.999871 | 6.630867 |
7bcf7a78-20d8-4552-b4bf-97f0c771b7bf | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/07/0710/personal_submission/cf1060e_lengnian.cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using i128 = __int128;
using ull = unsigned long long;
#define pll pair<ll, ll>
#define pii pair<int, int>
#define vi vector<int>
#define fir(i, a, b) for (int i = a; i <= b; i++)
#define pqi priority_queue<int> // 优先队列
#define all(x) x.begin(), x.... | ALGO | 0.999675 | 4.624819 |
d600555e-7e0d-4a9d-81e5-a8e42a6442e2 | anastasia-spb/AdventOfCode | Day_7/src/gate.cpp | #include "gate.hpp"
//======================= Gate functions ==========================
static uint and_gate(uint in1, uint in2){
return in1 & in2;
}
static uint or_gate(uint in1, uint in2){
return in1 | in2;
}
static uint not_gate(uint in1, uint in2){
return ~in2;
}
static uint rshift_gate(uint in1, uint in2){... | ALGO | 0.91812 | 4.916657 |
1bf326be-24dc-4f0c-9387-9298888ab600 | ishandutta2007/codeforces | nuip/normal/526/C.cpp | #include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#incl... | ALGO | 0.999915 | 3.288635 |
7eb4591e-784c-493a-ba66-481d84293e03 | pranavsindura/CompetitiveProgramming | spoj/prhyme.cpp | #include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pi pair<int,int>
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define endl ... | ALGO | 0.999986 | 4.2703 |
ada79aec-dc8b-48f9-aa1a-84c3e34be505 | saibalagi006/Analysis-of-Algorithms-project | Dijkstra without heap.cpp.cpp |
#include <iostream>
#include <cstdlib>
#include<time.h>
#include<conio.h>
#include<ctime>
using namespace std;
int vertex=5000;
int deg=6;
int graph[6000][6000];
int vertexcounter[6000];
int countvert[6000];
void seed()
{
srand(time(0));
}
// Adjacency List Node
struct node
{
int dest;
int weight;
... | ALGO | 0.999584 | 3.480551 |
c20a5aea-7b8f-4ba2-9bac-33808dddfc30 | HaranRoga/MyStl | algorithm/04_modify4.cpp | // Unique functions - Remove consecutive duplicates
// 1. using unique
// 2. using unique + func2
// 3. unique and copy to another location
// 4. unique + func2 and copy to another location
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// source vectors
vector<char> v1 = {'a', 'b', '... | ALGO | 0.998934 | 5.770594 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.