uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
aaac7c7b-d9b2-4006-8829-15567d4d458f | mailhonor/lib-zc | cpp_src/charset/detect.cpp | /*
* ================================
* <EMAIL>
* http:/linuxmail.cn/
* 2017-01-06
* ================================
*/
#include "zcc/zcc_charset.h"
#include <cmath>
#define mydebug \
if (var_debug_mode) \
zcc_info
zcc_namespace_begin;
zcc_general_namespace_begin(charset);
#pragma pack(push, ... | ALGO | 0.983183 | 5.155713 |
a6df206d-6c28-440d-a9ac-3d05e1811c8e | RomanBapst/PX4_mavros | fw_att_controller/include/fw_att_controller/eigen/doc/snippets/Tutorial_solve_triangular.cpp | Matrix3f A;
Vector3f b;
A << 1,2,3, 0,5,6, 0,0,10;
b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vector3f x = A.triangularView<Upper>().solve(b);
cout << "The solution is:" << endl << x << endl;
| ALGO | 0.999861 | 3.055453 |
a66a13fa-1824-4ce4-bfbd-2979cb3142ef | hhy018/opencv | modules/photo/src/contrast_preserve.cpp | #include "precomp.hpp"
#include "opencv2/photo.hpp"
#include <cmath>
#include <vector>
#include <limits>
#include "contrast_preserve.hpp"
using namespace std;
using namespace cv;
void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _color_boost)
{
CV_INSTRUMENT_REGION();
Mat I = _src.getMat();
... | ALGO | 0.993099 | 4.186191 |
c7036650-ed84-4c45-9878-cafd89311c5a | walnia/walnia | a/动态内存.cpp | #include<iostream>
using namespace std;
void swap(int& refa, int& refb) {
int t = refa;
refa = refb;
refb = t;
cout << refa << endl << refb << endl;
/*int* A = &a;
int* B = &b;
int* C =A;
A = B;
B = C;*/
}
int main()
{
int a, b;
cin >> a >> b;
int& refa=a;
int& refb=b;
cout <<"before"<< a << endl << b << ... | ALGO | 0.999216 | 3.168979 |
83dee28b-2628-47b9-ba7c-a3d807dbcd15 | kidclone3/CP | ACMTRAINING/Implement/Task_1/Codeforce-1369B.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ar array
#define vt vector
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define ll long long
#define ld long double
#define ii pair<int, int>
#defin... | ALGO | 0.999955 | 4.183908 |
1fe77218-0bc3-4ef3-a387-f893e1e2ee2d | Murad501/Phitron | Contests/Codeforces/Codeforces Rounds/Div 3/1016/A_Ideal_Generator.cpp | // 08/04/2025 20:37
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define all(x) x.begin(), x.end()
#define ll long long int
#define yes cout << "YES" << '\n'
#define no cout << "NO" << '\n'
#define cyes cout << "Yes" << '\n'
#define cno cout << "No" << '\n'
#define minus cout << -1 << '\n'
#define zero... | ALGO | 0.999695 | 5.291213 |
c9582371-e7ab-43cc-8b88-dd3e538fb637 | Charbel-11/Competitive-Programming | Contests/Codeforces/710 Div3/A.cpp | #include <iostream>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int t; cin >> t;
while (t--) {
ll n, m, x; cin >> n >> m >> x;
x--;
ll row = x... | ALGO | 0.999943 | 4.169094 |
96eb0aed-7488-4b75-af87-78f9ac2fe002 | Vaibhav-22-dm/Cpp-Codes | Sliding Window/count_anagrams_in_window.cpp | #include <bits/stdc++.h>
using namespace std;
int count_anagrams(string s, string a) {
map<char, int> m;
int n = 0;
for (int i = 0; i < a.size(); i++){
if(m.count(a[i])==0){
m[a[i]] = 1;
n++;
}
else m[a[i]] += 1;
}
cout << "n: " << n << endl;
for(... | ALGO | 0.999766 | 4.415411 |
8248b49b-f787-46c0-a2ef-30f20fa9af88 | robban112/AvalgProject1 | 2opt.cpp | #include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <random>
std::vector<std::vector<int> > distMatrix;
std::clock_t start;
double timeLimit = 2;
int size;
inline void startTimer() {
start = std::clock();
}
i... | ALGO | 0.999987 | 4.422152 |
5899d91b-8e11-4783-b8c3-e14cc60ce474 | galloska/ACM-ICP-Summer-trainining-camp-2015 | 3D.cpp | #include <bits/stdc++.h>
using namespace std;
struct datos{
int val, id;
};
int n;
int num[100002];
datos arr[100002];
int islas = 1;
int res = 0;
int vis[100002];
bool doble (datos a, datos b){
return a.val < b.val;
}
int main (){
freopen ("islands.in", "r", stdin);
freopen ("islands.out", "w",... | ALGO | 0.99997 | 4.487539 |
7b5119ec-69f4-4304-b49f-5a6e8fb3cbde | ohseongtaek/Programmers_Algorithm | 338_배열만들기2/소스.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(int l, int r)
{
vector<int> answer;
for (int i = l; i <= r; i++)
{
string t = to_string(i);
bool flag = false;
for (int j = 0; j < t.size(); j++)
{
if (t[j] == '5' || t[j] == '0')
... | ALGO | 0.999531 | 4.249386 |
09954587-99af-4c3f-b691-b8894d0f2c3e | kang814/cs104-git-practice | homework-resources/hw1/palindrome.cpp | /**
* Incorrect code to identify palindromes
*/
#include <iostream>
#include <sstream>
#include <cstring>
using namespace std;
bool helper (stringstream &input, int len)
{
char prev;
//if we are at the midpoint of the string, return true.
if (len == 0) return true;
/**
* If the length of the string is odd... | ALGO | 0.998575 | 5.014424 |
446689d2-a1b0-4fde-b69c-8458108b4e10 | sanjaykazi/Leetcode-StudyPlan | Data structure - 2/addstrings.cpp | class Solution {
public:
string addStrings(string num1, string num2) {
int i = num1.size() - 1;
int j = num2.size() - 1;
int carry = 0;
string res = "";
while(i>=0 || j>=0 || carry){
long sum = 0;
if(i >= 0){sum += (num1[i] - '0');i--;}
if(j >= 0){sum += (num2[j] - '0');j--;}... | ALGO | 0.999865 | 6.662565 |
2d651ac8-3fe4-476b-abda-e17b3425aa0b | Srayan-Codex10/CP-Problems | C++/linkedlist.cpp | #include <iostream>
using namespace std;
typedef struct node
{
int data;
node *next;
node *prev;
} Node;
Node *rear, *front;
Node *create_node(int val)
{
Node *link;
link = (Node *)malloc(sizeof(Node));
link->data = val;
link->next = NULL;
link->prev = NULL;
return link;
}
void in... | ALGO | 0.99997 | 5.320116 |
2bc07443-5432-4f95-9ee6-151628a0f718 | Manish-kasera/DSACPPLearnin-Coding-Ninja- | recString.cpp | #include<bits/stdc++.h>
using namespace std;
int helper(int i,char ch[])
{
if(ch[i] == '\0' )
return i;
return helper(i+1,ch);
}
int length(char ch[])
{
int len = 0;
return helper(0,ch);
}
int length2(char ch[])
{
if(ch[0] == '\0')
return 0;
int smallans1 = length2(ch+1);
return 1 + smallans1;
... | ALGO | 0.999776 | 3.079879 |
1c80d2e5-b33d-486e-98da-afe6d8036965 | Neuronsmatrix/workspace | olympiads/codeforces/Div_3/div 3 748/a.cpp | #include <bits\stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
constexpr int INF = INT_MAX-1;
constexpr ll LINF = LLONG_MAX-1;
constexpr char nl = '\n';
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define tiii tuple<int,... | ALGO | 0.999911 | 5.288601 |
14371134-2238-42da-b683-fafb16e1287d | SwitchGDX/switch-gdx | switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp | #include "btStridingMeshInterface.h"
#include "LinearMath/btSerializer.h"
btStridingMeshInterface::~btStridingMeshInterface()
{
}
void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleIndexCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
{
(void)aabbMin;
(void)aabbM... | ALGO | 0.895849 | 6.360922 |
fd873ef1-3ced-4683-8261-fab701024af9 | sejal-varu/rust_calc | 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 |
3b40a2c8-392a-4194-9835-fc91dd5f245e | ufal/korektor | src/morphology/morphology.cpp | #include <fstream>
#include "morphology.h"
#include "persistent_structures/bit_array.h"
#include "persistent_structures/packed_array.h"
#include "spellchecker/configuration.h"
#include "utils/io.h"
namespace ufal {
namespace korektor {
//for some factors, there are a lot of possibilities per word, however the number... | TOOL | 0.894151 | 4.204234 |
c63f7f39-c91b-4c1b-9f56-5a6178ba48c7 | SUSHANTSINGH01/CP-AND-DSA | CP/medium/strings_operation.cpp | // https://www.codechef.com/problems/STROPERS
#include <bits/stdc++.h>
using namespace std;
#define md 1000000007
#define fast ios_base::sync_with_stdio(false)
#define fast1 cin.tie(0)
#define fast2 cout.tie(0)
#define ulli long long int
long long int ans=0;
int main()
{
fast;
fast1;
fast2;
int t;
... | ALGO | 0.999707 | 4.352046 |
985f859b-a8a6-4653-b347-f08bc550427e | vansh-kapila/Coding_Blocks_CPP | atcoder883.cpp | /* Author : VANSH KAPILA */
/* "The greatest glory in living lies not in never falling, but in rising every time we fall." -*/
#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define int long long
#define ld long doubl... | ALGO | 0.999918 | 4.063427 |
05a52cfc-ec39-41ae-8388-e99a75a080f6 | HekpoMaH/Olimpiads | ALGO ACADEMY/octoberfest2013/d.cpp | #include<bits/stdc++.h>
using namespace std;
string x;
vector<int> groups;
void getgr()
{
int br=1;
for(int i=x.size()-1;i>=0;i--)
{
//br++;
cout<<i<<" "<<br<<endl;
if(br==3)
{
groups.push_back((x[i]-'0')*100+(x[i+1]-'0')*10+x[i+2]-'0');
br=1;
... | ALGO | 0.999649 | 3.807852 |
30a66a37-726a-4605-a41f-1aa2c1a75a89 | TJChiang/algorithm | c_plus_plus/leetcode/0059-Spiral_Matrix_II/spiral_matrix_ii.cpp | #include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
class Solution {
public:
vector<vector<int> > generateMatrix(int n) {
// 二維陣列
vector<vector<int> > res(n, vector<int>(n, 0));
// 每一圈的起始 x 座標與 y 座標
int start_x = 0, start_y = 0;
... | ALGO | 0.999648 | 5.070115 |
ec3a2970-2baa-42fa-97ec-f5c800ce13ba | andreriedel/code-signal | 1-intro/2-edge-of-the-ocean/cpp/matrixElementsSum.cpp | int solution(vector<vector<int>> m) {
int sum = 0;
for (int i = 0; i < m.size(); i++) {
for (int j = 0; j < m[0].size(); j++) {
if (m[i][j] == 0) continue;
if (i >= 1 and m[i - 1][j] == 0) {
m[i][j] = 0;
continue;
}
sum +... | ALGO | 0.999861 | 5.949712 |
9929145c-cf5d-4e70-8c81-66cfe75c5707 | givemagalaxy/star23sharp | frontend/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.998303 | 6.76775 |
18b5ad74-2683-428d-91b5-ee3782f1edad | actium/codeforces | 1500/20/1523c.cpp | #include <iostream>
#include <string>
#include <vector>
template <typename T>
std::istream& operator >>(std::istream& input, std::vector<T>& v)
{
for (T& a : v)
input >> a;
return input;
}
void answer(const std::vector<std::string>& v)
{
for (const std::string& x : v)
std::cout << x << '\... | ALGO | 0.999702 | 4.940796 |
5196cb25-e611-4662-8077-002884eff232 | ishandutta2007/codeforces | pigstd/normal/1612/F.cpp | #include<bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define WT int TT=read();while(TT--)
#define NO puts("NO");
#define YES puts("YES");
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar()... | ALGO | 0.999864 | 3.561846 |
48a3c993-0d44-4e84-8969-b689d8b370ae | codemonkeyricky/lc | 2617.cpp | #include <iostream>
#include <vector>
#include <cassert>
#include <stack>
#include <queue>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <cmath>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
... | ALGO | 0.999983 | 5.754133 |
e1832f8e-da98-4024-b1f8-5c503a2087ca | CuriousCI/codeforces | 131A.cpp | #include <iostream>
#include <regex>
#include <string>
#include <cstdint>
#include <algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(NULL);
cin.tie(NULL);
string sentence;
cin >> sentence;
regex expression(" [a-z]?[A-Z]+ ");
smatch match;
if (regex_search(sentence, match, regex("^[a-z]... | ALGO | 0.999817 | 4.95036 |
ef12dc83-42ec-4243-ac23-aabd59b91800 | codefosu/Telco-Customer-Churn-ML-Predictor | myenv/Lib/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.998445 | 7.198757 |
1175924f-1269-4a57-8923-2852c5e525f8 | AdriaSerraMoral/CodingTestExamples | MinWindowSubstring/min_window_substring.cpp | /////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Problem Statement:
//
// Given a string S and a string T, find the minimum window in S which will contain all the
// characters in T in complexity O(n).
//
//
//////////////////////////////////////////////////... | ALGO | 0.999805 | 6.965065 |
5f4e47cc-80b4-4379-a638-74859fd8c718 | Saurav-Sutaria/LeetCode | 283-move-zeroes/283-move-zeroes.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums) {
int i = 0, j =1;
while(i <= j && j < nums.size()){
if(nums[i] != 0) i++;
else{
if(nums[j] != 0){
swap(nums[i],nums[j]);
i++;
}
... | ALGO | 0.999981 | 6.153889 |
9fe73619-a64b-4f0e-81f0-2923073e9edd | AlijonTursunboyev/lab5 | problem9.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int data) : data(data), next(nullptr) {}
};
class LinkedList {
public:
Node* head;
LinkedList() : head(nullptr) {}
void createList() {
int value;
cout << "Enter integers : "<<endl;
... | TOOL | 0.988248 | 5.28675 |
e3318be1-0830-4c10-87d9-9e5f1ce360e8 | urvishah305/LeetCode | 380-insert-delete-getrandom-o1/insert-delete-getrandom-o1.cpp | class RandomizedSet {
public:
unordered_map<int,int> mp;
vector<int> v;
RandomizedSet() {
}
bool searchEle(int val){
if(mp.find(val) != mp.end()){
return true;
}
return false;
}
bool insert(int val) {
if(searchEle(val)){
retur... | ALGO | 0.999182 | 6.083773 |
67747a78-8e56-4375-926d-f7e69821dab4 | 1bijay/Numerical_method | taylor_series.cpp | #include <stdio.h>
#include <math.h>
double taylor_series_sin(double x, int n) {
double result = 0;
for (int i = 0; i < n; i++) {
result += pow(-1, i) * pow(x, 2 * i + 1) / tgamma(2 * i + 2);
}
return result;
}
int main() {
double x;
int n;
printf("Enter the value of x: ");
sc... | ALGO | 0.999078 | 5.904892 |
3288f704-33e6-4ec1-851a-7a707eb2178c | luwei0917/GlpG_Nature_Communication | src/KOKKOS/improper_harmonic_kokkos.cpp | /* ----------------------------------------------------------------------
Contributing author: Stan Moore (SNL)
------------------------------------------------------------------------- */
#include <mpi.h>
#include <math.h>
#include <stdlib.h>
#include "improper_harmonic_kokkos.h"
#include "atom_kokkos.h"
#include ... | ALGO | 0.996508 | 6.740561 |
e1f8c02b-7f92-4867-8e09-1bdf7ba6e4e5 | alexandraback/datacollection | solutions_5695413893988352_1/C++/nolasuz/B.cpp | #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <b... | ALGO | 0.999956 | 4.371219 |
5da1bcbf-8a80-4429-a21e-8e35f054e9ce | ishandutta2007/codeforces | alexluchianov/normal/840/D.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
using ll = long long;
int const nmax = 300000;
int v[1 + nmax];
struct Query{
int x;
int y;
int id;
int k;
};
vector<int> frec... | ALGO | 0.999999 | 4.178629 |
54ce384d-5733-47b3-8841-60fa15ad349b | shaikhikram04/DSA-with-Cpp | Heap/min_cost_of_rope.cpp | // https://practice.geeksforgeeks.org/problems/minimum-cost-of-ropes-1587115620/1
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
//Function to return the minimum cost of connecting the ropes.
long long minCost(long long arr[], long long n) {
long long cost = 0;
... | ALGO | 0.999818 | 4.719276 |
b9143dc8-37fc-4d05-b0c4-aaec5368281b | ishandutta2007/codeforces | kaitokid/normal/1203/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int t;
int n,cnt[10009];
vector<int>v;
int main()
{
ios::sync_with_stdio(0);
cin>>t;
while(t--)
{
v.clear();
bool bl=true;
int x;
for(int i=0;i<10009;i++)cnt[i]=0;
cin>>n;
for(int i=0;i<4*n;i++){cin>>x;cnt[x]++;}
for(int i=1;i<10009;i++)
{
if(cnt[i]%2=... | ALGO | 0.999859 | 3.675144 |
753f4336-2d5f-471c-ae04-ccc0203f7574 | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/06/0622/personal_submission/cf1033c_Lu_xZ.cpp | #include<bits/stdc++.h>
#define eb emplace_back
#define ep emplace
using namespace std;
using ll = long long;
constexpr int N = 1e5 + 5;
int n, a[N], in[N], f[N];
vector<int> g[N];
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n;
for(int i = 1; i <= n; ++ i) cin >> a[i];
for(int i = 1; i <= n; ++ i) {
fo... | ALGO | 0.999901 | 3.520215 |
69a120e2-0a87-4014-b02b-b59a6a0829d6 | kawauso-github/cpp | Bohyoh/chap03/list0310.cpp | // 1n܂ł̘a߂
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "1n܂ł̘a߂܂B\n";
do {
cout << "n̒lF";
cin >> n;
} while (n <= 0);
int sum = 0; // v
int i = 1;
while (i <= n) {
sum += i; // sumi
i++; // iCNg
}
cout << "1" << n << "܂ł̘a" << sum << "łB\n";
}
| ALGO | 0.990362 | 3.386726 |
a5cfb45a-7447-45a2-8e14-5d2946d9d963 | al3sha9/cpp-1 | lab tasks/lab/friend class/temperature.cpp | #include<iostream>
using namespace std;
class TemperatureConverter{
private:
float Celsius, Fahrenheit;
public:
TemperatureConverter(float Celsius, float Fahrenheit){
this->Celsius = Celsius;
this->Fahrenheit = Fahrenheit;
}
friend class CelsiusConverter;
friend class Fahr... | TOOL | 0.910851 | 6.791912 |
d3c6e1af-1377-4122-8134-00157cd2cb0d | Aadarsh-26/Hackerrank-basic-questions-solved | tables.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=10;i++)
{
cout<<n<<" x "<<i<<" = "<<n*i<<endl;
}
} | ALGO | 0.98959 | 3.466982 |
9a2fb95c-5ef4-48fa-a2bd-64bbd8b54400 | Zu-rin/AtCoder | AtCoder_Beginner_Contest/ABC080/ABC080D.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MOD 1000000007
#define INF 1 << 30
using namespace std;
typedef long long ll;
int main(void) {
int num, m, i, j, a, b, c, ans = 0;
cin >> num >> m;
vector<vector<int>> d(m, vector<int>(100001, 0));
for (i = 0; i < num; i++) {
s... | ALGO | 0.999967 | 4.250668 |
bd21dc38-30d1-4bfa-82b1-0a641cd554b3 | AkashKarnatak/cses | sorting_and_searching/sum_of_four_values.cpp | #include <cstdint>
#include <vector>
#ifndef _LOCAL_DEBUG
#include <bits/stdc++.h>
#endif
#include <algorithm>
#include <iostream>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
class Sum {
public:
int32_t i;
int32_t j;
int32_t v;
Sum(int32_t i, int32_t j, int32_t v) : i(i... | ALGO | 0.999984 | 4.416404 |
6edbb877-3b21-433b-afe0-8a64e53eca9d | suhsein/algorithm | 프로그래머스/0/181936. 공배수/공배수.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int number, int n, int m) {
return (!(number % n) && !(number % m));
} | ALGO | 0.999796 | 5.339475 |
01e5abac-1fb8-45e6-b98e-b226aa3c1ffc | ned14/boost-release | libs/numeric/ublas/doc/samples/compressed_matrix.cpp | #include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
compressed_matrix<double> m (3, 3, 3 * 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = 3 * i +... | TOOL | 0.96899 | 3.002881 |
8f5876b8-f46a-4511-b27e-fe354aa2f622 | nickmcgreivy/sparse_solve_tests | generate_sparse_solve/eigen-3.4.0/doc/examples/TutorialLinAlgSetThreshold.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2d A;
A << 2, 1,
2, 0.9999999999;
FullPivLU<Matrix2d> lu(A);
cout << "By default, the rank of A is found to be " << lu.rank() << endl;
lu.setThreshold(1e-5);
cout << "With threshold 1e-5... | ALGO | 0.999736 | 4.090376 |
c7194ef1-22fe-410b-b8cb-2f6ddceb8b9d | NikitaBabich26rus/SPbU-HomeWork | Semester1/htable/htable/List.cpp | #include <stdio.h>
#include <string.h>
#include "List.h"
#include "HashTable.h"
struct ListElement
{
char word[sizeOfWord]{};
ListElement* next = nullptr;
int amount = 0;
};
struct List
{
ListElement* head = nullptr;
int sizeOfList = 0;
};
List* createList()
{
return new List;
}
bool empty(List* list)
{
retu... | ALGO | 0.961866 | 4.120035 |
7e9e010f-3b38-4ede-8949-220316d7d6ef | Ignisko/Leetcode_Cpp | 58. Length of Last Word.cpp | #include <iostream>
using namespace std;
class Solution {
public:
int lengthOfLastWord(string s) {
int count = 0;
for (int i = s.length() - 1; i >= 0; i--) {
if (s[i] == ' ') {
if (count == 0) continue; // Skip trailing spaces
else break; // End of the la... | ALGO | 0.999073 | 5.65667 |
be75a798-546a-4f88-ba35-d8a942102eb7 | Niltiwari7/Topic-wise-question-for-Interview | Bit manupulation/medium/1829. Maximum XOR for Each Query.cpp | class Solution {
public:
vector<int> getMaximumXor(vector<int>& nums, int maximumBit) {
int _xor = pow(2,maximumBit)-1;
int n = nums.size();
vector<int>prefix(n,0);
prefix[0] = nums[0];
for(int i = 1;i<nums.size();i++){
prefix[i] = prefix[i-1]^nums[i];
}
... | ALGO | 0.999986 | 5.490188 |
1b272ed3-6b27-491e-93c5-89fa4d410dd0 | lee-honey/CodingTest-Study | 12주차/리코쳇 로봇/hyeonwoo.cpp | #include <string>
#include <vector>
#include <queue>
#include <iostream>
#define MIN(a,b)(((a)<(b))?(a):(b))
#define INF 999999
using namespace std;
// dfs -> 시간초과
int dx[4] = { -1,1,0,0 };
int dy[4] = { 0,0,1,-1 };
bool visited[101][101];
int depth[101][101];
void bfs(vector<string> board, int x, int y) {
queu... | ALGO | 0.999703 | 5.191265 |
ca3c94f9-b4f9-492e-b8ef-1fbcf5f64fbb | gurpreet1205/Hackerearth-Problems | SpecialShop.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int t,a,b,x,y,n,c,c1;
cin>>t;
while(t--)
{
cin>>n>>a>>b;
x=(b*n)/(a+b);
y=n-x;
c=a*x*x+b*y*y;
if(x<n)
{
x=x+1;
y=y-1;
c1=a*x*x+b*y*y;
if(c1<c)
c=c1;
}
cout<<c<<"\n";
}
return 0;
} | ALGO | 0.999847 | 3.482179 |
84b4fa9a-56fa-487d-ab22-ffe365d05780 | gonzamol/EDA | Diccionarios y aplicaciones de TADs/confHidrogafica/main.cpp | #include <iomanip>
#include <iostream>
#include <stdexcept>
#include <string>
using namespace std;
//FUNCIONA PERFECTO
#include "List.h"
#include "ConfHidro.h"
void mostrarLista(List<Rio> l){
List<Rio>::Iterator it = l.begin();
if (it != l.end()){
cout << " " << it.elem() << endl;
it.next();
}
while (it... | TOOL | 0.868195 | 3.747887 |
3bce6e96-a126-4a6c-abb2-a4c00b12ee6f | Sudhanwa11/Data-Structures-And-Algorithms-In-cpp | ARRAYS CODES/Word break 2/word break 2.cpp | class Solution {
public:
vector<string> wordBreak(string s, vector<string>& wordDict) {
unordered_set<string> wordSet(wordDict.begin(), wordDict.end());
unordered_map<string, vector<string>> mem;
return wordBreak(s, wordSet, mem);
}
private:
vector<string> wordBreak(const string& s,... | ALGO | 0.999918 | 6.6953 |
2de9755b-be28-424d-97a6-d5b0479d27d2 | vayer2005/acm | 1600s/697E.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define int long long
using vpi = vector<pair<int, int>>;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<v... | ALGO | 0.999942 | 4.374007 |
2b23e722-59f9-4926-9f93-9fdf7c613655 | ishandutta2007/codeforces | zqyyy/normal/1279/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read(){
int f=1,r=0;char c=getchar();
while(!isdigit(c))f^=c=='-',c=getchar();
while(isdigit(c))r=(r<<1)+(r<<3)+(c&15),c=getchar();
return f?r:-r;
}
const int N=1e6+7;
int n,K,L,ans,a[N];
ll f[N],g[N];
char str[N];
inline int check(ll mi... | ALGO | 0.999973 | 3.660676 |
2f0e6c9b-a2a3-47d5-93c6-c96e0a20b56b | stephsanchez89/Chapter-7_7.10_5 | Chapter 7_7.10_5.cpp | // Chapter 7_7.10_5.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
int Calculation_Choice = 0;
char Shape;
double Radius = 0;
double Height = 0;
double Width = 0;
... | TOOL | 0.966687 | 3.939154 |
60a01e32-c104-413e-9e4f-a746a57d77c0 | aritra-sen/DSA-Practice | algo/backtracking/solve-sudoku.cpp | #include <iostream>
using namespace std;
int sudoku[9][9];
bool isSafe(int r,int c,int val)
{
for(int i=0;i<9;i++)
if(sudoku[i][c]==val)
return false;
for(int i=0;i<9;i++)
if(sudoku[r][i]==val)
return false;
int br = r/3;
int bc = c/3;
for(int i=br*3;i<(br+1... | ALGO | 0.998852 | 5.390157 |
fba239eb-39a7-4117-9583-4e7276699a96 | biprodasroy/Online-Judge-Solutions | ProjectEuler-Solutions/pe008 - Largest product in a series.cpp | #include <bits/stdc++.h>
using namespace std;
#define lng long long
lng mx= 0, mul=1;
int main() {
string s;
cin>>s;
for(int i=0;i<1000-13;i++){
mul=1;
for(int j=i;j<i+13;j++){
mul = mul * (s[j]-'0');
}
mx= max(mx, mul);
}
cout<<mx;
}
//ans: 235146... | ALGO | 0.999651 | 4.219759 |
23d63af0-63ce-41bb-bd81-95d70e202f74 | Booooooooooo/wyb---ACM | 贪心/D AC.cpp | #include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
int t,peo[1005];
scanf("%d",&t);
while (t--)
{
int n,i;
int time1=0,time2=0,time =0;
int flag=1,p[1005]={0},cnt=0;
printf("\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&peo[i]);
}
sort(peo,peo+n);
... | ALGO | 0.999956 | 3.240977 |
6be33440-fa22-40aa-a584-9f2192889d4a | ishandutta2007/codeforces | matrixcascade_qwq/normal/1172/F.cpp | #include <bits/stdc++.h>
#define int long long
#define up(i,x,y) for(int i=x,i##end=y;i<=i##end;++i)
#define down(i,x,y) for(int i=x,i##end=y;i>=i##end;--i)
using namespace std;
int n, m, k;
int read()
{
int s = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
... | ALGO | 0.999951 | 4.166184 |
59a972f7-5acf-4c48-a18f-27e522bdca7f | susuok/cp2015860009 | HW 1-4/ex1-4.cpp | #include <stdio.h>
int main () {
int a;
printf(" ԷϽÿ : \n");
scanf("%d", &a);
if (80 <= a && a <=100)
printf(" AԴϴ. \n");
else if ( 60 <= a && a <= 80)
printf(" BԴϴ. \n");
else if ( 40 <= a && a < 60 )
printf(" CԴϴ. \n");
else if ( 20 <= a && a < 40 )
printf(" DԴϴ. \n");
else
printf(" EԴϴ... | ALGO | 0.997095 | 3.199754 |
8cc1db46-34a4-4de6-97fb-f2dcaa379ef9 | PetarV-/HashCode2017Finals | main.cpp | #include <iostream>
#include <queue>
#include <vector>
#include <cassert>
using namespace std;
const int N = 1000;
int n, m, radius, cost_edge, cost_router, budget, start_i, start_j;
char board[N][N];
struct coord
{
int i, j;
} ;
// ----------
// ----------
// backbone
struct edge
{
int from, to;
int len;
}... | ALGO | 0.999095 | 3.897471 |
703a6d34-dafa-45ce-a5f9-9bcca60ae57d | bongende/estrutura-de-dados-em-C- | 7_tabela_hash/main.cpp | #include <iostream>
#include "aluno.h"
#include "tabela_hash.h"
using namespace std;
void gerenciar_hash(int tam_vetor, int max, string nomes[]) {
}
int main() {
string nomes[] = {"Aberto", "ema", "imi", "home", "ben", "emili", "vens"};
return 0;
}
//! ***************************************** TABELA HAS... | ALGO | 0.997839 | 3.911045 |
da1193df-a261-42d4-855c-8ae8ca77b07d | patiltops10/manoj | Assignment/module 4/templates/2.cpp | #include <iostream>
#include <algorithm>
// Template function to sort an array
template <typename T>
void sortArray(T arr[], int n) {
std::sort(arr, arr + n);
}
int main() {
int arrInt[] = {5, 3, 1, 4, 2};
std::cout << "Before sorting: ";
for (int i = 0; i < 5; i++) {
std::cout << arrInt[i] <<... | ALGO | 0.999886 | 6.128628 |
0474d995-bd22-40d4-b08a-05768a53d075 | Zaira98742/KS24B-JPN-203-dev-C | S6/S6-Ex6.cpp | #include <cstdio>
int main() {
for (int i = 1; i <= 100; ++i) {
if (i % 3 == 0 && i % 5 == 0) {
printf("FizzBuzz\n");
} else if (i % 3 == 0) {
printf("Fizz\n");
} else if (i % 5 == 0) {
printf("Buzz\n");
} else {
printf("%d\n", i);
... | ALGO | 0.998921 | 5.567431 |
075e5f03-0556-4d80-8e5f-e4601573281d | jimjin73/compro | ABC/168/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
ll K;
int main(){
cin >> K;
cin >> s;
if(s.size() <= K){
cout << s << endl;
}else{
for(int i=0;i<K;i++) cout << s[i];
cout << "...";
cout << endl;
}
return 0;
} | ALGO | 0.999579 | 3.554351 |
a711f6dd-ae5a-4f63-acaa-48fde3b258d3 | Halliburton-Landmark/xulrunner-24.0 | intl/icu/source/tools/toolutil/denseranges.cpp | #include "unicode/utypes.h"
#include "denseranges.h"
// Definitions in the anonymous namespace are invisible outside this file.
namespace {
/**
* Collect up to 15 range gaps and sort them by ascending gap size.
*/
class LargestGaps {
public:
LargestGaps(int32_t max) : maxLength(max<=kCapacity ? max : kCapacity)... | ALGO | 0.997909 | 7.401211 |
ce03b1ca-163d-42f2-8a58-26ddb1ef9277 | DanielBrown1998/Challenge_Alura | 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.998485 | 6.76775 |
151eab48-1d20-4f5c-b605-7c03b7ff0792 | zwei-chen/OpenSource | r3live_ws/src/R3LIVE/src/rgb_map/rgbmap_tracker.cpp | #include "rgbmap_tracker.hpp"
Rgbmap_tracker::Rgbmap_tracker()
{
cv::TermCriteria criteria = cv::TermCriteria((cv::TermCriteria::COUNT) + (cv::TermCriteria::EPS), 10, 0.05);
if (m_lk_optical_flow_kernel == nullptr)
{
m_lk_optical_flow_kernel = std::make_shared<LK_optical_flow_kernel>(cv::Size(21, 2... | ALGO | 0.985148 | 4.831008 |
de6372c4-ef34-4b0b-8d8e-dd652972492a | Autoratch/submissions | Evaluator/oct12_assign.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
string a,b;
cin >> a >> b;
int x = 0,y = 0,p = 0,q = 0,t = 0;
bool va = false,pa = false;
vector<string> ans;
while(x<a.length() and y<b.length())
{
char xx = a[x],yy = b... | ALGO | 0.999942 | 3.390772 |
b77150b3-76e7-45d9-b479-7f6984c2740a | codewithmanik1/C_with_Classes_CPP | Reference_Var/clByRef3.cpp |
//call By reference
//Swap by using reference
#include<iostream>
void fun(int &ref1, int &ref2){
int temp = ref1;
ref1 = ref2;
ref2 = temp;
}
int main() {
int x = 20, y = 50;
std::cout << x << " " << y << std::endl;
fun(x,y);
std::cout << x << " " << y << std::endl;
ret... | ALGO | 0.997871 | 4.815703 |
26cab288-f6ab-49c4-b7d9-2f62b26b3310 | PaukIsUha/optimizing_formating_code | predictions/full_output_predicted_submissions/Codenet/p00998/104734515/original.cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
struct Treap {
struct node {
int value;
node *left, *right;
int priority;
int cnt;
int small;
node(int v) : value(v), priority(rand()), cnt(1), small(v) {
left = right = NULL;
}
};
node *root;
Treap() : root... | ALGO | 0.999981 | 4.288063 |
ed1cbb80-41d4-44b1-bf43-66ceb753134b | husscc/leetcode | unsolved/ScrambleString_Recursive.cpp | /*
Given a string s1, we may represent it as a binary tree
by partitioning it to TWO NON-EMPTY SUBSTRINGS RECURSIVELY.
Below is ONE POSSIBLE representation of s1 = "great":
great
/ \
gr eat
/ \ / \
g r e at
/ \
a t
To scramble the string, we may choose any non-leaf nod... | ALGO | 0.99998 | 6.106487 |
e8a06ed4-bdcf-42f1-86f3-7757b14d8581 | MartinoPhoenixVox/ProgrammingIntroduction | On_Thi_Cuoi_Ky/hoc_Bu/HocBu_1.cpp | #include <iostream>
#include <conio.h>
#include <iomanip>
using namespace std;
const int tienK1 = 20000, tienK2 = 45000;
const int tien1 = 5, tien2 = 7, tien3 = 10, tien4 = 15, tien5 = 20;
void clear()
{
_getch();
system("cls");
}
int main()
{
double gioVao, gioRa, tienK, kyTruoc, kySau, ky, tien;
do
{
do {
... | ALGO | 0.961506 | 3.269633 |
a2337ef6-5360-41df-9fcc-90b7141f6355 | wsxdrorange/UVA | Cpp/10815-AndysFirstDictionary.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
using namespace std;
void MergeSortA(int low , int high);
void MergeA(int low ,int mid ,int high);
vector<string> words;
void MergeSortA(int low , int high)
{
int mid = 0;
if(low < high)
{
mid = ((low+high... | ALGO | 0.999151 | 4.347531 |
0dcaa76c-637d-4e4a-a8f3-3d236b6b00da | Lohithnath2910/Leetcode | 543-diameter-of-binary-tree/diameter-of-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.999868 | 6.319187 |
49f7643d-4d47-42f0-823b-33c2c2a40c7c | madhur3u/DSA-Questions | LeetCode/838 Push Dominoes.cpp | // https://leetcode.com/problems/push-dominoes/
class Solution {
public:
string pushDominoes(string d) {
// adding a L and R at extremes wont have any effect
// this will help us in dealing with edge cases
d = 'L' + d + 'R';
string res = "";
// two pointers, both w... | ALGO | 0.999983 | 6.783962 |
6acf62e4-db05-4aa3-aad3-7c34e8e71c8a | Anower77/GERBAGE-CODE | Week-15 (Super Zone)/E.cpp | #include "bits/stdc++.h"
#define ll long long
using namespace std;
const ll N = 1e5+5;
void solve()
{
ll n; cin>>n;
if(n==1)
{
cout<<1<<'\n';
return;
}
if(n%2) cout<<"-1\n";
else{
ll t=0, len=n, i=0, j=n-1, c=0;
while(i<=j)
{
if(c%2)
{
ll cur=0;
if(j<t)
{
cur=(n+j)-t;
... | ALGO | 0.999715 | 4.367903 |
488d6d16-e75d-4302-aad8-a260d907a79f | masterchef2209/coding-solutions | codes/codechef/MAGICJAR.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int arr[n];
int sum=0;
for(int i=0;i<n;i++)
{
cin>>arr[i];
sum+=(arr[i]-1);
}
sum+=1;
cout<<sum<<endl;
}
return 0;
} | ALGO | 0.999451 | 3.77702 |
81b11866-d9ce-447b-a3e6-142f3b6c86f8 | InnovatorMind/ZeroToHeroDSAPractice | 1. Core (or Fundamentals)/06_Functions/Practice_Problems/program10.cpp | // Float Return Type:
// Write a function calculateAverage that takes an array of integers and i
// ts size as parameters and returns the average of the numbers as a float.
#include <iostream>
using namespace std;
// Function to calculate the area of a circle
float calculateArea(float radius) {
const float PI = ... | ALGO | 0.998779 | 4.930585 |
75d8de37-cb74-4a68-a0bf-dba090646920 | yogeshnarendratiwari/CP-GALAXY | Binary Search Tree/Insertion/Iterative Insertion.cpp | #include <iostream>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
} *root = NULL;
void insert(int key)
{
struct Node *t = root;
struct Node *p, *r;
if (root == NULL)
{
p = (struct Node *)malloc(sizeof(struct Node));
p->data = key;
... | ALGO | 0.99996 | 4.607403 |
fcb953a5-e7f1-4a3f-b254-582142dbb691 | ishandutta2007/codeforces | afterall/normal/1693/A.cpp | #include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
//#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize("Ofast,no-stack-protector,un... | ALGO | 0.999742 | 4.025806 |
fe1dbd66-d16e-4a71-8316-7de44085eaf1 | majkeloess/oopExam | poExam/rozw/egz10.cpp | #include <iostream>
#include <functional>
#include <vector>
#include <algorithm>
int add2(int n)
{
return n + 2;
}
std::function<std::vector<int>(std::vector<int>)> liftToVector(std::function<int(int)> fun)
{
return [fun](std::vector<int> vec)
{
std::vector<int> ret_vec(vec.size());
for (s... | ALGO | 0.990988 | 6.045101 |
7cf65835-9a9a-4d39-b173-fe56ff093b5b | imsangamesh/DSA-Mac | 000_DSA/008_WEEK_5_ASS/10_string_to_interger.cpp | //*
//* ◉ ● ⇒
//* --------------------------------------
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
//? if number > INT_MAX, clamp it to INT_MAX
//? if number < INT_MIN, clamp it to INT_MIN
//? if there is no num, return 0.
int myAtoi(string s) {
int number = 0, i = 0;
int s... | ALGO | 0.997402 | 4.590388 |
5c089eb7-a37b-45c7-9e53-923d79dcd134 | ishandutta2007/codeforces | kpw29/normal/479/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long ll;
typedef unsigned long lon... | ALGO | 0.999994 | 3.478324 |
8a777940-b246-441f-aa86-c6cf501748cc | alexandraback/datacollection | solutions_5766201229705216_0/C++/mostleg/GCJ2014R2.cpp | // GCJ2014R2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#pragma warning(disable:4996)
using namespace std;
int T;
int A,B;
int N;
int edge[1024][1024];
int num[1024];
int del[1024];
int tot[1024];
void init()
{
cin >> T... | ALGO | 0.999346 | 5.041105 |
5531679e-81e2-48c6-9905-8dfaab725c36 | yzf/algorithm | soj/1012. Stacking Cylinders.cpp | #include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstdio>
using namespace std;
int main()
{
//freopen( "input.txt", "r", stdin );
//freopen( "output.txt", "w", stdout );
int count;
int i, k;
double y, x[10];
for(cin >> count; count != 0; cin >> count)
... | ALGO | 0.9997 | 3.644892 |
7b73765a-4507-438d-99d7-9504b6d51fb0 | retroBro3/CP_codings | DSA && CP Topics/DSA/Semester 2/Week 02 - Graph Algorithm/Module 6.5 - Practice Day/Practice_1.cpp | /*
You will be given an undirected graph. Print its DFS traversal
in reverse order. Consider root as 1.
*/
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<int> graph[N];
int visited[N];
void reverseDFS(int s = 1)
{
visited[s] = 1;
for (auto i : graph[s])
{
if... | ALGO | 0.999995 | 5.221345 |
32544953-fa43-48cd-a44a-33df10b7ca51 | TrellixVulnTeam/cs425_PA2_QILF | gem5/src/systemc/tests/systemc/misc/semantic/2.3/T_2_3_1_5_neg/T_2_3_1_5_neg.cpp | /*****************************************************************************
T_2_3_1_5_neg.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**********************************************************************... | ALGO | 0.966551 | 3.195102 |
72d703e5-7691-4da2-b484-7aef00fc6f6d | sunilrpandey/cpp | code_concepts/06_stl_programming/05_diff_iter_type.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <list>
using namespace std;
int main()
{
std::vector<int> vec1{1,2,3,4,5};
std::vector<int> vec2{10,20,30,40,50};
auto iter_2 = find(vec1.begin(), vec1.end(),2);
if(iter_2 != vec1.end()){
cout << "\nFound : " << *iter_2;
}
... | TOOL | 0.968243 | 4.088812 |
c098858a-becd-41c3-bbd6-9927cfb6a73d | mollaomar991/Class_Code_DSA1 | Class 2/BubbleShort.cpp | #include<stdio.h>
int main()
{
int n= 4;
int arr[100]= {4,10,6,9};
int temp,i;
for( i=0; i<=n-2; i++)
{
for( int j=0; j<=n-2-i; j++)
{
if(arr[j]>arr[j+1])
{
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
... | ALGO | 0.999916 | 3.097871 |
a8a2df3d-a77f-4a75-a5b8-1b1d39cbbd34 | whitearmorq/test | pimutex_fixed.cpp | #include <pthread.h>
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <signal.h>
int FLAG = 0;
int iter = 10000;
int c_thr;
double pi = 0.0;
pthread_mutex_t pi_lock = PTHREAD_MUTEX_INITIALIZER;
typedef struct Parts
{
double n1;
double n2;
int step;
double partial_sum;
} Parts;
voi... | ALGO | 0.999707 | 4.384202 |
c7c5f87a-dacc-48b0-ad20-8c152e9edc40 | binhtran29/Code-C | Part 1/C5.cpp | #include<stdio.h>
#include<stdlib.h>
#define For(i,a,b) for(int i=a;i<b;++i)
void ip(int *n, int **a)
{
printf("Nhap n = ");
re:
scanf("%d",n);
if(*n<1){
printf("Nhap lai n = ");
goto re;
}
*a = (int*) malloc(sizeof(int) * (*n));
printf("Nhap cac phan tu... | ALGO | 0.999873 | 3.438262 |
8cac7624-2f2a-4144-85b1-157fc93c3540 | shivamkcodes/codeFor15 | solutions/day10.1Word.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
string s;
cin >> s;
int l = 0, u = 0;
for (char c : s)
{
if (islower(c))
l++;
else
u++;
}
if (l > u || l == u)
transform(s.begin(), s.end(), s.begin(), ::tolower);
... | ALGO | 0.999824 | 5.260502 |
93843ac2-f11a-491f-9d9d-1cea413b662b | Mugdha-Hazra/180-Questions-Striver-SDE-sheet-in-CPP | Count Total Setbits - GFG/count-total-setbits.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// using the fact :
// summation r * nCr is the sequence sum till 2^n. Then the remaing is say x then sum += x+countBits(x);
class Solution {
long long solve(long long x){
long long sum=(x*1ll * pow(2,x-1... | ALGO | 0.999951 | 6.088991 |
45245daf-e230-4711-919f-c209003154c7 | OzzieIsaacs/winmerge-qt | ext/boost_1_70_0/libs/graph/example/print-edges.cpp | using namespace boost;
template < typename Graph, typename VertexNamePropertyMap > void
read_graph_file(std::istream & graph_in, std::istream & name_in,
Graph & g, VertexNamePropertyMap name_map)
{
typedef typename graph_traits < Graph >::vertices_size_type size_type;
size_type n_vertices;
typena... | ALGO | 0.986024 | 5.660892 |
70318bb7-0b64-4a1e-bbad-abf8eb5b602f | sarrhub/DSA-PRACTICE | DS_pivot_binary_search.cpp | #include<iostream>
using namespace std;
int getPivot(int arr[],int n){
int start=0;
int end = n-1;
int mid = start+(end-start)/2;
while(start<end){
if(arr[mid]>=arr[0]){
start=mid+1;
}else{
end=mid;
}
mid = start+(end-start)/2;
}
return sta... | ALGO | 0.999949 | 5.342077 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.