uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
68eef7be-687f-445c-9dac-b84bdc23225c | detamos/Cache-Simulator | src/hexToDec.cpp | #include "hexToDec.hpp"
vector<long long int> power(10);
void preCompute()
{
long long int num = 1;
for(int i=0;i<9;i++)
{
power[i] = num;
num *= 16;
}
}
long long int hexToDec(const string &hex)
{
long long int ret = 0;
int n = hex.size();
for(int i=0;i<n;i++)
{
if(hex[i] >= '0' && hex[i] <= '9')
... | ALGO | 0.989273 | 4.961392 |
e35485cf-3b42-456e-8996-f97b1244e93c | kisang0365/baekjoonAlgorithm | 1978.cpp | /*
* 1978.cpp
*
* Created on: 2017. 4. 19.
* Author: chokisang
*/
#include<iostream>
using namespace std;
int main(){
int N;
cin >> N;
int prime[1001] = {0, };
for(int i=1; i<=1000; i++){
int j=i-1;
while(j>=1){
if(j==1) {
prime[i] = 1;
break;
}
if(i%j == 0){
prime[i] = 0;
... | ALGO | 0.99991 | 3.711216 |
e1a88b51-7f1f-4b09-85e3-1219f1e01c45 | vitagon/jpeg-viewer | examples/wavelet_atrous.cpp | #include "CImg.h"
using namespace cimg_library;
#ifndef cimg_imagepath
#define cimg_imagepath "img/"
#endif
// Define convolution mask.
CImg<float> mask(const unsigned char dirIdx, const unsigned char scale) {
const int
d1 = 1 << (scale-1),
d2 = 1 << scale,
c = d2,
vecLen = (1 << (scale + 1)) + 1;
... | ALGO | 0.999207 | 5.085041 |
70bb7bba-c674-4a10-a7d9-b7ac8dc56bd1 | Rahul-Palahwat/LeetCode_Problems | 1493-longest-subarray-of-1s-after-deleting-one-element/1493-longest-subarray-of-1s-after-deleting-one-element.cpp | class Solution {
public:
// Brute force
// int longestSubarray(vector<int>& nums) {
// int ans = 0 , n = nums.size();
// int cnt=0 , flag=0;
// vector<int> store;
// for(int i=0;i<nums.size();i++){
// if(flag==0 && nums[0] == 0){
// flag=1;
// ... | ALGO | 0.999928 | 5.867241 |
13d7ea05-5f46-4582-b91d-50b2772cd4fd | mariobecerra/Analisis_Algoritmos_Tarea_02 | matrixChainOrder.cpp | #include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
List matrixChainOrder(IntegerVector p){
int n = p .size() - 1;
IntegerMatrix m(n + 1, n + 1);
IntegerMatrix s(n + 1, n + 1);
int j, q;
//double inf = 1.0/0.0;
//int inf = std::numeric_limits<int>::max();
int inf = 2147483647;
for(int ... | ALGO | 0.999955 | 3.988462 |
1613fb3b-0bc2-4b6c-b0ad-e2d7b3bf5ef0 | asdadeeeee/OJ | vjudge/chapter1/1_3_POJ3278/a.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <ostream>
#include <queue>
#include <vector>
using namespace std;
int s, e;
int sig[100001];
const int inf = 0x3f3f3f3f;
std::queue<int> points;
bool valid(int x) {
if (x >= 0 && x <= 100000 && sig[x] == inf) {
return true;
... | ALGO | 0.999836 | 3.4587 |
c4291775-4777-42de-a5d3-9925bc5a6b4d | aTom3333/Schmou-TSE | src/Utilitaires/Collision.cpp | #include "Collision.h"
#include <cmath>
const double PI = acos(-1);
sf::Vector2f centre_transforme(const sf::CircleShape& c)
{
const double theta = c.getRotation() / 180 * PI;
auto z = sf::Vector2f{c.getRadius(), c.getRadius()} - c.getOrigin();
z.x *= c.getScale().x;
z.y *= c.getScale().y;
const s... | ALGO | 0.997168 | 5.583198 |
5d838683-2ee7-47b9-9f97-ac8422e0cdb2 | Corvus-AOSP/android_frameworks_base | libs/hwui/utils/HostColorSpace.cpp | // This is copied from framework/native/libs/ui in order not to include libui in host build
#include <ui/ColorSpace.h>
using namespace std::placeholders;
namespace android {
static constexpr float linearResponse(float v) {
return v;
}
static constexpr float rcpResponse(float x, const ColorSpace::TransferParame... | TOOL | 0.924839 | 7.644052 |
3f79b1cf-7f8c-4cf9-bc72-746e6533de5d | saqibbedar/CPlusPlusLearningHub | PSP 1st Semester 📖/Functions/MinMax.cpp | // write a function to check small and maximum number in an array
#include <iostream>
using namespace std;
const int SIZE = 5;
void inputArray(int a[SIZE]) {
for (int i = 0; i < SIZE; i++) {
cin >> a[i];
}
}
void minNum(int a[SIZE]){
int min = a[0];
for (int i = 0; i < SIZE; i++)
{
... | ALGO | 0.999209 | 4.067337 |
0f19d1eb-ea43-4f44-8aad-41ff57faf824 | pachecowillians/URI | 1789.cpp | #include <iostream>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <stack> //pilha
#include <queue> //fila
#include <functional>
#include <tr1/functional> //hash
#include <vector>
#include <cstring>
#include <string>
#include <stdlib.h>
#include <bits/stdc++.h>
#include <unordered_map... | ALGO | 0.999067 | 3.663073 |
bb8abf5c-2f15-4ac2-8b7f-a8a8ad160ffe | sumedhiscoding/Algozenith_Codes | PhaseTest.cpp/question9.cpp | #include <bits/stdc++.h>
using namespace std;
bool isValid(const string &temp) {
if (temp.empty() || !islower(temp[0])) {
return false;
}
size_t it = temp.find('/');
size_t it2 = temp.find('\\');
if (it == string::npos || it2 == string::npos || it2 <= it + 1) {
return false; // Bo... | ALGO | 0.994695 | 5.160929 |
bbf8da93-2f64-4bd8-83fa-022bdf266a4d | JY1Lnz/Contests | 2018.12.14实训赛3/B.cpp | #include<bits/stdc++.h>
using namespace std;
int getreverse(int n)
{
if (n < 10)
return n;
int x = 0;
return n%10+getreverse(n/10);
}
bool primer(int n)
{
for (int i = 2;i*i<=n;i++)
if (n%i == 0)
return false;
return true;
}
int main()
{
int n;
while(cin>>n)
... | ALGO | 0.999977 | 3.97751 |
c965c772-55ea-4ecc-ac8d-3be1613e755b | Adiihub/DSA | 11 - DP/2-StairCase.cpp | #include <iostream>
#include <vector>
using namespace std;
// Dynamic Programming (Efficient, O(n) Time & O(n) Space)
#include <bits/stdc++.h>
using namespace std;
vector<int> memo(1000, -1); // Initialize a memoization table with -1
int fib(int n) {
if (n == 0 || n == 1) return n;
if (memo[n] != -1) retu... | ALGO | 0.999991 | 6.156259 |
53a6dce4-9f29-4b54-a557-985ac4e3ce26 | RenderHeads/MayaPlugin-VertexChameleon | VertexChameleon/Random.cpp | // Random number generator based on Mersenne Twister.
// http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
#define MNoVersionString
#include "MayaPCH.h"
#include "Random.h"
RandomMT gRand;
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
#define UMASK 0x80000000UL /* most significant w-r bits */
#defin... | ALGO | 0.997109 | 6.532728 |
93307b8c-e78d-42ae-bffa-04e947a054e0 | KSH-code/Problem-Solving | 1086.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[32768][100];
int N;
string strs[15];
int mod;
int s[15][100];
ll dfs(int bits, int r) {
if (dp[bits][r] != -1) return dp[bits][r];
ll result=0;
if (bits == (1<<N)-1) result += r==0;
for (int i = 0; i < N; i++) {
if (... | ALGO | 0.999942 | 4.386694 |
45af0150-88f3-4bd0-a0e0-306630571823 | Mr-NSK/AR_Object_Detection | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
5b19e569-6a98-472c-a134-82036f97fd0e | saqibshafin/ostad-cracking-coding-interview | week3-string/assignmentSubmit_validString_v1.cpp | // Time complexity: Not sure, but probably much faster than o(n^2)
// Space complexity: o(1)
// <---------- What exactly is meant by Brackets closed in same order?
// ---------->
// #include <iostream>
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
int main() {
string bracesOnlyString;
bool in... | ALGO | 0.998108 | 5.247535 |
4809d6ae-3280-4838-86f2-97d00cca6a84 | rajansahu713/Working-with-C-and-Cpp | swaping class value using friend.cpp | #include<iostream>
using namespace std;
class B;
class A
{
int value;
public:
void accept(int x)
{
value=x;
}
void disp()
{
cout<<"A "<< value<<endl;
}
friend void exchange(class A &a,class B &b);
};
class B
{
int value1;
public:
void accept(int y)
{
value1=y;
}
void disp()
{
cout<<"B "<<v... | ALGO | 0.991741 | 4.570055 |
b77367ef-f338-4d4b-bafe-7c5b89f03a7e | riddhij16/dsa | Random/Fbhackercup/A1: Consistency - Chapter 1-Code.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
bool isvowel(char c){
if(c=='A' || c=='E' || c=='I' || c=='O' || c=='U') return true;
return false;
}
int solve(string &s){
if(s.size()==1) return 0;
int count=0;
int con=0,vow=0;
int freqcon=INT_MIN,freqvow=INT_MIN;
unordere... | ALGO | 0.999927 | 5.597924 |
4fcd6858-72e7-4f62-b543-2037ad638673 | ayushrakesh/Data-Structures-and-Algorithms | 0617-merge-two-binary-trees/0617-merge-two-binary-trees.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.999995 | 5.971289 |
05b46f35-f7dd-4036-82b8-d41585360bfc | veblen34/DL_final | Decompose_retrieval/Dessert-main-v4/deps/eigen/failtest/jacobisvd_int.cpp | #include "../Eigen/SVD"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
JacobiSVD<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| ALGO | 0.980958 | 3.327923 |
d0559bd1-caf1-4162-8dbb-1dc8241b63e6 | bhavyawig/Competitive-Programming | GukiZ and Contest codeforces.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main()
{
lli n;
cin>>n;
lli a[n],s[n];
for(lli i=0;i<n;i++)
{
cin>>a[i];
}
lli count=0;
for(lli i=0;i<n;i++)
{
count=0;
for(lli j=0;j<n;j++)
{
if(j!=i && a[j]>a[i])
{
c... | ALGO | 0.999921 | 3.207728 |
bdf98a02-e22e-403f-b52b-c0886f6fdc91 | YILINQ/biharmonic_distance | libigl/include/igl/cut_to_disk.cpp | #include "cut_to_disk.h"
#include <map>
#include <set>
#include <deque>
#include <algorithm>
namespace igl {
template <typename DerivedF, typename Index>
void cut_to_disk(
const Eigen::MatrixBase<DerivedF> &F,
std::vector<std::vector<Index> > &cuts)
{
cuts.clear();
Index nfaces = F.rows();
... | ALGO | 0.992308 | 4.886522 |
3c938fab-93a8-479d-8045-97786a63ce8b | zxc12523/test | hw1/p2.cpp | #include "bits/stdc++.h"
using namespace std;
#define eb emplace_back
#define fi first
#define se second
#define pii pair<int, int>
#define MOD 1000000007
#define FastIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define int long long
#de... | ALGO | 0.999785 | 3.526309 |
ca19db62-b83e-4626-ba87-284fa4cc8164 | ishandutta2007/codeforces | adam_gs/normal/1537/D.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define pb push_back
#define st first
#define nd second
#define all(a) a.begin(), a.end()
#define lg(a) (31-__builtin_clz(a))
bool potega(int p, int n) {
while(n%p==0) n/=p;
... | ALGO | 0.999979 | 4.699167 |
20799ddc-b4d0-4628-985e-da6ada053586 | revyos-rocm/llvm-project-rocm | libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp | // <vector>
// iterator erase(const_iterator position);
#include <vector>
#include <iterator>
#include <cassert>
#include "asan_testing.h"
#include "min_allocator.h"
#include "MoveOnly.h"
#include "test_macros.h"
#ifndef TEST_HAS_NO_EXCEPTIONS
struct Throws {
Throws() : v_(0) {}
Throws(int v) : v_(v) {}
Throw... | TEST | 0.893782 | 7.892087 |
b9f58511-9d3a-40d5-826f-de99f3021259 | ishandutta2007/codeforces | snuke/normal/759/A.cpp | #include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitse... | ALGO | 0.999796 | 3.593506 |
dd683430-8515-4852-988e-bb00345d8328 | Fraunhofer-AISEC/guarantee-llvm | clang-tools-extra/clang-tidy/utils/OptionsUtils.cpp | #include "OptionsUtils.h"
namespace clang {
namespace tidy {
namespace utils {
namespace options {
static const char StringsDelimiter[] = ";";
std::vector<std::string> parseStringList(StringRef Option) {
SmallVector<StringRef, 4> Names;
Option.split(Names, StringsDelimiter);
std::vector<std::string> Result;
... | TOOL | 0.937851 | 7.261842 |
a355843b-3561-4664-ae77-091ee8caaf72 | fywc/CodeForces | Div.4/871/E_The_Lakes.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3+10;
int matrix[MAXN][MAXN];
int get_volume(int n, int m, int i, int j, int temp_volume)
{
if(i < 0 || i >= n || j < 0 || j >= m) {
return temp_volume;
}
if(matrix[i][j] == -1 || matrix[i][j] == 0) {
return temp_volume;
... | ALGO | 0.999691 | 4.929514 |
bc57fcc9-adbd-4c12-9783-65832292a098 | Jialin/ICPC | Archive/Codeforces/1326-D.cpp | // First batch includes
#include "common/include.h"
#include "common/macros.h"
#include "debug/debug_declare.h"
#define MANACHER_CALC_CHAR_ARRAY
#define MANACHER_EVEN_LOWER
#define MANACHER_EVEN_UPPER
#define MANACHER_ODD_LOWER
#define MANACHER_ODD_UPPER
#define MANACHER_RESERVE
#include "string/palindrome/manacher_ma... | ALGO | 0.999975 | 4.537752 |
0b756618-4714-4a82-ba30-14a63f6fe008 | sonygod/blender_3 | extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp | #if defined(_WIN32) || defined(__i386__)
#define BT_USE_SSE_IN_API
#endif
#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
#include "btConvexPolyhedron.h"
#include "LinearMath/btConvexHullComputer.h"
#include <new>
#include "LinearMath/btGeometryUtil.h"
#include "LinearMath/btGrahamScan2dConvexHull... | ALGO | 0.992533 | 6.122885 |
86e383e6-9117-42f9-9d82-d9f229999255 | JoaoASousa/Hackerrank | C++/STL/lowerBound-Stl.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n; cin >> n;
vector<int> v;
int element;
for (size_t i = 0; i < n; ++i) {
cin >> elem... | ALGO | 0.999972 | 4.545737 |
a6767d45-a793-4a1f-81b4-490f81260b62 | zhiz-m/Competitive-Programming | each_edge_MST.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define SZ(x) (int)(x).size()
#define rep(i,a,b) for (int i=a;i<b;i++)
#define per(i,a,b) for (int i=b-1;i>=a;i--)
#define each(a,x) for(auto&a:(x))
#define DEB... | ALGO | 0.999975 | 4.118518 |
a9293998-470b-4edc-aa35-ea9e9673236c | ZeroSum24/Operating-Systems-2018 | os-coursework/coursework-skeletons/sched-rr.cpp | /*
* Round-robin Scheduling Algorithm
* SKELETON IMPLEMENTATION -- TO BE FILLED IN FOR TASK (1)
*/
/*
* STUDENT NUMBER: s
*/
#include <infos/kernel/sched.h>
#include <infos/kernel/thread.h>
#include <infos/kernel/log.h>
#include <infos/util/list.h>
#include <infos/util/lock.h>
using namespace infos::kernel;
usin... | ALGO | 0.986051 | 5.29502 |
b48c2e7a-f853-4c4c-9e31-649a49bd92b4 | tarstars/coeff_tune | eralde/homework/1-02-cpp/main.cpp | // Оператор for: ввести из входного потока целое число n.
// Вывести на печать первые n чисел последовательности Фиббоначи 1,1,2,3,5,8...
#include <limits.h>
#include <cmath>
#include <iostream>
#include <string>
#define MAX_N 100
using std::cin;
using std::cout;
using std::endl;
using std::string;
double ... | ALGO | 0.999863 | 5.065485 |
df89887e-f3ec-440a-84d6-9a194323f86c | quanvo0112/Intro-To-Algorithms-Complexity | BTLan2/main.cpp | #include <iostream>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <chrono>
#include <random>
#include <cstdint>
#include <fstream>
#include <string>
#include "kadane.cpp"
#include "bruteforce.cpp"
#include "divideconquer.cpp"
std::vector<int64_t> generate_random_array(int64_t siz... | ALGO | 0.982021 | 5.982974 |
410003ea-1481-4c3c-88f1-7061ae9c149f | gene1974/DistributedCache | LRU.cpp | #include<iostream>
#include"LRUCache.h"
using namespace std;
int main()
{
LRU_Cache* lruCache = new LRU_Cache(5);
lruCache->Insert("0", 0);
lruCache->Insert("bv", 2);
lruCache->Insert("cd", 3);
lruCache->Insert("ef", 5);
lruCache->Insert("gh", 4);
cout << "The size is " << lruCache->GetSize() << endl;
cout <<... | TOOL | 0.888874 | 4.101753 |
634ae59e-a3fd-413f-a2da-94eab97393aa | xiangflight/algopc | hdu100/problem2025.cpp | //
// Created by xiang on 2019/9/25.
//
// Description:
// 对于输入的每个字符串,查找其中的最大字母,在该字母后面插入字符串“(max)”。
//
// Input:
// 输入数据包括多个测试实例,每个实例由一行长度不超过100的字符串组成,字符串仅由大小写字母构成。
//
// Output:
// 对于每个测试实例输出一行字符串,输出的结果是插入字符串“(max)”后的结果,如果存在多个最大的字母,就在每一个最大字母后面都插入"(max)"。
//
// Sample:
//
// abcdefgfedcba -> abcdefg... | ALGO | 0.999665 | 5.239644 |
020f1834-5585-457a-9287-30c57b8e02dd | appinho/SDCND_P10_ModelPredictiveControl | src/Eigen-3.3/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.997266 | 4.092313 |
df550b73-c947-47e4-ab8d-c6aef6e486cb | aqshanto/Binary_Search | LUV/Aggresive_cow_spoj.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
double pi= 3.141592653589793238462643383279;
const int stmax=1e5+10;
int st,cow;
int stloc[stmax];
bool isPlacePos(int mindif){
int lastpos=-1,cowcnt=0;
for(int i=0;i<st;i++){
if(stloc[i]-lastpos>=mindif || lastpos==-1... | ALGO | 0.999958 | 4.210503 |
f14aa15c-3df5-4be5-aed0-e9bb9d1b6d4e | ShabbirHasan1/litepool | third_party/boost_1_83_0/libs/graph/example/connected-components.cpp | int main()
{
using namespace boost;
typedef adjacency_list< vecS, vecS, undirectedS > Graph;
const int N = 6;
Graph G(N);
add_edge(0, 1, G);
add_edge(1, 4, G);
add_edge(4, 0, G);
add_edge(2, 5, G);
std::vector< int > c(num_vertices(G));
int num = connected_components(
G... | ALGO | 0.963226 | 5.574742 |
ff0c5420-46ed-4c5b-9c43-9d771d82c7fa | GittyGetty/InterviewPractice | InterviewC/LinkedLists.cpp | #include <memory>
#include <iostream>
#include "LinkedLists.h"
/************************************************************************************/
struct node {
node(int v) {
this->v = v;
this->next = NULL;
}
int v;
node* next;
};
/***************************************************************************... | ALGO | 0.999879 | 4.918383 |
37c0a8e1-d0e4-4d2b-84c9-84f72c80fccf | khushali3110/C- | Loop/tempCodeRunnerFile.cpp | #include<iostream>
// using namespace std;
// int main(){
// char choice = 'y';
// while(choice == 'y' || choice == 'Y' )
// {
// int start;
// cout<<"Enter Start Number :";
// cin>>start;
// int end;
// cout<<"Enter end number : ";
// cin>>end;
// for(int num = start; num<=end; num+... | ALGO | 0.992378 | 3.434593 |
3c861738-89c6-440e-913a-46bfc2ad4d16 | CitrusSin/AlgorithmProblemAnswers | Luogu/P1044.cpp | #include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
ull solve(int n) {
if (n <= 1) {
return 1;
}
ull seq[n+1];
seq[0] = 1;
seq[1] = 1;
for (int n2 = 2; n2 <= n; n2++) {
seq[n2] = 0;
for (int i=0; i<n2; i++) {
seq[n2] += seq[n2-1-i]... | ALGO | 0.999995 | 5.197822 |
e1143f17-4ed3-4d77-8df7-7b3cb96b09df | Andy87877/Codewars | (8)You only need one - Beginner.cpp | // https://www.codewars.com/kata/57cc975ed542d3148f00015b/train/cpp
#include <bits/stdc++.h>
using namespace std;
bool check(const vector<string>& seq, const string& elem) {
for (auto i: seq) {
if (elem == i) {
return true;
}
}
return false;
}
| ALGO | 0.999314 | 5.572645 |
e219659d-a0a1-4551-9f39-a70f8dbc7cff | REAL-SUNGWOO/CPP_Practice_2025 | 14.cpp | //Ʈ2 4 stack Ŭ
// stack class (̳ ̺귯)
#include<iostream>
#include<iomanip>
#include<stack>
#include<string>
using namespace std;
int main(void) {
string str;
stack<char> test;
cout << "ڿ Է: "; getline(cin, str);
for (int i = 0; i < str.size(); i++)
{
test.push(str[i]);
}
cout << "ڿ : ";
for (int i = 0; ... | ALGO | 0.99743 | 3.757437 |
5db33957-590b-4c63-93db-6985534fc160 | ishandutta2007/codeforces | forza_ferrari/normal/1696/F.cpp | #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
using namespace std;
int t,n,sum;
vector<int> v[101],node[101];
bool tag[101][101][101],vis[101];
inline void dfs(int k,int f,int deep)
{
node[deep].emplace_back(k);
for(int i:v[k])
{
if(i==f)
continue;... | ALGO | 0.999961 | 3.765885 |
d346723c-ce3c-406e-9265-18d9a38f83d3 | Fari27/Aventus_ecommerce | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
96e1068d-5313-4bdc-9e91-78bce226d43e | ianeesdev/data-structures-and-algorithms | SortingAlgo's/BubbleSort.cpp | #include<iostream>
using namespace std;
class sort {
public:
int *arr;
int size;
sort() {
int x;
cout << "Enter length of list: ";
cin >> x;
size = x;
arr = new int[size];
}
void bubbleSort(int array[]) {
int temp;
for (int i = (size - 1... | ALGO | 0.99925 | 4.588076 |
948d5b7b-076f-462c-82ad-196044ab70c4 | arvind-crate-7/Compatative-Coding | LeetCode/169 Majority Element.cpp | int majorityElement(vector<int>& nums) {
int cnt=0;
int n=nums.size();
int el;
for(int i=0;i<n;i++){
if(cnt==0){
el=nums[i];
cnt++;
}else if(nums[i]==el) cnt++;
else cnt--;
}
int ans=-1;
cnt=0;
for(i... | ALGO | 0.999966 | 5.050425 |
a8a84d03-7269-4f32-9718-283f06967a3d | jencymaryjoseph/learned-cardinality-duckdb | duckdb/extension/tpcds/dsdgen/dsdgen-c/parallel.cpp | #include "config.h"
#include "porting.h"
#include "init.h"
#include <stdio.h>
#include "r_params.h"
#include "scaling.h"
#include "tdefs.h"
#include "genrand.h"
/*
* Routine: split_work(int tnum, worker_t *w)
* Purpose: allocate work between processes and threads
* Algorithm:
* Data Structures:
*
* Params:
* Re... | DATA | 0.976724 | 6.737086 |
8f60bc95-59e4-45fd-a313-87841483afbe | Sudip-Chel/DSA-from-Scratch | LinkedList/reverseLinkedListRecursive.cpp | /*iven the head of a singly linked list, reverse the list, and return the reversed list.
Example 1:
Input: head = [1,2,3,4,5]
Output: [5,4,3,2,1]
Example 2:
Input: head = [1,2]
Output: [2,1]
Example 3:
Input: head = []
Output: []
Constraints:
The number of nodes in the list is the range [0, 5000].
-5000 <= Node.v... | ALGO | 0.999804 | 5.92449 |
53f2d0fa-8afb-41ce-95ae-23c79b8fde1f | Not-Satya/Cpp_Basics | pascalTriangle.cpp | /*
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
This is the pascal's triangle
If each position has coordinates (x,y)
where x is the row number and y is the column number
Then the values at position (x,y) is determined by xCy
*/
#include <iostream>
using namespace std;
int fac(int n) //Calculates the factorial
{
int p=1;
... | ALGO | 0.99994 | 4.601963 |
7bce905a-a8b7-4d15-92db-72f85d8f94c2 | DustinBaek/Projects | Resources/opencv_contrib-master/opencv_contrib-master/modules/face/samples/facemark_demo_lbf.cpp | /*
This file was part of GSoC Project: Facemark API for OpenCV
Final report: https://gist.github.com/kurnianggoro/74de9121e122ad0bd825176751d47ecc
Student: Laksono Kurnianggoro
Mentor: Delia Passalacqua
*/
/*----------------------------------------------
* Usage:
* facemark_demo_lbf <face_cascade_model> <saved_model... | DATA | 0.948826 | 4.404443 |
6454c3b2-20a1-4b97-8826-24bd3d0637f3 | nutan-sangani/CP-Practice | Mashup Contest/D_Turtle_vs_Rabbit_Race_Optimal_Trainings.cpp | #include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define forLoop for(int i=0;i<n;i++)
#define pii pair<int,int>
#define pb push_back
#define pll pair<ll,ll>
#define mp make_pair
#define um unordered_map
#define us unordered_set
#define umll unordered_map<ll,ll>
#define omll map<ll,ll>
#define vecll vect... | ALGO | 0.999958 | 4.215383 |
91dad0a6-bad8-4a08-a55c-19d75f004559 | hkmangla/cppProgramms | dp2.cpp | #include<iostream>
using namespace std;
int dp(int a[], int n)
{
int i,b[n];
int res,re=0,min = INT_MAX;
for(i=0;i<n-1;i++)
{
for(int j=0;j<i;j++)
b[j]=a[j];
b[i]=(a[i]+a[i+1])%100;
for(int j=i+1;j<n-1;j++)
b[j]=a[j+1];
res = a[i]*a[i+1] + dp(b,n-1);
if(min>res)
min=res;
re = min;
}
return re;
}... | ALGO | 0.999847 | 3.768943 |
86b0f96e-34c3-4da3-8b3d-ad31b3eb4845 | inferno986return/eldritch-mirror | Eldritch-Source/Code/Projects/Eldritch/src/PEs/wbpeelddistance.cpp | #include "core.h"
#include "wbpeelddistance.h"
#include "Components/wbcompeldtransform.h"
WBPEEldDistance::WBPEEldDistance()
{
}
WBPEEldDistance::~WBPEEldDistance()
{
}
/*virtual*/ void WBPEEldDistance::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam ) const
{... | TOOL | 0.897427 | 6.530457 |
54840472-5651-43a6-b0c2-d281e38ebc1b | IMSLGGYU/OpenCV-with-CUDA | opencv-4.10.0/samples/cpp/convexhull.cpp | #include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
static void help(char** argv)
{
cout << "\nThis sample program demonstrates the use of the convexHull() function\n"
<< "Call:\n"
<< argv[0] << endl;
}
int main( int argc, c... | ALGO | 0.988256 | 6.031953 |
e067910c-5dd2-4486-a5f3-3b65c6f564f8 | BodhiDog/OJCode | Luogu/P3225.cpp | #include <bits/stdc++.h>
using namespace std;
const int R = 1e3 + 10;
vector<int> son[R];
int dfn[R], low[R], tme, root, cptot, notcptot, gcnt, group[R];
bool cp[R];
void tarjan(int x, int f)
{
int soncnt = 0;
dfn[x] = low[x] = ++tme;
for (int to : son[x])
{
if (to != f)
{
if (!dfn[to])
{
++soncnt;
... | ALGO | 0.999569 | 4.468963 |
214e0c58-88f0-49ab-955d-602575dfe265 | zhbom25/my-leetcode | test_257.cpp | //
// Created by zhaobo on 2022/3/2.
//
#include "TreeNode.h"
class Solution {
public:
vector<string> binaryTreePaths(TreeNode* root) {
vector<string> ret;
if (root == nullptr) return ret;
if (root->left == nullptr && root->right == nullptr) {
ret.push_back(to_string(root->val))... | ALGO | 0.998972 | 6.311927 |
20c0b976-5a7a-4140-a7b7-10d6e46fce68 | KarthikDhulipati/Personal-Programmes | C++ Programs/ArmstrongNumber.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n;
cout<<"Enter a number: ";
cin>>n;
int sum=0, originaln=n;
while (n>0){
int lastdigit=n%10;
sum+=pow(lastdigit,3);
n=n/10;
}
if(originaln==sum){
cout<<"The number "<<originaln<<" is an ... | ALGO | 0.999781 | 4.628957 |
cd50227f-763e-4b53-b886-9819c1b80d5b | Arsssenij/Lab7-1 | boost/libs/program_options/src/value_semantic.cpp | #ifndef BOOST_PROGRAM_OPTIONS_SOURCE
# define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/config.hpp>
#include <boost/program_options/value_semantic.hpp>
#include <boost/program_options/detail/convert.hpp>
#include <boost/program_options/detail/cmdline.hpp>
#include <set>
#include <cctype>
nam... | TOOL | 0.986121 | 7.625994 |
133e1fbd-6240-49ea-9bfe-1ac1f79ed452 | Prachi309/GFG-Questions | Difficulty: Medium/Shortest Distance in a Binary Maze/shortest-distance-in-a-binary-maze.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int shortestPath(vector<vector<int>> &grid, pair<int, int> source,
pair<int, int> destination) {
// code... | ALGO | 0.999953 | 6.110398 |
9a61d120-23e3-4890-a3ec-f90ad2ef0f57 | Blaster2398/CodeForces_git | B_Good_Kid.cpp | #include<bits/stdc++.h>
using namespace std ;
int product(int arr[],int j, int n){
int res=1;
arr[j]+=1;
for(int i=0; i<n; i++){
res*=arr[i];
}
arr[j]-=1;
return res;
}
int main(){
int t;
cin>> t;
while(t--){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
... | ALGO | 0.999961 | 3.923492 |
ce81fa83-4735-4ac6-9979-d2cfb4c568a9 | vbonnici/grafe-sim | analysis/data/p02255/s237723090.cpp | #include <iostream>
using namespace std;
void trace(int a[],int n){
for(int i=0;i<n;++i){
if(i>0){
cout << " ";}
cout <<a[i];
}
cout << endl;
}
void isort(int a[],int n){
int j,v;
for (int i=1;i<n;++i){
v=a[i];
j=i-1;
while(j>=0&&a[j]>v){
... | ALGO | 0.99991 | 4.465439 |
95a27d4b-76cd-49dd-8c58-0b070e88d623 | jvkersch/hsmmlearn | hsmmlearn/_hsmm/src/dCalc.cpp | #include "dCalc.h"
#include <iostream>
using namespace std;
void CalcStoreD()
{
double x;
int j, u, v;
// Store D
for (j = 0; j < J; j++) {
for (u = 1; u <= M; u++) {
x = 0;
for (v = u; v < M + 1; v++)
x += d[j][v];
D[j][u] = x;
}
for (u = M + 1; u <= tau; u++)
{
D[j][u] = 0;
}
}
... | ALGO | 0.99451 | 3.070608 |
e6dfc9c4-91cf-4559-8265-ad59f599d0e5 | GowriUmesh/ExposureControl | main.cpp | /**
* Authors: Gowri Umesh <<EMAIL>>
Abigail Pop
* Created: 24.Jun.2020
* Version: 0.1
*
* Description: This code implements the exposure control by maximizing
* a robust gradient-based image quality metrics to improve robustness
* of visual odometry in challenging illumination conditions ... | ALGO | 0.998141 | 6.479079 |
cb320f68-23fe-45e1-ae75-92423abfdab8 | YJK0805/onlinejudge_ac_code | Kattis/Prva.cpp | // Problem: Prva
// Contest: Kattis
// URL: https://open.kattis.com/problems/prva
// Memory Limit: 1024 MB
// Time Limit: 1000 ms
#include <bits/stdc++.h>
using namespace std;
char a[25][25];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
long long r,c;
cin>>r>>c;
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
... | ALGO | 0.999955 | 4.015372 |
c3de0f41-ec0f-4464-83a2-cda8195c5f3e | namemaksim/--CPP-- | PZ_6_2/PZ_6_2.cpp | /* № 2 Дано число R и список размера N.Найти два соседних элемента списка, сумма которых
наиболее близка к числу R, и вывести эти элементы в порядке возрастания их индексов
(определение наиболее близких чисел - то есть такой элемент AK, для которого
величина | AK - R | является минимальной). */
#include <iostream>
#in... | ALGO | 0.999833 | 3.761181 |
ca2547cc-33fc-4ae5-a992-86e7c90caf34 | ItsOpaz/prog2 | student/06/network/main.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
const std::string HELP_TEXT = "S = store id1 i2\n P = print id\n"
"C = count id\n D = depth id";
std::vector<std::string> split(const std::string& s, const char delimiter, bool ignore_empty = false)... | ALGO | 0.850485 | 4.243684 |
639248ef-2660-4027-ae10-71b7e4439a01 | phitronio/Conceptual-Sessions-Code | Batch 6/Data Structure/Week 1-1/divisors.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
for (int tc = 1; tc <= t; tc++)
{
int n;
cin >> n;
vector<int> divisors;
for (int i = 1; i <= sqrt(n); i++)
{
if (n % i == 0)
{
divisors.push_b... | ALGO | 0.998818 | 5.021881 |
79877b38-1ea8-4983-88d5-e6760ce13f33 | wooseokCho/ps_study | 지은/programmers/12919.cpp | #include <string>
#include <vector>
using namespace std;
string solution(vector<string> seoul) {
string answer = "";
for(int i=0; i<seoul.size(); i++){
if(seoul[i]=="Kim"){
answer= "김서방은 "+to_string(i)+"에 있다";
break;
}
}
return answer;
} | ALGO | 0.990309 | 5.148391 |
8e6e5f0f-34c9-4c14-bc52-4b1febb84124 | ricglz/COJ-Problems | 1000-1999/1300.cpp | #include <cstdio>
int main(int argc, char const *argv[]){
bool exists[42] = {false};
int count = 0, aux, modulus;
for (int i = 0; i < 10; ++i){
scanf("%u", &aux);
modulus = aux%42;
if(!exists[modulus]){
exists[modulus]=true;
count++;
}
}
printf("%i\n", count);
return 0;
} | ALGO | 0.992218 | 3.598057 |
6b26f91a-44fc-4ffb-8f4c-e73b13502ee7 | alisherfw/cplusplus-problem-solve | case/case5.cpp | #include <iostream>
using namespace std;
int main()
{
float A, B;
int C; //C - amal butun soni.
cout << "A="; cin >> A;
cout << "B="; cin >> B;
cout << "Amal kiriting(1-qo'shish;2-ayirish;3-bo'lish;4-ko'paytirish;):"; cin >> C;
switch (C)
{
case 1: cout << A+B; break;
case ... | ALGO | 0.96265 | 3.067233 |
32b3c0c1-7f5c-42b0-b4dd-490464173fb3 | ayushsrawat/leetcodes | DifferenceofTwoArrays/sol3.cpp | class Solution {
public:
vector<vector<int>> findDifference(vector<int>& nums1, vector<int>& nums2) {
unordered_map<int,int> inone;
unordered_map<int,int> intwo;
for(int ele:nums1){
inone[ele]++;
}
for(int ele:nums2){
intwo[ele]++;
}
... | ALGO | 0.999983 | 6.030302 |
64396ecd-046c-4f09-952f-162e0cb5787b | bollu/alok-bollu | word2blank/ongoing/word2grass/compute-accuracy.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <stdlib.h>
#include <ctype.h>
#include <armadillo>
#include <iostream>
#include "grad.h"
//compute-accuracy /path/to/model.bin < questions-words.txt > output-file.txt
using namespace std;
using namespace arma;
co... | ALGO | 0.996966 | 5.424545 |
9894a332-ff1b-4fc2-b819-c96700be1c89 | CloudeaSoft/data-structure-examples | cpp.SameBST/cpp.SameBST.cpp | #include <iostream>
using namespace std;
typedef struct TreeNode
{
int data;
bool flag;
TreeNode* Left;
TreeNode* Right;
TreeNode(int d) {
data = d;
flag = false;
Left = Right = NULL;
}
}*tree;
void insertNode(tree& root, int x);
bool findNode(tree root, int x);
void clearTree(tree root);
int main()
{
i... | ALGO | 0.999971 | 3.66676 |
b2274772-6cdb-442f-92d1-dd5a2f3f0698 | Nidhiverma04/ADA | LAB_10/nQueens_mirror.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int MAX_SOLUTIONS = 100;
bool place(int k, int i, int* x) {
for (int j = 0; j < k; j++) {
if (x[j] == i || abs(j - k) == abs(x[j] - i)) {
return false;
}
}
return true;
}
void print(int* x, int n) {
cout ... | ALGO | 0.999923 | 6.076071 |
08962d41-9008-433d-a104-07049037aeef | Peter-Ball/cpp-sandbox | name-frame.cpp | #include <iostream>
#include <string>
int main()
{
// Get the name
std::cout << "Please enter your first name: ";
// name can't be const because it is not initialized immediately
std::string name;
std::cin >> name;
// Build the message
// Use = to initialize a variable value
// us... | TOOL | 0.963205 | 4.483548 |
61e4fabf-a358-48cc-a0fb-a4ebe3fecaf3 | raiaqt/kattis-submissions | FastFood.cpp | #include <cstdio>
#include <iostream>
using namespace std;
int main()
{
int n, m, test;
int qty[10];
int reqs[10][30];
int prize[10];
int sticker[30];
scanf("%d", &test);
for (int t = 0; t < test; t++) {
scanf("%d", &n);
scanf("%d", &m);
for (int i = 0; i... | ALGO | 0.996342 | 3.303394 |
b15b6daa-98c2-4da5-a486-095125cac12d | WXY666541/cplusplus | vector.cpp | #include<iostream>
template<typename T>
class Link
{
public:
Link()
{
T* parr = new T[2];
cursize = 0;
totalsize = 2;
}
void resize()
{
T* pdata = new T[totalsize * 2]();
memcpy(pdata, parr, sizeof(int) * totalsize);
delete[] parr;
parr = pdata;
totalsize *= 2;
}
void InsertPos(int pos, T val)
... | ALGO | 0.996207 | 4.301534 |
b3a41c8a-1b63-4700-9925-7c5757d8bbff | Luiz-Monad/opencv-android-lib | app/opencv/modules/calib3d/src/polynom_solver.cpp | #include "precomp.hpp"
#include "polynom_solver.h"
#include <math.h>
#include <iostream>
int solve_deg2(double a, double b, double c, double & x1, double & x2)
{
double delta = b * b - 4 * a * c;
if (delta < 0) return 0;
double inv_2a = 0.5 / a;
if (delta == 0) {
x1 = -b * inv_2a;
x2 = x1;
retu... | ALGO | 0.999889 | 5.068909 |
073095d8-2aa7-4a38-ac2c-02d7be372404 | cbj0304/StudyNotes | 3算法类/leetcode刷题/leetcode_xianduanshu.cpp | #include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iterator>
using namespace std;
/*
线段树
区间和的查询
leetcode-307
给定一个整数数组 nums,求出数组从索引 i 到 j (i ≤ j) 范围内元素的总和,包含 i, j 两点。
update(i, val) 函数可以通过将下标为 i 的数值更新为 val,从而对数列进行修改。
Given nums = [1, 3, 5]
sumRange(0, 2) ->... | ALGO | 0.99988 | 5.249409 |
2c12f05e-1561-4ef6-81aa-c87c4d34dbca | Shaik1406/CSA1415-Compiler-design | 11.Triple.cpp | #include <stdio.h>
#include <string.h>
int main() {
char line[20];
int s[20], t = 1, m = 0, i = 0, prevMem = 0;
printf("Enter string:");
fgets(line, sizeof(line), stdin);
for (i = 0; i < 20; i++) {
s[i] = 0;
}
printf("mem\top\ta1\ta2\n");
for (i = 2; line[i] != '\0'; i++) {
... | ALGO | 0.996894 | 3.385072 |
753ab0fe-5c76-4c46-a7c2-0cf1e24d91c1 | KaiDi-Wan/cce | learning-cxx/learning-cxx/exercises/04_static/main.cpp | #include "../exercise.h"
// READ: `static` 关键字 <https://zh.cppreference.com/w/cpp/language/storage_duration>
// THINK: 这个函数的两个 `static` 各自的作用是什么?
static int func(int param) {
static int static_ = param;
// std::cout << "static_ = " << static_ << std::endl;
return static_++;
}
int main(int argc, char **arg... | TEST | 0.915083 | 5.219908 |
8fcfc2c6-0734-4aa4-8732-963b998e1256 | shelltdf/osgall | prebuild/cgal-master/Triangulation_2/examples/Triangulation_2/terrain.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Projection_traits_xy_3.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Projection_traits_xy_3<K> Gt;
typedef CGAL::Delaunay_triangulation_2<Gt> ... | ALGO | 0.988207 | 5.163087 |
456b9ba1-3051-411b-96c0-dc1728957bb4 | purohit800/6Companies30Days | Intuit/koko-eating-bananas.cpp | class Solution
{
public:
int check(vector<int> piles, int m, int h)
{
int ans = 0;
for (auto i : piles)
{
ans += i / m;
if (i % m != 0)
ans++;
}
if (ans == h)
return 0;
else if (ans > h)
return 1;
... | ALGO | 0.999868 | 5.215868 |
2709a80e-8974-4d2c-a1a8-533bb8080e99 | ishandutta2007/codeforces | nots0fast/normal/1621/E.cpp | /*
#pragma GCC optimize("O3")
#pragma GCC target("sse4,avx2,abm,fma,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp(a) setprecision(a)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define ... | ALGO | 0.99998 | 3.98464 |
9da6a266-8289-4ddc-bb15-30950e3941c9 | mushkul/Vanderbilt-CP | solutions/claude-3-5-sonnet-20241022/1674.cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
vector<int> subordinates;
int dfs(int node) {
int count = 0;
for(int child : adj[node]) {
count += 1 + dfs(child);
}
subordinates[node] = count;
return count;
}
int main() {
ios_base::sync_with_stdio(false);
ci... | ALGO | 0.99996 | 4.666811 |
fa84b070-4a05-4741-92c2-abe4c61886f3 | utkarsh-27-sharma/DSA | LeetCode/717.cpp | class Solution {
public:
bool isOneBitCharacter(vector<int>& bits) {
int i = 0, n = bits.size();
for(i=0; i<n-1; i++) if(bits[i]) i++;
return i < n;
}
};
| ALGO | 0.999632 | 6.089046 |
1feaa974-86ac-444b-81d4-8dcdcec30f9f | arg-hya/Cluster_test1 | Cluster_Test/FFT_WIKI.cpp | #include "stdafx.h"
#include "FFT_WIKI.h"
int FFT_WIKI::log2(int N) /*function to calculate the log2(.) of int numbers*/
{
int k = N, i = 0;
while (k) {
k >>= 1;
i++;
}
return i - 1;
}
int FFT_WIKI::check(int n) //checking if the number of element is a power of 2
{
return n > 0 && (n & (n - 1)) == 0;
}... | ALGO | 0.999785 | 3.624409 |
1abdd67d-2100-4b7e-9238-24fe0378b3f6 | Sumanth-NR/CompetitiveProgramming | Platforms/CodeForces/Rounds_0901-0950/Round938_Div3/C_Inhabitant_of_the_Deep_Sea.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n;
ll k;
cin >> n >> k;
vector<ll> a(n);
for (auto &x: a) {
cin >> x;
}
int i = 0, j = n - 1;
while (k and i <= j) {
if (k == 1) {
a[i] -= 1;
if (a[i] == 0) {... | ALGO | 0.999973 | 4.476681 |
1cbd0eaf-a002-49b8-ac24-2085ab245786 | DyhaCreator/programming_tasks | CodeForcesRound/nar/2075C.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 7;
void solve() {
ll n, m;
cin >> n >> m;
vector<ll> a(m);
for (auto &x : a)
cin >> x;
sort(a.begin(), a.end());
for (auto &x : a)
x = min(x, n - 1);
vector<ll> pref(m + 1);
for (i... | ALGO | 0.99993 | 4.119613 |
5a9a5802-42e5-4151-9d98-428724c92ca5 | i-mkrishna/Cpp | evenOddindex.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int arr[n] = {0};
for (int i = 0; i < n; i++){
cin >> arr[i];
}
int even = 0;
int odd = 0;
for (int i = 0; i < n; i++){
if(( i%2==0 )||( arr[i]%2 ==0 )){
even += arr[i];
... | ALGO | 0.999946 | 3.894461 |
e78eb2bd-5113-4bd1-846f-412899b57fb0 | kmjp/procon | codeforce/621-660/638/b2.cpp | #include <bits/stdc++.h>
using namespace std;
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 ZER... | ALGO | 0.998532 | 3.608268 |
9c8ce0d3-f219-4a2c-a153-f5bfb6f623a1 | lilyhappily/CarND-Term2-P1-Kidnapped-Vehicle-and-notes | CarND-Kidnapped-Vehicle-Project/src/particle_filter.cpp | /**
* particle_filter.cpp
*
* Created on: Dec 12, 2016
* Author: Tiffany Huang
*/
#include "particle_filter.h"
#include <math.h>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <random>
#include <string>
#include <vector>
#include "helper_functions.h"
using namespace st... | ALGO | 0.996235 | 5.327525 |
e1e11bdf-23c5-45e2-a747-806118614e15 | Mohamed-Elhabashy/competitive-programming | Codeforces/1066/B.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e5 +10;
typedef long long ll;
int n,r,arr[N],fr[N];
int main()
{
cin>>n>>r;
for(int i=1; i<=n; i++)
cin>>arr[i];
int ans=0;
for(int i=1; i<=n; i++)
{
if(fr[i]==0)
{
bool f=0;
int x;
... | ALGO | 0.999974 | 3.782506 |
54f213d6-65ad-42ed-a98f-d73d36a579f7 | hisenberggg/competitive-coding | cpp/reverse_linkedlist_in_group_k.cpp | #include<bits/stdc++.h>
#include "LinkedList.h"
using namespace std;
Node *reverse_ll(Node *start, int i,int n, int b[]){
if(start == NULL){
return NULL;
}
// skip while the b[i] is 0
while(b[i]==0){
i+=1;
if(i>=n) break;
}
// if b is exhausted then return start (keep as it is)
if(i>=... | ALGO | 0.999983 | 4.139627 |
3473b542-a568-4b72-8e0f-cc55f231d5ea | fazlerahmanejazi/SPOJ | PT07Z - Longest path in a tree.cpp | #include <bits/stdc++.h>
using namespace std ;
#define inf 10000000
int T, n, u, v, far, s, dia ;
vector<vector<int> > adj ;
void dfs(int u, int prev, int far)
{
if (far>dia)
{
dia=far ;
s=u ;
}
for (int i=0 ; i<adj[u].size() ; i++)
if(adj[u][i]!=prev)
dfs(adj[u][i]... | ALGO | 0.999579 | 4.2955 |
cd9d5660-6890-40aa-a390-0f4e693a41d3 | vampcoder/Online-Programmes | Codeforces/312/A.cpp | #include<bits/stdc++.h>
using namespace std;
bool func(pair<int, int> a, pair<int, int> b){
return a.first > b.first;
}
bool func1(pair<int, int> a, pair<int, int> b){
return a.first < b.first;
}
int main()
{
int n, x, y;
cin >> n;
vector<pair<int, int> > vp;
vector<pair<int, int> > vn;
for(int i = 0; i < n; i... | ALGO | 0.999889 | 3.942273 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.