uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
848ef52a-d512-4fb7-9638-e7612599913a | Johniel/contests | atcoder/abc413/C/main.cpp | // github.com/Johniel/contests
// atcoder/abc413/C/main.cpp
#include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
#define __builtin_popcount(x) __builtin_popcountll(x)
using namespace std;
template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p);
te... | ALGO | 0.997771 | 4.450686 |
c0eec0fd-e769-4408-8464-b6f212e7e7c8 | killer-abhi/Geeks-For-Geeks---DSA | 17 Graph/shortest_path.cpp | #include<bits/stdc++.h>
using namespace std;
void addEdge(vector<int> *adj,int u,int v){
adj[u].push_back(v);
adj[v].push_back(u);
}
void findShortestPath(vector<int> *adj,int v,int sv){
int *dist=new int[v];
bool *visited=new bool[v];
for(int i=0;i<v;i++){
dist[i]=INT_MAX;
visited... | ALGO | 0.999747 | 4.01627 |
8a46647f-c1b6-48d3-be5b-460f7056ded2 | wmyw96/ParallelComputing | hw3/HW3_frogger_x1054028.cpp | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <termios.h>
#include <pthread.h>
#include <time.h>
#include <iostream>
using namespace std;
int width = 41, height;
int cur_x, cur_y;
int num_lane;
double prop[5] = {0.1, 1.0, 0.7, 0.4, 0.0};
int TIME_BASE, TIME_RAND;
int board[55][42];
int game_go_on... | TOOL | 0.898609 | 4.349536 |
482045a4-d15a-4b66-a808-468fe8847530 | ishandutta2007/codeforces | hitman623/normal/1130/A.cpp | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define all(a) (a).begin(),(a).end()
#define x first
#d... | ALGO | 0.999982 | 4.065653 |
5d8c0255-6c4a-4711-9997-dc6cabb3bf6a | BracU-Programmers-Community/Beginner-Batch-02 | B-20_ Complete Search and Backtracking/Codes/perm.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n ;
vector<int> input(n);
for(int i = 0; i<n; i++){
cin>>input[i];
}
sort(input.begin(), input.end());
do{
for(int x : input){
cout<<x<<" ";
}
cout<<endl;
}while(next_pe... | ALGO | 0.999971 | 4.723771 |
9b76b6f4-98b8-45fa-893f-7bbbc7fccd38 | giriraj761/DSA | 4th_sem/SCHOOL/#3rd sem/oops/lab 5/q4.cpp | #include<iostream>
#include<string.h>
using namespace std;
class time
{
public:
int h,m,s;
time() //fixed predefined time
{
h=11;
m=40;
s=12;
}
void display()
{
cout<<"the time is "<<h<<":"<<m<<":"<<s<<"\n";
}
};
void displaysum(time obj1 ,time obj2... | TOOL | 0.900749 | 3.733843 |
3e85b568-e26e-493f-b081-a96fe824c539 | sirAdarsh/CP-files | PRACTICE/test1.cpp | /*----- || Hare Krishna || -----*/
/* "WHY DO WE FALL, BRUCE?" */
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define elif else if
#define PI 3.1415926535897932384
#define MOD 1000000007
using namespace std;
char alpha[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r... | ALGO | 0.999974 | 3.987998 |
2edd163e-ddd4-4f39-8823-d24132c7fb73 | WJ-self/algorithm | .history/acwing/basic/数学知识/约数/875_快速幂_20230903225811.cpp | #include<bits/stdc++.h>
using namespace std;
int n,
longlong a,b,p;
int quick_pow(int a, int b, int p){
int r = 1;
while(b) {
if(b & 1 == 1) r = r*a % p;
a = a*a % p;
b >>= 1;
}
return r;
}
int main() {
cin >> n;
while(n--) {
cin >> a >> b >> p;
cout <... | ALGO | 0.999953 | 4.228358 |
b8abdaff-9fdd-440f-8bc2-025797a6759c | he-guanzhong/LeetCode | Code2/08-BT_subsets.cpp | #include "head.h"
/* 78. 子集
给你一个整数数组 nums ,数组中的元素互不相同。返回该数组所有可能的子集(幂集)。
示例 1:
输入:nums = [1,2,3]
输出:[[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
解集 不能 包含重复的子集。你可以按 任意顺序 返回解集。
示例 2:
输入:nums = [0]
输出:[[],[0]] */
void backtracking(vector<int>& nums,
int index,
vector<int>& path,... | ALGO | 0.999671 | 5.178047 |
b4acbbfb-691e-4703-b927-70d302a44b99 | faludiz/gama | lib/gnu_gama/local/median/g2d_cogo.cpp | /**************************************************************
* 2d coordinate geometry *
**************************************************************/
/*
* In Median in all methods "calculation" was added try / catch
* block. Exceptions g2d_exc are sent by command throw... | ALGO | 0.999751 | 6.161593 |
04fdda2a-52cb-4990-a578-646e45348e18 | RomanUsoltsev/CPP_MATRIX | src/main/InverseMatrix.cpp | //
// Created by roman on 09.07.2022.
//
#include "CppMatrix.h"
S21Matrix S21Matrix::InverseMatrix() {
CheckSquareMatrix();
NullCheck(*this);
double det = Determinant();
double inverse_det = 1.0f / det;
if (MyFabs(det) < 1e-8) throw std::invalid_argument("Invalid Determinant value");
S21Matrix matrix_comp... | ALGO | 0.995566 | 5.499619 |
2c0ad35b-baeb-4856-b738-84e76284cac7 | anuin-cat/QG | Code-2/Calculator/src/main.cpp | #include <cstdio>
#include <iostream>
#include "SqStack.h"
#include "SqStack.cpp"
#include <cstring>
#include <cmath>
#define isNum(x) ((x) <= '9' && (x) >= '0')
using namespace std;
void exceptionOccur(string);
void RPN(int* num, char* opr, char* syn, int* len);
int RPN2RES(int* num, char* opr, int len);
int main... | ALGO | 0.999342 | 3.935478 |
2720e509-49df-4627-bc19-bf9484261b2e | galacean/physX.js | physx/source/geomutils/src/convex/GuConvexHelper.cpp | #include "GuConvexHelper.h"
#include "GuGeometryUnion.h"
#include "GuInternal.h"
#include "PsUtilities.h"
using namespace physx;
using namespace Gu;
// PT: we can't call alloca in a function and we want to avoid defines or duplicating the code. This makes it a bit tricky to write.
void Gu::getScaledConvex( PxVec3*& s... | ALGO | 0.995439 | 7.710986 |
4243d77a-f14b-4747-9093-9558a15dd5aa | MostlyFor/Algorithm_topic | 유형 정리/그래프/bj.1197.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <string>
using namespace std;
// 시간복잡도 O(ElogE + E * a(V)) : a 애커만 함수
// 공간복잡도 O(E+V)
vector<int> per;
vector<int> level;
vector<pair<int,int>> edges; // (가중치, 원래 인덱스)
vector<pair<int, int>> edges_sum; // (노드 1, 노드 2)
... | ALGO | 0.999968 | 4.849901 |
5af19bd5-5a70-4aa7-8d4a-116af3d3b123 | aryankhatuwala/CrackYourPlacement | 0143-reorder-list/0143-reorder-list.cpp | class Solution {
public:
void reorderList(ListNode* head) {
helper(head);
}
ListNode* helper(ListNode* head) {
if (head == nullptr || head->next == nullptr) return head;
ListNode* last = head;
ListNode* prev = head;
while (last->next != nullptr) {
prev = ... | ALGO | 0.999963 | 6.023859 |
e498c72e-21a4-4dad-94fe-07323d5291af | TechTycoon-Jitu/LoveBabbarDSA | Lecture-31-Learning-Recursion-The-Best-Way/power.cpp | #include <iostream>
using namespace std;
int power(int n)
{
// Base case
if (n == 0)
return 1;
// recursive relation
int smallerproblem = power(n - 1);
int biggerproblem = 2 * smallerproblem;
return biggerproblem;
}
int main()
{
cout << "Enter the size->";
int n;
cin >> n;
... | ALGO | 0.999949 | 5.570026 |
6e4cf03d-e201-4e60-8e97-a63a53c9d747 | SPSPRANAV/CS204 | PM_Lab4/Q2.cpp | #include<bits/stdc++.h>
using namespace std;
int flag=0;
class graph
{
public:
int N;
list <int>* adj;
int * color;
int * visited;
graph(int N);
list<int>q;
void add_edge(int x,int y);
void is_bipartite();
void BFS();
void set(int v);
};
graph::graph(int N){
this->N=N;
adj= new list<int>[N];
color = new ... | ALGO | 0.999958 | 4.089922 |
123c0e61-2b04-4bed-a893-5204588ccbb1 | prakharr5/ACMBMU_Hacktoberfest | my_scam.cpp | #include <iostream>
int main() {
int n;
std::cout << "Enter the number of rows for the pyramid: ";
std::cin >> n;
for (int i = 1; i <= n; i++) {
// Print spaces before the stars
for (int j = 1; j <= n - i; j++) {
std::cout << " ";
}
// Print stars for the f... | ALGO | 0.995118 | 5.355309 |
78df40aa-1b23-4b0f-acf1-e40efcb2cba3 | raincross7/code-similarity | codes/train_code/problem129/problem129_148.cpp | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define v(n) int n; cin>>n;
using namespace std;
int main() {
v(a); v(b);
if (a % b == 0) cout << -1 << endl;
else {
int o;
for (int i = 0; i < i + 1; i++) {
o = a * (i + 1);
if (o % b != 0) break;
}
cout << o << endl;
}
} | ALGO | 0.999878 | 3.387521 |
ccd5c26e-992e-4bd1-80fe-c4f73a9853fb | dwivedishubham545/Leetcode | 0206-reverse-linked-list/0206-reverse-linked-list.cpp | class Solution {
public:
ListNode* reverseList(ListNode* head) {
if (head==NULL) return NULL;
ListNode* cur=head, *Next, *prev=NULL;
while(cur!=NULL){
Next=cur->next;
cur->next=prev;
prev=cur;
cur=Next;
}
return prev;
}
}; | ALGO | 0.999503 | 5.406495 |
73913d65-cb12-4a2f-904d-5de896bc1e0d | Hamim-200/Learning_Programming | Basic Data Structures/Module_10/cycle_detect.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *next;
Node(int val)
{
this->val = val;
this->next = NULL;
}
};
int main()
{
Node *head = new Node(10);
Node *a = new Node(20);
Node *b = new Node(30);
Node *c = new Node(40);
head->... | ALGO | 0.999824 | 4.552574 |
de12ba1d-34e3-44c9-b850-85dbdf8e9eda | Achyuthc/Dynamic-Programming | Matrix Chain Multiplication (GFG).cpp | /*Given a sequence of matrices, find the most efficient way to multiply these matrices together. The efficient way is the one that involves the least number of
multiplications.The dimensions of the matrices are given in an array arr[] of size N (such that N = number of matrices + 1) where the ith matrix has the dimens... | ALGO | 0.999993 | 4.418212 |
7d62aa41-9993-4439-90b6-86eec7e205da | kosirobwada/AtCoderSubmit | submissions/abc107/b.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int h, w;
cin >> h >> w;
vector<vector<char>> vec(h, vector<char>(w));
vector<vector<bool>> out(h, vector<bool>(w, true));
bool bou;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
cin >> vec[i][j];
}
}
for (int i = 0;... | ALGO | 0.99998 | 3.36133 |
300d0204-c6cb-45f4-8c15-28bf8df149ba | Yukti-Batra/100-Days_Of_Code | Day53.cpp/Day53.RomanToInteger.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int romanToInt(string s) {
unordered_map<char, int> romanMap = {
{'I', 1},
{'V', 5},
{'X', 10},
{'L', 50},
{'C', 100},
{'D', 500},
{'M', 1000}
}; ... | ALGO | 0.999819 | 5.952618 |
9204751a-d2cc-4eec-8e7e-93c3d992422b | Gaofei244617/Demo | lib/eigen3/test/denseLM.cpp | #include <iostream>
#include <fstream>
#include <iomanip>
#include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template<typename Scalar>
struct DenseLM : DenseFunctor<Scalar>
{
typedef DenseFunctor<Scalar> Base;
typedef typename Base::JacobianType JacobianType;
typed... | TEST | 0.967994 | 5.862647 |
6a1ebd59-1ff7-4c50-bfd2-ecf01f3ac8d3 | bentlemon/TDDC73-Project-Login-Page | Flutter_login/create_acc_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.998576 | 6.76775 |
fb1599d9-447d-47ab-82a4-129d3fd279e0 | amantiwari8861/Data-Structures-and-Algorithm-with-CPP | Code in cpp/ArmstrongNumber/main.cpp | #include <iostream>
using namespace std;
int main()
{
int num, temp, rem, arm=0;
cout<<"Enter a number: ";
cin>>num;
temp = num;
while(num>0)
{
rem = num%10;
arm = arm + (rem*rem*rem);
num = num/10;
}
if(temp==arm)
cout<<"It is an Armstrong number"<<endl;
... | ALGO | 0.999309 | 4.093743 |
4519429d-f532-4a5f-b93a-25662364a424 | kaiumuddin/DSA-Codes | Dynamic_Programming_Phitron/26.Longest_common_subsequence/4.lc_substring_tabu___lc_substring_print.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1005;
vector<vector<int>> dp(N, vector<int>(N, 0));
int solve(string a, int n, string b, int m)
{
for (int i = 0; i <= n;i++) {
for (int j = 0; j <= m; j++) {
if (i == 0 || j == 0)
dp[i][j] = 0;
}
}
for... | ALGO | 0.999987 | 4.470067 |
20f33423-a92d-4965-aedd-91c9bd5f72d4 | wjwhhhhhh/ACM_ | codeforces/Codeforces Round 892 (Div. 2)/1859D.cpp | #include <bits/stdc++.h>
#define dug(x) cerr << "死了吧小丑" << x << endl
using namespace std;
using i64 = long long;
template <class T> void chkmax(T &a, T b)
{
a > b ? (a = a) : (a = b);
}
template <class T> void chkmin(T &a, T b)
{
a > b ? (a = b) : (a = a);
}
struct DSU
{
std::vector<int> f, siz;
DSU()
... | ALGO | 0.999911 | 4.390924 |
691a3610-473a-43b3-9032-01e1aa3910f5 | aoaforever/C_trian | Leetcode/tree/652_findDuplicateSubtrees.cpp | #include "TreeNode.h"
#include <vector>
#include <unordered_map>
#include <string>
using namespace std;
class Solution {
public:
vector<TreeNode*> findDuplicateSubtrees(TreeNode* root) {
find(root);
return res;
}
private:
vector<TreeNode*> res;
unordered_map<string,int> dup;
string ... | ALGO | 0.998899 | 5.617111 |
a6f7b7c7-461a-46e7-b91c-a5bd2afafd0c | TeamNyx/external_opencv | cxcore/src/cxminmaxloc.cpp | #include "_cxcore.h"
/****************************************************************************************\
* MinMaxLoc *
\****************************************************************************************/
... | ALGO | 0.99897 | 6.675497 |
bd7ea592-35a1-4391-92af-3f1d15560843 | pedronihwl/2d-physics | Engine/src/Physics/CollisionDetector.cpp | #include "CollisionDetector.h"
bool CollisionDetector::IsColliding(Particle* a, Particle* b, Contract& contract) {
if (a->shape->GetType() == CIRCLE && b->shape->GetType() == CIRCLE) {
return CollisionDetector::IsCollidingCircleCircle(a, b, contract);
}
if ((a->shape->GetType() == POLYGON || a->shape->GetType()... | ALGO | 0.993212 | 5.600844 |
1b88d399-b29d-4eeb-a41e-f357305d440e | rraghu30/DSA-Practice | swapalt.cpp | #include<iostream>
using namespace std;
void printArray(int arr[], int n)
{
for(int i = 0; i<n; i++)
{
cout<< arr[i] <<" ";
}
cout<<endl;
}
void swapAlternate(int arr[], int size)
{
for(int i = 0; i<size; i+=2 )
{
if(i+1 < size)
{
swap(arr[i], arr[i+1]);
... | ALGO | 0.999502 | 5.035398 |
722fb2e0-d675-4e9c-a569-de2c1d2be60e | pratyush1712/encryption | main.cpp | #include <iostream>
#include <cstdlib>
#include <sstream>
#include <iomanip>
#include <thread>
#include <vector>
#include <mutex>
#include "bignum.hpp"
const Bignum rsa_n = Bignum("961654026701305847725376297729342506337924345847359381690045401972111757000324880811399265283685752965867557035683506718471520123051990736... | ALGO | 0.995472 | 5.527069 |
acecc970-5335-46b1-8e72-84c2daaab686 | guilhermesilveira/uva-problems | archive/ok/2618/c.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
double precos[100010];
int prod[100010];
int lista[200];
double como[200];
void tenta(int l, int tot) {
for (int i = 0; i != l; i++)
como[i] = -1;
int maxi = 0;
for (int i = 0; i != tot; i++) {
... | ALGO | 0.98924 | 3.282559 |
e4407ca8-9d31-4688-a7c7-6a27d994dbfb | shoaib842/6companies30dayschallenge | Trim a Binary Search Tree/main.cpp | class Solution {
public:
TreeNode* trimBST(TreeNode* root, int low, int high) {
if (root == nullptr)
return nullptr;
if (root->val < low)
return trimBST(root->right, low, high);
if (root->val > high)
return trimBST(root->left, low, high);
root->lef... | ALGO | 0.999995 | 6.823745 |
aea1a174-5817-4ea2-8f6d-4786ace5acb6 | ArchitKumar1/LeetCode-Submissions | walking-robot-simulation-ii/Compile Error/11-14-2021, 5:14:42 AM/Solution.cpp | // https://leetcode.com/problems/walking-robot-simulation-ii
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){cout<<name<<" : "<<arg1<<endl;}
template<typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){const char* comma=... | ALGO | 0.99984 | 4.829132 |
5d7f9402-ddf0-47ee-820e-e9d1b6ccda23 | cybeko/proj_ForwardList | proj_ForwardList/List.cpp | #include <iostream>
using namespace std;
struct Element
{
char data;
Element* Next;
};
//
class List
{
//
Element* Head;
//
Element* Tail;
//
int Count;
public:
//
List();
//
~List();
//
// ( )
void Add(char data);
void AddPos(char data, int pos);
int SearchPos(char data);
//... | ALGO | 0.998837 | 3.586368 |
cfe19291-3486-4812-9278-475144d63dc0 | Ostrichcrab/solution | tiantisai/l1-056.cpp | #include<iostream>
#include<map>
#include<string>
using namespace std;
int main()
{
map<string,int> mp;
int n; cin>>n;
int i;
string name;
int val,avg,sum=0,numMax=1000;
for(int i = 0; i < n; i++)
{
cin>>name>>val;
mp[name]=val;
sum += val;
}
avg = sum /n /2;
map<string,int>::iterator it... | ALGO | 0.999777 | 4.779729 |
861cfb7c-4024-4b06-98c5-b3f8a7860f81 | sarvex/leetcode-d | solution/1600-1699/1679.Max Number of K-Sum Pairs/Solution.cpp | class Solution {
public:
int maxOperations(vector<int>& nums, int k) {
sort(nums.begin(), nums.end());
int cnt = 0;
int i = 0, j = nums.size() - 1;
while (i < j) {
if (nums[i] + nums[j] == k) {
i++;
j--;
cnt++;
}... | ALGO | 0.999951 | 6.226375 |
24dbb91e-4373-45da-a98a-4bc1d322777a | luohongk/SuperVINS | supervins_estimator/src/factor/marginalization_factor.cpp | #include "marginalization_factor.h"
void ResidualBlockInfo::Evaluate()
{
residuals.resize(cost_function->num_residuals());
std::vector<int> block_sizes = cost_function->parameter_block_sizes();
raw_jacobians = new double *[block_sizes.size()];
jacobians.resize(block_sizes.size());
for (int i = 0;... | ALGO | 0.999247 | 5.150388 |
eaf132bf-1fb3-45f7-b192-1493cb665010 | samvandensteen/AIP | aif_lib/tools/branch_reader.cpp | #include <iostream>
#include <cstdint>
#include <fstream>
#include "branch_file.pb.h"
#include "branch_file_util.h"
#include "proto_reader.h"
using std::endl;
using std::cout;
using branch_file::Entropy_Window;
int main(int argc, char* argv[]){
if(argc < 3){
cout << "Usage: ./branch_reader <path to branch file> ... | TOOL | 0.866186 | 4.300378 |
941f2f30-d2ff-4262-aef8-24cbba122c63 | nxphuc/LeetCode | algorithms/0096-unique-binary-search-trees.cpp | // Title: Unique Binary Search Trees
// Source: https://leetcode.com/problems/unique-binary-search-trees
// Difficulty: Medium
// Tags: Math, Dynamic Programming, Tree, Binary Search Tree, Binary Tree
// Author: nxphuc
// Time Complexity: O(N^2)
// Space Complexity: O(N^2)
// Note:
/**
* Given an integer n, return t... | ALGO | 0.999991 | 7.054574 |
d88aaf23-f9a7-4711-b7bf-03e7b89af596 | Kaushal-11/CodeForces-Problem-Solution | 1833C.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
while(n--){
int size, x,even = 0, odd =0,mini = INT_MAX;
cin>>size;
while(size--){
cin>>x;
mini = min(mini, x);
if(x % 2 == 1) odd++ ;
else even++;
}
... | ALGO | 0.999736 | 3.875744 |
1c359058-6828-4fc1-a3cc-0c4cdd88133f | Henrik-Yao/NEUQ-ACM-Solution | week2/侯浩宇/汉诺塔.cpp | #include<bits/stdc++.h>
using namespace std;
int countt=0;
void move(char a,int n,char c){
countt++;
cout<<a<<"->"<<c<<endl;
}
void hanoi(int n,char a,char b,char c){
if(n==1)
move(a,1,c);
else
{
hanoi(n-1,a,c,b);
move(a,n,c);
hanoi(n-1,b,a,c);
}
}
int main(void){
int n;
ci... | ALGO | 0.999992 | 4.179532 |
489203ad-ff2b-4904-8c4a-f42ea2419a3c | himanshugupta09/LEETCODE_SOLUTIONS | 1889-check-if-number-is-a-sum-of-powers-of-three/1889-check-if-number-is-a-sum-of-powers-of-three.cpp | class Solution {
public:
bool checkPowersOfThree(int n) {
while(n > 0)
{
if(n%3 == 2)
{
return false;
}
n /= 3;
}
return true;
}
}; | ALGO | 0.999448 | 5.667019 |
32d0f027-8373-4e1b-809e-fb870da8d6c3 | Aryan810/programming | learn/learn_cpp/codeforces/global_round_28/B_Kevin_and_Permutation.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define vi vector<int>
#define vii vector<int>::iterator
#define vlli vector<ll>::iterator
#define vll vector<ll>
#define rep(i, n) for(int i=... | ALGO | 0.999959 | 4.030731 |
aff2d280-556b-4dc3-8691-4cc7d24c4ca2 | anoobzg/qi | src/blender/src/source/blender/compositor/operations/COM_DenoiseOperation.cpp | #include "COM_DenoiseOperation.h"
#include "BLI_math.h"
#include "BLI_system.h"
#ifdef WITH_OPENIMAGEDENOISE
# include "BLI_threads.h"
# include <OpenImageDenoise/oidn.hpp>
static pthread_mutex_t oidn_lock = BLI_MUTEX_INITIALIZER;
#endif
#include <iostream>
DenoiseOperation::DenoiseOperation() : SingleThreadedOperat... | TOOL | 0.922553 | 5.608093 |
888c1118-06b4-441b-bae5-302d80515c32 | RinCloud/TrickCatcher | Datasets/TrickyBugs/PUT_cpp/p03112/sol_114.cpp | #include<bits/stdc++.h>
#define LL long long
using namespace std;
int a,b,n;
const LL INF=1e16;
set <LL> s,t;
set <LL>::iterator it,it1,it2;
int main()
{
LL x;
scanf("%d%d%d",&a,&b,&n);
for (int i=1;i<=a;i++) scanf("%lld",&x),s.insert(x);
for (int i=1;i<=b;i++) scanf("%lld",&x),t.insert(x);
for (int i=1;i<=n;i++)... | ALGO | 0.999481 | 3.293078 |
382ac564-72d0-4acf-93c0-61b3ff979149 | QI1002/library | NVIDIA_GPU_Computing_SDK/C/src/binomialOptions/binomialOptions_gold.cpp | #include <stdio.h>
#include <math.h>
#include "binomialOptions_common.h"
///////////////////////////////////////////////////////////////////////////////
// Polynomial approximation of cumulative normal distribution function
///////////////////////////////////////////////////////////////////////////////
static double C... | ALGO | 0.99992 | 7.432131 |
4a207780-d78d-4224-a87c-06b4d3227a5d | codehub001/CrackYourInternship | Populating Next Right Pointers in Each Node.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(int _val, Node* _left, Node* _right, Node* _next)
: val(_... | ALGO | 0.999878 | 5.739063 |
9c91b48a-fcbd-42d1-9b75-c5c5884f6aab | vovkasm/jsc-android | webkit/Source/JavaScriptCore/dfg/DFGPutStackSinkingPhase.cpp | #include "config.h"
#include "DFGPutStackSinkingPhase.h"
#if ENABLE(DFG_JIT)
#include "ButterflyInlines.h"
#include "DFGBlockMapInlines.h"
#include "DFGGraph.h"
#include "DFGInsertionSet.h"
#include "DFGPhase.h"
#include "DFGPreciseLocalClobberize.h"
#include "DFGSSACalculator.h"
#include "OperandsInlines.h"
namespa... | TOOL | 0.870872 | 7.863059 |
04df1da5-b865-4385-b152-4cd255ec4c66 | Romasa102/CompetitiveProgramming | ABC/ABCC/ABC348/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define repp(i,o,n) for(ll i = o; i < (n); ++i)
using P = pair<ll,ll>;
int main(){
ll N;
cin >> N;
rep(i,N){
if(i%3==2){
cout << "x";
}else{
cout << "o";
... | ALGO | 0.99925 | 3.610316 |
439995e4-257c-4e32-97af-788a2a503611 | ishandutta2007/codeforces | spacewalker/normal/501/B.cpp | #include <iostream>
#include <map>
#include <string>
#include <set>
using namespace std;
int main() {
int n; cin >> n;
map<string, string> handles; //newName->oldName
while (n--) {
string oldName, newName;
cin >> oldName >> newName;
if (handles.find(oldName) == handles.end()) {
handles[newName] = oldName;
... | ALGO | 0.9997 | 4.773251 |
dc540e69-4a75-44c3-99a3-1444adb9dc74 | wusai2333/Exercise | 45. Jump Game II/BFS O(N).cpp | class Solution {
public:
int jump(vector<int>& nums)
{
if (nums.size() < 2) { return (0); }
int level = 0, currentMax = 0, i = 0, nextMax = 0;
while (currentMax - i + 1 > 0) // nodes count of currentlevel is greater than 0
{
level++;
for ( ; i <= currentMax; i++) // traverse currentlevel and update the... | ALGO | 0.999991 | 5.831652 |
d7b44b4e-cc01-42ed-9d15-2b42ffc976f2 | harun-u-r-rashid/XPSC | 9th week/Day 05/Arithmetic Array.cpp |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n;
cin>>n;
vector<int>a(n);
int sum = 0;
for(int i=0; i<n; i++)
{
cin>>a[i];
sum+=a[i];
}
int ans;
if(sum==n)... | ALGO | 0.999904 | 3.852443 |
59857442-8163-4d7a-8d66-347ec4893ed2 | Manjunath-Jakaraddi/Competitive-Coding | hackerrank/dp/largestsquare.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define MOD 1000000007
#define pb push_back
#define pf printf
#define sf scanf
#define all(v) v.begin(), v.end()
#define rep(i, s, e) for(auto i=s; i<=e; i++)
#define loop(i, n) ... | ALGO | 0.999951 | 3.995078 |
da98cde6-ac6f-46ed-8ac2-34c7ff589aab | fearlessghoul/Competitive-Programming | DATA STRUCTURES/Stacks/Expressions/Conversions/PostfixToInfix.cpp | #include <bits/stdc++.h>
using namespace std;
bool isOperator(char c){
return (c == '+' || c == '-' || c == '*' || c == '/' || c == '^');
}
string postfixToInfix(const string &postfix){
stack<string> s;
for (size_t i = 0; i < postfix.length(); i++){
char c = postfix[i];
if (isalnum(c)){
... | ALGO | 0.999836 | 6.315634 |
44ade329-bdfd-496a-a42d-9a4edb3e2530 | tmuttaqueen/MyCodes | Online Judge Code/[Other] Online-Judge-Solutions-master_from github/Live Archive/5066 - Fire Drill.cpp | #include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
struct node{
int f,r,c,dist;
node(){}
node(int _f, int _r, int _c, int _dist){
f = _f; r = _r; c = _c; dist = _dist;
}
};
char M[10][100][101];
int f[100],r[100],c[100],p[100];
int rs,cs,... | ALGO | 0.999341 | 4.347498 |
dd5992c8-a483-4f40-b59f-37daa46c5020 | riscv-spectre-mitigations/llvm_retpoline | libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp | // <algorithm>
// template<InputIterator Iter, Predicate<auto, Iter::value_type> Pred>
// requires CopyConstructible<Pred>
// constexpr Iter::difference_type // constexpr after C++17
// count_if(Iter first, Iter last, Pred pred);
#include <algorithm>
#include <functional>
#include <cassert>
#include "test_ma... | TEST | 0.957057 | 6.901881 |
5b788e14-2c33-4407-a24e-bd85c20e233c | lemezohaib/android_frameworks_av-2 | media/libmedia/CharacterEncodingDetector.cpp | //#define LOG_NDEBUG 0
#define LOG_TAG "CharacterEncodingDector"
#include <utils/Log.h>
#include <media/CharacterEncodingDetector.h>
#include "CharacterEncodingDetectorTables.h"
#include <utils/Vector.h>
#include <media/StringArray.h>
#include <unicode/ucnv.h>
#include <unicode/ucsdet.h>
#include <unicode/ustring.h>... | TOOL | 0.885144 | 4.541462 |
0a527291-228c-4a49-b728-66be7ca7535c | ishandutta2007/codeforces | yuma_/normal/1334/E.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<vector>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<iomanip>
#include<assert.h>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<stack>
#include<complex>
#include<memory>
#include<numeric>
/*
#pragma GCC ta... | ALGO | 0.999864 | 5.555308 |
e826d547-0a24-451b-a317-38c644b0d675 | divyeshjethava/LeetCode | 54-spiral-matrix/spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& mat) {
int m = mat.size();
int n = mat[0].size();
int srow = 0,erow = m-1,scol = 0,ecol = n - 1;
vector<int> ans;
while(srow<=erow && scol <= ecol){
for(int i = scol;i <= ecol;i++){
... | ALGO | 0.999999 | 6.307525 |
7e9f5eed-5fb1-4b34-9500-6a1957e81194 | raincross7/code-similarity | codes/train_code/problem390/problem390_334.cpp | // g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>... | ALGO | 0.999851 | 3.434197 |
4fa1f11b-f444-42b7-b75a-f182c54aa31f | powerLEO101/Work | Code/CEDL_test/C2-huangzile2018-8-27/message.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <stack>
#include <vector>
#define File(s) freopen(#s".in", "r", stdin); freopen(#s".out", "w", stdout)
#define gi get_int()
#define _ 1000
int get_int()
{
int x = 0, y = 1; char ch = getchar();
while ((ch < '0' || ch > '9') && ch !... | ALGO | 0.999983 | 4.160249 |
2cf03398-a766-4f4d-ac27-610b13fad8bc | coolyuyuyu/leetcode | algorithm_0000-0999/912-Sort an Array/main.cpp | class Solution {
public:
void quicksort(vector<int>& nums, int lo, int hi) {
if (lo >= hi) {
return;
}
// S S S S M M M M ? ? ? ? ? ? L L L L
// i k j
int pivot = nums[lo + (hi - lo) / 2];
int i = lo, k = lo, j = hi;
while (k... | ALGO | 0.999991 | 5.451375 |
749441f6-c3bd-44c7-acd3-eaa918fe893d | mdsouza176/MazeRunner | ass3.cpp | #include <iostream>
#include <string>
using namespace std;
void testX(string &S, int k) {
for (int i = 0; i < S.length(); i++) {
if (S[i] == '-') {
S[i] = NULL;
}
}
string r = "";
for (int i = 0; i < S.length(); i++) {
if (S[i] != NULL) {
r += S[i];
}
}
string change = "";
for (int i = 0; i < S.l... | ALGO | 0.988911 | 3.29991 |
e15ae91d-4d13-4057-938a-001881b3912a | Madophs/Data-Structures-and-Algorithms-Specialization | algorithmic-toolbox/week-4/Closest_Points.cpp | #include <bits/stdc++.h>
template <typename Arg, typename... Args>
void debug(std::ostream& out, Arg&& arg, Args&&... args)
{
out << std::forward<Arg>(arg);
using expander = int[];
(void)expander{0, (void(out << " " << std::forward<Args>(args)), 0)...};
out << std::endl;
}
using namespace std;
typede... | ALGO | 0.999897 | 4.802675 |
880595eb-ff03-4a29-a004-83963323f8a5 | pphamducminh/A_thuattoan | Graph/BFS 01/ZOO_coci19.cpp | //******************/
//* I<3 C++ */
//* I WANT ANY AC */
//* I LOVE PROGRAM!*/
//*IT'S INTERESTING*/
//* I LOVE PROGRAM!*/
//* IN CONTESTS */
//* GET SCORE */
//* AC CODE */
//* LET'S */
//* GO */
//* Written by: */
//* Duc Minh */
// bfs 01
//
// https://oj.uz/pr... | ALGO | 0.99993 | 4.201897 |
d3c14924-0330-4f0d-807e-ba0f2fba406d | Kullsno2/C-Cpp-Programs | SplitCircularLinkedListintoTwo.cpp | #include<iostream>
using namespace std ;
struct node{
int val ;
struct node * next ;
node(int x) : val(x) , next(NULL){}
};
void print(struct node * head)
{
if(!head){
cout<<"empty"<<endl;
return ;
}
struct node * t = head ;
cout<<t->val<<" ";
t = t->next;
while(t != head){
cout<<t->val<<" ",t =t -> n... | ALGO | 0.999188 | 3.216106 |
d3de9f0c-1335-4fab-aab4-1bc08d5326df | zkxshg/Test_of_LeetCode | 287_Find_the_Duplicate_Number.cpp | // O(n2) brute force
class Solution {
public:
int findDuplicate(vector<int>& nums) {
int n1 = nums.size();
int res = 0;
int cou = 0;
for (int i = 1; i < n1; i++){
cou = 0;
for (int j = 0; j < n1; j++){
if (nums[j] == i) cou++;
}
... | ALGO | 0.999975 | 5.941614 |
36ce07ed-4211-4199-b61a-1e85520253ab | geekysn/-CrackYourIntership | group_anagrams.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vvi vector<vector<int>>
#define vvc vector<vector<char>>
#define pp pair<int, int>
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
unordered_map<string, vector<string>> anagramGroups;
fo... | ALGO | 0.999998 | 6.46154 |
23b6bbf7-8722-490f-87f2-0c456a6cecec | mjmiah/AdventOfCode2020 | Day 3/task1.cpp | #include <iostream>
#include <vector>
#include <fstream>
using namespace std;
int main()
{
vector<string> lines; //stores each line of the file
string line;
ifstream myfile ("data.txt");
if (myfile.is_open()) //reading the file with the input data
{
while ( getline (myfile,line) )
... | ALGO | 0.999153 | 4.645668 |
57b956bc-32dd-4694-aa5b-9ec9e93f6ebb | fuzongjian/sword_offer_vs | 1-20/18_02_deleteDuplicatedNode.cpp | #include <iostream>
#include <string>
#include <cstdio>
/*
题目:删除链表中的重复结点
在一个排序的链表中,如何删除重复的结点?
*/
struct ListNode
{
int m_nValue;
ListNode* m_pNext;
};
class List
{
public:
static ListNode* createListNode(int value)
{
ListNode * pNode = new ListNode();
pNode->m_nValue = value;
pNo... | ALGO | 0.999908 | 4.190759 |
ccc499e2-bf90-4e59-82fa-3ed32f328692 | kmjp/procon | atcoder/past001-040/past005/j.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#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 FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999958 | 3.596362 |
8b39d508-618c-45ab-9582-9b3fb7ba156c | Shivam5259/OOP-Lab- | Lab 2/task_2.cpp | #include <iostream>
#include <iomanip>
using namespace std;
void input(int **arr, int m, int n);
void display(int **arr, int m, int n);
void add(int **matrix1, int **matrix2, int m, int n);
void subtract(int **matrix1, int **matrix2, int m, int n);
void deallocate(int **arr, int m);
int main(){
int m, n;
cout... | ALGO | 0.984863 | 4.192057 |
113d4e58-6725-41f1-a03b-826de81b3823 | bogdanov-mikhail/itmo-cpp-programming | practice-2/4/2_4.cpp | //
// Created by bogda on 27.09.2023.
//
#include <iostream>
#include <cmath>
using namespace std;
int main2_4() {
system("chcp 65001");
const int required_score = 50;
int current_score = 0;
int shots = 0;
while (current_score < required_score) {
shots++;
float x, y;
std:... | TOOL | 0.859727 | 3.995821 |
5979f274-8764-4637-ba72-3e991d4619d3 | ghy60/bitcoin-probe | src/consensus/merkle.cpp | #include <consensus/merkle.h>
#include <hash.h>
#include <util/check.h>
/* WARNING! If you're reading this because you're learning about crypto
and/or designing a new system that will use merkle trees, keep in mind
that the following merkle tree algorithm has a serious flaw related to
duplicat... | ALGO | 0.999827 | 7.47119 |
ae04c3a3-09f9-46ff-9a70-c2afd94c53a3 | ishandutta2007/codeforces | robezh/normal/960/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k1,k2;
int num1[1050],num2[1050];
int dif[1050];
int fabs(int a){
return a > 0 ? a : -a;
}
int main(){
cin >> n >> k1 >> k2;
for(int i = 0; i < n; i++) cin >> num1[i];
for(int i = 0; i < n; i++) cin >> num2[i], dif[i] = fabs(n... | ALGO | 0.999908 | 3.457935 |
74a672a3-2e2e-492e-be32-a1c1ca1f9e30 | RenanMota-03/recicla_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.9988 | 6.76073 |
0bd131c0-86c5-4262-bfc3-d538cb3685a2 | iniyan007/Leetcode_problems | 0179-largest-number/0179-largest-number.cpp | class Solution {
public:
string largestNumber(vector<int>& nums) {
vector<string>n1;
for(int i= 0; i<nums.size();i++){
n1.push_back(to_string(nums[i]));
}
sort(n1.begin(), n1.end(), [](const string&a, const string&b){
return (a+b)>(b+a);
});
if... | ALGO | 0.999995 | 6.264426 |
81b918a2-1b59-48db-860e-6acee481edf7 | qorcjftns/GBA4iOS9 | emu-ex-plus-alpha/GBA.emu/src/vbam/gba/gbafilter.cpp | #include "gbafilter.h"
#include <math.h>
extern int systemColorDepth;
extern int systemRedShift;
extern int systemGreenShift;
extern int systemBlueShift;
static const unsigned char curve[32] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x10, 0x12,
0x14, 0x16, 0x18, 0x1c, 0x20, 0x28, 0x30, 0x38,
0x40... | TOOL | 0.98349 | 4.498862 |
490bebce-21c6-45bb-896f-726bb8c7b7e6 | safinghoghabori/data-structures | recursion/fibonacci.cpp | #include<iostream>
using namespace std;
int fib(int n)
{
if(n==0)
{
return 0;
}
if(n==1)
{
return 1;
}
int smallOutput1=fib(n-1);
cout<<"smallOutput1-->"<<smallOutput1<<" n-->"<<n<<endl;
int smallOutput2=fib(n-2);
cout<<"smallOutput2-->"<<smallOutput2<<" n-->"<... | ALGO | 0.99999 | 4.546188 |
e4175449-9957-4077-9e73-a9d8b9f487a3 | NicolodeL/Coleccion-de-Ejercicios-Clase-String | Ejercicio 5/main.cpp | #include <iostream>
int main() {
std::string str = "Inteligencia Artificial";
std::cout << "Cadena original: " << str << std::endl;
std::string sub_str = str.substr(13, 9); // "Artificial"
std::cout << "Subcadena: " << sub_str << std::endl;
str.insert(0, "La "); // "La Inteligencia Artificial"
... | TOOL | 0.888462 | 3.866782 |
2672b771-5f6d-431d-a734-1fbb41417712 | Vladimir-Lapushkin/https---github.com-Vladimir-Lapushkin-MIPT-1cours-2semestr | week5/E.cpp | #include <iostream>
bool reserve_memory(size_t N, int *dst) {
if (dst == nullptr) {
dst = new int[N];
return true;
} else {
return false;
}
}
void free_memory(const int* ptr) {
delete[] ptr;
}
int main() {
int* ptr = nullptr;
size_t N = 0;
std::cin >> N;
std::c... | TOOL | 0.944459 | 3.652924 |
463ac035-e95f-4220-88c4-60e72409771d | ShinsuSenju/Practice-Questions | my-folder/3451-string-compression-iii/solution.cpp | class Solution {
public:
string compressedString(string word) {
string comp="";
int count = 1;
for (int i = 0; i < word.size() - 1; i++) {
if (word[i] == word[i + 1]) {
count++;
} else {
while (count > 9) {
c... | ALGO | 0.999987 | 6.144509 |
83b139c3-3c95-4b37-88f1-dfc991d51985 | ishandutta2007/codeforces | davidberard/normal/1091/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef long double ld;
ll n;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> n;
vector<ll> fac;
set<ll> ans;
for(ll i = 1;i*i <= n;++i) {
if(n%i == 0) {
fac.push_back(n... | ALGO | 0.999809 | 4.34048 |
e4215ffc-ab46-4593-8eee-e7de4e6cf5ba | abhishek3stp/notes | DataStructure/Queue/Queue-Linked-List.cpp | #include <bits/stdc++.h>
using namespace std;
class Queue
{
int csize;
list<int> l;
public:
Queue()
{
csize = 0;
}
bool empty()
{
return csize == 0;
}
void push(int data)
{
l.push_back(data);
csize++;
}
void pop()
{
if (!em... | ALGO | 0.998525 | 4.620811 |
5f3dfe58-05da-44cc-b5e1-ac1827b4c980 | KwanPitsinee/POSN | division.cpp | #include<bits/stdc++.h>
using namespace std;
int p[1000005];
int main(){
for(int i=1;i<=1000000;i++){
for(int j=i;j<=1000000;j+=i){
p[j]++;
}
}
int n;
cin>>n;
for(int i=1;i<=n;i++){
int x,y,z;
cin>>x>>y>>z;
int m=0;
for(int j=x;j<=y;j++){
if(p[j]==z){
m++;
}
... | ALGO | 0.999625 | 4.176485 |
efdc6a4b-ad00-4182-9eba-3ca1c3ecc24b | jarrett-taylor-repos/CodingChallenges | Coding Challanges/Amazon/Problem 1/main.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'reduceGifts' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER_ARRAY prices
* 2. INTEGER k
* 3. INTEGER thr... | ALGO | 0.999653 | 4.903477 |
58098cad-5852-4432-a8d2-d1cc06c3dbd6 | shkk941111/Algorithms | selection_sort/selection_sort_ver_1.cpp | #include <iostream>
using namespace std;
int main()
{
int arr[] = {5,7,2,4,1,3,9,8,6};
for(int i=0;i<(sizeof(arr)/sizeof(int)-1);i++)
{
int minPos = i;//The position of the i-th minimum value
//sort
for(int j=i+1;j<(sizeof(arr)/sizeof(int));j++)
{
minPos = arr[j] < arr[minPos] ? j : minPos;
}
c... | ALGO | 0.999961 | 3.841821 |
01c8253e-d95a-4ab6-a113-85a443fd0564 | anmamun0/cp-problem-solving-zone | xWeek_11/Topic_Different_Array/C_Two_TVs.cpp | #include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
#define str string
#define X first
... | ALGO | 0.999954 | 4.390882 |
df6f51b9-37a2-4065-820a-d7e52005db6b | built-different-13/Cpp-Programming-Language- | Operators and For Loop/print1.cpp | #include <iostream>
using namespace std;
int main() {
int i;
cout << "Enter the first number" << endl;
cin >> i;
int j;
cout << "Enter the second number" << endl;
cin >> j;
cout << "The numbers from " << i << " to " << j << " are printed below" << endl;
for (; i<=j; ++i) {
cout <... | TOOL | 0.996357 | 3.548596 |
cf5b358f-903f-4f55-964d-154bf453743b | changaolee/leetcode | 0001-0050/0010/solution.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
bool isMatch(string s, string p) {
int n = s.length(), m = p.length();
s = ' ' + s, p = ' ' + p;
vector<vector<bool>> f(n + 1, vector<bool>(m + 1));
f[0][0] = true;
for (int i = 0; i <= n; i... | ALGO | 0.998516 | 5.522052 |
a15697da-5968-4612-9ff7-6fc4d5c84304 | fuxiang90/code-fuxiang90 | cpp/codeforce/176-2-b.cpp | #include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;
//typedef __int64_t long long
//__int64 a;
//__int64_t a;
typedef unsigned long long ull;
unsigned long long n;
unsigned long long k;
unsigned long long getMin(ull i)
{
return (2+ (2+i-1) )*i /2 - (i-1);
}
unsigned long long getMax(ull i)
... | ALGO | 0.99987 | 3.753734 |
d82bf732-7efa-4de2-bbc7-f62d3cd99aca | Kartik-Mathur/DSA-4th-May-Batch- | L16-CharacterArrays/4_Substrings.cpp | #include <iostream>
using namespace std;
int main() {
char a[] = "abcd";
int lena = strlen(a);
for (int i = 0; i < lena; ++i)
{
for (int j = i; j < lena; ++j)
{
for (int k = i; k <= j; ++k)
{
cout << a[k];
}
cout << endl;
}
}
return 0;
}
| ALGO | 0.999488 | 3.25017 |
a5c964d4-3527-4c3d-be5a-6da948b4cd88 | NiladreeDatta/Binary-Search-Algorithm | SPOJ nimmit in trouble number theory + binary search.cpp | #include<bits/stdc++.h>
using namespace std;
const int me = 100025;
int t;
long long int n,k;
int seive[me];
vector <long long> primes;
int main()
{
for(int i = 2 ; i < me ; i++)
{
if(!seive[i])
{
primes.push_back(1LL*i*i);
for(int j = i + i ; j < me ; j += i)
... | ALGO | 0.999916 | 4.624868 |
288d0d68-d8b2-4347-9dd0-7e45cddf1484 | alok-karn/Advanced-Programming | vectors/firstVector.cpp | #include<bits/stdc++.h>
using namespace std::chrono;
using namespace std;
int main() {
vector<int> v = {1, 2, 3, 4, 5};
auto start = high_resolution_clock::now();
cout << v[0] << endl;
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
cout... | ALGO | 0.922595 | 5.192114 |
dd3f3fc5-0c86-4a99-a813-7097ecddb106 | KaranGulve4342/DSA | Heap/MergeKSortedArrays.cpp | // LEETCODE 23
/*
class cmp{
public:
bool operator()(const ListNode* l1, const ListNode* l2){
return l1->val > l2->val;
}
};
class Solution{
public:
ListNode* mergeKLists(vector<ListNode*>& lists){
priority_queue<ListNode*, vector<ListNode*>, cmp>pq;
for(int i = 0;i < lists.si... | ALGO | 0.999928 | 5.833175 |
9b99b6af-2c6c-4fb9-9cf7-3ad0a8ed38e7 | sarvex/leetcode-pharo | solution/1200-1299/1249.Minimum Remove to Make Valid Parentheses/Solution.cpp | class Solution {
public:
string minRemoveToMakeValid(string s) {
string stk;
int x = 0;
for (char& c : s) {
if (c == ')' && x == 0) continue;
if (c == '(')
++x;
else if (c == ')')
--x;
stk.push_back(c);
}... | ALGO | 0.99996 | 6.321692 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.