uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2cb03046-a192-44cc-81d7-b124624fe242 | rpsingh55/Data-Structures | 83_SmallestWindowContainAllCharOfAnotherString.cpp | #include<bits/stdc++.h>
#define pb push_back
using namespace std;
string smallestWindow (string s, string p)
{
int arr[256] = {0}, alag = 0,flag = 1;
int n = s.length(), m = p.length();
for(int i = 0; i < m; i++){
if(arr[p[i]] == 0){
alag++;
}
... | ALGO | 0.999937 | 4.391954 |
3797ee0e-735d-4026-8bb2-c7da894319ed | bmaneech/Algorithms-and-Data-structures- | Algorithms /Graph /kruskal.cpp | #include<bits/stdc++.h>
using namespace std ;
struct edge{
int u , v , w ;
bool operator<(const edge &other)const{
return w < other.w ;
}
} ;
const int MAXN = 1000 ;
edge e[MAXN] ; // max = edge ;
int n , m ;
int par[MAXN] ;
int findpar(int u ){
if(u == par[u])
return u ;
return fin... | ALGO | 0.999975 | 4.750389 |
2f6bf316-484a-4ae3-9560-913d572b66d5 | ao7777/openGauss-add-rule | src/common/backend/utils/adt/jsonb_op.cpp | #include "postgres.h"
#include "miscadmin.h"
#include "utils/jsonb.h"
Datum jsonb_exists(PG_FUNCTION_ARGS)
{
Jsonb *jb = PG_GETARG_JSONB(0);
text *key = PG_GETARG_TEXT_PP(1);
JsonbValue kval;
JsonbValue *v = NULL;
/*
* We only match Object keys (which are naturally always Strings... | TOOL | 0.899199 | 7.066141 |
176ab772-00bd-44c3-9161-18f73b635c87 | BRAINSia/OpenCV_TruncatedSVN | modules/highgui/src/loadsave.cpp | //
// Loading and saving IPL images.
//
#include "precomp.hpp"
#include "grfmts.hpp"
#undef min
#undef max
/****************************************************************************************\
* Image Codecs *
\***************************... | TOOL | 0.92856 | 5.839422 |
f1953b95-f85f-4fa4-a9b2-e548de0f5ce1 | HarshPandey2111/leetcode | 0199-binary-tree-right-side-view/0199-binary-tree-right-side-view.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999868 | 6.318829 |
0a7e4790-7b15-41a1-a7bd-cf26e4f31541 | Chetan0078/DSA-lessgo | crt1/day4.cpp | #include <bits/stdc++.h>
using namespace std;
int spanArr(int x, int arr[])
{
int max = arr[0];
for (int i = 0; i < x; i++)
{
if (arr[i] > max)
{
max = arr[i];
}
}
int min = arr[0];
for (int i = 0; i < x; i++)
{
if (arr[i] < min)
{
... | ALGO | 0.999949 | 4.44892 |
c75aea1c-37f7-4438-8b28-efb5698b627d | janakrishnan123/class-1 | 8.cpp | #include <stdio.h>
int isComposite(int num) {
int i;
if(num <= 1) {
return 0;
}
for(i=2; i<=num/2; i++) {
if(num % i == 0) {
return 1;
}
}
return 0;
}
int main() {
int n, i, count = 0;
printf("Enter the size of the array: ");
scanf("%d", &n);
... | ALGO | 0.999641 | 4.39936 |
0e7a33a5-8d18-4630-a493-92ee7d29ad56 | 15joeybloom/ICPC | ACM_ICPC_Twelfth_Contest/B.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <queue>
#include <cstring>
#include <iterator>
#include <list>
#include <set>
#include <map>
#include <bitset>
using namespace std;
#define MAGIC 26
#define MOD 961748941
... | ALGO | 0.999233 | 3.162067 |
b83f82aa-297f-47dd-a6da-90d607db0aa2 | pratyushchamola/codeforces | C2_Potions_Hard_Version_.cpp | #include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
// using namespace __gnu_pbds;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define INF... | ALGO | 0.999845 | 4.540369 |
c089f844-2592-43d4-bc45-71793010b2ff | jishant-AKA-jk/DSA-JOURNEY | Arrays/Easy/move-zeros-to-end.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums) {
int zeroCount=0;
vector<int> newNums;
for(int i=0;i<nums.size();i++)
{
if(nums[i]==0)
{
zeroCount++;
}
else{
newNums.push_back(nums[i]);
... | ALGO | 0.999876 | 6.546261 |
b168a45e-de76-447a-8d2e-fafb5762550a | sanikaardekar/leetcode | 1700-number-of-students-unable-to-eat-lunch/1700-number-of-students-unable-to-eat-lunch.cpp | class Solution {
public:
int countStudents(vector<int>& students, vector<int>& sandwiches) {
queue<int> stud_choice;
for(int i=0;i<students.size();i++)
{
stud_choice.push(students[i]);
}
int rot=0,i=0;
while(stud_choice.size()&&rot<stud_choice.size())
... | ALGO | 0.999982 | 5.461888 |
7636cd1e-03f9-414a-9253-c0ea9587fe66 | dangnguyen03/IT002-Object-oriented-programming | Exercises/Ex-day12/Answer/21520683_NguyenThanhDang_BT12.2.cpp | // Baitapbuoi12.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
class DT {
private:
int n;
float *heso;
public:
DT() {
n = 0;
}
friend istream &operator >> (istream& is, D... | ALGO | 0.988395 | 3.483322 |
8680a585-e795-4375-b31c-d1fa359c2355 | Leonardo-Jodeve/C-backup | ch8_5/ch8_5.cpp | #include <stdio.h>
int main()
{
int find(int *p,int *ptr[]);
int a[]={1,2,3,4,5,6,7,8,9}; //สผ
int x,i,*ptr[9],*ptrx=&x; //ึธาชัฐาตึธ
scanf("%d",&x);
for(i=0;i<9;i++)
ptr[i]=&a[i]; //ึธ้ธณึต
printf("%d\n",find(ptrx,ptr));
return 0;
}
int find(int *p,int *ptr[])
{
int i,x,num=-1;
x=*p;
for(i... | ALGO | 0.999098 | 3.247755 |
57be2d6f-8dd0-4bbc-8e24-89e6350833d1 | Ridham24/GFG-Potd | Aug22POTD.cpp | #include<bits/stdc++.h>
using namespace std;
int findMinOpeartion(vector<vector<int> > matrix, int n)
{
// code here
int s=0,t=0,m=0;
for(int i=0;i<n;i++)
{
t=0;
for(int j=0;j<n;j++)
{
s+=matrix[i][j];
t+=matrix[i][... | ALGO | 0.99994 | 3.615252 |
c2008c00-108a-4a96-ba0d-080132eebd9c | Coach-Academy/Summer-1-2024 | Level 2/CPU - Basic - L2 - C102/Practice G1/Week 12/H.cpp |
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cctype>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <sstream>
#include <iterator>
#include <map>
#include <unordered_set>
#include <bitset>
#inclu... | ALGO | 0.999975 | 4.175742 |
6e2b28e8-d147-4e29-a115-8acd643f44c2 | teashock/studySB-CPP | 13-vector/13.1 - 2 reverse.cpp | #include <iostream>
#include <vector>
int main () {
std::cout << "Input count of numbers in the array: ";
int N;
std::cin >> N;
std::vector<float> array(N);
for (int i = 0; i < N; i++) {
std::cin >> array[i];
}
int max = array[0];
int secondMax = array[0];
for (int i =... | ALGO | 0.999773 | 5.18266 |
5d4b6199-ab41-48cc-9f23-8518e855f171 | rajsinghast03/6Companies30days | longest_mountain.cpp | class Solution
{
public:
int longestMountain(vector<int> &arr)
{
int n = arr.size();
vector<int> dp1(n, 1), dp2(n, 1);
int ans = 0;
for (int i = 1; i < n; ++i)
{
if (arr[i] > arr[i - 1])
dp1[i] = 1 + dp1[i - 1];
}
for (int i = n - 2; i >= 0; --i)
{
if (arr[i] > a... | ALGO | 0.999974 | 5.452463 |
5528c99a-c452-446b-aa3a-87dd722b31ce | raincross7/code-similarity | codes/train_code/problem205/problem205_112.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long li;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
li h, w, d;
cin >> h >> w >> d;
if (d % 2 == 1) {
for (int i = 0; i < h; ++i) {
for (int j = 0; j < w; ++j) {
cout << (((i + j) & 1) ? 'R' ... | ALGO | 0.998767 | 3.776482 |
eabfba1b-4099-460c-8ebc-9171fd829072 | Chandansr01/DSA-practice | TREES/leastCommonAncesstor.cpp | class Solution
{
public:
//Function to return the lowest common ancestor in a Binary Tree.
Node* lca(Node* root ,int n1 ,int n2 )
{
//Your code here
if(root==NULL){
return NULL;
}
if(root->data == n1 || root->data==n2){
return root;
}
... | ALGO | 0.999997 | 6.533576 |
b5e990ef-306d-4cf5-8679-f678a8282299 | raincross7/code-similarity | codes/train_code/problem262/problem262_237.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int n;
cin >> n;
vector<int> arr(n);
for(int i=0;i<n;i++) cin >> arr.at(i);
vector<int> copy = arr;
sort(arr.begin(),arr.end());
int max1 = arr.at(n-1);
int max2 = arr.at(n-2);
for(int i=0;i<n;i++){
... | ALGO | 0.99999 | 3.563019 |
7c54cfa3-3437-4a7b-83b9-638943984061 | KevinMuyaoGuo/PAT_levelB | 1040.cpp | /*
* ๅญ็ฌฆไธฒ APPAPT ไธญๅ
ๅซไบไธคไธชๅ่ฏ PAT๏ผๅ
ถไธญ็ฌฌไธไธช PAT ๆฏ็ฌฌ 2 ไฝ(P)๏ผ็ฌฌ 4 ไฝ(A)๏ผ็ฌฌ 6 ไฝ(T)๏ผ็ฌฌไบไธช PAT ๆฏ็ฌฌ 3 ไฝ(P)๏ผ็ฌฌ 4 ไฝ(A)๏ผ็ฌฌ 6 ไฝ(T)ใ
็ฐ็ปๅฎๅญ็ฌฆไธฒ๏ผ้ฎไธๅ
ฑๅฏไปฅๅฝขๆๅคๅฐไธช PAT๏ผ
่พๅ
ฅๆ ผๅผ๏ผ
่พๅ
ฅๅชๆไธ่ก๏ผๅ
ๅซไธไธชๅญ็ฌฆไธฒ๏ผ้ฟๅบฆไธ่ถ
่ฟ10
5
๏ผๅชๅ
ๅซ PใAใT ไธ็งๅญๆฏใ
่พๅบๆ ผๅผ๏ผ
ๅจไธ่กไธญ่พๅบ็ปๅฎๅญ็ฌฆไธฒไธญๅ
ๅซๅคๅฐไธช PATใ็ฑไบ็ปๆๅฏ่ฝๆฏ่พๅคง๏ผๅช่พๅบๅฏน 1000000007 ๅไฝๆฐ็็ปๆใ
่พๅ
ฅๆ ทไพ๏ผ
APPAPT
่พๅบๆ ทไพ๏ผ
2
*/
#include <iostream>
#define lim 1000000007
using n... | ALGO | 0.999864 | 4.547548 |
47b78c4d-45f5-4241-8980-2e85e05cfd72 | Shital14Sable/leetcode | Cpp/copy_list_random_ptr.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* next;
Node* random;
Node(int _val) {
val = _val;
next = NULL;
random = NULL;
}
};
*/
class Solution {
public:
Node* copyRandomList(Node* head) {
if(head==NULL) return NULL;
unordered_ma... | ALGO | 0.998601 | 5.478175 |
1d22d362-d7cf-4821-b307-529164b1b824 | Ravi-Khatri/code | codeforce/CF_ROUNDS/651/B.cpp | #include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
using namespace std;
void solve()
{
int n;cin>>n;
if(n==1){
cout<<"FastestFinger\n";
return;
}
if(n==2){
cout<<"Ashishgup\n";
return;
}
if(n%2){
cout<<"Ashishgup\n";
return;
}
if(n && !(n & (n-1))){
cout<<"F... | ALGO | 0.999608 | 3.982139 |
3ddf0b91-8f89-4068-a6a0-31bd6e602954 | marlonwc3/cp-codes | Spoj/Spoj19934==O Tabuleiro Esburacado.cpp | #include <bits/stdc++.h>
#define _ printf("\n");
#define sc1(a) scanf("%d", &a)
#define sc2(a,b) scanf("%d %d", &a, &b)
#define sc3(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define sc4(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)
#define iz(b) if(!b) {break;}
#define pb(a) push_back(a)
#define inf 0x3f3f3f3f
#define linf... | ALGO | 0.999856 | 3.245143 |
47b63954-5223-47dd-8eca-45ab276fb1aa | Pold87/blockchain-swarm-robotics | original_code/Epuck/loop_functions/environment_classification_loop_functions/environment_classification_loop_function.cpp | #include "environment_classification_loop_function.h"
#include <argos3/core/utility/math/rng.h>
#define ALPHA_CHANNEL 0
#define COLOR_STRENGHT 255
#define TOTAL_CELLS 400
#define ENVIRONMENT_CELL_DIMENSION 1000.0f
#define N_COL 3
#define ARENA_SIZE_X 1.9f
#define AR... | ALGO | 0.988538 | 4.569129 |
46d9c353-5238-4f90-8e46-1fccadb49ed8 | namtrungit/BigO | blue/lecture_15/prim.cpp | #include<iostream>
#include<queue>
#include<vector>
#include<cstring>
using namespace std;
#define MAX 100
const int INF = 1e9;
vector<pair<int, int>> graph[MAX];
vector<int> dist(MAX, INF);
int path[MAX];
bool visisted[MAX];
int N, M;
void printMST() {
int ans = 0;
for(int i=0; i<N; i++) {
if(path[i] == -1) {... | ALGO | 0.999988 | 4.669073 |
835b1e9c-38a3-449a-96d6-5e529cb2f92e | umaidansari12/CP | previous_codes/unpleasant_ones.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
string getBinaryString(int n)
{
string s;
while (n)
{
s += to_string(n % 2);
n /= 2;
}
reverse(s.begin(), s.end());
return s;
}
void generatePermutations(vector<string> &b, string res, int l, int r, int &ans)
{
if (l == r + 1)
{
int co... | ALGO | 0.999941 | 5.601751 |
0eddea16-3442-4595-a31c-945ba343572a | GziXnine/Codeforces | Digits Summation.cpp | #include <iostream>
using namespace std;
int main()
{
long long M, N;
cin >> M >> N;
cout << (M % 10) + (N % 10) << endl;
return 0;
} | ALGO | 0.998811 | 3.072126 |
e9e0347f-2af9-47dc-85e7-9186bf85b4f5 | IgorJoaquimn/2022-Competitive-Programming | Lista 2/2243 (1)/2243 copy 2.cpp | #include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define INF 0x3f3f3f
#define MAX 26
#define _ \
ios_base::sync_with_stdio(false); \
std::cin.tie(0);
bool possivel_subir(int x, int y, int A, int B, vector<int> &v)
{
if(x == ... | ALGO | 0.999967 | 4.206615 |
23663f9f-6fed-45fc-81d9-fe5f7fe1975c | piaoyao424/vs2013 | opencv2.4.13/sources/modules/features2d/src/dynamic.cpp | #include "precomp.hpp"
namespace cv
{
DynamicAdaptedFeatureDetector::DynamicAdaptedFeatureDetector(const Ptr<AdjusterAdapter>& a,
int min_features, int max_features, int max_iters ) :
escape_iters_(max_iters), min_features_(min_features), max_features_(max_features), ad... | ALGO | 0.960574 | 5.649426 |
5b3286d3-7c57-4ea1-b010-06fec0be1ce4 | Yuessiah/Destiny_Record | CSES/1619_Restaurant_Customers.cpp | #include<bits/stdc++.h>
using namespace std;
int n, a, b;
int main()
{
cin >> n;
vector<pair<int, int>> t;
for(int i = 0; i < n; i++) {
cin >> a >> b;
t.push_back({a, 1});
t.push_back({b, -1});
}
sort(t.begin(), t.end());
int sum = 0, ans = 0;
for(auto [_, p]: t) {
sum += p;
ans ... | ALGO | 0.999954 | 4.417596 |
d2aa4145-22f9-4c57-bdbf-37af46dd856b | AnkithChowdary/C-Plus-Plus | Graphs/weightedGraph.cpp | #include<iostream>
#include<unordered_map>
#include<list>
using namespace std;
class Graph{
public:
// first int-> u
// Second int->v
// Third int->wt
unordered_map<int,list< pair<int,int> >>adjList;
void addEdge(int u,int v,int weight,bool direction){
// direction=0 -> undirected graph
// directi... | ALGO | 0.999437 | 4.983383 |
53d11ca9-64cd-4eb9-a8f4-4823a67b7a44 | Vladimir-Kondratiev/WinDjView | libdjvu/atomic.cpp | #ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stddef.h>
#include <stdlib.h>
#include <assert.h>
#include "atomic.h"
#if defined(WIN32)
# include <windows.h>
#endif
#include "GThreads.h"
// #include <pthread.h>
// #include <QMutex>
// #include <QWaitCondition>
#define OBEY_HAVE_INTEL_ATOMIC_BUILTINS 1
/... | TOOL | 0.959607 | 6.538878 |
0462f3ab-36bd-4925-908d-704ca26accd8 | LukasGarbacik/DEM_engine | src/demo/DEMdemo_WheelDPSimplified.cpp | // =============================================================================
// A simplified wheel drawbar-pull test, featuring Curiosity wheel geometry and
// terrain particles represented by irregular DEM elements. Unlike WheelDP, this
// demo does not have a prerequisite and can run on its own, and the terrain i... | TEST | 0.891571 | 5.128553 |
119189b7-e4b3-460f-be9e-5621bb092b48 | ruleless/programming | alg/poj/archive/2231/5933962_WA.cpp | #include<iostream>
#include<cmath>
using namespace std;
int a[10002];
int main()
{
// freopen("in.txt","r",stdin);
int N,i,j,sum=0;
scanf("%d",&N);
for(i=0;i<N;i++)
scanf("%d",&a[i]);
for(i=0;i<N;i++)
{
for(j=0;j<N;j++)
{
if(i!=j)
{
sum+=abs(a[i]-a[j]);
}
}
}
printf("%d\n",sum);
return 0;... | ALGO | 0.999778 | 3.417696 |
ca49691c-843a-4df9-a672-8b468c0040bb | noko206/AtCoder | abc/301-350/347/a.cpp | // clang-format off
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REPI(i,0,n)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,R... | ALGO | 0.999914 | 3.651258 |
87b62991-1db8-49e7-870a-218c43212ebd | janisfreund/path-tree-optimization | ompl/src/ompl/base/samplers/src/MaximizeClearanceValidStateSampler.cpp | /* Author: Ioan Sucan */
#include "ompl/base/samplers/MaximizeClearanceValidStateSampler.h"
#include "ompl/base/SpaceInformation.h"
ompl::base::MaximizeClearanceValidStateSampler::MaximizeClearanceValidStateSampler(const SpaceInformation *si)
: ValidStateSampler(si), sampler_(si->allocStateSampler()), improveAttemp... | ALGO | 0.989542 | 6.865608 |
2b6aa31e-f817-4edf-ba86-a7ffba52856e | venediktov/travis-sandbox | jsonv/src/jsonv/util.cpp | #include <jsonv/util.hpp>
#include <jsonv/algorithm.hpp>
#include <jsonv/string_view.hpp>
#include <jsonv/coerce.hpp>
#include <cmath>
#include <sstream>
#include <stdexcept>
namespace jsonv
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ... | TOOL | 0.943693 | 7.641881 |
96e5bc80-c964-42ae-8cf4-d7d23c4111d2 | sqiemanqieman/Leetcode-vscode | header/63.ไธๅ่ทฏๅพ-ii.cpp | /*
* @lc app=leetcode.cn id=63 lang=cpp
*
* [63] ไธๅ่ทฏๅพ II
*/
// @lc code=start
#ifdef RUN_IN_LOCAL
#include "common.h"
#endif
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
int m = obstacleGrid.size(); int n = ob... | ALGO | 0.999394 | 6.155051 |
19c7531f-e2c5-464e-b3ba-82b086afd5b4 | svchaudhari1995/CarND-MPC-Project | src/Eigen-3.3/doc/snippets/JacobiSVD_basic.cpp | MatrixXf m = MatrixXf::Random(3,2);
cout << "Here is the matrix m:" << endl << m << endl;
JacobiSVD<MatrixXf> svd(m, ComputeThinU | ComputeThinV);
cout << "Its singular values are:" << endl << svd.singularValues() << endl;
cout << "Its left singular vectors are the columns of the thin U matrix:" << endl << svd.matrixU(... | ALGO | 0.999619 | 3.463409 |
e251ed21-8f09-4f86-82a1-123398545b11 | raincross7/code-similarity | codes/train_code/problem070/problem070_109.cpp | #include <stdio.h>
int main(void){
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
if(0 <= b - c){
printf("delicious");
}
else{
if(a >= c - b)
printf("safe");
else{
printf("dangerous");
}
}
return 0;
}
| ALGO | 0.999662 | 4.193281 |
0462e115-a793-447a-850e-9c80cbfd2055 | wwwllm/C-- | codeforces/1200-1400/E. Triple Operations.cpp | #include <bits/stdc++.h>
using namespace std;
// https://codeforces.com/problemset/problem/1999/E
// ่ฟๅฏไปฅ็จๅ็ผๅ้ขๅค็ๆๆ1-2e5็ๆฐๆฎ
void solve()
{
int l, r;
cin >> l >> r;
int p_3 = 1, cnt = 1;
while (p_3 < l)
{
p_3 *= 3;
cnt++;
}
if (p_3 != l)
cnt--, p_3 /= 3;
int ans = c... | ALGO | 0.999866 | 3.906033 |
d5608f1b-40a2-475f-b391-30d1b780b147 | Rajeshnds/Competitive-Programming | codeforces/dragonmas/codeforces(c++)_old/blocks/main.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
string s;
int main(){
int k=0,l=0;
vector<int>v;
char c;
cin>>n>>s;
for(int i=0;i<n;i++)s[i]=='B'?k++:l++;
if(k%2&&l%2)cout<<-1;
else{
if(k%2==0)c='W';
else c='B';
k=0;
for(int i=0;i<n;i++){
if(k%... | ALGO | 0.999687 | 3.62794 |
caa628db-0943-4fc3-b91f-4efb8f221198 | algoplutus1708/Leetcode-Solutions | C++/Shortest-Common-Supersequence.cpp | /*
*
* Runtime : 12ms, faster than 98.40%
* Memory : 10.7MB, faster than 85.57%
* prerequisite : least common subsequence in string
*/
class Solution {
public:
string shortestCommonSupersequence(string str1, string str2) {
int i = str1.length();
int j = str2.length();
int t... | ALGO | 0.999991 | 5.665495 |
aaea0013-c96a-4a01-86c7-7a7d287e0eed | gandhi56/Competitive-Programming | kattis/classy/classy.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
string getRank(string name, string rank){
string r;
for (int i = 0; i < rank.length(); ++i){
if (rank[i] == 'u'){
r += 'a';
}
if (rank[i] == 'm'){
r += 'b';
}
if (rank[i] == 'o'){
r += 'c';
}
}
i... | ALGO | 0.998803 | 4.783819 |
e157e159-068b-4686-966d-1b53648d0c38 | sangbumlikeagod/Leetcode_page | 2201-valid-arrangement-of-pairs/2201-valid-arrangement-of-pairs.cpp | class Solution {
public:
vector<vector<int>> validArrangement(vector<vector<int>>& pairs) {
unordered_map<int, vector<int>> adjList;
unordered_map<int, int> in;
unordered_map<int, int> out;
for (vector<int> pair : pairs)
{
adjList[pair[1]].push_back(pair[0]);
... | ALGO | 0.999997 | 5.533479 |
4e5a4657-c89c-4682-9a9b-a36e46df6ca4 | risacker/Leetcode_Solutions | binary-search/binary-search.cpp | class Solution {
int binary_search(vector<int> &nums, int target, int si, int ei)
{
if(si >= ei && nums[si] != target)
return -1;
int mid = (si + ei) / 2;
if(nums[mid] == target)
return mid;
else if(nums[mid] > target)
return binary_sea... | ALGO | 0.999979 | 6.285326 |
7e139412-4278-436d-8cce-7468a57c4212 | Jaimedev12/CourseraCourses | AlgorithmicToolbox/Week4/week4_divide_and_conquer/2_binary_search_with_duplicates/binary_search.cpp | #include <iostream>
#include <cassert>
#include <vector>
using std::vector;
int binary_search(const vector<int> &a, int x) {
int left = 0, right = (int)a.size();
//write your code here
}
int linear_search(const vector<int> &a, int x) {
for (size_t i = 0; i < a.size(); ++i) {
if (a[i] == x) return i;
}
... | ALGO | 0.999949 | 5.273572 |
1a77797f-25b1-4013-a4e1-c5a30d1fd8a7 | ishivxnshh/Leetcode-Solutions | Binary Trees/Q_104.cpp | #include <iostream>
#include <algorithm>
using namespace std;
// 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, TreeNo... | ALGO | 0.999959 | 7.18231 |
95a0d96d-4f9e-4d22-8fb4-55e75a94cbcc | hieupham1103/TINHOC | TRAIDONG/7-11/N.cpp | #include<bits/stdc++.h>
#define ii pair <int,int>
#define fi first
#define se second
#define price fi
#define num se
// #define int long long
#define double long double
#define endl '\n'
using namespace std;
const int maxN = 6010;
const int mod = 1e9 + 7;
ii a[maxN];
bool cmp(ii x, ii y){
return x.price < x.pric... | ALGO | 0.99892 | 3.969324 |
84afe0b1-64a8-4fe2-81f1-563fec8c7ac2 | blariise/PPP3 | chapter_04/exercises/exercise_12.cpp | #include "../../PPPheaders.h"
vector<int> getAnswer() {
vector<int> result {};
result.push_back(random_int(0, 9));
bool is_in { false };
while (std::size(result) < 4) {
is_in = false;
int x = random_int(0,9);
for (const auto num : result) {
if (x == num)
is_in = true;
}
if... | ALGO | 0.994678 | 5.430645 |
75b3ae65-030c-44ae-8b4a-c0be26d68699 | dietmarkuehl/operator-dot | test/SemaCXX/constexpr-ackermann.cpp | // RUN: %clang_cc1 -std=c++11 -fsyntax-only %s
constexpr unsigned long long A(unsigned long long m, unsigned long long n) {
return m == 0 ? n + 1 : n == 0 ? A(m-1, 1) : A(m - 1, A(m, n - 1));
}
using X = int[A(3,4)];
using X = int[125];
| ALGO | 0.988702 | 3.247344 |
0bc4de1c-864e-4372-a97d-634545ffb652 | alphacube18/dsacodes | 15.cpp | #include <iostream>
#include <vector>
#include <climits>
using namespace std;
#define V 6 // Number of vertices
int minKey(vector<int>& key, vector<bool>& mstSet) {
int min = INT_MAX, min_index;
for (int v = 0; v < V; v++)
if (!mstSet[v] && key[v] < min)
min = key[v], min_index = v;
... | ALGO | 0.999962 | 5.855292 |
44ca9f6f-3363-4c1b-8cf6-e592edb0a353 | powermad80/DnAPathfindingProject | DnAPathfindingProject/mygraph.cpp | #include <iostream>
#include <cstdlib>
#include <list>
//Jake Dubusker
//Ryan Karrasch
//Group 14
using namespace std;
class Graph
{
private:
int n;
int **matrix;
bool *visited; //number of nodes, adjacency matrix, and array marking visited nodes always visible
//to all functions within each instance of t... | ALGO | 0.998429 | 5.49577 |
f47e68be-1bcc-43de-acd5-984f48a5f70c | nishantthedevill/Data-Structures-and-Algorithms | 0019-remove-nth-node-from-end-of-list/0019-remove-nth-node-from-end-of-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:
int counts(ListNode* head... | ALGO | 0.999958 | 5.915338 |
25072299-5bbb-4dd6-ac7b-9a52c31dcd43 | narang-madhur/CPP | CODING NINJAS QUESTIONS/DSA IN C++/RECURSION/binary_search_recursive.cpp | #include <iostream>
using namespace std;
int binarysearch(int arr[], int start, int end, int x)
{
if (start > end)
{
return -1;
}
int mid = (start + end) / 2;
if (arr[mid] == x)
{
return mid;
}
else if (arr[mid] > x)
{
int index = binarysearch(arr, start, mid... | ALGO | 0.999954 | 5.615071 |
acf585bc-3b8c-41d5-9cb2-04aa9d897eca | arshsaluja/Hakerrank | C++/For Loop.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main() {
int a;int b;
cin>>a>>b;
for(int n=a;n<=b;n++)
{
if(n==1)
cout<<"one"<<endl;
else if(n==2)
cout<<"two"<<endl;
else if(n==3)
cout<<"three"<<endl;
else if(n==4)
cout<<"four"<<endl;
else if(n==5)
cout<<"five"<<endl;
else if(n==6)
co... | ALGO | 0.999957 | 3.364188 |
03707c31-e2f9-4ffa-ba74-46797dacea87 | Henne/Bright-Eyes | src/custom/schick/rewrite_m302de/seg052.cpp | /**
* Rewrite of DSA1 v3.02_de functions of seg052 (citycamp)
* Functions rewritten: 1/1 (complete)
*
* Borlandified and identical
* Compiler: Borland C++ 3.1
* Call: BCC.EXE -mlarge -O- -c -1 -Yo seg052.cpp
*/
#include <stdio.h>
#include "v302de.h"
#include "seg002.h"
#include "seg004.h"
#include "seg007.h"
... | TOOL | 0.8841 | 4.772952 |
0e739244-76e6-4712-a4fe-f9fde4ac70ef | ankursinghkuntal/DSA | DP/0-1 KnapSack/minimumSubsetSumDiff.cpp | #include <bits/stdc++.h>
using namespace std;
int minSubsetSumDifference(vector<int>& arr, int n) {
int sum = 0;
for (int i = 0; i < n; i++) sum += arr[i];
vector<vector<bool>> dp(n+1, vector<bool>(sum+1, false));
for (int i = 0; i <= n; i++) dp[i][0] = true;
for (int i = 1; i <= n; i++) {
... | ALGO | 0.999941 | 5.783428 |
33e7a1cb-b5bc-4913-ba4c-df39b0b25387 | ishandutta2007/codeforces | gshgsh/normal/1553/A.cpp | #include<iostream>
#include<cstdio>
using namespace std;
#define For(i,l,r) for(int i=l;i<=r;i++)
int get(){int x=0;char c=getchar();while(c<'0'||c>'9')c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x;}
int main()
{
int T=get();
while(T--)
{
int N=get();cout<<(N+1)/10<<endl;
}
return 0;
} | ALGO | 0.997862 | 3.295317 |
8f8875cd-d258-4dc5-9d9d-a1b35e8f123e | kbazow/vn_movement_engine-master | Krkr/M2Psb/dr_source/FileStream.cpp | /*
Moe-Sky(ศฟีบ) File Stream Sources
201724 @ Moe-Sky
2013-01-20
*/
#include <windows.h>
#include "FileStream.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <shlwapi.h>
#include "zlib.h"
#pragma comment(lib,"zlib.lib")
#include <malloc.h>
#ifdef _DEBUG
#undef THIS_FILE
s... | TOOL | 0.874466 | 4.413762 |
b8a92008-59d2-45f4-8e89-63f858b82e94 | sankalp0412/C_Coding | Recursion/Subset Sum/code.cpp | #include "bits/stdc++.h"
using namespace std;
void init_code() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("output.txt", "w", stderr);
#endif
}
void solve(int index, int sum, vector<int> &ans, vector<int> arr) {
if(index == arr.size()) {
ans.push_back(sum);
... | ALGO | 0.999952 | 4.914647 |
83f63547-09a0-48ee-8600-dade1b40e5e6 | 1303575952/Data-Structure-And-Algorithms | Think-In-Algorithms/05-Binary-Search-Tree/Course Code (C++)/07-Binary-Search-Tree-Remove-Min-and-Max/main.cpp | #include <iostream>
#include <queue>
#include <cassert>
#include <ctime>
using namespace std;
// ไบๅๆ็ดขๆ
template <typename Key, typename Value>
class BST{
private:
// ๆ ไธญ็่็นไธบ็งๆ็็ปๆไฝ, ๅค็ไธ้่ฆไบ่งฃไบๅๆ็ดขๆ ่็น็ๅ
ทไฝๅฎ็ฐ
struct Node{
Key key;
Value value;
Node *left;
Node *right;
Node(Key... | ALGO | 0.999714 | 4.624988 |
ce75c0db-9213-4eba-a4c0-f78ec582b506 | JanaSabuj/cpmaster | Atcoder/Atcoder Educational DP/Frog2.cpp | //Built by Sabuj Jana(greenindia) from Jadavpur University,Kolkata,India
// God is Great------------/////\\\\\\\--------------------------------
#include <bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
// #define INF LLONG_M
#define pb ... | ALGO | 0.999925 | 3.707256 |
9c03a3f1-52ef-49b8-8887-f56f663e6004 | reo0105/atcoder | contest/2024_04_06_beginner/F.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<vector<int>> a(n, vector<int>(m));
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> a[i][j];
}
}
using BS = bitset<2000>;
vector<BS> d(n);
for (int... | ALGO | 0.999977 | 3.627614 |
997790d4-aa20-4003-aa0c-29e8394d6c70 | offshore0315/-C- | app2.cpp | #include<iostream>
using namespace std;
void main() {
int x;
int t;
int* foo;
foo = new int[20];
cin >> x;
for (int y = 0; y < x; y++) {
cin >> foo[y];
}
for (int i = 0; i < x - 1; i++) {
for (int j = 0; j < x - i - 1; j++) {
if (foo[j] > foo[j + 1]) {
t = foo[j];
foo[j] = foo[j + 1];
foo[j +... | ALGO | 0.999963 | 3.477504 |
40224288-6baa-4698-a28c-06ca880a07d0 | feiranwang/caffe | src/caffe/layers/mvn_layer.cpp | #include <algorithm>
#include <vector>
#include "caffe/common_layers.hpp"
#include "caffe/layer.hpp"
#include "caffe/util/math_functions.hpp"
namespace caffe {
template <typename Dtype>
void MVNLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
top[0]->Reshape(bottom... | DATA | 0.876666 | 6.998205 |
daffc642-e5c0-4e38-bd94-1501d522a8bb | Anish218/project_euler | projecteuler_7.cpp | #include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int flag=0,temp=1,num;
for(int i=2;flag<=10001;i++)
{
for(int j=2;j<=i/2;j++)
{
if(i%j==0)
{
temp=0;
break;
}
else{
temp... | ALGO | 0.99971 | 3.528925 |
5e6440df-33ed-40b8-a5e9-94735699d999 | mukuldeep/cs | google kickstart 2021 H/google_kickstart21H_YT.cpp | //
// Created by me on 14-11-2021.
//
#include <bits/stdc++.h>
#define SYNC ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define DRIVER int main(){SYNC ll t=1;I_ t;for(int i=1;i<=t;i++){soln(i);}return 0;}
#define TEST_DRIVER int cc_main(){SYNC ll t=1;I_ t;for(int i=1;i<=t;i++){soln(i);}return 0;}
#define FR_(a,... | ALGO | 0.999334 | 3.667961 |
db534d41-a87e-4397-9e98-f12c8b739ecb | Mohamed-Mounaji/Level-1-of-Problem-Solving--50-Problems | problem_9/problem_10/problem_10.cpp | #include <iostream>
using namespace std;
void ReadMarks(float Marks[3])
{
cout << "Please enter the first mark: ";
cin >> Marks[0];
cout << "Please enter the second mark: ";
cin >> Marks[1];
cout << "Please enter the third mark: ";
cin >> Marks[2];
}
float SumOf3Marks(float Marks[3])
{
return Marks[0] + Mark... | TOOL | 0.965641 | 3.046897 |
2196c2a1-9ef8-40cb-8d89-3f2fa5733cbc | krypciak/programming-exercises | codequest/2025/pra/a.cpp | #include <bits/stdc++.h>
#include <string>
using namespace std;
#ifdef TEST
int run(istream &cin, ostream &cout) {
#else
int main() {
#endif
ios_base::sync_with_stdio(0);
cin.tie(0);
map<string, map<string, string>> G = {
{"BEGIN", {{"C", "New"}}},
{"New", {{"S", "Draft"}}},
{"Draft",
... | ALGO | 0.999576 | 4.661988 |
4960ca7e-a072-4c30-a863-30dd7c594ea1 | Maurya2811/LeetCode-GFG-Solutions | Target Sum - GFG/target-sum.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//Back-end complete function Template for C++
class Solution {
public:
// This problem is same as the
// Count the no of the subset with a given diff
int countOfSubsetSum(vector<i... | ALGO | 0.999976 | 6.192771 |
280bbf27-1478-4349-a957-8fb680e24e6e | KirillSmirnov/dpll-perf-toy-project | 02-unordered_set_used/sat.cpp | #include <algorithm>
#include <errno.h>
#include <fstream>
#include <iostream>
#include <set>
#include <unordered_set>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#define MAXVARS 1500
using std::vector;
using std::string;
using std::unordered_set;
class CNF {
int nvars;
bool em... | ALGO | 0.999356 | 5.819419 |
0eeb0cf6-c567-4818-baa6-79beff4d9ecc | ishandutta2007/codeforces | fanache99/normal/1630/E.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <cassert>
#include <map>
#include <numeric>
#include <cstring>
#include <set>
#include <ctime>
#include <queue>
#include <cmath>
#include <iomanip>
#include <iterator>
#include <bitset>
#include <unordered_map>
#incl... | ALGO | 0.999937 | 5.072833 |
75109f39-0139-4a2c-b61f-097afe1ee0ed | BMGongsg1/algorithms-code | 2024-05-04----2024-05-05/2024-05-05-bbg6b3.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long long n,L;
cin>>n>>L;
vector<long long> nums(1e6+100);
vector<long long> pre(1e6+100);
for(int i=0;i<n;i++)
{
long long a,b;
cin>>a>>b;
nums[a] += b;
}
for(int i=0;i<=1e6;i++)
{
pre[i+1] += ... | ALGO | 0.999958 | 3.725146 |
2ed0d5ce-df18-4477-ab30-6df094d459ea | nikhiljha625/Cp_All_questions | B_Password.cpp | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#pragma GCC optimize("Ofast")
#define ll long long
#define pb push_back
#define all(v) v.begin(), v.end()
#define ff second
#define ss second
#define pyes cout << "YES" \
... | ALGO | 0.99993 | 4.169032 |
3be2a35d-600c-4d14-9f54-8537cadbd699 | pg2005230/GarciaPaul_CIS5_44187 | Hmwk/Assignment_1/Gaddis_8thEd_Chap2_Prob17_Stock_V2/main.cpp | /*
File: main.cpp
Author: Dr. Mark E. Lehr
Created on January 4, 2017, 12:05 PM
Purpose: Stock Calculation
*/
//System Libraries
#include <iostream>
using namespace std;
//User Libraries
//Global Constants
//Such as PI, Vc, -> Math/Science values
//as well as conversions from system of units to
//anoth... | TOOL | 0.939514 | 4.800452 |
e03421b0-4e4d-4541-a5cf-373a4aeb8570 | forkee/sikretcoin | src/spork.cpp | #include "spork.h"
#include "base58.h"
#include "key.h"
#include "main.h"
#include "masternode-budget.h"
#include "net.h"
#include "protocol.h"
#include "sync.h"
#include "util.h"
#include <boost/lexical_cast.hpp>
using namespace std;
using namespace boost;
class CSporkMessage;
class CSporkManager;
CSporkManager spo... | TOOL | 0.973512 | 5.869124 |
03c78503-a400-4049-a892-b24e610c9386 | ishandutta2007/codeforces | gary2005/normal/594/E.cpp | /**
* author: gary
* created: 03.06.2022 16:40:52
**/
#include<bits/stdc++.h>
#include <algorithm>
#include <cassert>
#include <numeric>
#include <string>
#include <vector>
namespace atcoder {
namespace internal {
std::vector<int> sa_naive(const std::vector<int>& s) {
int n = int(s.size());
std::ve... | ALGO | 0.999997 | 4.061804 |
b49fc135-1738-4aae-a74a-fff1cde5fd6d | par9615/competitive-programming | UVa-12468.cpp | #include<iostream>
#include<cmath>
#include<map>
#include<vector>
#include<algorithm>
#include<utility>
#include<set>
#include<cctype>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef set<int> si;
typedef map<string, int> msi;
#define FO... | ALGO | 0.999274 | 3.464127 |
43fdf2ce-d692-4135-ab80-84a111e9ec11 | Kaminyou/Competitive-Programming-Playground | solutions/1697B.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, q;
cin >> n >> q;
vector<long long> prices(n, 0);
for (int i = 0; i < n; ++i) cin >> prices[i];
sort(prices.begin(), prices.end());
vector<long long> prefixSum(n + 1, 0);
for (int i = 0; i < ... | ALGO | 0.99986 | 4.397177 |
b16a3147-8b10-402c-868b-fc72e22f1ce7 | keisuke90/AtCoder | practice/abc101-c.cpp | #include <bits/stdc++.h>
#define rep(i, start, end) for(int i = start; i < end; i++)
using namespace std;
int main(){
int n, k;
cin >> n >> k;
vector<int> vec(n);
rep(i, 0, n) cin >> vec[i];
int ans = (n-1+k-2)/(k-1);
cout << ans << endl;
return 0;
} | ALGO | 0.999881 | 3.814655 |
f535d796-57d9-4aec-a95c-4f84e0d01b22 | uriuriboo/kyopuro_Cpp | Library/dp/Largest_Rectangle.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
int getLargestRectangle(int size,vector<int> &G){
int maxv = 0;
stack<pair<int,int>> S;//height,pos
G[size] = 0;
for(int i = 0;i <= size;i++){
pair<int,int> rect;
rect.first = G[i];
re... | ALGO | 0.999898 | 4.244695 |
f7c708f0-7747-4d8c-a4f5-174c009ed68e | degmvp/labdev | XC++/XC++P3/xc+155.cpp |
/*
---------------------------------------
# โ
xc+155 C++ Lib 11
# โ
C++ criado: 2021/03/31
# โ
Objetivo:sql server - C++ Lib 11
---------------------------------------*/
create proc [dbo].[xc+155]
AS
/*
#include <iostream>
#include <stack>
using namespace std;
int main()
{
stack<int>pilha1,pilha2;
pilha1.pus... | ALGO | 0.900425 | 4.459014 |
51adc427-06d3-4581-b9ae-443d0d4b37b2 | Ryosel/programmers | ํ๋ก๊ทธ๋๋จธ์ค/unrated/181929.โ
์์๋ค์โ
๊ณฑ๊ณผโ
ํฉ/์์๋ค์โ
๊ณฑ๊ณผโ
ํฉ.cpp | #include <string>
#include <vector>
#include <cmath>
using namespace std;
int solution(vector<int> num_list) {
int mul = 1;
int sum = 0;
int answer = 0;
for(int i : num_list){
mul *= i; sum += i;
}
if(mul < pow(sum, 2)) answer = 1;
else answer = 0;
return answer;
} | ALGO | 0.999727 | 4.762487 |
1edaea45-6ca0-4d94-a631-a81398528dae | Akhileshramks/LeetCode_Solution | 0210-course-schedule-ii/0210-course-schedule-ii.cpp | class Solution {
public:
vector<int> findOrder(int n, vector<vector<int>>& prerequisites) {
queue<int> q;
vector<vector<int>> adj(n);
vector<int> indegree(n,0);
for(auto& i : prerequisites){
adj[i[1]].push_back(i[0]);
indegree[i[0]]++;
}
for(... | ALGO | 0.999992 | 6.406217 |
b8e56917-5a9c-480a-83ba-1eadfeea32b2 | amit1078-en/Data_Structure_And_Algorithms | Hashing/hashing_all_op.cpp | #include<bits/stdc++.h>
#define endl '\n'
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
int Linear[1000001];
int Linear_Replacement[1000001];
void linear_probling_with_replacement(int data,int size)
{
if(Linear_Replacement[... | ALGO | 0.999949 | 3.713723 |
5e8e4024-9407-40b8-aa62-fa8ec0bcb69d | rachitsainii/Leetcode-Solved | 2094-remove-stones-to-minimize-the-total/2094-remove-stones-to-minimize-the-total.cpp | class Solution {
public:
int minStoneSum(vector<int>& piles, int k) {
priority_queue<int> heap(piles.begin(), piles.end());
while(k > 0){
int top = heap.top();
top -= floor(top / 2.0);
cout << top << endl;
heap.pop();
heap.push(top);
... | ALGO | 0.999676 | 5.241255 |
08b5ff32-cd3d-4908-9e0a-58acb75e321a | ishandutta2007/codeforces | kdvinit/normal/1626/C.cpp | /*
K.D. Vinit /,,/
Problem - C
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
int sum2(int n)
{
int ans = (n*(n+1))/2;
return ans;
}
void solve()
{
int n;
cin>>n;
int k[n+1], h[n+1];
for(int i=1; i<=n; i++) cin>>k[i];
for(int i=1; i<=n; i++) cin>... | ALGO | 0.99996 | 3.640681 |
5b935b09-b350-4f1b-8176-77b5e7224e1a | kartavya21-dot/Cpp_everything | L009/02max_min.cpp | #include <iostream>
#include <limits.h>
using namespace std;
int getMax(int num[], int n)
{
int maxi = INT_MIN;
for (int i = 0; i < n; i++)
{
maxi = max(maxi, num[i]);
// if (num[i] > max)
// {
// max = num[i];
// }
}
return maxi;
}
int getMin(int num[]... | ALGO | 0.999658 | 4.656506 |
00cac5e3-4aa4-42e2-adda-70be05e4d196 | t0whid/Solved-Problem | Codeforces/940A. Points on the line.cpp | #include<bits/stdc++.h>
#define ll long long
#define pi acos(-1.0)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define case(a,b) printf("Case %lld: %lld\n",a,b)
#define pf(a) p... | ALGO | 0.999827 | 3.249571 |
92554df2-9cc3-4010-9b97-ac144e901006 | Sudeep2k2/Leetcode | 0026-remove-duplicates-from-sorted-array/0026-remove-duplicates-from-sorted-array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums)
{
int n = nums.size();
int j = 1;
if (n == 0)
{
return 0;
}
for (int i = 1; i < n; i++)
{
if (nums[i] != nums[i - 1])
{
... | ALGO | 0.9999 | 6.491904 |
8bce852e-37c8-45bd-93d3-67fe77885c23 | Donut-the-1st/Truss-Solver | codegen/lib/tensionCalculator3/xnrm2.cpp | // Include files
#include "xnrm2.h"
#include "coder_array.h"
#include <cmath>
// Function Definitions
namespace coder {
namespace internal {
namespace blas {
double xnrm2(int n, const ::coder::array<double, 2U> &x, int ix0)
{
double y;
y = 0.0;
if (n >= 1) {
if (n == 1) {
y = std::abs(x[ix0 - 1]);
... | ALGO | 0.991258 | 5.772293 |
94b0aa81-4b39-4ca3-b00f-26844c973419 | bossxu/acm | cf/edu48/b.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<cmath>
#include<vector>
#include<set>
#include<cstdlib>
#include<map>
using namespace std;
#define INF 0x3f3f3f3f
const double eps = 1e-6;
#define ll long long
const int maxn = 1e9+7;
#define clr(a,x) mems... | ALGO | 0.999893 | 3.283536 |
1b6f9ee6-a5c7-4183-8853-d8fc3f4f5365 | NevilMangukiya/C_plus_plus | ASSIGNMENT 33/ASS066.cpp | #include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
class String
{
private:
char a[100], b[100], c[100], name1[100], name2[100];
public:
String()
{
cout<<endl<<" Enter Your name: ";
cin>>this->name1;
cout<<" Enter Dare 1: ";
fflush(stdin);
gets(this->a);
cout... | ALGO | 0.982723 | 3.278526 |
5c7cfba5-d198-4727-946e-d39c01ff382b | MohanManjhi/collegelife | DSA with c++/CodeForces/Dubstep.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
for (int i = 0; i < s.length(); i++)
{
if (s[i]=='W' && s[i+1]=='U' && s[i+2]=='B')
{
i+=2;
cout<<" ";
}else{
cout<<s[i];
}
}
return 0;
} | ALGO | 0.999505 | 3.425337 |
aeee089e-89eb-4c53-99f5-314cca5d497e | lyfeng001/ROS_Learning | src/snake_test/src/snake_control_gazebo_serpentine_PY.cpp | // created by cherryblossomnight on 2022/10/25
// it write to 18 joint snake robot
#include "ros/ros.h"
#include "std_msgs/Float64.h"
#include "sensor_msgs/JointState.h"
#include <snake_test/Serpentine.h>
#include <vector>
#include <string>
#include <nav_msgs/Path.h>
#include <geometry_msgs/Quaternion.h>
#include <geo... | ALGO | 0.992369 | 3.745385 |
54830e13-0474-44a7-8846-a62be85a8abc | shubhamcodingblocks/G9 | 30-10-2023/divisible3.cpp | #include<iostream>
using namespace std;
int digitsSum(int num){
int sum = 0;
while(num!=0){
int lastDigit = num % 10;
sum += lastDigit;
num = num/10;
}
return sum;
}
int main(){
int n;
cin >> n;
int a[100000];
for(int i=0;i<n;i++){
cin >> a[i];
}
int sum = 0;
for(int i=0;i<n;i++){
sum += digitsSu... | ALGO | 0.999843 | 4.075769 |
908ba011-f45e-4344-8798-8dd2539faade | Avriox/BISAM | src/modelSel_regression.cpp | // we only include RcppArmadillo.h which pulls Rcpp.h in for us
#include "RcppArmadillo.h"
// via the depends attribute we tell Rcpp to create hooks for
// RcppArmadillo so that the build process will know what to do
//
// [[Rcpp::depends(RcppArmadillo)]]
//Include other headers
#include "cstat.h"
#include "crossprod... | ALGO | 0.994201 | 4.588172 |
bb01ad2f-fbc6-4586-bf38-d06408e30596 | Geeky-5hubham/DSA-Sheet-Questions | Longest increasing subarray - GFG/longest-increasing-subarray.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
long int lenOfLongIncSubArr(long int arr[], long int n) {
long long int ans = 1;
long long int res = LONG_MIN;
//long long int n = .size();
long long int curr = arr[... | ALGO | 0.999739 | 6.212803 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.