uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
4e12adf3-7be7-418f-8f1f-1a78747bdff6 | Atul-Kashyap/APS | Catalan-Numbers.cpp | /** Print all the Catalan numbers from 0 to n, n being the user input.
* A Catalan number satifies the following two properties:
* C(0) = C(1) = 1; C(n) = sum(C(i).C(n-i-1)), from i = 0 to n-1
* Read more about Catalan numbers here:
https://en.wikipedia.org/wiki/Catalan_number
*/
#include <iostream>
using nam... | ALGO | 0.999908 | 6.495102 |
3d2f5d81-307f-4993-ae3f-94cce8a3bdb4 | kressjh/openravefork | src/libopenrave/configurationspecification.cpp | /** \file configurationspecification.cpp
\brief All definitions that involve ConfigurationSpecification
*/
#include "libopenrave.h"
#include <openrave/xmlreaders.h>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/bind/bind.hpp>
#include <boost/lexical_cast.hpp>
using boost::placeholders::_1;
using... | TOOL | 0.895277 | 3.658532 |
685322a4-9f1f-4c4c-a475-00082a070698 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_258_4.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
double xx[maxn], yy[maxn];
double dist(double x, double y, double x1, double y1, double x2, double y2) {
if ((x - x1) * (x2 - x1) + (y - y1) * (y2 - y1) <= 0)
return sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
if ((x - x2) * (x1 - x2) ... | ALGO | 0.999884 | 3.780769 |
f7942455-31d2-4bb5-b943-e00be1d82ad3 | yadavarchana123/LeetCode-Problems | 2779-maximum-beauty-of-an-array-after-applying-operation/2779-maximum-beauty-of-an-array-after-applying-operation.cpp | class Solution {
public:
int maximumBeauty(vector<int>& nums, int k) {
sort(nums.begin(), nums.end());
int i = 0, j, n = nums.size();
for (j = 0; j < n; ++j)
if (nums[j] - nums[i] > k * 2)
i++;
return j - i;
}
}; | ALGO | 0.999969 | 5.705707 |
db52e9c1-7c41-4f61-83c8-9785d99f2047 | airejtashfeen/Leetcode | (E)nim_game.cpp | #include <iostream>
using namespace std;
class Solution {
public:
bool canWinNim(int n) {
return !(n % 4 == 0);
}
};
int main() {
Solution sol;
// Test cases
int test1 = 4; // Expected output: false (the player cannot win if n is 4)
int test2 = 5; // Expected output: true (the pl... | ALGO | 0.999608 | 7.06153 |
ca907a60-10a4-4f42-a5f9-bdd9415d6feb | PhuocVinhLee/system_exam_quiz_programming | online_exam_system_backend/temp/8k4rqyzg.cpp | #include<stdio.h>
int add(int a){
int sum;
sum = a + a;
return sum;
}
int main() {
int a = 3;
int test;
test = add(a);
printf("%d", test);
return 0;
}
| ALGO | 0.949224 | 3.468997 |
dd90a2c9-e513-4e20-9a7d-0bd2b11c48b3 | himanshu111203/GeeksforGeeks | Linked List/Easy/Delete in a Singly Linked List.cpp | class Solution {
public:
/* Function to delete a node from a linked list */
Node* deleteNode(Node* head, int x) {
Node *curr=head,*prev=NULL;
if(x==1)
return head->next;
while(--x){
prev=curr;
curr=curr->next;
}
prev->next=curr->next;
... | ALGO | 0.999961 | 5.167018 |
eeb60f8e-13e2-41e7-b5cb-be0fe0b240e1 | kanwar-rajput/Training-Programs | P1.cpp | // Write a program to print the sum of two numbers defining your own function.
#include <iostream>
using namespace std;
float sum(float x , float y){
return x + y;
}
int main()
{
cout << sum(5,10) << endl;
return 0;
} | ALGO | 0.997159 | 5.22522 |
d0f234f0-9c75-4b1d-9b7c-a7fe970c74f9 | DARLINGTON-CG/DEVMET | 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.998693 | 6.797273 |
a4e59bfd-fc9a-4881-a176-782601e564b2 | Komrondevv/IELTS-MiniDairy | 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.998859 | 6.785645 |
84826365-6b38-4933-a216-1c190a230b6e | muzamil9899/dsa-essential-course | 22 Graphs/01_adj_list.cpp | #include<iostream>
#include<list>
using namespace std;
class Graph{
int V;
list<int> *l;
public:
Graph(int v){
V = v;
l = new list<int>[V];
}
void addEdge(int i,int j,bool undir=true){
l[i].push_back(j);
if(undir){
l[j].push_back(i);
}
}
void printAdjList(){
//Iterate over all the rows
for(... | ALGO | 0.998318 | 4.95028 |
90dee0a4-33dc-483a-9fb3-1082233985a4 | Conless/cmu-15-445 | bustub/src/optimizer/nlj_as_hash_join.cpp | #include <algorithm>
#include <memory>
#include "catalog/column.h"
#include "catalog/schema.h"
#include "common/exception.h"
#include "common/macros.h"
#include "execution/expressions/column_value_expression.h"
#include "execution/expressions/comparison_expression.h"
#include "execution/expressions/constant_value_expre... | ALGO | 0.952012 | 6.431778 |
7376e8c9-63c4-4f93-a85a-6c43e9c664cf | musa-45/CODEFORCES_CODES | Find B.cpp | #include<bits/stdc++.h>
using namespace std;
void pre(vector<int> &sum , vector<int > &v , int n)
{
sum[0] = 0;
for(int i = 1 ; i < n ; i++)
{
sum[i] = sum[i-1] + v [ i-1] - 1;
}
}
void musa()
{
int n,k;
cin >> n >> k;
vector<int> v(n);
vector<int > a(n+1);
a[0]= 0;
fo... | ALGO | 0.999965 | 4.048716 |
8baffb59-ff67-441a-9c0d-081c12e5615c | KaiYuanee/ZeroJudge_CPP | d070.cpp | #include <iostream>
using namespace std;
int main()
{
int y;
while (1)
{
cin >> y;
if (y == 0)
{
break;
}
if ((!(y % 4) && (y % 100)) || !(y % 400))
{
cout << "a leap year" << endl;
}
else
{
cout <<... | ALGO | 0.999762 | 3.284656 |
c6a2d088-05cb-4950-957a-74a9b5c53774 | JoelEarps/cpp-STL-templates-course | Ex_Files_C_PlusPlus_Templates/Exercise Files/Chap02/set.cpp | // set.cpp by Bill Weinman <http://bw.org/>
// updated 2018-11-03 for CppSTL
#include <iostream>
#include <string>
#include <set>
#include <unordered_set>
using namespace std;
//container of a sorted set of elements
//set class holds only unique elements whereas multi set class contains multiple unique ones
// print th... | TOOL | 0.89452 | 5.736537 |
15c8e6a8-65b0-4e6d-8938-5f087d71e456 | ishandutta2007/codeforces | 777777777plus/normal/1326/E.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e5+5;
int n;
int p[N],q[N],pos[N];
int ans[N];
struct ST{
int tot;
int ls[N<<1],rs[N<<1];
int mx[N<<1],tag[N<<1];
void down(int x){
if(!tag[x])return;
if(ls[x]){
mx[ls[x]]+=tag[x];
tag[ls[x]]+=tag[x];
}
if(ls[x]){
... | ALGO | 0.999996 | 3.514114 |
b07f0f69-47f4-4f64-a66b-34f6a74d1dad | ishandutta2007/codeforces | zmj2008akioi/normal/1729/A.cpp | #include <cstdio>
int T,a,b,c;
template<typename T>T rv(T x){return x>T()?x:-x;}
template<typename T>T min(T x,T y){return x<y?x:y;}
int main(){
scanf("%d",&T);
while(T--){
scanf("%d %d %d",&a,&b,&c);
int t1=a-1,t2=rv(c-b)+c-1;
if(t1<t2)puts("1");
if(t1>t2)puts("2");
if(t1==t2)puts("3");
}
return 0;
} | ALGO | 0.999942 | 3.847116 |
047fb491-0345-4137-909b-bcab28b1f83b | 18-RAJAT/LEETCODE | 2206-divide-array-into-equal-pairs/2206-divide-array-into-equal-pairs.cpp | class Solution {
public:
bool divideArray(vector<int>& nums) {
sort(nums.begin(),nums.end());
for(int i=0;i<nums.size();i+=2)
if((nums[i]^nums[i+1]))//cout<<"XOR op";
return false;return true;
}
}; | ALGO | 0.999904 | 5.15167 |
c6d63ab8-2539-4f60-8a4e-d472e8b893ef | ishandutta2007/codeforces | invusr/normal/892/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long s64;
inline int getint() {
static char c;
while ((c = getchar()) < '0' || c > '9');
int res = c - '0';
while ((c = getchar()) >= '0' && c <= '9') {
res = res * 10 + c - '0';
}
return res;
}
const int MaxN = 100000;
int n;
int a[MaxN], ... | ALGO | 0.99997 | 3.101569 |
4d5ffd8f-9450-4c49-ad47-7d051f603915 | shivam-mishra1423/BANARY-SEARCH | 02.cpp | //binary search
#include<iostream>
using namespace std;
int binary(int arr[],int n,int k){
int start=arr[0];
int end=arr[n-1];
for(int i=0;i<n;i++){
int mid=(start+end)/2;
if(arr[mid]==k){
return mid;
}
else if(arr[mid]>k){
end=mid-1;
}
else if(arr[mid]<k){
start=mid+1;
... | ALGO | 0.999958 | 5.000188 |
4f1efc9e-b890-4855-ac17-d23236a29127 | itsan2448/leetcode-solutions- | 0215-kth-largest-element-in-an-array/0215-kth-largest-element-in-an-array.cpp | class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
// minheap
priority_queue<int,vector<int>,greater<int>> mh(nums.begin(),nums.begin()+k);
for(int i=k;i<nums.size();i++){
if(nums[i]>mh.top()){
mh.pop();
mh.push(nums[i]);
... | ALGO | 0.999905 | 5.057986 |
463c3a29-7626-49ac-b67f-e188f6526f06 | zhongchong7/opencalib | SensorX2car/lidar2car/3rdparty/eigen3/doc/examples/class_Block.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::Block<Derived>
topLeftCorner(MatrixBase<Derived>& m, int rows, int cols)
{
return Eigen::Block<Derived>(m.derived(), 0, 0, rows, cols);
}
template<typename Derived>
const Eigen::Block<const Derive... | TOOL | 0.934189 | 5.865374 |
62b90135-322f-4096-9d9a-416625fa6390 | FaSha20/CN_CHomeworks_4 | ca4/tcp.cpp | #include <iostream>
#include <thread>
#include <ctime>
#include <cmath>
#include <sstream>
using namespace std;
//using namespace std::chrono;
#define SLOW_START 0
#define CONG_AVOIDANCE 1
#define FAST_RECOVERY 2
#define BBR_STABILITY 3
#define INF 10000
#define RENO 0
#define NEW_RENO 1
#define BBR 2
class TCPCon... | ALGO | 0.933369 | 4.919419 |
13af0435-df10-4441-8178-a7695d1fb94b | DuGuYifei/LeetCode_Record | 2180.统计各位数字之和为偶数的整数个数.cpp | /*
* @lc app=leetcode.cn id=2180 lang=cpp
*
* [2180] 统计各位数字之和为偶数的整数个数
*
* https://leetcode-cn.com/problems/count-integers-with-even-digit-sum/description/
*
* algorithms
* Easy (65.01%)
* Likes: 17
* Dislikes: 0
* Total Accepted: 12.6K
* Total Submissions: 19.1K
* Testcase Example: '4'
*
* 给你一个正整数... | ALGO | 0.999901 | 6.192683 |
df0f53d9-71d4-4cbf-b2ca-a4b82d2c1a63 | 0xEbrahim/LeetCode-Grind | 121-Best-Time-to-Buy-and-Sell-Stock.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int ret = 0;
int prev_mx = 0;
for(int i = prices.size() - 1 ; ~i ; i--){
ret = max(ret, prev_mx - prices[i]);
prev_mx = max(prev_mx, prices[i]);
}
return ret;
}
}; | ALGO | 0.99974 | 6.092437 |
f93e001d-5747-4e69-98eb-f42aa32874a4 | DHRUVSHARM/CPP_codes | string_task.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
/*
int main(){
string upper;
cin>>upper;
char lower=upper[0] + ('a'-'A');
cout<<lower<<endl;
return 0;
}
*/
int main(){
string s;
cin>>s;
for(int i=0;i<s.size();i++){
if(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' || s[i]=='U' || s[i... | ALGO | 0.998019 | 3.717377 |
5bf7d723-abbe-476a-bfb5-4ab22ba8117c | pavel-ryzhov/global_vars | runs/000681.cpp | #include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char *argv[])
{
//Количество вершин
int nVerts = 0;
cin >> nVerts;
//Получаем ребра графа
map <pair<int,int>, int> edges;
int i = 0, v1 = 0, v2 = 0;
... | ALGO | 0.999927 | 4.412642 |
33c9e385-bf93-4125-8733-135aa66c8374 | jessicah/haiku-private | src/kits/interface/layouter/LayoutOptimizer.cpp | #include "LayoutOptimizer.h"
#include <stdio.h>
#include <string.h>
#include <new>
#include <AutoDeleter.h>
//#define TRACE_LAYOUT_OPTIMIZER 1
#if TRACE_LAYOUT_OPTIMIZER
# define TRACE(format...) printf(format)
# define TRACE_ONLY(x) x
#else
# define TRACE(format...)
# define TRACE_ONLY(x)
#endif
#define TRACE_ERRO... | ALGO | 0.998275 | 5.631266 |
ef63588f-321e-4c80-b9e1-1b5bde933eae | raincross7/code-similarity | codes/train_code/problem135/problem135_46.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> entered_cars;
int number;
while (cin >> number)
{
if(number == 0)
{
int& x = entered_cars.back();
cout << x << endl;
entered_cars.pop_back();
... | ALGO | 0.999439 | 4.95018 |
b1c98872-1a94-4d15-a344-c9dfb5c7d0e5 | AlexandruPintea2000/Cpp-libraries-applications | Applications/common frev multiple/common.cpp | #include <string>
#include <fstream>
#include <iostream>
#include <string.h>
using namespace std;
string common[ 10000 ];
int common_iter = 0;
int length ( int a )
{
if ( a == 0 ) return 1;
int i = 0;
while ( a != 0 )
{
i = i + 1;
a = a / 10;
}
return i;
}
int length ( int a[] )
{
int i = 0;
while ( a... | TOOL | 0.956066 | 3.137764 |
6b64999f-f95f-443c-ad81-8117ef2b486d | pbysu/BOJ | ~2017/2523.cpp | #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include<iostream>
#include<string>
using namespace std;
int main() {
int n,temp;
cin >> n;
temp = n;
for (int i = 0; i < n-1; i++) {
for (int k = 0; k <= i; k++) {
printf("*");
}
temp--;
printf("\n");
}
temp = n;
for (int i = 0; i < n; i++) {
... | ALGO | 0.999885 | 3.526251 |
2eebe50d-4b55-40e7-8a3b-beb8b61007b0 | vimalprogrammer/Python-TQ | 3SumClosest-leetcode.cpp | /*
Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target.
Return the sum of the three integers.
You may assume that each input would have exactly one solution.
Input: nums = [-1,2,1,-4], target = 1
Output: 2
Explanation: The sum that is closes... | ALGO | 0.999998 | 6.173876 |
9e45c5dc-4145-41fa-bc1e-be14b45d7009 | ArthurAugustinho/UniEva-Algoritimos | Algoritimos/Segundo Periodo/ex11 (1).cpp | /* Faa um programa para verificar se um determinado nmero inteiro e divisvel por 3 ou 5, mas
no simultaneamente pelos dois.
*/
#include<stdio.h>
#include<math.h>
#include<locale.h>
main()
{ setlocale(LC_ALL,"Portuguese");
int n1;
printf("\n Digite um numero e veja se ele divisvel por 3 ou 5: ");
scanf("%i",&n1);... | ALGO | 0.994949 | 3.259073 |
b31b2208-d06a-4450-a588-5a80ae3c9f91 | wik46/learn-cpp | objects/stl/algorithms/intro_find.cpp | /*
* Filename: intro_find.cpp
* Author: Wikus Jansen van Rensburg.
* Date: November 17, 2020
* Description: Introduction to the algorithms used
* for the conainers defined in the C++ STL
* */
// ==========================
// STL Part 3: Algorithms
// ==========================
/*
All the containers in the STL... | ALGO | 0.995498 | 4.89529 |
981eb582-3c33-4b2e-a6b1-ce781a43fc60 | mzgsxs/cpp-primer | chapter14/e1424.cpp |
#include<string>
#include<iostream>
#include<sstream>
class Book{
public:
std::string name;
size_t quantity;
Book() = default;
Book(std::string s, unsigned num): name(s), quantity(num) {}
Book & operator +=(Book const & );
};
std::istream & operator >> (std::istream & in, Book & book){
in >> book.name >>... | TOOL | 0.921781 | 5.151075 |
f861bf34-c050-4de5-b5d7-2d9489e3a290 | ErenKarakus/algorithmic_complexity | rma/rma/rma.cpp | #include <string>
#include <list>
#include <fstream>
#include <iostream>
#include <chrono>
#include <algorithm>
struct brickNamesStruct {
std::list<std::pair<std::string, std::string>> a;
std::list<std::pair<std::string, std::string>> b;
};
struct testData {
std::string label;
std::string path;
};
bo... | ALGO | 0.980206 | 5.195782 |
d59a8088-d916-4730-b153-9dd538b1837c | JCDWalker/CppUdemy_1 | reference_variable/reference_variable/reference_variable.cpp | #include <iostream>
using namespace std;
int main()
{
int x{ 10 };
int &v = x;
cout << "v = " << v << endl;
v = v++;
cout << "v = " << v << endl;
cout << "x = " << x << endl;
return 0;
} | TOOL | 0.96383 | 3.743324 |
536c2976-2a3f-46bd-b335-ffd6bddf75c8 | nafi103/Solved-Problems | Contest/Division 3/Round 529/A_Repeating_Cipher.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;
/********************************Macros********************************/
#define mod 998244353
#define pb push_back
#define inf LLONG_MAX
#defi... | ALGO | 0.999987 | 4.391782 |
76117adc-da97-4fdf-83cc-93368fb1156f | bhavyakalra19/comp-prog | 2155-find-missing-observations/find-missing-observations.cpp | class Solution {
public:
vector<int> missingRolls(vector<int>& rolls, int mean, int n) {
vector<int> ans;
int check = 0;
int sz = rolls.size();
mean *= (sz + n);
int meanSum = 0;
for(int i = 0; i < sz; i++){
meanSum += rolls[i];
}
if(meanS... | ALGO | 0.999762 | 5.596857 |
2410f361-af74-4779-ab37-a5286812a332 | ShabbirHasan1/litepool | third_party/boost_1_83_0/libs/math/example/root_finding_multiprecision_example.cpp | // Note that this file contains Quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
// Example of root finding using Boost.Multiprecision.
#ifndef BOOST_MATH_STANDALONE
#include <boost/math/tools/roots.hpp>
//using boost::math::policies::policy;
//using boost::math::t... | ALGO | 0.999039 | 3.615398 |
3bbf3cbd-19f5-47e1-9e3e-10061a8d45c1 | Joshua-ZY/PAT | 乙级/1015(25)德才论(sort按照多条件排序结构体).cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
#define MAXSTU 100010
typedef struct student STUDENT;
struct student {
int id;
int de;
int cai;
int category; //ʵǸȰͬڰܷ
};
STUDENT stulist[MAXSTU];
bool cmp(STUDENT a, STUDENT b) {
if (a.category != b.category)
return a.category < b.category; //ǰıҪС
... | ALGO | 0.99981 | 3.589508 |
9c2a5171-6210-4576-ba48-9d870c7f00ac | Vanslashington/algorithm-problem-solutions | UVa/revAndAdd.cpp | #include <iostream>
#include <algorithm>
#include <deque>
using namespace std;
typedef long long ll;
deque<int> itodq(ll num)
{
deque<int> ret;
while(num != 0)
{
ret.push_front(num % 10);
num /= 10;
}
return ret;
}
int dqtoi(deque<int>& dnum)
{
int place = 1;
in... | ALGO | 0.999941 | 4.303732 |
06e70496-e7ba-4eaa-aaca-39b8bc24d895 | shun60s/rt-wdf_renderer-sample-study | Libs/rt-wdf_lib/rt-wdf_nlModels.cpp | #include "rt-wdf_nlModels.h"
//==============================================================================
// Parent class for nlModels
//==============================================================================
nlModel::nlModel( int numPorts ) : numPorts (numPorts) {
}
nlModel::~nlModel( ) {
}
//---------... | ALGO | 0.997585 | 5.252144 |
8e43d2d0-6bec-4160-8884-a68d38b173fb | dmkz/competitive-programming | codeforces.com/Codeforces Ladder 1500-1599 (extra)/0707C.cpp | /*
Problem: 707C. Pythagorean Triples
Solution: math, constructive, O(1)
Author: Dmitry Kozyrev, github: dmkz, e-mail: <EMAIL>
*/
#include <iostream>
#include <algorithm>
#include <vector>
typedef long long ll;
int main() {
ll a; std::cin >> a;
if (a == 1 || a == 2) { std::cout << -1; r... | ALGO | 0.999952 | 4.484039 |
5a804fe7-ac40-4c02-b7f5-d1e0288ae30e | ishandutta2007/codeforces | hyperbolic/normal/913/C.cpp | #include <stdio.h>
long long int MAX = 1;
int a,x[50];
long long int func(int k)
{
if(k==0) return 0;
int pivot = a+1;
for(int i=1;i<=a;i++)
{
int c = (1<<(i-1));
if(c>=k)
{
pivot = i;
break;
}
}
long long int minCost = MAX;
int index = 0;
for(int i=1;i<pivot;i++)
{
minCost*=2;
if(x[i]<min... | ALGO | 0.999644 | 3.325797 |
bb91eb22-5551-489f-9d5a-2f20471efef5 | raincross7/code-similarity | codes/train_code/problem083/problem083_171.cpp | #include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
vector<vector<int>> di... | ALGO | 0.999979 | 3.890603 |
b4664807-d1c7-4fed-8438-034bd69620d3 | dogganidhal/Parallel-processing | Pthreads/cppthreads.cpp | /* Les threads POSIX, souvent appelés pthreads,
sont un sous-standard de la norme POSIX
décrivant une interface de programmation
permettant de gérer des threads. */
// CPP Program to find sum of array
#include <iostream>
#include <thread>
#include "chrono.h"
#define NUM_THREADS 16
using ... | TOOL | 0.991575 | 4.986452 |
dd794ad7-e7da-4dbc-9b28-c0b58cb05403 | anurag-111/allSubmissions | delete-node-in-a-bst/Accepted/9-4-2023, 1_35_09 PM/Solution.cpp | // https://leetcode.com/problems/delete-node-in-a-bst
// val, left, right
class Solution {
private:
TreeNode* inorderSuccessor(TreeNode* root) {
while(root != NULL && root -> left != NULL) {
root = root -> left;
}
return root;
}
public:
TreeNode* deleteNode(TreeNode* ... | ALGO | 0.999996 | 6.91272 |
0f029643-17c8-4b9e-ad02-ce07eeafa9ea | Im4lish/PAT | Advanced level/1110.Complete Binary Tree.cpp | #include<iostream>
#include<vector>
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
int n;
struct Node {
int left;
int right;
};
Node node[20];
bool exist[20];
int cnt=0;
int lastnode=0;
void bfs(int root) {
queue<int> q;
q.push(root);
while(!q.empty()) {
int now = q.front();
q.... | ALGO | 0.999921 | 3.594333 |
3a50fa9c-f9cd-453a-baa7-5b941edc242f | vishal01072002/Complete-DSA | 09. Recursion/problem08.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
// Reverse string
bool isPalandrome(string &arr, int start, int end){
if (start > end) // all case passed
return true;
if(arr[start] != arr[end]) return false;
return isPalandrome(arr, start + 1, end - 1);
}
int main(){
strin... | ALGO | 0.999918 | 4.749962 |
0d5a7d13-2e17-41fa-af7e-6239397b4a59 | van-artist/Data_Structure-and-Algotithm | sort/shellSort.cpp | #include <vector>
template <typename T, typename Interator>
void shellSort(std::vector<T> &arr, Interator begin, Interator end)
{
return;
} | ALGO | 0.991174 | 4.326438 |
bbf9781f-e9f3-424e-964a-7c14ab469d5d | mccormickgriffin/aanniversaries | 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.998859 | 6.785645 |
572e3840-5c47-4e43-bfde-1dd3dbceea90 | Mantano/mantano-lcp-client | src/third-parties/cryptopp/twofish.cpp | // twofish.cpp - modified by Wei Dai from Matthew Skala's twofish.c
// The original code and all modifications are in the public domain.
#include "pch.h"
#include "twofish.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
// compute (c * x^4) mod (x^4 + (a + 1/a) * x^3 + a * x^2 + (a + 1/a) * x + 1)
// over GF(256)
sta... | ALGO | 0.99974 | 6.873923 |
ca5b1e20-46ea-4377-9db4-9f1df89f87da | WenjieZhang1/leetcode | find_peek.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution
{
public:
int findpeek(vector<int>& nums){
int s=nums.size();
if(s<3){
return 0;
}
bool as=(nums[1]-nums[0]>0);
if(as){
return (nums[s-1]+nums[0]+s-1)/2;
}else{
return (nums[0]+nums[s-1]-s+1)/2;
}
}
};
int main(){
Sol... | ALGO | 0.999981 | 5.349947 |
cbac03f3-8c1b-46a1-b315-bedb5d60ada1 | UW-COSC-2030-FA-2017/merkle-votes-epicly-i-m-not-dead-yet | pMT.cpp | #include "pMT.h"
#include <iostream>
#include <string>
using namespace std;
pMT::pMT()
/**
* @brief
* @param hashSelect a number corresponding to the hashfunction to use for this pMT
* @return
*/
{
}
//copy constructor -- creates empy tree of certain size
//pre-build allows it to never be rehashed, reducing op... | ALGO | 0.996798 | 4.304914 |
7a4513fc-f24f-4e29-9c54-defb6cf7f50a | pingjuiliao/softbound | llvm-project-13.0.0.src/clang-tools-extra/clang-query/Query.cpp | #include "Query.h"
#include "QuerySession.h"
#include "clang/AST/ASTDumper.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/TextDiagnostic.h"
#include "clang/Tooling/NodeIntrospection.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang::ast_matche... | TOOL | 0.892974 | 7.78962 |
03d1bad4-e2f1-45ca-982e-cc54a6a90f69 | moaiforge/plugin-moai-bullet | bullet/src/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp | #include "btConvexTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
#include "BulletCollision/CollisionShapes/btStridingMeshInterface.h"
btConvexTriangleMeshShape ::btConvexTriangleMeshShape (btStridingMeshInterface* meshInterface, bool calcAabb)
... | ALGO | 0.973599 | 7.530622 |
d737115c-20c6-438f-8c39-7a0bc213e341 | YoshikiTakashima/vert | benchmark/cpp_transcoder/RECURSIVELY_BREAK_NUMBER_3_PARTS_GET_MAXIMUM_SUM/RECURSIVELY_BREAK_NUMBER_3_PARTS_GET_MAXIMUM_SUM_towasm_mutated.cpp | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>
int min(int x, int y) { return (x < y)? x: y; }
int max(int x, int y) { return (x > y)? x: y; }
int cmpfunc (const void * a, const void * b) {return ( *(int*)a - *(int*)b );}... | ALGO | 0.999992 | 5.62058 |
292c6b24-597f-4649-a802-83676720f45f | deepakantony/Euler | p1_to_p67/p6_sum_squares.cpp | #include <iostream>
#include <cstdlib>
using std::cout;
using std::endl;
int main(int argc, char *argv[]) {
int n = atoi(argv[1]);
int sum_of_squares = (n+1)*(2*n+1)*n/6;
int square_of_sum = n*(n+1)/2;
square_of_sum *= square_of_sum;
cout << square_of_sum - sum_of_squares << endl;
return 0;
} | ALGO | 0.99593 | 5.059764 |
a1ce248a-01f2-4d1e-8728-197d3c325031 | Intanmer/lat-responsi-124220026 | 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 |
355b6d15-d578-4e30-a844-539c97aab56a | Hasin-Ishrak/CodeFolio | vscode(c++)/minimize_equal_sum_subarray.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(nullptr);
#define ll long long
#define yo '\n'
#define pb push_back
const ll mod = 1e6 + 123;
int main() {
fast;
ll t;
cin >> t;
while (t--) {
ll n;
cin >> n;
vector<ll> a(n), b(n);... | ALGO | 0.99995 | 3.513691 |
6b92c023-de93-49f6-98fb-767107fcf884 | Moonshile/AlgorithmCandy | leetcode/8.cpp | #include <iostream>
#include <vector>
#include <string>
#include <cctype>
using namespace std;
class Solution {
private:
const int INT_MAX = 2147483647;
const int INT_MIN = -2147483648;
inline int charToDigit(char c) {
return c - '0';
}
public:
int myAtoi(string str) {
auto it = ... | ALGO | 0.998709 | 4.932531 |
01ffafc6-1b9b-4409-98e5-2513d430d6b2 | abhiram22MH1A4267/Github-Problems | Difficulty: Medium/Number of Provinces/number-of-provinces.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution {
public:
void dfs(int node, int vis[], vector<int>adjList[]){
vis[node] = 1;
for(int it : adjList[node]){
if(!vis[it]){
... | ALGO | 0.999948 | 6.584072 |
047173a5-53ef-437c-9d0f-87ee8eb72552 | sunrize0714/AtCoder | ABC/201-300/ABC214/c.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pair<ll,ll>> vp;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define revrep(i,a,n) for(ll i=n-1;i>=a;i--)
#de... | ALGO | 0.999996 | 3.553297 |
b886824e-9ce3-4631-add7-cf8639870efe | Pritam723/ProblemSolving | 3189-find-champion-ii/3189-find-champion-ii.cpp | class Solution {
public:
// time/space: O(n + E)/O(n)
int findChampion(int n, vector<vector<int>>& edges) {
vector<int> indegree(n, 0);
for (auto edge : edges) indegree[edge[1]]++;
int champion = -1;
for (int i = 0; i < n; i++) {
if (indegree[i] != 0) continu... | ALGO | 0.999966 | 5.744934 |
383ed7dc-4b13-4855-8a26-c93d18ecda84 | Gaurav-20/LeetCode-Solutions | 218-the-skyline-problem/218-the-skyline-problem.cpp | class Solution {
public:
vector<vector<int>> getSkyline(vector<vector<int>>& buildings) {
vector<pair<int, int>> h;
for (auto b : buildings) {
h.push_back({ b[0], -b[2] });
h.push_back({ b[1], b[2] });
}
sort(h.begin(), h.end());
int prev = 0,... | ALGO | 0.999975 | 6.436322 |
93371a9a-1120-4e26-bbdc-f3de52c79bf4 | NguyenMinhDuc163/Cpp-Programming | demo/4.Mang1Chieu/DemSoPhanTuLapLai.cpp | #include<bits/stdc++.h>
//#include<iostream>
using namespace std ;
#define ll long long
int main()
{
int t; cin >> t;
while(t--)
{
int n,dem =0; cin >> n;
map<int,int> mp;
for(int i = 0; i < n ;i++)
{
int tmp; cin >> tmp;
mp[tmp]++;
... | ALGO | 0.999533 | 3.644719 |
394e217b-4189-4864-9ab3-a081b0113925 | skyneko/C-- | less2/2-7.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
/**
* mảng này sẽ chứa các kí tự bit sau khi chia [0,1,1, ...]
* giá trị càng lớn thì có thể tính toán được số lớn hơn, mặc định max 500 kí tự bit.
*/
int arr[500];
int main() {
int num; // số này nhập từ bàn phím.
bool isNegative = false; // đánh... | ALGO | 0.999967 | 4.319005 |
0d27e395-a0ef-466b-a877-a249d7acf46d | MahmoudSamy1452/Problem-Solving-Solutions | Leetcode/Daily Problems/57. Insert Interval.cpp | // 57. Insert Interval
// You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and intervals is sorted in ascending order by starti. You are also given an interval newInterval = [start, end] that represents the start and e... | ALGO | 0.999938 | 6.181744 |
58e2f4f9-4f9e-4d30-86d7-253bbea3b392 | dvtdat/cp | codeforces/1537A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n; cin >> n;
int sum = 0;
for (int i = 0; i < n; ++i)
{
int t; cin >> t;
sum += t;
}
if (sum >= n) cout << sum - n << endl;
else cout << 1 << endl;
}
int main()
{
int test; cin >> test;
while (test--)... | ALGO | 0.999681 | 4.435689 |
e347139c-b4be-4601-9d55-7ffd1c2c2134 | thalyson004/solutions | leetcode/0938_rangeSumOfBst.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
int rangeSumBST(TreeNode* root, int L, int R) {
if(root==NULL) return 0;
if(... | ALGO | 0.999994 | 6.569801 |
1175dbc0-477e-4a8c-a430-02e1da696014 | rikuTanide/atcoder_endeavor | abc104/abc104_a.cpp | #include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e10;
const ll ... | ALGO | 0.999142 | 3.893946 |
82ad5cbd-4d03-429b-9947-e06092bc70c2 | userWaliso/cp | teste.cpp | #include <iostream>
int main() {
int a, b, soma;
std::cin >> a >> b;
soma = a + b;
std::cout << soma;
return 0;
} | ALGO | 0.971767 | 4.100746 |
9b6a2bda-7f52-4dfa-b4d0-ed2f9d9a2f12 | raincross7/code-similarity | codes/train_code/problem444/problem444_317.cpp | #include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
int Max = 10 + 1e8;
int main()
{
int n, m;
c... | ALGO | 0.999796 | 4.17549 |
83eaee56-18e7-4452-ac5c-ea2678695082 | Marlin-Phone/code | cpp/luogu/P1591/Luogu_P_1591.cpp | // https://luogu.com.cn/problem/P1591
#include <bits/stdc++.h>
using namespace std;
const int N0 = 3e3;
const int N = 3e3 - 10;
int t;
int n; // 阶乘n
int a; // 数码a
int A[N0];
int cnt = 0;
void cheng(int x) {
int carry = 0;
for (int i = 1; i < N - 1; i++) {
A[i] = A[i] * x + carry;
carry = A[i] ... | ALGO | 0.999862 | 3.551943 |
7a7c51fa-b2da-4cd6-951c-eb9892e4adac | anandhu720/Datastructures | Basics/callbyreferance.cpp | #include<iostream>
using namespace std;
void swap(int &x,int &y)
{
int temp;
temp = x;
x = y;
y = temp;
}
int main()
{
int a=10,b=3;
cout<<a<<b;
swap(a,b);
cout<<a<<b;
return 0;
} | ALGO | 0.999325 | 3.613203 |
ca94e28e-fc4d-416c-af6a-3319657ad005 | ViswesB/AlgorithmsWS | HouseRobber.cpp | /*
198. House Robber
Medium
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjac... | ALGO | 0.999959 | 6.016143 |
3df33437-e97c-4622-9be1-c0803be8dd32 | LordGuilberGS/js-symbolic-executor | cvc3/src/theory_array/theory_array.cpp | /*****************************************************************************/
/*****************************************************************************/
#include "theory_array.h"
#include "theory_bitvector.h"
#include "array_proof_rules.h"
#include "typecheck_exception.h"
#include "parser_exception.h"
#include... | ALGO | 0.957423 | 7.154287 |
1154cac8-6dee-4c7d-b7a7-7a4398a19b70 | raoprer/cpp-programs | SparseMatrixTranspose.cpp | #include<iostream>
#define MAX 10
using namespace std;
class smt
{
public:
int row,col,val;
void createSm(int r,int c,int value)
{
row=r;
col=c;
val=value;
}
void transpose(smt s[],smt t[])
{
t[0].col=s[0].row;
t[0].row=s[0].col;
t[0].val=s[0].val... | ALGO | 0.999623 | 3.409638 |
739361bd-4e77-4eae-afa8-dea2381cd62c | abhishek10V/Leetcode_Solutions | 0044-wildcard-matching/0044-wildcard-matching.cpp | class Solution {
public:
bool all(string& s, int j) {
for(int i=1; i<=j; i++) {
if(s[i-1] != '*') return false;
}
return true;
}
bool isMatch(string s, string p) {
int n = s.size();
int m = p.size();
vector<vector<bool>> dp(n+1, vector<bool>(m... | ALGO | 0.99998 | 4.982123 |
7965cd20-6d0d-4479-9de4-efc60d780aca | SWitsarut/algo | greedy/twin.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
class GiftSet {
private:
int left;
int right;
int diff;
bool leftMore;
int calDiff() { return abs(this->left - this->right); }
public:
GiftSet(int left, int right) {
this->left = left;
this->right = right;
this->... | ALGO | 0.999972 | 4.72028 |
32f58dfd-7d41-4d3d-9b4b-48bf838aab2c | ishandutta2007/codeforces | kmjp/normal/1268/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999884 | 3.605019 |
9653d897-b4d6-4a59-bd78-86fdeb09ecb4 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_11001_5.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long tests = 1;
while (tests--) {
long long n;
cin >> n;
long long ans = n / 100;
n %= 100;
ans += n / 20;
n %= 20;
ans += n / 10;
n %= 10;
ans += n / 5;
... | ALGO | 0.999384 | 4.537487 |
a7ebcedb-d1b9-4ad7-ae32-697b70d54198 | yilinguo121/cp | f043.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
cin >> c >> a;
if (c == a) a -= 3;
b = c - a;
if (b < a) swap(a, b);
cout << a << '+' << b << '=' << c;
}
| ALGO | 0.999567 | 3.271524 |
de4f3ad5-3895-4a10-a34b-306fe73dcf4a | occlum/llvm | examples/Kaleidoscope/Chapter2/toy.cpp | #include "llvm/ADT/STLExtras.h"
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <memory>
#include <string>
#include <vector>
//===----------------------------------------------------------------------===//
// Lexer
//===-----------------------------------------------... | TOOL | 0.947746 | 7.089499 |
98c3b993-c374-4dea-a4dc-9d7525232fe3 | Srishtik16/Leetcode-Submissions | 1387-sort-integers-by-the-power-value/1387-sort-integers-by-the-power-value.cpp | class Solution {
public:
int getKth(int lo, int hi, int k) {
auto getMoves = [&](int n) {
int moves = 0;
while(n != 1) {
if(n & 1) {
n = 3 * n + 1;
}
else {
n /= 2;
}
... | ALGO | 0.99999 | 5.337777 |
5894bc80-c430-411d-89eb-76beff85b8f4 | agatagc/Courses | CPP/CPP_From_A_to_Z/Section_10/Funkcja_rekurencyjna.cpp | #include <iostream>
using namespace std;
int dodawanie(int n)
{
if (n<= 0)
{
return 0;
}
else
{
return (n + dodawanie(n-1));
}
}
int silnia(int n)
{
if (n<= 0)
{
return 1;
} else
{
return (n * (silnia(n - 1)));
}
}
int fibonacci (int... | ALGO | 0.999726 | 4.217581 |
419aa777-7c0a-4b43-8547-de355910010e | nccaiteam/histopathology_annotation_nia | libs/boost_1_67_0/libs/config/tools/generate.cpp | //
// This progam scans for *.ipp files in the libs/config/test
// directory and then generates the *.cpp test files from them
// along with config_test.cpp and a Jamfile.
//
#include <boost/regex.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hp... | TEST | 0.915714 | 5.68929 |
c695b0e3-2f9e-4f23-abc0-d0e0885cea8d | ishandutta2007/codeforces | axs7384/normal/1625/A.cpp | #include<bits/stdc++.h>
using namespace std;
int t,n,m;
int a[10005];
int main()
{
scanf("%d",&t);
while (t--)
{
scanf("%d%d",&n,&m);
for (int i=1;i<=n;++i)
scanf("%d",&a[i]);
int ans=0;
for (int j=0;j<m;++j)
{
int p=0;
for (int i=1;i<=n;++i)
if (a[i]&(1<<j))
++p;
if (p>n/2)
ans|=1... | ALGO | 0.999852 | 4.265068 |
94276c03-a074-4cc3-a380-9e760fc07266 | Ultron011/DSA | BINARY TREE/MEDIUM/VIEW OF BINARY TREE/RIGHT VIEW/rightView.cpp | /**
* Problem: Right View of a Binary Tree
*
* Given a binary tree, imagine yourself standing on the right side of it,
* return the values of the nodes you can see ordered from top to bottom.
*
* Sample Input:
* 1
* / \
* 2 3
* \ \
* 5 4
*
* Sample Output:
* [1, 3, 4]
*
* Expl... | ALGO | 0.99996 | 6.398322 |
5088f4d4-96fb-4f63-8ffd-afaa2a0cffd8 | hackybacky/my-leet | 740-delete-and-earn/740-delete-and-earn.cpp | class Solution {
public:
int dp[30000];
map<int,int> cnt;
int recur(int i , vector<int>&nums){
if(i>=nums.size() )return 0;
if(dp[i]!=-1)return dp[i];
//if take;
int k =0;
k=(nums[i]*cnt[nums[i]]);
// cout<<k<<endl;
int ans;
... | ALGO | 0.999853 | 4.839075 |
892a5cf2-4c26-4a87-82a5-bcd2f516f7dd | TheUnicat/competitive-pwogramming | codeforces/contest_990/B_990.cpp | //
// Created by TheUnicat on 2024-12-02.
//
#include <iostream>
#include <string>
#include <set>
#include <map>
using namespace std;
int t, n;
string curr_case;
int main() {
cin >> t;
for (int i = 0; i < t; i++) {
set<pair<int, char>> freqs;
map<char, int> freq;
cin >> n >> curr_case... | ALGO | 0.999988 | 5.608508 |
7fd0a184-2321-4e93-8a6c-748286d21c9f | Dhoni77/Leetcode-2024 | SlidingWindow/medium/LongestRepeatingCharacterReplacement.cpp | //
// Created by Aldrin on 15-01-2024.
//
#include "LongestRepeatingCharacterReplacement.h"
int main() {
LongestRepeatingCharacterReplacement lrc;
// cout << lrc.characterReplacement("ABAB", 2);
cout << lrc.characterReplacement("AABABBA", 1);
} | ALGO | 0.999049 | 6.194863 |
9818298a-8434-49c1-85fe-ea3b17e84c85 | tarekrahamn/Codeforces-Problem-solve | Codeforces Round 898 (Div. 4)/G.cpp | #include <iostream>
#include <string>
using namespace std;
int maxCoins(string s) {
int coins = 0;
int n = s.length();
// Iterate through the string and look for "AB" and "BA" substrings
for (int i = 0; i < n - 1; i++) {
if (s[i] == 'A' && s[i + 1] == 'B') {
coins++;
... | ALGO | 0.999511 | 6.274136 |
ccbfc602-2436-45ff-ba66-95a1e336eac5 | lncarter/Openpose | src/openpose/net/nmsBase.cpp | #include <opencv2/opencv.hpp>
#include <openpose/net/nmsBase.hpp>
namespace op
{
template <typename T>
void nmsRegisterKernelCPU(int* kernelPtr, const T* const sourcePtr, const int w, const int h,
const T& threshold, const int x, const int y)
{
// We have three scenari... | ALGO | 0.990217 | 7.033502 |
b44ac14d-4c31-46c0-a1c0-5311140aa064 | Sharif1000/Problem-Solving-900 | Problem_038.cpp | -- Problem Link: https://codeforces.com/contest/1593/problem/B
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t; cin>>t;
while(t--){
string s; cin>>s;
int cnt0 = 0, idx0 = 0;
for(int i = s.size()-1; i >= 0; i--){
if(s[i] != '0') cnt0++;
else{
... | ALGO | 0.999628 | 5.1842 |
6fafa41b-a8a4-433c-9cf9-9db3ac9e19e4 | arash16/prayers | UVA/vol-012/1231-astar-TLE.cpp | /*
>>~~ UVa Online Judge ACM Problem Solution ~~<<
ID: 1231
Name: ACORN
Problem: https://onlinejudge.org/external/12/1231.pdf
Language: C++
Author: Arash Shakery
Email: <EMAIL>
*/
#include <bits/stdc++.h>
using namespace std;
#define MAXTH 2143
int M[MAXTH][MAXTH], nexta[MAXTH][MAXTH], S[MAXTH], SS[MA... | ALGO | 0.999548 | 3.667086 |
c272ba48-f256-4821-ad8f-9c3e995b6afe | dltpal07/algorithm | programmers/월간코드챌린지시즌1_약수의개수와덧셈.cpp | //https://programmers.co.kr/learn/courses/30/lessons/77884
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int solution(int left, int right)
{
int answer = 0;
for (int i = left; i <= right; i++)
{
int cnt = 0;
for (int j = 1; j <= i; j++)
{
if (i % j == 0)
cnt++;
}
if... | ALGO | 0.999921 | 5.224668 |
7aff233b-b8e8-4b37-bf5b-168ef8dd30a1 | Stenmarken/school-projects | vstenm-labbar/08/main.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
using namespace std;
vector<int> find_primes(int N)
{
int *numbers = new int[N]; // Default värde för värden i en int array är 0
// 0 motsvarar ett primtal, 1 motsvarar inte ett icke-primtal
... | ALGO | 0.998925 | 4.574829 |
87e0ebcd-9cb8-401b-be99-2b4baf0ab715 | karan-pawar-09/codeforces | D_Number_of_Shortest_paths.cpp | /*
author:Karan
created:26.07.2021 16:38:08
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(ar) ar.begin(),ar.end()
#define endl '\n'
const ll mod=1e9+7;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// freopen("input.txt","r",stdin);
// freopen("ou... | ALGO | 0.999977 | 4.764853 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.