uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5dec27ea-3aee-4bad-84a9-33812272486b | sandyp007/100_Days_Code | Day8/Coin_Change.cpp | // https://leetcode.com/problems/coin-change/
// Solved using Dynamic Programming
class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
int Max = amount + 1;
vector<int> dp(amount + 1, Max);
dp[0] = 0;
for (int i = 1; i <= amount; i++) {
for (int j =... | ALGO | 0.999979 | 6.198418 |
2e035f7b-60ef-436c-97af-bf9be59b2018 | SetsunaChyan/OI_source_code | 2019 Yinchuan Online/I.cpp | #include <bits/stdc++.h>
using namespace std;
int n,k,ans,a[100],b[100],dp[100],jc[100];
void buu()
{
for(int i=0;i<n;i++)
a[i]=b[i];
for(int i=0;i<k;i++)
for(int j=1;j<n;j++)
if(a[j-1]>a[j]) swap(a[j-1],a[j]);
}
bool check()
{
int mx=0;
for(int i=0;i<n;i++)
dp[i]=... | ALGO | 0.999956 | 3.365037 |
0ac7ef13-ae0d-4fe0-86c9-543c057dff40 | fishy15/competitive_programming | schools/tamu/spring2022/best_fish.cpp | #pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_... | ALGO | 0.999708 | 3.554634 |
ac5361f8-790a-42c7-a5b7-ccbbc356bc57 | songhn233/Algorithm-Packages | codeforces/cf587 div3/B.cpp | #include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
int ans=0,n;
struct node{
int val,id;
bool operator<(const node&t) const{
return val>t.val;
}
}a[1050];
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i].val;
a[... | ALGO | 0.999977 | 3.300277 |
e2d71e38-7031-467c-b8eb-bd31841f7505 | Dai-Wenxun/Algorithm-Adventure | 数据结构设计/355. 设计推特.cpp | class Node {
public:
int id;
int time;
Node(int _id, int _time): id(_id), time(_time) {}
};
class Comp {
public:
bool operator() (Node *n1, Node *n2) {
return n1->time < n2->time;
}
};
class Twitter {
public:
int time = 0;
unordered_map<int, vector<Node*>> um;
unordered_map<int, vector<int>> uf;
Twitter... | ALGO | 0.999921 | 5.526516 |
6079e1c3-c109-49b7-9a40-fd47f46f3325 | aryandelwadia/Coding-Questions | Leetcode/2570. Merge Two 2D Arrays by Summing Values.cpp | //link
//https://leetcode.com/problems/merge-two-2d-arrays-by-summing-values?envType=daily-question&envId=2025-03-02
class Solution {
public:
vector<vector<int>> mergeArrays(vector<vector<int>>& nums1, vector<vector<int>>& nums2) {
unordered_map<int, int> nums;
for(auto& i : nums1){... | ALGO | 0.999971 | 6.021837 |
703e4f77-61a5-4c28-ba6d-56fe6b2a8734 | arpitdeveloper/Chat_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.998859 | 6.785645 |
a649b7a2-3b36-4334-9d4d-a0be88aa9235 | fanliqmul/gromacs_AFM_FH-MD | src/gromacs/gmxana/gmx_helixorient.cpp | #include "gmxpre.h"
#include <cmath>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/gmxana/gstat.h"
#include "gromacs/math/do_fit.h"
#include "gromacs/math/utilities.h"
#include "gromacs/math/vec.h"
#inclu... | ALGO | 0.99687 | 4.81974 |
2a37857b-5c17-46be-ac05-4c3c971e8a8b | maximusvo/Ehrenlicht | ATXMEGA/CFFT.cpp | /*
ergebnis:
adc_min/adc_max: min./max. analoger wert
spectrum: 16kHz in 64 buckets -> 250Hz/bucket
*/
#include <avr/io.h>
#include <string.h>
#include <avr/pgmspace.h>
#include "CFFT.h"
#include "adc.h"
// werte fr reverse a-weighting
const float PROGMEM fft_a_weight_tab[FFT_N / 2] = {
0.736858111,
1.107561091,
1.62... | ALGO | 0.996736 | 3.979975 |
dded0d15-6cd4-4179-bbd2-4840eb5aab63 | sw0501/Baekjoon | Algorithm/Baekjoon/Complete/boj_9663.cpp | #include<iostream>
using namespace std;
int N; //퀸 개수, 체스보드 넓이
int board[15][15]; //체스보드
int count=0; //놓을 수 있는 경우의 수
void Board(); //보드 출력
void Queen(int row); //시작행
//void Q_on_col();
//void Q_on_diagonal();
int main(){
cin>>N;
Queen(0);
cout<<count;
return 0;
}
void Queen(int row){
//행은 퀸을 놓고 건너뛰기... | ALGO | 0.999972 | 4.909634 |
eaa0de6d-8925-41e6-994c-3769df684d16 | sarvex/leetcode-q-sharp | lcof2/剑指 Offer II 057. 值和下标之差都在给定的范围内/Solution.cpp | class Solution {
public:
bool containsNearbyAlmostDuplicate(vector<int>& nums, int k, int t) {
set<long> s;
for (int i = 0; i < nums.size(); ++i) {
auto it = s.lower_bound((long) nums[i] - t);
if (it != s.end() && *it <= (long) nums[i] + t) return true;
s.insert((... | ALGO | 0.999822 | 6.479762 |
0adfa2ad-b787-442e-ab44-4811be3700b2 | Tinganz/speech_ncnn | ncnn/src/layer/yolodetectionoutput.cpp | #include "yolodetectionoutput.h"
#include "layer_type.h"
#include <math.h>
namespace ncnn {
YoloDetectionOutput::YoloDetectionOutput()
{
one_blob_only = false;
support_inplace = true;
}
int YoloDetectionOutput::load_param(const ParamDict& pd)
{
num_class = pd.get(0, 20);
num_box = pd.get(1, 5);
... | ALGO | 0.967284 | 6.604523 |
71efc178-4a66-46a6-838e-c2ddeb0f23f5 | hirakuuuu/kyopro | ARC/175/c.cpp | #include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, a, n) for(int i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i >= n; i--)
#define inr(l, x, r) (l <= x && x < r)
#define ll long long
#define ld long double
// using mint = modint1000000007;
// u... | ALGO | 0.999999 | 4.183138 |
733d3b74-8507-4976-9cae-ecb50699ada3 | AneekG8/DSA | ALGORITHM/DP/minJumps.cpp | #include<bits/stdc++.h>
using namespace std;
int minJumpsRecur(int arr[],int n)
{
if(arr[0] == 0)
return -1;
if(n==1)
return 0;
int res = INT_MAX;
for(int i=0;i<n-1;i++)
{
if(i+arr[i] >= n-1)
{
//int jumps = minJumpsRecur(arr,i);
//if()
... | ALGO | 0.999987 | 4.494902 |
73b2010a-9a53-4875-9b52-e792c3bc6b39 | TacticalMeow/IKSolverLibigl | igl/find_zero.cpp | #include "find_zero.h"
#include "for_each.h"
#include "any.h"
template <typename AType, typename DerivedI>
IGL_INLINE void igl::find_zero(
const Eigen::SparseMatrix<AType> & A,
const int dim,
Eigen::PlainObjectBase<DerivedI> & I)
{
assert((dim == 1 || dim == 2) && "dim must be 2 or 1");
// Get size of input
... | ALGO | 0.998161 | 5.917986 |
0867bf86-2771-4020-a8f7-35f6a38c7250 | PhanHongYenQuynh/Bloc_Flutter | examples/flutter_login/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.998147 | 6.761023 |
b3b8d940-465c-4884-9d2f-fc0a5bd658a2 | sarvex/leetcode-intercal | solution/0000-0099/0085.Maximal Rectangle/Solution.cpp | class Solution {
public:
int maximalRectangle(vector<vector<char>>& matrix) {
int n = matrix[0].size();
vector<int> heights(n);
int ans = 0;
for (auto& row : matrix) {
for (int j = 0; j < n; ++j) {
if (row[j] == '1')
++heights[j];
... | ALGO | 0.999974 | 6.53909 |
e123d00d-f700-4199-b763-ad00ae093f06 | aca123321/Competitive-Programming | Shortest Routes II.cpp | #include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define f first
#define sec second
#define pb push_back
#define INT_M 1000000000001
lli dist[1001][1001];
main()
{
lli n,m,t,a,b,c,i,j,k;
cin>>n>>m>>t;
for(i=1;i<=n;i++)
{
dist[a][a] = 0;
for(j=1;j<=n;j++)
... | ALGO | 0.999991 | 4.433771 |
a81187a7-66e9-4269-957a-ece872e1b216 | nileshleve/CPPCompCoding | cc_oct_co/PERMEXIS.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
int t;
cin>>t;
while(t-- > 0){
int n;
cin>>n;
int arr[n];
int check = 0;
for (int i = 0; i < n; ++i)
{
cin>>arr[i];
}
sort(arr, arr + n);
for (int i = 0; i < n - 1; ++i)
{
if(abs(arr[i] - arr[i+1]) > 1){
... | ALGO | 0.999838 | 4.096463 |
75535b5e-3b35-4c0c-8cb5-fb21ebc7c72c | yinsumirage/coding-daily | My New Code/05-class-design/24-slicing.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6 + 5;
int n;
int h[N],k,sum=0;
int l,r,mid,ans;
inline ll read(){//read和cin不能同时处理字符
ll x=0,f=1;
char c=getchar();
while(c>'9'||c<'0'){
if(c=='-')f=-1;
c=getchar();
}
... | ALGO | 0.999973 | 3.546222 |
98801ad4-e3a3-4f39-8af1-933717f133fe | emtee40/serenityOS-ancient | Userland/Utilities/nc.cpp | #include <AK/ByteBuffer.h>
#include <AK/HashTable.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/EventLoop.h>
#include <LibCore/Socket.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <arpa/inet.h>
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h... | WEB | 0.927214 | 6.372107 |
4acf80a9-f515-4e5a-86de-860c6eca925a | Haysten-D-costa/Object-Oriented-Programming-Using-C-plus-plus | Experiment-03/Exp05.cpp | /* **********************************************************************************************************
Lab ID : 3.5
Program Title : Method Overloading
Author : Haysten D'costa
Roll No. : 21co56
Class : Comp B[Batch P3]
Language : C++
Due Date : 29-09-2022
--------------------... | ALGO | 0.997969 | 5.928272 |
e596c9b1-8694-47ee-89a0-af591192e98e | OmarMuhammmed/problem-solving-Multi-Platforms-MulitLangs | Cpp/From A to Z .cpp | // https://www.codewars.com/kata/6512b3775bf8500baea77663/train/cpp
#include <string>
using namespace std;
string gimme_the_letters(const string& sp)
{
string result = "";
for (int i = sp[0] ; i<=sp[2] ; i++)
{
result.push_back(char(i));
}
return result;
}
| ALGO | 0.947962 | 4.316452 |
02181f31-cbf0-4818-94e7-1ad50602ec3d | asadgulib/SVAM | include/igl/embree/line_mesh_intersection.cpp | // For error printing
#include <cstdio>
#include <vector>
#include <igl/per_vertex_normals.h>
#include <igl/embree/EmbreeIntersector.h>
template <typename ScalarMatrix, typename IndexMatrix>
IGL_INLINE ScalarMatrix igl::embree::line_mesh_intersection
(
const ScalarMatrix & V_source,
const ScalarMatrix & N_source,
... | ALGO | 0.998639 | 5.511906 |
56b0170c-dd68-4c32-b289-5af7b0d3e7e2 | eggBOY91/Arctic-Core | dep/src/g3dlite/Crypto_md5.cpp | /**
@file Crypto_md5.cpp
@author Morgan McGuire, http://graphics.cs.williams.edu
Copyright 2006-2007, Morgan McGuire. All rights reserved.
@created 2006-03-28
@edited 2006-04-06
*/
#include "G3D/platform.h"
#include "G3D/Crypto.h"
#include "G3D/BinaryInput.h"
#include "G3D/BinaryOutput.h"
#include <cstring>... | ALGO | 0.920852 | 7.18831 |
74ef577f-2405-4ac9-9925-00526b9ec4c0 | MisbahSmarthens/MisbahSmarthensH.W | week4/week4Task5.cpp | #include<iostream>
using namespace std;
int discountamount(string day,string month,int amount);
int main(){
int price;
string d,m;
cout<<"Enter The Purchase Day:";
cin>>d;
cout<<"Enter The Purchase month:";
cin>>m;
cout<<"Enter The Purchase Amount:";
cin>>price;
cout<<"Payable amount after discount :"<<discountamount( ... | ALGO | 0.980883 | 3.845261 |
7a22b13c-e193-4b99-845b-3c4d19a6ccbc | Abboobh/cppcodes | search_server.cpp | #include "search_server.h"
void SearchServer::AddDocument(int document_id, const std::string& document, DocumentStatus status, const std::vector<int>& ratings) {
if (document_id < 0) {
throw std::invalid_argument(" id"s);
}
if (documents_.count(document_id)) {
throw std::invalid_argument(... | WEB | 0.976818 | 6.392555 |
a7a13554-5c31-475c-81e8-78acf10e9847 | priyankjairaj100/Codeforces-Solutions | contest/869/c/31773515.cpp | /*|-----------------------------------------------|
| Problem solved by Priyank Jairaj, BITS Pilani |
| Github: priyankjairaj100, StopStalk: la_flame |
|-----------------------------------------------|*/
#include<bits/stdc++.h>
using namespace std;
const long mod=998244353;
long long X[5010][5010];
int main(){
... | ALGO | 0.999943 | 4.905361 |
6b428fab-e322-4b76-9c51-a98c8f486443 | gurtaransingh/cpp | Before FEB 22/A_Next_Round.cpp | #include <iostream>
using namespace std;
int main()
{
int n, b, a, g, count = 0;
string x;
x[0]=0;
cin >> n >> b;
for (int i = 1; i <= n; i++)
{
cin >> a;
x[i] = a;
if (x[i] == x[i - 1])
{
g = g + 1;
}
if (x[1] == 0)
{
... | ALGO | 0.999545 | 3.609407 |
915249b3-06dc-48fc-9157-b09de572d3f4 | asg72/simple-calculator | tempCodeRunnerFile.cpp | f (oper == "+")
// {
// calc.sum();
// }
// else if (oper == "-")
// {
// calc.subtracting();
// }
// else if (oper == "*")
// {
// calc.multiplying();
// }
// else
// {
// cout << "Operator not found";
// } | ALGO | 0.992924 | 3.13519 |
9d8fcaf4-75a8-45d4-ab5a-6c0200b17428 | geoo993/ComputerGraphicsWithOpenGL | src/objects/Metaballs.cpp |
#include "Metaballs.h"
// http://www.humus.name/index.php?page=3D&ID=57
// http://www.angelcode.com/dev/metaballs/metaballs.html
// http://www.angelcode.com/dev/metaballs/
//=============================================================================
CMetaballs::CMetaballs()
{
m_vao = 0;
m_textures = {};
}
... | ALGO | 0.990977 | 4.404029 |
fa8269af-04cd-4565-aa9d-90ee4372efe6 | messsimo/Cpp_lab | lab4_daniel_mihai.cpp | #include <iostream>
using namespace std;
// Функция
int findNumbers(int arr[], int size) {
// Изначальные значения
int count = 0;
int max_value = arr[0];
// Цикл с уловие для выявления значений
for (int i = 0; i < size; i++) {
if (arr[i] >= max_value) {
count++;
... | ALGO | 0.999957 | 5.288735 |
dc1ae90c-7c7e-45d5-9e34-af47b0a93e70 | Hugo-cell111/DataStructure_exercise | wangdaokaoyan/chapter2/2_2_3_Q7.cpp | #include <iostream>
using namespace std;
int main(){
int arr1[10] = {1,2,5,7,13,14,16,24,28,36};
int arr2[7] = {2,4,6,8,12,20,35};
int arr3[17];
int head1 = 0;
int head2 = 0;
int index = 0;
while(head1 < 10 or head2 < 7){
if (arr1[head1] <= arr2[head2]){
arr3[index] = ar... | ALGO | 0.999636 | 3.137437 |
1ca45040-bc42-4760-be8a-34a6125af3e1 | danaser72/baekjoon_new | acmicpc/c++/4344/4344.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main(void) {
int C, N, count;
double sum;
double arr[1000] = { 0, };
scanf("%d", &C);
for (int c = 0; c < C; c++) {
sum = 0;
count = 0;
scanf("%d", &N);
for (int i = 0; i < N; i++) {
... | ALGO | 0.997973 | 4.027711 |
7418f568-0138-4a93-b366-945cd703216d | DyingBunny/Subject | 最小公倍数/min_num/min_num/min_num.cpp | #include<iostream>
int main()
{
int a, b, result;
std::cin >> a >> b;
for (result = a;; result++)
{
if (result%a == 0 && result%b == 0)
{
break;
}
}
std::cout << result << std::endl;
return 0;
} | ALGO | 0.999661 | 3.622591 |
fff00e8a-e1cc-481c-914b-4180316b20d1 | longjianjiang/LeetOJ | cpp/231_power_of_two.cpp | #include <iostream>
using namespace std;
// 本题给定一个数字让我们判断是否为2的幂
// 既然是2的幂,那么这个数字的二进制里面只有一个1,如果是负数直接是false了
// 还有看到一种方法,将整数减1然后与原来的数进行与,那么如果是2的幂,因为只有一个高位1,那么想与后结果就是0了
class Solution {
public:
bool isPowerOfTwo(int n) {
if (n < 0) return false;
int count = 0;
for (int i = 0; i < 31; ++i) {
... | ALGO | 0.996533 | 5.866107 |
2b0709de-46bb-4590-b365-ff9af032c3e8 | Kingmintchoco/Programmers | Level3/기지국 설치/p.cpp | #include <iostream>
#include <vector>
using namespace std;
int solution(int n, vector<int> stations, int w){
int answer = 0;
int l = 1, pos = 0;
while(l <= n){
if(l >= stations[pos] - w && l <= stations[pos] + w){ // 현재 위치에 기지국이 설치되어있다면
l = stations[pos++] + w;
}else{ ... | ALGO | 0.999963 | 4.432734 |
5c9960ce-0c73-4a9d-9f89-1dec6d09db19 | sahilduhan/pepcoding_youtube | linked_list/reverse_k_node.cpp | #include <bits/stdc++.h>
using namespace std;
class node
{
public:
int data;
node *next;
node(int data)
{
this->data = data;
next = NULL;
}
};
void print_list(node *head)
{
node *temp = head;
while (temp != NULL)
{
cout << temp->data << " ";
temp = temp->n... | ALGO | 0.999949 | 4.172786 |
435c6b5b-8b5a-4e7e-8c59-120ddda9903c | Thanraj/frameworks_base | media/jni/android_media_MediaProfiles.cpp | //#define LOG_NDEBUG 0
#define LOG_TAG "MediaProfilesJNI"
#include <utils/Log.h>
#include <stdio.h>
#include <utils/threads.h>
#include "jni.h"
#include <nativehelper/JNIHelp.h>
#include "android_runtime/AndroidRuntime.h"
#include <media/MediaProfiles.h>
using namespace android;
static Mutex sLock;
MediaProfiles *s... | TOOL | 0.874474 | 5.141733 |
0ded4a5e-8dae-4661-964f-8df0189772c8 | zml24/oi | ds/binary_heap.cpp | int h[N], ph[N], hp[N], idx, cnt;
void init() {
cnt = idx = 0;
}
// O(n) init
void init(int n) {
cnt = idx = n;
for (int i = 1; i <= n; i++) h[i] = w[i];
for (int i = n / 2; i; i--) pushdown(i);
}
void heap_swap(int a, int b) {
swap(ph[hp[a]],ph[hp[b]]);
swap(hp[a], hp[b]);
swap(h[a], h[b... | ALGO | 0.999778 | 3.696767 |
fc38e6e1-f3c2-489c-acd6-32d3d90b997f | yo00unis/Problems | 677A. Vanya and Fence.cpp |
/*
problem link ----> https://codeforces.com/contest/677/problem/A
*/
#include <iostream>
#include <vector>
using namespace std;
short calculateTotalHeight(){
short n = 0, h = 0, ans = 0;
cin>>n>>h;
vector<short> v(n);
for(int i=0; i<n; i++){
cin>>v[i];
}
for(int i=0; i<v.size(); i+... | ALGO | 0.999385 | 3.582859 |
e26695b8-e402-43f8-8e41-5e7b1af0bc29 | MadhurAggarwal/DSA | Basics/c++ apna college/First/42ques.cpp | #include <iostream>
using namespace std;
// maximum subarray sum...
//brute force O(n3)
//Theory, basics
int main()
{int n;
cin>>n;
int a[n];
for (int i=0; i<n; i++)
cin>>a[i];
//Method#1: Brute Force
int sum=0, max=a[0];
for(int start=0; start<n; start++)
{for(int end=start; end<n; end++)
{fo... | ALGO | 0.999963 | 3.823459 |
c35ff22c-c81a-4d30-8ba3-365f337e56cd | nickwang333/Leetcode | LC 1214. Two Sum BSTs.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.999992 | 6.431903 |
71cf0c2b-60ff-4e0f-8760-edd7bcf4647d | divyansingh/CPP-sample | pattern_alpha2.cpp | #include<iostream>
using namespace std;
int main()
{
int i,j,n;
char ch;
cin>>n;
for(i=n;i>=1;i--)
{
for(j=1,ch='A';j<=i;ch++,j++)
{
cout<<ch<<" ";
}
for(j=1,ch-=1;j<=i;ch--,j++)
{
cout<<ch<<" ";
}
cout<<endl;
}
... | ALGO | 0.999912 | 3.418555 |
34f265d4-4a3a-4ceb-ba03-a3ed1b9c9c56 | JLiesenborgs/GA2 | src/trackbestonlyselectionpopulation.cpp | #include "trackbestonlyselectionpopulation.h"
#include <cassert>
using namespace std;
using namespace errut;
namespace eatk
{
TrackBestOnlySelectionPopulation::TrackBestOnlySelectionPopulation(std::shared_ptr<FitnessComparison> fitComp, size_t objectiveNumber)
: m_fitnessComp(fitComp), m_objectiveNumber(objectiveNu... | TOOL | 0.949256 | 5.996989 |
a1c32785-275b-4621-af1f-96d281bc9e4a | sauradip007/Dsa-in-CPP | coding ninjas assignments/tripletsumarr.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for(int i = 0 ; i < n; i++)
{
cin>>arr[i];
}
int key;
cin>>key;
int count = 0;
for(int i = 0 ; i < n-1; i++)
{
for(int j = i+1 ; j < n; j++)
{
if(arr[i... | ALGO | 0.999951 | 4.431759 |
bf4731cd-f173-44fa-ba4d-1a327bd64cb6 | GaddamJhushiketh/Data-Structure-and-Algorithms | Arrays/Finding_missing_num_optimal.cpp | #include<iostream>
#include<vector>
using namespace std;
int main()
{
int n,j=0;
cout<<"Enter the size of array :";
cin>>n;
vector<int> arr(n);
cout<<"Enter the Elements in to array: ";
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
int sum1=0,sum2=(n*(n+1))/2;
for(int i=0;i<=n-1;i++)
{
sum1+=arr[i];... | ALGO | 0.999258 | 3.026113 |
e8a49c41-d99c-4b4d-97ee-6ca85fe71873 | Samreen555/DSA-MID | DSA-MID/Main.cpp | #include <iostream>
#include <string>
#include <limits>
using namespace std;
typedef int Itemtype;
struct Node {
Node* next;
Node* previous;
Itemtype score;
Node(int s) : score(s), next(nullptr), previous(nullptr) {}
};
class doubly_linked_list {
private:
Node* head; // Pointer to the first nod... | ALGO | 0.995333 | 7.336876 |
619be78a-3c86-4d02-9725-9ac673d1ede0 | Eduardo-Murillo22/C-Coding | 17B Assigments/Midterm Problem 8/main.cpp | #include <iostream>
#include <random>
#include <ctime>
using namespace std;
int main() {
// Probability of a single bit being within the filled section
double p = 0.4;
// Number of trials
int n = 5;
// Number of simulations
int num_simulations = 1000000;
// Initialize a random number ge... | ALGO | 0.999532 | 6.918037 |
3710b336-16ed-41b5-a620-a8e70a54312b | AVVKavvk/DSA | leetcode/25.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:
int getLength(ListNode*&... | ALGO | 0.999973 | 5.671947 |
405f79f1-d367-4495-b207-c193e8de2334 | coiti4/leetcode-challenges | arrays/plusOne.cpp | /**
* @file plusOne.cpp
* @brief Increments a non-negative integer represented as an array of digits by one.
*
* This file contains a solution for LeetCode problem 66: Plus One.
* The function takes a vector of digits representing a non-negative integer and
* returns the vector after incrementing the number by on... | ALGO | 0.999762 | 7.661663 |
65ab8727-f882-4e4b-9f7a-97667f86aa1a | Mohit21/Questions-Mohit | treetraversal.cpp |
#include<iostream>
#include<algorithm>
#include<set>
#include<vector>
using namespace std;
struct node{
int info;
node *left,*right;
}*root;
void insert(node **tree,int n){
node *temp;
if(!*tree){
temp=new node;
temp->left=temp->right=NULL;
... | ALGO | 0.999887 | 4.007931 |
b1aeac78-b93c-49af-80df-129cb1389d22 | Kashi1311/DSA-in-C-language | tut277.cpp | #include<iostream>
#include<vector>
#include<queue>
#include<climits>
using namespace std;
class Solution {
public:
int findMaxValueOfEquation(vector<vector<int>>& points, int k) {
int ans = INT_MIN;
priority_queue<pair<int, int>> maxHeap; // (y - x, x)
for (const vector<int>& p : points) {
cons... | ALGO | 0.999916 | 5.659326 |
8a1c1166-0c89-4d0e-b266-54130d90d301 | MilkClouds/Competitive-Programming | BOJ/milkclouds/11896/11896.cpp14.cpp | # pragma GCC optimize ("O3")
# pragma GCC optimize ("Ofast")
# pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#define rep(a,b,c) for(ll a=b;a<c;a++)
#define rep2(a,b,c) for(ll a=b;a>c;a--)
#define pb push_back
#define x first
#define y second
#define all(x) x.begin(), x.end()
using namespace st... | ALGO | 0.999749 | 3.823256 |
6f58af12-65a9-4a37-9391-d126495ab985 | asrezoun/contest-programming | number theory/HackerRank/hackerRank_Identify Smith Numbers.cpp | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<utility>
#include<climits>
#include<cstring>
#include<string>
#include<cmath>
#include<bitset>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define f first
#define s secon... | ALGO | 0.999944 | 4.067006 |
253923fd-4274-4689-ba27-019412297fa2 | haudevops/local_auth | 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.998693 | 6.797273 |
27419111-b47f-4e76-8207-9b1557fe7adf | EunJung516/BOJ | 00001~05000/1717_집합의 표현.cpp | #include <iostream>
using namespace std;
int n, m, c, a, b, par[1000010];
int find(int a) {
if (par[a] == a) return a;
return par[a] = find(par[a]);
}
void merge(int a, int b) {
int a_root = find(a), b_root = find(b);
if (a_root != b_root) par[a_root] = b_root;
}
int main() {
ios::sync_with_stdio(0), cin.tie(0)... | ALGO | 0.999987 | 4.603261 |
148a9b9b-27b9-4a5b-ab45-c9dd21a808d2 | dnsannt/c-cpp | bab5/OperasiSeleksi/maks31.cpp | #include <iostream>
using namespace std;
int main()
{
double x, y, z, terbesar;
cout << "Bilangan x: ";
cin >> x;
cout << "Bilangan y: ";
cin >> y;
cout << "Bilangan z: ";
cin >> z;
terbesar = x; // Anggap dulu x yang terbesar
if (terbesar < y) // Bandingkan dengan y
te... | ALGO | 0.987336 | 4.220574 |
4c4689f3-77d9-4409-9ab8-bff63323b3dd | ttwang0303/Adaptive-RGBD-Localization-Mappig | System/tracking.cpp | #include "tracking.h"
#include "Core/keyframe.h"
#include "Core/keyframedatabase.h"
#include "Core/landmark.h"
#include "Core/map.h"
#include "Drawer/viewer.h"
#include "Features/extractor.h"
#include "Features/matcher.h"
#include "Odometry/odometry.h"
#include "Odometry/pnpransac.h"
#include "Odometry/pnpsolver.h"
#in... | ALGO | 0.991417 | 5.973938 |
55ffecdb-3e7b-481f-b8e3-ff88700f8c1e | eufymake/eufyMake-PrusaSlicer-Release | AnkerStudio/src/admesh/normals.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
// Boost pool: Don't use mutexes to synchronize memory allocation.
#define BOOST_POOL_NO_MT
#include <boost/pool/object_pool.hpp>
#include "stl.h"
static void reverse_facet(stl_file *stl, int facet_num)
{
++ stl->stats.facets_reversed;
i... | ALGO | 0.997519 | 3.322415 |
ec1e17e1-c2b2-4079-999d-59c20d60c430 | Aman-Pal07/DSA-Basic-and-Advanced-Problem- | Pattern/patter7.cpp | /*print the string
A
B C
C D E
D E F G
E F G H I
*/
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int row = 1;
while (row <= n)
{
int col = 1;
while (col <= row)
{
char ch = ('A' + row + col - 2);
cout << ch << " ";
... | ALGO | 0.997845 | 4.103217 |
e32bedce-37fe-4077-a2a4-ef2169d7d5b5 | Aerma7309/codingblocks | Arrays-Spiral_Print_Clockwise.cpp | // @author: Abhimanyu Maurya
#include <iostream>
using namespace std;
int main()
{
int r, c;
cin >> r >> c;
int a[r][c];
for (int i = 0; i < r; i++)
{
for (int j = 0; j < c; j++)
{
cin >> a[i][j];
}
}
int rs = 0, re = r, cs = 0, ce = c;
while (rs < re... | ALGO | 0.998324 | 3.666065 |
d06080fa-3cb5-4fbc-89b1-76175c7e2101 | daybreaker42/Problem-Solve | Baekjoon/Silver 3/3273.cpp | // Baekjoon No. 3273
// Time Complexity O(n)
// #DP
// ٸ n ٸ 2 x ִ ϴ α
#include <iostream>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, x;
int i;
cin >> n;
vector<int> arr(n);
for (i = 0; i < n; i++)
... | ALGO | 0.999968 | 4.34493 |
f0c2e2e7-f11a-45b0-b128-00c64f887f1b | chiNmoy09/Competitive_Programming | DetermineTheScore.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t;cin>>t;
while(t--){
int x,n;cin>>x>>n;
int pt=x/10;
cout<<pt*n<<endl;
}
return 0;
} | ALGO | 0.998855 | 3.903272 |
f9ec024d-ca6b-4685-a5ed-99ad4d3fad7c | PalmsNiro/Advent-of-Code-2024 | src/Day1.cpp | #include "Day1.hpp"
using std::cout;
using std::endl;
using std::sort;
using std::string;
using std::vector;
Day1::Day1() {};
void Day1::readFileToArrays(const string filepath)
{
std::ifstream file1(filepath);
if (!file1.is_open())
{
cout << "Fehler beim Öffnen der Datei!" << endl;
}
str... | ALGO | 0.999533 | 5.30989 |
7d5d94ae-36ab-43b3-ae46-43e880fbd40a | raincross7/code-similarity | codes/train_code/problem087/problem087_154.cpp | #include <bits/stdc++.h>
using namespace std;
int main ()
{
long long int n,i,fact=1;
cin>>n;
while (n!=0)
{
fact*=n;
n--;
}
cout<<fact<<endl;
}
| ALGO | 0.999997 | 4.258431 |
edd1b27a-8890-4c66-aa11-2b3bf6662426 | simX/d2x-xl | tags/v1.14.78/render/fastrender.cpp | #ifdef HAVE_CONFIG_H
#include <conf.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "descent.h"
#include "error.h"
#include "u_mem.h"
#include "light.h"
#include "dynlight.h"
#include "lightmap.h"
#include "automap.h"
#include "texmerge.h"
#include "ogl_lib.h"
#include ... | TOOL | 0.961498 | 4.09472 |
e9e5889b-d130-47a0-bbea-d14311dd7dbc | jeffyehtw/E-Turtor | 中文題庫/Array 001 - 050/[C_AR23-易] 字根與子字串.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
string n, m;
while(cin >> n >> m)
{
bool ok = false;
for(int i = 0; i < m.length(); i++)
{
int j;
for(j = 0; j < n.length(); j++)
if(m[i + j] != n[j])
... | ALGO | 0.999939 | 3.55331 |
319dafe6-fe65-42b4-927c-0e5aa85e3285 | tada-s/ICPC_Training | UVa/UVa00103_Stacking_Boxes/103_Stacking_Boxes.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX_K 30
#define UNDEF -1
#define pb push_back
int d[MAX_K];
vector<int> g[MAX_K];
bool cmp(int l[30][10], int n, int i, int j){
for(int k = 0; k < n; k++){
if(l[i][k] <= l[j][k]){
return false;
}
}
return true;
}
int f(int u){
if(d[u] =... | ALGO | 0.999971 | 3.607864 |
b6ba3db6-844b-4188-bfbc-b913a0afc844 | Hyppocrat/Sirius | bfs.cpp | #include <iostream>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <list>
#include <vector>
using namespace std;
//список смежности
vector <int> gr[113];
//пусть в графе не больше, чем 100 вершин
int n, m; // n - число вершин, m - число ребер
vector <int> pred(113, -1); //м... | ALGO | 0.999988 | 4.462722 |
86885aa2-5d75-47cd-99f5-469599bf55f9 | PootieT/explain-then-translate | CodeGenMirror/data/transcoder_evaluation_gfg_fixed/cpp/FIRST_ELEMENT_OCCURRING_K_TIMES_ARRAY.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( int arr [ ], int n, int k ) {
unordered_map < int, int > count_map;
for ( int i = 0;
i < n;
i ++ ) count_map [ arr [ i ] ] ++;
for ( int i... | ALGO | 0.999532 | 5.40671 |
3f42a299-5f6c-4e1d-9910-2aedf5e4897d | MohamedMohamedSaleh/Weather | 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.998784 | 6.761023 |
cdc0ff78-ebd4-4f0b-b0fb-9977df24acb8 | peiyan1234/LeetCode-CPP-efficient-solution | $0011_Spiral_Matrix.cpp | /*
Runtime: 0 ms, faster than 100.00% of C++ online submissions for Spiral Matrix.
Memory Usage: 6.9 MB, less than 30.13% of C++ online submissions for Spiral Matrix.
*/
class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int> ans;
int m = matrix... | ALGO | 0.999989 | 5.995439 |
fb1519f2-3d4f-4104-a2d1-1a0fa2f4060a | ayush-1560/DSA | 25-reverse-nodes-in-k-group/reverse-nodes-in-k-group.cpp | class Solution {
public:
ListNode* reverseKGroup(ListNode* head, int k) {
ListNode* temp = head;
int cnt = 0;
while (cnt < k) {
if (!temp) return head;
temp = temp->next;
cnt++;
}
ListNode* prevNode = reverseKGroup(temp, k);
... | ALGO | 0.999995 | 5.869351 |
6dd1b4f9-5bd1-4196-ad08-66cf2c66a8d6 | jerek86/otus-data-structures-algorithms | dz21/one_two_pears.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
inline static bool odd(int number) {
return (number & 1) == 1;
}
inline static bool even(int number) {
return (number & 1) == 0;
}
int NOD(int a, int b) {
if (a == b) return a;
if (a == 0) return b;
if (b == 0) return a;... | ALGO | 0.999514 | 5.343923 |
dff3e754-fddc-4a93-9fb6-132ca9481b50 | pranavsindura/CompetitiveProgramming | codeforces/contest/1285/b.cpp | #include<bits/stdc++.h>
#define ll long long int
#define pii pair<int,int>
#define mod 1000000007
#define eps 0.000000001
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define mp make_pair
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)... | ALGO | 0.999884 | 4.432215 |
fa3037de-c121-4b86-9f46-fc0d1088f137 | hupax/algorithm-note | lanqiao/Dif/1276_小明的彩灯.cpp | //
// Created by hupax on 25-3-24.
//
#include <iostream>
#define fo(x, y) for (int i=x; i<=y; i++)
#define gc getchar_unlocked()
using namespace std;
using ll = long long;
//void read(ll &x) {
// x=0; int f=1;
// char ch=getchar();
// while (!isdigit(ch)) {
// if (ch=='-') f=-1;
// ch=getchar();... | ALGO | 0.999978 | 3.886488 |
7ff0a954-0dbf-4143-92d6-bc4d996d7556 | Lokesh598/data-structures-and-algorithm | Recursion/Reverse a Stack.cpp | //geeks for geeks problem
class Solution{
public:
void helper(stack<int> &st, int x) {
if(st.empty()) {
st.push(x);
return;
}
int elm = st.top();
st.pop();
helper(st, x);
st.push(elm);
}
void Reverse(stack<int> &st){
if(st.empty... | ALGO | 0.999958 | 5.348241 |
3953c3b7-0b69-4021-b0f4-2a916fbe8732 | IntelSTORMteam/Projects | kcfi/llvm-kcfi/lib/CodeGen/CriticalAntiDepBreaker.cpp | #include "CriticalAntiDepBreaker.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetRegisterInfo.h"
#i... | ALGO | 0.983093 | 6.622485 |
2aa623db-b8e4-4e7b-9527-d2c867f0452a | runebone/compgraph-s4-bmstu | lab_03/algorithm.cpp | #include "algorithm.h"
#include <cmath>
#include <cstdio>
#ifdef TIMEIT
#include <chrono>
#include <iostream>
/* auto start = std::chrono::high_resolution_clock::now(); */
/* auto end = std::chrono::high_resolution_clock::now(); */
/* std::chrono::duration<double> elapsed = end - start; */
/* std::cout << "DDA - Elap... | ALGO | 0.995047 | 5.677035 |
c463d58c-7b3c-4bfd-8fcc-4ad9119a1ab9 | emrah2021/study | diamondProblem.cpp | #include <stdio.h>
#include <iostream>
#include <stack>
using namespace std;
class A
{
public:
int _a;
};
class B : virtual public A
{
public:
int _b;
};
class C : virtual public A
{
public:
int _c;
};
class D : public B, public C
{
public:
int _d;
};
int main()... | ALGO | 0.879278 | 3.410645 |
f872cd71-1c5f-4eff-b44b-81ebb342270e | mandos1995/PS | 5000 ~ 5999/5430_AC.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--) {
string p, x;
int n;
cin >> p >> n >> x;
deque<int> DQ;
string item;
x.erase(x.begin());
x.pop_back(... | ALGO | 0.99943 | 5.007784 |
0d21d45f-34cc-46df-bcb8-fbf83747ac4d | Lee-ji-soo/algorithm | 심화2/greedy/greedy.회의실.cpp | /******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run a... | ALGO | 0.998701 | 4.445737 |
472111c9-5c5b-4e69-9880-aa58a7c76f1e | software2-3media/problem-solving | practice-set/02/10828/hch3245.cpp | #include <iostream>
#include <cstring>
using namespace std;
int arr[10000];
int main() {
int n;
int top = -1;
cin >> n;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
if (str.compare("push") == 0) {
int num;
cin >> num;
top++;
arr[top] = num;
}
else if (str.compare("pop") == 0) {
if... | ALGO | 0.99941 | 4.083034 |
4a1f7ef2-c511-4336-913a-5053253d579f | AbdulRahmanAzam/Cpp | OOPS/Assignment 3/Task 3.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
template <typename T>
class Matrix{
protected:
int col;
int row;
vector<vector<T>> arr;
public:
Matrix(int row, int col) : row(row), col(col) {
arr.resize(row);
for(int i =0; i < this->row; ++i){... | ALGO | 0.990076 | 4.259049 |
6aed0308-e93b-48c0-9cda-13d0ece16f9e | shobhit6993/egraphs-with-dmp | egraphs/src/egraph.cpp | #include<egraphs/egraph.h>
using namespace std;
//TODO: This is an arbitrary size...
#define ARBITRARY_HASH_TABLE_SIZE 32*1024
EGraph::EGraph(EGraphDiscretize* eg_disc, int dimensions, int num_constants){
eg_disc_ = eg_disc;
num_dims_ = dimensions;
num_constants_ = num_constants;
num_edges_ = 0;
num_compon... | ALGO | 0.996797 | 5.794634 |
0579a0dc-de03-4fca-bf50-f7c58ba95e47 | kicchi/Procon | AtCoder/ABC/ABC55/D/main.cpp | #include<iostream>
#include<vector>
#include<string>
#include<cstdlib>
#include<sstream>
#include<queue>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#define INF 2147483647
#define lli long long int
#define MOD 100000007
using namespace std;
typedef vector<int> vi;
... | ALGO | 0.999944 | 3.629582 |
6322582b-9178-4bf6-9109-093cf6754d44 | manoj155/DSA_usingCPP | Abstruction/Stack/twoStacksinOneArray.cpp | #include<iostream>
using namespace std;
class Stack {
public:
int *arr;
int top1;
int top2;
int size;
Stack(int size) {
arr = new int[size];
this->size = size;
top1 = -1;
top2 = size;
}
void push1(int data) {... | ALGO | 0.996309 | 4.278005 |
048338f0-4135-4152-81f4-bec821627693 | ebispaul07/cpp_journey | assessments/cppbasics/CPPBASICS/src/prg38.cpp | //38.Write a Program to Calculate the Length of the String Using Recursion
#include<iostream>
using namespace std;
#define MAX 100
int main() {
char str[MAX];
cout << "Enter your String:";
cin.getline(str, 100);
cout << strlen(str);
} | ALGO | 0.995706 | 4.386512 |
4d6e64c1-5587-485c-800a-235101b7d788 | Adimanchare11/Dsa-Problems | Linked_list.cpp/insert_node.cpp | #include<iostream>
using namespace std;
class Node
{
public:
int data;
Node* next;
Node(int data)
{
this->data= data;
this->next = NULL;
}
};
Node* takeInput()
{
int data;
cin>>data;
Node* head=NULL;
Node* tail= NULL;
while(data!=-1)
{
Node* ne... | ALGO | 0.999397 | 5.074556 |
764c00df-6333-4d08-964e-cd1518101e32 | raincross7/code-similarity | codes/train_code/problem143/problem143_83.cpp | #include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
using namespace std;
long long int combination2(long long int c);
int main() {
long long int N, sum = 0;
cin >> N;
vector<... | ALGO | 0.999952 | 4.15571 |
9302a621-9b33-4a50-aee3-a3195e5c1d03 | siwangqishiq/algorithm | max_area.cpp | /**
* 给你 n 个非负整数 a1,a2,...,an,每个数代表坐标中的一个点 (i, ai) 。在坐标内画 n 条垂直线,
* 垂直线 i 的两个端点分别为 (i, ai) 和 (i, 0) 。找出其中的两条线,使得它们与 x 轴共同构成的容器可以容纳最多的水。
说明:你不能倾斜容器。
示例 1:
输入:[1,8,6,2,5,4,8,3,7]
输出:49
解释:图中垂直线代表输入数组 [1,8,6,2,5,4,8,3,7]。在此情况下,容器能够容纳水(表示为蓝色部分)的最大值为 49。
示例 2:
输入:height = [1,1]
输出:1
示例 3:
输入:height = [4,3,2,1,4]
输出:... | ALGO | 0.999897 | 5.777977 |
2604019b-6e87-412d-9975-2d4c7021710d | vineethm1627/SDE_Sheet_Striver | Day-18_Binary_Tree/height_balanced.cpp | /*
Problem Link: https://leetcode.com/problems/balanced-binary-tree/
*/
/*
For a tree to be height balanced, at every node:
absolute difference between height of left and right subtrees should be <= 1
abs(height(left) - height(right)) <= 1
*/
#define pii pair<int, int> // {height, isBalanced ... | ALGO | 0.999978 | 6.789645 |
5ec0a460-deb1-4fdb-a881-ebdec482a3f3 | HawDinh/CodePTIT | Code_DSA/DSA06030.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
void testCase(){
int n; cin >> n;
vector <int> a(n);
vector <vector<int>> b;
for (int i=0;i<n;i++) cin >> a[i];
for (int last=n-1;last>0;last--){
int ok=1;
for (int i=0;i<last;i++){
if (a[i]>a[i+1]) {
... | ALGO | 0.999234 | 4.359511 |
9009fc49-ed24-482a-b551-a1eb83f9b9e0 | ural89/ConsoleCraftEditor | Engine/Source/box2d/src/dynamics/b2_friction_joint.cpp | #include "../../include/box2d//b2_friction_joint.h"
#include "../../include/box2d//b2_body.h"
#include "../../include/box2d//b2_time_step.h"
// Point-to-point constraint
// Cdot = v2 - v1
// = v2 + cross(w2, r2) - v1 - cross(w1, r1)
// J = [-I -r1_skew I r2_skew ]
// Identity used:
// w k % (rx i + ry j) = w * (-... | ALGO | 0.994814 | 7.57796 |
0fde3b51-2006-4734-a52f-7e9f0e96c4c8 | alexrobomind/eigen34 | bench/perf_monitoring/trmv_upt.cpp | #include "gemv_common.h"
EIGEN_DONT_INLINE
void trmv(const Mat &A, Vec &B, const Vec &C)
{
B.noalias() += A.transpose().triangularView<Upper>() * C;
}
int main(int argc, char **argv)
{
return main_gemv(argc, argv, trmv);
}
| ALGO | 0.985388 | 4.911764 |
a6078e90-31fa-497f-b892-c971da4d5b35 | MojoAlpha/CSES-Problemset | Sorting and Searching/Restaurant_Customers.cpp | #include <bits/stdc++.h>
#define ll long long
#define N 100005
#define M 10000007
#define O 1000000009
#define vll vector<long long>
#define vl vector<long>
#define dis(n) cout << n << endl
#define fo(i, N) for (int i = 0; i < N; ++i)
#define fos(i, b, N) for (int i = b; i < N; ++i)
#define forr(i, N) for (i = N; i >= ... | ALGO | 0.999754 | 4.050086 |
ef6df3a1-483c-4dc1-a742-fbfd4c49bc54 | axelu/leetcode | cpp/01500-01999/addtwopolynomialsrepresentedaslinkedlists.cpp |
// 1634. Add Two Polynomials Represented as Linked Lists
// https://leetcode.com/problems/add-two-polynomials-represented-as-linked-lists/
/**
* Definition for polynomial singly-linked list.
* struct PolyNode {
* int coefficient, power;
* PolyNode *next;
* PolyNode(): coefficient(0), power(0), next(n... | ALGO | 0.99955 | 4.911736 |
0bb1e844-4bd0-4b32-8200-7c1d8888c644 | Anuj-S62/Interview-Bit-Solutions | all_factors.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> allFactors(int A) {
vector<int> ans;
for(int i=1;i<=sqrt(A);i++){
if(A%i==0){
if(A/i==i) ans.push_back(i);
else{
ans.push_back(i);
ans.push_back(A/i);
}
}
}
sort(... | ALGO | 0.999259 | 4.502553 |
f77935fe-b50c-4238-8103-b7be28e76b19 | ishandutta2007/codeforces | ekzhang/normal/1179/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const double PI = 4 * atan(1);
#define MAXN 500013
int N;
vector<int> adj[MAXN];
int sz[MAXN];
LL dp[MAXN];
LL ans; // minimize this
inline LL nc2(LL n) {
return n * (n - 1) / 2;
}
inline double isect(pair<LL, LL>& a, pair<LL, LL>& b) {
return 1.... | ALGO | 0.999718 | 4.356656 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.