uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
e4379e7f-d13b-4ee5-8798-cd6a45aa5ed7 | 0point1Zishan/CP | DSA Practice/Number_Theory/Practice/A_Segment_with_Small_Sum.cpp | #include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define nline "\n"
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ff first
#define ss second
#define int lon... | ALGO | 0.999952 | 4.373398 |
cf52ef60-1f8f-41cf-8930-f541e5c67999 | sashamigdal/LoopEquations | CPP/src/SamplesBinner.cpp | #define _USE_MATH_DEFINES
#include <vector>
#include <cstring>
#include <iostream>
#include <cassert>
#include <functional>
#include <algorithm>
#include <numeric>
#include <filesystem>
#include "SortedMerger.h"
namespace fs = std::filesystem;
using namespace std::string_literals;
bool SamplesBinner::ProcessSamplesDi... | DATA | 0.982342 | 5.067394 |
c7a94a3e-d4dc-4571-aa61-4d4df4227947 | SupreethiGajula/DataStructures | sllpractice2.cpp | #include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node *next;
};
struct node *newnode,*temp;
struct node *head = 0;
int choice = 1;
void create(){
while(choice){
newnode = (struct node*)malloc(sizeof(struct node));
printf("enter the data to be inserted:");
scanf("%d",&newnode->data);
newnode->next =... | ALGO | 0.999909 | 3.41049 |
6dcfa146-b54b-432a-b791-0a256164e1d5 | shreydevep/DSA | 532-k-diff-pairs-in-an-array/532-k-diff-pairs-in-an-array.cpp | class Solution {
public:
int findPairs(vector<int>& nums, int k) {
multiset<int> st;
set <pair<int,int>> res;
for(auto x : nums){
st.insert(x);
}
for(int i=0;i<nums.size();++i){
if(st.find(nums[i]) == st.end()) continue;
i... | ALGO | 0.999842 | 5.613498 |
698fbf12-644f-4c2a-82c2-bb69b4e7c51a | nirowu/leetcode-master | 0150-evaluate-reverse-polish-notation/0150-evaluate-reverse-polish-notation.cpp | class Solution {
public:
int evalRPN(vector<string>& tokens) {
stack <int> s;
for (int i = 0; i < tokens.size(); i++) {
int fst_num, sec_num;
if (tokens[i] == "+" ){
sec_num = s.top(); s.pop();
fst_num = s.top(); s.pop();
s.pu... | ALGO | 0.999903 | 6.16052 |
94213419-6963-4f1e-86e0-9c84ec26ae7d | jasemichael/ppm_cli_editor | color_table/JuliaSet.cpp | #include "JuliaSet.h"
#include <iostream>
JuliaSet::JuliaSet()
: ComplexFractal(), mA(-0.650492), mB(-0.478235){}
JuliaSet::JuliaSet( const int& height, const int& width, const double& min_x, const double& max_x, const double& min_y, const double& max_y, const double& a, const double& b )
: ComplexFractal(height,... | ALGO | 0.97552 | 5.220965 |
c0b22b2f-dd75-4243-856d-551d6171c6f9 | char-1ee/leetcode | data_structures/705-design-hashset.cpp | #include <bits/stdc++.h>
using namespace std;
class MyHashSet {
public:
MyHashSet() {
data.resize(1000, vector<bool>());
}
void add(int key) {
int hashKey = key % 1000;
if (data[hashKey].empty()) {
data[hashKey].resize(1000, false);
}
data[hashKey][key /... | ALGO | 0.997219 | 5.009447 |
69196d5c-29f1-4c23-8f0b-7e182f065cd4 | maverickreal/leetcode-solutions | Convert Level Order Traversal to BST - GFG/convert-level-order-traversal-to-bst.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node* right;
Node* left;
Node(int x){
data = x;
right = NULL;
left = NULL;
}
};
void preorderTraversal(Node* root)
{
if (!root)return;
cout << root... | ALGO | 0.999903 | 6.249579 |
3989d95c-fc46-4356-8fd8-c62e8fc711cd | anasjawed283/Strivers_A2Z_materials | STL/code20.cpp | //--------------------------------SET--------------------------------//
//----stores sorted and unique----//
#include<iostream>
#include<vector>
#include<math.h>
#include<string>
#include <set>
using namespace std;
//SET is container. It stores everything in sorted order and stores unique.
// if a value is already in ... | ALGO | 0.995977 | 4.859804 |
fb561234-a208-4360-960e-092ebb70f350 | qzqsmile/algorithm | leetcode/archived/C++/Best_time_to_buy_and_sell_stock.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int low , max = 0;
if(!prices.size())
return 0;
low = prices[0];
for(int i = 0; i < prices.size(); i++)
{
if(prices[i] <= low)
low = prices[i];
else
... | ALGO | 0.999711 | 6.127732 |
b078034b-742e-4032-92ba-153d5a007607 | pavanbaloju/data-structures-and-algorithms | trees/07.IsTreeBalanced.cpp | #include <iostream>
#include <vector>
using namespace std;
// Definition of a binary tree node
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
};
// Problem Statement:
// Given a binary tree, determine if it is height-balanced.
// ... | ALGO | 0.999995 | 7.600902 |
707b040c-9a20-4163-9c48-534563e9578f | v-zaburdaev/qrdetect | src/main.cpp | using namespace std;
using namespace cv;
int usage(char *program_name);
int thresh = 50;
const char* wndname = "src";
// helper function:
// finds a cosine of angle between vectors
// from pt0->pt1 and from pt0->pt2
double angle( CvPoint* pt1, CvPoint* pt2, CvPoint* pt0 )
{
double dx1 = pt1->x - pt0->x;
dou... | ALGO | 0.965624 | 3.431083 |
3bf25d28-66d1-405f-b2f3-ef37b450a1cf | Ariful-Islam010/Toc-Exam | NFA/2.NFA for strings starting with 'a'.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
int i,count;
while(1)
{
cout<<"Enter the string : ";
cin>>s;
count=0;
int len=s.length();
for(int i=0;i<len;i++)
{
if(s[i]=='a'||s[i]=='b')
continue;
e... | ALGO | 0.990174 | 3.960649 |
6b246836-0600-456d-980d-defdd72a04a3 | LuzCastelluber/Guia-2-Programaci-n-UPC-C- | Guia 2 Ejercicio 9/Guia 2 Ejercicio 9.cpp | // Guia 2 Ejercicio 9.cpp : Este archivo contiene la función "main". La ejecución del programa comienza y termina ahí.
//
#include <iostream>
#include <string>
using namespace std;
int main() {
string nombre;
int ataque, defensa, velocidad, vidaMax;
float critico;
cout << "Nombre del jugador: ";
... | TOOL | 0.937627 | 4.596579 |
2761033b-6ebb-41d3-a389-b3bf33380e7e | Rishi2k3/dsa-cpp | oops/linked_list_lec_44/delete_node.cpp | #include <iostream>
using namespace std;
class node
{
public:
int data;
node *next;
public:
// constructor
node(int d)
{
this->data = d;
this->next = NULL;
}
// destructor
};
void insertathead(node *&head, int d)
{
node *temp = new node(d);
temp->next = head... | ALGO | 0.999517 | 4.20934 |
8c612bca-a3c4-4fe6-8161-78b35fb50865 | edionu97/Algorithms-DataStructures-ContestsSolutions | Campion.ro/vanatorul.cpp | #include <iostream>
#include <fstream>
using namespace std;
ifstream f("vanatoare.in");
ofstream g("vanatoare.out");
long ka,kb,i;
void citire()
{f>>ka>>kb;}
long v[100000];
void formare(long v[100000],long ka,long kb,long&i)
{int ok=1,s=3;
v[1]=1;
v[2]=2;
i=2;
while(ok)
{i++;
v[i]=v[i-1]+v[i-2];
s=s+v[i];
i... | ALGO | 0.999856 | 3.236034 |
95946003-5535-4735-ab6a-bcac2cd2bc95 | LukasLeonardKoening/2D-Histogram-Filter | simulate.cpp | /**
simulate.cpp
Purpose: implements a Simulation class which
simulates a robot living in a 2D world. Relies
on localization code from localizer.py
*/
#include <algorithm>
#include "simulate.h"
#include "localizer.cpp"
/**
Constructor for the Simulation class.
*/
Simulation::Simulation(vector < vector <char> ... | ALGO | 0.997832 | 5.640027 |
15a3789c-a235-4028-b3c6-86565cbb01a8 | rishabh1507/data_structure_and_algorithm | c++/xplore360/stack/1_stack.cpp | #include <bits/stdc++.h>
using namespace std ;
void push(int &top,int val,int n,int arr[]){
if(top >= n-1){
cout<<"overflow";
}
else{
top++;
arr[top] = val;
}
}
void pop(int &top){
if(top <= -1){
cout<<"underflow";
}
else{
top--;
}
}
void top1(int arr[],int &... | ALGO | 0.993567 | 3.675779 |
a605bdcc-444e-40b5-8dc0-1aabecff86ff | yzzupgo/MFTCG | Data/abc170_b/mkondo/ac/26345894.cpp | #include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <fstream>
using namespace std;
int main()
{
int x, y;
cin >> x >> y;
for (int i = 0; i <= x; i++)
{
int j = x - i;
if (i * 2 + j * 4 == y)
{
cout << "Yes" << endl;
return 0;
}
}
cout <... | ALGO | 0.999975 | 3.124678 |
67e383e6-858e-433b-8ab6-f519f0685ff1 | Backstreet-05/Codeforces-Git | Contests/A_Soccer.cpp | #include <bits/stdc++.h>
using namespace std;
void inputAndOutput()
{
long long int x1, y1, x2, y2;
cin>>x1>>y1>>x2>>y2;
if ((x1>y1 && y2>x2) || (y1>x1 && x2>y2))
{
cout<<"NO"<<endl;
}
else cout <<"YES"<<endl;
return;
}
int main()
{
int t;
cin>>t;
for (int i=1; i<=t... | ALGO | 0.999466 | 3.433154 |
9fcbdabc-b7b6-4947-9aba-d817cbe3a470 | JustArs/MultiplyTrainer | exercise.cpp | #include "exercise.h"
void Exercise::init(int exerciseNumber, int mode, int speed)
{
data.mode = mode;
data.speed = speed;
data.exerciseNumber = exerciseNumber;
exerciseLeft = exerciseNumber; //N заданий осталось
exercisePassed = 0; //N заданий пройдено
data.mistakeNumber = 0;
data.correctN... | ALGO | 0.954986 | 3.806517 |
3e28708a-3a74-4259-8326-05b272f92440 | anshsharma43/Leetcode-repo | 124. Binary Tree Maximum Path Sum.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.999945 | 6.349042 |
19259278-24c5-432d-a1a7-c7ca35a17385 | crisantru/C-plus-plus | colas/cola.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
class NodoInt
{
int valor;
NodoInt *ptrSig;
public:
NodoInt(int valor)
{
this->valor = valor;
ptrSig = NULL;
}
int getValor()
{
return valor;
}
NodoIn... | ALGO | 0.99599 | 3.858866 |
4a152205-f7fe-423b-aa53-d03adc01ded9 | zjsxzy/HackerRank | Problem Solving/Algorithms/Graph Theory/Kingdom Connectivity/main.cpp | #include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int mod = 1000000000;
const int maxn = 10005;
const int maxm = 100005;
struct Edge {
int v, next;
}edge[2 * maxm], edge2[2 * maxm];
int N, M;
int low[maxn], dfn[maxn], cnt[ma... | ALGO | 0.999761 | 4.349313 |
5f0df3bd-8d5b-4712-9faa-534747fa8da0 | DrhF/ACM | Menshikov/Tr 7/7C/sol.cpp | #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <bitset>
#include <functional>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
using namespace std;
long long n;
int num=1;
l... | ALGO | 0.999913 | 3.358601 |
cf4897a4-6809-4ad1-a3ab-ef6549cd53f1 | ssatendra790/CP | B_Partial_Replacement.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef unsigned long long ull;
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define all(x) x.begin(), x.end()
#define fo(i, n) for (i = 0; i < n; i++)
#define foo(i, n) for (i = 1; i <= n; i++)
#define F first
#define S second
#def... | ALGO | 0.999861 | 3.565436 |
12867327-eb24-4ac3-bba3-be8ed03c8bb0 | SGGODE/lettcode-solved | 0334-increasing-triplet-subsequence/0334-increasing-triplet-subsequence.cpp | class Solution {
public:
bool increasingTriplet(vector<int>& nums) {
map<int,int>mp;
set<int>s;
for(auto&it:nums){
s.insert(it);
mp[it]++;
}
priority_queue<int,vector<int>,greater<int>>pq;
pq.push(nums[0]);
--mp[nums[0]];
if(mp[... | ALGO | 0.999985 | 5.669854 |
28ebded2-d5ee-4f1e-b2d4-dd9a828d6c49 | WA-King/icpctemplate | banzi/stirling_second.cpp | ll sb[maxn<<2],sr[maxn<<2];
// 计算 k!*S(n,k),k=0,1,2,...,n, 复杂度(n*log n)
void stirling_second(int n){
int len=NTT::init(2*n+2);
for(int i=1; i<=n; i++) sr[i]=qpow(i, n)*inv[i]%mod;
for(int i=0; i<=n; i++){
if(i&1) sb[i]=mod-inv[i];
else sb[i]=inv[i];
}
NTT::mul(sr,sb,len);
}
// 单独计算 m!*S(n,m) 复杂度 O(m*log n)
... | ALGO | 0.99998 | 3.564244 |
c5b214dd-3eca-46a1-9b10-f1043720bdb9 | ryanannis/snowy | extlib/eigen/doc/snippets/MatrixBase_all.cpp | Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones());
Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs();
// let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax:
cout << "Is (" << p0.transpose() << ") inside the box: "
<< ((boxMin.array()<p0.array(... | ALGO | 0.978181 | 3.495238 |
bdbfb788-9494-4328-9734-e45469294912 | jangyicheng/rucbase | src/analyze/analyze.cpp | #include "analyze.h"
/**
* @description: 分析器,进行语义分析和查询重写,需要检查不符合语义规定的部分
* @param {shared_ptr<ast::TreeNode>} parse parser生成的结果集
* @return {shared_ptr<Query>} Query
*/
std::shared_ptr<Query> Analyze::do_analyze(std::shared_ptr<ast::TreeNode> parse)
{
std::shared_ptr<Query> query = std::make_shared<Query>();
... | TOOL | 0.898006 | 4.679547 |
38e97965-d31a-417c-86f9-df84c71ec17e | ssearobber/boost_realize | libs/graph/example/accum-compile-times.cpp | namespace std
{
template < typename T >
std::istream& operator>>(std::istream& in, std::pair< T, T >& p)
{
in >> p.first >> p.second;
return in;
}
}
namespace boost
{
enum vertex_compile_cost_t
{
vertex_compile_cost
};
BOOST_INSTALL_PROPERTY(vertex, compile_cost);
}
using namespace boost;
typedef adjacen... | ALGO | 0.99152 | 4.707503 |
ab32ba8b-7f39-4e68-b3a7-aa0fe6adff53 | Shubhendra16660/1.java | C++/pattern29.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"enter number"<<endl;
cin>>n;
int C=1;
int row,col;
for(row=0;row<n;row++){
for(col=0;col<row;col++){
cout<<C;
C++;
if(col<row){
cout<<"*";
}
}
... | ALGO | 0.999882 | 3.215181 |
b0019791-7b3a-4139-b4ee-71fc83b9635f | sarvex/leetcode-hack | solution/1700-1799/1763.Longest Nice Substring/Solution.cpp | class Solution {
public:
string longestNiceSubstring(string s) {
int n = s.size();
int k = -1, mx = 0;
for (int i = 0; i < n; ++i) {
int lower = 0, upper = 0;
for (int j = i; j < n; ++j) {
char c = s[j];
if (islower(c))
... | ALGO | 0.999966 | 6.320702 |
2ce7df0b-d5cc-4ae6-8554-a04b420ffc7a | ishandutta2007/codeforces | rednextcentury/normal/253/D.cpp | #include <bits/stdc++.h>
using namespace std;
char a[1000][1000];
int b[401][401][26];
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n,m,k;
cin>>n>>m>>k;
getchar();
for (int i=1;i<=n;i++){
for (int j=1;j<=m;j++){
a[i][j]=getchar();
... | ALGO | 0.999978 | 3.431927 |
f6778444-eac5-4b8d-9035-00a0c914f84a | CodingRohanX/C- | 0 Practice/65 Leetcode LinkedList.cpp | #include <iostream>
using namespace std;
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) {}
};
void insertAtTail(ListNode *&head, int val)
{
ListNode *n = new ListNo... | ALGO | 0.999961 | 5.955446 |
b1bb9d32-40a3-4a6f-90c5-dcadacb95db0 | SammedKusanale/sem8 | HPC/h4_1_.cpp | #include <iostream>
#include <cstdlib>
#include <cuda_runtime.h>
// Kernel function for vector addition
__global__ void vectorAddition(const int* a, const int* b, int* result, int size) {
int tid = blockIdx.x * blockDim.x + threadIdx.x;
if (tid < size) {
result[tid] = a[tid] + b[tid];
}
}
int mai... | ALGO | 0.995096 | 6.191681 |
eaea4ccb-a75c-46b2-8d94-1f7671d973ae | shu-bha-m-patil/DSA | DataStructures/30_Hashing/CountDistinctElements.cpp | #include <iostream>
#include <unordered_set>
int main()
{
int arr[10] = {0,2,2,4,4,6,6,8,8,9};
// std::unordered_set<int> unorderedSet;
// for (size_t i = 0; i < 10; i++)
// {
// unorderedSet.insert(arr, arr + 10);
// }
std::unordered_set<int> unorderedSet(arr, arr + 10);
std::cout... | CONFIG | 0.958716 | 4.164844 |
1a153d84-fbf5-4211-b379-ca32c6e8ddb2 | TheFenrisLycaon/DSA-C-- | cp/CodeForces/0001-0099/15A.cpp | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
std::ios_base::sync_with_stdio(false);
int n, t; std::cin >> n >> t;
std::vector<std::pair<double, double> > v(n);
for(int p = 0; p < n; p++){
double x, a; std::cin >> x >> a;
v[p] = std::make_pair(x - a / 2.0, x + ... | ALGO | 0.999888 | 4.323814 |
fe96683d-5b5a-4609-a44a-dd56f0f99191 | sachin6377Tyagi/leetsubmission | 200-number-of-islands/number-of-islands.cpp | class Solution {
public:
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
void dfs(int i,int j,int n,int m, vector<vector<bool>>&vis,vector<vector<char>>& grid){
if(i>=0&&i<n&&j>=0&&j<m&&vis[i][j]==0&&grid[i][j]=='1'){
vis[i][j]=1;
for(int k=0;k<4;++k){
int x=i+dx[k];
int y=j+dy[... | ALGO | 0.999991 | 6.564464 |
250b134b-2a58-4f68-899a-83f3aa046539 | ArnabC27/leetcode_daily_2024 | 515. Find Largest Value in Each Tree Row.cpp | class Solution {
public:
vector<int> largestValues(TreeNode* root) {
if (root == nullptr)
return {};
vector<int> ans;
queue<TreeNode*> q{{root}};
while (!q.empty()) {
int mx = INT_MIN;
for (int sz = q.size(); sz > 0; --sz) {
TreeNode* node = q.front();
q.pop();
... | ALGO | 0.999981 | 6.878423 |
e1b82c4d-e242-4b52-9fc3-ca1d279dcafe | huutai2806/CTDL-GT | bai16.cpp | #include <iostream>
double sumPositive(double arr[], int n) {
if (n == 0) { // Trường hợp cơ sở
return 0;
} else {
double sum = sumPositive(arr, n-1);
if (arr[n-1] > 0) {
sum += arr[n-1];
}
return sum;
}
}
int main() {
double arr[] = {1.2, -2.5, 3.7,... | ALGO | 0.999986 | 4.163853 |
13bcb30c-2214-4811-96b2-b4272266b957 | Vrdko93/Tic-Tac-Toe | Tic-Tac-Toe.cpp | #include <iostream>
#include "tic_tac_toe.h"
using namespace std;
void TicTacToe::play()
{
int my_row, my_col;
player1_turn = true;
display();
do
{
if (player1_turn)
cout << "Player 1: select a row and column number between 1 and 3 to mark 'X' on the grid: ";
else if (player2_turn)
cout << "Player 2: s... | ALGO | 0.923806 | 4.621399 |
54565372-a3a7-4fd7-9967-ae9aa6a9e3c4 | Mf-ff99/px4-autopilot | src/modules/navigator/GeofenceBreachAvoidance/geofence_breach_avoidance.cpp | #include "geofence_breach_avoidance.h"
#include <lib/geo/geo.h>
#include <motion_planning/VelocitySmoothing.hpp>
using Vector2d = matrix::Vector2<double>;
GeofenceBreachAvoidance::GeofenceBreachAvoidance(ModuleParams *parent) :
ModuleParams(parent)
{
_paramHandle.param_mpc_jerk_max = param_find("MPC_JERK_MAX");
_p... | TOOL | 0.921935 | 6.103031 |
0a4ad7d0-8b93-4f20-851e-c54387ad9ff0 | cy2016-1/robo-butler-r | controllers/tinyscretch/eigen/failtest/colpivqr_int.cpp | #include "../Eigen/QR"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
ColPivHouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| TEST | 0.93412 | 3.159166 |
08934e26-e9f3-4ca1-b0f1-3ffc963bb7da | BRIJESH6063/DataStructures | Graph January 2023/minMultiplication/MinMultiplication.cpp | #include<bits/stdc++.h>
#include<time.h>
using namespace std;
// Minimum multiplication to reach end ..
// Check a number product with every other number of array leading to target
int minMultiplication(vector<int> &arr, int start, int end) {
queue<pair<int, int>> q ;
q.push({start, 0}) ;
vector<int> dis... | ALGO | 0.999965 | 3.800512 |
bd561f65-2f2d-446e-8412-59c373f8baae | harshitcodez19/All-About-DSA | Leetcode-Questions/DP/213.cpp | class Solution {
public:
int solution (vector<int>& arr){
int n = arr.size();
int prev= arr[0];
int prev2=0;
for( int i =1 ;i<n;i++){
int take = arr[i];
if(i >1) {
take+= prev2;
}
int notTake = prev +0;
in... | ALGO | 0.999979 | 5.485878 |
ef9d7745-6963-4781-9b4d-f699bcaf1cf9 | PalakA05/daily_code | ODDPAIRS.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
long long int n;
cin>>n;
// for(int i=1;i<=n;i++)
// {
// for(int j=1;j<=n;j++)
// {
// if((i+j)%2!=0)
// {
// cnt++;
// }
... | ALGO | 0.999473 | 4.906137 |
a42119fb-d80d-4ffb-a242-577e79d2cef5 | sinian666/code_102_5 | cpp_副本52/chapter_hashing/array_hash_map.cpp | /**
* File: array_hash_map.cpp
* Created Time: 2022-12-14
* Author: msk397 (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 键值对 int->String */
struct Entry {
public:
int key;
string val;
Entry(int key, string val) {
this->key = key;
this->val = val;
}
};
/* 基于数组简易实现的哈希表 */
class A... | TOOL | 0.937965 | 5.642146 |
829fd98c-42da-446b-8c5f-55bfcf83f891 | Lukeaalbert/basic_2d_physics_engine | src/main.cpp | #include <vector>
#include <math.h>
#include <random>
#include <ctime>
#include "SFML/Graphics.hpp"
#include "verlet_solver.hpp"
#include "renderer.hpp"
std::array<sf::Color, 6> COLORS = {
sf::Color(255, 99, 71),
sf::Color(255, 165, 0),
sf::Color(255, 223, 0),
sf::Color(60, 179, 113),
sf::Color(70... | ALGO | 0.993759 | 4.783503 |
7de98434-af07-487f-8495-e547e3aebbf6 | POMA7213/my_code | DataStructures/segment_tree.cpp | #include <iostream>
#include <vector>
class SegmentTree {
public:
explicit SegmentTree(const std::vector<int64_t> &arr) : arr_(arr) {
tree_sum_.assign(4 * arr.size() + 4, 0);
tree_min_.assign(4 * arr.size() + 4, 0);
tree_max_.assign(4 * arr.size() + 4, 0);
DoBuild(arr, tree_sum_, 1,... | ALGO | 0.999478 | 6.048824 |
d4c883ec-34fa-437b-9310-905848ad3c13 | r4pidstart/problems | by_category/geometry/2536.cpp | // https://www.acmicpc.net/problem/2536
// 2023-11-29 03:33:18
#include"bits/stdc++.h"
using namespace std;
struct intersect
{
static inline double ccw(pair<long,long> a, pair<long,long> b, pair<long,long> c)
{
return (a.first*b.second)+(b.first*c.second)+(c.first*a.second)-(b.first*a.second)-(c.first*... | ALGO | 0.999875 | 5.02175 |
be3338a7-6314-4a23-836d-c8ca0ee64168 | surajmate007/700_Topicwise_DSA_Solved_Problems | 01_Arrays/Extra_22_Remove_Zero_Sum_Consecutive_Nodes_From_LL.cpp | // this solution can tell us how to remove all subarrays from an array with sum 0.
class Solution {
public:
ListNode* removeZeroSumSublists(ListNode* head) {
ListNode node = ListNode(0, head);
ListNode* temp = &node;
int sum = 0;
unordered_map<int, ListNode*> mp;
while(temp... | ALGO | 0.999652 | 5.898325 |
11c0fe2f-fc51-4566-b54e-eef544b0fe5b | immaksudalam/LinkList-Template | Remove duplicates from shorted list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* deleteDupli... | ALGO | 0.999943 | 5.683021 |
d2c29f1b-d966-4ff3-acd9-8f63313e0efa | icecat2012/leetcode | problems/289. Game of Life/solve.cpp | class Solution {
public:
int check(vector<vector<int>>& board, int i, int j)
{
if(i<0||j<0||i>=board.size()||j>=board[0].size()) return 0;
return board[i][j] & 1;
}
void update(vector<vector<int>>& board, int i, int j)
{
int cnt=0;
cnt+=check(board, i-1, j-1);
... | ALGO | 0.99987 | 6.073714 |
13addcdd-e054-46e9-940f-0ddea82fd694 | codulluiandrei/pbinfo | pbinfo-848/main.cpp | #include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("paranteze1.in");
ofstream fout("paranteze1.out");
int n;
char s[256];
int main()
{
fin >> n;
for(int k = 1 ; k <= n ; k ++)
{
fin >> s;
int ok = 1;
int nivel = 0;
for(int i = 0 ; s[i] && ok ; i ++)
if(s[i] == '(')... | ALGO | 0.999707 | 3.674964 |
addbf617-d3f4-49eb-a291-05ba8e9d2c41 | muhammadyaseen01/DSA | Linked_List/extra.cpp | void display()
{
Node *curr = new Node(); // memory allocation //Node* curr = head2 ------> aisy bhi kr sakte direct
curr = head2; // inintialize a current pointer which traverse and print dones value one by one
// Node* curr =head2;
cout << "\n List is: ";
while (curr != NULL)
... | ALGO | 0.929076 | 3.074502 |
e20ffc50-c800-47e7-83ff-8ecae45813aa | acenelio/curso-algoritmos | cpp/soma_linhas.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main(){
int m, n;
double somalinha;
cout << "Qual a quantidade de linhas da matriz? ";
cin >> m;
cout << "Qual a quantidade de colunas da matriz? ";
cin >> n;
double matriz[m][n], vetor[m];
for (int i=0; i<m; i++) {
... | ALGO | 0.989508 | 3.806212 |
d65ab305-e281-46dd-bb2c-b6440cfd669b | Gustavo-Jodar/Programmation_Parallele | ProjetENSTA2023/ProjetEnsta2023_Q2/src/runge_kutta.cpp | #include <iostream>
#include "runge_kutta.hpp"
#include "cartesian_grid_of_speed.hpp"
#include <chrono>
#if defined(_OPENMP)
#include <omp.h>
#endif
using namespace Geometry;
Geometry::CloudOfPoints
Numeric::solve_RK4_fixed_vortices( double dt, CartesianGridOfSpeed const& t_velocity, Geometry::CloudOfPoints const& t_... | ALGO | 0.999953 | 3.739559 |
830f5e24-e3d4-4c87-9f32-092a4a80c930 | shjzhang/PPPBox | lib/Geomatics/random.cpp | #pragma ident "$Id$"
/**
* @file random.cpp
* Simple random number generator.
*/
// -----------------------------------------------------------------------------
#include <iostream>
#include <iomanip>
#include <cmath>
#include <ctime>
#include "random.hpp"
using namespace std;
// -------------------------------... | ALGO | 0.990042 | 6.27802 |
5345a9f0-d8e6-47e7-8181-881ae0cc6544 | Ashutosh0024/LeetCode-Solution | 9-palindrome-number/9-palindrome-number.cpp | class Solution {
public:
bool isPalindrome(int x) {
int digit;
int ans=x;
long long int a=0;
while(x!=0){
digit=x%10;
a=a*10 + digit;
x=x/10;
}
if(ans==a && ans>=0){
return true;
}
return false;
}
}; | ALGO | 0.999957 | 5.770433 |
684472b9-04d6-49c9-8721-b2dbde55563c | kushaltiwari18/C-PW | Questions/Hashmap/Hashmap_Question/makeStringEqual62.cpp | /* Can you make the strings equal?
Given an array of string, You can move any number of characters from one string to any another string any number of time. you just have to make all of the strings equal. Print "Yes" if you can make every string in the array qual by using any number of operations otherwise print "No".
... | ALGO | 0.999974 | 5.404418 |
3599ca2e-cfbe-421b-a3bb-f658a4a8a3af | thisisbabul/uri-online-judge-solutions | 1040.cpp | #include<iostream>
#include<iomanip>
using namespace std;
int main(){
float a, b, c, d, e, avg;
cin>>a>>b>>c>>d;
avg=(a*2+b*3+c*4+d*1)/10;
cout<<"Media: "<<fixed<<setprecision(1)<<avg<<endl;
if(avg>=7){
cout<<"Aluno aprovado."<<endl;
}
else if(avg<5){
cout<<"Aluno reprovado."... | ALGO | 0.99797 | 3.531074 |
c2d60424-3238-4b66-8314-9b96a3462cfa | NirmalKAhirwar/leetcode | product-of-array-except-self/product-of-array-except-self.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int n = nums.size();
vector<int> output(n);
output[0] = 1;
for(int i=1; i<n; i++){
output[i] = output[i-1] * nums[i-1];
}
int right = 1;
for(int i=n-1; i>=0; i--){
... | ALGO | 0.999965 | 6.194231 |
2806992f-cf74-4358-a259-434151df577f | Jackson-Mu/HotelFinder-Application | hashtable.cpp | //============================================================================
// Name : Hotel Finder
// Author : Jackson Mukeshimana
// Version : 1.0
// Date Created : 25-11-2023
// Date Modified: 12-12-2023
// Description : Hotel Finder Application Program
//======================================... | ALGO | 0.978331 | 5.775125 |
4f8891b8-f98b-4475-b060-ddcf4c3c948a | heart-org/leecode | 40.cpp | #include "iostream"
#include "queue"
#include "stack"
#include "vector"
#include "algorithm"
#include "cstring"
#include "cmath"
#include "set"
#include "map"
#include "numeric"
#include "unordered_set"
#include "unordered_map"
#include "array"
#include "cctype"
#include "list"
using namespace std;
using vecContainer... | ALGO | 0.999989 | 5.964197 |
981bda07-2465-43e0-8b8a-6dab44fb3a95 | CrimsonTheLegoBuilder/MyBaekjoonSolve | Cpp/boj_solve/boj27718_geo_intersect.cpp | #include <iostream>
#include <algorithm>
typedef long long ll;
const int LEN = 2'001;
int N;// , T[LEN][LEN]{ 0 };
struct Pos {
ll x, y;
bool operator == (const Pos& p) const { return x == p.x && y == p.y; }
};
struct Seg { Pos l, r; } segs[LEN];
bool parallel(const Seg& s1, const Seg& s2) {
ll ccw = (s1.r.x - s1.... | ALGO | 0.999812 | 4.04614 |
6c38ebab-c632-4192-99e1-df377495e626 | PedroAugustooss/Hangman-Game | Jogo da Forca/Chutes_Errados.cpp | #pragma once
#include "Assinaturas.hpp"
inline int Chutes_Errados(const std::string& palavra_secreta, const std::vector <char>& chutes_dados, std::array <char, 7>& chutes_errados, int& indice) {
int erros = 0;
for (char chute : chutes_dados) {
bool existe = false;
for (char letra : palavra... | ALGO | 0.986676 | 4.68434 |
c37c6ee6-672d-4ce5-b770-5e8f8f6f5898 | AshwinkumarPillai/LeetCode | Problems/1455_Check_If_a_Word_Occurs_As_a_Prefix_of_Any_Word_in_a_Sentence.cpp | class Solution
{
public:
int isPrefixOfWord(string sentence, string searchWord)
{
int wordIndex = 1, currIndex = 0, n = sentence.size();
int searchIndex = 0, sn = searchWord.size();
while (currIndex < n)
{
if (searchWord[searchIndex] == sentence[currIndex])
... | ALGO | 0.999884 | 5.644238 |
9d0aa28d-f6a7-4434-822e-5b08b29c64d2 | quangduymanh/Qu-ng-Duy-M-nh_ENG-KS24B_Dev-C_Session-05 | session 05- bài 03.cpp | #include <stdio.h>
int main() {
int n, tong = 0;
do {
printf("Nhap so nguyen duong: ");
scanf("%d", &n);
} while (n <= 0);
for (int i = 1; i <= n; i++) tong += i;
printf("Tong tu 1 den %d la: %d\n", n, tong);
return 0;
}
| ALGO | 0.956561 | 3.086518 |
2f8092cd-3a31-4bac-af40-785f2d2941b4 | fushime2/competitive | AOJ/aoj1180.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SZ(x) (int)(x).size()
#define pb push_back
void solve(string s, int l) {
vector<string> v;
for(int i=0... | ALGO | 0.999675 | 3.071375 |
d72eb911-3f3a-4d1f-9243-d3d2f79ee12a | kitt238/dp-Luogu | 传球游戏.cpp | #include<iostream>
#define INF 0x7fffffff
#define int long long
using namespace std;
int n, m;
int a[2][32];
void add(int cnt, int p) {
if (p == 0)
a[cnt % 2][p] = a[(cnt - 1) % 2][p + 1] + a[(cnt - 1) % 2][n - 1];
else if (p == n - 1)
a[cnt % 2][p] = a[(cnt - 1) % 2][0] + a[(cnt - 1) % 2][p - ... | ALGO | 0.999968 | 3.266834 |
7ae05d03-8b98-48a0-a84d-d0f210548bd5 | FabianLangkabel/Jellyfish | Plugins/QuantumComputing/Lib/src/laser.cpp | #include "../header/laser.h"
namespace QC
{
// returns electric field strengths (x,y,z) of Laser at time t
std::vector<double> Laser::get_field_strengths(double time) {
std::vector<double> output;
switch (m_type) {
case LaserType::Trapezoid: {
std::vector<double> Field_Strength_Vector;
for (int i = 0; i... | TOOL | 0.897019 | 4.195239 |
f0cf87dc-6b2f-4bab-b2e8-79938be6dcbb | ishandutta2007/codeforces | chenjb/normal/913/B.cpp | #include<bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;++i)
#define N 100005
using namespace std;
int b[N],v[N],f[N],n,m,tot;
int main(){
scanf("%d",&n);
rep(i,n-1)scanf("%d",v+i),++b[v[i]];
rep(i,n)if(!b[i])++f[v[i-1]];
rep(i,n)if(b[i]&&f[i]<3){puts("No");return 0;}
puts("Yes");
//system("pause");
return 0;
... | ALGO | 0.999991 | 3.514172 |
45618f7a-5ad9-4065-8e87-1b2775d8b825 | Safwan-Ibrahim/CPP | Codeforces Ratingwise/1100/B_Shifting_Sort.cpp | // Created on: 2025-02-02 01:10
// Author: Safwan_Ibrahim
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
void solve() {
int n; cin >> n;
vector<int>A(n);
for (int i = 0; i < n; i++) {
cin >> A[i];
}
vector<array<int, 3>>Ans;
for (int i = 1; ... | ALGO | 0.999686 | 4.156683 |
29ae4012-2550-422c-879b-5a88c51f90cb | squaresLab/BatFix | results/transcoder/results/java/syntax/FIND_THE_NUMBER_OCCURRING_ODD_NUMBER_OF_TIMES_1.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <queue>
#include <fstream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>
#include <algorithm>
using namespace std;
int f_gold (... | ALGO | 0.999567 | 5.439387 |
538be8ab-0e19-462b-8aed-1afd49504759 | OptimusRahul/data-structrues-and-algorithms | data-structures/a) basic/recursion/palindrome.cpp | #include <bits/stdc++.h>
using namespace std;
bool isPalindromeHelper(int start, int end, string &str)
{
if(start >= end/2) return true;
if (str[start] != str[end]) return false;
return isPalindromeHelper(start + 1, end - 1, str);
}
bool isPalindrome(string &str)
{
// Write your code here.
return ... | ALGO | 0.99999 | 5.862018 |
655be2ad-8371-4a4d-864d-8691e873dae8 | Jakex2018/shoes_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.9988 | 6.76073 |
811e7b1f-c27d-4e7d-9557-dfba3c67f30a | andreihaivas6/OOP-Labs | S2/Numar/main/main.cpp | // main.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "NumberList.h"
#include <stdio.h>
#include "NumberList.h"
using namespace std;
int main()
{
NumberList x;
x.Init();
for (int i = 15; i >= 10; --i)
x.Add(i);
x.Add(5);
x.Sort();
x.Print();
return 0;
} | ALGO | 0.947286 | 4.297054 |
b50f4816-26ee-43c9-9e36-3eff6e700ab1 | AmericanoHoney/barcode | core/src/oned/ODDataBarReader.cpp | #include "ODDataBarReader.h"
#include "BarcodeFormat.h"
#include "DecoderResult.h"
#include "GTIN.h"
#include "ODDataBarCommon.h"
#include "Result.h"
#include <cmath>
#include <unordered_set>
namespace ZXing::OneD {
using namespace DataBar;
static bool IsCharacterPair(PatternView v, int modsLeft, int modsRight)
{
... | ALGO | 0.866819 | 6.850015 |
cb8aca7b-c3d0-467b-968f-5b57734d9e40 | Sajal072004/Dsa-practice-for-interviews | CSES/Sorting and Searching/FerrisWheel.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,x;
cin >> n >> x;
vector<int>arr(n);
for(int i = 0; i<n; i++) cin >> arr[i];
sort(arr.begin(),arr.end());
int i = 0; int j = n-1; int ans = 0;
while(i<=j){
if(arr[i] + arr[j] <= x) {
ans++; i++; j--;
}
else {
ans++; ... | ALGO | 0.999973 | 4.245308 |
613010d7-cdaf-48c3-8693-8ecfd136f201 | umaidansari12/CP | previous_codes/rating_and_laptop.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
int price[n], rating[n];
vector<pair<int, int>> laptop(n);
for (int i = 0; i < n; i++)
{
cin >> price[i];
cin >> rating[i];
laptop[i] = ma... | ALGO | 0.999745 | 4.333039 |
c189562a-81a4-4952-a8b1-0ca42bc003f5 | RashakDude/codeforces | CPP solutions/381A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int num;
cin >> num;
int arr[num];
for(int i=0;i<num;i++) cin >> arr[i];
int s=0,t=0;
int left = 0, right = num-1;
bool test = true;
while(left<=right){
if(test){
if(arr[left]>arr[right]){
s+=a... | ALGO | 0.999989 | 3.641448 |
56125f2c-d70f-4d2b-b50f-6cbe7826a16d | Koyingtw/CP | CF practice/1855D.cpp | #include <bits/stdc++.h>
#define Weakoying ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define int long long
#define ll long long
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pqueue priority_queue
#define pb push_back
#define F first
#define S second
#define max(a, ... | ALGO | 0.999953 | 3.986756 |
413edc3b-a636-498d-9133-884b24ab80f2 | mkbn-consultancy/modern_cpp | lambda expressions/9_lambda_capture_exercise.cpp | //-------- MKBN Training and Consultancy --------//
//--------------- <EMAIL> ---------------//
#include<iostream>
#include<vector>
#include<algorithm>
//SUM ALL POSITIVE NUMBERS IN RANGE
int main()
{
std::vector<int> vec{ 1,-2,3,-4,5,6,-7,8 };
int sum = 0;
//C++98 style
std::for_each(vec.begin()... | ALGO | 0.999557 | 4.048402 |
d366850b-72d5-4feb-aaad-96025151a7d5 | ShanksSU/codewars | 6kyu/Equal Sides Of An Array/main.cpp | /*
https://www.codewars.com/kata/5679aa472b8f57fb8c000047/cpp
*/
int find_even_index(const std::vector<int> numbers) {
for (int i = 0; i < numbers.size(); i++) {
int num1 = 0, num2 = 0;
for (int j = 0; j < i; j++)
num1 += numbers[j];
for (int k = numbers.size() - 1; k > i; --... | ALGO | 0.999745 | 6.004572 |
4a6c9cb0-97f3-4418-bc8a-8f581da976db | vinayak0505/Data-Structures | Count All Possible Routes.cpp | #include "vector"
#include "unordered_map"
using namespace std;
class Solution {
int mod(int a){
return a > 0 ? a : -a;
}
const int MOD = 1e9 + 7;
unordered_map<int,unordered_map<int,int>> dp;
public:
int countRoutes(vector<int>& locations, int start, int finish, int fuel) {
if(dp[... | ALGO | 0.999878 | 5.40724 |
60001010-abb5-4043-9437-6b9f7655653d | Singularity-MX/Life-Up-Mobile-flutter | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
faf9b12b-63f0-48ef-a3c4-5b2b7b9d8563 | tspink/stacsos | kernel/src/sched/alg/rr.cpp | #include <stacsos/kernel/sched/alg/rr.h>
// *** COURSEWORK NOTE *** //
// This will be where you are implementing your round-robin scheduling algorithm.
// Please edit this file in any way you see fit. You may also edit the rr.h
// header file.
using namespace stacsos::kernel::sched;
using namespace stacsos::kernel:... | ALGO | 0.986337 | 3.790959 |
fbe3e92e-2e3e-49f9-9a9f-b5e6ffc25a1f | PranjalShinde16/Codeforces | Ladder A/87.Mike and Fax.cpp | #include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long
using namespace std;
int main()
{
fast;
string str;
int k;
cin>>str>>k;
int l = str.length();
if(l%k!=0){cout<<"NO";return 0;}
int len = l/k;
int p=0;
for(int j=0;j<k;j++){
... | ALGO | 0.999997 | 3.991459 |
fc495cf8-54f5-419d-834a-b0b30e4b6c42 | mingkaic/DataStructures | Algorithm/Structure/RBTree.cpp | #ifdef __RB_TREE__H
template <class T>
void RBTree<T>::deleteFixUp(pTreeNode<pair<bool, T> >* parent, bool childIsLeft)
{
pTreeNode<pair<bool, T> >* child;
pTreeNode<pair<bool, T> >* sibling;
child = childIsLeft ? parent->left : parent->right;
while (child != this->root && (NULL == child || is... | ALGO | 0.999223 | 5.330031 |
7aa921b3-6e39-4544-8a93-978a4d250258 | ragibshahrier/cp | Contests/Eid/p5.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pair<int,int>>
#define rep(ii,st, n) for(int ii=st; i<n; i++)
#define gp <<" "
//#define DEBG
#define debug(n)
#ifdef DEBG
#define debug... | ALGO | 0.999943 | 4.104409 |
996aa84c-a820-4fda-9136-7c2f8e38385a | nicelxm/algriothm | leetcode/m_克隆图.cpp | //https://leetcode-cn.com/problems/clone-graph/
/*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> neighbors;
Node() {
val = 0;
neighbors = vector<Node*>();
}
Node(int _val) {
val = _val;
neighbors = vector<Node*>();
}
Node... | ALGO | 0.999822 | 6.268261 |
938bbb11-2695-48d5-a8ff-adb4cd155681 | shenghuanjie/poj | problems/2729_求12以内n的阶乘.cpp | /*
2729: 求12以内n的阶乘
http://bailian.openjudge.cn/practice/2729/
描述
求12以内n的阶乘。
输入
只有一行输入,整数n(n<=12)。
输出
只有一行输出,数值n!。
样例输入
3
样例输出
6
来源
JP06
*/
#include<iostream>
using namespace std;
int main()
{
int n;
unsigned result=1;
cin>>n;
for(;n>1;n--)
{
result*=n;
}
cout<<result<<endl;
return 0;
}
| ALGO | 0.999804 | 4.557942 |
7f2a69e1-bab6-49cd-b2d0-f195ed680b99 | Cyb3r-0/Face-Recognition | opencv-master/modules/gapi/src/backends/cpu/gnnparsers.cpp | #include "gnnparsers.hpp"
namespace cv
{
namespace gapi
{
namespace nn
{
class YoloParser
{
public:
YoloParser(const float* out, const int side, const int lcoords, const int lclasses)
: m_out(out), m_side(side), m_lcoords(lcoords), m_lclasses(lclasses)
{}
float scale(const int i, const int b)
... | TOOL | 0.993755 | 5.824342 |
06b08e9d-7f65-4de1-abf7-c15e35f89e26 | Riodsa/CompetitiveProgramming | ComProg/06_Vector_33.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct party
{
double remainder;
double ans;
double ss;
string name;
bool operator<(const party &x)&{
if(remainder != x.remainder) return remainder > x.remainder;
return ans > x.ans;
}
};
bool sort_par... | ALGO | 0.995493 | 3.656255 |
c48363f9-1d8e-43f3-bf28-cc976ba5b319 | HimanshiNayak/GFG-Solutions | Difficulty: Basic/Elements before which no element is bigger/elements-before-which-no-element-is-bigger.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int countElements(vector<int>& arr) {
// code herel
long long max = arr[0];
long long count =1;
for(long long i=0;i<arr.size();i++){
if(max<arr[i]){
... | ALGO | 0.987494 | 6.582137 |
ca22c43d-bc82-4da4-9ad2-53061c204d32 | lattalab/slove-problem | Star 2/uva11991.cpp | // accepted
# include <iostream>
# include <map>
# include <vector>
using namespace std;
int main()
{
int n,m;
while(cin >> n >> m)
{
// note: map可以對應到一個vector
map<int, vector<int>> mp; // 該數字對應一個儲存出現位置的vector
for(int i=0;i<n;i++)
{
int num;
cin >> num... | ALGO | 0.999987 | 3.698754 |
c807c051-4c94-4950-a806-15f53573c756 | bytedance/terark-zip | 3rdparty/boost-include/libs/program_options/example/regex.cpp | // This example shows how a user-defined class can be parsed using
// specific mechanism -- not the iostream operations used by default.
//
// A new class 'magic_number' is defined and the 'validate' method is overloaded
// to validate the values of that class using Boost.Regex.
// To test, run
//
// regex -m 123... | TOOL | 0.903877 | 7.578928 |
077b090d-ca60-4a61-9ce1-3a86fc4cb1a1 | JustinChris/programminportfolio | SOCS/Untitled1.cpp | #include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
bool comp(const int a[], const int b[], int n)
{
int total = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n;j++){
if (b[i] == pow(a[j],2)){
total++;
... | TEST | 0.994411 | 3.380718 |
8b5bec19-3af7-471c-bf9f-f94eb451b08b | 0xpye/cp | code/78.gifts.cpp | #include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define maxn 1000005
using namespace std;
int n, s, t, cnt, tr[1005], check, maxflow;
struct flow{
int u, v, c, f;
} a[2*maxn];
vector <int> Edge[2005];
void Add(int u, int v, int w){
... | ALGO | 0.999972 | 3.456663 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.