uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
e33474bd-91dc-44c0-8187-9d67ea9694bc | Giri231/array123 | arraychecknopresentinarrayornot.cpp | #include<iostream>
using namespace std;
int main()
{
int a[5],i,n;
cout<<"enter any random no";
for(i=0;i<=4;i++)
{
cin>>a[i];
}
cout<<"enter any random no =";
cin>>n;
for(i=0;i<=4;i++)
{
if(a[i]==n)
{
cout<<"Element found at index = "<<i;
... | ALGO | 0.999072 | 3.93226 |
ed5df721-8880-404e-9c81-b587eca1397c | wllchrst/leetcode-solutions-wllchrst | two-sum.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
class Solution
{
public:
int maxProfit(vector<int> &prices)
{
const int length = prices.size();
int buyingValue = 0, sellingValue = 0, i = 0, k = 0, maximumProfitValue = 0;
while (i < length && k < len... | ALGO | 0.996863 | 5.797946 |
331daeb0-77bc-4ffb-bbe3-0e1251db83b2 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/sliding-puzzle-Solution2.slidingPuzzle/177840_+Info.cpp | static int ldb_dn_escape_internal(char *dst, const char *src, int len)
{
const char *p, *s;
char *d;
size_t l;
p = s = src;
d = dst;
while (p - src < len) {
p += strcspn(p, ",=\n\r+<>#;\\\" ");
if (p - src == len) /* found no escapable chars ... | ALGO | 0.998903 | 3.052653 |
86a7d6c3-c66b-4818-a8ab-e64bc0f912ba | BrunoDaniell/funcao-de-retorno | primeiroExercicio01.cpp |
#include <iostream>
using namespace std;
int menorValor(int a, int b) {
if (a < b) {
return a;
}
else {
return b;
}
}
int main()
{
int a, b;
cout << "Digite um valor\n";
cin >> a;
cout << "Digite outro valor\n";
cin >> b;
int menor = menorValor(a, b);
co... | ALGO | 0.998597 | 4.013227 |
d71e3195-a598-4837-a584-c4e63fec0baa | PranavNaik16/leetcode-solved-problems | Binary Search/bookallocationbs.cpp | #include <iostream>
#include <vector>
using namespace std;
bool isPossible(vector<int> &arr, int n, int m, int maxallowed) {
int students = 1;
int pages = 0;
for (int i = 0; i < n; i++) {
if (arr[i] > maxallowed){
return false;
}
if (pages + arr[i] <= maxallowed){
... | ALGO | 0.999902 | 5.33775 |
9993f2c5-545d-43d4-a5c2-8784b89a04f4 | lihongzheshuai/yummy-code | gesp/dad/gesp3/B3640-dad-2.cpp | #include <iostream>
#include <string>
#include <algorithm>
int main() {
std::string str;
std::string result;
while(std::cin >> str) {
if (islower(str[0])) {
transform(str.begin(), str.end(), str.begin(), ::toupper);
} else if (isupper(str[0])) {
transform(str.begin()... | ALGO | 0.999892 | 5.168757 |
e75fa1c2-98e4-4c6c-8faa-46dd98db1de7 | haydenji0731/profileprofile_mmseqs2 | src/alignment/Alignment.cpp | #include <SubstitutionMatrixProfileStates.h>
#include <QueryMatcher.h>
#include "Alignment.h"
#include "Util.h"
#include "Debug.h"
#include "Matcher.h"
#include "DBWriter.h"
#include "NucleotideMatrix.h"
#include "SubstitutionMatrix.h"
#include "PrefilteringIndexReader.h"
#include "FileUtil.h"
#include "LinsearchIndex... | ALGO | 0.991593 | 5.813864 |
385879d4-641e-4b3f-99a1-6d2614bb4db7 | mijanurm21/Leetcode-Solutions | 309-best-time-to-buy-and-sell-stock-with-cooldown/best-time-to-buy-and-sell-stock-with-cooldown.cpp | class Solution {
public:
int solve(int ind, int buy, vector<int> &prices, vector<vector<int>>&dp){
if(ind >= prices.size()) return 0;
if(dp[ind][buy] != -1) return dp[ind][buy];
if(buy){
return dp[ind][buy] = max(-prices[ind] + solve(ind+1, 0, prices, dp) , 0+ solve(ind+1, 1, prices, dp));
}
... | ALGO | 0.999972 | 5.796919 |
b61458f9-dc18-4719-af28-c405c8bfadae | bansal-samarth/Daily-Dose-Of-DSA | Difficulty: Medium/Longest Increasing Subsequence/longest-increasing-subsequence.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int dp[1001][1001];
int solve(vector<int>& arr, int idx, int prev) {
if(idx == arr.size())
return 0;
if(prev != -1 && dp[idx][prev] != -1)
retur... | ALGO | 0.999562 | 6.441641 |
8f8affd4-0bd9-4ab3-b04a-0a7583571a7c | Jparedes22/flutter | notas_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.998391 | 6.76073 |
cc9f634d-7e98-48aa-9f77-05a6f10f25f9 | Jackarain/avhttp | boost/libs/regex/example/snippets/regex_split_example_1.cpp | /*
* LOCATION: see http://www.boost.org for most recent version.
* FILE regex_split_example_1.cpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: regex_split example: split a string into tokens.
*/
#include <boost/regex.hpp>
#include <list>
unsigned tokenise(std::list<std::string>& ... | TOOL | 0.855234 | 5.773776 |
46e6e13f-cdfc-49f3-86ed-1a0b59c1a8b3 | ishandutta2007/codeforces | kostia244/normal/1260/C.cpp | //#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("trapv")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb pu... | ALGO | 0.999927 | 4.21689 |
2869f316-4800-414d-a652-28e52d31050b | dasinlsb/Algorithm-Contest-Records | PersonalTraining/atcoder/arc102E.cpp | /*
考虑对每个f[s],2<=s<=2k单独计算
对于固定的s,限制来自于所有i,s-i(1<=i,s-i<=k)不能同时选取
先考虑s为奇数的情况,偶数的情况只要花常数时间枚举中间那个是否选即可
我一开始先枚举整个序列分成多少段相同的数,但是复杂度过高且式子难以化简
实际上在外层枚举等价类个数不会简化接下来要处理的限制,内层计算的时候还是要考虑
一种可行的方法是对于不同类别的限制分开处理
假设这些二元组(i,s-i)有t个,可以先枚举从中选i个,方案数是C(t,i)*2^i
这样就把问题转化成x_1+x_2+...+x_i+y_1+y_2+...+y_{k-2*t}==n
要求在x_i>0,y_i>=0的限制下,这个方程的整数解... | ALGO | 0.999975 | 4.164234 |
35aef02b-cb8b-4152-bd89-b27a0c7d990c | deadlyaman0000/MyCode | linkLlist/l6-append-lastKnodes-at-start.cpp | #include <iostream>
using namespace std;
class node
{
public:
int data;
node *next;
};
void display(node *head)
{
node * temp = head ;
while (temp != NULL)
{
cout << temp->data << "->";
temp = temp->next;
}
cout<<"NULL" <<endl ;
}
// length function
int length(node *head)
{
... | ALGO | 0.999662 | 3.939426 |
3761f3d1-e1bc-40a0-8232-bf08f5b1b217 | mariza-cy/Competitive-Programming | Notes/Graphs/Implementation/Kosaraju's algorithm.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> graph;
const ll N=1e6;
graph g[N], rg[N], dag[N]; // g: the original graph, rg: the reversed graph, dag: the component graph
vector<ll> s; // s: The (reversed) topological order of the graph
bool vis1[N]={};
void dfs1(ll curr){... | ALGO | 0.999976 | 5.204885 |
10eeb049-6137-4b57-83ab-cfa74ed1b08b | Parmeshwargupta/DSA_cpp | binary search/firstandlastoccurance.cpp | #include <iostream>
using namespace std;
int firstoccu(int arr[], int n, int key)
{
int s = 0;
int e = n - 1;
int ans = -1;
int mid = s + (e - s) / 2;
while (s <= e)
{
if (arr[mid] == key)
{
ans = mid;
e = mid - 1;
}
else if (arr[mid] < key... | ALGO | 0.999742 | 4.452091 |
627feb34-2a56-4028-a073-c94f3760d329 | nlueb/cpp-praktikum | 02_memory/src/map.cpp | #include "map.hpp"
#include <algorithm>
#include <iterator>
#include <stdexcept>
#include <string>
#include <vector>
cppp::Map::Map(const std::size_t size)
: size { size }
, arr { new MapBucket[size] }
{
/*
> Worin unterscheiden sich die beiden Funktionen? [https://stackoverflow.com/a/7397862]
- s... | TOOL | 0.906113 | 5.502431 |
5d6ca67f-8c54-45ad-85c7-1d7983707605 | IbraheemTuffaha/Competitive-Programming | Codeforces/2018-12-04/CF1088-D2/CF1088-D2-A.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
int main() {
int x;
cin >> x;
for(int a=1; a<=x; ++a) {
for(int b=1; b<=x; ++b) {
if(a%b == 0 && a*b > x && 1.0*a/b<x) {
cout << a << " " << b << endl;
return 0;
}
}
}
cout << -1 <<... | ALGO | 0.999906 | 4.066428 |
d916d933-b480-4227-bf97-4f3cbcf55079 | KanchanyadavGitHub/CPP-PROGRAMS | cpp/sumofnum.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"enter number";
cin>>n;
int sum=0;
for(int i=1;i<=n;i++)
{
sum+=i;
cout<<sum;
}
return 0;
}
| ALGO | 0.990537 | 3.363634 |
5baee652-ebd1-4af4-af6c-7759512f4e4f | ZWaldbusser/LeetCode | Problems/43. Multiply Strings.cpp | //Similar to a class homework assignment ive had.
//Wanted to find a more optimal solution.
//O(n*m) time complexity, O(n+m) space complexity
class Solution {
public:
string multiply(string num1, string num2) {
if(num1=="0" || num2 == "0") {
return "0";
}
int n = num1.length();... | ALGO | 0.999794 | 6.102133 |
b7862e29-e425-4551-afbc-5795d0834206 | ishandutta2007/codeforces | ffao/normal/1240/F.cpp | #if 1
#ifdef LOCAL
#define _GLIBCXX_DEBUG 1
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
#include <bits/stdc++.h>
using namespace std;
#if 0
#include <bits/extc++.h>
using namespace __gnu_pbds;
template<class T>
u... | ALGO | 0.999986 | 3.559287 |
fbbc1472-397c-4b0f-8052-981e6f81a65b | 0m7191/BCA_OOPS | problem5.cpp | #ifndef FIND_CALCULATION_H
#define FIND_CALCULATION_H
// Function to compute the square root of a number
double find_Sqrt(double number) {
double error = 0.000001; //define the precision of your result
double s = number;
// Babylonian method for square root
while ((s - number / s) > error) { // to... | ALGO | 0.999956 | 5.688025 |
0e7f1315-4809-4a8e-b766-883b3b6cab78 | rh29152/coding-practise | AlternativeSignSeriesSum.cpp | #include<iostream>
#include<cmath>
using namespace std;
//1-2+3-4+5-6+7-8+......+n
int Sum1(int n){
int sum=0;
// for(int i=1;i<=n;i++){
// sum+=(pow(-1,i+1)*i);
// }
if(n%2==0){
sum=(-n/2);
}
else {
sum=(n+1)/2;
}
return sum;
}
int Sum2(int n){
if(n==1) return 1... | ALGO | 0.999972 | 4.406616 |
9565740c-2675-4621-b1b3-f58857404a13 | Rajveer-CSE-27/Coding-Journey-CPP | CPP Nuts/C++ Tutorial for Beginners/Multithreading in c++/4 mutex.cpp | #include <iostream>
#include <thread>
#include <chrono>
#include <mutex>
using namespace std;
/**
https://www.youtube.com/watch?v=eZ8yKZo-PGw&list=PLk6CEY9XxSIAeK-EAh3hB4fgNvYkYmghp&index=5
Mutex in c++.
#include <mutex>
Mutex stands for Mutual exclusion.
RACE CONDITION:
0. Race condition is a situation where two o... | ALGO | 0.971454 | 5.304043 |
1567cc3b-1b31-4d77-bd18-7eb77bbaf333 | Monty05012002/LeetCode | Pairwise swap elements of a linked list - GFG/pairwise-swap-elements-of-a-linked-list.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
next = NULL;
}
};
// } Driver Code Ends
/*
Pairwise swap a linked list
The input list will have at least one element
node is defined as
s... | ALGO | 0.999942 | 5.440934 |
2022fb15-f3ec-40d7-839f-1f00fdb4f909 | SeacenLiu/LeetCode | 前K个高频元素/main.cpp | /**
给定一个非空的整数数组,返回其中出现频率前 k 高的元素。
例如,
给定数组 [1,1,1,2,2,3] , 和 k = 2,返回 [1,2]。
注意:
你可以假设给定的 k 总是合理的,1 ≤ k ≤ 数组中不相同的元素的个数。
你的算法的时间复杂度必须优于 O(n log n) , n 是数组的大小。
*/
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
using namespace std;
class Solution {
public:
vector<int> ... | ALGO | 0.999977 | 5.613115 |
b2a4382a-fc19-494b-b92b-a23765935aca | punnapavankumar9/coding-platforms | codechef/nov 10/starter 10/d.cpp | #include <iostream>
#include <bits/stdc++.h>
#define endl "\n"
typedef long long ll;
typedef unsigned long long ull;
const int mod = 1e9 + 7;
using namespace std;
int main(){
cin.tie(0)->sync_with_stdio(false);cout.tie(0);
int t;
cin >> t;
while(t--){
int n;
cin >> n;
vector<int... | ALGO | 0.999989 | 4.018776 |
7fa245a6-2d0c-4398-9ce1-cfa5450ceb6a | CoderSharma97/dsa | maxdepth.cpp | class Solution {
public:
int maxDepth(string s) {
int count =0;
int ans = -1;
for(int i=0;i<s.size();i++){
if(s[i] =='(')count++;
ans=max(count,ans);
if(s[i]==')')count--;
}
return ans;
}
};
| ALGO | 0.999561 | 5.647867 |
5e04c485-ee36-4895-9bf0-3c7e3b8b794f | karthick-192211057/C-Programming | Arithmetic_operations.cpp | #include <stdio.h>
#include <math.h>
int main()
{
int a,b,power,mul,add,sub,div,i;
printf("Enter 1st number:");
scanf("%d",&a);
printf("Enter 2nd number:");
scanf("%d",&b);
printf("1--> Power\n");
printf("2--> Addition\n");
printf("3--> Subtraction\n");
printf("4--> Multiplication\n");
printf("5--> Division... | ALGO | 0.991519 | 3.22331 |
89d52cb7-ccef-4541-92a4-8176e432d084 | raincross7/code-similarity | codes/train_code/problem016/problem016_53.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;
//繰り返し二乗法
ll EX(ll x,ll n){
if(n == 0) return 1;
else if(n%2 == 1) return EX(x,n-1)*x%mod;
else return EX(x*x%mod,n/2)%mod;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(... | ALGO | 0.999989 | 4.621233 |
6f999104-7a4b-437a-a17d-dd184a6a57fc | AnushkaBanerjee/Decode-DSA-with-CPP | Bubble Sort/push0ToEnd.cpp | #include<iostream>
using namespace std;
int main(){
int arr[]={5,0,1,2,0,0,4,0,3};
int n = 9;
for(int i = 0;i < n;i++){
cout<<arr[i]<<" ";
}
//bubble sort
for(int i=0;i < n-1;i++){
//traverse
for(int j=0;j < n-1-i;j++){
if(arr[j]==0){
swap(arr[j],arr[j+1]);
}
}
}
cout<<endl;
... | ALGO | 0.999934 | 3.343668 |
70aed98b-92e4-4767-b2a1-033b6d68ed15 | RyanL123/Competitive-Programming | Leetcode/1870.cpp | class Solution {
public:
int minSpeedOnTime(vector<int>& dist, double hour) {
int n = dist.size(), l = 1, r = 1e7, ret = 0x3f3f3f3f;
while (l <= r) {
int m = (l+r)/2;
double cur = 0;
for (int i = 0; i < n-1; i++) {
cur += ceil((double)dist[i]/m);
... | ALGO | 0.999979 | 5.455528 |
6a17a65c-f39f-4985-bf51-faac6012a04d | MrinmoiHossain/LeetCode | 12.Integer_to_Roman/IntegertoRoman.cpp | class Solution {
public:
string intToRoman(int num){
string s = "";
string list[] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
int value[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
int i = 0;
while(num){
... | ALGO | 0.998779 | 6.274359 |
5fc153bc-f48c-410f-a414-79d441a74aa8 | Morthor/flutter_platform_experiment | 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.998693 | 6.797273 |
26fba025-0b63-47ce-a5c8-a69c7aafb5be | somosaleteo/CatApp_IntegrationTest | 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.998859 | 6.785645 |
7b2a4b47-fed3-4575-a625-1b73716d9e51 | Siddhesh672004/DSA | Learn the Basics/Basic Maths/Reverse-Integer(leetcode).cpp | class Solution {
public:
int reverse(int x) {
bool isNeg = false;
int ans = 0;
if(x <= INT_MIN){
return 0;
}
if(x < 0){
isNeg = true;
x = -x;
}
while(x>0){
if(ans > INT_MAX/10){
return 0... | ALGO | 0.999894 | 5.99717 |
b93855fe-db0d-4c5f-8632-fe436e82b650 | spencersalazar/stk.chug | stk/src/Mesh2D.cpp | /***************************************************/
/*! \class Mesh2D
\brief Two-dimensional rectilinear waveguide mesh class.
This class implements a rectilinear,
two-dimensional digital waveguide mesh
structure. For details, see Van Duyne and
Smith, "Physical Modeling with the 2-D Digital
... | TOOL | 0.945179 | 5.842426 |
bcdf8454-1d45-43d6-9d26-20cbd6427d33 | rizvy99/Problem-Solving | Codeforces/A_Median_of_an_Array.cpp | #include<bits/stdc++.h>
#define ll long long int
#define el "\n"
#define all(x) x.begin(), x.end()
#define rev(x) reverse(all(x))
#define sortall(x) sort(all(x))
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll t;
cin>>t;
while (t--) {
int n,cnt=0;
cin >> ... | ALGO | 0.999696 | 4.349651 |
3c20a9ad-3c5c-40d8-8982-49f5c136dfcc | shiqizhoufan/findSameWord | frameworks/cocos2d-x/cocos/platform/winrt/CCFileUtilsWinRT.cpp | #include "CCFileUtilsWinRT.h"
#include <regex>
#include "CCWinRTUtils.h"
#include "platform/CCCommon.h"
using namespace std;
NS_CC_BEGIN
static std::string s_pszResourcePath;
// D:\aaa\bbb\ccc\ddd\abc.txt --> D:/aaa/bbb/ccc/ddd/abc.txt
static inline std::string convertPathFormatToUnixStyle(const std::string& path)
{... | TOOL | 0.896072 | 6.452617 |
65fdaa4d-c8cc-405e-b676-c870701af2e2 | sarvex/leetcode-crystal | solution/0800-0899/0822.Card Flipping Game/Solution.cpp | class Solution {
public:
int flipgame(vector<int>& fronts, vector<int>& backs) {
unordered_set<int> s;
int n = fronts.size();
for (int i = 0; i < n; ++i)
if (fronts[i] == backs[i])
s.insert(fronts[i]);
int ans = 9999;
for (int& v : fronts)
... | ALGO | 0.999925 | 5.451608 |
685581d0-2d1b-4c16-84eb-7f1be28ca398 | CruzPort/100-days-coding | Day 53/Find the town judge.cpp | class Solution {
public:
int findJudge(int n, vector<vector<int>>& trust) {
vector<int> trustcount(n + 1, 0);
// Count trust relationships
for (const auto& relation : trust) {
trustcount[relation[0]]--;
trustcount[relation[1]]++;
}
for (int i = 1... | ALGO | 0.999938 | 5.787355 |
425a9dea-ca82-4aea-b139-9171e60d3455 | yubinbai/pcuva-problems | UVa 476 - Points in Figures Rectangles/sol.cpp | #include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
typedef struct pnode
{
double x, y;
} point;
typedef struct rnode
{
point p1, p2;
} rect;
rect R[11];
int main()
{
char c;
int count = 0, t = 1;
while ( cin >> c && c != '*' )
{
cin >> R[count].p1.x >> R[c... | ALGO | 0.997168 | 3.220996 |
88f0e709-de51-4ea9-9dfd-dd39e919d45e | terry-hsu/smv | userspace/benchmarks/parsec-3.0/pkgs/libs/tbblib/src/examples/parallel_for/tachyon/src/trace.tbb.cpp | #include "machine.h"
#include "types.h"
#include "macros.h"
#include "vector.h"
#include "tgafile.h"
#include "trace.h"
#include "light.h"
#include "shade.h"
#include "camera.h"
#include "util.h"
#include "intersect.h"
#include "global.h"
#include "ui.h"
#include "video.h"
// shared but read-only so could be private t... | ALGO | 0.928264 | 4.146451 |
638c3ca4-9fcd-4db5-8076-8634c9ec6513 | ShashiSingh8434/Cpp-and-DSA-Practice-Codes | _142_Boundary_Transversal.cpp | #include <iostream>
#include <vector>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
Node(int val) {
data = val;
left = right = nullptr;
}
void relationSet(Node* x, Node* y) {
left = x;
right = y;
}
};
void printLeftBounda... | ALGO | 0.999936 | 4.703268 |
e105590e-e7c4-45fc-bc2c-a1da3925f56d | Allen-Cee/C-Cpp | Openjudge/2767 简单密码.cpp | #include<iostream>
#include<string>
#include<cstring>
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
using namespace std;
int main() {
char s[200];
gets(s);
for(int i=0;s[i]!='\0';i++){
if(s[i]>='F'&&s[i]<='Z') cout<<(char)(s[i]-5);
else if(s[i]>='A'&&s[i]<='E') cout<... | ALGO | 0.999379 | 3.41407 |
a029c2c3-b198-458a-a410-f137a2d77e57 | hectorratia/CarND-Path-Planning-Project | src/pathplanner.cpp | #include "pathplanner.h"
#include <iostream>
using namespace std;
pathplanner::pathplanner() {}
pathplanner::~pathplanner() {}
void pathplanner::update_telemetry(vector<double> ego_s, vector<vector<double> > sensors){
ego_state = ego_s;
sensor_fusion = sensors;
ego_lane = ego_state[3] / 4;
}
void pathplanner:... | ALGO | 0.998573 | 3.438524 |
5c5197d5-398b-42fc-aa86-b0e055a40c9f | nowrin50/CSE-122-OOP | lab 5/helpful maths.cpp |
//Helpful Maths
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s;
cin>>s;
int i,j;
for(i=0; i<s.size(); i+=2)
{
for(j=0; j<s.size()-1; j+=2)
{
if(s[j]>s[j+2])
{
swap(s[j],s[j+2]);
}
}
}
cout<<s<<endl;
}
| ALGO | 0.999969 | 3.819314 |
c0cc85a8-6cec-4a0e-8f07-00856add2337 | danishkangwal/LeetCode | 0087-scramble-string/0087-scramble-string.cpp | class Solution {
unordered_map<string,bool> mp;
public:
bool isScramble(string s1, string s2) {
int n=s2.size();
if(s1==s2){
return true;
}
vector<int> a(26,0);
vector<int> b(26,0);
vector<int> c(26,0);
if(mp.count(s1+s2)){
return m... | ALGO | 0.999988 | 6.038648 |
6b8b5aa1-4fd2-41c2-a4c6-3b7e6fd2d4ef | lineage-op7/android_frameworks_av | media/libstagefright/foundation/AStringUtils.cpp | #include <string.h>
#include <AStringUtils.h>
namespace android {
// static
int AStringUtils::Compare(const char *a, const char *b, size_t len, bool ignoreCase) {
// this method relies on a trailing '\0' if a or b are shorter than len
return ignoreCase ? strncasecmp(a, b, len) : strncmp(a, b, len);
}
// stat... | TOOL | 0.939533 | 6.505208 |
387977be-ab32-475c-884e-282e8bdd58e4 | busratop/leetCode | LeetCode-Cpp/RemoveDuplicatesfromSortedArrayII.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int k = 0;
for (auto i : nums) {
if (k<2 || i> nums[k - 2]) {
nums[k++] = i;
}
}
return k;
}
};
| ALGO | 0.999876 | 6.185843 |
72119bef-8a82-479e-8d49-b275e6f31fb4 | shan9077/docker_cpp | volansys_cpp_advanced/17_STL/sort.cpp | /**
* @file sort.cpp
* @author rohirto
* @brief Demo of default sort in STL
* @version 0.1
* @date 2023-12-26
*
* @copyright Copyright (c) 2023
*
*/
#include <algorithm> //Need this header for sort
#include <iostream>
int main()
{
int arr[] = {3, 5, 1, 2, 4};
// Sort the array in ascending order
... | ALGO | 0.999415 | 5.336941 |
2b83becb-d167-4b77-b2ba-3dd624856a3c | ProtossGenius/cppweb | str_utils.cpp | #include "str_utils.h"
#include <ctype.h>
namespace sureice {
std::string trim(const std::string &str) {
if (str.empty()) {
return str;
}
int begin = 0, end = str.size() - 1;
for (; begin < str.size(); ++begin) {
if (!isspace(str[begin])) break;
}
for (; end >= 0; --end) {
if (!isspace(str[en... | TOOL | 0.871686 | 6.15489 |
d307800d-f5db-46bc-be2c-a27ce1520ac6 | Ethan4582/Codeforces-solution | CODEFORCES/D-set/D_Colored_Portals.cpp | // // #include <bits/stdc++.h>
// // using namespace std;
// // const int N = 2e5 + 10;
// // const int inf = 1e9;
// // int n, q, val[N], prv[N][16], nxt[N][16];
// // void solve() {
// // cin >> n >> q;
// // auto id = [](char c) {
// // if (c == 'B') return 0;
// // if (c == 'G') return 1... | ALGO | 0.999472 | 5.399161 |
766784ae-97bf-4e9b-a859-3f6d346a80a3 | 21omkarsase/CP | Codeforces/Practice/800/aImage.cpp | // A. Image
// time limit per test2 seconds
// memory limit per test512 megabytes
// inputstandard input
// outputstandard output
// You have an image file of size 2×2, consisting of 4 pixels. Each pixel can have one of 26 different colors, denoted by lowercase Latin letters.
// You want to recolor some of the pixels ... | ALGO | 0.99997 | 4.791319 |
031fa3f0-a52c-4afe-ad99-277dbadaee8d | InzamZ/Inzam-XCPC-Code | Codeforces/CF1633_Edu122/B.cpp | //InzamZ
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define REG register
// #define FREAD 1
const int maxn = 2e5 + 10;
const int maxb = 110;
const int inf = 1e9;
const ll Inf = 1e18;
const ll mod = 1e9 + 7;
#ifdef FREAD
inline char nc()
{
... | ALGO | 0.999911 | 4.673557 |
ff766e75-3e64-400d-8fa5-c343c6c7208b | vfcosta/CarND-MPC-Project | src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.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 << "Column's maximum: " << std::endl
<< mat.colwise().maxCoeff() << std::endl;
}
| ALGO | 0.999423 | 3.779679 |
64fb803b-2451-4afe-8cba-e83091ce93c0 | Overstars/Practice | OJ/Codeforces/暴力/CF550A Two Substrings(暴力,1500).cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=100005;
char s[maxn];
int a[maxn],b[maxn];
int main()
{
scanf("%s",s+1);
int n=strlen(s+1);
for(int i=2;i<=n;i++)
{
if(s[i]=='B'&&s[i-1]=='A')
a[i]=1;
if(s[i]=='A'&&s[i-1]=='B')
b[i]=1;
}
// for(int i=1;i<=n;i++)
// printf("%d,%d\n",a[i],b[i]);... | ALGO | 0.999977 | 3.428073 |
53366460-1a9a-4f03-a65c-0ad0c2bbf3f5 | cile/android_frameworks_av | media/libstagefright/codecs/amrnb/enc/src/levinson.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/levinson.c
Funtions: Levinson_init
Levinson_reset
Levinson_exit
Levinson
------------------------------------------------------------------------------
MODULE DESCRIPTI... | ALGO | 0.998827 | 6.290952 |
28b50a1d-6246-4963-be11-8ddfb3a6a204 | HendAdel/flutter_application_task8 | 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.9988 | 6.76073 |
1b85df94-b98a-49c9-97fc-d1082f517029 | CAI-YI-LIN/Data-structure-Hw | HW1/Hw1Question1/src/AckermannDoubleStack.cpp | #include <iostream>
#include <chrono> // ޤJɶqYɮ
using namespace std;
const int STACK_SIZE = 50000; // ]w@Өj|Ŷ
// ΨӰ}C| Ackermann Dj禡
int AckermannDoubleStack(int m, int n) {
// ϥΨӰ}CӼ|
int stack_m[STACK_SIZE]; // s m
int stack_n[STACK_SIZE]; // s n
int top = 0; // lư|w
stack_m[top] = m; // N... | ALGO | 0.999782 | 6.094943 |
72368441-9f4f-4c69-8d07-caaf7ca0b0fa | Yoyuuhi/cpp-atcoder | _result/_AtCoderBeginnerContest354/A-Exponential_Plant/main.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
#define out(X) cout << (X) << endl;
#define outs(XS) \
for (auto X : XS) cout << X << " "; \
cout << endl;
#define outl cout << endl;
#ifdef __LOCAL
#define DBG(X) cout << #X << " = " << (X) << endl;
#else
#define DBG(X)
#endif
#define rep(i, n) ... | ALGO | 0.999918 | 4.14962 |
ed3f035f-99df-4118-a87c-724423332a29 | rohitbhatghare/c-c- | Sept-28-20/assignment165.cpp | #include<iostream>
using namespace std;
int main()
{
int n,i,temp;
int mn,mx,sum=0;
cout<<"Enter the starting and ending range or number : \n";
cin>>mn>>mx;
cout<<"Armstrong numbers are:\n";
for(n=mn;n<=mx;n++)
{
temp=n;
sum=0;
while(temp!=0)
{
i... | ALGO | 0.99874 | 4.258248 |
cdc59bd3-355a-44ea-aacc-b36b13d5b56e | shelltdf/osgall | prebuild/cgal-master/Surface_mesh_shortest_path/examples/Surface_mesh_shortest_path/shortest_paths_multiple_sources.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Random.h>
#include <CGAL/Surface_mesh_shortest_path.h>
#include <boost/lexical_cast.hpp>
#include <cstdlib>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <iterator>
typedef CGAL::Exact_... | ALGO | 0.99906 | 4.468705 |
f8579a16-d269-499a-a508-6f7b34d6e026 | joshualass/CP | Solutions/Contests/CodeForces/CF2125/D2125.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
template<class T>
constexpr T power(T a, ll b) {
T res = 1;
for (; b; b /= 2, a *= a) {
if (b % 2) {
res *= a;
}
}
return res;
}
//Modular Division currently uses Little Fermat's The... | ALGO | 0.999969 | 4.527211 |
adc1d36b-e15f-4b96-a396-9d2ad1facfd8 | shreshtsharma/Leetcode_Questions | 22-generate-parentheses/22-generate-parentheses.cpp | class Solution {
public:
vector<string> generateParenthesis(int n) {
int open=n,close=n;
string s;
vector<string> str;
solve(open,close,s,str);
return str;
}
void solve(int open,int close,string s,vector<string> &str)
{
if(open==0 && close==0)
{
... | ALGO | 0.999833 | 6.262632 |
13ec0384-1fbb-4aaa-a179-58e775d48142 | sarvex/leetcode-fish | solution/1100-1199/1105.Filling Bookcase Shelves/Solution.cpp | class Solution {
public:
int minHeightShelves(vector<vector<int>>& books, int shelfWidth) {
int n = books.size();
int f[n + 1];
f[0] = 0;
for (int i = 1; i <= n; ++i) {
int w = books[i - 1][0], h = books[i - 1][1];
f[i] = f[i - 1] + h;
for (int j =... | ALGO | 0.999978 | 6.377368 |
633a8f46-6ae9-4f46-87fa-edaabe22779c | ishandutta2007/codeforces | shayan.p/normal/703/E.cpp | // Can U hack it?
#include<bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1010,MAX=1e4+10,mod=1e9+7;
ll gcd(ll a,ll b){
... | ALGO | 0.99996 | 3.388685 |
1d2c5edc-6182-47f9-94bb-65699574e683 | mohit-singh-13/DSA-Cpp | 14. Binary Search Interview Questions Session 1/question2.cpp | /*Peak index in a mountain array.*/
#include<iostream>
using namespace std;
int peakIndex(int arr[], int size);
int main()
{
int size;
cout << "Enter the size of array : ";
cin >> size;
int arr[100];
cout << "Enter the array : ";
for (int i=0 ; i<size ; i++)
{
cin >> arr[i];... | ALGO | 0.999923 | 4.556038 |
0729c138-363d-435c-8896-b9e9280af307 | enochjung/acmicpc_net | 15/15782.cpp | #include <cstdio>
#include <vector>
#define N 100010
#define MAX 1<<18
using namespace std;
int n, m;
int v[MAX], l[MAX];
vector<int> edge[N];
int st[N], en[N];
bool visited[N];
class segment_tree
{
private:
int start;
void propagate(int idx, int width)
{
if(l[idx])
{
if(... | ALGO | 0.999968 | 4.810602 |
597f879f-446a-4afc-ba0c-1fe5d6800144 | hjiang13/LLMs-in-IR | POJ-104/39/1722.cpp | #include <iostream>
using namespace std;
int money(int n1,int n2,char n3,char n4,int n5);
int main()
{
long i,max,n,n1,n2,n5,sum;
char name[20],n3,n4,max_name[20];
cin >> "%d\n",&n);
sum=0;
max=0;
for(i=1; i<=n; i++)
{
cin >> "%s%d%d %c %c%d\n",name,&n1,&n2,&n3,&n4,&n5);
if(money(n1,n2,n3,n4,n5)>max)
{
max=money(n1,n2,... | ALGO | 0.993558 | 3.150136 |
191f3b56-03df-434a-94d8-828df9c37823 | SagenHansda19/Contest | Codeforces_Round_993_(Div.4)/C_Hard_Problem.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int m, a, b, c;
cin >> m >> a >> b >> c;
int r1 = min(a, m);
int r2 = min(b, m);
int remr1 = m - r1;
int remr2 = m - r2;
int rest = min(c, remr1 + remr2);
cout << r1 + r2 + rest << '\n';
}
int main(){
ios_base::sync_with_stdio(fal... | ALGO | 0.99996 | 3.811579 |
b9f3fc57-68b4-4150-8eaf-f79e0f35aba0 | regitabish/competitive-programming | leetCode/arai60/10.cpp | /**
* Definition for singly-linked list.
* 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) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbe... | ALGO | 0.999905 | 6.316962 |
edcbe5ea-5999-47a1-abde-43120e686ad1 | firiexp/contest_log | atcoder/Other/bitflyer2018_final-C.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;
template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
int main() {
map<int, i... | ALGO | 0.999076 | 4.041494 |
b23fca8a-2298-4da3-9dc5-33522cf79bd4 | uneq95/AlgorithmicProgramming | hackerrank/domains/algorithms/dynamic-programming/longest_common_subsequence.cpp | #include<iostream>
using namespace std;
//https://www.hackerrank.com/challenges/dynamic-programming-classics-the-longest-common-subsequence
int main(){
int n,m;
cin >> n >> m;
int x[n],y[m];//the two sequences
int b[n+1][m+1];
//array b stores the LCS length
//array a stores the path for obta... | ALGO | 0.999993 | 3.42276 |
b51aa595-d678-4da2-bdab-f1dae8f4e654 | DhruvGahoi/ds-zero | learning-dp/279.cpp | class Solution {
public:
int arr[10001];
int helper(int n){
if(n == 0) return 0;
if(arr[n] != -1) return arr[n];
int minCount = INT_MAX;
for(int i = 1; i * i <= n; i++){
int result = 1 + helper(n-i*i);
minCount = min(minCount, result);
}
... | ALGO | 0.999985 | 5.423485 |
e7aed54c-b2a8-4cd2-b990-8f3bd023da8b | leodayvison/estruturas-de-dados | lista1/q2.cpp | #include <iostream>
#include <vector>
using namespace std;
int buscaBinariaImpares(vector<int> v, int x){
int r, p = 1;
if(v.size()%2 != 0) r = v.size();
else r = v.size() - 1;
while(p <= r){
int q = (p+r)/2;
if(v[q] == x) return v[q];
if(v[q] < x) p = q + 2;
if(v[q] > ... | ALGO | 0.999942 | 4.781579 |
2dfea9f2-95c6-4fca-a4e9-f7dd0bd7dd5c | xhcstudy/Cplusplus | set multiset容器/set插入和删除.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
#include <set>
//setвݺɾ
//insert(elem); //вԪ
//clear(); //Ԫ
//erase(pos); //ɾposָԪأһԪصĵ
//erase(beg, end); //ɾ[beg, end)ԪأһԪصĵ
//erase(elem); //ɾֵΪelemԪ
//void PrintSet(const set<int> &s)
//{
// for (set<int>::const_iterator it = s.begi... | TOOL | 0.909639 | 3.187212 |
1f5ad21c-bf7d-46c1-9070-22309f1fb2c9 | saipraneeth1009/Leetcode-problems | 1715-split-a-string-into-the-max-number-of-unique-substrings/1715-split-a-string-into-the-max-number-of-unique-substrings.cpp | class Solution {
public:
void maxCount(string s,vector<string> &ans,int i,int &maxi){
if(i==s.size()){
int count=ans.size();
maxi=max(maxi,count);
return;
}
string dummy="";
for(int j=i;j<s.size();j++){
dummy+=s[j];
if(find(... | ALGO | 0.999988 | 5.861392 |
c20ddeec-90cc-48aa-b8e1-f040d0fffbc4 | biswass101/phitron_cpp_for_DSA | Module-6.5&7.5(Practice Day)/practice_problem_1.cpp | #include<bits/stdc++.h>
using namespace std;
class Student
{
public:
string name;
int roll;
int marks;
};
int main()
{
int n; cin >> n;
Student a[n];
for(int i= 0; i < n; i++)
{
cin >> a[i].name >> a[i].roll >> a[i].marks;
}
for(int i = 0; i< n - 1; i++)
{... | ALGO | 0.999938 | 4.209467 |
c5dbe128-18d5-4261-b0aa-fb3ba2073300 | reven86/dreamfarmgdk | Source/third_party/boost_1_58_0/libs/bimap/example/mi_to_b_path/mi_bidirectional_map.cpp | /******************************************************************************
Boost.MultiIndex
******************************************************************************/
#include <boost/config.hpp>
//[ code_mi_to_b_path_mi_bidirectional_map
#include <iostream>
#include <boost/tokenizer.hpp>
#include <boost/m... | ALGO | 0.975203 | 6.431124 |
c7fd3f1d-24ea-4cb1-9c72-b128b1e47625 | n99joon/AlgorithmProblems | CPPTester/Leetcode/668HardBetter.cpp | class Solution {
public:
bool kSmaller(int n, int m, int num, int k) {
int c = 0;
for (int i = 1; i <= m; i++)
c += min(n, num/i);
return c >= k;
}
int findKthNumber(int m, int n, int k) {
int lo = 0, hi = m*n, mid, res;
while (lo < ... | ALGO | 0.999992 | 5.656696 |
741ef3a7-85c6-4588-adcc-e0d4c9c05b3f | syncfusion/SfQtWebKit | qtbase/src/corelib/tools/qstring.cpp | #include "qstringlist.h"
#include "qregexp.h"
#include "qregularexpression.h"
#include "qunicodetables_p.h"
#ifndef QT_NO_TEXTCODEC
#include <qtextcodec.h>
#endif
#include <private/qutfcodec_p.h>
#include "qsimd_p.h"
#include <qnumeric.h>
#include <qdatastream.h>
#include <qlist.h>
#include "qlocale.h"
#include "qlocal... | TOOL | 0.982918 | 4.742927 |
a7c39c7f-b6ca-40fa-8cad-5393f72ada51 | mohitgupta02/Leetcode_ans | 1036-rotting-oranges/1036-rotting-oranges.cpp | class Solution {
public:
int orangesRotting(vector<vector<int>>& grid) {
int n = grid.size();
int m = grid[0].size();
queue<pair<pair<int, int>, int>> q;
vector<vector<int>>vis(n,vector<int>(m,0));
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
... | ALGO | 0.999969 | 6.197457 |
79eccb56-9e65-4b8f-973b-c19528a91f35 | azizulnayem/Data-Structure-Algorithm-Laboratory | Assignment 01/Activity Selection Problem.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Activity {
int start_time;
int finish_time;
};
bool compare(Activity a1, Activity a2) {
return a1.finish_time < a2.finish_time;
}
vector<Activity> greedyActivitySelector(vector<Activity>& activities) {
sort(activi... | ALGO | 0.999984 | 5.390191 |
9d650b12-3c4a-402e-908c-be64e37b0883 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4623_12.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, x[N], y[N];
int X[N], Y[N], cnt[2][2];
int main() {
scanf("%d", &n);
for (int i = (int)(1); i <= (int)(n); i++) {
scanf("%d%d", &x[i], &y[i]);
X[i] = x[i];
Y[i] = y[i];
}
sort(X + 1, X + n + 1);
sort(Y + 1, Y + n + 1);
in... | ALGO | 0.999925 | 4.366818 |
276e7f60-4120-44f2-87f2-721a274f64d3 | KAYTERDOESTHINGS/Cpp-Practice | KTLT-Baitap/Chuong4/Bai4Chuong4.cpp | #include<iostream>
#define SIZE 100
using namespace std;
void xuat(int x);
void nhap(int A[], int &n, int &x);
int timXnhiPhan(int A[], int left, int right, int x);
int main()
{
int A[SIZE],n,x,left,right;
nhap(A,n,x);
left=0;
right=n-1;
int kq= timXnhiPhan(A,left,right,x);
xuat(kq);
return 0;
}
void xuat(i... | ALGO | 0.999974 | 4.32549 |
3bb92bef-5763-47ae-b2c7-424427078c39 | Gilgameshgb-1/ProgrammingTechniques | T4/Z4/main.cpp | //TP 2018/2019: Tutorijal 4, Zadatak 4
#include <iostream>
#include <string>
#include <cmath>
template <typename NekiTip>
NekiTip UnosBroja(std::string a,std::string b,NekiTip &c)
{
int belaj=1;
bool isdouble=false;
std::string str;
while(1) {
std::cout<<'\n';
std::cout<<a;
std:... | ALGO | 0.990003 | 4.569107 |
39e4bc46-4569-4543-abf8-d2daf31ebd9f | bishnumishra98/DSA | Leetcode&Gfg/14. Graphs/33_Bellman-Ford.cpp | // • The Bellman-Ford algorithm is a graph algorithm used to find the shortest paths from a single source vertex
// to all other vertices in a directed weighted graph.
// • It cannot be used directly on undirected graphs. To use it, we have to convert undirected graph to directed graph.
// For example, if there is... | ALGO | 0.99998 | 5.864414 |
713ba724-6709-481f-9017-d4b23cc7a5ed | DANIS-4512/dsa | practice/quick_sort.cpp | #include <iostream>
using namespace std;
int binarysearch(int input[],int n,int key){
int start=0,end=n-1;
for (int i = 0; i < n-1; i++)
{
int mid=start+(end-start)/2;
if (input[mid]==key)
{
return mid;
}else if (input[mid]>key)
{
end=mid-1;
... | ALGO | 0.999947 | 4.282401 |
13e3f040-23f1-43a3-9e5e-ae367b0b3106 | Surajsinhar77/DASandAll | CPP/DSA/Array/Daily Practice/unionNdIntersection.cpp | #include<iostream>
using namespace std;
void unION(int ary[],int ary2[],int n){
int ary3[n*2];
for(int i =0; i<n; i++){
ary3[i] = ary[i];
}
// int i = 0;
int k = n;
for(int i =0; i<n; i++){
for(int j=0; j<n; j++){
if(ary3[j] == ary2[i]){
break;
... | ALGO | 0.999208 | 3.714524 |
7e9c68a2-b241-445a-9f0a-daed002f7fc3 | hnjog/Algorithm | 프로그래머스/0/181852. 뒤에서 5등 위로/뒤에서 5등 위로.cpp | #include <vector>
#include <algorithm>
using namespace std;
vector<int> solution(vector<int> num_list) {
sort(num_list.begin(),num_list.end());
vector<int> answer(num_list.begin() + 5,num_list.end());
return answer;
} | ALGO | 0.999637 | 3.938788 |
a09ead06-8cc4-442b-b6ba-5b274e66eb1f | sakshamVerma08/DSA | Sliding Window/findXSumOfKLongSubarray.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
// Uses Unordered map and Priority Queue. The calculateXSum is required for findXSum.
// time complexity: O(N) + O(N* k log k)
// space complexity : O(2k)
vector<int> findXSum(vector<int> &nums, int k, int x)
{
unordered_map<int, int> mpp;
vecto... | ALGO | 0.999789 | 5.461759 |
23d2c9e7-d7cd-4cc9-83b4-cf16189e4cb4 | Arun-sharma-1/Dsa | 4.1_Queue/pro_4_queue_using_stack.cpp | #include<bits/stdc++.h>
using namespace std;
class Queue
{
public:
stack<int>s1,s2;
// we are using two stacks for implemeting
void enqueue(int n) // O(n)
{
while(!s1.empty())
{
int t=s1.top();
s2.push(t);
s1.pop();
}
s1.push(n);
... | ALGO | 0.999543 | 4.473049 |
763d78c0-e302-4816-9d87-f3e9f0962646 | Spike7964/unsettled_files | c语言实例/阶乘(for)1.0.cpp | #include <stdio.h>
int main() {
int num;
scanf("%d", &num);
int i = 1;
int fact = 1;
for (i = 1; i <= num; i++) {
fact *= i;
}
printf("%d\n", fact);
} | ALGO | 0.999963 | 5.00888 |
07c00ce2-c2df-47c2-98b3-231d94da8ff3 | Badar-Ur-Zaman/Leetcode | 102-binary-tree-level-order-traversal/binary-tree-level-order-traversal.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.999923 | 6.295725 |
3cbca5ad-994a-4cd5-9107-cb6f3939cac4 | frankkn/CodeForce | HackerRank/110_spring_ids_lab_may_02/template.cpp | /*
* author: jamie
* email: <EMAIL>
*/
#include <iostream>
#include <memory>
struct Node
{
Node (uint64_t k = 0): key {k}, left_subtree_size {} {}
uint64_t key;
uint64_t left_subtree_size;
std::unique_ptr<Node> left;
std::unique_ptr<Node> right;
};
class BinarySearchTree
{
public:
bool Empty () const;
... | ALGO | 0.999853 | 5.068479 |
a1c1f3e1-b48a-404e-ada1-8d5d5ac15df7 | ArinGaon/basic_study | algorithm/isPrime.cpp | #include <iostream>
#include <vector>
#include <cmath> // sqrt();
using namespace std;
bool isPrime(int a) { // Ҽ Ǻ Լ
if (a < 2)
return false;
else if (a == 2)
return true;
else if (a > 2) {
for (int i = 2; i <= sqrt(a); i++) {
if (a % i == 0)
return false;
}
return true;
}
}
int main() {
ios:... | ALGO | 0.999938 | 4.883785 |
4fbf2f09-d086-4166-af5a-ccc2095c1aba | maruf-ahammed-75/problem-solve-for-cp | Code Forces/Playlist.cpp | // playlist
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void I_Am_Here() {
int n,k;
cin >> n >> k;
vector<pair<int,int>>a(n);
for(int i=0 ; i<n ; i++){
cin>>a[i].second>>a[i].first;
}
sort(a.begin(),a.end());
// cout<<endl;
// for(int i=0 ; i<n ; i++){
... | ALGO | 0.999928 | 3.464358 |
022b7004-4cba-4efc-b42f-4fbe371647b3 | ishandutta2007/codeforces | aid/normal/736/D.cpp | #ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif
#define sz(x) ((int) (x).size())
#define TASK "text"
const int inf = (int) 1.01e9;
con... | ALGO | 0.999918 | 4.020902 |
ff13be22-9de8-472b-843c-a12d24502988 | divyamu2015/Kids-Shopping-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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.