uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9efb2f41-3715-422f-996f-3e1024c71437 | Soboroo/ProgrammingPractice | hellocpp/other/2579.cpp | #include <iostream>
#include <set>
using namespace std;
int main() {
int n, m, b;
char a;
cin >> n;
for (int i = 0; i < n; i++) {
multiset<int> s;
cin >> m;
for (int j = 0; j < m; j++) {
cin >> a >> b;
if (a == 'I')
s.insert(b);
else if (a == 'D') {
if (b == 1) {
... | ALGO | 0.998991 | 3.937907 |
a048a6d0-701b-4fb7-ae3f-f5dfebb7964c | bhartiomee/dailyCodes | recursion/344_leet.cpp | // https://leetcode.com/problems/reverse-string/submissions/
//iterative
void reverseString(vector<char> &s)
{
int n = s.size();
int i = 0;
while (i < n / 2)
{
char tmp = s[i];
s[i] = s[n - i - 1];
s[n - i - 1] = tmp;
i++;
}
}
//recursive
void reverseString(vector<char> &s)
{
helper(0, s... | ALGO | 0.999886 | 6.51798 |
1f1d4e68-b87a-4194-a4df-c394ac7e8ced | EyeCantCU/android_device_lge_joan-common | gps/utils/loc_misc_utils.cpp | #define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_misc_utils"
#include <stdio.h>
#include <string.h>
#include <platform_lib_log_util.h>
#include <loc_misc_utils.h>
#include <ctype.h>
int loc_util_split_string(char *raw_string, char **split_strings_ptr,
int max_num_substrings, char delimiter)
{
... | TOOL | 0.952942 | 5.316868 |
fdaa85c8-702c-4808-86a4-e5e4ece4e322 | a5tronomy/ue5-ffcotw | Engine/Source/ThirdParty/ICU/icu4c-64_1/source/test/intltest/punyref.cpp | /**********************************************************/
/* Implementation (would normally go in its own .c file): */
#include <string.h>
#include "unicode/utypes.h"
#if !UCONFIG_NO_IDNA
#include "punyref.h"
/*** Bootstring parameters for Punycode ***/
enum { base = 36, tmin = 1, tmax = 26, skew = 38, damp = ... | TOOL | 0.989055 | 6.852651 |
71cd3483-b34d-44f6-a90d-9993bf9bf60a | siddharth03-del/cpp_leetcode_problems | MaxNumberOfK-SumPairs.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution{
public:
int maxOperations(vector<int>& nums, int k){
sort(nums.begin(), nums.end());
int i = 0;
int j = nums.size() - 1;
int count = 0;
while(j > i){
if(nums[i] + n... | ALGO | 0.99974 | 5.659427 |
9855b4c9-496d-48e2-8d35-05da267ec93f | Lin-jingy/ACM | codeforces/Codeforces Round 932 (Div. 2)/1935A.cpp | #include <bits/stdc++.h>
#if defined (_WIN64)
#pragma clang diagnostic ignored "-Wunused-value"
// #pragma clang diagnostic ignored "-Wshift-op-parentheses"
#endif
// #define int long long
template <class T>using vec=std::vector<T>;
template<class K,class V> using umap=std::unordered_map<K,V>;
template<class T>std::is... | ALGO | 0.999692 | 5.212934 |
951d8d99-0509-4a65-81f8-56589dcc5a34 | Lewuathe/mlir-hello | thirdparty/llvm-project/llvm/lib/TableGen/StringMatcher.cpp | #include "llvm/TableGen/StringMatcher.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace llvm;
/// FindFirstNonCommonLetter - Find the first character ... | TOOL | 0.969805 | 7.345655 |
a0b1d520-eefc-4b0d-afba-868aa7282c31 | sihyeong671/Algorithm | Gold/B1806.cpp | // 부분합
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int N, S;
ll _sum = 0;
int length = 1e5;
bool check = false;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> N >> S;
vector<int> v(N);
for(int i = 0; i < N; ++i){
... | ALGO | 0.999995 | 3.968699 |
323e800d-060d-4aa8-a861-8e593baa5a7d | coredux/Leetans | src/MaximalSquare.cpp | class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
int rows = matrix.size();
if ( rows == 0 ) {
return 0;
}
int cols = matrix[0].size();
vector<vector<int>> dp( rows , vector<int>( cols , 0 ) );
int maxEdgeLen = 0;
for ( i... | ALGO | 0.999447 | 6.450527 |
a1884a88-74c8-4902-808a-ccb15954616e | MDTAHSINURRAHMAN/Codeforces-Daily-Code | codes/B_Karina_and_Array_Codeforces_Round_867_Div_3.cpp | #include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define isinf = 0x3f3f3f3f;
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define fl(i, m, n) for (ll i = m; i < n; ++i)
#define rl(i, m, n) for (int i = n; i >= m; i--)
#define py cout << "YES\n"
#define pn cout << "NO\n"
#d... | ALGO | 0.999745 | 4.350267 |
7238fbd2-d325-46ae-84df-cc1f29c8a0c4 | ifilex/sensa | ndk/sources/cxx-stl/llvm-libc++/libcxx/test/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp | // <algorithm>
// template<LessThanComparable T>
// pair<const T&, const T&>
// minmax(const T& a, const T& b);
#include <algorithm>
#include <cassert>
template <class T>
void
test(const T& a, const T& b, const T& x, const T& y)
{
std::pair<const T&, const T&> p = std::minmax(a, b);
assert(&p.first == &x... | TEST | 0.970677 | 5.858769 |
0a5a6b3d-dcd9-4bf5-b161-0e1306013b53 | takuma1229/atcoder | src/abc/abc326/c.cpp | #include <bits/stdc++.h>
using namespace std;
// 問題は「Ai≤Aj<Ai+Mを満たすようなjの個数の最大値を求めよ」となる
int main() {
int N, M;
cin >> N >> M;
vector<int> A(N);
for (int i=0; i<N; i++) {
cin >> A.at(i);
}
sort(A.begin(), A.end());
int result = 0;
for (int i=0; i<N; i++) {
// A[i]を左端と考えて... | ALGO | 0.99997 | 4.55077 |
0c072b7c-edd3-4359-9ddd-bf0c3e6e9d51 | whattadarsh/competitive-coding-online-platforms-solutions | codeChef/long_challenge/july/PTMSSNG.cpp | // Chef has N axis-parallel rectangles in a 2D Cartesian coordinate system. These rectangles may intersect, but it is guaranteed that all their 4N vertices are pairwise distinct.
// Unfortunately, Chef lost one vertex, and up until now, none of his fixes have worked (although putting an image of a point on a milk cart... | ALGO | 0.999517 | 4.328144 |
cf41d74e-4684-4a5d-87ef-36e10614c6e9 | SpreadTheJello/CSE024 | Lab_01/slope.cpp | #include <iostream>
using namespace std;
int main() {
float x1,x2,y1,y2,grad;
cout << "Enter first x: ";
cin >> x1;
cout << "Enter first y: ";
cin >> y1;
cout << "Enter second x: ";
cin >> x2;
cout << "Enter second y: ";
cin >> y2;
grad = (y2-y1)/(x2-x1);
if(x2-x1 == 0){
cout << "Can't divide by 0" ... | ALGO | 0.971515 | 3.928641 |
24df5647-6928-472b-abfa-c45ff3a87b50 | filipeabelha/gym-solutions | uri/2242.cpp | #include <bits/stdc++.h>
char palavra[100];
char chr;
int n;
int ok = 1;
int main () {
while (1) {
scanf("%c", &chr);
if (chr == 10) break;
if (chr == 'a') palavra[n] = 'a', n++;
if (chr == 'e') palavra[n] = 'e', n++;
if (chr == 'i') palavra[n] = 'i', n++;
if (chr =... | ALGO | 0.998225 | 3.300157 |
20d8382f-9ac4-4e5b-97f2-b51b30e3ee3c | siamect/proview | xtt/lib/xtt/src/xtt_menu.cpp | #include <stdlib.h>
#include "co_api.h"
#include "co_ccm_msg.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_dcli_msg.h"
#include "co_lng.h"
#include "co_string.h"
#include "rt_xnav_msg.h"
#include "xtt_xnav.h"
pwr_dImport pwr_BindXttClasses(Base);
xmenu_sMenuCall* XNav::mcp = 0;
static xmenu_sMenuItem xm... | TOOL | 0.853428 | 3.146502 |
0ede2cf5-4166-40bd-a98c-f6833dab4b8f | FabienBarrios/LibForMachineLearning | Eigen/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp | ArrayXXf table(10, 4);
table.col(0) = ArrayXf::LinSpaced(10, 0, 90);
table.col(1) = M_PI / 180 * table.col(0);
table.col(2) = table.col(1).sin();
table.col(3) = table.col(1).cos();
std::cout << " Degrees Radians Sine Cosine\n";
std::cout << table << std::endl;
| ALGO | 0.936452 | 3.543272 |
e6f0359b-95d0-4a4c-924d-fe17ff18758c | EshanthPatyal/Leet_solns | 2586-longest-square-streak-in-an-array/longest-square-streak-in-an-array.cpp | class Solution {
public:
int longestSquareStreak(vector<int>& nums) {
int m=0;for(auto it:nums)m=max(m,it);
vector<int> v(m+1,0);
for(auto it:nums)v[it]++;
int out=1;
for(auto it:nums){
int curr=v[it];
if(curr==0)continue;
curr=1;
... | ALGO | 0.999951 | 5.451109 |
c2433623-e758-48d0-9add-d2c092c6014f | Chirag-04/DSA-Practice- | 485-max-consecutive-ones/max-consecutive-ones.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int len = 0 ;
int i= 0 ;
int j = 0 ;
int n = nums.size();
while(j<n){
if(nums[i] ==1 and nums[j] == 1){
len = max(len , j-i+1);
j++;
}
... | ALGO | 0.99999 | 6.089676 |
74f4f989-c016-4410-8180-14b0afaa1e0e | ishandutta2007/codeforces | platter/normal/1363/E.cpp | #include <bits/stdc++.h>
using namespace std;
int a[200000];
int b[200000];
int c[200000];
vector<int> adj[200000];
const long long bil=1000000000;
int cnt=0;
int save[200000];
typedef pair<int,int> P;
int zero[200000];
int one[200000];
void makeval(int v,int par,int val) {
val=min(val,a[v]);
save[v]=val;
... | ALGO | 0.999819 | 3.703237 |
f215c69c-e6d9-459b-b12e-009d4b981915 | safiyat/CompilerDesignLab | Q14/parent.cpp | #include "parent.h"
parent::parent()
{
}
parent::parent(string fileName)
{
populate(fileName);
}
void parent::populate(string fileName)
{
char temp[32];
LOC t1;
int index = 0;
ifstream file(fileName);
if(!file)
{
cerr << "Error opening the input file: " << fileName << endl;
return;
}
while (file)
{
... | TOOL | 0.976227 | 3.100147 |
5a1df6df-0cd1-440d-b1ad-854ee6d4ae16 | maruf-hossain74/Codeforces_problem_Solve | Rating_1000-1100/Maximum Cost Deletion.cpp | /*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ $
$ Author: marufhussain745 $
$ Institute: JKKNIU $
Problem: A_Maximum_Cost_Deletion
$ Date: 2024/12/30 $
$ Time: 11:... | ALGO | 0.999929 | 4.852351 |
c37fe13d-9946-4d9b-9010-84396d610bc6 | abel3t/leetcode | C++/binary-search/74.search-a-2-d-matrix.cpp | /*
* @lc app=leetcode id=74 lang=cpp
*
* [74] Search a 2D Matrix
*/
// @lc code=start
class Solution
{
public:
bool searchMatrix(vector<vector<int>> &matrix, int target)
{
int m = matrix.size();
int n = matrix[0].size();
int left = 0, right = m * n - 1;
while (left <= righ... | ALGO | 0.999915 | 6.596796 |
b5e2f4a3-103f-4b3b-91c0-8367fbc5a922 | raincross7/code-similarity | codes/train_code/problem026/problem026_29.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using mp = map<char,int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
int main() {
ios_base::sync_with_stdio(... | ALGO | 0.999984 | 3.714242 |
f8c1e40d-f4c9-4061-b593-a04aa68f7661 | wanghongbo122333/LeetCode | leetcode_cpp_code/118.杨辉三角.cpp | /*
* @lc app=leetcode.cn id=118 lang=cpp
*
* [118] 杨辉三角
*/
// @lc code=start
class Solution
{
public:
vector<vector<int>> generate(int numRows)
{
vector<vector<int>> res;
for (int i = 0; i < numRows; i++)
{
vector<int> row(i + 1);
row.push_back(1);
... | ALGO | 0.999979 | 6.391133 |
d338e1e3-2e5f-44eb-8438-91f48b706d4a | Kundanku/elements-of-programming-interviews | Pretty_printing.cpp | #include <algorithm>
#include <iostream>
#include <limits>
#include <random>
#include <string>
#include <vector>
using std::cout;
using std::default_random_engine;
using std::endl;
using std::min;
using std::numeric_limits;
using std::random_device;
using std::string;
using std::uniform_int_distribution;
using std::ve... | ALGO | 0.998747 | 5.265327 |
44e42be8-51ae-4f14-bb45-73dd8ba6f35f | sajivddinGlobally/new_india_mall_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
575fc213-2788-444d-97a9-38a9a352e196 | hwngz/Study-coding-OOP | Nguyễn Ngọc Diệu Hương BT 2,4 Chương 3/bai 2 chuong3.cpp | #include<iostream>
using namespace std;
class PS {
private:
int tu, mau;
public :
PS ()
{
tu = 0;
mau = 0;
}
// phuong thuc thiet lap
~PS (){}
// phuong thuc huy
void Set()
{
cin >> tu >> mau;
}
int UCLN (int a, int b)
{
while(b!=0)
{
int r = a%b;
a = b;
b = r;
}... | ALGO | 0.993208 | 4.177151 |
a684c058-80f4-4b67-93a9-28a7d2c2703e | raincross7/code-similarity | codes/train_code/problem060/problem060_121.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int MAXN = 100003;
const int STATES = 2;
int N;
vector<int> edges[MAXN];
int dp[MAXN][STATES];
int add(int a, int b) {
return (a + b) % MOD;
}
int mul(int a, int b) {
return (ll(a) * ll(b)) % MOD;
}
int solve(... | ALGO | 0.99964 | 4.911033 |
e481162d-61b3-4c53-9b67-6391d1446e54 | himanshumaharshi/LeetCode-DSA | 2871-double-a-number-represented-as-a-linked-list/double-a-number-represented-as-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverse(Lis... | ALGO | 0.999983 | 6.15262 |
4cbfaead-34ea-422c-a120-450cad6cd4ff | danielhO9/PS | CODEFORCES/2053B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
ll l[200000], r[200000];
ll cnt[400001];
void solve() {
cin >> n;
for (int i = 0; i < n; ++i) cin >> l[i] >> r[i];
string ans = "";
for (int i = 0; i <= 2 * n; ++i) {
cnt[i] = 0;
}
vector<int> sum(2 * n + 1, 0);
for (int i = 0; i < n; ... | ALGO | 0.999981 | 3.704535 |
afbdcaf2-351e-4b6d-b445-832fc6d76d53 | Nicolas1205/TrabajoFinalProgramacion | src/sieve.cpp | #include "../include/sieve.h"
#include <math.h>
#include <stdio.h>
#include <vector>
std::vector<bool> get_sieve() {
std::vector<bool> sieve(10000, 1);
sieve[0] = 0;
sieve[1] = 0;
for (int i = 2; i <= sqrt(sieve.size()); i++) {
for (int j = i << 1; j < sieve.size(); j += i) {
sieve[j] = 0;
}
... | ALGO | 0.997036 | 3.857165 |
b01e1e9a-fd3a-402a-80be-b927df3faeda | hyl946/llvm7.0.1 | tools/llvm-rc/ResourceScriptCppFilter.cpp | #include "ResourceScriptCppFilter.h"
#include "llvm/ADT/StringExtras.h"
#include <vector>
using namespace llvm;
namespace {
class Filter {
public:
explicit Filter(StringRef Input) : Data(Input), DataLength(Input.size()) {}
std::string run();
private:
// Parse the line, returning whether the line should be i... | TOOL | 0.917284 | 6.948372 |
17449cb2-58e3-4c74-9275-34984f2edea5 | elevenzheng/cpp | 数组/08 二维数组横向求和.cpp | #include <iostream>
using namespace std;
int main() {
int arr[3][3] = { {100,100,100},{90,50,100},{60,70,80} };
for (int i = 0; i < 3; i++) {
int sum = 0;
for (int j = 0; j < 3; j++) {
sum += arr[i][j];
}
cout << i << " " << sum << endl;
}
system("pause");
return 0;
} | ALGO | 0.999521 | 3.494003 |
d4e7592c-b156-4403-b52a-55fc10ffee25 | thegamer1907/Code_Analysis | contest/1542594147.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <cctype>
#include <casse... | ALGO | 0.999976 | 3.615646 |
8faa4bfe-730b-43fb-80c6-8904791a7625 | ayush2409/HackerRank- | C++/conditional statement.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
if(n == 1) {
cout << "one";
}
else if(n == 2) {
cout << "two";
}
else if(n == 3) {
cout << "three";
}
else if... | ALGO | 0.997619 | 4.074264 |
db258afc-29c7-4e3e-8665-c97dd565c02c | ishandutta2007/codeforces | ytkn/normal/1726/C.cpp | #include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <functional>
#include <cassert>
#include <stack>
#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __fun... | ALGO | 0.999527 | 4.052525 |
0e4726e9-d60a-4a0f-a065-bfff22da115b | lucastarche/aotd | Graphs/086-SPFA.cpp | //SPFA (Shortes Path Faster Algorithm)
//A better version of Bellman-Ford, which avoids processing repeated stuff. Has all the advantages of it as well.
//Looks like the bastard child of Bellman-Ford and Dijkstra.
//Runtime: O(k*m), where m is the number of edges, and k is a graph-dependant constant such that k <= n
#i... | ALGO | 0.999985 | 4.665433 |
3739cd3d-3c7e-498e-a542-127aaf59ece7 | Johannyjm/c-pro | MojaCoder/pdc001/d.cpp | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
ll gcd(ll m, ll n){
ll tmp;
while(m%n){
tmp = n;
n = m % n;
m = tmp;
}
return n;
}
int main(){
cin.tie(nullptr)... | ALGO | 0.999122 | 3.728479 |
ae09b6bb-0a99-444d-9195-27cb1f52dfb5 | Ananditha-phindla/LeetCode-DSA | 90-subsets-ii/subsets-ii.cpp | class Solution {
public:
void solve(vector<int>& nums,int i,vector<int>&curr,vector<vector<int>>&ans){
ans.push_back(curr);
if(i == nums.size()){
return;
}
for(int idx=i;idx<nums.size();idx++){
if(i != idx && nums[idx] == nums[idx-1])
continue... | ALGO | 0.99997 | 6.040509 |
1db978e7-4633-429c-a4cc-930b903d968c | HaHuyenTrang/baitap-ss6 | ss6/bai6.cpp | #include<stdio.h>
#include<stdlib.h>
#include <string.h>
#define MAX 5
// cau truc ngan xep
typedef struct{
int array[MAX];
int top;
}Stack;
// khoi tao 1 stack rong
void inital(Stack* stack){
stack->top = -1;
}
// kiem tra stack rong
int isEmpty(Stack* stack){
if(stack->top == -1){
return 1;
}
return 0;... | ALGO | 0.999851 | 4.53748 |
ec2023f6-f49e-4688-8613-d795545d9c15 | IreshEranga/OOC-Object-Orientaion-Concepts | Simple Exercises/Simple calculater/29.cpp | #include <iostream>
float cal(int num1, int num2, char method); //function prototype
using namespace std;
int main(){
int num1, num2; //variable declaration
char method;
cout << "Enter a number :"; //get user inputs
cin >> num1;
cout << "Enter a number :";
cin >> num2;
cout << "Enter a calculation... | TOOL | 0.994057 | 4.568787 |
e8fffde3-8961-4833-bf44-ee2b9dda168f | bhavyakalra19/comp-prog | 105-construct-binary-tree-from-preorder-and-inorder-traversal/construct-binary-tree-from-preorder-and-inorder-traversal.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.999989 | 6.388737 |
b35761e9-9597-4748-a3f8-66a34cd96b04 | ishandutta2007/codeforces | zhukov_dmitry/normal/1696/D.cpp | #include <stdio.h>
#include <bits/stdc++.h>
#include <cstdint>
#include <ctime>
#include <functional>
#include <limits>
#include <random>
#include <string_view>
#include <type_traits>
#include <utility>
#ifdef ROOM_311
# ifndef OLYMP_DEBUG
# define OLYMP_DEBUG
# endif
#else
# define OLYMP_NDEBUG
#endif
//#include <o... | ALGO | 0.999819 | 4.381282 |
3336bb88-c1f2-4bd2-889d-2ce50e4ed6c9 | AyazNacafli2010/Competitive-Programming | Topics/DynamicProgramming/1D/OwnProblems/a9.cpp | // C. Sweets Eating
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define int long long
main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, m; std::cin >> n >> m;
std::vector<int> a(n);
for (int i = 0; i < n; i++)
std::cin >> a[i];
std::sort(all(a));
std::vector<int> ans(... | ALGO | 0.999984 | 3.489567 |
4b86c819-48ca-481a-8a36-a0127fcf59ae | talbertmegan/CapstoneCode | scipy/scipy/optimize/_highs/src/simplex/HMatrix.cpp | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* This file is part of the HiGHS linear optimization suite */
/* */
/* Written an... | ALGO | 0.955822 | 4.862104 |
f3732ed8-5484-4e53-bcfe-a22b9b355e06 | zrss/LeetCode | PartitionEqualSubsetSum.cpp | // 位操作方法
// 很巧妙
// 左移与当前数字相同的位数,相当于之前的所有数字加上当前数字
// 当然 |= 保留当前数字
// 题目已经给出了限制
// 0 < nums[i] <= 100
// number of nums <= 200
// 所以 bitset 最大为 100 * 200 / 2 + 1 = 10001
class Solution {
public:
bool canPartition(vector<int>& nums) {
int sum = 0;
// 0位为 1
bitset<10001> rel(1);
int ... | ALGO | 0.999955 | 5.463643 |
64929b52-1870-42cb-9847-cbd476130a2d | FranciscoThiesen/OldProblems | URI/ecc.cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
int t;
scanf("%d", &t);
int hpy = 0;
for(int i = 0; i < t; ++i)
{
int x;
scanf("%d", &x);
if(x == 0)
hpy++;
}
if(hpy > floor(t/2.0))
cou... | ALGO | 0.999828 | 3.626719 |
ea4b3b7d-bba5-458e-86c3-98f30bc11bae | doomsday861/Allofit | ashwanichutiya.cpp | /**
* ashwanichutiya
**/
#include<bits/stdc++.h>
#define ll long long
#define testcase ll t;cin>>t;while(t--)
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define run ios_base::syn... | ALGO | 0.99976 | 4.156956 |
f1f60277-555d-48b4-ac34-2f91b7852f62 | yuhao2480444683/NLP_Project | niutensor/source/tensor/core/math/Binary.cpp | /*
* $Created by: JIANG Yufan (email: <EMAIL>) 2019-04-05
*/
#include <math.h>
#include "../../XName.h"
#include "../shape/IsSameShaped.h"
#include "Binary.h"
#include "Binary.cuh"
namespace nts {
template<class T1, class T2>
T1 BinaryDescale(T1 x, T2 num)
{
return (T1)(x / num);
}
template<class T1, class T2>
... | TOOL | 0.928277 | 6.636555 |
df9e7103-c283-4e25-bf34-99a39b997b3c | himanshushukla12/gfg_solutions | Easy/Frequency Game/frequency-game.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 LargButMinFreq(int arr[], int n) {
// code here
unordered_map<int,int> m;
int freq=INT_MAX,num=arr[0];
... | ALGO | 0.999892 | 5.424549 |
30cca82c-cb13-4e41-9de0-bbb3e9c315ac | AIxiaodi4Ever/leetcode_in_cpp | 01a栈_队列_双端队列/0042_stack.cpp | // 42. Trapping Rain Water
class Solution {
public:
int trap(vector<int>& height) {
int n = height.size();
stack<int> stk;
int ans = 0;
for (int i = 0; i < n; ++i) {
while (!stk.empty() && height[i] > height[stk.top()]) {
int top = stk.top();
... | ALGO | 0.999977 | 6.703243 |
204bffec-f27a-4847-8e2c-c0eaab3cb332 | Dixitej2002/Pattern-program | pattern12.cpp | #include<iostream>
using namespace std;
int main(){
cout<<"Enter number:-";
int n;
cin>>n;
int i=1;
char ch='A';
while (i<=n)
{
int j=1;
while(j<=i){
cout<<ch<<" ";
ch=ch+1;
j=j+1;
}
cout<<endl;
i=i+1;
... | ALGO | 0.999719 | 3.772928 |
addc5112-6c04-4ca6-82c6-681aaaf7fc60 | wexingliu/PB_RMSimulation | src/rm_driver/livox_ros_driver2/src/src/comm/comm.cpp | #include "comm/comm.h"
#include <string.h>
#include <arpa/inet.h>
namespace livox_ros {
/** Common function --------------------------------------------------------- */
bool IsFilePathValid(const char *path_str) {
int str_len = strlen(path_str);
if ((str_len > kPathStrMinSize) && (str_len < kPathStrMaxSize)) {
... | TOOL | 0.865349 | 5.896616 |
02b88626-9b88-4968-9ec9-80ba2f10fa21 | SGL-UT/GPSTk | core/lib/Utilities/BinUtils.cpp | //==============================================================================
//
// This software was developed by Applied Research Laboratories at the
// University of Texas at Austin, under contract to an agency or agencies
// within the U.S. Department of Defense. The U.S. Government retains all
// rights to ... | TOOL | 0.960112 | 5.44913 |
0f990cba-adc4-4c04-baaf-29dd14d39615 | Indecisive613/DMOJ-Questions | Inaho V.cpp | //https://dmoj.ca/problem/inaho5
//2019
using namespace std;
int main() {
int M;
long long int *num;
unsigned long long int total = 0;
cin>> M;
num = new long long int[M];
for (int i = 0; i < M; i++) {
cin>>num[i];
num[i] = num[i]*(-1);
}
for (int i = ... | ALGO | 0.999967 | 3.82638 |
0fc18c32-1297-4533-bf02-acc6f457f259 | McqGo/Sword-Point-Offer | 二、数组/2-5subArraySum.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int subArraySum(vector<int>& nums, int k){
//unordered_map[k],若不存在键k,则返回值的默认值,这里int型的默认值就是0
unordered_map<int, int> hash;
int sum = 0;
int count = 0;
hash[0] = 1;
for(const auto &num: nums){
sum+=num;
... | ALGO | 0.999754 | 5.346177 |
16d865e5-f6cc-4242-9691-88f5a1dbaa9d | Nashar-Ahmed/UVA-Problems | 10911 - Forming Quiz Teams/10911 - Forming Quiz Teams.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
double dp[65555];
double x[20],y[20];
int Set(int n,int pos)
{
return n=(n | (1<<pos));
}
int reset(int n,int pos)
{
return n=(n &(~(1<<pos)));
}
bool check(int n,int pos)
{
return (bool)(n&(1<<pos));
}
double call(int mask)
{
if(mask == ((1<<n)-1))... | ALGO | 0.999643 | 4.014324 |
50653a44-182c-4625-be54-bb494a91f17b | desparza22/delaunay_3d | clibs/eigen-3.4.0/doc/examples/TutorialLinAlgSVDSolve.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3, 2);
cout << "Here is the matrix A:\n" << A << endl;
VectorXf b = VectorXf::Random(3);
cout << "Here is the right hand side b:\n" << b << endl;
cout << "The least-squares ... | ALGO | 0.999594 | 4.175827 |
a6472973-ca11-466c-836e-a85b51455711 | FomaZheka/Algo5 | D/algo5_4c.cpp | #include <iostream>
#include <vector>
using namespace std;
int findSubArray(const vector<unsigned long long>& troops, unsigned long long sz, unsigned long long val){
unsigned long long left = sz;
unsigned long long right = troops.size() - 1;
while(left<right){
unsigned long long med = left + (righ... | ALGO | 0.999891 | 3.748798 |
9207fbba-39bc-429b-bf40-47110c106108 | lucashenriquejbe/desafios | Exercicio/desculpa/mochila.cpp | #include <algorithm>
#include <iostream>
#include <values.h>
#include <cstdio>
#include <map>
using namespace std;
int w[100], v[100];
int n, W;
map< pair<int, int>, int > moch;
inline int max(int a, int b)
{
return a > b ? a : b;
}
int mochila(int n, int W)
{
if(n == 0)
return 0;
if(W == 0)
return 0;
if(w... | ALGO | 0.999984 | 4.089457 |
26958c50-7ad1-4921-9117-965540c75154 | realAYAYA/UnrealEngine-ToonLit | UnrealEngine/Engine/Source/ThirdParty/CryptoPP/5.6.2/include/blumshub.cpp | // blumshub.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "blumshub.h"
NAMESPACE_BEGIN(CryptoPP)
PublicBlumBlumShub::PublicBlumBlumShub(const Integer &n, const Integer &seed)
: modn(n),
maxBits(BitPrecision(n.BitCount())-1)
{
current = modn.Square(modn.Square(seed));
bitsLe... | ALGO | 0.999197 | 6.763701 |
4587faf4-a546-42b3-83d7-9f77eb9bb18b | VoidAshfak/Data-Structure-And-Algorithm | Bitwise/leetcode_231.cpp | #include<iostream>
#include<math.h>
using namespace std;
bool power_of_two(int n)
{
for(int i=0; i<=31; i++)
{
int ans = pow(2,i);
if(ans == n)
{
return true;
}
}
return false;
}
int main()
{
int num;
cin >> num;
cout << power_of_two(num) <<endl;
... | ALGO | 0.997842 | 4.849512 |
18781fa8-cf06-4658-9245-47a9e65917bb | savbatovasadbek/Issues_in_Cpp | ikkilikdagi birlar soni funksiyada/main.cpp | #include <iostream>
using namespace std;
int countOnes (int num)
{
int numOnes = 0;
do {
int digit = num % 2;
if (digit == 1 ) {
numOnes++;
}
num /= 2;
}
while (num > 0);
return numOnes;
}
int main()
{
int num;
cout << "Enter number: "; cin ... | ALGO | 0.976353 | 5.848226 |
82035830-d08e-4e68-ba02-4e519636e967 | UnePatate5010/3D-Programming_Course | WORK1/mds3d_work1/ext/nanogui/ext/eigen/unsupported/doc/examples/MatrixExponential.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(3,3);
A << 0, -pi/4, 0,
pi/4, 0, 0,
0, 0, 0;
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix exponential ... | ALGO | 0.999626 | 3.706936 |
c9a828e0-cfcd-457e-828d-8f435f1103dc | Hinski2/CP | inne/teleportacja/cpp286.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, maks, suma;
vector<ll>power;
inline void wczytaj(){
scanf("%lld", &n);
}
inline void wyznacz(){
ll p = 1, m = n;
power.push_back(p);
while(p < m){
suma += p;
m -= p;
p <<= 1;
power.push_back(p);
}
power.pop_back(... | ALGO | 0.99995 | 4.558791 |
b3b96708-821d-4154-b692-e82eff27bea9 | Akm007git/gfg_coding | Difficulty: Medium/Shortest Common Supersequence/shortest-common-supersequence.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
{
private:
int solve(string &s1,int m,string &s2,int n,vector<vector<int>>&dp)
{
// base
if(m == 0 || n == 0)
{
... | ALGO | 0.999942 | 6.371563 |
f08b96ea-b99a-43c7-a136-67f09d5724c8 | Congee/leetcode | src/56.merge-intervals.cpp | #ifdef __LOCAL__
#include <leetcode.h>
#endif
class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
return line_sweep(intervals);
return greedy(intervals);
}
vector<vector<int>> greedy(vector<vector<int>>& intervals) {
int n = intervals.size();
if (n == 1) return ... | ALGO | 0.999998 | 6.271134 |
239db266-09f2-424e-ab3d-ab039670afb3 | udaykirankavaturu/dsa | Trees/binary-search-trees.cpp | #include <iostream>
#include <queue>
#include <utility>
using namespace std;
class Node {
public:
int value;
Node* left;
Node* right;
Node(int value){
this->value = value;
this->left = nullptr;
this->right = nullptr;
}
};
class BST{
... | ALGO | 0.999876 | 5.542942 |
d0e6e059-eb3f-4a6e-8cc4-2553eebafb4c | 0point1Zishan/CP | DSA Practice/Graphs/Dijkstra's shortest path.cpp | #include <bits/stdc++.h>
vector<int> dijkstra(vector<vector<int>> &vec, int n, int edges, int src) {
// Write your code here.
vector<vector<pair<int, int>> > adj(n);
for(auto it: vec){
adj[it[0]].push_back({it[1], it[2]});
adj[it[1]].push_back({it[0], it[2]});
}
vector<int> dis(n,... | ALGO | 0.999887 | 5.044441 |
5025144d-8e2c-409d-9e34-58b89eb0528a | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/ChefAndAnts_20210112143121.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999944 | 3.621349 |
3fd83570-efb6-42b2-af03-38750cd2457e | 99hgz/Algorithms | Graph/Basis/VDCC.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
#define LL long long
inline int read()
{
int x=0,f=1; char ch=getchar();
while (ch<'0' || ch>'9') {if (ch=='-') f=-1; ch=getchar();}
while (ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=g... | ALGO | 0.999962 | 4.020137 |
0fd21274-472b-40c2-98b5-496badb92603 | payal15604/Data_Structures | Arrays/Two Pointer/Best Time to Buy and Sell Stock II.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int max_profit = 0;
for (int i = 1; i < prices.size(); i++) {
// If the current price is greater than the previous price, accumulate the profit
if (prices[i] > prices[i - 1]) {
max_profit += prices... | ALGO | 0.999825 | 6.939293 |
22f334d9-d132-48c5-bd25-1a113d92faf8 | kb2623/optcpp | ddgv1.cpp | #include "ddgv1.hpp"
using std::abs;
DDGv1::DDGv1() : DDG() {}
DDGv1::DDGv1(const DDGv1& o) : DDG(o) {}
DDGv1::~DDGv1() {}
string DDGv1::sinfo() {
return "DDGv1";
}
string DDGv1::info() {
return "Dual Differential Grouping version 1 (" + sinfo() + ")";
}
double DDGv1::calc_epsilon(BoundedObjectiveFunction<doub... | ALGO | 0.999372 | 5.577853 |
10b23cdb-ee37-433a-b23d-0abe49f03cd0 | silencelee/leetcode | algorithm/123.best-time-to-buy-and-sell-stock-iii.cpp | /*
* @lc app=leetcode id=123 lang=cpp
*
* [123] Best Time to Buy and Sell Stock III
*
* https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/description/
*
* algorithms
* Hard (36.05%)
* Likes: 2070
* Dislikes: 73
* Total Accepted: 211.4K
* Total Submissions: 569.4K
* Testcase Example: ... | ALGO | 0.999934 | 6.356583 |
69d44644-2880-414a-8a8f-ba07bce79cbf | gusrb/student_coding | test5.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int N,sum=0,i;
char a[20],color[3];
cin >> N;
for (int i = 0; i < N; i++)
{
cin >> a[i];
}
for ( i = 0; i < N; i++)
{
if (a[i] != color[0] && a[i] != color[1] && a[i] != color[2])
{
color[0] = a[i];
if (color[0] != 0)
{... | ALGO | 0.999811 | 3.615741 |
b7227041-2bd6-45fb-8402-dc775ebbcd6a | sanstzu/competitive-programming | codeforces/1535C.cpp | #include <iostream>
#include <map>
#include <cstring>
#include <vector>
#include <algorithm>
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,abm,avx,avx2,fma,mmx,tune=native")
using namespace std;
int main(){
//ios::sync_with_stdio(0);
//cin.tie(0... | ALGO | 0.999688 | 3.871771 |
b1279fb2-f035-41d0-889f-428f8385b204 | InclinedScorpio/coding_ultimate_series | algorithms/array/sorting/merge_sort.cpp | #include<iostream>
#include<vector>
using namespace std;
void merge(int*, int, int, int);
/**
* @MERGE_SORT:
* Merge sort works on Divide and Conquer
*
* LOGIC:
* Basic, works on 2 pointers approach (2 sorted Arrays) - merge them to result a single sorted array
* - Divide the array from half, and keep dividin... | ALGO | 0.999984 | 5.766785 |
4e5cd30a-6934-40db-ad24-610cd7b84b45 | andongfan/oicode | 2810.cpp | #include<iostream>
#include<cstring>
using namespace std;
const int dirx[]={0,0,-1,1},diry[]={1,-1,0,0};
struct node{int l,r;}seg[2000005];
int n,m,map[505][505]={0},vis[505][505]={0};
void DFS(int x,int y)
{
vis[x][y]=1;
for(int i=0;i<4;i++)
{
int nx=x+dirx[i];
int ny=y+diry[i];
if(... | ALGO | 0.999969 | 3.090341 |
6361d789-6ef4-46f1-973c-5987fdf3fe14 | ishwor12/Notes-For-BIT-students | 2nd semester bit texas/c++/notes/2_friend_function.cpp | #include<iostream>
using namespace std;
class teacher;
class student{
int rupee;
public:
void input()
{
cout<<"Enter rupess for student:";
cin>>rupee;
}
friend int total(student, teacher);
};
class teacher{
int rupee;
public:
void input()
{
cout<<"Enter rupee for teacher:";
cin>>... | ALGO | 0.916744 | 3.69842 |
813eceff-bc1b-4eb2-944d-d71af24b62e6 | vijaymanikantareddy/LeetCode_GFG_solved | 0077-combinations/0077-combinations.cpp | class Solution {
public:
set<vector<int>> res;
void fun(int n, int k, int start, vector<int> temp){
if(temp.size() == k){
res.insert(temp);
return;
}
for(int i = start ; i <= n ; i++){
temp.push_back(i);
fun(n, k, i+1, temp);
te... | ALGO | 0.999978 | 6.021978 |
de820234-f36d-44b1-a12c-cf76814360d6 | omonimus1/competitive-programming | Leetcode/search-insert-position.cpp | // https://leetcode.com/problems/search-insert-position/submissions/
class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int len = nums.size();
// Last element is smaller
if(nums[len-1] < target)
return len;
if(nums[0] > target)
return 0... | ALGO | 0.999946 | 6.364165 |
8aecca5b-7a85-4c57-bebf-a299f22de378 | icf/Code | C++ code/GpBCS_S.C.CPMC/SC_afqmcConstraintPathBP_3.1_ChargeContinuous_afqmclab_icf_ExactDensityinput/include/eigen/test/product_syrk.cpp | #include "main.h"
template<typename MatrixType> void syrk(const MatrixType& m)
{
typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime, RowMajor> RMatrixType;
typedef Matrix<Scalar, MatrixType::C... | TEST | 0.85714 | 4.001125 |
ae805c58-f862-4943-a2fd-70820a71fd49 | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/04/0424/personal_submission/cf749d_sheepstick.cpp | #include<bits/stdc++.h>
using namespace std;
using i64 = long long;
void solve() {
int n; cin >> n;
vector<vector<int>> participants(n + 1);
vector<int> mx(n + 1);
for (int i = 1; i <= n; i++){
int x, y; cin >> x >> y;
participants[x].push_back(y);
mx[x] = y;
}
map<int,int> mp;
for (int i = 1; i <= n; i+... | ALGO | 0.999972 | 4.358267 |
e68c7724-0fd3-4844-b6ec-36bb66979c3f | clazzified/dsa | Arrays/Problem_04/Solution.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> findProduct(vector<int> nums);
int main() {
vector<int> vec{4,1,3,2,5};
vec = findProduct(vec);
for (int i : vec)
cout << i << "\t";
}
vector<int> findProduct(vector<int> nums) {
int initProduct = 1, temp = 1;
for ... | ALGO | 0.999981 | 4.431046 |
1b0401f3-8090-4af0-88d3-e1ed116435ec | Rafiul29/programming-journey | codingninjas/Reversing a Queue .cpp | #include <bits/stdc++.h>
queue<int> reverseQueue(queue<int> q)
{
// Write your code here.
stack <int> s;
while(!q.empty()){
s.push(q.front());
q.pop();
}
while(!s.empty()){
q.push(s.top());
s.pop();
}
return q;
}
| ALGO | 0.998228 | 5.365115 |
0a2c2b14-6926-4ebb-8c1a-75788f1e73b8 | Min0322/css-343-ass-4 | BST.cpp | #include "BST.h"
#include <stack>
#include <unordered_set>
BST::BST()
{
root = NULL;
}
BST::~BST()
{
clearHelper(root);
}
bool BST::insert (Book* ins)
{
return insertHelper(root, ins);
}
bool BST::remove(Book*rem)
{
return removeHelper(root, rem);
}
bool BST::getBook(const Book& findB, Book*& retur... | ALGO | 0.997663 | 5.003533 |
65311d59-3f9b-4657-810b-4cb1e0e2477c | fafa1899/BuildCppDependency | Source/boost-1.86.0/libs/numeric/ublas/doc/samples/triangular_matrix.cpp | #include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
triangular_matrix<double, lower> ml (3, 3);
for (unsigned i = 0; i < ml.size1 (); ++ i)
for (unsigned j = 0; j <= i; ++ j)
ml (i, j) = 3 * i + j;
... | ALGO | 0.915439 | 3.772041 |
93af3850-4fd4-4394-ad9b-a604b7a4e254 | Developer-Baboo/cpp_programs-and_exercises | Card game.cpp | #include <iostream>
using namespace std;
const int clubs = 0; //suits
const int diamonds = 1;
const int hearts = 2;
const int spades = 3;
const int jack = 11; //face cards
const int queen = 12;
const int king = 13;
const int ace = 14;
struct card
{
int number; //2 to 10, jack, queen, king, ace
int suit; ... | ALGO | 0.999289 | 3.181133 |
fa246b86-6b2c-4ba5-b94d-b2e37947dfca | tarunsilam07/LEETCODE | 2182-find-the-minimum-and-maximum-number-of-nodes-between-critical-points/find-the-minimum-and-maximum-number-of-nodes-between-critical-points.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
vector<int> nodesBetw... | ALGO | 0.999989 | 4.860481 |
4e970947-d408-4665-85e7-7f2eb369a996 | polaris6933/my2048 | random stuff/main.cpp |
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
void printBinary(int x);
bool checkCnt(int x);
int main() {
int test = (1 << 16) - 1;
int x;
//cin >> x;
x = test;
printBinary(x);
if (checkCnt(x)) {
cout << "even count\n";
}
else {
cout << "uneven count\n";
}
return 0;
}
void ... | ALGO | 0.997531 | 4.638186 |
10d53dcf-7a6a-42cd-a5cf-62e533479c21 | sagarchauhan3110/c-programing | pattern9.cpp | #include<iostream>
using namespace std;
int main()
{
char n;
cout<<"enter any word..";
cin>>n;
char r='A';
while (r<=n)
{
char c='A',col=r;
while(c<=n)
{
cout<<col;
c=c+1;
col=col+1;
}
cout<<endl;
r=r+1;
}
... | ALGO | 0.998369 | 3.451633 |
1cf91350-0aaa-4916-8661-74ad81a6e59f | YazanZebak/Algorithms-and-DataStructures | Data Structures/SQRT Decomposition.cpp |
// Range Max/Min Query
void build() {
for (int i = 0 ; i< MAX_SQRT ; i++) res[i] = OO;
sq = ceil(sqrt(N));
int cnt = 0;
for (int i = 0 ; i < N ; i++) {
if (i && i % sq == 0)cnt++;
res[cnt] = min(res[cnt] , a[i]);
}
}
int RMQ(int l, int r) {
int ret = OO;
while (l % sq != 0 && l < r) ret = min(ret , a[l--... | ALGO | 0.999295 | 3.592848 |
f0d98651-b85e-4ec6-8625-d843dfd3c34e | ckolivas/ckcoind | src/index/blockfilterindex.cpp | #include <map>
#include <clientversion.h>
#include <common/args.h>
#include <dbwrapper.h>
#include <hash.h>
#include <index/blockfilterindex.h>
#include <logging.h>
#include <node/blockstorage.h>
#include <undo.h>
#include <util/fs_helpers.h>
#include <validation.h>
/* The index database stores three items for each b... | TOOL | 0.955967 | 5.931411 |
6a37cf56-ca7c-4382-87ff-02ee1934bfb5 | 593413198/TicTacGame | PlayGame.cpp | #include "PlayGame.h"
#include <stdio.h>
int ans = 0; //所有局面数量
int times[3] = {0,0,0}; //先手胜平负的局数统计
char Name[3] = {'O',' ','X'};
int NowTurn; //当前回合数
int WhoTurn; //记录当前局面轮到谁落子
bool CanWin; //寻找是否有最终获胜的子节点
bool FirstTurn; //记录是否电脑先手
bool Over=0; //记录是否分出胜负
int MyStep() { //我方落子
// 若FirstTurn =0,表示我方先手,
int winner ... | ALGO | 0.999694 | 3.760207 |
0a315dbb-7600-4901-8a2b-d6084651af41 | commonapi-someip/boost_1_71_0 | libs/fiber/src/numa/windows/topology.cpp | #include "boost/fiber/numa/topology.hpp"
extern "C" {
#include <windows.h>
}
#include <map>
#include <set>
#include <system_error>
#include <vector>
#include <boost/assert.hpp>
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace {
class procinfo_iterator {
private:
using SLPI = SYSTEM_LOG... | TOOL | 0.939992 | 6.418592 |
578be9bf-b1d3-4473-bb03-752f55613550 | miferco97/dynamic_trajectory_generator | tests/taylor_series_vs_exp_benchmark.cpp |
#include <benchmark/benchmark.h>
#include <cmath>
#include <exception>
#include <iostream>
#include <vector>
class gaussian
{
private:
double mean_;
double sigma_;
public:
gaussian(double mean, double sigma)
: mean_(mean), sigma_(sigma){};
double operator()(double x) const
{
x = x - mean_;
... | TEST | 0.985882 | 7.064093 |
a93fbe4e-0adc-4dae-bd58-90166c1f3d4d | WilliamX1/leetcode | Solutions/Water-Bottles.cpp | class Solution
{
public:
int numWaterBottles(int numBottles, int numExchange)
{
int ans = numBottles;
while (numBottles >= numExchange)
{
ans += numBottles / numExchange;
numBottles = numBottles / numExchange + numBottles % numExchange;
};
return... | ALGO | 0.999575 | 5.295668 |
b6a8fea2-59c2-4a1b-8303-4d1d88c1c330 | OYousryB/Codeforces | 554A - Kyoya and Photobooks/Kyoya and Photobooks.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
cout << 26 + 25 * s.length()<<endl;
}
| ALGO | 0.98987 | 3.238234 |
8e79cef4-0d53-427b-b9a5-a1d4b70738f5 | ishandutta2007/codeforces | lucyanna2018/normal/1017/D.cpp | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<string>
#include<sstream>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
#include<queue>
#include<utility>
using namespace std;
int n, m, q, cnt[1 << 12], w[12];
int res[1 << 12][101];
voi... | ALGO | 0.999779 | 3.792159 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.