uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3be0fe79-56ae-4b53-8d82-1489ff2afdeb | geniusrks1/Hackerblocks-DSA-in-java | ISA_DEC_Adarsh/Binary Tree 18 quest/Lowest Common Ancestor ( BST ).cpp | #include<bits/stdc++.h>
using namespace std;
class node
{
public:
int data;
node* left, *right;
node(int data)
{
this->data=data;
left=NULL;
right=NULL;
}
};
node* insertNodeToBST(node* root, int val)
{
//Base Case
if(!root)return new node(val);
//Recursive Case
if(root->data<val)root->right=insertNo... | ALGO | 0.99999 | 4.477454 |
7c7a3e28-6a51-4661-90c1-810506665094 | GaurishIIITNR/CP-Problems-Solutions | B_Mystic_Permutation.cpp | //🚩HHM🚩
// DATE: 10-06-2022
// TIME:22:28:36
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define dbl double
#define deb(v) cout << #v << " " << v << "\n"
#define debv(v) \
cout << #v << ": "; \
for (auto x : v) \
{ \
cout << x << " ... | ALGO | 0.999955 | 4.525283 |
165a3b36-53d0-43a7-bd7b-e60fb8108bba | tjdqh4909/sum_test | sum.cpp | int sum(int n) {
int res = 0;
for (int i=1; i<= n; ++i)
res += i;
return res;
}
| ALGO | 0.997826 | 3.628196 |
8222cb88-bd79-457a-b995-717cec0e1cfa | ishandutta2007/codeforces | rafi22/normal/1710/B.cpp | #include <bits/stdc++.h>
#define int long long
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
double PI=3.14159265359;
int inf=1000000000000000007;
int mod=100... | ALGO | 0.999974 | 3.726762 |
e155f1e6-7104-4610-88a1-c21091ed8db0 | blockspacer/bootstrap-redux | ext/boost-1.70.0/libs/bimap/example/tagged_simple_bimap.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is misleading and unsettling, there are no
// po... | TOOL | 0.943753 | 5.94737 |
8d03dab1-3267-48c4-9f10-4c5c1608ed19 | anuragbnrj/leetCodeSolutions | 3000-minimum-absolute-difference-between-elements-with-constraint/3000-minimum-absolute-difference-between-elements-with-constraint.cpp | class Solution {
public:
int minAbsoluteDifference(vector<int>& nums, int x) {
int len = nums.size();
set<int> stt;
int res = INT_MAX;
for (int i = x; i < len; i++) {
int curr = nums[i];
stt.insert(nums[i - x]);
auto lb = stt.... | ALGO | 0.99998 | 5.649415 |
602a99e4-0cda-4064-9437-b203aba9e63c | upcurious/test_BA_g2o | g2o/core/sparse_optimizer.cpp | #include "sparse_optimizer.h"
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <iterator>
#include <cassert>
#include <algorithm>
#include "estimate_propagator.h"
#include "optimization_algorithm.h"
#include "batch_stats.h"
#include "hyper_graph_action.h"
#include "robust_kernel.h"
#include "g2o/s... | ALGO | 0.999612 | 6.879821 |
ca16373e-a903-4bd5-9eb4-4fd4c068c28a | TuananhSR/MaTran_NMLT_ThayKhang | Bai015/Bai015.cpp | #include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <string>
using namespace std;
string getInputFileName(int);
void Nhap(int[][500], int&, int&, string);
void Xuat(int[][500], int, int);
void LietKe(int[][500], int, int, int);
int main()
{
int b[500][500];
int k;
... | ALGO | 0.986271 | 3.048784 |
8d2bd735-1c0c-4841-b1b3-83a3984eea68 | kmjp/procon | codeforce/241-260/cf257/d.cpp | #include <cstdlib>
#include <cstring>
#include <memory>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)print... | ALGO | 0.999868 | 3.79966 |
e64262ef-ba29-4a26-8ffd-573f4f55640e | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_9744_15.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
double n, k;
cin >> n >> k;
long long a[(long long)floor(n)];
double sum = 0;
for (long long i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
if (ceil(sum / n) == k) {
cout << 0;
return 0;
... | ALGO | 0.99997 | 3.566432 |
100aff37-3fc9-4bc1-8d07-f71b17e89ac4 | qquynh217/DSA | sap_xep_don_gian.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll P = 1e9 + 7;
int main()
{
int n;
cin >> n;
int a[n + 5], vt[n + 5], res = 1;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
vt[a[i]] = i;
}
int l[n + 5];
l[1] = 1;
for (int i = 2; i <= n; i++)
... | ALGO | 0.999949 | 3.86778 |
a69d298f-5a42-47ba-8c72-ac56cadc2373 | mykhailo-fedyna/oop-lab6.1 | lab6.1/lab6.1.cpp | #include "Array.h"
#include <iostream>
#include <ctime>
#include <cmath>
#include <algorithm>
using namespace std;
Array createDynamicArray(int* arr, int size) {
// Step 2: Create a dynamic array
Array dynamicArray(size);
// Copy values from the initial array to the dynamic array
for (int i = 0; i < ... | ALGO | 0.999602 | 5.526411 |
c4722f17-1366-4664-8c14-508e2dabfa16 | Aryan-Thapa/DSA | Questions/lastoccurence.cpp | #include<iostream>
using namespace std;
//iterative
int lastoccurence(string &s,char &ch)
{
int ans=0;
int n=s.size();
for(int i=0;i<n;i++)
{
if(s[i]==ch)
{
while(i>ans)
{
ans=i;
}
}
}
return ans;
}
//recursive
int lasto... | ALGO | 0.999679 | 5.021947 |
8102cad2-bdae-432e-b4ed-04d5bdac5b7e | perchuts/CompetitiveProgramming | Olympiads/IOI/ioi10quality.cpp | #include <bits/stdc++.h>
#define maxn (int)(1e5+51)
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define endl '\n'
#define ll long long
#define pb push_back
#define ull unsigned long long
#define ii pair<int,int>
#define iii tuple<int,int,int>
#define inf 2000000001
#define mod 1000000007 //998244353
... | ALGO | 0.999442 | 3.729749 |
2d5569d7-f95b-49f4-9fc5-2f45b136963b | delwar03/CF | B_Vertical_Writing.cpp | #include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;
const int INF = 1e18 + 10;
void solve() {
int n; cin>>n;
vector<string> v(n);
int mx = 0;
for(auto &x : v) cin>>x, mx = max(mx, (int) x.size());
reverse(v.begin(), ... | ALGO | 0.999988 | 3.897662 |
0f19de94-51da-4114-aa32-0010d63a0d41 | huangjunhao2019/leetcode-tencent | algorithm/sort/quick_sort/quick_sorte.cpp | #include<iostream>
#include<vector>
using namespace std;
int partition(vector<int> &nums,int left,int right){
int pivot=nums[left];
while(left<right){
while(left<right && nums[right]>=pivot){
right--;
}
nums[left]=nums[right];
while(left<right && nums[left]<=pivot){
... | ALGO | 0.999981 | 4.859316 |
00724b31-2894-414d-a407-e5608d88eb85 | JamiePW/LuoguOI | P/P1803.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
struct race {
int start;
int end;
};
race arr[1000001];
bool Compare(race a, race b) {
return a.end < b.end;
}
int main() {
int n;
cin >> n;
for (int i=0;i<n;i++) {
scanf("%d%d", &arr[i].start, &arr[i].e... | ALGO | 0.999936 | 4.114875 |
273f909b-7992-4785-829e-0cef771e0b9c | thuswm/FreeCAD | src/Mod/Robot/App/kdl_cp/chainiksolvervel_pinv.cpp | // Version: 1.0
// Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// URL: http://www.orocos.org/kdl
#include "chainiksolvervel_pinv.hpp"
namespace KDL
{
ChainIkSolverVel_pinv::ChainIkSolverVel_pinv(const Chain& _chain,doub... | ALGO | 0.99979 | 6.050402 |
27767b04-caaa-4c36-a848-ad628fa84eff | ayushgoyal04/Learning-Journey | Learning-DSA/Training placement classes/Phase 1- Day wise Contest on Basic 17022024/G.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
cout<<k%n;
} | ALGO | 0.999556 | 3.277143 |
31e6426c-b41d-4a34-9d2d-ca994f51eaf9 | servo/rust-icu | icu-sys/icu/source/i18n/search.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/brkiter.h"
#include "unicode/schriter.h"
#include "unicode/search.h"
#include "usrchimp.h"
#include "cmemory.h"
// public constructors and destructors -----------------------------------
U_NAMESPACE_BEGIN
SearchIt... | TOOL | 0.88972 | 4.234629 |
c5a73969-3a3c-4cae-aec9-8cb7c480b946 | 113bommy/LogicalErrorFixCodeT5 | logicalErrorFix_CodeT5_Linenumber/model/cpp/CodeT5_LineNumber_cpp_source/Problem_20_source_90.cpp | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int MAXN = 1e3 + 5;
const long long MAXV = LLONG_MAX;
template <typename T1, typename T2>
inline void chmin(T1& x, T2 y) {
if (x > y) x = y;
}
template <typename T1, typename T2>
inline void swapmin(T1& x, T2& y) {
if (x > y) swap(x, y);... | ALGO | 0.999547 | 4.763559 |
2f7085ad-2892-43f6-bdeb-bc9cbc57db25 | SrLancelot7/ProgramacionCompetitiva | 10000-10999/10038 - Jolly Jumpers/main.cpp | #include<stdio.h>
#include<bitset>
#include<cmath>
//antes de compilar cualquier cosa, acuerdate de guardar lo que cambiaste
int main()
{
#ifndef ONLINE_JUDGE
// For getting input from input.txt file
freopen("input.txt", "r", stdin);
// Printing the Output to output.txt file
... | ALGO | 0.999883 | 3.770715 |
281991f4-7479-4c14-8698-2b1e1febf702 | YoshikiTakashima/vert | benchmark/cpp_transcoder/SMALLEST_OF_THREE_INTEGERS_WITHOUT_COMPARISON_OPERATORS_1/SMALLEST_OF_THREE_INTEGERS_WITHOUT_COMPARISON_OPERATORS_1_processed.cpp |
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
using namespace std;
int f_gold ( int x, int y, int z ) {
if ( ! ( y / x ) ) return ( ! ( y / z ) ) ? y : z;
return ( ! ( x / z ) ) ? x : z;
}
| ALGO | 0.998831 | 4.82375 |
be4b8a58-6573-48ac-825e-acfb24499a49 | minhnbnt/ptit_solutions | dsa/DSA10015.cpp | #include <algorithm>
#include <iostream>
#include <unordered_map>
#include <vector>
struct Edge {
int a, b;
int length;
bool operator<(const Edge &other) {
return this->length < other.length;
}
};
class DisjoinSet {
std::unordered_map<int, int> parent;
std::unordered_map<int, unsigned> children_size;
publ... | ALGO | 0.999893 | 4.569777 |
adbf53f5-5efa-4d5a-a1c0-bb3664e972c7 | ishabhray/Competitive-Programming | codeforces/1717C.cpp | #include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
#define al... | ALGO | 0.999975 | 4.050375 |
9e11917b-d82a-44c2-ae12-88dd9543bd6a | LWJGL/lwjgl3 | modules/lwjgl/meshoptimizer/src/main/c/quantization.cpp | #include <assert.h>
union FloatBits
{
float f;
unsigned int ui;
};
unsigned short meshopt_quantizeHalf(float v)
{
FloatBits u = {v};
unsigned int ui = u.ui;
int s = (ui >> 16) & 0x8000;
int em = ui & 0x7fffffff;
// bias exponent and round to nearest; 112 is relative exponent bias (127-15)
int h = (em - (112... | ALGO | 0.997163 | 6.221665 |
db4f5947-4239-4678-8296-df443c0f918d | vivekreddy1601/codeforces | 1351B-Square?.cpp | //code by Vivek Reddy
#include <iostream>
#include <utility>
#define ll long long int
using namespace std;
int main()
{
ll vt;
cin >> vt;
while(vt--){
ll a,b,a1,b1;
cin >> a >> b >> a1 >> b1;
if(a > b)
swap(a,b);
if(a1 > b1)
swap(a1,b1);
if(a... | ALGO | 0.9995 | 3.267563 |
6a7c9955-deaf-43d0-ba6b-6daee8a58f3e | Kirti123x/codeforces | B_Swap_and_Delete.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
for(int i=0;i<t;i++){
string s, str;
cin>>s;
str = s;
int cnt0 = 0, cnt1 = 0;
int k = 0;
for(k=0;k<s.size();k++){
if(s[k]=='0') cnt0++;
else cnt1++;
}
... | ALGO | 0.999868 | 3.973034 |
3ece76d7-28fd-4834-8ada-d289062951e5 | BigBigFlyPig/USIM | include/opencv/sources/samples/cpp/tutorial_code/xfeatures2D/LATCH_match.cpp | #include <iostream>
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_XFEATURES2D
#include <opencv2/features2d.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/opencv.hpp>
#include <vector>
// If you find this code useful, please add a reference to the following pape... | ALGO | 0.989528 | 6.065845 |
13949c5c-ecb0-467b-a8f7-e28f12765af4 | paarth/A_lib | RMQ_n_LCA/SEGMENT_T.cpp | /*
Complexity
For initializing: (init): O(N)
For query: (query): O(log2 N)
< O(N) , O(log2 N) >
*/
#include<iostream>
#include<map>
#include<algorithm>
#include<stack>
#include<queue>
#include<climits>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int... | ALGO | 0.999961 | 4.834138 |
15683ce5-3130-47cc-a8d9-541770c7d16a | CodeBySrinivasan/CODSOFT-churn | venv/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.9982 | 7.198757 |
9f063231-ae99-4fe5-add7-48e9fbf5c6cb | cran/Boom | src/Bmath/qweibull.cpp | #include "nmath.hpp"
#include "dpq.hpp"
namespace Rmath{
double qweibull(double p, double shape, double scale, int lower_tail, int log_p)
{
#ifdef IEEE_754
if (ISNAN(p) || ISNAN(shape) || ISNAN(scale))
return p + shape + scale;
#endif
R_Q_P01_check(p);
if (shape <= 0 || scale <= 0) ML_ERR_return_NA... | ALGO | 0.978685 | 4.177987 |
d28faba2-c4da-4076-aa59-d2980e8ca18a | kr-premsingh/DSA-QS | DPP 8/q1 - BFS.cpp | #include<bits/stdc++.h>
using namespace std;
class Graph{
int V;
list<int> *adj;
public:
Graph(int V);
void addEdge(int v, int w);
void BFS(int s);
};
Graph::Graph(int V){
this->V = V;
adj = new list<int>[V];
}
void Graph::addEdge(int v, int w){
adj[v].push_back(w);
}
voi... | ALGO | 0.999972 | 4.658835 |
f60ea179-4bdf-46fd-ac0a-97c49d3056ec | Ruman-Hossain/Problem-Solving | UVA/11417 GCD (2).cpp | #include<bits/stdc++.h>
using namespace std;
int GCD(int a,int b)
{
int t;
while(a!=0){
t=b%a;
b=a;
a=t;
}
return b;
}
int main()
{
int n,i,j;
while((cin>>n)&&n!=0){
int G=0;
for(i=1;i<n;i++){
for(j=i+1;j<=n;j++){
G+=GCD(i,j);
}
... | ALGO | 0.999867 | 4.486516 |
f3898309-ed82-464c-801d-d80476973078 | ishandutta2007/codeforces | peti1234/normal/1734/B.cpp | #include <bits/stdc++.h>
using namespace std;
int w;
int main()
{
cin >> w;
while (w--) {
int n;
cin >> n;
for (int i=1; i<=n; i++) {
for (int j=1; j<=i; j++) {
cout << (j==1 || j==i) << " ";
}
cout << "\n";
}
}
return ... | ALGO | 0.999956 | 4.082861 |
dd3f82e7-0d6a-40e3-8411-3f7da4428e96 | sage26Ayano/competitive-programming | codeforces/A_Crazy_Computer.cpp | #include <bits/stdc++.h>
using namespace std;
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tlp int tc; cin >> tc; while (tc--)
#define rep(i, a, b) for(int i = a; i < b; ++i)
#define sp ' '
#define nl '\n'
#define newline cout << '\n'
#define ll long long int
#define vi vector <int>
#defin... | ALGO | 0.999958 | 3.821923 |
9805b58e-8a20-446c-b6c7-5a5e8e49703b | ishandutta2007/codeforces | pacu/normal/518/B.cpp | #include <iostream>
#include <string>
using namespace std;
bool fine[200000];
int main()
{
string s,t;
int cntUpper[26];
int cntLower[26];
cin >> s >> t;
for(int i=0;i<26;i++)
cntUpper[i] = cntLower[i] = 0;
int N = s.size();
int M = t.size();
for(int i=0;i<M;i++)
{
if(('a'<=t[i])&&(t[i]<='z'))
cntLower[... | ALGO | 0.999996 | 4.143997 |
5644bc21-0d05-4fb2-ae0c-17fcfb22e01f | arkayyy/leetcode-problems | Strings/242-valid-anagram/242-valid-anagram.cpp | class Solution {
public:
bool isAnagram(string s, string t) {
if(s.length()!=t.length()) return false;
vector<int> freq(26,0);
for(auto ch:s)
freq[ch-'a']++;
for(auto ch:t)
freq[ch-'a']--;
for(auto f: freq) if(f!=0) return fa... | ALGO | 0.999997 | 6.323001 |
72e7bbec-cf7d-4087-9704-a4521d55fe5a | SayandeepB9/Codeforces | solved/1881C.cpp | #pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
// #pragma GCC target("avx2,sse4.2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 998244353
#define mod1 1000000007
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define rev(... | ALGO | 0.99981 | 5.521126 |
67658237-36c2-4bf7-b3c8-dff4790f4532 | Uttamkumargupta000/DSA | GeeksForGeeks/CompareTwoFraction.cpp | class Solution {
public:
string compareFrac(string str) {
// Code here
double num1=0,num2=0,den1=0,den2=0;
string temp = "";
//intilise the pointer to the stating of the string
int i=0;
//geting the individual sring as integer in numerator next an... | ALGO | 0.999793 | 4.513803 |
e03273e3-b373-4700-bfd5-50f03bd6cc27 | Kuo-1025/LeetCode_Solution | Dynamic_Programming/2140/2140.cpp | /*
* @Author Jun-an
* @Date 2023/5/12
* @Url https://leetcode.com/problems/solving-questions-with-brainpower/description/
*/
class Solution {
public:
long long dp[100005];
long long mostPoints(vector<vector<int>>& q) {
int sz = q.size();
for (int i = sz - 1; i >= 0; --i) {
int ... | ALGO | 0.999802 | 5.154214 |
7726b4c0-734d-4241-b2db-1fcd3f7ab32b | harjeevsingh7115/Patterns-in-C | 6 Pyramid pattern.cpp | #include <stdio.h>
int main() {
int size = 5;
for (int i = 0; i < size; i++) {
for (int j = 0; j < size-i-1; j++) {
printf(" ");
}
for (int k = 0; k < 2*i+1; k++) {
printf("*");
}
printf("\n");
}
return 0;
}
| ALGO | 0.999698 | 3.904076 |
81de19a4-c340-4539-8d51-fdd447a471f2 | raberlt/PHENIKAA | Nam2/Ki2/LapTrinhCNangCao/ThucHanh/9_5_2023/OanTuTi.cpp | #include<iostream>
using namespace std;
bool check(string &s){
if(s.length() != 3) return false;
for(int i = 0; i<s.length(); i++){
if(s[i]!= 'B' && s[i] != 'G' && s[i] != 'K') return false;
}
return true;
}
void getWinner(string s1, string s2){
int diem=0;
for(int i = 0; i <s1.length()... | ALGO | 0.999977 | 3.643052 |
6d46e118-d841-4edf-9c5b-6e4f93aece69 | scalyvladimir/algorithms_and_data_structures | least_square_method/main.cpp | #include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ifstream input("D:\\HARD WORK PAYS OFF\\Labs\\5 sem\\input.csv");
if (!input.is_open()) {
throw runtime_error("File not found.");
}
lon... | ALGO | 0.983041 | 3.78248 |
6b7d1643-2ef7-4f79-abf2-4c2359e055b6 | juanporta1/oia-train | jurisdiccional/terminados/tatetizero/tatetizero.cpp | #include <iostream>
#include <vector>
using namespace std;
void imprimirTablero(vector<vector<int>> tablero)
{
for (int i = 0; i < 3; i++)
{
for(int j = 0; j < 3; j++)
{
switch (tablero[i][j])
{
case 0:
cout << " . ";
break;
... | ALGO | 0.999362 | 4.364685 |
569e3e1b-1be8-4433-8387-bec7555eefc7 | baizmeoq/Code-Cpp | Cautrucdulieu/queue.cpp | #include<iostream>
using namespace std;
typedef struct {
int front, rear; // Vị trí đỉnh đầu, đỉnh cuối
int *nodes; // Danh sách các phần tử
} Queue;
void init(Queue* queue);
void insert(Queue* queue, int node);
int remove(Queue* queue);
void release(Queue* queue);
void traverse(Queue* queue);
in... | ALGO | 0.999543 | 4.277894 |
59d1c3db-906c-486d-ab84-6f4fb1264526 | SloanPC/ZeroClient | src/deps/cryptopp/oaep.cpp | // oaep.cpp - originally written and placed in the public domain by Wei Dai
#include "pch.h"
#ifndef CRYPTOPP_IMPORTS
#include "oaep.h"
#include "stdcpp.h"
#include "smartptr.h"
NAMESPACE_BEGIN(CryptoPP)
// ********************************************************
size_t OAEP_Base::MaxUnpaddedLength(size_t paddedL... | TOOL | 0.854632 | 7.868777 |
00e6872f-8d62-4116-a904-dd1870018535 | dcjones/isolator | src/fastmath.cpp |
#include <cmath>
#include "fastmath.hpp"
#include "fastmath-vanilla.hpp"
#include "fastmath-sse.hpp"
#include "fastmath-avx.hpp"
#include "cpuid.hpp"
/* The implementation of each of these functions is determined at run time */
void* (*aalloc)(size_t n) = NULL;
void (*afree)(void*) = NULL;
void (*acopy)(void* dest, ... | ALGO | 0.947125 | 5.454988 |
9b682c3b-51e7-423a-98fa-15db71682fb0 | dhoehna/RipOutDOL | Source/Core/Common/Crypto/ec.cpp | #include <algorithm>
#include <cstring>
#include "Compiler.h"
#include "Crypto/bn.h"
#include "Crypto/ec.h"
#include "Random.h"
#include "StringUtil.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4505)
#endif
namespace Common::ec
{
static const u8 square[16] = {0x00, 0x01, 0x04, 0x05, 0x10, 0x11,... | ALGO | 0.999531 | 7.001757 |
a3141631-293a-4cd9-83e5-6b820daf5003 | txs19991/moveit_pilz_blend_enhancement | src/trajectory_generator_ptp.cpp | #include "pilz_industrial_motion_planner/trajectory_generator_ptp.h"
#include "moveit/robot_state/conversions.h"
#include "ros/ros.h"
#include <iostream>
#include <sstream>
#include <fstream>
#include <tf2_eigen/tf2_eigen.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
namespace pilz_industrial_motion_planner
{
... | TOOL | 0.982531 | 6.948833 |
553b828b-b8ed-4070-96db-4d8b60ea3c0d | ahr9n/psolving-paradigms | 4.dynamic-programming/21.non-classical/CodeForces 1132F - Clear the String.cpp | #include "bits/stdc++.h"
#pragma GCC optimize("Ofast")
#pragma GCC optimize("-O2")
using namespace std;
using ll = long long;
using ld = long double;
const int N = 3E5 + 5, M = 1E6 + 10, MOD = 1E9 + 7, OO = 0x3f3f3f3f;
int n;
string s;
int memo[501][501];
// nested ranges style
int dp(int l, int r) {
if (l ==... | ALGO | 0.999962 | 5.947855 |
3b18be59-2ef5-424c-83cd-1d2acf548d35 | HeZephyr/Awesome-Algorithm-Resources | ICPC/13th四川 ACM-ICPC/M.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, k, x, s[N], p[N], t[N];
int res[N];
double max = 0;
int main(){
scanf("%d%d%d", &n, &k, &x, &p[0]);
for(int i = 1; i <= n; ++ i){
scanf("%d", &s[i]);
}
for(int i = 1; i <= k; ++ i){
scanf("%d", &t[i]);
}
... | ALGO | 0.999488 | 3.253843 |
4a715de9-f683-4eca-b00a-0ea109d8d252 | pastjung/Algorithm | 프로그래머스/2/42747. H-Index/H-Index.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> citations) {
int answer = 0;
sort(citations.begin(), citations.end(), greater<>()); // 내림차순 정렬
for(int i = 0; i < citations.size(); i++){
if(citations[i] >= i + 1){
answer ... | ALGO | 0.999929 | 6.180346 |
2ef494d3-b784-41a4-9455-781465ecb34f | electech6/ORB_SLAM3_detailed_comments | Thirdparty/g2o/g2o/core/estimate_propagator.cpp | #include "estimate_propagator.h"
#include <queue>
#include <vector>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <fstream>
//#define DEBUG_ESTIMATE_PROPAGATOR
using namespace std;
namespace g2o {
# ifdef DEBUG_ESTIMATE_PROPAGATOR
struct FrontierLevelCmp {
bool operator()(EstimatePropa... | ALGO | 0.999896 | 5.578137 |
b8391db7-d8b1-4eb0-ab50-328c1227cbd4 | zjsxzy/Leetcode | Rotate List/main.cpp | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <vector>
#include <cstdio>
#include <string>
#include <climits>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define PB pu... | ALGO | 0.999935 | 4.870921 |
325f1059-d9d3-4b0c-b094-ff95a9a49eef | qnfm/leetcode | 1637. Widest Vertical Area Between Two Points Containing No Points.cpp | #include <vector>
#include <algorithm>
using namespace std;
class Solution
{
public:
int maxWidthOfVerticalArea(vector<vector<int>> &points)
{
sort(points.begin(), points.end(), [&](const auto &a, const auto &b)
{ return a[0] < b[0]; });
int r = 0;
for (int i = 1; i < points... | ALGO | 0.999964 | 5.405636 |
ce2e4010-6718-4ced-8cd3-04741eb6f8cf | kash1sh/practice_ques_cp | A_Consecutive_Sum_Riddle.cpp |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vll vector<ll>
#define vpll vector<pair<ll, ll>>
#define fo(i, k, n) for (ll i = k; i < n; i++)
#define fo1(i, k, n) for (ll i = k; i <= n; i++)
#define rr return
#define Endl endl
#define ff first
#define ss second
// #define all(X) (X).begin(... | ALGO | 0.999806 | 3.958885 |
09320df4-20fa-488e-b592-e348b4ca5d15 | Deepak-png981/Data_Structures_And_Algorithms | Pattern 6 - GFG/pattern-6.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
void printTriangle(int n) {
for(int i = n; i>=1; i--){
for(int j = 1; j<=i; j++)
cout<<j<<" ";
cout<<endl;
}
}
};
//{ Driver Code Starts.
int main() {
... | ALGO | 0.999811 | 6.191059 |
04ced7e3-4245-4b6a-9bbc-bde9bf825581 | Tkr-Karan/Hacktober-Fest-2022 | second.cpp | #here I write thee code for basic code where we print the total no. sum from 1 to n.
// brute force approach TC: O(N) SC: O(1)
#include<iostream.h>
using namespace std;
int main(){
int n;
cin >> n;
int sum = 0;
for(int i = 1; i <= n; i++) {
sum += i;
}
cout << sum << endl;
return 0;
}
// o... | ALGO | 0.998659 | 4.174434 |
266f46f3-5288-46a0-8d80-1f791beb70f9 | VikramgTuring/rlhf | task_391499_ModelA_Turn1/main.cpp | #include <iostream>
#include <memory>
#include <chrono>
// The Strategy interface
class MovementStrategy {
public:
virtual void move() = 0; // Perform the movement action
virtual ~MovementStrategy() = default;
};
// Concrete strategies
class WalkStrategy : public MovementStrategy {
public:
void move() ove... | TOOL | 0.889387 | 7.895703 |
d54052ea-5718-4bb2-875c-43f1474b07bd | Khaleeq01/Leetcode-problems-solutions | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence2-div-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idi... | class Solution {
public:
string replaceWords(vector<string>& dictionary, string sentence) {
unordered_set<string> st(dictionary.begin(), dictionary.end());
string ans = "";
int i = 0;
while (i < sentence.length()) {
string word = "";
bool skip = false;
... | ALGO | 0.999919 | 6.082284 |
17971397-ccfe-485a-9cf1-fc5d519001af | Sanjeev-tech1/N_Queen | prim1.cpp | #include<iostream>
#include<stdlib.h>
#include<conio.h>
#define INFINITY 999
using namespace std;
int main()
{
int a,b,u,v,n,i,j,ne=1;
int visited[10]={10},cost[10][10];
int min,mincost=0;
cout<<"\n prime algo Implementation \n";
cout<<"\n Enter the number of nodes:";
cin>>n;
cout<<"\n E... | ALGO | 0.999936 | 3.300053 |
58801b1d-a33c-4f43-8a24-c30ced5eb5e5 | ospinalucas15/practica-1 | ejercicio4.cpp | #include <iostream>
using namespace std;
int ejercicio4(){
int n1 = 0;
int n2 = 0;
int ultdig1 = 0;
int ultdig2 = 0;
int ultdig3 = 0;
int primdig1 = 0;
int primdig2 = 0;
int primdig3 = 0;
cout << "Ingrese la hora del dia: ";
cin >> n1;
cout << "Ingrese la duracion: ";
... | ALGO | 0.997412 | 3.451662 |
99899538-7cb6-4811-a93d-d27b7648fc7e | alreadySagor/XPSC-Batch-4 | Week_2/Day_1/B_Minor_Change.cpp | /**
* author: SAGOR AHMED
* created: M A R C H , 2024
**/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
string s, t;
cin >> s >> t;
int cnt = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i]!=t[i]) {
cnt+... | ALGO | 0.999976 | 5.330095 |
035d4cf3-43d2-4e29-80e0-60ce4936256f | Charlescai123/PhyDRL-Locomotion-Rewrite | third_party/eigen3/include/unsupported/doc/examples/MatrixExponential.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(3,3);
A << 0, -pi/4, 0,
pi/4, 0, 0,
0, 0, 0;
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix exponential ... | ALGO | 0.999843 | 3.730493 |
c75bdccc-0baa-4a7f-908e-f097508ae028 | madhabkafle/LeetCode | 0078-subsets/0078-subsets.cpp | class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
vector<int> v;
vector<vector<int>> ans;
int n=nums.size();
helper(0,v,ans,nums) ;
return ans;
}
void helper(int i,vector<int> &v,vector<vector<int>> &ans,vector<int> &nums){
if(i==nums.size()){
... | ALGO | 0.999883 | 6.104532 |
e732c911-5d4a-43f5-b77b-73712333e70c | vikke1234/bird-optimization | game.cpp | #include "game.h"
#include "precomp.h"
#include <cstdint>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <new>
#include <xmmintrin.h>
#define LINES 750
#define LINEFILE "lines750.dat"
#define ITERATIONS 16
int lx1[LINES], ly1[LINES], lx2[LINES], ly2[LINES]; // lines: start and e... | ALGO | 0.997945 | 5.106969 |
ad038b3b-a477-45ff-a6ce-83ff6683e305 | archermind/MTK_X20_BASE_AOSP | ndk/sources/cxx-stl/llvm-libc++/libcxx/test/containers/sequences/vector.bool/emplace_back.pass.cpp | // <vector>
// vector.bool
// template <class... Args> void emplace_back(Args&&... args);
#include <vector>
#include <cassert>
#include "min_allocator.h"
int main()
{
#if _LIBCPP_STD_VER > 11
{
typedef std::vector<bool> C;
C c;
c.emplace_back();
assert(c.size() == 1);
ass... | TEST | 0.955317 | 4.28819 |
c4ec1642-84e4-4854-9472-b80579ab7a2e | ShivaBansfore-JGEC/CompetitiveProgrammingQuestions | Bitmasking/uniquII.cpp | #include<bits/stdc++.h>
using namespace std;
void solve(int arr[],int n){
int res=arr[0];
for(int i=1;i<n;i++) res=res^arr[i];
int temp=res;
int i=0;
while(temp>0){
if(temp&1){
break;
}
i++;
temp=temp>>1;
}
int mask=1<<i;
int first_no=0;
... | ALGO | 0.999987 | 3.439694 |
4734ae82-0f39-4c0a-9fcf-a8aa48c8dd7a | bluebear4/leetcode | 2022/2022.08/2022.08.14/D.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
class Solution {
enum Relation {
LESS,
EQUAL,
MORE,
};
int factorial(int n) {
int fc = 1;
for (int i = 1; i <= n; ++i) fc *= i;
... | ALGO | 0.9995 | 5.961856 |
36912e92-56bf-4e8c-aa75-2e5b1b78b477 | Deeps-01/Programming | DSA/Algorithms/array_rotation.cpp | #include <bits/stdc++.h>
using namespace std;
// the time complexity of this is O(n)
void rotate(int **arr, int d, int n)
{
int *arr_new = new int[n];
for (int i = 0; i < n; i++)
arr_new[i] = *(*arr + (i+d) % n);
*arr = arr_new;
}
void printArray(int *arr, int n)
{
for (int i = 0; i < n; i++)... | ALGO | 0.999561 | 5.789234 |
ef08851e-cf99-4b60-9513-277cc501aa01 | LeoChenL/Miscellaneous | edu/Dynamic Programming/Longest Common Substring/Longest Alternating Subsequence/Basic Solution.cpp | /*
Problem Statement #
Given a number sequence, find the length of its Longest Alternating Subsequence
(LAS). A subsequence is considered alternating if its elements are in
alternating order.
A three element sequence (a1, a2, a3) will be an alternating sequence if its
elements hold one of the following conditions:
{a... | ALGO | 0.999686 | 6.103676 |
5d67a3ef-cc36-4a3b-895b-59fcecaf4c07 | adityak54/cp | before-aug-24/B_Integers_Shop.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pi pair<int,int>
#define all(n) n.begin(), n.end()
#define rall(n) n.begin(), n.end(), greater<int>()
#define fr(i,a,b,c) for(int i=a;i<b;i+=c)
#define rfr(i,a,b,c) for(int i=a;i>=b;i-=c)
#define pb push_back
// Input Functions
template<t... | ALGO | 0.999808 | 5.156425 |
26801954-df21-4f02-9c20-3ab9403cbf12 | Mayanklakhina/Leetcode-Practice-Problems | 1302-deepest-leaves-sum/1302-deepest-leaves-sum.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.999898 | 6.454618 |
9a44e033-5829-45ca-82e5-7dda9d41fc0d | Charul2304/Leetcode_DSA | 891-score-after-flipping-matrix/score-after-flipping-matrix.cpp | class Solution {
public:
int matrixScore(vector<vector<int>>& grid) {
int n = grid.size();
int m = grid[0].size();
// If first is 0, swap the string
for(int i = 0; i < n; ++i)
if(grid[i][0] == 0)
for(int j = 0; j < m; ++j)
grid[i][j] =... | ALGO | 0.999979 | 6.779314 |
88bb9bf5-7916-43eb-bd68-b4d81e25a895 | JungDaeHan/Algorithm-Study | 2색칠하기(byDFS).cpp | /*
2 ĥϱ, ϸ鼭 ĥ ִ ̴.
2 Ѵ. ٸ.
־ , 2 ĥϱⰡ ϴ α ۼϽÿ.
Է
ù° ٿ N M ־.
( 1 N 10,000, 1 M 100,000 ) ° ٺ ־.
a, b ̷ , ̴ a b Ǿ ִٴ ǹ̴.(0 a, b N-1)
־ Ͽ 2 ĥϱ⸦ YES, NO Ѵ.
*/
#include <cstdio>
#include <vector>
using namespace std;
vector<int> Graph[10010];
int color[10010]={0,}... | ALGO | 0.999991 | 4.38933 |
951f917c-9db7-40de-b754-0ac11394a081 | swkajnBruceee/LuoGu | 循环结构/洛谷__打分/洛谷__打分/源.cpp | #define _CRT_SECURE_NO_WARNINGS 1
using namespace std;
#include<iostream>
#include<algorithm>
int main()
{
int n,i,sum=0;
double score;
cin >> n;
int arr[10001];
for (i = 1;i <= n;i++)
{
scanf("%d", &arr[i]);
}
sort(arr +1, arr + n +1);
for (i = 2;i < n;i++)
{
sum += arr[i];
}
score = (double)sum / (n -... | ALGO | 0.999463 | 3.42086 |
a54198a6-93d9-45f7-a804-1e3e14fc4c74 | HONGJICAI/LeetCode | cpp/219.cpp | // hash-33ms.cpp
class Solution {
public:
bool containsNearbyDuplicate(vector<int> &nums, int k) {
unordered_map<int, int> map;
int len = nums.size();
for (int i = 0; i < len; ++i)
if (map.find(nums[i]) != map.end()) {
if (abs(i - map[nums[i]]) <= k)
return 1;
map[nums[i]] ... | ALGO | 0.999644 | 5.936452 |
cda5e2a6-fb80-4413-b63e-254207bf96fe | Khagendra01/CppAlgorithmChallenges | Knapsack.cpp | #include <bits/stdc++.h>
using namespace std;
struct Item
{
int profit, weight;
Item(int profit, int weight)
{
this->profit = profit;
this->weight = weight;
}
};
static bool cmp(struct Item a, struct Item b)
{
double r1 = (double)a.profit / (double)a.weight;
double r2 = (double... | ALGO | 0.999866 | 4.678081 |
71edce1f-6217-4477-b799-8b55259d3824 | levisre/simple_string_toolkit | Cryptopp/aria_simd.cpp | // aria_simd.cpp - written and placed in the public domain by
// Jeffrey Walton, Uri Blumenthal and Marcel Raad.
//
// This source file uses intrinsics to gain access to ARMv7a and
// ARMv8a NEON instructions. A separate source file is needed
// because additional CXXFLAGS are required to enabl... | ALGO | 0.999551 | 7.377539 |
76d49f0f-52c4-463c-8f19-fbb1acbf7e7e | dimekai/Algorithmic-Club | Intermedios/Matemáticas/GoldbachConjeture.cpp | #include <bits/stdc++.h>
#define MAX_COTA 1000000
using namespace std;
typedef vector<int> vi;
typedef vector<bool> vb;
vi primes;
void sievePrime(vb & isPrime){
//primes.clear();
isPrime.resize(MAX_COTA+1,true);
int cota = sqrt(MAX_COTA)+1;
isPrime[0] = false;
isPrime[1] = false;
//primes.push_back(2);
for(... | ALGO | 0.999952 | 4.016528 |
6f6e51fe-ffad-4574-a9ba-b34da20478c8 | ishandutta2007/codeforces | krijgertje/normal/1705/E.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <cstring>
#include <list>
#include <cassert>
#include <climits>
#inclu... | ALGO | 0.999958 | 4.141555 |
0331c542-e7a1-4b6d-b3ab-985bad40e97d | Sparksidy/3DGameEngine | 3DGameEngine/Libraries/Include/glm/test/gtc/gtc_bitfield.cpp | #include <glm/gtc/bitfield.hpp>
#include <glm/gtc/type_precision.hpp>
#include <glm/vector_relational.hpp>
#include <glm/integer.hpp>
#include <ctime>
#include <cstdio>
#include <vector>
namespace mask
{
template <typename genType>
struct type
{
genType Value;
genType Return;
};
inline int mask_zero(int Bi... | TEST | 0.896301 | 3.026472 |
564ebd98-91fd-4853-9189-3a276ab58644 | srilakshmisruthi/MissionRnD-C-Strings-Worksheet | src/commonWords.cpp | /*
OVERVIEW: Given two strings, find the words that are common to both the strings.
E.g.: Input: "one two three", "two three five". Output: "two", "three".
INPUTS: Two strings.
OUTPUT: common words in two given strings, return 2D array of strings.
ERROR CASES: Return NULL for invalid inputs.
NOTES: If there are no... | ALGO | 0.937499 | 4.388936 |
78ddf70b-9c49-4c35-8915-7425d99c6802 | NARESHroyaLNt/CSA0488-OS | OS LAB Q4O.cpp | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define MAX_PAGES 100
int findLRU(int timeStamp[], int num_frames)
{
int i, minimum = timeStamp[0], pos = 0;
for (i = 1; i < num_frames; ++i)
{
if (timeStamp[i] < minimum)
{
minimum = timeStamp[i];
pos = i;
... | ALGO | 0.999901 | 5.602399 |
609a9418-a6b7-475d-be7a-62188489e0c2 | Rahul-skush/leetcode-solutions | 1691-maximum-height-by-stacking-cuboids/1691-maximum-height-by-stacking-cuboids.cpp | class Solution {
public:
int maxHeight(vector<vector<int>>& cuboids) {
for(auto &x : cuboids)
sort(x.begin(), x.end());
sort(cuboids.rbegin(), cuboids.rend());
int n = cuboids.size();
vector<int> LIS(n+1, 0);
int ans = 0;
for(int... | ALGO | 0.999811 | 5.870908 |
61ac05b1-a914-4a4f-97da-09ac8959e596 | talhaalipk/Data-Structures-and-Algorithms-in-C- | 2. Recursion/0. Vs Code/Day 3/3_Recursion_LinearSearch.cpp | #include <iostream>
using namespace std;
int linearSearch(int arr[],int size,int key)
{
if(size==0)
{
return -1;
}
if(arr[size-1] == key)
{
return size-1;
}
else{
return linearSearch(arr,size-1,key);
}
}
int main()
{
const int size = 5;
int key = 2 ;
... | ALGO | 0.999899 | 5.200902 |
9d33e8f1-ed64-4fcb-b7a7-57ec8f7312c5 | 2JeanRojas2/C- | SumaYProductoV2/Source.cpp | #include<iostream>
using namespace std;
int main() {
int num1, num2, num3, num4, suma, producto;
cout << "Ingrese el primer numero: ";
cin >> num1;
cout << "Ingrese el segundo numero: ";
cin >> num2;
cout << "Ingrese el tercer numero: ";
cin >> num3;
cout << "Ingrese el cuarto numero: ";
cin >> num4;
suma ... | ALGO | 0.994321 | 3.471469 |
d0bdbcb9-d26c-40fe-873c-6b5e4909c984 | EazyReal/CompetitveProgramming | atcoder-educational-dp/pW-hank.cpp | //https://atcoder.jp/contests/dp/submissions/3951000
//from hank55663
//well written segment_tree, logic is same as pW2
//better style for compression
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<bits/extc++.h>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int... | ALGO | 0.999875 | 4.283096 |
1870eb59-143d-47de-abee-f2f9ad493cde | razibhasan7/Codechef-beginner-solution | C++/beginner/Greedy puppy.cpp | /***************************
Programmer: Aanisha Mishra
For all values of k, find the maximum (no.of coins)%k value.
***************************/
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n,k,maxm=0,i=1;
cin>>n>>k;
while(i<=k)
... | ALGO | 0.999927 | 4.018688 |
fed4b6ae-46ce-4b5f-b9e5-7c80d4c70674 | noah-ftnx/rpl | sde/17/09_.cpp | #include <vector>
using namespace std;
#define PREORDER 1
#define INORDER 0
#define POSTORDER 2
void traverseTree(BinaryTreeNode<int> *node,
vector<vector<int>> &traversals) {
if (node==nullptr) return;
traversals[PREORDER].push_back(node->data);
traverseTree(node->left, traversals); // GO L... | ALGO | 0.999967 | 6.00552 |
b6e494c8-d2ef-48e6-95bc-86e117d07e78 | raincross7/code-similarity | codes/train_code/problem303/problem303_271.cpp | #include <iostream>
#include <string>
int main()
{
std::string s, t;
std::cin >> s >> t;
int count = 0;
for (int i = 0; i < (int)s.size(); i++)
{
if (s[i] != t[i])
{
count++;
}
}
std::cout << count << std::endl;
return 0;
} | ALGO | 0.999893 | 4.374146 |
3002758f-7beb-4771-8ea8-6bdad67cecd3 | hoangpc0112/cpp-ptit | CPP0138.cpp | #include <bits/stdc++.h>
#define MOD 1000000007
#define MAX 10000001
#define ll long long
using namespace std;
int nt[10000005];
void sang() {
for (int i = 2; i < MAX; i++) {
nt[i] = 1;
}
for (int i = 2; i <= sqrt(MAX); i++) {
if (nt[i]) {
for (int j = i * i; j < MAX; j += i) ... | ALGO | 0.999715 | 4.430669 |
381aebc2-edbc-4236-b70e-97e505643748 | VipulChauhan89/CodeChef-Practice-Problems | Beginner/Shoe Fit-SHOEFIT/fit.cpp | /*
You have three shoes of the same size lying around. Each shoe is either a left shoe (represented using 0) or a right shoe (represented using 1).
Given A, B, C, representing the information for each shoe.
Program to find out whether you can go out now, wearing one left shoe and one right shoe.
*/
#include <ios... | ALGO | 0.99995 | 4.257621 |
ff25c301-1082-4d31-9f90-63f9070c01a7 | parrot15/flyby-robotics-project | lidar_client/src/utils.cpp | #include "utils.h"
Config read_config_file(const std::string& config_path) {
// Read config file.
std::ifstream config_file(config_path);
if (!config_file.is_open()) {
std::stringstream ss;
ss << "Could not open the config file: " << config_path << "\n";
throw new std::runtime_error(ss.str());
}
... | CONFIG | 0.890232 | 6.197738 |
f443a5ff-a452-4d09-be70-53f5f3c401f9 | ishandutta2007/codeforces | cinnamoroll/normal/1167/D.cpp | // warm heart, wagging tail,and a smile just for you!
//
//
//
//
// ... | ALGO | 0.999923 | 3.913716 |
62e1a7bc-f325-4a51-9abe-8c15bd57abb7 | ChiragRohada7020/DSA | C++/CodeChef/Chef_and_Bored_Games.cpp | #include <bits/stdc++.h>
using namespace std;
int OddSquares(int N, int n)
{
return ((N - n + 1) * (N - n + 1));
}
int main()
{
int N, n, sum = 0, t;
cin >> t;
while (t--)
{
cin >> N;
n = 1;
sum = 0;
while (n <= N)
{
sum = sum + OddSquares(N,... | ALGO | 0.999875 | 5.211339 |
7d6d5975-383a-42f1-a75e-9a2ec0293b76 | qazwsxedcrfvtg14/ACM_OAO | qazwsxedcrfvtg14/CF_363/JE_pB.cpp | //#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<string>
#include<queue>
#include<map>
#define f first
#define s second
using namespace std;
typedef pair<double,double>par;
int ar[200005];
int in[200005];
int main(){
int n;
scanf("%d",&n);
int rot=-1;
for(int i=0;... | ALGO | 0.999997 | 3.314359 |
699de749-7b58-4a72-b125-4f5a4b2ccc91 | iains/LLVM-7-branch | libcxx/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp | // <vector>
// vector<bool>
// iterator insert(const_iterator position, size_type n, const value_type& x);
#include <vector>
#include <cassert>
#include <cstddef>
#include "min_allocator.h"
int main()
{
{
std::vector<bool> v(100);
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
... | TEST | 0.942977 | 4.773561 |
19d03ac4-41ea-4bf2-8e06-3462e8c7d8b8 | GeekyMayank19/DSA | Data Structure/linkedList/merging.cpp | #include<bits/stdc++.h>
using namespace std;
class node {
public:
int data;
node *next;
};
//creating link list from array
node* create(int A[],int n){
int i;
node *t,*last,*first;
first = new node;
first->data=A[0];
first->next=nullptr;
last = first;
for(i=1;i<n;i++){
t=new nod... | ALGO | 0.993741 | 3.513835 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.