uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ad03d5ab-f368-44e2-b5e9-4803771ff357 | utkarshmaken/cp | codeforces div 3/652/1.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
long n;
cin>>n;
if(n%4==0)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
} | ALGO | 0.998771 | 4.413449 |
870f90d9-a98e-4207-8248-6062ca303c16 | KKapoor0801/DSA_DAT | Leetcode/Dynamic Programming/198_House_Robber.cpp | class Solution {
public:
int houseRobber(vector<int>& nums, int i, vector<int>& dp){
// Base Case
if(i >= nums.size())
return 0;
// Memoization
if(dp[i] != -1)
return dp[i];
int stolenHouseMoney = nums[i] + houseRobber(n... | ALGO | 0.999976 | 6.076003 |
212657cf-d4f5-4291-ad76-a3318f352c72 | sivac88/Competitive-Programming | Dynammic-Programming/NthFibonacciNumber.cpp | // Dynamic programming approach to find the nth fibonacci number.
// https://www.geeksforgeeks.org/program-for-nth-fibonacci-number/
// Explanation Video : https://www.youtube.com/watch?v=EEb6JP3NXBI
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
void multiply(int a[2][2],int b[2... | ALGO | 0.99999 | 6.091951 |
93d1cafd-330f-476b-8b3b-288ab07cfd3f | om-arya/StockRank | src/metrics_sim.cpp | #include <iostream>
#include <array>
#include <string>
using namespace std;
double totalReturn(double dailyPrices[], int size) {
double startPrice = dailyPrices[0];
double endPrice = dailyPrices[size - 1];
return endPrice - startPrice;
}
double returnOnInvestment(double dailyPrices[], int size) {
do... | ALGO | 0.979953 | 4.805756 |
cd04370d-168f-4856-8f52-d706a5970054 | yuvraj1107thapa/Competitive-Programming | DS++/Linked List/Leetcode/addOne.cpp | #include <bits/stdc++.h>
using namespace std;
class Node{
public:
int val;
Node* next;
Node(int data){
val=data;
next=NULL;
}
};
void insert(Node* &head, int data, int pos){
if(pos==1){
Node* node=new Node(data);
node->next=head;
head=node;
return;
... | ALGO | 0.999969 | 4.976946 |
4f92688e-e4d9-48e4-881c-e62734c3d0d8 | FalseG0d/Algorithm-Data-Structure | General/Stack/stackArr.cpp | #include <iostream>
using namespace std;
class Stack{
int arr[100];
int top;
int size;
public:
Stack(){
top=-1;
size=100;
}
void push(int ele){
if(top==-1){
top=0;
arr[top]=ele;
return;
}
if(top>=size-1){
... | ALGO | 0.99636 | 4.766675 |
626ec76f-ec1d-44c8-bfd5-ad63c2832e5e | johnsmith0x3f/CompetitiveProgramming | codeforces/gym/102994/A.cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int N = 64;
i64 a[N], b[N];
inline void insert(i64 x, i64 *base) {
for(int i = 62; ~i; --i) {
if((x >> i) & 1) {
if(base[i]) x ^= base[i];
else return void(base[i] = x);
}
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0), c... | ALGO | 0.999976 | 4.088202 |
4ff05338-78ec-4917-b04b-5c89448a20d5 | mdshadesh/Codeforcesall-problem-solution- | 688B - Lovely Palindromes.cpp | #include <iostream>
using namespace std;
string a;
int main()
{
cin >> a;
for (int i = a.size() - 1; i >= 0; i--)
{
a += a[i];
}
cout << a;
} | ALGO | 0.999532 | 4.730772 |
8992e087-38a8-46f5-8038-5df827890e5b | zszyellow/leetcode | Cpp/658.find-k-closest-elements.cpp | /*
* @lc app=leetcode id=658 lang=cpp
*
* [658] Find K Closest Elements
*/
class Solution {
public:
vector<int> findClosestElements(vector<int>& arr, int k, int x) {
sort(arr.begin(), arr.end(), [x](int a, int b) {
int xa = abs(x - a), xb = abs(x - b);
return xa < xb || xa == xb ... | ALGO | 0.999993 | 5.828504 |
ca3b4afe-1e76-4bfb-bd83-f0f837cbbd3e | rajesh-1920/Competitive_Programming_Problem_Solving | Codeforces/E_Nastya_and_Potions.cpp | // Author: Rajesh Biswas
// CF : rajesh-1920
// Date : 25.03.2025
#include <bits/stdc++.h>
using namespace std;
//----------------------------(definition section)-----------------------------------------
#define dbg(x) cout << #x << " = " << x << '\n'
#define int long long int
#define fi first
#define sc second... | ALGO | 0.999959 | 3.969902 |
20f49c32-2214-452f-ab04-0317b7e30308 | namitaa15/dsa | graphs/1319. Number of Operations to Make Network Connected.cpp | 1319. Number of Operations to Make Network Connected
There are n computers numbered from 0 to n - 1 connected by ethernet cables connections forming a network where
connections[i] = [ai, bi] represents a connection between computers ai and bi. Any computer can reach any other
computer directly or indirectly through ... | ALGO | 0.999823 | 6.542699 |
fe57f131-fde6-4607-867a-480a0cb76183 | ishandutta2007/codeforces | popovicirobert/normal/1466/E.cpp | #include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define Test(tt) cout << "Case #" << tt << ": "
using namespace std;
const int MOD = (int)1e9 + 7;
int main() {
#ifdef HOME
ifstream cin("A.in");
ofstream cout("A.out");
#endif
int t;
ios::sync_with... | ALGO | 0.999746 | 4.28793 |
4d4f685b-9ee7-4a40-9208-ca07694a1b25 | mambelli/osg-bosco-marco | src/classad_analysis/boolValue.cpp | #include "condor_common.h"
#include "boolValue.h"
#include "list.h"
using namespace std;
// F && (T|F|U|E) = F
// E && (T|F|U|E) = E
// (T|U) && F = F
// (T|U) && U = U
// (T|U) && E = E
// T && T = T
// U && T = U
bool
And( BoolValue bv1, BoolValue bv2, BoolValue &result )
{
if( bv1 == FALSE_VALUE ) { result = F... | TOOL | 0.90492 | 5.249905 |
6e6ff59e-f8b1-4440-9dce-3ecd2c8a55c7 | utkabobr/SliceBeam | app/src/main/jni/libigl/igl/copyleft/cgal/points_inside_component.cpp | #include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_triangle_primitive.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <cassert>
#include <list>
#include <limits>
#include <vector>
namespace igl {
namespace copyleft
{
namespace cgal {
namespace poin... | ALGO | 0.999497 | 7.396303 |
6731c13f-9583-4987-84e0-dde99f7da2db | CompilandoConocimiento/Reference | Code/Search/TernarySearch.cpp | #include <iostream>
#include <vector>
using namespace std;
using lli = long long int;
/**
* @param left The initial index to start searching
* @param right The final index to start searching; if -1 we end at Container.size()
* @param toFind The number to find
* @return The index of the eleme... | ALGO | 0.999965 | 5.223886 |
94ed5730-ab0f-4a72-9b25-839308e95fd7 | aponom84/lpam-clustering | related_methods/network-community-benchmark-master/comm_algs/GCECommunityFinder/graph_representation.cpp | using namespace std;
#include "graph_representation.hpp"
#include <iostream>
#include <algorithm>
template <> // TODO: I dunno why I can't do a generic one for key_for_vertexName. It seems I have to specialize it for Int
long int bloomGraph<int>::key_for_vertexName(int v) const {
// Don't use this function until popu... | ALGO | 0.921539 | 4.788801 |
5472b4b7-facb-478d-a990-9d2f73fe9a6f | oeljeklaus-you/LintCode | 365. ไบ่ฟๅถไธญๆๅคๅฐไธช1.cpp | class Solution {
public:
/*
* @param num: An integer
* @return: An integer
*/
int countOnes(int num) {
// write your code here
int times=0;
while(num)
{
num=num&(num-1);
times++;
}
return times;
}
}; | ALGO | 0.999441 | 5.885596 |
2e56fe79-677f-444d-9237-c5ad4bea9635 | ghts2110/competitive_programing | codechef/Chef and Semi-Primes/Semi_primo.cpp | #include <iostream>
#include <cmath>
using namespace std;
bool is_primo(int num){
for(int i = 2; i <= sqrt(num); i++){
if(num % i == 0){
return false;
}
}
return true;
}
bool is_semi_primo(int num){
int sp = false;
for(int i = 2; i <= sqrt(num); i++){
if(num %... | ALGO | 0.999824 | 5.863057 |
c525e20e-d243-4c76-a478-8a97a7925912 | bdostumski/learning-workspace | problem-solving/dsa/cpp-lang/recursive-functions/euclid.cpp | // Recurce Out
#include <iostream>
using namespace std;
void euclid(int a, int b) {
if(a % b > 0) {
euclid(b, a % b);
cout << a << " = " << a / b << " . " << b << " + " << a % b << endl;
} else {
cout << a << " = " << a / b << " . " << b << " + " << a % b << endl;
}
}
int main() {
int a, b;
c... | ALGO | 0.99943 | 4.20801 |
e9990e55-b088-4db3-8d79-434d0efc5288 | pkcwong/UST-COMP2012 | Assignment/PA03/avl.cpp | /*
* avl.cpp
*/
#ifndef AVL_CPP
#define AVL_CPP
#include "avl.h"
/* TODO
* Goal: To find the balance factor of an AVL tree
* balance factor = height of right sub-tree - height of left sub-tree
* Return: (int) balance factor
*/
template<typename T, typename K>
int AVL<T, K>::bfactor() const{
int left = -... | ALGO | 0.974666 | 5.499682 |
95445e5b-1d68-43a2-9864-3ba5f610ee1d | Hieu031/VTI_Tranning | TraniningCpp/SomeKnowledgeMathBasic/ReversibleNumber.cpp | #include<iostream>
using namespace std;
int ReversibleNumber(int n){
int m, tmp;
tmp = n;
while(n != 0){
m = m * 10 + n % 10;
n /= 10;
}
if(m == tmp){
return 1;
}
else{
return 0;
}
}
int main(){
while(1){
int a;
cout << "Enter a: ";... | ALGO | 0.999441 | 3.951249 |
5c9c7f65-ea3b-4540-a113-831d8e877289 | GeisslerGroup/lammps-2Apr13-replica | src/USER-CUDA/pair_lj_sdk_cuda.cpp | /* ----------------------------------------------------------------------
Contributing author: Paul Crozier (SNL)
------------------------------------------------------------------------- */
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "pair_lj_sdk_cuda.h"
#include "pair_lj_sdk_... | ALGO | 0.992693 | 6.57813 |
c1af5046-87f5-4cc6-904b-da0d8eb5d1b8 | DanValve/CG-Project | Examples/src/customHashFunctions/CustomHashFunctions.cpp | #include "CustomHashFunctions.h"
size_t V3HashFunction::operator()(const glm::ivec3& vec)const {
size_t rx = std::hash<float>()(vec.x);
size_t ry = std::hash<float>()(vec.y) << 1;
size_t rz = std::hash<float>()(vec.z) << 2;
return (rx ^ ry ^ rz);
} | TOOL | 0.883955 | 5.910938 |
bcdeaa42-a2cd-49b8-9a25-f8895f9bb01a | Ashraf1551/Fundamental_Coding | 03_Basic_Data_Structure_with_C++/M10_STL_List&_Cycle_Detection/reverse_singly_lined_list.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *next;
Node(int val)
{
this->val = val;
this->next = NULL;
}
};
void print_recursion(Node *n)
{
// base case
if (n == NULL)
return;
cout << n->val << " ";
print_recursion(n->next)... | ALGO | 0.999695 | 4.645324 |
78c04643-c0f4-492b-ac66-66eeb0b3a220 | LegacyXperiaAOSP/android_frameworks_av | media/libstagefright/codecs/amrnb/enc/src/c4_17pf.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "c4_17pf.h"
#include "typedef.h"
#include "inv_sqrt.h"
#include "cnst.h"
#include "cor_h.h"
#include "set_sign.h"
#include "basic_op.h"
/*---... | ALGO | 0.999979 | 5.243907 |
5a49c8d9-ab57-4501-8677-bd4f0498b9ce | parinphatw/CPlusPlus | Grader/[d62_q1a_punch] Vector Punch/[d62_q1a_punch] Vector Punch/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<string> punch(vector<string> &v, vector<string>::iterator it,int k) {
//write some code here
int index = distance(v.begin(), it);
int k_back,k_front;
if (k > v.size() - index - 1) {
k_back = v.size() - index -... | ALGO | 0.999897 | 3.327598 |
50c4c734-8606-4dfd-9c32-99ee1ff429cd | viditvirmani/CodesOnly | vidit_123/codeforces/920-A/920-A-34904058.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t,n,k;
cin>>t;
while(t--){
cin>>n>>k;
int arr[k+1];
for(int i=1;i<=k;i++){
cin>>arr[i];
}
int ans=0;
for(int i=1;i<k;i++){
ans=max(ans,1+(arr[i+1]-arr[i])/2);
}
ans=max(ans,arr[1]);
ans=max(ans,n-arr[k]+1);
cout<<ans<... | ALGO | 0.999911 | 3.683986 |
d313ea3f-bedd-4102-b274-a223bfe146bd | uni-algorithms/christmas-flatland | main.cpp | #include <cassert>
#include "flatland.h"
flatland solver;
auto main() -> int {
std::ifstream input("input.txt");
std::ofstream output("output.txt");
assert(input);
assert(output);
auto result = solver.outcast(input);
output << result.size() << std::endl;
for (auto t : result) {
ou... | ALGO | 0.983609 | 5.014721 |
b93bd111-00a6-4dba-9c04-1229fe87235d | BUAAHugeGun/LeetCode | src/1399.cpp | class Solution {
public:
int sum[10010];
unordered_map<int,int> mp;
int countLargestGroup(int n) {
for(int i=1;i<=n;i++)sum[i]=sum[i/10]+i%10,mp[sum[i]]++;
int Max=0,ans=0;
for(auto &v:mp)Max=max(Max,v.second);
for(auto &v:mp)if(v.second==Max)ans++;
return ans;
}
... | ALGO | 0.999352 | 6.398504 |
6c73328d-c496-4f27-b1a5-67e6ca2e5bb3 | henry0427/1071-C-programming | W07/Hanoi tower.cpp | #include <stdio.h>
void tower1(int n, char from, char aux, char to){
if(n==1)
printf("%c -> %c\n", from,to);
else{
tower1(n-1,from,to,aux);
printf("%c -> %c\n", from,to);
tower1(n-1,aux,from,to);
}
}
void tower2(int n, char to, char aux, char from){
if(n==1)
print... | ALGO | 0.999762 | 4.462002 |
d7c40ff8-1132-4d0b-9bab-768319e5bd67 | praditia12/Flutter-State-Provider | 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 |
6fdcd796-7c4e-48ef-8552-e07f7f83d048 | sarvex/leetcode-scratch | solution/1500-1599/1514.Path with Maximum Probability/Solution.cpp | class Solution {
public:
double maxProbability(int n, vector<vector<int>>& edges, vector<double>& succProb, int start, int end) {
vector<vector<pair<int, double>>> g(n);
for (int i = 0; i < edges.size(); ++i) {
int a = edges[i][0], b = edges[i][1];
double s = succProb[i];
... | ALGO | 0.999981 | 5.821889 |
370c67ad-1d9a-4c66-bf1f-82e1fc9f1c9e | Blixibon/source-2013-expanded-steam | mp/src/tier1/checksum_md5.cpp | #include "basetypes.h"
#include "commonmacros.h"
#include "checksum_md5.h"
#include <string.h>
#include <stdio.h>
#include "tier1/strtools.h"
#include "tier0/dbg.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
// The four core functions - F1 is optimized somewhat
// #define ... | ALGO | 0.996682 | 5.925139 |
ff035077-3f6b-455b-be78-c0f29d7505e2 | faisalkn-71/XPSC | Week-10/Day-5/B_Good_Arrays.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<int> ara(n);
ll sum = 0;
int cnt = 0;
for(int i=0; i<n;... | ALGO | 0.999541 | 4.167176 |
8de79920-b0d9-49c7-b8b4-d20325b47da1 | zews78/my_leetcode_problems | 11-container-with-most-water/container-with-most-water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int i=0;
int j= height.size()-1;
int max_cap=0;
while(i<j){
int vol;
if(height[i]<= height[j]){
vol = (j-i)*height[i];
i++;
}else{
vol = (j... | ALGO | 0.999927 | 6.697914 |
aa827734-9377-4ec5-9a73-d5885b699664 | zonyitoo/leetcode | Algorithms/191_Number_of_1_Bits.cpp | #include <cstdint>
class Solution {
public:
int hammingWeight(uint32_t n) {
int count = 0;
for (int i = 0; i < 32; ++i) {
if ((n & (1 << i)) != 0) ++count;
}
return count;
}
};
| ALGO | 0.999211 | 6.800043 |
ba05df14-6df4-45ff-858b-23b6dec900f9 | jJayyyyyyy/OJ | cmb/2018_04_ๅบๅๆพๆฐ.cpp | /*
https://www.nowcoder.com/test/question/done?tid=32350874&qid=221987#summary
ๆๅ้ถ่กไฟก็จๅกไธญๅฟ2018็งๆ้จๅ็ผ็จ้ขๆฑๆป
่ฟไธๅฅ้ข็ฎ๏ผๅผๅคด้พ๏ผไธญ้ด็ฎๅ๏ผๆๅ้พ๏ผๅ ๆญคๅ้ข็ๆถๅ๏ผๆๅฅฝๅ
ๆ้ข็ฎ้ฝ็ไธ้๏ผไปๅฎนๆ็ๅผๅง๏ผ่ไธๆฏไธช้ข็ฎๅฏไปฅๅ
ๆต่ฏไธไธ่พน็็จไพๆฟๅ๏ผๅๆถไนๅฏไปฅๆฃๆตไธไธๆ่ทฏๆฏๅฆๆญฃ็กฎ
ไป้่ดๆดๆฐๅบๅ 0, 1, 2, ..., n ไธญ็ปๅบๅ
ๅซๅ
ถไธญnไธชๆฐ็ๅญๅบๅ, ๆพๅบไธๅจ่ฏฅๅญๅบๅไธญ็้ฃไธชๆฐ
่พๅ
ฅ1๏ผ 3 3 0 1
่พๅบ1๏ผ 2
่ฏดๆ๏ผ
่พๅ
ฅไธญ็็ฌฌไธไธชๆฐ 3 ๆฏ n๏ผ ๅณๅบๅ็ๆๅคงๅผ๏ผๅณๅฎๆดๅบๅๆ n+1 ไธชๆฐ
่ n ๅ้ข่พๅ
ฅ็ๆฏ n ไธชๆฐ,... | ALGO | 0.999945 | 3.840744 |
ca7d5bc4-31b0-41a6-b222-715bc88a7ca5 | HKUST-Aerial-Robotics/Teach-Repeat-Replan | simulation/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/performance/rt_generic_rk4_lorenz.cpp | #include <boost/array.hpp>
#include "rt_explicit_rk.hpp"
#include "rk_performance_test_case.hpp"
#include "lorenz.hpp"
typedef boost::array< double , 3 > state_type;
typedef rt_explicit_rk< state_type > rk_stepper_type;
const size_t stage_count = 4;
class rt_generic_wrapper
{
public:
rt_generic_wrapper( con... | ALGO | 0.925178 | 5.196967 |
d10e6cdb-81b1-49cf-ad53-dfe3dbde6f71 | MadEldar/Nandateyo | Assignment 8-7b.cpp | #include <stdio.h>
int main(){
int m=-1,n=-1;
while(m<=0||n<=0){
printf("Nhap so hang: ");
scanf("%d",&m);
printf("Nhap so cot: ");
scanf("%d",&n);
}
int list1[m][n],list2[m][n];
int *ptr1,*ptr2;
ptr1=&list1[0][0];
ptr2=&list2[0][0];
printf("Ma tran thu nhat:\n");
for (int i = 0; i < m; i++){
for (in... | ALGO | 0.984333 | 3.104313 |
ebe0c15b-c716-4181-a5bd-bac3b9d41f89 | Taoyao-OwO/SummerTTS-python | eigen-3.4.0/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.99882 | 4.659281 |
e9c62c15-e938-41d5-ad5a-c14b301999c0 | ishandutta2007/codeforces | sky3141/normal/1603/B.cpp | #include <iostream>
#include <algorithm>
using namespace std;
using LL = long long;
constexpr int MAXN = 100000 + 9;
void solve()
{
int x, y;
cin >> x >> y;
if (x > y)
{
cout << y + x << '\n';
}
else if (x == y)
{
cout << x << '\n';
}
else
{
cout << (y... | ALGO | 0.999918 | 4.666097 |
27a2c1c7-256d-48cc-a842-0b2acd820273 | M4573R/competitive-programming-archive | spoj/classical/the_next_palindrome.cpp | #include <iostream>
#include <string>
using namespace std;
inline
void use_io_optimizations()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
inline
string all_nines_case(const string& number)
{
return '1' + string(number.size() - 1, '0') + '1';
}
string not_all_nines_case(string number)
{
+... | ALGO | 0.999657 | 6.463324 |
3c2e1f26-55a4-403b-967a-2b56a5a78f5a | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9963_11.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
using namespace std;
const long long inf = numeric_limits<long long>::max() / 2;
const long double eps = 1e-9;
const long double pi = acos(-1);
long long n;
set<long long> ss;
long long solve() {
if (n < 11) {
for (long long i = 0; i <= n; i++) {... | ALGO | 0.999902 | 4.955415 |
6dfc0635-17cc-4e68-b4c4-85c52f32a408 | RajThakur777/Leetcode-POTD | 2695-find-score-of-an-array-after-marking-all-elements/2695-find-score-of-an-array-after-marking-all-elements.cpp | class Solution {
public:
long long findScore(vector<int>& nums) {
int n = nums.size();
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
long long ans = 0;
for(int i=0; i<n; i++){
pq.push({nums[i] , i});
}
while(!pq.emp... | ALGO | 0.999975 | 4.602141 |
4b724810-4673-41ef-b1d6-1819b877ff46 | Rajveer-CSE-27/Coding-Journey-CPP | Google/or_xor.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mod = 1e9 + 7;
/**
ou are given the following:
Two integers ( N ) and ( K ) An array ( A ) of size ( N )
Let sequence ๐ต=(๐ต1,๐ต2,โฆ,๐ต2๐พ)) of size 2K be a subsequence of array A .
Let's define F(B) as:
๐น(๐ต)=[(๐ต1|๐ต2|โฆ|๐ต๐พ)โ(๐ต๐พ+1|๐ต๐พ+2... | ALGO | 0.999985 | 5.080586 |
9f933a8a-2c65-43ef-a561-4a665f6633e1 | vijaykumar0710/Leetcode | 0891-score-after-flipping-matrix/0891-score-after-flipping-matrix.cpp | class Solution {
public:
int matrixScore(vector<vector<int>>& grid) {
int rows=grid.size();
int cols=grid[0].size();
for(int i=0;i<rows;i++){
if(grid[i][0]==0){
for(int j=0;j<cols;j++){
if(grid[i][j]==0){
grid[i][j]=1;
... | ALGO | 0.999954 | 6.507689 |
d6330e42-60d4-4882-97e5-f3efb1e2d710 | boshishuoshuo/cppprimer | ch3/e3-15.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
vector<string> v;
string s;
char cont = 'y';
while(cin >> s)
{
v.push_back(s);
cout << "continue ? " << endl;
cin >> cont;
if (cont != 'y' && cont !... | TOOL | 0.989959 | 3.650926 |
5e6a1000-88d6-4f36-b731-3bfbecbb317a | master-Turbo/projects | module 13/13.6.1. Vector/main.cpp | /*
ะงัะพ ะฝัะถะฝะพ ัะดะตะปะฐัั
ะะตะพะฑั
ะพะดะธะผะพ ะธะท ะทะฐะดะฐะฝะฝะพะณะพ ะฟะพะปัะทะพะฒะฐัะตะปะตะผ ะฒะตะบัะพัะฐ ัะดะฐะปะธัั ัะธัะปะพ X.
ะะฐะบ ัะฐะฑะพัะฐะตั ะฟัะพะณัะฐะผะผะฐ
ะะพะปัะทะพะฒะฐัะตะปั ะฒะฒะพะดะธั ั ะบะปะฐะฒะธะฐัััั ัะธัะปะพ n โ ัะฐะทะผะตั ะฒะตะบัะพัะฐ, ะบะพัะพััะน ะฝะฐะดะพ ะทะฐะฟะพะปะฝััั.
ะะพะปัะทะพะฒะฐัะตะปั ะฒะฒะพะดะธั n ัะตะปัั
ัะธัะตะป, ะบะพัะพััะต ะทะฐะฟะพะปะฝััั ะฒะตะบัะพั.
ะะพะปัะทะพะฒะฐัะตะปั ะฒะฒะพะดะธั ะทะฝะฐัะตะฝะธะต โ X. X โ ัะดะฐะปัะตะผะพะต ะธะท ะฒะตะบัะพัะฐ ะทะฝะฐัะตะฝะธะต.... | ALGO | 0.999463 | 5.43986 |
b10d4188-87b2-4168-9ba4-b3416dc16e58 | AcrossForest/ModifiedGem5ForSIMDMerge | src/systemc/tests/systemc/misc/user_guide/chpt3.1/counter.cpp | /*****************************************************************************
counter.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/****************************************************************************... | TOOL | 0.924482 | 4.689918 |
897bbb81-5b2d-4654-9ff0-e2f371dbb8f3 | archermind/MTK_X20_BASE_AOSP | frameworks/av/media/libstagefright/codecs/amrwb/src/dec_alg_codebook.cpp | /*
------------------------------------------------------------------------------
Filename: dec_alg_codebook.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------------------------------------------------------... | ALGO | 0.99992 | 3.930405 |
1f928b3a-b259-454c-a329-771773acdb3f | thesilentline/DSA-code_on_every_line | binarytrees/brinarytreewithstring.cpp | //~ author : DSB
#include<bits/stdc++.h>
#include<iostream>
#include<queue>
using namespace std;
#define ll long long
#define pint pair<int,int>
#define plong pair<long long,long long>
#define vlong vector <long long>
#define vint ... | ALGO | 0.999947 | 3.802481 |
0b6260b6-083d-4103-8509-42bd0f4cce2f | mayankBuwade/DSA-with-CPP | 14Graph/06.cpp | //adjacency list
//BFS
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
class Graph {
private:
vector<vector<int>> adjList;
public:
Graph(int);
void addEdge(int, int);
void printGraph();
void BFS(int);
};
Graph::Graph(int numOfVertices)
{
adjList.resize(numOfVertices+1... | ALGO | 0.999887 | 4.776241 |
6bac8c44-c179-4865-8044-0743ab4cf493 | shyu61/program-competition | code/ant/059.cpp | // ๅฟ็จๅ้ก(Roadblocks): p102
#include <bits/stdc++.h>
using namespace std;
// 2็ช็ฎใฎๆ็ญ็ต่ทฏใๆฑใใๅ้กใ
// 1. SSSPใฎใขใซใดใชใบใ ใๆนๅคใใฆ่งฃใใๅ
จใๅฅใฎใขใใญใผใใง่งฃใใใ่ใใใๅพ่
ใฏใณในใใ้ซใใฎใงไธๆฆๅ่
ใง่กใใใจไปฎๅฎใใฆ่ใใใ
// 2. ใใคใฏในใใฉใใใซใใณใใฉใผใใฉใกใใงใใใใ่ใใใใ่ฒ ใฎ้ใฟใใชใใฎใงไธๆฆใใคใฏในใใฉใง่ใใฆใฟใใ
// 3. ใพใๆ็ญ็ต่ทฏใๆฑใใฆใใ2็ช็ฎใฎ็ต่ทฏใๆฑใใใใใใคใฏในใใฉใฎๅฎ่กไธญใซไธ็ทใซ2็ช็ฎใฎ็ต่ทฏใๆฑใใใใ่ใใใ
// ๆ็ญ็ต่ทฏๆจใๅ
ใซ2็ช็ฎใๅฐใใใใ่ใใใจใใซใใใ็ฐกๅใซใฏๅฐใใช... | ALGO | 0.999925 | 4.84315 |
8a8e6cae-28c9-478d-9bda-3870715a8de7 | parkgang/coding-test | src/baekjoon/bronze/14215-์ธ ๋ง๋/main.cpp | #include <iostream>
#include <numeric>
using namespace std;
void ascBubbleSort(int arr[], int n)
{
for (int i = n - 1; i > 0; i--)
for (int j = 0; j < i; j++)
if (arr[j] > arr[j + 1])
{
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + ... | ALGO | 0.999914 | 4.798691 |
d729bf19-85e6-4f00-9b7c-1178137b0ad9 | Glasspham/DSA-28Tech | Generation-Backtracking/Generation/lesson_20.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int a[1001], n, ok;
void sinh(){
int i = n;
while(i >= 1 && a[i]) a[i--] = 0;
if(i == 0) ok = 0;
else a[i] = 1;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int k; cin >> k;
vector<string> res;
for(n... | ALGO | 0.999974 | 4.320901 |
702c44b7-7d84-4621-83a7-687e05aacffd | zhilix/DREAMPlaceFPGA-MP | dreamplacefpga/ops/pin_pos/src/pin_pos.cpp | /**
* @file pin_pos.cpp
* @author Yibo Lin (DREAMPlace)
* @date Aug 2019
* @brief Given cell locations, compute pin locations on CPU
*/
#include "utility/src/torch.h"
#include "utility/src/Msg.h"
DREAMPLACE_BEGIN_NAMESPACE
/// @brief Given cell locations, compute pin locations
/// @param x cell locations i... | TOOL | 0.964 | 5.433702 |
862915ff-02cc-47bd-b043-e7e84e72c164 | AigaGoto/AtCoders | BiginnerContest/219/B.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string S[3], T;
cin >> S[0] >> S[1] >> S[2] >> T;
for (int i = 0; i < T.length(); i++) {
cout << S[T[i] - '0' - 1];
}
cout << endl;
return 0;
} | ALGO | 0.999757 | 3.2281 |
e50e62a6-fe95-4e2a-a19a-617bdf6bc8a7 | dipayandutta/c-plus-plus | ctime/mktime.cpp | #include<iostream>
#include<ctime>
using std::endl;
using std::cout;
int main(void){
time_t tim;
tm *ptr;
int y = 2017;
int m = 4;
int d = 20;
char weekday[7][20] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
time(&tim);
ptr =localtime(&tim);
ptr->tm_year = y... | TOOL | 0.952048 | 3.394196 |
344c5020-9368-4184-8cc4-0ae5c2199156 | jongli747/Contest-Code | Light OJ/1109 False ordering .cpp | /************************* Believe you can and you're halfway there ********************************/
#include <bits/stdc++.h>
#include <stdlib.h>
#include <assert.h>
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define AND &&
#define OR ||
#define space " "
#define FOR(i,x,y) for(in... | ALGO | 0.997894 | 3.265896 |
af0689c9-55cc-4fe6-aab7-5cd1d894bd42 | piyush121728/leetcode-potd2024 | June/1.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int scoreOfString(string s)
{
int n = s.size();
int sum = 0;
for (int i = 0; i < n - 1; i++)
{
sum += abs(s[i] - s[i + 1]);
}
return sum;
}
};
// link : https://leetcode.com/p... | ALGO | 0.999897 | 6.029511 |
a789a401-10a4-4146-ad19-4d15e1d23b0e | Mr-Tony-Lee/CP_Road | Uva_record/UVA_3_star_question/00242.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0); cout.tie(0) ; ios::sync_with_stdio(0);
int S ;
while(cin >> S && S ){
vector<vector<int>> arr ;
vector<int> ans ;
int N , n;
cin >> N ;
for(int i = 0 ; i < N ; i++ ){
int dp[2000] = ... | ALGO | 0.99987 | 3.240726 |
4a1a83db-7189-4d6f-bfbc-7161310c9330 | Abodi-Massarwa/Lectures | lecture3.cpp | //
// Created by abdms on 07/07/2020.
//
#include <iostream>
using namespace std;
//void foo(int& i)
//{
//
//}
//void foo(const int& i)
//{
//
//}
//
//int main()
//{
// // normal number not allocated in stack or heap is considered to be const -rvalue
//
// foo(7);
// int x=7;
// foo(x);
///*
// * Summary... | TOOL | 0.920967 | 4.201461 |
c906bd92-d764-41d1-819e-c87c65047053 | av1shekps/test-lab | CNS_LAB/selab/assignment_7/diffie_hellman.cpp | #include<stdio.h>
#include<math.h>
typedef long long ll;
ll power(ll a, ll b,ll P)
{
if (b == 1)
{
return a;
}
else
{
return (((ll )pow(a, b)) % P);
}
}
int main()
{
ll P, G, x, a, y, b, ka, kb;
printf("Enter value of P : ");
cin>>P;
cout<<endl;
printf("Enter value of G : ");
cin>>G;... | ALGO | 0.999957 | 3.211725 |
773eb6f7-1812-4d88-9ec1-d2a28b9ce298 | hitarth-gg/CP | CodeForces/archive/1447B - Numbers Box.cpp | // clang-format off
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
/* ----------------------- int128 ----------------------- */
// typedef __int128 lll;
// istream &operator>>(istream &cin,... | ALGO | 0.999972 | 4.721719 |
a744e1ef-9efe-4f0d-84c1-9a4982806924 | datre9/regex-tests | re2-demo/re2-demo.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <chrono>
#include <re2/re2.h>
using namespace std;
stringstream toWrite;
static void benchmark(const string& text, const RE2& regex, const string& title) {
toWrite << title << "\n";
for (int i = 0; i < 1000; i++) {
... | ALGO | 0.923228 | 4.739823 |
434d328e-fdbd-4eb5-a4bf-e62b3055597f | leopers/Data-Structures-and-Algo-Problemset | GraphTopOrder/main.cpp | #include "digraph_adj.hpp"
#include <iostream>
int main(){
std::size_t order;
std::cin >> order;
Digraph gr(order);
std::size_t a, b;
while(std::cin >> a >> b){
gr.add_edge(a, b);
}
std::set<std::size_t> visited1;
std::set<std::size_t> terminated;
if(gr.acycle_test(visited... | ALGO | 0.999698 | 5.255784 |
54147b16-33e0-4cd2-8a6e-21f77f26e902 | KimPopsong/BAEKJOON | 25305.cpp | #include <iostream>
#include <algorithm>
int main()
{
int attendant, winner;
int student[1001];
std::cin >> attendant >> winner;
for (int i = 0; i < attendant; i++)
{
std::cin >> student[i];
}
std::sort(student, student + attendant, std::greater<int>());
std::cout << student[winner - 1] << std::endl;
r... | ALGO | 0.999878 | 3.757928 |
de8af9fd-8a70-4f1c-a305-83c85bfa30b8 | sarvex/leetcode-jai | solution/1400-1499/1486.XOR Operation in an Array/Solution.cpp | class Solution {
public:
int xorOperation(int n, int start) {
int ans = 0;
for (int i = 0; i < n; ++i) {
ans ^= start + 2 * i;
}
return ans;
}
}; | ALGO | 0.999959 | 5.38591 |
8827f75b-33dd-4347-85d4-839bd27ff8d2 | rohanxxx/leetcode | 3616-make-array-elements-equal-to-zero/3616-make-array-elements-equal-to-zero.cpp | class Solution {
public:
int countValidSelections(vector<int>& nums) {
int sum=0,tot=0,ans=0;
for(auto ele:nums){
sum+=ele;
}
for(auto ele:nums ){
if(ele==0) {
if(tot*2==sum) ans+=2;
else{
if(tot*2-1 == sum) ... | ALGO | 0.999925 | 5.341336 |
aa02bf36-0a46-4f7f-b381-e55a81cf57d6 | luobuyu/Code-test-daily | codeforces/695/Bstd.cpp | #include <bits/stdc++.h>
#define ll long long
namespace FAST_IO
{
template <class T>
inline void read(T &x)
{
T flag = 1;
x = 0;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
flag = -1;
ch = getchar();
... | ALGO | 0.999864 | 4.120008 |
1a2c5700-3d3e-4bce-9398-2c7cbce56d87 | chrisg0106/C-pruebas | ejercicio5.cpp | #include <iostream>
#include <string.h>
using namespace std;
int main()
{
const char noDeseados[] = { ',',' ' };
char Numero[100]; int x = 0;
cout << "Escribe una lista de numeros separados con coma: "; cin.getline(Numero, 100);
for (int i = 0; i < strlen(Numero); i++)
{
for (int j = 0; j < strl... | ALGO | 0.993515 | 3.089168 |
241e4348-cb13-4b82-a3a5-a015e8ed1391 | Riyad0001/Phitron-Practice | Data Structure Practice/Z_Binary_Search.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, q;
cin >> n >> q;
int s[n];
for (int i = 0; i < n; i++)
cin >> s[i];
sort(s, s + n);
while (q--)
{
int x;
cin >> x;
bool flag = false;
int l = 0;
int r = n - 1;
while (l... | ALGO | 0.999976 | 4.487927 |
6429e419-fd4c-497d-b2d8-1da6e27c6754 | yangbodong22011/Data_Structure_and_Algorithm | recall/test_permutation.cpp | /*************************************************************************
> File Name: test_permutation.cpp
> Author: YangBodong
> Mail: <EMAIL>
> Created Time: Fri 26 Feb 2016 10:28:18 CST
************************************************************************/
#include<iostream>
#include<algorithm>
#include<v... | ALGO | 0.999562 | 4.009128 |
83747742-d1b5-4c87-ae4c-9decc68c541d | booneng/competitive_programming | google/codejam/2016/qualification_round/counting_sheep.cpp | #include <iostream>
#include <set>
using namespace std;
int main() {
int t;
cin >> t;
for (int j = 0; j < t; j++) {
int n;
cin >> n;
cout << "Case #" << j + 1 << ": ";
if (n == 0) {
cout << "INSOMNIA" << endl;
continue;
}
set<int> seen;
int i = 1;
while (1) {
int... | ALGO | 0.999704 | 5.175623 |
89ac4059-2a48-4a26-b671-edf85e53c8f9 | tomn2804/Kanalysis | External Dependencies/boost_1_74_0/libs/numeric/odeint/examples/my_vector.cpp | #include <vector>
#include <boost/numeric/odeint.hpp>
//[my_vector
template< size_t MAX_N >
class my_vector
{
typedef std::vector< double > vector;
public:
typedef vector::iterator iterator;
typedef vector::const_iterator const_iterator;
public:
my_vector( const size_t N )
: m_v( N )
{
... | TOOL | 0.948389 | 6.296396 |
e872c1fe-5a89-43f8-abef-ff4da16eb0a0 | LRL52/ACM-ICPC | 2022ๅนด็ตๅญ็งๆๅคงๅญฆACM-ICPCๆๅ้่ฎญ๏ผๅซๆฐๅญฆไธๅ ไฝไธ้ข๏ผ/7.7/CF388781/H_Three_swimmers.cpp | //ID: LRL52 Date: 2022.7.7
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define ee(i, a) for(int i = head[a]; i; i = e[i].nxt)
using namespace std;
const int N = 1055, M = 2055; char ss[1 << 21], * A = ss, * B = ss, cc;
inline char gc... | ALGO | 0.999945 | 3.726593 |
2a530374-a32c-48de-b5db-1c2109b544be | dhairyasingla09/striver_sde_sheet | Day3/majority_element.cpp | // https : // takeuforward.org/data-structure/find-the-majority-element-that-occurs-more-than-n-2-times/
#include<bits/stdc++.h>
using namespace std;
// Better Approach
int majorityElement(vector<int> v){
int n = v.size();
map<int, int> mp;
for (int i = 0; i<n; i++){
mp[v[i]]++;
}
... | ALGO | 0.999929 | 5.113229 |
52906b36-4a95-4f31-9600-c40f009e12ed | behitek/acm-epu | SPOJ/cpp/spoj-vn/GPMB.cpp | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
typedef std::pair<int, int> p2;
struct ite... | ALGO | 0.999579 | 3.909698 |
f16e34c5-87ea-4126-96be-60fd0f10d9a7 | Aethereux/Hikari-LLVM19 | libcxx/test/std/algorithms/robust_against_adl_on_new.pass.cpp | // <algorithm>
#include <algorithm>
#include <functional>
#include "test_macros.h"
struct A {
int i = 0;
bool operator<(const A& rhs) const { return i < rhs.i; }
static bool isEven(const A& a) { return a.i % 2 == 0; }
};
void *operator new(std::size_t, A*) = delete;
int main(int, char**)
{
A a[4] =... | TEST | 0.99917 | 5.696238 |
997934d1-758a-4bdc-a64a-84495d318c96 | pingjuiliao/BasicBlockIDTracing | llvm-project-10.0.1/libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class fisher_f_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <cassert>
#include <vector>
#include <algorithm>
#include <cmath>
#include "test_macros.h"
double fac(double x)
{
double ... | TEST | 0.98805 | 4.623489 |
4a93f38f-e42a-4ea4-88ff-1bc55ed955d6 | SovietPower/My-OI-ACM | ๅญ็ฌฆไธฒ/AC่ชๅจๆบ/BZOJ.2434.[NOI2011]้ฟ็ธ็ๆๅญๆบ(AC่ชๅจๆบ ๆ ็ถๆฐ็ป DFSๅบ).cpp | /*
31000kb 484ms
ศฒาชๆดขรฟึทิฝึทฮดTrieรฟ'P',ยผรดฮปฤฃิผวฐฺตำฆวตฺผ(วฐฺตใตฑวฐฺต)'B',ึปาปฺตใกฃ
ศป๓นนฝTrieอผfail[]าปาช: fail[y]=xรดyฺตสพฤดาปxฺตสพฤด
DZอฟิตฯฒัฏyรฟฺตfail[]วทึฑำปึธx
ืขโตฝรฟฺตfail[]วฝึธาปฺตฤฃวฟิทอผfail[x]->xฮณาปfail
วถรฟัฏศฅxฺตะถูธyะตฤฝฺต
าปฺตDFSาปาปฮฃิฟึฑfailDFSศปืดฮฌ
ึฑTrieDFSีทสตาปยท+1สฝสฑ-1าปฤดสฑวฐืดึตาปวธรดฯตฤตืต
(ืขิญำฆDzxfailะตfailรตDFS)
รฟฮทสตาปฺต อฟิตรตฮชyัฏสตฤด
ัฏสฐy(Trieฯตฮป)รฟฺติดาปัฏสฑลตไฃฌศปTrieาปDFS
*/
#include <cstdio>
#includ... | ALGO | 0.999842 | 3.555507 |
0d144279-dcd3-459a-989d-7d87c2280dd7 | aqfaridi/Competitve-Programming-Codes | Contests/practo/knodes.cpp | #include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<string>
#include<stdlib.h>
#include<algorithm>
#include<set>
#include<stack>
#include<queue>
#include<assert.h>
#include<utility>
using namespace std;
typedef long long int ll;
#define mp make_pair
#define pb push_back
#define MaxN 10000... | ALGO | 0.999942 | 4.205689 |
f2a204fc-a981-45a5-bf1d-dfbd72822bb0 | pjw6468/ParkJunWoo | ์๋ฃ๊ตฌ์กฐ&๋์์ธํจํด/์๋ฃ๊ตฌ์กฐ์์๊ณ ๋ฆฌ์ฆ/์์ /Chapter_5/BubbleSort/BubbleSort.cpp | #include <stdio.h>
void BubbleSort(int arr[], int n)
{
int temp;
for (int i = 0; i < n - 1; i++)
{
for (int j = 0; j < (n - 1) - i; j++)
{
if (arr[j] > arr[j + 1])
{
temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
int main(void)
{
int arr[4] = { 3, 2, 4, 1 };
BubbleSo... | ALGO | 0.999977 | 4.801095 |
8ced00a3-8eab-4f1b-adf9-40eae37a0788 | chm994483868/HMDailyLearningRecord | Algorithm_C/Algorithm_C/First/MaxInSlidingWindow/MaxInSlidingWindow.cpp | #include "MaxInSlidingWindow.hpp"
vector<int> maxInWindows(const vector<int>& num, unsigned int size) {
// 1. ็จๆฅๅญๆพ max ็ vector
vector<int> maxInWindows;
if (num.size() >= size && size >= 1) {
// 2. ็จๆฅๅญๆพๅฝๅๅคงๅผไธๆ ็ deque
deque<int> index;
// 3. ้ฆๅ
ๆพๅฐ็ฌฌไธไธชๆปๅจ็ชๅฃ็ๆๅคงๅผ๏ผๅนถๆๅฎ็ไธๆ ๆพๅจ index ้้ข
... | ALGO | 0.999891 | 6.217751 |
32a6ad1a-de92-4e99-a18d-ce34bdcb5e75 | torquerxf/Algo-stuffs | Arrays and Pointers/Sorting.cpp | #include <bits/stdc++.h>
using namespace std;
void solution(){
int n;cin>>n;
int a[n];
for(int &i : a) cin>>i;
//using selection sort
for (int i = 0; i < n-1; i++)
{
for (int j = i+1; j < n; j++)
{
if(a[i] > a[j]){
swap(a[i], a[j]);
}
... | ALGO | 0.99985 | 4.890307 |
dd77c0ed-b964-4780-869c-d56fa1612d14 | NipunRathore/LeetCodeSolutions | 2966-divide-array-into-arrays-with-max-difference/2966-divide-array-into-arrays-with-max-difference.cpp | class Solution {
public:
vector<vector<int>> divideArray(vector<int>& nums, int k) {
// sort the input array in ascending order
sort(nums.begin(), nums.end()) ;
int n = nums.size() ;
vector<vector<int> > ans ;
// iterate in steps of 3, for each group of 3 consecuive element... | ALGO | 0.999961 | 5.621987 |
e68ca8ef-e0a2-4d8e-8456-c6dd787676de | Mahedi02/CP-WITH-PHITRON | WEEK WISE SOLVING/WEEK 12/W12-TUESDAY/B_Sets_and_Union.cpp | /* _AUTHOR_ : MAHEDI HASAN ANIK
_CREATED_ : 2024-06-11 || 15:11:12 */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define vec vector<ll>
#define sorta(x) sort(x.begin(), x.end());
#define sor... | ALGO | 0.99918 | 3.665768 |
395e2f90-497d-4451-8fe3-24ac4fdde7a7 | EmptyBlueBox/Practice_of_Programming_in_C_and_CPP_cxsjsx-ljy-2022Spring-PKU | 2022 ็จๅบ่ฎพ่ฎกๅฎไน ไฝไธ/01 ไฝ่ฟ็ฎไฝไธ/C ็ผ็จๅกซ็ฉบ๏ผๅทฆ่พนiไฝๅๅ.cpp | #include <iostream>
using namespace std;
int bitManipulation3(int n, int i) {
//
return n^(0xffffffff<<(32-i));
//
}
int main() {
int t, n, i;
cin >> t;
while (t--) {
cin >> n >> i;
cout << bitManipulation3(n, i) << endl;
}
return 0;
} | ALGO | 0.998634 | 3.81116 |
4e2d2ded-e887-465e-a65a-ce03e80df281 | SequoiaDB/SequoiaDB | thirdparty/boost/libs/hana/benchmark/fold_left/execute.hana.tuple.erb.cpp | #include <boost/hana/fold_left.hpp>
#include <boost/hana/tuple.hpp>
#include "measure.hpp"
#include <cstdlib>
int main () {
boost::hana::benchmark::measure([] {
long double result = 0;
for (int iteration = 0; iteration < 1 << 10; ++iteration) {
auto values = boost::hana::make_tuple(
... | TEST | 0.904191 | 3.626584 |
67d1fcbf-14f0-4dd9-ab0e-4bd7d847a172 | daviferreirart/ffmpeg | deps/opencv/3rdparty/carotene/src/accumulate.cpp | #include "common.hpp"
#include "vtransform.hpp"
#include <cstring>
namespace CAROTENE_NS {
void accumulate(const Size2D &size,
const u8 *srcBase, ptrdiff_t srcStride,
s16 *dstBase, ptrdiff_t dstStride)
{
internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON
size_t roi... | ALGO | 0.999354 | 5.641029 |
bcba4e4c-f051-499d-bbdf-639dc17278c7 | an920107/programming | Other/minesweeper-v2.cpp | #include <iostream>
#include <conio.h>
#include <cstdlib>
#include <ctime>
#define MAX_SIZE 26
#define MIN_SIZE 5
#define FLAG_SIGN 35 // #
#define CURSOR_SIGN 88 // X
#define BACKGROUND_SIGN 32 // Space
#define OCCUPIED_SIGN 46 // .
using namespace std;
int main() {
/** ่ฎๆธๅๅงๅ **/
srand(time(NULL));
... | TOOL | 0.996578 | 3.293037 |
b3298532-507d-4dc1-9a26-ba4bb51b0d6c | alutnopk/cses | 3-dynamic-programming/Removing_Digits.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#pragma GCC target ("arch=sandybridge")
using namespace std;
using namespace __gnu_pbds;
const int p7 = 1000000007;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef unsign... | ALGO | 0.999652 | 4.32894 |
66019929-5df2-4f6d-b200-6d30eeff6949 | BIT-zhaoyang/competitive_programming | uva10557.cpp | #include <bits/stdc++.h>
#define UNVISITED -1
#define _ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
using namespace std;
typedef long long int64;
typedef pair<int, int> ii;
/* A really really good problem. Bellman-Ford and Faster SSSP can only detect if a negative/positive cycle exists.... | ALGO | 0.999783 | 3.926826 |
2c710fc2-00c9-445a-b9b1-05cc8a97b4cf | Skrobson/PolishNumberPlateRecognitionSystem | 3rdParty/opencv/sources/modules/cudalegacy/src/fgd.cpp | #include "precomp.hpp"
using namespace cv;
using namespace cv::cuda;
#if !defined(HAVE_CUDA) || defined(CUDA_DISABLER) || !defined(HAVE_OPENCV_IMGPROC) || !defined(HAVE_OPENCV_CUDAARITHM) || !defined(HAVE_OPENCV_CUDAIMGPROC)
cv::cuda::FGDParams::FGDParams() { throw_no_cuda(); }
Ptr<cuda::BackgroundSubtractorFGD> cv... | ALGO | 0.997233 | 6.663975 |
8e2cb602-ed3c-497f-9092-e699e287e17a | joshuahansel/cl1de | src/reconstructors/ReconstructorEuler2PhaseGodunov.cpp | #include "ReconstructorEuler2PhaseGodunov.h"
#include "DoFHandlerEuler2Phase.h"
ReconstructorEuler2PhaseGodunov::ReconstructorEuler2PhaseGodunov(
const DoFHandlerEuler2Phase & dof_handler)
: ReconstructorEuler2Phase(dof_handler)
{
}
void ReconstructorEuler2PhaseGodunov::reconstructSolution(
const std::vector<do... | ALGO | 0.99661 | 4.454247 |
6a94be0d-44ad-4802-8a06-33fb8b10f3ed | Justinshao33/competitive_programming | done/AtCoder/A_Bitwise_Exclusive_Or.cpp | #pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define rep(X, a, b) for(int X = a; X < b; ++X)
#define pii pair<int, int>
#define... | ALGO | 0.999972 | 4.760525 |
0e3d60d5-8071-4a0f-8ca2-dad2386ad794 | ahmed-youssef-m/attendance-management-system-suite | dlib/examples/sequence_segmenter_ex.cpp | /*
This example shows how to use dlib to learn to do sequence segmentation. In a sequence
segmentation task we are given a sequence of objects (e.g. words in a sentence) and we
are supposed to detect certain subsequences (e.g. the names of people). Therefore, in
the code below we create some very sim... | ALGO | 0.869395 | 7.789237 |
623faa7c-a01c-4828-8345-d984ba063697 | Surya-211/My_GFG_Solutions | Easy/BFS of graph/bfs-of-graph.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to return Breadth First Traversal of given graph.
vector<int> bfsOfGraph(int n, vector<int> adj[]) {
// Code here
vector<int>ans;
queue<int>q;
int vi... | ALGO | 0.999964 | 6.311265 |
b2be844a-6f70-44a2-b3c7-c8abc2aa0ab9 | DKU-STUDY/Algorithm | BOJ/2798.๋ธ๋์ญ/6047198844.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int N, M;
//์ฒซ์งธ ์ค์ M์ ๋์ง ์์ผ๋ฉด์ M์ ์ต๋ํ ๊ฐ๊น์ด ์นด๋ 3์ฅ์ ํฉ์ ์ถ๋ ฅํ๋ค.
//index + 1์ ์ ํํ์๋์ ์์ index + 1์ ์ ํํ์ง ์์์๋์ ์
int brute_force(vector<int> &arr, int idx, int cnt, int sum) {
//index + 1์ ์ ํ์ ๊ณ ๋ คํ์ง์๋์. ์ด๋ฏธ ์กฐ๊ฑด ๋ง์กฑ. ๋์ด์ ๊ณ ๋ คํ ๊ฒ์ด์๋ค -> base case
if (cnt ==... | ALGO | 0.999977 | 4.639212 |
d983caf8-5c1f-4c13-a0d5-f0019166456d | nazmulnnb/Solved-Problems | Toph/How Many Ways.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int>adj[105];
bool visited [1005];
int s,e;
int work(int u)
{
if(u==e)
return 1;
if(adj[u].size()==0)
return 0;
if(visited[u])
return 1;
}
int main()
{
int tt;
cin>>tt;
for(int t=1;t<=tt;t++)
{
int n,m,u,v... | ALGO | 0.999431 | 3.933696 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.