uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ceb3525e-7949-403d-a493-1ca3f6b385a9 | simoll/llvm-project | libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp | // UNSUPPORTED: c++03
// <vector>
// template <class... Args> iterator emplace(const_iterator pos, Args&&... args);
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main(int, char**)
{
{
std::vector<int> v;
v.reserve(3);
... | TEST | 0.973058 | 5.626007 |
4cb6bac3-42c1-4f78-8629-5297748e501a | yellowHatpro/Codes-Practice | Codeforces/Edu/2 Pointer/Step1_C_NumberOfEqual.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;cin>>n>>m;
map<int, int> a;
vector<int> b(m);
for (int i = 0; i < n; ++i)
{
int x;cin>>x;
a[x]++;
}
for (int i = 0; i < m; ++i)
{
cin>>b[i];
}
long long cnt = 0;
int j = 0;
for (auto i: a){
long long newcnt = 0;
while (j<m && i.firs... | ALGO | 0.999898 | 3.476821 |
4c0a5ad1-b644-49f6-86c6-7f6cebd094c0 | mayank-kabra2001/boost | libs/numeric/odeint/examples/bulirsch_stoer.cpp | #include <iostream>
#include <fstream>
#define _USE_MATH_DEFINES
#include <cmath>
#include <boost/array.hpp>
#include <boost/ref.hpp>
#include <boost/numeric/odeint/config.hpp>
#include <boost/numeric/odeint.hpp>
#include <boost/numeric/odeint/stepper/bulirsch_stoer.hpp>
#include <boost/numeric/odeint/stepper/bulirs... | ALGO | 0.999929 | 5.602321 |
b4d165f2-848d-47e2-990e-9dd66bcf81b6 | iamakashrout/Competitive-Programming | CodeForces/Hello 2025/c.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
const ll mod=1e9+7;
string binary(ll x){
string ans="";
while(x>0){
if(x%2==0){
ans='0'+ans;
}
else{
ans='1'+ans;
}
x/=2;
}
while(ans.size()<32){
... | ALGO | 0.999901 | 3.707505 |
72bff761-495d-4616-ad15-01aad82b3dda | aqilc/2dgfx | deps/extern/tracy/client/TracyCallstack.cpp | #include <limits>
#include <new>
#include <stdio.h>
#include <string.h>
#include "TracyCallstack.hpp"
#include "TracyDebug.hpp"
#include "TracyFastVector.hpp"
#include "TracyStringHelpers.hpp"
#include "../common/TracyAlloc.hpp"
#include "../common/TracySystem.hpp"
#ifdef TRACY_HAS_CALLSTACK
#if TRACY_HAS_CALLSTACK =... | TOOL | 0.854065 | 5.406917 |
1bc5c47b-a2d7-4eca-999f-e73dc3be83b3 | Tasurron/Introduction-to-Programming | C++/Final_Assignment.cpp | #include<iostream>
using namespace std;
class Person
{
protected:
int data;
public:
Person()
{
cout<<"Empty for Person"<<endl;
}
Person(int d)
{
data = d;
cout<<"parameterized for Person"<<endl;
}
void showDataPerson()
{
cout<<"Data:"<... | TOOL | 0.870904 | 4.441097 |
50ac9d11-5618-4f12-a252-fcb09ca6bacf | ishandutta2007/codeforces | maxwellzen/normal/1650/D.cpp | #include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> iset;
typedef long long ll;
typedef long double db;
typedef string str;
typedef vector<int> vi;
typedef vector... | ALGO | 0.9998 | 3.924801 |
b0e0000a-475a-4a48-8bae-2c47ac9ad6ab | ishandutta2007/codeforces | monogon/normal/993/C.cpp |
#include <bits/stdc++.h>
#define ll long long
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define vi vector<int>
#define pii pair<int, int>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
using namespace std;
// require x = 0
// O(nm) options for each... | ALGO | 0.999961 | 3.979151 |
4f47c2d4-3296-4c90-8959-478a2108ce50 | ToraSpencer/libigl_CGAL_openGL | include/igl/is_edge_manifold.cpp | #include "is_edge_manifold.h"
#include "oriented_facets.h"
#include "unique_simplices.h"
#include "unique_edge_map.h"
#include <algorithm>
#include <vector>
template <
typename DerivedF,
typename DerivedEMAP,
typename DerivedBF,
typename DerivedBE>
IGL_INLINE bool igl::is_edge_manifold(
const Eigen::Matr... | ALGO | 0.928264 | 7.240858 |
b439d892-159a-409e-b672-e419a5ed586c | TacticalMeow/IKSolverLibigl | igl/copyleft/cgal/triangle_triangle_squared_distance.cpp | template < typename Kernel>
IGL_INLINE bool igl::copyleft::cgal::triangle_triangle_squared_distance(
const CGAL::Triangle_3<Kernel> & T1,
const CGAL::Triangle_3<Kernel> & T2,
CGAL::Point_3<Kernel> & P1,
CGAL::Point_3<Kernel> & P2,
typename Kernel::FT & d)
{
typedef CGAL::Point_3<Kernel> Point_3;
typedef C... | ALGO | 0.999318 | 6.756804 |
01316542-c44b-4304-b2cf-00f61daff93f | martinal/mshr | 3rdparty/CGAL-4.6.3/examples/Boolean_set_operations_2/symmetric_difference.cpp | /*! \file symmetric_difference.cpp
* Computing the symmetric difference of two polygons with holes.
*/
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Boolean_set_operations_2.h>
#include <list>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Point_2 ... | ALGO | 0.984125 | 6.81672 |
bf3f151b-d245-4d95-995a-0f674a4c39a0 | baofuhann/FISCO_BCOS_FL | deps/src/boost/libs/math/example/numerical_derivative_example.cpp | #ifdef _MSC_VER
# pragma warning (disable : 4996) // assignment operator could not be generated.
#endif
# include <iostream>
# include <iomanip>
# include <limits>
# include <cmath>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/math/special_functions/next.hpp>... | ALGO | 0.998508 | 7.277137 |
8aeb70e4-afa3-4d95-85ca-c8ae0decfecf | matthew-pisano/masm | src/utils.cpp | //
// Created by matthew on 4/15/25.
//
#include "utils.h"
#include <algorithm>
#include <filesystem>
#include <regex>
#include <sstream>
std::string readSeq(StreamHandle& streamHandle) {
std::string input;
while (true) {
const char c = streamHandle.getCharBlocking();
if (c == '\n')
... | TOOL | 0.948196 | 4.57736 |
d187a323-f71b-41b7-9c9a-ac2735ea734f | zysundar/CPP_Programming | tower of henoi.cpp | #include <iostream>
#include <conio.h>
using namespace std;
void tower(int a,char from,char aux,char to)
{if(a==1)
{cout<<"disc 1 move from"<<from<<"to"<<to;
}
else
{
tower(a-1,from,to,aux);
cout<<"disc move from"<<from<<"to"<<to;
tower(a-1,aux,from,to);
}
}
int main()
{int n;
cout<<"enter the number of disc";
cin>> ... | ALGO | 0.997067 | 4.058333 |
36323750-817c-46ac-8b63-0fe8d3669e98 | ppraval/Codez | cplusplus/DIcounter.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s = "III";
int n = s.length();
vector<int> arr;
int i = 0, d = n;
for(int j = 0; j <= n; j++)
{
if(s[j] == 'I')
arr.push_back(i++);
else
arr.push_back(d--);
}
for(int i : arr)
... | ALGO | 0.999909 | 4.300962 |
5944cbb7-5f62-4654-a693-6a815d1da1ab | raincross7/code-similarity | codes/train_code/problem465/problem465_298.cpp | #include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
bool do_dp(vector<int> v,int sum){
vector<bool> dp;
dp.assign(8080,false);
dp[0] = true;
if(sum<0) return false;
for(int i=0;i<v.size();i++){
for(int j=8080;j>=0;j--){
if(j-v[i]>=0&&dp[j-v[i]]) dp[j] = true;
}
}
if(dp[sum]) return... | ALGO | 0.999992 | 3.334919 |
be3e3d5d-eab5-49b2-9d37-2b6292d540de | JamesQAQ/Coding-Practices | LeetCode/Medium/1631. Path With Minimum Effort/2023-09-16_Accepted.cpp | struct Node {
int x;
int y;
int dp;
bool operator>(const Node& other) const {
return dp > other.dp;
}
};
class Solution {
private:
int dir[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
public:
int minimumEffortPath(vector<vector<int>>& heights) {
int n = heights.size();
int m = heights[0].siz... | ALGO | 0.999986 | 6.43505 |
1f0ea897-fc80-42ae-82f6-1f44d8d3fd5b | ValentinnoCruz/CPP-Object-Oriented-Programming | Projects/project 2/Project2_v3/Ultimate.cpp | #include <iostream>
#include "TicTacToe.h"
#include "Ultimate.h"
#include <Windows.h>
using namespace std;
Ultimate::Ultimate()
{
size = 3;
ultimate = new TicTacToe*[size*size];
for (int i = 0; i < size*size; i++)
{
ultimate[i] = new TicTacToe();
}
win_status = new int[size*size];
for (int i = 0; i < size*si... | ALGO | 0.871124 | 3.861888 |
622f0990-2817-4a0f-96e3-4ae555a50754 | edosportelli/CrackingTheCodeInterview | Leetcode/strings/merge_sort_array.cpp | /*
Input: nums1 = [1,2,3,0,0,0], m = 3, nums2 = [2,5,6], n = 3
Output: [1,2,2,3,5,6]
*/
#include <iostream>
#include <vector>
void merge_sort(std::vector<int>& v1, std::vector<int>& v2, int num1, int num2)
{
int index{num1 + num2 - 1};
while (index >= 0)
{
if (num2 == 0)
break;
... | ALGO | 0.999993 | 6.206569 |
b6a2b38f-b107-4b4a-9df8-60770a8341e1 | takashigoto1207/atcoder | abc2xx/abc248/abc248_a.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int main() {
string S;
cin >> S;
vector<bool> flag(10, false);
rep(i, 9) flag[S[i] - '0'] = true;
rep(i, 10) if (!flag[i]) cout << i << endl;
return 0;
} | ALGO | 0.998986 | 4.577969 |
53405981-5c91-4ced-9b35-56a9bc2d98a7 | dzbwhut/algerithm-basic | 4.11 fibonacci.cpp | #include <windows.h>
#include <iostream>
#include <math.h>
using namespace std;
const int P=1000000007;
class Matrix22{
public:
int m[2][2];
Matrix22(int x=0) {
if (x == 0) {
m[0][0] = m[0][1] = m[1][0] = m[1][1] = 0;
}
else{
m[0... | ALGO | 0.999791 | 3.628325 |
c690b5d9-411c-451c-b9d9-1360ca498dac | rocmnavi/boost | libs/spirit/example/x3/calc/calc7/vm.cpp | #include "vm.hpp"
namespace client
{
void vmachine::execute(std::vector<int> const& code)
{
std::vector<int>::const_iterator pc = code.begin();
stack_ptr = stack.begin();
while (pc != code.end())
{
switch (*pc++)
{
case op_neg:
... | ALGO | 0.939711 | 5.070799 |
71bb7fc9-d0d9-41e4-b3c4-295d69f5ceb9 | ishandutta2007/codeforces | zhouyuyang/normal/869/D.cpp | #include<bits/stdc++.h>
#define mo 1000000007
#define N 255
using namespace std;
map<int,int> mp;
int u[10],v[10],tot;
int head[N],num[N],vis[N];
struct edge{int to,next;}e[N*10];
void upd(int &x,int y){
(x+=y)>=mo?x-=mo:23333;
}
int getid(int x){
if (!mp[x]) mp[x]=(int)mp.size();
return mp[x];
}
void add(int x,int ... | ALGO | 0.999937 | 4.29253 |
64e6cfc4-69ce-4ede-b731-aac237f7b519 | AnastasiaGomorina/oopMyLabWork | ЛР 5/lab_4/lab_4.cpp | #include "AEROFLOT.h"
#include <algorithm>
#include <windows.h>
int main() {
SetConsoleOutputCP(1251);
const int arraySize = 7;
AEROFLOT aeroflotArray[arraySize];
// Ввод данных в массив и сортировка по пунктам назначения
for (int i = 0; i < arraySize; ++i) {
aeroflotArray[i].setInputValue... | ALGO | 0.99383 | 4.413341 |
2c672413-ff77-4bc0-a172-c9fd20e63613 | SCUT-CCNL/3DSIFT | 3DSIFT/3party/Eigen/bench/sparse_transpose.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_transpose.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
// -DNOGMM -DNOMTL
// -DCSPARSE -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef... | ALGO | 0.987989 | 5.110691 |
7a499f5d-1f4d-464c-bc7c-0c34e83c67dc | ADS-bot/Leetcode | 2260-minimum-consecutive-cards-to-pick-up/2260-minimum-consecutive-cards-to-pick-up.cpp | class Solution {
public:
int minimumCardPickup(vector<int>& cards) {
int ans = INT_MAX;
unordered_map<int, int> lastSeen;
for (int i = 0; i < cards.size(); ++i) {
if (const auto it = lastSeen.find(cards[i]); it != lastSeen.cend())
ans = min(ans, i - it->second + 1);
lastSeen[cards[i]... | ALGO | 0.999908 | 6.227571 |
7bb58164-91bf-4bae-b85c-af1d26c5d680 | liuq901/code | CF/cd_100451_K.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
struct data
{
int a,b,id;
ll dead;
};
inline bool operator <(const data &a,const data &b)
{
return(a.dead<b.dead);
}
data a[200010];
vector <int> b;
bool check(ll delay,int n,int F,bool print)
{
ll now=0;... | ALGO | 0.999964 | 3.040243 |
2bc8331f-5a41-438c-a04c-4f63fc31dfaa | ishandutta2007/codeforces | derekfeng/normal/200/D.cpp | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <ma... | ALGO | 0.997823 | 3.601991 |
1a2740e2-41f0-4639-9282-dbb7eca36e5c | merge34/hometask | semester_1/homework_6/problem_4/sort.cpp | #include "sort.h"
/**
* Merges (both) sorted `sourceList` into `destList`
*/
void merge(listStuff::PairStringList *destList,
listStuff::PairStringList *sourceList,
std::function<bool(const std::pair<std::string, std::string> &,
const std::pair<std::string, std::string> &... | ALGO | 0.999639 | 5.972963 |
760e29e2-2c84-4a7e-94c9-2513ce30a551 | thegamer1907/Code_Analysis | scrape/data/Organized/Isalix/Isalix_A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
const int maxn=1e5+5;
ll a[maxn];
int main()
{
ll n,m,k;
scanf("%lld%lld%lld",&n,&m,&k);
for(int i=1;i<=m;i++) scanf("%lld",&a[i]);
a[m+1]=inf;
ll pre=0,ans=0,t;//pre是上一个下标志
ll v;
if(0==a[1]%k) v=a[1]/k*k;
else v=a[1]/k*k+k;
... | ALGO | 0.99974 | 3.132658 |
2f398881-43c0-4102-ac80-f313c00966f8 | satyakumarch/DSA2024 | DSA2024/ForLoop/TenTOOne.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter the number:";
cin>>n;
for(int i=n;i>=1;i--){
cout<<i<<" ";
}
return 0;
} // namespace std;
| ALGO | 0.999236 | 3.540656 |
05ca4fb1-6b08-44ea-80ae-aa53fe78f678 | cheolwanpark/PS | boj/9251.cpp | // https://www.acmicpc.net/problem/9251
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int memo[1001][1001];
char a[1002], b[1002];
int alen, blen;
int main() {
scanf("%s", a+1); alen = strlen(a+1);
scanf("%s", b+1); blen = strlen(b+1);
for(int i=1; i<=alen; ++i) {
... | ALGO | 0.9999 | 4.017224 |
647b68f9-5ec2-42d0-9b51-f6399d61c002 | ihritwik/Algorithmic-Coding | leetcode/219. Contains Duplicate II.cpp | #include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
bool containsNearbyDuplicate(vector<int>& nums, int k) {
unordered_map<int, int> data (nums.size());
int recent_repeat_index;
for (int i = 0;... | ALGO | 0.999948 | 5.50871 |
aec02039-255f-4f0c-904d-80a119f295bc | amitkrjha-geek/leetcode | 209-minimum-size-subarray-sum/209-minimum-size-subarray-sum.cpp | class Solution {
public:
int minSubArrayLen(int target, vector<int>& nums) {
int start=0,sum=0,ans=INT_MAX;
for(int i=0;i<nums.size();i++)
{
sum+=nums[i];
while(sum>=target)
{
ans=min(ans,i-start+1);
sum-=nums[start];
... | ALGO | 0.999993 | 6.286231 |
6ca35d87-412b-4b73-8055-dd77e7da216f | JeyJey1000/Bitcoin-Knots | src/util/strencodings.cpp | #include <span.h>
#include <tinyformat.h>
#include <util/strencodings.h>
#include <array>
#include <cassert>
#include <cstring>
#include <limits>
#include <optional>
#include <ostream>
#include <string>
#include <vector>
static const std::string CHARS_ALPHA_NUM = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0... | TOOL | 0.991591 | 7.221657 |
7c3817dd-f750-4976-bc69-696f753700f7 | kamyu104/LeetCode-Solutions | C++/count-number-of-ways-to-place-houses.cpp | // Time: O(logn)
// Space: O(1)
// matrix exponentiation
class Solution {
public:
int countHousePlacements(int n) {
vector<vector<int>> T = {{1, 1},
{1, 0}};
int64_t result = matrixMult({{2, 1}}, matrixExpo(T, n - 1))[0][0]; // [a1, a0] * T^(n-1) = [an, a(n-1)]
... | ALGO | 0.99999 | 6.317715 |
6ef60001-2fca-4498-8b92-013060a9a7e7 | 7matuag/DSA-Sheet-by-Love-Babbar-450-Questions- | Array/Factorials of large numbers.cpp | class Solution {
public:
vector<int> factorial(int N){
// code here
vector<int> fact;
fact.push_back(1);
for (int i = 2; i <= N; i++){
int carry = 0;
for (int j = fact.size() - 1; j >= 0; j--){
int sum = fact[j] * i + carry;
fac... | ALGO | 0.999929 | 5.858826 |
f07302fa-3d5d-466b-a4a8-77361a7a20d5 | NahushRana12/CompetitionCoding | SCP/D.duplicateset.cpp | #include <bits/stdc++.h>
using namespace std;
bool isvovel(char c){
return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
}
void solve()
{
int n,count = 0;
cin>>n;
int arr[n];vector<int> result;
set<int> book;
int i =0 ;int l = n;
while(l--){
int temp;
cin>>temp;
arr[i++] = temp;
}... | ALGO | 0.999547 | 3.763793 |
50521fe7-2e99-40f9-af81-25802d584451 | Dacia04/code_cplusplus | loaibonguyenam.cpp | #include<iostream>
#include<string>
int main()
{
std::string s;
std::cin>>s;
for(int i=0;i<s.size();i++)
{
s[i]= std::tolower(s[i]);
if(s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u' || s[i]=='y')
{
s.erase(s.begin()+i);
i--;
}
... | ALGO | 0.997586 | 3.460527 |
f70d9166-cfe4-4ad3-bace-19592d4b92f6 | SanketRakshe/Striver-s-SDE-Sheet | 1) Array(Part-1)/MaximumSubarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int n = nums.size();
int maxi = INT_MIN;
int sum = 0;
for(int i=0; i<n; i++) {
sum += nums[i];
if(sum > maxi) {
maxi = max(sum, maxi);
}
if(sum < 0) {
... | ALGO | 0.999898 | 6.451627 |
12bc9340-9291-4c37-9441-3977f6747274 | AlexHPGrall/LeetCodeSolutions | problems/sum_of_left_leaves/solution.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999838 | 6.541841 |
fbff75d0-a395-4613-bac9-f6c90af53c71 | Hossainul/Problem-Solving | week 8/Day 2/B_Different_Divisors.cpp | // Bismillah.
#include<bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define p cout <<
#define f for(int i = 0; i<n; i++)
#define testcase int t; cin >> t; while(t--)
#define faster ios::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int gcd(int a)
{
for(int i = 2; i * i <= a; i++)
{
... | ALGO | 0.999964 | 4.683903 |
0bf0e844-876a-4360-9a43-34618070dbaf | AlaaAbuHantash/Competitive-Programming | Codeforces/75C - Modified GCD.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <stack>
#include <cstring>
#include <math.h>
#include<cstdio>
#include<deque>
#include<sstream>
#include <stdio.h>
#include <fstream>
#d... | ALGO | 0.999977 | 3.892518 |
e15a9b94-2e55-43a8-8bb0-0e6e79eb1dcc | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/count-all-possible-routes-Solution.countRoutes/177777_DoS_Exec_Code_Overflow.cpp | void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
int width, int height,
GfxImageColorMap *colorMap,
int *maskColors, GBool inlineImg)
{
unsigned char *buffer;
unsigned int *dest;
cairo_surface_t *image;
cairo_pattern_t *pattern;
int x, y;
ImageStream *imgStr;
Guchar *p... | TOOL | 0.973324 | 5.159135 |
90c33a85-f2a4-49be-836b-8b9de3be826e | ashishkumar11125/GFG-DSA-question | Difficulty: Easy/Nearest multiple of 10/nearest-multiple-of-10.cpp | //{ Driver Code Starts
#include <iostream>
using namespace std;
// } Driver Code Ends
class Solution {
public:
string roundToNearest(string str) {
// Complete the function
int n = str.size();
// base case
if(str[n-1] == '0')
return str;
... | ALGO | 0.999581 | 6.874651 |
763d4536-3d63-405c-9092-84a8dcacb0b5 | dementrock/acm | poj/Archives/3013/7084561_RE.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
const int MAXV=50000;
int que[MAXV+1],dis[MAXV+1],vis[MAXV+1],v,e,*map[MAXV+1],*edge[MAXV+1],degree[MAXV+1],
x[MAXV+1],y[MAXV+1],z[MAXV+1],w[MAXV+1];
void spfa(int s)
{
memset(dis,0x77,sizeof(dis));
memset(vis,0,sizeof(vis));
memset(que,0,sizeof(que));
int clo... | ALGO | 0.999991 | 3.8297 |
42aac04b-1882-4b78-b8d7-dfd870ae9836 | 21900679/CodingTest | 10819번 - 차이를 최대로.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int N;
int input[8];
int num[8] = {0,1,2,3,4,5,6,7};
int result = 0;
int nextValue(){
int count = N-1;
while(count >= 1 && num[count] <= num[count-1])
count--;
if(count == 0){
return 0;
}
else{
int index = count... | ALGO | 0.999904 | 3.667088 |
88549a2a-cc86-46dd-b812-ab777f7e7ed7 | Viralore/unCode | Arrays/1D Array/unCode_Arrays_Sort_BubbleSort_Ascending.cpp | //Program for Bubble Sort(in Ascending Order) to sort the Array
//Time Complexity of Bubble Sort
//Worst Case Average Case Best Case
//O(N^2) O(N^2) O(N)
//Space Complexity of Bubble Sort is O(1)
#include<bits/stdc++.h>
using namespace std;
void swap(int *a,int *b) //utilit... | ALGO | 0.999922 | 5.257936 |
c85a50bf-1faf-4e40-995c-f01e45f66bc1 | ozzgurkarli/fitnessapp | 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 |
1bcd1b94-b814-45b3-8516-28e878f1af57 | Ahmed99125/Sudoku | Game.cpp | //
// Created by at991 on 8/22/2023.
//
#include "Game.h"
#include <iostream>
int Game::fails = 0, Game::tries = 0;
bool Game::valid_input = 1, Game::wrong_ans = 0;
void Game::play(Board &board) {
valid_input = 1, wrong_ans = 0;
tries++;
std::cin >> x >> y >> value;
x--, y--;
if (x < 0 || y < 0 |... | TOOL | 0.980551 | 5.337436 |
a7df1108-0203-400d-b388-b4dc8e9c01ea | nillmishra/DSA-in-CPP | 2D array/vector/basic.cpp | #include<iostream>
#include<vector>
using namespace std;
int main (){
vector <vector<int>> arr;
vector<int>a{1,2,3};
vector<int>b{4,5,6};
vector<int>c{7,8,9};
arr.push_back(a);
arr.push_back(b);
arr.push_back(c);
for (int i = 0; i<arr.size(); i++)
{
for (int j = 0; j<arr[i... | ALGO | 0.991123 | 3.382679 |
c0f607f8-f22b-494a-af29-4b722b93aca1 | notYnoj/Programming-Questions-in-CPP | Codeforces/F/F - Bomb.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mxN = 1e9+1;
ll formula(ll ai, ll bi, ll n){
ll start = ai*n;
ll dif = bi*(n*(n-1))/2;
return start-dif;
}
void solve(){
ll ans = 0;
ll n,k;
cin>>n>>k;
vector<ll> a(n);
vector<ll> b(n);
for(ll i = 0; i<n; i+... | ALGO | 0.999975 | 3.214889 |
80b76cd2-325f-4590-8a06-59d8d48d9816 | Baibhavsingh07/Data-structures | 50-powx-n/powx-n.cpp | class Solution {
public:
double myPow(double x, int n) {
int i,j,c=0,s=0;
return pow(x,n);
}
}; | ALGO | 0.999693 | 5.528866 |
36547fc2-d85f-4968-86d4-47bb0df36619 | Eternity329/algorithms | binary search/1760F.cpp | //二分答案+贪心 (check为周期等于k+1的检查)
//https://codeforces.com/contest/1760/problem/F
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
bool check(ll k,vector<int>&a,ll d,ll c){
// ll res = 0;
// int n=a.size();
// for (int i = 0; i < min(n*1LL, k + 1); i++) {
// res += 1LL * a[i] * (d / (... | ALGO | 0.999955 | 3.817387 |
7626ca60-2ee8-436f-b183-0b4b52ab6cfc | iamtasir/Competitive-programming | 2022/April/string unique.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
sort(s.begin(), s.end());
int index = unique(s.begin(), s.end()) - s.begin();
for (int i = 0; i < index; i++)
cout << s[i];
cout << "\n";
} | ALGO | 0.999785 | 4.015505 |
45d9aa66-e132-4877-b5df-809dfe22fb51 | yaadhav/Competitive-Programming | HR/Problem Solving/Implemetation/Bill Division/1.cpp | #include <bits/stdc++.h>
using namespace std;
void bonAppetit(vector<int> bill, int k, int b) {
int sum = accumulate( bill.begin(), bill.end(), 0);
sum = sum-bill[k];
if( (sum/2)==b )
cout << "Bon Appetit" ;
else
cout << b-(sum/2) ;
}
int main()
{
int n, k, b, temp;
c... | ALGO | 0.999796 | 3.847598 |
01afa6d0-578b-456c-931e-e0221ac5f679 | VarunReddyT/DSCPP | 46_LL_Head_End.cpp | #include<iostream>
using namespace std;
class Node{
public:
int value;
Node* next;
Node(int data){
value = data;
next = NULL;
}
};
void insertAtHead(Node* &head, int val){
Node * new_node = new Node(val);
new_node->next = head;
head = new_node;
}
void insertAtEnd(Node*... | ALGO | 0.997715 | 4.528747 |
89f7dacc-4c36-4c37-ad89-77402c12ebb9 | Mindjolt2406/Competitive-Programming | Codeforces/E47/E.cpp | /*
Rathin Bhargava
IIIT Bangalore
*/
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 998244353
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.s... | ALGO | 0.999981 | 4.486779 |
89f9aa57-2f5a-4eb8-b3c8-c06546e5f61c | VivekKumarMishra1301/competative-coding | Recursion_return_subset_of_a_array.cpp | #include <iostream>
/***
You need to save all the subsets in the given 2D output array. And return the number of subsets(i.e. number of rows filled in output) from the given function.
In ith row of output array, 1st column contains length of the ith subset. And from 1st column actual subset follows.
For eg. Input : {1... | ALGO | 0.999951 | 3.873604 |
d9164a0b-8fb8-4895-89e2-050adc71a5e1 | TCGBench/TCGBench | data/partially_correct_code/partially_correct_code_noip/P1525/60-80_2.cpp | #include <cstdio>
#define MAXN 20002
#define MAXM 100001
int n, m;
int father[MAXN];
int enemy[MAXN];
int arr[MAXM][3];
void prepare() {
for (int i = 1; i <= n; ++i) {
father[i] = i;
enemy[i] = 0;
}
}
int find(int i) {
return father[i] == i ? i : (father[i] = find(father[i]));
}
void un... | ALGO | 0.999993 | 4.73778 |
f16bf8c3-ab93-4831-a75a-dd7c5061d31f | VigoWong/leetcode_training | InsertionSortList/InsertionSortList.cpp | //
// Created by Vigo Wong on 28/5/20.
//
// Definition for singly-linked list.
#include <iostream>
#include <vector>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next... | ALGO | 0.999977 | 6.201595 |
fd25d0fe-2862-4f8d-84c0-a518864bce61 | Miguel235711/CompetitiveProgrammingAndMore | Competitive Programming 3/Section 1.4/Time Waster/10033 - Interpreter/C++/main.cpp | #include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define SQR(x) ((LL)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define PERMUTE next_permutation
#define fi ... | ALGO | 0.998955 | 3.839594 |
c336d52b-e4e3-4fc0-a449-51bc184c51c2 | congping/particle-coordinated-transport-model-in-3-dimensional-spance | twostepsmove.cpp | #include <math.h>
#include <stdlib.h>
#include <vector>
#include <stdio.h>
double ran2(long *);
double rand_norm_1(long * p);
double inverseGaussian(double lam,double mu, long * p){
double v=rand_norm_1(p);
v=v*v;
double x1=mu+mu/(2*lam)*(mu*v-sqrt(4*mu*lam*v+v*v*mu*mu));
double r=ran2(p);
... | ALGO | 0.99922 | 3.624194 |
9e49a161-1b7a-42a9-944f-6f8ee30cf616 | guancongyi/Labcapacity | optical_flow-3/myfunc.cpp | #include "Header.h"
void myfunc(Mat &image1, Mat &image2, ofstream &out)
{
int myarray[11][11];
vector<Point2f>features;
vector<Point2f>features2;
vector<uchar> status;
vector<float> err;
int maxCount = 2000; //max point
double minDis =10; //min distance between points
double qLevel = 0.01; //quality level
//... | ALGO | 0.96714 | 3.643263 |
c6ba6fcf-6a9e-471b-ad7b-1a4196d025a3 | OprahDingus/Decode-DSA-C-- | Week 11 - Recursion/55 Recursion Part 4/12_permutationsSequence.cpp | #include <iostream>
#include <string>
using namespace std;
string helper(string str, int k, string ans) {
int n = str.length();
if (n == 1) {
ans = ans + str;
return ans;
}
int fact = 1;
for (int i = 2; i <= n - 1; i++) {
fact = fact * i;
}
int idx = k / fact;
if... | ALGO | 0.999984 | 5.77044 |
f807a411-5264-4c3e-8f64-47820150ae13 | sidjha57/Competitive | C++/Unacademy/Recursion Backtracking and DP/Dynamic Programing/1D DP/Coins_Game.cpp | //template
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//typedef trie<strin... | ALGO | 0.999984 | 4.286155 |
e3de059e-8411-4e06-a3d3-11d01335294b | thabumi/test3 | Untitled2.cpp | #include <bits/stdc++.h>
using namespace std;
map<int, double> m;
// 2's complement
string decToBin(double d, int dec) {
// 14-dec ---> -dec
string res = "";
if (d < 0) {
res += '0';
d = -d;
double t = d - (int)(d);
int k = (int)(d);
for (int i = 14 - dec; i >= 0; i--) {
if ((int)(m[i]) <= k) {
k... | ALGO | 0.999785 | 3.480766 |
f6551fc6-9519-4497-80ab-23487bad3f6b | Macesuted/Code | Nowcoder/247576.cpp | /**
* @file 247576.cpp
* @author Macesuted (<EMAIL>)
* @date 2023-01-06
*
* @copyright Copyright (c) 2023
*
*/
#include <bits/stdc++.h>
#include <string>
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif
bool mem1;
void solve(void) {
int n, m;
string s, t;
cin >> n >> m >> s >> t, s = "... | ALGO | 0.99994 | 4.517451 |
571383e1-b8af-4288-89bb-3a14633de2f6 | kunalshah017/Learning-CPP | # Algorithms/Sorting/Bubble_Sort.cpp | // In this algorithm we will sort the array of 10 numbers in ascending order. The algorithm is as follows:
#include <iostream>
using namespace std;
int main()
{
int array[10];
cout << "Enter 10 numbers" << endl;
for (int i = 0; i < 10; i++)
{
cin >> array[i];
}
for (int i = 0; i < 10... | ALGO | 0.999923 | 4.305367 |
ad12c9d7-83dd-4540-8c91-7ec51a779560 | vidhi2002/Striver-sSheet | Wave Array - GFG/wave-array.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// #include <algorithm>
// } Driver Code Ends
class Solution{
public:
// arr: input array
// n: size of array
//Function to sort the array into a wave-like array.
void convertToWave(int n, vector<int>& arr){
// Y... | ALGO | 0.999828 | 5.637173 |
5bb24ec6-c8f2-4bef-be58-77938f81282b | ishandutta2007/codeforces | um_nik/normal/552/A.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
int n;
cin >> n;
int ans = 0;
while(n--)
{
int x, xx, y, yy;
cin >> x >> y >> xx >> yy;
ans += (abs(xx - x) + 1) * (abs(yy - y) + 1);
}
cout << ans << endl;
return 0;
} | ALGO | 0.925678 | 3.115903 |
3943a744-0c04-4b8b-abf8-697163daa983 | GuacheSuede/MSSubmission1234567890 | submission/sma/boost_1_69_0/libs/thread/tutorial/factorial.cpp | #include <boost/thread/thread.hpp>
#include <iostream>
class factorial
{
public:
factorial(int x, int& res) : x(x), res(res) { }
void operator()() { res = calculate(x); }
int result() const { return res; }
private:
int calculate(int x) { return x <= 1 ? 1 : x * calculate(x-1); }
private:
int x;
... | TOOL | 0.940568 | 6.021823 |
6c8f9321-3083-4619-88fe-9196b2da1638 | Amebin/Cplusplus | tp4_d_char/ejercicio 3.cpp | #include<stdlib.h>
#include<stdio.h>
#include<string.h>
main(){
char Cadena[200];
char Palabra[30];
char *Posicion;
printf("Ingresa el texto: ");
gets(Cadena);
_flushall();
strupr(Cadena);
puts(Cadena);
printf("\nIngresa la Palabra a buscar en el texto: ");
gets(Palabra);
_flushall();
strupr(Palabr... | ALGO | 0.989468 | 3.503813 |
8cab4269-0161-460f-91c4-9d0bc311e60c | coderRahul212000/DSA-CodeHelp | Lecture048 Linked List Day5/duplicates.cpp | /************************************************************
Following is the linked list node structure.
class Node
{
public:
int data;
Node* next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
};
********... | ALGO | 0.999876 | 4.766758 |
66198c98-6c76-4d73-9a0e-1b6cf7f412db | MSwadhin/Judge-CDIUPC | validator.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define LL long long
#define READ(x) freopen(x,"r",stdin)
#define WRITE(x) freopen(x,"w",stdout)
#define BOOST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define mem(x,y) mems... | ALGO | 0.999122 | 3.60331 |
4a6fb368-b6dd-4f8d-8637-ccdf13ff488e | gjainiitr/Algorithms-and-Data-Structres | Searching/Subarray-With-Given-Sum.cpp | // Problem URL :- https://practice.geeksforgeeks.org/problems/subarray-with-given-sum-1587115621/1
// } Driver Code Ends
// Function to find the subarray with given sum k
// arr: input array
// n: size of array
void subarraySum(int arr[], int n, int s){
// Your code here
// end does not act as an inclusive pa... | ALGO | 0.999918 | 5.564535 |
aa73a4be-3511-4d7a-8806-b3cda0675417 | ishandutta2007/codeforces | eddy1021/normal/547/B.cpp | // eddy11021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long long ll;
typedef pair<int,int> PII;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF 1023456789ll
#define INF16 10000000000000000ll
#define FI first
#define SE second
#define PB push_back
#define MP make_pair
#defi... | ALGO | 0.999988 | 3.550481 |
260d314a-1181-46fa-82c5-503f5e138cea | dzungpng/material-point-method-jello-simulation | Deps/libigl/python/py_igl/py_gaussian_curvature.cpp | m.def("gaussian_curvature", []
(
const Eigen::MatrixXd& V,
const Eigen::MatrixXi& F,
Eigen::MatrixXd& K
)
{
return igl::gaussian_curvature(V,F,K);
}, __doc_igl_gaussian_curvature,
py::arg("V"), py::arg("F"), py::arg("K"));
| ALGO | 0.906012 | 5.120569 |
03970b7a-878f-4eff-be54-5bad2f4782c1 | sarvex/leetcode-ksh | solution/0100-0199/0139.Word Break/Solution.cpp | class Solution {
public:
bool wordBreak(string s, vector<string>& wordDict) {
unordered_set<string> words(wordDict.begin(), wordDict.end());
int n = s.size();
vector<bool> dp(n + 1);
dp[0] = true;
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < i; ++j) {
... | ALGO | 0.999683 | 6.425675 |
5b86ea0e-3db5-4190-9087-3b9f00069211 | abnsl0014/Coding-Questions | CF(Code Forces)/cf8.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,r;
cin>>n;
if(n%4==0||n%7==0||n%47==0||n%74==0)
{
cout<<"YES\n";
return 0;
}
while(n){
r=n%10;
if(r!=4 && r!=7)
{
cout<<"NO\n";
return 0;
}
n=n/10;
}
cout<<"YES\n";
re... | ALGO | 0.999834 | 3.343965 |
9193a1be-4ec6-4c1b-8fe0-55b5d83467d6 | giovanni1351/OpenCVOpenGL02 | OpenCV4-6/sources/modules/video/src/tracking/detail/tracker_feature.cpp | #include "../../precomp.hpp"
#include "opencv2/video/detail/tracking.detail.hpp"
namespace cv {
namespace detail {
inline namespace tracking {
TrackerFeature::~TrackerFeature()
{
// nothing
}
void TrackerFeature::compute(const std::vector<Mat>& images, Mat& response)
{
if (images.empty())
return;
... | ALGO | 0.969913 | 6.804374 |
a8699525-76bc-4731-8385-5b67226cae1e | brownedon/Arduino-to-MI-Band-2 | libraries/Crypto/EAX.cpp | #include "EAX.h"
#include "Crypto.h"
#include <string.h>
/**
* \class EAXCommon EAX.h <EAX.h>
* \brief Concrete base class to assist with implementing EAX for
* 128-bit block ciphers.
*
* References: https://en.wikipedia.org/wiki/EAX_mode,
* http://web.cs.ucdavis.edu/~rogaway/papers/eax.html
*
* \sa EAX
*/
/... | ALGO | 0.8527 | 7.229335 |
f3387ed5-6b92-484c-b31d-eb9cb6a87916 | bryceForrest/aoc23 | day08/day08.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <utility>
#include <numeric>
#include <algorithm>
using Network =
std::unordered_map<std::string, std::pair<std::string, std::string>>;
size_t part_1(std::string path);
size_t part_2(std::string path);
std... | ALGO | 0.999749 | 6.604303 |
b346cb6a-5782-4335-b561-3cd3851e10b2 | liumindbdx/Algorithm | 算法入门/数论/普通快速幂.cpp | //普通快速幂 计算 (a^b)%c
typedef long long ll;
ll quick_mod(ll a,ll b,ll c){
ll ans=1;
while(b){
if(b&1) ans=(ans*a)%c;
a=(a*a)%c;
b>>=1;
}
return ans;
}
//利用快速乘法优化
ll quick_mul(ll a,ll b,ll c){
ll ans=0;
while(b){
if(b&1) ans=(ans+a)%c;
a=(a+a)%c;
... | ALGO | 0.999861 | 3.469005 |
600c0203-5112-4677-990c-88bd53a31c2f | yf291115925/CPP-Nanodegree | 2_Foundations/04_Writing_Larger_Programs/07_Pointers/main.cpp | /*
Accessing a Memory Address
Each variable in a program stores its contents in the computer's memory, and each chunk of the memory has an address number.
For a given variable, the memory address can be accessed using an ampersand in front of the variable.
To see an example of this, execute the following code which dis... | TOOL | 0.96669 | 5.357799 |
5ccc8393-263d-485b-bbb4-bcf134aec55b | ceska-faturrachman2007/Bukta | buku_tamu/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.99818 | 6.76073 |
c8977dd1-072a-4ccf-87fe-e8d69bbe526d | muhammadhasan01/cp | Online Judge/TLX/TROC#29/A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int x, y;
cin >> x >> y;
cout << (x == y) << '\n';
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tc = 1;
// cin >> tc;
for (int t = 1; t <= tc; t++) {
solve();
}
ret... | ALGO | 0.999705 | 4.525194 |
df72957f-3ea1-46e2-9e36-9e2cc0c6f5a2 | jihunparkme/Problem-Solving | PS_Study/BOJ/1991(2).cpp | #include <iostream>
#include <cstdio>
using namespace std;
char node[26][2];
void preorder(char root)
{
if (root == '.') return;
cout << root;
preorder(node[root - 65][0]);
preorder(node[root - 65][1]);
}
void inorder(char root)
{
if (root == '.') return;
inorder(node[root - 65][0]);
cout << root;
inorder... | ALGO | 0.999898 | 3.709223 |
ce703b2a-fee2-4015-9272-b93526e6e387 | vivekbharadwaj009/cns | 01.cpp | #include <stdio.h>
#include <ctype.h>
void encryptDecrypt(char text[]) {
for (int i = 0; text[i] != '\0'; i++) {
if (isalpha(text[i])) {
if (isupper(text[i])) {
text[i] = 'Z' - (text[i] - 'A');
}
else if (islower(text[i])) {
text[i] = 'z... | ALGO | 0.996273 | 4.185073 |
a6747a27-cbe4-4477-bb50-33bd161bdbde | MohdAqib8267/6-Companies_30_days_Challenges | 1052-grumpy-bookstore-owner/1052-grumpy-bookstore-owner.cpp | class Solution {
public:
int maxSatisfied(vector<int>& customers, vector<int>& grumpy, int minutes) {
int i=0;
int j=0;
int sumofNotGrumpy=0;
int windowSum=0;
int maxWindowSum=0;
//basically hum window (mintues ki) ka sum nikalte jayenge and
//maximise krenge ... | ALGO | 0.999497 | 6.423751 |
199e7166-c69e-4ff0-a00e-b7145e6d8d7a | ArutoriaWhite/Competitive-programming | cf1343c.cpp | #include <bits/stdc++.h>
#define de(x) cout << #x << "=" << x << ", "
#define dend cout << '\n'
#define Eriri ios::sync_with_stdio(0), cin.tie(0);
#define F first
#define S second
#define int long long
using namespace std;
typedef pair<int,int> Pii;
const int N = 2e5+10;
int arr[N], r, t, n, res;
signed main()
{
... | ALGO | 0.999784 | 4.092505 |
2053b8d9-02be-414c-b538-154277a9bd70 | Pratiksha-Andhare-PA/CrackYourInternship | longest_common_prefix.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
for(int i=0;i<strs[0].length();i++){
char currChar = strs[0][i];
for(int j=1;j<strs.size();j++){
if(strs[j][i] != currChar || i >= strs[j].length()){
return strs[0... | ALGO | 0.999811 | 5.883549 |
7d902910-86bf-4f91-ad1c-1699cc237c1c | Icho2/Molecular_Projects | Project#01/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(2);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,
1;
//add v to each column of m
mat.colwise() += v;
std::cout << "Broadcasting result: " << std::endl;... | ALGO | 0.998267 | 4.147263 |
053ceffa-c1a5-420d-a245-2c92b8bdf8cb | alex-nikolov/sdp-practicum-2016-17 | week07/solutions/hamming.cpp | #include <queue>
#include <iostream>
using namespace std;
int min(int a, int b, int c) {
if (a > b)
swap(a, b);
if (a > c)
swap(a, c);
return a;
}
void popMin(queue<int>& q, int min) {
if (q.front() == min)
q.pop();
}
void hamming(int n) {
cout << 1 << endl;
// Създаваме си три опашки, в които ще пази... | ALGO | 0.999981 | 4.323794 |
4718b0b4-fc17-4dfc-b31a-a671b91d1191 | nakul1010/6companies30Days_Challenge | Microsoft/13_BRIDGE_EDGE.cpp | /*Bridge edge in a graph
https://practice.geeksforgeeks.org/problems/bridge-edge-in-graph/1#
*/
void remove_edge(vector<int> adj[], int u, int v)
{
for(int i=0; i<adj[u].size(); i++)
{
if(adj[u][i]==v)
{
adj[u].erase(adj[u].begin()+i);
break;
}
}
for(int ... | ALGO | 0.999327 | 5.371034 |
a024f5ef-ebf4-44a7-be78-56701bc3d88c | wyrover/book-code | C++标准库(第2版)/algo/shuffle1.cpp | #include <cstdlib>
#include "algostuff.hpp"
using namespace std;
int main()
{
vector<int> coll;
INSERT_ELEMENTS(coll, 1, 9);
PRINT_ELEMENTS(coll, "coll: ");
// shuffle all elements randomly
random_shuffle(coll.begin(), coll.end());
PRINT_ELEMENTS(coll, "shuffled: ");
// sort them again
... | TOOL | 0.875038 | 4.95377 |
07446652-9bbe-4642-8cf3-33770657e91b | Beichen-Wang/HPCTest | LC/Dichotomy/MatrixDichotomy.cpp |
// INT_MAX [5, 7, 9, 8, 11, 12] INT_MAX
// 找到局部最小值
#include <vector>
#include <iostream>
using namespace std;
inline int FindMin(int start, int end){
return start + (start + end) >> 1;
}
int FindLocalMinValue(vector<int> input){
int start = 0;
int end = input.size() - 1;
int min;
switch (input... | ALGO | 0.999983 | 4.681622 |
2610297d-2c7b-4e06-9953-3fec46ba8801 | kamyu104/LeetCode-Solutions | C++/maximum-equal-frequency.cpp | // Time: O(n)
// Space: O(n)
class Solution {
public:
int maxEqualFreq(vector<int>& nums) {
int result = 0;
unordered_map<int, int> count;
vector<int> freq(nums.size() + 1);
for (int i = 0; i < nums.size(); ++i) {
--freq[count[nums[i]]];
++freq[count[nums[i]... | ALGO | 0.999935 | 5.711123 |
da13fb00-d5e8-4220-8f82-a9ee5e6b29a2 | Shubhamp6/CP_Codes_Cpp | codeforces/D_Playoff.cpp | #include <bits/stdc++.h>
using namespace std;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL), cout.tie(NULL);
int n;
cin >> n;
string s;
cin >> s;
int countOnes = 0;
for (int i = 0; i < n; i++)
{
if (s[i] == '1')
countOnes++;
}
int star... | ALGO | 0.999859 | 4.177555 |
0dd0955e-2806-4435-99a4-ca27bc3abe10 | Arshelle9912/Competitive-Programming | Practice/2102C.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long t;
cin >> t;
while (t--)
{
long long n;
cin >> n;
vector<vector<long long>> arr(n, vector<long long>(n, -1));
int x = (n % 2 ? n / 2 : n / 2 - 1);
int y = (n % 2 ? n / 2 : n / 2 - 1);
arr... | ALGO | 0.999816 | 4.148937 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.