uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
27265e86-842e-482f-b05c-45cf5c4a57f7 | cryptoquick/bitcoin-starius | src/common/system.cpp | #if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#include <common/system.h>
#include <logging.h>
#include <util/string.h>
#include <util/time.h>
#ifndef WIN32
#include <sys/stat.h>
#else
#include <compat/compat.h>
#include <codecvt>
#endif
#ifdef HAVE_MALLOPT_ARENA_MAX
#include <malloc.h>
#endif... | TOOL | 0.851304 | 6.254135 |
e82e68d0-b784-4745-9396-f5d80d60d3aa | ZYH223/GAMES202-Homework | homework2/prt/ext/tbb/src/perf/cpq_pdes.cpp | #include <cstdlib>
#include <cmath>
#include <queue>
#include "tbb/tbb_stddef.h"
#include "tbb/spin_mutex.h"
#include "tbb/task_scheduler_init.h"
#include "tbb/parallel_for.h"
#include "tbb/tick_count.h"
#include "tbb/blocked_range.h"
#include "../test/harness.h"
#include "tbb/concurrent_priority_queue.h"
#pragma warn... | TEST | 0.962678 | 5.480506 |
600f6ee3-fe5b-4290-b5dd-37511a7dacd9 | gnahtcouq/cpp | Chuong 16 De Quy/Giai Bai Tap/bai739_26-11.cpp | // Tinh s(x, n) = x^n
/*
Ta can biet:
+ Voi n > 0 (vi du la 3) -> x^3 chinh la: x * x * x
+ Voi n < 0 (vi du la -3) -> x^-3 chinh la: 1 / (x^3) = 1/x * 1/x * 1/x
*/
#include <iostream>
using namespace std;
float deQuy(float x, int n) {
if (n == 1)
return x;
if (n == -1)
return 1.0 / x;
if (n < ... | ALGO | 0.999896 | 5.062889 |
d254dc4a-6652-4ce0-bdda-0c4fba4723e8 | munna2014/code-practice | c++/allocation.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
struct Customer
{
int arrival, departure, index;
};
int main()
{
int n;
cin >> n;
vector<Customer> customers(n);
for (int i = 0; i < n; i++)
{
cin >> customers[i].arrival >> customers[i].d... | ALGO | 0.999998 | 5.341031 |
c993f6a4-6a9c-4fe3-bdac-785f2c4ed84a | Anastasizzmay/2semesretOAIP | метод секущих.cpp | #include <iostream>
#include <cmath>
using namespace std;
double F(double x)
{
return (sin(x)*sin(x)-x/5-1);
}
int main()
{
setlocale(0, "");
double x1, x2, res = 0, y, E;
cout << "Вычисление по методу секущих" << endl;
cout << "Введите погрешность:" << endl;
cin >> E;
cout << "Введите начало промежутка поиск... | ALGO | 0.999993 | 3.999238 |
ab872bbf-d6a0-4cfc-ad69-766cb3e615a4 | edenhub/LeeCode | 20_ValidParentheses.cpp | #include <iostream>
#include <stack>
using namespace std;
class Solution {
public:
bool isValid(string s) {
int size = s.size();
stack<char> st;
for(int i=0;i<size;i++){
if(s[i] == '(' || s[i] == '[' || s[i] == '{') st.push(s[i]);
else{
if(st.empty(... | ALGO | 0.998976 | 5.869239 |
e96b22b1-46e3-44cf-b067-e833cfbc9941 | UET-2425HK2-INT2210-01/23021422-CTDLGT | Lec 4/bai 2b.cpp.cpp | #include <iostream>
using namespace std;
const int TABLE_SIZE = 11;
int hashTable[TABLE_SIZE];
bool occupied[TABLE_SIZE] = {false};
int hashFunction(int key) {
return (2 * key + 5) % TABLE_SIZE;
}
void insert(int key) {
int index = hashFunction(key);
while (occupied[index]) {
index = (index + 1) ... | ALGO | 0.999572 | 6.245842 |
9013f702-1562-4164-9a38-f05f49ff31e2 | 192110481/CSA0626-DAA | merge sort.cpp | #include <stdio.h>
#include <stdlib.h>
void merge(int arr[], int left, int mid, int right);
void mergeSort(int arr[], int left, int right);
int main() {
int n;
printf("Enter the number of elements: ");
scanf("%d", &n);
int *arr = (int*)malloc(n * sizeof(int));
printf("Enter the elements:\n");
fo... | ALGO | 0.999931 | 4.813128 |
afb076b4-cb10-4ea9-9f7b-f8d2e1a50a1e | ishandutta2007/codeforces | abeker/normal/453/C.cpp | #include <cstdio>
#include <vector>
using namespace std;
const int MAXN = 100005;
int N, M;
vector <int> v[MAXN], ch[MAXN], path;
bool bio[MAXN];
int c[MAXN];
void load() {
scanf("%d%d", &N, &M);
while (M--) {
int a, b;
scanf("%d%d", &a, &b);
v[a].push_back(b);
v[b].push_back... | ALGO | 0.999963 | 4.130191 |
bba0fdb6-2e10-416b-bbb9-4143ebe13dac | tayu0110/atcoder | tenke/tenke24.cpp | #include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
struct Ed... | ALGO | 0.999982 | 3.53408 |
125fc3cd-fc63-46f2-bdd1-53f328b38385 | SusuuuMan/muut | 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 |
7f29472c-e4f4-413d-8505-129ed790e163 | tanishqshah/leetcode | 1220-count-vowels-permutation/1220-count-vowels-permutation.cpp | class Solution {
public:
int countVowelPermutation(int n) {
long a = 1, e = 1, i = 1, o = 1, u = 1, mod = pow(10, 9)+7;
long a2, e2, i2, o2, u2;
for (int j = 2; j <= n; j++) {
a2 = (e + i + u) % mod;
e2 = (a + i) % mod;
i2 = (e + o) % mod;
... | ALGO | 0.999964 | 6.594493 |
289c0b03-dab2-4595-85e7-5d723fcabe76 | aarindey/Leetcode-Solution-By-aarindey | Carpet into Box - GFG/carpet-into-box.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:
int carpetBox(int A, int B, int C, int D) {
if((A<=C&&B<=D) || (B<=C&&A<=D)) return 0;
if(A>C && A>D) return 1+carpetBox(A/2,B,... | ALGO | 0.998766 | 5.634744 |
6ae44a1d-a778-4395-8461-7f5f55cfca94 | ji1dev/algorithm | BOJ/14719.cpp | // 14719번_빗물
#include <iostream>
#include <algorithm>
using namespace std;
int h, w, block[501];
int lh, rh, limit, water, sum;
void findHighest(int base){
for(int j=0; j<base; ++j) lh = max(lh, block[j]);
for(int j=base+1; j<w; ++j) rh = max(rh, block[j]);
}
int main(){
cin >> h >> w;
for(int i=0; i<w;... | ALGO | 0.999934 | 4.156742 |
74fad3c1-2006-477d-ba9c-52a5229237d5 | yashsharma080105/Finale-Project-Submit | 0860-design-circular-queue/0860-design-circular-queue.cpp | class MyCircularQueue {
public:
int f; // front
int b; // back/rear
int s; //curr size
int c; // capacity
vector<int>arr;
MyCircularQueue(int k) { // k is capacity
f =0;
b =0;
s =0;
c =k;
vector<int> v(k);
arr =v;
}
bool enQueue(int... | ALGO | 0.998587 | 5.717554 |
65cc4652-1aa2-4bff-844e-cc696f14e060 | eslams3dawi/Data-Structures-From-Scratch-Using-C-Plus-Plus | ArrayList/ArrayList.cpp | #include <iostream>
using namespace std;
class ArrayList
{
private:
int* Arr;
int MaxSize;
int Length;
public:
ArrayList(int maxSize)
{
if (maxSize < 0)
throw invalid_argument("Invalid Index");
else
MaxSize = maxSize;
Length = 0;
Arr = new int[MaxSize];
}
ArrayList() {}
bool IsEmpty() // chec... | TOOL | 0.99063 | 4.492559 |
01be1da1-14ef-495b-9231-89230cdd2dee | ss1237/advent-of-code | 2023/AOC2023D24P2.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
vector<ld> zeros(3, 0);
struct Stone {
ll px, py, pz, vx, vy, vz;
};
vector<ld> intersect(Stone &a, Stone &b) {
ld d = a.vx * b.vy - a.vy * b.vx;
if (d == 0) return zeros;
ld i1 = a.vy * a.px - a.vx * a.py;
... | ALGO | 0.999671 | 3.745157 |
6d71b928-99f3-4a1e-94b9-88bb657d0817 | ishandutta2007/codeforces | galen_colin/normal/1061/C.cpp | #include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
using namespace std;
#define f0r(a, b) for (a = 0; a < b; a++)
#define f1r(a, b, c) for (a = b; a < c; a++)
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define pb push_back
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie... | ALGO | 0.999942 | 4.60818 |
6b13ffc1-7301-48e5-8393-52d7cefa2ed8 | TheDangerD0802/30-Days-Coding-Challenge---WCC | BinarySearch/Search in Rotated Sorted Array.cpp | class Solution {
public:
int search(vector<int>& a, int target) {
int low = 0, high = a.size() - 1;
while(low <= high) {
int mid = (low + high) >> 1;
if(a[mid] == target) return mid;
// the left side is sorted
if(a[low] <= a[mid]) {
... | ALGO | 0.999959 | 6.10224 |
2118476f-9742-44dd-8bdd-545ccf2ed12b | KailasMahavarkar/interview-prep | leetcode/longest_subsequence_with_limited_sum_leetcode_2389.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
void printVector(string tag, vector<int> arr)
{
cout << tag << " --> ";
for (int i = 0; i < arr.size(); i++)
{
cout << arr... | ALGO | 0.999933 | 5.583298 |
bf311cb7-7021-4ef5-bb7b-b5ca522a0b07 | paperfrog1228/Algorithm | Baekjoon/1563_개근상.cpp | #include<iostream>
#include <string.h>
#define mod 1000000
int n;
long long dp[1004][4][4];
long long func(int day,int l,int a){
if(l>=2) return dp[day][l][a]=0;
if(a>=3) return dp[day][l][a]=0;
if(day==n) return dp[day][l][a]=1;
if(dp[day][l][a]!=-1)
return dp[day][l][a];
return dp[day][l][... | ALGO | 0.999946 | 3.855368 |
d315eadf-0b02-41fb-ab76-92f5f8439699 | raincross7/code-similarity | codes/train_code/problem110/problem110_463.cpp | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite)... | ALGO | 0.999982 | 3.803185 |
57c10133-f2dc-420e-8b52-d1a052f6170c | Harsita7/c-project | coding c++/task106.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main() {
int n;
cout << "Enter value of n: ";
cin >> n;
int absN = abs(n);
int i = 0;
int ans = 0;
while (absN != 0) {
int bit = absN & 1;
ans = ((bit * pow(10, i)) + ans);
absN = absN >> 1;
i++;
... | ALGO | 0.999617 | 4.801372 |
476c4ea5-11a7-47cc-96d6-a7a9a9cefd04 | Venkatramanbehera/DSA-Refresher | stack/live2.cpp | #include<iostream>
#include<stack>
using namespace std;
// Q1 - sort the stack
void sortInsert(stack<int>& st, int data) {
// BC
if (st.empty() || st.top() < data) {
st.push(data);
return;
}
int topEle = st.top();
st.pop();
sortInsert(st, data);
st.push(topEle);
}
void s... | ALGO | 0.999953 | 5.042518 |
e41680be-65e4-40f6-9e91-898a92162cf9 | RunAtTekky/DSAandCP | contests/CF/1001Div2/C_Cirno_and_Operations.cpp | #include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << ' ' << x << '\n';
vector<long long> get_reverse(vector<long long>& vec) {
vector<long long> rev;
for (long long i=vec.size()-1; i>=0; i--) rev.push_back(vec[i]);
return rev;
}
vector<long long> get_diff(vector<long long>& vec) ... | ALGO | 0.999975 | 4.733652 |
af618ea0-834a-4653-ac9e-d0c26e9dba63 | igoingdown/leetcode | 653.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
private:
TreeNode* find_v(TreeNode* root, int k) {
if (!root) return root;
if (k > root... | ALGO | 0.999996 | 6.093979 |
ec99cb54-39c5-45fa-b8b1-dd4bc5f1de69 | g932150283/leetcode | alcode/ch7/POJ3625(Prim).cpp | //8176K 94MS
#include<iostream>
#include<cstring>
#include<vector>
#include<cmath>
using namespace std;
#define INF 1000000000.0
#define MAXN 1010
double A[MAXN][MAXN];
double lowcost[MAXN];
bool U[MAXN];
int X[MAXN],Y[MAXN];
int N;
double Prim(int v)
{
double ans=0.0;
for(int i=0;i<N;i++)
lowcost[i]=INF;
memset(... | ALGO | 0.999965 | 3.746552 |
20f83c3e-1019-4034-9082-c94ab76725a8 | mdOwaisAnsary/PF-CPP-Lectures-Codes | 3-AssignmentOpr.cpp | #include<iostream>
using namespace std;
int main()
{
cout<<"Assignment :"<<endl;
int x,y;
x=5;
y=2;
cout<<"x is:"<<x<<endl;//
cout<<"y is:"<<y<<endl;//
cout<<"After:"<<endl;//
x=x+y;//normal way
x+=y;//Assignment
cout<<"x is:"<<x<<endl;//
y=y+x;//normal way
y+=x;//Assignment
cout<<"y is:... | ALGO | 0.906279 | 3.448056 |
e561dcec-2cc8-45d2-bd5e-95c4cc482b0f | im-sakshijain/Codechef_Ques | Chef and Coupon.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int D,C,sumfirst=0,sumsecond=0;
cin>>D>>C;
int a1,a2,a3;
cin>>a1>>a2>>a3;
int b1,b2,b3;
cin>>b1>>b2>>b3;
sumfirst=a1+a2+a3;
sumsecond=b1+b2+b3;
if(sumfirs... | ALGO | 0.999076 | 3.665278 |
a49c2bac-0508-4b35-a6a2-2a336766a784 | visitorckw/leetcode-solution | AC_submissions/2027.minimum-moves-to-convert-string.565471140.ac.cpp | /*
* @lc app=leetcode id=2027 lang=cpp
*
* [2027] Minimum Moves to Convert String
*/
// @lc code=start
class Solution {
public:
int minimumMoves(string s) {
int ctr = 0;
int i = 0;
const int n = s.size();
while( i < n ){
if(s[i] == 'O') i++;
else{
... | ALGO | 0.999765 | 6.161633 |
a0643920-ffda-425b-ad98-12ef2cba17ab | YooBIK/Algorithms | BOJ/AlgorithmStudy/Week_1/SearchAndSort/11650.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool compare(pair<int,int> a, pair<int,int> b){
if(a.first == b.first){
return a.second<b.second;
}else{
return a.first<b.first;
}
}
int n;
vector<pair<int,int>> vec;
int main(){
cin >> n;
for(int i=0... | ALGO | 0.999831 | 4.599454 |
d0f11895-48e6-40c3-8c99-7ddf78895e3b | HexHive/EL3XIR | src/svf/lib/DDA/ContextDDA.cpp | /*
* ContextDDA.cpp
*
* Created on: Aug 17, 2014
* Author: Yulei Sui
*/
#include "Util/Options.h"
#include "DDA/ContextDDA.h"
#include "DDA/FlowDDA.h"
#include "DDA/DDAClient.h"
#include "MemoryModel/PointsTo.h"
using namespace SVF;
using namespace SVFUtil;
/*!
* Constructor
*/
ContextDDA::ContextDDA(SV... | TOOL | 0.860663 | 4.612224 |
c80e6634-1ed3-42c0-aefd-76913dc78728 | kalok008/MyCodePortfolio | SoftUni Courses/C++ Fundamentals - ноември 2024/Arrays/06. Equal Arrays.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
int arr1[n];
int arr2[n];
for(int i = 0; i<n; i++){
cin>>arr1[i];
}
for(int i = 0; i<n; i++){
cin>>arr2[i];
}
bool identical = true;
int sum = 0, index = 0;
for(int i = 0; i<n; i++){
... | ALGO | 0.999975 | 4.261122 |
ee82440e-58e6-4a4c-9a82-bb30d7bd8eaa | Akshita-Goel/technicalresources2026cohort | a2_q11.cpp | #include<iostream>
using namespace std;
int main() {
int n;
int a=1;
cin>>n;
for(int row=1;row<=n;row++) {
for(int col=1;col<=row;col++) {
cout<<a<<" ";
a=a+1;
}
cout<<endl;
}
return 0;
}
| ALGO | 0.999866 | 3.841681 |
726bb5aa-292f-491a-b55b-c40bca3e2dba | alexandraback/datacollection | solutions_5706278382862336_1/C++/o17/20140511a.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{ freopen("A-large.in","r",stdin);
freopen("A-large.out","w",stdout);
int t,l,ans;
char ch;
long long a,b,c;
double p;
cin>>t;
for(l=1;l<t+1;l++)
{
// cout<<l<<endl;
ans=0;
... | ALGO | 0.999295 | 3.456144 |
75b58ff6-480d-4db5-905d-25d0a154cc54 | unicode-Ind/DSA_Final_Prep | 2.09 DP/DP Basics/2.Fibonacci (Dp-PURE-BottomUP approach).cpp | #include<iostream>
using namespace std;
#define ll long long
ll fib_TopDownDP(ll n){
ll dp[1000];
fill(dp,dp+1000,-1);
dp[0]=0;
dp[1]=1;
for(ll i=2;i<=n;i++){
dp[i]=dp[i-1]+dp[i-2];
}
return dp[n];
}
int main(int argc, char const *argv[])
{
ll n;
cin>>n;
cout<<n<<"th fib no :"<<fib_TopDownDP(... | ALGO | 0.999975 | 3.98423 |
782ba8ad-8a1c-4860-ad0e-897f01b25285 | syg/gecko | gfx/skia/trunk/src/effects/Sk2DPathEffect.cpp | #include "Sk2DPathEffect.h"
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
#include "SkPath.h"
#include "SkRegion.h"
Sk2DPathEffect::Sk2DPathEffect(const SkMatrix& mat) : fMatrix(mat) {
fMatrixIsInvertible = mat.invert(&fInverse);
}
bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src,
... | TOOL | 0.884845 | 7.285851 |
78bc4519-54a4-43b7-a788-9e5f7bee3452 | Barada32/PD225 | UNIQUE_RAND.cpp | #pragma once
#include "UNIQUE_RAND.h"
template<typename Mytype> void UniqueRand(Mytype arr[], const int length, int minrand, int maxrand)
{
if (minrand > maxrand)
{
swap(minrand, maxrand);
}
if (minrand == maxrand)
{
maxrand++;
}
bool flag = true;
for (int i = 0; i < length; )
{
flag = false;
int ... | TOOL | 0.934482 | 4.07003 |
70391a8b-05c3-48de-99de-bcb1ab510ae6 | waghale/book_shelf_flutter | 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.998756 | 6.772262 |
9ea3cee9-6612-40d2-b875-ae9cc56b99ec | hannespetur/free.simd | test/doc/bitwise/clz.cpp | //==================================================================================================
//==================================================================================================
//! [clz]
#include <boost/simd/bitwise.hpp>
#include <boost/simd/pack.hpp>
#include <iostream>
namespace bs = boost:... | ALGO | 0.995175 | 6.000637 |
1c381eb8-f69d-48fb-ae22-bd641ceca316 | manishkhilnani2911/leetcode | 92_reverse_link_list_2.cpp | /*
Reverse a linked list from position m to n. Do it in one-pass.
Note: 1 ≤ m ≤ n ≤ length of list.
Example:
Input: 1->2->3->4->5->NULL, m = 2, n = 4
Output: 1->4->3->2->5->NULL
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x),... | ALGO | 0.999902 | 5.814228 |
c3e6d1fb-b5d8-4310-9325-84e944c50654 | whq05/sort | countsort.cpp | /* ************************************************************************
> File Name: countsort.cpp
> Author: whq
> Created Time: Fri 25 Apr 2025 07:40:30 PM CST
> Description: 计数排序(基础版)
************************************************************************/
#include <iostream>
#include <vector>
#i... | ALGO | 0.999969 | 5.204014 |
64fbdbdd-843e-49ea-9ddf-6c853a9d8c4e | kovaxis/progcomp | problems/training/AnotherCoinWeighingPuzzle.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REPGET(_1, _2, _3, NAME, ...) NAME
#define rep3(i, b, n) for (int i = (int)(b); i < (int)(n); i++)
#define rep2(i, n) rep3(i, 0, (n))
#define rep(...) REPGET(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define invrep3(... | ALGO | 0.999789 | 4.629055 |
3fbb16c8-4e38-4276-8109-45e4f4f66615 | Um-ded/problem-solving | Codeforces Codes/618.Prob1003B(Binary String Constructing).cpp | ///*/////////////////////////////*///
/// IN THE NAME OF ALMIGHTY ALLAH ///
///*/////////////////////////////*///
///*///////////////*///
/// Author : Um_ded ///
///*///////////////*///
///*//////////////////////////////////////////*///
/// "When you want something, all the universe ///
/// conspires in helping you ... | ALGO | 0.999967 | 4.102686 |
f286859f-b9e2-4f1c-bd0f-9b742d4ad4fe | AxionAOSP/android_external_skia | src/gpu/graphite/DrawPass.cpp | #include "src/gpu/graphite/DrawPass.h"
#include "include/gpu/graphite/GraphiteTypes.h"
#include "include/gpu/graphite/Recorder.h"
#include "include/private/base/SkAlign.h"
#include "src/core/SkTraceEvent.h"
#include "src/gpu/graphite/Buffer.h"
#include "src/gpu/graphite/BufferManager.h"
#include "src/gpu/graphite/Caps... | TOOL | 0.856453 | 7.480454 |
d528e863-0135-4a23-aebf-d2aea02274e7 | keshavbsk7/C_basic | 26.cpp | #include<iostream>
using namespace std;
int main()
{
int n=3214;
int temp=n;
int s,rem;
while(rem!=temp)
{
rem=n%10;
n=n/10;
rem=(rem*1000)+n;
n=rem;
cout<<rem<<" ";
}
}
| ALGO | 0.99962 | 3.043913 |
71cc02d5-065c-43f1-84bb-11dd0d7d2308 | ethoshomo/codding-challenges | Leetcode/0445-Add-Two-Numbers-II.cpp | /* 445. Add Two Numbers II
You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
You may assume the two numbers do not contain any leading zero, e... | ALGO | 0.999911 | 6.287801 |
f38d0fc5-9d6c-437b-a065-77dfcc7ee104 | doooraaAA/C | data structure&algorithm/homework the sum of child/homework the sum of child/源.cpp | //4: 二叉树的子树和
//现在给出一棵二叉树,每个结点有一个权值,希望你依次输出每一个节点为根的子树的子树权值和
///输入
//第一行一个正整数 n,表示给定的树的节点的数目,规定节点编号 1∼n,其中节点 1是树根。
//第二行 n 个正整数,用一个空格分隔,第 i 个正整数vi,代表节点 i 的权值。
//接下来 n 行,每行两个正整数 li, ri ,分别表示节点 i 的左右孩子的编号。如果不存在左 / 右孩子,则以 −1 表示。两个数之间用一个空格隔开。
//输出
//一行,n个数,分别表示i号结点为根的子树的子树权值和
//输入
//3
//1 1000 1000
//2 3
//- 1 - 1
//- 1 - 1... | ALGO | 0.999978 | 4.339932 |
d03368c4-bd41-48fe-bb7c-18a881299324 | sana144/lc3-project | instructions.cpp | #include "instructions.h"
#include <cstdint>
#include "lc3.h"
uint16_t ir, nzp, dr, sr1, imm_flag, sr2, imm5, base_r, flag, opcode, address, tmp_sr1, temp_sr2, GateALU, value, sr;
int16_t offset9, offset6, offset11;
bool HultInstruction(){
return (registers.getMDR() == 0xF025);
}
void Fetch(Memory& memory){
... | ALGO | 0.926044 | 5.11398 |
90c95ced-4970-40bb-b129-4804e160b9d7 | raincross7/code-similarity | codes/train_code/problem464/problem464_406.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
int n, m; cin >> n >> m;
vector<int> cnt(n);
for(int i = 0; i < m; i++) {
int a, b; cin >> a >> b;
cnt[a - 1]++;
cnt[b - 1]++;
cnt[a - 1] %= 2;
cnt[b - 1] %= 2;
}
cout << (count(... | ALGO | 0.999997 | 4.621393 |
7a5ec40a-35c9-4901-964a-910416aa558e | SergiuMuntean/LeetCodeProblems | Arrays/find-the-original-array-of-prefix-xor.cpp | class Solution {
public:
vector<int> findArray(vector<int>& pref) {
vector<int> arr;
int curr{pref.at(0)};
arr.push_back(curr);
for(int i{1}; i < pref.size(); i++) {
curr = pref.at(i) ^ pref.at(i - 1);
arr.push_back(curr);
}
return arr;
}
}... | ALGO | 0.999992 | 5.607214 |
1a4327ba-a863-4ddf-bf56-e511b121cd3c | Koyingtw/CP | CSES/DP/Edit Distance.cpp | /*
.-..-. _
: :' ; :_;
: ' .--. .-..-..-.,-.,-. .--.
: :.`.' .; :: :; :: :: ,. :' .; :
:_;:_;`.__.'`._. ;:_;:_;:_;`._. ;
.-. : .-. :
`._.' `._.'
*/
#include <bits/stdc++.h>
// #define int long long
#define pr pair<int, int>... | ALGO | 0.999945 | 4.066648 |
1604acdb-a8a4-4271-968e-18179bd77e3c | wilcox-willem/Mercer-Cobra-Clone | csc245/Project3/Attempt2/huffman.cpp | #include "huffman.h"
#include <iostream>
using namespace std;
HuffmanTree:: HuffmanTree()
: numChars(0), built(false) {}
void HuffmanTree:: insert(char ch, int weight) {
HNode newNode = {ch, weight, -1, -1};
built = false;
nodes.push_back(newNode);
numChars++;
}
bool HuffmanTree:: inTree(char ch) ... | ALGO | 0.995259 | 4.482347 |
d052b5c1-42b5-465a-9ee5-e47e6ee4e3b5 | jongbin26/coding_test | cpp/devideNum.cpp | #include<iostream>
using namespace std;
int main() {
int a, b, n, rest, devide;
cin >> a >> b >> n;
for (int i = n; i > 0; i--) {
a %= b;
a *= 10;
devide = a / b;
}
cout << devide;
} | ALGO | 0.99988 | 3.409035 |
8a630c4c-688f-4121-bfd7-5fe7bc3a3d5d | AnkitMaskara907/CP_codes | vscode/B_Simple_Math_4.cpp | // #pragma GCC optimize("Ofast")
// #pragma GCC target("avx")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less_equal<int>, rb_tr... | ALGO | 0.992697 | 4.38259 |
5affabc2-1919-4360-ae68-af9ac0012d29 | HanYouyang/Computer | 数据结构与算法/PKU-CS/PastClasses/@1/Theory of Computation and Baisc C/2-Q1.cpp | #include <iostream>
using namespace std;
int main(){
int apple, apple_left, rate, time;
cin >> apple;
cin >> rate;
cin >> time;
if(time % rate == 0){
if(time / rate >= apple){
apple_left = 0;
}else{
apple_left = apple - time / rate;
}
}else{
... | ALGO | 0.9997 | 3.245149 |
7a2e318b-6c43-4484-b332-91c117a4c63b | kevin-chau/ctci6th_solutions | chapter 16/16_1/16_1.cpp | // Number Swapper: Write a function to swap a number in place (no temporary variables)
// Using addition and subtraction
#include <iostream>
using namespace std;
void swap (int * a, int * b){
if (*a > *b){
*a = *b - *a;
*b = *b + *a;
*a = *b - *a;
} else {
*b = *a - *b;
*a = *b + *b;
*b = *b - *a;
}
}
... | ALGO | 0.997942 | 5.708131 |
ab9531f2-009c-4e34-bdec-13b7448e3f45 | Huangxiaoming1314/AR_Robot | catkin_ws/src/nav/navigation-kinetic-devel/base_local_planner/src/goal_functions.cpp | #include <base_local_planner/goal_functions.h>
namespace base_local_planner {
double getGoalPositionDistance(const tf::Stamped<tf::Pose>& global_pose, double goal_x, double goal_y) {
return hypot(goal_x - global_pose.getOrigin().x(), goal_y - global_pose.getOrigin().y());
}
double getGoalOrientationAngleDi... | TOOL | 0.994483 | 6.199865 |
0e6c2a1e-706e-4e3f-9030-fff414944123 | rishabhdvn/leetcode | 0295-find-median-from-data-stream/0295-find-median-from-data-stream.cpp | class MedianFinder {
public:
priority_queue<int> maxHeap;
priority_queue<int,vector<int>,greater<int>> minHeap;
MedianFinder() {
}
void addNum(int num) {
if(maxHeap.empty() || num<=maxHeap.top()){
maxHeap.push(num);
}
else{
minHeap.push(num);
... | ALGO | 0.999977 | 6.123716 |
48fbe26b-628c-4dfa-a1dd-e3126f286258 | salilab/imp | modules/score_functor/src/internal/surface_helpers.cpp | #include <IMP/score_functor/internal/surface_helpers.h>
#include <cmath>
IMPSCOREFUNCTOR_BEGIN_INTERNAL_NAMESPACE
double get_height_above_surface(const algebra::Vector3D ¢er,
const algebra::Vector3D &normal,
const algebra::Vector3D &point,
... | ALGO | 0.99863 | 6.387599 |
9b408156-551f-4223-a19a-25e010784aff | priyanshu1101/Leetcode-Practice-Problems | 1790-check-if-one-string-swap-can-make-strings-equal/1790-check-if-one-string-swap-can-make-strings-equal.cpp | class Solution {
public:
bool areAlmostEqual(string s1, string s2) {
for(int i=0;i<s1.length();i++){
for(int j=i;j<s1.length();j++){
swap(s1[i],s1[j]);
if(s1==s2) return true;
swap(s1[i],s1[j]);
}
}
return false;
}
}... | ALGO | 0.999956 | 6.046333 |
0bca772e-5b09-4629-bd85-d19149bcdfc2 | hhr2449/Code | algorithm/graph theory/Homework/HW2/technologyIteration/main.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
#include <queue>
using namespace std;
int n;
vector<double> v;
vector<double> s;
vector<int> lable;//lable[i]表示原图中的顶点i在变化后的图中的编号,即label[i] = j表示顶点i在变化后的图中的顶点编号是j
vector<int> IsDel;
vector<double> costTime;
vector<int> outDegree;
struct Edge{
... | ALGO | 0.999899 | 3.852527 |
3ef13102-0c7c-4bd8-9780-c1f7adadee59 | pedrohfsd/tsplib_solver | tsplib_solver/CuttingPlaneCrossing.cpp | #include <vector>
using namespace std;
CuttingPlaneCrossing::CuttingPlaneCrossing(Data& data, bool singleThreaded) :TSP(data, "CuttingPlaneCrossing", singleThreaded) {}
void CuttingPlaneCrossing::solve() {
addDecisionVariables(true);
addObjectiveFunction();
addIncomingEdgeConstraints();
addOutgoingEdgeConstrain... | ALGO | 0.996599 | 4.410359 |
9d15b315-53a1-4bdd-8a0f-1df18745b2b5 | yjs616/Algorithm-Study | 백준/Jeongsoen/week7/17478.cpp | #include <iostream>
using namespace std;
int n;
int cnt=0;
string s1="\"재귀함수가 뭔가요?\"";
string s2="\"잘 들어보게. 옛날옛날 한 산 꼭대기에 이세상 모든 지식을 통달한 선인이 있었어.";
string s3="마을 사람들은 모두 그 선인에게 수많은 질문을 했고, 모두 지혜롭게 대답해 주었지.";
string s4="그의 답은 대부분 옳았다고 하네. 그런데 어느 날, 그 선인에게 한 선비가 찾아와서 물었어.\"";
string s5 ="라고 답변하였지.";
void solve(string s... | ALGO | 0.999747 | 3.257894 |
955d0b8f-1678-4cc1-8eb2-534120f15521 | Ravi02RR/leetcoded-solutions | 0917-boats-to-save-people/0917-boats-to-save-people.cpp | class Solution {
public:
int numRescueBoats(vector<int>& people, int limit) {
int boat=0;
sort(people.begin(),people.end());
int i=0;
int j=people.size()-1;
while(i<=j){
if(people[j]+people[i]<=limit){
boat++;
i++;
... | ALGO | 0.999993 | 5.939818 |
3ebe6f8a-ddee-4127-b341-232a2dd2f60d | YoLynx/Daily-DSA-Dose | Binary Search/p-6.cpp | // Problem Link : https://leetcode.com/problems/single-element-in-a-sorted-array/
class Solution {
public:
int singleNonDuplicate(vector<int>& nums) {
int n=nums.size();
int low=1; // loop goes from 1 to n-2 as we have handled the edge cases.
int high=n-2;
if(nums.size()==1... | ALGO | 0.999982 | 5.70026 |
5d7bd03b-3a87-4a76-b013-23c6227d857a | govindjeevan/OpenGL-Work | lab2/clock.cpp | #include <GL/glu.h>
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
struct Point {
GLint x;
GLint y;
};
void draw_dda(Point p1, Point p2) {
GLfloat dx = p2.x - p1.x;
GLfloat dy = p2.y - p1.y;
GLfloat x1 = p1.x;
GLfloat y1 = p1.y;
GLfloat step = 0;
if(abs(dx) > abs(dy)) {
ste... | TOOL | 0.961259 | 5.007854 |
71d3cad5-2dbc-4422-a112-24f860e9fcf9 | cakuang1/codeforces | codeforces/dp/opt/sub.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
// Fenwick (BIT) for exact 64-bit sums
struct Fenwick {
int n;
vector<ll> f;
Fenwick(int _n): n(_n), f(n+1,0) {}
// point update: A[i] += v
void update(int i, ll v) {
for (; i <= n; i += i & -i)
f[i] += v;
... | ALGO | 0.999948 | 4.539074 |
e3e0bad9-3a9d-4efe-b42a-d8b086d1e019 | caleb765landis/B-Tree | main.cpp | // main.cpp
#include <iostream>
#include <stdlib.h> // rand(), srand()
#include <cstdlib> // std::isDigit(), system
#include <algorithm> // find()
#include <vector>
#include <sstream>
#include "BTree.h"
#include "Node.h"
// prototype
bool isNumber(std::string string);
int main() {
// clear screen to start the progr... | ALGO | 0.998126 | 5.743508 |
5e85fea0-a8b1-4b65-8b8f-023093db6040 | TheGEN1U5/codeforcesProblems | contests/round 944 div 4/D/D.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t; cin >> t;
while(t--){
string s; cin >>s;
int c = 1;
int oiC = 0;
for(int i=0; i<s.size()-1; i++){
if(s[i]=='1'){
if(s[i+1] == '0') c++;
}
else{
i... | ALGO | 0.999944 | 4.572427 |
e3fdd63f-7966-4f31-87be-343d5ca25a59 | Aashu1303/leetcode | 1030-smallest-string-starting-from-leaf/smallest-string-starting-from-leaf.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.999987 | 5.924676 |
f80a1b62-019d-4914-92e7-b6b87a777e8c | open-airlab/VTNMPC-Autonomous-Wind-Turbine-Inspection | WTI_catkin/NMPC_code_generator/acado_ccode_generation/src/quadrotor/nmpc_pc_learning_ccode.cpp | /**
* \author Mohit Mehndiratta
* \date 2019
*/
#include <acado_code_generation.hpp>
#include <ros/ros.h>
#include <ros/package.h>
#include <boost/algorithm/string.hpp>
int main()
{
USING_NAMESPACE_ACADO
// Variables:
DifferentialState x; // the body position w.r.t X_I
DifferentialState y; ... | ALGO | 0.989165 | 4.214275 |
ad636f53-3e87-4d78-9a19-ee10e02afb8c | AarishEjaz/DSA-with-CPP | Stacks/sort a stack(coding ninja).cpp | #include <iostream>
#include <stack>
using namespace std;
void sortedInsert(stack<int> &st, int number)
{
if (st.empty() || st.top() < number)
{
st.push(number);
}
else
{
int n = st.top();
st.pop();
sortedInsert(st, n);
st.push(n);
}
}
void sortStack(sta... | ALGO | 0.999941 | 5.396113 |
7acd0a4e-8dab-4e9a-931c-781b2a19d4c1 | Sagar73594/C-Tutuorials | 22STL/19Permuations.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
// just larger from smaller to bigger.
// means 123 then 132 then 213 then 231 like this lexicographical order.
vector<int> arr{1, 2, 3};
do
{
for (auto i : arr)
cout << i << " ";
cout << endl;
} while (next... | ALGO | 0.999854 | 4.463429 |
51a97044-ea91-49ea-8afd-79be4530d56f | LikeScience/Code | CompetitiveProgramming/ONI/ONI2023QC.cpp | #include <bits/stdc++.h>
#define F(i,s,e) for (int i = s; i<e; i++)
#define ll long long
#define fi first
#define se second
using namespace std;
ll c(char A, char B) {
if (B == '?') return 1;
else return int(A==B);
}
vector<int> dc(int x, vector<int> &pt) {
vector<int> v(11);
for (int i = 10; i>=0; i... | ALGO | 0.999862 | 4.07184 |
b97d6496-07e7-4431-807d-bdbeae7ce193 | chickenchobab/BOJ-problem-solving | 4_graph/2_shortest_path/9376_탈옥.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define INF 10000
using namespace std;
int T, H, W;
char map[102][102];
typedef pair<int, int> p;
vector<p> people;
int cnt[3][102][102];
deque<p> dq;
int di[] = {1, -1, 0, 0},... | ALGO | 0.999763 | 3.682059 |
a1943fe7-1380-49a5-acc3-6e851e567112 | ArielGarciaM/arigami | Mate/CRT.cpp | /*INFO
{\bf Descripción: } Encuentra $x$ tal que $x \equiv x_1 \pmod{m_1}, x \equiv x_2 \pmod{m_2}$. Regresa $-1$ si tal $x$ no existe.
{\bf Complejidad: } $\mathcal{O}(\log(m_1 + m_2))$. Rápido en la práctica.
*/
#include <bits/stdc++.h>
using namespace std;
template<typename T> void euclid(T a, T b, T &x, T &y) {
... | ALGO | 0.999996 | 4.580951 |
b5d4a461-719e-4621-9289-8f97b5265976 | mathieu-reymond/MOTTTS | src/MOBanditNormalPosterior.cpp | #include <MOBanditNormalPosterior.hpp>
#include <Statistics.hpp>
MOBanditNormalPosterior::MOBanditNormalPosterior(const size_t A, const size_t W, bool saveSamples) :
sampleMu_(A, W), sampleSumOfSquares_(A, W), counts_(A),
saveSamples_(saveSamples)
{
sampleMu_.setZero();
sampleSumOfSquares_.set... | ALGO | 0.995867 | 6.256606 |
f2574b3e-2b36-4c09-b894-d95d45887266 | Danyal-Rana/LeetCode | 0160-intersection-of-two-linked-lists/0160-intersection-of-two-linked-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
int getLength (ListNode *x)
{
int myCounter = 0;
while (x != NULL)
{
myCounter++;
... | ALGO | 0.999617 | 5.369145 |
a939d72b-4471-43e4-a6f0-ecc7de15844a | yongyi781/turing | antihydra.cpp | #include "pch.hpp"
#undef fun
#include <boost/multiprecision/gmp.hpp>
using namespace std;
auto run()
{
mpz_int a = 8;
int64_t b = 0;
for (size_t i = 0; b != -1; ++i)
{
b += (int64_t)(2 - (a & 1) * 3);
a += a >> 1;
if (i % 100000 == 0)
cout << i << " | log2(a) = " ... | ALGO | 0.996028 | 4.331513 |
03666647-e9be-4b30-9d7d-26c66c1cedd7 | cepxuozab/YandexTrainingAlgorithms | Training4/Lesson4/E_CorrectBracketSequences/main.cpp | #include <cstdio>
#include <iostream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int n;
stack<char> s;
string opened = "([";
string closed = ")]";
string res;
void input()
{
cin >> n;
res.resize(n);
}
char GetPair(char openBracket)
{
int pos = opened.find(openBracket);
r... | ALGO | 0.999791 | 4.149578 |
aa16abd6-b3b4-403a-b06c-7e96c99ded56 | pritmanvar/DSA-with-CPP | Searching/Search in Rotated Sorted Array.cpp | // Problem Link : https://leetcode.com/problems/search-in-rotated-sorted-array/
int search(vector<int>& nums, int target) {
int l = 0;
int h = nums.size() - 1;
while(l <= h){
int m = l + (h - l)/2;
if(nums[m] > target){
if(nums[m] >= nums[l]){
... | ALGO | 0.999986 | 6.301411 |
7df9dd26-497e-4741-b99a-a4de4101e16f | nicollasprado/prog-competitiva | Questoes/atcoder/beginner-389/c.cpp | // This isn't completed
// Questão não completa
#include <iostream>
#include <queue>
using namespace std;
int main(){
int qt; cin >> qt;
queue<long long> snakes;
for(int i=0; i < qt; i++){
int type;
long long l;
cin >> type;
if(type == 1){
cin >> l;
... | ALGO | 0.999487 | 3.524674 |
85951d34-167d-44df-8504-9887372093a8 | ArrowOS-Extended/android_frameworks_av | media/codecs/amrwb/dec/src/isp_isf.cpp | /*
------------------------------------------------------------------------------
Filename: isp_isf.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-----------------------------------------------------------------------------... | ALGO | 0.999317 | 5.655546 |
b8574487-09da-4e0b-be1c-c5efc55ae226 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_1496_12.cpp | #include <bits/stdc++.h>
using namespace std;
int num[1000009], low[1000009], scc[1000009], n, m, cnt, t;
vector<vector<int> > adj;
stack<int> s;
void add(int x, int sx, int y, int sy) {
x = x << 1 ^ sx;
y = y << 1 ^ sy;
adj[x ^ 1].push_back(y);
adj[y ^ 1].push_back(x);
}
void dfs(int u) {
num[u] = low[u] = +... | ALGO | 0.999983 | 3.873874 |
cee5c64c-cf2b-481a-b1c4-b0902aac1340 | rasgr6-2017/detection_and_pcl | correspondence_grouping.cpp | #include <pcl/io/pcd_io.h>
#include <pcl/point_cloud.h>
#include <pcl/correspondence.h>
#include <pcl/features/normal_3d_omp.h>
#include <pcl/features/shot_omp.h>
#include <pcl/features/board.h>
#include <pcl/filters/uniform_sampling.h>
#include <pcl/recognition/cg/hough_3d.h>
#include <pcl/recognition/cg/geometric_con... | ALGO | 0.997555 | 6.603967 |
1469aae2-0cf1-4aa3-ab14-8c7a47415bbb | KshipraMalviya/Programming | CodingC++/Stack/RedundantParenthesis.cpp | #include<iostream>
#include<string>
#include<stack>
using namespace std;
int main()
{
cout<<"Enter the expression : ";
string s;
cin>>s;
int l=s.length();
stack<string>st;
int redundant=0;
for(int x=0; x<l; x++)
{
if(s[x]=='(' || s[x]=='+' || s[x]=='-' || s[x]=='*' || s[x]=='/'... | ALGO | 0.999598 | 4.622112 |
54ca4aa5-e25b-4cdb-b546-ae32240675a5 | ramah-hawash/LeetCode | 83-remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.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* deleteDupli... | ALGO | 0.999941 | 5.735457 |
1200dad9-e2a6-4432-8e7b-81f8c973c61f | jiangyinzuo/algorithm | src/dynamic_programming/最长回文子串/leetcode5.cpp | //
// Created by jiang on 2020/2/25.
//
#include <cstdio>
#include <cstdlib>
inline int min(int n1, int n2) {
return n1 < n2 ? n1 : n2;
}
inline int max(int n1, int n2) {
return n1 > n2 ? n1 : n2;
}
char *longestPalindrome(char *s) {
char str[4000];
int len = 0;
for (int i = 0; s[i]; ++i) {
... | ALGO | 0.999926 | 4.875 |
8bf908f5-dbcf-4d72-8f04-5fb3fd872985 | rishabangadi/dsa-problems | Leetcode/Leetcode-DSA-course/Trees-and-Graphs/127-word-ladder/word-ladder.cpp | class Solution {
public:
int ladderLength(string beginWord, string endWord,
vector<string>& wordList) {
unordered_set<string> dict(wordList.begin(), wordList.end());
queue<pair<string, int>> queue({pair(beginWord, 1)});
unordered_set<string> seen({beginWord});
... | ALGO | 0.999982 | 5.944466 |
986f31a1-b571-4645-8587-01d9aa547dee | Lamiiine/Competitive-Programming-1 | Solutions/UVA/10341.cpp | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define eps 1e-9
using namespace std;
typedef double d;
d a[6];
inline d func(const d x){
// This function is always decreasing
return a[0]*exp(-x) + a[1]*sin(x)+a[2]*cos(x)+a[3]*tan(x)+a[4]*x*x+a[5];
}
int main(){
// freopen("Input.txt", "r", stdin);
int b[6];
... | ALGO | 0.999962 | 3.280107 |
9aa789f2-2ad1-42d8-afc1-ee1d6fa12970 | Liousvious/LeetCode | Dynamic_Problems/Number_bits_dp/902. Numbers At Most N Given Digit Set.cpp | #include <bits/stdc++.h>
using namespace std;
/*
dp[i][0] denotes the total combination numbers equal to target number last i bits
dp[i][1] denotes the total combination numbers less than target number last i bits
*/
class Solution {
public:
int atMostNGivenDigitSet(vector<string>& D, int N) {
... | ALGO | 0.999932 | 6.49928 |
1ee39eb9-2bdb-4d63-ae02-5491079d87d3 | De-Las-Alas/58009-DSAA | Insert.cpp | #include <iostream>
using namespace std;
int* insert(int n, int arr[], int x, int pos)
{
int y;
n++;
for (y = n; y >= pos; y--)
arr[y] = arr[y - 1];
arr[pos - 1] = x;
return arr;
}
int main()
{
int arr[100] = { 0 };
int y, x, pos, n = 10;
for (y = 0; y < 10; y++)
arr[y] = y + 1;
cout<<"\nThe Current Ar... | ALGO | 0.9995 | 4.096715 |
571b91de-b9f8-416e-a112-cd3b55ff0311 | WYK15/swift-Ollvm12 | llvm/lib/Transforms/Scalar/BDCE.cpp | #include "llvm/Transforms/Scalar/BDCE.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/DemandedBits.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"... | TOOL | 0.894295 | 7.964206 |
37f9635a-29c7-42d5-8515-9c9228e8d0d5 | u-wyh/luogu-code | 拓扑排序——入度删除法2.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAXN = 100;
int n,m;
vector<vector<int >>graph;
int indegree[MAXN];
int edge[MAXN][2];
queue<int>Q;
int main()
{
cin>>n>>m;
for(int i=1;i<=m;i++){
cin>>edge[i][0]>>edge[i][1];
}
graph.resize(n);
for(int i=1;i<=m;i++){
graph[edg... | ALGO | 0.999997 | 4.362056 |
440951fa-5002-4619-ad55-4916fb9c80c3 | arkchimy/_Algorithm | BackJoon/Class단계/3단계/11286번_절댓값 힙/소스.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
bool Comp(const int& a, const int& b)
{
if (abs(a) == abs(b))
return a > b;
return abs(a) > abs(b);
}
int main()
{
auto comp = [](int a, int b)
{
if (abs(a) == abs(b))
return a > b;
return abs(a) > abs(b);
... | ALGO | 0.999972 | 4.113909 |
a25701ab-71a9-4db5-bc58-55383d07caf4 | thepratholic/Competitive-Programming | Codeforces/practice problems/D_Remove_Two_Letters.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, n) for (ll i = 0; i < n; i++)
#define ia(a, n) \
ll a[n]; \
f(i, n) cin >> a[i]
#define iv(v, n) \
vector<ll> v(n); \
f(i, n) cin >> v[i]
#define MOD (1000000007)
#define INF 1000000000000000000LL // Infinity for ll
#d... | ALGO | 0.99973 | 4.586744 |
e971e26d-af20-411e-9b0c-3b9350d23938 | raincross7/code-similarity | codes/train_code/problem172/problem172_418.cpp | #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;
int main()
{
int n, mx = 0, mn = 1010;
cin >> n;
vector<int> x(n);
for(int i = 0; i < n; ++i){
cin >> x.at(i);
... | ALGO | 0.999963 | 4.445706 |
a0604299-11c3-4d27-8952-df48bdcde477 | hjiang13/LLMs-in-IR | POJ-104/44/1253.cpp | #include <iostream>
using namespace std;
int reverse(int num)
{
int zheng=abs(num);
int sz[10],i,wei=0;
for(i=0; i<10; i++){
sz[i]=zheng%10;
zheng=zheng/10;
wei++;
if(zheng==0)
break;
}
int Reverse=0;
for(i=0; i<wei; i++){
Reverse=Reverse*10+sz[i];
}
return Reverse;
}
int main()
{
int n,i;
for(i=0; i<6; i++){
cin >> "%... | ALGO | 0.999505 | 3.626826 |
5aee2f9f-3cf9-454b-b4c0-86266fb40f5f | awulz/CppLearningJourney | bar_earnings_simulation.cpp | #include <iostream>
#include <time.h>
#include <stdlib.h>
using namespace std;
int main()
{
int bar1[31], bar2[31];
int day1 = 0, day2 = 0;
srand(time(0));
for(int i = 0; i < 31; i++)
{
bar1[i] = rand()% 999;
}
for(int i = 0; i < 31; i++)
{
bar2[i] = rand()% 999;
}
if (bar1[24] <= bar... | ALGO | 0.990503 | 3.824441 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.