uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5d9bcd5f-d060-4833-8cff-039b50170392 | actium/codeforces | 1900/20/1928d.cpp | #include <iostream>
#include <vector>
using integer = long long;
template <typename T>
std::istream& operator >>(std::istream& input, std::vector<T>& v)
{
for (T& a : v)
input >> a;
return input;
}
void answer(integer x)
{
std::cout << x << '\n';
}
void solve(const std::vector<unsigned>& c, uns... | ALGO | 0.999771 | 5.012624 |
52d891f3-9be4-4575-ab29-a2b4e671e513 | Elojah/42SchoolProjects | 42/C++/Gomoku/src/minmax.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minmax.cpp :+: :+: :+: ... | ALGO | 0.99952 | 6.48491 |
2e419e1a-ad15-4348-b8b6-e84848ee9751 | nihar756/my-leetcode-solutions | daily-challenge/longest-unequal-subseq.cpp | // You are given a string array words and a binary array groups both of length n, where words[i] is associated with groups[i].
// Your task is to select the longest alternating subsequence from words. A subsequence of words is alternating if for any two
// consecutive strings in the sequence, their corresponding elem... | ALGO | 0.999984 | 5.824267 |
094e8421-29e5-4979-af5c-98b83352923b | Nimsant/studyADER | main.cpp | #include <cstdio>
#include <math.h>
#include <armadillo>
#define FMT_HEADER_ONLY
#include <fmt/core.h>
#include <fmt/ranges.h>
using ftype=double;
#define MAX_MORDER 10
#define MAX_ITERS 10
template <int M> ftype polynominal(int l, ftype x){
#include "gen_polynomials_l.cpp"
return 1;
}
template <int M> ftype deri... | ALGO | 0.999294 | 4.052808 |
17ac2798-3459-4343-aefd-f09ccc26dc86 | Merci24Dec/unitech_cpp_with_oops-course | programs_AtoZ/HCF & LCM of Two Numbers/LCM.cpp | // C++ Program to Find LCM of Two Numbers
#include<iostream>
using namespace std;
int main()
{
int numOne, numTwo, mp;
cout<<"Enter Two Numbers: ";
cin>>numOne>>numTwo;
if(numOne>numTwo)
mp = numOne;
else
mp = numTwo;
while(1)
{
if((mp%numOne == 0) && (mp%numTwo == 0... | ALGO | 0.990056 | 5.241777 |
9ef8d3d2-0169-40f6-b914-0f3f5bc366ef | uym2/tripVote | tripRoot/OutgroupRooting.cpp | #include "OutgroupRooting.h"
RootedTree* OutgroupRooting::__find_one_ingroup__(RootedTree *tree, set<string> &outgroups){
if (tree->isLeaf()){
std::set<string>::iterator it = outgroups.find(tree->name);
if (it != outgroups.end())
return NULL;
else
return tree;
... | ALGO | 0.97554 | 4.317444 |
2eb00349-cda1-407e-97ba-725636f82b63 | Saiyangodgoku1/start-450 | Step-02(Arrays)/Medium/05_Count_Subarray_with_given_sum.cpp | /*
QUESTION:
Given an array of integers and an integer k, find the total number of continuous subarrays whose sum equals to k.
Example:
Input:
arr = [1, 1, 1], k = 2
Output:
The total number of continuous subarrays with sum equal to k is: 2
APPROACH:
1. Initialize a map mpp to store prefix sums and their frequencies.... | ALGO | 0.999921 | 6.51461 |
39690476-fce9-4264-99bd-e9cb045eea42 | LFRusso/Quadtree | source/src/quadtree.cpp | #include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include "quadtree.hpp"
void Quadtree::start()
{
std::cout << "Building quadtree\n";
quadnode = new Quadnode(x1 - 10, x2 + 10, y1 - 10, y2 + 10);
for(int i=0; i< this->no_points; i++)
{
quadnode->insert(points[i]);... | TOOL | 0.94286 | 4.139543 |
ad9b394b-59d6-4187-a875-6c1a149a13e5 | geqingbin/C- | gaili3-4.cpp | #include <stdio.h>
int main(void)
{
double x,y;
printf("Enter x:");
scanf("%lf",&x);
if(x<0){
printf("y=0");
}else if(x<=15){
y=4*x/3;
printf("y=%.2f",y);
}else{
y=2.5*x-10.5;
printf("y=%.2f",y);
}
return 0;
}
| ALGO | 0.990912 | 3.793681 |
6c96c3f9-6beb-40bb-8b0f-f32d0c3917de | Edveikis/LearnCPP | ArrAndPtrTask.cpp | #include <iostream>
#include <iterator>
int* findValue(int* begin, int* end, int value);
int main()
{
int arr[]{ 2, 5, 4, 10, 8, 20, 16, 40 };
// Search for the first element with value 20.
int* found{ findValue(std::begin(arr), std::end(arr), 40) };
// If an element with value 20 was found, print i... | ALGO | 0.988384 | 5.536884 |
3f6a0ac6-8b25-46e5-a377-1d9385768a9d | itzz-keerthi/Hackerrank | Conditional Statements.cpp | /*TASK
Given a positive integer , do the following:
If 1<=n<=9, print the lowercase English word corresponding to the number (e.g., one for 1, two for 2, etc.).
If n>9, print Greater than 9.
Input Format
A single integer,n .
Constraints
1<=n<=10^9
Output Format
If 1<=n<=9, then print the lowercase English word corr... | ALGO | 0.997945 | 4.724133 |
2ea66e19-91a5-4e2b-a5e6-b6db8fcc1c5b | KB-learning-01/My-University | 高等程序设计2019/大班/第五-六章作业I/6_2.cpp | #include <iostream>
#include <stdio.h>
#include <cstring>
using namespace std;
/*
int maxx(int **p,int*q,const int n,int j,int*m) //aֵλ飬һеڼ ,
{ //ֵλøλ
int x=p[0][j],place=0;
for (int i=0;i<n;i++)
{
if (p[i][j]>x) {
x=p[i][j];
fill(p[0],p[0]+sizeof(p)/sizeof(int),0);
q[place]=i;
}else if (p[i... | ALGO | 0.999983 | 3.077443 |
c3ef9618-df1b-42e9-8d7b-1d5ad6c65863 | Chiragadve/leetcode-submission | 1302-delete-characters-to-make-fancy-string/delete-characters-to-make-fancy-string.cpp | class Solution {
public:
string makeFancyString(string s) {
int count = 0;
string result;
for(int i = 0; i < s.length();i++) {
if(s[i] == s[i+1]){
count++;
}
else{
count = 0;
}
if(count < 2){
... | ALGO | 0.999982 | 5.847852 |
650d13e1-90aa-41ab-bc0b-89ca72893e88 | NeverStack/frameworks_native | libs/input/VirtualKeyMap.cpp | #define LOG_TAG "VirtualKeyMap"
#include <stdlib.h>
#include <string.h>
#include <input/VirtualKeyMap.h>
#include <utils/Log.h>
#include <utils/Errors.h>
#include <utils/Tokenizer.h>
#include <utils/Timers.h>
// Enables debug output for the parser.
#define DEBUG_PARSER 0
namespace android {
static const char* WHIT... | TOOL | 0.861719 | 6.241313 |
16dbe566-e5e4-4b1f-824d-7d2baa315dcf | memento3525/BaekJoon | 프로그래머스/0/181849. 문자열 정수의 합/문자열 정수의 합.cpp | #include <string>
#include <vector>
using namespace std;
int solution(string num_str) {
int answer = 0;
for (char c : num_str)
{
int num = c - '0';
answer += num;
}
return answer;
} | ALGO | 0.999383 | 6.252947 |
a03d58e4-093e-4105-9f91-4c0463783f47 | EnzoHideki/algo | sites/projecteuler/79.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <queue>
#include... | ALGO | 0.998929 | 3.940907 |
d08c9207-5ce0-4794-ab37-3246325a7c14 | owlpaw20/CPArchive | 洛谷题库/[洛谷 P11188] 商店砍价 (小常数).cpp | #include <bits/stdc++.h>
using i64 = long long;
using u32 = unsigned int;
const int MAX_V = 10;
int N, v[MAX_V];
void solve() {
std::string s;
std::vector<std::vector<int>> pos(MAX_V);
std::cin >> s, N = s.length();
for (int i = 1; i <= 9; ++i) std::cin >> v[i];
if (N <= 5) {
i64 ans = std::numeric_... | ALGO | 0.99804 | 4.585566 |
f94b02f1-cb9b-4d8f-b0a3-3452c216e4b0 | metrocoder/MyPrograms | Data Structures/Week 4 Classes, stacks and queue/Project/Project using classes/sorter.cpp | #include "sorter.h"
void sorter::bubbleSort()
{
candidates *nextNode = head;
string tempName;
int tempVotes;
float tempPercent;
int b,counter = 0;
while(nextNode)
{
counter++;
nextNode = nextNode->next;
}
nextNode = head;
while(nextNode->next != NULL)
{
for(b = 0; b <= counter; b++)
{
if(nextNode... | ALGO | 0.998184 | 4.385462 |
d27c8e17-1d56-4894-a00f-b5dc243b6c00 | ljh1101/myleetcode | DP/01背包/416_canPartition.cpp | /*
* @Author: Liu Jiahui
* @Date: 2022-02-14 15:34:52
* @Last Modified by: Liu Jiahui
* @Last Modified time: 2022-02-Mo 06:08:29
*/
/*
Given a non-empty array nums containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.
Exam... | ALGO | 0.999972 | 5.622137 |
d771465f-f160-4bcf-91e1-da2c219ba877 | avramdj/MATF | AISP/ISPIT/prag.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int brojIznad(vector<int>& poeni, int prag){
sort(begin(poeni), end(poeni));
auto it = lower_bound(begin(poeni), end(poeni), prag);
return distance(it, end(poeni));
}
int main(){
int n;
cout << "Unesti broj studenata... | ALGO | 0.999534 | 4.563692 |
61618fca-cc0a-4d67-a240-7490602d9ada | ozzwoy/SPOS-Course | lab1/boost_1_74_0/libs/graph/example/edge-connectivity.cpp | /*
IMPORTANT!!!
~~~~~~~~~~~~
This example uses interfaces that have been deprecated and removed from
Boost.Grpah. Someone needs to update it, as it does NOT compile.
*/
#include <boost/config.hpp>
#include <algorithm>
#include <utility>
#include <boost/graph/edmonds_karp_max_flow.hpp>
#include <boost/graph... | ALGO | 0.998786 | 7.462359 |
bf5f6b25-dae3-436b-a180-25c9d9fb1f26 | fusiontwo/-C-EXPRESS | 예제7-9.cpp | #include <stdio.h>
int main(void)
{
int i, sum = 0;
i = 0;
while (1) {
if (sum > 10000)
break;
i++;
sum += i;
}
printf("1부터 %d까지의 합이 %d입니다.", i-1, sum-i);
return 0;
}
| ALGO | 0.994253 | 4.099799 |
12574a63-dd8e-40ec-a537-c8911fc39f46 | gittushR/DSA | K-th element of two sorted Arrays - GFG/kth-element-of-two-sorted-arrays.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int kthElement(int arr1[], int arr2[], int n, int m, int k)
{
vector<int> ans;
int i=0,j=0;
while(i<n && j<m){
if(arr1[i]<=arr2[j]){
ans.pu... | ALGO | 0.99999 | 5.342439 |
3778c7f1-6b9d-4a04-a35a-757952c7bf75 | dnmai7122/HCMUS-LAB-Programming-Engineering | 21127104_DoanNgocMai_Tuan2/21127104_DoanNgocMai/B2.5/Ham2.5.cpp | #include"Ham2.5.h"
int StrLength(string str, string sub)
{
if (str.length() < sub.length())
return 0;
} | TOOL | 0.879581 | 3.317188 |
6aca195f-74fb-49a5-8694-aa7ca4e037a1 | Gon-Tata/workspace | code/fenk.cpp | #include<bits/stdc++.h>
using namespace std;
const int inf=5e4+10;
int t,n,x,y,ans,len;
int id[inf],a[inf],s[inf],tag[inf];
string ks;
void add(int l,int r,int v){
int lid=id[l],rid=id[r];
if(lid==rid){
for(int i=l;i<=r;i++){
a[i]+=v;
s[lid]+=v;
}
return ;
}
... | ALGO | 0.998061 | 3.818804 |
2bba823a-b10b-4e17-b853-61f349d0e94c | lge88/OpenSees | SRC/damage/Kratzig.cpp | // $Revision: 1.3 $
// $Date: 2008-04-14 22:38:26 $
// $Source: /usr/local/cvs/OpenSees/SRC/damage/Kratzig.cpp,v $
// Written: AA,GGD
// Created: 08/02
// Revision: AA
//
// Description: This file contains the class implementation for Damage mode... | TOOL | 0.966179 | 5.076622 |
be951d97-a656-4f2e-bca9-439771dd929a | hideonbug-ssi/CSC234 | state_management_lab/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.999039 | 6.76073 |
cb27831c-7b82-4094-a024-8e3227ea1e99 | Ahmed58Usama2001/LeetcodeTracker | 63-unique-paths-ii/unique-paths-ii.cpp | class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
if(obstacleGrid[0][0])
return 0;
int m= obstacleGrid.size(),n=obstacleGrid[0].size();
vector<vector<int>>dp(m,vector<int>(n,0));
dp[0][0]=1;
for(int i=0;i<m;i++)
{
... | ALGO | 0.999595 | 5.918767 |
23c338a7-07cb-4811-ac5e-8b6bfa3b6d12 | moqsad/solved-problems | UVA/10678_The Grazing Cow.cpp | #include <cstdio>
#include <cmath>
#define PI 2*acos(0)
int main()
{
int t, cnt;
double d, l, a;
scanf("%d", &t);
for(cnt = 0; cnt < t; ++cnt)
{
scanf("%lf %lf", &d, &l);
a = sqrt(l * l / 4.0 - d * d / 4.0);
printf("%.3lf\n", PI * a * l / 2.0);
}
return 0;
}
| ALGO | 0.999723 | 3.802952 |
0cbe42fe-c254-4a51-a978-89593bae4525 | shobhitjawa/dsAlgos | 2-D Array/identitymatrix.cpp |
#include<bits/stdc++.h>
using namespace std;
int Identity(int num)
{
int row, col;
for (row = 0; row < num; row++)
{
for (col = 0; col < num; col++)
{ //identity matrix.
if (row == col)
cout ... | ALGO | 0.999853 | 4.027715 |
7587fcba-6948-4510-b723-70f89f57ee8a | jmini1234/algorithm | BOJ_11052.cpp | #include <iostream>
#include <queue>
#include <functional>
#include <vector>
#include <string>
#include <math.h>
# define MOD 1000000000;
using namespace std;
int dp[1001];
int arr[1001];
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
... | ALGO | 0.999934 | 4.001613 |
46f627ef-1afa-4c52-90f1-5fc8d19d322f | ishandutta2007/codeforces | alireza_kaviani/normal/1552/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define all(x) (x).begin(),(x).end()
#define X first
#define Y second
#define sep ' '
#define endl '\n'
#define SZ(x) ll(x.size())
const ll MAXN = 1e6 + 10;
const... | ALGO | 0.999956 | 4.712054 |
f0e002ae-9ed0-4b72-ba6b-d3b3072b00ff | ishankinger/Data-Structures-and-Algorithms | VECTORS/iking_102.cpp | // ******************* INPUTS FROM THE ARRAY ********************
#include<iostream>
using namespace std;
int main(){
char vowels[5]; // DEFINING ARRAY OF SIZE 5
for(int i=0;i<5;i++){
cin>>vowels[i]; // TAKING INPUT AS ARRAY
}
// ******** USING... | ALGO | 0.957094 | 3.383489 |
27443f9b-0f2b-4fa3-833b-fc12b43097a5 | ITC-Vanadzor/ITC-7 | Hakob_Torosyan/C++ solutions/Homework/06.11.2015/ONES2.cpp | #include <iostream>
int divider(int a, int b)
{
if(a>b)
{
a=a-b;
return divider(a,b);
}
if(a<b)
{
b=b-a;
return divider(a,b);
}
if(a==b)
{
return a;
}
}
int main()
{
int N = -5, M =-7, a = 0, b = 0;
std::cout << "Please import N " << std::endl;
std::cin >> N;
std::cout << "Please import M " << std::en... | ALGO | 0.998079 | 3.418782 |
aa692c98-dbd2-4da3-b6b9-00de13eab00e | user557742/PC1 | tree/v8org.cpp | //dề bài : cây n đỉnh . cho số nguyên k tìm cách xóa ít đỉnh nhất sao cho cây bị bẻ thành các cây con có độ dài không quá k
// có sz nhỏ hơn k
// dp[u] là số đỉnh it nhất cần loại bỏ để có sz nhỏ hơn k trong cây con gốc u
// nếu sz[u]>k bỏ đỉnh u sz[u]=0;
// dp[u]+=1;
#include <bits/stdc++.h>
using namespace std;
#d... | ALGO | 0.999215 | 3.633666 |
7a8b1a99-d14f-4d68-b3ce-5e8656e7fe1b | abhinav-2102/leetcode | 1737-maximum-nesting-depth-of-the-parentheses/1737-maximum-nesting-depth-of-the-parentheses.cpp | class Solution {
public:
int maxDepth(string s) {
int n=s.length();
int count = 0,curr=0;
for(int i=0;i<n;i++){
if(s[i]=='('){
count++;
curr=max(curr,count);
}
else if(s[i]==')'){
count--;
}
... | ALGO | 0.999754 | 5.755236 |
9940b445-bd2e-472b-aada-728027aa317a | inovia/IronHSP | hsp3ll/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | #include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/Target/TargetLowering.h"
using namespace llvm;
namespace {
class VectorLegalizer {
SelectionDAG& DAG;
const TargetLowering &TLI;
bool Changed; // Keep track of whether anything changed
/// For nodes that are of legal width, and that have more than one use,... | ALGO | 0.985211 | 6.267349 |
ed8af7c4-58eb-4875-88b9-2e25ea6c2240 | pappubishwas/GeeksForGeeks | Contest-134/max_array.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std ;
// } Driver Code Ends
class Solution {
public:
int minOperations(vector<int> a, int n) {
// Code here
int mx=*max_element(a.begin(),a.end());
int c=0,cs=0,t=0;
for(int i=0;i<n;i++){
if(mx==a... | ALGO | 0.999568 | 6.123994 |
08a2f9d4-206b-47eb-9d0d-9a6719af4b8b | raincross7/code-similarity | codes/train_code/problem326/problem326_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a,b,c,d;
cin >> a >> b >> c >> d;
if (a > b) {
cout << b*c + (a - b)*d << endl;
}
else {
cout << a*c << endl;
}
} | ALGO | 0.999481 | 3.623966 |
12d962b0-2d0e-40f5-988d-476ee173f1a8 | hsheric0210/Algorithm-Coding | cpp/AJIT-new/경시대비-정올기출-고등부1/쇼핑몰 #17506/src-binsearch-0.cpp | /*
쇼핑몰-정올2019
https://<IP_ADDRESS>/contest/17/problem/17506
*/
#include<iostream>
#include<algorithm>
#include<deque>
#include<queue>
using namespace std;
typedef struct _A { int i, w; } A;
deque<A> tc(100000, { 0,0 }); // check if this will cause memory overflow // 테스트 케이스: i=고객번호, w=계산물품갯수
A arr[100000]; // i=계산대번호, ... | ALGO | 0.999669 | 3.586355 |
2b9bf98a-615d-4ccc-a9c8-0791178f319c | eventtoken/eventtoken-notrade | src/checkpoints.cpp | #include <boost/assign/list_of.hpp> // for 'map_list_of()'
#include <boost/foreach.hpp>
#include "checkpoints.h"
#include "txdb.h"
#include "main.h"
#include "uint256.h"
static const int nCheckpointSpan = 10;
namespace Checkpoints
{
typedef std::map<int, uint256> MapCheckpoints;
//
// What makes a good... | TOOL | 0.959258 | 7.159133 |
276aa858-1a25-441b-bde2-d804f9debe83 | Learning-With-Me/BTVN | BaiTap4.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX 100
void mang(int &n, int arr[], int x, int &k)
{
cin >> n;
if (n <= 0 || n > MAX) {
return;
}
for (int i = 0; i < n; i++)
{
cin >> arr[i];
// cout << arr[i];
}
cin >> x;
cin >> k;
n++;
if (k > n)... | ALGO | 0.999693 | 3.84251 |
8ac92000-c0f9-425e-8967-9359397e6d94 | codeblocks-mirror/code.blocks.all | branches/yt/src/sdk/finddlg.cpp | /*
* This file is part of Code::Blocks Studio, an open-source cross-platform IDE
* Copyright (C) 2003 Yiannis An. Mandravellos
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2... | TOOL | 0.867831 | 6.655474 |
0d04c282-1c04-48ac-b845-1bd54c53e3ff | cobed95/gwanak-ps | atcoder/atcoder_beginner_170/minsu/p4.cpp | //time limit exceeded
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> A;
int B[200000];
int f=0,i,j;
for(i=0;i<n;i++){
int t;
cin>>t;
B[i]=t;
for(j=0;j<f;j++){
if(A[j]==t){
... | ALGO | 0.999956 | 3.590978 |
25efcb2f-8fdb-436d-9357-677c77030f46 | joker-eph/llvm-unified | llvm/lib/CodeGen/MachineCopyPropagation.cpp | #include "llvm/CodeGen/Passes.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Pass.h"
#... | ALGO | 0.991929 | 7.853759 |
08d451c6-2aa7-4a59-9ade-e727cf0feb9f | Algorithms-and-Data-Structures-2022/search-algorithms-assignment-2po4ill | src/linear_search_two_pointers.cpp | #include "assignment/linear_search_two_pointers.hpp"
namespace assignment {
std::optional<int> LinearSearchTwoPointers::Search(const std::vector<int>& arr, int search_elem) const {
// Tips:
// 1. Задайте две переменные: (1) индекс первого элемента и (2) индекс последнего элемента.
int left = 0;
int... | ALGO | 0.999683 | 5.8066 |
61354935-aa07-4c3c-8d95-409bda1c3b34 | vanhhn/Data_Structures_and_Algorithms_Code_PTIT | A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int check(string s){
int cnt=0;
for(int i=0;i<s.size()-1;i++){
if(s[i]=='0'&&s[i+1]=='1')
{
cnt++;
}
}
return cnt==2;
}
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
ci... | ALGO | 0.999277 | 5.101397 |
6759f5b1-f9f3-4572-997f-68a380b20f6f | ishandutta2007/codeforces | scanhex/normal/928/B.cpp | #include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <iomanip>
#include <bitset>
using name... | ALGO | 0.999938 | 3.971885 |
8ad40478-f7e7-4f5b-9b15-3b53d0dd9319 | 7uyash/leetcode | 1603-running-sum-of-1d-array/running-sum-of-1d-array.cpp | class Solution {
public:
vector<int> runningSum(vector<int>& nums) {
if(nums.size()<=1){
return nums;
}
for(int i = 0; i<nums.size()-1; i++){
nums[i+1]= nums[i]+nums[i+1];
}
return nums;
}
}; | ALGO | 0.99982 | 5.809289 |
addc4d8d-9422-4484-a7ed-ae89a24b74ea | raincross7/code-similarity | codes/train_code/problem232/problem232_202.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase... | ALGO | 0.999973 | 3.50802 |
9b8246bd-31d1-4679-b2f1-f7abb0196502 | YoungchoKim/LeetCode | 0776-n-ary-tree-postorder-traversal/0776-n-ary-tree-postorder-traversal.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val) {
val = _val;
}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
public:
vector<int> postorder(Node*... | ALGO | 0.999917 | 5.959577 |
a56e3f32-e6db-43de-a839-1b48597a61b1 | MScIng/OpenSees_16_03 | SRC/system_of_eqn/eigenSOE/ArpackSolver.cpp | // $Revision: 1.5 $
// $Date: 2010-02-16 18:51:04 $
// $Source: /usr/local/cvs/OpenSees/SRC/system_of_eqn/eigenSOE/ArpackSolver.cpp,v $
// Written: fmk
// Created: 05.09
//
// This is the solver that works on the ArpackSOE. It uses the LinearSOE
// in the SOE to perform the solve() operation if required.
// It uses th... | ALGO | 0.999053 | 3.484711 |
59613d5a-a262-4c6c-b782-6e39a0c6a297 | walkccc/LeetCode | solutions/1019. Next Greater Node In Linked List/1019.cpp | class Solution {
public:
vector<int> nextLargerNodes(ListNode* head) {
vector<int> ans;
stack<int> stack;
for (; head; head = head->next) {
while (!stack.empty() && head->val > ans[stack.top()]) {
int index = stack.top();
stack.pop();
ans[index] = head->val;
}
s... | ALGO | 0.999895 | 6.018747 |
dca6defb-aec2-41f9-a429-f66e7649018b | whale90830/OOP_zju | Assignment01/Assignment 01 classes/main.cpp | #include <iostream>
using namespace std;
#include"Opt_library.h"
int main(int argc, char** argv) {
int id, days, issued, returned, books;
cout << "Enter card number: ";
cin >> id;
cout << "Enter days left for the validation: ";
cin >> days;
cout << "Enter number of books issued previously: ";
cin >> issue... | TOOL | 0.88089 | 3.9043 |
fa0dd149-1167-4da8-a876-c8ff24fbed65 | victorhalimm/leetcode | 0146-lru-cache/0146-lru-cache.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int key;
int val;
Node *next;
Node *prev;
Node(int val, int key) : val(val), key(key), next(nullptr), prev(nullptr) {}
};
class LRUCache
{
public:
unordered_map<int, Node *> cache;
int max_cap;
Node *head = nullptr;
Node ... | ALGO | 0.99967 | 5.563922 |
1f6cc152-b80e-4759-84b6-6b274be1f79b | logancarter/cs184as2 | as3/poop/eigen/bench/sparse_trisolver.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL
// -I /home/gael/Coding/LinearAlgebra/CSparse/... | ALGO | 0.997263 | 4.874496 |
a591393b-8fff-4247-9dcd-fdf67d121714 | kallagoutham/My_Solutions | Leetcode/142. Linked List Cycle II.cpp | /*Intuition :
Use a Floyd's Cycle-Finding algorithm to detect a cycle in a linked list and find the node where the cycle starts.
What is Floyd's Cycle-Finding algorithm ?
It is also called Hare-Tortoise algorithm
The algorithm works by using two pointers, a slow pointer and a fast pointer.
Initially, both pointers are ... | ALGO | 0.999989 | 6.023073 |
5c6d703b-6f01-444e-a8aa-28c4073e1e3e | rickyqin005/DMOJ-Solutions | main/aac4p2 10.cpp | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define MAX_LONG 9223372036854775807
#define MOD 1000000007
#define clz __builtin_clz
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll arr[200001];
ll gcd(ll a, ll b) {
... | ALGO | 0.999809 | 3.548827 |
2a4b4043-958d-4df8-991b-1fbb51d10b45 | RenePoncelet/HardCoded | libs/lib_eejj/ee2j2l/qqee2l.cpp | #include <cmath>
#include "Constants.hpp"
#include "eeqq2l.hpp"
namespace HardCoded {
double qqee2l(const double p[], const double muR, const unsigned int nl)
{
using std::log;
const double s = 2. * (p[0] * p[4] - p[3] * p[7] - p[2] * p[6] - p[1] * p[5]);
const double ts = -2. * (p[1] * p[9] + p[2] * p... | ALGO | 0.998005 | 4.19918 |
e2b3c968-50ba-40aa-9c19-9e639c661dfe | danieltrt/SBFL | results/py/COUNT_PAIRS_DIFFERENCE_EQUAL_K.cpp | int f_filled ( int arr [ ] , int n , int k ) {
int count = 0 ;
for ( int i = 0 ;
i <= n ;
i ++ ) {
for ( int j = i + 1 ;
j <= n ;
j ++ ) {
if ( arr [ i ] - arr [ j ] == k || arr [ j ] - arr [ i ] == k ) count ++ ;
}
}
return count ;
}
| ALGO | 0.998513 | 4.321258 |
984139b9-2fb5-4307-9a08-6615d5b91cf6 | zv-proger/ol_programms | acmp/0601.cpp | /*
: (<EMAIL>)
0601 acmp.ru
*/
#include<bits/stdc++.h>
using namespace std;
int main() {
int n, m; cin >> n >> m;
vector<map<int, int>> gr(n + 1);
for (; m--;) {
int a, b, c; cin >> a >> b >> c;
gr[a][c] = b;
gr[b][c] = a;
}
int cur = 1, k; cin >> k;
... | ALGO | 0.999967 | 4.077308 |
e9c6a84f-8c4f-4e49-9e86-0bb17028d3e4 | LHY1990/codingTest | MyCode/week_021_6 3065. Minimum Operations to Exceed Threshold Value I.cpp | // https://leetcode.com/problems/minimum-operations-to-exceed-threshold-value-i/description/
class Solution {
public:
int minOperations(vector<int>& nums, int k) {
int count = 0;
for (const int& single : nums)
{
if (single < k)
++count;
}
return count;
}
}; | ALGO | 0.999955 | 5.942788 |
2d6dfb85-ab51-4da7-af2a-a90208359474 | Hritik003/cpp-problems | Leetcode 153Find min in rotated sorted array.cpp | class Solution {
public:
int findMin(vector<int>& nums) {
sort(nums.begin(),nums.end());
return nums[0];
}
};
| ALGO | 0.999683 | 5.82617 |
9cac67f3-c51e-4d35-8b71-6da5f3527f9c | Rashmika-Prabhode/flutter-tab-page-selector | 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 |
a78bb325-abca-459c-be34-6ece3f5952b6 | andrewmcalinden/competitive-programming | kickstart/roundA2022/nine.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
cin.tie(0)->sync_with_stdio(0);
int t;
cin >> t;
for (int run = 1; run <= t; run++)
{
string num;
cin >> num;
string ans = num;
int sum = 0;
for (char c : num)
{
sum += c - 48... | ALGO | 0.999871 | 5.89131 |
7c71f47d-8eb0-47c2-81c6-c7fa1e91a053 | 02shiyuan/2020cce | week05/325-4.cpp | #include <stdio.h>
int a[3][3]={{1,2,3},{4,5,6},{7,8,9}};
int main()
{
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
printf("%d",a[i][j]);
}
printf("\n");
}
}
| ALGO | 0.993762 | 3.004088 |
36ff5f66-d977-4351-bcf8-d2b79a533a91 | polossk/Code-Archive | POJ/14 - 16/poj1611.cpp | // <!--encoding UTF-8 UTF-8编码--!>
/*****************************************************************************
*----Stay Hungry Stay Foolish----
*@author: Shen
*@name : A
******************************************************************************/
//#pragma GCC optimize ("O2")
//#pragma comment(linker, "/STACK:... | ALGO | 0.999861 | 3.521266 |
a2cf5355-e3a8-45b7-be5b-13608552d043 | innogames/android-ndk | sources/cxx-stl/llvm-libc++/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class fisher_f_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <cassert>
#include <vector>
#include <algorithm>
#include <cmath>
double fac(double x)
{
double r = 1;
for (; x > 1; -... | TEST | 0.998713 | 5.05399 |
8ad0a7df-29c3-489b-b848-8394d46a2860 | hussamEL-Hwary/my-problem-solving | codeforces/round 277/B.cpp | #include <iostream>
#include<vector>
#include<bits/stdc++.h>
using namespace std;
int main() {
int r, c;
scanf("%d%d", &r, &c);
vector<pair<int, int>>poin;
vector<vector<int>>val(r, vector<int>(c));
for (int i = 0; i<r; i++)
{
for (int j = 0; j<c; j++)
{
cin >> val[i][j];
if (val[i][j] == 0)
{
... | ALGO | 0.999483 | 3.307631 |
d8901dbf-32b0-493f-bca6-1eadf720ac76 | ahmedmhd1/My_Projects | 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.998859 | 6.785645 |
98978ff3-1440-49fb-af4c-1eeefb6e89b7 | mutekichi/AtCoder | ABC/362/d.cpp | #include <iostream>
#include <stdio.h>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <utility>
#include <c... | ALGO | 0.999995 | 4.011481 |
c6941f4c-1eed-4db0-aaaa-fc08f4526c94 | kyduke/Coding | GoogleCodeJam/Round1B2016/Technobabble.cpp | // Google Code Jam Round 1B 2016 Problem C. Technobabble
// It is NOT a solution
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;
int solve(map<string, int>& x, map<string, int>& y, vector<pair<string, string>>& topics) {
int result, i;
result = 0;
for (i = 0; i < topi... | ALGO | 0.999806 | 5.136925 |
be524316-9221-4319-8c87-005a9db444f1 | israilyas/DSA-cpp | Variable, Data Types & Operators/practiceQuestion.cpp | #include <iostream>
using namespace std;
// Calculate SUM of TWO Numbers
int main(){
float num1,num2;
cout << "Enter First number:" ;
cin >> num1 ;
cout << "Enter Second number:";
cin >> num2 ;
cout << "The SUM is = " << (num1+num2) << endl;
return 0;
}
// Syntax ==> Rules of progr... | TOOL | 0.887321 | 3.425881 |
d27d2de0-8e78-4ec3-960c-89d680923b74 | ncreech1/Class-Projects | cs140/lab2/topcoder/Cryptography/Cryptography.cpp | #include <string>
#include <vector>
#include <list>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
class Cryptography {
public:
long long encrypt(vector <int> numbers);
};
long long Cryptography::encrypt(vector <i... | ALGO | 0.999967 | 4.530582 |
93ca4fab-cf36-4a6d-92fd-8e203ce2b507 | JakeBiggs/DEFLATE-CPP | main/lz_old.cpp | // COMP203.cpp : Defines the entry point for the application.
//
#include "lz_old.h"
using namespace std;
#include <iostream>
#include <vector>
#include <fstream>
// Define a struct to hold the LZ77 tokens
// These act as references to substrings within the input data
struct LZ77Token {
uint16_t offset;
uin... | ALGO | 0.999027 | 5.570961 |
ae929a60-8ff4-4458-9a4d-2921e7307ddd | airejtashfeen/Leetcode | (E)sqrt(x).cpp | #include <iostream>
using namespace std;
class Solution {
public:
int mySqrt(int x) {
if(x<=1) return x;
int low = 1, high = x;
int ans;
while(low <= high){
int mid = low + (high - low) / 2;
long long midSquared = (long long) mid * mid;
... | ALGO | 0.99911 | 4.877102 |
8e414a89-3a4c-41ed-b6d7-cb58b8fc18ce | Jasayasc/Ejercicios-c- | matriz_inversa_clases.cpp | #include <iostream>
using namespace std;
class matriz{
private:
int fila, columna;
int matriz_original[7][7];
int matriz_traspuesta[7][7];
public:
matriz();
~matriz();
void entrada(void);
void proceso(void);
void salida(void);
}traspuesta;
matriz::matriz(){
fila=0;
columna=0;
}
matriz::~matriz(){}... | ALGO | 0.978776 | 3.257296 |
281238ca-35f8-45bf-8604-04ef739e3d07 | RakeshIIITD/Uva | 612.cpp | //accepted
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std ;
struct str
{
int inv ;
string s ;
str(int inv , string s):inv(inv),s(s){} ;
} ;
bool sortByInv(const str &lhs ,const str &rhs )
{
return lhs.inv<rhs.inv ;
}
int main()
{
int testcase ;
scanf("%d",&testca... | ALGO | 0.999864 | 3.705701 |
ce2089ec-3dec-483b-a475-33c53f4ef89b | Alekssasho/sge_source | libs_ext/bullet/bullet3/src/Bullet3OpenCL/BroadphaseCollision/b3GpuParallelLinearBvhBroadphase.cpp | /*
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it f... | ALGO | 0.966817 | 6.258276 |
edb7552f-e814-46a9-b20a-a6671ba4bd7e | Hee-Jae/Algorithm | boj/16507.cpp | #include <iostream>
using namespace std;
int arr[1010][1010]={};
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int N, M, x1,x2,y1,y2, Q;
cin >> N >> M >> Q;
for(int i=1; i<=N; i++)
for(int j=1; j<=M; j++) cin >> arr[i][j];
for(int i=2; i<=M; i++) arr[1][i] += arr[1][i-1];
for(int i=2; i<=N; i++) ... | ALGO | 0.998825 | 3.610975 |
1eb4be77-3ed6-44b8-aea4-0967ffa2f12d | numbqq/opencv | modules/dnn/src/layers/softmax_layer.cpp | #include "../precomp.hpp"
#include "layers_common.hpp"
#include "../op_cuda.hpp"
#include "../op_halide.hpp"
#include "../op_inf_engine.hpp"
#include "../ie_ngraph.hpp"
#include "../op_vkcom.hpp"
#include <algorithm>
#include <stdlib.h>
using std::max;
#ifdef HAVE_OPENCL
#include "opencl_kernels_dnn.hpp"
using namesp... | ALGO | 0.959834 | 7.567345 |
9c2f89d6-3995-4d8b-897a-07fa8efc2a0c | Rajat0002/Leetcode | 0053-maximum-subarray/0053-maximum-subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int sum=0;
int maxi=INT_MIN;
for(auto it:nums){
sum+=it;
maxi=max(sum,maxi);
if(sum<0){
sum=0;
}
}
return maxi;
}
}; | ALGO | 0.999985 | 6.231666 |
2ad0b374-f187-46f0-a3fc-9d705381f41a | gdoudeng/helloWasm | cocos2dx-minigame/frameworks/cocos2d-x/tools/simulator/libsimulator/lib/ProjectConfig/SimulatorConfig.cpp | #include "SimulatorConfig.h"
#include <sstream>
SimulatorConfig *SimulatorConfig::_instance = NULL;
SimulatorConfig *SimulatorConfig::getInstance()
{
if (!_instance)
{
_instance = new SimulatorConfig();
}
return _instance;
}
SimulatorConfig::SimulatorConfig()
{
_screenSizeArray.push_back(... | CONFIG | 0.899154 | 4.28234 |
bd7c64c4-0f10-4c0f-9ed9-b0f3c8979384 | GaussGreen/old-code | JP/code/drlib/market/src/VolProcessedBS.cpp | //----------------------------------------------------------------------------
//
// Group : EDG Derivatives Research
//
// Filename : CVolProcessedBS.cpp
//
// Description : What a VolatilityBS can do
//
// Author : Mark A Robson
//
// Date : 15 Jan 2001
//
//
//-------------------------... | ALGO | 0.957477 | 6.970827 |
67ec8d23-c43c-4467-9a8e-a472e1c78c6f | Hellfire01/encode-o-matic | librairies/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,1,2,3;
//add v to each row of m
mat.rowwise() += v.transpose();
std::cout << "Broadcasting result: " << std::... | ALGO | 0.998435 | 4.296038 |
026cc0e3-4f6d-4513-ac7b-85db42275c56 | SrabonBhowmik7/Computer-Graphics-and-Multimedia | Computer Graphics Multimedia/Triangle Animation.cpp | #include<windows.h>
#include <GL/glut.h>
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
float x1= 0.0f, y1= 0.0f, x2= 0.4f, y2= 0.0f, x3=0.2f, y3=0.4f;
int flag=1;
void idle()
{
if(flag==1)
{
x1+=0.0001;
x2+=0.0001;
x3=(x1+x2)/2;
if(x1>=1)
{
... | ALGO | 0.952209 | 3.071089 |
afd9ad36-ae99-4818-9443-aed00a6adab2 | neelthepatel8/chesslab | backend/mac/src/bitboard.cpp | #include "bitboard.h"
#include <algorithm>
#include <bitset>
#include <initializer_list>
#include "misc.h"
namespace Stockfish {
uint8_t PopCnt16[1 << 16];
uint8_t SquareDistance[SQUARE_NB][SQUARE_NB];
Bitboard LineBB[SQUARE_NB][SQUARE_NB];
Bitboard BetweenBB[SQUARE_NB][SQUARE_NB];
Bitboard PseudoAttacks[PIECE_TYP... | CONFIG | 0.990251 | 5.95335 |
041ba4b3-914f-4b18-a329-a8649c606425 | Brahim-maaqoul/mnpc_bootcamp | Day01/Z.cpp | #include <iostream>
#include <vector>
#include <map>
using namespace std;
int main()
{
int n, i = 2;
cin >> n;
map <int, int> m;
while (n > 1)
{
while (n % i == 0)
{
m[i]++;
n /= i;
}
i++;
}
for (auto it = m.begin(); it != m.end(); i... | ALGO | 0.999877 | 3.688155 |
0eb36b24-d8d3-431e-9ad2-39f6703038bb | shivam7242/way2 | E_Secret_Box.cpp | #include <bits/stdc++.h>
using namespace std;
const unsigned int M = 1000000007;
#define endl "\n"
typedef long long ll;
// /-------------gcc functions--------------------/
#define ctz __builtin_ctz
#define ctzll __builtin_ctzll
#define clz __builtin_clz
#define clzll __builtin_clzll
#define setbits __builtin_popcount
... | ALGO | 0.999907 | 4.413855 |
02a5b8ed-db5d-4d6a-9d52-dce9449f8dbb | victorliu/RNP | devel/test_pdco.cpp | #include "Optimization.h"
#include "Random.h"
#define RNP_TBLAS_USE_RANDOM
#include "TBLAS.h"
#include "IO.h"
#include <complex>
#include <cstdlib>
typedef double real_t;
typedef std::complex<real_t> complex_t;
void generate_random_LP(
size_t m, size_t n,
real_t *A, real_t *b, real_t *c,
real_t *bl, real_t *bu,
r... | ALGO | 0.999611 | 5.547466 |
a9a68e3a-5370-4f3c-90b9-f6fc59afe4e0 | siddharth03-del/cpp_leetcode_problems | sort_array_by_increasing_frequency.cpp | #include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
class Solution{
public:
vector<int> frequencySort(vector<int>& nums){
unordered_map<int, int> m;
for(int i = 0; i < nums.size(); i++){
if(m[nums[i]]){
m[nums[i]]++;
}
else{
m[... | ALGO | 0.999994 | 5.57881 |
fc044475-bd1b-4ac1-9a47-2c954644f10b | km-git007/DSA | 1046-max-consecutive-ones-iii/max-consecutive-ones-iii.cpp | class Solution {
public:
int longestOnes(vector<int>& a, int k)
{
int zeroes=0,i=0;
int maxLen=0;
for(int j=0;j<a.size();j++)
{
if(a[j]==0)
zeroes++;
if(zeroes>k)
{
if(a[i]==0)
zeroes--;
... | ALGO | 0.999942 | 5.884583 |
48e323b9-e82d-4663-8ddb-12bdaf6642fe | SamsonHunk/NetworkGameClient | NetworkCourseworkClient/Box2D/Dynamics/b2Island.cpp | #include "Box2D/Collision/b2Distance.h"
#include "Box2D/Dynamics/b2Island.h"
#include "Box2D/Dynamics/b2Body.h"
#include "Box2D/Dynamics/b2Fixture.h"
#include "Box2D/Dynamics/b2World.h"
#include "Box2D/Dynamics/Contacts/b2Contact.h"
#include "Box2D/Dynamics/Contacts/b2ContactSolver.h"
#include "Box2D/Dynamics/Joints/b2... | ALGO | 0.999939 | 4.619961 |
37029dcf-44d4-4ce1-8074-bfa23f1c2af6 | flr/FLBRP | src/adolc/checkpointing.cpp | #include "oplate.h"
#include "taping_p.h"
#include <adolc/adalloc.h>
#include <adolc/externfcts.h>
#include <adolc/interfaces.h>
#include <adolc/checkpointing.h>
#include "checkpointing_p.h"
#include <adolc/revolve.h>
#include <cstring>
#include <stack>
using namespace std;
ADOLC_BUFFER_TYPE ADOLC_EXT_DIFF_FCTS_BUFF... | ALGO | 0.956168 | 5.198971 |
847a7185-fe82-4de4-8e1c-aeeb9e184618 | LeeNJU/LeetCode | LeetCode/Word Ladder.cpp | #include<vector>
#include<string>
#include<unordered_set>
#include<queue>
//Ŀ:һʼʣһֹʺһֵ䣬ÿΰʼʱ任һַʼʱ任ֹʣ
// ÿα任õмɵʱֵܹҵСı任
//ⷨ:ȱöУazȥʼʵÿԪأжϵõм䵥ǷֵУڣ
// 뵽УҪע¼ʵIJ
int ladderLength(std::string beginWord, std::string endWord, std::unordered_set<std::string>& wordDict)
{
std::queue<std::pair<std::string, int>> que;... | ALGO | 0.999951 | 5.495631 |
a655d33c-0762-4a54-8c1c-b36969b05b16 | Nayandeep1431/Leetcode-Solutions | Problem of the day/Lexicographical Numbers.cpp | class Solution {
void solve(int num , int &n , vector<int> &ans ){
if(num > n)
return ;
for(int i = 0 ; i<= 9 ; i++){
int val = num * 10 + i ;
if(val <= n){
ans.push_back(val) ;
solve(val , n , ans) ;
}
}
... | ALGO | 0.999715 | 6.829529 |
7a0f24b9-8cdf-429f-ac04-78a2f8f9d66d | shubham21699/My-LeetCode-Solutions | 0587-erect-the-fence/0587-erect-the-fence.cpp | class Solution {
public:
bool isClockwiseTurn(vector<int>& a, vector<int>& b, vector<int>& c) {
int xa = a[0], xb = b[0], xc = c[0];
int ya = a[1], yb = b[1], yc = c[1];
bool isConvex = ((yc - yb) * (xb - xa)) - ((yb - ya) * (xc - xb)) >= 0;
return isConvex;
}
... | ALGO | 0.999997 | 6.156638 |
b5d91411-48e9-47e4-88ef-2733490ddb4a | Klara1423/GPLT | M2019/01.cpp | #include <iostream>
using namespace std;
int main()
{
int n = 0, m = 0, tmp = 0, t[100000][2] = {0};
cin >> n;
while (n--)
{
int k = 0;
cin >> k;
if (k == 1)
cin >> tmp;
else
while (k--)
{
cin >> tmp;
... | ALGO | 0.999552 | 3.781916 |
e9e6ec6e-cfb5-4b1c-87a8-47ab5e965b04 | ezhou2008/algorithm-basic | cpp2/443-Two-Sum-Greater-than-target.cpp | /*
Two Sum - Greater than target
Description
Notes
Testcase
Judge
Given an array of integers, find how many pairs in the array
such that their sum is bigger than a specific target number.
Please return the number of pairs.
Have you met this question in a real interview? Yes
Example
Given numbe... | ALGO | 0.999769 | 5.626316 |
59957477-2f24-47dc-b437-e8ec994c54b1 | xjtuacm/wellgasa-snippets | DataStructure/CartesianTree.cpp | /*
@title: Cartesian Tree 笛卡尔树
@description:
Cartesian Tree 笛卡尔树
可以实现线性时间内建立具有BST性质的树
@structure:
CartesianTreeNode:
parent: 父指针
l: 左孩子指针
r: 右孩子指针
@arguments:
BuildFromArray:
value: 源数组
N: 数组大小
index: 源数组的逆映射数组
tree: 目标建树数组内存首地址
stack: 堆栈空间... | ALGO | 0.999641 | 5.68138 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.