uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
93f48a63-c005-40b7-84e2-39f920da8659 | Kyan820815/leetcode | lc00xx/lc0066.cpp | //--- Q: 0066. Plus One
//--- last written: 2023/07/02
//--- method 1: linear operation, O(n)
class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
int i;
for (i = digits.size()-1; i >= 0; --i) {
if (digits[i] == 9) {
digits[i] = 0;
} else {
... | ALGO | 0.999806 | 7.130517 |
adc7cb30-064f-49f6-8cff-7d3acaedc573 | badalkumarray275/leetcode | 3sum/3sum.cpp | class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
int n = nums.size();
sort(nums.begin(),nums.end());
vector<vector<int>> res;
for(int i =0;i<n-2;i++)
{
int low= i+1,high = n-1;
while(low<high)
{
... | ALGO | 0.999964 | 5.873589 |
1fe856cf-0ee9-4fee-ac28-c0ee134116a6 | PrithwishJana/CoTran | CodeGen/data/transcoder_evaluation_gfg/cpp/FIND_REPEATING_ELEMENT_SORTED_ARRAY_SIZE_N.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( int arr [ ], int low, int high ) {
if ( low > high ) return - 1;
int mid = ( low + high ) / 2;
if ( arr [ mid ] != mid + 1 ) {
if ( mid > ... | TEST | 0.997718 | 5.424495 |
0aabb5f7-ffed-4322-9f3c-0bb50a1e736e | muskan278/Competitive-coding | string/longestRepeatingSubsequence.cpp | #include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int LongestRepeatingSubsequence(string s){
//BOTTOM UP SOLN
int l=s.length();
vector<vector<long long int>> dp(l+1,vector<long long int> (l+1,0));
for(int i=1;i<=... | ALGO | 0.999696 | 5.972921 |
21e8494a-8ed6-4682-ac66-e70b00340d29 | Go-Jaecheol/BOJ | BruteForce/[2231] 분해합/BOJ_2231(Recursion).cpp | #include <iostream>
#include <cmath>
using namespace std;
int n_Count(int n);
int Decomposition(int n, int temp); // Recursion
int main(void)
{
int n, answer, count;
cin >> n;
count = n_Count(n);
answer = Decomposition(n, 1 * pow(10, count - 2));
cout << answer << endl;
return 0;
}
int n_Count(int n)
{
int... | ALGO | 0.999578 | 4.188718 |
4de88683-8b5c-400c-8df0-30c5e19913fb | EndianKnight/multi-threading-problems | Q2/queue-booth-problem.cpp | /**
* @file queue-booth-problem.cpp
* @author Soumodipta Bose
* @brief Multi Threading problem solving for the EVM problem
* @version 1.0
* @date 2021-11-25
*
* @copyright Copyright (c) 2021
*
*/
#include <bits/stdc++.h>
#include <pthread.h>
using namespace std;
pthread_mutex_t print_mutex;
typedef struct Bo... | ALGO | 0.997329 | 4.959364 |
e3536fe1-c034-4527-8779-72bdc6a86209 | sicilydefense/openvino | src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp | #include "multiclass_nms.hpp"
#include "ov_ops/multiclass_nms_ie_internal.hpp"
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <queue>
#include <string>
#include <utility>
#include <vector>
#include "openvino/core/parallel.hpp"
#include "utils/general_utils.h"
#include "shape_infer... | ALGO | 0.96394 | 7.396619 |
d72ebc8b-9f40-47f4-a6f5-16c12205abe2 | alexandraback/datacollection | solutions_5670465267826688_1/C++/gxnncrx/1234.cpp | #pragma comment(linker,"/STACK:102400000,102400000")
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <algorithm>
#include <bitset>
#include <functional>
#include <numeric>
#in... | ALGO | 0.99995 | 3.648009 |
f5cb0b7d-0085-455a-bc0f-61e074ead2a1 | shivanshagarwalup/World-of-DSA | Selection_sort.cpp | #include<bits/stdc++.h>
using namespace std;
void selection_sort(int arr[], int n) {
for (int i = 0; i < n - 1; i++) {
int mini = i;
for (int j = i + 1; j < n; j++) {
if (arr[j] < arr[mini]) {
mini = j;
}
}
int temp = arr[mini];
arr[mini] = arr[i];
arr[i] = temp;
}
co... | ALGO | 0.999908 | 5.250172 |
262a568e-9584-41e3-a845-500e3d70d2ec | rashshafee29/UVA-online-judge-solves | 821_NETTT.cpp | /*
* Sai Cheemalapati
* UVA 821: Page hopping
*
*/
#include<algorithm>
#include<cstdio>
using namespace std;
int graph[110][110];
int T, N, a, b;
int main() {
while(scanf("%d %d", &a, &b) == 2) {
if(a == 0 && b == 0) break;
T++;
for(int i = 0; i < 100; i++)
for(int j = 0;... | ALGO | 0.998406 | 3.650156 |
d2aec161-bea9-4b4f-9596-4a94c06f6b13 | crazyquark/tortoise-svn-1.8.10 | src/TortoiseProc/RevisionGraph/ModificationOptions.cpp | // TortoiseSVN - a Windows shell extension for easy version control
#include "stdafx.h"
#include "ModificationOptions.h"
#include "VisibleGraph.h"
#include "VisibleGraphNode.h"
// apply a filter using differnt traversal orders
void CModificationOptions::TraverseFromRootCopiesFirst
( IModificationOption* option
... | ALGO | 0.969666 | 5.828154 |
fcf7baa5-2593-4d15-a767-83c6ac4f4a39 | sharmaishan2511/DSA-in-cpp | binary tree/binary_tree_inserion.cpp | #include <bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node *left;
Node *right;
Node(int d){
data=d;
this->left = NULL;
this->right = NULL;
}
};
void insertion(Node *root,int d){
Node *temp;
Node *newnode = new Node(d);
queue<Node*> q;
... | ALGO | 0.999985 | 4.528316 |
ce271e7b-55d2-48ea-8d01-234452ffe4a1 | lostinet/Model_Predictive_Control | src/Eigen-3.3/bench/sparse_dense_product.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.99348 | 4.386344 |
546ed516-c1aa-4ebc-a01a-32148468d88b | readable-ko/ProblemSolving | 11051.cpp | //https://st-lab.tistory.com/162 페르마의 소 정리!
//https://velog.io/@gidskql6671/%EC%9D%B4%ED%95%AD-%EA%B3%84%EC%88%98-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98
#include <iostream>
#define MOD 10007
using namespace std ;
int dp[2][1001] ;
int combination(int N)
{
int i = 1 ;
for(int front = 1 ; front <= N ; front++)
... | ALGO | 0.999969 | 4.911716 |
883e8ab2-e2c5-42c8-a559-8c85b9b9c329 | Saurabhn16/CP-dsa | algo/sort/sort-count.cpp | #include <iostream>
using namespace std;
void countSort(int arr[], int n)
{
int k = arr[0];
for (int i = 0; i < n; i++)
{
k = max(k, arr[i]);
}
int count[10] = {0};
for (int i = 0; i < n; i++)
{
count[arr[i]]++;
}
for (int i = 1; i <= k; i++)
{
count[i] ... | ALGO | 0.999848 | 4.797248 |
77c8ce86-b249-4f8b-861c-88079f353cc2 | raghavchadha23/Leetcode | 1552. Magnetic Force Between Two Balls.cpp | class Solution {
public:
int tries = 0;
bool checkIfCanPlaced(vector<int>& position, int numBalls, int distance) {
tries++;
int counter = 1;
int flag = 0;
int storeValueofi = 0;
for(int i = 1; i < position.size(); ++i) {
if(abs(position[i] - position[storeValu... | ALGO | 0.999995 | 5.658025 |
78514f17-c2f5-4c0a-ad78-14a8ae003b7b | bishalprasad321/DSA-Code | Sorting/02_insertion_sort.cpp | #include<bits/stdc++.h>
using namespace std;
// printArray function to print the elements of the array
void printArray(int array[], int length)
{
for (int i = 0; i < length; i++)
{
cout<<array[i]<<" ";
}
}
// insertionSort function
void insertionSort(int array[], int length)
{
for (int i = 1; ... | ALGO | 0.99998 | 4.966535 |
b9858445-1f19-43cc-bdc2-6343f30fcbf7 | rutuja-patil923/Data-Structures-and-Algorithms | Tree/checkIfGraphIsTree.cpp | #include<bits/stdc++.h>
using namespace std;
int vis[1000];
vector<int> adj[1000];
int parent[1000];
bool dfs(int node)
{
vis[node]=1;
for(auto child:adj[node])
{
if(!vis[child])
dfs(child);
else if(child!=parent[node])
return false;
}
return true;
}
int main()
{
int edges;cin>>edges;
while(edges-... | ALGO | 0.999853 | 4.992133 |
bca5b004-569f-4d9c-b3b7-0e3371b5094b | codetalker7/cp-res | Codeforces/CF1525B.cpp |
/*
template by: codetalker7
editor: sublime text 3
file name: CF1525B
date created: 2021-05-16 13:48:23
problem link: https://codeforces.com/contest/1525/problem/B
*/
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<unordered_set>
#include<cmath>
#include<nume... | ALGO | 0.999794 | 4.254021 |
eb84bbc3-78a0-4e07-b270-28096944f584 | yu-lab-vt/muSSP | SSP/Sink.cpp | #include "Sink.h"
Sink::Sink(int n, double sink_cost){
sink_cost_ = sink_cost;
sink_precursor_weights.assign(n, FINF);
//sink_precursor_weights[0] = FINF; // src has 0 weights
// used_sink_precursor.assign(n, false);
}
/**0 is src and n is sink, 1,3,5... is former node, 2,4,6...is latter node**/
//we u... | ALGO | 0.992285 | 3.363193 |
507c22e4-2e62-479a-a1c3-2776ca6326a6 | javed2214/Binary-Tree | Cousin-Nodes.cpp | // Two nodes of a binary tree are cousins if they have the same depth, but have different parents.
// Program to Find If the Two Nodes are Cousins or Not
// https://leetcode.com/problems/cousins-in-binary-tree/
class Solution {
public:
int parent[100001];
int level[100001];
void bfs(TreeNode *roo... | ALGO | 0.999968 | 5.787708 |
7fa5d3ba-fd3d-4133-a7ae-6500ce1119bd | nguyenquyen1910/CPlusPlusPTIT | Thuc Hanh 3/tongtrongkhoang.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
int n,q;cin>>n>>q;
int a[n],P[n+1];
for(int i=1;i<=n;i++){
cin>>a[i];
P[i]=P[i-1]+a[i];
}
while(q--){
int l,r;cin>>l>>r;
cout << P[r]-P[l-1] ... | ALGO | 0.999823 | 4.217486 |
95bbdade-0971-4dff-8e4d-46783f75dd99 | asamieh/Algorithms | priority_queue.cpp | #include <iostream>
#include <set>
using namespace std;
template <class Type>
class custom_compare
{
public:
bool operator()(const Type &lhs, const Type &rhs)
{
return lhs.first > rhs.first;
}
};
template <class Type>
class priority_queue
{
private:
multiset<Type, custom_compare<Type> > ms;
pu... | ALGO | 0.999801 | 4.231398 |
5e50f2ce-e52f-4cd4-a92e-2b298d8fa8e2 | arm/arm-toolchain | libc/src/math/generic/nearbyintf128.cpp | #include "src/math/nearbyintf128.h"
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float128, nearbyintf128, (float128 x)) {
return fputil::round_using_current_rounding_mode(x);
}... | ALGO | 0.955923 | 6.359721 |
f42d0cab-66ca-42f9-874c-e5f7b0fc4cd4 | Victor-droid165/URI | Problema_1047.cpp | /*
@autor: Victor E. B. Rodrigues;
@data: 23/06/2021;
@nome: Tempo de Jogo com Minutos;
*/
#include <bits/stdc++.h>
using namespace std;
bool acabouMesmoDia(int& horaInicial, int& horaFinal, int& minutoInicial, int& minutoFinal){
if(horaFinal <= horaInicial){
if(minutoFinal <= minutoInicial)
return false... | ALGO | 0.999775 | 4.536219 |
d9d5cb37-66bb-43bd-9be0-02bc453b6348 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_8483_57.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, e;
double d;
cin >> a >> b;
d = (a + b) / 2.0;
e = d;
if (a > b) {
cout << b << " " << e - b << endl;
} else {
cout << a << " " << e - a << endl;
}
return 0;
}
| ALGO | 0.999941 | 4.191105 |
9806b28c-5319-4334-96ea-f43df0b53981 | nahiyan/cadical-sha256 | src/mobical.cpp | /*------------------------------------------------------------------------*/
/*------------------------------------------------------------------------*/
// Model Based Tester for the CaDiCaL SAT Solver Library.
namespace CaDiCaL {
static const char *USAGE =
"usage: mobical [ <option> ... ] [ <mode> ]\n"
"\... | TEST | 0.985493 | 7.330536 |
6ee1ab6c-ed06-488f-b7bb-04bfcedc1387 | PULKlT/Leetcode | 0409-longest-palindrome/0409-longest-palindrome.cpp | class Solution {
public:
int longestPalindrome(string s) {
map <char,int> mp;
int count=0,odd=0;
for(char i : s){
mp[i]++;
}
for(auto it : mp){
if(it.second%2==0)
count+=it.second;
else{
count+=(it.second... | ALGO | 0.999949 | 5.85191 |
cc64c68e-1d0d-4cda-bdaf-02a43d562a7a | DonghoOh-pipity03/Coding-Test | week3 - 완전탐색과 백트래킹/H13913.cpp | // 13913 - 1회차 이론 성공 (자료구조 일부실패)
#include<bits/stdc++.h>
using namespace std;
const int MAX = 200000;
int n, k, visited[MAX+4], prevVisited[MAX+4];
vector<int> v;
queue<int> q;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> n >> k;
if (n == k) {
cout << "0\n" << n;
retu... | ALGO | 0.999996 | 4.227873 |
68c0a5bf-b9eb-4470-a207-ef83058cf9a4 | SonuRajput1010/DSA_GFG | Medium/Kth smallest element/kth-smallest-element.cpp | //{ Driver Code Starts
//Initial function template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
// arr : given array
// l : starting index of the array i.e 0
// r : ending index of the array i.e size-1
// k : f... | ALGO | 0.999837 | 5.467686 |
63f3c9e2-304c-4ff3-a078-f8ed341eb5bb | actium/codeforces | 1900/80/1980c.cpp | #include <iostream>
#include <set>
#include <vector>
template <typename T>
std::istream& operator >>(std::istream& input, std::vector<T>& v)
{
for (T& a : v)
input >> a;
return input;
}
void answer(bool v)
{
constexpr const char* s[2] = { "NO", "YES" };
std::cout << s[v] << '\n';
}
void solv... | ALGO | 0.999649 | 5.250053 |
aa57582e-1d0b-4db4-8cb0-28d5cabe922b | mufiye/PAT-Practice | Advanced Level/2021-autumn/3.cpp | //if there are two solutions, output the starting postion with the smallest index
//using the dfs
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
//const int INF = 999999999;
int N,M;
int maxStart = -1, maxSite = -1, currentStart, tempCnt = 0;
vector<int> graph[110]; //1~N
bool vis[110];
... | ALGO | 0.999894 | 4.206126 |
0091a61c-5fa3-4afd-a26b-3d5dad70494c | JiamingZeng/dswp-change | buildPDG.cpp | //1st step: create dependence graph
#include "DSWP.h"
#include "llvm/Support/raw_os_ostream.h"
using namespace llvm;
using namespace std;
void DSWP::dfsVisit(BasicBlock *BB, std::set<BasicBlock *> &vis,
std::vector<BasicBlock *> &ord, Loop *L) {
vis.insert(BB);
for (succ_iterator SI = succ_begin(BB), E = suc... | ALGO | 0.999716 | 3.034007 |
8d1a6257-254c-4392-85f8-9954806798c5 | naoto0804/atcoder_practice | contests/abc/12/129/d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = ... | ALGO | 0.999983 | 4.879752 |
6eff8002-d9b0-4a0b-81e5-7a128a96cfc1 | herbps10/rlme | src/remove_k_smallest.cpp | #include "Rcpp.h"
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector remove_k_smallest(NumericVector v, int k) {
int *indices =(int *) malloc(sizeof(int) * k);
for(int i = 0; i < k; i++) {
double smallest = 0;
int smallest_index = 0;
bool first = true;
for(int j = 0; j < v.size();... | ALGO | 0.999026 | 5.18361 |
c58ed3f2-f3aa-4349-843d-706c003cc120 | Arshelle9912/Competitive-Programming | Greedy/CSES_Stick_Lengths.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
long long sum1 = 0;
long long sum2 = 0;
for (int i = 0; i<n; i++) {
cin >> arr[i];
}
sort(arr.begin(), arr.end());
if (n%2==0) {
int median1 = arr[n/2-1];
int medi... | ALGO | 0.99997 | 4.982333 |
be5e0ee9-e849-4e69-bb0e-bea373a92064 | isage/vita-boost | libs/sort/example/binaryalrbreaker.cpp | // See http://www.boost.org/libs/sort for library home page.
#include <boost/sort/spreadsort/spreadsort.hpp>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
using namespace boost::sort::spreadso... | ALGO | 0.998071 | 5.440438 |
9e3597f9-0caa-4bdd-b628-8b13f0864e7b | TheMecz/ATS_programming | 11_Funciones_en_C++/Ejercicio_17.cpp | /*Ejercicio 17: Suma de números complejos
z1 = 5-3i , z2 = -4+2i
z1 + z2 = (5 - 3i) + (-4 + 2i).
= 5 - 3i -4 +2i
= 1 - i
*/
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
using namespace std;
typedef int type_entero;
typedef f... | ALGO | 0.991454 | 4.918339 |
a338fd4d-edf3-43b7-ba14-3f132ab9e1d8 | ishandutta2007/codeforces | saba2000/normal/1342/B.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
main(){
int t;
cin >>t ;
while(t--){
string s;
cin >> s;
int ok = 1;
for(int i = 0; i < (int)s.size() - 1; i++)
if(s[i] != s[i+1]) ok = 0;
if(ok){
cout<<s<<endl;
}
... | ALGO | 0.99997 | 3.398281 |
23785b09-009c-4e5c-bdf1-eee8483042c5 | farzamdorostkar/amon | llvm-project-17.0.6.src/mlir/lib/Tools/lsp-server-support/SourceMgrUtils.cpp | #include "mlir/Tools/lsp-server-support/SourceMgrUtils.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Path.h"
#include <optional>
using namespace mlir;
using namespace mlir::lsp;
//===----------------------------------------------------------------------===//
// Utils
//===------------------------------... | TOOL | 0.900634 | 6.825454 |
857e30a6-ccb6-490e-af61-57731be3c13c | aboeuf/AdventOfCode | 2024/puzzle_2024_22.cpp | #include <2024/puzzle_2024_22.h>
#include <common.h>
#include <deque>
namespace puzzle_2024_22 {
using Int = unsigned long long;
constexpr auto sequence_size = std::size_t{4u};
constexpr auto nb_secret_numbers = 2000u;
inline Int multiply(const Int secret_number, Int operand) {
return ((secret_number * operand) ^... | ALGO | 0.994064 | 5.890886 |
8cfff2f3-60bc-422d-86a6-1a19daa2fcb4 | Priybhanu99/My-Codes | rotation making.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int t,n;
//cin>>t; while(t--){
cin>>n;
map<int,int> a,b;
... | ALGO | 0.999717 | 3.799197 |
5abedc21-baba-407f-a060-9dc178297a6d | Revyiii/Programowanie_zadania | Zadania/programowanie/6/4D_27_Łazowy_Tymon/6.3/6.3.cpp | #include <iostream>
#include <windows.h>
#include <fstream>
#include <functional>
using namespace std;
int main()
{
cout<<endl<<"Witam w zadaniu 6.3"<<endl;
string key = "";
int i;
int ii;
char d;
size_t hash_value;
bool palindrome;
while(true){
key.erase();
//cout<<"po... | ALGO | 0.983852 | 3.594454 |
6c4da1d3-5495-4e25-9f7c-ebef80a16a5e | anshjaiswal11/C-PLUS-PLUS | Pattern Printing/Pattern3.cpp | // solid square
// 4 input
// * * * *
// * * * *
// * * * *
// * * * *
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=0; i<n; i++){
for(int j=0; j<n;j++){
cout<<" "<<"*";
}
cout<<endl;
}
}
// pattern
// 1111
// 2222
// 3333
// 4444
// if... | ALGO | 0.999909 | 3.968695 |
2beacb0f-8388-4339-bf81-0aad4419b37b | mahendra18github/Basic-Programming-Codes | array_sumandproduct.cpp | #include<iostream>
using namespace std;
int main(){
int n,arr[10],i,sum=0,product=1;
cout<<"Enter size of an array: "<<endl;
cin>>n;
cout<<"Enter elements of an array: "<<endl;
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
for(int i=0;i<n;i++){
sum=sum+arr[i];
product=pro... | ALGO | 0.995148 | 3.691303 |
8c0043ed-cb21-44b9-8fee-261dfddc64c5 | zeeldadhaniya1895/programming | c++ programming/APNC+CWH/array/subarray_vs_subsequences/subarrayofgivensum.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int key;
cin>>key;
for(int i=0;i<n;i++)
{ int sum=0;
for(int j=i;j<n;j++)
{
sum+=a[j];
if(sum==key)
{
cout<<i+1<<... | ALGO | 0.999961 | 4.060713 |
7b295b99-e428-41aa-b934-7519eab0ae16 | checksummaster/depthmovie | opencv/src/opencv/modules/ml/src/inner_functions.cpp | #include "precomp.hpp"
namespace cv { namespace ml {
ParamGrid::ParamGrid() { minVal = maxVal = 0.; logStep = 1; }
ParamGrid::ParamGrid(double _minVal, double _maxVal, double _logStep)
{
CV_TRACE_FUNCTION();
minVal = std::min(_minVal, _maxVal);
maxVal = std::max(_minVal, _maxVal);
logStep = std::max(_... | ALGO | 0.995622 | 6.905294 |
99715b81-b277-47e5-8a6c-b6e7a6c4e6dd | calgagi/leetcode | 0477/brute_force.cpp | class Solution {
public:
int totalHammingDistance(vector<int>& nums) {
int x = 0;
for (int i = 0; i < nums.size(); i++) {
for (int j = i+1; j < nums.size(); j++) {
x += __builtin_popcount(nums[i] ^ nums[j]);
}
}
return x;
}
};
| ALGO | 0.999997 | 6.093411 |
09707541-8aeb-41e3-a676-d9495bc2f8e9 | suditisarkar/LeetCode | 0020-valid-parentheses/0020-valid-parentheses.cpp | #include <stack>
#include <string>
class Solution {
public:
bool isValid(std::string s) {
std::stack<char> stack;
for (const char c : s)
if (c == '(')
stack.push(')');
else if (c == '{')
stack.push('}');
else if (c == '[')
stack.push(']');
else if (stack.empt... | ALGO | 0.994815 | 7.101375 |
4c594b35-404a-4441-b6d1-8f336944d9f9 | Inuyashaaaaa/IntroductionToAlgorithmicContests | codeforce/ed Round 83/B.cpp | #include<bits/stdc++.h>
#define LL long long
#define ms(s) memset(s, 0, sizeof(s))
using namespace std;
const int maxn = 1e2 + 10;
int cnt[maxn];
int main() {
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
whil... | ALGO | 0.99978 | 4.551405 |
177b7a43-afb8-495b-a91c-e3b59071f6ae | Rentsendondog/Prorammchlaliin-bodloguud | SPOJ/52. Orts, davhar, haalga.cpp | #include <iostream>
using namespace std;
main() {
int d, o, t, k, n, m, a;
cin >> d >> o >> t;
cin >> a;
int r = a % (d * t);
k = a / (d * t) + (r > 0);
n = r / t + (r % t > 0);
m = r % t;
if(n == 0)
n = d;
if(m == 0)
m = t;
cout << k << " " << n << " " << m << end... | ALGO | 0.999099 | 3.243196 |
7705acda-051c-49f5-b936-db083126cc13 | naveen-dwivedi-7/Problems-on-Greedy- | Min_Cost_Path_Brute_Force.cpp | #include<bits/stdc++.h>
using namespace std;
int Min_Cost_Path_brute(int **input, int m, int n , int i , int j){
// base case
if(i==m-1 && j==n-1){
return input[i][j];
}
// moves Right , Down and diagonal are allowed
// check on boundary
if( i>=m || j>=n){
return INT_MAX;
}
// recursi... | ALGO | 0.999918 | 4.174635 |
fe20e0fd-f219-4115-b906-d31ebe54f27c | honeyvikash/Leetcode_Solved_Problems | 3031-minimum-time-to-revert-word-to-initial-state-ii/3031-minimum-time-to-revert-word-to-initial-state-ii.cpp | vector<int> z_function(string s)
{
int n = (int)s.length();
vector<int> z(n);
// consider a window [l,r]
// which matches with prefix of s
int l = 0, r = 0;
z[0] = n;
for (int i = 1; i < n; ++i)
{
// when i<=r, we make use of already computed z
// value for some smaller i... | ALGO | 0.999992 | 5.462875 |
fea04b4a-3918-4339-a3de-a39d00c01d66 | Dharanesh-BM/Leet-Code | 11-container-with-most-water/container-with-most-water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int start = 0;
int end = height.size()-1;
int maxArea = min(height[start],height[end])*abs(start-end); // calculating the area in first to last wall
while(start < end){
if(height[end] > height[start]){
... | ALGO | 0.999969 | 6.550005 |
6ff776dc-57dc-432f-88d7-1449433a12b0 | hlmichellemasters/flutter_fasting | 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 |
56e18ed8-549b-4f6d-a033-9d008165be75 | blayush/Cpp-Programming-and-OOPS | 06. Pointers/02. pointer_sample.cpp | /*
author : Anmol Tomer
email : <EMAIL>
*/
#include <iostream>
using namespace std;
int main()
{
int a = 10; // A data variable
int *ptr = &a; // Address variable declared with * and initialized with address of a.
cout << "Printing a gives : " << a << endl;
cout << "Printing Address of a using &a g... | ALGO | 0.96054 | 3.777051 |
1078ac7f-7dce-4639-8992-440a9ff8f87d | Shailesh93602/LeetCode | 237-delete-node-in-a-linked-list/delete-node-in-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void deleteNode(ListNode* node) {
node->val = node->next->val;
node->next = node->next->next;
}
}; | ALGO | 0.999711 | 5.612188 |
ca3df0d6-208a-4591-b842-60666a03fb8c | omerhorev/cryptopals | src/breaks/byte-at-a-time-ecb-decryption.cpp | //
// Created by omerh on 06/09/2019.
//
#include <cstddef>
#include <breaks/byte-at-a-time-ecb-decryption.h>
#include <breaks/internal/ecb-block-parser.h>
#include <utils/general.h>
#include <utils/debug.h>
using namespace breaks;
using namespace breaks::internal;
size_t byte_in_a_time_ecb_decryption::run(unsigned ... | ALGO | 0.977633 | 6.344883 |
bf542c5a-f95d-41fd-acb2-8c58d7d8cde4 | Seann0425/LeetCode | finished/16. 3Sum Closest.cpp | #include <bits/stdc++.h>
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) : val(x), next(next) {}
};
struct TreeNode {
int val;
TreeNode *left;
TreeNode *righ... | ALGO | 0.999996 | 5.951018 |
575de519-ca2a-4449-8d46-7924ee28b852 | MarynaTsr/laba7.1 | laba7.cpp | #include <iostream>
#include <fstream>
#include <windows.h> //
using namespace std;
int main() {
SetConsoleCP(1251); //
SetConsoleOutputCP(1251); //
ifstream fin("C:\\Users\\user\\Documents\\studing\\inf\\numbers.txt");
// !!! \ '
if (!fin) {
cout << " !" << endl;
... | ALGO | 0.98841 | 3.298316 |
aba876aa-f03e-4926-ad58-4d07cd0b5dc4 | thomasduffy328/codility | nesting.cpp | #include <string>
#include <stack>
int solution(string &S) {
// empty string check
if( S.empty() )
return 1;
// check for matches using a stack
std::stack<char> stack;
for( std::string::iterator it = S.begin(); it != S.end(); ++it ) {
if( *it == '(' )
stack.push( *it );... | ALGO | 0.99615 | 5.401649 |
5e30badd-c467-4dac-9cf2-659bb955d6ae | abdelqayyim/C-Tic-Tac-Toe | build-mac/Boost/libs/mpi/example/generate_collect_optional.cpp | // An example using Boost.MPI's split() operation on communicators to
// create separate data-generating processes and data-collecting
// processes using boost::optional for broadcasting.
#include <boost/mpi.hpp>
#include <iostream>
#include <cstdlib>
#include <boost/serialization/vector.hpp>
#include <boost/serializat... | TOOL | 0.990803 | 6.554121 |
f62f07e6-4503-45f5-8974-c9fa421d62ed | wangkai5616/leetcode | 57_插入区间/57_Insert Interval/Insert Interval.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
/*
һص ʼ˵б
бвһµ䣬ҪȷбеȻҲصбҪĻԺϲ䣩
ʾ 1:
: intervals = [[1,3],[6,9]], newInterval = [2,5]
: [[1,5],[6,9]]
*/
struct Interval {
int start;
int end;
Interval() : start(0), end(0) {}
Interval(int s, int e) : start(s), end(e) {}
};
//newIntervalint... | ALGO | 0.999853 | 5.42802 |
d060bddc-a0b0-4074-b43d-286302f8ad55 | ffshreyansh/LeetCode-Problems | 0876-middle-of-the-linked-list/0876-middle-of-the-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* middleNode(... | ALGO | 0.999926 | 6.028365 |
0d084c7f-0e6a-4fbf-b012-1e6d21d4de34 | kdg5424/nextfoam-cfd | ThirdParty-2404/sources/boost/boost_1_74_0/libs/sort/benchmark/parallel/benchmark_objects.cpp | //----------------------------------------------------------------------------
/// @file benchmark_objects.cpp
/// @brief Benchmark of several sort methods with different objects
///
/// @author Copyright (c) 2016 Francisco José Tapia (<EMAIL> )\n
/// Distributed under the Boost Software License, Version 1.0.\n... | TEST | 0.958034 | 6.158231 |
1d330190-4b71-4a51-a0fe-909a215f2172 | ayushag1505/CodeForces_solution | CodeForces/CodeForces_800/231A_Team.cpp | #include<bits/stdc++.h>
using namespace std ;
int main(){
int t ;
cin>>t ;
int counter=0 ;
while(t--){
int a[3] ;
int temp=0 ;
for(int i=0; i<3; i++){
cin>>a[i] ;
if(a[i]==1) temp++ ;
}
if(temp>=2) counter++ ;
}
cout<<counter <<"\n... | ALGO | 0.999364 | 3.841347 |
88082ca0-d658-43f9-9d8e-245cfc60f3db | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5978_12.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 300100;
int n, q;
struct point {
int x, idx;
point(int _x = 0, int _idx = 0) {
x = _x;
idx = _idx;
}
} M[N * 5];
int global;
struct interval {
int a, b, idx;
interval(int _a = 0, int _b = 0, int _idx = 0) {
a = _a;
b = _b;
idx = _... | ALGO | 0.999827 | 3.797414 |
50a93078-da97-4438-82b7-21a62ed31ae0 | imnotwannafire/Data-Structure-and-Algorithm | thuat_toan_sinh/sinh_xau_nhi_phan/sinh_xau_nhi_phan.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int n, a[100];
int final = 0; //check gia tri cuoi cung
void khoi_tao(){// khoi tao cau hinh dau tien 00000000...
for(int i = 1; i<=n; i++)
{
a[i] = 0;
}
}
void sinh()
{
int i = n; // bat dau tu bit cuoi cung
while (i>=1 &&... | ALGO | 0.999808 | 3.743357 |
bb1fa271-5643-41e3-b8ac-9582c4bb1930 | siddharth691/GeorgiaTech-Logo-Projection | eigen-eigen-323c052e1731/doc/examples/DenseBase_template_int_middleRows.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(1..3,:) =\n" << A.middleRows<3>(1) << endl;
return 0;
}
| ALGO | 0.966725 | 3.245548 |
ad731e5f-a871-4233-8a89-b7596bb2bc3b | cfreeze111/ncnn_face_rec | source/lite/mnn/cv/mnn_glint_arcface.cpp | //
// Created by DefTruth on 2021/11/13.
//
#include "mnn_glint_arcface.h"
using mnncv::MNNGlintArcFace;
MNNGlintArcFace::MNNGlintArcFace(const std::string &_mnn_path, unsigned int _num_threads) :
BasicMNNHandler(_mnn_path, _num_threads)
{
initialize_pretreat();
}
inline void MNNGlintArcFace::initialize_pretr... | TOOL | 0.904864 | 5.312476 |
ddd2bab5-c61a-4ba1-be04-c59b49f3dc00 | chang-ha/CodeTest | CodeTest/FraudulentActivityNotifications/FraudulentActivityNotifications.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string&);
string rtrim(const string&);
vector<string> split(const string&);
/*
* Complete the 'activityNotifications' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER_ARR... | ALGO | 0.999592 | 5.183351 |
90585af3-3365-4e27-9e67-3d7f28c12701 | filiperecharte/FEUP-CAL | cal_fp03_CLion/Tests/NearestPoints.cpp | /*
* NearestPoints.cpp
*/
#include <limits>
#include <thread>
#include <algorithm>
#include <cmath>
#include "NearestPoints.h"
#include "Point.h"
#include <unistd.h>
const double MAX_DOUBLE = std::numeric_limits<double>::max();
Result::Result(double dmin, Point p1, Point p2) {
this->dmin = dmin;
this->p1 = p1;
... | ALGO | 0.999965 | 5.250071 |
c2a524da-9203-45ff-b97d-47004b09209d | cocaine/cocaine-plugins | ipvs/gateway.cpp | #include "gateway.hpp"
#include <cocaine/context.hpp>
#include <cocaine/context/config.hpp>
#include <cocaine/context/mapper.hpp>
#include <cocaine/dynamic.hpp>
#include <cocaine/errors.hpp>
#include <cocaine/format.hpp>
#include <cocaine/logging.hpp>
#include <cocaine/memory.hpp>
#include <cstring>
#include <blackh... | WEB | 0.887881 | 7.403337 |
3d3a6147-c72f-444c-8241-28e3f4e9dbf0 | pyc5714/LiDARTag_docker | src/LiDARTag/internal_eigen3/eigen/doc/examples/TutorialLinAlgComputeTwice.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A, b;
LLT<Matrix2f> llt;
A << 2, -1, -1, 3;
b << 1, 2, 3, 1;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the right hand side b:\n" << b << endl;
cout << "Computing LLT... | ALGO | 0.999893 | 3.145425 |
b85c2565-2b58-4613-a564-4d41072d1209 | PlumCastle/yuzu-nightshade | src/shader_recompiler/frontend/ir/post_order.cpp | #include <algorithm>
#include <boost/container/flat_set.hpp>
#include <boost/container/small_vector.hpp>
#include "shader_recompiler/frontend/ir/basic_block.h"
#include "shader_recompiler/frontend/ir/post_order.h"
namespace Shader::IR {
BlockList PostOrder(const AbstractSyntaxNode& root) {
boost::container::sma... | ALGO | 0.862411 | 6.658561 |
05c6db1b-09a2-4fdd-a3b6-647aed53a53c | vbonnici/grafe-sim | analysis/data/p02262/s904379672.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdio>
using namespace std;
long long cnt;
vector<int> G;
int n;
int a[1000000];
/*void algorithm3_6(vector<int> G, int A[], int N) {
for (int i = G.size() - 1; i >= 0; i--) {
for (int k = 0; k < N - G[i]; k++) {//对应每个i,... | ALGO | 0.999973 | 3.212205 |
bfff59a0-99f3-47e1-8d55-f16120c683c4 | prriyanayak/GFG_Solved | medium/CheckIfSubTree.cpp | bool areIdentical(Node* root1, Node* root2)
{
if (root1 == NULL && root2 == NULL)
return true;
if (root1 == NULL || root2 == NULL)
return false;
return (root1->data == root2->data
&& areIdentical(root1->left, root2->left)
&& areIdentical(root1->right, root2->right));
}
bool isSubtr... | ALGO | 0.999835 | 5.470706 |
22eae727-3c37-4935-8cf8-d0899570bed8 | harrySentinel/DSA | basics/NumberTriangle.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter the number of rows: ";
cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++) {
cout << j;
}
cout << endl;
}
return 0;
}
| ALGO | 0.994569 | 4.623829 |
b3964998-1fd4-45bf-8ddc-784536ce99c0 | afsanamim04/Codeforces_Solution | Rank List.cpp | #include<bits/stdc++.h>
#define PI acos(-1.0)
#define all(x) x.begin(),x.end()
#define nl '\n'
#define pb push_back
typedef long long int ll;
typedef unsigned long long int llu;
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
map <... | ALGO | 0.999941 | 3.474477 |
dff3c349-872b-4db2-aa26-473250ae0cbe | sat-yad/codeforcesSolutions | codeforcesladder/1792_A.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fl(w,x) for(ll i=w;i<x;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cin.tie(nullptr); cout.tie(nullptr);
#define nl cout<<"\n";
#define onjudge #ifndef ONLINE_JUDGE freopen("./input.txt", "r", stdin); freopen("./output.txt", "w",... | ALGO | 0.999681 | 4.522857 |
b5d7f0fb-1998-4da9-ba7c-5f3826a83c43 | GyuJeGal/Algorithm-Study | Assignment/W9_B.cpp | #include <iostream>
#include <vector>
using namespace std;
int grid[22][22]; // (-1: , 0: , 1:, 2:)
struct point_info
{
int x;
int y;
};
vector<point_info> candidate;
vector<int> check[21][21][3];
//check[x][y][1]:(x, y)ǥ 浹 鵹
//check[x][y][2]:(x, y)ǥ 鵹 浹
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8... | ALGO | 0.997174 | 3.138855 |
3b82b30c-edd8-4d71-8e2a-2062717f7b55 | codulluiandrei/pbinfo | pbinfo-1366/main.cpp | #include <iostream>
using namespace std;
int main() {
int n, i, v[3000], j;
bool adv;
cin >> n;
for (i = 1; i <= n; i++)
cin >> v[i];
do { for (i = 1; i <= n; i++)
cout << v[i] << " ";
cout << endl;
adv = false; i = 2;
while (i <= n)
if ((v[i -... | ALGO | 0.999987 | 3.152303 |
d8cf431c-a0e2-489a-b0b0-7ce121df8c6a | ronsaldo/bullet-pharo | src/bullet-2.82-r2704/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp | #include "btConvex2dConvex2dAlgorithm.h"
//#include <stdio.h>
#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/Collisio... | ALGO | 0.999768 | 6.684228 |
094b1ccc-2bb6-4cb0-a3e6-c3f68336b7af | HRS05/Practice-Questions | 26-remove-duplicates-from-sorted-array/26-remove-duplicates-from-sorted-array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
//wonderful solution
int count = 0;
for(int i = 1; i < nums.size(); i++)
{
if(nums[i] == nums[i-1]) count++;
else nums[i-count] = nums[i];
}
return nums.size()-count;
/*
//my soluti... | ALGO | 0.999954 | 6.032569 |
532cde35-81d1-4c73-8b8d-4d4fe12ded1f | sandeshkhadase/Leetcode-Solutions | Leetcode Solutions/solution/0200-0299/0272.Closest Binary Search Tree Value II/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.999998 | 5.708705 |
b3e6f007-7d0c-4dc8-b316-8eb5c9bdc25d | rprusacki1/Standard-Library | miniDList.cpp | /*Rachel Prusacki, 10/21/2021
* COSC220
* Implementations of template functions for miniDList
*/
#include "miniDList.h"
#include <iostream>
using namespace std;
template <class DataType>
miniDList<DataType>::miniDList() { //Constructor
header = nullptr;
trailer = nullptr;
listsize = 0;
}
templat... | TOOL | 0.963436 | 5.507275 |
6f189a81-1787-49de-8d5b-36416da0dc32 | wuwendb/cccode | nowcoder/87410/K.cpp | // Problem: 鸽桥
// Contest: NowCoder
// URL: https://ac.nowcoder.com/acm/contest/87410/K
// Memory Limit: 524288 MB
// Time Limit: 2000 ms
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define rev(i, a, b) for (int i = (a); i >= (b); --i)
#define all(a) (a).begi... | ALGO | 0.999372 | 3.437522 |
dbf1d51a-1e96-4ca3-88f8-f6e50a396306 | zachallarey/P3_NYPD | P3_NYPD/src/data_generator.cpp | //
//
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <set>
#include <random>
using namespace std;
//int main(){
// srand(time(0));
//
// int numNodes = 10000;
// int numEdges = 30000;
//
// ofstream graphFile("../data/data.txt");
// ofstream locF... | DATA | 0.888998 | 4.094267 |
eb7d1f28-071c-4e68-aa1e-004393630707 | EmptyDust/Algorithm-Codes-and-writeups | codes/-0x30_competition/-0x34_atcoder/abc338/D.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int MAXN = 1e6;
int nums[MAXN];
using pt = pair<int, int>;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n, m;cin >> n >> m;
for (int i = 0;i < m;++i)cin >> nums[i], nums[i]--;
vector<int> mi(... | ALGO | 0.999989 | 4.212882 |
f270ea21-cc4b-4f9a-8030-47d57b05da88 | Harsh971/100DaysOfDSA | Day 59/Geek's Village and Wells_GFG/Geek's_Village_and_Wells.cpp | class Solution{
public:
vector<vector<int>> chefAndWells(int n,int m,vector<vector<char>> &c){
// Code here
vector<vector<int>> vis(n,vector<int>(m,0));
vector<vector<int>> ans(n,vector<int>(m,-1));
queue<pair<int,pair<int,int>>> q;
for(int i=0;i<n;i++)
{
... | ALGO | 0.999847 | 4.902591 |
09d0a087-c6c0-4912-93fe-2a6273e9aecb | CSI-SRM-NCR-Chapter/100-Days-of-Code | ROHIT KUMAR/Day 6/Question_1.cpp | class Solution {
public:
bool isAnagram(string s, string t) {
if (s.length() != t.length())
return false;
sort(s.begin(), s.end());
sort(t.begin(), t.end());
for (int i=0; i<s.length(); i++){
if (s[i] != t[i])
return false;
}
re... | ALGO | 0.999939 | 6.126211 |
22705ae8-7b03-49e1-8a97-2a78d2964c28 | RuoAndo/NII-SOCs-admin-tools | bitset/trans-vector6.cpp | #if __linux__ && defined(__INTEL_COMPILER)
#define __sync_fetch_and_add(ptr,addend) _InterlockedExchangeAdd(const_cast<void*>(reinterpret_cast<volatile void*>(ptr)), addend)
#endif
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <fstream>
#include... | DATA | 0.964833 | 3.752143 |
a0865614-4e90-40d8-8779-12b193affefc | vmos-dev/frameworks | av/media/libstagefright/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.989353 | 6.540888 |
6f8df538-4652-4744-8b3e-69acb2f181a9 | trungduc81/DSA | Greedy/DSA03012 - SẮP ĐẶT XÂU KÝ TỰ 1.cpp | #include<bits/stdc++.h>
using namespace std;
#define faster() ios_base::sync_with_stdio(false); cin.tie(0);
int main()
{
faster() ;
int t ; cin >> t ;
while(t--)
{
map<char,int> mp ;
string s ; cin >> s ;
for(auto i : s) mp[i]++ ;
int n = s.size() ;
int MAX = 0 ;
for(auto i : mp)
{
if(i... | ALGO | 0.999932 | 4.052485 |
9280b7dc-dd47-41c0-a1f7-0e67922a8c6a | HaKkaz/Competitive-Programming | CodeForces/Round#746/B.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define ft first
#define sd second
#define ALL(v) v.begin(),v.end()
#define fast ios::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define cerr if(0);else cerr
#define _ << ' ' <<
int main(){
fast;
int t; cin >> t;... | ALGO | 0.999802 | 4.100801 |
64bc3479-21cc-4cfb-83b1-7a38952f3d97 | NicholasZXT/OpenSourceProjectsLearning | pytorch/aten/src/ATen/native/cpu/ReduceOpsKernel.cpp | #include <numeric>
#include <iterator>
#include <algorithm>
#include <ATen/Dispatch.h>
#include <ATen/cpu/vec256/vec256.h>
#include <ATen/native/ReduceOps.h>
#include <ATen/native/ReduceOpsUtils.h>
#include <ATen/native/TensorIterator.h>
#include <ATen/native/SharedReduceOps.h>
#include <ATen/native/ReduceOpsUtils.h>
... | ALGO | 0.999393 | 7.299295 |
19fab63e-7e00-4bef-9b9b-c9e409369d59 | csingh27/Principal-Component-Analysis | exercise2/include/eigen-3.3.8/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
std::cout << "Row's maximum: " << std::endl
<< mat.rowwise().maxCoeff() << std::endl;
}
| ALGO | 0.999636 | 3.881484 |
23e1a2d2-6816-4137-b50e-4a04cba2197f | harshpandeyjiit/Codes | Graph Algortihms/MARYBMW.cpp | /*# # # # # # # # # # # # # # # # # # #
# # # # # # # # #
# # # # # ## # # # # # ## # # # # # # # # # # # # # ##
# # # # # # # # #
# # # # # # # # # # # # #*/
#include... | ALGO | 0.99993 | 3.887858 |
f92b8ef5-c4e6-4e06-b0bb-b2d3bdd9766c | AlexYaoRuihao/CS225_POTD | potd-q47/MinHeap.cpp | #include "MinHeap.h"
MinHeap::MinHeap(const vector<int> & vector)
{
int inf = numeric_limits<int>::min();
elements.push_back(inf);
elements.insert(elements.end(), vector.begin(), vector.end());
buildHeap();
}
MinHeap::MinHeap()
{
int inf = numeric_limits<int>::min();
elements.push_back(inf);
}... | ALGO | 0.997403 | 4.608685 |
cc6f7a63-41e1-4ad3-a15a-a8a7e5324b1b | james31366/Algo1-Lab | Elab2/intro1/Trucks.cpp | #include <iostream>
using namespace std;
int main()
{
const int LOAD_LIMITS = 1000;
int n;
cin >> n;
int package_array[n];
for (int i = 0; i < n; i++)
{
cin >> package_array[i];
}
int ans = 0;
int truck_load = 0;
for (int i = 0; i < n; i++)
{
truck_load += ... | ALGO | 0.999884 | 4.415537 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.