uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
353bd661-0f6d-4b2d-a99b-8932a24d26ad | xiechengsheng/leetcode | 088-merge-sorted-array/merge-sorted-array.cpp | // Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
//
//
// Note:
// You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2. The number of elements initialized in nums1 and nums2 are m and n respectively.
c... | ALGO | 0.999953 | 5.91871 |
a7eadf65-9c68-4a53-9e3e-453b632ee1e7 | COVESA/vsomeip | implementation/endpoints/src/netlink_connector.cpp | #if defined(__linux__) || defined(ANDROID)
#include <thread>
#include <boost/asio/write.hpp>
#include <boost/asio/read.hpp>
#include <sstream>
#include <vsomeip/internal/logger.hpp>
#include "../include/netlink_connector.hpp"
namespace vsomeip_v3 {
void netlink_connector::register_net_if_changes_handler(const net... | WEB | 0.859739 | 7.737468 |
ea2c7349-ffc9-43d4-977f-f31b0ecd14af | ShivrajTheCoder/DAA-main | week9/DAA1.cpp | #include <bits/stdc++.h>
using namespace std;
void Dijkastras(vector<pair<int,int>> adj[],int n,int src)
{
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
vector<int> dist(n+1,INT_MAX);
vector<int> parent(n+1,0);
dist[src]=0;
parent[src]=src;
pq.push({0,src})... | ALGO | 0.99995 | 4.422484 |
c0185dc6-a32f-4ee1-b4f5-68c5ed436fa4 | AnandShastry/CPP_N_C_REPO | lambda.cpp | #include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
vector<int> vi;
for(int i=0;i<=9;i++)
vi.push_back(i);
std::for_each(vi.begin(),vi.end(),[](int j){cout<<j<<" ";});
cout << "" << endl;
int x=1;
int y=7;
//pass by value
for_each(vi.begin(),vi.end()... | ALGO | 0.99235 | 3.101794 |
6f076dbc-e5e0-4820-97fc-e813a1d4a38c | borisbulychev/bulychev_b_y | 0915a.cpp | #include <iostream>
using namespace std;
int main() {
int n, k , c= 0;
int a = 10 ^ 100;
int i = 0;
cin >> n >> k;
for (i = 0; i < n; i += 1) {
cin >> c;
if (k % c==0) {
a = std::min(k/c, a);
}
}
cout << a;
}
| ALGO | 0.999802 | 3.712057 |
125d7ae0-b2e3-43fd-bfb8-9b571e3b64ba | tde-nico/cses | dynamic_programming/grid_paths/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int main() {
int N;
cin >> N;
vector<vector<char>> grid(N+1, vector<char>(N+1, '\0'));
for (int i = 1; i <= N; ++i) {
for (int j = 1; j <= N; ++j) {
cin >> grid[i][j];
}
}
vector<vector<int>> dp(N+1, vector<int>(N+1, 0));
dp[1][1] =... | ALGO | 0.999928 | 5.045163 |
d65a98dd-15f1-472c-8b10-8f4ca2a5c508 | ikawaguchi/coinFireGet | coinFireGet/cocos2d/cocos/base/CCNS.cpp | #include "CCNS.h"
#include <string>
#include <vector>
#include <string.h>
#include <stdlib.h>
using namespace std;
NS_CC_BEGIN
typedef std::vector<std::string> strArray;
// string toolkit
static inline void split(const std::string& src, const std::string& token, strArray& vect)
{
size_t nend = 0;
size_t nbe... | TOOL | 0.884574 | 5.082911 |
c1190d09-5e40-4fd3-858a-7632f7d585b0 | yashdubey369/Codef | B_Rudolph_and_Tic_Tac_Toe.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long int
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
while(t--){
int cnt=0;
string a[3][1];
string s,ans="DRAW";
for (int i = 0; i < 3; i++)
{
cin>>a[i][0];
}
string s1=a[0][0],s2=a[1][0],s3=a[2][0... | ALGO | 0.999975 | 4.9122 |
48e5451f-5561-4458-9126-b1e8af4e062d | nouremara/Helios-Presi-HSB | helios-base-master/src/player/basic_actions/body_intercept2018.cpp | // -*-c++-*-
/////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "body_intercept2018.h"
#include "intercept_evaluator.h"
#include "basic_actions/basic_actions.h"
#include "basic_actions/body_go_to_point.h"
#include <rcsc/player/intercept_t... | ALGO | 0.981094 | 6.736197 |
3a0e6ae6-1c81-476d-89e0-37bc4fb6c3d2 | ong-wei-hong/coding-problems | kattis/snappereasy/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<long long>
#define vii vector<pair<int, int>>
#define pq priority_queue
#define forn(i, n) for(int i=0; i<int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.ren... | ALGO | 0.999873 | 5.006654 |
ee3de2c5-88a3-4802-a75f-4f368d17335d | akshat-shethia/Competitive-Coding-In-Cpp | Striver DP YT/1D Dp/FrogJump(CN).cpp | // link->https://www.codingninjas.com/studio/problems/frog-jump_3621012
#include <bits/stdc++.h>
vector<int> dp;
int f(int n, vector<int> &heights)
{
if (n == 0)
return 0;
if (dp[n] != -1)
return dp[n];
int left = f(n - 1, heights) + abs(heights[n] - heights[n - 1]);
int right = INT_MAX... | ALGO | 0.999983 | 5.525158 |
f655d980-e949-4ae2-b808-efd21b278173 | kns-1/ncrwork | C/Assignment-1/RealCalculatorBraces/RealCalBraces.cpp | #include<iostream>
#include<stdio.h>
#include<ctype.h>
using namespace std;
#define MAX 100
int top_operand = -1, top_operator = -1, result = 0;
int operand_stack[MAX]; //operand stack
char operator_stack[MAX]; //operator stack
void push_operand(int ele)
{
operand_stack[++top_operand] = ele;
}
void push_operator(cha... | ALGO | 0.999554 | 3.705446 |
3debb65e-aef5-4503-86b5-8360fe9540d4 | Md-Nasiat-Hasan-Fahim/Problem-Solving-with-C | .acmx/solutions/Virtual Judge - 2nd Marathon/B_Task_2_2.cpp | #include<bits/stdc++.h>
using namespace std;
#define FastIO ios_base::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define int long long
#define all(x) x.begin(),x.end()
#define pb push_back
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define check(x) cout << (#x) << " is " << (x) << endl;
const int mod ... | ALGO | 0.999673 | 3.283221 |
f437aecb-23ef-4f73-8134-749adf6eef0f | mansonjones/CppND-System-Monitor | src/linux_parser.cpp | #include <dirent.h>
#include <unistd.h>
#include <string>
#include <vector>
#include <thread> // Needed for delay in CpuUtilization()
#include <chrono> // Needed for delay in CpuUtilization()
#include <iostream> // delete after debugging
#include "linux_parser.h"
using std::stof;
using std::string;
using std::to_str... | TOOL | 0.942796 | 5.46714 |
393271c8-544a-4972-a92e-aef93d5555c8 | joy-mohajon/URI-Problem-solutions | uri 2031.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i;
char plyr1[10],plyr2[10];
cin >> n;
for (i=0; i<n; i++)
{
cin >> plyr1 >> plyr2;
// displaying decision according to
// the rules to determine a winner
if (plyr1[1]=='t')
{
if ... | ALGO | 0.999953 | 3.529176 |
e43a89ad-5563-42fb-8db8-be8229094750 | kaustubh-pandey/Competitive-Programming | Codeforces/praxtice/112A.cpp | #include<bits/stdc++.h>
#define ll long long
#define xll __int128
#define fo(i,n) for(int i=0;i<n;i++)
#define rfo(i,n) for(int i=n-1;i>=0;i--)
#define Fo(i,q,n) for(int i=q;i<n;i++)
#define rFo(i,q,n) for(int i=n-1;i>=q;i--)
#define fO(i,n,k) for(int i=0;i<n;i+=k)
#define FO(i,q,n,k) for(int i=q;i<n;i+=k)
#define zero... | ALGO | 0.999989 | 4.101362 |
dc1e2ef1-d0a1-4710-af14-dc02aff46af4 | iwannabeasenior/BasicProgramming | DSA/graph/Bellman-Ford.cpp | // đồ thị không có hướng , có thể có trọng số âm.
// Thuat toan voi do thi khong co chu trinh am
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
vector<ii> a[181220];
int n, m;
int d[181220];
bool inqueue[181220];
int pre[181220];
vector<int>path;
void bellman(int u) {
//Buoc 1: Khoi t... | ALGO | 0.999986 | 4.660142 |
02a7fe33-f1f6-435e-a798-63eb4551c2e9 | NasirAmiri/clean-code | BrownianMotionManifold-master/src/model.cpp | #include "model.h"
#include "common.h"
#include <omp.h>
#include <unordered_map>
double const Model::T = 293.0;
double const Model::kb = 1.38e-23;
double const Model::vis = 1e-3;
extern Parameter parameter;
Model::Model(){
rand_normal = std::make_shared<std::normal_distribution<double>>(0.0, 1.0);
//github te... | ALGO | 0.999719 | 4.353706 |
5622ac16-5a07-400a-9dbc-4bd33d43d820 | mono-1729/AtCoder_cpp | ABC/269/g.cpp | #include <bits/stdc++.h>
#include <unordered_map>
#include <stdlib.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <atcoder/all>
using namespace atcoder;
using namespace boost::multiprecision;
using namespace std;
#define rep(i, a, n) for(ll i = a; i < n; i++)
#define rrep(i, a, n) for(ll i = a; i >= n; i--)
#d... | ALGO | 0.999951 | 4.162592 |
36a345d6-211b-4033-9027-5f495a1dddfd | MObinXIV/a-Repo-to-get-back-My-level-of-the-devil | Algorithms/Graph/Problems/shortestPath/networkDelaytime.cpp | //https://leetcode.com/problems/network-delay-time/
#include<bits/stdc++.h>
using namespace std;
int networkDelayTime(vector<vector<int>>& times, int n, int k) {
vector<pair<int,int>>adj[n+1];
for(auto&it:times)
{
adj[it[0]].push_back({it[1],it[2]});
}
priority_queue<... | ALGO | 0.999955 | 5.947302 |
f2ade4cd-493c-45c2-82f5-e4c64f82cde9 | ymd45921/HUST-ACM-training | nowcoder/2020通常比赛/contest4462/G.cpp | /**
*
* 这个题目怎么有种既视感==
*
* C++4s,暴搜能过,好
*
* 但是还是又能做的事情的,比如优化,比如还有一个老哥
* 提出了一个看起来还有点意思的中位数方法。
*/
#include <iostream>
#include <cstring>
#include <utility>
using namespace std;
typedef long long longs;
typedef long double longd;
int mat[105][105];
longs row[105],col[105]; // 行、列的总值
longs res = 0;
pair<int... | ALGO | 0.999892 | 4.372902 |
e4b846c8-013a-4243-9414-db978486c17b | abdullahjohar23/newcomer-sheet-solutions | Sheet 3/E. Lowest Number.cpp | // Codeforces Handle: Abdullah_Johar
// Newcomer Sheet 3: E. Lowest Number
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
... | ALGO | 0.999917 | 4.786266 |
ed740b7a-e4ba-4746-8ab4-9c32a7d56318 | Kanis-Fatema-Shanta/LeetCode | 6. 4Sum II.cpp | //TC : O(n) MC : O(n)
class Solution {
public:
int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4) {
unordered_map<int,int> um;
for(auto &i: nums1)
{
for(auto &j:nums2) um[i+j]++;
}
int res{0};
for(auto &i: nums... | ALGO | 0.999938 | 6.262813 |
f16f1695-3a13-4b45-9085-5969af450b53 | Fisher87/leetcode | cplus/minimum-difference-between-largest-and-smallest-value-in-three-moves.cpp | // Time: O(n + klogk)
// Space: O(1)
class Solution {
public:
int minDifference(vector<int>& nums) {
static const int k = 4;
if (nums.size() <= k) {
return 0;
}
nth_element(begin(nums), begin(nums) + k, end(nums));
sort(begin(nums), begin(nums) + k);
nth... | ALGO | 0.999871 | 5.82169 |
1a6f1485-35b1-4257-9ead-94f9ac52d995 | Ted2016/TedLeetcodeAnswers | 289. Game of Life(c++)/289. Game of Life.cpp | class Solution {
public:
void gameOfLife(vector<vector<int>>& board) {
vector<vector<int>> tmp = board;
array<pair<int, int>, 8> check {make_pair(1, 0), make_pair(1, 1), make_pair(-1, 0)
, make_pair(-1, 1), make_pair(0, 1), make_pair(0, -1), make_pair(-1, -1), make_pair(1, -1)
};... | ALGO | 0.999853 | 6.548472 |
5cb0e9e8-45e2-49b9-8de5-ecaab1aff318 | zionsc/leetcode | Bit Manipulation/1915. Number of Wonderful Substrings/1915.cpp | #pragma GCC optimize('0fast','unroll-loops')
class Solution {
public:
long long wonderfulSubstrings(string word) {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long res=0;
int mask=0;
vector<int>count(1024,0);
count[0]++;
for(auto& c ... | ALGO | 0.999688 | 5.138757 |
5d080d15-5fed-4182-99df-9858f6a26687 | shubhamchandak94/LFZip | src/libbsc/libbsc/lzp/lzp.cpp | /*-----------------------------------------------------------*/
/* Block Sorting, Lossless Data Compression Library. */
/* Lempel Ziv Prediction */
/*-----------------------------------------------------------*/
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#i... | ALGO | 0.999668 | 3.820359 |
7885d103-c996-4734-b8f0-824ed2db7c79 | tayma-06/Basic_code | Contest/150_Problems_Contest/Christmas_Eve.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
long long N, K;
cin >> N >> K;
long long H[N];
for(int i = 0; i < N; i++){
cin >> H[i];
}
sort(H, H + N);
long long minimum_difference = 1000000000;
for(long long i = 0; i <= N - K; i++){
long long cu... | ALGO | 0.999903 | 3.742252 |
3eea2587-0073-4adc-82d2-22660a464716 | hritik211074/DSA-CODE | Graph Series/cycle_detection_in_a_directed_graph.cpp |
class Solution {
public:
// Function to detect cycle in a directed graph.
bool isCyclic(int V, vector<int> adj[]) {
vector<int>indegree(V,0);
for(int i=0;i<V;i++){
for(int &v:adj[i]){
indegree[v]++;
}
}
int count=0;
queue<int>que;
for(int i=0;i<V;i++){
... | ALGO | 0.999827 | 5.971879 |
a9a88360-9712-4503-8f44-888570d7f19b | jushcooly/baekjoonFile | 2073.cpp | //
// Created by 서준혁 on 5/3/24.
//
#include<iostream>
#include<vector>
using namespace std;
vector<int> vol, len;
int d,p;
int dp[100001];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>d>>p;
vol.resize(p);
len.resize(p);
for(int i =0; i<p; i++)
{
cin>>len[... | ALGO | 0.999184 | 3.925404 |
f30204c9-3e39-4e10-acbf-072d241631f5 | Jiyarathore/Leetcode | 0290-word-pattern/0290-word-pattern.cpp | class Solution {
public:
bool wordPattern(string pattern, string s) {
unordered_map<char,int>p;
unordered_map<string,int>w;
istringstream in(s);
string word;
int i=0,n=pattern.size();
for(word;in>>word;i++){
if(i==n || p[pattern[i]]!=w[wo... | ALGO | 0.999768 | 6.473375 |
252ceb8c-c288-44db-bf5b-55e298bdb510 | Zaber30/Codeforces-Github | B_Letters_Rearranging.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;
sort(s.begin(),s.end());
if(s.size()==1)
{
cout<<"-1"<<endl;
}
else if(s[0]==s[s.size()-1])
{
cout<<"-1"<<endl;
... | ALGO | 0.999869 | 4.042077 |
fa28fc86-88e9-4921-b734-7853f6e907af | kojima0615/Algorithm_library | code/BellmanFord.cpp |
//ベルマンフォード
class BellmanFord
{
public:
typedef struct Edge
{
ll from;
ll to;
ll cost;
Edge(ll f, ll t, ll c) : from(f), to(t), cost(c) {}
} Edge;
ll edge_num, vertex_num, start, goal;
vector<Edge> edges;
vector<ll> dist;
vector<ll> afby_nc;
BellmanFord(l... | ALGO | 0.999929 | 4.385762 |
fb9c9eb4-929e-48a8-bea2-b29c9933c47e | jayeshbhandarkar/Data-Structures-and-Algorithms | bubble.cpp | #include <iostream>
using namespace std;
void bubbleSort(int arr[], int n) ;
int main()
{
int n,i;
cout << "Enter the number of elements: ";
cin >>n;
int arr[n];
cout << "Enter the elements: ";
for (i = 0; i < n; i++)
{
cin >> arr[i];
}
bubbleSort(arr, n);
cout << "S... | ALGO | 0.999506 | 5.005084 |
99f1082c-0bbd-4f0c-9d87-9a7f47c8e34c | srbcheema1/cheema-freezer | enc_dec.cpp | #include <bits/stdc++.h>
using namespace std;
int key=1;
fstream fin,fout;
string file_name,ext;
void decrypt(string str,int key){
int i;
char a='a';
for(i=0;i<str.size();i++)
{
a=str[i];
a=(a+key)%128;
fout<<a;
}
}
void encrypt(string str,int key){
int i;
c... | TOOL | 0.929816 | 3.39031 |
62167d7b-d815-43e5-9b54-9273b17f4c59 | Inuyashaaaaa/IntroductionToAlgorithmicContests | Chapter 7-Brute force/$ 7.7.cpp | #include<bits/stdc++.h>
using namespace std;
struct Tree {
double L, R; // distance from the root to the leftmost/rightmost point
Tree():L(0),R(0) {}
};
const int maxn = 6;
int n, vis[1<<maxn];
double r, w[maxn], sum[1<<maxn];
vector<Tree> tree[1<<maxn];
void dfs(int subset) {
if(vis[subset]) return;
vis[su... | ALGO | 0.999957 | 3.803407 |
3c67f1ba-0b73-45f2-9e3b-37109ec2c982 | boatinw99/CompetitiveProgramming | Codeforces/846B.cpp | #include<bits/stdc++.h>
using namespace std;
main()
{
int a,b,c,i,j,count,value,n,pr=0 ;
scanf("%d %d %d",&a,&b,&c);
int s[b],max=0;
for(i=0;i<b;i++)
{
scanf(" %d",&s[i]);
max+=s[i];
}
sort(&s[0],&s[b]);
for(i=0;i<=a;i++)
{
count=max*i;
value=i*(b+1);
if(count<=c)
{
for(j=0;j<b&&count<=c;j++)
... | ALGO | 0.99995 | 3.180119 |
26ad1af2-60ca-4525-b596-f1bb3af3bf66 | shantanushrivastava/c-imp- | linkedList.cpp/middle_insert.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node*next;
Node(int val){
data = val;
next = NULL;
}
};
class List{
public:
Node* head;
Node* tail;
List() {
head =NULL;
tail =NULL;
}
void push_front(int val){
Node* newNod... | ALGO | 0.999646 | 4.105323 |
bc793f77-4f99-4bc6-9679-7a54b3dd5396 | opencv/opencv | 3rdparty/openexr/IlmImf/dwaLookups.cpp | #define OPENEXR_BUILTIN_TABLES
//
// A program to generate various acceleration lookup tables
// for Imf::DwaCompressor
//
#include <cstddef>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <OpenEXRConfig.h>
#ifndef OPENEXR_BUILTIN_TABLES
#ifdef OPENEXR_IMF_HAVE_SYSCONF_NPROCESS... | ALGO | 0.966214 | 5.427552 |
9020f16a-abb7-426b-b3b3-b7b2e111050c | mayankchauhan971/CppCodes | Strings/q2_anagrams.cpp | #include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
string input1;
cin >> input1;
string input2;
cin >> input2;
int n = input1.length();
int m = input2.length();
bool isCopy = true;
if(n == m){
sort(input1.begin(), input1.... | ALGO | 0.999984 | 4.54219 |
75dacb0f-438d-464d-b8a8-65de404fff83 | FarPluginsArchive/farplug-Maximus-archive | Far3bis2798/filefilter.cpp | /*
filefilter.cpp
*/
#include "headers.hpp"
#pragma hdrstop
#include "filefilter.hpp"
#include "keys.hpp"
#include "ctrlobj.hpp"
#include "filepanels.hpp"
#include "panel.hpp"
#include "vmenu.hpp"
#include "scantree.hpp"
#include "array.hpp"
#include "filelist.hpp"
#include "message.hpp"
#include "config.hpp"
#inclu... | TOOL | 0.944233 | 5.594338 |
a7289766-efd8-408c-aee4-ab437f675734 | KeepCodeing/AlgorithmRecords | LeetCode/字符串/125验证回文串.cpp | #include <iostream>
#include <algorithm>
using namespace std;
// ΪǴСдŵȣԿȥַȻһַٷתԱ
// עĿ˵ַҲַпȻûУ
// ֺԵֵ
class Solution {
public:
char toLowCase(char c) {
return c >= 'A' && c <= 'Z' ? c + 32 : c;
}
bool isPalindrome(string s) {
int sLen = s.size();
string temp1, temp2;
for (int i = 0; i < sLen; ... | ALGO | 0.99934 | 4.446846 |
7913ad36-0698-4f07-a804-3c5880dd9126 | heechan3006/CS | BOJ/BOJ_17472/Project6/소스.cpp | #include <iostream>
#include <queue>
#include <cstring>
#include <vector>
#define MAXN 10
#define INF 987654321
using namespace std;
int map[MAXN][MAXN];
bool visited[MAXN][MAXN];
int dist[7][7];
int max_v = 0;
int N, M;
struct node {
int u;
int v;
int weights;
};
vector<node> adj;
vector<bool> used;
int dx[] = { 0... | ALGO | 0.999962 | 4.137008 |
8d9b5771-1b29-42fd-851c-f3e74aa1d34c | wonseokdjango/job_interview | 01_sorting_algorithms/merge_sort.cpp | #include <cstdio>
int N;
int ARR[1000000 + 1];
void sort(int arr[], int s, int e) {
}
int main(void) {
scanf(" %d", &N);
for (int it = 0; it < N; ++it)
scanf(" %d", &ARR[it]);
sort(ARR, 0, N - 1);
for (int it = 0; it < N; ++it)
printf("%d\n", ARR[it]);
return 0;
}
| ALGO | 0.999765 | 3.933604 |
0ce54c05-440c-44c8-9d0f-abc28ac19c49 | kritirikhi/DataStructuresAndAlgorithms | buildingTreeFromPreorder.cpp | #include <iostream>
using namespace std;
class node{
public:
int data;
node* left;
node* right;
node(int d){
data=d;
left=right=NULL;
}
};
node* buildtree(node* root){
int d;
cin>>d;
if(d==-1){
return NULL;
}
root=new node(d);
root->left=buildtree(... | ALGO | 0.999907 | 4.871321 |
64d025c4-0cdc-4ba3-b4f8-3a650c48c6b6 | barkhagupta2104/100-Days-of-code | day31/avgvalue of even number that are divisible by three.cpp | int t=0,sum=0;
for(int i=0;i<nums.size();i++)
{
if(nums[i]%6==0)
{
t++;
sum+=nums[i];
}
}
if(t==0)
return 0;
else
return sum/t;
}
| ALGO | 0.999564 | 3.669147 |
4231318c-0592-465a-b549-ff907ab925ea | raincross7/code-similarity | codes/train_code/problem413/problem413_290.cpp | //organize and stay in moment - Abhinav IIIT-A
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,x,n) for(int i=x;i<n;++i)
#define ar array
#define MAXN (int)2e5+5
#define pb push_back
int mod= 998244353;
int arr[MAXN];
int as;
void input(){
cin>>as;
f(i,0,as) cin>>arr[i];
}
int mod2=9... | ALGO | 0.999836 | 3.97272 |
e39ad109-b93f-47cb-9bf6-6289743da0d3 | caitlynchau/cs134 | lab4/ParticleSystem.cpp |
// Kevin M.Smith - CS 134 SJSU
#include "ParticleSystem.h"
void ParticleSystem::add(const Particle &p) {
particles.push_back(p);
}
void ParticleSystem::addForce(ParticleForce *f) {
forces.push_back(f);
}
void ParticleSystem::remove(int i) {
particles.erase(particles.begin() + i);
}
void ParticleSystem::setLife... | TOOL | 0.883232 | 6.129504 |
4edf0fc2-a361-4622-bec0-44f7993a004e | ayanisation/DSA-practice-questions | Binary_Tree/p30_findKthSmallest.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node* buildTree(string str)
{
// Corner Case
if(str.length() ... | ALGO | 0.999907 | 5.899169 |
9242d417-2d45-47a6-871b-b1742223d028 | bevindavivian/Sekuro2024 | Tugas Pendahuluan Modul 2/TP_Modul_2_19623228_Bonus.cpp | #include <iostream>
using namespace std;
//Tidak boleh membuat global variable
// fungsi untuk menghitung jumlah array
int jumlah(int arr[], int size) {
int total = 0;
for (int i = 0; i < size; ++i) {//untuk setiap i dari 0 sampai ke size-1
total += arr[i]; // menambahkan elemen array i (looping) dan m... | ALGO | 0.997875 | 4.882153 |
97dae5d5-17d6-45ae-ab51-8cd9ae2037a3 | xyb7910/cpp_fire | hetao_contest/month/202502数论补考/a.cpp | /*
* @Author: Yanpb
* @Date: 2025-03-03 16:21:17
* @Last Modified by: Yanpb
* @Last Modified time: 2025-03-03 16:27:50
*/
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#define x first
#define y secon... | ALGO | 0.999813 | 3.512128 |
bb2377f4-3ca6-4806-80d6-a62c40443a8c | better-call-vee/Cpp-programming | GraphYKW_DFS.cpp | /*
### Depth First Search (DFS) ###
**What is DFS?**
- DFS explores a graph by visiting nodes starting from a source node and moving
as far as possible along each branch before backtracking.
- It uses recursion or an explicit stack to manage the traversal.
- DFS is commonly used for:
1. Checking if a graph is connec... | ALGO | 0.99991 | 5.964462 |
44787fae-d2fa-49bf-bbba-cff1afe26904 | alvarolm1/v43 | task1/mayorMenorParalelizable.cpp | #include <iostream>
#include <stdio.h>
#include <omp.h>
// using namespace std;
int main(){
double start=omp_get_wtime();
int vector[] = {0,1,2,3,4,5,6,7,8,9,10};
int mayor;
int menor;
int i=0;
mayor=vector[0];
menor=vector[0];
omp_set_num_threads(10);
#pragma omp parallel
{
... | ALGO | 0.999797 | 3.327253 |
bc845378-574d-4b07-a087-18c35a2ffcd9 | csl-iisc/SUV-MICRO24 | llvm/lld/wasm/Relocations.cpp | #include "Relocations.h"
#include "InputChunks.h"
#include "OutputSegment.h"
#include "SymbolTable.h"
#include "SyntheticSections.h"
using namespace llvm;
using namespace llvm::wasm;
namespace lld {
namespace wasm {
static bool requiresGOTAccess(const Symbol *sym) {
if (!config->isPic &&
config->unresolvedS... | TOOL | 0.883883 | 7.131329 |
859a05da-88be-414e-839c-c1c9243ca3dc | mir183/LeetCode | 78Subtree of Another Tree/m.cpp | #include<bits/stdc++.h>
using namespace std;
// Paste here
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), left... | ALGO | 0.999955 | 6.027293 |
b330c465-4bd9-4467-928c-a11ce62ad9f6 | cedongne/Algorithm_Practice | Baekjoon_Solution/DP/1949_Outstanding_Village.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
vector<int> residentCount;
vector<int, int> villageLink;
int village_num;
int tmp_resident_num;
scanf("%d", &village_num);
for(int count = 0; count < village_num; count++){
scanf("%d", &tmp_resident_num);
r... | ALGO | 0.999753 | 3.322501 |
dd27c0a5-ad8e-4686-94d1-c6c9a46866e1 | NuriyaGureva/Project-1 | Fraction/main.cpp |
# pragma warning (disable:4326)
#include<iostream>
using std::cin;
using std::cout;
using std::endl;
class Fraction;
Fraction operator*(Fraction left, Fraction right);
Fraction operator/(Fraction left, Fraction right);
Fraction operator+(Fraction left, Fraction right);
Fraction operator-(Fraction left, Fraction righ... | TOOL | 0.919077 | 4.03671 |
4f6986c5-c8d5-424a-937a-860abc569137 | rajeevrpandey/Coding-Ninjas-Solutions-CPP | Lecture 11 : Trees/Code : Find sum of nodes.cpp | /*
Given a generic tree, find and return the sum of all nodes present in the given tree.
Input format :
The first line of input contains data of the nodes of the tree in level order form. The order is: data for root node, number of children to root node, data of each of child nodes and so on and so forth for each node.... | ALGO | 0.999341 | 5.963272 |
aea9ed0a-8288-4f22-a0dd-5832b8247848 | lenfgh/CPP-Learning | BIT Lexue/Topic3/couple prime/couple prime directly.cpp | // This is the solution of the
// Created by FUGUO on 2024/11/2.
//
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int n, m;
int isPrime( int ); // 若是素数函数isPrim返回1,否则返回0
cin >> n >> m;
while ( n < m-1 )
{
if ( isPrime(n) && isPrime(n+2) )
{
cou... | ALGO | 0.999911 | 4.559052 |
702cfba2-85a8-4580-812d-b5af803369ca | V41BH4VR4JPUT/DSA-practice | Character Array and Strings/ques5.cpp | // Replace spaces to @40
#include <bits/stdc++.h>
using namespace std;
string ReplaceSpace(string &s){
string temp = "";
for(int i = 0 ; i < s.length() ; i++){
if(s[i] == ' '){
temp.push_back('@');
temp.push_back('4');
temp.push_back('0');
}
else
... | ALGO | 0.996089 | 4.265622 |
43b9a9f9-67d7-4d03-ac6e-5eda8e494690 | jonayet/e-braille-app | E-BrailleBasics/libraries/tess-two/jni/com_googlecode_tesseract_android/src/ccmain/tesseract_cube_combiner.cpp | // The TesseractCubeCombiner class provides the functionality of combining
// the recognition results of Tesseract and Cube at the word level
#include <algorithm>
#include <string>
#include <vector>
#include <wctype.h>
#include "tesseract_cube_combiner.h"
#include "cube_object.h"
#include "cube_reco_context.h"
#incl... | ALGO | 0.954256 | 7.432499 |
f7faa372-ab04-4920-9d5c-136432471656 | DuNai0524/algorithm_solving | leetcode/editor/cn/LeetCode402.cpp | #include <bits/stdc++.h>
using namespace std;
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
public:
string removeKdigits(string num, int k) {
}
};
//leetcode submit region end(Prohibit modification and deletion)
int main() {
Solution s;
} | ALGO | 0.999927 | 6.118042 |
fee297bf-25b6-4952-852e-ed9f8963664a | satviktiwari/LeetCode | 1833-maximum-ice-cream-bars/1833-maximum-ice-cream-bars.cpp | class Solution {
public:
int maxIceCream(vector<int>& costs, int coins) {
sort(costs.begin(), costs.end());
int ans = 0;
for(int i = 0; i < costs.size(); i++){
if(costs[i] <= coins){
ans++;
coins -= costs[i];
}
}
return ... | ALGO | 0.999604 | 6.000073 |
be1b0ca3-83d8-47fc-97a3-1878127a0cac | nehcoah/algorithm-template | codeforces/2000(div3)/c.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
using u32 = unsigned;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int m;
cin >> m;
while (m--) {
string s; cin >> s;
... | ALGO | 0.999922 | 5.374294 |
d6ece14b-ec70-44aa-abb6-06f3e2472ad8 | siva786t/Leetcode | StudyPlan/DataStructures/1c_ClimbingStairs.cpp | // 70. Climbing Stairs
// Easy
// You are climbing a staircase. It takes n steps to reach the top.
// Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
// Example 1:
// Input: n = 2
// Output: 2
// Explanation: There are two ways to climb to the top.
// 1. 1 step + 1 s... | ALGO | 0.999958 | 5.722002 |
463cd20e-da10-40e5-9944-1bf3af37b244 | MridulGupta75/Leetcode-Daily-challanges-all | 1283-find-the-smallest-divisor-given-a-threshold/1283-find-the-smallest-divisor-given-a-threshold.cpp | class Solution {
private:
int func(int mid,vector<int>&nums)
{
int sum=0;
for(auto&x:nums)
{
int k=ceil(x/(mid*1.0));
sum+=k;
}
return sum;
}
public:
int smallestDivisor(vector<int>& nums, int threshold) {
int l=1,h=*max_element... | ALGO | 0.999979 | 6.102338 |
aaded187-f5f4-4075-bfaa-7d5739184015 | zech-chi/CodeForces | training/A/A_Bicycle_Chain.cpp | /*
* zech-chi
*/
#include <algorithm>
#include <cstddef>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <iterator>
#include <set>
#include <vector>
#include <numeric>
#include <cmath>
#include <stack>
#include <iomanip>
typedef long long ll;
using namespace std;
#define abs(a) (((a) > 0) ? (a) : (... | ALGO | 0.999594 | 3.631534 |
8f503a50-d792-4202-9e1c-e4d712a7e352 | 0211Abhay/SDE-Training | Codes_by_Manan_Sir/Arrays/prefix_sum.cpp | #include <bits/stdc++.h>
using namespace std;
// using namespace std::chrono;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
#define fastIO \
ios_base::sync_with_stdio(false... | ALGO | 0.999717 | 4.236486 |
f1c9c72f-c076-4734-92e9-ddd3563f5f59 | Uniquegaurav/DPandGraph | LinkedList/Remove duplicateelementfromSortedLinkedList.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
//Function to remove duplicates from sorted linked list.
Node *removeDuplicates(Node *head){
if(head==NULL){
return head;
}
Node *t1 = head;
Node *t2... | ALGO | 0.999791 | 4.237288 |
2efd1873-03e9-4445-a267-65c100eb5f43 | pblan/aoc-2021 | day17/src/main.cpp | #include <chrono>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <numeric>
#include <bits/stdc++.h>
#include <util.h>
// split string
std::vector<std::string> split(const std::string &s, const std::string &delim) {
std::vector<std::string> elems;
size_t pos = 0;
size_t... | ALGO | 0.997003 | 5.516273 |
8c9d7723-523f-4ce4-bfa2-bc2daffc8852 | AntennaeVY/CP | CodeForces/1300/Particles.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
int n;
cin >> n;
vector<long long> a(n);
for(auto &ai : a) cin >> ai;
long long s[2] = {0, 0};
for(int i=0; i < n; i++) {
s[i%2] += max(a[i], 0LL);
}
int x = *max_element(a.begin(), a.end());
... | ALGO | 0.999865 | 4.649259 |
dacf8d65-08b4-46f1-8424-727ad9c04d39 | fathimasafala/calender_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.998733 | 6.76775 |
3a5dfd20-910c-4684-a93c-4e26f3d8745a | BhandariSakshi/C-Plus-Plus-Programs | ArrNumFrequency.cpp | # include <iostream>
using namespace std;
class ArrayX
{
private:
int iSize = 0;
int *Arr = NULL;
public:
ArrayX(int iNo)
{
cout << "Inside constructor: " << endl;
iSize = iNo;
Arr = new int[iNo];
}
~ArrayX()
{
... | ALGO | 0.99937 | 4.68436 |
20fffca4-b58e-42e9-b7a8-a9dcd7e066c6 | akashghadge/competitive-programming | Company Test/Nilesh Python/B.cpp | #include <bits/stdc++.h>
using namespace std;
int lcm(int a, int b) { return (a * b) / __gcd(a, b); }
void print(vector<int> arr)
{
for (auto val : arr)
cout << val << " ";
cout << endl;
}
vector<int> solve1(vector<int> &arr, int n)
{
while (true)
{
n = arr.size();
vector<int> n... | ALGO | 0.99999 | 3.828604 |
908fe1be-2ee1-401a-bafe-9769618265a0 | arpan-dey-xo/LeetCode-POTD | 29-05-25.cpp | class Solution {
public:
int dfs(int node, int parent, int depth,
const vector<vector<int>>& children, vector<int>& color) {
int res = 1 - depth % 2;
color[node] = depth % 2;
for (int child : children[node]) {
if (child == parent) {
continue;
... | ALGO | 0.999949 | 5.884001 |
a9de3e76-0dcf-48f3-9b83-32f1f0e6b8b6 | Aaqib925/Cpp | switch.cpp | #include <iostream>
using namespace std;
int main(){
int x;
cout << "Enter the number from 0 to 6: ";
cin >> x;
string DayName;
switch (x)
{
case 0: DayName = "Sunday"; break;
case 1: DayName = "Monday"; break;
case 2: DayName = "Tuesday"; break;
case 3: DayName = "Wednesday";... | TOOL | 0.966185 | 3.69255 |
000de081-c4c1-43cc-b854-bedbd04b4881 | startingfindmistake/C1 | ctt.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
char str[BUFSIZ], tmp[BUFSIZ];
long sum = 0, cnt = 0;
printf("Input some string : ");
scanf("%s", str);
for (int i = 0; i <= strlen(str); i++) {
if (str[i] >= '0' && str[i] <= '9') {
tmp[cnt++] = str[i... | ALGO | 0.998741 | 3.514129 |
ee9e63fa-296a-4e6e-86b2-baeb675e9b40 | ramancoder123/100-Days-of-DSA | Day11/binarytolist.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
struct Node {
int key;
Node *left, *right;
};
/* utility that allocates a new Node
with the given key */
Node* newNode(int key)
{
Node* node = new Node;
node->key = key;
node->left = node->right = NULL;
return (n... | ALGO | 0.9997 | 6.997562 |
a5f47014-032e-4e5b-9e42-36614cff71a5 | SambasBoyyyy/NSUPS_1 | id_ship.cpp | #include<iostream>
using namespace std;
int main(){
int times;
cin>>times;
while (times--)
{
char c;
cin>>c;
if (c == 'c' || c == 'C')
{
cout<<"Cruiser"<<endl;
}
else if (c == 'B' || c == 'b')
{
cout<<"BattleShip"<<endl;
}
else if (c == 'D' || c == 'd')
{
... | ALGO | 0.995527 | 3.05637 |
b77423aa-de09-4946-ad5f-8a1662ec4745 | lifecycles1/competitive-programming | codesignal/arcade/2.core/12.list backwoods/5.crossingSum.cpp | // Given a rectangular matrix and integers a and b, consider the union of the ath row and the bth
// (both 0-based) column of the matrix (i.e. all cells that belong either to the ath row or to the bth
// column, or to both). Return sum of all elements of that union.
#include <iostream>
#include <vector>
class Solut... | ALGO | 0.999931 | 5.975863 |
41bd55dd-2333-45b0-a7de-2cf8fbc45ea2 | codingFungus/CS3451 | ext/eigen/bench/quat_slerp.cpp | #include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Q>
EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t)
{
return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized());
}
template<typename Q>
EIGEN_DONT_INL... | ALGO | 0.991748 | 6.251058 |
a5ae94bc-b807-4708-98cd-ab4bf802bff0 | nishatlea/Programming | DS + Algorithm codes/Binary_searching.cpp | #include<bits/stdc++.h>
using namespace std;
int b_search(int h, int l, int x, int arr[])
{
int mid;
while(l<=h)
{mid = (l+h)/2;
if(arr[mid]==x)
return mid;
else if( arr[mid]>= x)
{
h= mid -1;
b_search(h,l,x,arr);
}
else
{
l = mid +1;
b_sear... | ALGO | 0.999943 | 4.565341 |
78ff32cd-2097-42d5-b621-0f2d09b05d2d | aeternalis1/Contest-problems | IOI/IOI-'09-P3-Poi.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 201;
typedef long long ll;
struct s{
int a,b,c;
bool operator<(const s&e){
if (e.a==a){
if (e.b==b){
return e.c>c;
}
return e.b<b;
}
return e.a<a;
}
};
int main(){
... | ALGO | 0.999873 | 3.64704 |
d5ce317a-2e01-445c-a741-0b8a92109090 | Teafox-Yang/GAMES202_HW_TEAFOX | 2.Environment Lighting-PRT/prt/ext/tbb/examples/parallel_for/tachyon/src/intersect.cpp | /*
* intersect.cpp - This file contains code for CSG and intersection routines.
*/
#include "machine.h"
#include "types.h"
#include "intersect.h"
#include "light.h"
#include "util.h"
#include "global.h"
unsigned int new_objectid(void) {
return numobjects++; /* global used to generate unique object ID's */
}
uns... | TOOL | 0.968677 | 5.815677 |
bd5b7989-707c-4be6-ae5e-efae4c49f343 | ishandutta2007/codeforces | abc864197532/normal/1371/B.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (lli i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define printv(a) {\
for ... | ALGO | 0.999768 | 4.803188 |
f5340973-e883-4766-a1a9-cd3ed11fd73b | Nikita110602/-CrackYourPlacement | Array/Subarrays_Sum_Divisible_By_K.CPP |
class Solution {
public:
int subarraysDivByK(vector<int>& nums, int k) {
int n = nums.size();
int sum = 0;
int count = 0;
unordered_map<int, int> m;
m[0] = 1;
for (int i : nums) {
sum += i;
int mod = sum % k;
if (mod < 0)
... | ALGO | 0.999936 | 6.075543 |
7ce48d12-7d79-4680-bfd2-646e3730d1b4 | imranakki/Competive-Programming-Problems | Multiplication.cpp | #include <bits/stdc++.h>
#define for_n(i, a, n) for (ll i = a; i < n; i++)
#define ll long long
#define v(t) vector<t>
using namespace std;
void print(v(ll) &v){
for_n(i, 0, v.size()){
cout << v[i] << " ";
}
cout << endl;
}
int main()
{
ll n;
cin >> n;
v(ll) num(n), fnum;
for_n(i, ... | ALGO | 0.999927 | 3.420871 |
2edb2a52-541b-47c2-a99d-18c804d70352 | VaishnaviMishra/CPP_Assignment | Assignment5/Que01.cpp | #include<iostream>
using namespace std;
class Distance
{
private:
int feet;
int inch;
public:
Distance()
{
this->feet = 0;
this->inch = 0;
}
Distance(int feet, int inch): feet(feet), inch(inch)
{
}
void accept()
{
cout << "Please enter feet: ";
... | ALGO | 0.920304 | 3.56424 |
82626cfd-99dd-450d-a544-3850c4ac9465 | jonK341/MasterNoder | src/pubkey.cpp | #include "pubkey.h"
#include <secp256k1.h>
#include <secp256k1_recovery.h>
namespace
{
/* Global secp256k1_context object used for verification. */
secp256k1_context* secp256k1_context_verify = nullptr;
} // namespace
/** This function is taken from the libsecp256k1 distribution and implements
* DER parsing for EC... | TOOL | 0.930684 | 7.41997 |
d17ee579-3928-415c-9f46-f170bb876ae9 | HossameTor/The_100_Days_In_Codeland_Solutions | Week 2/C-Bizutage bla tqra3.cpp | #include <bits/stdc++.h>
using namespace std;
void fx();
int main() {
int t; for(cin >> t; t-- ; ) fx();
return 0;
}
void fx(){
int n, ans=0; cin >> n;
string s; cin >> s;
map<char, int> mp;
for(char c:s){
if(mp[c]==0) ans+=2;
else ans++;
mp[c]++;
}
cout << ... | ALGO | 0.999106 | 4.017568 |
12d829e1-7aac-4a02-b682-cc77bb753962 | GopherTeen/OJ_Code | Problems/Codeforces/1701-1800/1798/D_Shocking_Arrangement.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#endif
using namespace std;
using ll = long long;
static constexpr int MOD = 1'000'000'007;
// 前置:https://leetcode.cn/problems/maximum-absolute-sum-of-any-subarray/ 任意子数组和的绝对值的最大值
void solve() {
int n;
cin >> n;
vector<int> vec(n);
for (int... | ALGO | 0.999927 | 5.392567 |
01d35b0c-b953-4676-9d2e-421d2ce662c6 | abhipray-cpu/cpp | Strig Algorithms/Questions/Chutiye/PatternIn2dMatrix.cpp | //copy mei code likha hai dekhlena mei nhi kar rha yei faltu ka chutiya hai
//and we can use map<pair<row,col>,bool> to keep record whether the
//cell was visited or not
#include<bits/stdc++.h>
using namespace std;
#define MAX 5
class PatternMatch
{
public:
string pattern;
char Mat [MAX][MAX]; //this is th... | ALGO | 0.99965 | 4.42655 |
b24b7a13-3e3e-447f-9360-fe97f3097372 | tjdans6342/BaekJoon-Online-Judge | 100 challenge/2743.cpp | #include <bits/stdc++.h>
#include <string.h>
using namespace std;
int main()
{
//int cnt=0;
char q[101];
scanf("%s", q);
printf("%d", strlen(q));
// for(int i=0;true;i++)
// {
// if(q[i] == 0) break;
// cnt++;
// }
// printf("%d",cnt);
return 0;
} | ALGO | 0.998431 | 3.128974 |
56ef3262-2a0a-4ea1-949e-e7f53f9cab8c | MateusX10/Exs-c-faculdade | exercicios_a_comentar/ex29.cpp | // Ex: 29
// Autor : Renan D Costa, Mateus Henrique de Souza Medeiros (apenas comentei o cdigo, mas no fui eu quem desenvolveu o programa)
//Inclue a biblioteca de entrada e sada de dados
#include <stdio.h>
//Tambm inclui libre de I/O de dados
#include <iostream>
//Main Function
int main()
{
//Declara varivel do... | ALGO | 0.94088 | 3.536622 |
7504ecd3-59e6-44d7-a553-bfea307ccd1a | Thrinaria/Codebase | boost_1_34_1/boost_1_34_1/libs/numeric/ublas/doc/samples/vector_slice_project.cpp | #include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v (3);
for (int i = 0; i < 3; ++ i)
project (v, slice (0, 1, 3)) (i) = i;
std::cout << project (v, ... | ALGO | 0.97323 | 3.176859 |
b49dd311-c87f-4c28-9987-0f7979be33fe | Sephtis6/NumberSorting | Sorting/Sorting.cpp | // Sorting.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include "Sorting.h"
#include <iostream>
#include <time.h>
//allows the use of namespace std and declares void to be used in the cpp file
using namespace std;
void DisplayUserCommands();
void bubbleS... | ALGO | 0.993389 | 4.475563 |
2634f8de-6b66-48ea-b0a9-d0747220e16b | mbawhitefield/urban_cab | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
65bb834f-237b-4b80-81e1-9066b4b868de | kgarun/Competitive-programming | Others/1049 - One Way Roads.cpp | /*
* @Author: kg
* @Date: 2017-12-30 16:19:13
* @Last Modified by: kg
* @Last Modified time: 2017-12-30 16:36:05
*/
#include <bits/stdc++.h>
using namespace std;
#define rz resize
#define ff first
#define ss second
#define eb emplace_back
#define pb push_back
#define um unordered_map
#define mkp(x,y) make_pair((x)... | ALGO | 0.999776 | 4.549093 |
90539e8c-3035-4703-a875-66c2a5784312 | SonuRajput1010/DSA_GFG | Medium/Minimum steps to destination/minimum-steps-to-destination.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int minSteps(int d) {
// code here
int sum = 0;
int steps = 0;
while(sum!=d) {
sum+=steps... | ALGO | 0.999706 | 6.220091 |
b090a54b-263c-4610-bf2b-4c9df98ac867 | Alok1721/CompetitiveCoding_DSA | resources/Tree-Theory/FenwickTree.cpp | class FenwickTree {
public:
vector<int> bit; // Binary Indexed Tree
int n;
FenwickTree(int size) {
n = size;
bit.assign(n + 1, 0); // 1-based indexing
}
// Adds 'val' at index 'i' (0-based)
void update(int i, int val) {
i++; // Convert to 1-based
while (i <= n... | ALGO | 0.999631 | 6.491698 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.