uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ddfa3e13-407a-4880-aad8-a421d00418c0 | snmath-pi/DataStructures | StriverDP/DP10iterative.cpp | #include <bits/stdc++.h>
int minSumPath(vector<vector<int>> &grid) {
// Write your code here.
int n = grid.size(), m = grid[0].size();
vector<vector<int>> dp(n, vector<int>(m, 1e9));
// return dfs(n-1, m-1, grid, dp);
dp[0][0] = grid[0][0];
for(int i=0; i<n; i++) {
for(int j=0; j<m; j++... | ALGO | 0.999962 | 5.660497 |
7d50a9e6-b377-4e05-b5fb-170d08c3a92c | Ahnaf-41M/Codeforces_AtCoder | codeforces/1535/B.cpp | #include "bits/stdc++.h"
#define ff first
#define ss second
#define pb push_back
#define MX 100005
#define int long long
#define PII pair<int,int>
#define endl "\n"
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define all... | ALGO | 0.999361 | 4.555377 |
304bf3c3-c3ef-4b12-a2d9-fd7625881a3c | RMGDFT/rmgdft | RMG/Common/Betaxpsi.cpp | #include <stdio.h>
#include <stdlib.h>
#include <complex>
#include "transition.h"
#include "const.h"
#include "RmgTimer.h"
#include "rmgtypedefs.h"
#include "params.h"
#include "typedefs.h"
#include "common_prototypes.h"
#include "common_prototypes1.h"
#include "rmg_error.h"
#include "Kpoint.h"
#include "GpuAlloc.h"
#i... | ALGO | 0.971063 | 3.126638 |
498f4879-c50e-41de-b567-ea13314c2186 | admb-project/admb | src/df1b2-separable/df1b2f19.cpp | /**
* \file
* Description not yet available.
*/
#include <df1b2fun.h>
/**
* Description not yet available.
* \param
*/
double sqrt_m5(double x) {return .5/sqrt(x);}
/**
* Description not yet available.
* \param
*/
double sqrt_m32(double x) {return -.25/(sqrt(x)*x);}
/**
* Description not yet available.
* ... | ALGO | 0.999221 | 6.326993 |
ce4084f4-a60c-47d2-84ce-e1c1fdea562f | IrinaMBejan/Personal-work-contests | Algorithmics/Problems from various contests/agenda.cpp | #include <fstream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#define Lmax 1001
#define Nmax 10000
using namespace std;
ifstream fin("agenda.in");
ofstream fout("agenda.out");
int nr, nrp;
struct sef
{
int ts, tf;
} S[Nmax];
struct ext
{
int t, s, tip;
} E[2*Nmax];
int c;
char sir[Lmax], s[Lma... | ALGO | 0.99806 | 3.354512 |
b5ed7edf-d207-4865-97cf-5666e505385c | M4573R/competitive-programming-archive | uva/volume-122/emoogle_balance.cpp | #include <iostream>
using namespace std;
inline void use_io_optimizations()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main()
{
use_io_optimizations();
unsigned int events;
for (unsigned int test {1}; cin >> events && events != 0; ++test)
{
int balance {0};
... | ALGO | 0.991873 | 5.033163 |
5e7ce8fa-8c5b-4587-858c-33450dd42e3a | Lenonim/simple-neural-networks | line_creator/src/MainNeuro.cpp | #include "MainNeuro.h"
using namespace std;
void randfill_array(double* arr, size_t size) {
for (size_t i = 0; i < size; i++)
arr[i] = ((rand() % 1001) - 500) / 100.0;
}
void show_array(double* arr, size_t size) {
for (size_t i = 0; i < size; i++)
std::cout << arr[i] << "\t";
}
int main()
{
setlocale(LC_ALL,... | ALGO | 0.98519 | 4.213999 |
e0bdf271-d75d-4203-8fc8-0f97c0bb506c | dirtyfilthy/llvm-project-14.0.6 | libc/src/string/strstr.cpp | #include "src/string/strstr.h"
#include "src/__support/common.h"
#include <stddef.h>
namespace __llvm_libc {
// TODO: This is a simple brute force implementation. This can be
// improved upon using well known string matching algorithms.
LLVM_LIBC_FUNCTION(char *, strstr, (const char *haystack, const char *needle)) {... | TOOL | 0.989296 | 6.452508 |
1211ff28-2b48-4d1e-b9c4-24854e277891 | SKouga0926/atcoder | tesoku-contest/B11-Binary-Search2.cpp | using namespace std;
#include <bits/stdc++.h>
int N, Q;
int A[100009];
int X[100009];
int main(void)
{
// 入力
cin >> N;
for (int i = 1; i <= N; i++) cin >> A[i];
cin >> Q;
for (int i = 1; i <= Q; i++) cin >> X[i];
// ソート処理
sort(A + 1, A + N + 1);
for (int i = 1; i <= Q; i++) {
... | ALGO | 0.999934 | 4.99469 |
56ef4605-5f6d-48ed-9ec1-52d7efe012b0 | shohne/CarND-MPC-Project | src/Eigen-3.3/bench/geometry.cpp |
#include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace std;
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 8
#endif
typedef SCALAR Scalar;
typedef NumTraits<Scalar>::Real RealScalar;
typedef Matrix<RealScalar,Dynamic,Dynamic> A;
type... | ALGO | 0.941071 | 5.941502 |
f2ac4517-618c-467d-8af6-4302c6b6e1fa | ankitc248/Spoj-Solutions | NDIV.cpp | /*
NDIV - n-divisors
SOLUTION BY RAMAN SHARMA
*/
#include<bits/stdc++.h>
using namespace std;
#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
int main(){
int a,b,n;
cin>>a>>b>>n;
int d[b-a+10];
memset(d,0,sizeof d);
for(int i=1; i*i<=b; ++i){
for(int j=((a-1)/i+1)*i; j<=b; j+=i){
i... | ALGO | 0.999682 | 4.081369 |
09781e5c-f37f-4e57-af64-5e8718abd0a6 | nithinsai2002/CP | A_Beautiful_Year.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#inc... | ALGO | 0.999883 | 4.618555 |
6968981b-e668-413d-8fcb-6b0c023579e9 | DevleenaBanerjee/Stock_Prediction_ds | venv/Lib/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/libs/graph/example/adjacency_matrix.cpp | int main()
{
using namespace boost;
enum { A, B, C, D, E, F, N };
const char* name = "ABCDEF";
// A directed graph
typedef adjacency_matrix<directedS> Graph;
Graph g(N);
add_edge(B, C, g);
add_edge(B, F, g);
add_edge(C, A, g);
add_edge(C, C, g);
add_edge(D, E, g);
add_edge(E, D, g);
add_ed... | ALGO | 0.972276 | 5.275048 |
5fd5fac4-8546-47c9-a7be-e117f8624376 | Aryan-Kumar-Thakur/GFG-DSA-Submissions | Difficulty: Medium/Maximize The Cut Segments/maximize-the-cut-segments.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
int solve(int n,int l,int m,int o,vector<int> &dp){
if(n<0){
return -1e5;
}
if(n==0){
return 0;
}
if(dp[n]!=-1){
return dp[n];
... | ALGO | 0.999679 | 5.494329 |
b5c422d3-dff3-4042-aec4-f62bfa3df36c | barjimal/cg | lib/boost_1_78_0/libs/serialization/src/extended_type_info.cpp | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// extended_type_info.cpp: implementation for portable version of type_info
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) //... | TOOL | 0.911708 | 6.805827 |
a03cc0e2-75ec-4711-9cc8-339ab002cb56 | Samim-Arefin/UVa-Problem-Solution | Uva-299 - Train Swapping.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t,num;
cin>>t;
while(t--)
{
cin>>num;
int arr[num];
for(int i=0;i<num;i++)
{
cin>>arr[i];
}
int temp,count=0;
for(int i=0;i<num;i++)
{
for(int j=0;j<num-i-1;j++... | ALGO | 0.99972 | 3.86723 |
ed6495b2-0a39-4fdb-8498-6925e45660aa | himani080/DSA | wireshark.cpp | #include <iostream>
#include <vector>
int bucket_size = 1000; // Bucket capacity in bytes
int output_rate = 100; // Output rate in bytes per second
int bucket_level = 0; // Current data in the bucket
// Function to simulate the leaky bucket algorithm for adding packets
void leaky_bucket(int packet_size) {
if (... | ALGO | 0.872077 | 5.599697 |
a0b79f34-9204-4127-b8ac-e6c2e9792f5e | suselgz/QR_Code | src/zxing/pdf417/detector/LinesSampler.cpp | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#include <map>
#include <zxing/pdf417/detector/LinesSampler.h>
#include <zxing/pdf417/decoder/BitMatrixParser.h>
#include <zxing/NotFoundException.h>
#include <zxing/common/Point.h>
#include <algorithm>
using std::map;
using std::vector;
using s... | ALGO | 0.991822 | 5.080978 |
2c538617-08f1-46ce-b7ab-61c04ba070d7 | nyutonn/programming_history | C++/C++コード集/その他/pg-battle/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
int main(){
int n, x, a, b;
cin >> n >> x >> a >> b;
if(n >= x) cout << b*n << endl;
e... | ALGO | 0.995978 | 3.578579 |
299849f1-b41b-47bd-aa33-43051f6a689b | Lophophora24/Quench_2.0 | thirdparty/boost_1_82_0/libs/compute/perf/perf_stl_partition.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
bool less_than_10(int value)
{
return value < 10;
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::c... | ALGO | 0.993416 | 6.031366 |
c7ef7d38-eb9d-4058-b68f-230e2636ba3a | goodstudyqaq/ACM | codeforces/1600-1699/1630/D.cpp | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
template < typename A, typename B... | ALGO | 0.99996 | 3.676007 |
1b560508-9fcb-4bf5-bc70-3666ca8db10c | InflixOP/DSA | Queue/queue using linked list.cpp | #include<iostream>
#include<stdlib.h>
using namespace std;
class Node{
public:
int data;
Node *next;
};
class Queue
{
private:
Node *front;
Node *rear;
public:
Queue(){front=rear=NULL;}
void enqueue(int x);
int dequeue();
void display();
};
void Queue::en... | ALGO | 0.997888 | 4.085366 |
dc06ad75-c9b9-45fb-a82f-c1f957eb80bc | Runnable2021/Runnable-Rewriting | llvm/lib/CodeGen/LiveIntervalUnion.cpp | #include "llvm/CodeGen/LiveIntervalUnion.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SparseBitVector.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstdlib>
using namespace llvm;
#define DEBUG_TYPE "re... | ALGO | 0.967194 | 7.222612 |
945e7882-a1e7-47bb-a136-915b5f878171 | Nirmakaya/CPP-DSA | IntersectionOfTwoLinkedList.cpp | #include<iostream>
using namespace std;
//Time Complexity : O(Greater length of linked list amongst both)
class node{
public:
int data;
node* next;
node(int val){
data=val;
next=NULL;
}
};
void intersect(node* &head1, node* &head2, int pos){
node* temp1=head1;
pos--; ... | ALGO | 0.999946 | 4.549116 |
62613e7e-fbd3-4cd1-9901-90b37bc98639 | apru02/LeetCode-ACs | 719-find-k-th-smallest-pair-distance/find-k-th-smallest-pair-distance.cpp | class Solution {
public:
int smallestDistancePair(vector<int>& nums, int k) {
sort(nums.begin(), nums.end());
int n = nums.size();
int low = 0, high = nums[n - 1] - nums[0];
auto count_pairs = [&](int max_distance) {
int count = 0, j = 0;
for (int i = 0; i < ... | ALGO | 0.999994 | 6.15572 |
3b12bb4c-fc45-4e17-9452-d71a89cc9bf6 | LeeHyungGeol/Algorithm_BaekJoon | 백준_if문/[백준 골드 2] 1561번.cpp | // ̺ Ž(ĶƮ ġ)
// 0п Mŭ ź.
// A ̱ⱸ mid б ¿°? : mid / (A ð)
// Kп ̱ⱸ Ѱ? : K % Times[i]( ̱ⱸ ð) == 0 īƮ
// https://suhwanc.tistory.com/45
// http://melonicedlatte.com/algorithm/2018/08/09/115053.html
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
ll N, M,... | ALGO | 0.999995 | 5.012596 |
4ca3d581-d114-4cc8-894f-526649fce6ab | Protype8/CPlusPlus-Competition-Codes | examples/template_example.cpp | template<class T>
class Stack
{
private:
T *stk;
int top;
int size;
public:
Stack(int sz)
{
size=sz;
top=-1;
stk=new T[size];
}
void push(T x);
T pop();
};
template<class T>
void Stack<T>::push(T x)
{
if(top==size-1)
cout<<"Stack is Full";
else
... | ALGO | 0.984906 | 3.903193 |
38cd79ac-98a5-4585-b99f-b6a0c18a09dd | LEEYOONJONG/Algorithm_mac | pattern/union&find/10775_공항.cpp | #include <iostream>
using namespace std;
int parent[100001];
int counts[100001];
int find(int x){
if (x==parent[x]) return x;
return parent[x] = find(parent[x]);
}
void uni(int a, int b){
parent[find(a)] = find(b);
}
int main(){
cin.tie(0);
ios_base::sync_with_stdio(0);
int g; cin>>g;
i... | ALGO | 0.999874 | 3.660209 |
d65746ec-94e3-4b0a-b342-9483fde0ddf2 | AmreetaSengupta/Embedded-Machine-Vision-and-Intelligent-Automation | Exercise 4/Q4/q4.cpp | /**********************************************************************************************
* File Name: q4.cpp
* Description: The code performs skeletal transform on the continously streaming image
* Author: Amreeta Sengupta
* Date: 07/19/2019
* References: http://www.cse.uaa.alaska.edu/~ssiewert/a485_code,
* ... | ALGO | 0.995146 | 4.216395 |
d5bbfa24-fc93-47f8-85b0-fef78cb1ffc6 | miti/Codes | anag_spoj.cpp | #include<iostream>
#include<cstring>
using namespace std;
int main()
{
string a,b;
int arr[27],brr[27];
int t,i,j;
cin>>t;
for(i=0;i<t;i++)
{
memset(arr,0,sizeof(int)*27);
memset(brr,0,sizeof(int)*27);
cin>>a>>b;
for(j=0;j<a.length();j++)
{
arr[a[j]-97]++;
}
for(j=0;j<b.length();j++)
{
... | ALGO | 0.999973 | 4.022386 |
0c38ff12-a4db-420a-bf78-927531af689a | Khushal41/DSASupreme-1.0- | Week13-Trees/Lecture2-Trees/Question2.cpp | // Lowest Common Ancestor [Leetcode-236]
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution
{
public:
TreeNode *lowestCommonAncestor(TreeNode *root, TreeNod... | ALGO | 0.999991 | 6.369459 |
8b1e119e-c209-4820-a378-d28bc13512ec | bngsdria/lab-algoritma-pemerograman | tugas pertemuan 6/Tugas/tugas1.cpp | /* ---------------------------- */
/* Program dengan pernyatan goto */
/* ---------------------------- */
#include <iostream>
#include <stdio.h>
#include <conio.h>
using namespace std;
int main()
{
int a, b;
char lagi;
atas:
//clrscr();
cout << "Masukkan bilangan = ";
cin >> a;
b = a % 2;
... | ALGO | 0.984624 | 3.038611 |
e89f9361-d0d9-4a2d-a253-67c3511dfa49 | inchoel/DailyCoding | acmicpc.net/1697_숨바꼭질2.cpp | #include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
int N, K;
int findPath () {
if (N == K)
return 0;
int visited[100001] = {0, };
queue<int> q;
q.push(N);
visited[N] = 1;
int x;
while (!q.empty()) {
x = q.front();
q.pop();
if (x == K)
return visited[x] ... | ALGO | 0.999684 | 4.217594 |
a0b0c7ba-c88d-4fb4-925f-b299cce8d826 | AkaakuHub/class-simulation | main.cpp | #include "euler_cromer.hpp"
#include <stdio.h>
int main() {
const double h = 0.001;
const int intmax = 10000; // ループ回数
Cood p = {
r, // x
0.0, // y
0.0, // vx
6.283185307179586 // vy = 2*PI/T
};
for(int i = 0 ; i < intmax ; i++) {
euler_cromer(p,... | ALGO | 0.999893 | 4.036774 |
02c438dc-cce1-4b85-9862-2656b6dd6423 | Sobuj54/DSA-with-CPP | problems solved/week_8/day_7/S_2-letter_strings.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<vector<int> > cnt(12, vector<int>(12, 0));
long long ans = 0;
for (int i = 0; i < n; i++)
... | ALGO | 0.999491 | 4.293333 |
90f08f84-3770-4e23-a5e7-39d2936762b4 | BoltTaha/CS2001-Data-Structures | Linked List/find_key_in_ring.cpp | #include<iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int d) {
data = d;
next = NULL;
}
};
void find_elment(Node* head,int key)
{
Node* slow = head;
Node* fast = head;
while(fast->next !=head && fast->next->next != head)
{
s... | ALGO | 0.999987 | 4.860358 |
ef041372-1c1e-4ae0-aa02-056fb5386bdd | sj1705/DSA | GFG questions/Left View of Binary Tree - GFG/left-view-of-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
vector<int> leftView(struct Node *root);
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->... | ALGO | 0.999612 | 6.833105 |
02c17d3b-0ac3-46e9-82b6-8ebf4ee0f08c | mdarafat1819/Code-Library | Data Structure/Queue/Implementation of Queue using linked list.cpp | #include <bits/stdc++.h>
using namespace std;
typedef struct node Node;
struct node
{
int data;
Node *next;
};
Node *head = NULL, *tail = NULL;
void enQueue(int data)
{
Node *new_node = (Node*)malloc(sizeof(Node));
new_node -> data = data;
new_node -> next = NULL;
if(head == NULL)
{
... | ALGO | 0.998214 | 4.436883 |
ce0d8b07-d3e9-4139-90ce-fe569f6392a6 | ishandutta2007/codeforces | darkkcyan/normal/949/D.cpp | #include <bits/stdc++.h>
using namespace std;
// #define constexpr(...) (__VA_ARGS__)
using ll = long long;
using ld = long double;
const ld eps = 1e-8;
// for matching the kactl notes
#define sz(x) ((int)x.size())
#define rep(i,a,b) for (int i = (int)(a); i < (int)(b); ++i)
#define all(a) (a).begin(), (a).end()
#d... | ALGO | 0.99998 | 4.510454 |
66b1292f-0ac4-421f-9e7e-f28c9ab31ec7 | vi5hnuu/DSA-prac | recursion/Tower Of Hanoi.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
/*
Input:
N = 2
Output:
move disk 1 from rod 1 to rod 2
move disk 2 from rod 1 to rod 3
move disk 1 from rod 2 to rod 3
3
Explanation: For N=2 , steps will be
as follows in the example and total
3 steps will be taken.
*/
class Solution{
public... | ALGO | 0.999968 | 5.409929 |
4910aea9-1a7c-4a50-ab97-2e4a35a31f1b | SukhwalRaghav/StartMenu-v1.0 | Library/PackageCache/com.unity.ide.visualstudio@2.0.17/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.940997 | 6.933585 |
48993fad-6b70-44b1-8f1f-9036601bf677 | slimepiki/atcoder | abc123/c/main.cpp | using namespace std;
using ll = long long;
using ull = unsigned long long;
#include <bits/stdc++.h>
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef __LOCAL
#define debug(...) ... | ALGO | 0.999498 | 3.852842 |
d1e1a614-411e-463e-b014-23f8107a805e | masterchief007/UnrealEngine | Engine/Source/ThirdParty/Intel/TBB/IntelTBB-2019u8/examples/concurrent_hash_map/count_strings/count_strings.cpp | // Workaround for ICC 11.0 not finding __sync_fetch_and_add_4 on some of the Linux platforms.
#if __linux__ && defined(__INTEL_COMPILER)
#define __sync_fetch_and_add(ptr,addend) _InterlockedExchangeAdd(const_cast<void*>(reinterpret_cast<volatile void*>(ptr)), addend)
#endif
#include <string>
#include <cstring>
#include... | TOOL | 0.988821 | 6.252856 |
c7b1bd23-de31-4308-b4d3-998ae9b9c6f8 | AdityaAtb09/LeetCode | 1985-find-the-kth-largest-integer-in-the-array/1985-find-the-kth-largest-integer-in-the-array.cpp | class Solution {
public:
static bool cmp(string &a,string &b)
{
if(a.size() == b.size())
{
return a<b;
}
return a.size()<b.size();
}
string kthLargestNumber(vector<string>& nums, int k) {
sort(nums.begin(), nums.end(), cmp);
... | ALGO | 0.999938 | 5.720597 |
5203bcc5-8b10-4f2b-983f-7d049baadbff | heweimin77/shoran_cpp | session4000/problem3200/p3112.minimumTime.cpp | #include <gtest/gtest.h>
#include <queue>
using namespace std;
namespace {
static auto autorun = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return 0;
} ();
class Solution {
public:
vector<int> minimumTime(int n, vector<vector<int>>& edges, vector<int>& disappear) {
... | ALGO | 0.999806 | 6.019049 |
9c6a416c-2f38-4ed5-87c1-ef811082cf40 | iliyian/LuoguOJ | Problems/P3017/main.cpp | // wa#01:没意识到二维前缀和求某个宽为1的矩阵和时仍然需要四角坐标
// 除非对于这种单次求和的宽必然为1的情况制作C个一维前缀和
#include <bits/stdc++.h>
#define N 505
using namespace std;
int a[N][N], s[N][N], R, C, A, B;
bool check(int mid) {
int acnt = 0, prev = 0;
for (int i = 1; i <= R; i++) {
int bcnt = 0, sum = 0;
for (int j = 1; j <= C; j++) {
... | ALGO | 0.998935 | 3.927985 |
f4b073d5-3fa3-413e-b06d-153b0cd30e62 | shreyanshTechz/LeetCode-Daily | Swap two nibbles in a byte - GFG/swap-two-nibbles-in-a-byte.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int swapNibbles(int N){
int M = N;
// cout<<M<<4<<" "<<
return ((N>>4 | M<<4) & ((1<<8)-1));
}
};
//{ Driver Code Starts.
int main()
{
int t;
cin>>t;
while(t... | ALGO | 0.99968 | 5.292188 |
101132d3-113b-4012-a6c6-8883959db0d4 | sakshisrivastava126/Recursion | sumOfSeries.cpp | class Solution {
public:
int sumOfSeries(int n) {
if(n==0) {
return 0;}
return pow(n,3) + sumOfSeries(n-1);
}
};
| ALGO | 0.999769 | 5.516918 |
5fcde992-c9fd-4426-9e64-70880bdc33eb | rayz1065/competitive-programming | cses/1092_two_sets/main.cpp | #include <bits/stdc++.h>
#define MAXN 1000005
using namespace std;
int n;
bool in_set[MAXN];
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
if (n % 4 == 1 || n % 4 == 2) {
cout << "NO\n";
return 0;
}
if (n % 4 == 0) {
for ... | ALGO | 0.998694 | 3.46579 |
7232e154-0abd-428e-bdf2-589da84faffc | morris821028/UVa | temp/11846 - Finding Seats Again.cpp | #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <assert.h>
using namespace std;
char g[32][32];
int ig[32][32], N, K, ret[32];
class DLX {
public:
struct DancingLinks {
int left, right, up, down, ch;
int id, lx, ly, rx, ry; // extra data
} DL[131072 + 256];
int s[512],... | ALGO | 0.999318 | 4.271715 |
8f4c342c-2024-48bd-a95c-e4b48c0910d1 | Hikari9/UVa | stuff/orderset.cpp | // SPOJ ORDERSET - Order Statistics Set
// Treap implementation
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <algorithm>
using namespace std;
struct node {
// max priority is root
int key, size, prio; //,value
node *left, *right;
node(int key):
key(key)... | ALGO | 0.999551 | 4.367984 |
8e361141-5e8c-4bf7-8d81-cda0c22cfdab | chandola/squad | src/clusterc/CLUSTERCPredict.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string.h>
#include <stdlib.h>
#include <map>
#include <queue>
#include <math.h>
#include "tools.h"
#include "fftw3.h"
using namespace std;
char *sequence_filename=0;
char *clusters_filename=0;
char *output_filename=0;
int measure = 0;
/* Data struct... | ALGO | 0.998985 | 4.649181 |
d6afa7b8-2d17-4ab4-8fb1-d75c7f9a73ca | anuragyes/DSA | TREE-dsa/trim-bst.cpp | /*class Solution {
public:
TreeNode* trimBST(TreeNode* root, int low, int high) {
if(root==nullptr){
return nullptr;
}
if(root->val < low){
return trimBST(root->right,low,high);
}
if(root->val > high){
return trimBST(root->left,low,high);
... | ALGO | 0.999976 | 6.654618 |
22dfce26-9469-4193-ba27-a0717715885c | PrveenYadav/DSA-Journey | 18_Stack and Queue/Lecture-56 Stack/code.cpp | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
//Que- Next smaller element: for input(2, 1, 4, 3) next smaller element is (1, -1, 3, -1)
vector<int> nextSmallerElement(vector<int> &arr, int n) {
stack<int> s;
s.push(-1);
vector<int> ans(n);
//loop till the smaller element ... | ALGO | 0.999994 | 5.133468 |
f571bf9d-84f0-4763-bbf5-93d5aaaf1ec8 | dihelium/cpp-competitive | Intra Hostel Contests/Contest 3/Aracontest3E.cpp | #include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<string.h>
#include<cstdio>
#include<map>
#include<cassert>
using namespace std;
#define FOR(i,a,b) for(int i = a; i < b; ++i)
#define pb push_back
const int MOD = 1000000007;
int main()
{
int n;
cin>>n;
strin... | ALGO | 0.999919 | 3.273637 |
afe97cab-9760-4739-8dfb-ceec31947f38 | kenchikqq/ConsoleApplication6 | ConsoleApplication6/ConsoleApplication6.cpp | //класс двумерный вектор
#include <iostream>
class Vector2D {
public:
double x, y;
Vector2D(double x = 0, double y = 0) : x(x), y(y) {}
//методы для доступа к компонентам вектора
double getX() const { return x; }
double getY() const { return y; }
//методы для изменения компонент вектора
v... | ALGO | 0.973944 | 5.537884 |
3ecf4767-74e7-40de-9af8-1504876ad643 | 82473468/wenchi-map | src/poles_map/src/global_poles_map.cpp | #include <ros/ros.h>
#include <pcl/io/pcd_io.h>
#include "tinyxml.h"
std::string g_read_mapping_xml ;
unsigned int g_line_num = 1;
unsigned int g_tree_id = 1;
std::string g_load_poles_txt ;
std::string g_save_poles_pcd ;
float g_merge_dis ;
unsigned int g_poles_detect_times ;
struct PoleFeature{
/// mean of mult... | DATA | 0.870699 | 4.171188 |
46b196e7-c31b-4309-8f09-634e3e7ce91f | rhazra-003/LeetCode_Practice | 0491-non-decreasing-subsequences/0491-non-decreasing-subsequences.cpp | class Solution {
public:
vector<vector<int>> findSubsequences(vector<int>& nums) {
vector<vector<int>> res;
vector<int> seq;
dfs(res, seq, nums, 0);
return res;
}
void dfs(vector<vector<int>>& res, vector<int>& seq, vector<int>& nums, int pos) {
... | ALGO | 0.999992 | 6.346539 |
c605d3c0-18f8-4e91-bcd3-1c75ed7215ad | raincross7/code-similarity | codes/train_code/problem389/problem389_259.cpp | #include"bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.141592653589793238
int main() {
int Q, H, S, D, N;
cin >> Q >> H >> S >> D >> N;
int64_t ans = 0;
while (N > 0) {
if (N == 1) {
if (S <= 2 * H && S <= 4 * Q) {
ans += S;
}
else if (H <= 2 *... | ALGO | 0.996511 | 3.21267 |
c8d96365-cf39-4c57-bef5-0e0a3793b153 | GuacheSuede/MSSubmission1234567890 | submission/rsi/boost_1_69_0/libs/numeric/odeint/examples/stochastic_euler.cpp | #include <vector>
#include <iostream>
#include <boost/random.hpp>
#include <boost/array.hpp>
#include <boost/numeric/odeint.hpp>
/*
//[ stochastic_euler_class_definition
template< size_t N > class stochastic_euler
{
public:
typedef boost::array< double , N > state_type;
typedef boost::array< double , N > der... | ALGO | 0.999026 | 5.867243 |
96da357b-a88c-4ab3-8842-0e6a00fdf303 | m4oughi/100DaysofCode | pureCPP/0003. Day 3/Const/012. Constant Expressions (constexpr)/004. constexpr with Array Sizes/main.cpp | #include <iostream>
constexpr int arraySize(int n) {
return n * 2;
}
int main() {
int arr[arraySize(5)]; // Array size determined at compile-time
std::cout << sizeof(arr) / sizeof(arr[0]) << std::endl; // Prints 10
}
| TOOL | 0.887175 | 6.827146 |
75643cd0-ecaa-47d0-9e63-bf6d8a85651e | Ivan-71-ua/Competitive-Programming | LeetCode/3240.cpp |
#include <bits/stdc++.h>
class Solution {
public:
int minFlips(std::vector<std::vector<int>>& grid) {
int ans = 0;
int n = grid.size();
int m = grid[0].size();
for (int i = 0; i < n /2; i++)
{
for (int j = 0; j < m /2; j++)
{
int ones = 0;
ones += grid[i][j];
ones += grid[i][m - j - 1];
... | ALGO | 0.99997 | 5.682622 |
e8321754-f01e-4f25-8328-0e3a462e2ea1 | apsawicki/fa21-OS-assignments | Project 1 - event_sim/event_sim.cpp | #include "event_sim.h"
#include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
#include <fstream>
#include <string>
using namespace std;
int getConfig(int arr[], const string& file){ // file handling + getting config values from external file
ifstream inFile(file);
if (!inFile.is_open()){
... | ALGO | 0.896036 | 4.010109 |
81a77973-592b-43af-ad9e-df488a9c42e0 | haderech/libcxx | test/std/algorithms/alg.sorting/alg.set.operations/set.union/set_union_move.pass.cpp | // <algorithm>
// template<InputIterator InIter1, InputIterator InIter2, typename OutIter,
// CopyConstructible Compare>
// requires OutputIterator<OutIter, InIter1::reference>
// && OutputIterator<OutIter, InIter2::reference>
// && Predicate<Compare, InIter1::value_type, InIter2::value_type... | TEST | 0.930373 | 5.695879 |
d5b9e9ad-dfbd-4f6e-bcd6-3ee1a0d1b5bf | tudelft3d/3D_Urban_Mesh_Annotator | CGAL/examples/Linear_cell_complex/linear_cell_complex_3_with_colored_vertices.cpp | #include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <iostream>
#include <algorithm>
struct Average_functor
{
template<class CellAttribute>
void operator()(CellAttribute& ca1, CellAttribute& ca2)
{ ca1.info()=(ca1.info()+ ca2.info())/2; }
};
struct Myitem
{
template<class Refs>
struct Dart_w... | ALGO | 0.975612 | 7.370529 |
c3107f18-3c4e-4b83-860f-5ff4d85e455c | Oleg7292/LAB1 | Mark.cpp | #include <iostream>
#include <cmath>
using namespace std;
// Функция для вычисления периметра трапеции
float perimeter(float main1, float main2, float side1, float side2) {
return (main1 + main2 + side1 + side2);
}
// Функция для вычисления площади трапеции
float square(float main1, float main2, float height... | ALGO | 0.949691 | 4.417367 |
92ba7f2c-eaad-4eb5-9ee7-867a8c1487a8 | hydranyx/robo-grasper | pas/ros/catkin_ws/src/alice_pointcloud/src/point_cloud_filters.cpp | #include "point_cloud_functions.h"
PointCloudFilters::PointCloudFilters() :
coefficients_(new pcl::ModelCoefficients),
inliers_(new pcl::PointIndices),
tree_search_(new pcl::search::KdTree<Point>) {
segmentation_.setOptimizeCoefficients(true);
segmentation_.setModelType(pcl::SACMODEL_PLANE);
segmentation_... | TOOL | 0.969615 | 5.988286 |
2337e2b6-023a-4dbe-8be8-7709aedc88f4 | sakshamgoel-github/LeetCode-Solutions | 2352EqualRowandColumnPairs.cpp | #include <bits/stdc++.h>
using namespace std;
#define turbo ios_base::sync_with_stdio(false);cin.tie(NULL);
class Solution {
public:
int equalPairs(vector<vector<int> >& grid) {
map<vector<int>, int> hashmap;
int ans = 0;
int row = grid.size();
int col = grid[0].size();
for ... | ALGO | 0.999706 | 4.162921 |
7224fd57-d601-43d1-b190-c14b90527ca5 | feng-jianwei/csp | 201403-2窗口.cpp | /*************************************************************************
> File Name: 201403-2窗口.cpp
> Author: fjw
> Mail: <EMAIL>
> Created Time: 2019年07月04日 星期四 20时08分08秒
************************************************************************/
#include<bits/stdc++.h>
using namespace std;
#defin... | ALGO | 0.999934 | 3.902838 |
2fb93767-aea0-4d4f-b089-b7e0500bdf1a | Mattias1/tours | src/savings.cpp | #include "savings.h"
#include <list>
#include <algorithm>
#include <assert.h>
#include <iostream>
#include "use_lkh.h"
#include "utils.h"
//
// The saving class
//
Saving::Saving(int i, int j, const Graph& graph, vector<int> costDepot2i)
:I(i),
J(j),
Value(costDepot2i[i] + costDepot2i[j] - calculateEucli... | ALGO | 0.999757 | 5.272856 |
af69463c-f7c1-44b0-a9f8-69e1e1ad620c | Manish-Kumar12345/Functions | factorial.cpp | #include<iostream>
using namespace std;
// int fact(int n){
// int fact = 1;
// for(int i = 2; i <= n; i++){
// fact *= i;
// }
// return fact;
// }
int main(){
int n;
cin>>n;
// for(int i = 1; i <= n; i++){
// cout<<fact(i)<<endl;
// }
// Method -> 2
int fact = ... | ALGO | 0.99997 | 5.397507 |
2a711466-b89f-4b56-a1bb-52f6bddbeffe | emotionless/Leetcode | 2163-minimum-difference-in-sums-after-removal-of-elements/2163-minimum-difference-in-sums-after-removal-of-elements.cpp | class Solution {
public:
long long minimumDifference(vector<int>& nums) {
priority_queue<int> left;
priority_queue<int, vector<int>, greater<>> right;
int n = nums.size();
int N = n / 3;
long long total = 0;
vector<long long> tmp(n, 0);
for (int i = n - 1; i >... | ALGO | 0.999845 | 5.607921 |
fd2f3d93-3ffe-43ff-97d5-262f10b8879d | Karelito00/problems | OCI/pdinam.cpp | #include <bits/stdc++.h>
#define mn(a,b) (a < b ? a : b)
#define mx(a,b) (a > b ? a : b)
#define f first
#define s second
#define mp make_pair
#define all(v) (v).begin(),(v).end()
using namespace std;
int const MAXn = 2e5 + 2;
struct nodo{
int open;
int close;
};
struct st{
nodo l[2];
}tree[4 * MAXn];
... | ALGO | 0.999839 | 4.010045 |
338bfd8a-06a7-42e9-b16e-09408a80c864 | BGCX067/faint-graphics-editor-svn-to-git | tags/release-0.1/util/autocomplete.cpp | #include "autocomplete.hh"
#include <algorithm>
#include <cassert>
namespace faint {
class ACNode;
struct ACNodeLess{
bool operator()( const ACNode* lhs, const ACNode* rhs ) const;
};
class WordsImpl{
public:
ACNode* m_node;
std::string m_base;
};
/* ACNode implementation */
class ACNode ... | ALGO | 0.996406 | 6.599183 |
5b7a3aff-e094-4e2f-88a6-d7a812d78dae | abdullahIt18040/cps_course_level_1 | Bisection_problem/hajj.cpp |
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define optimization() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree< long long , null_type, less_equal<long long >, rb_tree_tag, tree_order_statistics_node_update ... | ALGO | 0.997559 | 3.807023 |
04d439b1-5cef-4ace-9db7-b1f3f9aad1b6 | lxxcy/note | leecode solution/字符串-反转字符串.cpp | /*
编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组 s 的形式给出。
不要给另外的数组分配额外的空间,你必须原地修改输入数组、使用 O(1) 的额外空间解决这一问题。
示例 1:
输入:s = ["h","e","l","l","o"]
输出:["o","l","l","e","h"]
示例 2:
输入:s = ["H","a","n","n","a","h"]
输出:["h","a","n","n","a","H"]
*/
#include <iostream>
using namespace std;
#include <vector>
class Solution {
public:
... | ALGO | 0.999709 | 4.828947 |
b9dcb802-ae5e-4605-8c5e-4a1771fb579e | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_2454_20.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, count = 0;
cin >> a >> b >> c;
while (a > 0) {
if (b >= 2 * a && c >= 4 * a) {
count = a + 2 * a + 4 * a;
break;
}
a--;
}
cout << count;
return 0;
}
| ALGO | 0.999902 | 3.770539 |
9a8e716e-3bd2-46ed-a2fc-deaf261651eb | lingd3/OJ-CODE | Lintcode/35_reverse-linked-list/reverse-linked-list.cpp | /*
@Copyright:LintCode
@Author: linqiao
@Problem: http://www.lintcode.com/problem/reverse-linked-list
@Language: C++
@Datetime: 17-02-25 04:03
*/
/**
* Definition of ListNode
*
* class ListNode {
* public:
* int val;
* ListNode *next;
*
* ListNode(int val) {
* this->val = val;
* ... | ALGO | 0.999816 | 5.4952 |
9ae45467-b59f-4b1e-bd0e-974330b7fa3d | Ziklon/algorithms | tc/testprograms/TravellingByTrain.cpp | #include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
#defi... | ALGO | 0.998658 | 5.625764 |
865879ed-1885-4db9-8cc8-6f94cfdb06bc | debugster/UVa | uva-10131.cpp | //#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <bitset>
#include <string>
#include <utility>
#include <ite... | ALGO | 0.999982 | 3.803814 |
5c9f9cff-db7b-4c1d-a90e-111e0834caee | RutujaM05/flutter | class_app/Stateless/Container_in_centre/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.997718 | 6.776823 |
b63bf21a-09a3-4029-abda-385d7a799b55 | jamarshon/Leetcode | 230-239/239SlidingWindowMaximum.cpp | /*
239. Sliding Window Maximum
Given an array nums, there is a sliding window of size k which is
moving from the very left of the array to the very right. You can
only see the k numbers in the window. Each time the sliding window
moves right by one position.
For example,
Given nums = [1,3,-1,-3,5,3,6,7], and k = 3.
W... | ALGO | 0.999886 | 6.040254 |
87fae118-9797-4105-ba8c-cf808925509b | PiyushArora01/Coding | SPOJ/CRDS.cpp | #include <iostream>
using namespace std;
#define ll long long
int main()
{
int test;
cin >> test;
while(test--) {
ll n;
cin >> n;
ll mod = 1000007;
ll ans = (3*n*n + n)/2;
ans = ans%mod;
cout << ans << endl;
}
return 0;
}
| ALGO | 0.999853 | 4.352061 |
925814f4-51fa-42b1-82a2-d9600c5c8e8d | mihkhoi/baitap | Chuong 5 mang 1 chieu/Ky thuat them/266.cpp | #include<bits/stdc++.h>
using namespace std;
void input(int a[], int n)
{
for(int i = 0;i < n;i++)
{
cin >> a[i];
}
}
void output(int a[], int n)
{
for(int i = 0;i < n;i++)
{
cout << a[i] << " ";
}
}
void solve(int a[], int n, int k, int x)
{
for(int i = n + 1;i > k;i--)
... | ALGO | 0.999988 | 3.377022 |
2c2a2950-6ea0-487a-bf7f-8a3e01a6b253 | Sudhir769/LeetCode-GFG-Daily | 05 December 2024/lc-/Solution.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
bool canChange(string start, string target)
{
int n = start.length();
int i = 0, j = 0;
while (i < n or j < n)
{
while (i < n and start[i] == '_')
i++;
while (j < n an... | ALGO | 0.999868 | 3.92482 |
faf88b05-1773-4dff-b8a8-eb2d52adf073 | pamd/foo | faq/mitbbs/DP_cut_rod.cpp | /* Given a wooden stick of length L with m markings on it at arbitrary
* places (integral), and the markings suggest where the cuts are to
* be made accordingly. For chopping a L-length stick into two pieces,
* the carpenter charges L dollars (does not matter whether the two pieces
* are of equal length or not,... | ALGO | 0.999901 | 4.901086 |
401e4ce4-190c-430a-9fd9-20d3cb037024 | abdelqayyim/C-Tic-Tac-Toe | build-mac/Boost/doc/html/boost_asio/example/cpp14/parallel_group/parallel_sort.cpp | #include <boost/asio.hpp>
#include <boost/thread/thread.hpp>
#include <boost/asio/experimental/parallel_group.hpp>
#include <algorithm>
#include <chrono>
#include <functional>
#include <iostream>
#include <random>
template <
typename Executor,
typename RandomAccessIterator,
BOOST_ASIO_COMPLETION_TOKEN_FOR(... | ALGO | 0.999804 | 6.788676 |
0f7dae89-ee25-45b8-9600-00f612d9eeee | elmergustavo/ProgramasC | Programas en C++/programacion en c++/Nueva carpeta/ejercicio 2/main.cpp | #include <iostream>
using namespace std;
int main (){
int matriz[3][3];
for (int i=0; i<3; i++){
for (int j=0; j<3; j++){
cout<<"ingrese un valor ["<<i<<"]["<<j<<"]: ";
cin>>matriz[i][j];
}
}
cout<<"\n Matriz Original\n"<<endl;
for(int i=0; i<3; i++){
... | ALGO | 0.979967 | 3.225163 |
cf72e0c0-2143-4779-ba33-f7906342719f | MohammedNayaz/HackerRank-CPP-Language-Solutions | Functions.cpp | //Functions
#include <iostream>
#include <cstdio>
using namespace std;
/*
Add `int max_of_four(int a, int b, int c, int d)` here.
*/
int max_of_four(int a, int b, int c, int d)
{
if(a>b && a>c && a>d)
{
return a;
}
else if(b>c && b>d)
{
return b;
}
else if(c>d)
{
... | ALGO | 0.999787 | 4.198265 |
bc27731d-0e31-4805-8721-9d3d6368e83c | Mohamed-7018/ICPC-Assiut-NewComers-Sheet | sheet #7 Recursion/B. Print from 1 to N.cpp | #include<bits/stdc++.h>
using namespace std;
int counter= 1;
void print (int num) {
if(num == 0){
return;
}
cout << counter ++<<endl;
return print (num-1);
}
int main () {
int num ;
cin >> num;
print (num);
} | ALGO | 0.999532 | 3.832892 |
bc22ab7a-56ff-43f1-beb5-7fd6dd2a3e9e | uxth/leetcode | cpp/351.android-unlock-patterns.cpp | /*
Question
Formatted question description: https://leetcode.ca/all/351.html
Android devices have a special lock screen with a 3 x 3 grid of dots. Users can set an "unlock pattern" by connecting the dots in a specific sequence, forming a series of joined line segments where each segment's endpoints are two consecutive... | ALGO | 0.999975 | 7.137396 |
bf484427-2154-4f88-9ed1-258d3e1a1cce | pokibon3/ch32v | freqcounter/src/main.cpp | //
// freqcounter Ver 1.1
//
// 2024.07.31 New Create
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "fix_fft.h"
#include "ch32v003fun.h"
#define micros() (SysTick->CNT / DELAY_US_TIME)
#define millis() (SysTick->CNT / DELAY_MS_TIME)
// what type of OLED - uncomment just one
//#define SSD1306_... | TOOL | 0.901728 | 4.714107 |
5db1346a-6c25-4f63-a48a-a30ae9ecf16f | SangJae-Nam/cp-repo | 33696.cpp | #include <algorithm>
#include <iostream>
#include <utility>
#include <functional>
#include <vector>
#include <array>
#include <string>
#include <tuple>
#include <sstream>
#include <numeric>
#include <cassert>
#include <bitset>
#include <queue>
#include <limits>
#include <cmath>
#include <map>
#include <set>
#include <u... | ALGO | 0.999855 | 4.821318 |
187a14e7-011a-4fe2-9d8e-aad1c03c6c31 | sawon85/4185oj | 3613/3613/main.cpp | //
// main.cpp
// 3613
//
// Created by sawon on 2021/05/01.
//
#include <iostream>
#include <cstring>
using namespace std;
int main(int argc, const char * argv[]) {
ios_base::sync_with_stdio(false);
cout.tie(NULL); cin.tie(NULL);
string name;
cin >> name;
char a;
for(i... | ALGO | 0.999303 | 4.513567 |
af66b23c-d768-4b7e-a2e9-1e86626de2b0 | MaheshSharan/LeetCode_Automation | solutions/1600-1699/1617.Count Subtrees With Max Distance Between Cities/Solution.cpp | class Solution {
public:
vector<int> countSubgraphsForEachDiameter(int n, vector<vector<int>>& edges) {
vector<vector<int>> g(n);
for (auto& e : edges) {
int u = e[0] - 1, v = e[1] - 1;
g[u].emplace_back(v);
g[v].emplace_back(u);
}
vector<int> ans(... | ALGO | 0.999858 | 5.788897 |
a361a186-34f1-4427-a5d3-eb64f4616147 | 4ndrespabon/SIS-112PRACTICA_2 | Ejercicio_02_04.cpp | // Materia: Programacin I, Paralelo 4
// Autor: Andres Ignacio Pabon Sotomayor
// Fecha creacin: 30/08/2023
// Fecha modificacin: 30/08/2023
// Nmero de ejericio: 4
// Problema planteado: Un arreglo contiene las edades de un grupo de 50 personas con nmeros al azar,
// determine: el porcentaje de mayores (>=18 aos) y me... | ALGO | 0.996247 | 3.879069 |
64870400-46f3-4415-a72d-4bf80565db30 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Mixtral/top0-100/best-time-to-buy-and-sell-stock-iv-Solution.maxProfit/177906_DoS_Exec_Code_Overflow.cpp | SplashPath *Splash::makeDashedPath(SplashPath *path) {
SplashPath *dPath;
SplashCoord lineDashTotal;
SplashCoord lineDashStartPhase, lineDashDist, segLen;
SplashCoord x0, y0, x1, y1, xa, ya;
GBool lineDashStartOn, lineDashOn, newPath;
int lineDashStartIdx, lineDashIdx;
int i, j, k;
lineDashTotal = 0;
... | ALGO | 0.995201 | 4.793598 |
24293a26-143d-42cd-b7b5-bcd84fd9d04a | boazfrider/MyLeetCode | MiddleoftheLinkedList.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* middleNode(... | ALGO | 0.999567 | 5.757137 |
e9884939-4572-426d-bc1c-9e1f784d7269 | agam753/dsa_bootcamp_gdsc_miet | 5. Recursion and Stack/Sort a stack.cpp | void insert(int a, stack<int> &s){
if(s.empty() || a >= s.top())
{
s.push(a);
return;
}
int ele = s.top();
s.pop();
insert(a, s); // it finds the currect position of ele a in the stack
s.push(ele);
}
void SortedStack :: sort()
{
if(s.empty())
return... | ALGO | 0.999977 | 4.945861 |
755d7257-2525-4567-8703-b35980337fd7 | kento-yoshidu/cpp_algorithm | atcoder/abc0xx/abc022/a_best_body.cpp | // https://atcoder.jp/contests/abc022/tasks/abc022_a
#include <iostream>
#include <vector>
using namespace std;
int func(int n, int s, int t, int w, vector<int> a) {
int ans = 0;
int current = w;
if(w >= s && w <= t)ans++;
for (auto num: a) {
if (s <= current && current <= t) {
... | ALGO | 0.999269 | 4.804682 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.