uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ac7976e3-2d3a-41a4-96a4-00a6f94b8776 | Surya-driod/DSA | chainmatrix.cpp | #include <iostream>
#include <vector>
#include <climits>
#include <functional>
using namespace std;
void mcm(vector<int> &p) {
int n = p.size() - 1;
vector<vector<int>> dp(n, vector<int>(n, 0));
vector<vector<int>> cut(n, vector<int>(n, -1));
for (int len = 2; len <= n; ++len) {
for (int i = ... | ALGO | 0.999951 | 4.91024 |
59e2822e-bc29-4880-9cc8-036f43e24984 | Vishal9569/-CrackYourInternship | Twosum.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> twoSum(vector<int> &nums, int target)
{
vector<int> index;
for (int i = 0; i < nums.size(); i++)
{
for (int j = i + 1; j < nums.size(); j++)
{
if (nums[i] + nums[j] == target)
{
in... | ALGO | 0.99972 | 5.819178 |
c9572a29-0373-4a60-a36b-879ce8858eb3 | SeungheeJeongHL/gbc | 4. Sort & Binary Search/custom_sort.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef struct Person{
int height;
int weight;
int age;
}PERSON;
bool compare (const PERSON &a, const PERSON &b){
if (a.height > b.height) return true;
else if (a.height==b.height){
if (a.weight > b.weight) retur... | ALGO | 0.996962 | 3.421163 |
768e3740-9d0c-49e2-844b-9a16f2e66f0c | nguyenhoang4875/CompetitiveProgramming | aglo_libs/data/Lca.cpp | template <typename T = int>
struct Lca {
int root;
int LG;
vector<int> depth;
vector<vector<int>> up;
Lca(vector<vector<int>>& adj, int _root) {
root = _root;
int n = adj.size();
LG = __lg(n);
depth.assign(n + 1, 0);
up.assign(n + 1, vector<int>(LG + 1));
... | ALGO | 0.999799 | 5.285772 |
d101fb83-f842-4b05-99a2-09ad1873fa7f | freezerspace/Leetcode | 0543-diameter-of-binary-tree/0543-diameter-of-binary-tree.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.99991 | 6.651651 |
61e65f3a-313c-4bd5-b1ec-5b3d77ebe303 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_329_7.cpp | #include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
const long long M = 1e6 + 5;
const long long mod = 1e9 + 7;
const long long m1 = 1e9 + 7;
const long long m2 = 1e9 + 9;
const long long p1 = 402653189;
const long long p2 = 1610612741;
const long long lN = 22;
long long powermodm(long long x, lo... | ALGO | 0.99994 | 3.87211 |
3391facc-4831-4635-ba40-861712c2452e | ayegenberdiyeva/ICPC | ICPC_contest/l-4/b.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
long long n, k; cin >> n >> k;
vector<long long> els(n, 0);
vector<long long> pre(n+1, 0);
while(k--){
string type; long long i_l, x_r; cin >> type >> i_l >> x_r;
if (type == "A"){
els[i_l] = x_r;
... | ALGO | 0.988878 | 3.615166 |
00873293-a903-405e-8b94-a70c04de1233 | Aniket1398/LeetCode-Solutions | 268-missing-number/268-missing-number.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
int n=nums.size();
int i=0;
for(int num:nums)
{
n^=num;
n^=i;
i++;
}
return n;
}
}; | ALGO | 0.999971 | 5.663141 |
47f54f6e-fe4b-400a-a0ba-847745fbe25e | cosmic-shivam/leetcode | 1923-sentence-similarity-iii/1923-sentence-similarity-iii.cpp | class Solution {
public:
vector<string> splitSentence(string sentence) {
vector<string> words;
stringstream ss(sentence);
string word;
while (ss >> word) {
words.push_back(word);
}
return words;
}
bool areSentencesSimilar(string sentence1, string sentence2) {
// Split both sente... | ALGO | 0.999974 | 6.618157 |
9bf8d985-2bb0-455b-b981-3857f1582c52 | amantvn1234/Leetcode-Gfg | count-elements-with-strictly-smaller-and-greater-elements/count-elements-with-strictly-smaller-and-greater-elements.cpp | class Solution {
public:
int countElements(vector<int>& nums) {
sort(nums.begin(),nums.end());
int count=0;
for(int i=1;i<nums.size()-1;i++){
if(nums[i]>nums[0]&&nums[i]<nums[nums.size()-1])
count++;
}
return count;
}
}; | ALGO | 0.999915 | 5.381833 |
cd7d555e-2ffd-4728-a5e3-b6043279a660 | ashib11/Sub_Zero_ | N_Digit_Primes.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
#define ll long long
#define pi acos(-1.0)
#define ull unsigned long long
#define endl "\n"
#define all(v) v.begin(), v.end()
#define allr(v) v.r... | ALGO | 0.99964 | 4.549282 |
7efc74d5-e2ab-4f81-bbc6-df0035e52ea1 | divyanshukumar10/C11 | Practise/constant.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
const int pricesmallroom(20);
const int pricelargeroom(30);
const float tax(10);
int sr;
int lr;
cin>>sr;
cin>>lr;
cout<<"cost: Rs "<<((pricesmallroom * sr) + (pricelargeroom * lr)) * tax<<endl;
}
| TOOL | 0.951271 | 3.597764 |
388a5ea1-a09b-4c0c-8a6c-5ec21761e786 | shweta845/cpp-programming-language | day1c++/areaofsquare.cpp | #include<iostream>
using namespace std;
int main ()
{
int area , side ;
cout<<"enter the sideof square";
cin>>side;
area=side*side;
cout<<"the area of square"<<area<<endl;
}
| TOOL | 0.851909 | 3.044796 |
428ba99d-4960-4307-bf72-67ca8cba5e8a | ooooo-youwillsee/leetcode | 0000-0500/0221-Maximal-Square/cpp_0221/main.cpp | #include <iostream>
#include "Solution1.h"
void test(vector<vector<char>> matrix) {
Solution solution;
cout << solution.maximalSquare(matrix) << endl;
}
int main() {
test({
{'1', '0', '1', '0', '0'},
{'1', '0', '1', '1', '1'},
{'1', '1', '1', '1', '1'},
{'1', '0', '0'... | TEST | 0.997751 | 5.594639 |
1b23c6ac-9847-4a7e-afe0-bf1817adf880 | greenrain78/alps13 | HBS/3주차/1558.cpp | long long int f(long long int n)
{
long long int num = 1;
int i = 0;
long long int arr[20];
while (n > 0)
{
arr[i] = n % 10;
n /= 10;
i++;
}
long long int result = 0;
for (int s = i - 1; s >= 0; s--)
{
result += arr[s] * num;
num *= 10;
}
return result;
} | ALGO | 0.999941 | 4.2256 |
ba170759-77ae-4588-8e98-a80014a33f7b | abhinav6859/cpp- | 1_basic c++/greatest.cpp | /*
take input and print greates number
*/
#include<iostream>
using namespace std;
int main (void)
{
int num_1,num_2,num_3;
cout << "enter first number";
cin>> num_1;
cout << "enter second number";
cin>> num_2;
cout << "enter third number";
cin>> num_3;
{
if (num_1>num_2 && num_2>num_3)
cout ... | ALGO | 0.99937 | 3.508092 |
0f92c29f-e3f0-4045-a2da-6ffedb8b197b | joeljohngeorge/array-problems | subarray1.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int>arr(n);
vector<int>currsum(n+1);
for(int i=0;i<n;i++)
cin>>arr[i];
currsum[0]=0;
for(int i=1;i<=n;i++)
currsum[i]=currsum[i-1]+arr[i-1];
int maxSum=INT_MIN;
for(int i=1;i<=n;i++)
... | ALGO | 0.999857 | 3.620398 |
ecc49769-daf6-4b96-9efc-5e1915b048e5 | liangsheng/cpp | CF_195_2_D求逆元.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#define pause cout << " press ansy key to continue...", cin >> chh
#define file_r(x) freopen(x, "r", stdin)
#define file_w(x) freopen(x, "w", stdout)
#def... | ALGO | 0.999946 | 4.028612 |
9f0c3561-f970-412f-97e9-d8b7318bdc21 | ishandutta2007/codeforces | joisino/normal/167/C.cpp | #include <bits/stdc++.h>
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( A... | ALGO | 0.999999 | 4.341108 |
cecefe43-224d-4071-adc3-e0cefb4a947b | chunag24/project_euler | 5_1/euler33.cpp | /*************************************************************************
> File Name: euler33.cpp
> Author:
> Mail:
> Created Time: Fri 19 Mar 11:37:53 2021
************************************************************************/
#include<iostream>
using namespace std;
int func(int x, int y){
int x1 = ... | ALGO | 0.999763 | 5.439189 |
f5fd26a3-9343-4ec9-b18a-f5c225af8546 | Sakenkz118/Cplusplus | Ch10.Pr.Ex.17 (8th edition).cpp | #include <iostream>
using namespace std;
class ticTacToe
{
public:
void gameRules() const;
// Function to print a game rules
// Postcondition: game rules are displayed
void print() const;
// Function to print the current board
// Postcondition: board is printed and displayed
void getMove... | ALGO | 0.995072 | 5.340583 |
61ae179c-7346-49e8-b17f-b54f02acb560 | GPUOpen-LibrariesAndSDKs/DirectXShaderCompiler | lib/Analysis/DivergenceAnalysis.cpp | #include "llvm/Analysis/DivergenceAnalysis.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/I... | ALGO | 0.991482 | 7.939739 |
9aa69acf-4df2-48d1-b4ac-77f7344b9f6d | ishandutta2007/codeforces | aidos/normal/41/A.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#define pb push_back
#define ll long long
#define mp make_pair
#define ff first
#define sc second
#define pii pair<int,int>
#define pis pair<i... | ALGO | 0.999984 | 3.534429 |
26cbc814-bed6-4a36-8560-083065269526 | bovivian/graphslam | thirdparty/fast_gicp/thirdparty/Eigen/bench/eig33.cpp | #include <iostream>
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Matrix, typename Roots>
inline void computeRoots(const Matrix& m, Roots& roots)
{
typedef typename Matrix::Scalar Scalar;
con... | ALGO | 0.999639 | 5.666831 |
6d3029fe-557f-44a6-8e89-c3d6c4cd418e | coderpheonix/CPP-practice | voule consonanat using switch case.cpp | #include <iostream>
#include <cctype> // for tolower function
using namespace std;
int main()
{
char ch;
// Prompt the user to input a character
cout << "Please input a character: ";
cin >> ch;
// Convert the character to lowercase to handle both uppercase and lowercase inputs
ch = tolower(c... | ALGO | 0.989398 | 6.565696 |
f1660509-0a8b-4521-a903-c4bd179c9a0b | Ayushi02paul192/Leetcoding | 974-subarray-sums-divisible-by-k/974-subarray-sums-divisible-by-k.cpp | class Solution {
public:
int subarraysDivByK(vector<int>& A, int K) {
int pref = 0; // prefix sum
vector<int> cPref(K); //sum will not exceed K as we are taking modulo at every step
cPref[pref]++; // adding 0 as prefix sum, base case
int answer = 0; // count of number of sub... | ALGO | 0.999908 | 6.020608 |
579497f1-2c3c-4866-9d64-c7138760580d | vijayausare/PROGRAMS | titforTat.cpp |
#include<iostream>
//#include<bits/stdc++.h>
//#include<cstring> // string
//#include<algorithm> // sort ,
//#include<stack> //stack,
#include<climits> // INT_MAX ,INT_MIN,
using namespace std;
#define pb push_back
#define YES printf("YES\n")
#define NO printf("NO\n")
#define fre freo... | ALGO | 0.999951 | 3.120897 |
16d8cedd-75e3-40f0-bbf6-1692a442e6be | PhoenixTAN/CS-591-Parallel-Computing | Assignments/6-C++-OpenMP/left_fold_of_a_binary_operation.cpp |
#include <iostream>
#include <chrono> /* time manipulation */
#include <omp.h> /* openMP */
/**
* @description: sequential version of pseudo polynomial knapsack
* @param {long int* v} a constant and non-negative array of length N
* @param {int N} the length of array v
*/
long long int sequential_left... | ALGO | 0.9995 | 5.375137 |
b9e2b463-729e-435b-81bc-487ebc2558f0 | MOMA7777/PS-solutions | Contains_Duplicate.cpp | #include <bits/stdc++.h>
using namespace std;
/*
Insertion Sort takes O(n^2) at worse case:
------------------------------------------
insertion sort pattern ..
4, 3, 2, 1.
4, 4, 2, 1.
3, 4, 2, 1.
3, 4, 4, 1.
3, 3, 4, 1.
2, 3, 4, 1.
2, 3, 4, 4.
2, 3, 3, 4.
2, 2,... | ALGO | 0.999983 | 5.311402 |
46233ce8-a3fc-46bb-a05c-c63befcf87d1 | dattocngan/THCS2_PTIT | Homework/bai94_sokhonggiam.cpp | #include<stdio.h>
#include<math.h>
#include<string.h>
int check(long long n){
int a = n % 10,count = 0 , b;
n /= 10;
while( n != 0 ){
b = n % 10;
if( b > a ) return 0;
a = b;
n /= 10;
}
return 1;
}
int main(){
int t;
scanf("%d",&t);
while(t--){
long long n;
scanf("%lld",&n);
if(check(n) == 1) pr... | ALGO | 0.999333 | 4.288064 |
1459297f-b5b1-4ffd-af7e-2734747736d0 | AvishekPaul/Codeforces-Problem-Solving | 148A.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
int k,l,m,n,d;
int count=0;
cin>>k>>l>>m>>n>>d;
for(int i=1;i<=d;i++){
if(i%k==0 || i%l==0 || i%m==0 || i%n==0){
count++;
}
}
cout<<count;
} | ALGO | 0.999769 | 3.541289 |
a0eee320-1548-4811-ba16-19d8186416b7 | tdiant/SchoolWorks | 51cpc/1011.cpp | #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
double PI=3.14;
int main(){
double angle;
cin>>angle;
angle=(angle/180)*PI;
printf("%.2lf\n%.2lf",sin(angle),cos(angle));
return 0;
}
| ALGO | 0.99706 | 3.132336 |
c4722833-ebb7-47ca-8755-9c8dac039841 | TatoNaranjo/Codeforces-Solutions | Ejercicios Sueltos/C_Next_Alphabet.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
char a; cin>>a;
char ans = a+1;
if(ans>122)ans=97;
cout<<ans<<endl;
return 0;
} | ALGO | 0.89903 | 3.188311 |
18b28770-dbff-4bd1-a7e5-3fad93f4f7f7 | file-citas/via | llvm/libcxx/test/std/utilities/function.objects/func.search/func.search.bm/default.pass.cpp | // UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: c++17, c++2a
// <functional>
// boyer_moore searcher
// template<class RandomAccessIterator1,
// class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
// class BinaryPredicate = equal_to<>>
// class boyer_moore_searcher {... | TEST | 0.963995 | 6.982162 |
8cb793c1-af21-436b-81cd-dc074142586e | yogeshvishnole/DSA-1 | 2023-cherno-and-ankit-thak/dsa/section-11-recursion/recursion-patterns/p12-print-all-permutations-ap-2.cpp | #include <iostream>
#include <vector>
using namespace std;
void permutations(vector<int> &arr, vector<vector<int>> &ans, int size)
{
if (size == arr.size())
{
ans.push_back(arr);
return;
}
for (int i = size; i < arr.size(); i++)
{
swap(arr[i], arr[size]);
permutatio... | ALGO | 0.99998 | 5.316504 |
07da1ec8-3984-4434-bb13-c2f5322c53cd | owlpaw20/CPArchive | Codeforces/[CF 788C] The Great Mixing.cpp | #pragma GCC optimize("O2,unroll-loops")
#include <bits/stdc++.h>
const int MAX_N = 1e6 + 5;
const int MAX_V = 5e5;
const int OFS = 1e6;
const int INF = 0x3F3F3F3F;
int N, k;
int a[MAX_N], f[MAX_N << 2];
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cin >> k >> N;
for (int i = 1;... | ALGO | 0.999922 | 4.024644 |
e8a1448b-f3c6-43c9-88bd-c7981ea1da14 | IsratJahan09/LeetCode | MEDIUM/3011. Find if Array Can Be Sorted.cpp | class Solution {
public:
int countset(int n){
int count = 0;
while(n){
count+=n&1;
n = n>>1;
}
return count;
}
bool canSortArray(vector<int>& nums) {
int n = nums.size();
for(int i = 0; i<n-1; i++){
for(int j = 0; j<n-i-1; j++){
i... | ALGO | 0.999998 | 5.33166 |
a8165f2e-2c38-4dd4-96a3-292542d1003d | ahmatjan/KeepLearning | CPP-TanHaoqiang/类模板.cpp | /*
201242921:21:32
˽Ӧģ
ģDz࣬ij
compare Ҫд compare<numtype>
*/
# include <iostream>
using namespace std;
template <class numtype>
class compare
{
public:
compare(numtype a, numtype b): x(a), y(b) {}
numtype max();
numtype min();
private:
numtype x;
numtype y;
};
/*¼Ϊģⲿ庯ʽ*/
template <class numtype>... | ALGO | 0.995024 | 4.168208 |
8a457351-0322-4b02-b114-d4939c4bb5b2 | Shibli2316/DSA90cpp | macro/basic.cpp | #include <iostream>
using namespace std;
#define PI 3.14
int main(){
int r = 5;
// double pi = 3.14;
double area = PI * r * r;
cout <<"Area is: " << area << endl;
} | ALGO | 0.978547 | 3.532751 |
f5b7e51c-734a-4d75-9edb-d27f91774680 | nparnami3/Geeks-for-Geeks-Problems | Difficulty: Basic/Vector Sum/vector-sum.cpp | //{ Driver Code Starts
// Initial Template for C++
// Find sum of the vector
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
// Complete the function
int sumMe(vector<int> arr, int n) {
int sum = 0;
// Your code here
for(int i : arr){
sum = ... | ALGO | 0.997652 | 7.060074 |
4197eb43-9948-464b-b3e5-27eb39bca857 | kbcgang/kbc | KBB TIME/C++/DO-for-fun/SEGSUMMOD.cpp | /// Hãy làm Sư tử, đừng làm Nai.
/// Hãy làm thợ săn, đừng làm con mồi.
/// --- <EMAIL> ---
/// ☆*: .。. o(≧▽≦)o .。.:*☆
#include <bits/stdc++.h>
using namespace std;
#define kien long long
#define JAV main
#define Million 1000000
#define NT 10000000
#define MOD 1000000007
kien n, k, m, dem, f[Million + 5], a[1000000];
k... | ALGO | 0.999861 | 4.258702 |
87c0c7b2-43b2-413a-8faa-797b8be3132a | kaixih/layer_norm | eigen-3.4.0/bench/quat_slerp.cpp | #include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Q>
EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t)
{
return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized());
}
template<typename Q>
EIGEN_DONT_INL... | ALGO | 0.987623 | 6.263251 |
e9e934c1-c754-4821-92ea-a95e19e6e44e | aditya4436/Data--Structures-And-Algorithm-In-C-Plus-Plus | Data Structures And Algorithm/Linked List/SINGLY LINKED LIST/Count The Number Of Nodes.cpp | /// A program to count the number of nodes in Singly Linked List
#include<iostream>
using namespace std;
struct Node
{
int data;
Node *next;
};
struct Node *head=NULL;
struct Node *tail=NULL;
void Add_Nodes_To_The_List(int data)
{
struct Node *newNode=new Node;
newNode->data=data;
newNode->next=NULL... | ALGO | 0.999711 | 4.623306 |
7a8335b9-ad2a-4104-887c-0906128c00ef | ishandutta2007/codeforces | swistakk/normal/1500/B.cpp | #include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define int long long
#define st first
#define nd second
#define rd third
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define RE(i, n) FOR(i, 1, n)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, n) for(int i = 0;i <(n); ++i)... | ALGO | 0.999973 | 3.658069 |
6c819cf1-3632-41f9-977d-6290fe30f3a0 | vaughn-k/Algorithm | graph/bfs/bj1697.cpp | /* 33m
3진트리 bfs
- 1차원배열
- queue
실제 풀이시간은 절반이였지만 실수로 많은 시간을 날림.
조건부분에서 사람이 0~100000 사이의 구간을 이동할수있는데 0을 미포함하여 계속 실패했다.
- if 조건 문제와 맞는지 잘 살피기!
*/
#include <iostream>
#include <queue>
using namespace std;
int n,k;
queue<int> q1;
queue<int> q2;
int position[100010];
int minimum = 0;
int move(int num){
if(num >=... | ALGO | 0.99997 | 3.888101 |
d3e8704d-4dd6-43aa-9147-91234073560d | itkmaingit/Nuclear-Power-Dynamics-Seminar | 0502/vaf.cpp | // vaf.cpp : calculate velocity autocorrelation function
//
#include <stdio.h>
#include <math.h>
#include <boost/timer/progress_display.hpp>
#define NUM_ATOM 512
#define TOTAL_STEP 20000
#define SAVE_STEP 10
#define DEL_T 0.001
#define NUM_HIST 100
#define NUM_DATA (TOTAL_STEP / 2 / SAVE_STEP + 1)
void getdata(int), ... | ALGO | 0.998907 | 4.596334 |
8667f077-6cab-4a3f-bc2d-c67d9370f4ca | sarvex/solution-cpp | 0621.task_scheduler.cpp | class Solution {
public:
int leastInterval(vector<char>& tasks, int n) {
vector<int> cnt(26);
int x = 0;
for (char c : tasks) {
c -= 'A';
++cnt[c];
x = max(x, cnt[c]);
}
int s = 0;
for (int v : cnt) {
s += v == x;
... | ALGO | 0.99998 | 6.815064 |
a5abdd89-aab1-41d3-94d4-44b7f2c92707 | rudrakaiser/CodeForces-Solutions | SOLVE/32B - Borze.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string str, output = "";
cin >> str;
for (int i=0; i<str.size(); i++) {
if (str[i] == '-' && str[i+1] == '.') {
output += "1";
i++;
} else if (str[i] == '-' && str[i+1] == '-') {
output += "2";
... | ALGO | 0.999845 | 3.575432 |
247c17df-1a13-4b6d-8150-2396367b4892 | CaiCandong/daydayone | src/1-30/day23/main.cpp | #include<stdio.h>
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
};
int countNodes(struct TreeNode* root){
if(root==NULL){
return 0;
}
int dx;
if(root->left==NULL&&root->right==NULL){
dx=0;
}else if(root->left==NULL||root->right==NULL)... | ALGO | 0.999754 | 4.880458 |
be6db901-7b72-4ae4-9487-75fbcea3c775 | sujeetamberkar/DSA_PW_Skills | Assignment/Codes/Week3/Pattern Printing - 1/Q11/code.cpp | /*
Required Output:
*
**
***
****
***
**
*
*
*/
#include <iostream>
using namespace std;
int main()
{
int n = 4;
cout << "ENter a number ";
cin >> n;
for (int i = 1; i <= n; i++)
{
for (int j = n -i; j >= 1; j--)
{
cout << " ";
}
for (in... | ALGO | 0.999872 | 3.958319 |
0725d3df-e403-432f-935d-863cf6101020 | AdityaShekharTiwary/codechef | cc_gross_salary.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int sal;
double gross,hra,da;
cin>>sal;
if(sal<1500)
{
hra=sal*.10;
da=sal*.90;
}
else
{
hra=500;
da=sal*.98;
}
gross=sal+hra+da;
printf("%.... | ALGO | 0.99848 | 3.394704 |
f809ce16-1875-4483-9e74-6b64dd5cdb94 | reese60525/LeetCode | LeetCode/NotReview/NOTREVIEW-LeetCode-3043.cpp | /*
* 題目: https://leetcode.com/problems/find-the-length-of-the-longest-common-prefix/description/
*
* 題目解釋:
* 給兩組integer array,找出這兩組array各自任選一個integer配對,其prefix最大能為多少bit。
*
* 思路:
* 使用Trie資料結構來解決,把array1當作預載資料insert至Trie中,再將array2當作要搜索的資料,
* 丟入Trie去計算其最大prefix,把array2全搜尋一次後即可得答案。
*
* 解法:
*
*/
#include <iostre... | ALGO | 0.999946 | 5.571792 |
7b47f3c3-ae8e-4bc9-b277-d95cee734bbd | harrySentinel/DSA | basics/countDigits.cpp | #include <iostream>
using namespace std;
int countDigitsGreater(int number, int value) {
int count = 0;
while (number > 0) {
int digit = number % 10; // Extract last digit
if (digit > value) {
count++;
}
number /= 10; // Remove last digit
}
return count;
}
i... | ALGO | 0.999977 | 5.820829 |
19080a35-2f94-4d0b-a2ca-6daa28199131 | Bersin07/aqualytic | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
862c28c7-f703-46d2-a8ca-9258f26427b5 | ishandutta2007/codeforces | serotonin/normal/1525/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 5005, inf = 1e8;
int n, a[sz], dp[sz];
int fnc(int x) {
if(x > n) return 0;
int &w = dp[x];
if(w >= 0) return w; w = inf;
if(a[x]) {
int ans = -x, one = 1, zer = 0;
for(int i=x+1; i<=n; i++) {
if(a[i])... | ALGO | 0.999974 | 3.711234 |
94f60fca-7c14-4c3c-a071-5587722ccab2 | bioconductor-source/SMAD | src/GetPPN.cpp | #include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export(.GetPPN)]]
NumericMatrix GetPPN(NumericMatrix mat) {
int nc = mat.ncol();
int rstart = 0;
int rend = mat.nrow();
NumericMatrix rmat(nc, nc);
for (int c1 = 0; c1 < nc; c1 ++){
for(int c2 = 0; c2 < c1; c2++){
int sMinXY = 0;
for(int r = r... | ALGO | 0.999707 | 4.198883 |
93e314f7-31b9-4c68-873d-606485954696 | GaelGR316/Estructurada24A | CalculadoraDeMatrices_GómezRiveraGael.cpp | #include <iostream>
#include <cstdlib> // Para rand()
using namespace std;
const int FilasMax = 10;
const int ColumnasMax = 10;
// Funcin para llenar una matriz con valores aleatorios entre -100 y 100
void llenarMatrizAleatoriamente(int matriz[][ColumnasMax], int filas, int columnas) {
for (int i = 0; i < filas;... | ALGO | 0.977406 | 4.515108 |
a401aeac-9097-4d75-be6a-8da2afd4f9df | rajeevranjancom/Leetcode_Cpp | 104. Maximum Depth of Binary Tree.cpp | /**
* 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:
int maxDepth(TreeNode* root) {
if (!root) return 0;
return max(maxDepth(root->left), maxDepth(root->ri... | ALGO | 0.999583 | 6.355525 |
e4763c7f-0053-43b1-b22b-fc8bcc43c5e1 | jankrepl/Competitive_Programming | Hackerrank/Algorithms/Strings/Sherlock_and_Anagrams.cpp | // Name: Sherlock_and_Anagrams
// WWWW: https://www.hackerrank.com/challenges/sherlock-and-anagrams
// Author: Jan Krepl
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<string> create_all_substrings(string s, int length){
vector<string> out... | ALGO | 0.999842 | 4.998624 |
070ff85a-9a25-4f65-acef-9c191860efa1 | TASnim4555/problem-solving | problem solving/problem A in div2/div924/div2.cpp | #include "iostream"
using namespace std;
bool rectangle(int a,int b){
if(a%2==0&&b%2==0){
return true;
}
else if(a%2!=0&&b%2!=0) {
return false;
}
else{
if(a%2==0&&b%2!=0){
int new_a=a/2;
if(2*new_a==a){
if(b*2!=b&&b*2!=a){
... | ALGO | 0.999896 | 4.521386 |
82cb7b92-6518-478b-8663-67b1039b8de7 | CodeFish99/PAT | B1026.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int c1,c2;
scanf("%d%d",&c1,&c2);
int time=c2-c1;
time=(int)round((double)time/100);
int hh,mm,ss;
hh=time/3600;
time%=3600;
mm=time/60;
ss=time%60;
printf("%02d:%02d:%02d",hh,mm,ss);
return 0;
}
| ALGO | 0.99742 | 3.6705 |
827b803b-0545-4260-b25a-28f254f248cc | glytch3/LeetCode-s | 0120-triangle/0120-triangle.cpp | class Solution {
public:
int f(int x,int y,vector<vector<int>>& triangle,vector<vector<int>>& dp) {
int n=triangle.size();
if(x==n-1)
return triangle[n-1][y];
if(dp[x][y]!=-1)
return dp[x][y];
int d=triangle[x][y]+f(x+1,y,triangle,dp);
int dr=triangle[... | ALGO | 0.999981 | 6.195626 |
607d5dfa-03c6-4a21-876a-c769eadad367 | rohit11012003/cp_problems | Board Moves.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++)
{
long long int n;
long long int count=0;
cin>>n;
cout<<(n*n*n-n)/3<<endl;
}
return 0;
}
| ALGO | 0.999868 | 3.707365 |
35020a88-105e-4705-9739-4e9c1051e9d6 | ayush3011/leetcode | 1800. Maximum Ascending Subarray Sum.cpp | class Solution {
public:
int maxAscendingSum(vector<int>& nums) {
int ansSum = nums[0]; // for storing the max possible sum
int localSum = nums[0]; // for storing ascending subarray sum
for (int i = 1; i < nums.size(); i++) {
if (nums[i] > nums[i - 1]) {
localSu... | ALGO | 0.999955 | 6.347857 |
fba1bc5d-76cf-4381-ba79-c2aaa378d4fe | jmaralo/codeforces | 1684/c/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define TESTCASES true
void solve(int tt) {
int n, m;
cin >> n >> m;
vector<vector<int>> grid(n, vector<int>(m));
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> grid[i][j];
}
}
vector<int> bad;
... | ALGO | 0.999974 | 3.693421 |
556502fa-3b6d-4ec9-bbe5-660abd04c407 | ZENZO-Ecosystem/ZENZO-Core-Archive | src/merkleblock.cpp | #include "merkleblock.h"
#include "hash.h"
#include "primitives/block.h" // for MAX_BLOCK_SIZE
#include "utilstrencodings.h"
using namespace std;
CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter& filter)
{
header = block.GetBlockHeader();
vector<bool> vMatch;
vector<uint256> vHashes;
vM... | ALGO | 0.998857 | 5.939562 |
3f28d559-9137-4eb1-9a95-0f9e02bd03e5 | Jeelgor/DSA | WEEK__7/RECURSION CLASS 1/CheckSorted.cpp | #include <iostream>
using namespace std;
bool CheckSorted(int arr[], int size, int index)
{
// base case
if (index >= size)
{
return true;
}
// processing
if (arr[index] > arr[index - 1])
{
bool agekaAns = CheckSorted(arr, size, index + 1);
return agekaAns;
}
... | ALGO | 0.999798 | 5.509021 |
24488cee-bcaf-494c-b999-119ad8762721 | tuenti/hiphop-php | src/runtime/base/server/ip_block_map.cpp | #include <runtime/base/server/ip_block_map.h>
#include <util/logger.h>
using namespace std;
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
IpBlockMap::Acl::Acl() : m_networks(true) {}
IpBlockMap::BinaryPrefixTrie::BinaryPrefixTrie(bool allow) {
m_children[0] = m_c... | TOOL | 0.958458 | 7.531628 |
37b46b87-0998-4914-8fce-34ecd70b8a5f | Aakash-Bathri/Competative-Programming | mashup/mashup7/gcd_dcg.cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int l, r;
cin >> l >> r;
if (r >= l + 1) {
if (l % 2 == 0) {
// If l is even
cout << l << " " << l << endl;
} else {
// If l... | ALGO | 0.999963 | 5.184246 |
15c55726-69dc-46b4-b754-ab9b40b9072e | Bhaikko-01/neetcode-questions | two-pointers/array-with-elements-not-average-neighbors.cpp | /**
* 1. Two pointer with Sorting - O(nlogn)
* If we can ensure that an element is surrounded by either both greater or less than current el,
* then average value can never be same as current
* To do this, fill alternative position of array by first and second half of array
*/
#include <bits/stdc... | ALGO | 0.999972 | 4.848 |
384d1d3b-b07f-4964-a621-2f09a3ef31a4 | zbogenza/mes_cpp | Solver.cpp | #include "GlobData.h"
#include "SolveMatrix.h"
#include "FeSM_Heat.h"
#include <iostream>
extern GlobData data;
void SOLVER() {
int NEL;
int nk[4];
int i, j, ii, jj;
// Pełna macierz globalna (kwadratowa)
std::vector<std::vector<double>> globalMatrix(data.mGr.nh, std::vector<double>(data.mGr.nh, 0... | ALGO | 0.999739 | 3.662301 |
a50a844f-bdd8-4f47-914e-f9454d9e3c04 | visheshgargavi/mission_faang | Graph/0_0_Best_First_Search.cpp | #include<bits/stdc++.h>
using namespace std;
template <typename T>
class graph
{
public:
map<T, list<pair<T, T>>> adjlist;
void addEdge(T u, T v, int dist, bool bidirec)
{
adjlist[u].push_back(make_pair(v, dist));
if (bidirec)
{
adjlist[v].push_back(make_pair(u, dist));... | ALGO | 0.999974 | 4.98323 |
858bd94d-d0b5-43e8-94e9-c54f130bcb5e | AndyS1mpson/software-for-HPCS | OpenMP/5.OddEvenSort/OddEvenSortParallel.cpp | #include <omp.h>
#include <iostream>
#include <algorithm>
#include <random>
#include <iomanip>
#include <ctime>
#include <chrono>
class Arr {
public:
Arr() {
int* arr = nullptr;
int size;
}
void generate_arr(int size, int range = 1e+9, int seed = 42) {
std::mt19937 gen;
gen... | ALGO | 0.999222 | 5.572811 |
e527c1e2-1fab-4078-801c-6d5248af4c34 | 0-jij-0/CompetitiveProgramming | Problems Archive/0000 - 0999/0598 - Little Pony and Crystal Mine.cpp | #include <iostream>
using namespace std;
void print_line(int D, int all) {
if (all == 1) { cout << 'D'; return; }
if (D == all) { cout << 'D'; print_line(D - 2, all - 2); cout << 'D'; return; }
cout << '*'; print_line(D, all - 2); cout << '*';
}
void print_diamond(int h, int w) {
if (h == w) { print_line(w, w); ... | ALGO | 0.999864 | 3.437994 |
3a788d4b-3e6a-4c92-95db-df9097f13071 | Chivas-Regal/ACM | Learnding/CoolQuestion/hdu_5493 Queue(线段树)/main.cpp | //߶
//iͬߵųһӣ֪Լǰжٸ˱Լ
//Խ˰Ȼ̰ģСÿ˰
//ǰţֵܱ֤С
//Ŀӣhttp://acm.hdu.edu.cn/showproblem.php?pid=5493
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<ctype.h>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<iostream>
#include<iterator>
#define dbg(x) printf(... | ALGO | 0.999946 | 3.402611 |
bb992193-afc6-43ba-9337-f32b45cf921f | jyhsia5174/algo | leetcode/410.cpp | // Split Array Largest Sum
class Solution {
public:
int splitArray(vector<int>& nums, int m) {
unsigned long long int l = 0;
unsigned long long int r = 1 << 30;
for(auto a: nums){
l = max(l, (unsigned long long int) a);
r += a;
}
unsi... | ALGO | 0.999969 | 5.734309 |
2a6b9f21-af40-4c1c-845e-dd181ec92edf | 0-jij-0/CompetitiveProgramming | Problems Archive/2000 - 2999/2354 - Increasing.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t; cin >> t; while (t--) {
int n; cin >> n; vector<int> v(n);
for (auto& x : v) cin >> x;
cout << (n == set<int>(v.begin(), v.end()).size() ? "YES" : "NO") << '\n';
}
} | ALGO | 0.999588 | 4.670833 |
14701b90-0689-4d9e-91c1-64d0b8f423fe | sarojpatro/leetcode | 1382 Balance a Binary Search Tree/1382balance-a-binary-search-tree.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.99999 | 6.33698 |
966bc23b-6b41-478d-93b8-6a068c25df01 | ishandutta2007/codeforces | meret/normal/226/B.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.999846 | 3.253848 |
34224b65-d9bb-439a-aa4a-23eb29181e7a | roiguri/c-Game_Board | Simulator/game_modes/competitive_runner.cpp | #include "competitive_runner.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <set>
#include <memory>
#include <future>
#include <dlfcn.h>
#include "utils/library_manager.h"
#include "registration/GameManagerRegistrar.h"
#include "registration/AlgorithmRegist... | ALGO | 0.938126 | 7.082423 |
f041f1ec-cb40-4a7f-8b80-dc6459847f70 | cliarie/grind25 | misc/trains.cpp | #include <iostream>
#include <vector>
using namespace std;
int convertTimeToMinutes(int time)
{
int hours = time / 100;
int minutes = time % 100;
return hours * 60 + minutes;
}
int convertMinutesToTime(int minutes)
{
int hours = minutes / 60;
int mins = minutes % 60;
return hours * 100 + mins;... | ALGO | 0.999857 | 4.989842 |
b2ed478f-1b61-4370-8d20-00c18636baf5 | Aayush-Sood101/DSA-CODING | 2darray/sumofrectangle.cpp | #include<iostream>
using namespace std;
int main()
{
int m,n;
cout<<"Enter no. of rows and columns : ";
cin>>m>>n;
int arr[m][n];
cout<<"Enter array elements : ";
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cin>>arr[i][j];
}
}
cout<<"Enter l1 r1 ... | ALGO | 0.999848 | 3.372061 |
e55538e4-af18-496d-ae77-b0140a9903e5 | yhc520314484/LeetCode | Simple/Accepted/Leetcode_Simple_383_Ransom_Note.cpp | /*
Leecode 383 Ransom Note
Level: Simple
Author: JackWilliam
Date: 11, June, 2020
*/
/*
Version 0.1
查表
48 ms 34.55%
6 MB 100%
*/
class Solution {
public:
bool canConstruct(string ransomNote, string magazine) {
int ransom_cont['z' + 1] = {0};
int magazine... | ALGO | 0.99994 | 5.779537 |
8603927b-48eb-40d4-a6ff-3078cb5b6d8a | YimingPan/algorithm-dataStructure | UVa/UVa414 - Machined Surfaces.cpp | #include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
freopen("input.txt","r",stdin);
int N, min, ans, nVoid[13];
char surface[26];
while(cin >> N, N)
{
getchar();
min = 30;
ans = 0;
for(int i=0;i<N;i++) nVoid[i] = 0;
for(... | ALGO | 0.99721 | 3.292423 |
6d110d8c-23b9-41d8-ae52-9c88e29cb0ae | Aaron617/AgentGen | src/utils/VAL/src/Events.cpp | /*-----------------------------------------------------------------------------
VAL - The Automatic Plan Validator for PDDL+
$Date: 2009-02-05 10:50:12 $
$Revision: 1.2 $
Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL
Stephen Cresswell - PDDL Parser
<EMAIL>
<EMAIL>
<EMAIL>
<EMAIL>
By re... | TOOL | 0.899197 | 5.187207 |
e742d5d9-756d-44e0-b460-eb33195689b3 | ImtiazAhmedAkash/Problem-Solving | codeforces/2059/D.cpp | /* In the Name of ALLAH, the most gracious, the most merciful */
/* And whoever puts their trust in ALLAH, He alone is sufficient for them. Al-Quran (65:3) */
// Graph and Graph
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "Dbug.h"
#else
#define dbg(...)
#endif
using ll = long long;
cons... | ALGO | 0.999605 | 4.911671 |
bcd0d383-9af2-42f8-8aa5-023d4b8c634c | shubhampathak09/dynamic-programming-and-arrays | CP guide/prim mst.cpp | #include<bits/stdc++.h>
using namespace std;
#define V 5
int minKey(int key[],bool mstset[])
{
int min=INT_MAX;
int min_index;
for(int v=0;v<V;v++)
{
if(mstset[v]==false&&key[v]<min)
{
min=key[v];
min_index=v;
}
}
return min_index;
}
void printmst(int parent[],int graph[V][V])
{
for(int i=... | ALGO | 0.999973 | 4.181001 |
cad70e9d-66ba-4e6b-abd3-5225645b61e8 | Chan531/BaekJoon_Online_Judge | 님게임.cpp | #include <iostream>
using namespace std;
int n, ans, cnt;
void input()
{
cin >> n;
}
void solution()
{
for (int i = 0; i < n; i++)
{
int m;
cin >> m;
if (m == 1) cnt++;
ans ^= m;
}
if (cnt == n)
n % 2 ? cout << "cubelover" : cout << "koosaga";
else
ans ? cout << "koosaga" : cout << "cubelover";
... | ALGO | 0.999934 | 3.632335 |
62f2c1d5-7ea5-4c20-87af-c8af736ad701 | we0091234/leetCode | 回溯算法/131.分割回文串.cpp | #include <vector>
#include <iostream>
#include <string>
using namespace std;
vector<string> path;
bool isHuiwen(string &mystr)
{
int i= 0,j = mystr.size()-1;
while(i<j)
{
if(mystr[i]!=mystr[j])
return false;
i++;j--;
}
return true;
}
bool isHuiwenVec(vector<string>&mystrVec)... | ALGO | 0.999929 | 4.796924 |
43937dba-c61b-46a4-8908-8fbd92c8ce3b | ADA-GWU/3-concurrency-emil-naghizade | Assignment_3_new/src/Source.cpp | #include <iostream>
#include <vector>
#include <thread>
#include <mutex>
#include <cmath>
#include <opencv2/opencv.hpp>
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
// Function to get screen size on Windows
std::pair<int, int> getScreenSize() {
return { GetSystemMetrics(SM_CXSCREEN), GetSystemMetric... | ALGO | 0.908473 | 7.042049 |
882bca59-772b-496c-a6fe-1059df14995c | SURAJANKOLA19/agrofood | 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.998756 | 6.772262 |
737c6743-3bc7-447d-a521-6159e1154c8e | abovethe-clouds/ACM | c++/atc/AtCoder Beginner Contest 418/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define endl "\n"
typedef long long ll;
#define int long long
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int mod = 1e9 + 7, inf = 0x3f3f3f3f, P = 131;
int read()
{
int x = 0, w = 1;
... | ALGO | 0.999902 | 4.464739 |
08b385b2-38b2-4d4a-8686-308c71482f37 | Chetan0724/DSA-CPP | Week 07/03_Recursion - Class 2/01_Recur.cpp | #include <iostream>
using namespace std;
int main()
{
int firstValue = 0;
int secondValue = 1;
int ans;
for (int i = 0; i < 10; i++)
{
ans = firstValue + secondValue;
cout << ans << endl;
firstValue = secondValue;
secondValue = ans;
}
return 0;
} | ALGO | 0.999546 | 3.692322 |
ca9ba23b-eae4-43aa-9fee-4779b2e20ce2 | hieun1402/cpp | exercise_49.cpp | #include<iostream>
int main(){
int n[5] , i ,x;
printf("Input the first number of the array: ");
scanf("%d",&x);
for(i=0 ; i<5 ; i++){
n[i] = x;
x *=3;
printf("n[%d] = %d\n", i , n[i]);
}
return 0;
} | ALGO | 0.999907 | 3.030274 |
2641d520-4c58-4617-9368-86940b422807 | Wisc-HCI/authr | authr_pddl/paradiseo/deprecated/eo/contrib/mathsym/gen/TreeBuilder.cpp | #include <utils/eoRNG.h>
#include "TreeBuilder.h"
Sym TreeBuilder::make_terminal() const {
if (rng.flip(vcprob)) {
return table.get_random_var();
}
return table.get_random_const();
}
Sym TreeBuilder::build_tree(unsigned max_depth, bool grow) const {
if (max_depth == 0 || grow && rng.random(2) == 0)... | TOOL | 0.932644 | 5.770195 |
dc72f67c-9504-4bb2-9259-d797aab18c43 | tim099/AgeOfCube | src/Class/field/map/search/SearchJob.cpp | #include "SearchJob.h"
#include "WorkableBuilding.h"
SearchJob::SearchJob(int _which_player) {
which_player=_which_player;
}
SearchJob::~SearchJob() {
}
bool SearchJob::check_search(StaticCube* cube){
Building *building=cube->get_building();
if(building&&building->belong_to()==which_player){
WorkableBuilding *w_... | TOOL | 0.956398 | 3.557184 |
4d8ad9c7-445e-4242-b1f5-95ffc903b810 | Suparnauchiha/dsa | circular_queue.cpp | #include<iostream>
using namespace std;
class cirqueue{
int *arr;
int size;
int front;
int rear;
public:
cirqueue(int size){
this->size=size;
arr=new int[size];
front=rear=-1;
}
int enqueue(int element){
if((front == 0 && rear==size-1)|| (rear=... | ALGO | 0.998481 | 4.370468 |
f6dc542e-7cc7-4f8a-814b-e3f62fd4f103 | Angellopp/CodeForces-Problems | E_Counting_Pascal.cpp | #include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie (NULL)
#define dbg(x) cerr << " [ " << #x << " = " << x << " ]\n"
#define cp(x) cerr << " [ " << #x << " = (" << x.F << ", " << x.S << ") ]\n"
#define endl "\n"
#define F first
#define S second
#define mk make_pair
#define rep(ini, n) for... | ALGO | 0.999804 | 4.118739 |
50d19267-4abd-4a4d-9765-035fbe503cc1 | Lost-MSth/Lost | HPC/HPCGame 2025/D-最长公共子序列/handout/lcs.cpp | #include <utility>
#include <cstdlib>
#include <algorithm>
typedef int element_t;
size_t lcs(element_t* arr_1, element_t* arr_2, size_t len_1, size_t len_2) {
size_t* previous = (size_t*)calloc(len_2 + 1, sizeof(size_t));
size_t* current = (size_t*)calloc(len_2 + 1, sizeof(size_t));
for (size_t i = 1; i ... | ALGO | 0.999416 | 4.790152 |
7fc05c39-af10-40db-93d8-3ff3e5308290 | aaasa05/CP | 158A.cpp | #include<iostream>
using namespace std;
int main(){
int n,k,count=0;
cin>>n>>k;
int a[n];
if(n<=50 && n>=k){
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
if(a[i]>=a[k-1] && a[i]>0){
count++;
}
}
}
cout<<count;
return 0;
} | ALGO | 0.999936 | 3.164188 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.