uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b9f792ac-cdae-4c54-bc94-76bab2e62994 | asm123/codes | algorithms/leetcode/number_of_1_bits.cpp | #include <iostream>
using namespace std;
class Solution
{
public:
int hammingWeight (int n)
{
int count = 0;
while (n)
{
count += n & 1;
n >>= 1;
}
return count;
}
};
int main (void)
{
int n;
cin >> n;
Solution sol;
cout << sol.hammingWeight(11) << endl;
return 0;
}
| ALGO | 0.999966 | 5.567301 |
b9013311-b3e4-43df-b35d-6365835b653b | Giang-Dang/Base_Converter_And_Calculator | Calculation.cpp | #include "Calculation.h"
std::string addBinNum(std::string str_binNum1, std::string str_binNum2) {
std::bitset<MAX_BITSET> binNum1(str_binNum1);
std::bitset<MAX_BITSET> binNum2(str_binNum2);
std::bitset<MAX_BITSET> carry{0};
std::bitset<MAX_BITSET> res{0};
res = binNum1 ^ binNum2;
carry = binN... | ALGO | 0.999354 | 5.004826 |
b793e21d-5627-4a4d-a093-90a38ff3ca0f | Sumanth-NR/CompetitiveProgramming | Platforms/AtCoder/abc361/C_Make_Them_Narrow.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, k;
cin >> n >> k;
k = n - k;
vector<int> a(n);
for (auto &x: a) {
cin >> x;
}
sort(a.begin(), a.end());
int ans = INT_MAX;
... | ALGO | 0.999947 | 4.166686 |
148558c6-74b4-4adc-a680-0c08e9d32510 | vslutov/cmc-archieve | FourthSemester/PracticalCourse/2015-03-26/ps04-5.cpp | template <int x>
class Fib
{
public:
static const int VAL = Fib<x-2>::VAL + Fib<x-1>::VAL;
};
template <>
class Fib <0>
{
public:
static const int VAL = 0;
};
template <>
class Fib <1>
{
public:
static const int VAL = 1;
};
| ALGO | 0.999458 | 5.583834 |
1d8d478f-9d56-4dfe-8b3b-96a728f8333c | arduR-O/Algorithms | binary_exponentiation.cpp | #include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "O:\Programming\C++\Problems\printerfunc.hpp"
#endif
long long int power(long long int a,long long int b){
long long int result = 1;
long long int m;
while(b> 0){
if(b%2) result = (result * a) % m;
a = (a*a)%m;
... | ALGO | 0.999339 | 3.696322 |
71fe5d9a-ac32-4a47-8664-da8119a4663f | wazedrifat/Vjudge | SPOJ/YODANESS/15264025_AC_130ms_18432kB.cpp | #include<bits/stdc++.h>
using namespace std;
#define MX 30001
int a[MX], SegTree[4*MX], Lazy[4*MX];
void update(int low, int high, int Qhigh, int pos=0, int Qlow=0)
{
if(Qlow>high || Qhigh<low || low>high) return;
if(Lazy[pos])
{
SegTree[pos]+=Lazy[pos];
if(low!=high)
{
Lazy[2*pos+1]+=Lazy[pos];
Lazy[... | ALGO | 0.99985 | 3.777853 |
03d16f14-ba01-4f85-bd96-af571b20f840 | kritikarag/Practice | longest_subarray.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
// your code goes here
long long t;
cin >> t;
while (t--)
{
long long n;
cin >> n;
vector<long long> numbers(n);
for(long long i=0;i<n;i++) cin >> numbers[i];
long long start = 1, ... | ALGO | 0.999781 | 4.539794 |
b08fe0d1-c3d7-4ca8-a311-e43ada5a5132 | Kathleen7474/-leetcode | 66PlusOne.cpp | class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
vector<int> output(size(digits), 0);
int d_size = size(digits);
int carry = 1;
for (int i = 0;i<d_size;i++){
// cout<<digits[d_size-i-1]<<endl;
output[d_size-i-1] = (digits[d_size-i-1]+carry) ... | ALGO | 0.999915 | 6.159513 |
aaff3041-c0c8-4d44-ba14-f1f0abb307e5 | codeyoma/ps | boj/2252/2252.cpp | #define LOCAL // need to delete in online judge
//------------------------------------------------------------------------------
#include <iostream>
using namespace std;
template <typename T, typename... Args>
void log(const T& first, const Args&... rest);
void end();
#define C_MIN (-(1e8 + 7))
#define C_MAX (1e8 + 7)
... | ALGO | 0.999998 | 4.7421 |
2caa1c9e-d9bf-4372-afc4-21bd4000ad88 | lzyrapx/Competitive-Programming | 百度之星/2020/第三场/C.cpp | /*
* @Author: zhaoyang.liang
* @Github: https://github.com/LzyRapx
* @Date: 2020-07-26 23:35:38
*/
#include <cstring>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
int main(int argc, char const *argv[])
{
int t;
cin >> t;
while(... | ALGO | 0.999974 | 4.636679 |
91d26b04-f98a-4e45-820e-513a4256c1fa | V-Sekai/godot-whisper | thirdparty/clblast/src/routines/level2/xtbmv.cpp | #include "routines/level2/xtbmv.hpp"
#include <string>
#include <vector>
namespace clblast {
// =================================================================================================
// Constructor: forwards to base class constructor
template <typename T>
Xtbmv<T>::Xtbmv(Queue &queue, EventPointer event, ... | ALGO | 0.950856 | 6.828109 |
b8eee160-10db-4ca5-9b5e-29acc58888ba | cubercsl/The-road-to-ACMer | Misc/LanQiao2018_Simulation/H.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1 << 17;
int pre[N], suf[N];
ll pre_sum[N], suf_sum[N];
int d[N];
int main()
{
int n;
while (cin >> n)
{
vector<int> v(n);
for (auto& t : v) cin >> t;
sort(v.begin(), v.end());
for (int i = 1; ... | ALGO | 0.999773 | 3.71104 |
3143e9de-157a-4c60-bd34-7358d915ac9c | saquib77/Code | div7.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,c=0;
cin>>n;
vector<int>per;
while(n){
per.push_back(n%10);
n/=10;
}
sort(per.begin(),per.end());
do{
int sum=0;
for(auto& x:per)
sum=sum*10+x;
if(sum%7==0) c++;
}while(next_permut... | ALGO | 0.999477 | 4.54467 |
d7219b47-2dfc-434d-a6b0-6fbbe64132ba | pojith/Data-Structures-And-Algorithm | Library/DS/bit.cpp | //1-d bit
int valR[N], valL[N], bit[N];
map<int, int> id;
void add(int x){
while(x<N){
bit[x]++;
x += x&(-x);
}
}
int query(int x){
int ans = 0;
while(x){
ans += bit[x];
x -= x&(-x);
}
return ans;
}
void suffix(){
set<int> no;
//for suffix queries
//add all no's in the set that you will add + query
/... | ALGO | 0.999944 | 3.671164 |
ba6ab99d-c00b-41b8-9a6f-44e9713d23de | The-CopyNinja-Kakashi/dsa | 7 and 8.cpp | #include <iostream>
using namespace std;
struct Node {
int data;
Node *left, *right;
bool lthread, rthread;
Node(int val) {
data = val;
left = right = nullptr;
lthread = rthread = true;
}
};
class ThreadedBST {
Node *root;
public:
ThreadedBST() : root(nullptr)... | ALGO | 0.999853 | 6.863884 |
60e03b38-282a-4c81-ac9c-1dafdc6540d4 | ajaykmr8684/Leetcode | 201-bitwise-and-of-numbers-range/201-bitwise-and-of-numbers-range.cpp | class Solution {
public:
int rangeBitwiseAnd(int left, int right) {
int ct=0;
while(left != right)
{
left = left >>1;
right = right >> 1;
ct++;
}
return left << ct;
}
}; | ALGO | 0.999963 | 5.999427 |
3d65d30b-0b01-476e-96dc-fd1a8214fd5e | Andy2h/coding | leetcode/Sqrt.cpp | class Solution {
public:
int sqrt(int x) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
if (x <= 0) return 0;
int t;
int l = 1;
int h = x;
int m;
... | ALGO | 0.999958 | 5.39383 |
6d1bc7b9-430b-4cc9-a684-d5108e03f37e | veertank/veer.cpp | pectical 2(4).cpp | #include<iostream>
using namespace std;
int main()
{
int x[100],n,i,j,temp;
cout<<"Enter The Limit : ";
cin>>n;
cout<<"Enter "<<n<<" Value :"<<endl;
for(i=0;i<n;i++)
{
cin>>x[i];
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(x[i]>x[j])
... | ALGO | 0.999899 | 4.090828 |
5e363504-38e2-4c9e-941d-f48bb24e8388 | Lokesh-Bisht/DSA-Interview-Prep | leetcode/cpp/Heap/Top K Frequent Words.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
using namespace std;
class Solution {
struct compare {
bool operator()(pair<int, string> num1, pair<int, string> num2) {
if (num1.first == num2.first) {
return num1.second > num2.second;
... | ALGO | 0.999987 | 6.037655 |
aeafe4c4-cb39-4ec0-b50d-249e27362218 | Harshvardhan6367/C-_DSA | 28_Graph/17_Bellman_Ford.cpp | #include<iostream>
#include<vector>
using namespace std;
// User function Template for C++
// time Complexity : V+E -->worst case
// best case = E
// Space : V
class Solution {
public:
vector<int> bellmanFord(int V, vector<vector<int>>& edges, int src) {
// Code here
vector<int>dist(V... | ALGO | 0.999681 | 5.072485 |
5cd1577a-81e5-42a3-a455-e7ea156a589c | Omkar7143/Logic-Building | Program400.cpp | // Generic Programming
// This is generic program
// Every specific program is not convert into generic
#include <iostream>
using namespace std;
double Addition(double Arr[], double iSize)
{
double iSum = 0.0;
int i = 0;
for (i = 1; i < iSize; i++)
{
iSum = iSum + Arr[i];
}
return iS... | TOOL | 0.976885 | 4.425287 |
bd423ddf-d5a3-4bc6-920b-0742360fa53c | ZXTgbh/Laboratornaya- | lab_d2/d2_8.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string str1, str2;
cout << "Enter the first string: ";
cin >> str1;
cout << "Enter the second string: ";
cin >> str2;
str1.erase(remove(str1.begin(), str1.end(), ',.;:\'\\/!'));
cout << str1 << endl;
return 0;
} | TOOL | 0.938073 | 3.571279 |
1a9fd5a6-99ee-4d21-88fb-8f3b6c8d04e4 | ApurbaApd/Leetcode | Maximum path sum from any node - GFG/maximum-path-sum-from-any-node.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node *buildTree(string str) {
// Corner Case
if (str.length() ... | ALGO | 0.999822 | 7.071258 |
e97225db-611d-4bbe-87c7-80e1ff65fca1 | bishakh17/CP | Problems/A_Forbidden_Integer.cpp | #include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define cout(x) cout<<(x)<<endl
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int T = 1;
void solve(){
int n,k,x; cin>>n>>k>>x;
if(x!=1){
cout("YES");
cout(n)... | ALGO | 0.999675 | 3.908594 |
f3999c30-b870-496e-b3e6-223cb41c5b2c | Qiti0/codeforces | C_Turtle_Fingers_Count_the_Values_of_k.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
const double pi = acos(-1.0);
const int N = 2e5 + 10;
typedef long long ll;
typedef pair<int,int> pii;
inline int lowbit(int x) {return x & (- x);}
map <ll,ll> mp;
void solve()
{
ll a,b,l;cin >> a >> b >> l;
mp.clear();
int ans = 0;
... | ALGO | 0.999945 | 4.233152 |
5a5b8849-bf40-4bcc-b92e-62f063ac2545 | RafDevX/advent-of-code | 2021/day06/part2.cpp | #include <bits/stdc++.h>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void show_school(vector<long long> school, string prefix)
{
vector<long long> fs;
for (long long i = 0; i < school.size(); i++) {
for (long long j = 0; j < school[i]; j++) {
fs.push_back(i);... | ALGO | 0.978362 | 3.491969 |
69049326-e8de-46b5-b9f0-c7c0ed7cc109 | GordonHaha/AlgorithmExercises | 数据结构和算法/二叉树/牛客/剑指offer/JZ26.cpp | // https://www.nowcoder.com/practice/6e196c44c7004d15b1610b9afca8bd88
#include <bits/stdc++.h>
using namespace std;
struct TreeNode
{
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL)
{
}
};
class Solution
{
public:
bool isSamePartTree... | ALGO | 0.999958 | 5.247996 |
9f3fb723-b484-4a35-bc24-43403a7e3c51 | saga-gis/saga-gis | saga-gis/src/tools/garden/garden_fractals/Grid_FractalDimension.cpp | /**********************************************************
* Version $Id: Grid_FractalDimension.cpp 1921 2014-01-09 10:24:11Z oconrad $
*********************************************************/
//---------------------------------------------------------
///////////////////////////////////////////////////////////
... | ALGO | 0.984335 | 6.108774 |
45b37226-1543-4e28-bfe9-1c66f98f89e6 | sazedul1/polyfit | polyfit_new/Source.cpp | #include<vector>
#include<iostream>
#include "polyfit.cpp"
using namespace std;
int main(){
vector<double> oX;
for (int i = 0; i < 5; i++){
int x = i;
oX.push_back(x);
cout << x << " ";
}
cout << endl;
vector<double> oY;
for (int i = 0; i < 5; i++){
int y = i*i*i + 2 * i*i - i + 1;
y = 3 *i* i + 2*i-... | ALGO | 0.996549 | 3.093467 |
92653d40-759f-4527-b8ae-3c6cd6faf292 | simar295/striver_nqt_sheet | problem on arrays/8.cpp | /*
Rotate array by K elements : Block Swap Algorithm
In this article we will learn a very popular algorithm for “Rotate array by K elements : Block Swap Algorithm”.
Problem Statement: Given an array of n size, rotate the array by k elements using the Block Swap Algorithm.
Examples:
Example 1:
Input: N = 5, array[] =... | ALGO | 0.999908 | 5.555375 |
18a26ab9-1cd0-481c-a9bc-46df18c3d454 | SharathN29/Leetcode | Leetcode - C++/154_findMinInRotArr2.cpp | // https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/
// Time : O(log N)
#include <iostream>
#include <vector>
using namespace std;
int findMin(vector<int>& nums) {
int left = 0, right = nums.size()-1;
while(left < right) {
int mid = left + (right-left)/2;
if(nums[mid] < ... | ALGO | 0.99999 | 6.295012 |
7461e53f-3628-475b-9928-255c07bc57f5 | gaojiabao1991/cpp_primer | 6.1.3/main.cpp | #include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include "fact.h"
using std::begin;
using std::cerr;
using std::cin;
using std::cout;
using std::end;
using std::endl;
using std::string;
using std::vector;
int main() {
cout << (fact(5)) << endl;
} | ALGO | 0.998977 | 4.978504 |
f6131574-43b0-441f-a214-a053393f08d4 | amundra15/ray-tracer | main/a_cameras.cpp | #include <core/image.h>
#include <core/point.h>
#include <core/vector.h>
#include <core/scalar.h>
#include <core/julia.h>
#include <rt/ray.h>
#include <rt/cameras/perspective.h>
#include <rt/cameras/orthographic.h>
#include <iostream>
#include <rt/renderer.h>
using namespace rt;
float a2computeWeight(float fx, float ... | ALGO | 0.979178 | 6.60158 |
27038403-d5b8-4baf-a33e-6799ea2b4c09 | bbc/turingcodec | boost/libs/program_options/src/parsers.cpp | #include <boost/config.hpp>
#define BOOST_PROGRAM_OPTIONS_SOURCE
#include <boost/program_options/config.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/positional_options.hpp>
#include <boost/program_options/detail/cmdline.hpp>
... | CONFIG | 0.925945 | 7.369888 |
3f4359dd-b652-4811-9f6b-d9485eb67c37 | riteshkumar005/Data-Structures-And-Algorithms | Array/ArrayItersection.cpp | #include <iostream>
#include <vector>
using namespace std;
void ArrayIntersection(vector<int>& num1 , vector<int>& num2){
vector<int> arrayInteraction;
for(int i = 0; i < num1.size(); i++){
int element = num1[i];
for(int j = 0; j < num2.size(); j++){
if(element == num2[j]){
... | ALGO | 0.999548 | 4.75158 |
a7bc651d-9b54-45d1-a8a4-6c884ea82954 | Adyem/Libft | Libft/ft_memchr.cpp | #include "libft.hpp"
#include "../CPP_class/nullptr.hpp"
void* ft_memchr(const void* pointer, int number, size_t size)
{
size_t index;
const unsigned char *string = static_cast<const unsigned char*>(pointer);
unsigned char character = static_cast<unsigned char>(number);
index = 0;
while (index < s... | TOOL | 0.854858 | 4.156905 |
e0c2aa91-eb5f-4a5d-bf51-8dbec341e64a | kedarvartak/Leetcode2025 | DP/Tabulation/house_robber.cpp | class Solution {
public:
int rob(vector<int>& nums) {
int n = nums.size();
if(n == 1) return nums[0];
vector<int> dp(n, 0);
dp[0] = nums[0];
dp[1] = max(nums[0], nums[1]);
for(int i = 2; i < n; i++){
dp[i] = max(dp[i - 1], nums[i] + dp[i - 2]);
}
... | ALGO | 0.99996 | 6.092093 |
e4912cac-8af0-4675-b116-e44ce9d3ed2d | SophiaTX/SophiaTX-MainNet | libraries/chain/sophiatx_evaluator.cpp | #include <sophiatx/chain/sophiatx_evaluator.hpp>
#include <sophiatx/chain/database/database.hpp>
#include <sophiatx/chain/custom_operation_interpreter.hpp>
#include <sophiatx/chain/custom_content_object.hpp>
#include <sophiatx/chain/sophiatx_objects.hpp>
#include <sophiatx/chain/witness_objects.hpp>
#include <sophiatx/... | TOOL | 0.894073 | 6.694213 |
341e568b-c5fc-4076-917f-4d4e50570f5f | raman7073/AllAboutCPP | Contest/Atcoder/ABC341/b.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int N;
cin >> N;
vector<long long> A(N);
for (int i = 0; i < N; ++i)
{
cin >> A[i];
}
vector<long long> S(N - 1), T(N - 1);
for (int i = 0; i < N - 1; ++i)
{
cin >> S[i] >> T[i];
}
lo... | ALGO | 0.999787 | 3.498766 |
0477431a-9152-4aba-9335-2bfea7310250 | junhee-won/problem-solving | BOJ_2659.cpp | // 22 / 1 / 31
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<bool> check(10 * 10 * 10 * 10, false);
vector<int> clockNum;
void init(void)
{
for (int i = 1; i <= 9; i++)
{
for (int j = 1; j <= 9; j++)
{
for (int k = 1; k <= 9; k++)
... | ALGO | 0.999873 | 4.907974 |
44bbff74-352a-4dfc-b935-f9ba4f8e8ed5 | ishandutta2007/codeforces | noimi/normal/444/B.cpp | #pragma region Macros
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; ... | ALGO | 0.999952 | 3.251552 |
86df18cf-1fe6-4743-a239-3a3e07f0a224 | Manya0209/DSA-LEARNING-PROGRESS | sayDigits.cpp | #include<iostream>
using namespace std;
void sayDigits(int n, string arr[]){
if(n==0)
return ;
int digit= n % 10;
n= n/10;
sayDigits(n, arr);
cout<<arr[digit]<<" ";
}
int main(){
string arr[]= {"zero", "one", "two", "three", "four", "five", "six", "seven","eight", "nine"};
int n;
... | ALGO | 0.998613 | 5.076339 |
c968a11f-4f67-4977-9576-9c137dde574b | BangKartavya/LeetCode | House Robber/main.cpp | class Solution {
public:
int rob(vector<int>& nums) {
int rob = 0;
int norob = 0;
for(int i =0;i<nums.size();i++) {
int newrob = norob+nums[i];
int newnorob = max(norob,rob);
rob = newrob;
norob = newnorob;
}
return max(rob,nor... | ALGO | 0.99982 | 5.733282 |
662ae12d-ffea-49e4-86ef-14f337ae92e1 | lele12/algorithm | string/leetcode459.cpp | #include <iostream>
#include <string>
using namespace std;
bool repeatedSubstringPattern(string s){
if (s.length() == 1){
return false;
}
for (int i = 0; i < s.length() / 2; i++){
if (s.length() % (i + 1) != 0){
continue;
}
string sub = s.substr(0, i + 1);
... | ALGO | 0.999536 | 4.194775 |
41e5e12e-2536-4b92-bda0-860c51b0ea39 | ualbertagreen/competitive-coding | LeetCode/4Sum II.cpp | class Solution {
public:
/*
int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4) {
map<int, int> sum12;
map<int, int> sum34;
for (int i = 0; i < nums1.size(); i++) {
for (int j = 0; j < nums1.size(); j++) {
... | ALGO | 0.99991 | 6.233783 |
104ba44d-1e8a-4670-9ba4-a43b7a5cd89a | swfsql/university | federal-university-itajuba/old/eco-010/fabiana/Aula 2 - Funcoes/1.cpp | #include <iostream>
// cria matrizes 3x3, e pode som-las.
void zerar(int [3][3][3]);
void input(int [3][3][3]);
void somar(int [3][3], int [3][3], int [3][3]);
void mostrar(int [3][3]);
int main()
{
int a[3][3][3];
zerar(a);
int op = -1;
while(op)
{
if(op == 1)
input(a);
... | ALGO | 0.924123 | 3.434991 |
5e75ccc6-df56-4ce2-8be9-5e0908a43dac | codulluiandrei/pbinfo | pbinfo-205/main.cpp | #include <fstream>
using namespace std;
int x[10] ,n, poz[10];
int nrsol=0;
ofstream fout("shuffle.out");
int Vecine(int a,int b){
if(poz[a]-poz[b]==1 || poz[a]-poz[b]==-1)
return 1;
return 0;
}
int OK(int k){
if(k==1)
return 1;
for(int i=1;i<k;++i)
if(x[k]==x[i])
return 0;
if(Vecine(x[k],x[k-1]))
retur... | ALGO | 0.999852 | 3.546082 |
85f20047-23fe-447a-a2da-ff8ec160a676 | Krythz43/CP-Archieve | codeforces/1330d.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define rep(i,n,z) for(int i=z;i<n;i++)
#define rrep(i,z) for(int i=z;i>=0;i--)
#define nl cout<<endl
#define vi vector<int>
#define vlli vector<long long int>
#define umap u... | ALGO | 0.999938 | 4.643473 |
b491fc3a-9b63-4263-8cc1-b69ba7b43909 | Zahid031/CPP_Code | VJUDGE/csss.cpp |
#include <bits/stdc++.h>
#define mod 1000000007
#define int long long
#define endl '\n'
int maxn = 1;
#define mx 40000001
using namespace std;
void solve()
{
int a, b, c, d, x, y = 0, z, sum = 0, ans = 1, odd = 0, even = 0, res, zero = 0, one = 0;
map<int, int> mp;
//map<int,int>mpp;
// map<int, int>:: ... | ALGO | 0.998714 | 3.489454 |
fc1c40fe-ae95-43cc-8eeb-df1b268f847f | 21-aakash/Data-Structures-Problems- | recusrion/bubblesort.cpp | #include <iostream>
using namespace std;
void print(int arr[], int size)
{
for (int i = 0; i < size; i++)
{
cout << arr[i];
}
}
void bubblesort(int arr[], int size)
{
int temp;
for (int i = 0; i < size ; i++)
{
for (int j= 0; j < (size-1)-i; j++)
{
if (arr... | ALGO | 0.999844 | 4.652256 |
0cdcd727-ec6a-4876-9dad-d5101c74f5ca | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/find-the-grid-of-region-average-Solution.resultGrid/177773_DoS_Exec_Code_Overflow_Mem._Corr..cpp | create_surface_from_thumbnail_data (guchar *data,
gint width,
gint height,
gint rowstride)
{
guchar *cairo_pixels;
cairo_surface_t *surface;
static cairo_user_data_key_t key;
int j;
cairo_pixels = (guchar *)g_malloc (4 * width * height);
surface = cairo_image_surface_... | ALGO | 0.999059 | 5.230801 |
d79fa10a-6f19-4a16-a669-8f52c1d55b5a | Ash-B0y/Cpp | C++/prefix.cpp | #include<iostream>
#include<conio.h>
#include<string.h>
using namespace std;
char a[20];
int fr=0,res,arr[10];
void push(int tot)
{
arr[fr]=tot;
fr++;
}
int main()
{
int x,cnt=0,ptr=0;
cout<<"\n Enter the expression:";
cin>>a;
x=strlen(a);
for(int i=x-1;i>=0;i--)
{
if(a[i]=='+'||a[i]=='-'||a[i]=='*'||a... | ALGO | 0.999736 | 3.41779 |
b47bdb5d-fed9-407f-b047-da520f2d2b92 | LEE026/baekdu | baekjoon/균형잡힌세상_4949.cpp | #include<iostream>
#include<stack>
#include<string>
using namespace std;
int main(void) {
cin.tie(NULL);
ios::sync_with_stdio(false);
cout.tie(NULL);
string s;
while (true)
{
getline(cin,s);
if (s == ".") break;
stack<char> st;
bool yes = true;
for (char c:s)
{
if (c == '.') break;
if (... | ALGO | 0.99988 | 4.473531 |
20502041-8c89-4996-9c32-ea8d62c3ad51 | AbdullaKhan01/Competitive-Programming | 1500/temp4.cpp | #include<bits/stdc++.h>
#define mod 1000000007
#define mod2 998244353
#define ceil(a,b) ((a+b-1)/b)
#define floor(a,b)((a-b+1)/b)
#define fast_io() ios::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define int long long
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).... | ALGO | 0.999946 | 4.507441 |
f27f9f33-d20e-4550-a451-be68aac101e6 | xbaotg/training | AtCoder/abc204/abc204/d/main.cpp | //{{
/*
* Created at: 06/21/21 17:49:29
*
* FB: https://facebook.com/tgbaodeeptry
* From Viet Nam with Love :D
*
*/
#include <bits/stdc++.h>
using namespace std;
#define fast_io() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define REP(i, a, b) for (int i = int(a); i < int(b); ++i... | ALGO | 0.999892 | 4.653039 |
80ff5bcc-4bd2-4933-95b5-484c198f8761 | PochecoPachico/Procon | AtCoder/ABC/116/b.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())
#define DUMP(x... | ALGO | 0.999961 | 3.92509 |
0e98d9ef-3754-4ece-a211-fb49825eab12 | AbinayaSakthivel13/DSA-LeetCode-solutions | 1168-duplicate-zeros/duplicate-zeros.cpp | class Solution {
public:
void duplicateZeros(vector<int>& arr) {
int n=arr.size();
vector<int> a;
for(int i=0;i<n;i++){
if(arr[i]==0){
a.push_back(0);
a.push_back(0);
}
else
a.push_back(arr[i]);
}
... | ALGO | 0.999929 | 5.781937 |
11d9354d-48b5-4688-b4c2-7b66c7a0ed11 | thanhminh0411/Graphic-OpenGL-Practice-C-- | main.cpp | #include <GLFW/glfw3.h>
#include <iostream>
#include <curses.h>
#include "Point2d.h"
#include "Draw2d.h"
const int WINDOW_WIDTH = 800;
const int WINDOW_HEIGHT = 600;
void bresenhamLine(GLFWwindow &window)
{
int x, y;
std::cout << "Nhap vao toa do diem thu 1: ";
std::cin >> x >> y;
Point2d a(x, y);
... | ALGO | 0.910941 | 5.685839 |
57d0d964-d53f-476f-b127-2ffb0e24107a | goodboi1234/rnw | third_project.cpp | #include <iostream>
#include <string.h>
using namespace std;
int sub(int a , int b){
return b-a;
};
int main(){
int row = 3;
int col = 3;
int list1[row][col] = {{1 , 7 , 8},{8 , 9 , 10} , {5 , 4 , 2}};
int small_no = list1[row][col];
cout<<small_no<<endl;
int big_no = list1[0][0];
fo... | ALGO | 0.998667 | 3.077771 |
ec58981b-d13c-40da-b346-da18c63386b5 | tejeshrayavaram/192211597-DSA0159 | 52.cpp | #include <iostream>
using namespace std;
int gcd(int a, int b) {
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
return a;
}
int main() {
int num1, num2;
cout << "Enter two numbers to find their GCD: ";
cin >> num1 >> num2;
cout << "GCD of " << num1 << " and... | ALGO | 0.999466 | 5.877531 |
b9417d06-2968-418d-895e-7cb721b11891 | surfer-mu/Data-Structure-And-Algorithm | 树/二叉树/排序树的建立输出/二叉排序树的建立输出.cpp | #include<stdio.h>
#include<stdlib.h>
typedef struct node{
int data;
struct node * left;
struct node * right;
}BTNode;
int count=0;
BTNode * CreateTree(int arr[],int n)
{
BTNode * t,*p,*q,*root=NULL;
for(int i=0;i<n;i++){
p=(BTNode *)malloc(sizeof(BTNode));
p->data=arr[i];
p->left=p->right=NULL;
if(!root)... | ALGO | 0.999906 | 4.47267 |
1db8cc74-eb0b-409d-bde6-815240bac9ec | ShahPranav1094-Courses/365DaysChallenge | January2022/31-FindTheHighestAltitude/Solution.cpp | // O(N) Time & O(1) Space
int largestAltitude(vector<int> &gain)
{
int ele = max(0, gain[0]);
for (int i = 1; i < gain.size(); ++i)
{
gain[i] = gain[i] + gain[i - 1];
ele = max(ele, gain[i]);
}
return ele;
}
// O(N) Time & O(1) Space
int largestAltitude(vector<int> &gain)
{
int ... | ALGO | 0.999813 | 6.554721 |
2b37f2ec-c282-4a03-ad7f-8dde80be5dbb | rudalsd/Algorithm-Study | 백준/자료 구조/14428. 수열과 쿼리 16.cpp | #include<iostream>
#include<vector>
#include<cmath>
using namespace std;
struct node {
int num;
int idx;
};
int N, M;
int arr[100001];
vector<node> segTree;
node makeTree(int cur, int start, int end) //Ʈ Ʈ
{
int mid = (start + end) / 2;
if (start == end) {
return segTree[cur] = { arr[start], start };
}
n... | ALGO | 0.999999 | 4.777507 |
c7586141-1813-48d2-83fa-e7f6c47150b1 | xtf0214/CPP | Problem/Luogu/Training/205【数据结构2-1】二叉堆与树状数组/P2085.cpp | // P2085 最小函数值
// https://www.luogu.com.cn/problem/P2085
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
vector<tuple<int, int, int>> F;
vector<int> st;
int f(int i) {
auto &[a, b, c] = F[i];
int x = st[i]++;
return a * x * x + b * x + c;
}
signed main() {
ios::sync_with_stdio(... | ALGO | 0.99997 | 4.155912 |
9d3f8bbd-7a58-46fe-9698-23454d8a5f9b | FollowWindCrazyDog/imageProcessing | 资料/colorization/tensor3d.cpp | #include <fstream.h>
#include <math.h>
#include <stdlib.h>
#include "tensor3d.h"
Tensor3d::Tensor3d(int lx, int ly, int lz) {
data = NULL ;
set(lx, ly, lz) ;
}
Tensor3d::Tensor3d(const Tensor3d& other) {
data = NULL ;
*this = other ;
}
real Tensor3d::cube(double x, double y, double z) {
int i,j;
int ix =... | ALGO | 0.996537 | 5.129981 |
04d13f2c-3d87-4814-8cd3-faba8473f5bd | morsalins/Algorithms-and-Data-Structures | Prime Generator/Sieve of Eratosthenes/Number and Sum of Divisors.cpp | #include <cstdio>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
using namespace std;
#define MAX 1000000
#define I64 long long
I64 binPow (I64, I64);
void Sieve ();
I64 NumberOfDivisors (int);
I64 SumOfDivisors (int);
vector <int> primes;
int compo... | ALGO | 0.998177 | 5.451294 |
9d5f1288-4bb1-4d4e-970d-f41b2ab7a923 | rovinbhandari/Programming_Scripting | ProgrammingCompetitions/ACM-ICPC/ACM-ICPC_12/Amritapuri/online contest/ACM-ICPC Amritapuri 2012 Online Competition Accepted Solutions/B/cpp/00010810_B_STICKS_amicpc120490.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main()
{
long long int t,i,j,k,count,x,y,z,n,m;
cin>>t;
while(t--)
{
cin>>n>>m;
long long int a[n],b[m],l=0,d;
count=0;
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<m;i++)
... | ALGO | 0.999907 | 3.078783 |
73645744-78e6-4b01-bc22-80261eb14b65 | 123pk/Topic-wise-Problems | Greedy/C. Circular Local MiniMax.cpp | /*
Platform :- Codeforces
Contest :- Codeforces Round 794 Div 2
Approach :- First we will sort our first array and after that we will check if our second array is sorted or not , if it is not sorted and the elements which we need to
swap are distinct in array 1 we cannot sort it as if we will try to swap th... | ALGO | 0.99998 | 4.726839 |
fbb3014f-494a-4fa1-8ce0-3e8c2283aa30 | barryZZJ/summerACM | 算法/Bilibili/BST_Binary_Search_Tree.cpp | #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
//https://blog.csdn.net/zhouzejun1/article/details/95116453
//1. 查找某个数是否在集合中:从根出发,比当前结点小就找左儿子,否则找右儿子。
//2. 插入:查找应该放的位置,直到这个位置是空的,放入。
//删除:
//谁来填这个点的位置呢?
//1. 首先,新值应该还要维持与父节点的大小关系,所以只能从父节点的单侧子树~(即图中红框)~中找,
//2. 然后看红框内这棵子... | ALGO | 0.999928 | 4.252285 |
a8f8c96e-4a56-4eb0-b762-cc0429281c91 | zhouyong1234/Multi-Sensor-Fusion | 第5章-惯性导航原理及误差分析/05-imu-calib/src/imu_tk/src/calibration.cpp | #include "imu_tk/calibration.h"
#include "imu_tk/filters.h"
#include "imu_tk/integration.h"
#include "imu_tk/visualization.h"
#include <limits>
#include <iostream>
#include "ceres/ceres.h"
using namespace imu_tk;
using namespace Eigen;
using namespace std;
template <typename _T1> struct MultiPosAccResidual
{
Multi... | ALGO | 0.995234 | 5.036423 |
537b4231-fe95-47bc-be9f-ec6ec9589299 | Ayush32/DSA-Interview-Problems- | DSA/BST-Binary Search Tree/4_normal_BST_to_balanced_BST.cpp | class Solution {
void inorderOfBst(TreeNode*root,vector<int>&inorder)
{
if(root == NULL)
return;
inorderOfBst(root->left,inorder);
inorder.push_back(root->val);
inorderOfBst(root->right,inorder);
}
TreeNode* inorderToBst(vector<int>inorder,int start,int end)
... | ALGO | 0.999974 | 6.490592 |
94ff4cc7-c88a-47f7-8924-6e2babf7109d | nerd-sourav/x | GFG POTD/NOVEMBER/20_nov_LCM.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
long long lcmTriplets(long long n)
{
// code here
if (n <= 2)
return n;
if (n % 2 != 0)
{
return n * (n - 1) * (n - 2);
}
else
{
if (n % 3 == 0)
... | ALGO | 0.999987 | 5.945999 |
53127ae8-afc5-454c-ae43-d70756eda09e | free3nvy/CodePractice | leetcode_c++/704.二分查找.cpp | /*
* @lc app=leetcode.cn id=704 lang=cpp
*
* [704] 二分查找
*/
// @lc code=start
class Solution {
public:
int search(vector<int>& nums, int target) {
// 暴力循环法 hhh
// for (int i = 0; i < nums.size(); i++)
// {
// if (nums[i] == target)
// {
// return i... | ALGO | 0.999849 | 6.074336 |
5fd4392b-df70-4f21-bef1-7138fe9ee117 | m3tac1ph4r/Babbar_DSA | arrays/minimize_the_heights_2.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int arr[]={2,6,3,4,7,2,10,3,2,1};
int n=sizeof(arr)/sizeof(arr[0]);
int k=5;
sort(arr, arr + n);
int minnum, maxnum, result = arr[n - 1] - arr[0];
for (int i = 1; i < n; i++)
{
if (arr[i] >= k)
... | ALGO | 0.999865 | 4.141764 |
0584f236-2dfb-465f-8646-8898325435f6 | MMA-JAY/leetcodes | 453. 最小操作次数使数组元素相等.cpp | /*
ĿԴ
https://leetcode.cn/problems/minimum-moves-to-equal-array-elements/description/
https://leetcode.cn/problems/minimum-moves-to-equal-array-elements/solutions/1056443/wei-rao-li-lun-xuan-chu-n-1ge-zeng-jia-1-czj7/
*/
/*
n-1һһһû
*/
class Solution {
public:
int minMoves(vector<int>& nums) {
int l_min ... | ALGO | 0.999974 | 5.505841 |
183e01b4-3a83-47cd-97cd-7b722206a170 | shenhuaze/leetcode | cpp/permutation_sequence.cpp | #include <iostream>
#include <vector>
using namespace std;
string GetPermutation(int n, int k) {
string result;
string num = "123456789";
vector<int> factorial(n, 1);
for (int i = 1; i < n; i++) {
factorial[i] = factorial[i - 1] * i;
}
k -= 1;
for (int i = 0; i < n; i++) {
... | ALGO | 0.999955 | 5.337357 |
46e6197c-73f0-4f1c-a80c-5421997b792e | andrewzolotukhin/codeforces | 1692/A/solution.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int a, b, c, d;
cin >> a >> b >> c >> d;
int r = 0;
if (b > a)
r++;
if (c > a)
r++;
if (d > a)
r++;
cout << r << '\n';
}
}
| ALGO | 0.999651 | 3.517111 |
513f67e6-43c2-4cb9-bd08-0e0a6780fa39 | valida-xyz/valida-compiler | llvm/lib/Support/Z3Solver.cpp | #include "llvm/Config/config.h"
#include "llvm/Support/SMTAPI.h"
using namespace llvm;
#if LLVM_WITH_Z3
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
#include <set>
#include <z3.h>
namespace {
/// Configuration class for Z3
class Z3Config {
friend class Z3Context;
Z3_config Config;
public:
... | TOOL | 0.920701 | 3.7087 |
a9af4dfd-2d48-4a66-bc4c-b8637c417579 | ishandutta2007/codeforces | izban/normal/1237/A.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>... | ALGO | 0.999972 | 3.813906 |
c05789e8-c6ad-4de0-ad85-26cd4f8692b3 | jihad-islam/My-Programming-Brain | 2. C++/6. Array of Objects/4.2.sort_array_of_object_using_sort_function3.cpp | // sort function use kore marks onujayi descending or ascending order e sort. marks same hole roll onujayi ascending or descinding korbo.
#include <bits/stdc++.h>
using namespace std;
class Student
{
public:
string name;
int roll;
int marks;
};
bool cmp(Student a, Student b) // this is the shortest way
{... | ALGO | 0.999671 | 4.812626 |
1421667e-c8b9-4d8e-baae-17a68abd1a5f | 4sunny/cp | 118D.cpp | #include <bits/stdc++.h>
#define nl '\n'
using namespace std;
typedef long long ll;
int inf = numeric_limits<int>::max();
long long llinf = numeric_limits<long long>::max();
int n1, n2, k1, k2;
int dp(bool nStart, int r, int nr, int nk){
if (r == 0){
return 1;
}
int p;
if (r == n1 + k1){
... | ALGO | 0.99977 | 3.415509 |
2fe3f51a-7555-4f28-b41f-6bda137c67ba | GersonCavalheiro/OpenMPSnapshot | May2023/RepCPP/419120644/test.cpp | #include <iostream>
#include <omp.h>
#include <vector>
#include <random>
using namespace std;
int randomize_int(bool nullable = true) {
random_device rd;
auto generator = mt19937(rd());
auto result = (-1) ^ generator() * (!nullable + generator());
return static_cast<int>(result);
}
vector<int> randomize_array(int si... | ALGO | 0.999319 | 4.135712 |
d8ab0c4d-1729-4396-94ef-bd0bd7a90a18 | tokkissi/baekjoon_coding_test | document_search-string.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
string t;
int cnt=0;
int nbe=0;
getline(cin, s);
getline(cin, t);
while(s.find(t, nbe)!=string::npos){
nbe=s.find(t, nbe) + t.length();
cnt++;
}
cout << cnt << "\n";
return 0;
}
| ALGO | 0.99939 | 4.424778 |
d2b86d7e-b57e-4069-9fab-3611b6070a4a | qianglisinoeusa/BioMulti-L-NL-Model | saliency/Saliency_other_models/models/SR/qdct_impl/signum.cpp | /**
* If you use any of this work in scientific research or as part of a larger
* software system, you are requested to cite the use in any related
* publications or technical documentation. The work is based upon:
*
* [1] B. Schauerte, and R. Stiefelhagen, "Quaternion DCT Spectral Saliency:
* Predicting Hu... | ALGO | 0.999443 | 6.035088 |
850fe544-e36f-4042-9d50-1ee02ae0cbb1 | algorithm-skill/AlgorithmAnalysisAndDesignTutorial | 百度和整理的课后习题答案/第7章/3课程安排.cpp | //οhttps://blog.csdn.net/greatjames/article/details/75668477
//ͼpoj 1469 COURSES
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define eps 1e-8
#define I... | ALGO | 0.999905 | 3.936781 |
e26d1119-fc88-4ca9-ae1e-f968133a80ac | Jishad07/Kumarakam_registration | kumarakam/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.998061 | 6.76775 |
84954a38-92de-484d-b767-dfb65d8bd2a8 | rounakraj401/CRACK-INTERN | 116-populating-next-right-pointers-in-each-node/116-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.999936 | 5.675816 |
230b79f4-fc98-4f80-aedc-a5c256e17d7a | kisstom/cppdist | src/cpp/main/algos/psimrank/psimrank_node.cpp | /*
* psimrank_node.cpp
*
* Created on: 2014.06.12.
* Author: kisstom
*/
#include "psimrank_node.h"
PSimrankNode::PSimrankNode() {
logger_ = &log4cpp::Category::getInstance(std::string("PSimrankNode"));
fpIndex_ = 0;
pathIndex_ = 0;
pathLen_ = 0;
numFingerprints_ = 0;
oddIter_ = true;
aCoef_ =... | ALGO | 0.984426 | 4.068786 |
59275ad7-c6df-4d0f-b1c9-d5ed6ca4e7bd | AshrafBasnoe-Github/Flutter | team_management_app/team_management_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.997725 | 6.772262 |
52087a64-5fec-4026-833d-3643693f5765 | delwar03/CF | F_Palindromic_Expression.cpp | #include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define ff first
#define ss second
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;
const int INF = 1e15 + 10;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string magic(int n) {
string s = to_string(n);
... | ALGO | 0.999875 | 4.51287 |
03848e32-5963-4813-a908-c9fcf5dbeb93 | john-George510/Blind-75 | Arrays/Maximum Product Subarray.cpp | #include <iostream>
#include <vector>
#include <climits>
#include <cmath>
using namespace std;
int maxProduct(vector<int>& nums) {
int prod1=nums[0],prod2=nums[0],result=nums[0];
for (int i=1;i<nums.size();i++){
int temp=max(nums[i],max(prod1*nums[i],prod2*nums[i]));
prod2=min(nums[i],min(prod1*nums[i],prod2*n... | ALGO | 0.999919 | 5.666806 |
1750c118-c45a-4334-aced-a6037fb1348a | lzn27/codePuzzle | 114_Flatten_Binary_Tree_to_Linked_List(引用指针)/Solution.cpp | #include<iostream>
#include<algorithm>
using namespace std;
// Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
void flatten(TreeNode* root) {
TreeNode* head = ne... | ALGO | 0.999994 | 5.257449 |
e1386fa1-6517-40ac-938b-b69d774d46bf | chetan2298/CPP-1 | functions.cpp | #include<iostream>
using namespace std;
int swap(int &a, int &b)
{
}
int main()
{
int x,y,z;
x=10;
y=5;
z=add(x,y);
cout<<"Sum is "<<z;
return 0;
}
| ALGO | 0.999437 | 4.725137 |
c802beb6-1449-4486-acee-0dd42c9c2f12 | hjiang13/LLMs-in-IR | POJ-104/33/1940.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
scanf ("%d",&n);
char a[1000][256];
int i,j;
for (i=0; i<n; i++)
{
scanf ("%s",a[i]);
}
for (i=0; i<n; i++)
{
for (j=0; a[i][j]!='\0'; j++)
{
if (a[i][j]=='A')
{
a[i][j]='t';
}
if (a[i][j]=='T')
{
a[i][j]='A';
}
if (a[i][j]=='C')
{
a[i][j]='g';
}
if (a[i][j]=... | ALGO | 0.999703 | 4.3159 |
e88aa88e-3715-485f-ae38-d2774f8e20a2 | marcosmagno/PAA | TP.2.2/ex.cpp | #include <iostream>
#include <utility>
#include <iostream>
#include <vector>
using namespace std;
const int INF = 1000 * 1000 * 1000;
class MinCutStoerWagner {
public: pair<int, vector<int> > min_cut(vector<vector<int> > &g) {
pair<int, vector<int> > res(INF, vector<int>());//res.first is total weight of dele... | ALGO | 0.999659 | 4.405921 |
243dec7d-0f16-4dd9-a931-21c6a2c06472 | Kelvinyu1117/fk-the-algo | codeforce/800/2065A.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
int t;
std::cin >> t;
while(t--) {
std::string s;
std::cin >> s;
int n = s.size();
for(int i = 0; i < n - 2; i++) {
std::cout << s[i];
}
std::cout << 'i' << '\n';
}
ret... | ALGO | 0.994878 | 3.201649 |
e1323eea-eca1-4fc7-a138-e0ed4a43eba6 | dknof/lichtgehen | src/taktik/groesstes_einflussgebiet.cpp | #include "groesstes_einflussgebiet.h"
namespace TaktikNS {
/**
** Standardkonstruktor
**
** @param -
**
** @return -
**
** @version 2014-11-23
**/
GroesstesEinflussgebiet::GroesstesEinflussgebiet() :
Taktik{"größtes Einflussgebiet", "Auf das Feld mit dem größten Einflussgebiet... | ALGO | 0.988255 | 5.549391 |
3f6d8500-07c6-42db-85ba-ec84b0148f24 | jawdan-dev/LeetCode | Solutions/0523.ContinuousSubarraySum.cpp | class Solution {
public:
bool checkSubarraySum(vector<int>& nums, int k) {
// Speed thingies.
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
// Early exit.
if (k == 0) return true;
// Calculation variables.
unordered_map<int, int> activeRemainders;
activeRemainders.emplace(0... | ALGO | 0.999903 | 6.04575 |
8371f611-be93-4b92-b79e-e69d9fc23b53 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_6708_5.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, arr1[50001];
cin >> n >> m;
int arr[50001][6];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> arr[i][j];
}
}
for (int i = 0; i < n; i++) {
int count = 0;
for (int j = 0; j < m; j++) {
int st ... | ALGO | 0.999978 | 3.655016 |
cf44b876-c161-43df-9b8d-fe9213e00f48 | kcalbCube/PVC-16 | include/boost_1_78_0/libs/graph_parallel/test/distributed_dfs_test.cpp | #ifdef BOOST_NO_EXCEPTIONS
void
boost::throw_exception(std::exception const& ex)
{
std::cout << ex.what() << std::endl;
abort();
}
#endif
using namespace boost;
using boost::graph::distributed::mpi_process_group;
// Set up the vertex names
enum vertex_id_t { u, v, w, x, y, z, N };
char vertex_names[] = { 'u',... | ALGO | 0.965122 | 6.875578 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.