uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
52f846d5-4ab6-4a69-97cd-7f99e95c225e | virtualacademy-pk/programming-fundamentals | generic-programming/Array.cpp | #include <iostream>
using namespace std;
const int MAX = 5 ;
class Array
{
private :
int *arr ;
int size ;
public :
Array(){
arr = new int[MAX] ;
size =0;
}
// inserts an element num at given position pos
void insert ( int pos, int num )
{
// shift elements to right
for ( ... | ALGO | 0.995983 | 3.869959 |
2a3e5e92-80ff-4583-a841-c1074ccb4f5e | Mental-bicep/CPP-Codes | Smallest String With Swaps.cpp | class Solution {
public:
int find(int x,vector<int>&par)
{
if(x==par[x]) return x;
return par[x]=find(par[x],par);
}
string smallestStringWithSwaps(string s1, vector<vector<int>>& pairs) {
vector<int> par(s1.size()),rank(s1.size());
for(int i=0;i<par.size();++i) par[... | ALGO | 0.999997 | 5.619598 |
a2b0306a-b046-4244-ade0-3d73ff3272e9 | eklavyaK/codeforces-solutions | BracketWalk.cpp | #include<bits/stdc++.h>
#define endl "\n"
#define F first
#define S second
#define int long long
typedef long long ll;
typedef long double ld;
using namespace std;
void print(bool k){
cout<<(k?"YES":"NO")<<endl;
}
void code(){
int n,q; cin>>n>>q;
string s; cin>>s;
set<int> forward, backward;
funct... | ALGO | 0.999665 | 3.829676 |
83ff1ed5-4b00-40ab-9b24-5c39864e3fba | mdtalhaba/data_structure | Week1/assignment/problem3a.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t; cin>>t;
while (t--)
{
int n; cin>>n;
vector<int> ar(n);
for (int i = 0; i < n; i++) cin>>ar[i];
vector<int> srt(n);
srt = ar;
sort(srt.begin(),srt.end());
(ar == srt) ? cout<<"YES"<<e... | ALGO | 0.9999 | 4.325149 |
90a2e784-6ec9-41d2-b75f-04500292e607 | trueos/trueos-ports | graphics/nurbs++/files/patch-matrixRT.cpp | --- nurbs/matrixRT.cpp.orig Mon May 13 14:07:46 2002
+++ nurbs/matrixRT.cpp Fri Dec 1 00:43:46 2006
@@ -51,13 +51,13 @@
// *this = C.translate(x,y,z)*B.rotate(ax,ay,az) ;
rotate(ax,ay,az) ;
#ifdef COLUMN_ORDER
- m[12] = x ;
- m[13] = y ;
- m[14] = z ;
+ this->m[12] = x ;
+ this->m[13] = y ;
+ this->m[14... | ALGO | 0.99653 | 7.117537 |
5695637d-978b-4cb9-92ea-d2736a163564 | 747745124/LeetCode_Daily | 450deleteBST.cpp | #include "header.hpp"
/**
* 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, TreeNo... | ALGO | 0.999987 | 6.071995 |
aaef7df6-ba8e-4efd-aaf8-856bf05e6abb | izzheurov/wallet-core | src/NULS/Signer.cpp | #include "Signer.h"
#include "Address.h"
#include "BinaryCoding.h"
#include "../Hash.h"
#include "../PrivateKey.h"
using namespace TW;
using namespace TW::NULS;
Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
auto output = Proto::SigningOutput();
try {
auto signer = Sig... | ALGO | 0.973971 | 6.302627 |
9764b86c-cb53-4408-a750-ec0643c25d2e | lakshitcodes/DSA_Problems | LeetCode/2191_SortTheJumbledNumbers.cpp | #include <bits/stdc++.h>
using namespace std;
// Question Link : https://leetcode.com/problems/sort-the-jumbled-numbers/description/
class Solution
{
public:
static bool comparator(const vector<int> &a, const vector<int> &b)
{
return a[0] == b[0] ? a[2] < b[2] : a[0] < b[0];
}
vector<int> sort... | ALGO | 0.999968 | 5.926898 |
4ec35c78-0302-4df5-bb4e-0c25d5a14276 | Rakib-Mondal-One8/XPSC-Challenges | Week 5/Day - 5/Closest_to_the_Right.cpp | #include <bits/stdc++.h>
typedef long long ll;
#define Yes cout << "YES" << '\n'
#define No cout << "NO" << '\n'
#define nl '\n';
#define loop(i, s, n) for (int i = s; i <= n; i++)
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int n, x;
cin >> n >> x;
vector<int> a(... | ALGO | 0.999974 | 4.295178 |
2eeae69d-addd-40a1-8d35-45ad96f44318 | hsnavarro/imepp | GYM/ICPC/Damascus-2015/C.cpp | #include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define st first
#define nd second
#define pb push_back
#ifndef ONLINE_JUDGE
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<
#else
#define d... | ALGO | 0.999977 | 3.800174 |
ca62c464-87a8-43e5-a2e8-6436e9da50a5 | noemibtll/Semi-Traductores2 | Analizador-lexico/main - copia.cpp | #include <string>
#include <iostream>
using namespace std;
vector<string> keywords ={"auto","break","case","char","const","continue","default",
"do","double","else","enum","extern","float","for","goto",
"if","int","signed",
"sizeof","s... | ALGO | 0.95099 | 4.002934 |
bcb75a85-b3a1-4848-9bc0-d02da574bf52 | TooYoungTooSimp/my_solutions | OnlineJudges/Codeforces/Round #368 (Div. 2)/b.cpp | #include <cstdio>
struct Edge
{
int from, to, dist;
Edge *next;
Edge(int f = 0, int t = 0, int d = 0, Edge *n = 0) : from(f), to(t), dist(d), next(n) {}
} * G[100005];
const int inf = 1 << 30;
int scs[100005];
bool isStor[100005];
int main()
{
int n, m, k, ans;
ans = inf;
scanf("%d%d%d", &n, &m,... | ALGO | 0.999948 | 3.847727 |
c1de509d-d773-4a31-b39d-2af739cf1cb7 | prajwalbayari/C_plus_plus | Apna college/Sliding window problems/subPalinConcat.cpp | //Find if array has a subarray whose elements can be concatenated to form a palindrome (only contains single digits)
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
bool isPalindrome(int num)
{
int temp=num,sum=0;
while(temp>0)
{
sum=sum*10+temp%10;
temp/=10;
}... | ALGO | 0.999923 | 4.848063 |
a238fac6-f8f4-4568-b162-b1ceef8fa9a7 | ixray-team/xray-vss-archive | xrLC/xrSoftenLights.cpp | #include "stdafx.h"
#include "build.h"
#include "xrHemisphere.h"
// hemi
struct hemi_data
{
xr_vector<R_Light>* dest;
R_Light T;
};
void __stdcall hemi_callback(float x, float y, float z, float E, LPVOID P)
{
hemi_data* H = (hemi_data*)P;
H->T.energy = E;
H->T.direction.set (x,y,z);
H->dest->push_back (H... | TOOL | 0.894821 | 3.591161 |
bfebd202-19ec-4b89-a132-e3c441410e57 | vozeo/Code | DynamicProgramming/Linear/P1006传纸条.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int m, n, a[55][55], f[105][55][55];
int ax[4] = {0, 1, 0, 1}, ay[4] = {0, 0, 1, 1};
int main()
{
scanf("%d%d", &m, &n);
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++)
scanf("%d", &a[i][j]);
//memset(f, -1, sizeof(f)... | ALGO | 0.999981 | 3.36245 |
5a6e2431-feac-44cb-aac0-b316044d7e18 | modelhemo/YaneuraOu.wasm | source/movepick.cpp | #include "movepick.h"
#if defined(USE_MOVE_PICKER)
#include "thread.h"
// パラメーターの自動調整フレームワークからパラメーターの値を読み込む
#include "engine/yaneuraou-engine/yaneuraou-param-common.h"
#if defined(USE_SUPER_SORT) && defined(USE_AVX2)
// partial_insertion_sort()のSuperSortを用いた実装
extern void partial_super_sort(ExtMove* start, ExtMove* ... | ALGO | 0.999252 | 6.85608 |
6d2bf411-83ed-47fd-a185-f5fab4714e12 | triender/IT003-DSA | SlidingWindow.cpp | #include <bits/stdc++.h>
using namespace std;
const int WINDOW_SIZE = 3;
int main()
{
int n, m;
cin >> n >> m;
int arr[105][106];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
cin >> arr[i][j];
int min = INT_MAX, sum = 0;
for (int i = 0; i < n - WINDOW_SIZE + 1; ... | ALGO | 0.99977 | 4.269144 |
405ecef4-9ba5-4329-848a-265c51e3dbf5 | TusharPachori/Competitive-Programming | C++/well -performing.cpp | #include<bits/stdc++.h>
using namespace std;
int findLongest(vector <int> hours, int x){
vector<int>::iterator iter1;
vector<int>::iterator iter2;
int count = 0;
int max_count = 0;
int wp = 0;
int nwp = 0;
for(iter1 = hours.begin();iter1<hours.end();iter1++){
count=0;
wp=0;
... | ALGO | 0.99986 | 3.799479 |
ac8e7bb1-6a5a-4b6c-8cf7-482af6bb59a9 | InquietoPartho/DSA-with-Hand-Notes | Dyanamic_Programming_ClassIV_10th June 2023/Q1_Partition_equal_subset_sum.cpp | // https://leetcode.com/problems/partition-equal-subset-sum/
class Solution {
public:
bool solveRec(int index,vector<int>&nums,int target){
// Base case
if(index >= nums.size()){
return false;
}
if(target < 0){
return false;
}
if(target == 0){... | ALGO | 0.999928 | 6.208279 |
d46c373e-d6dd-47e1-a432-d1a6772a2921 | nikakogho/codeforces | Problems/1360F.cpp | #include <bits/stdc++.h>
using namespace std;
short n, m;
vector<string> words;
///vector<set<char>> values;
bool worksfor(string a, string b)
{
short delta = 0;
for(short i = 0; i < m; i++)
{
if(a[i] != b[i])
{
delta++;
if(delta == 2) return false;
}
}
return true;
}
bool checkfor(string word)
{... | ALGO | 0.999501 | 4.070017 |
bb4d92ae-ea8e-40f2-9eaf-41eeebe3d465 | tsuchi0410/AtCoder | problems/競技プログラミングの鉄則/06_考察テクニック/A43.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
// cout << fixed << setprecision(10);
const ll INF = 4e18;
const ld PI = acos(-1);
#define pb push_back
#define eb emplace_back
#define mp make_pa... | ALGO | 0.99968 | 4.602973 |
94859157-f77c-4e5c-b14e-79760912c1cf | MichTronics76/OpenMuS9 | OpenMu-MS/Source/MD5.cpp | #include "stdafx.h"
#include "md5.h"
#include "md5_keyval.h"
#include <assert.h>
#include <string.h>
#include <iostream>
//---------------------------------------------
// MD5 ߰
// Էµ ڿ Űε (0~65535) Ͽ 128 bits (16 bytes) MD5 Ű
bool MD5::MD5_EncodeKeyVal (
char * lpszInputStr,
char * lpszOutputKeyVal, ... | ALGO | 0.982656 | 5.224075 |
6a03a2d6-8e83-4d92-accf-82dcb06daab3 | BC46/kattis-solutions | src/nsum.cpp | #include <iostream>
int main()
{
int sum = 0;
int n;
std::cin >> n;
for (size_t i = 0; i < n; i++) {
int num;
std::cin >> num;
sum += num;
}
std::cout << sum << std::endl;
return 0;
}
| ALGO | 0.985338 | 5.465005 |
27b479e9-085b-41d3-8655-8024ddd2ab6c | RainbowZerg/X-Ray_Engine_1.5.1.0 | src/Layers/xrRender/xrStripify.cpp | #include "stdafx.h"
#include "xrstripify.h"
#include "NvTriStrip.h"
#include "VertexCache.h"
int xrSimulate (xr_vector<u16> &indices, int iCacheSize )
{
VertexCache C(iCacheSize);
int count=0;
for (u32 i=0; i<indices.size(); i++)
{
int id = indices[i];
if (C.InCache(id)) continue;
count ++;
C.AddEntry ... | ALGO | 0.912602 | 5.281858 |
32760e2f-6db0-42ff-8678-f4cdfb6c30b8 | sumanmalakar/leetcode | easy/vector_min_sum.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<int> min_sum(vector<int> &v, int k){
vector<int>n;
int s = v.size();
for(int i = 0; i<s; i++){
for(int j = i+1; j<s; j++){
if(v[i]+v[j]==k){
n.push_back(i);
n.push_back(j);
break;
}
}
}
return n;
... | ALGO | 0.99979 | 4.774873 |
59be0e66-bb1a-4bf2-a0d1-db2cf677df88 | yuforest/contests | abc_065/a/main.cpp | // ここは競プロではサボりがちです
#include <bits/stdc++.h>
using namespace std;
// デバッグ用マクロです。詳しくは https://naskya.net/post/0002/
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
// 節操ないですが、競プロでは便利です。
using ll = long ... | ALGO | 0.999388 | 4.732232 |
9d421ace-7923-48e1-9f7c-6eb0b516a57b | ahmad-kashkoush/PS | codeforces/Fennec_VS._Snuke_AtCoder_-_arc078_b_.cpp | //
// Created by ak on 7/28/23.
//
#include<bits/stdc++.h>
#define el '\n'
#define ll long long
#define reset(v, d) memset(v, d , sizeof(v))
#define all(s) s.begin(), s.end()
#define cin(v) for(auto &i:v)cin>>i
#define cout(v) for(auto i:v)cout<<i<<" "
#define edg(adj, u, v) adj[u].emplace_back(v);
using namespace st... | ALGO | 0.999781 | 4.818576 |
e110d491-2b85-4da4-8e47-b9fb561b8235 | bdcbqa314159/leetCodeWork | 740-delete-and-earn/740-delete-and-earn.cpp | class Solution {
public:
int deleteAndEarn(vector<int>& nums) {
int n = 10001;
vector<int> values(n,0);
for (int num:nums){
values[num]+=num;
}
int take = 0, skip = 0;
for (int i = 0; i<n; i++){
int takei = s... | ALGO | 0.999408 | 5.972576 |
abf34a1b-fdb0-4b52-8931-e9852c808475 | Sumanth-NR/CompetitiveProgramming | Platforms/AtCoder/abc358/G_AtCoder_Tour.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, m, k;
cin >> n >> m >> k;
int sx, sy;
cin >> sx >> sy;
--sx, --sy;
vector<vector<int>> a(n, vector<int>(m));
for (auto &v: a) {
... | ALGO | 0.999943 | 4.360349 |
da983b5a-5fcf-40de-9d5a-d6c2d55a5f71 | ahammadshawki8/Phitron | semester 2/Course 4 - Algorithms/module 5/cycle_detect_in_directed_graph_using_dfs.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
bool vis[N];
bool path[N];
vector <int> adj[N];
bool ans;
void dfs(int par) {
vis[par] = true;
path[par] = true;
for (auto child: adj[par]) {
if (path[child]) {
ans = true;
}
if (vis[child] ==... | ALGO | 0.99993 | 4.929715 |
e9163ced-7dd2-4fa8-a5a0-7e065c653488 | Chandan193/LeetCode-Solution | 594-longest-harmonious-subsequence/longest-harmonious-subsequence.cpp | class Solution {
public:
int findLHS(vector<int>& nums) {
unordered_map<int, int> mp;
for(int i : nums) mp[i]++;
int maxlen = 0;
for(int i=0; i<nums.size(); i++){
int minN = nums[i];
int maxN = nums[i]+1;
if(mp.count(maxN)){
maxlen ... | ALGO | 0.999857 | 5.720241 |
b2bd81fb-2f16-4c2b-96ec-3ee949929a9a | praymeta/Code-Up-Algorithm | PRG0_RemoveDuplicateCharacters.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
string solution(string my_string) {
string answer = "";
vector<string> v;
int flag = 0;
for(int i = 0; i < my_string.length(); i++) {
string temp = my_string.substr(i, 1);
flag = 0;
... | ALGO | 0.999969 | 5.213838 |
29333769-94c8-458c-a2a1-243f60565fe6 | Ricokoelling/KryptoLAB | VL05-20240129/aufgaben.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <bitset>
#include <sstream>
#include "AES.h"
using namespace std;
int main(int argc, char* argv[])
{
ifstream text,ciphertext, roundkey, subbytes , invsub, iv;
ofstream output;
invsub.open("SBoxInvers.txt");
subbytes.open("SBox.txt");
strin... | TOOL | 0.959413 | 3.774218 |
6cd7aa56-31b3-47d7-a19a-ee34db13a957 | Rampage-ZA/QT6Cplusplus | QT6 C++ code/60266996_Assignment_1 (QT code)/Question 2/squabcon.cpp | #include <iostream>
#include <QTextStream> //test1
#include "squabcon.h"
QTextStream cout(stdout); //2
QTextStream cin(stdin); //3
Position::Position(){};
Position::Position(int x, int y)
{
Position::x=x;
Position::y=y;
}
int Position::getX() const{
return x;
}
int Position::getY() const{
return y... | ALGO | 0.984931 | 3.074539 |
6e628259-7c97-487d-a96b-c3389b978e64 | JinYeJin/algorithm-study | June~October, 2020/2020-08-01/3109_빵집_김우재.cpp | #include <iostream>
#include <vector>
using namespace std;
int r,c;
int dx[3] = {-1,0,1};
int dy[3] = {1,1,1};
vector<vector<char>> map;
bool passed[10000][500];
int go(int x, int y){
passed [x][y] = true;
if(y == c-1) return 1;
for(int i=0; i < 3; i++){
int nx = x + dx[i];
int ny = y +... | ALGO | 0.999691 | 4.580766 |
9daf96d6-e10b-4afa-8ee5-d1ae335b8a2e | agrawalbansal88/data_structures | c++/template_function.cpp | #include <iostream>
#include "base.h"
using std::cout;
using std::endl;
template <class T>
T max(T const& t1, T const& t2){
return t1<t2?t2:t1;
}
int main(){
Person p1(10);
Person p2(11);
cout << "MAX of 3 and 4 is " << max(3,4) << endl;
cout << "MAX of 3 and 4 is " << max(p1,p2).getMyNumber() <... | ALGO | 0.960587 | 4.080525 |
02ec260a-dfb0-4589-b515-71ba12a87339 | schergds/estrutura-de-dados | 09-05/testerecursao.cpp | #include <iostream>
#include <ctime>
#include <cstdlib>
#define TAM 10
using namespace std;
/*
Recursão -> técnica de repetição por empilhamento de processo -> o mesmo processo se chamando várias vezes
- entender o que compõe uma repetição
for(inicialização da variável de controle; teste de parada com a variável ... | ALGO | 0.998487 | 4.630504 |
7c5b9a11-1e26-4bb8-a13c-8de8a5e29054 | fweilun/leetcode-solved | 0417-pacific-atlantic-water-flow/0417-pacific-atlantic-water-flow.cpp | const auto _ = std::cin.tie(nullptr)->sync_with_stdio(false);
#define LC_HACK
#ifdef LC_HACK
const auto __ = []() {
struct ___ {
static void _() { std::ofstream("display_runtime.txt") << 0 << '\n'; }
};
std::atexit(&___::_);
return 0;
}();
#endif
class Solution {
public:
void dfs(vector<ve... | ALGO | 0.999911 | 5.942137 |
35bd76bd-66fa-4414-9eb0-75ba4a2ddcba | tapeshpuhan/ApplicationSourceCode | hakathon/count_triplets.cpp | #include <bits/stdc++.h>
using namespace std;
using Triplets = std::array<long,3>;
Triplets GenerateTriples(long index, long r)
{
Triplets t;
t[0] = index;
t[1] = index * r;
t[2] = t[1] * r;
return t;
}
// Complete the countTriplets function below.
long countTriplets(vector<long> arr, long r) {
... | ALGO | 0.999758 | 4.268146 |
8380494f-c531-48a9-873f-3659fc1eb3b5 | CountSven/Codeforces-Solved-Problems | Beautiful Matrix.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a[5][5];
for ( int i = 0; i < 5; i++ ) {
for ( int j = 0; j < 5; j++ ) cin >> a[i][j];
}
int cnt = 0;
for ( int i = 0; i < 5; i++ ) {
for ( int j = 0; j < 5; j++ ) {
if ( a[i][j] == 1 ) {
cn... | ALGO | 0.999741 | 3.52319 |
7bd4c8d9-f3c2-4e5c-bf0e-b75e48b9465a | KausBoss/G3_Codes | Build_BST_Array.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
class Node{
public:
int data;
Node* left;
Node* right;
Node(int data){
this->data=data;
left = right = NULL;
}
Node(int data, Node* left, Node* right){
this->data=data;
this->left=left;
this->right=right;
}
};
void PrePrint(Node* roo... | ALGO | 0.99978 | 4.761496 |
5041491e-d02c-4327-a9b7-3122a853d9af | SparkleYuyu/Hi3861 | src/base/global/resmgr_lite/frameworks/resmgr_lite/src/utils/hap_parser.cpp | #include "hap_parser.h"
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <unzip.h>
#include <zip.h>
#include <zlib.h>
#include "hilog_wrapper.h"
#include "locale_matcher.h"
#include "securec.h"
#include "utils/common.h"
#include "utils/errors.h"
#include "utils/string_utils.h"
n... | TOOL | 0.874764 | 4.871368 |
2cf42b4c-f44f-43f7-8e0b-0d2992e9cd76 | kurumishka/problems | 1463/1463B.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t; cin >> t;
while (t--)
{
int n, temp; cin >> n;
vector<int> v;
int o = 0, e = 0;
for (int i = 0; i < n; i++)
{
cin >> ... | ALGO | 0.999969 | 3.491971 |
8b0e3216-060a-4de7-b74b-fae6d7913d3b | pedrovontobel/introducao-logica-programacao | Seção 10 - Linguagem C++/Exercicios/Exercicio_4.cpp | #include <iostream>
using namespace std;
int main(){
int n1, n2;
cout << "Digite dois numeros: " << endl;
cin >> n1;
cin >> n2;
while (n1 != n2){
if (n1 < n2){
cout << "CRESCENTE!" << endl;
}
else {
cout << "DECRESCENTE!" << endl;
... | ALGO | 0.999251 | 3.607687 |
dac63a2a-0a0c-45a8-ade4-a2ccdcfad297 | ysk24ok/leetcode-submissions | 1448/top_down_dfs.cpp | #include <gtest/gtest.h>
#include <limits>
#include <string>
#include "leetcode/tree.hpp"
using namespace std;
using namespace LeetCode;
class Solution {
public:
int goodNodes(TreeNode* root) {
int ret = 0;
dfs(root, numeric_limits<int>::min(), ret);
return ret;
}
void dfs(TreeNode* node, int ... | ALGO | 0.998271 | 6.76455 |
fd3ad0f8-8992-4fea-b86a-cd9725e60201 | hualuoliushui/Exam | dot_asterisk_pattern.cpp | //#include <iostream>
//using std::cout;
//using std::cin;
//using std::endl;
//
//
////ģʽеĵڶַǡ*ʱ
////1ַһַģʽеĵһַƥ䣬ôַģʽһַȻƥʣġ
////2 ַһַģʽеĵһַƥ䣬ֱӷfalse
////
////ģʽеĵڶַǡ*ʱ
////ַһַģʽһַƥ䣬ģʽ2ַƥ䡣ַһַģʽһַƥ䣬3ƥ䷽ʽ
////1ģʽ2ַ൱x*ԣ
////2ַ1ַģʽ2ַ
////3ַ1ַģʽ䣬ƥַһλΪ*ƥλ
//
//class Solution {
//private:
// inline bool isAsterisk(char ch){
/... | ALGO | 0.999722 | 4.210333 |
a2d3bcea-a776-469b-8f16-a1aadb01f278 | vivek-30/cp-and-dsa-zone | CSES/mathematics/bracketSequence1.cpp | #include <bits/stdc++.h>
using namespace std;
#define null NULL
#define endl "\n"
#define inf INT_MAX
#define minf INT_MIN
#define mod 1000000007
#define ll long long int
#define all(v) v.begin(), v.end()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii > vii;
typedef vector<int> vi;
typedef vect... | ALGO | 0.999993 | 4.942158 |
322cd6c8-e73f-4142-a0a1-dc97851b5c36 | NaVIn69/AlgoZenith_DSA | week2/prefix_sum.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
int a[100100];
void prefix_sum(int*a,int*b,int n){
for(int i=0;i<n;i++){
if(i==0){
b[i]=a[i];
}else{
b[i]=a[i]+b[i-1];
}
}
}
void solve(){
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
... | ALGO | 0.999852 | 3.855041 |
b2d770c4-8305-4a5e-bdd6-bb45ed6d4bf0 | menna1261/IEEE-CS-25 | Rookies/Task 6/C. Send the Fool Further! (easy).cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int N = 1000;
int n, u, v, c, maxSum = 0;
bool vis[N];
vector<pair<int, int>> adj[N];
void dfs(int node, int currentSum) {
vis[node] = true;
for (int i = 0; i < adj[node].size(); i++) {
int nextNode = adj[node][i].... | ALGO | 0.99995 | 4.591631 |
cb20e617-8058-4fd3-9480-a9836728d42d | tanntnny/como | posn2023/dp2/toi13_orchid.cpp | #include <bits/stdc++.h>
using namespace std;
int LIS[1111111], A[1111111];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
for(int i=0; i<n; i++) cin >> A[i];
int mx = 0;
for(int i=0; i<n; i++){
int idx = upper_bound(LIS, LIS + mx, A[i]) - LIS;
... | ALGO | 0.999924 | 4.537919 |
ae4e766d-d2d9-427d-876b-45c0a3cb7546 | archishmanghos/dynamic-programming-classical | 2-D_and_Grids/Unique-Paths-II/top-down.cpp | #include <bits/stdc++.h>
using namespace std;
int dp(int posX, int posY, int m, int n, vector< vector< int> > &obstacleGrid, vector<vector<long>> &cache) {
if (posX >= m or posY >= n) return 0;
if (obstacleGrid[posX][posY] == -1) return 0;
if (posX == m - 1 and posY == n - 1) return 1;
if (cache[posX][... | ALGO | 0.999881 | 5.369776 |
4a74afa8-6caa-4d4a-880b-f516f98ade54 | Thevanshgupta/DSA | Recurrsion/recurrsion3.cpp | #include<iostream>
using namespace std;
int func(int num){
if (num <= 1) {
return 1;
}
return num * func(num-1);
}
int main() {
cout<<func(-4)<<endl;
return 0;
} | ALGO | 0.999979 | 4.651257 |
b72380af-05bc-4609-a84c-cde39ab2d672 | VadimBordey/Interesting-tasks | task6.cpp | #include <iostream>
const char* ones[] = { "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
"sixteen", "seventeen", "eighteen", "nineteen" };
const char* tens[] = { "", "", "twenty", "t... | TOOL | 0.93844 | 6.306437 |
c7f6763d-dcae-4194-95af-ade3e37e1fc9 | para8ox-deb/leetcodeSolutions | 2181-smallest-index-with-equal-value/2181-smallest-index-with-equal-value.cpp | class Solution {
public:
int smallestEqual(vector<int>& nums) {
int res=-1;
for(int i=0;i<nums.size();i++){
if(i%10==nums[i]){
res=i;
break;
}
}
return res;
}
}; | ALGO | 0.999864 | 5.698152 |
873d12f6-1c30-4e63-8e13-174f22d95eb4 | niket3342/leetcode_solutions | 968-binary-tree-cameras/968-binary-tree-cameras.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.999867 | 7.136919 |
e6544c35-b987-4b0b-92b9-b6d481f345e7 | UtkarshGupta12/InterviewBit | Greedy/gas-station.cpp | int Solution::canCompleteCircuit(const vector<int> &gas,
const vector<int> &cost)
{
int N = gas.size();
int sum = 0;
int start = 0;
int tank = 0;
for(int i=0;i<N;i++)
{
sum += gas[i]-cost[i];
tank += gas[i]-cost[i];
if(tank<0)
{
... | ALGO | 0.999975 | 5.57697 |
316f2ca2-13cb-42fe-a93c-4c6ed8f071eb | tabib-e-alahi/uri-online-judge-solving | uri1038.cpp | #include<stdio.h>
int main()
{
int x,y;
scanf("%d %d",&x,&y);
if(x==1){
printf("Total: R$ %.2f\n",(y*4.00));
}
else if(x==2){
printf("Total: R$ %.2f\n",(y*4.50));
}
else if(x==3){
printf("Total: R$ %.2f\n",(y*5.00));
}
else if(x==4){
printf("Total: R$ ... | ALGO | 0.999659 | 3.692132 |
0df455cd-31b2-4a0a-b6fe-bf7fbcd22139 | KhoiBui16/28Tech_Code_Online | Data structure algorithm/Source Code DSA Contest/MangCongDon_HaiConTro_SlidingWindow/MangCongDon,MangHieu/Bai5_UpdateOperation.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long ll;
int main()
{
int n , q ; cin >> n >> q;
vector<int>a , b;
a.resize(n + 1 , 0);
for(int i = 1 ;i <= n ; i++)
{
int x ; cin >> x;
if(i == 1) a[i] = x;
else
{
a[i] =... | ALGO | 0.999915 | 3.959361 |
23651552-1afd-4c18-af80-eabd9ac64a1f | greengangsta/Coding | minabsdiff_hackerrank.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
int min1 = 1000000001;
for(int i=0;i<n-1;i++)
{
min1 = min(abs(a[i]-a[i+1]),min1);
}
cout<<min1<<endl;
return 0;
} | ALGO | 0.999873 | 3.529482 |
88fbc3b7-869c-45fe-a5bf-09afd54130cb | yaman-694/DS | graph/krushkals.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class disjoint{
public:
vector<int> parent, rank, size;
disjoint(int V){
parent.resize(V+1);
rank.resize(V+1,0);
size.resize(V+1);
for(int i= 0;i<V;i++){
parent[i] = i;
size[i] = 1;
}
}
int f... | ALGO | 0.999995 | 5.790031 |
c29e467b-3b48-4c6a-bbd4-3dc308e42cc4 | itzuditsharma/Leetcode | 1056-capacity-to-ship-packages-within-d-days/1056-capacity-to-ship-packages-within-d-days.cpp | class Solution {
public:
bool isPossible(vector<int>& weights, int days, int capacity){
int sum = 0;
int numdays = 1;
for(int i = 0; i < weights.size(); i++){
if(sum + weights[i] <= capacity){
sum += weights[i];
}else{
numdays++;
... | ALGO | 0.999994 | 5.878105 |
84ff53f2-43eb-4467-8299-528eab37f53d | lyccrius/OI-Solution | UOJ/#9. 【UTR #1】vfk的数据 trie 97.cpp | #include <iostream>
#include <string>
#include <deque>
#include <map>
#include <cstring>
typedef char chr;
typedef std::string str;
typedef std::deque<int> diq;
typedef std::map<chr, int> mci;
const int maxN = 10000;
const int maxM = 100;
const chr ind[70] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_01234... | ALGO | 0.998219 | 3.485915 |
fa59f656-265d-4fa2-ab0b-17f32b2f1812 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_4306_2.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int a[1005][1005];
int dp[605][303][303];
int calc(int t, int c, int cc) {
if (t == 2 * (n - 1)) {
if (c == n && cc == n)
return a[n][n];
else
return -(1e8);
}
if (dp[t][c][cc] != -1) return dp[t][c][cc];
int r = 2 + t - c;
int rr = 2 + ... | ALGO | 0.999902 | 3.341551 |
0a4621a8-d131-4c6b-b5d2-2e82f89164c5 | florianhauer/mapnplan | src/2dwaypoint_tracker.cpp | #include "ros/ros.h"
#include "nav_msgs/Odometry.h"
#include "geometry_msgs/Point.h"
#include "geometry_msgs/Twist.h"
#include "tf/transform_datatypes.h"
#include "visualization_msgs/Marker.h"
ros::Publisher command_pub;
double x_desired=0;
double y_desired=0;
double V_max=3;
double omega_max=4;
double dtheta_max=0.5... | TOOL | 0.900813 | 4.495915 |
c98aa42b-15f0-4059-b7ca-5d81f46a4daf | mohitdtumce/Competitive-Coding | DataStructure&Algorithm/backtracking/6a.cpp | #include <iostream>
using namespace std;
class graph{
private:
int V;
int **g;
bool isSafe(int color[],int v,int c){
for(int i = 0; i < V; i++){
if(g[v][i] && color[i] == c){
return false;
}
}
return true;
}
bool graphColoringUtil(int m,int color[],int v){
if(v == V){
return true... | ALGO | 0.999646 | 5.576247 |
8fc25019-5d80-4ef9-b34e-32818667d695 | LonxunQuantum/Lammps_for_PWMLFF | lammps_neigh_mlff_20230508/src/DIPOLE/pair_lj_cut_dipole_long.cpp | // clang-format off
#include "pair_lj_cut_dipole_long.h"
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "force.h"
#include "kspace.h"
#include "math_const.h"
#include "memory.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "update.h"
#include <cmath>
#include <cstring>
using namespace LAM... | ALGO | 0.99716 | 5.37126 |
d492eee7-5754-4cd1-b5c7-8b005fc5ac94 | md-shamim-ahmad/HackerRank-Online-Judge-Problems-Solutions | Practice/Problem Solving/Data Structures/Insert a Node at the Tail of a Linked List.cpp |
// Complete the insertNodeAtTail function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
SinglyLinkedListNode* insertNodeAtTail(SinglyLinkedListNode* head, int data) {
SinglyLinkedListNode* newNode = new SinglyLinkedListNode(data);
i... | ALGO | 0.995019 | 3.321773 |
3f553870-0efd-4343-8ba4-4f0fe3df91f1 | anirudhajith/OOP-lab-assignments | A4/main.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
class Complex {
protected:
double real;
double imaginary;
public:
Complex(double r, double i) {
real = r;
imaginary = i;
}
void add(Complex &d) {
real += d.real;
imaginary += d.imagi... | ALGO | 0.9904 | 4.671179 |
34219f98-1e8c-4251-9d55-7a297a757291 | WillMeyer123/Big-Int-C- | functions.cpp | #include "functions.h"
#include "bigint/bigint.h"
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
const char B = 26;
bool convert_char(char &ch, unsigned int &i) {
if (ch >= 'a' && ch <= 'z') i = (unsigned int)(ch - 'a' + 0);
... | ALGO | 0.992471 | 5.607175 |
3ba0543f-d27c-4af5-aa80-218193167ad7 | parthsarthiprasad/Competitive_Programming | codeforces/689div2/p3.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i=j;i<k;i++)
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
while(t--){
int n,m;
cin>>n>>m;
vector<int> permut(n);
rep(i,0,n){
cin>>permut[i];
}... | ALGO | 0.999835 | 3.389031 |
d731d5ff-e225-4cc2-8e84-0a21ea9963bc | Kmalesh/QUEUE-DSA | PROJECTS/trangle_pattern_printing.cpp | #include<iostream>
using namespace std;
int main(){
for(int i=1;i<5;i++)
{
for(int j=1;j<=i;j++)
{
cout<<"*";
}
cout<<endl;
}
return 0;
}
| ALGO | 0.999157 | 3.28559 |
3cd56d26-b2aa-4bcd-a253-10ac97f60500 | CorentinMercier/neural-meta-tracts | lib/eigen/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)
{
return v.sta... | TEST | 0.97522 | 6.677844 |
7a4a5307-e10a-4abc-98d5-327d5c87bf9e | RuiHuangNUS/MARS-FTCC | Dynamical_Trajectory/src/uav_simulator/so3_quadrotor_simulator/src/dynamics/Quadrotor.cpp | #include "quadrotor_simulator/Quadrotor.h"
#include "ode/boost/numeric/odeint.hpp"
#include <Eigen/Geometry>
#include <boost/bind.hpp>
#include <iostream>
#include <ros/ros.h>
namespace odeint = boost::numeric::odeint;
namespace QuadrotorSimulator
{
Quadrotor::Quadrotor(void)
{
alpha0 = 48; // degree
g_ ... | ALGO | 0.978807 | 6.26187 |
7d1aef42-10d8-4c08-a5b6-8ae677fdf3d8 | ramijahsultana/Basic_Data_Structure | Module 5 - Singly Linked List/Printing_Linked_List.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node* next;
Node(int val)
{
this->val = val;
this->next = NULL;
}
};
void Printing_list(Node* head)
{
Node* temp = head;
while(temp != NULL)
{
cout << temp->val << endl;
temp =... | ALGO | 0.998441 | 3.847044 |
083e54dc-8971-4beb-97f9-d030e3acfa59 | ryan-4u/DSA-cpp- | Basics/Source-02-ApnaCollege/Patterns/hollowRectangle.cpp | #include<iostream>
using namespace std ;
int main()
{
int l;//length
cout<<"Enter length : ";
cin>>l;
int b;//breadth
cout<<"Enter breadth : ";
cin>>b;
for(int i=1 ;i<=b ; i++)
{
for(int j=1 ;j<=l;j++)
{
if( (i==1) || (i==b) || (j==1) || (j==l) ){
... | ALGO | 0.999489 | 3.016515 |
dd863213-dd50-4dc4-b64f-a73ee4d74a6f | Anikcsejnu/cpp-problem-solving | C++/codemarshal/A11.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int e, o;
cin>>e>>o;
if((o-e==1) || o==e || e-o==1)printf("YES\n");
else printf("NO\n");
}
| ALGO | 0.999894 | 3.037582 |
f5a27867-c8b7-49ad-9ddc-c3bfe06abddb | diasbuz/C-labs | lab02/13.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int intArray[8] ,j=0;
for(int i=0;i<8;i++)
{
cin>>intArray[i];
}
do
{
cout<<intArray[j]+pow(2,j)<< " ";
j++;
}
while(j!=8);
}
| ALGO | 0.99895 | 3.035506 |
be1d41a4-d30f-4f5f-a586-e91b3f2fc679 | kslk11/Problem_solving_using_cpp | 172-factorial-trailing-zeroes/factorial-trailing-zeroes.cpp | class Solution {
public:
int trailingZeroes(int n) {
int count=0;
while(n>=5){
count+=(n/5);
n/=5;
}
return count;
}
}; | ALGO | 0.999879 | 6.271377 |
779c90f2-940d-49a3-9595-499d697f131d | ConorFWild/_gemmi | src/rmsz.cpp | #include <stdio.h>
#include <cstdlib> // for getenv
#include <stdexcept>
#include "gemmi/model.hpp" // for Structure, Atom, etc
#include "gemmi/chemcomp.hpp" // for ChemComp
#include "gemmi/monlib.hpp" // for MonLib, read_monomer_lib
#include "gemmi/topo.hpp" // for Topo
#include "gemmi/calculate.hpp" // f... | TOOL | 0.981975 | 6.04626 |
4f85d1aa-80fc-4b32-a6e9-40243c8c2914 | navneetsingh9135/C---DSA | DSA NEW/Pattern/TrainglePattern.cpp | #include <iostream>
using namespace std;
int main()
{
int n = 4;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < i + 1; j++)
{
cout << "*";
}
cout << endl;
}
return 0;
} | ALGO | 0.999769 | 3.958138 |
333a9a92-94bd-4a91-b614-aa8cf35cda0e | Kaminyou/MyLeetcode | cpp_solutions/1189.cpp | class Solution {
public:
int maxNumberOfBalloons(string text) {
vector<int> counts(5, 0); // a, b, l, n, o
vector<int> div = {1, 1, 2, 1, 2};
for (auto c : text) {
if (c == 'a') counts[0]++;
else if (c == 'b') counts[1]++;
else if (c == 'l') counts[2]++;
... | ALGO | 0.999347 | 5.9511 |
c87f9fc5-8550-4f53-a5bb-341dcf576592 | Mustafaelsayed1/Smart-Access-room | Smart-Access-main/Smart Access/Admin panel/Admin Panel web application/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.99785 | 6.76775 |
ab71a1dc-12c5-4bba-acb9-3de2502a350b | amolsatsangi/Leetcode | Medium/Container With Most Water/Container With Most Water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int maxi{INT_MIN};
int i{0}, j = height.size()-1;
while(i<j){
int temp = min(height[i],height[j])*(j-i);
maxi = max(temp,maxi);
if(height[i]<height[j]) i++;
else j--;
}
... | ALGO | 0.999944 | 6.658829 |
95a89a9a-a227-40f1-9a1d-4efddf13fbb5 | ArchanPatel890/CompetitiveProgramming | Codeforces/Official/672/672C.cpp | /*
* Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
* Example:- $ g++ -std=c++11 c++Template.cpp
*/
/******** All Required Header Files ********/
#include <bits/stdc++.h>
using namespace std;
/******* All Required define Pre-Processors and typedef Constants ***... | ALGO | 0.999927 | 4.15868 |
9600ab34-98d6-415c-9798-9b6a6908dacc | Dup4/competitive-programming | codeforces/contest/1296/f/f.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define endl "\n"
using namespace std;
using db = double;
using ll = long long;
using ull = unsigned long long;
using pII = pair<int, int>;
using pLL = pair<ll, ll>;
constexpr int mod = 1e9 + 7;
template <class T1, class T2>
inlin... | ALGO | 0.99989 | 4.387332 |
fae1927b-24b8-4c93-af8b-6e69b3264335 | harry-dev98/CompetitiveCodingSolutions | DP/MaxSumRect.cpp | #include<bits/stdc++.h>
using namespace std;
#define inf 1<<30
int main(){
int t;
cin>>t;
while(t--){
int n,m;
cin>>n>>m;
int A[n][m];
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cin>>A[i][j];
}
}
int ColSum[n];
... | ALGO | 0.999973 | 3.455662 |
bb1b566b-32ad-45df-885e-2981f2217cff | MrityunjayNPandey/vscode | CP/D_Divide_and_Summarize.cpp | /**
* codeforces: _joKer_0
* codechef: joker_0000
* created: 23-07-2023 15:11:29
**/
// clang-format off
#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("avx,avx2,fma")
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std; ... | ALGO | 0.999987 | 4.994964 |
e75bac38-2e4a-4cde-9c44-7fb434fb777e | takaakiaoki/my-lammps | src/USER-SPH/fix_meso_stationary.cpp | #include "stdio.h"
#include "string.h"
#include "fix_meso_stationary.h"
#include "math.h"
#include "stdlib.h"
#include "string.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "update.h"
#include "integrate.h"
#include "respa.h"
... | ALGO | 0.986845 | 6.223447 |
3defc501-77f7-4638-b0dd-fedd394c6090 | UOSCS/algorithms | BOJ/bruteforce/1476.cpp | //
// main.cpp
// cpp
//
//
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
// insert code here...
ios::sync_with_stdio(0);
int E, S, M;
cin >> E >> S >> M;
int i = 1;
while (true) {
if (!((i - E) % 15) && !((i - S) % 28) && !((... | ALGO | 0.999822 | 3.540706 |
1cf20b34-f6e8-498a-a37b-56ba71157da2 | Krissny/cpp | DSA/Recursion/Combination.cpp | #include <bits/stdc++.h>
using namespace std;
void print(vector<int> v){
for(auto c: v){
cout<<c<< " ";
}
cout<<endl;
}
void CombinationSum(int arr[], int i,int target, int n, vector<int> v){
//base case
if(i==n){
if(target==0){
print(v);
}
return;
}
... | ALGO | 0.999644 | 5.043394 |
658ab780-2c8d-4fab-bbb5-9011db9d36fa | asirff399/Phitron_s2 | Basic Data Structures/Module 2/vector_input.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
// vector<int> v;
// int n;
// cin>>n;
// for(int i=0;i<n;i++)
// {
// int x;
// cin>>x;
// v.push_back(x);
// }
// for(int val:v)
// {
// cout<< val <<" ";
// }
int n;
cin>>n;
vecto... | ALGO | 0.991838 | 3.537353 |
41adebb0-2b72-4e76-8da3-ad8626412041 | kapil4457/Striver-A2Z-Sheet | 7. Recursion(Pattern Wise)/7.2/Combination Sum II.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:
void func(vector<int> &arr,int tar,int idx, vector<vector<int>> &ans, vector<int> &temp)
{
if(idx==arr.size())
{
... | ALGO | 0.999656 | 6.190334 |
28c33624-863d-40a4-a93d-b3f3b5f938c7 | allem40306/Competitive-Programming | zerojudge/B250~499/zjb294.cpp | #include <iostream>
#include <cmath>
int main(){
long long ans=0,n,x;
scanf("%lld",&n);
for(int i=1;i<=n;i++){
scanf("%lld",&x);
ans+=i*x;
}
printf("%lld",ans);
}
| ALGO | 0.999751 | 3.575865 |
67b0a25c-ac64-43e4-9432-46bd154a3a78 | zazicam/otus-cpp-hw15 | visualize.cpp | #include "png_image.hpp"
#include <iostream>
#include <vector>
struct Point {
double x;
double y;
int cluster;
};
rgb color_by_index(int i) {
if(i==0) return rgb{255,0,0};
if(i==1) return rgb{0,255,0};
if(i==2) return rgb{0,0,255};
if(i==3) return rgb{128,0,0};
if(i==4) return rgb{0,128,0};
if(i==5) return ... | DATA | 0.95564 | 5.897686 |
115361d7-d518-4b37-9436-0d4ec3ecaf3d | DeepInMind12345/UEToonShading | Engine/Source/ThirdParty/PhysX3/APEX_1.4/module/destructible/fracture/Core/Delaunay3dBase.cpp | #include "RTdef.h"
#if RT_COMPILE
#include "Delaunay3dBase.h"
#include "PsSort.h"
#include <PxAssert.h>
#include "PxBounds3.h"
namespace nvidia
{
namespace fracture
{
namespace base
{
using namespace nvidia;
// side orientation points outwards
const int Delaunay3d::Tetra::sideIndices[4][3] = {{1,2,3},{2,0,3},{0,1,3... | ALGO | 0.998103 | 4.825842 |
e2931ef0-763d-4883-9046-74d9374133ef | Takahashi0213/Practice_18 | k2EngineLow/ExEngine/bulletPhysics/src/LinearMath/btPolarDecomposition.cpp | #include "btPolarDecomposition.h"
#include "btMinMax.h"
namespace
{
btScalar abs_column_sum(const btMatrix3x3& a, int i)
{
return btFabs(a[0][i]) + btFabs(a[1][i]) + btFabs(a[2][i]);
}
btScalar abs_row_sum(const btMatrix3x3& a, int i)
{
return btFabs(a[i][0]) + btFabs(a[i][1]) + btFabs(a[i][2]);
}... | ALGO | 0.999366 | 6.762144 |
e2b748a3-77f2-4d2d-8343-02edb935df83 | novrion/GYAR | .old/2/bb/search_alpha_beta.cpp | #include "search.h"
using namespace std;
using namespace std::chrono;
//int nodes = 0;
void PlayBot() {
int depth;
cout << "depth: ";
cin >> depth;
Board b{};
double average_times[3][kNPositions] = {};
for (int board_type = 0; board_type < 3; ++board_type) {
for (int board_index = 0; board_index < kNPositi... | ALGO | 0.997457 | 3.711434 |
2cd18693-16e6-4d39-b65c-787ab4b27ca4 | kunalbandooni/GS-Problem-Soving | B.77 Letter Combinations of a Phone Number.cpp | // https://leetcode.com/problems/letter-combinations-of-a-phone-number
class Solution {
const vector<string> pad = {
"", "", "abc", "def", "ghi", "jkl",
"mno", "pqrs", "tuv", "wxyz"
};
public:
vector<string> letterCombinations(string digits) {
if (digits.empty()) return {};
ve... | ALGO | 0.999927 | 7.054161 |
ea106fb6-4307-4e99-b736-fb071deb3dee | jbm2593/Algorithm | BackJoon/2206/Hong/block.cpp | #include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
struct node
{
int x;
int y;
int d;
int n;
};
int N, M, result;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
int map[1010][1010];
bool visit[1010][1010][2];
queue<node> q;
vo... | ALGO | 0.999866 | 4.188114 |
a7a19d27-8cb0-4c4a-9c53-ed75d2f664e6 | kejpmdt/Static | Workspace/CODES/Problems/ZR/20th/day12/T2/T2.cpp | #include<bits/stdc++.h>
using namespace std;
long long f[100005][2];
vector<int>tos[100005];
int v[100005];
long long dfs(int nw,int x){
if(f[nw][x]){
return f[nw][x];
}
long long re;
if(x==1){
re=v[nw];
}
else{
re=0x7fffffff;
}
for(auto i:tos[nw]){
if(x){... | ALGO | 0.999936 | 4.110116 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.