uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7c9993ce-a27f-4072-b225-ef890ccee8fe | YJ17/codetree-TILs | 240421/이상한 진수 2/awkward-digits-2.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
string a;
int num = 0, max = 0;
cin >> a;
for(int j = 1; j < (int)a.size(); j++){
if(a[j] == '1'){
a[j] = '0';
}
else {
a[j] = '1';
}
for(i... | ALGO | 0.999981 | 4.752366 |
15bd6ecb-11ec-407b-8452-536d4d7bae6c | nguyentrunghieu15/Codeforces | Minimums_and_Maximums.cpp | #include <iostream>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
int l1,r1,l2,r2;
cin>>l1>>r1>>l2>>r2;
if(l1<=l2){
if(l2<=r1){
cout<<l2<<endl;
}else{
cout<<l1+l2<<endl;
}
}else{
if(l1<=r2){
cout<<l1<<endl;
}else{
cout<<l1+l2<<endl;
}
}
}
return 0;
}
| ALGO | 0.999585 | 3.177076 |
1501302e-7faa-4a11-8d06-46358b5e2bcf | jaydcarlson/netmf-community-ports | DeviceCode/pal/OpenSSL/OpenSSL_1_0_0/crypto/ecdh/ech_key.cpp | /* crypto/ecdh/ecdh_key.c */
#include "ech_locl.h"
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
extern "C" int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
EC_KEY *eckey,
void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen))
{
ECDH_DATA *ecdh = ecdh_check(eck... | TOOL | 0.990024 | 4.767568 |
18306f05-4702-4b53-b080-611e116e1a1b | BaileySri/Practical-Software-Defense-for-GPS-Spoofing-on-a-Hobby-UAV | libraries/Filter/ModeFilter.cpp | #include "ModeFilter.h"
// Constructor
template <class T, uint8_t FILTER_SIZE>
ModeFilter<T,FILTER_SIZE>::ModeFilter(uint8_t return_element) :
FilterWithBuffer<T,FILTER_SIZE>(),
_return_element(return_element),
drop_high_sample(true)
{
// ensure we have a valid return_nth_element value. if not, revert... | ALGO | 0.967574 | 6.446736 |
e6647ed5-b9a0-49ab-ac01-bdf21ccf5b8e | SJ110/leetcode_solution | 80. 删除有序数组中的重复项 II.cpp | /**
markDirty 遇到相等的就markDirty一下,表示计数两次,
否则表示计数一次。
在两个数不想等时记一次数。
循环结束后在做一个兜底处理
*/
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if(nums.size() <= 2) return nums.size();
bool markDirty = false;
int slow = 0, fast = 1;
int retIndex = 0;
while(fast < num... | ALGO | 0.999955 | 5.819676 |
a7b3d291-9a3c-4814-81aa-31ce115c4b15 | sahilsingh2002/LeetCode-DSA | 136-single-number/single-number.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int x =0;
for(int i:nums){
x^=i;
}
return x;
}
}; | ALGO | 0.999955 | 5.524185 |
31bcec63-2f75-46bf-917b-f4fbc0ea4ca3 | NidoSen/CMU15-445 | src/storage/page/b_plus_tree_internal_page.cpp | #include <iostream>
#include <sstream>
#include "common/exception.h"
#include "storage/page/b_plus_tree_internal_page.h"
namespace bustub {
/*****************************************************************************
* HELPER METHODS AND UTILITIES
******************************************************************... | TOOL | 0.856908 | 4.650664 |
1b8e0bf5-c741-4fe1-a618-6fecfd8a7363 | MaTianmao/src | src/boost/libs/graph/example/edge-connectivity.cpp | namespace boost
{
template < typename Graph >
std::pair < typename graph_traits < Graph >::vertex_descriptor,
typename graph_traits < Graph >::degree_size_type >
min_degree_vertex(Graph & g)
{
typename graph_traits < Graph >::vertex_descriptor p;
typedef typename graph_traits < Graph >::degree_s... | ALGO | 0.999246 | 7.146661 |
defcea39-28c1-4901-8159-11a4cf46e997 | zaowen/Euler | prob045/45.cpp | /************************************************************************
Program:
Author: ZArthur
************************************************************************/
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
unsigned long int HEX( int n )
{
return n * ( (2 * n) - 1 );
}
u... | ALGO | 0.998887 | 3.927958 |
78d6d033-375c-426a-bec9-e9d1e3f17aab | alibaba/nann | blaze-benchmark/thirdparty/boost_1_53_0/libs/heap/examples/interface.cpp | #include <iostream>
#include <iomanip>
#include "../../../boost/heap/fibonacci_heap.hpp"
using std::cout;
using std::endl;
using namespace boost::heap;
//[ basic_interface
// PriorityQueue is expected to be a max-heap of integer values
template <typename PriorityQueue>
void basic_interface(void)
{
PriorityQueue ... | ALGO | 0.98635 | 4.902658 |
6e48122c-c63c-4b0d-9324-dfe18c9f0f3d | tetrafintech/tetra | src/rpcclient.cpp | #include "rpcclient.h"
#include "rpcprotocol.h"
#include "ui_interface.h"
#include "util.h"
#include <set>
#include <stdint.h>
using namespace std;
using namespace json_spirit;
class CRPCConvertParam
{
public:
std::string methodName; //! method whose params want conversion
int paramIdx; //! 0-base... | CONFIG | 0.949218 | 6.837204 |
b3cd7b8f-9398-4fc7-92bb-d3816b8c5dfc | zhj12138/CalcMethods-HITSZ-2021 | Homework/2-1.cpp | #include <bits/stdc++.h>
using namespace std;
const double e = 0.0005;
double f(double x) { return x * x * x - 2 * x - 5; }
double divide(double a, double b){
double mid = (a + b) / 2;
double fmid = f(mid);
cout << a << " " << mid << " " << b << " " << fmid << endl;
if(mid - a <= e) return mid;
if(... | ALGO | 0.999792 | 3.929011 |
2dc704d3-0730-4ea2-b333-a2dcade84fcd | N1237846/DetectingOnlineCodeSimilarity | Dissertation_N1237846/C++/Type03CombineCPPDataset/28.cpp | #include<iostream>
#include<math.h>
int main()
{
//program to find the cube of a number
int a;
std::cout<<"Enter a number : ";
std::cin>>a;
//1. using * operator
std::cout<<a*a*a<<std::endl;
//2. pow() function
std::cout<<pow(a,3)<<std::endl;
return 0;
} | TOOL | 0.992405 | 3.651954 |
f2e3a66b-754a-4bda-9e58-7afe3b6960ef | Altynaikurvanekkyzy04/premia | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
fe834e2a-102e-46cc-a8b8-5fac3cecd84b | puffyyy/coding | C++ code/course code/algorithm/class_2/c.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
using namespace std;
typedef long long int ll;
const int MS = 1e5 + 5;
int a[MS], b[MS];
int dp[2][MS];
int main()
{
// ios::sync_with_... | ALGO | 0.999885 | 3.248037 |
a28a7419-09ab-4eb5-b714-e26cc8a16976 | Psingh12354/C | MilesKiloConversion.cpp | #include<stdio.h>
int main()
{
int miles=26,yards=385;
double kilometers;
kilometers=1.609*(miles+yards/1760.0);
printf("\n Marathon is %lf kilometers\n\n",kilometers);
return 0;
}
| ALGO | 0.987822 | 3.38786 |
3ca69619-7477-43c5-8314-3981b2f55d02 | mygit021/DSA_learn | sorting/selection.cpp | #include <iostream>
using namespace std;
void printarray(int* a, int length);
void swapArrayElement(int* a, int position1, int position2);
void selection(int* a, int length);
int main (){
// int arr[] = {13, 9, 15, 5, 45, 789, 98, 68};
int arr[] = {5, 1 , 3 , 4 , 8, 7, 9, 0, 5, 2};
int length = sizeof(arr... | ALGO | 0.999935 | 4.545205 |
8203bf4b-5867-481d-9632-ebf19544bd7d | abhilashGit-01/DSA | STACKS/POSTFIXevaluation.cpp | #include<iostream>
#include<stack>
using namespace std;
int solve (int val1,int val2,char ch){
if(ch=='+') return val1+val2;
else if(ch=='-') return val1-val2;
else if(ch=='*') return val1*val2;
else return val1/val2;
}
int main(){
string s="79+4*8/3-";
//we need only one stack
stack<int>val... | ALGO | 0.999896 | 4.058518 |
c79ce970-9fac-4783-b55a-45f526eec938 | 2sevenabhi/DSA-Questions | 0373-find-k-pairs-with-smallest-sums/0373-find-k-pairs-with-smallest-sums.cpp | class Solution {
public:
struct Vector3{
int x,y,z;
};
struct CompareVector3 {
bool operator()(Vector3& v1,Vector3& v2) {
int sum1=v1.x+v1.y;
int sum2=v2.x+v2.y;
return sum1>sum2;
}
};
vector<vector<int>> kSmallestPairs(vector<int>& v1, vec... | ALGO | 0.999992 | 5.112923 |
33053fc4-de7f-4ecd-8531-2361473b894f | SLIIT-FacultyOfComputing/tutorial-02b-IT21222740 | tute03.cpp | /*Exercise 3 - Repeatition
Convert the C program given below which calculates the Factorial of a number that you input from the keyboard to a C++ program.
Please Note that the input command in C++ is std::cin. This is a representation of the Keyboard.*/
#include <iostream>
using namespace std;
int main()
{
int n... | ALGO | 0.999354 | 3.190208 |
04052fc4-f419-4744-b725-1617860ccc0d | UnbDroid/Trufes2019 | examples/trek2.cpp | #define ENCODER_L 2
#define ENCODER_R 1
#define MOTOR_LEFT 1<<0
#define MOTOR_RIGHT 1<<1
#define MAXIMUM_VOLTAGE 7
#define MINIMUM_VOLTAGE 0
#define SAMPLES 10000
#define N_PERIODS 4
// 0 for square, 1 for triangular wave
#define TRIANGULAR 1
// Period of sampling in seconds
#define PERIOD 0.002
#include <cstdio>
... | TOOL | 0.910602 | 4.304574 |
448a5404-a0f5-468c-9d06-10b090e28bae | dpariag/leetcode | binary_tree_preorder.cpp | // Leetcode: https://leetcode.com/problems/binary-tree-preorder-traversal/description/
// Given a binary tree, return the preorder traversal of its nodes' values.
// Approach: Use a stack to store the next node to be visited, visit it then emplace right/left children.
#include <vector>
#include <stack>
#include <iost... | ALGO | 0.999961 | 7.019099 |
7dd80b11-a7e0-4791-81f7-a61627be9015 | DA96/mca-204-Network-protocols--Visual-simulation | stop&wait.cpp | // VISUAL SIMULATION OF STOP AND WAIT PROTOCOL
// Author : DIVYA AGARWAL
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
using namespace std;
void drawSender();
void drawReceiver();
void drawFrame(int xi,int yi,int seq_no);
void drawAck(int xi,int yi,i... | ALGO | 0.986497 | 4.497362 |
c9102d94-51b7-46fd-ba4b-82e93ee38cf5 | ITRussell/Courses | Grokking/Old/TwoPointers/conceptual/squareSortedArray.cpp | /*
Given a sorted array, create a new array containing squares of all the number of the input array in the sorted order.
Example 1:
Input: [-2, -1, 0, 2, 3]
Output: [0, 1, 4, 4, 9]
Example 2:
Input: [-3, -1, 0, 1, 2]
Output: [0 1 1 4 9]
*/
class SortedArraySquares {
public static int[] makeSquares(int[] arr) {
... | ALGO | 0.999259 | 5.764784 |
4039995e-855e-4587-a3a1-767ff4dd2602 | MihirSinghYadav/programming-basics | C++/Beginning C++/14.cpp | #include<iostream>
#include<string>
using namespace std;
void usage()
{
cout<<endl;
cout<<"calc arg1 op arg2"<<endl;
cout<<"arg1 and arg2 are the arguments"<<endl;
cout<<"op is an operator, one of +-/*"<<endl;
}
int main(int argc,char *argv[])
{
if(argc!=4)
{
usage();
return 1;
... | TOOL | 0.997733 | 4.445637 |
4d7878bd-463b-4db5-a1f2-956806ef9f26 | MinchangSung0223/RTDualArm | include/QT/QtWidgets/QtFunctions.cpp | #include "QtFunctions.h"
#include <iostream>
using namespace std;
double minimalStep(double scaleSize, int steps)
{
scaleSize = std::abs(scaleSize);
double ms = scaleSize/steps;
double fractions[]={5,2,1};
double multiply = 10;
double fraction = 1.0;
double test;
if (static_cast<int>(ms)<=5) mult... | ALGO | 0.997724 | 3.103561 |
bd65d09f-ed6f-450f-9a22-e5c6beebc659 | abhinavrapartiwar/DSA-Journey | Linked List/Questions/Reverse_node_in_k_groups_2nd_way.cpp | #include <bits/stdc++.h>
using namespace std;
struct node
{
int data;
struct node *next;
node(int x)
{
data = x;
next = NULL;
}
} * head;
struct node *reverse_in_k(struct node *head, int k)
{
struct node *curr = head, *prev = NULL, *next = NULL;
int count = 0, flag = 0;
... | ALGO | 0.999934 | 3.284347 |
ef92578b-9b25-4f86-b8bc-c1142d6523d2 | 1018weijia/CPlusPlus_Practice_Projects | text_reading/text_reading.cpp | #include"text_reading.h"
using namespace std;
#include<vector>
#include<fstream>
#include <algorithm>
//캯,ļΪβΣļ
text_reading::text_reading(string file_where)
{
fstream file;
file.open(file_where, ios::in);
char c;
file >> noskipws;//űֱӺ
string sentence;
while (!file.eof())//δļĩβʱѭ
{
sentence = "";
file >> c... | TOOL | 0.957879 | 3.021629 |
990b9f81-29f9-4e75-b14a-8ac8989653a4 | Yash12-cloud/Leetcode-sol | 0160-intersection-of-two-linked-lists/0160-intersection-of-two-linked-lists.cpp |
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
ListNode* a = headA;
ListNode* b = headB;
int lenA = 0;
int lenB = 0;
bool say = false;
while(a != NULL){
lenA++;
a = a->next;
}
whil... | ALGO | 0.999902 | 5.245465 |
e58907fa-9d42-436b-88ac-f0557c1bb0ca | YohannDR/Xnor | Core/externals/include/jolt/Physics/Character/CharacterVirtual.cpp | #include <Jolt/Jolt.h>
#include <Jolt/Physics/Character/CharacterVirtual.h>
#include <Jolt/Physics/Body/Body.h>
#include <Jolt/Physics/PhysicsSystem.h>
#include <Jolt/Physics/Collision/ShapeCast.h>
#include <Jolt/Physics/Collision/CollideShape.h>
#include <Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h>
#includ... | TOOL | 0.974788 | 3.834652 |
c284a73b-9ace-462c-9878-cdcc78545ae0 | permin/Olymp | codejam/2016/round2/B/problem.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <st... | ALGO | 0.999861 | 5.473134 |
a23fcf7c-4366-40f2-9171-94f0af2c1f67 | Harini-Pavithra/Solve-CPP-HackerRank | LowerBound-STL.cpp | Input Format
The first line of the input contains the number of integers N.The next line contains N integers in sorted order. The next line contains Q, the number of queries. Then Q lines follow each containing a single integer Y.
Note: If the same number is present multiple times, you have to print the first index a... | ALGO | 0.999993 | 4.511239 |
bd2ad251-833c-4a4c-affd-8be9c3865c47 | GARVS0205/Achievements | MaxSubArray.cpp | #include<iostream>
#include<climits>
using namespace std;
int main()
{
int array[5]={1,2,3,4,-5};
int n=5;
int max_sum= INT_MIN;
int start=-1;
int end=-1;
for(int i=0;i<n;i++)
{
for(int j=i;j<5;j++)
{
int sumOfCurrentSubArray=0;
for(int k=i;k<=j;k++)
... | ALGO | 0.99958 | 3.500627 |
77062e58-bd6c-482c-ba9e-e45542506b99 | Dan13llljws/CP-Solutions | COCI/coci14c2p4.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int read(){int s=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){s=(s<<3)+(s<<1)+ch-'0',ch=getchar();}return s*f;}
#define re read()
const int mod = 1e9 + 7, MM = 1005;
int n, m, t, g[MM][MM], h[MM], ... | ALGO | 0.999961 | 3.031442 |
f93c83ab-33ac-4ee6-a40c-69be5fd751f0 | ishandutta2007/codeforces | elegia/normal/1677/A.cpp | /*
*/
#include <cmath>
#include <cassert>
#include <cstring>
#include <algorithm>
#include <complex>
#include <limits>
#include <functional>
#include <random>
#include <chrono>
#include <stack>
#include <bitset>
#include <numeric>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue... | ALGO | 0.999932 | 4.366232 |
c972da64-809a-4b6d-99c1-cf656fb51306 | sjtao98/Leetcode_backup_2 | find-k-th-smallest-pair-distance/find-k-th-smallest-pair-distance.cpp | class Solution {
public:
int smallestDistancePair(vector<int>& nums, int k) {
int n = nums.size();
sort(nums.begin(), nums.end()); //O(nlogn)
int l = 0, r = nums[n-1] - nums[0]; //smallest distance and largest distance
int m;
while(l < r){
m = l + (r - l)/2;
... | ALGO | 0.999995 | 5.871086 |
0b72f7ab-c81b-46f1-ae99-f82faf75f1e8 | ishandutta2007/codeforces | tzc_wk/normal/651/A.cpp | #include <iostream>
using namespace std;
int n, m;
int main(){
cin>>n>>m;
int cnt=0;
while(n>0&&m>0){
if(n<2&&m<2) break;
if(n<m) swap(n, m);
n-=2;m++;
cnt++;
}
cout<<cnt<<endl;
return 0;
} | ALGO | 0.99991 | 3.619018 |
af1b3144-0515-479e-b33a-b6c36a23c7a4 | adarshika2005/array | swap.cpp | #include <iostream>
using namespace std;
void printArray(int arr[], int n) {
for (int i = 0; i < n; i++) {
cout << arr[i] << " ";
}
cout << endl;
}
void swapAlternate(int arr[], int size) {
for (int i = 0; i < size - 1; i += 2) {
swap(arr[i], arr[i + 1]);
}
}
int main() {
int ... | ALGO | 0.999501 | 5.701216 |
a8cd9407-9088-4ca4-be3b-826bddfc5aaf | Harshstar/LeetCode_Sol | 414-third-maximum-number/414-third-maximum-number.cpp | class Solution {
public:
int thirdMax(vector<int>& nums) {
sort(nums.begin(),nums.end(),greater());
long mini=LONG_MAX;
if(nums.size()<3)
return nums[0];
int count=0;
for(int i=0;i<nums.size();i++)
{
if(mini>nums[i])
{
mini=nums[i];
... | ALGO | 0.999979 | 5.421816 |
6f81dbcb-aa8a-4256-8370-31d588efd5ab | AryanThakur01/Cpp-Practice | T64.cpp | #include <iostream>
using namespace std;
template <class T>
class vector
{
int size;
public:
T *arr;
vector(int m)
{
size = m;
arr = new T[size];
}
T dotProduct(vector &v)
{
T d = 0;
for (int i = 0; i < size; i++)
{
d += this->arr[i] * v.... | ALGO | 0.999619 | 4.240325 |
a681a25b-645a-45cc-bff8-bca8b573a8c2 | FlavScheidt/bcc | ci854/Applications/Contrib/Eigen/doc/examples/Tutorial_ArrayClass_cwise_other.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXf a = ArrayXf::Random(5);
a *= 2;
cout << "a =" << endl
<< a << endl;
cout << "a.abs() =" << endl
<< a.abs() << endl;
cout << "a.abs().sqrt() =" << endl
<< a.abs().sqrt() << endl... | ALGO | 0.96225 | 3.146753 |
d3449465-673a-4e45-b44c-b8ada3e795d3 | SLIIT-FacultyOfComputing/tutorial-03b-it21229220 | exercise03.cpp | #include <iostream>
using namespace std;
int volume(int height, int width, int length);
// 1. Define a structure called Box
// have the integer data types Height, Width, Length
struct
{
int height;
int width;
int lenght;
} box1,box2;
// Do not change the main function
int main() {
// 2. Create a variable ... | TOOL | 0.917 | 4.026515 |
abbc3d39-7239-412e-bcbc-379d09e4e7d6 | rsmwall/ifpi-ads-course | module-ii/estrutura-dados-i/avaliacoes/avaliacao-semestral/prova-pratica/q14.cpp | #include <stdio.h>
#include "filaIncompleta.h" // fila de char
int main (void) {
Fila F = fila(5);
for (int i=0; i<=3; i++) enfileira ('A'+i, F);
while( !vaziaf (F)) printf("%c\n", desenfileira (F)); destroif (&F);
return 0;
}
//Enfileira A, B, C, D, e depois faz o print de cada os desenfileiran... | ALGO | 0.983573 | 4.108486 |
1058f4a4-272d-4fc6-a0b9-24b41fcb7826 | SoftWiser-group/EBPC4CPO | Source/DataSet/codeforces/1736/1736-D.cpp | #include<bits/stdc++.h>
#include<unordered_map>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistic... | ALGO | 0.994477 | 3.367746 |
3ba2bb2b-7940-48ec-bfdf-213bfd7ba4a0 | qyjohn/UsydSort | Validate.cpp | #include <iostream>
#include <fstream>
#include <queue>
#include <vector>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
using namespace std;
int main(int argc, char* argv[])
{
char *dir = argv[1];
char *out = argv[2];
char command[1024];
std::vector<std::string> files;
if (argc < 3)
{
cou... | TOOL | 0.960607 | 5.03286 |
87882034-5304-4512-aea1-b7e3efa79822 | arkasnatapal/College | DSA/Problems on Arrays/Medium/Leader_in_an_array.cpp | // // BRUTE FORCE APPROACH
// #include <bits/stdc++.h>
// using namespace std;
// void leaders(int n, int arr[]) {
// for (int i = 0; i < n; i++) {
// bool isLeader = true;
// for (int j = i + 1; j < n; j++) {
// if (arr[j] > arr[i]) {
// isLeader = false;
// ... | ALGO | 0.999994 | 5.965415 |
a981f466-4c06-4c6c-8b1c-1753ed14e00a | vishal1641/Data-Structures-and-Algorithms | 0017-letter-combinations-of-a-phone-number/0017-letter-combinations-of-a-phone-number.cpp | class Solution {
public:
void number(string digits,int index,string output,vector<string>&ans,string m[]){
if(index>=digits.size()){
ans.push_back(output);
return;}
int n=digits[index]-'0';
string value=m[n];
for(int i=0;i<value.size();i++){
output.push_back(value[i]);
number(digits,index+1,output,ans,m);
o... | ALGO | 0.999969 | 6.727244 |
6430662a-2476-4595-9116-05461f9162e4 | akoadwin/Bucket-List-App | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
af9aad78-a492-4347-a110-968bbd4721dd | 1110AnRan/Leetcode | daily/1749.任意子数组和的绝对值的最大值.cpp | /*
* @lc app=leetcode.cn id=1749 lang=cpp
*
* [1749] 任意子数组和的绝对值的最大值
*/
// @lc code=start
class Solution {
public:
int maxAbsoluteSum(vector<int>& nums) {
partial_sum(nums.begin(), nums.end(), nums.begin());
auto [a, b] = minmax_element(nums.begin(), nums.end());
return max(*b, 0) - min(... | ALGO | 0.999917 | 5.859848 |
97d53986-a541-417b-8566-a5d68d04b5ae | Penguin5681/LeetCodeSolutions | FindPlayersWithZeroorOneLosses.cpp | // 2225. Find Players With Zero or One Losses
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<vector<int>> findWinners(vector<vector<int>>& matches) {
unordered_map<int, int> losses;
vector<vector<int>> result(2);
for (auto& match : matches) {
l... | ALGO | 0.999921 | 5.657156 |
377ca44f-ccc2-4595-af49-26e8a2165d39 | kanishka-p1/DSA_Codes | Binary Trees/Striver/print_All_nodes_at_k_disteance.cpp | /************************************************************************** QUESTION *******************************************************************************/
/*
Given the root of a binary tree, the value of a target node target, and an integer k, return an array of the values of all nodes that have a distance ... | ALGO | 0.999995 | 6.474252 |
09593b7e-34ca-4e25-8219-ac64b4578a34 | ishandutta2007/codeforces | maspy/normal/102/A.cpp | #line 1 "main.cpp"
#include <bits/stdc++.h>
#line 3 "/home/maspy/library/my_template.hpp"
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T> using vc = vector<T>;
template <class T> using vvc = vector<vc<T>>;
template <class T> using v... | ALGO | 0.999937 | 5.039762 |
58be1553-2d1b-4cbd-9b91-a78e68a62f49 | Avninder99/LeetCode_GFG_Solutions | 0886-possible-bipartition/0886-possible-bipartition.cpp | class Solution {
public:
void dfs(int node, vector<vector<int>>&drec, bool &res, int alt, vector<int>&rec){
alt *= -1;
for(auto itr: drec[node]){
if(rec[itr] == 0){
rec[itr] = alt;
dfs(itr, drec, res, alt, rec);
}else if(rec[itr] == rec[node]){... | ALGO | 0.999948 | 5.796952 |
d6708f4e-a244-4fa6-8a64-5ff4f5c9c7f6 | nattee/algo-class | exercise/ex05/h1_rank/solution/winning.cpp | #include <vector>
#include <iostream>
#include <stack>
using namespace std;
int n;
vector<vector<bool>> edge;
stack<int> s;
vector<bool> visited;
vector<int> component; // component id
vector<vector<int>> comp_list; // list of node in each component
//new graph
int n2; //num node
vector<vector<bool>> e2;
void dfs... | ALGO | 0.999963 | 4.316297 |
553aa4fd-a06d-4076-b348-fcc4909b14b9 | danishzulfiqar/CodeChef | Minimum Number of coins/code.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
if (n % 5 != 0)
cout << -1 << endl;
else if (n % 10 == 0)
cout << n / 10 << endl;
... | ALGO | 0.999591 | 4.706584 |
361df138-78be-4b0d-aeaa-c284c0c3482e | congshuW/HackerRank | Algorithms/Warm Up/Angry_Children.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int getMinimumUnfairness(vector<int> candies, int K)
{
sort(candies.begin(), candies.end());
int N = candies.size();
int best = 1 << 30;
for (int i = 0; i + K <= N; i++)
{
if (candies[i + K - 1] - candies[i] ... | ALGO | 0.999857 | 4.420606 |
45b6e357-af8b-4dbd-a851-dd3e8db96fbe | world-privacy-and-identity-association/cassiopeia | src/crypto/CRL.cpp | #include "CRL.h"
#include <openssl/ssl.h>
#include <log/logger.hpp>
#include <exception>
CRL::CRL( std::string path ) {
std::shared_ptr<BIO> bio( BIO_new_file( path.c_str(), "r" ), BIO_free );
crl = std::shared_ptr<X509_CRL>( PEM_read_bio_X509_CRL( bio.get(), 0, NULL, 0 ), X509_CRL_free );
if( !crl ) {
... | TOOL | 0.970513 | 6.687744 |
a75b86fb-8d49-4f3d-876a-4607a20841e7 | heathkh/iwct | snap/opencv2/features2d/src/fast.cpp | /*
The references are:
* Machine learning for high-speed corner detection,
E. Rosten and T. Drummond, ECCV 2006
* Faster and better: A machine learning approach to corner detection
E. Rosten, R. Porter and T. Drummond, PAMI, 2009
*/
#include "precomp.hpp"
namespace cv
{
static void makeOffsets(int pixel[], i... | ALGO | 0.999084 | 6.928669 |
f9f8ce6b-8e61-4ef1-8a29-b8991968372f | GMANOHAR-1/Strivers-SDE-Sheet-Challenge | stack and queue/stack using queue.cpp | /*
Time complexity: O(Q*N)
For each push operation O(N); O(1) for all other operations.
Space complexity: O(N)
where Q is the number of queries, N denotes the maximum number of elements in the queue.
*/
#include <queue>
class Stack {
public:
queue<int> *q1;
// Constructor.
Stack() { ... | ALGO | 0.998979 | 5.404447 |
62aeb689-96e1-4baa-9fd7-7becaa6e234a | Mansiprajapatii/DSA_Preperation | Data_Structures/Array/Sortings/SelectionSort/SelectionSort.cpp |
//SORTING IN ARRAY "SELECTION SORT"
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int a[n];
for (int i = 0; i < n; i++)
{
cin>>a[i];
}
for (int i = 0; i < n-1; i++)
{
for (int j = i+1; j < n; j++) //find smallest digit index and swap it with... | ALGO | 0.999907 | 4.462681 |
f6f438ec-39f8-4d24-8fbe-501e8acef00f | AngadSingh04/DSA-Leetcode | 78_Subsets.cpp | class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
int size = nums.size();
int total_subsets = (1<<size);
vector<vector<int>> ans;
for(int i = 0; i < total_subsets; i++){
vector<int> tmp;
for(int j = 0; j < size; j++){
i... | ALGO | 0.999911 | 6.308751 |
b6748573-40f1-4054-82f0-34ce9fd69535 | azer10tr/azer10tr | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
28c4abe3-cad9-4548-9d8c-d7308d1a7b1e | ishandutta2007/codeforces | zeliboba/normal/228/C.cpp | #include <cstdio>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<l... | ALGO | 0.999889 | 3.424527 |
e42714bc-d909-4385-b80c-9a7cb040da37 | GustavoPolicarpo/maratona | URI/AD-HOC/2922 - Classrooms.cpp | // Author: Gustavo Policarpo
// Name: Classrooms
// Level: 5
// Category: AD-HOC
// URL: https://www.beecrowd.com.br/judge/en/problems/view/2922
#include <bits/stdc++.h>
//LIFE IS NOT A PROBLEM TO BE SOLVED
#define rep(i,a,b) for( int i = (int) a; i < (int) b; i++ )
#define F first
#define S second
#define pb push_b... | ALGO | 0.999176 | 4.123355 |
92b4b8a3-8e21-4a0d-9c92-b5291971c6fe | ishandutta2007/codeforces | moririn2528/normal/1328/C.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
c... | ALGO | 0.999936 | 3.146554 |
157030cd-e50e-42ab-86e5-ea00c760bfd0 | Arpan243/CodeForces | Flip_Flop_Sum.cpp | // Flip Flop Sum
// You are given an array of n
// integers a1,a2,…,an
// . The integers are either 1
// or −1
// . You have to perform the following operation exactly once on the array a
// :
// Choose an index i
// (1≤i<n
// ) and flip the signs of ai
// and ai+1
// . Here, flipping the sign means −1
// will b... | ALGO | 0.999871 | 4.815261 |
28a25640-efa9-4a24-93e6-bc827bc93fdb | bocodev/BOCO | src/rpc/client.cpp | #include "rpc/client.h"
#include "rpc/protocol.h"
#include "guiinterface.h"
#include "util.h"
#include <set>
#include <stdint.h>
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
#include <univalue.h>
class CRPCConvertParam
{
public:
std::string methodName; //! method whose params want conversio... | CONFIG | 0.951551 | 7.000926 |
8a38675e-f8a4-4855-8a27-3711861fd929 | GitHub-Sanjit/allProgramsPhitron | PhitronAllPrograms-main/DSA/DATA STRUCTURE/Week 5/Module18/BinaryTreeHeightCount.cpp | #include<bits/stdc++.h>
using namespace std;
// Create Binary Tree class
class Node{
public:
int val;
Node *left;
Node *right;
// consturctor
Node (int val){
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
Node* input_Tree(){
// Take first input ... | ALGO | 0.999688 | 4.956594 |
cb6dc883-f1d5-4485-99b3-f5c755218d94 | giantcroc/intern-practice | LRU.cpp | #include<bits/stdc++.h>
using namespace std;
struct listnode{
int key;
int value;
listnode* prev,*next;
listnode(int key,int value):key(key),value(value),prev(nullptr),next(nullptr){}
};
class LRUCache {
public:
LRUCache(int cap) {
capacity=cap;
head=new listnode(0,0);
tail=n... | ALGO | 0.999412 | 5.149193 |
d3e4db23-352f-4e72-a39d-3f0a209f9e68 | cdsama/LeetCode | src/1011.cpp | #include "LeetCode.hpp"
/*
1011. Capacity To Ship Packages Within D Days
Medium
A conveyor belt has packages that must be shipped from one port to another within D days.
The i-th package on the conveyor belt has a weight of weights[i]. Each day, we load the ship with packages on the conveyor belt (in the order given... | ALGO | 0.999952 | 6.28551 |
9d188b0d-7b1f-4e0e-8475-704fd5a4e6de | rajnishgeek/DSandAlgorithmPracticeSolution | DFS/Longest Increasing Path in a Matrix.cpp | vector<vector<int>> dir = {{0, 1}, {1, 0}, {0, -1}, { -1, 0}};
int DFS(vector<vector<int>> &max_from_here, vector<vector<int>> &matrix, int row, int col, int n, int m)
{
if (max_from_here[row][col] != 0)
return max_from_here[row][col];
int maxi = 1;
for (vector<int> d : dir)
{
int x = r... | ALGO | 0.999994 | 6.144618 |
a580a685-dab9-452f-9cca-b7820821690f | pranjaliaditi/Competitive-Programming | 405A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>> n;
int a[n];
int i;
for(i=0;i<n;i++)
cin>> a[i];
sort(a, a + n);
for(i=0;i<n;i++)
cout << a[i] << " ";
return 0;
}
| ALGO | 0.999713 | 3.503775 |
0884658a-6f7e-4a91-9b72-8448368c0a7b | syedbilal07/cplusplus | C++ Basics/Chapter 13 - Pointers/PassingPointersToFunctions2/main.cpp | #include <cstdlib>
#include <iostream>
using namespace std;
double getAverage(int size, int *arr){
int i, sum = 0;
double avg;
for(i = 0; i < size; i ++){
sum += arr[i];
}
avg = (double)sum/size;
return avg;
}
int main(int argc, char** argv) {
// an int array with 5 elem... | ALGO | 0.978817 | 4.810427 |
c69838ef-b2b4-4b9e-a84d-83cae0450793 | ishandutta2007/codeforces | uryuuu/normal/1272/A.cpp | //#include <bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<time.h>
#include<cstdlib>
#include<unordered_map>
typedef long long ll;
#define mm(a) memset(a,0,siz... | ALGO | 0.999856 | 3.931672 |
a7b9f38e-c3e3-46d0-b510-09bd52022a9e | dn54321/Programming-Challenges | 520A - Pangram.cpp | // https://codeforces.com/problemset/problem/520/A
// SOLUTION BY DN54321
#include <iostream>
#include <string.h>
#include <ctype.h>
#include <vector>
#include <functional>
#include <algorithm>
typedef long long ll;
using namespace std;
int main() {
int n, res=26;
bool freq[26] = { 0 };
char s[200];
scanf("%d", ... | ALGO | 0.999994 | 4.197711 |
ab022559-bc2a-4cb7-88ab-990c4ca6cf49 | htungitmo420/DSA-1st-Semester | 6th Lab/LabB.cpp | #include <iostream>
#include <vector>
#include <string>
struct PriorityQueue {
std::vector<int> heap;
void siftUp(int i) {
while (i > 0) {
int parent = (i - 1) / 2;
if (heap[parent] <= heap[i]) break;
std::swap(heap[i], heap[parent]);
i = parent;
... | ALGO | 0.999899 | 4.716941 |
08f49ec7-d480-4104-9a6c-bbd19745b5b3 | ManojKumarPatnaik/Sr.SoftwareEngineerInterviewPrep | 04]. Coding Ninjas/1]. Practice/2]. Problem Lists/1]. Lists by Experts/1]. Striver SDE Sheet Problems/C++/026]. Middle of Linked List.cpp | #include <bits/stdc++.h>
/****************************************************************
Following is the class structure of the Node class:
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
... | ALGO | 0.999882 | 5.655785 |
90e81b38-7473-4701-a6a3-b8b2b1d14ee0 | FrancsXiang/DataStructure-Algorithms | dp/lcs_2.cpp | #include <iostream>
#include <algorithm>
#include <string>
#define MAXN 1001
using namespace std;
int dp[MAXN][MAXN];
//longest_common_substring
int main()
{
string s1,s2;
cin >> s1 >> s2;
for (int i = 1; i <= s1.length(); i++) {
for (int j = 1; j <= s2.length(); j++) {
if (s1[i - 1] == s2[j - 1]) dp[i][j] = ... | ALGO | 0.999936 | 4.077427 |
7425264f-302a-44ec-b8e0-cf4192a0a6eb | arpitgpta/Algorithms | fractional_knapsac.cpp | // g++ fractional_knapsac.cpp -o fractional_knapsac && ./fractional_knapsac
/*
this is a greedy based problem, we are being greedy on the paremeter "profit per unit weight"
algo:
take input in vector of pair
sort the vector in the decreasing order of ratio
loop:
if(remining ... | ALGO | 0.999971 | 4.371704 |
766fd9e8-dd8f-4a26-9cbe-4ff728980e34 | alittlekitten/AlgorithmStack | Baekjoon/Cpp/Arithmetic/B3_13228_The_REAL_Manhattan_distance.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// 13228 The REAL Manhattan distance
// 수학
int t, x1, y1, f1, x2, y2, f2;
cin >> t;
while (t--) {
cin >> x1 >> y1 >> f1 >> x2 >> y2 >> f2;
cout << abs(x1 - x2) + abs(y1 ... | ALGO | 0.998167 | 4.221578 |
c2d6cac7-9afa-429a-ab62-b8109d90235d | ToshihideMatsuda/atcoder | programs/ABC/ABC200-299/ABC272/b/main.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <unordered_map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0; i < n; i++ )
#define reps(i,m,n) for(ll i = m; i < n; i++ )
#d... | ALGO | 0.999931 | 4.208753 |
c7680852-92c1-4d7c-96fa-17570cdb6ab4 | mtytheone/Learning-cpp | EXPractice4-7/EXPractice4-7/main.cpp | #include <iostream>
#include <string>
#include <list>
using namespace std;
int main()
{
list<string> li;
string str;
do
{
cout << ":";
cin >> str;
li.push_back(str);
} while (str.length != 0);
cout << endl;
list<string>::iterator itr;
for (itr = li.begin(); itr != li.end(); itr++)
{
if (itr->leng... | TOOL | 0.919343 | 3.159684 |
6d444a08-78a7-4551-b8d5-dbaaa3b4134a | Thanalan/Computer-Graphics-Programming-in-OpenGL | Programs/Chapter_07_lighting/Prog7_1_lightingADS/Torus.cpp | #include <cmath>
#include <vector>
#include <iostream>
#include <glm\gtc\matrix_transform.hpp>
#include "Torus.h"
using namespace std;
Torus::Torus() {
prec = 48;
inner = 0.5f;
outer = 0.2f;
init();
}
Torus::Torus(float in, float out, int precIn) {
prec = precIn;
inner = in;
outer = out;
init();
}
float Toru... | ALGO | 0.850884 | 5.645627 |
cf591e77-c029-46a6-ae16-0289ea2d41e1 | ayushraut2111/Datastructure | stack/stack by linkedlist.cpp | #include<bits/stdc++.h>
using namespace std;
struct node
{
int data;
node* next;
};
struct mystack
{
node* head;
int size;
mystack()
{
head=NULL;
size=0;
}
void push(int data)
{
node* ptr=new node();
ptr->data=data;
ptr->next=head;
head... | ALGO | 0.997396 | 3.539167 |
5e8772f3-91d7-4bfb-9a95-d7533fab485e | 2745518585/code | hash.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1001,P=1000000;
int n,s;
char a[N];
int main()
{
scanf("%s",a);
n=strlen(a);
for(int i=0;i<=n-1;++i)
{
int w=0;
for(int j=i;j<=n-1;++j)
{
w=(w+a[j])%P;
s=(s+w*(j-i+1)%P)%P;
}
}
printf... | ALGO | 0.999867 | 4.005304 |
c3182e99-30d7-47af-8ef1-b91597bd21ea | mdshohed/Contest-Template | CSES/Tree/Tree Distances I.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define getbit(x,i) (((x)&(1ll<<(i))) != 0)
#define pii pair<int,int>
#define ll long long
const int mx = 2e5 + 7;
vector<int> g[mx];
vector<int> ans(mx);
vector<int> subSize(mx);
vector<int> maxValue(mx);
vector<int> dist(mx);
int ... | ALGO | 0.999897 | 4.777165 |
1bde790c-a71e-4bce-8284-2f3649448658 | emd22/arch-engine | include/Bullet/BulletCollision/CollisionDispatch/btManifoldResult.cpp | #include "btManifoldResult.h"
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h"
///This is to allow MaterialCombiner/Custom Friction/Restitution values
ContactAd... | ALGO | 0.989412 | 6.498711 |
69e00152-eebf-4abf-8be8-157f64aaaecf | lyr-2000/code | code/2742.给墙壁刷油漆.cpp | #include <bits/stdc++.h>
using namespace std;
/* clang-format off */
#define debug 1
void print() {}
template <typename T>
void echo(const T &t) { cout << t << " "; }
template <typename T>
void echo(vector<T> const &t) {for (auto w: t) echo(w); }
template <typename T>
void echo(vector<vector<T>> const &a) { for (auto f... | ALGO | 0.999953 | 5.543177 |
0a0aaf1e-bbda-41c3-bdd7-2e7e9466dd4a | spg-one/nncase-0.2.0-beta4 | src/transforms/hlir/k210/piecewise_regression.cpp | #include <hlir/transforms/k210/piecewise_regression.h>
using namespace nncase::hlir::transforms::k210;
piecewise_regression::piecewise_regression(size_t segments_count)
: desired_segments_count_(segments_count)
{
}
std::vector<segment> piecewise_regression::fit(std::vector<point> &points) const
{
if (points.... | ALGO | 0.988442 | 6.262596 |
b0d4a2d0-7f25-4a1f-b53c-17221b6b4492 | ishandutta2007/codeforces | zero4338/normal/1039/D.cpp | #include<bits/stdc++.h>
using namespace std;
int read()
{
int ret=0;bool f=0;char c=getchar();
while(c>'9'||c<'0')f|=(c=='-'),c=getchar();
while(c>='0'&&c<='9')ret=(ret<<3)+(ret<<1)+(c^48),c=getchar();
return f?-ret:ret;
}
const int maxn=1e5+5;
int n;
struct graph
{
vector<int>e[maxn];
void add(int x,int y){e[x].... | ALGO | 0.999964 | 3.555122 |
f31963ae-9a8c-4918-a73a-979f40388302 | sinhadiptiprakash/dsa | Array/maximum_profit_by_buying_selling_share_at_most_twise.cpp | #include <bits/stdc++.h>
using namespace std;
// below approach is
// 1. create a profit array of same size as the price array
// 2. traverse the price array from right to left and for every i store the maximum profit at that point
// in this way the profit[0] will store the max_profit after buying and selling for... | ALGO | 0.999908 | 5.729311 |
2b9bf0d0-7dad-48a4-a822-a4001d1752b7 | ag2810/leetcode | 583-delete-operation-for-two-strings/583-delete-operation-for-two-strings.cpp | class Solution {
public:
int minDistance(string word1, string word2) {
int len1 = word1.length();
int len2 = word2.length();
vector<vector<int>> dp(len1 + 1, vector<int>(len2 + 1, 0));
for(int i = 0;i <= len1;i++) {
for(int j = 0;j <= len2;j++) {
... | ALGO | 0.999989 | 5.872879 |
4a20deac-0efb-47ec-b209-1276076be720 | Tonouewa-kefil/CPlusPlusProjects | Pratice/backSpace.cpp | #include <iostream>
using namespace std;
string typedString(string str)
{
int i = 0;
int j = 0;
string typed = "";
cout << typed;
while (str[i] != '\0')
{
if (str[i] == '#')
{
if (typed[0] == '\0')
{
j == 0;
}
else... | ALGO | 0.996865 | 3.668683 |
58324cd3-c817-414f-b5b7-22bd00da43a6 | vfolunin/archives-solutions | UVa Online Judge/516.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
vector<int> getPrimes() {
vector<bool> isPrime(1e5, 1);
vector<int> primes;
for (int i = 2; i < 1e5; i++) {
if (isPrime[i]) {
primes.push_back(i);
... | ALGO | 0.999871 | 3.335446 |
2bd2fe03-47b2-45d1-83fe-93d48a072f00 | ZulfahmiCP/Competitive-Programming-Recources | CSES/Introductory/Two_Knights.cpp | #include <iostream>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <numeric>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <tuple>
#include <deque>
#include <se... | ALGO | 0.999635 | 4.706467 |
3484a6ad-7809-4ea9-aa6d-ac53ae40b4aa | milleniumcore/CactusEMU | dep/g3dlite/source/System.cpp | /**
@file System.cpp
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
Note: every routine must call init() first.
There are two kinds of detection used in this file. At compile
time, the _MSC_VER #define is used to determine whether x86 assembly
can be used at all. At runtime, processor de... | TOOL | 0.885002 | 3.356018 |
cff3112d-13a4-4013-a248-3057aca8a1c2 | ncr5012/Composable_Kernel | example/21_gemm_layernorm/gemm_bias_relu_add_layernorm_xdl_naive_fp16.cpp | #include <iostream>
#include <numeric>
#include <initializer_list>
#include "ck/ck.hpp"
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "ck/tensor_operation/gpu/device/gemm_specialization.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_gemm_multiple_d_multiple_r_xdl_cshuffle.hpp"
#includ... | TOOL | 0.850701 | 7.410822 |
95059e45-4a49-4b10-b8e9-a2e1a6c5ec62 | hack-parthsharma/LeetCode | 2344-minimum-deletions-to-make-array-divisible/2344-minimum-deletions-to-make-array-divisible.cpp | class Solution {
public:
int minOperations(vector<int>& nums, vector<int>& numsDivide) {
const int gcd = getGCD(numsDivide);
sort(begin(nums), end(nums));
for (int i = 0; i < nums.size(); ++i)
if (gcd % nums[i] == 0)
return i;
return -1;
}
private:
int getGCD(const vector<int>&... | ALGO | 0.999849 | 6.293201 |
480385ff-b5fc-4eee-849d-82a25ddf7035 | aishoot/CAPSolutions | CCF201409/T4/Source.cpp | /*****************************************************************************
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
using namespace std;
int n, m, k, d;
short map[1005][1005], dir[4][2] = { { 1,0 },{ 0,1 },{ -1,0 },{ 0,-1 } };
bool within(int x, int y... | ALGO | 0.999891 | 4.278451 |
8168e95c-f0f2-4165-b9b1-d244c1479f7e | AlexanderVazov/TUES_EMCS_TERM_2 | 2-player reaction time game/lib/FastLED/src/fl/wave_simulation_real.cpp | // Based on works and code by Shawn Silverman.
#include <stdint.h>
#include "fl/clamp.h"
#include "fl/namespace.h"
#include "fl/wave_simulation_real.h"
namespace fl {
// Define Q15 conversion constants.
// #define FIXED_SCALE (1 << 15) // 32768: 1.0 in Q15
#define INT16_POS (32767) // Maximum value for int16_t
#de... | ALGO | 0.999071 | 6.288991 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.