uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
57814f9d-2ea4-4ae4-9d57-1820fb141bf7 | i-X-ce/competitive-programming | ABC/313B.cpp | /*
g++ XXX.cpp
./a.out
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,m;
cin >> n >> m;
vector<int>a(n+1);
for (int j=0;j<m;j++){
int bf;
cin >> bf >> bf;
a.at(bf)++;
}
int cnta = 0;
for (int i=1;i<=n;i++){
if (a.at(i) == 0){
if (cnta != 0){
cout << -1... | ALGO | 0.999982 | 3.710815 |
b42611b9-4e52-4359-a71c-9fffb284692c | rewatlok/Prepare-for-ICPC | Theory/Data structures/Sparse Table/Sparse Table Min.cpp | class Sparse_table_min {
private:
int N, K;
vector<vector<int>> Stable;
vector<int> LOG2;
public:
Sparse_table_min(const vector<int>& vec) {
this->N = (int)(vec.size());
this->K = log2(N) + 2;
LOG2.resize(N + 1);
for (int i = 0; i <= N; i++) {
LOG2[i] = log2(... | ALGO | 0.999892 | 5.467834 |
2bba2176-f1f4-4e3b-9c94-dcfb0d40db7b | TRLVMMR/algorithm | C++/算法/堆与堆排序.cpp | /*
Сѣ
<=
ֻ踸 <= min
壺
>
ֻ > min
͵
*/
#include<cstdio>
#include<algorithm>
#define MAXV 256
using namespace std;
int heap[MAXV], n;
//µ:ʺϽʱ,left rightheapķΧ
void downAdjust(int left, int right)
{
int key = left, child = key * 2; //keyΪԤڵ,childΪСĺӣȳʼΪ
//ӴڣҵСĺӣȻ
/*
ȫԲ... | ALGO | 0.999804 | 3.102857 |
566a9daf-c26e-45dc-8a1b-024f9b0df3d8 | clifordjoshy/thistlethwaite-rubiks | rubiks.cpp | #include "rubiks.h"
#include<array>
#include<vector>
#include<set>
#include<iostream>
#define F_UP 0
#define F_DOWN 1
#define F_FRONT 2
#define F_BACK 3
#define F_LEFT 4
#define F_RIGHT 5
std::set<uint_fast64_t> permutations;
bool doDFS(const int searchDepth, std::vector<Move> &moveList,
const std::array<Mo... | ALGO | 0.999788 | 6.700751 |
491a3c8e-f121-4389-a2fe-2ca7cb76eb8c | bcmi220/cddp | tools/mosesdecoder/misc/pruneGeneration.cpp | #include <stdio.h>
#include <stdlib.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <boost/filesystem.hpp>
#include "pruneGeneration.h"
#include "moses/InputFileStream.h"
#include "moses/OutputFileStream.h"
using namespace std;
int main(int argc, char **argv)
{
cerr << "Starting" << endl;
... | DATA | 0.972117 | 4.628278 |
231a5acd-5491-46e1-9425-88cf57ec9ec3 | jabirsubaktagin16/problem-solving-accepted | uVa/Throwing Cards Away (I).cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
queue <int> q;
while(cin>>n)
{
if(n==0)
break;
for(int i=1;i<=n;i++)
q.push(i);
cout<<"Discarded cards:";
while(q.size()>1)
{
cout<<' '<<q.front();
q.... | ALGO | 0.999594 | 4.456592 |
9dc4ffa4-b247-4b6c-9ea4-f96981ee7ebf | kmjp/procon | leetcode/201-250/244/1887.cpp | typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) me... | ALGO | 0.999946 | 5.267655 |
4954bd84-703b-4488-b548-0477ac7727b1 | ishandutta2007/codeforces | intothenight/normal/1446/F.cpp | #include <bits/stdc++.h>
using namespace std;
template<class T = long long> struct point{
T x, y;
int ind;
template<class U> point(const point<U> &otr): x(otr.x), y(otr.y), ind(otr.ind){ }
template<class U = T, class V = T> point(U x = 0, V y = 0, int ind = -1): x(x), y(y), ind(ind){ }
template<class U> explicit ... | ALGO | 0.999929 | 3.187823 |
445762b7-7e8f-45c8-8ecb-fd9683edcd93 | Gliese832B/ReGt | regrowtopia2/proton/shared/Bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp | #include "btConvexPlaneCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
//#include <stdi... | ALGO | 0.99943 | 7.155145 |
ac2fefd6-cc2e-46c5-8a3c-c681950df89c | hhuangae/liggghts-src | fix_momentum.cpp | #include "stdlib.h"
#include "string.h"
#include "fix_momentum.h"
#include "atom.h"
#include "domain.h"
#include "group.h"
#include "error.h"
using namespace LAMMPS_NS;
using namespace FixConst;
/* ----------------------------------------------------------------------
Contributing author: Naveen Michaud-Agrawal (J... | TOOL | 0.945259 | 6.447498 |
fa087e97-63ae-4e58-a5b0-d51fed481c16 | Plumora/Core | src/merkleblock.cpp | #include <merkleblock.h>
#include <hash.h>
#include <consensus/consensus.h>
std::vector<unsigned char> BitsToBytes(const std::vector<bool>& bits)
{
std::vector<unsigned char> ret((bits.size() + 7) / 8);
for (unsigned int p = 0; p < bits.size(); p++) {
ret[p / 8] |= bits[p] << (p % 8);
}
return... | ALGO | 0.999242 | 6.255136 |
7a700351-e00a-4d82-a96f-f26599a102e4 | Quantrap/pr8 | 7/7.cpp | #include <iostream>
using namespace std;
int main()
{
setlocale(NULL, "rus");
int N, k = 0, k1 = 0;
cout << "Введите величину массива:";
cin >> N;
int* mass = new int[N];
for (int i = 0; i < N; i++)
{
mass[i] = rand() / 1000;
cout << mass[i] << " ";
if (mass[i] % 2 !=... | ALGO | 0.999256 | 3.878409 |
715c2fd5-4f3b-4b0c-a42e-990b4e4cd171 | StudioAlbert/925-HelloWorld-Solution | 925-HeadsOrTails/925-HeadsOrTails.cpp | // 925-HeadsOrTails.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
bool continueMessage()
{
char reponse;
std::cout << "Voulez vous continuer [o/n] ?\n";
std::cin >> reponse;
//return reponse != 'n';
if(reponse != 'n')
{
return true;
}
else
... | TOOL | 0.910139 | 4.860427 |
8f87d14e-4c31-4155-8a4c-c936784f865d | wjwhhhhhh/ACM_ | 模板/字符串/tire2.cpp | #include <bits/stdc++.h>
using namespace std;
struct Tire // 字母
{
static const int W = 26;
int cnt;
vector<array<int, W>> nex;
vector<int> size;
Tire(){};
Tire(int n)
{
init(n);
}
void init(int n)
{
cnt = 0;
nex.resize(n + 5); // 根据需要修改
size.resize... | ALGO | 0.999536 | 3.885297 |
e7bed7bf-4988-42ba-ad40-0bd8ff53a3ce | Vaibhav10sept/DSA | TREES/BT-boundary-traversal.cpp | #include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
Node(int data) {
this->data = data;
this->left = NULL;
this->right = NULL;
}
Node(int data, Node* left, Node* right) {
this->data = data;
this->left = left;
this->right = right;
}
Node() {
left ... | ALGO | 0.999972 | 4.743451 |
935e3cab-39a7-4603-a150-8737ce42bd91 | ocdian/competitive-code | Codeforces/A - Stones/main.cpp | #include <bits/stdc++.h>
using namespace std;
//there are two possible answers, either apply operation 1 as many times as possible,
//then apply operation 2 with c and the remainder of b, or apply operation 2 as many times
//as possible, and then apply operation 1 with a and the remainder of b, the answer is the
//max... | ALGO | 0.999902 | 4.495573 |
cda54660-0c43-44e4-84ce-49bfb75322f9 | PankajGit2711/DataStructures | Recursion/Recursion10 - HeightOfBinaryTree.cpp | /******************************************************************************
Recursion - 10:- Height of Binary Tree (Recursion on Trees)
Time Complexity = O(n) Space Complexity:- O(n)
*******************************************************************************/
#include <bits/stdc++.h>
using namesp... | ALGO | 0.999959 | 6.190678 |
ac75d853-1d25-499c-be3d-a86aab83fffc | ishandutta2007/codeforces | piyushsethia1999/normal/990/A.cpp | #include <bits/stdc++.h>
#define pb emplace_back
#define fi first
#define se second
#define int long long
using namespace std;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int l) { uniform_int_distribution<int> uid(0, l - 1); return uid(rang); }
int32_t main() {
ios::sync_... | ALGO | 0.99936 | 3.206857 |
0605d21c-316f-40e1-bb3a-6de359f720f3 | HohyunKim-kr/codingTest-study | AlgorithmJobs/Week2/Day2_6.cpp | // 백준 2506번
#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
int b;
int sum = 0, add = 1;
for (int i = 0; i < n; i++) {
scanf("%d", &b);
if (b == 1) {
sum += add;
add++;
}
else if (b == 0) {
add = 1;
}
}
pr... | ALGO | 0.999996 | 3.706674 |
be9b9f27-67a1-45cb-bd80-ef520cb42238 | arunnsit/allcodes | files/446c.cpp | #include<iostream>
#include<algorithm>
#include<math.h>
#include <stdio.h>
#include <vector>
#define mod 1000000009
using namespace std;
int fibo[300009],arr[300009],fibosum[300009],sum[300009],sol;
int n,i,cur=0,vm=0;
inline int add(int a,int b)
{
int res = (a+b)%mod;
//if(res >=mod)
// return res... | ALGO | 0.999833 | 3.728177 |
4bbfcc50-7f6e-4c99-bd53-0c4e7ad8d87e | tangodown1934/Algorithm-judge | source/match/1865229_WA.cpp | #include <stdio.h>
#include <string.h>
int main()
{
char arr[55];
int temp[55];
int ans[55];
int index = -1;
int j = 0;
scanf("%s", arr);
for (int i = 0; i < strlen(arr); i++){
if (arr[i] == '('){
index++;
temp[index] = i;
}
else if (arr[i] == ')'){
printf("%d %d\n", temp[index], i);
index--;
... | ALGO | 0.971962 | 3.034847 |
69678186-37ca-439b-bb03-d1ada2722e36 | PsiCodes/ktxpy | libp7zip/src/main/cpp/p7zip/CPP/7zip/Compress/Rar3Decoder.cpp | /* This code uses Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
#include "StdAfx.h"
#include "../../../C/Alloc.h"
#include "../Common/StreamUtils.h"
#include "Rar3Decoder.h"
namespace NCompress {
namespace NRar3 {
static const UInt32 kNumAlignReps = 15;
static const UInt32 kSymbolReadTable = 2... | TOOL | 0.957445 | 3.795733 |
977bc375-496e-4abc-8a78-02ac04c4d139 | dipayandutta/c-plus-plus | Basic/structure/Example05_enmu.cpp | #include <iostream>
using std::endl;
using std::cout;
using std::cin;
enum days_of_week {Sun,Mon,Tues,Wed,Thrus,Fri,Sat};
int main(){
days_of_week day1,day2;
day1 = Mon;
day2 = Thrus;
int diff = day2 - day1;
cout << "Days Between = "<< diff;
cout << endl;
if (day1>day2){
... | ALGO | 0.990353 | 3.548924 |
38ed2cc2-2212-4e18-9b0f-499243af3077 | raincross7/code-similarity | codes/train_code/problem319/problem319_347.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... | ALGO | 0.999497 | 3.974691 |
5752f607-b728-425e-a6fa-73d7979c74a3 | st117162/2023-cpp-autumn | 2023.11.21-homework-06/Project5/Source.cpp | #include<iostream>
void hanoi(int n, int from, int to);
int main(int argc, char* argv[])
{
int from = 1;
int to = 0;
int n = 0;
std::cin >> n;
for (int i = n; i > 0; --i)
{
to = (i % 2 == 0 ? 3 : 2);
hanoi(i, from, to);
from = to;
}
return EXIT_SUCCESS;
}
void hanoi(int n, int from, int to)
{
if (n <... | ALGO | 0.999934 | 4.028058 |
dad05b0a-66b2-4e5c-9657-a7725591a6f2 | braph-software/MemoryCapacity | braph2memorycapacity/measures/MEX_SRC/group_handler.cpp | //
// group_handler.cpp
// group_handler
//
// Created by Lucas Jeub on 21/11/2012.
//
// usage:
//
// [output]=group_handler('function_handle',input)
//
// implemented functions are 'assign', 'move', 'moverand', 'return'
//
// assign: takes a group vector as input and uses it to initialise the "group_index"
... | ALGO | 0.99756 | 5.159534 |
497acf17-c9ba-471a-a7a2-d92994c1e68b | akommula/CompetitiveProgramming | codeforces/under.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#define MAX_N 100005
#define f first
#define s second
using namespace std;
vector<int> con[MAX_N];
bool vis[MAX_N];
int d[MAX_N], lca[MAX_N][23];
int N, Q;
void DFS (int ind, int prev) {
vis[ind] = true;
... | ALGO | 0.999799 | 4.724363 |
7911f646-7a85-4b56-943f-f55938d68012 | ezsanch/oruewoihgfne | tp3 p5.cpp | #include <iostream>
using namespace std;
int main() {
int n, valor, encontrado = 0;
int vec[100];
cout << "Ingrese la cantidad de elementos: ";
cin >> n;
cout << "Ingrese los " << n << " numeros:";
for (int i = 0; i < n; i++) {
cin >> vec[i];
}
cout << "Ingrese el valor a b... | ALGO | 0.999208 | 4.848978 |
9930874a-a40e-4653-bac0-6d3ba9b6d8fe | utsavtyagi01/Leetcode | Minimum Number Of Days to make m bouquets.cpp | class Solution {
public:
bool helper(int m,int k, vector<int> bloomDay,int mid){
int temp=0,flower=0;
for(int i=0;i<bloomDay.size();i++){
if(bloomDay[i]<=mid){
flower++;
if(flower==k){
temp++;
flower=... | ALGO | 0.999997 | 6.094482 |
27e3f66c-f914-47a7-beed-5645375fd5cd | avik-samanta99/Speech-Processing | VowelRecognition.cpp | /*
=============================
Name : Avik Samanta
Roll no. - 204101016
Asgn. 3 - Vowel recognition
Submission Date : 04/11/2020
=============================
*/
#include "stdio.h"
#include "stdlib.h"
#include "vector"
#include "iostream"
#include "fstream"
#include "string"
using namespace std;
#define pi 3.14286 /... | ALGO | 0.996814 | 3.555569 |
6ef9c083-d7a8-4d30-bfc3-614b77b1642b | gayanigupta/Research | graph_decomposition/Example_v_5.0.0/eliminationorder_updated_v9.cpp | #include <iostream>
#include <list>
#include <set>
#include <map>
// INPUT HEADERS
#include "translate_from_input.hpp"
#include "input_to_network.hpp"
#include "structure_defs.hpp"
// OUTPUT HEADERS
#include "printout_network.hpp"
#include "printout_others.hpp"
using namespace std;
/**
* START OF FUNCTION
*
*/
... | ALGO | 0.999158 | 4.865284 |
b07f33ee-6477-4ff2-bbb9-7843e1b2c33e | miramar-labs/cuda-examples-vscode | Samples/cuSolverDn_LinearSolver/mmio_wrapper.cpp |
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mmio.h"
#include <cusolverDn.h>
/* avoid Windows warnings (for example: strcpy, fscanf, etc.) */
#if defined(_WIN32)
#define _CRT_SECURE_NO_WARNINGS
#endif
/* various __inline__ __device__ function to initialize a T_ELEM */
template <typename T_... | TOOL | 0.931687 | 4.804112 |
a21db603-fc4e-48b6-b25e-629e173132d4 | Kapilraj9755/Project | CODING BLOCKS/RemoveDuplicateSting/AddDigit.cpp | // kisi bhi digit ko add kr k use ek banana example
// 56 = 5+6=11 , 1+1=2
//output is 2
#include<bits/stdc++.h>
using namespace std;
int adddigit(int n){
if(n<10) return n;
int sum=0;
while(n){
sum=sum+n%10;
n=n/10;
}
return adddigit(sum);
}
int main(){
int n;
cin>>n;... | ALGO | 0.999839 | 5.014838 |
c003ae60-6a3a-494e-a593-8ac418a022f8 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_12878_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, c = 1;
cin >> n;
vector<int> v;
for (int i = 1; i <= n; i++) {
cin >> a;
v.push_back(a);
}
sort(v.begin(), v.end());
for (int i = 0; i < n - 1; i++) {
if (v[i] != v[i + 1] && v[i] != 0) {
c++;
}
}
cout << c << e... | ALGO | 0.999908 | 3.836391 |
8223890b-bcfa-4785-8a7b-1e9c04ca3dde | bihany-harsh/data-structures-and-algorithms | code-dump/contest878-forces/ski_resort.cpp | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
long long solve(vector<int> temps, int min_days, int max_temp)
{
vector<int> spanned(temps.size(), 0);
long long ways = 0;
int current_span = 0;
for (int i = 0; i < temps.size(); i++)
{
if (temps[i] > max_temp)
... | ALGO | 0.999854 | 4.363429 |
b01dd41c-7f2a-43a2-bd7a-6d95de557f3d | Akash-Raj-ST/Competitive-Programming | codechef/Data Structure/DIFSTR.cpp | #include <iostream>
#include <vector>
#define ll long long int
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<string> arr(n);
for(int i=0;i<n;i++) cin>>arr[i];
... | ALGO | 0.999935 | 5.172027 |
e08964aa-a7e0-4b9f-8885-988ad95b83e1 | trhgquan/CPP | sth_else/MISC/UWCOI20A.cpp | /**
* UWCOI20A - https://codechef.com/problems/UWCOI20A
* UWCOI2020 - online replay on Codechef
* Code by @trhgquan - https://github.com/trhgquan
*/
#include<bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int T; cin >> T;
while (T--) {... | ALGO | 0.9993 | 5.269334 |
266d95db-6b88-4076-92ff-20f4489a4abc | equation9/BOJ | 1652.cpp | /*1652번 누울 자리를 찾아라(C++11)*/
#include <cstdio>
char Room[100][101];
int N;
int Row_cnt(int L)
{
int i, cnt = 0;
for(i = 0 ; i < N ; i++)
{
if(Room[L][i] == '.')
{
if(i < N-1 && Room[L][i+1] == '.')
{
cnt++;
while(Room[L][i] == '.')
i++;
}
}
}
return cnt;
}
int Column_cnt(int L)
{
int... | ALGO | 0.999239 | 3.722177 |
b617cc90-668a-42fc-82be-23bff79d795f | TeamJ19ROADEF2012/ROADEF2012-J19 | src/localIP.cpp | #include "localIP.h"
#include "OsiSolverInterface.hpp"
#include "OsiClpSolverInterface.hpp"
#include "CoinModel.hpp"
#include "CbcModel.hpp"
#include "CbcHeuristicFPump.hpp"
#include "ClpPresolve.hpp"
#include <math.h>
#include <set>
#include <fstream>
using namespace std;
void set_solve_param(CbcModel& model) {
... | ALGO | 0.999552 | 5.066582 |
af5dbbf9-fa39-4f2e-8217-573b481073c4 | iamvinayvk/LeetCode | 94-binary-tree-inorder-traversal/94-binary-tree-inorder-traversal.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.999951 | 6.327276 |
2cc180ee-f9ec-45f2-bdd3-4534a1ae7950 | Junboom/BaekjoonAlgorithm | src/while/Main_11720_숫자의합.cpp | #include <iostream>
using namespace std;
int main()
{
int n, sum = 0;
string num;
cin >> n >> num;
for (int i = 0; i < n; ++i)
sum += num[i] - '0';
cout << sum << endl;
} | ALGO | 0.996361 | 4.247169 |
817549bd-ea58-48a9-a139-f1f222abbe3b | Karan-Veer-Singh/Leetcode | Linked Lists/876. 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.999889 | 6.074625 |
33d7c274-3a9d-4dd6-80f5-65ed17ecdd49 | TeamCrazyPerformance/algorithm2023-1-H | 전효정/7주차:삼성코테/14500_ans.cpp | // https://velog.io/@skyepodium/백준-14500-테트로미노 에서 가져왔습니다.
#include <iostream>
#define max_int 501
using namespace std;
int n, m, a[max_int][max_int], result;
bool check[max_int][max_int];
int dx[] = {0, 0, 1, -1};
int dy[] = {-1, 1, 0, 0};
int ex[4][4] = {{0,0,0,1}, {0,1,2,1}, {0,0,0,-1}, {0,-1,0,1}};
int ey[4][4]... | ALGO | 0.999967 | 5.048015 |
8eba30ef-7861-49c6-b5c9-783308acdf8a | SumerPock/Hscamera | Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/arm_nnexamples_gru.cpp | /**
* @ingroup groupExamples
*/
/**
* @defgroup GRUExample Gated Recurrent Unit Example
*
* \par Description:
* \par
* Demonstrates a gated recurrent unit (GRU) example with the use of fully-connected,
* Tanh/Sigmoid activation functions.
*
* \par Model definition:
* \par
* GRU is a type of recurrent neura... | ALGO | 0.910311 | 7.457812 |
bbfa6e0a-dae0-4ded-8b6f-6d5da6955d8d | shubhamgyd/mission_TCS | OA/Amazon/Amazon_SDE1/35_Amazon_Shopping.cpp | /*
Imagine you are shopping on Amazon.com for some good weight lifting equipment.
The equipment you want has plates of many different weights that you can combine to lift.
The listing on Amazon gives you an array, plates, that consists of n different weighted plates,
in kilograms. There are no two plates with the same... | ALGO | 0.999954 | 6.044732 |
9674367c-8d00-4242-a47c-fde650974a9c | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2963_14.cpp | #include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
int cases = 1;
map<int, pair<int, int> > add;
string Str[100005], str1, str2;
int M, N;
vector<int> graph[100005], rgraph[100005];
map<string, int> stin;
bool vis[100005];
pair<int, int> save[100005], fut[100005], dp[100005];
int mini_r, m... | ALGO | 0.999506 | 4.166562 |
170bd8e9-4be3-46dc-ba46-e9a761ebc472 | ShawnTSH1229/XEngine | ThirdParty/boost_1_78_0/doc/html/boost_asio/example/cpp14/executors/fork_join.cpp | #include <boost/asio/execution.hpp>
#include <boost/asio/static_thread_pool.hpp>
#include <algorithm>
#include <condition_variable>
#include <memory>
#include <mutex>
#include <queue>
#include <thread>
#include <numeric>
using boost::asio::static_thread_pool;
namespace execution = boost::asio::execution;
// A fixed-s... | ALGO | 0.998547 | 7.538884 |
e4ab7eeb-83df-4171-b2e9-0aca7526f0b5 | yashwanth-cell/Efficient-Matrix-Multiplication-using-Strassen-s-Algorithm | main.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include "Matrix.h"
int main() {
int size = 4; // Example: 4x4 matrices
// Generate two random matrices of the specified size
std::vector<std::vector<int>> A = generateRandomMatrix(size);
std::vector<std::vector<int>> B = generateRandomMatrix(siz... | ALGO | 0.999266 | 5.43438 |
388f91c6-1ec5-4a29-8b32-4ad0a9327030 | raincross7/code-similarity | codes/train_code/problem487/problem487_241.cpp |
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
#include <deque>
#include <set>
#include <climits>
#include <memory>
#include <numeric>
#include <utility>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a... | ALGO | 0.99958 | 3.819159 |
30c4d823-f9de-4b8a-96fd-a0d9040d8ce4 | WeiBenqiang/Fregata | CBSmode/src/gate.cpp | #include <gate.hpp>
#include <gatebootstrapping.hpp>
#include <keyswitch.hpp>
namespace TFHEpp {
// No input
template <class P>
void HomCONSTANTONE(TLWE<P> &res)
{
res = {};
res[P::k * P::n] = P::mu;
}
#define INST(P) template void HomCONSTANTONE<P>(TLWE<P> & res)
INST(lvl1param);
INST(lvl0param);
INST(lvlMpa... | ALGO | 0.997335 | 3.791214 |
cef8dacb-51d4-44b6-bc00-00d09211e3d4 | AntennaeVY/CP | AtCoder/Beginner Contest 380/C-Move Segment.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
k--;
string s;
cin >> s;
vector<pair<int, int>> v;
int l = 0;
for (int i = 1; i < n; i++) {
if (s[i] == '1' && s[i - 1] == '0') l = i;
if (s[i] == '0' ... | ALGO | 0.999998 | 4.693605 |
6b5584e8-7826-4f49-a0f8-c1a80b186e58 | BhanuPratapSinghVerma/C-programming | Transpose.cpp | #include <stdio.h>
int main() {
int a[10][10], transpose[10][10], r, c;
printf("Enter rows and columns: ");
scanf("%d %d", &r, &c);
printf("\nEnter matrix elements:\n");
for (int i = 0; i < r; ++i)
for (int j = 0; j < c; ++j) {
printf("Enter element a%d%d: ", i +1, j +1);
scanf("%d", &a[i][j]);
}
printf("\nEntered matr... | ALGO | 0.998752 | 3.347876 |
6bf1d47d-bdbe-4fac-90d6-029bdf16d99c | dukebw/K_And_R | Ch5/src/str_functions.cpp | #include <stdio.h>
#define MAXLINE 128
// NOTE(brendan): copies the string t to the end of s
char *strcat(char *s, char *t) {
char *result = s;
while (*s != '\0') {
++s;
}
while ((*s++ = *t++) != '\0');
return result;
}
// NOTE(brendan): returns length of string s
int strlen(char *s) {
... | ALGO | 0.993594 | 4.915891 |
0b55cede-8a05-407e-8145-1bbb0bc726d3 | khaledsliti/CompetitiveProgramming | IFHLC/2020/Indiv/IFHLC#03/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
const int N = 121;
void solve()... | ALGO | 0.999464 | 4.681528 |
e3c2443a-30b3-419e-9958-1e708601e1d6 | ut2310/codeforces | codeforces/1977/E.cpp | using namespace std;
#include <bits/stdc++.h>
#define ll int
#define MAXN 200005
const ll b = 1800;
bool visited[b + 5][MAXN];
ll pref[MAXN/b + 5][MAXN];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n, q; cin >> n >> q;
vector<ll> a(n);
for(int i = 0; i < n; i++){
cin >... | ALGO | 0.999959 | 4.087358 |
5792cca7-27cb-484e-8cc8-6c80dc59f764 | tattheptueyza-it061/trading-crypto | 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 |
a83d059d-739e-496e-b018-84978a2a8290 | hichoe95/BOJ | 11729.cpp | #include <cstdio>
#include <cmath>
void rec(int x, int y, int n){
if(!n) return;
rec(x,6-x-y,n-1);
printf("%d %d\n",x,y);
rec(6-x-y,y,n-1);
}
int main(){
int n;
scanf("%d",&n);
printf("%d\n",(int)pow(2,n)-1);
rec(1,3,n);
return 0;
} | ALGO | 0.999776 | 3.548783 |
d0d63161-b7e6-4b90-a011-70eb407edcf7 | Digital-Revelation/Byiness | src/rpc/blockchain.cpp | #include <rpc/blockchain.h>
#include <amount.h>
#include <blockfilter.h>
#include <chain.h>
#include <chainparams.h>
#include <coins.h>
#include <node/coinstats.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <hash.h>
#include <index/blockfilterindex.h>
#include <policy/feerate.h>
#include <policy/p... | TOOL | 0.899995 | 7.330027 |
2013f415-cfd8-4af4-b1be-e2af9c21dfe5 | Mariano152/merge_sort | main.cpp |
using namespace std;
#include <iostream>
#include <vector>
void merge(vector<int>& leftArray,vector<int>& rightArray,vector<int>& arr){
int leftSize=leftArray.size();
int rightSize=rightArray.size();
//indices
int i=0;
int l=0;
int r=0;
//main while
while(l<leftSize && r<rightSize){... | ALGO | 0.99978 | 4.911364 |
acef66a5-0e9e-4a67-8700-b0f7efb9de90 | tangodown1934/Algorithm-judge | source/bhd/1865965_TLE.cpp | #include <stdio.h>
#include <stdlib.h>
int main()
{
int itr;
int nCount; /* Ʈ ̽ */
int count=0;
int number_cows;
scanf("%d",&number_cows);
int *cows;
cows = (int *)malloc(number_cows*sizeof(int));
int number_watchable_cows=0;
for(int i=0;i<number_cows;i++) {
int new_cow;
scanf("%d",&new_cow... | ALGO | 0.999828 | 3.780942 |
45698765-ad5f-48e0-995e-60198e45e9de | raincross7/code-similarity | codes/train_code/problem459/problem459_437.cpp | #include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple... | ALGO | 0.999892 | 3.839084 |
c9e8015f-5d30-4830-b669-6b4b3bb20d93 | MBU-Team/OpenMBU | engine/lib/opcode/Ice/IceRay.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains code for rays.
* \file IceRay.cpp
* \author Pierre Terdiman
* \date April, 4, 2000
*/
///////////... | ALGO | 0.987203 | 5.687668 |
dab3c7d5-a32f-4f85-ac11-8c25d1e82e41 | VoTuanNhat/CTDLGT_IT2101_Nhom4 | CTDL_GT-VoTuanNhat-2151050306/Code_Chương2/C2_Bai14.cpp | #include <iostream>
#include <stdio.h>
#include <ctime>
using namespace std;
//Cau 2.1
#define MAX 100
int a[MAX];
int n;
//Cau 2.2
void input(int a[], int &n)
{
for (int i = 0; i < n; i++)
cin >> a[i];
}
//Cau 2.3
void output(int a[], int n)
{
cout << "Mang cua ban: "<<endl;
for (int i = 0; i < n; i++)
cout <... | ALGO | 0.997347 | 3.526997 |
b76d5e4f-baa1-4e05-a449-533dc9a75c95 | saptarshi-mondal-12/DSA-Revision | 1. Arrays/3_check_if_array_is_sorted_or_not.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
// check if array is sorted or not
bool brute_isSorted(int arr[], int n) {
// Time complexity - O(n^2)
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (arr[j] < arr[i])
return false;
}
}... | ALGO | 0.999735 | 5.28415 |
f7c56e39-48d4-4eca-9c99-0eb784616873 | abodzsar29/cpp-practice | ADS/LeetCode/TwoSum/TwoSum.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
/*
This is the solution for the problem "Two Sum", classed "Easy" on LeetCode. It is found under:
https://leetcode.com/problems/two-sum/description/
Two approaches are implemented:
1. Hash Map Approach - O(n) time complexity
2. Brute ... | ALGO | 0.9999 | 7.176975 |
ea80a35e-b137-4188-81c6-984af479819e | LuizHenriqueSena/ESBMC-GPU | regression/esbmc-cpp/algorithm/algorithm12/main.cpp | // search_n example
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
using namespace std;
bool mypredicate (int i, int j) {
return (i==j);
}
int main () {
int myints[]={10,20,30,30,20,10,10,20};
vector<int> myvector (myints,myints+8);
vector<int>::iterator it;
// using default... | ALGO | 0.999363 | 4.953629 |
091c17cc-12fa-48e7-8315-2db9cf89c9e5 | AbihaFatima/LeetCode | binary-search/binary-search.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int low=0, high =nums.size()-1;
while(low<=high)
{
int mid=(low+high)/2;
if(nums[mid]<target)
{
low=mid+1;
}
else if(nums[mid... | ALGO | 0.999969 | 6.233195 |
86a39bb7-644e-4cb5-9d48-fb13862ea154 | shubham4349/Leetcode | 2271-rearrange-array-elements-by-sign/rearrange-array-elements-by-sign.cpp | class Solution {
public:
vector<int> rearrangeArray(vector<int>& nums) {
int n = nums.size();
vector<int> pos, neg, ans;
for(int i =0; i<n; i++){
if(nums[i]>0) pos.push_back(nums[i]);
else neg.push_back(nums[i]);
}
for(int i =0; i<pos.size(); i++){
... | ALGO | 0.999955 | 5.475369 |
9f20db37-41e4-40dc-abb7-9f9ed37ef356 | Jesan-Sikder/ALGORITHM | slot_c.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
int main() {
ll n;
cin >> n;
vector<ll> p(n);
for (int i = 0; i < n; i++) {
cin >> p[i];
}
ll x, q, r;
cin >> x >> q >> r;
// Using sets to check if x, q, r are in the array
set<ll... | ALGO | 0.99987 | 4.428314 |
bee8ea8b-aca0-478f-a4bc-de9770d7c16e | David-Ortiz-Fernandez/Algorithmic-design | 4-Greedy/EJ24/Source.cpp | #include "Interval.h"
#include "PriorityQueue.h"
#include <iostream>
#include <fstream>
#include <climits>
using namespace std;
int solveCase(int N);
int main() {
#ifndef DOMJUDGE
std::ifstream in("casos.txt");
auto cinbuf = std::cin.rdbuf(in.rdbuf());
#endif
int n;
cin >> n;
while (n!=0) {
cout << solveCa... | ALGO | 0.99978 | 4.681369 |
835065c7-e367-463f-aaed-7883ff38d412 | thirogit/bk2008 | boost_1_55_0/tools/bcp/scan_licence.cpp | #include "licence_info.hpp"
#include "bcp_imp.hpp"
#include "fileview.hpp"
#include <fstream>
#include <iostream>
const int boost_license_lines = 3;
static const std::string boost_license_text[boost_license_lines] = {
"Distributed under the Boost Software License, Version 1.0. (See",
"accompanying file LICENSE_1_0... | TOOL | 0.964908 | 6.744157 |
99af9320-d661-4c92-a66a-f3e21b8e7f7c | geonnho0/study-ps | 프로그래머스/2/42746. 가장 큰 수/가장 큰 수.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
string solution(vector<int> numbers) {
vector<string> strs;
for (int n : numbers)
strs.push_back(to_string(n));
sort(strs.begin(), strs.end(), [](const string& a, const string& b) {
return a + b > b + a;
});
... | ALGO | 0.999906 | 6.307528 |
ee66c70c-8bda-4ae4-b179-00c769c0316c | ishandutta2007/codeforces | xiaowuc1/normal/705/B.cpp | #include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unord... | ALGO | 0.999976 | 3.543635 |
1cac2f7b-c918-4dcd-b731-053e7ab7fcb7 | Ayushluthra2001/LeetCode-upsolving | 100224. Split the Array.cpp | class Solution {
public:
bool isPossibleToSplit(vector<int>& nums) {
unordered_map<int,int>mapping;
for(auto i : nums){
mapping[i]++;
}
for(auto i : mapping){
if(i.second>2) return false;
}
return true;
}
};
| ALGO | 0.999822 | 5.5266 |
b1e5cc79-0be1-4038-b864-f2779c08ec12 | RaymundoGonzalezL/Competitive-Programming | COJ/Brute Force/1176 - Ternary.cpp | #include <iostream>
#include <string.h>
using namespace std;
int main(){
long long int n;
long long int band=0,x=0,r=0;
long long int numero[1000];
while(band!=-1){
cin >> n;
if(n==0)
cout << n << "\n";
else if(n<0)
break;
else{
while(... | ALGO | 0.999955 | 3.542185 |
a6819c19-09a2-4e7c-b9cd-c2dff7cc9955 | HMBSbige/leetcode.thekingofcity | 1.Two Sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int> ret;
vector<int>::iterator it, it_;
vector<int>::iterator _ = nums.begin(), __ = nums.end();
for (it = _; it != __; it++) {
for (it_ = it + 1; it_ != __; it_++) {
if (*it + *it_ == target){
ret.push_back(distan... | ALGO | 0.999915 | 6.05167 |
bbc992c3-d9c8-4392-96f9-49f19ed47128 | khaledmorshed/getx_boilerplate | 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 |
c8581166-9c99-4ee6-ae18-40356a3070b7 | AnuragChoubey95/System-Monitor | linux_parser.cpp | #include <dirent.h>
#include <unistd.h>
#include <sstream>
#include <string>
#include <vector>
#include "linux_parser.h"
using std::stof;
using std::stol;
using std::string;
using std::to_string;
using std::vector;
string LinuxParser::OperatingSystem() {
string line;
string key;
string value;
std::ifstream f... | TOOL | 0.935658 | 4.19603 |
bbfac36d-fa80-4955-92b4-7c29eb8d27a2 | OpenRadioss/OpenRadioss | starter/source/output/tools/ieee.cpp | extern "C" void integer_to_IEEE_ASCII(int entier,unsigned char octet[4]);
extern "C" void IEEE_ASCII_to_integer(int *entier,unsigned char octet[4]);
extern "C" void real_to_IEEE_ASCII(float reel,unsigned char octet[4]);
extern "C" void IEEE_ASCII_to_real(float *reel,unsigned char octet[4]);
extern "C" void double_to_... | TOOL | 0.898731 | 3.687089 |
e073375e-f773-483b-83c5-54ea016e39c1 | IrynaMatuliak/Designing_algorithms | Lab_2/Lab_2/Lab_2.cpp | #include <iostream>
#include <vector>
#include <array>
#include <optional>
#include <stack>
#include <algorithm>
#include <chrono>
#include <random>
#include <set>
#include <fstream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <set>
#include <utility>
#include <unordered_set>
#include <cassert>
#i... | ALGO | 0.995202 | 3.850418 |
53fbb266-0f25-44cb-80c9-a541d050c5ed | AAKASH-YADAV-CODER/Data-Structure-And-Algorithm-Using-C- | 7_Stack/16_redundant_parenthisis.cpp | #include <iostream>
#include <stack>
using namespace std;
int main()
{
string s;
cin >> s;
stack<char> st;
bool ans = false;
for (int i = 0; i < s.size(); i++)
{
if (s[i] == '(' or s[i] == '+' or s[i] == '-' or s[i] == '*' or s[i] == '/')
{
st.push(s[i]);
}
... | ALGO | 0.999818 | 3.626702 |
70297035-500a-4cbd-8d79-ef781b010bc9 | INF1015-2022E/c01-s03-exercices-aurenich | Exercises/_version_prof/tuples.cpp | ///
/// Exemples sur les paires, tuples et liaisons structurées.
///
#include <cstddef>
#include <cstdint>
#include <utility>
#include <tuple>
#include <string>
#include <span>
#include <numeric>
#include <cppitertools/enumerate.hpp>
#include "tuples.hpp"
using namespace std;
using namespace iter;
MinMax findMinM... | ALGO | 0.996813 | 5.493381 |
dd1214fd-69c4-4dea-8de2-6996e0fc5d4c | haghbinh/Rfssa | src/winprod.cpp | // Include necessary headers.
#include <RcppArmadillo.h>
// Load the RcppArmadillo library.
// [[Rcpp::depends(RcppArmadillo)]]
using namespace Rcpp;
// Define a function called 'winprod'.
//'@importFrom Rcpp sourceCpp
// [[Rcpp::export]]
double winprod(arma::mat x, arma::mat y, arma::vec w, arma::mat G) {
// Ge... | ALGO | 0.999925 | 5.733734 |
459deb10-15a6-4f1f-8d87-e2c6faacd93a | tchomphoochan/cmutoi_codes | solutions/programming-in-th/11xx/65-cdiv.cpp | #include <cstdio>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
typedef unsigned long long ll;
int main()
{
int n;
scanf("%d" ,&n);
map<ll, int> numbers[10];
for (int i = 0; i < n; i++)
{
ll number;
scanf("%lld", &number);
for (ll fac = 2; fac... | ALGO | 0.999988 | 4.299023 |
82d5b028-be47-488b-a1b8-006e546cc820 | gulabchan/leetcode-c-challenges | 1091-shortest-path-in-binary-matrix/1091-shortest-path-in-binary-matrix.cpp | class Solution {
public:
int shortestPathBinaryMatrix(vector<vector<int>>& g, int steps = 0) {
queue<pair<int, int>> q;
q.push({ 0, 0 });
while (!q.empty()) {
++steps;
queue<pair<int, int>> q1;
while (!q.empty()) {
auto c = q.front();
q.pop();
if (c.first >= 0 && c.second >= 0 &&... | ALGO | 0.999993 | 6.116107 |
be0ca0d5-7c70-4b6e-99f2-c0a440dcad8b | Gera-Mtz-Rdz/Proyecto-Final. | libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/find.pass.cpp | // <string>
// template<> struct char_traits<wchar_t>
// static const char_type* find(const char_type* s, size_t n, const char_type& a);
// constexpr in C++17
#include <string>
#include <cassert>
#include "test_macros.h"
#if TEST_STD_VER > 14
constexpr bool test_constexpr()
{
constexpr const wchar_t *p = L"123... | TEST | 0.952989 | 6.004947 |
4c123eb1-f319-4dda-afed-fe24e7c68bd5 | iamvinayvk/LeetCode | 283-move-zeroes/283-move-zeroes.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums) {
int pointerZero=-1;
for(int i=0;i<nums.size();i++){
if(nums[i]==0&&pointerZero==-1){
pointerZero=i;
}
else if(pointerZero!=-1&&nums[i]!=0){
swap(nums[pointerZer... | ALGO | 0.999982 | 6.369091 |
1f471d7d-18af-4c47-b8e9-0819eb540bc8 | RafaelRibeiro19/Tlp-10 | intercalares.cpp | #include <iostream>
using namespace std;
void main()
{
int vetor1[10][2],vetor2[20], i, posicion = 0, maior = 25, posicao = 1;
for (i = 0; i < 10; i++)
{
cout << "dame um numero\n";
cin >> vetor1[i][0];
cout << "dame um numero\n";
cin >> vetor1[i][1];
}
for (i = 0; i < 20; i++)
{
vetor2[i] = vetor1[po... | ALGO | 0.995363 | 3.098547 |
3396c347-7ad9-4737-911e-c60bb3bfcdc2 | sulphurx1/Polytechnics-Mauritius | Week 3/001.cpp | #include <iostream>
using namespace std;
int main() {
static int a = 10;
++a;
cout << a << endl;
cout << a << endl;
int b = 20;
++b;
cout << b << endl;
cout << b << endl;
// there are 3 types of datatypes
// primitive data type: integer, character, boolean
// primitive data type takes 4 bytes of mem... | ALGO | 0.888399 | 3.253856 |
64972693-0668-4719-872b-641a3c38620f | SuyogMahajan/DSAwithCplusplus | Unlock.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
void defuse_bomb(vector<int> &v,int k){
unordered_map<int,int> mp;
for(int i=0;i<v.size();i++){
mp[v[i]] = i;
}
int i = 0;
int j = v.size();
while(k){
int idx = mp[j--];
if(... | ALGO | 0.999997 | 3.934806 |
583eadb9-831b-4380-b19a-387cb01fe4b0 | nickkolok/didact-tp | laby-2s/cpp-examples/prehardcoded-input-array1d-void.cpp | /*
С клавиатуры вводится массив из 10 элементов и число n от 0 до 10.
Выведите на экран сумму элементов массива, начиная с n.
*/
#include <iostream>
using namespace std;
void input_array(int mas[], int size){
cout << "Введите массив из " << size << " элементов" << endl;
for (int i = 0; i < size; i++) {
cin >> mas... | ALGO | 0.991055 | 4.165898 |
b1d42809-d344-462d-b77f-27d742654eec | starichockmoh/C-tasks | homework/first sem/templates.cpp | #include <iostream>
#include <vector>
template <typename X> //шаблон функции
std::vector<std::vector<X>> CreateDoubleArray(X c, int n, int m) {//вспомогательная функция для создания двумерного массива
std::vector<std::vector<X>> Arr(n);//инициализируем матрицу
for (int i = 0; i < n; ++i){ //далее заполнем двум... | ALGO | 0.998901 | 3.725035 |
b183948d-68dd-4851-bb84-d70b3341d150 | dexterrxx31/DataStructuresAlgorithms | no_of_anagram_of_a_String.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string arr_in = "forfoforfro"; // input String
int n = arr_in.size(); // size of input String
string arr_ptr = "for"; // Pattern String
int k = arr_ptr.size(); // size of window
unordered_map<char, int> mp;
// fre... | ALGO | 0.999972 | 4.695983 |
f0364a95-db88-4fa3-a662-d8469abf247d | paulhuggett/pstore | lib/command_line/help.cpp | #include "pstore/command_line/command_line.hpp"
#include "pstore/support/array_elements.hpp"
#include <iostream>
#include <iterator>
#include <string>
#ifdef _WIN32
# include <Windows.h>
#else
# include <sys/ioctl.h>
# include <termios.h>
# include <unistd.h>
#endif // _WIN32
namespace {
#ifdef _WIN32
unsign... | TOOL | 0.927805 | 7.805708 |
797ccfd6-a102-4b20-8ebd-d9af25f4163f | yczhangsjtu/SJTU-ACM-OnlineJudge | 1056.cpp | #include <cstdio>
#include <set>
#include <vector>
using namespace std;
typedef struct Box
{
int size;
int index;
int treesize;
int left;
int right;
int father;
Box(){}
Box(int i,int s=1):
size(s),index(i),treesize(1),left(0),right(0),father(0){}
} Box;
bool operator<(const Box &b1, const Box &b2)
{
if(b1.... | ALGO | 0.999837 | 4.016191 |
10367fab-98f2-4198-8f44-ba94ad8d795b | GautamKeshari/DSA_Code | LoveBabbar C++/73a_LargestBSTinBT.cpp | // https://practice.geeksforgeeks.org/problems/largest-bst/1?page=1&category[]=Binary%20Search%20Tree&sortBy=submissions
// //{ Driver Code Starts
// //Initial Template for C++
// #include <bits/stdc++.h>
// using namespace std;
// #define MAX_HEIGHT 100000
// // Tree Node
// struct Node {
// int data;
// No... | ALGO | 0.999771 | 6.590672 |
4f3af82c-c328-4d74-91d0-94ce24f34c1d | szn-cs/reference | cpp/examples/13.Pointers/13.11PointerArithmetic_DistanceBetweenElements/main.cpp | #include <iostream>
int main(){
int scores[10] {11,12,13,14,15,16,17,18,19,20};
//Array index notation
// int * pointer1 {&scores[0]};
// int * pointer2 {&scores[8]};
//Pointer arithmetic notation
int * pointer1 {scores + 0};
int * pointer2 {scores + 8};
std::cout << "pointer2 - poin... | ALGO | 0.941534 | 4.130414 |
f41612f4-4c64-4117-ac3e-509c58762169 | Kaustubh1504/Striver-s-A2Z-DSA-Sheet | binary_tree/left_view.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
vector<int> leftView(struct Node *root);
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->... | ALGO | 0.999613 | 7.090652 |
7d886427-eede-436e-8da4-eb0482e56822 | Amulya-coder/DSA-All-In-One | Arrays/Rotate_Array_to_Right_by_Ksteps.cpp | /*
(Right or counter-clockwise)
Rotate the array to the right by k steps
Input: [1,2,3,4,5,6,7]
K: 3
Output: 5 6 7 1 2 3 4
Explanation:
Rotate array by 1 step to right: [7,1,2,3,4,5,6]
Rotate array by 2 steps to right: [6,7,1,2,3,4,5]
Rotate array by 3 steps to right: [5,6,7,1,2,3,4]
Input: nums = [-1,-100,3,99], k ... | ALGO | 0.999992 | 6.216558 |
090469d5-4704-471f-b05d-66fd776ebd83 | Brustsp/Udacity-self-driving-engineer | path_tracking/MPC/src/Eigen-3.3/bench/sparse_randomsetter.cpp |
#define NOGMM
#define NOMTL
#include <map>
#include <ext/hash_map>
#include <google/dense_hash_map>
#include <google/sparse_hash_map>
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef DENSITY
#define DENSITY 0.01
#endif
#ifndef REPEAT
#define REPEAT 1
#endif
#include "BenchSparseUtil.h"
#ifndef MINDENSITY
#define M... | TOOL | 0.874764 | 4.487392 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.