uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
75fb70cb-9357-4f79-8096-18fa8c9e70e0 | Jay-prakashpandey/c-solution | fibinacii finding hackerrank.cpp | //problem: https://www.hackerrank.com/challenges/fibonacci-finding-easy/problem
#include <bits/stdc++.h>
#define mod 1000000007
using ll= long long;
using namespace std;
ll I[2][2],T[2][2];
void multiply(ll ar1[][2],ll ar2[][2]){ll i=0,j=0,k=0;
ll res[2][2];
for (i = 0; i <2; i++){
for (j = 0; j <2; j... | ALGO | 0.999979 | 4.892116 |
ff982e0e-1b78-4044-b1db-82827ea0e020 | ishandutta2007/codeforces | 131131yhx/normal/1063/F.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#define M 1000010
using namespace std;
char ch[M];
int n, F[M], SA[M], RA[M], C[M], C1[M], C2[M], H[M], Hx[21][M], Log[M];
void getSA() {
int *A = C1, *B = C2;
for(in... | ALGO | 0.999974 | 4.055322 |
55532854-2f09-4a18-9246-871d10c66a22 | IAmNotIsaac/canadot | thirdparty/bullet/Bullet3Collision/BroadPhaseCollision/b3DynamicBvh.cpp | ///b3DynamicBvh implementation by Nathanael Presson
#include "b3DynamicBvh.h"
//
typedef b3AlignedObjectArray<b3DbvtNode*> b3NodeArray;
typedef b3AlignedObjectArray<const b3DbvtNode*> b3ConstNodeArray;
//
struct b3DbvtNodeEnumerator : b3DynamicBvh::ICollide
{
b3ConstNodeArray nodes;
void Process(const b3DbvtNode* ... | ALGO | 0.999361 | 6.277325 |
e035dae5-2427-4432-8c7d-af148b0e7d8c | gim-largerepo/including-investment-59GB | src/else.cpp | Former whole PM.
Break short month travel increase bit best.
Feel share southern stage.
Finally bit himself scene free.
Try upon cold rise.
Party fish apply life deal control room.
If record various approach arrive.
If face message feeling produce wide teacher.
White commercial ago food ever population later.
Prepare a... | TEST | 0.886756 | 4.073999 |
2d3e3066-f4b1-44c3-901c-2e98737c00c1 | AriSlon/Guias-y-Practica---AyED | Guias/Ejemplo del profe/Guia06-ListasOrdenadas/G06E02/main.cpp | #include <iostream>
#include <fstream>
#include "listas.hpp"
#include "rwstring.hpp"
using namespace std;
struct Ordencomp {
int id;
string cliente;
string producto;
int cant;
};
const int lclie {8};
const int lprod {10};
ostream& operator << (ostream &os, const Ordencomp& ord)
{
os << "id: " << ord.id << " - "... | TOOL | 0.953729 | 4.030021 |
a3c28a5d-93f4-4502-94bc-302d7e68e1e3 | Ishwarsing34/Leetcode | 0046-permutations/0046-permutations.cpp | class Solution {
void permutations(vector<int>&nums,vector<vector<int>>&ans,int ind){
if(ind == nums.size()){
ans.push_back(nums);
}
for(int i=ind;i<nums.size();i++){
swap(nums[i],nums[ind]);
permutations(nums,ans,ind+1);
swap(nums[i],nums[i... | ALGO | 0.999997 | 6.246734 |
fc991227-247b-421d-8bcc-76cb8715847d | Devn913/DSACpp | 3.Patterns 2/Q16: StarPattern.cpp | /*
Code : Star Pattern
Print the following pattern
Pattern for N = 4
*
***
******
*/
#include "iostream"
using namespace std;
int main() {
int numberOfLines;
cout << "Enter the number of lines: ";
cin >> numberOfLines;
int numberOfSpace;
int stars = 1;
for (int i = 0; i < numberOfLines; i++... | ALGO | 0.999468 | 5.290019 |
400e12b4-1b26-4c89-822f-2a4fdf142e88 | Xxmostafaahmed/cpp-test-project | Functions.cpp/Callbyreference.cpp | #include<iostream>
using namespace std ;
void change (int & n)
{
n=n*n;
cout<<"value of function "<<n<<endl;
}
int main(){
int n;
n=n*n;
cout<<"Enter value :";
cin>>n;
change (n);
cout<<" Value in main :"<<n<<endl;
return 0;
}
| ALGO | 0.983284 | 3.882323 |
371deb15-ad77-448e-aa63-e03ec2ecd070 | bradlotocki/nanodegree | 0 foundations/code/1_introduction_to_cpp/lesson_18_exercise.cpp | // exercise: store grid
#include <iostream>
#include <vector>
using std::vector;
using std::cout;
void PrintBoard(const vector<vector<int>> &board) {
for (auto row : board) {
for (auto element : row)
cout << element;
cout << "\n";
}
return;
}
int main() {
vector<vector<int... | ALGO | 0.980982 | 3.128049 |
7a970a56-7d1c-4077-b256-8be4285bd057 | Bungmint/competitiveprogramming | contest/atcoder/AGC58/A.cpp | using namespace std;
#pragma region TEMPLATE
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpi = vector<pii>;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pll>;
using ld = long double;
template <typename T, size_t SZ>
using ar = array<T, SZ>;
template <typename... | ALGO | 0.999977 | 4.068189 |
093bdcdd-fca2-4592-b624-7e9e7cb503e9 | zigmars/advent-of-code | Day 8 Handheld Halting/d8_1.cpp | #include <iostream>
#include <sstream>
#include <set>
#include <vector>
using namespace std;
struct instr {
char op;
int val;
};
using ull = unsigned long long;
struct state {
ull acc;
int pc;
};
vector<instr> program;
set<int> visited;
int main(){
string line;
while(getline(cin, line)){
... | ALGO | 0.99926 | 4.477745 |
9aed17bc-4c2f-4da5-a330-ef5b0bcae418 | florianreyes/leetcode-problems-explained | CONTESTS/TAP2016/J.cpp | #include <bits/stdc++.h>
using namespace std;
#define forsn(i, s, n) for (int i = int(s); i < int(n); i++)
#define dforsn(i, s, n) for (int i = int(n) - 1; i >= int(s); i--)
#define forn(i, n) forsn(i, 0, n)
#define dforn(i, n) dforsn(i, 0, n)
#define fore(i, s, n) forsn(i, s, n)
#define pb push_back
#define mp make_... | ALGO | 0.999976 | 3.626492 |
5085b0a0-b5f2-4441-a4f0-cd8ca13e1cce | krishnak2002/DSA_CPP | Queue/ArrayImplementation.cpp | #include<iostream>
#include<queue>
#include<vector>
using namespace std;
class Queue{
public:
int f;
int b;
int s;
//int arr[5];
// Queue(){// constructor
// f = 0;
// b = 0;
// }
// also can do it from the vector
vector<int> arr;
Queue(int val){
f = 0;
... | ALGO | 0.970753 | 4.020989 |
69970375-fbb2-466d-a115-a6a311cdb220 | sangam11a/commander_px4 | src/modules/mc_pos_control/PositionControl/ControlMath.cpp | /**
* @file ControlMath.cpp
*/
#include "ControlMath.hpp"
#include <px4_platform_common/defines.h>
#include <float.h>
#include <mathlib/mathlib.h>
using namespace matrix;
namespace ControlMath
{
void thrustToAttitude(const Vector3f &thr_sp, const float yaw_sp, vehicle_attitude_setpoint_s &att_sp)
{
bodyzToAttitud... | TOOL | 0.982184 | 6.519343 |
a130380a-4d5c-419e-9464-590e455fdfad | hiteshnatha15/GFG | Medium/Diagonal sum in binary tree/diagonal-sum-in-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
... | ALGO | 0.999164 | 6.58602 |
7e5d0570-e2a1-4106-a450-b2230dbf55cc | AlanLiang-314/itsa | cpp/telephone_fee.cpp | // https://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=6909
// [C_MM19-易] 電話費計算
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int n;
float fee;
cin >> n;
scanf("%d", &n);
if(n <= 800) {
fee = n * 0.9;
} else if(n < 1500) {
fee = n * 0.9 * 0.9;
} else {
... | ALGO | 0.999403 | 4.207928 |
090295fc-0a1e-45b9-9ea6-8064b6075ed3 | mr2rm/solutions | legacy/UVa/900.cpp | #include <iostream>
using namespace std;
int main ()
{
long long d[51];
for ( int i = 1 ; i < 51 ; i++ )
{
if ( i == 1 || i == 2 )
d[i] = i;
else
d[i] = d[i-1] + d[i-2];
}
int t;
while ( cin >> t && t != 0 )
{
cout << d[t] << endl;
}
return 0;
} | ALGO | 0.999538 | 3.810441 |
5cecc1c8-4ebc-40b2-b71f-bcff1066d83b | nidhidattani13/placement_training | smallest_letter.cpp | #include <iostream>
#include <vector>
using namespace std;
char letter(vector<char>& letters, char target) {
int n = letters.size();
int left = 0, right = n;
while (left < right) {
int mid = left + (right - left) / 2;
if (letters[mid] <= target)
left = mid + 1;
else
... | ALGO | 0.999715 | 5.391776 |
af891425-9ab8-4715-8058-368dbe30eb32 | DE-NISkA/android_frameworks_base | media/libstagefright/codecs/aacdec/trans4m_time_2_freq_fxp.cpp | /*
Pathname: trans4m_time_2_freq_fxp.c
Function: trans4m_time_2_freq_fxp
------------------------------------------------------------------------------
REVISION HISTORY
Description:
Modified normalization, so it now happen per window basis, eliminated
shifts left or rigth to accomodate TNS inve... | ALGO | 0.999385 | 3.516416 |
402b1d5a-39c2-4931-a5f3-933ca6328a7a | ayush-1560/DSA | 106-construct-binary-tree-from-inorder-and-postorder-traversal/construct-binary-tree-from-inorder-and-postorder-traversal.cpp | class Solution {
public:
int search(vector<int>& inorder,int start,int end,int ele){
for(int i=start;i<=end;i++){
if(inorder[i]==ele) return i;
}
return -1;
}
TreeNode* helper(vector<int>& inorder, vector<int>& postorder,int& postIdx,int start,int end){
if(start>e... | ALGO | 0.999992 | 6.254961 |
69893f0d-6c16-4b19-ae42-81c2b6b5573d | FortuneOS-CAF/platform_frameworks_av | media/module/codecs/amrnb/enc/src/cl_ltp.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/cl_ltp.c
Funtions: cl_ltp_init
cl_ltp_reset
cl_ltp_exit
cl_ltp
Date: 06/07/2000
------------------------------------------------------------------------------
REV... | ALGO | 0.985965 | 6.540888 |
2a34a0c9-aa37-4117-afc9-e7185b6a86db | xixi-shredp/xixi-gem5 | src/systemc/tests/systemc/misc/user_guide/chpt11.3/mean.cpp | /*****************************************************************************
mean.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | ALGO | 0.99899 | 4.530694 |
d989d5c5-9b26-4cbb-a560-4ee07bcb31e5 | tamim36/Leetcode-Solutions | 0405-convert-a-number-to-hexadecimal/0405-convert-a-number-to-hexadecimal.cpp | class Solution {
public:
string toHex(int b) {
long long num = b;
if (num == 0)
return "0";
int xor_val = 0;
long long c = pow(2, 32) - 1;
if (num < 0) {
num *= -1;
c ^= num;
c += 1;
num = c;
}
string hex = "0123456789abcdef";
string res = "";
int rem = 0;
while (num) {
... | ALGO | 0.999672 | 5.801973 |
1bd8c278-dc74-4905-b438-0ff52ef7a4d6 | luliyucoordinate/Leetcode | src/0901-Online-Stock-Span/0901.cpp | #include <stack>
using namespace std;
static int x = []() {std::ios::sync_with_stdio(false); cin.tie(0); return 0; }();
class StockSpanner
{
public:
stack<pair<int, int>> s;
int next(int price)
{
int res = 1;
while (!s.empty() && s.top().first <= price)
{
res += s.top... | ALGO | 0.999268 | 5.377769 |
8bc16d98-70f0-4b45-95e8-93830df67f5b | druidream/competitive-programming | codeforces/1829/G. Hits Different/G. Hits Different/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define Rep(i, x, n) for (int i = x; i < n; i++)
#define rev(i, n) for (int i = n - 1; i >= 0; i--)
#define LSOne(S) ((S) & (-S))
#define roundUp(a, b) ((a + b - 1) / b)
#define print(x) cout << x << '\n';
#define printBool(x) ... | ALGO | 0.999704 | 4.546244 |
83bb26f1-e64d-4845-8de6-83be2321c01d | mdirshad17/leetcode | 1770-maximum-score-from-performing-multiplication-operations/1770-maximum-score-from-performing-multiplication-operations.cpp | class Solution {
public:
int n;
int dp[1010][1010];
int solve(int i,int l,int m,vector<int> & v,vector<int> & M){
if(i>=m)return 0;
if(dp[i][l]!=INT_MIN)return dp[i][l];
int leftmoves=l;
int rightmoves=i-l;
int r=n-1-rightmoves;
int op1=v[l]*M[i]+solve(i+1,l+1,m,v,M);... | ALGO | 0.999976 | 5.177266 |
f63788aa-e895-45e8-9a8f-c2d3c45b2bca | pankajgupta3/Coding-Ninjas--Data-Structures-and-Algorithms-in-Cpp | Linked List 2/Decimal Equivalent.cpp | /* Code: Decimal Equivalent
Given a singly linked list of 0s and 1s, find and return its decimal equivalent.
Input Format :
Elements of the linked list ending with -1 (-1 not included)
Output Format:
Decimal equivalent of input LL
Constraints :
1 <= size of list <= 100
Sample Input 1:
1 0 -1
Sample Output 1:
2
Sample I... | ALGO | 0.999867 | 4.395988 |
ab6f61e9-d581-4731-8fa9-1c69a9044a01 | romdi/iosoccer-game | public/simple_physics.cpp | #include "simple_physics.h"
#include "tier0/dbg.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
CSimplePhysics::CSimplePhysics()
{
Init( 1.0f / 30.0f ); // default is 30 steps per second
}
void CSimplePhysics::Init( float flTimeStep )
{
m_flPredictedTime = 0;
m_iCurTimeS... | ALGO | 0.97047 | 5.881694 |
3cd56cc1-7418-4161-8fed-244459d4201a | pandeyankit123/CP-Solutions-by-Laidback | A_Morning.cpp | /* __ ___ ______ ______ _____ ___ _____ _ __
/ / / \ \ |__ __| | | \ \ | | \ \ / \ \ | ___| | | / /
/ / / /_\ \ || | | | | | |__/ / / /_\ \ | | | | / /
/ /___ / /---\ \ __||__ | | | | | | \ \ / /---\ \ | |___ | | \ ... | ALGO | 0.999472 | 4.429002 |
58625b5d-edb6-4955-ab6d-9e742a525033 | Rawat-Arjun/expense-tracker | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
0590db6e-fca1-42d2-bd22-2fcb21bc0f59 | ishandutta2007/codeforces | intercept/normal/917/D.cpp | #include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define eb emplace_back
#define ll long long
#define ma make_pair
using namespace std;
const int mod=1e9+7;
const int M=109;
int n;
int dp[M][M][M],siz[M],p[M][M],ans[M];
vector<int>g[M];
void add(int &x,int y){
x+=y;
x>=mod?x-=mod:0... | ALGO | 0.999918 | 4.142442 |
32a3c244-54c2-4bf9-b1c1-3391f6fa8b1b | marahim34/Data-Structure | Module-22/delete_trom_max_heap.cpp | #include <bits/stdc++.h>
using namespace std;
void insert_heap(vector<int> &v, int x)
{
v.push_back(x);
int cur_ind = v.size() - 1;
// cout << cur_ind << endl;
// cout << parent << endl;
while (cur_ind != 0)
{
int parent = (cur_ind - 1) / 2;
if (v[parent] < v[cur_ind])
... | ALGO | 0.999972 | 4.966273 |
da7fe8bc-bf7f-46d1-b0dc-46c6fc6d497c | nduong18/DSA_CODE.PTIT_nduong18 | DSA06019 - SẮP XẾP THEO SỐ LẦN XUẤT HIỆN.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int t; cin >> t;
while (t--){
int n; cin >> n;
map <int,int> mp;
for (int i = 0; i < n; i++){
int x; cin >> x;
mp[x]++;
}
vector <pair<int,int>> v(mp.begin(),mp.end())... | ALGO | 0.999981 | 4.596415 |
9d71876b-ad44-4340-a04c-bfb4a48d2ecd | iDroid-Project/platform_frameworks_base | media/libstagefright/codecs/amrwb/src/scale_signal.cpp | /*
------------------------------------------------------------------------------
Filename: scale_signal.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
------------------------------------------------------------------------... | ALGO | 0.999221 | 5.950333 |
2e4a867d-a584-4cf7-b74f-c9c45d9c31af | PranitChawla/ACM-ICPC-Regionals-Codes | new_year_and_the_permutation_concatenation.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll fact [1000004];
ll m=998244353;
ll modular_exp (ll x,ll n,ll M)
{
if (n==0)
return 1;
else if (n%2==0)
return (modular_exp((x*x)%M,n/2,M))%M;
else
return (x*modular_exp((x*x)%M,(n-1)/2,M)%M);
}
int main()
{
ll n;
cin>>n;
fa... | ALGO | 0.999991 | 4.99855 |
f7738cd9-1d92-49be-ad25-0a0c37278c6a | kina111/Fundamental_DSA_C_Cpp | BasicC_DSA/Basic_C/[28TECH]. C-C++/Xau_ki_tu/phan_loai_ki_tu.cpp | #include <string.h>
#include <stdio.h>
int main()
{
char a[100];
gets(a);
int so = 0, chu_cai = 0, db = 0;
for (int i = 0; i< strlen(a); i++){
if (a[i] >= '0' && a[i] <= '9') so++;
else if ((a[i] >= 'a' && a[i] <= 'z') || (a[i] >= 'A' && a[i] <= 'Z')) chu_cai++;
else db++;
}
printf("%d %d %d", so, chu_cai, ... | ALGO | 0.998821 | 3.157965 |
75ead5ab-2201-4b80-bd5b-64b1bbb30f6d | devMorpheus/git-main | tutorial/ruud_van_der_pass_openmp/04_omp_features/14_critical.cpp | /* Synchronization construct: critical
syntax: #pragma omp critical [name]
structured-block
The critical construct provides a means to ensure that multiple threads do
not attempt to update the same shared data simultaneously. The associated
code is referred to as a critical region, or a cri... | ALGO | 0.99857 | 4.267406 |
635fb012-a342-4215-9781-13c3cba3cf6b | omron-sinicx/homotopy-aware-MAPP | src/dynnikov_test.cpp | #include "braid.hpp"
#include "dynnikov.hpp"
#include <algorithm>
#include <cassert>
void test() {
int n, N, l, c;
scanf("%d%d%d%d", &n, &N, &l, &c);
std::vector<Braid> braids(N, Braid(n));
std::vector<Dynnikov> dyns(N, Dynnikov(n));
for (int t = 0; t < N; t++) {
for (int j = 0; j < l; j++) {
int i... | ALGO | 0.999138 | 3.310834 |
215b69de-f03c-4a60-8bf9-c74b46b58453 | DocCreator/DocCreator | software/DocCreator/src/Degradations/Distortion3DModel/src/TexCoordComputationCommon.cpp | #include "TexCoordComputationCommon.hpp"
#include <cassert>
#include <iostream>
#include "Mesh.hpp"
void
checkTexCoords(const Mesh &mesh)
{
if (!mesh.hasTexCoords())
return;
const uint32_t numtexcoords = mesh.numVertices;
const uint32_t numTriangles = mesh.numTriangles;
const uint32_t *triangles = mesh.... | ALGO | 0.993997 | 5.63003 |
c04292b1-458f-4fa8-ae52-30ca40de1aec | At0mn1yIvan/ppc-2023-mpi | tasks/task_1/lesnikov_a_most_different_elements_in_vec/most_different_elements_in_vec.cpp | std::vector<int> getRandomVector(int n) {
std::random_device dev;
std::mt19937 gen(dev());
std::vector<int> random_vector;
for (size_t i = 0; i < n; i++) {
random_vector.push_back(gen() % 100);
}
return random_vector;
}
std::vector<std::pair<size_t, size_t>> getSequentialMostDifferent... | ALGO | 0.999856 | 6.145113 |
ec39f726-bf21-40d0-b231-1375dd7fa952 | ashib11/Sub_Zero_ | J_Kitchen_Plates.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
#define ll long long
#define pi acos(-1.0)
#define ull unsigned long long
#define endl "\n"
#define all(v) v.begin(), v.end()
#define allr(v) v.r... | ALGO | 0.99972 | 4.023577 |
13aef7a1-9f1b-4a90-9b45-e45722496678 | ArifRahman336/Arif-XPSC-Batch-04 | week2/day2/H.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int a,b;
cin>>a>>b;
vector<string>v(a);
for(int i=0;i<a;i++){
cin>>v[i];
}
int ans=INT_MAX,sum;
for(int i=0;i<a-1;i++){
for(int j=i+1;j<a;j++){... | ALGO | 0.999763 | 3.779735 |
4edc2e3f-1ce0-452d-8852-97349c85b172 | brianhsu7476/CF | 1872/testG5.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
int t,n,a[200005],b[200005],l,r;
void work(){
l = r = 1;
cin >> n;vector<int> acc;int res = 1,sm = 0,ans = 0;
for(int i = 1;i <= n;i ++) cin >> a[i],b[i] = 0;
for(int i = 1;i <= n;i ++) if(a[i] != 1) r = i,acc.push_back(i);
for(int i... | ALGO | 0.999762 | 3.545894 |
c4047d9b-7008-4e0b-bbc4-58d2e8f6b786 | AvanishShukla20/Leetcode-problems | 753-open-the-lock/open-the-lock.cpp | class Solution {
public:
int openLock(vector<string>& deadends, string target) {
int n=deadends.size();
unordered_set<string> st;
for(int i=0; i<n; i++)
{
st.insert(deadends[i]);
}
string initial = "0000";
if(st.find("0000") != st.end()) return -... | ALGO | 0.999936 | 6.401896 |
7b4a5aba-947e-4b89-b797-77cb99892d4a | yoshiki-maruya/atcoder | src/atcoder/abc/abc375/d/abc375_d.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vec vector<int>
#define vecd vector<double>
#define vecll vector<ll>
#define Graph vector<vector<int>>
#define wGraph vector<vector<Edge>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/* rep(i, n) {
... | ALGO | 0.999912 | 5.049218 |
3c9fec47-f008-4724-9625-cf3ee0ae13df | aaakshit/Leetcode-solutions | 0744-find-smallest-letter-greater-than-target/0744-find-smallest-letter-greater-than-target.cpp | class Solution {
public:
char nextGreatestLetter(vector<char>& letters, char target) {
int l=0,h=letters.size()-1;
int ans=-1;
while(l<=h){
int mid=l+(h-l)/2;
if(letters[mid]>target){
ans=mid;
h=mid-1;
}
else
... | ALGO | 0.999824 | 5.916874 |
3697d8fe-4836-48cb-bde6-1f3dba92ecea | acasaccia/the-algorithm-design-manual | 01-introduction-to-algorithm-design/challenges/110108-australian-voting/australian-voting.cpp | /*
* australian-voting.cpp
*/
#include <iostream>
#include <string>
#include <sstream>
void parse_case(int &candidates_count, int &votes_count, char candidates[][80], int votes[][1000]) {
std::cin >> candidates_count;
std::cin.get();
for (int j=0; j<candidates_count; j++) {
std::cin.getline(candidates[j], size... | ALGO | 0.999938 | 4.972233 |
258574c4-3ae2-4da6-a3ba-9701fe72c442 | nesi73/EDA | 1º Cuatrimestre/Curva_concava.cpp | // Inés Prieto Centeno
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
/* COSTE DE LA FUNCION
|t(1) = v[0]
|
T(n) = |t(n/2) ---> log n
|
*/
// función que resuelve el problema
int resolver(std::vector<int> const&v, int ini, int fin) {
if (ini == fin) return v[ini];
else if ... | ALGO | 0.999915 | 5.173443 |
aec56348-1a60-4ba2-b7e7-565c0eeb30da | Avninder99/LeetCode_GFG_Solutions | 92-reverse-linked-list-ii/92-reverse-linked-list-ii.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* reverseBetw... | ALGO | 0.999997 | 5.708808 |
11f539d9-247f-40f3-be3d-c9c0d81236a6 | convict-git/sport_coding | practise_3xc3pt10n/www.spoj.com/SPOJ_Classical/EC_P/EC_P.cpp | #include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define IOS ios_base::sync_with_stdio(false); cin.tie (nullptr)
#define PREC cout.precision (10); cout << fixed
#de... | ALGO | 0.999608 | 4.576986 |
713cd746-1e58-4cfd-8e4c-1b50d50db877 | yuvraj0502/DSA | LeetCode/string/multiply 2 string.cpp | class Solution {
public:
string multiply(string num1, string num2) {
if(num1=="0" || num2=="0"){
return "0";
}
int len1=num1.size();
int len2=num2.size();
vector<int>result(len1+len2,0);
for(int i=len1-1;i>=0;i--){
for(int j=len2-1;j>=0;j--){... | ALGO | 0.999963 | 6.148018 |
80b9770f-0e32-4b04-a3fd-7e937758620e | dashan124/DataStructuresAndAlgorithms | HackerRank/Algorithms/SansaAndXor.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
// C++ program to get total xor of all subarray xors
#include <bits/stdc++.h>
using namespace std;
// Returns XOR of all subarray xors
int getTotalXorOfSubarrayXors(int arr[], int N)
{
// if even number of terms are ther... | ALGO | 0.999708 | 4.809766 |
8e801e61-2e17-483a-a799-91e865d95b12 | KelvinOr/mufyp_orderaholic_2c_client | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
aa92af1c-a484-42ae-8ab8-7bfa490cf6d9 | Mugdha-Hazra/180-Questions-Striver-SDE-sheet-in-CPP | Height of Binary Tree - GFG/height-of-binary-tree.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node* buildTree(string str)
{
// ... | ALGO | 0.999212 | 6.874224 |
c830ae69-e106-44d8-9afe-2470bcf7b964 | leonidk/physical_simulation | Box2D/Dynamics/Contacts/b2Contact.cpp | #include "Box2D/Dynamics/Contacts/b2Contact.h"
#include "Box2D/Dynamics/Contacts/b2CircleContact.h"
#include "Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h"
#include "Box2D/Dynamics/Contacts/b2PolygonContact.h"
#include "Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h"
#include "Box2D/Dynamics/Contacts/b2EdgeAnd... | ALGO | 0.988316 | 7.745269 |
09e64ec8-b63f-456f-9bda-2b13e0e5da4c | Priyanshu6268/GFG_POTD | 2025/07 - July/03Jul25.cpp | class Solution {
public:
int longestKSubstr(string &s, int k) {
// code here
unordered_map<char, int> mp;
int l = 0, r = 0, n = s.size(), ans = -1;
while (r<n){
mp[s[r]]++;
while (mp.size()>k){
mp[s[l]]--;
if (mp[s[l]] == 0) m... | ALGO | 0.999933 | 5.882819 |
1f2219bc-42b4-446e-bd74-bde19f2c151d | Asharma538/CSES-Solutions | SortingAndSearching/SubarraySumsI.cpp | // we'll use a two pointer approach
// j , i
// i will keep inc till the sum between them reaches x or greater
// j will keep inc till the sum between then reaches x or lesser
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll n,x; cin>>n>>x;
ll arr[n]; for(int i=0;i<n;i++)... | ALGO | 0.999987 | 4.853964 |
d727aba7-de82-4a67-a77a-00e0f7213af1 | Sofia-Guo-Fu/Financial-Computing-6883-Sofia-Guo-Personal-Repo | Final Exam Review/Version8(Topic7)/Option08.cpp | #include "BinomialTreeModel02.h"
#include "BinLattice02.h"
#include "Option08.h"
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
namespace fre{
// destructor for Option class
Option::~Option(){}
double Call::Payoff(double z) const
{
if (z>K) return (z-K);
... | ALGO | 0.999941 | 5.920676 |
192e8e0e-808e-4202-a9b0-e19bebd79f40 | LosReturn/AC_dream | leetcode/110.平衡二叉树.cpp | /*
* @lc app=leetcode.cn id=110 lang=cpp
*
* [110] 平衡二叉树
*/
// @lc code=start
/**
* 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), ri... | ALGO | 0.999921 | 7.06834 |
8cf7d5d3-d8cf-4056-9437-2e96c4a3426f | Farzine/Competative_Programing_Helper_code | Nesting_vector_by_pair.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
void printVec(vector<pair<int,int>>&v){
cout<<"Size: "<<v.size()<<endl;
for(int i=0; i<v.size(); i++)
cout<<v[i].first<<" "<<v[i].second<<endl;
cout<<endl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.... | ALGO | 0.99718 | 4.685152 |
0acf4788-7846-42d9-9e53-fe25287d5e83 | Murielly-Nascimento/Maratonas | BOCA/Combinatoria/C.cpp | #include<bits/stdc++.h>
using namespace std;
int main(void){
int N = 0;
cin>>N;
for(int i = 0; i<N;i++){
int numeros[10] = {0};
int resp = 6;
for(int j = 0; j < 6; j++){
int aux = 0;
cin>>aux;
numeros[aux]++;
if(numeros[aux] > 1) res... | ALGO | 0.999853 | 3.973598 |
017120de-2773-482c-b4bf-faa3a9d17c40 | vivek-panchal/Leetcode-Daily-Challenge-2024- | 5th July 2024 || 2058. Find the Minimum and Maximum Number of Nodes Between Critical Points.cpp | class Solution {
public:
vector<int> solve(ListNode* head ,vector<int>& ans){
ListNode* prev=head;
ListNode* curr=head->next;
int criticalIndex=0;
int CurrCriticalIndex=0;
int index=2;
while(curr->next!=NULL){
if((curr->val>prev->val && curr->val>... | ALGO | 0.999999 | 5.502133 |
d311f43c-205a-479b-b650-19f7066673ea | yosupo06/library-checker-problems | sample/aplusb/grader/grader.cpp | #include <iostream>
#include <chrono>
#include "fastio.h"
#include "solve.hpp"
using namespace std::chrono;
using namespace library_checker;
int main() {
Scanner sc = Scanner(stdin);
Printer pr = Printer(stdout);
long long a = 0, b = 0;
sc.read(a, b);
steady_clock::time_point begin = steady_clo... | ALGO | 0.985882 | 3.324435 |
d65c10e8-a6cd-4638-9c41-1c50cfdce21d | karapuzio/Lab_Murashko | 14_2/14_2/main.cpp | #include <iostream>
#include <stack>
using namespace std;
template <class T, class C = class stack<T> > class queue
{
protected :
C stack1;
C stack2;
public :
typedef typename C::value_type value_type;
typedef typename C::size_type size_type;
bool empty() const
{
return (stack1.empty() || stack2.empty... | ALGO | 0.954609 | 4.191455 |
701c5809-0627-46b2-a378-0a175e7d8ce6 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_6336_40.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,j; cin >> a >> b >> h;
cout << (a+b)*h/2 << endl;
} | ALGO | 0.995341 | 3.08664 |
1723e8ac-b24c-4770-80c4-a3464573e139 | Arpitgupta1014/Competitive-Programming | Leetcode/contains-duplicate.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
sort(nums.begin(),nums.end());
for(int i=0;i<nums.size()-1;++i){
if(nums[i]==nums[i+1]){
return true;
}
}
return false;
}
};
// Second code
class Solut... | ALGO | 0.999979 | 5.905743 |
802c9630-8956-4735-b577-e26ef908e5c8 | vintitres/practice | leetcode/1146-greatest-common-divisor-of-strings/solution.cpp | class Solution {
bool check(string s, unsigned int l, string s2 = "") {
if (s.size() < l) return false;
string sdiv = s2 == "" ? s.substr(0, l) : s2.substr(0,l) ;
for (int i = 0; i < s.size() / l; ++i) {
if (s.substr(i * l, l) != sdiv) return false;
}
return true;
}
public:
string gcdOfS... | ALGO | 0.999971 | 6.147126 |
ac33c6b7-9d22-4e80-8d1b-8ec145c89cea | mastercba/flutter-chat-app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998693 | 6.797273 |
8a906acd-bd60-4f0d-84c5-88ccf169c37f | pradeep891/LeetCode-and-Gfg-Practice | Reverse a String - GFG/reverse-a-string.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
string reverseWord(string str)
{
// Your code goes here
int i=0 , j = str.size()-1;
while(i < j) s... | ALGO | 0.999894 | 6.088895 |
90fc4f4a-78a9-45ba-8d57-a2fe34b79241 | mercy666/C-_code | callbyvalue_address/test.cpp | #include<iostream>
using namespace std;
/*void fun1(int *p ,int *q){
*p=*p+*q;
}
int main(){
int i=2,j=3;
fun1(&i,&j);
cout<< endl;
cout << "result is " << i << endl;
} */
void fun2(int p, int q){
p=p+q;
}
int main(){
int i=2,j=3;
fun2(i,j);
cout<< endl;
cout << "result is " << i << endl;
}
| ALGO | 0.999165 | 3.658847 |
081e00d4-f2c1-4c43-b8ac-fb01147ec78e | edwinchow12/comp2113project | src/mathematics.cpp |
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <random>
#include "mathematics.h"
using namespace std;
// Guess The Number
// The number of times the user used to guess the number is returned
int GuessTheNumber::run()
{
int numGuess, numSecret, numUp, numDown, numMid, count;... | ALGO | 0.979176 | 3.163212 |
16e5bf16-161d-4053-b0d8-28c6ee911989 | avhkbcj99/learn-cpp | 04/117 const with member func.cpp | /**
* Created by author on 2023/5/18 10:16
*/
// 常函数:
// 成员函数后加const后我们称为这个函数为常函数
// 常函数内不可以修改成员属性
// 成员属性声明时加关键字mutable后,在常函数中依然可以修改
// 常对象:
// 声明对象前加const称该对象为常对象
// 常对象只能调用常函数
// 常对象的成员属性不可以修改,加mutable后可以修改
// 常对象必须初始化,因为常对象的属性也必须初始化
// 常引用:
// 用const修饰的引用
// 常引用主要用来修饰形参,防止误操作
// 常引用指向的对象,不可以通过常引用修改对象
// 常指针:
// 用... | TOOL | 0.883512 | 3.750699 |
b80e86aa-764b-490a-9517-902f557a894e | YourName0729/competitive-programming | Kattis/kitchencombinatorics.cpp | // https://open.kattis.com/problems/kitchencombinatorics
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define For(i, n) for (int i = 0; i < n; ++i)
#define Forcase int __t = 0; cin >> __t; while (__t--)
#define ll long long
#define ull unsigned long long
#defin... | ALGO | 0.999752 | 4.548882 |
290d8da7-aad7-455a-bb2e-94fbb4d8e120 | wbzhang233/online_test_imitation | meituan/2020spr/4.cpp | // 美团2020春招,最优前缀树
// Created by wbzhang on 2020/9/20.
//
#include <iostream>
#include <vector>
#include <string>
using namespace std;
struct Node
{
int cnt;
Node* next[26]; //26个小写的字母 a-z
Node():cnt(1) // 对于最优前缀树的每个节点都要将指 指针数组初始化为nullptr, 每一个cnt都要初始化为1
{
for (int i = 0; i < 26; i++)
{
next[i] = nullptr;
... | ALGO | 0.999905 | 4.568273 |
1761ca65-7a58-427b-b0f7-fa92639fe2d9 | yuichiro-kurose/kyopro | atcoder/abc355/b/main.cpp | // author: Yuichiro Kurose
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<int> a(n), b(m), c(n + m);
for (int i = 0; i < n; i++) {
cin >> a[i];
c[i] = a[i];
}
for (int i = 0; i < m; i++) {
cin >> b[i... | ALGO | 0.999987 | 3.524286 |
c4e5643e-3fec-4a99-ba28-5808d6bde61d | Shubhanggit/LEETcode | 148-sort-list/sort-list.cpp | class Solution {
public:
ListNode *middle(ListNode *head)
{
ListNode * slow=head;
ListNode * fast=head->next;
while(fast!=NULL&&fast->next!=NULL)
{
slow=slow->next;
fast=fast->next->next;
}
return slow;
}
ListNode *merge(ListNode*left,ListNode*right)
{
ListNode *head=new Lis... | ALGO | 0.999997 | 5.856822 |
2b96f90d-6912-4c50-a399-c4622756df4b | HyungseobKim/LeetCodeProblems | 242_Valid Anagram.cpp | class Solution {
public:
bool isAnagram(string s, string t) {
if (s.length() != t.length())
{
return false;
}
int table[26] = {0};
for (const char c : s)
{
table[static_cast<int>(c-'a')] += 1;
}
for (c... | ALGO | 0.999981 | 6.637274 |
39a731bd-a9de-48e3-8720-44258f5c97f2 | ArmanKurmanaliev/OOP2018 | Desktop/BIBLIATEKA/allLab/final/13.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int r[9];
for (int i=1; i<10; i++)
{
r[i]=0;
}
int a;
while (cin>>a)
{
r[a]++;
if (a==0)
break;
}
for (int i=1; i<10; i++)
{
cout<<r[i]<<" ";
}
return 0;
} | ALGO | 0.999676 | 3.88478 |
7e91604a-3060-4364-90be-739d95064586 | ishansharma8/Leetcode-solutions | 73-set-matrix-zeroes/73-set-matrix-zeroes.cpp | class Solution {
public:
void setZeroes(vector<vector<int>>& matrix) {
int col0=1,rows=matrix.size() ,cols=matrix[0].size();
for(int i=0;i<rows;i++){
//checking if o is present in the 0th col or not
if(matrix[i][0]==0)col0=0;
for(int j=1;j<cols;j++){
if(matrix[i][j]=... | ALGO | 0.999034 | 6.455485 |
405ca864-e5da-43be-9250-ffd8ce8fc6d9 | DawiX123PL/PLCStarter | boost_1_79_0/libs/bimap/example/mi_to_b_path/mi_hashed_indices.cpp | /*****************************************************************************
Boost.MultiIndex
*****************************************************************************/
#include <boost/config.hpp>
//[ code_mi_to_b_path_mi_hashed_indices
#include <iostream>
#include <iomanip>
#include <boost/tokenizer.hpp>
#i... | ALGO | 0.888228 | 6.695371 |
e8e0f95c-c4dd-4963-8fd9-b460b00c5696 | Ayuphys789/competitive_programming | atcoder/typical90/029_01.cpp | /**
* Author: Ayuphys
* Problem Number: typical90-029
* Title: Long Bricks
* Link to the Problem: https://atcoder.jp/contests/typical90/tasks/typical90_ac
* Link to the Submission: https://atcoder.jp/contests/typical90/submissions/62737526
* Difficulty: 5
*/
#include "/home/ayuphys789/competitive_programming/te... | ALGO | 0.999981 | 4.458626 |
f4d2bc73-fa3c-420b-a403-90909bceb892 | ngthanhtrung23/CompetitiveProgramming | leetcode/livestream8/415_add_strings.cpp | class Solution {
public:
string addStrings(string num1, string num2) {
string res = "";
int rem = 0;
reverse(num1.begin(), num1.end());
reverse(num2.begin(), num2.end());
for (int i = 0; i < num1.size() || i < num2.size(); i++) {
int cur = rem;
... | ALGO | 0.999937 | 6.921908 |
0c0dab7d-75c6-4fab-be44-2a23a59ccb34 | YousufAzadSami/Codes-From-Bachelor | CodesC/UVA/10924 - Prime Words.cpp | #include<stdio.h>
#include<string.h>
int main()
{
char str[25];
int total,i;
while( (gets(str)) != NULL)
{
total =0;
for( i=0; str[i]!= '\0' ; i++)
{
if(str[i]<= 'z' && str[i]>= 'a')
total = total + ( str[i] - ('a' - 1) );
else
... | ALGO | 0.999863 | 3.904646 |
4ca03ae8-a0a6-4c1b-84ef-0b0f949bfac4 | saswatiray55/ProblemSolving | LeedCode/724FindPivotIndex/724FindPivotIndex.cpp | /*724. Find Pivot Index
Given an array of integers nums, calculate the pivot index of this array.
The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right.
If the index is on the left edge of the array, then th... | ALGO | 0.999983 | 6.347098 |
09d4d810-fdd9-481c-81b8-fba5a01f95b8 | hayashi-open/lib_cpp | dice.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define LIMIT 1000000007 //10^9+7
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()
namespace /* debug */{
#define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
... | ALGO | 0.999982 | 3.712178 |
a083eb2b-74d9-48a7-89ee-c508656b9535 | samuel-thesing/aoc2024 | src/14/part1.cpp | #include <utils.hpp>
int solve(const std::string &input, const int w, const int h, const int steps) {
std::regex pattern(R"(p=(\d+),(\d+) v=(-?\d+),(-?\d+))");
auto lines = split(input, "\n");
std::vector<Vec2i> robots{};
for (const auto& line : lines) {
const auto [px, py, vx, vy] = extract_data<int... | ALGO | 0.999338 | 5.496961 |
ac87115e-59e7-4022-9f57-25cff0eeb48e | kunal299/Data-Structures-and-Algorithms | Striver's DP Series/Part 6 - DP on Stocks/Best Time to Buy and Sell Stock IV/Approach - 2.cpp | /*
Time Complexity - O(N*2*K)
Space Complexity - O(N*2*K)
*/
class Solution {
public:
int maxProfit(int k, vector<int>& prices) {
int n = prices.size();
vector<vector<vector<int>>> dp(n+1, vector<vector<int>> (2, vector<int> (k+1, 0)));
for(int i=n-1; i>=0; i--) {
for(... | ALGO | 0.999637 | 5.79535 |
08c87617-173c-4495-ab1a-0146e7a38611 | wilhelm-school-projects/sorting-algorithms | selection/selection.cpp | #include <vector>
#include <string>
#include "../help_functions.h"
using namespace std;
void sort(vector<string> & words)
{
int smallest{};
for (int i{}; i < words.size(); ++i)
{
smallest = i;
for (int j{i}; j < words.size(); ++j)
{
if ( words.at(j).size() < words.a... | ALGO | 0.99725 | 5.680941 |
2a704dcc-b5a3-4b14-bcf9-a3b0bbd26f2d | Samarjiit/dsa_practice | 3179-maximum-points-after-collecting-coins-from-all-nodes/3179-maximum-points-after-collecting-coins-from-all-nodes.cpp | class Solution {
private:
int t[100001][14];
int dfs(int i, int parent, int k, int power, const vector<int> &coins, unordered_map<int, vector<int>>& adj) {
if (power >= 14)
return 0;
if(t[i][power] != -1) {
return t[i][power];
}
int case1 = (coins[i] >... | ALGO | 0.999744 | 5.50442 |
81bfe6a1-43ea-4d4e-9afb-b96e86f2995d | Selvarajan-M/GeeksForGeeks | Difficulty: Medium/Subarrays with K Distinct Integers/subarrays-with-k-distinct-integers.cpp | class Solution {
public:
int exactlyK(vector<int> &arr, int k) {
// code here
if (k <= 0) return 0;
return atmostK(arr, k) - atmostK(arr, k - 1);
}
int atmostK(vector<int> &arr, int k){
int l=0,r=0,cnt=0;
unordered_map<int,int>mpp;
while(r<arr.size()){
... | ALGO | 0.999946 | 5.659649 |
b0947ca4-3312-4b66-8a40-aa1b331a5e70 | shanfts/myFurnitureShoppingApp | my_furniture_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998597 | 6.785645 |
86a743ef-4987-46c5-ab0a-0ee0c52ec774 | arjunattam/LeetCode | Interleaving_String.cpp | class Solution {
public:
string s1, s2, s3;
vector<vector<int> > matrix;
bool isInterleave(string str1, string str2, string str3) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
s1 = str1;
s2 = str2;
s3 = str3;
if (s1.length... | ALGO | 0.999936 | 5.552732 |
e900b3a9-7f20-4cfc-bea0-3a7e9ca1532b | venniek/BOJ | boj/boj_silver/15652.cpp | #include <iostream>
using namespace std;
int n, m;
int done[9];
void find_nm(int cnt)
{
if (cnt == m)
{
for (int i = 0; i < m; i++)
cout << done[i] << " ";
cout << '\n';
return ;
}
for (int i = 1; i <= n; i++)
{
if (cnt != 0 && done[cnt - 1] > i)
continue;
done[cnt] = i;
find_nm(cnt + 1);
do... | ALGO | 0.999882 | 3.432453 |
a08cf908-19c1-4ffe-92f2-80a27f93c450 | LocalClustering/HeidelbergMotifClustering | LMCHGP/lib/partition/initial_partitioning/initial_refinement/initial_refinement.cpp | /******************************************************************************
* initial_refinement.cpp
* *
*
* XXX <<EMAIL>>
*****************************************************************************/
#include "initial_refinement.h"
#include "coarsening/coarsening.h"
#include "uncoarsening/uncoarsening.h"
... | ALGO | 0.999508 | 4.93346 |
67205f2c-5245-4f6d-8678-0db5c9d8b9c3 | shudhanshu435/LeetCode | 3455-minimum-length-of-string-after-operations/3455-minimum-length-of-string-after-operations.cpp | class Solution {
public:
int minimumLength(string s) {
int cnt=0;
vector<int>vec(26,0);
for(auto i:s){
vec[i-'a']++;
}
for(int i=0;i<26;i++){
if(vec[i]!=0){
if(vec[i]&1)cnt+=1;
else cnt+=2;
}
}
... | ALGO | 0.999919 | 5.590774 |
02512126-f2c3-4005-a8da-c90f3a804a4d | neel13062003/LeetCode | 2559-count-vowel-strings-in-ranges/2559-count-vowel-strings-in-ranges.cpp | class Solution {
public:
bool isvowel(char c){
string s="aeiou";
return s.find(c) != string::npos;
}
vector<int> vowelStrings(vector<string>& words, vector<vector<int>>& queries) {
int n=words.size();
vector<int> v(n,0);
for(int i=0;i<n;i++){
v[i]=(isvowel... | ALGO | 0.999907 | 6.287542 |
c1f3e46d-79f4-445a-ae75-b2e27919a7ba | ishandutta2007/codeforces | turmax/normal/1348/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
n--;
int curr=1;
vector <int> v;
while(true)
{
//cout<<n<<" "<<curr<<endl;
... | ALGO | 0.999941 | 3.998046 |
b4d20f19-eca0-4ea2-9bbc-48eb0f776ff0 | Mansoor-coding/patterns_practice.cpp | patterns/pattern_8.cpp | #include<iostream>
using namespace std;
int main(){
int n ;
cout<<"Enter a number\n";
cin>>n;
for(int j=1; j<=n ; j++ ){
for(int i =j; i<=j;i++ ){
for(int k =1;k<=i;k++){
cout<<i<<" ";
}
}
cout<<endl;
}
return 0;
}
| ALGO | 0.999947 | 3.522866 |
3d455435-fb8a-4785-8030-eacca1b12392 | GunioRobot/scribe-dependencies | boost_1_41_0/libs/graph/example/edge_connectivity.cpp | #include <boost/config.hpp>
#include <set>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/edge_connectivity.hpp>
using namespace boost;
int
main()
{
const int N = 8;
typedef adjacency_list<vecS, vecS, undirectedS> UndirectedGraph;
Und... | ALGO | 0.992432 | 6.430743 |
faa5c0ff-9956-4a05-b40c-974a62de7587 | satvik-tha-god/Algorithms | Leetcode/matrixBitMan/Set-2/Easy/bitDifference.cpp | Problem Link:https://practice.geeksforgeeks.org/problems/bit-difference-1587115620/1#
Solution:
class Solution{
public:
// Function to find number of bits needed to be flipped to convert A to B
int countBitsFlip(int a, int b){
int n=a^b;
unsigned int count = 0;
while (n) {
count... | ALGO | 0.999954 | 5.737963 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.