uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
4075a65e-d96a-4e9c-a10a-65fa3e366d50 | little-rookie-at-UJS/c | od/jscpc2021/C.cpp | //
// Created by DELLPC on 24-4-28.
//
#include<bits/stdc++.h>
using namespace std;
#define irep(i, l, r) for(int i = l; i <= r; ++ i)
#define drep(i, r, l) for(int i = r; i >= l; -- i)
#define ll long long
#define LD double
const int mod = 1000000000 + 7;
#define vv vector
//#define int long long
void solve() {
... | ALGO | 0.998797 | 4.943059 |
b62e7acb-3d3d-4abd-bc6f-836035914fec | martell/ellcc | libecc/src/c++/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp | // <vector>
// vector(size_type n, const value_type& x, const allocator_type& a);
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "asan_testing.h"
template <class C>
void
test(typename C::size_type n, const typename C::value_type& x,
const typename C::allocator... | TEST | 0.897984 | 6.512844 |
6fa19d1b-0cd2-40dd-b3f6-dede7ba81377 | hs094/CP | AtCoder/Denso Create Programming Contest 2022(AtCoder Beginner Contest 239)/A_-_Horizon.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
#define ar array
#define ll long long
#define ld long double
#define sza(x) ((int)x.size())
#define all(a) (a).begin(), (a).end()
#define forn(i, n) for (in... | ALGO | 0.999156 | 3.446369 |
70379f25-0094-4d3c-8f14-0d19b81a76e0 | rektide/libbpg | jctvc/TLibCommon/TComWeightPrediction.cpp | /** \file TComWeightPrediction.h
\brief weighting prediction class (header)
*/
// Include files
#include "TComSlice.h"
#include "TComWeightPrediction.h"
#include "TComInterpolationFilter.h"
static inline Pel weightBidir( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset, Int clipBD)
{
retu... | ALGO | 0.997486 | 6.030519 |
8700a6b6-98ba-4460-a793-ef0e986d04e5 | dl8sd11/online-judge | sproutoj/p391-dijkstra.cpp | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<ll,ll> pii;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1... | ALGO | 0.999801 | 3.98242 |
425dab56-6dd3-4eec-a879-aeadcc83ec96 | kratikesh18/MyDSA | 19_TheGraphs/QuestionsOnGraph/Q4_RotttingOranges.cpp | #include<iostream>
#include<vector>
#include<map>
#include<queue>
using namespace std;
int TimeToRottingOrangs(vector<vector<int>> &grid){
//finding all rotten oranges and putting in the quque with time
queue<pair<pair<int,int> , int> > q;
int ansTime = 0 ;
for(int row = 0 ; row<grid.size(); row+... | ALGO | 0.999785 | 5.821494 |
3e4e896a-64e1-4179-95f6-6e59da86ec2e | drmeister/legacy-externals-clasp | boost/libs/graph/example/fr_layout.cpp | // Authors: Douglas Gregor
// Andrew Lumsdaine
#include <boost/graph/fruchterman_reingold.hpp>
#include <boost/graph/random_layout.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/topology.hpp>
#include <boost/lexical_cast.hpp>
#include <string>
#include <iostream>
#include <map>
#include... | ALGO | 0.999073 | 5.374009 |
3089f8d5-7760-4901-922f-ac9ef351c7f8 | justinjchoi/data_structures | lab8/main.cpp | // main.cpp
#include <iostream>
#include <time.h>
#include <cstdlib>
using namespace std;
extern "C" long vecsum (long*, long);
// Purpose: This main program produces a vector of random numbers
// between 0 and 99, then calls the externally defined function
// 'vecsum' to add up the elements of the vector.
// Orig... | TOOL | 0.914032 | 5.210586 |
a334a1ac-2da5-44c1-9dde-5cde6e89db43 | STREIN-11/ConCepts | Daily/Reverse_string.cpp | /*
You are given a string s. You need to reverse the string.
Example 1:
Input:
s = Geeks
Output: skeeG
Example 2:
Input:
s = for
Output: rof*/
#include<bits/stdc++.h>
using namespace std;
class Solution
{
public:
string reverseWord(string str)
{
stack<char>s;
string ans;
for(auto i... | ALGO | 0.999858 | 6.318642 |
ff48b39a-feee-4231-9403-73c7f93997b3 | Yangjie-Bit/Linux | CodingInterview/59_02_QueueWithMax/QueueWithMax.cpp | //==================================================================
// ָOfferԹپͱ⡷
// ߣκ
//==================================================================
// 59еֵ
// ĿһͻڵĴСҳлֵ磬
// {2, 3, 4, 2, 6, 2, 5, 1}ڵĴС3ôһ6
// ڣǵֱֵΪ{4, 4, 6, 6, 6, 5}
#include <cstdio>
#include <deque>
#include <exception>
using namespace std... | ALGO | 0.999037 | 5.109166 |
85d3edda-ee6f-4ff2-98b3-650f0e416d0e | ComQuestVentures/px4 | src/lib/FlightTasks/tasks/Offboard/FlightTaskOffboard.cpp | /**
* @file FlightTaskAuto.cpp
*/
#include "FlightTaskOffboard.hpp"
#include <mathlib/mathlib.h>
#include <float.h>
using namespace matrix;
bool FlightTaskOffboard::initializeSubscriptions(SubscriptionArray &subscription_array)
{
if (!FlightTask::initializeSubscriptions(subscription_array)) {
return false;
}
... | ALGO | 0.958161 | 6.277825 |
7db20977-03d4-4615-903e-5db96d4fa09d | JeremyARussell/Evolution-Game | Box2D/Collision/b2Collision.cpp | #include <Box2D/Collision/b2Collision.h>
#include <Box2D/Collision/b2Distance.h>
void b2WorldManifold::Initialize(const b2Manifold* manifold,
const b2Transform& xfA, float32 radiusA,
const b2Transform& xfB, float32 radiusB)
{
if (manifold->pointCount == 0)
{
return;
}
switch (manifold->type)
{
... | ALGO | 0.999451 | 7.776567 |
0940ffc1-72a2-46fe-8a4d-76f288caa82a | NguyenMinhThuan24112001/Data_structures_and_Algorithms_PTIT | tap con lien ke phia truoc dung.cpp | #include<bits/stdc++.h>
using namespace std;
// y tuong lam tuong tu sinh to hop
void solution(){
int n, k;
cin >> n >> k;
vector<int> A(n);
for(int i=0; i<k; i++) cin >> A[i]; // nhap
int step = k;
while(step > 0 && A[step] - A[step - 1] <= 1) step--; // lap den khi khoang cach giua A[i] va A[i-1] > 1
... | ALGO | 0.999901 | 3.819803 |
b15d2f0b-8dde-4280-8445-704ea6371736 | Denver44/CP-and-DSA-in-CPP | DSA/9DynamicProgramming/DP1/23ParitionintoSubsets.cpp | #include <iostream>
using namespace std;
// if there is 100 team we have to made and there are 100 people then there will be only one way thats hwy i == j =1.
// if people are less than a team requriement then 0.
// if people are greater than the team the formula
// ek 123 in two teams 3 says to 12 u make team of 2... | ALGO | 0.999926 | 4.658538 |
5c26b381-cd30-4213-8cff-c7999f5bb769 | ngvinh185/DSA | segment tree/bai D (doc de hieu segment tree) (hay vcl).cpp | #include <bits/stdc++.h>
#define vinh ios::sync_with_stdio(false);cin.tie(nullptr);
#define myfor(i,a,b) for(int i=a;i<b;i++)
#define myFor(i,a,b) for(int i=a;i>=b;i--)
#define foreach(x,a) for(auto x:a)
#define forEach(x,a) for(auto &x:a)
#define ll long long
#define ms(x,y) memset(x,y,sizeof(x))
#define fi first
#def... | ALGO | 0.999917 | 4.069531 |
332276af-9130-4511-a715-d22199a58396 | qwefgh90/AlgorithmSolution | AlgorithmCategory/AlgorithmCategory/약수.cpp | #include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <math.h>
#include <iostream>
int main(){
int testcase = 0;
scanf("%d", &testcase);
for (int i = 0; i < testcase; i++){
printf("#testcase%d\n", i + 1);
int n;
int k;
scanf("%d %d", &n, &k);
int cnt = 0;
int flag = 0;
... | ALGO | 0.999951 | 3.776172 |
2f23c951-18f9-4059-9584-0101d31e628f | Mamun-NSU/Problem-Solving-2025 | leetcode/Top Interview 150/12. Integer to Roman.cpp | // Link: https://leetcode.com/problems/integer-to-roman/description/
class Solution
{
public:
string intToRoman(int num)
{
// Define Roman numeral symbols and their values
const vector<pair<int, string>> romanSymbols = {
{1000, "M"}, {900, "CM"}, {500, "D"}, {400, "CD"}, {100, "C"},... | ALGO | 0.999423 | 7.161192 |
422fc294-46a0-471e-81b8-03e17a59faa3 | Nguyenvanha2509/baitap | PhanB.3.cpp | #include <iostream>
#include <string>
using namespace std;
#define MAX 100000
class Stack {
private:
int stk[MAX];
int topIndex;
public:
Stack() : topIndex(-1) {}
// Ham push de day phan tu vao stack
void push(int x) {
stk[++topIndex] = x;
}
// Ham pop de lay phan tu tu stack
... | ALGO | 0.993458 | 4.470179 |
879cbaca-2154-4f8b-999f-2867933bfff1 | amitsvg/Leetcode-submissions | 0876-middle-of-the-linked-list/0876-middle-of-the-linked-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:
ListNode* middleNode... | ALGO | 0.999898 | 5.753838 |
d58b7cfc-7b5f-4a18-b6cd-bdfe4668c521 | AhmedKrimi/self-driving-car-nanodegree-udacity | nd013-c5-planning-starter-master/project/starter_files/eigen-3.3.7/doc/examples/TutorialInplaceLU.cpp | #include <iostream>
struct init {
init() { std::cout << "[" << "init" << "]" << std::endl; }
};
init init_obj;
// [init]
#include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A(2,2);
A << 2, -1, 1, 3;
cout << "Here is the input matrix A before decompositi... | ALGO | 0.999839 | 3.804785 |
9e277c29-b80f-4090-9d2d-49989f0f012c | trivializm/firmware-mod-kit | src/others/squashfs-2.2-r2-7z/p7zip/7zip/Compress/LZ/MT/MT.cpp | // MT.cpp
#include "StdAfx.h"
#include "../../../../Common/Alloc.h"
#include "MT.h"
class CMatchFinderCallback:
public IMatchFinderCallback,
public CMyUnknownImp
{
MY_UNKNOWN_IMP
STDMETHOD(BeforeChangingBufferPos)();
STDMETHOD(AfterChangingBufferPos)();
public:
CMatchFinderMT *m_MatchFinderMT;
const... | TOOL | 0.897391 | 5.691321 |
b51b432b-b9c5-4fd3-b9f8-9e2388cc25b7 | fweingartshofer/se-swe-exam-practice | cpp/2011a.cpp | //
// Created by florian on 09.07.21.
//
#include <string>
#include <map>
#include <fstream>
#include <iostream>
#include <vector>
bool is_char(char c) {
int lower_c = tolower(c);
return 'a' <= lower_c && lower_c <= 'z';
}
bool is_valid_mail(const std::string &mail) {
if(mail.empty() || !is_char(mail[0])) {
... | TOOL | 0.968888 | 5.761154 |
90928bb1-b686-458b-a002-bf7fafae5301 | himanshi2003/Cpp_Learning | avg_of_array.cpp | #include <iostream>
using namespace std;
int main()
{
int array[] = {123, 43, 231, 3, 212};
int sum = 0, size = sizeof(array) / sizeof(array[0]);
for (int x = 0; x < size; x++)
{
sum = sum + array[x];
}
cout << "avg of array will be " << sum/size;
}
| ALGO | 0.995289 | 3.747485 |
b9cb7d02-1461-4ede-a891-ccfb9c900597 | sarvex/leetcode-g-forth | solution/1800-1899/1881.Maximum Value after Insertion/Solution.cpp | class Solution {
public:
string maxValue(string n, int x) {
int i = 0;
if (n[0] != '-')
for (; i < n.size() && n[i] - '0' >= x; ++i)
;
else
for (i = 1; i < n.size() && n[i] - '0' <= x; ++i)
;
return n.substr(0, i) + to_string(x)... | ALGO | 0.999884 | 5.433229 |
e0a92c63-a661-484c-8390-2f2bcafba6ee | wuhy08/GLEWproject | src/ar_track_alvar/src/Optimization.cpp | #include "ar_track_alvar/Alvar.h"
#include "ar_track_alvar/Optimization.h"
#include "time.h"
#include "highgui.h"
#include <iostream>
using namespace std;
namespace alvar {
Optimization::Optimization(int n_params, int n_meas)
{
estimate_param = 0;
J = cvCreateMat(n_meas, n_params, CV_64F); cvZero(J);
JtJ ... | ALGO | 0.999707 | 6.410347 |
add9e0cb-370e-4aac-b18b-9ed5ab324e08 | Bingyy/APAT | ALevel/Templates/Simu2-CC.cpp | #include <iostream>
#include <cstdio>
#include <string>
#include <stack>
#include <queue>
#include <map>
using namespace std;
struct node {
double num; //操作数
char op; //操作符
bool flag; //true表示操作数,false表示操作符
};
string str;
stack<node> s; //操作符栈
queue<node> q; //后缀表达式序列
map<char,int> op;
... | ALGO | 0.999794 | 3.766991 |
57ddee4a-f45a-4ca5-bf9f-18d7d1244acf | kuroi75/class-problam | 3th semester/codewars (only ans)/Array plus array.cpp | #include <vector>
int arrayPlusArray(std::vector<int> a, std::vector<int> b)
{
int sum = 0;
for (int num : a) sum += num;
for (int num : b) sum += num;
return sum;
} | ALGO | 0.997297 | 4.840475 |
261d4fb3-34a9-4827-afc9-8cb3c6af4374 | farizsatria1/aplikasi_pembimbing | 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.9988 | 6.76073 |
79c6d707-1fa8-41a6-81cf-c837b53b5036 | andreslab/global-game-jam-2019 | cocos2d/cocos/math/CCVertex.cpp | #include "math/CCVertex.h"
#include "base/ccMacros.h"
NS_CC_BEGIN
void ccVertexLineToPolygon(Vec2 *points, float stroke, Vec2 *vertices, unsigned int offset, unsigned int nuPoints)
{
nuPoints += offset;
if(nuPoints<=1) return;
stroke *= 0.5f;
unsigned int idx;
unsigned int nuPointsMinus = nuPoin... | ALGO | 0.992923 | 5.81487 |
a839844e-5679-4f83-91ef-47d29c53d611 | sergw3x/CPP4Dum6 | CPP_Programs/Chap18/LinkListClass/main.cpp | // LinkedListClass -linked list example with class methods
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
// NameDataSet - stores a person's name (these objects
// could easily store any other information
// desired).
class NameDataSet
{
public:
NameData... | ALGO | 0.968926 | 4.300265 |
19e2e979-9ec9-45ed-8d8f-328ac26c2c20 | darrentimotius/algoProg | Bab04/Q-readingBook.cpp | #include <stdio.h>
int main() {
int T;
scanf("%d", &T);
for (int i = 1; i <= T; i++) {
int N, X;
scanf("%d %d", &N, &X);
// for (int j = 0; j < 1;) {
// if (X == 1 || X == N || ((N % 2 != 0) && (X + 1 == N))) break;
// if ((N / 2) >= X) {
// ... | ALGO | 0.999808 | 4.705682 |
f3168816-e18b-4279-bc31-723c113639a3 | ArazSoley/Physics-Engine | Lib/eigen-3.4.0/test/denseLM.cpp | #include <iostream>
#include <fstream>
#include <iomanip>
#include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template<typename Scalar>
struct DenseLM : DenseFunctor<Scalar>
{
typedef DenseFunctor<Scalar> Base;
typedef typename Base::JacobianType JacobianType;
typed... | TEST | 0.953216 | 5.868212 |
3a07fd2d-30f4-42eb-a954-4410ab3eff1a | Justinianus2001/ProjectEuler | old_version/P043.cpp | #include "library.hpp"
int main(int argc, char** argv){
string str = "0123456789";
long long range, num, res = 0;
cin >> range; sieve(range * 2);
str = str.substr(0, range + 1);
do{
if(str[0] == '0')
continue;
bool ok = true;
for(long long idx = 0; idx < str.length() - 3; idx ++){
num = stoll(str.subs... | ALGO | 0.999606 | 4.458221 |
a6e84057-cdf3-4f18-bde9-641c9c4343a0 | AlonsoPaulino/competitive-programming | UVA/543 - Goldbach's Conjecture.cpp | #include <iostream>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#define N 1000000
using namespace std;
bool v[N];
void criba (){
memset (v, true, sizeof (v));
v [0] = false;
v[1] = false;
for ( int i = 4; i < N; i += 2 )
v [i] = false;
for ( int i = 3; i *... | ALGO | 0.999646 | 3.558117 |
310675e0-c163-4866-9e75-f6881bde8ca0 | ashmanmode/code-samples | GfG/285D.cpp | #include <bits/stdc++.h>
using namespace std;
#define fr(i,n) for(int i = 0 ; i < n ; i++ )
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define printvect(a) fr(i,a.size()) cout << a[i] << " " ;
typedef unsigned long long int ull;
int main()
{
int n ;
cin >> n ;
vector<int> stack;
fr(i,n) stack.pb(i)... | ALGO | 0.997517 | 3.503671 |
099b643f-a7fe-4c37-a09e-3b324aef2e09 | tanmoy4171/LeetCode | 0523-continuous-subarray-sum/0523-continuous-subarray-sum.cpp | class Solution {
public:
bool checkSubarraySum(vector<int>& nums, int k) {
for(int i=1;i<nums.size();i++) {
if(nums[i] == 0 && nums[i-1] == 0) return true;
}
for(int i=1;i<nums.size();i++) {
nums[i] += nums[i-1];
if(nums[i] % k ==0) return true;
... | ALGO | 0.999926 | 5.400879 |
3245d245-72c7-42f6-b55b-354e36b42ab9 | raincross7/code-similarity | codes/train_code/problem126/problem126_98.cpp | #include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
Int w, h, ans = 0; cin >> w >> h;
priority_queue<pair<Int, bool>> pq;
for(Int i=0; i<w; ++i){
Int p; cin >> p;
pq.push(make_pair(p, 0));
ans += p * (h+1);
}
for(Int i=0; i<h; ++i){
... | ALGO | 0.999805 | 3.605085 |
44fd9614-9807-4d9c-b9f6-71b6933e14c0 | Sharknevercries/Online-Judge | 10453 Make Palindrome.cpp | /* 15881355 10453 Make Palindrome Accepted C++ 0.527 2015-08-05 07:05:05 */
#include<bits\stdc++.h>
using namespace std;
char str[1005];
int DP[1005][1005];
int record[1005][1005];
int DFS(int a, int b) {
if (a > b) return 0;
if (DP[a][b] != -1) return DP[a][b];
if (str[a] == str[b])
record[a][b] = 0, DP[a][... | ALGO | 0.999974 | 3.958486 |
e690c82e-e6ab-4647-aa46-6f76168f373b | chan-hyeok-kim/Coding_Test_Algorithm_C | 0x15/solutions/7785.cpp | // http://boj.kr/b88f0e4817f94b0fa6080d56952fd1fe
#include <bits/stdc++.h>
using namespace std;
unordered_set<string> s;
int main(void){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
while(n--){
string name, log;
cin >> name >> log;
if(log == "enter") s.insert(name);
else s.erase(na... | ALGO | 0.998726 | 4.603447 |
5b477017-be1c-4dca-921d-1aef03ef2005 | franfill1/cses.fi-solutions | src/Mathematics/2185-Prime Multiples.cpp | /*
Task: 2185 Prime Multiples
Sender: franfill
Submission time: 2021-11-26 13:40:46
Language: C++17
Result: ACCEPTED
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n, k;
cin >> n >> k;
vector < ll > a(k);
for (ll &v : a) cin >> v;... | ALGO | 0.999924 | 3.757352 |
964e2334-fc19-4338-8b82-a979c392ac6f | miguelAlessandro/CompetitiveProgramming | project_euler/largest_palindrome_product.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main(){
int maxi = 0;
for(int i = 999; i >= 100; --i)
for(int j = ((i%11 == 0) ? 999 : 990); j >= i; j -= ((i%11 == 0) ? 1 : 11)){
if(i*j <= maxi) continue;
int aux = 0, inv = i*j;
while(inv){
... | ALGO | 0.999808 | 4.085742 |
9b0bc361-4c65-463a-9c0c-738740735bbe | ishandutta2007/codeforces | kuribohg/normal/741/A.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int MAXN=110;
typedef long long LL;
int n,a[MAXN];
bool used[MAXN];
LL ans=1;
LL gcd(LL a,LL b)
{
if(b==0) return a;
return gcd(b,a%b);
}
LL lcm(LL a,LL b)
{
return a/gcd(a,b)*b;
}
int main()
{
scanf("%d... | ALGO | 0.999965 | 3.34519 |
e4c4580a-b8f4-43eb-8a5c-6daeaba2a339 | EzraCerpac/CSE_minor_octp | lammps-23Jun2022/src/KOKKOS/angle_harmonic_kokkos.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Stan Moore (SNL)
------------------------------------------------------------------------- */
#include "angle_harmonic_kokkos.h"
#include "atom_kokkos.h"
#include "atom_masks.h"
#include "comm.h"
#in... | ALGO | 0.94503 | 6.415132 |
81cc28e9-18af-4720-84c7-68bf4d628a43 | ishandutta2007/codeforces | demoralizer/normal/1696/D.cpp | #include "bits/stdc++.h"
using namespace std;
#define int long long
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(),(x).end()
#define uniq(v) (v).erase(unique(all... | ALGO | 0.999848 | 4.685428 |
183a1c0b-4ee2-4979-b899-6db061d4e186 | bhartik021/6Companies30Days | Company-5-[Google]/2274. Maximum Consecutive Floors Without Special Floors.cpp | class Solution {
public:
int maxConsecutive(int bottom, int top, vector<int>& special) {
int ans = 0;
sort(begin(special), end(special));
for (int i = 1; i < special.size(); ++i)
ans = max(ans, special[i] - special[i - 1] - 1);
return max({ans, special.front() - bottom, top - special.back()})... | ALGO | 0.999811 | 5.581219 |
11a4d92f-91d0-49cc-8670-19dba3b4c2ea | talhaibnmahmud/leetcode | source/cpp/653. Two Sum IV - Input is a BST.cpp | #include <climits>
#include <unordered_set>
// 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... | ALGO | 0.99998 | 6.45181 |
25c57e60-c12b-405d-be46-770f693cb184 | dkhonker/sysu | 数据结构/数据结构实验课文件/EXP16-graph(topo,scc)/EXP16-graph(topo,scc)/fortest/source/20364062/queen.cpp | #include<stdio.h>
int n,t=0;
int lines[11];
int good(int x,int y){
int flag=1;
for(int k=1;k<y;k++){
if(lines[k]==y){
flag=0;
break;
}
if(lines[k]+k==x+y){
flag=0;
break;
}
}
return flag;
}
void queen(int i,int n){
if(i>n){
return;
}
else{
for(int j=1;j<=n;j++){
if(good(i,j)){
i... | ALGO | 0.99989 | 3.569861 |
02965304-d6e5-4fec-bdf8-8d3bd0fb97f2 | saumyatiwari08/code-library | automorphic_num.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int number;
cin >> number;
long int power = number*number;
// Let's convet now the two numbers;
string n , p;
n = to_string(number);
p= to_string(power);
int starting_point = p.size() - n.size();
for(int ... | ALGO | 0.989205 | 4.259032 |
88c14cf1-65d6-47fa-8141-2e455bd8a7ce | MWRose/Visualizing-Dessin-dEnfants | point_generator.cpp | #include <iostream>
#include <complex>
#include <vector>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
using namespace std;
using cmplx = complex<long double>;
const double h = 0.000001;
const int n = 5;
const int black[2]{-1, 2};
const int white[2]{-2, 1};
cmplx bMap(cmplx t)
{
return (pow(t, n));
}
c... | ALGO | 0.99983 | 3.405488 |
fa8ee105-309c-43c5-81e4-778f738e7bb7 | SteponasK/IT-Olimpiada-Treniruotes | IT-Olimpiada-Treniruotes/2023-Mokyklos-Etapas/Jaunesniuju-Grupe/Lenktynes/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
int main() {
int n, t;
std::cin >> n >> t;
std::vector<int> times;
times.push_back(t);
for (int i = 0; i < n; ++i) {
int temp{};
std::cin >> temp;
times.push_back(temp);
}
std::sort(times.begin(), times.end(), std::less<int>());
for (int i = 0; i... | ALGO | 0.999967 | 5.375876 |
b9181893-7483-4b30-9117-a63533695c3a | Bhanuprakash-M04/leetcode-DSA | 1-two-sum/two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int,int>mymap;
vector<int>ans;
for(int i=0;i<nums.size();i++){
if(mymap.find(target-nums[i])!=mymap.end()){
return {i,mymap[target-nums[i]]};
}
mymap... | ALGO | 0.999648 | 6.126823 |
afd4c913-32a1-4941-b9f6-fc86df953aba | AnkushDebnath00/DSA-Concepts-Cpp | 16.BubbleSort.cpp | #include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>
#include <utility>
#include <C:\Users\Ankus\OneDrive\Documents\C++\h\Searching.h>
#include <C:\Users\Ankus\OneDrive\Documents\C++\h\Printing.h>
using namespace std;
vector<int> bubbleSort(vector<int> arr)
{
// ===============================... | ALGO | 0.999644 | 5.632727 |
d2891f10-04f0-4e17-9698-d998fbd95666 | kelvintorres/Tanques | Library/PackageCache/com.unity.ide.visualstudio@2.0.11/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call made to Visual Studio can fail after ... | TOOL | 0.958405 | 6.977724 |
e1b633c5-99bf-485c-a70a-ed745776aac0 | StefanRvO/ADA | Portfolio1/code/sources/Tower_of_Hanoi.cpp | #define _unused(x) ((void)x) //Prevent compiler warnings about unused variables
#include "../headers/Tower_of_Hanoi.h"
#include <iostream>
#include <cassert>
Tower_of_Hanoi::Tower_of_Hanoi(const int n, const bool _verbose)
:A(n), B(0), C(0)
{
verbose = _verbose;
discs = n;
}
void Tower_of_Hanoi::move_discs(Rod &M... | ALGO | 0.99923 | 6.085697 |
107b41d4-870b-4ecb-869d-9ee8ab5b4082 | akshay-gupta03/LeetCode--Solved-Questions | 0028-find-the-index-of-the-first-occurrence-in-a-string/0028-find-the-index-of-the-first-occurrence-in-a-string.cpp | class Solution {
public:
int strStr(string haystack, string needle) {
int n=needle.length();
if(n>haystack.length()){
return -1;
}
for(int i=0;i<=haystack.length()-n;i++) {
if(haystack.substr(i,n)==needle) {
return i;
}
}
return -1;
... | ALGO | 0.999901 | 5.778452 |
90e33a5e-d8d0-4ac2-b8eb-cd9249b5aae1 | Mabsas/Code_Forces | Translation.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s ,t;
cout<<"Enter strings : ";
cin>>s>>t;
reverse(s.begin(),s.end());
if(t==s){
cout<<"YES";
}
else{
cout<<"NO";
}
}
| ALGO | 0.999981 | 3.6561 |
493488f0-349a-4975-800f-5cb588e56abb | OzPol/COP4533_Group_Project | cpp/program5B.cpp | #include <iostream>
#include <vector>
#include <tuple>
/* Solution to program 5B
* @param n the number of sculptures
* @param W the maximum width of the platform
* @param heights the heights of the sculptures
* @param widths the widths of the sculptures
* @return a tuple containing the number of platforms used, the opt... | ALGO | 0.999907 | 4.146764 |
65f30b12-fb0a-4e83-8a80-16b0d25e6409 | juuso-oskari/VisualSLAM | libs/opencv/samples/cpp/convexhull.cpp | #include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
static void help(char** argv)
{
cout << "\nThis sample program demonstrates the use of the convexHull() function\n"
<< "Call:\n"
<< argv[0] << endl;
}
int main( int argc, c... | ALGO | 0.994938 | 6.01609 |
37bf0e9e-2a66-4d57-ba47-9cadd24d61fe | rajaditya-m/Interview-Prep | Leetcode/Easy/Remove_Dups_Sorted_List.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *deleteDuplicates(ListNode *head) {
ListNode* prev = head;
ListNode* cur = NULL;
if(prev)
... | ALGO | 0.999952 | 5.635132 |
2a150ddd-ba69-4a4b-b029-e09fc820f126 | xiaohongma/daka1 | app/src/main/cpp/bundler/bundler/RadialUndistort.cpp | /* RadialUndistort.cpp */
/* Undo radial distortion */
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <string.h>
#include "sfm.h"
#include "color.h"
#include "image.h"
#include "resample.h"
#include "util.h"
// #include "jpegcvt.h"
#include "LoadJPEG.h"
#incl... | TOOL | 0.868008 | 5.34852 |
e8ef69aa-b878-4eff-b159-edf26cb471f4 | dirkneuhaeuser/exercise-problems | number_theory/mod_arithmetic/kattis_another_candies.cpp | #include"bits/stdc++.h" // using "" instead of <>, so it will search locally for the precompiled version first
using namespace std;
// 2**6 = 64 // 5! = 120
// 2**8 = 256 // 10! = 3,628,800
// 2**10 = 1,024 // 12! = 4... | ALGO | 0.999904 | 3.806647 |
a5173744-d462-4e9c-8abb-385cad0acd45 | jeannetoh99/cp | kattis/yinyangstones.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
char c;
int w = 0;
int b = 0;
while(scanf("%c", &c) && c != '\n') {
if (c == 'W') {
w++;
} else {
b++;
}
}
cout << (w == b) << endl;
}
| ALGO | 0.999563 | 3.450666 |
f50b51c4-54e3-46df-93dc-afb875976ea2 | ishandutta2007/codeforces | keywet06/normal/1495/C.cpp | #include <bits/stdc++.h>
const int N = 1e3 + 23;
char str[N][N];
int n, m, p, T;
void solve() {}
int main() {
std::ios::sync_with_stdio(0);
std::cin.tie(0), std::cout.tie(0);
std::cin >> T;
while (T--) {
std::cin >> n >> m;
for (int i = 1; i <= n; ++i) std::cin >> str[i] + 1;
... | ALGO | 0.999893 | 3.860224 |
c01d43a9-519b-4d88-9571-fa1100c0be66 | cccdddwww/PR033 | pcl_image/src/projection (复件).cpp | #include <iostream>
#include <vector>
#include <ros/ros.h>
#include<sensor_msgs/image_encodings.h>
#include <cv_bridge/cv_bridge.h>
#include <image_transport/image_transport.h>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace std;
using namespac... | ALGO | 0.928267 | 4.913501 |
20ee0e8c-b6e2-4f51-82da-24e787324933 | Tisapatel/DSA | PROJECT-2/Q-3.cpp | #include<iostream>
using namespace std;
int main(){
int num,i,sum=0,firstDigit,lastDigit;
cout<<"Enter a number: ";
cin>>num;
lastDigit=num%10;
firstDigit=num;
while(firstDigit>=10)
{
firstDigit=firstDigit/10;
}
sum=firstDigit+lastDigit;
cout<<"The Sum of firstDigit... | ALGO | 0.996964 | 4.537952 |
e6430066-1c9f-451c-9fc3-2377872c814a | chahk0129/Blink-hash | index/blink-hash-str/lib/lnode_btree.cpp | #include "lnode.h"
namespace BLINK_HASH{
template <typename Key_t, typename Value_t>
inline void lnode_btree_t<Key_t, Value_t>::write_unlock(){
(static_cast<node_t*>(this))->write_unlock();
}
template <typename Key_t, typename Value_t>
inline bool lnode_btree_t<Key_t, Value_t>::is_full(){
return (this->cnt =... | TOOL | 0.997159 | 6.10938 |
a494e502-2f38-4865-9f96-deec0e63b13a | misals/Leetcode | 29-divide-two-integers/29-divide-two-integers.cpp | class Solution {
public:
int divide(int dividend, int divisor) {
if(dividend == divisor) {
return 1;
}
bool checkSign = (dividend < 0 == divisor < 0);
unsigned int num1 = abs(dividend);
unsigned int num2 = abs(divisor);
unsigned int ans = 0;
... | ALGO | 0.999919 | 6.17314 |
702b651f-a5c5-4a34-a324-c87c1d513bf4 | arraesgustavo/competitiveProgramming | Maratona/aula4/problema1147.cpp | #include <iostream>
#include <vector>
using namespace std;
pair<int, int> convertePosicao(string pos) {
int linha = pos[0] - '1';
int coluna = pos[1] - 'a';
return {linha, coluna};
}
bool dentroTabuleiro(int linha, int coluna) {
return (linha >= 0 && linha < 8 && coluna >= 0 && coluna < 8);
}
int... | ALGO | 0.999757 | 5.151888 |
9584733f-e21c-4a1b-99b5-fda2ca543ca4 | CoconutJJ/rt | src/object/plane.cpp | #include "plane.hpp"
#include "hitrecord.hpp"
#include "material.hpp"
#include "ray.hpp"
#include "smooth_object.hpp"
#include "vec3.hpp"
#include <stdexcept>
Vec3 findVectorOnPlane (Vec3 normal, Vec3 point)
{
if (normal[0] != 0)
return Vec3 (
(normal[1] * (1 - point[1]) ... | ALGO | 0.905878 | 7.439082 |
f10d5665-eff5-4af8-92c7-90411c635424 | vbonnici/grafe-sim | analysis/data/p02835/s092630116.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if(a+b+c >= 22) cout << "bust\n";
else cout << "win\n";
return 0;
} | ALGO | 0.99926 | 3.255568 |
c6be471f-b96b-48ca-babc-fe845bd3e971 | sandialabs/xstack-klokkos | kokkos-examples/ExampleMistakes/LAMMPSDefects/lammps-15/domain_kokkos-buggy.cpp | // clang-format off
#include "domain_kokkos.h"
#include "atom_kokkos.h"
#include "atom_masks.h"
#include "error.h"
#include "force.h"
#include "kspace.h"
#include "kokkos.h"
using namespace LAMMPS_NS;
#define BIG 1.0e20
#define SMALL 1.0e-4
/* ----------------------------------------------------------------------... | ALGO | 0.96306 | 6.746239 |
57974bf8-7277-4a89-a91c-18eb90036886 | TanishqBhargava/Hackerearth | Algorithms/Greedy Algorithms/Basics of Greedy Algorithms/The score game.cpp | /*========================*\
| ID: tanishqbhargava2509 |
| LANG: C++ |
\*========================*/
//Tanishq Bhargava
#include <bits/stdc++.h>
using namespace std;
int x[100000], y[100000];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t;
cin >> t;
while(t--)... | ALGO | 0.999977 | 3.553136 |
ac25d319-02e6-4bc4-9605-4ace9abd143d | kipfuho/CodeRoad | hust/ktlt/week4/bai4.9.cpp | // Nguyen Dinh Ut Biu
// Bi 4.9. Ci dat thuat ton Dijkstra trn do thi v huong
// duoc bieu dien bang danh sch ke su dung std::priority_queue
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct Node{// kieu du lieu de luu dinh u v do di cua duong di ngan nhat tu s den u.
int u;
l... | ALGO | 0.999966 | 4.69729 |
f57a7066-e33f-4455-bc02-478f25186b83 | SteamDB2/CSGO-Old2018- | game/server/cstrike15/bot/states/cs_bot_use_entity.cpp | // Author: Michael S. Booth (<EMAIL>), 2003
#include "cbase.h"
#include "cs_bot.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
/**
* Face the entity and "use" it
* NOTE: This state assumes we are standing in range of the entity to be used, with no obstructions.
*/
void ... | ALGO | 0.875374 | 6.400703 |
6cb937b5-2456-49f4-88aa-2744a73f7f4c | manav-chan/DSA | Data Structures/Heap/isBtHeap.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node *buildTree(string str) {
// Corner Case
if (str.length() ... | ALGO | 0.999589 | 6.471133 |
da96f7dc-b9cd-44cc-9990-ef45b6d0517b | marlonwc3/cp-codes | Uva/Uva11742==Social Constraints.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==0) { break; }
#define pf(a) printf("%d ", a);
#define pfc(c,a) printf("%... | ALGO | 0.999853 | 3.365068 |
30715418-0231-4231-80c8-433174e4b062 | Frank076-web/flutterTaskApp | 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.998784 | 6.761023 |
c85e3222-ff96-411f-9fbf-31b3fd909c1d | ABHISHEKBANKAWAT/Prarambh | Graph/StoreAGraph.cpp | // Undirected graph
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, m;
int adj[n+1][m+1];
for(int i=0;i<m;i++){
int u,v;
cin>>u>>v;
adj[u][v] =1;
// adj[u][v]=weight; for weighted graph
adj[v][u] =1;
}
return 0;
}
// usign a adjacency list
#include<bits/stdc++.h>
using ... | ALGO | 0.999874 | 4.072099 |
48c00f48-0ce7-4c1b-b818-1bd2b51c07da | Coolcooo/laboratoryWork | lab1_14_5.cpp | #include <iostream>
#include <string>
using namespace std;
const int amountStruct = 8;
int amount=0;
string request;
struct NOTE
{
string lastName,firstName;
long long phoneNumber;
short birthday[2];
};
NOTE database[amountStruct],t;
void outputStruct(int i)
{
cout<<database[i].lastName<<" "<<database[i].firstNa... | TOOL | 0.861154 | 3.882934 |
d406ae39-f5be-4ef0-9d04-51e70f99b8a1 | dubesar/Competitive-Programming-Templates | C++_Templates/Polynomial Solver.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 10005;
// Using solution to Polynomial Madness as template for code
class poly{
public:
void init(int n){
poly.resize(n);
}
void set(int x , int vl){
poly[x] = vl;
}
int eval(int vl){
int x = poly.size();
int ans = 0;
fo... | ALGO | 0.999901 | 3.608794 |
abb9cf2b-17b6-447e-abb4-afe4e01dc79e | Asik8/My-Codeforces | Old Codes/C_Sakurako_s_Field_Trip.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define forni for (int i = 1; i < n; i++)
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
while (t--) {
ll n;
cin >> n;
vector <ll> v(n+1);
for(int i=1;i<... | ALGO | 0.99989 | 4.263611 |
bff59084-7417-44c7-b355-69c853dcc404 | loafofpiecrust/lfant | src/lfant/MeshLoader.cpp | // External
#include <boost/algorithm/string.hpp>
// Internal
#include <lfant/MeshLoader.h>
#include <lfant/util/String.h>
namespace lfant
{
using boost::algorithm::to_lower;
Geometry* LoadMesh(string name)
{
std::deque<string> tokens = Split(name, ".", "");
string ext = tokens[tokens.size()-1];
to_lower(ext);
... | TOOL | 0.920658 | 6.42242 |
20f9c933-604a-4c4e-918d-e86c199c6a8d | llinkl/cartwheel-3d | Core/Character.cpp | #include "Character.h"
#include <Utils/Utils.h>
#include <stdio.h>
/**
the constructor
*/
Character::Character() : ArticulatedFigure() {
}
/**
the destructor
*/
Character::~Character(void){
//nothing to do. We'll let whoever created the world deal with freeing it up
}
/**
This method is used to populate the rela... | TOOL | 0.867744 | 3.139037 |
00764929-0ce7-46cc-b25f-fc746ce12fd6 | gifsyn/AtCoder | ABC/ABC079/abc079b.cpp |
#include <cstdio>
int main(){
int n;
scanf("%d",&n);
unsigned long long l[n + 1];
l[0] = 2;
l[1] = 1;
for(int i = 2; i <= n; i++){
l[i] = l[i - 1] + l[i - 2];
}
printf("%lld\n",l[n]);
return 0;
} | ALGO | 0.999938 | 4.370257 |
e060d0f5-a81e-4fe6-b3a0-cba660c222ed | DanielGoncalves666/Programando | URI/C++/1871.cpp | #include<iostream>
#include<string>
using namespace std;
int main(){
int a,b;
while(true){
cin >> a >> b;
if(a+b == 0)
break;
int soma = a + b;
string str = to_string(soma);
for(int i=0; i< str.size(); i++){
if(str[i] != '0')
cout << str[i];
}
cout << endl;
}
return 0;
} | ALGO | 0.99968 | 4.101982 |
789b423b-581b-4adb-a7f4-f8daf082ea32 | Ghulam213/Dictionary-with-different-Data-Structures | TemplateBasedVectorDictionary/TemplateBasedVectorDictionary.cpp | //
// Created by GM on 06/01/2021.
//
#include "TemplateBasedVectorDictionary.h"
template<typename T, typename U>
TemplateBasedVectorDictionary<T, U>::TemplateBasedVectorDictionary() = default;
template <typename T, typename U>
T* TemplateBasedVectorDictionary<T,U>::begin(){
return &(words[0]);
}
template <type... | TOOL | 0.855373 | 5.467776 |
48f08fcb-9915-4424-9a4f-5830fac69257 | 0xWave-Flow/android-10.0.0_r45-C2 | av/media/libstagefright/codecs/amrwb/src/normalize_amr_wb.cpp | /*
------------------------------------------------------------------------------
Filename: normalize_amr_wb.cpp
Date: 12/10/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------------------------------------------------------... | ALGO | 0.998377 | 5.773019 |
c6b1f2cc-21f8-4198-9488-1db3c8391429 | MSami625/GFG-Problem-Solutions | Difficulty: Easy/Find Index/find-index.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> findIndex(vector<int>& arr, int key) {
// code here.
vector<int>ans(2,-1);
return find(arr,ans,key,0);
return ans;... | ALGO | 0.999658 | 5.747393 |
9f635fc4-0bba-46c3-a06b-82a058eab817 | sarvex/leetcode-small-basic | solution/1700-1799/1708.Largest Subarray Length K/Solution.cpp | class Solution {
public:
vector<int> largestSubarray(vector<int>& nums, int k) {
auto pos = max_element(nums.begin(), nums.begin() + nums.size() - k + 1);
return {pos, pos + k};
}
}; | ALGO | 0.999876 | 5.996024 |
64b54555-fc7d-4dca-839d-170eff49d3bb | ishandutta2007/codeforces | zdolny_kaczor/normal/1097/B.cpp | //Konrad Paluszek, University of Warsaw (former XIV LO Warsaw)
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include <bits/stdc++.h>
using namespace std;
#define sim template <class c
#define mor > muu & operator<< (
#define ris return *this
#define R22(r) sim> typename enable_if<1 r sizeof(dud<c>(0)), muu&>::type o... | ALGO | 0.999949 | 3.659227 |
d340141a-a244-4e32-b43c-654890f703f3 | Shivkisku/cplusplus | 41.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<vector<int>> permute(vector<int>& nums) {
vector<vector<int>> res;
DFS(res, nums, 0);
return res;
}
void DFS(vector<vector<int>>& res, vector<int>& nums, int pos) {
if (pos == nums.si... | ALGO | 0.999996 | 6.641791 |
e180ce3e-866a-4ffb-a71b-2eafe6e8baff | ms303956362/myexercise | DS/0_OJTest/gcd.cpp | #include <iostream>
using std::cin;
using std::cout;
void swap(long long& a, long long& b){
long long tmp;
tmp = a;
a = b;
b = tmp;
}
int main(int argc, char const *argv[])
{
long long a, b, r;
cin >> a >> b;
if (a < b)
swap(a, b);
r = a % b;
while (r != 0) {
a = b;... | ALGO | 0.999949 | 4.195784 |
0a453554-41fa-4c52-8d92-54c99404d6f4 | sogapalag/problems | atcoder/agc029c.cpp | #include <bits/stdc++.h>
using namespace std;
// when range [l, r), has property notP~P, want first P.
// when return r, means not found.
template <typename T>
T bs_first(T l, T r, function<bool (T)> f) {
assert(l < r);
T mid;
while (l != r) {
mid = l + (r-l)/2;
if (f(mid)) {
r... | ALGO | 0.999974 | 3.874201 |
aca9d8a2-3d0f-475c-b3f2-662dfa591ead | raincross7/code-similarity | codes/train_code/problem106/problem106_144.cpp | #define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())
... | ALGO | 0.999964 | 3.825128 |
1ccb00b4-bd74-4759-b2f1-a30c5283ec91 | baeharam/Handong-Problem-Solvers | problems/Dynamic Programming/BOJ 2213/지승윤.cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
vector<int> MIS[10001][2];
int N, a, b;
int maxx[10001][2], w[10001];
void dfs(int cur, int par) {
MIS[cur][1].push_back(cur);
maxx[cur][1] = w[cur];
for (auto next : adj[cur]) {
if (next == par) continue;
dfs(next, cur);
maxx[cur][1] += ma... | ALGO | 0.999957 | 4.308073 |
54c584ec-7ea5-491a-819f-bbe0dd746e55 | nehcoah/algorithm-template | atcoder/abc/321/f.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int mod = 998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int q, k;
cin >> q >> k;
vector<ll> ans(k + 1);
ans[0] = 1;
for (int i = 0; i < q; i++) {
char c; cin >> c;
if (c == '... | ALGO | 0.999924 | 4.395013 |
86aed0c2-f151-4ffa-8405-bac9c1f26061 | GURUSUJAN/CP | Binary Search.cpp | class Solution {
public:
int search(vector<int>& nums, int target)
{
int start=0;
int end=nums.size()-1;
int tar=target;
while(start<=end)
{
int mid=((start+end)/2);
if(nums[mid]==tar)
{
return mid;
exit... | ALGO | 0.999925 | 6.075403 |
e461c728-bc2d-4d7e-a51f-188f82f70f53 | ia-toki/toki-open-2024 | toki-open-2024-zero/solutions/solution-3.cpp | #include "buffet.h"
#if not LOCAL
#define NDEBUG 1
#endif
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (auto i = a; i < (b); ++i)
#define down(x, a) for (auto x = a; x--;)
#define all(x) begin(x), end(x)
#define sz(x) int(size(x))
#define let auto const
using ll = long long;
using lint = ll... | ALGO | 0.999026 | 3.888114 |
b1da02d6-f5ca-448b-aa16-e9d2281a189f | junstone1995/BaekJoon | c++/9465(스티커)/9465.cpp | #include <iostream>
#include <cstring>
using namespace std;
int n,t;
int map[2][100001];
int dp[2][100001];
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
cin >> t;
while(t--)
{
memset(map,0,sizeof(map));
memset(dp,0,sizeof(dp));
cin >> n;
for (int i = 0; i < 2; i++)
{
for (int j = 1; j <= ... | ALGO | 0.999808 | 3.588574 |
33f47476-642c-4c7f-b859-b99f0344c459 | Amit-45/cpp-data-structures | Matrix/rotate matrix clockwise.cpp | #include <iostream>
using namespace std;
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
void reverse(int arr[], int n)
{
int start = 0, end = n - 1;
int i = start, j = end;
while (i < j)
{
swap(arr[i++], arr[j--]);
}
}
void transpose(int arr[][100], int m, int n)... | ALGO | 0.999991 | 4.868676 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.