uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f3038d3e-6eb4-43ba-8b08-b420642c258f | prathmesh0125/180-Days-Of-DSA | interview problem/palidrome string.cpp | #include<iostream>
using namespace std;
int Ispalindrome(string s ,int start,int end){
if(start>=end)
return 1;
if(s[start]!=s[end]){
return 0;
}
return Ispalindrome(s,start+1,end-1);
}
int main()
{
string a="top";
int start=0;
int end=a.size()-1;
cout<<Ispalindrome(a,start,end);
} | ALGO | 0.999947 | 3.906819 |
d46809c9-235f-4161-9711-f13695cd66a9 | Aikenfell/MCTC-C-A3 | Q7.cpp | #include <iostream>
#include <cmath>
using namespace std;
int getweight() {
int PW;
cout << "Enter package weight(oz): ";
cin >> PW;
return PW;
}
float deliveryCharge(int PW) {
if (PW > 16) {
PW = PW - 16;
float bonus = ((PW) / 4) * 0.50;
float final = 3 + bonus;
retu... | TOOL | 0.989634 | 4.921297 |
031b134b-5640-4e39-9340-8818baf7263e | KrishDave1/DSA-course | Graphs/Pseudo_Critical_and_critical.cpp | #include <bits/stdc++.h>
using namespace std;
class UnionFind {
public:
UnionFind(int n) {
rank = vector<int>(n, 1);
f.resize(n);
for (int i = 0; i < n; ++i) f[i] = i;
}
int Find(int x) {
if (x == f[x]) return x;
else return f[x] = Find(f[x]);
}
voi... | ALGO | 0.99995 | 4.77325 |
9b67fc82-24a9-4d8c-be1b-878d7b40f154 | TEAM-Gummy/android_frameworks_base | tests/Camera2Tests/SmartCamera/SimpleCamera/jni/stats_scorer.cpp | // Stats (mean and stdev) scoring in the native.
#include "stats_scorer.h"
#include <jni.h>
#include <math.h>
void Java_androidx_media_filterpacks_numeric_StatsFilter_score(
JNIEnv* env, jobject thiz, jobject imageBuffer, jfloatArray statsArray)
{
unsigned char* pImg = static_cast<unsigned char*>(env->GetDir... | ALGO | 0.92085 | 7.096336 |
7288b311-bc86-437e-9bb9-4246e73d52da | Cirromulus/ElektronischeBenisVerlaengerung | Ueb1/dices.cpp | // Implement a solution to localize and identify the objects in the image
// from the set of possible objects (plate, fork, knife, spoon). The position
// where to add code is marked by "TODO".
// Consider
// http://docs.opencv.org/3.1.0/d3/dc0/group__imgproc__shape.html
#include "opencv2/imgproc/imgproc.hpp"
#include... | TOOL | 0.889732 | 4.475348 |
8c8736b4-1758-4a4c-ad9c-29ec27a7aeb7 | wenkaier/EfficientGS | submodules/diff-gaussian-rasterization/third_party/glm/test/gtx/gtx_pca.cpp | #define GLM_ENABLE_EXPERIMENTAL
#include <glm/glm.hpp>
#include <glm/gtx/pca.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/gtx/string_cast.hpp>
#include <cstdio>
#include <vector>
#if GLM_HAS_CXX11_STL == 1
#include <random>
#endif
template<typename T>
T myEpsilon();
template<>
GLM_INLINE GLM_CONSTEXPR float myEp... | TEST | 0.969057 | 6.786098 |
6067b1f1-7e5e-4717-81f0-350b25317215 | catsudon/TOI-prep | passed/cc133.cpp | #include<bits/stdc++.h>
#define f first
#define s second
using namespace std;
using pii = pair<int,int>;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int q; cin >> q;
while(q--)
{
int mn = INT_MAX;
int n,k; cin >> n >> k; // must be >= k
vector<pii> v;
for(int... | ALGO | 0.999686 | 3.978184 |
65dddea5-29c4-4cb6-adeb-98dd011ef770 | jfantab/algsReview | sorting/insertionSort.cpp | #include <iostream>
#include <cmath>
#include <climits>
int* insertionSort(int[], int);
int main() {
const int SIZE = 7;
int a[SIZE] = {6, 2, 3, 8, 9, 10, 1};
insertionSort(a, SIZE);
for(int i = 0; i < SIZE; i++)
std::cout << a[i] << " ";
std::cout << std::endl;
return 0;
}
int* in... | ALGO | 0.999928 | 4.778936 |
af6fd250-aeda-4ac3-a7de-0e607724dc6d | Elavarasan-N/Flutter_bloc | bloc_crud/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.998956 | 6.76073 |
41cb8325-c4a6-4463-ae69-06a50493a0a3 | ra2003/Plagiarism | dataset/test/modification/1519_code_insertion/25/transformation_1.cpp |
#include<bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
#define ll long long
#define ull unsigned long long
#define lld long double
#define fo(i,s,n) for(ll i=s;i<=n;i++)
#define fr(i,n,s) for(ll i=n;i>=s;i--)
#... | ALGO | 0.999894 | 3.794995 |
b1cb5200-8020-4ea9-88fa-05c5cad2bf44 | shehzad78675/C-DSA-Code | Loops/PrintAllPrime.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main(){
int n;
cin>>n;
for(int j=2; j<=n; j++){
bool check = true;
for(int i=2; i<=sqrt(j); i++){
if(j%i==0){
check = false;
break;
}
}
if(check){
cout<<j<<" ";
}
}
}
| ALGO | 0.999838 | 4.531106 |
43821777-f8d4-45a7-8be5-1718352f7a58 | gwangholee507/algorithm | cpp/gold/5/13549.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <stack>
using namespace std;
int N, K;
bool visited[100001] = { false };
int dfs(int n, int k) {
queue<pair<int, int>> q;
q.push({ n, 0 });
... | ALGO | 0.999878 | 4.702628 |
b504392c-886c-4dd3-b46d-c1027a05151c | magasteph/Atividades-ADS | 2-SEM-C++/ex8.cpp | #include <stdio.h>
void exibirTabuleiro(char tabuleiro[3][3]) {
printf("\n 1 2 3\n");
for (int i = 0; i < 3; i++) {
printf("%d ", i + 1);
for (int j = 0; j < 3; j++) {
printf("%c ", tabuleiro[i][j]);
}
printf("\n");
}
printf("\n");
}
int main() {
ch... | ALGO | 0.990312 | 5.908461 |
b20e834c-5f77-4668-aa22-734173dcf8ad | iamsiamhossen/XPSC-SOLVE | Week 2/Day-1/E_Plus_or_Minus.cpp | /**
* Author: iamsiamhossen
* Created: 22-03-2024 23:21:56
**/
#include <bits/stdc++.h>
#define fastread() (ios_base::sync_with_stdio(0), cin.tie(0))
#define endl "\n"
#define ll long long int
#define ld long double
#define pi pair<ll, ll>
using namespace std;
int main()
{
fastread();
int t;
cin >> t;
... | ALGO | 0.999922 | 5.781208 |
6bce0774-31a1-41cd-84dd-a9d3c6334f54 | praymeta/Code-Up-Algorithm | BOJ_10773_Zero.cpp | #include <iostream>
#include <stack>
using namespace std;
int main(void) {
stack<int> accountBook;
int K, num, book_size, sum = 0;
cin >> K;
for(int i = 0; i < K; i++) {
cin >> num;
if(num == 0)
accountBook.pop();
else
accountBook.push(num);
}
boo... | ALGO | 0.99964 | 4.337013 |
81cded8d-64a2-4754-82e5-df5cd515843e | simmran2003/ml_major | New_Db/191440628.cpp | #include <bits/stdc++.h>
#define int ll
#define ff first
#define ss second
#define zort sort
#define endl '\n'
#define pb push_back
#define IMAX INT64_MAX
#define N 200005
#define MOD 1000000007
#define MOD2 998244353
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define cno cout<<"NO"<<endl
#def... | ALGO | 0.999979 | 3.578851 |
6505f6bb-2f1e-4df7-bc44-f71ac14ca48a | 1SergiuF/12th-grade-computer-science | Excelenta/Parcurgeri/Bfs_set_distante_minime.cpp | #include <fstream>
#include <vector>
#include <queue>
#include <set>
using namespace std;
ifstream fin("graf4.in");
ofstream fout("graf4.out");
typedef vector<int> VI;
typedef vector<bool> VB;
typedef set<int> SI;
typedef vector<SI> VSI;
int n;
VSI G;
VB v;
VI d;
void CitesteGraf();
void Bfs(int x);
int main()
{
... | ALGO | 0.999308 | 4.35754 |
9ba700c1-9619-40b6-8c1a-b75d66a3830a | priyam314/CSES-problem-set | searching_and_sorting/maximumSubarraySum.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll n,maxSum=INT_MIN,currSum=INT_MIN;
cin>>n;
ll list[n];
for (ll i=0;i<n;i++){
cin>>list[i];
}
for (ll i=0;i<n;i++){
if (currSum>=0)
currSum += list[i];
else
currSum = list[i];
maxSum = max(currSum,max... | ALGO | 0.99997 | 4.104638 |
654725a6-9886-44a1-8c7d-4a97498aaf19 | harrysince1999/DSA | 0108-convert-sorted-array-to-binary-search-tree/0108-convert-sorted-array-to-binary-search-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.999997 | 6.56963 |
e40c682e-43bd-4f81-8534-c3eb2f2fe113 | anj7429/DSA | bfs.cpp | #include<iostream>
#include<queue>
#include<vector>
using namespace std;
class Graph{
int v;
vector<vector<int>>adj;
public:
Graph(int ver){
v=ver;
adj.resize(ver);
}
void add_edge(int u,int v){
adj[u].push_back(v);
adj[v].push_back(u);
}
void bfs(int src)... | ALGO | 0.999963 | 4.803328 |
f712229f-e0a8-4b4e-a91c-0a9095d25609 | Anuj0097/Competitive-Programming-C- | Subarray_permutations.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve()
{
ll n, k;
cin >> n >> k;
if (n > 1 && k == 1)
{
cout << -1 << endl;
return;
}
for (int i = 1; i < k; i++)
{
cout << i << ' ';
}
for (int i = n; i >= k; i--)
{
cout << ... | ALGO | 0.999965 | 4.667423 |
568e9fbd-a579-4910-95dc-c5126e9f570f | keynoid/school.tests | Rubbish/ege25/ege25/task7797.cpp | #include "25.1.h"
void task7797()
{
int const size = 5;
int array[size];
for (int i = 0; i < size; ++i)
{
cin >> array[i];
}
int amount = 0;
for (int i = 0; i < size - 1; ++i)
{
int sum = array[i] + array[i + 1];
int prod = array[i] * array[i + 1];
if (sum % 6 != 0 && prod < 1000)
{
++amount... | ALGO | 0.999801 | 4.680699 |
7b021585-9382-4f06-8019-6f59392f8cb5 | Nazrul7363/PW-Skills | PW PPT/Assignmnet_2/Assignment2_4.cpp | #include <iostream>
#include <vector>
using namespace std;
bool canPlaceFlowers(vector<int>& flowerbed, int n) {
int count = 0;
int size = flowerbed.size();
for (int i = 0; i < size; i++) {
if (flowerbed[i] == 0 &&
(i == 0 || flowerbed[i - 1] == 0) &&
(i == size - 1 || ... | ALGO | 0.999976 | 7.006868 |
1b843406-9f43-4ae9-a5f2-ec5005a89ad2 | Merica-Coin/merica-coin | src/pow.cpp | #include <pow.h>
#include <arith_uint256.h>
#include <chain.h>
#include <primitives/block.h>
#include <uint256.h>
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{
assert(pindexLast != nullptr);
unsigned int nProofOfWorkLimit = UintT... | ALGO | 0.998805 | 7.431722 |
f00ebe05-b00d-4717-a63d-be9119bb278c | tanaxiusi/Qt4.8.6-my-modified-version | src/gui/itemviews/qsortfilterproxymodel.cpp | #include "qsortfilterproxymodel.h"
#ifndef QT_NO_SORTFILTERPROXYMODEL
#include "qitemselectionmodel.h"
#include <qsize.h>
#include <qdebug.h>
#include <qdatetime.h>
#include <qpair.h>
#include <qstringlist.h>
#include <private/qabstractitemmodel_p.h>
#include <private/qabstractproxymodel_p.h>
QT_BEGIN_NAMESPACE
typ... | TOOL | 0.879984 | 7.500141 |
c48d7991-a14a-49e9-9cd5-5646e34a099d | gpoussel/copro-plus | codeforces/problems-07xx/0705/A.cpp | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numbers>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define nl '\n'
#define de... | ALGO | 0.999799 | 3.801557 |
eb645e22-7e62-4cc2-96e4-6e847804b861 | vishaljangid9413/dsa | 04. 2D Array/Binary Search 2d array/01. Search element in 2d Array.cpp | #include <iostream>
using namespace std;
// Problem: Search for a given element 'k' in a 2D sorted array.
// Approach: Treat the 2D array as a 1D array and apply binary search.
// To find the corresponding row and column indices from the mid index during the search.
// Time Complexity: O(log(row * col)), as we are per... | ALGO | 0.999919 | 6.282074 |
ff4f006d-defb-4034-bcab-e79bb9a93dcd | tic40/atcoder | abc/abc269/a/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define endl '\n'
int main() {
int a,b,c,d;
cin >> a >> b >> c >> d;
cout << (a+b) * (c-d) << endl;
cout << "Takahashi" << endl;
return 0;
} | ALGO | 0.999133 | 3.715962 |
81afd346-887e-4996-8b12-844c32fec6e5 | teichman/phd-code | ros-pkg/core/online_learning/src/program/filter_tracks.cpp | #include <online_learning/tbssl.h>
#include <boost/program_options.hpp>
#include <boost/foreach.hpp>
using namespace std;
using namespace Eigen;
namespace bpo = boost::program_options;
// A k-window is a sequential subset of size k.
// Returns a label where each prediction is the maximum prediction across all k-windo... | DATA | 0.975596 | 7.081063 |
3d58eb45-891c-4c46-9ecd-87f68e36dd7e | PrangerStefan/TempestSynthesis | src/storm-parsers/parser/DirectEncodingParser.cpp | #include "storm-parsers/parser/DirectEncodingParser.h"
#include <iostream>
#include <string>
#include <regex>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include "storm/adapters/RationalFunctionAdapter.h"
#include "storm/exceptions/AbortException.h"
#include "storm/exceptio... | TOOL | 0.965844 | 6.905803 |
7d64c5f1-835f-4e59-a545-dc74bf26c0ff | seifmohamed0/Leetcode-solutions | 1162-as-far-from-land-as-possible/1162-as-far-from-land-as-possible.cpp | class Solution {
public:
int xd[4] = {0 , 0 , 1 , -1};
int yd[4] = {1 , -1 , 0 , 0};
int n , m;
bool valid(int x , int y){
return x >= 0 && x < n && y >= 0 && y < m;
}
int maxDistance(vector<vector<int>>& grid) {
queue<array<int,2>>q;
n = grid.size();
m = grid[0].... | ALGO | 0.999927 | 5.832504 |
4693f0c9-c159-417d-a9ee-976ef05aa19a | RinatB2017/Arduino | Trash/sketchbook/libraries/SD/src/SD.cpp | /*
Implementation Notes
In order to handle multi-directory path traversal, functionality that
requires this ability is implemented as callback functions.
Individual methods call the `walkPath` function which performs the actual
directory traversal (swapping between two different directory/file handles
al... | TOOL | 0.968166 | 4.794852 |
c9fdf16c-5a3b-471c-8b2c-142d209b2e23 | yyyoonho/Algorithm | HackerRank/New_year_chaos.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
/*
* Complete the 'minimumBribes' function below.
*
* The function accepts INTEGER_ARRAY q as parameter.
*/
void minimumBribes(vector<int> q) {
int cnt=0;
int s... | ALGO | 0.99961 | 3.926911 |
5acc6dfa-2b32-4653-9ffb-a16b931d23f2 | Junwoo-Seo-1998/problem-solving-records | Codetree/250811/행복한 수열의 개수/number-of-happy-sequence.cpp | #include <iostream>
#include <vector>
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
int n;
int m;
std::cin >> n >> m;
std::vector<std::vector<int>> grid(n, std::vector<int>(n));
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < n; ++j)
{
... | ALGO | 0.999963 | 5.070322 |
15fb3d3b-3586-4591-bfa1-e23f8b649f77 | kyduke/Coding | CodeForces/CodeForces_651/Joysticks.cpp | // http://codeforces.com/contest/651/problem/A
#include <iostream>
using namespace std;
int solve(int a, int b) {
int big, small, t, ret;
ret = 0;
big = a;
small = b;
while (big > 0 && small > 0) {
if (big == 1 && small == 1) break;
ret++;
if (big < small) {
t = big;
big = small;
small = t;
}
... | ALGO | 0.99984 | 4.493861 |
d1e27081-a29c-4141-8ee1-2f9d8842d08b | LittleYang0531/CQ-CSP-S-2021 | CQ-00200/bracket/bracket.cpp | #include<bits/stdc++.h>
#define MOD 1000000007
#define N 505
using namespace std;
int n=1,ans,p,q;
int d[N][N];
int main(){
freopen("bracket.in","r",stdin);
freopen("bracket.out","w",stdout);
cout<<546949722;
}
/*
7 3
(*??*??
*/
| ALGO | 0.999921 | 3.421992 |
c80a8286-e314-47b0-8d7a-18cc51e2846f | ishandutta2007/codeforces | archuser84/normal/630/C.cpp | #include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <algorithm>
#include <vector>
#define Loop int loop = 0; loop < t; ++loop
#define LoopN int i = 0; i < n; ++i
#define LoopM int j = 0; j < m; ++j
#define ll long long
#define Mod1 1000000007
#define Mod2 998244353
using namespace std;
int ... | ALGO | 0.999962 | 5.029542 |
9f03adea-cf35-4bf2-8bb0-495b024845f3 | DKIT-STUDIO/giper_tasks_cpp | 76/main.cpp | #include <iostream>
#include <stdexcept>
#include <cmath>
// Базовый абстрактный класс Shape
class Shape {
public:
virtual ~Shape() = default;
// Метод вычисления пересечения фигур
virtual void getIntersection(const Shape& other) const {
throw std::runtime_error("Ошибка! Некорректные параметры... | ALGO | 0.998002 | 6.519471 |
4bc4c2bf-4b49-43fa-954c-c1f21e6e131f | Romelai28/competitive-programming | notebook/data_structures/segment_tree_lazy.cpp | // Segment tree para range update y point query
struct SegmentTreeLazy{
int n;
vl A, B;
ll elemNeutro;
SegmentTreeLazy(int N, vl &a, ll neutro) : n(N), A(a), elemNeutro(neutro){
B.resize(4*n, elemNeutro);
build(1, 0, n-1);
}
void build(int v, int tl, int tr){ // Vertice actual... | ALGO | 0.999258 | 5.560911 |
331818d0-5646-496c-a875-764945aa2258 | akiiishiii/oi_exercises | code/3159.cpp | // 3159.cpp
#include <iomanip>
#include <iostream>
#include <algorithm>
double const eps = 1e-8;
int const Maxn = 1005;
int a[Maxn], b[Maxn];
int n, k;
double chk(double lambda);
int main(int argc, char const *argv[]) {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
while (std::cin >> n >> k ... | ALGO | 0.999924 | 3.405563 |
25e9421f-964d-4a2d-98ac-eae475ca1768 | yunfuliu/initial-code | OpenCV_test/HPSNR.cpp | #include "BTC.h"
double BTC::HPSNR(const cv::Mat &src,cv::Mat &dst){
//ŪJve
//=============================================
int m=src.rows, n=src.cols;
//ʺAOtmһݪŶ
//=============================================
int **image_in;
image_in = new int*[m]; //xsJvǶ
for(int i=0;i<m;i++)
image_in... | ALGO | 0.965719 | 4.254898 |
e0257c82-d45a-4f3d-855e-cf649f384b3e | adithya-3141/Programs | 1603-design-parking-system/1603-design-parking-system.cpp | class ParkingSystem {
public:
int big;
int medium;
int small;
ParkingSystem(int big, int medium, int small) {
this->big = big;
this->medium = medium;
this->small = small;
}
bool addCar(int carType) {
if (carType == 1 && big != 0){
bi... | ALGO | 0.969218 | 5.858253 |
fb24545d-5f7b-436f-ad14-7a5d992b9a3c | ishandutta2007/codeforces | jacob/normal/158/A.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
int n, k;
cin >> n >> k;
vector<int> sc(n);
for (int i = 0; i < n; i++)
cin >> sc[i];
nth_element(sc.begin(), sc.begin() + n - k, sc.end());
int u = max(1, sc[n-k]);
int res = 0;
for... | ALGO | 0.999787 | 3.921901 |
c5622478-f361-4650-81d9-d71456ac5d31 | ishandutta2007/codeforces | lawrenceli/normal/552/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MAXN = 2005;
int n, x[MAXN], y[MAXN];
ll ans;
bool cmp(pii p1, pii p2) {
return p1.first*p2.second < p2.first*p1.second;
}
int main() {
if (fopen("input.txt", "r")) freopen("input.txt", "r", stdin);
... | ALGO | 0.999862 | 4.033385 |
2e8d2fe3-92f7-47fb-801d-1b18ac7ac2d7 | Liu-Steve/leetcode-sign-in | 20241011-3164.cpp | #include "bits/stdc++.h"
#define io \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : ... | ALGO | 0.999939 | 4.376251 |
29df4ff4-5811-455f-bcb2-ff47583ffa57 | numenoreon/LeetCode | Top Interview Questions Easy/Math/FizzBuzz.cpp | class Solution {
public:
vector<string> fizzBuzz(int n) {
vector <string> result (n);
for(int i=0; i<result.size(); i++){
if((i+1)%3 ==0 && (i+1)%5==0)
result[i]="FizzBuzz";
else if ((i+1)%3==0)
result[i]="Fizz";
else if ((i+1)%5==0... | ALGO | 0.999832 | 6.639149 |
cde457fc-66b6-46d7-9adf-6c2d8bd5594c | raincross7/code-similarity | codes/train_code/problem106/problem106_285.cpp | #include <bits/stdc++.h>
#define ll long long
#define vl vector<ll int>
#define vs vector<string>
#define v vector<int>
#define mi map<int,int>
#define mc map<char,int>
//ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
int n,i,j,sum=0;... | ALGO | 0.999962 | 3.791506 |
b28d95c5-ebe1-4536-93be-d6f0a18877d7 | abhinav-2102/leetcode | 2271-rearrange-array-elements-by-sign/2271-rearrange-array-elements-by-sign.cpp | class Solution {
public:
vector<int> rearrangeArray(vector<int>& nums) {
int n=nums.size();
vector<int>ans(n,0);
int pos=0,neg=1;
for(int i=0;i<n;i++){
if(nums[i]>=0){
ans[pos]=nums[i];
pos+=2;
}
else if(nums[i]<0){
... | ALGO | 0.99994 | 5.704293 |
d258de1c-1eb6-4cc1-b1f3-7cf8b9ca86cb | javagovindsharma/leetscode | solution/0900-0999/0974.Subarray Sums Divisible by K/Solution.cpp | class Solution {
public:
int subarraysDivByK(vector<int>& nums, int k) {
unordered_map<int, int> cnt{{0, 1}};
int ans = 0, s = 0;
for (int& x : nums) {
s = ((s + x) % k + k) % k;
ans += cnt[s]++;
}
return ans;
}
}; | ALGO | 0.999951 | 5.883665 |
49aed1cf-7819-4a8a-93ec-e8c417b1561b | Mrsandman327/windows-book-code-c- | C++标准库(第2版)/stl/copy1.cpp | #include <algorithm>
#include <list>
#include <vector>
#include <deque>
using namespace std;
int main()
{
list<int> coll1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
vector<int> coll2;
// resize destination to have enough room for the overwriting algorithm
coll2.resize(coll1.size());
// copy elements from f... | TOOL | 0.982354 | 4.52115 |
f7fbeea4-f820-4a03-a0bf-1bde73efbe27 | nazik1989/Learn_C_Plus_Plus | Lesson3/capitalSmallLetter.cpp | /*
Задача 9: Փոքրատառ և մեծատառ
Գրել ծրագիր, որը մուտքում ստանում է N թիվը [1, 26] միջակայքից և
արտածում լատինական այբուբենի N-րդ փոքրատառն ու մեծատառը: (դաս 3)
*/
/*
#include <iostream>
int main () {
short N;
std::cin >> N;
std::cout << char(N + 96) << " " << char(N + 64);
return 0;
}
*/
#include <iostream>
int ma... | ALGO | 0.999044 | 4.26324 |
64d625c5-f5b7-4fe9-8737-486de5186889 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_1693_0.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
const long long N = 1e6 + 5;
long long mod = 1e9 + 7;
void pairsort(long long a[], long long b[], long long n) {
pair<long long, long long> pairt[n];
for (long long i = 0; i < n; i++) {
pairt[i].first = a[i];
pairt[i].second = b[i];
... | ALGO | 0.999985 | 4.340254 |
c9f52096-f3d1-40a0-bade-04d5c1311386 | MD07Naushad/competative-programming | CompetitiveProg-master/02_data_structures/simpleaddition.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
template <class T> int size(const T &x) { return x.size(); }
const int INF = 2147483647;
#define rep(i,a,b) for (__typeof(a) i=(a); i<(b); ++i)
#define iter(it,c) for (__typeof(... | ALGO | 0.999821 | 4.383216 |
6297c16c-d86d-478a-8152-b316bbad0c2a | sraihan73/Lucene- | core/src/java/org/apache/lucene/geo/SimpleGeoJSONPolygonParser.cpp | using namespace std;
#include "SimpleGeoJSONPolygonParser.h"
namespace org::apache::lucene::geo
{
SimpleGeoJSONPolygonParser::SimpleGeoJSONPolygonParser(const wstring &input)
: input(input)
{
}
std::deque<std::shared_ptr<Polygon>>
SimpleGeoJSONPolygonParser::parse()
{
// parse entire object
parseObject(L""... | TOOL | 0.975789 | 6.363479 |
c030c1eb-5fd7-4694-991f-039f0423ea51 | enlighten5/symfit-kernel | subprojects/symcc-rt/src/backends/qsym/qsym/third_party/z3/src/tactic/arith/eq2bv_tactic.cpp | #include "tactic/tactical.h"
#include "util/cooperate.h"
#include "tactic/arith/bound_manager.h"
#include "ast/ast_pp.h"
#include "ast/arith_decl_plugin.h"
#include "ast/bv_decl_plugin.h"
#include "ast/rewriter/rewriter_def.h"
#include "ast/ast_util.h"
#include "ast/ast_pp_util.h"
class eq2bv_tactic : public tactic {
... | ALGO | 0.998254 | 6.385159 |
e6919eda-75c2-4f87-91df-38e24053b783 | Ramekenas/Marlin-2.1.2_anycubic_i3mega | src/feature/bedlevel/ubl/ubl_motion.cpp | #include "../../../inc/MarlinConfig.h"
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "../bedlevel.h"
#include "../../../module/planner.h"
#include "../../../module/motion.h"
#if ENABLED(DELTA)
#include "../../../module/delta.h"
#endif
#include "../../../MarlinCore.h"
#include <math.h>
//#define DEBUG_UBL_MOTION
#d... | ALGO | 0.979969 | 7.578781 |
fc5a56d2-aea8-41a1-9d49-b3e41cf6ba43 | vss021/Data-Structures-And-Algorithms | Sorting/Selection.cpp | // Impliment the Selection sort
#include <iostream>
using namespace std;
void swap(int *a, int *b){
int temp = *a;
*a = *b;
*b = temp;
}
/*
selection sort
=> for i traverse next n-i
=> check if next one is smaller the i'th element then store it to variable
=> swap the variable when ... | ALGO | 0.999944 | 4.638366 |
c8b9aaf8-5b13-44c4-9b53-5bc972ccb8ea | zhangwj0101/codestudy | algorithm/HDU-ACM/ambition0109/3569.cpp | ////////////////////System Comment////////////////////
////Welcome to Hangzhou Dianzi University Online Judge
////http://acm.hdu.edu.cn
//////////////////////////////////////////////////////
////Username: ambition0109
////Nickname: Ambition
////Run ID:
////Submit time: 2010-08-25 10:37:56
////Compiler: Visual C++
////... | ALGO | 0.999541 | 3.206574 |
5bac697a-829c-44a6-aea9-c431b64a1783 | defUserName-404/Online-Judge | CodeForces/1481A.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename... T>
void scan(T &...args)
{
((cin >> args), ...);
}
template <typename... T>
void print(T... args)
{
((cout << args), ...);
}
class Solution_To_Problem
{
// variables
int test_case, x, y;
int L, R, U, D;
string str;
bool ... | ALGO | 0.999938 | 4.688785 |
470c2977-f069-4470-8ee6-f145f54426df | bharat407/DSA_Cpp | Array/Q10_Factorial_of_large_number.cpp | // https://practice.geeksforgeeks.org/problems/factorials-of-large-numbers2508/1
class Solution
{
public:
vector<int> factorial(int N)
{
vector<int> ans;
// Initially push 1 to the ans
ans.push_back(1);
int carry = 0;
// For factorial multiplication
for (int i = ... | ALGO | 0.999968 | 6.203995 |
1450e3d5-2ac7-473a-9b65-5294c84949cc | shimmer12/leetcode | my-folder/2263-maximum-running-time-of-n-computers/solution.cpp | class Solution {
public:
long long maxRunTime(int n, vector<int>& A) {
sort(A.begin(), A.end());
long long sum = accumulate(A.begin(), A.end(), 0L);
int k = 0, na = A.size();
while (A[na - 1 - k] > sum / (n - k))
sum -= A[na - 1 - k++];
return sum / (n - k);
... | ALGO | 0.999954 | 6.028088 |
2ec18d3a-a5bb-4b10-9b41-85dfc9ada11f | Saxar1/vkr-project | venv/lib/python3.10/site-packages/prophet/stan_model/cmdstan-2.33.1/stan/lib/stan_math/lib/tbb_2020.3/src/perf/perf_sched.cpp | #include "perf.h"
#include <cmath>
#include "tbb/blocked_range.h"
#include "tbb/parallel_for.h"
#include "tbb/parallel_reduce.h"
#define NUM_CHILD_TASKS 2096
#define NUM_ROOT_TASKS 256
#define N 100000000
#define FINEST_GRAIN 10
#define FINE_GRAIN 50
#define MED_GRAIN 200
#defin... | TEST | 0.937826 | 5.846942 |
5e4490ea-d447-4778-9296-72723f8e97ad | Abhi-hpp/Physics-Engine-GBC | ExternalResources/reactphysics3d-0.7.1/testbed/nanogui/ext/eigen/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp | MatrixXd X = MatrixXd::Random(5,5);
MatrixXd A = X + X.transpose();
cout << "Here is a random symmetric 5x5 matrix, A:" << endl << A << endl << endl;
SelfAdjointEigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << ... | ALGO | 0.99979 | 3.056724 |
c12ead4c-3fed-4932-a5bc-eb26d1ef4c5c | anshyyy/CPP | Codeforces/192A.cpp | #include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define loop(i,a,n) for(int i=a;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define all1(v) (v).begin()+1,(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define allr1(v) (v).rbegin()+1,(v).rend()
typedef long long... | ALGO | 0.99975 | 4.843689 |
685fc589-f330-41b3-9c9e-67b971c0922b | PFiS1737/my-sdust-oj-archives | archives/1806_来算一下自己的成绩吧!.cpp | // INFO: 💩
//
// Description
// OJ是一个同学们又爱又恨的东东。老师在OJ上布置了作业,并且把作业成绩作为实验课程的成绩。马上就要结课了,小明想知道自己到底能得到多少分,所以他向老师请教分数的计算方法。老师告诉他,分数是这么算滴:
// 1. 对于某次作业,假设所有同学中Accpted题目数最多为X,小明Accpted题目数为Y,那么这次作业小明得分100Y/X。
// 2. 如果小明不幸错过了某次作业或者没有题目被Accpted,那么为0分。
// 3. 最终成绩是所有作业成绩的平均分。
// 好了,小明从OJ上下载了所有的standing,发现要想计算成绩还是挺麻烦的。所以,他向你求助,请你帮忙... | ALGO | 0.99719 | 4.887975 |
ab598ca6-ea99-41c6-b59c-6fa80ead12d3 | veenit1802/datastructures-and-Algorithms | array/Pancake_Sorting.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i;
cin>>n;
int a[n];
for(i=0;i<n;i++)
{
cin>>a[i];
}
int j,k;
for(j=n-1;j>=0;j--)
{
int maxnum=0,pos;
for(i=0;i<=j;i++)
{
if(maxnum<a[i])
{
maxnum=a[i];
pos=i;
}
}
if(pos!=j)
{
for(i=0;i<=pos/2;i++)
{
s... | ALGO | 0.999993 | 3.320184 |
58a0c933-a7f5-4dca-b0fc-069b3e492673 | ECN-SEC-SMP/tp10-tp10_eloi | codeTp1/factorielle.cpp | #include "factorielle.h"
int factorielle(int a) {
if (a == 0) {
return 1;
}
else {
return a*factorielle(a-1);
}
}
| ALGO | 0.998332 | 3.13486 |
9e877765-7f52-4f13-8c22-20356508cda0 | leonnfang/ECE365-Data-Structur-Algothrim-II | Dijkstra/heap.cpp | #include <iostream>
#include "heap.h"
//constructor
heap::heap(int capacity) {
heap::capacity = capacity;
heapSize = 0;
data.resize(capacity + 1);
allocate = new hashTable(capacity * 2);
}
//insert node into the heap
int heap::insert(const std::string &id, int key, void *pv) {
if (heapSize == data... | ALGO | 0.98982 | 4.186385 |
62f11aaf-328a-4ada-89b5-e105cda02d5a | Nelson0530/course | issue-of-recursion_6_6.cpp | #include <iostream>
using namespace std;
// 6-5 Fibonacci OiǦƦC(j)
// 6-6
/*
int fib(int n) // wqOiǦƦC(jgk)
{
if (n == 1)
return 1;
else if (n == 2)
return 1;
else
return fib(n - 1) + fib(n - 2);
}
double fib_repetitive(int n) // (jgk)
{
if (n == 1 || n == 2)
return 1;
int fib1 = 1, ... | ALGO | 0.999776 | 3.968697 |
5d9d0e78-ead5-4c11-ae7a-6ae1e44e8a86 | Ameer669/C-plus-plus | Factorial numbers.cpp | #include <iostream>
using namespace std;
int main(){
int n;
unsigned long long fac = 1;
while(true){
cout<<"Enter a positive number: ";
cin>>n;
if(cin.fail() || n<=0){
cout<<"\nInvaild input, Enter a Positive number!\n";
cin.clear();
cin.ignore(10000, '\n');
} else{
break;
}
}
for(int i=1; i... | ALGO | 0.998197 | 3.874724 |
0c074ced-8d72-4461-add5-2155e64c08c1 | xnmng/LeetCode | 0621-task-scheduler/0621-task-scheduler.cpp | class Solution {
public:
// TODO: understand this greedy solution
// https://leetcode.com/problems/task-scheduler/solution/
int leastInterval(vector<char>& tasks, int n) {
vector<int> v(26, 0);
int len = tasks.size(); // using len instead of usual n because of naming clash
int maximu... | ALGO | 0.999981 | 6.94298 |
fb92caec-4c60-4e7b-b715-12297b016461 | sctpimming/Competitive-Programming | Atcoder/abc167/A.cpp | #include<bits/stdc++.h>
using namespace std;
using lli = long long;
using pii = pair<int, int>;
#define rep(i,k,n) for(int i=(k); i != int(n); ++i)
#define sz(x) x.size()
#define all(x) x.begin(), x.end()
#define dbg(x) cout << #x << '=' << x << '\n'
#define dbg2(x, y) cout << #x << '=' << x << ' ' << #y << '=' << y ... | ALGO | 0.999987 | 3.785181 |
862b95f7-6bc7-42f3-863e-3110f545412c | mihoo-dev/SGA-Team-Project | GameFrameWork/utils.cpp | #include "stdafx.h"
#include "utils.h"
namespace NONA_UTIL
{
//Ÿ ϴ Լ
float getDistance(float x1, float y1, float x2, float y2)
{
float x = x2 - x1;
float y = y2 - y1;
return sqrtf(x * x + y * y);
}
// ϴ Լ
float getAngle(float x1, float y1, float x2, float y2)
{
float x = x2 - x1;
float y = y2 - y1;
... | TOOL | 0.976919 | 4.654756 |
066bb77e-9eac-4ff8-891b-f2fc5675bf2e | kerembkmz/data_structure-algorithm-questions | is_anagram.cpp | #include <bits/stdc++.h>
class Solution {
public:
bool isAnagram(string s, string t) {
unordered_map<char, int> freq_map_of_s;
if (s.length() != t.length())
{
return false;
}
for (auto& item : s){
if (freq_map_of_s.find(item) == freq_map_of_s.end()){... | ALGO | 0.999964 | 5.824336 |
ee285636-7f7a-487b-a1cc-1c888b8910cb | anshyyy/CPP | Codeforces/493B.cpp | #include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define loop(i,n) for(int i=0;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
typedef long long ll;
using namespace std;
void solve(){
ll n,first=0,second=0;
cin>>n;
vector<ll>arr(n),ff(n),ss(n);
loop(i,n){
... | ALGO | 0.999966 | 4.043725 |
c0bd103a-510c-4e8b-b4a3-85532cfa3067 | Heyya-x/CFPG | EDU/ST2/step1/A.cpp | #include <bits/stdc++.h>
using namespace std;
struct segtree {
int size;
vector<long long> values;
int NEUTRAL_ELEMENT;
void init(int n) {
size = 1;
while (size < n) size *= 2;
NEUTRAL_ELEMENT = 0;
values.assign(2 * size, 0LL);
}
long long merge(long long a, long long b) {
return (a + b);
}
void... | ALGO | 0.999761 | 5.245045 |
39648cb4-353d-489e-87f1-a119ef62d3a3 | nickomega84/Web-Server | src/config/ConfigParser.cpp | #include "../../include/config/ConfigParser.hpp"
#include "../../include/config/ConfigNode.hpp"
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <stdexcept>
ConfigParser::ConfigParser() : _configRoot(NULL) {}
ConfigParser::~ConfigParser() {
delete _configRoot;
}
ConfigParser& ConfigParser::getI... | TOOL | 0.974357 | 5.72179 |
76ef524e-8aec-48b6-9ae6-4f0377f3cc93 | aronZhang977/LeetCode | offer32-I.从上到下打印二叉树.cpp | /*
从上到下打印出二叉树的每个节点,同一层的节点按照从左到右的顺序打印。
例如:
给定二叉树: [3,9,20,null,null,15,7],
3
/ \
9 20
/ \
15 7
返回:
[3,9,20,15,7]
*/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL... | ALGO | 0.999872 | 5.56807 |
b6c756fc-0583-4d1e-ba34-5a8d8e8828eb | Alex19is/advanced_cpp | tasks/jpeg-decoder/huffman/huffman.cpp | #include <huffman.h>
#include <vector>
struct Node {
int value_;
int64_t depth_;
int64_t left_;
int64_t right_;
int64_t parent_;
};
class HuffmanTree::Impl {
public:
std::vector<Node> tree_;
size_t now_;
};
HuffmanTree::HuffmanTree() = default;
void HuffmanTree::Build(const std::vector<u... | ALGO | 0.999553 | 5.787981 |
a3735715-3b38-4bfb-a73a-9d0cdd83ace9 | hjr265/sport-programming | Live Archive/5873.cpp | // In the name of Allah, Most Gracious, Most Merciful
// /
//
//
//
//
// ??
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>... | ALGO | 0.956873 | 3.585801 |
84ecde98-94c6-4c12-a2ff-2b15212b3302 | saumya66/Competitive-Programming- | CODEFORCES/A2OJ Practice/1300 Codeforces Rating 1399/Drinks.cpp |
#include<bits/stdc++.h>
using namespace std;
typedef double ll;
void solve()
{
ll n;
cin>>n;
std::vector<ll> v(n);
ll s=0.0;
for(ll &x: v){
cin>>x;
s+= x;
}
ll ans = s/n;
cout<<fixed<<setprecision(12)<<ans;
}
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
/*
#ifndef ONLINE_JUDGE
... | ALGO | 0.999601 | 3.918354 |
bd5e151e-1ccc-464d-b2c0-6d076417b2ab | hihihi28/dsa_codeptit | DSA1014-TAPHOP.cpp | #include<bits/stdc++.h>
using namespace std;
int n,k,s,a[100];
int cnt=0;
void Try(int i){
for(int j=a[i-1]+1;j<=n-k+i;j++){
a[i]=j;
if(i==k){
int sum=0;
for(int l=1;l<=k;l++){
sum+=a[l];
}
if(sum==s) cnt++;
}
else Try(i+1);
}
}
int main(){
while(cin>>n>>k>>s){
if(n==0&&k==0&&s==0){
brea... | ALGO | 0.999774 | 3.490879 |
080f8bc5-c56d-4b1b-a5ad-560aa2c972aa | mdrasheduzzamanakash/DSA | Timus/graph/1837-isenbaevs-number.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <map>
#include <queue>
#include <vector>
#define INF (INT_MAX / 2)
using namespace std;
constexpr int MAXP = 3e2; // maximum number of players
vector<int> adj[MAXP];
bool visited[MAXP];
int dist[MAXP];
int main(void) {
int n;
cin >> n;
f... | ALGO | 0.999891 | 4.271552 |
8c63b6cc-2aba-4d0c-a03e-20da43752a85 | Arin016/DSA | Trees/treebasics.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1e9+7;
//simple garph
// +
//1 cc and no cycle
//exactly one simple path from a to b
//n nodes and n-1 edges
//we ourselves root to solve the problem
//subtree --> only comes into play when there exists a gloabl root
//a node and evrytin... | ALGO | 0.998808 | 4.760476 |
b9ed7480-a679-4ed6-a8e9-e8547354109d | higher-hai/video_model_impl | video_object_tracking/ByteTrack/deploy/ncnn/cpp/src/kalmanFilter.cpp | #include "kalmanFilter.h"
#include <Eigen/Cholesky>
namespace byte_kalman
{
const double KalmanFilter::chi2inv95[10] = {
0,
3.8415,
5.9915,
7.8147,
9.4877,
11.070,
12.592,
14.067,
15.507,
16.919
};
KalmanFilter::KalmanFilter()
{
int ndim = 4;
double dt = 1.;
_motion_mat = Eigen::MatrixXf::Identity... | ALGO | 0.999575 | 5.741516 |
bd0635db-da69-4325-a6d0-e9929604044c | Omkarbhargude/CPP_programs | Loops/Loop022.cpp | #include<iostream>
using namespace std;
class NNumber
{
public:
int iNo;
// Constructor
NNumber(int a)
{
this->iNo = a;
}
bool CheckPerfect()
{
int iCnt = 0, iSum = 0;
//Updater
if(iNo < 0)
{
... | ALGO | 0.999525 | 4.446776 |
e313e6c0-662f-44b0-9f0f-5dbf4e133283 | adityanjr/code-DS-ALGO | CodeForces/Complete/700-799/727B-BillTotalValue.cpp | #include<cstdio>
#include<iostream>
typedef long long ll;
int main(){
std::string s; std::cin >> s;
ll total(0), x(0);
long dot(-s.size());
for(long p = 0; p < s.size(); p++){
if('a' <= s[p] && s[p] <= 'z'){
if(p - dot > 3){x *= 100;}
total += x; x = 0; dot = -s.size(... | ALGO | 0.999294 | 4.103263 |
4c3143dd-f2a7-4787-94b3-9dde41ec53f0 | LSUDOKO/leetcode | cpp/binary-search/33_search_in_rotated_sorted_array.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int n=nums.size();
int low=0,high =n-1;
while (low<=high){
int mid=(low +high)/2 ;
if (nums[mid]==target)
return mid;
// for left part
if (nums[low]<=nums[mi... | ALGO | 0.999988 | 6.247574 |
3b3e6590-c173-46f2-bafb-477a2738cb7d | mohitkumaragrawal/cpp-algo | graph/make-it-connected.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
struct edge {
ll w, u, v;
};
bool operator<(const edge& a, const edge& b) { return a.w < b.w; }
vector<edge> elist;
vector<ll> a;
ll parent[200005];
ll dsu_size[200005];
ll find_set(ll x) {
if (parent[x] == x) r... | ALGO | 0.999988 | 4.553133 |
00bfbf86-df08-42cd-9b68-32eb728663c9 | lonelam/SolveSet | China Final 测试文件/C/chinafinalreviewc.cpp | #include<iostream>
using namespace std;
typedef long long ll;
ll n, k;
int main()
{
while(cin >> n >> k)
{
if (k <= 0)
{
cout << 1 <<endl;
continue;
}
n %= 10;
k = k % 4 + 4;
ll digit_n = n;
for (int i = 1; i < k; i++)
{
... | ALGO | 0.99992 | 3.423026 |
0b468c5a-763e-4700-9609-32698dae762f | Dlazcano8/Tarea-2-EDA | parenthesis/test/test_parenthesis.cpp | #include "adts/node.hpp"
#include "adts/queue.hpp"
#include "adts/stack.hpp"
#include <iostream>
#include <cstring>
using namespace eda;
bool validateParenthesis(const std::string &input, int* pos){
bool error = false;
int i = 0;
Stack stack;
while (!error && i < input.length()){
if (input[i] == '(') {
stack... | ALGO | 0.926733 | 4.011939 |
4cd16d16-13c6-4e3d-81c4-d57149e44785 | guilhermekollet/Binary_Search_Algorithm | main.cpp | /*============================================================
* Algoritmo implementado por Guilherme Kollet
* Graduando em Eng. da Computao
*
* Algoritmo de pesquisa binria, procura por
* um valor em um conjunto de elementos com
* complexidade O(log n) .
* ============... | ALGO | 0.999529 | 5.784839 |
afa8ea3e-3af3-4693-b979-01b8ddf67099 | ishandutta2007/codeforces | magicspark/normal/1698/F.cpp | /*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
- William Butler Yeats
*/
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native... | ALGO | 0.999948 | 3.651195 |
b96bc921-11f1-4431-9569-32caa14ba182 | AkashSingh3031/The-Complete-FAANG-Preparation | 1]. DSA + CP/1]. DSA/1]. Data Structures/13]. Binary Search Tree/C++/_11)_Insert-in-BST.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.999998 | 6.422822 |
6b25483b-05ce-450d-bbf5-ad41c17eb96f | KaziulyKurmanbek/PP1 | lab11/q.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cheat(vector<int> &v, int k, int i){
if(i==v.size()) return true;
if(v[i]-v[i-1]<=k) return false;
return cheat(v, k, i+1);
}
int main(){
int n, k;
cin>>n>>k;
vector<int> v(n);
for(int i=0; i<n; i++){
... | ALGO | 0.999972 | 3.541421 |
c5436ed7-7bc5-434d-8e29-4f736007a794 | xinfeng1i/AlgorithmSolution | codeforces/2/273/B.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
long long n, m;
cin >> n >> m;
long long kmax = (n-m+1)*(n-m)/2;
long long kmin = 0;
if (n % m == 0)
{
long long avg = n / m;
kmin = m*avg*(avg-1)/2;
}
else
{
long long avg = n / m;
long long r = n % m;
kmin = (avg+1)*avg/2 * r... | ALGO | 0.999882 | 4.051072 |
254df82f-53f1-469e-9e90-0a0ed5502e48 | SwayamTakkamore/Competitive_Coding | Marathon.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,i,j;
cin>>t;
int a[4];
int countar[t];
for(j=0;j<t;j++)
{
for(i=0;i<4;i++)
{
cin>>a[i];
}
int count=0;
for(i=0;i<4;i++)
{
if(i>0 && a[i]>a[0... | ALGO | 0.999583 | 3.573316 |
00f07458-7335-46f6-acfd-f50bde5d6a8b | tasnim-zeba/Problem-Solving | Codeforces/1849D.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,j;
cin>>n;
int a[n+1],f[n+1],b[n+1];
for(i=0;i<n;i++)
{
cin>>a[i];
b[i]=a[i];
f[i]=0;
}
int ans=0;
for(i=n-1;i>=0;i--)
{
if(i<n-1&&a[i+1])
{
a[i+1]--;
}
... | ALGO | 0.999868 | 3.771691 |
c631f5f2-a114-4bc9-9c8d-92b8cc0459df | AnupamAwasthi2004/GeeksForGeeks_Questions | 48.cpp | class Solution{
public:
int countTriplet(int arr[], int n)
{
// Your code goes here
sort(arr,arr + n);
int count=0;
for(int i=0;i<n-2;i++){
for(int j=i+1;j<n-1;j++){
count=count+finding(arr, n, arr[i]+arr[j], j);
}
}
return count;
}
private:
int fin... | ALGO | 0.999879 | 5.876374 |
3a7f98e3-7aec-49a8-817c-246b8857e0a7 | fufu-fafa/code | c/learn/intersection_point.cpp | #include <iostream>
#include <limits>
struct coordinate {
double x, y;
};
struct line {
coordinate start, end;
double gradient;
};
double get_gradient(coordinate start, coordinate end) {
if (end.x == start.x) return std::numeric_limits<double>::infinity();
else return (end.y - start.y) / (end.x -... | ALGO | 0.998684 | 5.048632 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.