uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
151fa9ae-012e-4cf4-ba86-0169c0dca1be | jaekunchoi/hacker_rank | maximizing_xor.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include "maximizing_xor.h"
using namespace std;
int maxXor(int _l, int _r) {
int results = _l ^_r;
return results;
}
maximizing_xor::maximizing_xor() {
int L, R, A, B, res;
vector<int> xor_results;
cin >> A >> B;
for (; A <= B; ++A... | ALGO | 0.999931 | 3.93252 |
a67d5d30-c256-4cd8-b8f5-0745fc6708b2 | somedude72/usaco-practice | bronze/hard/01/main.cpp | /*
USACO Bronze 2016: Angry Cows (Hard)
https://www.usaco.org/index.php?page=viewproblem2&cpid=592
*/
#include <algorithm>
#include <fstream>
#include <iostream>
#include <vector>
using namespace std;
int explode_cow(vector<int>& hay_line, int cow_index) {
int upper_bound;
int lower_bound;
int explosion... | ALGO | 0.999965 | 5.21485 |
5dbbf404-5f45-4d70-8e89-35f8cd13fa19 | InvalidNamee/OJ-AC-Repository-for-UPC | AC_code/跟随唐克练编程基础系列/3889_字符串/60_BI_密码判断.cpp | #include <iostream>
using namespace std;
char a[26];
bool check(char c) {
return c == '~' || c == '!' || c == '@' || c == '#' || c == '$' || c == '%' || c == '^';
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int n;
cin >> n;
while (n--) {
string s;
bool a[... | ALGO | 0.998771 | 4.724942 |
27025dbe-ca02-4a47-aa39-20a199fa507e | Coderaman-tech/Data-Sturcture-Code | Graph/noOfProvinces.cpp | class Solution {
public:
void dfs(int i,vector<int>adjsls[],vector<int>&vis){
vis[i]=1;
for(auto it:adjsls[i]){
if(!vis[it]){
dfs(it,adjsls,vis);
}
}
}
int findCircleNum(vector<vector<int>>& adj) {
int V=adj.size();
vector<int>adjls[V];
... | ALGO | 0.999979 | 5.980741 |
5eab93ae-369f-4762-a067-61f745f68a9f | Balachandar04/Dsa | Arrays/C++/majority.cpp | #include<bits/stdc++.h>
using namespace std;
int brute_solve(vector<int> &vec,int len){
int count = 0,element=INT_MIN;
for(int i=0;i<len ;i++){
count =0;
for(int j = i+1;j<len;j++){
if (vec[i] == vec[j]){
count++;
}
}
if(count > len/2){
element = vec[i];
break;
}... | ALGO | 0.999915 | 4.307553 |
0ac31149-04ba-4d8d-b391-2d92c7da7fe7 | ta-061/Atcoder_review | rating-contest/abc399/d/main.cpp | #include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//brew install boost
//#include <atcoder/modint>
using namespace std;
//using namespace atcoder;
template<typename T> using vc = vector<T>;
template<typename T> using vv = vc<vc<T>>;
using ull = unsigned long long;
using ll = long long;
ll INF = 2... | ALGO | 0.998825 | 4.443502 |
0465e49f-414f-42a1-8a3f-395ec25e6be2 | kevinrjt/leetcode-archive | ReorderList/main.cpp | #include <iostream>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
void PrintList(ListNode* head)
{
while(head)
{
cout << head->val << " ";
head = head->next;
}
cout << endl;
}
void reorderList(ListNode* head)
{
... | ALGO | 0.999988 | 5.270147 |
fa0f7a42-76a2-4cbc-b258-172222ea3317 | transfer-learning/llvm-tl45 | clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp | #include "clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h"
#include "clang/Lex/DependencyDirectivesSourceMinimizer.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Threading.h"
using namespace clang;
using namespace tooling;
using namespace dependencies;
CachedFileSystemEntry CachedFil... | TOOL | 0.863918 | 7.584403 |
6594c18a-5152-4791-a424-2b9fdb3c7521 | evialbert/LeetCode | 2671-frequency-tracker/2671-frequency-tracker.cpp | class FrequencyTracker {
public:
map<int, int>m, m1;
//vector<int>v;
FrequencyTracker() {
}
void add(int number) {
//v.push_back(number);
if(m.find(number)!=m.end()){
m1[m[number]]--;
if(m1[m[number]]==0){
m1.erase(m[number]);
... | ALGO | 0.999315 | 6.02462 |
1ab511be-0ff0-4f52-80a3-ccad2de8a113 | Subham90/leetcode-daily | 0066-plus-one/0066-plus-one.cpp | class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
for(int i = size(digits) - 1; i >= 0; i--){
if(digits[i] != 9){
digits[i]++;
return digits;
}
else{
digits[i] = 0;
if(i == 0)... | ALGO | 0.999822 | 6.780651 |
fe9ef12c-2389-417d-be67-fa4bea77bef3 | arpitasapehia13/DSA_LeetcodeSolution | LinkedList/Leetcode1721.cpp | // SWAPPING NODE IN LL
/**
* 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:
... | ALGO | 0.999997 | 5.749208 |
35808b51-78ea-4e3b-82e0-c28bc00d42c3 | PrajvalBadiger/leet-code | number-of-operations-to-make-network-connected.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
void dfs_each(int node, vector<vector<int>> adj, vector<bool> &visited) {
visited[node] = true;
for (int u : adj[node]) {
if (!visited[u]) {
dfs_each(u, adj, visited);
}
}
... | ALGO | 0.999834 | 5.980098 |
596c28be-cd20-4b43-b83d-f4a474c1df0d | yugalgaur174/Leetcode-Problems | 1463-the-k-weakest-rows-in-a-matrix/1463-the-k-weakest-rows-in-a-matrix.cpp | class Solution {
public:
vector<int> kWeakestRows(vector<vector<int>>& mat, int k) {
vector<int> arr;
for(int i=0;i<mat.size();i++){
int a=0;
for(int j=0;j<mat[0].size();j++){
if(mat[i][j]==1){
a++;
}
}
... | ALGO | 0.999957 | 5.542206 |
4071de11-c054-4600-be46-f4e9314eba71 | ricglz/COJ-Problems | 3000-3999/3817.cpp | #include <iostream>
#include <cmath>
using namespace std;
bool isPrime(long divisor){
if (divisor==2 || divisor==3 || divisor==5 || divisor==7 || divisor==11 || divisor==13){
return true;
}
else if(divisor%2!=0 || divisor%3!=0 || divisor%5!=0 || divisor%7!=0 || divisor%11!=0 || divisor%13!=0){
double root = sq... | ALGO | 0.999947 | 4.102195 |
805cb7a7-0f1d-44f0-9aaf-458fe8eddbe4 | jaywangpku/Algorithm | 暑假刷题/8月14日/丢失的圣诞袜.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, ans = 0;
cin >> n;
for(int i = 0; i < n; i++){
int temp;
cin >> temp;
ans ^= temp;
}
cout << ans << endl;
return 0;
}
| ALGO | 0.99999 | 4.289747 |
d4beb68f-84a4-465d-89b3-d4ac617180c0 | Aaronhdez/Grado-Ingenieria-Informatica | Segundo Ingenieria Informatica (Plan 40)/Metodos Numericos para la Computacion/Ejercicios Alumno/Prueba 1/Repaso 19_09_2/EjerciciosBasicos.cpp | /// INCLUSION DE LIBRERIAS NECESARIAS
#include <stdio.h>
#include "EjerciciosBasicos.h"
/// FUNCIN QUE CALCULA LA MEDIA DE UN VECTOR
real mn_media(Array1D< real > &u){
real total = 0;
for(int i=0; i<u.dim(); i++){
total +=u[i];
}
return total/u.dim();
}
/// FUNCIN QUE CALCULA EL MAXIMO DE UN V... | ALGO | 0.999786 | 3.449326 |
2fc2cf97-948e-4ffe-8259-518def23cada | DurgaSravanthiP/DSA-with-Cpp | reverseWordsInString.cpp | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string ReverseWords(string str){
int n=str.length();
string ans="";
reverse(str.begin(),str.end());
for(int i=0;i<n;i++){
string word="";
while(i<n && str[i]!=' '){
word+=str[i];
i++;
... | ALGO | 0.999979 | 5.116302 |
00135154-64db-472d-810b-9f8e7e2a2865 | opsifiz/TOI-Zero | A2/A2-026.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
string name[n+5];
int w[n+5];
int cnt = 0;
for(int i=1;i<=n;i++){
cin>>name[i]>>w[i];
cnt += (w[i]>15);
}
int mx = -1e9;
string res = "-1";
for(int i=1;i<=n;i++){
if(w[i] > mx){
mx = w[i];
res = name[i];
}
}
cout<<cnt<<'\n... | ALGO | 0.999703 | 4.02566 |
264e955b-12bb-4c11-b15f-85188f1ed61d | projeto-de-algoritmos/Greed_GreedyProblems | codeforces/contrast_value.cpp | /**
* author: mralves
* created: 15-05-2023 02:38:21
**/
#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
using namespace std;
using ll = int64_t;
ll ceil(ll a, ll b) {return a % b == 0 ? a / b : a / b + 1;}
void solve() {
int n;
cin>>n;
vector<int> a(... | ALGO | 0.999706 | 5.39758 |
06e4bff1-99df-4ca0-b7d8-148e087fece8 | erictsaii/leetcode-practice | 394_Decode_String.cpp | class Solution {
public:
string decodeString(string s) {
string ans = "";
for (auto& c : s) {
if (c != ']') ans.push_back(c);
else {
// first, extract string
string tmp = "";
while (ans.back() != '[') {
tmp.p... | ALGO | 0.999715 | 6.076918 |
3c002ffa-a065-46ef-a0bd-e626163b0fe5 | luanma-sys/matrix_Calculate | 线代服务器代码/myproject/public/eigen3/doc/examples/class_CwiseBinaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template binary functor
template<typename Scalar> struct MakeComplexOp {
EIGEN_EMPTY_STRUCT_CTOR(MakeComplexOp)
typedef complex<Scalar> result_type;
complex<Scalar> operator()(const Scalar& a, const Scalar& b... | ALGO | 0.956178 | 6.700232 |
386396b8-f72c-4ec0-9d23-63811a557db4 | Jashwanth-SR/DSA-lab-codes | question1.cpp | //Header files
#include <stdio.h>
#include "sort.h"
//Function prototypes:
void include_input(int *,int);
void printarr(int *, int);
//Main function
int main(){
while(1){
//Asking array input from the user:
int len;
printf("Enter the number of elements you want to enter in an array: "... | ALGO | 0.999069 | 3.860581 |
2d687ea8-9c98-4c23-bdeb-ec05c7489ef0 | Panchiman/TP-2-Conceptos-de-programacion | ejercicio7.cpp | #include <iostream>
using namespace std;
int main()
{
string nombre;
string nombreMayor;
int contadorLetras = 0;
int contadorLetrasMayor = 0;
for (int i = 0; i < 10; i++)
{
cout << "Ingrese un nombre: ";
cin >> nombre;
contadorLetras = nombre.length();
if (contad... | ALGO | 0.981348 | 4.549265 |
cb233255-393a-4cee-8db7-14ee133a074e | Factoriall/Algorithm-2021 | DP/2342_ddr_dp.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int INF = 987654321;
int dp[5][5];
int getPower(int now, int next) {
if (now == 0) return 2;
if (abs(now - next) == 2) return 4;
return 3;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
for (int i = 0; i < 5; i++) {
for (i... | ALGO | 0.999853 | 4.149275 |
d7670fd6-aeb5-40d2-8ab8-76339aab1754 | MaudHousman/myFHE | FHE_demo/src/engine/tinyconfig.cpp | #include <algorithm>
#include "tools.h"
#include "tinyconfig.h"
#include "BinaryFileReader.h"
using namespace std;
bool SpaceCompare(char a, char b)
{
return isspace(a) && isspace(b);
}
string ModifyKey(const string& str)
{
string keyString = StringTrim(StringLower(str));
// remove multiple space
c... | TOOL | 0.963412 | 5.642344 |
7f08d129-b231-41db-8f6a-cc6e10da7c65 | TigranMikayelyan/Homeworks | C++/Homework5/28.cpp | // Մուտքագրել թիվ, փոխակերպել թիվը տասնվեցական համակարգի թվի եւ տպել արդյունքը։
#include <iostream>
int main()
{
int num = 0;
std::cout << "Enter a number and I will convert the number to hexadecimal and print the result" << std::endl;
std::cin >> num;
const int size = 30;
char arr[size];
int i = 0;
while (nu... | ALGO | 0.976871 | 5.456685 |
ba4fc621-30bc-4bdf-a0b0-9aa32488196a | NurulFikrySolakhudin23/Lab-Algo2-222310051 | Tugas_Pertemuan 8/KonsepTREE.cpp | #include <iostream>
#include <stdio.h>
using namespace std;
struct Node{
int data;
Node *kiri;
Node *kanan;
};
void tambah(Node **root, int databaru)
{
if((*root) == NULL)
{
Node *baru;
baru = new Node;
baru->data = databaru;
baru->kiri = ... | ALGO | 0.997199 | 4.685126 |
3a81d18b-a4f5-4be2-8bb5-5b66900e6822 | NAYRA92/flutter_course_july | 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 |
63c2672d-91f2-40ac-9161-43dbc34bb711 | falcaoanderson/CompetitiveProgramming | OBI/obi-2008-chuva.cpp | // 05/11/20 // 6:23 PM //
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define ll long long
//#define int long long
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
const int MAXN = (... | ALGO | 0.996392 | 3.7817 |
eebae8ef-07b3-4deb-9329-7ad634b1a8ce | TheAbhisar/cpp_workspace | coin_flip.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int t,g;
cin>>t;
while(t--) {
cin>>g;
while(g--) {
int i,n,q;
cin>>i>>n>>q;
if(n%2==0)
cout<<n/2<<endl;
else {
if(i==1) {
if(q==1) {
cout<<n/2<<endl;
}
else {
cout<<(n/2) + 1<<endl;
}
}
... | ALGO | 0.998804 | 3.002021 |
5455c488-088c-4731-854b-ed6f768ccf1c | rockaman7/D.S.A | Sorting/insertionSort.cpp | #include <bits\stdc++.h>
using namespace std;
void Insertion_sort(int arr[],int n ){
for ( int i = 0 ; i<=n-1; i++){
int j = i ;
while ( j>0 && arr[j-1]> arr[j] ){ //condition is j>0 because we assume index 0 element as sorted and later we will compare arr[1] element with arr[0]
//swa... | ALGO | 0.999871 | 5.089238 |
55af4010-899c-4b82-a660-94fabcbd1467 | blockspacer/bootstrap-redux | ext/boost-1.70.0/libs/compute/perf/perf_copy_to_device.cpp | #include <vector>
#include <cstdlib>
#include <iostream>
#include <boost/compute.hpp>
int main(int argc, char *argv[])
{
size_t size = 1000;
if(argc >= 2){
size = boost::lexical_cast<size_t>(argv[1]);
}
boost::compute::device device = boost::compute::system::default_device();
boost::compu... | ALGO | 0.96272 | 5.095197 |
fa45c065-5e6a-4c47-9ee8-8d164df2c8b6 | pastacolsugo/coderfarm | Lezione 08/gravity.cpp | #include <iostream>
#include <vector> // per i vector
#include <stdio.h> // per i freopen
using namespace std;
int main () {
// freopen("input.txt", "r", stdin); // lettura da file
// freopen("output.txt", "w", stdout); // scrittura su file
int n, premuti = 2; // quello iniziale e quello finale
vecto... | ALGO | 0.999935 | 4.245064 |
6dd504d7-bd21-4d50-805d-f8100e449871 | YJ17/codetree-TILs | 240407/숫자들의 배수/multiple-of-numbers.cpp | #include <iostream>
int main() {
// 여기에 코드를 작성해주세요.
int arr[101];
int i = 0;
int c = 0;
scanf("%d", &arr[0]);
while(1){
printf("%d ", arr[i]);
if(arr[i] % 5 == 0){
c++;
if(c == 2){
break;
}
}
i += 1;
... | ALGO | 0.999531 | 3.001778 |
43a3a76b-550b-4aa5-9a1b-0f5a678d130d | raincross7/code-similarity | codes/train_code/problem190/problem190_436.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<P>>
#define fi first
#define se second
constexpr ll mod=1000000007;
constexpr ll INF=(1ll<<60);
constexpr double pi=3.14159265358979323846;
template<typename T> inline... | ALGO | 0.999991 | 4.558285 |
be5f2fed-0ea1-48f0-9339-be18a27930ad | Harshuuu12/OPPS | addtion in constrctor.cpp | #include<iostream>
using namespace std;
class demo
{
public:
int x,y;
demo(int a, int b)
{
x=a;
y=b;
}
return 0;
};
int main()
{
demo d;
cout<<"ENTER THE VALUE OF A"<<endl;
cin>>d.a;
cout<<"ENTER THE VALUE OF B"<<endl;
cin>>d.b;
cout<<"ADDTION IS :"<<a+b<<endl;
return 0;
} | TOOL | 0.916908 | 3.88139 |
66c0aaed-3bc6-4d34-81d0-184bcfd733a6 | anmolss111/Competitive-Code | Spoj/Will it ever stop.cpp | #include<iostream>
#include<ctype.h>
#include<string.h>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
long long int n;
cin>>n;
while(1)
{
if(n%2==0)
{
n=n/2;
}
else
break;
}
if(n==1)
cout<<"TAK"<<endl;
else
... | ALGO | 0.999781 | 4.125772 |
427c4db1-17b1-4aa1-9933-c7c4c42281ce | openjdk/jdk20u | src/hotspot/share/services/diagnosticFramework.cpp | #include "precompiled.hpp"
#include "jvm.h"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "services/diagnosticArgument.hpp"
#include "services/diagnosti... | TOOL | 0.926368 | 7.323194 |
6cf1b7e1-f1c3-41e4-8c73-199af3319fee | Vipul-183/Competitive-Programming | Finding_a_Centroid.cpp | #include <bits/stdc++.h>
using namespace std;
ll seg_len = 0;
vector<ll> seg;
void build(int N, vector<int> arr)
{
seg.clear();
seg_len = (ll)(log2(N));
if (__builtin_popcount(N) > 1)
seg_len++;
seg_len = (1 << seg_len);
seg_len *= 2;
for (int i = 0; i < seg_len; i++)
{ // depen... | ALGO | 0.999887 | 4.436557 |
ee8228ee-30ff-4fb9-96e3-729d35dbdeda | ishandutta2007/codeforces | lqx2005/normal/1295/D.cpp | #include<bits/stdc++.h>
#define int long long
#define lowbit(x) ((x)&(-(x)))
using namespace std;
int T,a,m;
vector<int> p;
void init()
{
int t=m;
for(int i=2;i*i<=t;i++)
{
if(t%i==0)
{
p.push_back(i);
while(t%i==0) t/=i;
}
}
if(t!=1) p.push_back(t);
return;
}
int solve(int x)
{
if(x<=0) return 0;... | ALGO | 0.999847 | 4.51864 |
0c5b01bb-2410-480e-baaa-1ff15c3d3870 | Hurleyworks/LWPluginDev | modules/wabi_core/excludeFromBuild/math/Seg3Tri3Dist.cpp | // ctor
template <typename T>
Seg3Tri3Dist<T>::Seg3Tri3Dist (const Segment3 <T> & segment, const Triangle3 <T> & triangle)
: mSegment(&segment),
mTriangle(&triangle)
{
}
// dtor
template <typename T>
Seg3Tri3Dist<T>::~Seg3Tri3Dist ()
{
}
template<typename T>
T Seg3Tri3Dist<T>::GetSquared()
{
Line3D<T> line(mSeg... | TOOL | 0.997377 | 6.434613 |
66fedab4-7760-4a84-8eb3-120b58b27653 | Rajnikant3862/codingblocks | 14_DeepDivingIntoRecursion/ChallengesDeepDivingIntoRecursion/16ClassAssignment.cpp | //Class Assignment
#include<iostream>
using namespace std;
int assign(int num){
if( num == 1){
return 2;
}
if( num == 2 ){
return 3;
}
return assign( num - 1) + assign( num -2);
}
int main() {
int n;
cin >> n;
int num;
for( int i = 1; i <= n; i++){
cin >> num;
cout << "#" << i <<... | ALGO | 0.999506 | 3.768126 |
0dfdb967-55f1-45cf-91c1-aa7e0fc563a9 | fernandomorato/competitive-programming | cses/Graph Algorithms/1691.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5+5;
vector<pair<int, int>> adj[N];
vector<int> path;
int deg[N], used[N], cnt, n, m;
inline bool check(){
int cnt = 0;
for(int i = 1; i <= n; i++){
if(deg[i]&1){
cnt++;
}
}
return cnt == 0;
}
void find_path(int v){
vector<int> stk;
stk.... | ALGO | 0.999986 | 4.619789 |
320a6a02-27ce-47e5-8ea0-e99a2a8a4c51 | sz3/pywirehair | wirehair/tables/TableGenerator.cpp | #include "HeavyRowGenerator.h"
#include "../test/SiameseTools.h"
using namespace siamese;
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;
#ifdef _MSC_VER
#include <intrin.h> // _BitScanReverse
#pragma intrinsic(_BitScanReverse)
#endif
// Compiler-s... | ALGO | 0.984137 | 5.946627 |
4019620a-211b-46ae-b936-66e8c06c19a3 | singh-shivam789/Data-Structures-with-CPP-Java-Coding-Ninjas | Binary Trees/cpp/Nodes without sibling.cpp | /*
Nodes without sibling
For a given Binary Tree of type integer, print all the nodes without any siblings.
Input Format:
The first and the only line of input will contain the node data, all separated by a single space.
Since -1 is used as an indication whether the left or right node data exist for root, it will not... | ALGO | 0.999989 | 4.982715 |
49bc0ea8-fec8-45f2-844d-2ac0f9623aa3 | Gurmeet-Singh657/LeetCode-GFG | Move Last Element to Front of a Linked List - GFG/move-last-element-to-front-of-a-linked-list.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
class ListNode{
public:
int val;
ListNode *next;
ListNode(int x){
val=x;
next=NULL;
}
};
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
ListNode *moveTo... | ALGO | 0.999917 | 5.983458 |
88123e84-f0a9-4a5d-9b17-3395b187c238 | LOSP/android_frameworks_av | media/libstagefright/codecs/amrwb/src/agc2_amr_wb.cpp | /*
------------------------------------------------------------------------------
Filename: agc2_amr_wb.cpp
Date: 05/08/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-------------------------------------------------------------------------... | ALGO | 0.999954 | 5.915693 |
1c99649c-defc-4418-bcc3-09625a4e60b3 | nguyenign/micmac4wasm | src/xinterf/fen_graph_window.cpp | #include "StdAfx.h"
/*****************************************************************/
/* */
/* Graph_8_neigh_Win_Comp */
/* */
/**************************... | ALGO | 0.987405 | 4.078598 |
749aa9f9-88ca-44bd-b4c7-b2e96493825c | leet-with-me/codility | L4_PermCheck/permcheck.cpp | #include <vector>
#include <iostream>
#include <map>
#include <numeric>
using namespace std;
// https://app.codility.com/demo/results/trainingHJ566N-ZZ6/
// Again you have to notice the little details.
// The question slightly implies this. The range must start with
// 1. So the numbers will be 1 through N. And it... | ALGO | 0.999695 | 5.803969 |
9500ea7f-3505-479d-b046-cfc59ce7c4f0 | jieqiboh/questions | leetcode/201.BitwiseANDofNumbersRange/main.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <bitset>
#include <utility>
#include <numeric>
using namespace std;
void fast() {
... | ALGO | 0.999884 | 5.538616 |
b7d6e013-36db-4fd3-9fd6-37ae9cff4363 | RealtimeRobotics/netgen | libsrc/csg/singularref.cpp | #include <mystdlib.h>
#include <myadt.hpp>
#include <linalg.hpp>
#include <csg.hpp>
#include <meshing.hpp>
namespace netgen
{
SingularEdge :: SingularEdge (double abeta, int adomnr,
const CSGeometry & ageom,
const Solid * asol1,
... | ALGO | 0.992164 | 5.624183 |
4324eb0f-2be6-4dca-bdb5-cd853916f380 | oliviersimard/DMFT_HF_IPT | mainIPT.cpp | #include "src/thread_utils.hpp"
#include "src/json_utils.hpp"
int main(int argc, char** argv){
// Loading parameters from Json file
#ifndef DEBUG
const std::string filename("./../params.json"); // ../ necessary because compiled inside build directory using CMake. For Makefile, set to params.json only (Debu... | ALGO | 0.978399 | 5.429315 |
f90f4741-9c47-4674-89c2-26b7af759d77 | gab-borges/OBI-Training | 2023/F2/distinto.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int n;
cin >> n;
vector<int> A(n);
for(int i = 0; i < n; i++)
cin >> A[i];
unordered_map<int, int> map;
int l = 0;
int tamMax = INT_MIN;
for (int r = 0; r < n; r++) {
if (... | ALGO | 0.999918 | 5.03236 |
cfc68583-c4be-41f4-b09f-c1c49a85b4a7 | RamAgrawal01/DSA | Strings/lec_68/minimumTimeDiffernce.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<climits>
using namespace std;
int findMinDifference(vector<string>&time){
//step 1 intialize a vector to store minutes:
vector<int>timeMinutes;
//step 2 convert HH:MM to minutes integer
for(int i = 0 ; i<time.size();i++){
string c... | ALGO | 0.999499 | 5.516117 |
989d35d7-9158-4b97-a672-20b3b5b42f1f | SoyOscarRH/Wallbreakers | Week3/50-Pow(x,n).cpp | class Solution {
public:
auto myPow(double x, long long n) -> double {
if (n < 0) return 1 / myPow(x, -n);
if (n == 0) return 1;
if (n == 1) return x;
if (n % 2 == 0) return myPow(x * x, n / 2);
return x * myPow(x * x, (n - 1) / 2);
}
};
| ALGO | 0.99985 | 6.356414 |
712566de-2be8-48ee-9281-1ecc77cb58fb | ARPIT226/Leetcode_solutions | 1235.cpp | // Problem Link: https://leetcode.com/problems/maximum-profit-in-job-scheduling/description/
Approach: Dynamic Programming (1-D Dp)
class Solution {
public:
struct Job{
int start, end, profit;
};
static int jobscomp(Job m, Job n){
return m.end < n.end;
}
int binary_search_pr... | ALGO | 0.999988 | 6.059258 |
1b053521-7568-4d45-855c-3b504dc4885e | neerajcodes888/GFG | Easy/Parenthesis Checker/parenthesis-checker.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to check if brackets are balanced or not.
bool ispar(string x)
{
stack<char>s;
for(int it:x)
{
if(it=='('||it=='{'||it=='[')
s.p... | ALGO | 0.997382 | 6.155263 |
46e254ca-e302-43de-b44d-4808df0a0acc | d-coder111/DSAmplify | C++/988_Smallest_String_Starting_From_Leaf.cpp | /*
988. Smallest String Starting From Leaf
You are given the root of a binary tree where each node has a value in the range [0, 25] representing the letters 'a' to 'z'.
Return the lexicographically smallest string that starts at a leaf of this tree and ends at the root.
As a reminder, any shorter prefix of a string is ... | ALGO | 0.999964 | 6.870862 |
d89fbee6-5a9b-496c-9859-c3a76c9590fd | ayush-gupta2002/Datastructures-and-Algorithms | min-max-BST.cpp | int minBST(Node* root){
Node* temp = root;
while(temp -> left){
temp = temp->left;
}
return temp->data;
}
int maxBST(Node* root){
Node* temp = root;
while(temp -> right){
temp = temp->right;
}
return temp -> right;
}
| ALGO | 0.999798 | 4.63657 |
c7505196-8be4-4724-b92a-8363b54d313d | muhammadakfz/Algorithm-Adventures | codeforces/300A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> first, second, third;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (x < 0) first.push_back(x);
else if (x > 0) second.push_back(x);
else third.push_back(x);
}
if (... | ALGO | 0.999936 | 3.668334 |
8d10972d-bb0d-4bd3-b3ee-6b432c89649b | nitish166/Interview-Prepration | STL/Example/Voterlist.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define mod 1000000007
typedef long long int LL;
int arr[500001];
int main()
{
//ios_base:: sync_with_stdio(false); cin.tie(0);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n1, n2, n3;
cin>>n1>>n2>>n... | ALGO | 0.999977 | 3.503161 |
63e71ea3-3ddf-40c7-a3c1-65f2370fddf2 | nis/Numerical-Methods--RB-NUM6-U2-1-F12- | Code/Tools/NR_C301/legacy/nr2/CPP_211/recipes/chebev.cpp | #include "nr.h"
DP NR::chebev(const DP a, const DP b, Vec_I_DP &c, const int m, const DP x)
{
DP d=0.0,dd=0.0,sv,y,y2;
int j;
if ((x-a)*(x-b) > 0.0)
nrerror("x not in range in routine chebev");
y2=2.0*(y=(2.0*x-a-b)/(b-a));
for (j=m-1;j>0;j--) {
sv=d;
d=y2*d-dd+c[j];
dd=sv;
}
return y*d-dd+0.5*c[0];
}
| ALGO | 0.999923 | 4.26832 |
f523cc25-978d-4c14-ad30-5f8096653374 | yu1mu/algorithm-baekjoon | cpp-automata_50-100/2441.cpp | #include <iostream>
using namespace std;
int main(void){
int num = 0;
cin >> num;
for (int i = 0; i < num; i++){
for (int j = 0; j < i; j++){
cout << " ";
}
for (int k = 0; k < num - i; k++){
cout << "*";
}
cout << "\n";
}
return 0... | ALGO | 0.999914 | 4.006132 |
f99d0f70-f77f-48e7-b7be-71288aa95b49 | ishandutta2007/codeforces | krijgertje/normal/630/F.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.999968 | 3.94059 |
41a0f6c2-ed18-4867-90e7-3a326cac0533 | zohaibafzaal123/PF_LAB | week5/lab/min.cpp | #include <iostream>
#include <windows.h>
#include <cmath>
using namespace std;
void calculateHeight(float distance, float degrees);
main()
{
float angle;
cout << "enter degrees: ";
cin >> angle;
float base;
cout << "enter base: ";
cin >> base;
float height;
calculateHeight(height,degrees);
height = calculateHeigh... | TOOL | 0.977942 | 4.291508 |
01165050-c86e-4677-8868-703116fb7f5e | akshayamishr/100DaysOfCode | Day_28/LT_114_recursive.cpp | class Solution {
public:
void flatten(TreeNode* root) {
if(root == NULL) return;
TreeNode* l = root->left;
TreeNode* r = root->right;
root->left = NULL;
flatten(l);
flatten(r);
root->right = l;
TreeNode* temp = root;
while(temp->right) temp = t... | ALGO | 0.99993 | 5.64916 |
429893a6-5913-4b6b-a639-35c1a46b63e1 | Ylieo816/Learning-Leetcode | Leetcode_camp/3_third week/213_House Robber II.cpp | class Solution {
public:
int rob(vector<int>& nums) {
// 198題+考慮 第一個不偷or最後一個不偷
int l = nums.size();
if(l<=1){
return l==0? 0:nums[0];
}
// 不搶第一個:
int last = 0, now=0;
for(int i=1; i<l; i++){
int temp = last;
last = ... | ALGO | 0.999747 | 5.312078 |
e550d3c2-690b-41fd-a9e4-ac983a0278cc | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_8236_5.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 69;
long long n, a, d[N], c[N], s[N], g[N], l[N], r[N], res = 0;
struct segment_tree {
vector<long long> it;
int type;
long long oo;
segment_tree(int _type) {
type = _type;
if (type)
oo = -1e18;
else
oo = 1e18;
it.resi... | ALGO | 0.999769 | 3.313174 |
58738348-8635-4e47-a405-5f1179fe7347 | yongho9064/cpp | Chapter05 --루프와 관계 표현식/문제/1-4.cpp | #include <iostream>
int main(){
using namespace std;
double a = 100000;
double b = 100000;
int year = 1;
while(a >= b){
a += 10000;
cout << year << " A:" << a << "\t";
b += b * 0.05;
cout << year << " B:" << b << endl;
year++;
}
cout << "B A ġ ʰϴ :... | ALGO | 0.995431 | 3.375873 |
e82e7ae6-e59d-41ee-9f23-3c6134c6717c | aminorex/nlp | eigen-eigen-74756ee995af/unsupported/doc/examples/MatrixPower_optimal.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix4cd A = Matrix4cd::Random();
MatrixPower<Matrix4cd> Apow(A);
std::cout << "The matrix A is:\n" << A << "\n\n"
"A^3.1 is:\n" << Apow(3.1) << "\n\n"
"A^3.3 is:\n" << Apow(3.3) << "\n\n"
... | ALGO | 0.998274 | 3.396939 |
8493cbd9-1446-49bf-8291-8c2201a3097f | Njuptccc/StudentManage | Service.cpp | #include"DataFuncdecl.h"
#include<algorithm>
/*
ܣ
¼ѧšƳɼϢͨ룬ѧΪ֣ûǷȷ
ʾû룬ִܷļ
ֵ
*/
void InputInfor()
{
FILE* fp = fopen("StudentInforFile.txt", "r");
if (fp == NULL)
{
char ErrorMessage[64] = { "ѧϢļʧܣ" };
HWND hwnd = GetHWnd();
HWND hndtipsF = GetHWnd();
int isok = MessageBox(hndtipsF, ErrorMessage, "ʾ", MB_OK)... | TOOL | 0.957429 | 3.438944 |
abf6810c-71cd-449c-b15b-1e38c2c68a06 | deeppatel51/DSA-250 | Math_CountPrimes.cpp | class Solution {
public:
int countPrimes(int n) {
vector<bool> flag(n+1, 1);
int count=0;
flag[0]=flag[1]=0;
for(int i=2; i<n; i++)
{
if(flag[i])
{
count++;
}
for(int j=i*2; j<n; j=j+i)
{
... | ALGO | 0.99996 | 5.619693 |
f6a553f7-cba0-46d5-8484-b74badd5b09a | lee-jeong-geun/ps | atcoder/abc122/B.cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int chk[105], length, result;
char S[15];
/*
주어진 조건에 맞게 최대 연속 길이가 몇인지 찾으면 된다.
*/
int main()
{
chk['A'] = 1;
chk['C'] = 1;
chk['G'] = 1;
chk['T'] = 1;
scanf("%s", S);
length = strlen(S);
for(i... | ALGO | 0.999897 | 3.752936 |
7c74cfff-c38f-4a24-af3a-a304c8d8cda9 | FakeEmperor/Semester03 | LabDM6/main.cpp | #pragma warning(disable:4996)
#define _CRT_USE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <conio.h>
#include <iostream>
#include <fstream>
#include <climits>
#include <iomanip>
#include <varargs.h>
#include <Windows.h>
static const bool TO_CONSOLE = true;
void fail(const char* str, bool close = true){
... | ALGO | 0.994515 | 3.509818 |
6c2b765b-dc95-4000-9d47-e3e8a5e0a1ed | raincross7/code-similarity | codes/train_code/problem196/problem196_115.cpp | #include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;
const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd... | ALGO | 0.999861 | 3.368095 |
81486b9b-7397-4422-902a-2a4afccb6fcc | mannynav/Multi-threaded-Monte-Carlo-for-Option-Pricing | PlainBrownianPath.cpp |
#include "PlainBrownianPath.h"
#include <boost/random/variate_generator.hpp>
PlainBrownianPath::PlainBrownianPath() : standard_norm_distro_(0.0,1.0)
{}
void PlainBrownianPath::GeneratePath(std::vector<double>& path, boost::mt19937& rng)
{
boost::random::variate_generator<boost::mt19937&, boost::normal_distribution... | ALGO | 0.980822 | 3.574497 |
4f7a5716-40db-47c7-bd32-9ddb9593fb5b | Moondex/MoonDEXCoin | src/chain.cpp | #include "chain.h"
using namespace std;
/**
* CChain implementation
*/
void CChain::SetTip(CBlockIndex *pindex) {
if (pindex == NULL) {
vChain.clear();
return;
}
vChain.resize(pindex->nHeight + 1);
while (pindex && vChain[pindex->nHeight] != pindex) {
vChain[pindex->nHeight] ... | ALGO | 0.998998 | 5.986343 |
460dc856-d7db-49f0-80b6-96df42fcbf91 | adoptium/jdk8u_hg | hotspot/src/share/vm/code/compressedStream.cpp | #include "precompiled.hpp"
#include "code/compressedStream.hpp"
#include "utilities/ostream.hpp"
// 32-bit one-to-one sign encoding taken from Pack200
// converts leading sign bits into leading zeroes with trailing sign bit
inline juint CompressedStream::encode_sign(jint value) {
return (value << 1) ^ (value >> 31)... | TOOL | 0.941099 | 6.693381 |
20b2b37f-b145-4a4c-aa50-83a6ebdd9514 | ralph-irving/squeezeplay | src/fdk-aac-2.0.1/libFDK/src/fft_rad2.cpp | /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
The Fraunhofer FDK AAC Codec Lib... | ALGO | 0.999239 | 5.93139 |
c45d9354-f3ef-46fe-a272-de7c859a6f3c | rupak-20/Problem-Solving | pascals-triangle/pascals-triangle.cpp | class Solution {
public:
vector<vector<int>> generate(int n) {
if(n == 1)
return {{1}};
vector<vector<int>> res = {{1}, {1,1}};
for(int i=2; i<n; i++){
vector<int> row;
row.push_back(1);
for(int j=0; j<i-1; j++){
row.push_back(r... | ALGO | 0.999982 | 5.520143 |
7afa80c2-1553-42fc-a670-8fd2977d45ab | yubinbai/pcuva-problems | UVa 10991 region/sol.cpp | #include<iostream>
#include "stdio.h"
#include<cmath>
#define PI acos(-1)
using namespace std;
int main()
{
int k;
double r1, r2, r3, S, a, b, c, G, x, y, z;
cin >> k;
for (int i = 0; i < k; i++)
{
cin >> r1 >> r2 >> r3;
S = sqrt((r1 + r2 + r3) * r1 * r2 * r3);
x = asin(2 / (... | ALGO | 0.999281 | 3.656977 |
56b3adf8-0cd4-4437-9a49-2207a1d51111 | xi-guo-0/leetcode-solutions | cpp/0201-bitwise-and-of-numbers-range.cpp | class Solution {
public:
int rangeBitwiseAnd(const int m, const int n) {
int res = 0;
int k = 1 << (sizeof(int) * 8 - 2);
while (0 < k && (k & m) == (k & n)) {
res |= (k & m);
k >>= 1;
}
return res;
}
};
| ALGO | 0.999739 | 6.336372 |
939216ea-9503-4c72-934d-791d47f32ddb | Pawanpathariya/Cpp_practice_oops | DSA/Insertionsort.cpp | #include<iostream>
using namespace std;
void insertion(int arr[],int s){
for(int i=0;i<s;i++){
int key=i;
while(key>0 && arr[key]<arr[key-1]){
int t=arr[key];
arr[key]=arr[key-1];
arr[key-1]=t;
key--;
}
}
}
int main(){
int arr[]={3,1,2,5,4};
int s=sizeof(arr)/sizeof(arr[0]);
cout... | ALGO | 0.999993 | 4.189365 |
062264a2-a9ce-48cf-9ac8-e73636bb2c26 | TangZichen0102/cpp_study | 吴江青少年科技馆/2022CSP强化班/CSP强化班/2022-8-10B/0-1 作业/2 归并排序自上而下.cpp | #include<bits/stdc++.h>
using namespace std;
void OutPut(vector<int> &v)
{
vector<int>::iterator it;
for(it=v.begin(); it!=v.end(); it++)
cout<< *it <<" ";
cout<<endl;
}
void Merge(vector<int> &v, int s1, int e1, int e2)
{
vector<int>t(e2-s1+1);
int k=0,i=s1,j=e1+1;
while( i<=e1 && j<=e2 )
if(v[i]<v[j])
t[... | ALGO | 0.999987 | 4.543608 |
59327363-d1a0-4c3c-9b46-a8e618a3fd97 | xueqilsj/mcss | pure-cpp/NVTIsing.cpp | /*
============================================================================
Name : NVTIsing.cpp
Description : Sampling in NVT Ising model with Metroplis Algorithm
============================================================================
*/
#include "Ising.h"
#include "nvector.h"
#include <iostream>... | ALGO | 0.979498 | 4.79725 |
fc7f328b-0312-482d-a9ab-73211bcea585 | ishandutta2007/codeforces | skywalkert/normal/567/E.cpp | #include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 100010;
const int long long mod1 = 880788066951082291LL, mod2 = 1051263176683549831LL;
typedef pair<long long, int> Edge;
int n, m, s, t, eu[maxn], ev[maxn], ew[maxn];
long long dis1[maxn],... | ALGO | 0.999945 | 3.957562 |
5e199302-5ba3-4a0c-8456-48f1420a85a7 | pranavjawale01/cp.exe | GFG/Medium/Gray to Binary equivalent/gray-to-binary-equivalent.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
// function to convert a given Gray equivalent n to Binary equivalent.
int grayToBinary(int n)
{
// Your code here
... | ALGO | 0.999694 | 5.601109 |
fec694db-bc2d-418c-92dd-3ffeb788fd59 | d33panpaudel07/thirdSemesterCodes | DSA class/recursion/towerOfHanoi.cpp | #include <iostream>
using namespace std;
void towerOfHanoi(int n, char source, char destination, char helper)
{
if (n == 0)
{
return;
}
towerOfHanoi(n - 1, source, helper, destination);
cout << "Moved disk " << n << " from " << source << " to " << destination << endl;
towerOfHanoi(n - 1... | ALGO | 0.999705 | 6.119503 |
cd00cbb6-91e2-4745-9f31-6f3c395f573b | mohit-pareek09/DSA-leetcode | Difficulty: Basic/Array Search/array-search.cpp | class Solution {
public:
// Function to search x in arr
// arr: input array
// X: element to be searched for
int search(vector<int>& arr, int x) {
// Your code here
for(int i=0;i<arr.size();i++){
if(arr[i]==x){
return i;
}
}
retu... | ALGO | 0.999879 | 5.9485 |
0b515792-1543-4741-9cfd-25fa96895736 | ishandutta2007/codeforces | daas/normal/1485/C.cpp | #include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<algorithm>
#include<ctime>
#define int long long
using namespace std;
int read()
{
int kkk=0,x=1;
char c=getchar();
while((c<'0' || c>'9') && c!='-')
c=getchar();
if(c=='-')
c=getchar(),x=-1;
whil... | ALGO | 0.999943 | 4.457733 |
41c02d45-fd9e-4105-a4bd-d8523117c35a | naoyat/topcoder | fileedit/2009/BeautifulString.cpp | // BEGIN CUT HERE
/*
// PROBLEM STATEMENT
// A string composed of the letters 'A' and 'B' is called beautiful if it satisfies all of the following criteria:
it contains no more than countA occurences of 'A';
it contains no more than countB occurences of 'B';
each substring that contains only 'A's consists of no more t... | ALGO | 0.999379 | 5.908679 |
db99e98a-3855-4663-bc62-1fbcfb86d336 | kshitijjan/LeetCode | 1114-binary-search-tree-to-greater-sum-tree/1114-binary-search-tree-to-greater-sum-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.999586 | 5.176723 |
588eea6f-8ded-495f-847d-81a8c9d8d9dc | stevenbai0724/Codeforces-Solutions | game23.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n, m; cin>>n>>m;
int x = m/n;
int count = 0;
if(m%n==0){
while(x%2 ==0){
x/=2;
count++;
}
while(x%3 ==0){
x/=3;
count++;
... | ALGO | 0.999971 | 4.501389 |
564616fe-730b-4e3d-97bb-936e25d383f4 | Bilalshah1/Leetcode_solutions | 151.reverse-words-in-a-string.cpp | class Solution
{
public:
string reverseWords(string s)
{
vector<string> words;
istringstream iss(s);
string word;
while (iss >> word)
{
words.push_back(word);
}
s = "";
reverse(words.begin(), words.end());
for (int i = 0; i < wo... | ALGO | 0.999621 | 6.051656 |
f6b047c5-7ddc-43b9-a3a6-e79d0d9a21a3 | jaARke/LeetCode | CIS4930/Week 1/Q1.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string raw;
string result;
cin >> raw;
for (int i = 0; i < raw.length(); i++) {
if (raw[i] == '<') {
if (result.length() != 0) {
result.pop_back();
}
}
else {
... | ALGO | 0.998872 | 3.400989 |
8dfd5720-09e6-48af-bc87-b18ee52365c5 | SanskarSinghiit/Data-Structures-and-Algorithms-Accepted-solutions | 540-single-element-in-a-sorted-array/single-element-in-a-sorted-array.cpp | class Solution {
public:
int singleNonDuplicate(vector<int>& nums) {
int n = nums.size();
if(n==1 || nums[0]!=nums[1]){
return nums[0];
}
if(nums[n-2]!=nums[n-1]){
return nums[n-1];
}
int lo = 0;
int hi = n-1;
int mid;
... | ALGO | 0.999959 | 5.619671 |
df29d2a9-8d9e-4a28-8044-d5ed11d30f20 | deeplukhi/Data-Structures-and-Algorithms | Data_Structure/Trees/red_black_tree.cpp | #include <iostream>
using namespace std;
// Red-Black Tree Node Structure
enum Color { RED, BLACK };
class Node {
public:
int data;
Color color;
Node* left, * right, * parent;
Node(int val) {
data = val;
color = RED; // New nodes are always RED initially
left = right = parent... | ALGO | 0.999766 | 6.800428 |
1e8ba0db-bbfa-46c7-b3f3-d08fec720546 | bioexcel/bioexcel-code-releases | GROMACS/gromacs-2018.3/src/gromacs/correlationfunctions/expfit.cpp | /*! \internal
* \file
* \brief
* Implements routine for fitting a data set to a curve
*
* \author David van der Spoel <<EMAIL>>
* \ingroup module_correlationfunctions
*/
#include "gmxpre.h"
#include "expfit.h"
#include <string.h>
#include <cmath>
#include <algorithm>
#include <lmstruct.h>
#include "gromacs... | ALGO | 0.999592 | 6.2432 |
876d3b04-4227-4c4f-b4d7-ba5ccf266de0 | anishmehta24/cp | A_Max_Plus_Size.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int oddMax = 0;
int... | ALGO | 0.99995 | 5.630331 |
5458f4b7-df14-40b8-b598-1e0734cf6b8c | raincross7/code-similarity | codes/train_code/problem249/problem249_469.cpp | #include<bits/stdc++.h>
#include<numeric>
#include<cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long int
#define CON 100010
const long long mod=1e9+7;
const int INF=1001001001;
const int inf=100000;
//const ll inf=1e9+7;
//const ll ful=1e18;
using namespace std;
//namespace mp = boost::multipr... | ALGO | 0.999685 | 4.171462 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.