uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2904cd56-ff6c-4c4d-b76a-26174bea3ed1 | satvik007/Scanner_OP | A4-paper-sheet-detection-and-cropping/Header_files/eigen/doc/examples/tut_arithmetic_redux_basic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::Matrix2d mat;
mat << 1, 2,
3, 4;
cout << "Here is mat.sum(): " << mat.sum() << endl;
cout << "Here is mat.prod(): " << mat.prod() << endl;
cout << "Here is mat.mean(): " << mat.mean() ... | ALGO | 0.99925 | 3.872858 |
d6c138e7-cbaa-4afe-9efd-d6369d4e3235 | kasa021/atcoder-archives | abc267/abc267_d_37307238_AC.cpp | /*
* Author: kAsA02
* Submission URL: https://atcoder.jp/contests/abc267/submissions/37307238
* Submitted at: 2022-12-16 16:03:38
* Problem URL: https://atcoder.jp/contests/abc267/tasks/abc267_d
* Result: AC
* Execution Time: 34 ms
*/
#include <bits/stdc++.h>
#include <cmath>
#if __has_include(<atcoder/all>)
... | ALGO | 0.999945 | 3.965352 |
11201aaf-3f08-4a1e-9a5f-c713819f5cf6 | sungmen/Solve_Algorithms | LeetCode/18_4Sum.cpp | class Solution
{
public:
vector<vector<int>> fourSum(vector<int>& nums, int target)
{
if (nums.size() < 4) return {};
sort(nums.begin(), nums.end());
set<vector<int>> s;
for (int i = 0; i < nums.size() - 3; i++)
{
for (int j = i + 1; j < nums.size() - 2; j++... | ALGO | 0.999979 | 6.092527 |
d78950a3-b583-483a-aded-0808460a54df | Sujay-lab/Cpp-codes | primenumber.cpp | #include <iostream>
using namespace std;
int main(){
int n,i=2;
cout<<"enter the number :";
cin>>n;
while(i<n){
if(n%i==0){
cout<<"not a prime for "<<i<<endl;
}
else{
cout<<"prime for "<<i<<endl;
}
i+=1;
}
} | ALGO | 0.999749 | 3.390187 |
137b8614-83df-478b-ba94-3451d9c1be35 | sgjzfzzf/SJTU_CS154 | 519030910182-刘津榤(VS)5/6-3.cpp | #include<iostream>
#include<cstring>
using namespace std;
int main()
{
char str[80], ch[80];
int k = 0;
cin.get(str, 80);
for (int i = 0; i < strlen(str); ++i)
{
bool flag = true;
for (int j = 0; j < i; ++j) {
if (str[i] == str[j])
{
flag = false;
break;
}
}
if (flag == true)
{
ch[k... | ALGO | 0.999992 | 3.4467 |
c0fa40e2-7438-4064-9f18-befd673de481 | parul16101/LeetCode | 0two-sum/0two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
int n = nums.size();
unordered_map<int,int> mp;
vector<int> ans;
for(int i=0;i<n;i++)
{
if(mp.find(target-nums[i])!=mp.end())
{
ans.push_back(mp[target... | ALGO | 0.999955 | 6.298677 |
f4651370-4205-4af3-a885-b0bdd2a73ccb | renweizhukov/LearningOpenCV | FlannMatching1to1/src/FlannMatching1to1.cpp | /*
* FlannMatching1to1.cpp
*
* Created on: Mar 29, 2017
* Author: Wei Ren
*
* Modified based on the tutorial "Feature Matching with FLANN" at
* http://docs.opencv.org/3.2.0/d5/d6f/tutorial_feature_flann_matcher.html.
*/
#include <cstdio>
#include <vector>
#include <chrono>
#include "opencv2/core.hpp"
#... | ALGO | 0.99248 | 5.583138 |
635dbbcd-2b8e-4410-9a47-5aaba9cc5829 | Naincy04/cpp_programs | 14-longest-common-prefix/longest-common-prefix.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& v) {
string ans="";
sort(v.begin(),v.end());
int n=v.size();
string first=v[0],last=v[n-1];
for(int i=0;i<min(first.size(),last.size());i++){
if(first[i]!=last[i]){
return ans;
... | ALGO | 0.999943 | 5.493755 |
cd249a12-dc2f-4721-b43c-bc680e3e7819 | sujeetamberkar/DSA_PW_Skills | Pratice/Sorting/Part_1/Bubble_Sort/Main/Optimised.cpp | #include <iostream>
#include <vector>
using namespace std;
// Function prototypes
void Bubble_Sort(vector<int> &);
void display_array(vector<int> &);
int main()
{
vector<int> v;
// Populating the vector with some sample data
v.push_back(5);
v.push_back(1);
v.push_back(4);
v.push_back(3);
v... | ALGO | 0.999868 | 6.929983 |
03036fc9-124a-4792-8ff3-b09201a7686d | jimdose/DOOM-3 | neo/idlib/hashing/MD5.cpp | #include "../precompiled.h"
#pragma hdrstop
/*
MD5 Message Digest Algorithm. (RFC1321)
*/
/* MD5 context. */
typedef struct
{
unsigned int state[4];
unsigned int bits[2];
unsigned char in[64];
} MD5_CTX;
/* The four core functions - F1 is optimized somewhat */
/* #define F1(x, y, z) (x & y | ~x & z) */
#... | ALGO | 0.998638 | 6.296065 |
6c954c41-d4a5-4565-a25d-6b2fbe656669 | imaansaleem/Competitive_Programming | Div2_25thMay2023/UnitArray.cpp | #include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int checkEven(int neg, int pos){
if(neg == 0 || neg%2==0)
return 0;
else
return 1;
}
int operations(int neg, int pos){
int op=0;
if(pos>neg)
return checkEven(neg, pos);
else{
op = ceil((neg-p... | ALGO | 0.99973 | 4.560331 |
90d77d1d-e726-4b8d-866f-2beebccb07ba | ishandutta2007/codeforces | davoth/normal/1110/B.cpp | #include <bits/stdc++.h>
using namespace std;
const int si=1e5+10;
int main() {
long long n, m, k;
cin >> n >> m >> k;
vector<long long> b(n);
for (int i = 0; i < n; i++) {
cin >> b[i];
}
long long ans = n;
priority_queue<int> pq;
for (int i = 1; i < n; i++) {
int diff = ... | ALGO | 0.999976 | 3.718028 |
7d5ae875-1868-4ee5-8a72-d0de18e9f390 | cold-su/cold-su | code/2024/10/03/SCUT 2024 入门练习题单 - 659424/BE - Count Order.cpp | #include <bits/stdc++.h>
#define println(...) std::puts(std::format(__VA_ARGS__).c_str())
#define int long long int
const static auto INIT = [] {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
return 0;
} ();
/* MY SOLUTION */
const bool HAVE_MULTIPLE_TESTCASES = fa... | ALGO | 0.999921 | 4.610196 |
2ae8f72f-5e26-4561-8db8-641c9cf3f5ba | Cazyshark/ACM-Traing | boost/boost_1_74_0/libs/graph/example/graph.cpp | #include <boost/graph/adjacency_list.hpp>
using namespace boost;
using namespace std;
typedef property< vertex_color_t, default_color_type,
property< vertex_distance_t, int,
property< vertex_degree_t, int,
property< vertex_in_degree_t, int,
property< vertex_out_degree_t, int > ... | ALGO | 0.987354 | 5.406191 |
2aed7f32-26ec-48b4-9d3b-46b3e14c2afc | Jabed27/C-datastructure-and-algorithm | BinarySearce.cpp | /*#include<stdlib.h>
#include<bits/stdc++.h>
using namespace std;
int binarysearch(int ar[],int l,int r,int x);
int main(){
int ae[7] = {3,6,8,2,9,10,33};
cout<<"what element do you want to search ?"<<endl;
int x;
cin>> x;
int result = binarysearch(ae,0,7,x);
if(result =... | ALGO | 0.997768 | 4.32103 |
39f70dd2-7dc0-44b7-ae19-a63d25d0da1d | Ktnnn3/lab3 | lab3_5.cpp | #include<iostream>
using namespace std;
int main()
{
string text1,text2;
int N,count=0;
cout<<"Enter the first text: ";
cin>>text1;
cout<<"Enter the second text: ";
cin>>text2;
cout<<"Enter N: ";
cin>>N;
while(count<N){
if(count%2==0){
cout<<text1<<" ";
}else{
cout<<tex... | ALGO | 0.999214 | 3.102341 |
6e3b4b4c-7345-4988-9afd-5b8c6bb8726d | bsy6766/VoxelEngine | VoxelEngine/Classes/Cube.cpp | // pch
#include "PreCompiled.h"
#include "Cube.h"
using namespace Voxel;
/*
Cube indices numbers
Top
Back
7---------5
/| /|
/ | / |
3--|------1 |
Right | | | | Left
| | | |
| 6------|--4
| / | /
2---------0
Front
Bottom
^ ... | TOOL | 0.923783 | 4.927606 |
ee0cdd81-8a55-4097-a6e1-49a42c3cdee5 | longbefer/Radiosity | Triangle.cpp | #include "pch.h"
#include "Triangle.h"
#include "Patch.h"
bool Triangle::IsHit(const Ray&ray, double&tmin) const
{
auto &v0 = vertices[0], &v1 = vertices[1], &v2 = vertices[2];
double a = v0.x - v1.x, b = v0.x - v2.x, c = ray.d.x, d = v0.x - ray.o.x;
double e = v0.y - v1.y, f = v0.y - v2.y, g = ray.d.y, h = v0.y - ... | ALGO | 0.931427 | 5.607736 |
7de4d121-af3a-4e77-a5dc-24dd42611f30 | GowthamSatya/DSA | DSA Sheets/A2Z DSA Striver Sheet/Recursion/Basic/power.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
// } Driver Code Ends
class Solution
{
public:
// You need to complete this fucntion
long long power(int N, int R)
{
// Your code here
if (R == 0)
return 1;
if (R % 2 == 0)
... | ALGO | 0.999863 | 5.927519 |
afe94ee6-b315-4a59-8222-a4854fc26e38 | devgoel186/SIP-Prep-CPP | 11-Graphs/primsMST.cpp | #include <bits/stdc++.h>
using namespace std;
int primsMST(vector<vector<vector<int>>> &adj, vector<bool> &visited, vector<int> &parent, int source)
{
vector<int> dist(adj.size(), INT_MAX);
set<vector<int>> s;
s.insert({0, source});
/* {weight, vertex} */
dist[source] = 0;
int cost = 0;
... | ALGO | 0.999959 | 4.801773 |
3e7a4d59-9d00-42fc-82d3-8ddbc5c12e2b | 37975/LAB11 | tempCodeRunnerFile.cpp | void checkWinner(int p, int y){
// Write condition for cout in this function
cout << "\n---------------------------------\n";
if (p == y){
cout << "| Draw!!! |"; // when p is equal to y
}else if (p > y)
{
cout << "| Player wins!!! |"; // when p is greater than y
}else{... | ALGO | 0.994695 | 3.459569 |
02f7d4ae-0d41-4f07-a306-5384f37a7810 | aarushi-1601/GFG | Hard/Longest valid Parentheses/longest-valid-parentheses.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 maxLength(string S){
// code here
int left = 0, right = 0, ans = 0;
for (int i=0; i < S.length(); i... | ALGO | 0.999589 | 5.539925 |
4fa817c6-de87-46ae-a4de-da806f75b058 | AmanParadkar/Striver_A2Z_DSA_sheet | BSon2DArrays/search2dMatrix.cpp | #include<iostream>
#include<vector>
using namespace std;
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int row = matrix.size();
int col = matrix[0].size();
int low = 0;
int high = (row * col) -1;
while(low <= high)
{
int mid = low + (high - low) / 2;
if(matrix... | ALGO | 0.999663 | 5.461354 |
342ac58d-ad9f-4b86-9fbd-646e33ab8513 | ROCm-Developer-Tools/llvm-project | clang/test/SemaCXX/constexpr-turing-cxx2a.cpp | // RUN: %clang_cc1 -verify -std=c++2a %s
// expected-no-diagnostics
const unsigned halt = (unsigned)-1;
enum Dir { L, R };
struct Action {
bool tape;
Dir dir;
unsigned next;
};
using State = Action[2];
// An infinite tape!
struct Tape {
constexpr Tape() = default;
constexpr ~Tape() {
if (l) { l->r = nu... | TEST | 0.956574 | 7.801661 |
f663c114-72f3-4045-9049-b455e17868d7 | polossk/Code-Archive | HDU/20/hdu2049.cpp | #include <stdio.h>
int main(void)
{
int i, m, n;
__int64 a[21][2] = {{1,0},{1,0},{2,1},{6,2}};
for (i = 4; i < 21; i++)
{
a[i][0] = i * a[i-1][0];
a[i][1] = (i-1) * (a[i-1][1] + a[i-2][1]);
}
scanf("%d", &i);
while (i-- && scanf("%d%d", &n, &m))
printf("%I64d\n", a[... | ALGO | 0.999918 | 3.606559 |
52a5b670-41a9-4074-8fc5-30dcf9a36c33 | oliverflood/advent-of-code-2022 | day03b.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> slurp();
string common(string a, string b);
int main() {
// file i/o setup
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
vector<string> input = slurp();
int score = 0;
// compute scores of common chars
for (int i = 0; i <... | ALGO | 0.996079 | 4.403187 |
cadf421c-de62-4054-b7ac-a838424a1b0e | codex31373/sdl_2_t | lib/box2d/src/dynamics/b2_wheel_joint.cpp | #include "box2d/b2_body.h"
#include "box2d/b2_draw.h"
#include "box2d/b2_wheel_joint.h"
#include "box2d/b2_time_step.h"
// Linear constraint (point-to-line)
// d = pB - pA = xB + rB - xA - rA
// C = dot(ay, d)
// Cdot = dot(d, cross(wA, ay)) + dot(ay, vB + cross(wB, rB) - vA - cross(wA, rA))
// = -dot(ay, vA) - d... | ALGO | 0.998057 | 7.108689 |
b23440b5-8c8f-487c-8afc-cec4ae0bf6e4 | Abanob21/WahbaAbanob_CIS5_Spring2017 | Homework/Assignment 1/Savitch_9thEd_Chap1_ProgProg3_Coins/main.cpp | /*
* File: main.cpp
* Author: Abanob Wahba
* Created on February 26, 2017, 12:32 PM
* Purpose: to calculate the number of coins in cents.
*
*
*/
//System Libraries
#include <iostream> //Input - Output Library
using namespace std; //Name-space under which system libraries exist
//Use... | ALGO | 0.963648 | 4.536726 |
5873a849-2e9d-455a-b679-4dbca3e9715f | hiroe-crowdbotics/Research-C2S-C--25K-week1 | ch10/ex10_17.cpp | // @pezy
//
// Exercise 10.17
// Rewrite exercise 10.12 from 10.3.1 (p. 387)
// to use a lambda in the call to sort instead of the compareIsbn function.
//
// @See 7.26, 10.12
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include "../ch07/ex7_26.h" // Sales_data class.
int main(... | ALGO | 0.99787 | 6.224326 |
42ba2705-5b02-4929-8a48-227431b5ab8e | sgneves/cpp | C++_Primer/Chapter_06/Exercise_06_12/Exercise_06_12.cpp | // Ex 6.12 - Based on Ex 6.10 but uses references.
#include <iostream>
void swap(int &i1, int &i2) {
int temp = i1;
i1 = i2;
i2 = temp;
}
int main()
{
int i1 = 1, i2 = 2;
swap(i1, i2);
std::cout << "i1 = " << i1 << std::endl;
std::cout << "i2 = " << i2 << std::endl;
return 0;
}
| ALGO | 0.986418 | 5.153223 |
640b3f38-2cb6-42b7-8388-6f87b8c3c379 | yashwanthguguloth24/Cpp-Practice | FINAL450/Searching and Sorting/find_majority_element.cpp | // https://practice.geeksforgeeks.org/problems/majority-element-1587115620/1
// find the potential candidate by cnt and check if potential candidate is the final answer
class Solution{
public:
// Function to find majority element in the array
// a: input array
// size: size of input array
int major... | ALGO | 0.999973 | 5.124912 |
d8809144-5734-462d-9620-59b92e9c83ad | NinjaMohit/fluttercode | 1.StatefulAssignment/Assignment9/flutter_application_9/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.996151 | 6.76073 |
39edc31b-1eb9-4959-8860-a7b6be3aafc7 | mrpankajpandey/GFG-POTD24 | 03 - March/20-03-2024.cpp | /*
Author : mrpankajpandey
Date : 20/03/2024
Problem : Sum of nodes on the longest path from root to leaf node
Difficulty : Medium
Problem Link : https://www.geeksforgeeks.org/problems/sum-of-the-longest-bloodline-of-a-tree/1
Video Solution : NA
*/
//{ Driver Code Starts
// Initial Template for C++
#include <bits/s... | ALGO | 0.999583 | 7.19877 |
91a953b3-3225-4863-aa78-10e0ad38947d | humamf/flutter_application_1 | 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 |
60e5df94-2829-4285-a787-9a6045b963dd | coderbysoul/Strivers-SDE-Sheet-Challenge | Day 25/wordbreakII.cpp | //https://www.codingninjas.com/studio/problems/word-break-ii_8230786?challengeSlug=striver-sde-challenge
#include <bits/stdc++.h>
void fun(vector<string>& ans, int mx, string w, unordered_set<string>& s, string str)
{
if (w.size() == 0 && str.size() > 0)
{
ans.push_back(str);
return;
}
... | ALGO | 0.999928 | 5.708058 |
a37ea15c-f1bd-4552-b121-2e3d2933b353 | KishanKumar1047/DSA | grredy/minumum_product.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std ;
int main() {
vector<int> arr = {1,-2,-3,4,6};
priority_queue<int , vector<int> , greater<int> > pq;
for(auto ele : arr){
pq.push(ele);
}
int x ;
int pd = 1;
int y = 0;
if(pq.top()<0){
... | ALGO | 0.999978 | 4.302036 |
fe842de2-cfc3-4ce2-a712-de867b1a63fa | 2001Kaye/assignment3 | mst_kruskal.cpp | #include <iostream>
#define INF (~0U >> 2)
#define MAX_EDGE 100
#define N 7
using namespace std;
struct Edge
{
int u, v, weight;
};
struct Node
{
int vertex, weight;
Node* next;
Node(int v, int w, Node* n) : vertex(v), weight(w), next(n) {}
};
Edge edges[MAX_EDGE];
void insertion_sort(Edge data[], int edge_coun... | ALGO | 0.999962 | 3.785132 |
8a346ba3-04a2-4984-ab6a-58dd3bd83f96 | ZiluZhang/LeetCode-Solutions | 105.cpp | // Construct Binary Tree from Preorder and Inorder Traversal
// 前序+中序 -> 树
// 递归,前序中第一个是parent,中序里这个节点左边是left child,右边是right child
// 递归中记录前序序列中的[i,j]是当前区间,中序序列中[k,l]是当前区间,如果区间不成立就返回null
// 注意index的计算
class Solution {
public:
TreeNode* buildTree(vector<int>& preorder, vector<int>& inorder) {
int num = pre... | ALGO | 0.99999 | 6.532091 |
1fa2e581-76c0-4413-9a23-23d2b9b43bac | Congb19/leetcode_solutions | cpp/help7.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <tr1/unordered_map>
#include <vector>
using namespace std;
static bool cmp(const pair< char, int >& p1, const pair< char, int >& p2) {
return p1.second > p2.second;
}
string solve(string a) {
string res = "";
tr1::unordered_map< char, int > map;
fo... | ALGO | 0.999988 | 4.046645 |
4283ead4-ea6b-494f-9a30-ae8bb99faab4 | garima-b8/coding_interview_questions | array/array_rotation/2.Array_Rotation_By_Reversal_Algo.cpp | /*
* Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements by using reversal algo
* Input : arr[] = [1, 2, 3, 4, 5, 6, 7]
* d = 2
* Output : arr[] = [3, 4, 5, 6, 7, 1, 2]
*
*/
#include<iostream>
using namespace std;
void reverse(int *arr,size_t start, size_t end)
{
while(start<end)... | ALGO | 0.999769 | 5.966199 |
76cd78f5-e529-4d28-a8d0-151bf08116c8 | Mitali-Potdar/LeetCode | 0078-subsets/0078-subsets.cpp | class Solution {
public:
vector<vector<int>> res;
// void solve(vector<int> &nums, vector<int> temp, int k){
// if(k == nums.size()) {
// res.push_back(temp);
// return;
// }
// //exclude
// solve(nums, temp, k+1);
// //include
... | ALGO | 0.999907 | 5.924773 |
200640a1-d45e-4c6a-9c5e-8e20ee572fd0 | Vinay-Rastogi/CrackYourPlacement | Day24/938-Range_Sum_of_BST.cpp | #include <bits/stdc++.h>
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:
int rangeSumBST(TreeNode* root, int L, int R) {
int rangeSum = 0... | ALGO | 0.999989 | 7.267508 |
844306de-26aa-42b9-8579-81a93e825f4a | OmarAlSeddik/competitive-programming-codeforces | assiut-sheets-2/sheet1/the-grades.cpp | #include <bits/stdc++.h>
using namespace std;
struct Student {
string name;
int total;
int grades[4];
};
bool compareByTotal(const Student& a, const Student& b) {
return a.total > b.total;
}
bool compareByName(const Student& a, const Student& b) {
return a.name < b.name;
}
int main() {
ios::... | ALGO | 0.999772 | 4.503757 |
4c60ccbe-c68f-49b1-81dc-b850795e6216 | james-sungjae-lee/2018_CPP | LAB/lab0412/lab0412_memory1.cpp | // 경영학부 경영학전공 20132651 이성재
// lab0412_memory1.cpp
#include <iostream>
#include <cstring>
using namespace std;
class MyString{
public:
char memory[80] = {0};
int size(){
int i = 0;
while (memory[i] != '\0') {
i++;
}
return i;
};
void cpy(char str[]){
int i = 0;
while (str[i] != '\... | TOOL | 0.967334 | 3.878226 |
bf2a3b55-5dd1-4d0a-a2bd-fd35b6e4b6bd | YuanjieHuang/mycode_kali | algrithm/05-Binary-Search-Tree/Course Code (C++)/Optional-04-More-about-Binary-Search/main.cpp | #include <iostream>
#include <cassert>
#include <cstdlib>
#include <ctime>
#include "BinarySearch.h"
#include "LinearSearch.h"
using namespace std;
int* generateRandomOrderedArray(int n, int rangeL, int rangeR){
int* arr = new int[n];
srand(time(NULL));
for(int i = 0 ; i < n ; i ++)
arr[i] = ran... | TEST | 0.994989 | 5.635867 |
612006c8-80e2-44f2-9cee-eb3133727250 | wojiushimogui/leetCode | isPalindrome_string.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
/*
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" is not a palindrome.
*/
/*
˼·еַתΪСдĸ洢һУȻǰָƶȽϼ
ע⣺Ҫȫǿոַ
*/
bool isValid(c... | ALGO | 0.999235 | 4.022809 |
ab304534-5d8f-43a8-aa54-064a045c39f1 | Dhirajkumar55/6Companies-30Days | damagedToy.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m,k;
cin >> n >> m >> k;
cout << (k+m-1)%n << endl;
return 0;
} | ALGO | 0.999971 | 3.439236 |
7bb07a13-5f7a-447c-917f-02584df48bee | AgreenCabTree/ICPC | 2024_09_20_Codeforces Round 973 (Div.2)/B.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
int a[N];
int main() {
cin.tie(NULL);
cout.tie(NULL);
ios::sync_with_stdio(false);
freopen("in.txt", "r", stdin);
int ntcs; cin >> ntcs;
while (ntcs--) {
int n; cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
if (n == 2) {
... | ALGO | 0.999523 | 3.915683 |
f9ddad3e-1c6a-41c3-9ab2-d11ba1c827d4 | shivam2001kumar/finalSheet | targetSheet/binary Tree/maxPathSumRootToRootNode.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node* left;
struct Node* right;
Node(int x){
data = x;
left = right = NULL;
}
};
class Solution {
public:
int solve(Node*root,int&res)
{
//Base Condition
if(root==NULL)
return 0;
... | ALGO | 0.999993 | 5.483076 |
f611ec3d-0fd0-4313-b088-9addb5cb4ee2 | lunw1024/OI | old/16.cpp | #include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
long long phi(long long x)
{
long long out = x;
for (int i = 2; i * i <= x; i++)
{
if (x % i == 0)
{
out = out / i * (i - 1);
while (x % i == 0)
{
x /= i;
... | ALGO | 0.999951 | 4.406758 |
4c7cfeac-800f-4c72-9c67-ebcac8466533 | manikanta2901/ubuntu | .history/SRM/elab/DataStructures/Stack/ST17_20200925181243.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node1{
int data;
struct Node1 *next;
};
void push(struct Node1 **top,int data){
struct Node1 *new_node = (struct Node1*)malloc(sizeof(struct Node1));
new_node->data = data;
new_node->next = *top;
*top = new_node;
}
void reverse(struct Node1*... | ALGO | 0.999985 | 4.757863 |
9763cdc3-338f-4cd0-8d42-cbbfc38d9c6e | 9Tempest/llvm-hacked | clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp | #include "DirectoryScanner.h"
#include "clang/DirectoryWatcher/DirectoryWatcher.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Path.h"
#inclu... | TOOL | 0.938768 | 7.650513 |
3ee4662a-109f-41dd-82f5-843ff9b36a19 | sumit-kakde/LeetCode-Problems | 1894-merge-strings-alternately/1894-merge-strings-alternately.cpp | class Solution {
public:
string mergeAlternately(string word1, string word2) {
string merge;
int i=0;
int j=0;
while(i<word1.size()||j<word2.size()){
if (i<word1.size()){
merge=merge+word1[i];
i++;
}
if(j<word2.size(... | ALGO | 0.999933 | 5.797495 |
0bbf260c-237e-432e-998a-a84e70a454c8 | Shohan07/Problem-Solving | Code Forces/CF_729_2A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t, n, a, od, ev;
cin >> t;
while(t--){
cin >> n;
od = ev = 0;
for(int i = 0; i < 2*n; i++){
cin >> a;
if(a&1)od++;
else ev++;
}
if(od == ev)cout << "Yes\n";
else cout << "No\n";
}
}
| ALGO | 0.999887 | 3.832328 |
f7a75205-2477-4e03-9183-18ae57cdc9bc | XeFreya/Detector_Rostros | opencv-4.x/opencv-4.x/modules/dnn/src/ocl4dnn/src/ocl4dnn_pool.cpp | #include "../../precomp.hpp"
#include <string>
#include <vector>
#include "../include/common.hpp"
#include "../include/ocl4dnn.hpp"
#include "opencl_kernels_dnn.hpp"
namespace cv { namespace dnn { namespace ocl4dnn {
template<typename Dtype>
OCL4DNNPool<Dtype>::OCL4DNNPool(OCL4DNNPoolConfig config)
{
int dims = co... | TOOL | 0.94004 | 6.664497 |
f1f05ded-3109-4a9f-8345-2461b6543303 | Smok1e/Injector | src/Main.cpp | #include <iostream>
#include <format>
#include <filesystem>
#include <stdexcept>
#include <string_view>
#include <Windows.h>
#include <Psapi.h>
#include <Shlwapi.h>
#include <ArgParser/ArgParser.hpp>
//========================================
class WinAPIError: public std::runtime_error
{
public:
using std::runtim... | TOOL | 0.896658 | 6.295971 |
8f8b0cc2-28c5-4348-8f45-ebe324c968e8 | biomachina-lab/Sculptor | svt/basics/test/powell/main.cpp | /***************************************************************************
main
----
begin : 06/14/06
author : Stefan Birmanns
email : <EMAIL>
******************************************************************... | ALGO | 0.997412 | 4.678417 |
c4eb2cf8-8dfa-48dc-90c2-ff60838e83a1 | WACUP/vis_classic | vis_classic/LevelFunc.cpp | #include <math.h>
// TODO try to use log1p on compatible VS builds
/*void LinearTable(int *table)
{
for(int i = 0; i < 256; i++)
table[i] = table[i]; // linear
}*/
void LogBase10Table(int *table)
{
for(int i = 0; i < 256; i++)
table[i] = (int)(log10(1.0 + (double)table[i] / 28.3334) * 256.0); // log bas... | ALGO | 0.9866 | 3.624788 |
e0bd1828-dbfe-4192-8c78-7846e5c03742 | enkilee/leetcode | no1111.cpp | /*
* @Author: your name
* @Date: 2020-04-20 19:40:43
* @LastEditTime: 2020-04-20 19:45:41
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \leecode\no1111.cpp
*/
#include <iostream>
#include <cmath>
#include <vector>
#include <stack>
#include <map>
#include <algorithm>
us... | ALGO | 0.99896 | 4.266695 |
72124a7e-2d86-46a9-8a25-94be4663af1c | ishandutta2007/codeforces | kostka/normal/490/C.cpp | #include "bits/stdc++.h"
using namespace std;
const int MAXN = 1000007;
bool czy1[MAXN], czy2[MAXN];
int main()
{
string x;
cin >> x;
int n = (int)x.size();
int a, b;
cin >> a >> b;
long long t = 0;
for(int i=0; i<n; i++)
{
t = (t*10)%a;
t = (t+(x[i]-'0'))%a;
//cerr << t << " ";
if(t=... | ALGO | 0.999979 | 3.55594 |
0607fb3d-0eff-4e8a-ac87-4dc2546ebd5a | sakshamA06/DSA | Step 3 : Solve Problems on Arrays [Easy -> Medium -> Hard]/Lec 3: Hard/1.pascalTriangle.cpp | #include<bits/stdc++.h>
using namespace std;
long long nCr(int n, int r){
long long ans = 1;
for(int i = 0; i < r; i++){
ans *= n-i;
ans /= i+1;
}
// nCr = n * n-1 * n-2 * .../ 1 * 2 * 3 * ....
// doing it in this order will never mess up with integer division as first it will be n/... | ALGO | 0.999909 | 3.88553 |
9785b78f-d745-4ca7-b15b-cb7e96549958 | toshi-physics/phase-field-rheology | analysis/src/msd.cpp | // msd.cpp
// A code that computes the mean square displacement from the trajectory file
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <string>
#include "position.hpp"
using std::cout;
using std::endl;
using std::ofstream;
using std::vector;
using std::string;
int main (int arg... | ALGO | 0.973826 | 4.47836 |
b10ae187-1eb1-43d4-af8b-aecb2649de1b | NGUAlexZhang/Algorithm | codeforces/Codeforces Round #841 (Div. 2) and Divide by Zero 2022 Anurag203 cse200001043 ka_tri/C.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n=2e5;
int tmp=n;
int cnt=0;
while(tmp){
cnt++;
tmp>>=1;
}
n=(1<<cnt)-1;
cout<<n<<endl;
int ans=0;
for(int i=1;i<=n;i++){
int num=sqrt(i);
if(num*num==i){
ans++;
}
}
... | ALGO | 0.999366 | 4.52704 |
0fb01701-a9c1-41e9-969c-ca4a271a078b | bob881688/school_data | ITSA 題庫/基礎題目/題目16. 子字串出現次數/16.cpp | #include <iostream>
using namespace std;
int main(){
string target, origin;
while ( cin >> target >> origin ){
int count = 0;
int pos = 0;
while ( origin.find(target, pos) != string::npos ){
count++;
pos = origin.find(target, pos) + 1;
}
cout <... | ALGO | 0.999582 | 4.108621 |
b3fb02e0-1ed3-4833-b9e0-2d77368e86aa | lyccrius/OI-Solution | Luogu/P1540 机器翻译.cpp | #include <bits/stdc++.h>
using namespace std;
int M, N;
int line[110];
int x, cnt;
bool check(int q) {
for (int i = 0; i < M; i ++) {
if (line[i] == q) return true;
}
return false;
}
int main() {
cin >> M >> N;
memset(line, -1, sizeof(line));
for (int i = 1; i <= N; i ++) {
int tmp;
cin... | ALGO | 0.999989 | 3.361234 |
c439226e-0b67-4c14-a3a5-a16053dc9f7e | Phil564/oddballs | source970311/maths.cpp | /*
* Project: oddballs
* File: maths.cpp
* Description:handles all mathematical functions
*/
#include "oddballs.h"
#include "maths.h"
VECTOR zero = {0,0,0};
int randomPointer = 0;
short randomTable[] =
{
346, 130, 10982, 1090, 11656, 7117, 17595, 6415, 22948, 31126, 9004, 14558, 3571, 22879, 18492, 1360,
... | TOOL | 0.953935 | 4.857477 |
b0313cef-8bb3-46aa-974f-d0c1af323a05 | Patronta/cpp | VS_src/Lab 2 (1-6)/Lab 2 4/Main.cpp | #include <iostream>
using namespace std;
import student.bks2102.Lab2.Variant15.Task4;
int main() {
int n;
double epsilon;
cout << "Input precision E: ";
cin >> epsilon;
cout << "Input value n: ";
cin >> n;
cout << "f1(" << n << ") = " << RBPO::Lab2::Variant15::Task4::f1(n) << endl;
cou... | ALGO | 0.999526 | 3.892597 |
2af951f0-e910-4cc3-aaae-47ad1b4b121d | HanYouyang/Computer | 数据结构与算法/PKU-CS/Leetcode/LeetCode-master 3/C++/increasing-subsequences.cpp | // Time: O(n * 2^n)
// Space: O(n^2)
class Solution {
public:
vector<vector<int>> findSubsequences(vector<int>& nums) {
vector<vector<int>> result;
vector<int> seq;
findSubsequencesHelper(nums, 0, &seq, &result);
return result;
}
void findSubsequencesHelper(const vecto... | ALGO | 0.999996 | 6.741587 |
737ae77c-de50-407f-b20b-ca016b615f04 | HPC-AI-Team/lammps-fugaku-threadpool-sc23 | src/ntopo.cpp | #include "ntopo.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "memory.h"
#include "neighbor.h"
using namespace LAMMPS_NS;
#define LB_FACTOR 1.5
#define DELTA 10000
/* ---------------------------------------------------------------------- */
NTopo::NTopo(LAMMPS *lmp) : Point... | TOOL | 0.991166 | 7.26352 |
73a7ae04-9d23-4a90-8977-4070667ba5b0 | Marco444/Accelerated-Cpp-Excercises | chapter06/Excercises/6.4/main2.cpp | #include <vector>
#include <iostream>
using std::cout; using std::vector;
void out(vector<int> u, vector<int> v)
{
for(vector<int>::const_iterator iter = u.begin(); iter != u.end();
++iter){
cout << (*iter) << '\n';
}
cout << '\n';
for(vector<int>::const_iterator it = v.begin(); it != v.en... | ALGO | 0.997589 | 3.398751 |
f13c37e0-27dc-42c8-bae1-20254f93f9d2 | AkshayKohad/Leetcode-Problems | Hashmap/Count Number of Distinct Integers After Reverse Operations.cpp | class Solution {
public:
void Reverse(int val,unordered_set<int>&result)
{
int reversed_num = 0;
int temp = val;
while(temp!=0)
{
int remainder = temp%10;
reversed_num = reversed_num*10 + remainder;
temp = temp/10;
}
result.insert(reversed_num);
}
int countDistinc... | ALGO | 0.999711 | 6.058897 |
3bf57562-aa30-4005-8525-5c80d8113883 | RaufAliev789/4.1-Ocenka-Slojnosti | 4.1 ОЦЕНКА сложности ОП/4.1 ОЦЕНКА сложности ОП.cpp | #include <iostream>
#include <vector>
using namespace std;
void mergeSort(vector<int>& a, size_t start, size_t end) {
if (end - start < 2)
return;
if (end - start == 2) {
if (a[start] > a[start + 1])
swap(a[start], a[start + 1]);
return;
}
mergeSort(a, start, start + (end - start) / 2);
mergeSort(a, sta... | ALGO | 0.999763 | 4.63657 |
a9b7fefb-848d-4014-942b-1143f2236cc4 | nutoll26/Tetris | IBlock.cpp | #include "IBlock.h"
/*
̺
*/
/*
Function name : Rotate
Discription : turn I block
*/
void IBlock::Rotate()
{
for(int i=0; i<4; i++)
memset(block[i], 0, sizeof(int) * 4);
switch(state)
{
case 0: case 2:
block[1][0]= 7; block[1][1] =7; block[1][2] =7; block[1][3]=7;
state++;
break;
case 1: case 3:
bloc... | ALGO | 0.938391 | 3.44164 |
5b869ee3-b8ab-4ca1-96d9-08062f022a9f | SaruarChy/Codeforces-Solution | 1005 B. Delete from the Left.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int l1,l2,len,c=0;
string s,t;
cin>>s>>t;
l1=s.length();
l2=t.length();
len=l1+l2;
// cout<<l1<<" "<<l2<<"\n";
if(s[l1-1] != t[l2-1]){
cout<<len<<"\n";
}
else{
l1--,l2--;
// cout<<l1<<" "<<... | ALGO | 0.999958 | 3.185023 |
9d5509e8-0b27-4ae9-adf0-13295a061aee | Corycle/XCPC-Codes | test/The 2023 CCPC (Chongqing) Onsite/F.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1000006;
int read(){
int s=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9'){s=s*10+c-'0';c=getchar();}
return s*f;
}
int n,ans[N],vis[N];
pair<int,int> a[1000006];
int main(){
... | ALGO | 0.999954 | 3.806258 |
06faa575-3758-47f2-8bc4-10df590a551e | zgh551/LateralControl_Cpp_Webots | controllers/rear_wheel_controller/Math/math_utils.cpp | #include "math_utils.h"
namespace math{
/**
* @brief Normallize Angle to [-PI,PI)
* @param angle the original value of the angle
* @return The normalized value of the angle
*/
double NormallizeAngle(const double angle)
{
double a = fmod(angle + static_cast<double>(M_PI),2.0 * static_cast<double>(M_PI));
i... | TOOL | 0.989362 | 4.986091 |
b84b12ac-9ee7-415e-b745-a9017e4c84b5 | alxterekh/VIGENERE-CHIPHER | cipherOfVzhiner/cipherOfVzhiner/Vigenere.cpp | #include "Vigenere.hpp"
Vigenere:: Vigenere (string key)
{
for(int numberOfCharacterInKey = 0; numberOfCharacterInKey < key.size(); ++numberOfCharacterInKey)
{
if (key[numberOfCharacterInKey] >= 'A' && key[numberOfCharacterInKey] <= 'Z')
{
this->key += key[numberOfCharacterInKey];
... | ALGO | 0.977917 | 5.542089 |
0c0e823c-7f9a-47af-8ff9-da3fa281d0f1 | abhaynathk/Design_Analysis_and_Algorithms | Pushrelabel2.cpp | #include <bits/stdc++.h>
using namespace std;
struct vertex {
int eflow, ht;
};
int v, e;
int **cap, **flow;
struct vertex *vert;
void preflow(int s) {
vert[s].ht = v;
for (int i = 0; i < v; i++) {
if (i != s && cap[s][i] != 0) {
flow[s][i] += cap[s][i];
flow[i][s] -= cap[s][i];
vert[i].eflow += cap[s][i];
}
}
}
int g... | ALGO | 0.999936 | 4.482928 |
bbb7b124-648c-4444-bc3c-ba207cf29cda | MaazAli8460/Basic-C-assignments | Lab tasks/i22-1042_lab04/i22_1042_section_A_Lab04/task02.cpp | #include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int main()
{
int num_1,num_2,num_3,add,sub,multiply,mod;
float div;
cout<<"\nEnter first number;";
cin>>num_1;
cout<<"\nEnter second number:";
cin>>num_2;
cout<<"\nEnter third number:";
cin>>num_3;
add=num_1+num_2+num_3;
sub=num_1-num_... | ALGO | 0.988192 | 3.047548 |
dc6fa1e5-cf69-4101-8f90-bbb725af043b | ishandutta2007/codeforces | barichek/normal/638/A.cpp | #include <bits/stdc++.h>
#define fin freopen("input.txt", "r", stdin)
#define fout freopen("output.txt", "w", stdout)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define tin int timer=clock()
#define tout printf(I,clock()-timer)
#define sqr(x) (x)*(x)
#define elif else if
#define maxin... | ALGO | 0.998883 | 3.20257 |
f64f8957-5d2d-4896-8b6a-8f7f575bd3a0 | hjhj97/ProblemSolving | BOJ/DP/2655-가장 높은 탑 쌓기.cpp | #include<stdio.h>
#include<vector>
using namespace std;
#define SIZE 111
struct Brick {
int a, h, w;
Brick() {}
Brick(int _a, int _h, int _w) {
a = _a;
h = _h;
w = _w;
}
};
int n, ans = 0, dp[SIZE];
Brick b[SIZE];
vector<int> v;
int fMax(int a, int b) {
return a > b ? a : b;
}
int dfs(int cur) {
if (dp[cur... | ALGO | 0.999962 | 3.707239 |
dde6188a-55b9-439f-a6fa-43c6806280b3 | geroge-gao/DataStructure | 7_Graph/Dijkstra.cpp | #include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
using namespace std;
#define TRUE 1
#define FALSE 0
#define MAX_VERTEX_NUM 20
#define OK 1
#define ERROR -1
typedef int VRType;
typedef char InfoType;
typedef char VertexType[20];//向量类型
typedef int Status;
int Visited[MAX_VERTEX_NUM];//标志数组
... | ALGO | 0.999966 | 3.696129 |
9dddb1ca-97a3-4bac-99cb-7863c2740d50 | Yash-Thio/DSA | recursion/Pow.cpp | #include <iostream>
using namespace std;
#include <iostream>
#include <vector>
using namespace std;
double helper(double x, int n)
{
if (n == 0)
{
return 1;
}
else if (n == 1)
{
return x;
}
else if (n == -1)
{
return 1 / x;
}
double half = helper(x, n / 2... | ALGO | 0.999945 | 4.44742 |
d70b8a01-2b9b-4467-97e5-fdf99d624a38 | Sahil8317/LeetCode | 496-next-greater-element-i/496-next-greater-element-i.cpp | // Stack problem
class Solution {
public:
vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {
stack<int> stk;
map<int,int> m;
for(int i=nums2.size()-1;i>=0;i--){
while(!stk.empty() && nums2[i]>=stk.top()){
stk.pop();
}
... | ALGO | 0.999849 | 5.625798 |
b03cf3c0-d84d-45cb-92ad-dc10a70fc7cf | victorjgomez/c_and_cplusplus_competitive_programming_problems | problems/1811A/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for(auto& i : a) cin >> i;
int x =
return 0;
}
| ALGO | 0.996511 | 3.703966 |
869f7bab-dbc0-4631-96d1-20fe546a0331 | LordaeronESZ/LeetCode | 0057插入区间/插入区间.cpp | #include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval) {
if (intervals.empty()) {
intervals.push_back(newInterval);
return intervals;
}
bool hasInserted = f... | ALGO | 0.999945 | 5.752588 |
30f8caff-f48a-4167-bc5b-ac9affae18ea | Shreyas2913/aman | arrays.cpp | #include <iostream>
using namespace std;
bool check_prime(int n);
int main() {
int n, i;
bool flag = false;
cout << "Enter a positive integer: ";
cin >> n;
for(i = 2; i <= n/2; ++i) {
if (check_prime(i)) {
if (check_prime(n - i)) {
cout << n << " = " << i << " + " << n-i << endl;
... | ALGO | 0.999081 | 4.87619 |
f78a467b-278d-48e6-8d49-c01da01e4803 | Forsyth-Creations/Ender-3-Upgrades-Forsyth-Creations | Marlin Builds/Forsyth Creations Firmware - March 2022 Edition/Marlin/src/gcode/probe/G38.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(G38_PROBE_TARGET)
#include "../gcode.h"
#include "../../module/endstops.h"
#include "../../module/motion.h"
#include "../../module/stepper.h"
#include "../../module/probe.h"
inline void G38_single_probe(const uint8_t move_value) {
endstops.enable(true);
G38_move =... | ALGO | 0.951526 | 7.697785 |
bfa2a1f8-38bd-4a8c-b7da-58c77244ccc8 | Yateesh96/Coding-with-CPP | Basic programs/time_struct.cpp | //Time structure (add and convert)
#include<iostream>
using namespace std;
struct Time
{
int hour,min,sec;
};
void add(Time k[],int n)
{
Time result={0,0,0};
for(int i=0;i<n;i++)
{
result.hour=result.hour+k[i].hour;
result.min=result.min+k[i].min;
result.sec=result.sec+k[i].sec;
}
if(result.sec>=60)
{
re... | ALGO | 0.973653 | 4.044394 |
2c4b8624-2096-4fd5-bf7a-620c9b3bbf56 | Rhithick02/C-code | Codechef/chefandstrings.cpp | #include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
char ch[1000];
cin>>ch;
int count=0;
for(int i=0;ch[i]!='\0';i++)
{
if(ch[i]>='0'&&ch[i]<='9')
count+=ch[i]-'0';
}
cout<... | ALGO | 0.99926 | 3.612904 |
8ebb178a-d668-4ca8-bf0f-a80ed3dd5030 | StokerBR/TAP2 | Listas/Treino 2/6_URI-1258_Camisetas.cpp | #include <bits/stdc++.h>
using namespace std;
bool sortNome(const pair<int, string> &a, const pair<int, string> &b){
if(strcmp(a.second.c_str(), b.second.c_str()) < 0 && a.first == b.first){
return true;
}
else{
return false;
}
}
int main(){
int n, i;
bool primeiro = true;
char tamanho;
strin... | ALGO | 0.9098 | 3.919019 |
0d229a08-bbe1-47b3-82a0-d9f20ce3c4d8 | ShoYamanishi/wailea | src_bin/jgaa_planarity_experiment.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include "undirected/base.hpp"
#include "undirected/bl_planarity_tester.hpp"
#include "undirected/bl_tree.hpp"
#include "undirected/bl_tree_node.hpp"
#include "undirected/bl_inline.hpp"
#include "undirected/st_numbering.hpp"
using namespace std;
using namespace... | ALGO | 0.916221 | 5.427964 |
5fb15724-7768-4fde-acf5-a571c037cd20 | ashishnagpal2498/CPP_Concepts_and_Codes | CodeChef-Problems/New/LunchTimeJuly2020/chefAndSteps.cpp | #include<bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define ArrIn(n) for(int i=0;i<n;i++)
#define ArrOut for(int i=0;i<n;i++) {cout<<arr[i]<<" "; }
#define mod 1e9+7
using namespace std;
ll t,n,k;
ll arr[200005];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>t;
while(... | ALGO | 0.999914 | 3.335351 |
8ec7894c-f792-4a6b-9b09-3a04f0a06289 | hasibul-hasib29/codeforces | 1735b.cpp | #include<bits/stdc++.h>
using namespace std;
// void counter(int &ct, int a, int b){
// while (b>a)
// {
// b = b/a;
// ct += b;
// }
// }
int main(){
int n;
cin>>n;
while (n--)
{
int t;
cin>>t;
vector<int> v(t);
int ct =0;
for(int i=... | ALGO | 0.999795 | 3.608255 |
a76f7ef1-4493-47d8-9199-5c99ba7cd9a5 | weiii8708271688/UVA | UVA/674/28908408_AC_60ms_0kB.cpp | #include<iostream>
#include<cmath>
using namespace std ;
int coin[5] = {1,5,10,25,50};
int main(){
int ans[7500] = {1};
for(int i = 0 ; i < 5 ; i++) {
for(int j = coin[i] ; j < 7500 ; j++) {
ans[j] += ans[j-coin[i]];
}
}
int n;
while(cin >> n) {
cout << ans[n] <... | ALGO | 0.998626 | 3.534058 |
1dc6eb5a-bb61-4308-876f-8b77cf423f90 | sameerkr1/competitive_coding | binary_lifting_lca_dis(a,b)_node.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;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define FASTIO ios_base::sync_with_stdio(0);cin.t... | ALGO | 0.999932 | 4.201995 |
e2d936ff-1b2f-47e5-9aeb-c71b82bddf6a | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7983_25.cpp | #include <bits/stdc++.h>
using namespace std;
ifstream fin("input.txt");
ofstream fout("output.txt");
bool isPrime(int x) {
if (x <= 4 || x % 2 == 0 || x % 3 == 0) return x == 2 || x == 3;
for (int i = 5; i * i <= x; i += 6)
if (x % i == 0 || x % (i + 2) == 0) return 0;
return 1;
}
inline void boostIO() {
i... | ALGO | 0.99992 | 3.824432 |
328fa471-0dec-41cc-93cd-61487e22d0b5 | DaaTimon/Cs50-Projects | Pset3/Plurality.cpp | #include <cs50.h>
#include <stdio.h>
#include <string.h>
// Max number of candidates
#define MAX 9
// Candidates have name and vote count
typedef struct
{
string name;
int votes;
}
candidate;
// Array of candidates
candidate candidates[MAX];
// Number of candidates
int candidate_count;
// Function prototyp... | ALGO | 0.999727 | 4.829177 |
b991ae12-d80e-4a56-bcf6-8fb4c5e57433 | SunilKumarPradhan/C_Plus_Plus_DSA | 02. Mathematics/02CountDigits.cpp | #include <bits/stdc++.h>
using namespace std;
int countDigits(int n) {
int count = 0;
while (n != 0) {
n /= 10;
count++;
}
return count;
}
int main() {
int n = 12345; // example number
cout << "Number of digits: " << countDigits(n) << endl;
return 0;
}
| ALGO | 0.999281 | 6.176578 |
01ec151f-5ec6-4a7b-8c5e-cccc8526c8da | XakerAli/cpp | Untitled10.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main()
{
double a,b,c=0;
cin>>a;
for(int i=1;i<=b;i++)
{
b=sqrt(a);
}
cout.precision(2);
cout<<fixed<<b;
}
| ALGO | 0.999693 | 3.140853 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.