uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f16a4bc5-e3e7-443d-88ab-ddd00ab496c2 | Vedant5751/GFG-Solutions | Print GFG n times.cpp | class Solution
{
public:
void printGfg(int N)
{
if (N != 0)
{
printGfg(N - 1);
cout << "GFG ";
}
}
}; | ALGO | 0.999327 | 4.184282 |
9dbdc651-cf49-4866-a5e9-99d081bcc7ea | raincross7/code-similarity | codes/train_code/problem459/problem459_126.cpp | #include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
#define mod2 998244353
void fast(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
}
long long binpow(long long a, long long b) {
long long res = 1;
... | ALGO | 0.999973 | 4.918773 |
2db7d90b-4a86-40ea-919d-b52bbe01845a | juanfelipe1104/DobleGradoSegundo | Q2/Algoritmos/Examenes/Examen2/mochila.cpp | #include <iostream>
#include "Objeto.h"
int mochilaVoraz(Objeto *objetos, int pesoMaximo, int numObjetos);
void bubbleSort(Objeto *objetos, int numObjetos);
int main(){
int pesoMaximo = 0, numObjetos = 0;
std::cin >> pesoMaximo;
std::cin >> numObjetos;
Objeto *objetos = new Objeto[numObjetos];
for... | ALGO | 0.999893 | 4.500104 |
cc91adf1-ac30-456b-a981-f50b74459b93 | ishandutta2007/codeforces | noam527/normal/1329/C.cpp | #include <bits/stdc++.h>
#define finish(x) return cout << x << endl, 0
typedef long long ll;
typedef long double ldb;
const int md = 1e9 + 7;
const ll inf = 2e18;
const int OO = 1;
const int OOO = 1;
using namespace std;
int n, m;
vector<int> a;
bool can(int x) {
if (x > m) {
if (a[x] == 0) return false;
return ... | ALGO | 0.999955 | 4.207619 |
a04e280d-4b50-467b-81a2-1b9b5f8ffc50 | Bijiazhou/Divide_Conquer | 二分查找.cpp | //
// Created by 岳晨阳 on 2019/12/18.
//
int BinarySerach(int iDatas[],int iLen,int &k){
int iLeft = 0,iRight = iLen - 1,iMid = 0;
while (iLeft <= iRight){
iMid = (iLeft + iRight)/2;
if(k == iDatas[iMid])
return iMid;
if(k < iDatas[iMid])
iRight = iMid - 1;
... | ALGO | 0.997853 | 3.144203 |
25cf59eb-d657-49ad-96d9-da3bb87d723e | AdityaShekharTiwary/code_for_fun | Maximum pairwise product.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
class Solution
{
public:
long MaxProduct(vector<int> &nums)
{
long first = 0, second = 0;
for (int i = 0; i < nums.size(); i++)
{
if (nums[i] > first)
{
second = first;
first = nums[i];
}
... | ALGO | 0.999937 | 4.530618 |
84f93db2-63f5-4d6a-91b5-478b3925347c | eklavyaK/codeforces-solutions | ZeroPath.cpp | #define PROGRAM int main(){rapid_iostream;int tc=1;cin>>tc;while(tc-->0){codeforce();}return 0;}
#define Compare(u) class Comp{public: bool operator() (u a, u b){return a.F < b.F;}};
#define rapid_iostream cin.tie(0)->sync_with_stdio(0)
#define _pq(u) priority_queue<u,vector<u>, Comp>
#define binary(n,k) bitset<k>(n).t... | ALGO | 0.999973 | 4.049734 |
79ca7a31-db1f-443c-b5c1-dd83734a955e | Colorisa77/cpp-search-server | search-server/main.cpp | #include "request_queue.h"
#include "process_queries.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void PrintDocument(const Document& document) {
cout << "{ "s
<< "document_id = "s << document.id << ", "s
<< "relevance = "s << document.relevance << ", "s
<<... | TEST | 0.908308 | 4.943871 |
3e68599e-aec7-4d8e-87f4-7d7540986186 | Mrhuangyi/leetcode-Solutions | Cpp/Easy/326. 3的幂.cpp | 给定一个整数,写一个函数来判断它是否是 3 的幂次方。
示例 1:
输入: 27
输出: true
示例 2:
输入: 0
输出: false
示例 3:
输入: 9
输出: true
示例 4:
输入: 45
输出: false
进阶:
你能不使用循环或者递归来完成本题吗?
循环写法:
class Solution {
public:
bool isPowerOfThree(int n) {
if(n<=0){
return false;
}
while(n>1){
if(n%3!=0){
... | ALGO | 0.999727 | 5.732748 |
82ca50ba-bd4c-4875-a17b-2b77748dab61 | mahedee/gen-code-sample | CrackingTheCodingInterview/ctci-master-5thed/c++/Chapter 17/Question17_1.cpp | #include <iostream>
using namespace std;
void swap(int*, int*);
void swap_alternate(int&, int&);
void swap(int* a, int* b) {
(*a) = (*a) - (*b);
(*b) = (*a) + (*b);
(*a) = (*b) - (*a);
}
void swap(int& a, int& b) {
a = a^b;
b = a^b;
a = a^b;
}
int main() {
int num1 = 10, num2 = 20;
cout << "\n-----------... | ALGO | 0.999151 | 5.268361 |
9b5ae275-c110-4172-baa6-40a544d31109 | Aryan-kamal/Leetcode-submissions | 0207-course-schedule/0207-course-schedule.cpp | class Solution {
public:
bool canFinish(int numCourses, vector<vector<int>>& prerequisites) {
int N=numCourses;
vector<vector<int>>adj(N);
for(auto it: prerequisites)
adj[it[0]].push_back(it[1]);
vector<int> indegree(N, 0);
for(int i=0;i<N;i++){
for(a... | ALGO | 0.999708 | 6.290676 |
a83a1bcb-8275-4baf-b35d-77bc28f52f08 | jaydip1235/placewit-white-swans-dsa | Strings/first-repeated-char.cpp |
string firstRepChar(string s)
{
map<char, int> mp;
string ans = "";
for (int i = 0; i < s.size(); i++)
{
mp[s[i]]++;
if (mp[s[i]] == 2)
{
return ans + s[i];
}
}
return "-1";
} | ALGO | 0.999988 | 4.108224 |
232ec8ed-123b-4224-88ba-9f1b17ff2158 | whybfq/Kehan-Academy-algorithm | Floyd-Warshall.cpp | /*********************************************************************************
*@copyright (C) 2018 san All Rights Reserved
*@file Floyd-Warshall.cpp
*@date Sep 2018
*@author san
*@CMAKE_CXX_STANDARD 17
*@IDE: Clion 2018.3
*@OS: macOS High Sierra 10.13.6
*
*@brief: the Floyd-Warshall... | ALGO | 0.999942 | 5.261156 |
f476ec7e-9f4e-4bb0-b527-e31de33bcdd4 | vishal8113/Data-Structures-And-Algo | Arrays/Hard/reversePairs.cpp | // arr[] = {40,25,19,12,9,6,2}
// i < j && arr[i] > 2 * arr[j]
// ans = 15
Brute Force
#include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[] = {40,25,19,12,9,6,2};
int n = sizeof(arr)/sizeof(arr[0]);
int cnt = 0;
for(int i = 0; i < n; ++i)
{
for(int j = i + 1; j < n; ++j)
... | ALGO | 0.999776 | 4.456954 |
438ab34a-a91d-4a92-80a8-6a9d1f29a9ac | amankumar6/CPP | a2oj/AhmedAl.cpp | #include <bits/stdc++.h>
using namespace std;
#define c(a) cin>>a;
#define ll long long int
#define f0(i,a,n) for(ll i=a;i<n-1;i++)
#define f(i,a,n) for(ll i=a;i<n;i++)
#define f1(i,a,n) for(ll i=a;i<=n;i++)
#define T ll t=1; cin>>t; while(t--)
#define nl cout<<endl;
#define fast ios_base::sync_with_stdio(false); cin.... | ALGO | 0.999639 | 3.95248 |
bbdecc79-4bab-426a-b2da-517f1c85ee89 | khushisinha20/Data-Structures-and-Algorithms | Basic Algorithms/Sliding Window/grumpy_bookstore.cpp | //leetcode.com/problems/grumpy-bookstore-owner
#include <bits/stdc++.h>
#include <vector>
using namespace std;
class Solution {
public:
int maxSatisfied(vector<int>& customers, vector<int>& grumpy, int minutes) {
int start = 0;
int non_grumpy_sum = 0;
int max_satisfied_customers = 0;
... | ALGO | 0.999567 | 6.530529 |
b27183c6-2f6d-4403-bc14-2385d4f24853 | jagannath-nayak/DSA | C++ STL/Iterators/Basics.cpp | #include<iostream>
#include<vector>
#include<forward_list>
#include<list>
using namespace std;
int main(){
// vector<int> arr;
// arr.push_back(10);
// arr.push_back(20);
// arr.push_back(30);
// vector<int> :: iterator it = arr.begin();
// while(it != arr.end()){
// cout << *it << " "... | TOOL | 0.96609 | 3.20635 |
0089636c-8f79-4eb6-b0e4-6bd6fcd32acd | Amarjeet264/DSA-problems | 188-best-time-to-buy-and-sell-stock-iv/best-time-to-buy-and-sell-stock-iv.cpp | class Solution {
int pro(int k,vector<int>&prices,int buy,int i,vector<vector<vector<int>>>&dp){
if(i>=prices.size()){
return 0;
}
if(dp[i][buy][k]!=-1)return dp[i][buy][k];
if(k==0){
return 0;
}
if(buy){
return dp[i][buy][k]= max(-... | ALGO | 0.999947 | 5.726573 |
163ae14a-a413-4806-a5da-2480121406bb | nandinicodes1/My-DSA | Tree/even after odd.cpp | #include <iostream>
using namespace std;
class node{
public:
int data;
node * next;
node(int data){
this->data=data;
this->next=NULL;
}
};
node* takeinput(int n){
int data;
int count=0;
cin>>data;
node* head=NULL,*tail=NULL;
while(count<n){
node *newnode=new ... | ALGO | 0.999914 | 4.201027 |
5333ac80-f50c-48ec-9873-17faabc50c23 | Hoooray666/c_codes | Stack.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Stack{
int size;
char *top;
char *base;
};
Stack* creatstack();
char getTop(Stack *s1);
void push(Stack *s1, char a);
void pop(Stack *s1);
int main(){
char shuzu[100];
char top;
int i=0;
Stack *s = creatstack();
scanf("%s", shuzu);
int l... | ALGO | 0.999948 | 3.283771 |
a9e015d6-a3f4-448a-b778-bcfebb2a28a3 | Intermodalics/pcl-debian | tools/icp2d.cpp | #include <pcl/console/parse.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/registration/icp.h>
#include <pcl/registration/icp_nl.h>
#include <pcl/registration/transformation_estimation_lm.h>
#include <pcl/registration/warp_point_rigid_3d.h>
#include <string>
#include <iostream>
#include <fstr... | ALGO | 0.939948 | 5.787538 |
6137a180-c7ed-408a-ad8e-f97649f6dcbd | deniscostadsc/data-structures-and-algorithms-specialization | algorithmic-toolbox/week4_divide_and_conquer/2_majority_element/majority_element.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using std::vector;
int get_majority_element(vector<int> &a, int left, int right) {
if (left == right) return -1;
if (left + 1 == right) return a[left];
//write your code here
return -1;
}
int main() {
int n;
std::cin >> n;
vector<int> a(n);
f... | ALGO | 0.999932 | 4.436155 |
bf249f73-18db-4faf-8795-3fbceca73248 | ishandutta2007/codeforces | ei133333/normal/434/A.cpp | #include<bits/stdc++.h>
using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;
const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10)... | ALGO | 0.999956 | 4.981643 |
aeb3f2c1-00d4-48d8-8f33-2d461cbdc002 | atsalrizandri/STD_Muhammad_Atsal_Rizandri_21104057 | 06_Double_Linked_List_Bagian_1/TP/SOAL_03.cpp | #include <iostream>
using namespace std;
struct Node
{
int data;
Node *next;
Node *prev;
};
typedef Node *List;
void insertLast_21104057(List &L, int value)
{
Node *newNode = new Node;
newNode->data = value;
newNode->next = nullptr;
if (L == nullptr)
{
newNode->prev = nullptr... | ALGO | 0.99961 | 4.48778 |
25108859-d41a-49ad-a9c8-a132fe39c3f7 | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/dpp_generated_progs_cpp/p03383/p03383_num2_parsed.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool isSymmetric(vector<string>& grid, int H, int W) {
for (int i = 0; i < H / 2; i++) {
for (int j = 0; j < W / 2; j++) {
if (grid[i][j] != grid[H - 1 - i][W - 1 - j]) {
return false;
}
... | ALGO | 0.999984 | 6.01254 |
1a48423e-7ff2-44d9-b419-e3e1f4e9c15d | chiunachiuna/2022c | week14/week14-4d.cpp | #include<stdio.h>
int main()
{
int n,i=1;
scanf("%d",&n);
while(n>0)
{
printf("%d ",(n%10)*i);
n/=10;
i*=10;
}
}
| ALGO | 0.99983 | 3.057545 |
7ec90bc5-303f-46a2-a044-b286d4352186 | geekboxzone/mmallow_ndk | sources/cxx-stl/llvm-libc++/libcxx/test/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp | // <algorithm>
// template<BidirectionalIterator InIter, BidirectionalIterator OutIter>
// requires OutputIterator<OutIter, InIter::reference>
// OutIter
// copy_backward(InIter first, InIter last, OutIter result);
#include <algorithm>
#include <cassert>
#include "test_iterators.h"
template <class InIter, cla... | TEST | 0.95971 | 6.824315 |
f9f57187-f50e-48db-b883-fabb9a8cb18f | Leonardo16AM/ICPC-WF-2023-UH-Top | Team-reference-2023/math/simplex.cpp | // Description:
// Solve a canonical LP:
// min. c x
// s.t. A x <= b
// x >= 0
const double eps = 1e-9, oo = numeric_limits<double>::infinity();
typedef vector<double> vec;
typedef vector<vec> mat;
double simplexMethodPD(mat &A, vec &b, vec &c){
int n = c.size(), m = b.size();
mat T(m + 1, vec(n + m + 1)... | ALGO | 0.999935 | 5.266448 |
e723f8cb-499a-4a53-8689-72b2467661d0 | KU-ALPS-15/Algorithm-Practice_kihyun | alps/alps/균형잡힌세상.cpp | #include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
class Stack {
private:
int point = 0;
char box[101];
bool TOF = true;
public:
void init() {
point = 0;
TOF = true;
}
void add(char ch) { box[point++] = ch; }
void pop() { point--; }
bool isEmpty() { return point == 0; }
bool get... | ALGO | 0.999847 | 4.041479 |
de86340f-4bba-4ee6-a7fa-eabe38d7ac9b | ysy1369/SortingAlgorithm_SpeedTest | Source Codes/CPP/Merge.cpp | #include "Merge.h"
template <class T>
void Merge<T>::recursiveMerge(T i[],const int s)
{
const int sm = s/2;
const int me = s - sm;
T *arrLeft,*arrRight;
if(s>1)
{
arrLeft = new T[sm];
arrRight = new T[me];
arrCopy(i,arrLeft,sm);
arrCopy(i+sm,arrRight,me);
recursiveMerge(arrLeft,sm);
recursiveMerg... | ALGO | 0.999944 | 4.199245 |
4fac91f5-b524-45b0-94b7-d51431976807 | TicoHsueh/PAT | Advanced Level/1061_Dating (20)【字符串】.cpp | #include<string>
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
string s[7]={"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
string a, b, c, d, ans;
cin >> a >> b >> c >> d;
int lena = a.length(), lenb = b.length(), lenc = c.length(), lend = d.length();
int i, count = 1;
... | ALGO | 0.99986 | 3.354238 |
c131ddb4-f9a0-43ce-8a71-04913ddb3252 | Ali-Tahseen/Data_Structures_Algorithms | 8_Linked_List/Linked_List_Insert/main.cpp | #include <stdio.h>
#include <stdlib.h>
// Define structure for node
struct Node {
int data;
struct Node *next;
} *first = NULL;
// Function to create linked list
void create(int A[], int n) {
int i;
struct Node *t, *last;
// Create the first node
first = (struct Node *)malloc(sizeof(struct Nod... | ALGO | 0.999977 | 4.963697 |
654424bb-b465-42b0-8f46-6c09f5941a1e | SiddhantBhosale05/Decision-Making-Statements | Positive and Negative.cpp | //Name:Siddhant Kiran Bhosale
//PRN:23070123038
//Aim:Implementation of Decision Making Statements to find Positive and Negative number
#include <iostream>
using namespace std;
int main() {
float num;
cout << "Enter a number: ";
cin >> num;
if(num>0)
{
cout << "The num is POSITIVE";
}
... | ALGO | 0.998879 | 3.543859 |
47bc1763-b14b-4824-9b4c-ae7ccd9e5bba | khanhnamle1994/technical-interview-prep | LeetCode/Possible-Bipartition.cpp | /* Given a set of N people (numbered 1, 2, ..., N), we would like to split everyone into two groups of any size.
Each person may dislike some other people, and they should not go into the same group.
Formally, if dislikes[i] = [a, b], it means it is not allowed to put the people numbered a and b into the same group.
... | ALGO | 0.999875 | 6.193269 |
f0a9379b-c705-4207-b653-dfc48f81118f | Lyd1995/Leetcode | C++/188. 买卖股票的最佳时机 IV.cpp | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<math.h>
#include<sstream>
using namespace std;
class Solution {
public:
int maxProfit(int k, vector<int>& prices) {
if(prices.size() == 0 || prices.size() == 1)
... | ALGO | 0.999783 | 5.159379 |
9876e2c8-1005-4dd4-a9e1-711815c70160 | MrZuXii/Algorytmy-i-Struktury-Danych | praktyka/2.1.cpp | #include <iostream>
#include <vector>
using namespace std;
int linearSearch(vector<int> items, int x) {
const int n = size(items);
int i = 0;
while (i < n) {
if (items[i] == x) return i;
i = i + 1;
}
return -1;
}
int linearSearch2(vector<int> items, int x) {
const int n = siz... | ALGO | 0.999386 | 5.292719 |
a694485d-c4ed-4f5b-bcf8-7b1e764f022e | sajtj/Basics-Of-Programming | 01 assignment/01.p8.cpp | #include<iostream>
using namespace std;
int main(){
int a;
cin >> a;
for (int i = 1; i <= a; i++)
{
for (int j = 1; j <= i; j++)
{
cout << "*";
}
cout << endl;
}
return 0;
}
| ALGO | 0.999963 | 3.88456 |
b4f25cf4-786d-40dd-bdb6-424c02440e9d | dip4012/Striver_SDE_Sheet | Arrays Part 4/longest_subarray_with_k_sum.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int maxLen(vector<int> &A, int n)
{
unordered_map<int, int> mp;
int maxLen = 0;
int sum = 0;
for (int i = 0; i < n; i++)
{
sum += A[i];
if (sum == 0)
{
... | ALGO | 0.999922 | 5.347608 |
071abf4d-9f2b-4e49-9dca-a80f56130559 | kaloronahuang/KaloronaCodebase | Practices/LibreOJ/LOJ6003.cpp | // LOJ6003.cpp
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e4 + 100, INF = 0x3f3f3f3f;
int head[MAX_N], current, s, t, dep[MAX_N], cur[MAX_N], n, tot, upward[MAX_N], tag[MAX_N], unit;
struct edge
{
int to, nxt, weight;
} edges[500010];
void addpath(int src, int dst, int weight)
{
edges[curr... | ALGO | 0.999958 | 3.718701 |
fcf7823a-8520-4e1b-802b-98bbdc0aaa29 | rajveer-09/DSAleetcode | Unique rows in boolean matrix - GFG/unique-rows-in-boolean-matrix.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
#define MAX 1000
vector<vector<int>> uniqueRow(int M[MAX][MAX],int row,int col);
// } Driver Code Ends
class Solution
{
public:
// #define MAX 1000
vector<vector<int>> uniqueRow(int M[MAX][MAX],int row,int col)
{
//Your code h... | ALGO | 0.999292 | 4.712072 |
91cacfe7-c159-4328-8ee1-cee52bf75598 | dtlavendar/DStructuresNAlgos | Segment_Tree.cpp | #include <bits/stdc++.h>
using namespace std;
struct segment_tree_queries {
using T = long long;
vector<T> tree;
vector<T> a;
int N;
segment_tree_queries(vector<T> &arr) {
N = arr.size();
assert(N <= 2e7);
// you're pushing it close with a segment tree anyways
tree.resize(4 * N);
a = vector<T>(arr.begin... | ALGO | 0.9995 | 4.964938 |
2aa5b7e1-f65c-4aa2-966c-7c71a31c4f07 | 22388o/test | src/crypto/hmac_sha512.cpp | #include <crypto/hmac_sha512.h>
#include <string.h>
CHMAC_SHA512::CHMAC_SHA512(const unsigned char* key, size_t keylen)
{
unsigned char rkey[128];
if (keylen <= 128) {
memcpy(rkey, key, keylen);
memset(rkey + keylen, 0, 128 - keylen);
} else {
CSHA512().Write(key, keylen).Finalize(... | ALGO | 0.93776 | 5.726457 |
7faf7491-22e2-4214-b0c1-9ba02acce072 | patpro28/maketest | dethi/hsg8vinh2025c2/sol/correct.cpp | /*
Author: Tu Pham Anh
Date: 2025/04/15 - 20:09
*/
#include <bits/stdc++.h>
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL), cout.tie(NULL);
string s;
cin >> s;
int cntS[3] = {0, 0, 0};
f... | ALGO | 0.999193 | 5.479308 |
6ac68aa7-d66b-46a8-86fc-c2be040fd776 | miraehab/LeetCode-July-Daily-Challenges-2022 | 118. Pascal's Triangle.cpp | class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> triangle;
for(int i = 1; i <= numRows; ++i){
vector<int> tmp(i);
tmp[0] = 1;
tmp[i-1] = 1;
triangle.push_back(tmp);
}
for(int... | ALGO | 0.999989 | 5.974712 |
475520b0-36df-4e2c-adcc-5b4fd15f72f2 | DragonKrissash/TLE | Level 1/Summing_the_N_series.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define vi vector<int>
#define MOD (ll)(1e9+7)
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
signed main(){
fastio
int tc;cin>>tc;
while(tc--){
ll n;
cin>>n;
ll mod=(n%MOD);
m... | ALGO | 0.997831 | 4.847049 |
92c208a3-8cb9-43f8-86ce-8f2182109270 | trinhminhtriet/leetcode | solutions/0900-0999/0993.cousins-in-binary-tree/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.999988 | 6.230993 |
f310b440-e9ad-4a0d-8907-e1a0e98edec3 | Tamimkhan7/CF-Contest | Random/A Raising Bacteria.cpp | #include <bits/stdc++.h>
using namespace std;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define faster \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define mod 1000000007
typedef long long int ll;
... | ALGO | 0.999822 | 4.566674 |
67733fcc-b1be-4686-b6c7-c7591647e2bd | yashrbankar/My-Learning | Data Structures/DSA for placement/Array week/d5_intersection.cpp | #include <bits/stdc++.h>
using namespace std;
int sear(int arr[], int n, int key)
{
for (int i = 0; i < n; i++)
{
if (arr[i] == key)
{
return 1;
}
}
return -1;
}
void intersection()
{
int A[] = {4, 3, 1, 6, 7};
int B[] = {6, 8, 3, 7, 9};
int C[10];
i... | ALGO | 0.999325 | 3.873334 |
436d2cda-737d-4912-bf4a-c962c46e4b18 | jakubowiczish/WDI | inne/2012 rozne/Liczby wieksze od co najmniej 3 poprzednich/main.cpp | #include <iostream>
/*
Prosze napisac program czytajacy z wejscia liczby typu integer i wypisujacy na wyjsciu te z nich,
ktre sa wieksze od przynajmniej trzech poprzednich. Prosze rozwazyc przypadki dla ciagu
wejsciowego o dowolnej dugosci.
*/
using namespace std;
int main()
{
int a,b,c,d;
int liczba;
cin>... | ALGO | 0.999783 | 3.453122 |
58c8c2c8-6704-4ce8-af7d-ff591434d361 | AmanPatodia/Codes-Programming | DSA (Love Bubber)/reversearr.cpp | #include<iostream>
using namespace std;
void swap(int *a, int *b)
{
int temp=*a;
*a=*b;
*b=temp;
}
void reverse(int arr[],int s)
{
int i=0,j=s-1;
while(i<=j)
{
swap(&arr[i],&arr[j]);
i++;
j--;
}
}
int main()
{
int arr1[6]={2,7,5,9,6};
reverse(arr1,5);
f... | ALGO | 0.998854 | 4.049653 |
af5e4b87-c7c3-471d-a78a-8d58064383a0 | SURYAPRAKASHKALYANAM/LEETCODE-GFG-SOLVED-SOLUTIONS | 3657-check-if-grid-can-be-cut-into-sections/3657-check-if-grid-can-be-cut-into-sections.cpp | class Solution {
public:
bool checkValidCuts(int n, vector<vector<int>>& rectangles) {
vector<vector<int>> yaxis, xaxis;
vector<vector<int>> ymerged, xmerged;
for (auto i : rectangles) {
yaxis.push_back({i[1], i[3]});
xaxis.push_back({i[0], i[2]});
}
s... | ALGO | 0.999875 | 6.087617 |
85fed3e9-97c4-4c0a-afa8-c5a5dedfa6fa | kobe24o/LeetCode | 剑指Offer/30.bao-han-minhan-shu-de-zhan-lcof.cpp | class MinStack {
stack<int> s;
int MIN;
int tp;
public:
/** initialize your data structure here. */
MinStack() {}
void push(int x) {
if(s.empty())
{
s.push(x);
s.push(x);
}
else
{
MIN = s.top() < x ? s.top() : x;
... | ALGO | 0.999977 | 5.790371 |
21296c68-db6e-41a9-a964-78a8954f5359 | khushbu123-hub/final-project | opencv-master/samples/cpp/stereo_calib.cpp | #include "opencv2/calib3d.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
using namespace cv;
using namespace s... | TOOL | 0.988463 | 6.24072 |
d40b9d7c-a5e1-4148-88bf-76f4c2790b45 | NavdeepKaurRupaul/IP-DSA | 12 STACK AND QUEUE/Minimum bracket Reversal.cpp | #include <iostream>
using namespace std;
#include<stack>
#include<cstring>
int countBracketReversals(char input[]){
stack<char> s;
// can you see this
int len=strlen(input);
if(len==0)
return 0;
if(len%2 !=0) {
return -1;
}
for(int i=0;i<len;i++){
if(input[i]=='{'){
... | ALGO | 0.997974 | 5.102305 |
7f65201a-d235-462f-a739-76988dc8d04c | mj0840/BaekJoon_C | 백준 5988 홀수일까 짝수일까.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
int main() {
int n, tmp;
char k[61];
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%s", k);
tmp = (int)k[strlen(k) - 1] - 48;
if (tmp % 2) printf("odd\n");
else printf("even\n");
}
return 0;
} | ALGO | 0.999074 | 3.673686 |
82cf128e-d30e-4d30-ab22-910df0d981d9 | ishandutta2007/codeforces | hongzy/normal/512/E.cpp | #include <bits/stdc++.h>
#define pb push_back
#define rep(i, j, k) for(int i = j; i <= k; ++ i)
#define per(i, j, k) for(int i = j; i >= k; -- i)
using namespace std;
const int N = 1024;
int n;
struct node {
int x, y;
};
struct space {
bool G[N][N], rev;
void read() {
rep(i, 1, n) G[i][i == n ? 1 : i + 1] = G... | ALGO | 0.99992 | 3.200155 |
71e7a2ba-65ae-4d36-8b9e-98ac63899c4f | Abhishek9503/June-DSA | Find the Closest Element in BST - GFG/find-the-closest-element-in-bst.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// } Driver Code Ends
/*
Tree Node
struct Node {
int data;
Nod... | ALGO | 0.999833 | 6.190385 |
8ecfdf81-3cdc-42e3-a8a7-a54a54b3a949 | DOGANAY06/Veri-Yap-lar-C- | hanoikulelerifondongusuyle.cpp | #include <iostream>
using namespace std;
int exp(int n){
int two=1;
for (int i=0; i<n; ++i){
two *= 2;
}
two = two-1;
return two;
}
int main()
{
int disk;
int start=1;
int middle=2;
int last=3;
cout << "Please enter the number of disks: ";
cin >> disk;
cout << e... | ALGO | 0.999831 | 4.84906 |
51ee533a-51b7-45df-9ecc-7f996754841a | kidsofspeed/gaddis | Chapter06/pr6-32B.cpp | // This program writes the ABCs in green, red, and yellow,
// displaying them diagonally across the screen so they
// appear to be climbing up a staircase.
#include <iostream>
#include <windows.h> // Needed to display colors and call Sleep
using namespace std;
// Prototype
void printSpaces(int n);
int main()... | ALGO | 0.949838 | 3.908801 |
210b11f5-14b5-429b-8c16-ba7755aa08c4 | 21p31a0563/OWL-CODER | 1798-max-number-of-k-sum-pairs/max-number-of-k-sum-pairs.cpp | class Solution {
public:
int maxOperations(vector<int>& nums, int k) {
sort(nums.begin(), nums.end());
int i = 0;
int j = nums.size() - 1;
int cnt = 0;
while(i < j) {
if(nums[i] + nums[j] == k) {
cnt++;
i++;
j--;
... | ALGO | 0.999961 | 6.172649 |
05b07094-8000-4969-9b33-1356715011bc | ktak2001/algorithm | AOJ/intro1/4.cpp | #include <iostream>
using namespace std;
void func(int a, int **num, int idx)
{
if (idx < 0)
return ;
(*num)[idx] = (a % 60);
if ((a / 60) > 0)
func(a / 60, num, idx - 1);
}
int main()
{
int a;
int *num;
num = new int[3];
for (int i = 0; i < 3; i++)
num[i] = 0;
cin >> a;
func(a, &num, 2);
cout << num... | ALGO | 0.971515 | 3.77555 |
5761b759-e2d8-44ff-a50e-5d3d75d653b3 | Rinnnt/CompetitiveProgramming | Baekjoon/10885.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl '\n'
const ll mod = 1000000007;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t;
cin >> t;
while (t--){
int n;
cin >> n;
vector<int> a(n + 1, 0);
for (int i = 0; i < n; i++)
cin... | ALGO | 0.99978 | 4.585067 |
c43e8a9c-2adf-4f00-8d25-20239797c515 | arangodb/arangodb | 3rdParty/boost/1.78.0/libs/numeric/ublas/doc/samples/matrix_binary_scalar.cpp | #include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = 3 * i + j;
std::cout << 2.0... | ALGO | 0.966559 | 3.700392 |
64febe48-acbc-4bb8-a6c5-27a563f5641a | agrawal-ris/competitive | Codeforces/Codeforces - 1097A.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
string s, t;
cin>>t;
int c = 0;
for (int i = 0;i<5;i++)
{
cin>>s;
if (s[0] == t[0] || s[1] == t[1])
c = 1;
}
if (c==1)
cout<<"YES";
else
cout<<"NO";
return 0;
}
| ALGO | 0.999855 | 3.638911 |
0abf5b1f-357b-4a77-9062-944af84e3463 | VishnubpriyaA/Data-structures | Implementation of Circular Linked Lists and Applications of Linked List/Task manager using linked list.cpp | //Develop an employee job scheduling system using a circular linked list. Traverse through all the employee
//tasks one at a time. And find out which employee completes the allotted task first.
//Example:
//Input:
//ID: 001
//Name: AAA
//Number of Tasks: 3
//ID: 002
//Name: AAA
//Number of Tasks: 4
//ID: 003
//Name: AA... | ALGO | 0.99993 | 6.401758 |
5c5a980b-180c-4db8-be60-ebdc513df08a | Benjaminhvenegaard/NummMeth | NummMeth-problems/Source Code/legacy/nr2/CPP_211/recipes/sor.cpp | #include <cmath>
#include "nr.h"
using namespace std;
void NR::sor(Mat_I_DP &a, Mat_I_DP &b, Mat_I_DP &c, Mat_I_DP &d, Mat_I_DP &e,
Mat_I_DP &f, Mat_IO_DP &u, const DP rjac)
{
const int MAXITS=1000;
const DP EPS=1.0e-13;
int j,l,n,ipass,jsw,lsw;
DP anorm,anormf=0.0,omega=1.0,resid;
int jmax=a.nrows();
for (j=1... | ALGO | 0.999988 | 3.764042 |
eae8c7bf-9d5a-4564-a46e-d80ab4becedc | ishandutta2007/codeforces | bohdanpastuschak/normal/610/A.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <unordered_map>
#includ... | ALGO | 0.999942 | 4.101997 |
6d2825e0-cb78-4cbe-bb7c-4d0d077cfd45 | SammedSankonatti/Leetcode | C++/137.SingleNumberII.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int singleNumber(vector<int> &nums)
{
map<int, int> mp;
for (int i = 0; i < nums.size(); i++)
{
mp[nums[i]]++;
}
for (auto it : mp)
{
if (it.second == 1)
... | ALGO | 0.999913 | 5.182602 |
6b0d5990-ac57-4c1a-ba2c-3de1a62bd094 | Mohammed-Ihab/Robotics-Program-Codeforces-Tasks | sheet_1_src/brothers.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
string first1, first2, second1, second2;
cin >> first1 >> second1 >> first2 >> second2;
if(second1 == second2){
cout << "ARE Brothers" << endl;
} else{
cout << "NOT" << endl;
}
return 0;
} | ALGO | 0.961205 | 3.27575 |
e84d98f7-2d5d-45e7-96f1-80fb81f332f0 | eric2003/OneFLOW | example/sod-shock-tube/rusanov/cpp/01b/Solver.cpp | #include "Solver.h"
#include "Field.h"
#include "HeatField.h"
#include "BurgersField.h"
#include "EulerField.h"
#include "CgnsUtil.h"
#include "Parallel.h"
#include "Post.h"
#include "Weno.h"
#include "ZoneState.h"
#include "global.h"
#include <fstream>
#include <iostream>
#include <iomanip>
#include <print>
#include... | ALGO | 0.998693 | 3.836621 |
e177b004-91b6-4059-b51f-22790fcd4488 | coderheck/learning-programming-languages | why-am-i-learning-cpp-now/grade-9/codeforces/1858a.cpp | #include"iostream"
using namespace std;
#define ll long long
ll a,b,c;
int t;
void solve(){
c%=2;
if(c){
if(a<b){cout<<"Second";}else{cout<<"First";}
}else{
if(a>b){cout<<"First";}else{cout<<"Second";}
}
cout<<"\n";
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin>>t;
while(t--){
cin... | ALGO | 0.99991 | 4.365259 |
fe86bd49-dcb4-40a8-b6ee-068d2e416886 | kmjp/procon | leetcode/251-300/291/2261.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.999872 | 3.85505 |
6348a9eb-def7-473d-a1db-88b395ca3d30 | MDNROnik/DSA-Solves | 2271-rearrange-array-elements-by-sign/rearrange-array-elements-by-sign.cpp | class Solution {
public:
vector<int> rearrangeArray(vector<int>& nums) {
vector<int> ans;
int m=nums.size(), p=0, n=0, now = 1;
for(int i=0;i<m;i++){
for(;p<m;){
if(nums[p]>0){
ans.push_back(nums[p]);p++;break;
}
... | ALGO | 0.99998 | 5.343981 |
28784bca-2c38-4a7b-982a-515bd0191867 | justdotheg/Algorithm | 알고리즘/백준/그리디/[11399] ATM/[11399] ATM.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
//입력
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
cin >> v[i];
//오름차순 정렬
sort(v.begin(), v.end());
//시간의 합 최솟값
int sum = 0; int k = n;
for (int i = 0; i < n; i++) {
sum += v[i] * k;
k--;
... | ALGO | 0.99993 | 4.228977 |
e14b823c-b3f2-46c4-9758-837dd97cbae7 | rahulsingh9878/Data-Structure | lab/linklist1.cpp | #include<stdio.h>
struct node{
int data;
struct node*next;
};
void printlist(struct node *n){
while(n!=NULL){
printf("%d ",n->data);
printf("%d",n->next;
n=n->next;
}
}
int main(){
struct Node* head = NULL;
struct Node* second = NULL;
struct Node* third = NULL;
head = (struct node*)malloc(siz... | ALGO | 0.94145 | 3.20785 |
bbdfca64-656d-4b62-8211-4e0ebbc73f7f | keerthana-1820/c- | Day2 Q5 palindrome or not.cpp | #include <iostream>
using namespace std;
int main() {
int originalNumber, reversedNumber = 0, remainder, number;
cout << "Enter an integer: ";
cin >> originalNumber;
number = originalNumber;
while (number != 0) {
remainder = number % 10;
reversedNumber = reversedNumber * 10 + remai... | ALGO | 0.999594 | 5.024236 |
9af9d263-f05e-41ef-b5a3-768e95fb4012 | SyedaShafi/DSA_Phitron | practice_contest_phitron/string_rules.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int N = 1e7 + 1;
int main()
{
string s, sub;
cin >> s;
for (int j = 0; j < s.size(); j++)
{
if (s[j] >= '0' and s[j] <= '9')
{
sub.clear();
int n = s[j] - '0';
// cout << n <<... | ALGO | 0.999669 | 3.578612 |
e309fed3-4ce0-4fa4-82a1-a4cf3b4ea1cb | rwang0417/d2c_mujoco200 | include/eigen3/doc/examples/Tutorial_BlockOperations_corner.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::Matrix4f m;
m << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10,11,12,
13,14,15,16;
cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl;
cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << ... | ALGO | 0.999398 | 4.092313 |
4e18fa94-72df-48d9-8adf-96bae9ffbf43 | SalmaDammak/LungSqCCContentPrediction | 4_WSI/3 Find non-clear slide tiles/Code/CentralLibrary_Dev/CompiledMex/interface/_coder_MatrixSubselection_logical_api.cpp | /* Include files */
#include "_coder_MatrixSubselection_logical_api.h"
#include "MatrixSubselection_logical.h"
#include "MatrixSubselection_logical_data.h"
#include "MatrixSubselection_logical_emxutil.h"
#include "rt_nonfinite.h"
/* Function Declarations */
static void b_emlrt_marshallIn(const mxArray *u, const emlrtM... | ALGO | 0.965995 | 6.189041 |
ed77c3df-f5bb-43c1-9f03-5d6d16f6c325 | ishandutta2007/codeforces | egor.lifar/normal/492/A.cpp | #include <iostream>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <string.h>
#include <cmath>
#include <set>
#include <map>
using namespace std;
int n;
bool get(int x) {
long long a = 0, b = 0;
for (int i = 0; i < x; i++) {
b += (i + 1);
a += b;
}
retu... | ALGO | 0.99982 | 3.943505 |
eb2565a0-324f-4e5e-8bf5-e5e1ac81a895 | Vibhu110602/DSAInterviewPrep | 1768-merge-strings-alternately/1768-merge-strings-alternately.cpp | class Solution {
public:
string mergeAlternately(string word1, string word2) {
int i=0,j=0;
string ans="";
while(i<word1.size() || j<word2.size()){
if(i<word1.size())ans+=word1[i];i++;
if(j<word2.size())ans+=word2[j];j++;
}
return ans;
}
}; | ALGO | 0.999971 | 5.931874 |
87bf3647-c145-468d-b800-f00c1d452556 | MeYo0o/wonderworlds | 15-automating-test-executions-and-build-distributions/projects/final/packages/component_library/example/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.997175 | 6.785645 |
6716c5e8-93bd-4a45-b15f-1aa093fd0b31 | henrique-artur/questoes-URI | URI-INICIANTE/uri2139.cpp | #include<iostream>
using namespace std;
int main(){
int mes, dia, i, j;
int array[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 25};
while (cin >> mes >> dia){
if(mes == 12 && dia == 25){
cout << "E natal!\n";
}
else if(mes == 12 && dia > 25){
cout... | ALGO | 0.999498 | 3.771831 |
c9ad931f-b847-430f-9acd-cf6419f1c3db | TigerBSD/TigerBSD | FreeBSD/contrib/llvm/tools/lldb/source/Utility/UriParser.cpp | #include "Utility/UriParser.h"
// C Includes
// C++ Includes
#include <cstring>
// Other libraries and framework includes
// Project includes
#include "lldb/Host/StringConvert.h"
using namespace lldb_private;
//----------------------------------------------------------------------
// UriParser::Parse
//-----------... | TOOL | 0.943559 | 5.917269 |
12545590-e7ed-47fb-8003-15bb34d6eb62 | ishandutta2007/codeforces | ashishgup/normal/1468/J.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define sz(x) ((int)x.size())
#define endl "\n"
#define inf (1LL<<62)
#define ninf (-inf)
const int nax = 200005;
int dsu[nax], size[nax];
int findSet(int x)
{
if(dsu[x] != x)
dsu[x] = findSet(dsu[x]);
return dsu[... | ALGO | 0.999989 | 4.638964 |
0c4e0ce0-5d86-4a0d-98d9-1f1d8f94c66e | ancillaryfactory/fuzz-pedal-vst | Source/PluginProcessor.cpp | /*
==============================================================================
This file contains the basic framework code for a JUCE plugin processor.
==============================================================================
*/
#include "PluginProcessor.h"
#include "PluginEditor.h"
//==============... | TOOL | 0.865047 | 4.73089 |
2a6fc7f1-e348-4011-9c64-c7229b6c8ded | drvalle1/MixMod_EBA | code.cpp | #include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
// code to sample from categorical distribution
int whichLessDVPresenceFast(double value,
NumericVector prob) {
int res=-1;
double probcum = 0;
for (int i = 0; i < prob.length(); i++) {
probcum = probcum + prob[i];
... | ALGO | 0.995879 | 3.98729 |
baf535d5-0fc5-4bb7-8877-0b2af422727d | lammps/lammps | src/fix_spring.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Paul Crozier (SNL)
------------------------------------------------------------------------- */
#include "fix_spring.h"
#include "atom.h"
#include "error.h"
#include "group.h"
#include "respa.h"
#inc... | TOOL | 0.994475 | 7.580481 |
90d44ecd-572e-4789-bbbe-98cd1d51792d | ShreyKhanduja/DSA-Sheet | min_platforms_railway.cpp | int findPlatform(int arr[], int dep[], int n) {
// Your code here
// sort both the arrival and departure times in ascending order
sort(arr, arr + n);
sort(dep, dep + n);
int count = 1; // platform needed for the arrival of the first train
int max_count = 1;
// use Two pointer approach
... | ALGO | 0.999768 | 5.31961 |
f207eb32-ac35-4349-aff1-f0097af3215c | ishandutta2007/codeforces | kraskevich/normal/26/A.cpp | #include <iostream>
#include <vector>
using namespace std;
bool prime(int n) {
for(int i = 2; i * i <= n; ++i)
if(n % i == 0)
return false;
return true;
}
int main() {
int n, res = 0;
cin >> n;
for(int i = 4; i <= n; ++i) {
int cur = 0;
... | ALGO | 0.999281 | 4.510872 |
69e7ee3c-55d7-4958-8459-9523f57933ae | sjtao98/Leetcode_backup_2 | 344-reverse-string/344-reverse-string.cpp | class Solution {
public:
void reverseString(vector<char>& s) {
int n = s.size();
if(n == 1) return;
int l = 0, r = n-1;
while(l < r){
char c = s[l];
s[l] = s[r];
s[r] = c;
l++;
r--;
}
return... | ALGO | 0.999789 | 6.290531 |
2be4e302-2e3b-4cc1-a417-70236bb04ab9 | wajs-err/study | algorithms/contests/graphs_1/E/E.cpp | #include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using std::vector;
class DAG {
public:
enum color {
WHITE = 1, GREY = 2, BLACK = 3
};
DAG() = delete;
explicit DAG(int V): V(V), edges(std::vector<std::vector<int>>(V + 1)) {}
DAG(const DAG&) = delete;
DAG& op... | ALGO | 0.999759 | 5.063655 |
50d48fe7-7405-4157-94a0-062e23055fee | Alin123/Algorithm_DataStructure | ALStructure/ALStructure/Polymorphism.cpp | #include "Polymorphism.hpp"
void Intellectual::study() {
printf("知识分子为中华民族之崛起而读书!\n");
}
void Intellectual::working() {
printf("知识分子运用自己的所学创造价值!\n");
}
Intellectual::~Intellectual() {
printf("显示声明的虚的析构函数必须手动定义!");
}
void Teacher::study() {
printf("老师通过教案来学习知识!\n");
}
void Teacher::working() {
p... | TOOL | 0.916825 | 5.645253 |
cb31344a-3b1c-41f3-b52d-9d363a8b4d57 | arichardson/cheri-monorepo-test | clang/lib/Tooling/Refactoring/ASTSelection.cpp | #include "clang/Tooling/Refactoring/ASTSelection.h"
#include "clang/AST/LexicallyOrderedRecursiveASTVisitor.h"
#include "clang/Lex/Lexer.h"
#include "llvm/Support/SaveAndRestore.h"
using namespace clang;
using namespace tooling;
using ast_type_traits::DynTypedNode;
namespace {
CharSourceRange getLexicalDeclRange(Dec... | TOOL | 0.945358 | 7.914464 |
be4fb81e-c40d-48de-a9bc-90388c1909f9 | SergioMalia9/Robo-shernan-mbermejo | Prac5_mbermejotc_shernandcd/src/specificworker.cpp | #include "specificworker.h"
#include <Eigen/Dense>
#include <iostream>
#include <math.h>
#include "grid.h"
using namespace std;
const float landa = -0.5 / log(0.1);
/**
* \brief Default constructor
*/
SpecificWorker::SpecificWorker(TuplePrx tprx, bool startup_check) : GenericWorker(tprx) {
this->startup_check_fl... | TOOL | 0.982791 | 4.192279 |
4299185d-718e-4168-9008-fa39785db262 | jnyfah/LeetCode | 7. Reverse Integer.cpp | class Solution {
public:
int reverse(int x) {
int pop = 0;
int rev = 0;
while (x != 0) {
pop = x % 10;
x /= 10;
if (rev > INT_MAX / 10 || (rev == INT_MAX && pop > 7))
return 0;
if (rev < INT_MIN / 10 || (rev == INT_MIN && pop < -8))
return 0... | ALGO | 0.999788 | 5.914586 |
f0dd5236-3584-4fac-b98f-bf6e468ded0d | TheFlyingPiano99/Makyoh | Sources/fallingSand/gas.cpp | #include "gas.h"
namespace Hogra::FallingSand {
bool Gas::Update(ParticleGrid& grid, unsigned int x, unsigned int y, float dt) {
if (lifeTime > 0.0f && age > lifeTime) {
grid.Write(actualX, actualY, nullptr);
return false;
}
age += dt;
// Change phase of matter:
if (temperature < condensationTempe... | ALGO | 0.999136 | 5.446803 |
3695d8da-2d9e-49d4-83e7-f14f71ce5bc3 | ArtZ336/Home_tasks | DZ41.cpp | List::List(const List& other)
{
begin = end = 0;
Node* temp = other.begin;
while (temp)
{
Push(temp->getViolation());
temp = temp->next;
}
}
List& List::operator=(const List& other)
{
List tmp(other);
std::swap(*this, tmp);
return *this;
}
void List::Push(Node* n)
{... | TOOL | 0.985252 | 4.16894 |
1f6ab55d-44be-4406-a68c-3300a8858a04 | allem40306/Competitive-Programming | other/ioicamp/ioi19004.cpp | // by =^● ⋏ ●^=
#include <bits/stdc++.h>
using namespace std;
int main() {
int T;
scanf("%d",&T);
while(T--) {
int n;
scanf("%d",&n);
if(n==1) puts("NO"); // meow!
else {
int up = sqrt(n)+1;
for(int i=2;i<up;i++)
if(n%i==0)up=0;
... | ALGO | 0.999886 | 4.707348 |
eadf8506-1d5d-40f4-bd83-ea43d5492abb | icefairy2/3DScanning-ex2 | libs/Eigen/bench/spbench/sp_solver.cpp | // Small bench routine for Eigen available in Eigen
// (C) Desire NUENTSA WAKAM, INRIA
#include <iostream>
#include <fstream>
#include <iomanip>
#include <Eigen/Jacobi>
#include <Eigen/Householder>
#include <Eigen/IterativeLinearSolvers>
#include <Eigen/LU>
#include <unsupported/Eigen/SparseExtra>
//#include <Eigen/Sp... | ALGO | 0.991004 | 4.29849 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.