uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
372a32bf-7f43-4c1a-baf2-ecd932fbc074 | HaniffAlisa/575 | 04_Expressions_Examples/EX_4_modulo.cpp | // S. Trowbridge 2022
#include <iostream>
using namespace std;
int main()
{
cout << endl;
cout << "MOD 3" << "\n"; // possible answers are 0 1 2 (0 to n-1 where n is 3)
cout << (0 % 3) << "\n";
cout << (1 % 3) << "\n";
cout << (2 % 3) << "\n";
cout << (3 % 3) << "\n";
cout << (4 % 3) << "\... | ALGO | 0.999206 | 3.526736 |
e205c07a-7b8b-4a36-91ac-9b586b8b270a | Akshadachobhee/My-Programs-LB | CPP/program225.cpp | using namespace std;
#include<iostream>
//take decimal number from user and convert it into binary format
void DisplayBinary(int iNo)
{
int iDigit = 0;
while(iNo != 0)
{
iDigit = iNo%2;
cout<<iDigit;
iNo = iNo/2;
}
cout<<"\n";
}
int main()
{
int iValue = 0;
cout<... | ALGO | 0.991778 | 5.235235 |
3e4c3bef-f452-42f0-a503-fc59e91d2b49 | vishnujayvel/practicecodes | test.cpp | #include <iostream>
using namespace std;
void getDuplicate(int arr[],int size)
{
int pos = 0;
int desiredPos = 0;
while(pos < size)
{
if(arr[pos] <= 0){
pos++;
//continue;
}
desiredPos = arr[pos] -1;
if(arr[desiredPos] > 0)
{
arr[pos... | ALGO | 0.999675 | 4.271965 |
2eccc66b-e4e1-48ef-b1e9-5bfe841edfce | ishandutta2007/codeforces | emilan/normal/1426/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define vt vector
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fi first
#define se second
using ll = long long;
using pii = pair<int, int>;
void solve() {
... | ALGO | 0.99986 | 4.131817 |
4255e94b-5024-488a-b796-c175fb1ac28a | pclubiitk/Spring-Camp-25 | CP/Aditya/Assignment 2/ReadingBooks.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < b; ++i)
#define tr(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define w(a) while(a--)
#define cint(n) int n; cin >> n;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi... | ALGO | 0.998051 | 3.930742 |
d8e3e5ad-aa7a-478a-aa71-c512e94df6e7 | dslab-epfl/tpot | klee-2.3/lib/Expr/ExprEvaluator.cpp | #include "klee/Expr/ExprEvaluator.h"
using namespace klee;
ExprVisitor::Action ExprEvaluator::evalRead(const UpdateList &ul,
unsigned index) {
for (auto un = ul.head; un; un = un->next) {
ref<Expr> ui = visit(un->index);
if (ConstantExpr *CE = dyn_cast<Consta... | ALGO | 0.929891 | 7.559079 |
e70a0243-f3ea-4027-b587-da83185c1aaa | P57749/Marlin_costom | buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.cpp | #include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
// Digital PinName array
const PinName digitalPin[] = {
PA_0, // Digital pin 0
PA_1, // Digital pin 1
PA_2, // Digital pin 2
PA_3, // Digital pin 3
PA_4, // Digital pin 4
PA_5, // Digital pin 5
PA_6, // Digital pin 6
PA_7, // Dig... | CONFIG | 0.921646 | 6.375713 |
682486af-aa10-4774-9bbb-ceb8690845b8 | zxyDEDIRE/ACM_CODE | CodeForces/Educational Codeforces Round 146 (Rated for Div. 2)/C.cpp | /*
嵌套变量重复 特殊样例 0 1 2 n 数组越界 开long long
清空 建图别用vector
*/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pp(x) array<int,x>
using ull=unsigned long long;
using ll=long long;
using pii=pair<int,int>;
const int dx[]={0,0,1,-1,1,-1,1,-1};
const int dy[]={1,-1,0,0,1,-1,-1,1};
const int mod=998244353... | ALGO | 0.999788 | 3.71427 |
74edd483-f8ed-44bd-ba4f-84b75662a7ff | shacklettbp/bps3D | src/vulkan/memory.cpp | #include "memory.hpp"
#include <vulkan/vulkan_core.h>
#include "utils.hpp"
#include "config.hpp"
#include <cstring>
#include <iostream>
using namespace std;
namespace bps3D {
namespace vk {
namespace BufferFlags {
static constexpr VkBufferUsageFlags commonUsage =
VK_BUFFER_USAGE_TRANSFER_DST_BIT;
static const... | TOOL | 0.887937 | 4.873327 |
7d9f7ff1-d91b-4ef5-b80c-b29fd51c8e15 | VA-run23/GeeksforGeeks-POTD | February/POTD_10_02_2025.cpp | class Solution {
public:
int sumK(Node *root, int k) {
// code here
unordered_map<int, int> prefixSumCount;
prefixSumCount[0] = 1; // To handle the case when path sum equals k at the root
return dfs(root, k, 0, prefixSumCount);
}
private:
int dfs(Node* node, int k, in... | ALGO | 0.999914 | 5.951855 |
e61992f9-57d7-48dc-bdc1-5d3f139b47ab | ishandutta2007/codeforces | ssrs_/normal/1684/E.cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 1000000;
template <typename T>
struct binary_indexed_tree{
int N;
vector<T> BIT;
binary_indexed_tree(int N): N(N), BIT(N + 1, 0){
}
void add(int i, T x){
i++;
while (i <= N){
BIT[i] += x;
i += i & -i;
}
}
T sum(int i){
... | ALGO | 0.999986 | 3.833825 |
53aeb7ec-9037-4ee0-b247-d9101dca1bc9 | Zhu-Bei-Jian/ACM-Template | Template/数论/BM.cpp | //线性递推 BM
typedef vector<ll> VI;
typedef pair<ll, ll> PII;
const ll mod = 1000000007;
ll powmod(ll a, ll b) { ll res = 1; a %= mod; ; for (; b; b >>= 1) { if (b & 1)res = res * a % mod; a = a * a % mod; }return res; }
ll _, n;
namespace linear_seq {
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n... | ALGO | 0.999977 | 3.64168 |
5887ebb9-1ff1-4e99-a807-32ac2a30f3f3 | Charbel-11/Competitive-Programming | Pre-Written Algorithms/Strings/Manacher.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//O(n)
//If even is true, res[i] = length/2 of the even palindrome with right center at i
//If even is false, res[i] = (length-1)/2 of the odd palindrome with center at i
//For example, "aaaa" even returns: 0 1 2 1, odd: 0 1 1 0
vector<int> manacher(s... | ALGO | 0.999924 | 5.029774 |
0bd658ff-addf-4985-bee4-a1390619f59b | UMich-CURLY/RKHS_BA | src/experiments/main_irls_tartan_rgbd_ablation_reg.cpp | #include <iostream>
#include <list>
#include <vector>
#include <utility>
#include <string>
#include <fstream>
#include <sstream>
#include <set>
#include <cmath>
#include <random>
#include <Eigen/Dense>
#include <Eigen/Geometry>
#include "cvo/CvoGPU.hpp"
#include "cvo/IRLS_State_CPU.hpp"
#include "cvo/IRLS_State_GPU.hpp... | DATA | 0.945593 | 3.354713 |
22a7a1c7-e5b4-40fd-b7fe-4dee144ebbac | KEDIARAHUL135/Aruco_Hand | main.cpp | /*
* File name : main.cpp
* Created by : Rahul Kedia
* Created on : 15/07/2020
* Description : This file contains main code for the project.
*/
#include <opencv2/opencv.hpp>
#include <iostream>
#include "ArucoDetection.h"
// Change these params to modify code functioning.
auto InputVideoPath = "Videos/Aruco_Han... | ALGO | 0.956653 | 5.525813 |
f086b76b-3c75-4318-bfad-0ee4af0ef3ba | Labanikanta/cdsa | RECURSION/fibonacci.cpp | #include <iostream>
using namespace std;
int fib (int n ){
if (n==0||n==1){
return n ;
}else {
return fib(n-1)+fib(n-2);
}
}
int main(){
cout << fib(3);
return 0 ;
} | ALGO | 0.999909 | 4.276978 |
74d03a64-bdb5-40a7-865c-3a1bb63cb9da | IncoCura/qt5 | qtwebengine/src/3rdparty/chromium/third_party/WebKit/Source/core/style/GridPositionsResolver.cpp | #include "GridPositionsResolver.h"
#include "core/layout/LayoutBox.h"
#include "core/style/GridArea.h"
#include <algorithm>
namespace blink {
static inline GridTrackSizingDirection DirectionFromSide(
GridPositionSide side) {
return side == kColumnStartSide || side == kColumnEndSide ? kForColumns
... | TOOL | 0.885512 | 7.84951 |
0b742fbf-38b4-41e9-8ee3-0a1fd5cab14d | rajat844/Leetcode2022 | 0142-linked-list-cycle-ii/0142-linked-list-cycle-ii.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
ListNode* slow = head;
ListNode* fast = head;
while(fast !=... | ALGO | 0.999945 | 5.741211 |
a6d8c307-c42f-4153-a79b-25a4188818e0 | Shamsullo/todos | todo_react/api/test2.cpp | #include <iostream>
using namespace std;
isPairedN(int a[], int n, int len)
{
if (len < 3) return 0;
for (int i = 0; i < len; ++i)
{
// int j = i + 1;
for (int 0; j < len; ++i)
{
if (j != i)
{
if (a[i] + a[j] == n)
{
if (i + j == n)
{
return 1
}
}
}
}
}
return 0... | ALGO | 0.999932 | 4.35269 |
09cb5ccc-8198-4078-99c7-831340da4414 | AnkitDevri/Data-Structures-and-Algorithms- | Algorithms/Recursion/smallestNumber.cpp | using namespace std;
#include <bits/stdc++.h>
void smallestNumber(long long& ans,vector<long long>& nums,string& s){
if(s.length()==0){
for(auto i : nums){
if(i!=-1) ans=min(ans,i);
}
return;
}
for(int i = 0; i<nums.size()-1; i++){
if(nums[i]==-1) continue;
... | ALGO | 0.999974 | 3.899825 |
f24510a9-d073-465b-a2e4-31cee97efc1e | Anurag-2312/CodeSprint2.0 | Day18/ques1.cpp | #include <bits/stdc++.h>
using namespace std;
bool isvalid(string s)
{
stack<char> st;
for (char c : s)
{
if (c == '(' || c == '{' || c == '[')
{
st.push(c);
}
else
{
if (st.empty())
return false;
char ch = st.top()... | ALGO | 0.999508 | 5.944394 |
d7c828b6-2817-4be2-a9ef-933841b39848 | AdnanMuzavor/PDS | BST/Max_width_of_BST.cpp | /*
662. Maximum Width of Binary Tree
Medium
3896
624
Add to List
Share
Given the root of a binary tree, return the maximum width of the given tree.
The maximum width of a tree is the maximum width among all levels.
The width of one level is defined as the length between the end-nodes (the leftmost and rightmost n... | ALGO | 0.999917 | 6.167426 |
d13b4629-9169-4256-b3dd-35d74ef522bc | johnscape/TickTackToe | src/Level.cpp | #include "Level.h"
#include <iostream>
Level::Level(int levelSize, int win)
{
NeedToWin = win;
Size = levelSize;
LastX = 0;
LastY = 0;
LevelData = new int*[levelSize];
for (int i = 0; i < levelSize; i++)
{
LevelData[i] = new int[levelSize];
for (int k = 0; k < levelSize; k... | TOOL | 0.936399 | 4.097035 |
385a8411-d354-41db-94a9-ffe57a714205 | Rajeev0651/Codeforces | Set_2/1 (13).cpp | #include<bits/stdc++.h>
using namespace std;
int fnc(const void *a, const void *b)
{
return(*(long int*)a - *(long int*)b);
}
int main()
{
int T;
cin>>T;
while(T--)
{
long int N,b,flag=1,x,q=1;
cin>>N;
long int A[4*N+5],B[N*2+5];
for(long int i=0; i<N*4; i++)
{
cin>>A[i];
}
qsort(A,N*4,sizeof(l... | ALGO | 0.999919 | 3.36715 |
f167fb85-050a-4149-b5a3-28e10f665e56 | KrSahil/Projects | DSA Level Up Prateek Narang/Priority Queue Heap/FindingCabs2.cpp | #include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
class Car{
public:
string id;
int x,y;
Car(string id,int x,int y){
this->id = id;
this->x = x;
this->y = y;
}
// int dist(){ //this will give us error because distance function must ... | ALGO | 0.999982 | 4.649971 |
2888beba-b934-421d-8bec-0d158016b00d | MrYellowCar/university | dodicesimoEsercizio/main.cpp | /*media e minimo di 5 valori inseriti in un array, la cui dimensione è fornita dall'utente*/
#include <iostream>
using namespace std;
int main() {
int n, media;
int minimo, massimo;
do {
cout << "Inserire quanti valori si vogliono inserire nel vettore: ";
cin >> n;
} while (n < 1 || ... | ALGO | 0.923522 | 3.347059 |
1bdd72e5-ff97-4b31-936a-da7d8e332b44 | sgovil5/competitive-programming | Templates/DSU(benq).cpp | struct DSU {
vi e; void init(int N) { e = vi(N,-1); }
// get representive component, uses path compression
int get(int x) { return e[x] < 0 ? x : e[x] = get(e[x]); }
bool sameSet(int a, int b) { return get(a) == get(b); }
int size(int x) { return -e[get(x)]; }
bool unite(int x, int y) { // union by size
... | ALGO | 0.999037 | 3.987015 |
648da96c-bcc5-4192-ac79-1a140581b501 | DevArman3/BasicFoundation | string/palind.cpp | #include <iostream>
#include<string>
using namespace std;
bool func(string s){
int i=0;
int j=s.size()-1;
while(i<=j){
if(s[i]!=s[j]){
return false;
}
i++;
j--;
}
return true;
}
int main() {
string s;
cin>>s;
if(func(s)) cout<<"yes";
else cout<<"no"... | ALGO | 0.999945 | 4.293095 |
2b3cfb90-deb1-4327-863b-b87b8532c8fa | ericliuu/flux | FLUX/libc/src/math/generic/sinf.cpp | #include "src/math/sinf.h"
#include "sincosf_utils.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/PolyEval.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/common.h"
#include... | ALGO | 0.997102 | 7.130465 |
a4b877a4-d1cd-47d6-ae36-a7929a320465 | chenchienkuo9010/c-cpp-practice | wdd/cpp/stl/day05/23remove/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
vector<int> v{1, 2, 2, 3, 1, 1, 1, 2, 2, 4, 5, 1, 2};
remove(v.begin(), v.end(), 2); // 用后面的元素覆盖要删除的元素
for (auto i : v) {
cout << i << " ";
}
cout << endl;
return 0;
}
| ALGO | 0.999176 | 4.060884 |
83de1285-a8ec-49b0-b410-76f8980543d2 | denis-gubar/Leetcode | Interactive/0278. First Bad Version.cpp | // The API isBadVersion is defined for you.
// bool isBadVersion(int version);
class Solution {
public:
int firstBadVersion(int n) {
int a = 0, b = n;
while (a + 1 < b)
{
int m = a + (b - a) / 2;
if (isBadVersion(m))
b = m;
else
a = m;
}
return b;
}
}; | ALGO | 0.999197 | 6.476545 |
bc190ba8-362e-4cd9-8ec4-a51ecb14029d | aditya3492gupta/Electron-Calculator | backend/calculator.cpp | #include <iostream>
#include <sstream>
#include <string>
double evaluateExpression(const std::string &expression)
{
// This is a very basic and insecure evaluation.
// For production, you should use a proper parser.
std::istringstream iss(expression);
double result;
iss >> result;
char operati... | TOOL | 0.979421 | 6.70794 |
9ffb2b40-9ebf-49c4-8ca3-7291b6c9f92f | amitprat/PracticeCode | threadSafeCircularQueue.cpp | /*
Implement thread-safe circular queue that has 2 methods Read & Write n bytes.
The entire design and implementation was open for discussion.
Discussion went for locking, multi threading, boundary cases, all sets of issues related to multi threading..it was quite intense..
*/
#include <iostream>
#include ... | ALGO | 0.996332 | 5.200372 |
cdb7084b-ab58-437e-b6bf-5aff1fc8bb38 | vietne329/DataStructuresAndAlgorithms | 12.NguoiDuLich.cpp | #include<bits/stdc++.h>
using namespace std;
int N,a[100][100],X[100],T[100],FREE[100],bestconfig = INT_MAX;
void Try(int i){
for(int j=2;j<=N;j++){
if(FREE[j]==0){
X[i] = j;
T[i] = T[i-1] + a[X[i-1]][j];
if(T[i]<bestconfig){
if(i<N){
FREE[j] = 1;
Try(i+1);
FREE[j] = 0;
}
else if(... | ALGO | 0.999791 | 3.156965 |
4b45d760-8b5b-48fe-b5bf-3a9afa91ec5c | Xinyuan-LilyGO/LilyGO-Mini-E-paper-S3 | Meshtastic/lib/Crypto/BigNumberUtil.cpp | #include "BigNumberUtil.h"
#include "utility/EndianUtil.h"
#include "utility/LimbUtil.h"
#include <string.h>
/**
* \class BigNumberUtil BigNumberUtil.h <BigNumberUtil.h>
* \brief Utilities to assist with implementing big number arithmetic.
*
* Big numbers are represented as arrays of limb_t words, which may be
* ... | TOOL | 0.883303 | 5.59117 |
db62a055-80d9-4cb3-8c39-1222efd2a8ba | doocs/leetcode | solution/0700-0799/0733.Flood Fill/Solution.cpp | class Solution {
public:
vector<vector<int>> floodFill(vector<vector<int>>& image, int sr, int sc, int color) {
int m = image.size(), n = image[0].size();
int oc = image[sr][sc];
if (oc == color) {
return image;
}
const int dirs[5] = {-1, 0, 1, 0, -1};
aut... | ALGO | 0.99977 | 6.711584 |
5569f6ca-ccb7-4122-907e-14c09cb833c1 | hssong1221/CodingTestPractice | DB-FS 백트래킹(재귀) 그래프 최단거리/백준1012(유기농배추).cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
//
vector<vector<int>> matrix(51, vector<int>(51, 0));
// 湮
vector<vector<int>> visit(51, vector<int>(51, 0));
// ť
queue<pair<int, int>> q;
// ߵ
int idx = 1;
//
vector<int> ans;
int C;
int M, N, K;
//¿
int dx[4] = { ... | ALGO | 0.999944 | 3.84747 |
730198c1-88f9-45d3-8954-d2077d811a59 | ctk0418/data_static | src/6/5-1.cpp | #include <windows.h>
#include <math.h>
#include <stdio.h>
#include <malloc.h>
double dividewangxx=(double)32767*(double)32767*(double)32767;
#include <c:\\simulated_book\\include_dll\\DLL_function_type.cpp>
double uniform_simulated(double alpha,double beta)
{
double tep1,tep=0,dividewangx;
again:
tep1=((doub... | ALGO | 0.999187 | 3.646455 |
ff34176f-502d-47a8-a8c0-93992fbb8859 | AnsonHooL/Coding_Note | leetcode/【动态规划】188.买卖股票的最佳(最多k次交易).cpp | //
// Created by lenovo on 2020/12/28.
//
/**
* 给定一个整数数组 prices ,它的第 i 个元素 prices[i] 是一支给定的股票在第 i 天的价格。
设计一个算法来计算你所能获取的最大利润。你最多可以完成 k 笔交易。
注意:你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。
示例 1:
输入:k = 2, prices = [2,4,1]
输出:2
解释:在第 1 天 (股票价格 = 2) 的时候买入,在第 2 天 (股票价格 = 4) 的时候卖出,这笔交易所能获得利润 = 4-2 = 2 。
* */
class Solution {
publ... | ALGO | 0.999749 | 5.793022 |
0ec123d7-30ba-4292-bf59-d3cc5ff2ffa1 | DusanTodorovic5/coding-challenge-solutions | algorithms/leetcode/1422_maximum_score_after_splitting_string/cpp/main.cpp | #include <iostream>
#include <utility>
class Solution {
public:
int maxScore(std::string s) {
int leftZeros = s[0] == '0';
int rightOnes = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '1') {
rightOnes++;
}
}
int max_split_s... | ALGO | 0.999953 | 6.045798 |
63f8ccab-c360-4171-a770-eed79a432ec8 | winmutase21/WinMutASE21Artifact | lib/IR/Dominators.cpp | #include "llvm/IR/Dominators.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/GenericDomTreeConstruction.h... | TOOL | 0.997968 | 7.898428 |
68593ac5-7f7b-42ad-bd71-25229dee25db | Pranav-Jain/Neural-Monte-Carlo-Fluid-Simulation | bindings/zombie/deps/tbb/examples/parallel_reduce/convex_hull/convex_hull_sample.cpp | /*
This file contains the TBB-based implementation of convex hull algortihm.
It corresponds to the following settings in convex_hull_bench.cpp:
- USETBB defined to 1
- USECONCVEC defined to 1
- INIT_ONCE defined to 0
- only buffered version is used
*/
#include "convex_hull.h"
#include "tbb/para... | ALGO | 0.999603 | 6.891715 |
b633dc53-f3df-458a-b2ef-4782a5829fd4 | firiexp/contest_log | atcoder/ARC/030A.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;
template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
int main() {
int n, k;
... | ALGO | 0.999954 | 4.552882 |
fe1df65e-ee24-4b81-90c8-6582c8c2b64a | dmcgough/Zombie-Fortress-Fresh | src/tier1/checksum_md5.cpp | #include "basetypes.h"
#include "commonmacros.h"
#include "checksum_md5.h"
#include <string.h>
#include <stdio.h>
#include "tier1/strtools.h"
#include "tier0/dbg.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
// The four core functions - F1 is optimized somewhat
// #define ... | ALGO | 0.997585 | 5.953895 |
6f880de8-b2be-4c7f-86cd-5137ce6fee5c | mdbal-lunule/lunule | src/boost/libs/graph/example/degree_centrality.cpp | //[degree_centrality_example
#include <iostream>
#include <iomanip>
#include <boost/graph/undirected_graph.hpp>
#include <boost/graph/exterior_property.hpp>
#include <boost/graph/degree_centrality.hpp>
#include "helper.hpp"
using namespace std;
using namespace boost;
// The Actor type stores the name of each vertex... | ALGO | 0.99881 | 7.26299 |
02f702d3-ba24-481f-b124-3ec9b216f316 | garg2002/TCS-NQT-2024-Coding-Practise | TCS NQT Coding Question 2023 – September Day 1 – Slot 1/Solution.cpp | /*
Problem Statement –
"A chocolate factory is packing chocolates into the packets. The chocolate packets here represent an array of N number of integer values. The task is to find the empty packets(0) of chocolate and push it to the end of the conveyor belt(array)."
Example 1 :
N=8 and arr = [4,5,0,1,9,0,5,0].
Th... | ALGO | 0.999978 | 4.082013 |
0b2c698f-8d15-4872-9a0f-ce85fb0f69b3 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1485_11.cpp | #include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int mn = 2e5 + 7;
vector<int> a(mn), k(mn);
vector<pair<int, int> > b(mn);
vector<vector<int> > c(mn);
vector<bool> vis(mn, false);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin >> n >> m;
for (int i = 1; i... | ALGO | 0.999998 | 3.966785 |
0dd9b74c-5b24-4025-92b7-c0fcd1724852 | 646divi/LeetCodeDSA | Alex Travelling - GFG/alex-travelling.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
typedef pair<int,int> p;
class Solution {
public:
int minimumCost(vector<vector<int>>& flights, int n, int k) {
// code here
// int n1=flights.... | ALGO | 0.999814 | 5.579842 |
a97a49f4-130f-4ce2-91ff-1691676dcfad | Abhijit25Mishra/code-chef | LONG/JAN 21/DECODEIT/main.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int n,k=0,e=8;
cin>>n;
string given="abcdefghijklmnop",s;
cin>>s;
int times4=n/4;
for(int i=0;i<times4;i++){
e=8;k=0;
in... | ALGO | 0.999836 | 3.482254 |
1880a723-4ae0-4c2e-b550-3ac7aea8f16d | Bharat2044/365-days-coding-challanges | Day_075/01_maxRectangleInBinaryMatrix.cpp | // Question Link: https://www.interviewbit.com/problems/max-rectangle-in-binary-matrix/
/*
Max Rectangle in Binary Matrix
Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing all ones and return its area.
Bonus if you can solve it in O(n^2) or less.
Example :
Input:
A : [ 1 1 1
... | ALGO | 0.99977 | 7.21453 |
3ad99f3e-9357-42d1-8301-64a633f574d4 | wenxinmmb/LeetcodeEveryday | June2019/0207CourseSchedule.cpp | // https://leetcode.com/problems/course-schedule/
//Topological Sort
class Solution {
public:
bool canFinish(int numCourses, vector<vector<int>>& prerequisites) {
if(numCourses == 0 ||prerequisites.size() == 0)
return true;
vector<vector<int>> Adja(numCourses, vector<int>());
vec... | ALGO | 0.999938 | 6.542275 |
fe7f80a8-bed4-49cb-9e6f-0b87d55141ae | jh11240/baekjoon_online_judge | Binary_Search_Tree/백준1351(무한수열).cpp | #include<iostream>
#include<map>
#include<math.h>
using namespace std;
long long int N;
int P, Q;
//일반 배열로 dp처럼 풀기엔 10^12* 8 바이트 크기를 못 감당함
//하지만 map을 사용해 값을 넣어주는 식으로하면 실제 저장할 값이 몇 안되어서 풀기 가능하다
map<long long, long long> dp;
void Input() {
cin >> N >> P >> Q;
dp[0] = 1;
}
long long returnValueA(long long n) {
if (dp... | ALGO | 0.9998 | 3.916474 |
30163a13-04aa-47d6-bd84-8d1b9929dd64 | anilpandey-2002/String | 1.cpp | class Solution
{
public:
int appendCharacters(string s, string t)
{
int a = 0;
for (const char c : s)
if (c == t[a])
if (++a == t.length())
return 0;
return t.length() - a;
}
};
// 2486
// Append Characters to String to Make Subsequence | ALGO | 0.999965 | 6.094575 |
2408664c-5b1c-41cc-a94b-1c15098a196e | raincross7/code-similarity | codes/train_code/problem246/problem246_409.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int N, T;
cin >> N >> T;
long long ans = 0;
vector<int> t(N); for(int i = 0; i < N; ++i) cin >> t[i];
for(int i = 0; i < N-1; ++i){
ans += min(T, t[i+1] - t[i]);
}
... | ALGO | 0.999972 | 3.634018 |
f83a8315-b671-42e2-bf1c-f6ef8825ced6 | ks0727/AtCoder-Archive | ABC/151-200/152/d.cpp | #include <iostream>
#include<cassert>
#include<algorithm>
using namespace std;
int main(){
int n;
cin >> n;
string ns = to_string(n);
long long ans = 0;
long long add = 1;
if(ns.size() >= 3){
long long now = 0;
for(int i=1;i<ns.size()-1;i++){
now = ns[i]-'0';
add *= now;
}
}
for... | ALGO | 0.998854 | 4.332578 |
a0176924-575f-46cb-9f9a-78c12d0248fc | pavellevap/code_antiplagiat | final_test/10/u156332_420_B_6444895.cpp | #include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <sstream>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;
#define sqr(x) ((x) * (x))
#define pb push_... | ALGO | 0.99997 | 3.113549 |
0af3d42d-9eea-4850-80eb-82de191c4c17 | KangInyeong/codetree-TILs | 240110/높은 수에서 낮은 수까지/from-high-to-low.cpp | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if(a>b){
for(int i=a; i>=b; i--) cout << i << ' ';
}else{
for(int i=b; i>=a; i--) cout << i << ' ';
}
return 0;
} | ALGO | 0.999735 | 3.575594 |
e55d6fb4-963c-46e2-a1e8-010968bb81e1 | george012/ltc_scrypt_go | src/scrypt.cpp | extern "C" {
#include "scrypt.h"
}
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <openssl/sha.h>
static inline uint32_t be32dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) +
((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 2... | ALGO | 0.974885 | 5.645777 |
d6fc3c87-9745-41a9-b5a8-9c1fe668dff5 | Sai-Suraj-27/cpp | starters43/4.cpp | #include <bits/stdc++.h>
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define F(i, a, n) for (ll i = a; i < n; i++)
#define B(i, a, n) for (ll i = n - 1; i >= a; i--)
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define vll vector<ll>
using namespace std... | ALGO | 0.999801 | 4.470707 |
dc834699-02ea-4a36-9ae4-4e0f99083d18 | mokezhang/eigen | bench/spbench/test_sparseLU.cpp | // Small bench routine for Eigen available in Eigen
// (C) Desire NUENTSA WAKAM, INRIA
#include <iostream>
#include <fstream>
#include <iomanip>
#include <unsupported/Eigen/SparseExtra>
#include <Eigen/SparseLU>
#include <bench/BenchTimer.h>
#ifdef EIGEN_METIS_SUPPORT
#include <Eigen/MetisSupport>
#endif
using namesp... | ALGO | 0.997135 | 4.270544 |
6837246b-7108-439f-97cb-7dfe1af35490 | EdimarJunior/CompositionalTioco | symbolrt/CVC4/src/theory/quantifiers/sygus/sygus_unif.cpp | /********************* */
#include "theory/quantifiers/sygus/sygus_unif.h"
#include "theory/quantifiers/sygus/term_database_sygus.h"
#include "theory/quantifiers/term_util.h"
#include "theory/quantifiers_engine.h"
#include "util/random.h"
using namespace std;
us... | ALGO | 0.99847 | 5.694744 |
6de8d6e5-115a-458b-b224-66bc31b27978 | JingKritsada/CodingPractice | ComProg/code_Exercise/code03/03_Loop_11.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
double n, sum = 0, cnt = 0;
while (n != -1)
{
cin >> n;
sum += n;
cnt++;
}
sum++;
cnt--;
if (cnt == 0)
{
cout << "No Data";
return 0;
}
double avg = sum / cnt;
cout << round(... | ALGO | 0.999853 | 3.865389 |
5cee7867-2de0-4dc7-a92d-f0d6e3a5c997 | Lemon-XQ/PAT-Basic | PAT-Basic-1005.cpp | #include <iostream>
#include <algorithm>
using namespace std;
struct student{
int stunum;
int de,cai;
int kind;// ɼ࣬
};
int H;
bool comp(student a,student b){
if(a.kind!=b.kind) return a.kind<b.kind;//
if(a.de+a.cai>b.de+b.cai) return true;
else if(a.de+a.cai==b.de+b.cai){
if(a.de>b.de) return true;// ²ܷͬ... | ALGO | 0.99971 | 3.295608 |
b62cb4ee-4211-4fa3-a351-b6abce73b582 | xiaohuihuigh/cpp | acm/hdu/5723.cpp | //#include<bits/stdc++.h>
//using namespace std;
//#define N 1000005
//#define ll long long
//vector<pair<int ,int > >V[N];
//struct node{
// int x,y,w;
//}p[N];
//int n,m,fa[N];
//double ans;
//bool cmp(node a,node b){
// return a.w<b.w;
//}
//int Find(int x){
// return x != fa[x]?fa[x] = Find(fa[x]):x;
//}
/... | ALGO | 0.999863 | 4.339806 |
54a394f7-afbb-44de-b361-7d8d9d15bdfe | SFU-HiAccel/rodinia-hls | Benchmarks/backprop/backprop_5_coalescing/back/src/local_support.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <string>
#include "backprop.h"
#include <CL/opencl.h>
#include "my_timer.h"
int INPUT_SIZE = 1;
extern void setup(cl_context& context, cl_command_queue& commands, cl_program& program, cl_kernel& kernel);
void bp... | ALGO | 0.95713 | 4.633389 |
8021dc10-00e3-44d9-aea7-a7ab298d087e | farzamdorostkar/amon | llvm-project-17.0.6.src/libcxx/test/std/algorithms/alg.nonmodifying/alg.find.end/ranges.find_end.pass.cpp | // <algorithm>
// UNSUPPORTED: c++03, c++11, c++14, c++17
// template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
// class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
// requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
// cons... | TEST | 0.957407 | 7.358946 |
c9a8f205-2e92-4782-9524-d75d7b156e6a | YoonChangKook/AlgorithmProblem | Boggle/main.cpp | /*
*** TEST CASES ***
PRETTY
URLPM
XPRET
GIAET
XTNZY
XOQRS
1 1
GIRL
URLPM
XPRET
GIAET
XTNZY
XOQRS
0 2
REPEAT
URLPM
XPRET
GIAET
XTNZY
XOQRS
2 1
YES
NNNNS
NEEEN
NEYEN
NEEEN
NNNNN
2 2
*/
#include <stdio.h>
#define SIZE 5
typedef struct Position
{
int x;
int y;
Position operator + (const Position& other) const
... | ALGO | 0.999791 | 4.375013 |
5b9df571-0d32-4cad-ba3e-7d8fb956cb55 | Aayushraj14/DSA | 0020-valid-parentheses/0020-valid-parentheses.cpp | class Solution {
public:
bool isValid(string s) {
stack<char>st;
for(int i=0;i<s.length();i++){
char ch=s[i];
if(st.empty() && (s[i]==')' || s[i]=='}' || s[i]==']'))return false;
else if(ch=='(' || ch=='{' || ch=='['){
st.push(ch);
}
... | ALGO | 0.99954 | 6.443923 |
70099ee4-4dfc-42f8-8fb2-633da736350e | ishandutta2007/codeforces | rfpermen/normal/601/C.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("tune=native")
//#pragma GCC optimize("unroll-loops")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=(n);i<=(N);++i)
#define For(i,n,N) for(int i=(n);i< (N);++i)
#define rap(i,n,N) for(int i... | ALGO | 0.999891 | 3.51877 |
f44862ab-520b-4723-b420-ce2b9b5ab204 | AanishRahmani/expenseTracker | 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.998756 | 6.772262 |
7a4c10ed-b23f-4d75-b766-a5ec4d69013b | ubcuas/SUAS-Controls-2024 | src/SUAS_Link_2024/src/util.cpp | #include "util.h"
#include "params.h"
#include "linker.h"
Drop_State::Drop_State() { // Deprecated
lat = 0;
lon = 0;
heading = 0;
}
// Approximations
double metersToLatitude(double meters) {
return meters / M_PER_LAT_DEG;
}
double metersToLongitude(double meters, double latitude) {
return mete... | TOOL | 0.96168 | 5.599362 |
09e40c05-8b82-43c3-b313-d06611733dc0 | leonovichka/Lab8_Leonovich | l8/Rational.cpp | #include "Header.h"
Rational::Rational() :
m_nominator{ 0 }, m_denominator{ 1 }{}
Rational::Rational(int x) :
m_nominator{ x }, m_denominator{ 1 }{}
Rational::Rational(int x, int y) :
m_nominator{ x }, m_denominator{ y }{Normalize();}
int Rational::Nominator() const
{
return m_nominator;
}
int Rational::Denomi... | TOOL | 0.851246 | 4.493886 |
38eb8ce4-84d3-450d-89c5-d62f3f848fa1 | satish-2002/basics | N_numbers.cpp | //cpp program to print n numbers and their sum
#include<iostream>
using namespace std;
void PrintNtoOne(int n)
{
if(n==0)
{
return;
}
cout<<n<<" ";
PrintNtoOne(n-1);
}
void PrintOnetoN(int n,int k=1)
{
if(n==0)
{
return;
}
cout<<k<<" ";
PrintOnetoN(n-1,k+1);
}
int getSum(int n)
{
if(n==0)
{
return 0;
... | ALGO | 0.993997 | 4.898934 |
64631fa0-b39c-4851-86b1-8642a9cec3a2 | renhaofan/Source-Archive | OpenCV/opencv-3.4.5/modules/cudaimgproc/src/hough_segments.cpp | #include "precomp.hpp"
using namespace cv;
using namespace cv::cuda;
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
Ptr<cuda::HoughSegmentDetector> cv::cuda::createHoughSegmentDetector(float, float, int, int, int) { throw_no_cuda(); return Ptr<HoughSegmentDetector>(); }
#else /* !defined (HAVE_CUDA) */
namesp... | ALGO | 0.850995 | 6.736634 |
6f3cd23f-a855-4662-83f2-57b237faad2f | AshvinBa/CPP_Programs-2 | Questions/GFG_Problem_of_the_day/padoVan_Sequence.cpp | /*
Padovan Sequence
Given a number n, find the nth number in the Padovan Sequence.
A Padovan Sequence is a sequence which is represented by the following recurrence relation
P(n) = P(n-2) + P(n-3)
P(0) = P(1) = P(2) = 1
Note: Since the output may be too large, compute the answer modulo 10^9+7.
Examples :
Input: n ... | ALGO | 0.99996 | 5.893424 |
cfe030b3-74dc-4400-a209-a09391788209 | tunardev/cp | Codeforces/191851861.cpp | // https://codeforces.com/contest/1791/submission/191851861
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 0x3F3F3F3F
#define mod (int)(1e9 + 7)
#define endl '\n'
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
string a = "codeforces";
in... | ALGO | 0.99988 | 4.850505 |
7cc4adc5-6734-4264-92db-a9b8483a0d10 | mdturin/CodeRed | 4 - Graph/Centroid of a Tree.cpp | #include<bits/stdc++.h>
using namespace std;
const int mx = 2e5 + 5;
int n, m;
vector<int> g[mx];
vector<int> Centroid(){
vector<int> ans, sz(n+1);
function<void(int,int)> dfs = [&](int u, int p){
sz[u] = 1;
bool is_centroid = true;
for(auto &v : g[u]){
if(v == p) contin... | ALGO | 0.999818 | 4.841842 |
ee6f8c4a-85e9-40e9-81fc-0b39fc8edd82 | gnaAndSeongpar/Algorithm | topcoder/0227/CirclesCountry_gna.cpp | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <tuple>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <climits>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <iostream>
using namespace std;
using ii = pair<in... | ALGO | 0.999624 | 4.443148 |
a1941762-d30b-427b-ba71-0a7080d5a01c | hotuanan/codeforces | 1486A - Shifting Stacks/main.cpp | #include <bits/stdc++.h>
#include <string>
using namespace std;
void solve()
{
int n;
cin >> n;
vector<int> v(n + 1);
for (int i = 0; i < n; i++)
cin >> v[i];
for (int i = 0; i < n; i++) {
if (v[i] == i) continue;
else if (v[i] < i) {
cout << "NO" << endl;... | ALGO | 0.999887 | 4.697707 |
8c1db347-a755-41b8-b5e6-5b26a8c89ea4 | Ayush7-BIT/turbo-robot | Algorithms/Line-Sweep-Algorithm.cpp | // Added function for solving time interval problem using Line Sweep Algorithm
int minGroups(vector<vector<int>>& intervals) {
map<int, int> pointToCount;
// Mark the starting and ending points in the map
for (vector<int> interval : intervals) {
pointToCount[interval[0]]++;
... | ALGO | 0.999982 | 6.005541 |
33ec3875-c479-4dce-92ee-11e0318a9ecd | easai/reverse-polish-notation | src/reverse-polish-notation.cpp | #include <iostream>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <string>
using namespace std;
// Function to perform arithmetic operations
int calculate(int y, int x, char op) {
switch (op) {
case '+':
return y + x;
case '-':
return y - x;
case... | ALGO | 0.993599 | 6.384082 |
54baf9d9-4183-447f-8e09-874b3df0e890 | PythonGithCode/pk | src/landscape.cpp | /** @file landscape.cpp Functions related to the landscape (slopes etc.). */
/** @defgroup SnowLineGroup Snowline functions and data structures */
#include "stdafx.h"
#include "heightmap.h"
#include "clear_map.h"
#include "spritecache.h"
#include "viewport_func.h"
#include "command_func.h"
#include "landscape.h"
#inc... | TOOL | 0.975954 | 5.138229 |
f9256a60-740c-40c6-a529-a329f6a44761 | alekela/CPP_bash_6sem | 2_homework/release/graph.cpp | #include "graph.h"
void Graph::add_vertex(initializer_list<int> input) {
if (_matrix.getSize() == 0) {
_matrix.addElem();
}
else {
_matrix.addElem();
int counter = 0;
int v, weight;
for (int i : input) {
if (counter % 2 == 0) {
v = i;
... | ALGO | 0.951577 | 4.315995 |
75c978d7-010f-4f83-b5d8-bf3c67f680f2 | Schr0Smi1ey/Codeforces | Problem Solving/1000/Array/B_Monsters.cpp | #include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define endl "\n"
#define int long long int
void solution()
{
int n , k;cin >> n >> k;
vector<pair<int,int>> arr;
vector<pair<int,int>> v;
for(int i=0;i<n;i++)
{
int x; cin >>... | ALGO | 0.999877 | 3.615666 |
d844ec0c-d8d3-4d9b-b8ab-80193779386e | kina111/Fundamental_DSA_C_Cpp | BasicC_DSA/DSA_usingC/Distribute_candies.cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int max(int a, int b)
{
return a<b?b:a;
}
long candies(int n, int arr_count, int* arr) {
int left[n], right[n];
for (int i = 0; i < n; i++){
left[i] = 1; right[i] = 1;
}
for (int i = 1; i < n; i++){
if (arr[i] > arr[i-1]) left... | ALGO | 0.999971 | 3.993299 |
6743c585-5a13-40d8-9479-61ba52435c3a | ck89119/Algorithm | Hiho/1310.cpp | #include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << __LINE__ << " : "<< #x << " = " << (x) << endl
#define clr(a, x) memset(a, x, sizeof(a)) //0:0, -1:-1, INF:0x3f, -INF:0xc0
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define lowbit(x) x & (-x)
typedef long long ll;
typedef pair<i... | ALGO | 0.999861 | 4.66232 |
debaa996-1c2c-42f1-8b85-119ca219de9d | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_11816_4.cpp | #include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
vector<pair<int, int> > v;
long long ways[2050], F[200005], Fi[200005];
long long po(long long a, long long b) {
long long r = 1;
while (b) {
if (b % 2) r = r * a % M;
a = a * a % M;
b /= 2;
}
return r;
}
void pre() {
F[0] ... | ALGO | 0.999979 | 4.441557 |
0cea72b4-73ea-4f81-9907-1711e88b83c1 | VishalChangder00789/Go_C- | Strings_Classes/StringSort.cpp | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
// do comparision based on lengths of the string
bool compare(string a, string b)
{
a.length() < b.length();
}
int main()
{
string s[100];
int n;
cin >> n;
cin.get();
for (int i = 0; i < n; i++)
{
get... | ALGO | 0.999714 | 3.623345 |
699d2342-d7b3-41bb-bcee-63ae4a3056ac | sailfishos-mirror/eigen-git-mirror | doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
m << 1,-2,
-3,4;
cout << "1-norm(m) = " << m.cwiseAbs().colwise().sum().maxCoeff()
<< " == " << m.colwise().lpNorm<1>().maxCoeff() << endl;
cout << "infty-norm(m... | ALGO | 0.999852 | 4.076589 |
fc593486-3dab-4e4f-86d2-649f3bffba8b | rishabhgargdps/coding_prep | amazon/partition_labels.cpp | class Solution
{
public:
vector<int> partitionLabels(string s)
{
vector<int> res;
int start = 0;
int end = 0;
unordered_map<char, vector<int>> m;
for (int i = 0; i < s.length(); i++)
{
m[s[i]].push_back(i);
}
while (end <= s.length() - ... | ALGO | 0.999757 | 5.943324 |
4b53f3a1-358b-4251-8953-1db1d8ca5494 | qkrtjdrbs/algorithm | 16928.cpp | #include <iostream>
#include <queue>
using namespace std;
int n,m,go[101],dist[101];
void bfs(){
queue<int> q;
dist[1]=0;
q.push(1);
while(!q.empty()){
int x=q.front(); q.pop();
for(int i=1;i<=6;i++){
if(dist[go[x+i]]==-1){
q.push(go[x+i]);
dis... | ALGO | 0.999859 | 4.070433 |
346ddce0-631e-41d1-b79b-fb06f248110f | iRobot42/Geeks-for-Geeks | Basic/Count number of equal pairs in a string.cpp | long long equalPairs( string s ) {
vector< int > h( 26 + 'a' );
for ( const char c : s ) ++h[ c ];
long long r{};
for ( const int i : h ) r += i * i;
return r;
} // T: 0.01+
| ALGO | 0.998992 | 4.812867 |
9dfcf4c0-65c4-4a6a-935a-e4d2bc2ab27c | dumitru1216/EeXOMI-Orig | CSGO SDK/aes/cryptopp/gost.cpp | #include "pch.h"
#include "gost.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
// these are the S-boxes given in Applied Cryptography 2nd Ed., p. 333
const byte GOST::Base::sBox[8][16]={
{4, 10, 9, 2, 13, 8, 0, 14, 6, 11, 1, 12, 7, 15, 5, 3},
{14, 11, 4, 12, 6, 13, 15, 10, 2, 3, 8, 1, 0, 7, 5, 9},
{5, 8, 1, 13, 10... | ALGO | 0.999417 | 7.498073 |
490d28f5-116e-41db-9944-c915af0381eb | brycemiller2/godot | thirdparty/rvo2/KdTree.cpp | #include "KdTree.h"
#include <algorithm>
#include "Agent.h"
#include "Definitions.h"
namespace RVO {
const size_t RVO_MAX_LEAF_SIZE = 10;
KdTree::KdTree() {}
void KdTree::buildAgentTree(std::vector<Agent *> agents) {
agents_.swap(agents);
if (!agents_.empty()) {
agentTree_.resize(2 * agents_.size(... | ALGO | 0.999062 | 6.264956 |
a9f543ce-f48d-4a10-bc4b-266976f26bec | kmjp/procon | atcoder/abc201-250/abc223/h.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999927 | 3.478457 |
a20e28da-c74e-47e8-a922-ef526548ea7f | dsiroky/conan-boost | boost_1_65_1/libs/compute/perf/perf_stl_set_intersection.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
std::vector<int> v1(std::floor... | ALGO | 0.956753 | 5.621977 |
69132a9f-a7a8-413a-87e1-3a2410d9f427 | SanchitPandey26/CPP | Patterns/8.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin >> n;
for (int i = n; i > 0; i--){
for (int k = 0; k < n-i; k++){
cout << ' ';
}
for (int j = 0; j < 2*i-1; j++){
cout << "*";
}
cout << endl;
}
}
| ALGO | 0.999984 | 3.759771 |
2a3094cc-f217-4119-959e-487f3905a4bb | NishantKumar14/Cpp | Pragrams/lab.cpp | #include<bits/stdc++.h>
#define endl "\n"
#define tab "\t"
#define conti(cont) cont.begin(), cont.end()
#define sort(s, l) sort(s.begin(), l.end())
#define ll long long int
#define vll vector<ll>
#define a_s arr.size()
#define mod 1000000007
#define fastio() ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nu... | ALGO | 0.996728 | 3.944412 |
ec3899d7-4559-4fe5-9616-b2ffcbde6d75 | dbywsc/xcpcCode | 数据结构/单调栈.cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main(void) {
int n; cin >> n;
stack<i64> s;
i64 ans = 0;
for(int i = 0; i < n; i++) {
int a; cin >> a;
//维护递减单调栈
while(s.size() && s.top() <= a) s.pop();
ans += s.size(); s.push(a);
}
cout <<... | ALGO | 0.9999 | 4.861029 |
4b09ed5a-a6f6-45e4-9e58-6fa7e8b763fe | sanchit-sinha/CP | Contests/Codeforces/CF-Contest/1598/D/sol.cpp | #include "bits/stdc++.h"
using namespace std;
#define f first
#define s second
#define pb push_back
#define ll long long
#define ld long double
#define lb lower_bound
#define ub upper_bound
#define m... | ALGO | 0.999922 | 4.007454 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.