uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
83e13868-12e7-4ef2-b33a-c73e063151d1 | d3b5/Beecrowd-URI-solutions | cpp+c/Event.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a;
long long int b;
while(true)
{
cin >> a >> b;
if(a==0) break;
cout << a*b << endl;
}
return 0;
} | ALGO | 0.999462 | 3.583994 |
0be727ba-57b8-4445-b563-0387cb2f1493 | OptimusRahul/data-structrues-and-algorithms | codechef/pratice/dsa learning series/1. complexity analysis + basic warm up/ZCO14003.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n; cin >> n;
long long price[n];
for(int i=0; i<n; i++) {
cin >> price[i];
}
long long ans = LONG_MIN;
sort(price, price+n);
for(... | ALGO | 0.999801 | 4.084094 |
cef3d51b-c7a2-437c-a2bd-ec1dc02233a6 | ScrimBundy/CompetitiveCoding | LeetCode/572 - Subtree of Another Tree/Accepted/2022-10-29_1.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.999979 | 6.490665 |
9125967a-31fe-447a-9cef-7479df45d43b | moizzulfiqar24/app_dev_assign2 | 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.998799 | 6.776823 |
9ba39c52-3ba0-401b-b972-ae9a0d91825b | ghost1412/Programs | Data-Structure/bfs.cpp | #include<iostream>
#include<vector>
#include <queue>
using namespace std;
struct edge{
int e;
};
//#define inf 100000001;
void bfs(vector<edge>v[],int s,int m,int n){
int d[n]={0};
queue<edge> q;
q.push((edge){s});
while(!q.empty()){
edge f=q.front();
if(d[f.e]==0){
cout<<f.e<<endl;
d[f.e]=1;
}
... | ALGO | 0.999956 | 3.646276 |
1ec5e499-800e-4871-898e-b018dab34026 | malay241/c- | reverse.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int rev = 0;
while(n!=0)
{
int t = n%10;
rev = rev*10+t;
n=n/10;
}
cout<<rev;
} | ALGO | 0.999938 | 4.537711 |
ba5dbde8-014f-4ebc-8d1f-b88a9d5d1099 | babhishek21/oj-sols | hackercup/2017/Round 1/official_io_sols/zombies.cpp | // Hacker Cup 2017
// Round 1
// Fighting the Zombies
// Jacob Plachta
#include <algorithm>
#include <functional>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cassert>
#include <string>
#... | ALGO | 0.999544 | 3.770711 |
866cfe6c-7c7f-4864-a987-af67548dfd20 | Peap0ds-23/Leetcode_Submissions | 19-remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-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* removeNthFr... | ALGO | 0.999971 | 5.90121 |
24bbfad7-dd46-429f-a39c-8663575b7141 | bytedance/terark-zip | 3rdparty/boost-include/libs/regex/example/snippets/partial_regex_iterate.cpp | /*
* LOCATION: see http://www.boost.org for most recent version.
* FILE partial_regex_iterate.cpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: Search example using partial matches.
*/
#include <boost/regex.hpp>
#include <iostream>
#include <fstream>
#include <sstream>
#include <st... | ALGO | 0.941664 | 6.695587 |
e3d588d5-9a85-4198-bb76-ebb27122afc8 | MethEthPro/DSA | stiver_dsa/step_4/one_d/lec7/q1.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int timesROT(vector<int> arr){
int n=arr.size();
int low=0;
int high=n-1;
int index=-1;
int min=INT_MAX;
while(low<=high){
int mid=(low+high)/2;
if(arr[low]<=arr[high]){
if(arr[low]<min){
... | ALGO | 0.999821 | 5.281522 |
f54ccfbe-27bb-45e0-9243-2bc0b59bcf14 | aryan57/cp-archive | Codeforces/Codeforces Round #726 (Div. 2)/B. Bad Boy.cpp | /*
group : Codeforces - Codeforces Round #726 (Div. 2)
name : B. Bad Boy.cpp
srcPath : /home/aryan/Documents/cp/B_Bad_Boy.cpp
url : https://codeforces.com/contest/1537/problem/B
*/
/*
author : aryan57
created : 18-June-2021 20:18:14 IST
*/
#include <bits/stdc++.h>
using namespace std;
template<typename A, ... | ALGO | 0.997713 | 3.639947 |
3bca9444-f812-441a-aa07-0007fb0c3161 | KirisameMarisa0602/cocos2d-x-card-game | cocos2d/cocos/navmesh/CCNavMeshUtils.cpp | #include "navmesh/CCNavMeshUtils.h"
#if CC_USE_NAVMESH
#include "recast/Detour/DetourCommon.h"
#include "recast/Detour/DetourNavMeshBuilder.h"
#include "recast/fastlz/fastlz.h"
NS_CC_BEGIN
LinearAllocator::LinearAllocator(const int cap)
: buffer(nullptr)
, capacity(0)
, top(0)
, high(0)
{
resize(cap);
}
LinearA... | TOOL | 0.979038 | 6.545071 |
60b0b630-945b-4ac4-853f-bb036b2be2a9 | ishandutta2007/codeforces | cookiedoth/normal/1359/C.cpp | /*
Code for problem C by cookiedoth
Generated 28 May 2020 at 05.57 PM
_____________
_____________
_____________
_____________ ______
_____________
_____________
___________ ________
>_<
\_()_/
^_^
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <... | ALGO | 0.99986 | 4.134384 |
f3dd5f4f-2aed-4c02-b846-083ab50873cb | sur16-cse/DSA-preparation | 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 x){
// code here
int left=(x<<4)&255;
int right=(x>>4)&255;
return left | right;
}
};
//{ Driver Code Starts.
int main()
{
int t;
cin... | ALGO | 0.9996 | 5.275687 |
fffdf4e8-72f1-4df6-b8c5-01c1ddfdebdf | ishandutta2007/codeforces | sserxhs/normal/1470/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
template<typename typC> void read(register typC &x)
{
register int c=getchar(),fh=1;
while ((c<48)||(c>57))
{
if (c=='-') {c=getchar();fh=-1;break... | ALGO | 0.999954 | 3.981532 |
4222cbcc-c8cf-49ff-853a-6e2648eb4644 | raincross7/code-similarity | codes/train_code/problem182/problem182_341.cpp | #include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)
int main()
{
int a, b, c, d;
cin >> a >> b >> c >> d;
cout << ((a + b) > (c + d) ? "Left" : (a + b) == (c + d) ? "Balanced" ... | ALGO | 0.99998 | 3.433842 |
bb51fa0f-f365-4842-b7d9-30a14d825e4e | soham1192k/Leetcode-Solutions | 810-chalkboard-xor-game/810-chalkboard-xor-game.cpp | class Solution {
public:
bool xorGame(vector<int>& nums) {
int val=0;
for(auto x:nums) val^=x;
if(!val||nums.size()%2==0) return true;
return false;
}
}; | ALGO | 0.999847 | 5.655723 |
c75c0781-0bdd-4535-b349-33124d819551 | Kareus/BOJ | code/17474.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
typedef long long ll;
struct node
{
ll M, M2, cnt, sum; //M = max, M2 = second max, cnt = count of nodes which max is M
};
struct segTree_beats
{
node v[1 << 21]; //assign would take long
node merge(node a, node b)
... | ALGO | 0.999873 | 5.254582 |
9857399c-3f39-4060-9ff9-e7c7327a6ec5 | Rishitha0320/LeetCode-problems | MaxWords.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int mostWordsFound(vector<string>& sentences) {
int max_words=0;
for(const auto& sentence:sentences){
int space_count=count(sentence.begin(),sentence.end(),' ')+1;
max_words =max(space_coun... | ALGO | 0.999766 | 5.447415 |
d3f47c27-8e2c-4699-9ced-adbaf9b14123 | unlibrosinpaginas/problem-set | set2(4.1).cpp | #include <iostream >
int sum( const int &x, const int &y) {
return x + y;
}
double sumar( const double &x, const double &y) {
return x + y;
}
int main(){
const int x=4;
const int y=5;
sum(&x,&y);
return 0;
}
| TOOL | 0.979296 | 4.475737 |
fc8b241e-94aa-4acc-96f0-d4cd6624ccae | WayneYann/PMB_solver | src/equil/vcs_util.cpp | /**
* @file vcs_util.cpp
* Internal definitions for utility functions for the VCSnonideal package
*/
#include "cantera/equil/vcs_internal.h"
#include "cantera/equil/vcs_defs.h"
#include "cantera/base/stringUtils.h"
#include "cantera/base/ctexceptions.h"
#include <cassert>
#include <cstring>
using namespace std;
... | TOOL | 0.937116 | 7.020711 |
51cdccfa-3ce0-4d5d-b2e4-b3e753060778 | larryxiao/peloton | src/postgres/backend/utils/adt/tsquery_op.cpp | #include "postgres.h"
#include "tsearch/ts_utils.h"
Datum
tsquery_numnode(PG_FUNCTION_ARGS)
{
TSQuery query = PG_GETARG_TSQUERY(0);
int nnode = query->size;
PG_FREE_IF_COPY(query, 0);
PG_RETURN_INT32(nnode);
}
static QTNode *
join_tsqueries(TSQuery a, TSQuery b, int8 operator___)
{
QTNode *res = (QTNode ... | TOOL | 0.958264 | 6.598629 |
e6523af1-25de-4938-b2c8-96dacb7bd1ac | mariyaeggs/C_Methodology_Collection | C++_I_2015_/W12 C++/W12_PrgAssignP1_Q1_Eggensperger_M.cpp | // Week12.cpp
// Description: Write a program that lets the user enter 10 integers into an array.
// The array then sorts all even and odd numbers.
// Author: Mariya Eggensperger
// Date: 11/23/2015
// Compiler: Dev-C++ 5.11
#include <iostream>
using namespace std;
int main()
{
const int SIZE=10; // maximum array i... | ALGO | 0.999868 | 4.049679 |
28153389-0996-4446-9e72-67a6d017d937 | akshatagg06/C_plusplus-PROGS_INVENTORY | Second_batch/mystrtok.cpp | #include <bits/stdc++.h>
using namespace std;
char *mystrtok(char str[], char delim[]){
int i;
//make a copy of the input, for str not equal to NULL.
static char *input = NULL;
if(str != NULL){
input = str;
}
//check if the input is null
if(input == NULL) return NULL;
//create a... | ALGO | 0.99868 | 4.672389 |
dfccbc00-5eea-4b74-9d74-39b97ab0176f | 0ctagon/TIPP | MC.cpp | #include <iostream>
#include <TRandom3.h>
#include "fct.cpp"
using namespace std;
//m12 distribution (function g(mnunu) in the article)
RooAbsPdf * m12distrib(RooRealVar& m12)
{
RooGenericPdf * m12fct = new RooGenericPdf("m12_fct","m12*sqrt((pow(5.27962,2)-pow(m12+0.89581,2))*(pow(5.27962,2)-pow(m12-0.89581,2)))",... | DATA | 0.989759 | 4.388356 |
fcfce9b2-4f85-48c2-82e6-a86b4d3d1f7d | tianyang-li/de-novo-rna-seq-quant-1 | boost_1_51_0/libs/intrusive/example/doc_rbtree_algorithms.cpp | struct my_node
{
my_node(int i = 0)
: int_(i)
{}
my_node *parent_, *left_, *right_;
int color_;
//other members
int int_;
};
//Define our own rbtree_node_traits
struct my_rbtree_node_traits
{
typedef my_node node;
typedef my_node * ... | ALGO | 0.999809 | 6.598481 |
3dc08c1f-c01c-441b-9769-8870816e3b96 | wukong220/AChain | backup001/main.cpp | #include <ctime>
#include "paras.h"
#include "files.h"
const int Num_info = 15; //id type xu yu zu vx vy vz c_orient[1] c_orient[2] c_orient[3] c_orient[4] c_shape[1] c_shape[2] c_shape[3]
const int dimension = 2;
const double mass = 1.0;
int Num_file = 2;
int N_chain = 30; //Polarization of single chain
int ... | DATA | 0.853094 | 3.846174 |
08be1bc9-fcb0-4f6e-b7b0-5c37740665d4 | SpongeCodes/coding-contests | leetcode/weekly/weekly-406/3.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
/*
3 solutions
1. 4D -DP
2. 2D- DP also possible
3. Best solution is greedy - take the maximum between present
vertical and horizontal cut to minimize the increase of the next opposite cuts
*/
// SOLUTION 1 - WILL FAIL FOR HIGHER CONSTRAINTS
... | ALGO | 0.999925 | 5.178349 |
af7e9430-ccb9-4900-8784-96ae9213e86f | raghavsood935/iiy_construction | 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.998689 | 6.787361 |
426f9e13-3745-4812-bcb0-ac808f3f1ebf | QinHongZhe/hongzhe-leetcode | solution/1800-1899/1827.Minimum Operations to Make the Array Increasing/Solution.cpp | class Solution {
public:
int minOperations(vector<int>& nums) {
int ans = 0;
int mx = 0;
for (int& v : nums)
{
ans += max(0, mx + 1 - v);
mx = max(mx + 1, v);
}
return ans;
}
}; | ALGO | 0.999987 | 6.141634 |
14233d1a-3fc4-4d11-a73e-4f4532927054 | para8ox-deb/leetcodeSolutions | 0090-subsets-ii/0090-subsets-ii.cpp | class Solution {
public:
void findSubSet(int ind, vector<int> &nums, vector<int> &ds, vector<vector<int>> &ans){
ans.push_back(ds);
//empty subset is selected
// now first we will select all single ele subset, then 2 ele, then 3 ele and so on
for(int i=ind; i<nums.size(... | ALGO | 0.999951 | 5.917572 |
190b3c18-1de1-4537-9738-c7eb07793da8 | bubblenut/Audio-Visualizer-using-SFML | math/FFT.cpp | #include "FFT.h"
#include <exception>
#include <iostream>
FFT::~FFT() {
delete[] OutFFT;
fftw_cleanup();
}
void FFT::LazyInit(double sampleRateD) {
SampleRate = 1;
while (SampleRate <= sampleRateD) {
SampleRate *= 2;
}
SampleRate /= 2;
OutFFT = new fftw_complex[SampleRate / 2 + 1... | ALGO | 0.994055 | 5.518478 |
b0911088-0d2f-4c0e-bbc5-fdb3744aa4a7 | nccaiteam/histopathology_annotation_nia | libs/boost_1_67_0/libs/graph/example/dave.cpp | #include <boost/graph/adjacency_list.hpp>
#include <boost/graph/visitors.hpp>
#include <boost/graph/breadth_first_search.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/graph_utility.hpp>
using namespace std;
using namespace boost;
/*
This example does a best-first-search (using dijkstr... | ALGO | 0.999972 | 5.580591 |
6d0132a8-d3ce-4356-a8dc-5b5cb2de4ebc | zherar7ordoya/Xperiments | C++/HelloWorld/helloworld.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
for (const string& word : msg)
{
cout << word << " ";
}
cout << endl;
} | TOOL | 0.938436 | 3.87438 |
aa8a7b00-1503-4d98-9199-cf2d369b3dfc | Magdy156/General_Problems | bitmasks/subsets.cpp | #include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
bool getBit(int n, int idx){
return (n>>idx) & 1;
}
int main() {
vector<vector<int>> ans; int n, s[18];
cin >> n;
for (int i = 0; i < n; i++) cin >> s[i];
for (int mask = 0; mask < (1 << n); mask++){
vector<in... | ALGO | 0.999954 | 3.966292 |
beacba8f-6a94-40a0-82e6-75b115409ca8 | NewProggie/ShapePP | libshapepp/thirdparty/eigen-2.3.9/doc/examples/Tutorial_BlockOperations_print_block.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::MatrixXf m(4,4);
m << 1, 2, 3, 4,
5, 6, 7, 8,
9,10,11,12,
13,14,15,16;
cout << "Block in the middle" << endl;
cout << m.block<2,2>(1,1) << endl << endl;
for (int i = 1; i <= 3; ++i)
{
cout << "B... | ALGO | 0.982056 | 3.680517 |
b4397088-2f49-4619-a003-8412e1c234b1 | ishandutta2007/codeforces | mr_spade/normal/1097/D.cpp | #include<cstdio>
#include<vector>
#define int long long
using std::vector;
const int mod=1e9+7;
inline int add(int a,int b)
{
return (a+=b)>=mod?a-mod:a;
}
inline int sub(int a,int b)
{
return (a-=b)<0?a+mod:a;
}
inline int mul(int a,int b)
{
return (long long)a*b%mod;
}
inline int qpow(int a,int b)
{
int res=1;
f... | ALGO | 0.999962 | 4.166183 |
af89a435-65bb-4313-acf5-bc39b6f1612d | yuguoshao/boost | libs/graph/test/mean_geodesic.cpp | #include <iostream>
#include <boost/graph/undirected_graph.hpp>
#include <boost/graph/directed_graph.hpp>
#include <boost/graph/exterior_property.hpp>
#include <boost/graph/property_maps/constant_property_map.hpp>
#include <boost/graph/floyd_warshall_shortest.hpp>
#include <boost/graph/geodesic_distance.hpp>
using n... | TEST | 0.996745 | 5.274351 |
550deea9-4394-4fa1-87f2-089a5355fd4f | epocode/luogu | p1102/p1102.cpp | #include <iostream>
#include <stdlib.h>
#include <queue>
#include <vector>
using namespace std;
int main() {
long long N, C;
cin >> N >> C;
priority_queue<unsigned int> pq;
while (N--) {
unsigned int input;
cin >> input;
pq.push(input);
}
vector<unsigned int> list;
w... | ALGO | 0.999868 | 3.645363 |
00df2e83-9a6b-41f2-a6f6-6a794792df5a | Simba256/Competitive-Programming | Codeforces/1732/1732C.cpp | using namespace std;
#include<bits/stdc++.h>
#define nl cout<<"\n"
#define ve vector
#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvll vector<vector<ll>>
#define ll long l... | ALGO | 0.999887 | 3.894027 |
43d3c6c8-a284-430e-bc02-c5e3de427c67 | Kavin1421/Leetcode-Solution | 3100-3199/3106.Lexicographically Smallest String After Operations With Constraint/Solution.cpp | class Solution {
public:
string getSmallestString(string s, int k) {
for (int i = 0; i < s.size(); ++i) {
char c1 = s[i];
for (char c2 = 'a'; c2 < c1; ++c2) {
int d = min(c1 - c2, 26 - c1 + c2);
if (d <= k) {
s[i] = c2;
... | ALGO | 0.999996 | 6.075056 |
01e11b41-dd5a-48a8-a8a9-17f0fc30a9de | shlkn/algorithms-and-data-structures | №4 dijkstra and kruskal algorithm/alg_lab_4/alg_lab_4.cpp | #include "alg_lab_4.h"
#include "data_performance.h"
#include "algorithms.h"
int a[SIZE][SIZE]; // матрица связей "a"
int b[SIZE][SIZE]; // матрица сделанная на основе матрицы а
int main()
{
data_in(); // ввод матрицы связей из файла
transform_to_not_orientied(); // преобразование ориентированного графа в неориенти... | ALGO | 0.999433 | 3.958936 |
d71bc951-eafb-4354-bf8d-40c6994d4fc9 | zhangsicong233/cpp_learning | Algorithm_Exercise/Luogu/Exerices/P1422.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
double fee;
if (n <= 150) fee = n * 0.4463;
else if (n > 150 && n <= 400) fee = (n - 150) * 0.4663 + 66.945;
else fee = (n - 400) * 0.5663 + 183.52;
printf("%.1lf", fee);
return 0;
} | ALGO | 0.999657 | 3.840444 |
c4bcf0fc-6354-46ad-a168-eb2749cf4e86 | nafargi/CPP-Leetcode-solutions | Submitted Code.cpp | class Solution {
public:
string shortestPalindrome(string s) {
const string t = {s.rbegin(), s.rend()};
const string_view sv_s(s);
const string_view sv_t(t);
for (int i = 0; i < s.length(); ++i)
if (sv_s.substr(0, s.length() - i) == sv_t.substr(i))
return t.substr(0, i) + s;
retur... | ALGO | 0.9999 | 6.869738 |
015f6d8f-5b80-4fc3-9356-5a8d9c08851b | SteffiKeranJ/Data-Structures-and-Algorithms-Cpp-and-Scala | Arrays/threeSum.cpp | /**
15. 3Sum
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Notice that the solution set must not contain duplicate triplets.
Example 1:
Input: nums = [-1,0,1,2,-1,-4]
Output: [[-1,-1,2],[-1,0,1]]
Example 2... | ALGO | 0.999873 | 5.591761 |
a1104b42-ff61-42e7-8869-48252710e101 | r-d-s-l-w/competitive-programming | Other sources/AlgoII - F10.cpp | /// Radoslaw Mysliwiec 2019
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB emplace_back
#define ALL(x) (x).begin(),(x).end()
#define endl '\n'
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using p... | ALGO | 0.999715 | 4.696766 |
c44eed4f-6100-48e3-af18-e525ab61f528 | xXxHowToType69xXx/Cpp-projects | converters/decimalToBinary.cpp | #include <iostream>
using std::cout, std::cin, std::endl;
int main(){
cout << "~~~ Decimal to Binary Converter ~~~" << endl;
cout << "Enter a decimal number: ";
int decimal;
cin >> decimal;
int orignalDecimal = decimal;
int remain;
int binary = 0;
int placeValue = 1;
while(decima... | ALGO | 0.996901 | 6.019188 |
ad4bfe43-1fa2-46ab-9234-8a217131dff3 | Anshul-ARK/assignment | LAB 1/1.cpp | #include <iostream>
using namespace std;
int main() {
double weight, postage = 0.0;
cout << "Enter the weight of the letter (in grams): ";
cin >> weight;
if (weight <= 50) {
postage = 0.50 * (weight / 10);
} else if (weight <= 150) {
postage = (0.50 * 5) + 0.40 * ((weight - 50) / 1... | TOOL | 0.999131 | 5.176888 |
4f057472-cb79-4c8e-a629-704233852ee8 | refainHub/ACM-ICPC | 做题记录/数据结构/树状数组/hoj 2352 树状数组stars .cpp | #include <cstdio>
using namespace std;
#define maxn 33000
int c[maxn],cnt[maxn]= {0};
int lowbit(int x)
{
return x&(-x);
}
int sum(int x)
{
int ret=0;
while(x>0)
{
ret+=c[x];
x-=lowbit(x);
}
return ret;
}
void modify(int i,int x)
{
while(i<maxn-5)
{
c[i]+=x;
... | ALGO | 0.999635 | 3.80524 |
5b2e95ca-28de-4fa5-8e73-d6f5ae157589 | aldew5/Competitive-Programming | CSES/Flight_Routes.cpp |
/*
ID: alec3
LANG: C++14
PROG:
*/
/*
*/
#include <bits/stdc++.h>
#define check(x) cout<<(#x)<<": "<<x<<" " << endl;
#define line cout << "--------------------" << endl;
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ss second
#define ff first
#define pb push_back
#define lb lower_bound
#... | ALGO | 0.999983 | 3.880729 |
9c2f55b4-7dd5-46d0-bab3-35be1125715b | chentong2015/CppMasterProject | basics/6_statements/selection/CppIfElseInit.cpp | #include <iostream>
int getValue() {
return 42;
}
template<typename T>
auto show(T t) {
// CPP17 if constexpr 语句在编译时计算
// 编译器仅生成与发送到函数模板的参数类型匹配的 if 分支的代码
if constexpr (std::is_pointer_v<T>) {
return *t;
} else {
return t;
}
}
int main() {
// TODO. 带有初始值设定项的if语句, init条件+con... | TOOL | 0.899103 | 6.741275 |
c75bf0d9-fd7c-4625-b7ef-d7ea66dd440d | vuthanhlan/Subjects | LAP TRINH HUONG DOI TUONG/BaiThucHanhSo5/5.2.cpp | #include<bits/stdc++.h>
using namespace std;
class sp
{
private:
int ao, thuc;
public:
sp();
sp(int a, int b);
friend ostream& operator<<(ostream & out, sp y);
sp operator+(sp a);
sp operator-(sp a);
};
sp::sp()
{
ao=thuc=0;
}
sp::sp(int a, int b)
{
ao=a;
thuc=b;
}
ostream& operator<<(ostream & out... | ALGO | 0.954972 | 3.724957 |
22111900-b792-4a82-86b0-464540f78208 | amitprajapati0702/sample_DSA-_C- | Ref.cpp | #include<iostream>
using namespace std;
int update(int& n){
n++;
}
int main(){
int n = 5;
cout <<"Before" << n << endl;
update(n);
cout <<"After" << n << endl;
} | ALGO | 0.977806 | 3.369057 |
87bb17ff-9d9c-4ede-b926-50f742cc2316 | ishandutta2007/codeforces | lawrenceli/normal/830/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 105;
const int maxm = 10010;
const ll inf = 1e12;
int n;
int a[maxn];
ll k;
int ar[maxn * maxm];
int sze;
int main() {
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
k += a[i];
}
ll ans... | ALGO | 0.99998 | 3.89193 |
0c26293f-2624-4b87-8c00-08b48980a65c | Brossend/Study | programming/РГР 2/РГР 2/game_of_life.cpp | #include <iostream>
#include <ctime>
#include <cstdlib>
#include <Windows.h>
#include "game_of_life.h"
#include "Sys.h"
using namespace std;
int game_of_life::rule(int i, int j)
{
int alive = 0;
for (int l = i - 1; l < i + 2; l++)
{
for (int n = j - 1; n < j + 2; n++)
{
alive ... | ALGO | 0.985933 | 3.817271 |
3510e61f-1f62-4072-bbf0-f59c19c23110 | Tomin-Joy/Sorting-Algorithms | Insertion Sort/insertion_sort.cpp | #include <iostream>
using namespace std;
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
void insertionSort(int arr[], int n) {
int i, j;
for (i = 1; i < n; i++) {
j = i;
while (j > 0 && arr[j - 1] > arr[j]) {
swap(arr[j], arr[j - 1]);
j-... | ALGO | 0.999971 | 5.431233 |
e383f66f-338e-45d3-bde9-b8a2102ea977 | gky2009514/leetcode | C++/059_Spiral Matrix II.cpp | class Solution {
public:
vector<vector<int> > generateMatrix(int n) {
vector<vector<int> > res;
vector<int> v;
for (int i = 0; i < n; i++)
v.push_back(0);
for (int i = 0; i < n; i++)
res.push_back(v);
int up = 0, left = 0;
int down = n - 1, rig... | ALGO | 0.999893 | 5.514993 |
855e5067-d36a-4815-b69f-b49f3df31dbe | cskilbeck/Game | assimp/code/FixNormalsStep.cpp | /** @file Implementation of the post processing step to invert
* all normals in meshes with infacing normals.
*/
#include "AssimpPCH.h"
// internal headers
#include "FixNormalsStep.h"
using namespace Assimp;
// ------------------------------------------------------------------------------------------------
// Con... | TOOL | 0.87682 | 6.991837 |
c85e07cf-44b9-4eb3-920c-79c39cace12b | MehaboobS/COMPLETE-DSA-IN-C- | module_17_recursion/lecture2/05_mazePathMain.cpp | #include<iostream>
using namespace std;
int maze(int sr,int er,int sc,int ec){
if(sr>er || sc>ec)return 0;
if(sr==er && sc==ec) return 1;
int rightAns=maze(sr,er,sc+1,ec);
int downAns=maze(sr+1,er,sc,ec);
return rightAns+downAns;
}
int main(){
cout<<maze(0,2,0,2)<<endl;
return 0;
} | ALGO | 0.999943 | 3.17653 |
ea7c031f-3b53-49aa-9a3b-1f7d76e05a0e | tsxc-github/knowledge-base | site/Learning Notes/code/p1075.cpp | #include<iostream>
#include<cstdio>
#include<iomanip>
using namespace std;
long long a=0,b,c,d,n,x,y;
bool temp;
int main(){
cin>>n;
long long i,j;
for(i=2;n%i;i++);
j=n/i;
if(i>=j)cout<<i;
else cout<<j;
} | ALGO | 0.999915 | 3.268654 |
636df1ba-cf61-4be4-9fff-e59069fd2c36 | ayyappareddynandipati/LEETCODE | 0441-arranging-coins/0441-arranging-coins.cpp | class Solution {
public:
int arrangeCoins(int n) {
long long sum=0;
int i=1;
while(sum+i<=n)
{
sum+=i;
i++;
}
return i-1;
}
}; | ALGO | 0.999936 | 6.377075 |
6de313bc-2910-4910-84b3-4d5b9491aa84 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5675_20.cpp | #include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double INF = 1e8;
int x[2], y[2], tx[2], ty[2];
int t, v;
inline double P(double t) { return t * t; }
bool yes(double m) {
if (m <= t)
return v * m >=
sqrt(P(x[0] + m * tx[0] - x[1]) + P(y[0] + m * ty[0] - y[1]));
else
r... | ALGO | 0.999849 | 3.953063 |
77264349-4288-4d83-b556-54b6edb8a34f | haitomnsg/c_practice | for_loop.cpp | #include <iostream>
using namespace std;
int main()
{
int multiplier = 5, number = 1, result = 0;
for (number; number <= 10; number++)
{
result = multiplier * number;
cout << multiplier << "*" << number << "=" << result << endl;
;
}
return 0;
} | ALGO | 0.998962 | 3.998308 |
6fb4d562-bf2c-4500-8a5e-d8f0c553c887 | ishandutta2007/codeforces | superpear/normal/156/E.cpp | #include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <set>
#include <algorithm>
#include <map>
#include <bitset>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <functional>
#include <sstream>
#include <list>
#include <complex>
#define ma... | ALGO | 0.999833 | 3.431103 |
87667486-597a-483b-a4ad-2c671fae13bf | asu-crypto/mpsica | thirdparty/linux/boost/libs/numeric/ublas/doc/samples/mapped_matrix.cpp | #include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
mapped_matrix<double> m (3, 3, 3 * 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = 3 * i + j;
... | ALGO | 0.952738 | 3.255538 |
ef730644-40b5-40b7-9043-b4ff00428e4d | KrailH/FeatureVerificatio | ClusteringVlgorithmVerificatio/OPTICS.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <limits>
struct Point {
double x, y;
bool processed;
bool is_core_point;
double reachability_distance;
int cluster_id;
Point(double x, double y) : x(x), y(y), processed(false), is_core_point(false),
... | ALGO | 0.999992 | 7.012943 |
f37e5992-6a1c-4633-b569-2dc621210014 | SachinM97/CodingProblems | consequtive_chs.cpp | // The power of the string is the maximum length of a non-empty substring that contains only one unique character.
// Given a string s, return the power of s.
// Example 1:
// Input: s = "leetcode"
// Output: 2
// Explanation: The substring "ee" is of length 2 with the character 'e' only.
// Example 2:
// Input: s ... | ALGO | 0.999908 | 6.285216 |
6bf57bc7-0839-42c0-93f1-1344afeec4ab | selectivegravity/DSA_Practice | practice/Practice set (Rough)/papa.cpp | #pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(... | ALGO | 0.99975 | 3.355636 |
a1953811-13ff-45fd-b79c-b955e7211736 | fleksin/NO_RUNNING | NRproject/cocos2d/cocos/base/CCConfiguration.cpp | #include "base/CCConfiguration.h"
#include <string.h>
#include "base/ccMacros.h"
#include "base/ccConfig.h"
#include "platform/CCFileUtils.h"
NS_CC_BEGIN
extern const char* cocos2dVersion();
Configuration* Configuration::s_sharedConfiguration = nullptr;
Configuration::Configuration()
: _maxTextureSize(0)
, _maxMod... | CONFIG | 0.931781 | 6.166008 |
63f59fb7-3564-4608-86ed-a065d0a49fad | Jikky1618/AtCoder | kyopro-tessoku/B/B16.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = (1 << 30) - 1;
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
int main(){
cin.tie(nullptr);
ios::sync_with_... | ALGO | 0.999942 | 4.459698 |
bbfb93ec-906b-4fea-97fd-b9c00296a604 | zFa3/CP_problems | 1068_CSES_WeirdAlgorithm.cpp | /*
ID: zFa3
TASK: Weird algorithm
LANG: C++
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll count;
cin>>count;
while (1){
if (count == 1){
c... | ALGO | 0.999987 | 4.203675 |
92ed1053-b533-4e82-b581-a86cbe131ab6 | mckapur/GeneticAlgorithmProgrammer | GeneticAlgorithmProgrammer/Evolution/ChromosomePopulation.cpp | #include "BrainfuckInterpreter.hpp"
#include "ChromosomePopulation.hpp"
#include "ChromosomePopulationProcesses.hpp"
#include "FitnessBaselineScoringSystemStringToStringSimilaritySE.hpp"
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <math.h>
#pragma mark - Init
void ChromosomePopulation::rando... | ALGO | 0.999721 | 5.814959 |
5668223d-a293-4957-a7bb-177c5269d66c | MahmudaB/Competitive-Programming-Problems-Solutions | Graph/Codeforces C-Dijkstra.cpp | //In the name of Almighty Allah
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vect... | ALGO | 0.999996 | 4.226488 |
c70f2d4b-8532-4190-97db-d317577e8106 | xmlb88/algorithm | leetcode/binarySearch/528.pickIndex.cpp | #include <iostream>
#include <vector>
#include <random>
using namespace std;
class Solution {
public:
vector<int> preSum;
int total = 0;
// c++11 random integer generation
mt19937 rng{random_device{} ()};
uniform_int_distribution<int> uni;
Solution(vector<int>& w) {
for (int x : w) {
... | ALGO | 0.999944 | 5.495445 |
f5496254-053b-484f-b0c7-701edb91a950 | SH7072/DSA-cpp | 16_BST/6_BuildBSTfrmSortedArr.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int val)
{
data = val;
left = NULL;
right = NULL;
}
};
Node *sortedArrToBST(int arr[], int start, int end)
{
if (start > end)
{
return NULL;
}
... | ALGO | 0.999978 | 5.85985 |
3ed9fa82-8c4d-42b4-8f00-6272a96966b6 | Modding-Zaibatsu/ue5-polaris | Engine/Source/ThirdParty/Intel/Embree/Embree2140/src/kernels/subdiv/bezier_curve.cpp | #include "bezier_curve.h"
namespace embree
{
BezierCoefficients::BezierCoefficients(int dj)
{
for (size_t i=0; i<=N; i++)
{
for (size_t j=0; j<=N; j++)
{
const float t1 = float(j+dj)/float(i);
const float t0 = 1.0f-t1;
c0[i][j] = t0 * t0 * t0;
c1[i][j] = 3.0f ... | ALGO | 0.988287 | 5.425904 |
4a9a54f0-d0a9-4cae-b808-10755051872e | heapsheeps/opencv-ios-framework | opencv/3rdparty/carotene/src/phase.cpp | #include <cfloat>
#include <cmath>
#include "common.hpp"
#include "vround_helper.hpp"
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
#define FASTATAN2CONST(scale) \
f32 P1((f32)( 0.9997878412794807 * (180.0 / M_PI) * scale)), \
P3((f32)(-0.3258083974640975 * (180.0 / M_PI) * scale)), \
... | ALGO | 0.999455 | 6.419463 |
747d3d9f-feb4-407b-8db9-ae94a8e8abf7 | ashish923/leet-code | 1091-shortest-path-in-binary-matrix/1091-shortest-path-in-binary-matrix.cpp | class Solution {
public:
int shortestPathBinaryMatrix(vector<vector<int>>& grid) {
int n = grid.size();
int m = grid[0].size();
vector<vector<int>> dir = {{0,1},{1,0},{-1,0},{0,-1}};
queue<pair<int,int>> q;
if(grid[0][0] == 1 || grid[n-1][m-1] == 1) return -... | ALGO | 0.999995 | 6.016428 |
449ed979-ba8d-4490-9e60-90d33dcb266e | Mohammed-eid35/Problem-Solving | kattis/Increasing Subsequence.cpp | //:::: Alien :::://
// Muhammad Eid //
#include <bits/stdc++.h>
using namespace std;
void Mo35() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
typedef vector<int> vi;
int n;
int ar[205], mem[205][205];
map<int, vi> mp;
vector<vi> vc;
int dp(int idx, int pre) {
if(idx == n... | ALGO | 0.999986 | 3.785949 |
29e7a55c-cf1a-41b4-bc23-f4c952063db2 | thimansh/huffman-coding | encoder.cpp | /*
* encoder.cpp
*
* Created on: Apr 4, 2017
* Author: Himanshu Taneja
*/
#include "hnode.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <unordered_map>
#include <cstddef>
#include <ctime>
#include <stack>
#include <string>
#include <queue>
#include "binary.h"
#include "fourway.h"
#incl... | ALGO | 0.999163 | 4.098858 |
e253c52a-6c02-4caa-a4f8-f983103f112d | StateFromJakeFarm/compProgramming | leetcode/apple/remove_duplicates_from_sorted_array.cpp | #include <bits/stdc++.h>
using namespace std;
void print_vec(vector<int>& vec) {
for (auto &v : vec) {
cout << v << ' ';
}
cout << endl;
}
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x)... | ALGO | 0.999979 | 5.660835 |
539dda13-2b25-4e84-a1d3-fc897b1694ba | vishwasT007/MY-Cpp-Learning | arrays/04_Modification_During_ArrayTraversal_RangeBased.cpp | #include<iostream>
using namespace std;
int main() {
int arr[] = {10,20,30,40,50};
for(int &x : arr) {
x *= 2;
}
for(int x : arr) {
cout<< x << "||" ;
}
return 0;
} | ALGO | 0.994773 | 3.533383 |
d6bdd411-bc16-419f-8b11-d197df44db06 | tonytec21/atlas | ocr/tesseract-main/src/textord/colpartitionset.cpp | #ifdef HAVE_CONFIG_H
# include "config_auto.h"
#endif
#include "colpartitionset.h"
#include "tablefind.h"
#include "workingpartset.h"
namespace tesseract {
// Minimum width of a column to be interesting as a multiple of resolution.
const double kMinColumnWidth = 2.0 / 3;
ColPartitionSet::ColPartitionSet(ColPartiti... | TOOL | 0.920182 | 7.342912 |
b5b2d3a4-12b4-494e-91af-91959093547b | amrit12001703/6Companies30Days | Q49.leadersInAnArray.cpp | // { Driver Code Starts
// C++ program to remove recurring digits from
// a given number
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
//Function to find the leaders in the array.
public:
vector<int> leaders(int a[], int n){
// Code here
vector<int> a... | ALGO | 0.999958 | 5.633183 |
8257d112-1d8a-4482-9e4a-f3f69c7796c9 | rochus-keller/Qt-4.4.3 | src/gui/painting/qpolygon.cpp | #include "qpolygon.h"
#include "qrect.h"
#include "qdatastream.h"
#include "qmatrix.h"
#include "qdebug.h"
#include "qpainterpath.h"
#include "qvariant.h"
#include "qpainterpath_p.h"
#include "qbezier_p.h"
#include <stdarg.h>
QT_BEGIN_NAMESPACE
//same as qt_painterpath_isect_line in qpainterpath.cpp
static void qt_p... | TOOL | 0.957561 | 6.297666 |
21ffbd40-eb15-4476-9537-02d24d33ce0f | stamcenter/llvm-zeno | libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/compare.pass.cpp | // <string>
// template<> struct char_traits<wchar_t>
// static int compare(const char_type* s1, const char_type* s2, size_t n);
// constexpr in C++17
#include <string>
#include <cassert>
#include "test_macros.h"
#if TEST_STD_VER > 14
constexpr bool test_constexpr()
{
return std::char_traits<wchar_t>::compare(... | TEST | 0.881287 | 5.959074 |
26a0e886-ebfb-483d-bec5-52c1a9ede7fb | HugoMVale/odrpack-python | src/odrpack/__odrpack.py.cpp | #include <nanobind/nanobind.h>
#include <nanobind/ndarray.h>
#include <nanobind/stl/map.h>
#include <nanobind/stl/optional.h>
#include <nanobind/stl/string.h>
#include <iostream>
#include <map>
#include <optional>
#include <stdexcept>
#include <utility>
#include "odrpack/odrpack.h"
namespace nb = nanobind;
using nam... | ALGO | 0.974745 | 7.783527 |
b204c970-56fb-4802-906d-9f7db70264f5 | ashishsurya/Placement-Concepts | Linked Lists/Merge 2 Sorted Lists.cpp | #include <bits/stdc++.h>
#include "ListNode.h"
using namespace std;
ListNode *mergeTwoLists(ListNode *list1, ListNode *list2)
{
if (list1 == NULL)
return list2;
if (list2 == NULL)
return list1;
// head for the merged linked list
ListNode *head = NULL;
if (list1->val < list2->val) {
head = list1;
... | ALGO | 0.999846 | 5.489344 |
9a413099-2d1c-4929-bcf0-cc798279cf15 | say2omprakash01/LeetCode | 2025-redistribute-characters-to-make-all-strings-equal/redistribute-characters-to-make-all-strings-equal.cpp | class Solution {
public:
bool makeEqual(vector<string>& words) {
if(words.size() ==1) return true ;
int tcharCount = 0 ;
for(auto s : words) tcharCount+=s.length() ;
if(tcharCount%words.size() != 0) return false ;
vector<int> v(26,0);
for(auto s : words){
... | ALGO | 0.999882 | 5.813927 |
52b7671e-aa31-4b0c-822a-785c51ddf79a | md-qubais/Data_Structures_Algorithms_and_Competitive_Programming | rotate_image.cpp | #include<bits/stdc++.h>
using namespace std;
void rotate_image(int arr[][100],int rows,int cols){
for(int i=0;i<rows;i++){
int k=0,l=cols-1;
while(k<l){
int temp=arr[i][k];
arr[i][k]=arr[i][l];
arr[i][l]=temp;
k++;
l--;
}
}
for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++){
if(i<j){
swap(arr[i][j],arr[j][i]);
}
}
}
... | ALGO | 0.999907 | 3.435674 |
d8e1b41c-debc-4a5a-bad8-ca6074a2fc6c | nguyenvu9405/online-judge | html/submissions/711/submission.cpp | #include<cstdio>
#include<cstring>
#include<cmath>
int p[101], f[21], a[21], n;
long cnt=0;
void sieve(int nmax)
{
memset(p, 1, sizeof(p));
p[1]=p[0]=0;
int i, j, lim=sqrt(nmax);
for (i=2; i<=lim; ++i)
if (p[i]) for (j=2; j<=nmax/i; ++j) p[i*j]=0;
}
void print()
{
//for (int i=1; i<=2*n;... | ALGO | 0.999597 | 3.415594 |
7f58cc76-a59b-4542-a60b-7bb95a5f7576 | ladaegorova18/Programming-homework | sem1/homework3/3.2.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
void tree(long int *array, int begin, int end)
{
int maxChild = 0;
int done = 0;
while ((begin * 2 <= end) && (!done))
{
if (begin * 2 == end)
{
maxChild = begin * 2;
}
else if (arra... | ALGO | 0.999739 | 3.898305 |
3bb4035b-9edf-45e4-93e0-c6a487400995 | anilpandey-2002/LinkedList | 24_rotate_doubly_linklist_by_n_node.cpp | void rotate(struct Node **head_ref, int N)
{
if (N == 0)
return;
struct Node *current = *head_ref;
int count = 1;
while (count < N && current != NULL)
{
current = current->next;
count++;
}
if (current == NULL)
return;
struct Node *NthNode = current;
... | ALGO | 0.999898 | 4.738379 |
83987f77-a712-4441-adc5-b37a0b49e087 | Ph0en1xGSeek/ACM | LeetCode/sword2/034.cpp | class Solution {
private:
int arr[26] = {};
public:
bool isAlienSorted(vector<string>& words, string order) {
int size = words.size();
int s_size = order.length();
for (int i = 0; i < s_size; ++i) {
arr[order[i] - 'a'] = i;
}
bool ans = true;
for (int... | ALGO | 0.999989 | 6.228721 |
509cd9dc-1ccc-4092-b143-af0ce8faa723 | SinethViduranga/ETA-Project | modules/calib3d/src/levmarq.cpp | #include "precomp.hpp"
#include <stdio.h>
namespace cv
{
class LMSolverImpl CV_FINAL : public LMSolver
{
public:
LMSolverImpl(const Ptr<LMSolver::Callback>& _cb, int _maxIters, double _eps = FLT_EPSILON)
: cb(_cb), epsx(_eps), epsf(_eps), maxIters(_maxIters)
{
printInterval = 0;
}
int... | ALGO | 0.999643 | 6.50397 |
c66b3527-4740-4b15-963d-9056b80d5de4 | KeingCasabona/Tecsup-semana6-flutter_codigo_components | 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.998784 | 6.761023 |
146afb1d-eedc-430f-90e9-d6948d1a725a | Hemanthmeesala/Striver-A2Z-DSA | 09. Heaps/2. Medium Problems/01. Kth largest element.cpp | /*
QUESTION:
Given an integer array nums and an integer k, return the kth largest element in the array.
APPROACH:
To find the kth largest element in the array, we can use a min-heap of size k.
1. Initialize a min-heap (priority queue) of size k.
2. Insert the first k elements of the array into the min-heap.
3. For the... | ALGO | 0.99999 | 6.482069 |
70687ddc-f5e3-4723-8665-d9208a82c528 | lkoiescg2031/APSS | Baekjoon Online Judge/1080.cpp | #include <cstdio>
using namespace std;
#define MAX 50
int n, m, ans;
int map[MAX][MAX], des[MAX][MAX];
void flip(int i, int j) {
for (int k = 0; k < 3; k++)
for (int l = 0; l < 3; l++)
map[i + k][j + l] = 1 - map[i + k][j + l];
}
int main() {
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++)
for (int j... | ALGO | 0.999907 | 3.196831 |
4975f5d1-a270-4bda-989e-102cf388c3be | RocShi/leetcode_answers | code/top-100-liked/cpp/234.回文链表.cpp | /*
* @lc app=leetcode.cn id=234 lang=cpp
*
* [234] 回文链表
*
* https://leetcode.cn/problems/palindrome-linked-list/description/
*
* algorithms
* Easy (53.95%)
* Likes: 1858
* Dislikes: 0
* Total Accepted: 685.2K
* Total Submissions: 1.3M
* Testcase Example: '[1,2,2,1]'
*
* 给你一个单链表的头节点 head ,请你判断该链表是否... | ALGO | 0.999812 | 6.104734 |
d642ca73-78b7-4d89-9674-b54d45089482 | abhishekchaturvedi10/LeetCode | restore-ip-addresses/restore-ip-addresses.cpp | class Solution {
public:
vector<string> res;
void rec(int i, string &s, string &cur, int val, int len) {
if (i == -1) {
if(cur[0]=='0'&&cur[1]!='.')
return;
int f = 1;
int cnt = 0;
if (cur[0] == '.')
c... | ALGO | 0.999901 | 5.2739 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.