uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
e43adf00-f076-47cd-9ed7-3398240f6091 | DoraemonOS-Base/android_system_core | libmemtrack/memtrack_test.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <filesystem>
#include <vector>
#include <android-base/file.h>
#include <android-base/parseint.h>
#include <android-base/stringprintf.h>
#include <memtrack/memtrack.h>
#define DIV_ROUND_UP(x, y) (((x) + (y)-1) / (y))
static vo... | TOOL | 0.892309 | 4.95648 |
5ba96dd6-9431-4dd9-8d99-d717c020076e | lzyrapx/Competitive-Programming | hihocoder/1038(dp).cpp | #include <cstdio>
#define max(a,b) a>b?a:b;
int n,m,w[505],p[505],f[100005],i,j;
int main(){
scanf("%d%d",&n,&m);
for(i=0;i<n;i++) scanf("%d%d",&w[i],&p[i]);
for(i=0;i<n;i++)
for(j=m;j>=w[i];j--)
f[j]=max(f[j],f[j-w[i]]+p[i]);
printf("%d\n",f[m]);
return 0;
} | ALGO | 0.999955 | 3.520614 |
3e22690d-571c-4439-8939-705bcb59ec65 | rasauq1122/ProblemSolving | topological-sort/BOJ2623.cpp | // 2019.12.23
#include <iostream>
#include <queue>
using namespace std;
int main()
{
cin.tie(0);
ios::sync_with_stdio(0);
vector < vector < int > > v(1000);
int n, m, in[1000] = {};
cin >> n >> m;
for (int i = 0, j = 0, x, s, f ; i < m ; i++)
{
cin >> x;
for (cin >> s ; j... | ALGO | 0.999987 | 3.738726 |
d987b04e-500b-4b9a-89b5-5bd0e66fb5c5 | mstrechen/competitive-programming | CodeForces.com/regular_rounds/#356/D.cpp | #include<iostream>
#include<fstream>
#include<cmath>
#include<algorithm>
using namespace std;
long long get(long long _a)
{
if(_a==0)
return 0;
long long a = cbrt(_a+1e-10);
return 1+get(_a-a*a*a);
}
int main()
{
ios::sync_with_stdio(false);
ofstream cout("out.txt");
int n = 100000;
... | ALGO | 0.999805 | 3.425642 |
d47c666a-f095-4db8-a465-c4ad6f7662fb | phutruonnttn/CPP_Code_Giai_Thuat | test08/main.cpp | #include <bits/stdc++.h>
using namespace std;
long m,t,nt[1000007],dem,p[1000007],dlt[1000007],tinh[1000007],d;
map <long,long> M;
void sang()
{
for (long i=2; i<=1000000; i++) nt[i]=i;
for (long i=2; i<=1000; i++)
if (nt[i]==i)
{
long j=i*i;
while (j<=1000000)
{
... | ALGO | 0.999635 | 3.930969 |
4f60d6e4-0fb3-44a8-a51e-78eeb92644d3 | CodderPrince/C-Plus-Plus | CODEFORCES/welcome2024/b.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
const int INF = 1e9 + 7;
int main()
{
int test_cases;
cin >> test_cases;
while (test_cases--)
{
int array_length;
cin >> array_length;
string input_string;
cin >> input_st... | ALGO | 0.999976 | 4.840142 |
479fe5b2-ef81-4800-a05d-74b0f1689ffa | Neeraj490/Algorithm | opt.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
vector<int> Omp = {23, 19, 14, 9, 7, 5};
Omp.push_back(23);
Omp.push_back(19);
Omp.push_back(14);
Omp.push_back(9);
Omp.push_back(7);
Omp.push_back(5);
int total_cost = 0;
sort(Omp.begin(), ... | ALGO | 0.999959 | 5.194015 |
4a0ec01d-9455-47b1-9209-e6e694265c0c | Tim-Gaede/UCF-HSPT-OE-Data-2015 | redlight.cpp |
#include <iostream>
#include <fstream>
using namespace std;
int main() {
// Variables
int testCases, redlightDuration, straightTime, rightTime, observedTime;
// Get the number of test cases
cin >> testCases;
// Process each test case
for (int caseNum = 1; caseNum <= testCases; caseNum++) {
... | ALGO | 0.998595 | 4.400734 |
6a2be2a5-a8c2-450f-9bcd-2667f06f27f1 | riyabaranwal/Decode-with-C-- | coding/Revision/patternprinting/noflipped.cpp | #include<iostream>
using namespace std;
int main(){
int r;
cout<<"Enter no. of rows : ";
cin>>r;
for(int i=1;i<=r;i++){
for(int j=r-i;j>=1;j--){
cout<<" "<<" ";
}
for(int k=1;k<=i;k++){
cout<<k<<" ";
}
cout<<endl;
}
} | ALGO | 0.998987 | 3.563552 |
3982cea8-ef24-4699-95d9-24065c10fe86 | shubham-up-47/CP_Codes | Bit Manipulation/check_ith_bit.cpp | #include <bits/stdc++.h>
using namespace std;
bool check_ith_bit(int n, int i)
{
int z = n & (1<<i);
if(z != 0)
return true;
else
return false;
}
int main() // 13 = 0000 1101
{
cout << check_ith_bit(13, 3) << endl;
}
| ALGO | 0.994133 | 4.642517 |
f7513fa0-0cea-4bcf-a41b-55fdaa9ee38f | JBuzzatto/PX4_octa | src/examples/fixedwing_control/main.cpp | /**
* @file main.c
*
* Example implementation of a fixed wing attitude controller. This file is a complete
* fixed wing controller for manual attitude control or auto waypoint control.
* There is no need to touch any other system components to extend / modify the
* complete control architecture.
*
* @author Lor... | TOOL | 0.944109 | 3.119595 |
034710c2-4578-415f-92e4-beb3ec7d1938 | microsoft/nnfusion | thirdparty/mlas/lib/convolve.cpp | #include "mlasi.h"
//
// Define the number of working buffer elements required per thread.
//
#define MLAS_CONV_WORKING_BUFFER_SIZE_PER_THREAD \
(MLAS_SGEMM_STRIDEN * MLAS_SGEMM_STRIDEK)
//
// Define the parameters to execute segments of a convolution operation on
// worker threads.
//
struct MLAS_CONV_WORK_BLO... | ALGO | 0.940849 | 5.303183 |
79d40d0b-06a1-4dfa-8a04-0e25fca37b25 | POANING/FYP | FYP/opencv-4.x/modules/calib3d/src/epnp.cpp | #include <iostream>
#include "precomp.hpp"
#include "epnp.h"
namespace cv
{
epnp::epnp(const Mat& cameraMatrix, const Mat& opoints, const Mat& ipoints)
{
if (cameraMatrix.depth() == CV_32F)
init_camera_parameters<float>(cameraMatrix);
else
init_camera_parameters<double>(cameraMatrix);
number_of_corre... | ALGO | 0.999701 | 5.666969 |
eb90544b-ffa1-4f18-8093-c8c878a777ce | Loquats/cs184-snow | libraries/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
VectorXf v(2);
MatrixXf m(2,2), n(2,2);
v << -1,
2;
m << 1,-2,
-3,4;
cout << "v.squaredNorm() = " << v.squaredNorm() << endl;
cout << "v.norm() = " << v.norm() << endl;
cout << "v.lpN... | ALGO | 0.997853 | 4.03798 |
1188a0d0-e939-43f1-8342-0817a4fd0e06 | joeyjhg2/AiV_VisionSW_2 | opencv/sources/modules/core/src/has_non_zero.dispatch.cpp | #include "precomp.hpp"
#include "opencl_kernels_core.hpp"
#include "stat.hpp"
#include "has_non_zero.simd.hpp"
#include "has_non_zero.simd_declarations.hpp" // defines CV_CPU_DISPATCH_MODES_ALL=AVX2,...,BASELINE based on CMakeLists.txt content
namespace cv {
static HasNonZeroFunc getHasNonZeroTab(int depth)
{
CV... | ALGO | 0.944345 | 5.442239 |
6d240082-d978-4da4-b59a-9fbe517f3aa2 | eungyukm/C_Pluse_Basic | Basic_164/Basic_164/Basic_164.cpp | // C++20
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
struct Monster
{
float X, Y;
bool bHostile;
float DistanceTo(float px, float py) const
{
return sqrt((X - px) * (X - px) + (Y - py) * (Y - py));
}
};
void CheckBattleMusic(float playerX, float playerY,
... | ALGO | 0.951496 | 4.811612 |
3c9b390c-1232-4255-aabf-04773a72b359 | Hussam-Turjman/FLDServer | third_party/opencv/samples/cpp/tutorial_code/features2D/Homography/panorama_stitching_rotating_camera.cpp | #include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
using namespace std;
using namespace cv;
namespace
{
void basicPanoramaStitching(const string &img1Path, const string &img2Path)
{
Mat img1 = imread( samples::findFile( img1Path ) );
Mat img2 = imread... | ALGO | 0.932478 | 4.634279 |
1d8232e3-9ae8-4a33-952a-f198054e31bf | makio93/competitive-othersites | LeetCode/Problems/DCC/2021/Oct/D24/main0.cpp | #include <bits/stdc++.h>
using namespace std;
// 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, TreeNo... | ALGO | 0.999821 | 6.273449 |
9099de49-31ff-4a82-9443-31cd16507a96 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_1631_0.cpp | #include <bits/stdc++.h>
using namespace std;
class A {
public:
void solve() {
int n;
cin >> n;
vector<int> a(n + 1);
vector<long long> sum(n + 1, 0);
for (int i = 1; i <= n; i++) {
cin >> a[i];
sum[i] = sum[i - 1] + a[i];
}
for (int i = 1; i <= n; i++) {
if (sum[i] >= s... | ALGO | 0.999677 | 3.134272 |
2f10f32a-0cef-46fa-b62a-c32dbecfe09b | stwuhan/leetcode | solution/2500-2599/2557.Maximum Number of Integers to Choose From a Range II/Solution.cpp | class Solution {
public:
int maxCount(vector<int>& banned, int n, long long maxSum) {
banned.push_back(0);
banned.push_back(n + 1);
sort(banned.begin(), banned.end());
banned.erase(unique(banned.begin(), banned.end()), banned.end());
int ans = 0;
for (int k = 1; k < b... | ALGO | 0.999976 | 6.233846 |
11cac0ca-0c83-4415-86cf-53dca1c34025 | Tonix22/Athenas | C_CPP_Proyects/interviews/spiralmatrix.cpp | #include <iostream>
#include <string>
using namespace std;
/*spiral matrix
[
[1,2,3] (´・ω・`) <|:^{)
[4,5,6]
[7,8,9]
/)/)
( '.')
c(")(") chi cheñol DIA DEL PLATANO :3
@..@
(----)
( >__< )
^^ -- ^^
You should return [1,2,3,6,9,8,7,4,5]
Ruth: ¯\_(ツ)_/¯
7-7
]
*/
void pri... | ALGO | 0.999664 | 4.426939 |
5ae78453-a7a9-49ba-8cdf-fff45ea1f741 | CMU-SAFARI/BEER | lib/z3-4.8.9/src/tactic/arith/card2bv_tactic.cpp | #include "tactic/tactical.h"
#include "ast/ast_smt2_pp.h"
#include "tactic/arith/card2bv_tactic.h"
#include "ast/rewriter/pb2bv_rewriter.h"
#include "ast/ast_util.h"
#include "ast/ast_pp.h"
#include "tactic/generic_model_converter.h"
class card2bv_tactic : public tactic {
ast_manager & m;
params_r... | ALGO | 0.960164 | 7.184439 |
b46ebe02-52ba-4e83-9b53-ae2a06669bba | foy4748/Phitron | Semester3/Week4/Day1/b_or_permutation.cpp | #include <bits/stdc++.h>
#define endl "\n"
//#define ll long long int
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// Write your code here
int T;
cin >> T;
while (T--) {
int N;
cin >> N;
for (int i = N; i >= 1; i--) {
cout << i << " ";
}
co... | ALGO | 0.999837 | 5.750327 |
446c5afb-82c3-4f00-b144-f5961fa99c0a | njligames/NJLIGameEngine | src/njli/steering/behavior/SteeringBehaviorSeek.cpp | #pragma mark Implementation
#include "SteeringBehaviorSeek.h"
#include "JLIFactoryTypes.h"
#include "SteeringBehaviorSeekBuilder.h"
#include "World.h"
#define TAG "SteeringBehaviorSeek.cpp"
#define FORMATSTRING "{\"jli::SteeringBehaviorSeek\":[]}"
#include "JsonJLI.h"
#include "btPrint.h"
namespace njli
{
Steerin... | TOOL | 0.900559 | 6.201638 |
8fafd9c1-cf71-4403-8470-f98eb46cef24 | HiYellowC/ACM | 杂/n10.cpp | #include <stdio.h>
#include <string.h>
int r, c;
int res;
int high[102][102];
int ans[102][102];
int cur[4][2] = {0, 1, 0 , -1, 1, 0, -1, 0};
int dp(int a, int b) {
int & n = ans[a][b];
if(n > 0)
return n;
n = 1;
int i, k;
for(i = 0; i < 4; i++)
if(a + cur[i][0] <= r && b + cur[i][1] <= c && high[a + cur[i][... | ALGO | 0.999456 | 3.742876 |
392497d5-7a0f-4a22-916e-9159f7eea8fc | PawanKumar666/dataStructures | BinaryTree.cpp | #include<iostream>
using namespace std;
struct node{
int data;
node* left;
node* right;
};
node* createNode(int inElement){
node* newNode = new node();
newNode->data = inElement;
newNode->left = NULL;
newNode->right = NULL;
return newNode;
}
node* Insert(node* root,int inElement){
if(root == NULL){
root = cr... | ALGO | 0.999858 | 4.196784 |
05c6d960-8980-4120-b885-3e92588c97a2 | Nopalogic/belajar-cpp | pertemuan_15/circular_linked_list.cpp | /*
==PROGRAM CIRCULAR SINGLY LINKED LIST==
==========BY : Struktur Data dan Algoritma==========
======================================= */
#include <iostream>
#include <conio.h>
#include <stdlib.h>
using namespace std;
typedef struct node *simpul;
struct node
{
char Isi;
simpul kanan;
};
//============... | ALGO | 0.999496 | 4.723691 |
60616dee-1f2c-48d1-ba7c-985a4c8c495c | YouRyuu/CPNPbiubiubiu | LeetCode/leetcode98.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.99999 | 6.262442 |
84eeb96f-38c8-45c4-baab-1f2a519118de | thaihuynhxyz/challenges | src/hacker_rank/data_structures/linked_lists/cycle_detection/main.cpp | #define CATCH_CONFIG_RUNNER
#include "catch2/catch.hpp"
#include <iostream>
#include <map>
using namespace std;
class SinglyLinkedListNode {
public:
int data;
SinglyLinkedListNode *next;
SinglyLinkedListNode(int node_data) {
this->data = node_data;
this->next = nullptr;
}
};
class SinglyLinkedList... | ALGO | 0.999225 | 5.661892 |
54bf8994-be25-40ea-98db-57a236e47cb9 | HG-IMMORTALS/GFG-POTD | Easy/Perfect Numbers/perfect-numbers.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int isPerfectNumber(long long N) {
if(N==1)return 0;
long long sum=1;
for(long long i=2;i<=sqrt(N);i++)
{
if(N%i==0){
sum+=i;
... | ALGO | 0.999402 | 5.763396 |
16fe7076-a445-491e-80c5-e18c4b179f5b | Sungijnwoo/studyC | (04-3)CONSTRUCTERR&DESTRUCTOR/zMission1/Mission1.cpp | #include <iostream>
using namespace std;
class Point{
private:
int xpos, ypos;
public:
Point(int x, int y){
xpos = x;
ypos = y;
}
void ShowPointerInfo() const{
cout << "[" << xpos << ", " << ypos << "]" << endl;
}
};
class Circle {
... | TOOL | 0.891371 | 5.301226 |
b4761c0a-10c9-43f9-b604-cb70b7a7d8e2 | sravi4701/competitive-programming | spoj/CRZYSMKR.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 11
ll mod_pow(ll base,ll exp){
ll res=1LL;
while(exp>0){
if(exp&1){
res=(res*base)%mod;
}
exp>>=1;
base=((base%mod)*(base%mod))%mod;
}
return res%mod;
}
int main(){
int t;
cin>>t;
ll n;
while(t--){
cin>>n;
ll f=(((mod_... | ALGO | 0.99979 | 3.948951 |
9dc45deb-4aaf-4bf2-83e1-c7b1f9b6bb40 | n0l3r/competitive-programming | leetcode/divide-two-integers.cpp | #include <bits/stdc++.h>
using namespace std;
int divide(int dividend, int divisor) {
if(dividend == INT_MIN && divisor == -1) return INT_MAX;
bool isNeg = false;
if((dividend > 0 && divisor < 0) || (dividend < 0 && divisor > 0)){
isNeg = true;
}
int absDividend = abs(dividend);
int ab... | ALGO | 0.99957 | 4.936238 |
80170cef-8042-446a-8583-bd32eda36750 | adlard07/Language-Translation-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.998859 | 6.785645 |
46096577-ba3f-466c-bc5f-223f29cd75c3 | LMFRomero/SRS_Cards | boost/libs/numeric/ublas/doc/samples/matrix_binary_scalar.cpp | #include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = 3 * i + j;
std::cout << 2.0... | ALGO | 0.980954 | 3.697959 |
a792e297-8ff6-4aa7-96d5-3afe53d6b2d3 | karthikmaddala/HLS_Project | layers/conv2d/conv2d_PaP1.cpp | #include <stddef.h>
#include <math.h>
#include "header/conv2d.h"
/** output_array is the Pointer to array of tensor values flattened in row major order and so on for other variables */
/** output_ndim is the Rank of the tensor (number of dimensions). and so on for other variables */
/** output_numel Number of elements... | ALGO | 0.977187 | 4.787003 |
1f8ed8c6-b3e6-46cd-bfee-ab6104cdb3b7 | Rkda8071/PS | BOJ/20xxx/21759/main.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
vector<int> v[200010];
ll dp[200010],a[200010];
ll dfs(int x){
for(int l : v[x]){
ll ang = dfs(l);
if(ang>0) dp[x] += ang;
}
return dp[x] = dp[x] + a[x];
}
int main(){
scanf("%d",&n);
for(int i=1,x,y;i<=n;i++... | ALGO | 0.999638 | 3.695606 |
a8ab3c7d-5eeb-4a33-a19b-b016df1655d7 | Terpodia/Competitive-Programming | Problems Solved/Codeforces/Greedy/Rigged.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// ordered_set<int> x; x.find_by_order(y); ... | ALGO | 0.999893 | 3.840425 |
06dc9af6-2c28-4cde-9072-95ca3a24ca0f | adivya-jain/DSA_study | LeetCode/1248_count_number_of_nice_subarrays.cpp | class Solution {
public:
int numberOfSubarrays(vector<int>& nums, int k) {
unordered_map<int,int> mp;
mp[0] = 1;
int oddCount = 0;
int result = 0;
for(int i = 0 ; i < nums.size();i++)
{
oddCount += (nums[i]%2);
if(mp.count(oddCount-k))
... | ALGO | 0.999991 | 6.015862 |
3ebfffc6-7b19-46d2-b6d9-21184bbfe304 | ravinthiranpartheepan1407/vertez | Infernix/tokenize.cpp | #include<iostream>
#include<vector>
#include<sstream>
using namespace std;
vector<string> tokenize(string x){
vector<string> out;
stringstream splitWords(x);
string words;
while(splitWords >> words){
out.push_back(words);
}
return out;
}
| TOOL | 0.986733 | 4.539364 |
d500475a-1051-4cba-9017-0953334cc5f4 | Jatin-8898/coursera | Data-Structures/WEEK 1/Programming-Assignment-1/stack_with_max/stack_with_max_naive.cpp | #include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
using std::cin;
using std::string;
using std::vector;
using std::cout;
using std::max_element;
class StackWithMax {
vector<int> stack;
public:
void Push(int value) {
stack.push_back(value);
}
v... | ALGO | 0.998058 | 5.75562 |
35e86e15-7cc5-41ba-90ac-7c8a6fb79fbb | chriger/distributed_langford_pairing | tbb43_20140724oss/examples/parallel_for/tachyon/src/trace.tbb1d.cpp | #include "machine.h"
#include "types.h"
#include "macros.h"
#include "vector.h"
#include "tgafile.h"
#include "trace.h"
#include "light.h"
#include "shade.h"
#include "camera.h"
#include "util.h"
#include "intersect.h"
#include "global.h"
#include "ui.h"
#include "tachyon_video.h"
// shared but read-only so could be p... | TOOL | 0.901325 | 4.048115 |
4011ca16-1bc7-48fa-b818-a773fbc31553 | quinnminhnguyen/Sorting-Project | PA2.cpp | /*********************************************************
Programming Assignment 2 CSCE 221-507
Ngo, Alexander Nguyen, Quinn Vallejo, Michael
<EMAIL> <EMAIL> <EMAIL>
**********************************************************/
#include <sstream>
#include <iostream>
#include <fstream>
#include <string>
... | ALGO | 0.956515 | 4.770435 |
11c541eb-e366-4922-be0d-e38d6d9e4f73 | ansh-d23/Leet-Code | 0987-vertical-order-traversal-of-a-binary-tree/0987-vertical-order-traversal-of-a-binary-tree.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.999994 | 6.123023 |
4f51935f-4c91-4a98-be62-237fa290a93e | Aishu0414/data-structures | factorial.cpp | #include <stdio.h>
// Function to calculate factorial using recursion
int factorial(int n) {
if (n == 0)
return 1; // Base case: 0! = 1
return n * factorial(n - 1); // Recursive case
}
int main() {
int n;
printf("Enter a number to find its factorial: ");
scanf("%d", &n);
if (n ... | ALGO | 0.999861 | 6.046869 |
5494b7a1-8a19-4477-afa1-b08fd11bdc1d | kronic-staging/platform_external_libcxx | test/std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_comp.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.981784 | 6.906991 |
220e246a-8498-497e-b20a-40ec26b07373 | ilanos4/DSA | Mathematics/Factorial/trailing_zero.cpp | #include <iostream>
using namespace std;
// Function to return trailing
// 0s in factorial of n
int findTrailingZeros(int n)
{
if (n < 0) // Negative Number Edge Case
return -1;
// Initialize result
int count = 0;
// Keep dividing n by powers of
// 5 and update count
for (int i = 5; n / i >= 1; i *= 5)
cou... | ALGO | 0.999732 | 6.292355 |
17aeacf6-b32a-4b76-82d7-487ca55ab94a | HyeonGiMin/CodingTest | Programers/LV2/76502.cpp | //괄호 회전하기
//https://school.programmers.co.kr/learn/courses/30/lessons/76502
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
bool isCollect(string str){
//stack을 이용해서 마지막 요소와 같으면
stack<char> st;
for(char c:str){
//왼쪽 브라켓은 무조건 넣는다.
if(c ... | ALGO | 0.999591 | 5.30199 |
95577e62-603b-420c-bea5-defcc5da64f4 | didw/coding | algospot/blockcover2.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int boardH, boardW;
vector<string> board;
vector<vector<pair<int, int>>> rotations;
vector<string> rotate(const vector<string>& arr) {
vector<string> rot(arr[0].size(), string(arr.size(), ' '));
for (int i = 0; ... | ALGO | 0.999049 | 5.007226 |
f40498f1-6d1b-4ea0-b1c2-29c50e4931ae | changyubiao/data_structure-immoc-course | 05-BST/06-Binary-Search-Tree-Level-Traverse/main.cpp | #include <iostream>
#include <ctime>
#include <cassert>
#include <queue>
using namespace std;
template<typename Key, typename Value>
class BST {
private:
struct Node {
// 树中的节点为私有的结构体, 外界不需要了解二分搜索树节点的具体实现
Key key; // 要比较的key
Value value; // key对应的value
Node *left; // 左孩子指针
... | ALGO | 0.998646 | 4.44062 |
140a4ecc-f4b0-42d6-a5fe-f87e33aeb499 | tanmoy215/Linked_list-2 | remove_nth_node_from_end.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int data) {
this->data = data;
this->next = NULL;
}
};
void display(Node* head){
Node* temp = head;
while(temp!=NULL){
cout<<temp->data<<" ";
temp=temp->next;
}
co... | ALGO | 0.999869 | 4.397074 |
d46e6391-e5db-45a8-9a21-794a18010764 | abhishekk781/matrix-session | intro to programming/session 14/queue_stl.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
queue <int> q; //queue
/*
st.push(); //insertion
st.pop(); //deletion
st.front(); // toppest element
st.size(); //size
st.empty() // return 1 when size is zero
*/
int n;
cin>>n;
for(int i=0;i<n;i++){
int x;
cin>>x;
q.push(x);
}
cout<<"SIZ... | ALGO | 0.976155 | 3.562082 |
6bc315b0-e9e3-444d-b060-abdc69fecfff | MohammadYoussof/Transfer_Function | trans_plane_position_and_optical_path.cpp | // This to calculate the position of the transmission plane and the optical path given the parameters surface_num, distance, material, Data, L, M, and N.
// It returns a structure containing the results.
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
struct Data {
vector<vector<vect... | ALGO | 0.9955 | 5.237251 |
806b4986-4733-41a2-a0f2-ff6f00d326c8 | openkylin/platform_external_llvm-project | llvm/lib/Analysis/SyncDependenceAnalysis.cpp | #include <functional>
#include <stack>
#include <unordered_set>
#define DEBUG_TYPE "sync-dependence"
// The SDA algorithm operates on a modified CFG - we modify the edges leaving
// loop headers as follows:
//
// * We remove all edges leaving all loop headers.
// * We add additional edges from the loop headers to the... | ALGO | 0.999358 | 3.645747 |
ae6788b8-0ee4-4981-8207-b0589578a8b1 | salog0d/DSA | Arrays/Problems/reverse_and_shift_array.cpp | #include <iostream>
using namespace std;
void reverseArray(int arr[], int start, int end) {
while (start < end) {
int temp = arr[start];
arr[start] = arr[end];
arr[end] = temp;
start++;
end--;
}
}
void shiftArray(int arr[], int n, int k) {
k = k % n;
if (k < 0) ... | ALGO | 0.999676 | 5.434138 |
a77ca12a-0ec0-4df4-b4a8-1c9948d9a371 | AIRLab-POLIMI/ReLe | rele/test/Batch/NlsBatchTest.cpp | #include "rele/core/BatchCore.h"
#include "rele/policy/parametric/differentiable/NormalPolicy.h"
#include "rele/algorithms/batch/policy_search/gradient/OffPolicyGradientAlgorithm.h"
#include "rele/approximators/basis/IdentityBasis.h"
#include "rele/approximators/features/DenseFeatures.h"
#include "rele/utils/RandomGene... | ALGO | 0.966439 | 5.949355 |
12d8ecb5-ad98-470e-856e-6f3575fb6c0d | Asxd2004/Codsoft.Internship | wordcount.cpp | #include <iostream>
#include <fstream>
using namespace std;
int main() {
string filename;
int wordCount = 0;
string word;
cout << "Enter Your File Name : ";
cin >> filename;
cout<<endl;
ifstream inputFile(filename);
if (!inputFile.is_open()) {
cout << "Error opening the fil... | TOOL | 0.912066 | 5.399877 |
29814956-4732-4020-855f-364ae8eb720a | jacoloves/algorithm-coder | 2023/1/week2/6.cpp | #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#incl... | ALGO | 0.999894 | 3.385337 |
7afa9c5c-4f75-4f07-9ad5-ce0552176d2a | emgullufsen/llvm-project | llvm/lib/CodeGen/VirtRegMap.cpp | #include "llvm/CodeGen/VirtRegMap.h"
#include "LiveDebugVariables.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveStacks.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/Ma... | TOOL | 0.950817 | 3.488388 |
0ec16bbc-e556-4918-928d-37fad7af51dc | ishaantiku29/GFG-Problems | Medium/Fill the Matrix/fill-the-matrix.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 minIteration(int N, int M, int x, int y){
int tmp1 = N-x + M-y; // n,m corner
int tmp2 = x-1 + M-y; // 0,... | ALGO | 0.999733 | 5.543866 |
4c6744c3-a275-42d1-8b16-e44da6871095 | S4ltF1sh/SPOJ | P174PROF.cpp | //P174PROF - ROUND 4F - Điểm danh
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
long long Sum1_to_n[1000006];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
vector<string> Name;
Sum1_to_n[0] = 0;
string tmp;
long long n... | ALGO | 0.999975 | 4.09084 |
bb0156e7-4ed7-4158-a5d8-46f47d67ac95 | maruti-panchal/DSA | Sorting/chechSortOrNot.cpp | // Bubble sort is also used to check the given array is sorted or not through optimized way
// It wii take time complecxity is O(n)
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int arr[6] = {2, 3, 4, 6, 72};
int size = 6;
int cnt = 0;
for (int i = 0; i <= size; i++)
... | ALGO | 0.999075 | 4.491742 |
1680be1e-dbfe-45e4-a269-5357b2a95402 | uuyymilkyl/6Dof-Robotic-Arm-Kinematics | include/3rdParty/eigen-3.4.0/doc/examples/QuickStart_example.cpp | #include <iostream>
#include <Eigen/Dense>
using Eigen::MatrixXd;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << m << std::endl;
}
| ALGO | 0.99669 | 3.474624 |
ad6985c3-71ff-4766-bf3f-e99899d08cb5 | ToLoveToFeel/LeetCode | Cplusplus/_0773_Sliding_Puzzle/_0773_main.cpp | // Created by WXX on 2021/6/26 11:14
#include <iostream>
#include <vector>
#include <map>
#include <queue>
using namespace std;
/**
* 执行用时:64 ms, 在所有 C++ 提交中击败了6.63%的用户
* 内存消耗:14.6 MB, 在所有 C++ 提交中击败了8.07%的用户
*/
class Solution {
public:
int slidingPuzzle(vector<vector<int>> &board) {
typedef vector<vect... | ALGO | 0.999986 | 5.872388 |
20278a0c-1c29-401b-9307-99a2b0c59bad | SV8/joe_xmw | A10-深度优先算法2/ex4.cpp | /*
现有用字符标记像素颜色的 8×8 图像。颜色填充的操作描述如下:给定起始像素的位置待填充的颜色,
将起始像素和所有可达的像素(可达的定义:经过一次或多次的向上、下、左、右四个方向移动所能到达且
终点和路径上所有像素的颜色都与起始像素颜色相同),替换为给定的颜色。
试补全程序。
*/
#include "bits/stdc++.h"
using namespace std;
const int ROWS = 8;
const int COLS = 8;
struct Point {
int r, c;
Point(int r, int c): r(r), c(c) {}
};
bool is_va... | ALGO | 0.996441 | 4.507071 |
50033a31-3193-43ab-9a6a-09c6d41c619b | YttriumWillow/OI | Contests/2023/SC/1008/ZJ-00898/flower/flower.cpp | // C
#include <iostream>
#include <algorithm>
#define i64 long long
#define endl '\n'
#define qwq puts("fzy qwq ~");
#define file(prob) freopen(prob".in", "r", stdin); freopen(prob".out", "w", stdout);
using namespace std;
const int N = 1e7 + 10;
int n, m, a[N]; i64 res;
int cnt;
inline void solve()
{
cin >> ... | ALGO | 0.999895 | 4.521011 |
2193e35e-7c36-4f28-8c80-878dd273802e | GuiSilva77/fatec_aulas_prog | ling_prog/Aula 06/lista_vetor/ex03/ex03.cpp | #include <stdio.h>
#include <stdlib.h>
int main()
{
int vetor1[10], j = 0;
int vetor2[10], l = 0;
int vetor3[10];
for (int i = 2; i <= 20; i++)
{
if (i % 2 == 0)
vetor1[j] = i;
else
j--;
j++;
}
for (int k = 10; k <= 19; k++)
{
vetor2[l] = k;
l++;
}
for (int m = 0... | ALGO | 0.987309 | 3.209951 |
3350bfa6-b50f-4a98-93dc-cb3ed5263847 | Jack-R-lantern/PS | IO/2438/cpp.cpp | #include <iostream>
using namespace std;
int main(void) {
int cnt;
int i, j;
cin >> cnt;
i = 0;
while (i < cnt) {
j = 0;
while (j <= i) {
cout << '*';
j++;
}
cout << endl;
i++;
}
return (0);
}
| ALGO | 0.999908 | 3.871979 |
72bc215d-9289-44b7-8899-a93fb0876754 | old-yan/leetcode-solutions | leetcode_solutions/leetcode_50/16/16.cpp | #include "utils.h"
class Solution {
vi next,prev,copy;
int mindis=INT_MAX,ans,target;
void dfs(int i){
int cursum=copy[i];
int l=i+1,r=copy.size()-1;
while(l<r){
int sum=cursum+copy[l]+copy[r];
if(chmin(mindis,abs(sum-target)))ans=sum;
if(sum==tar... | ALGO | 0.99999 | 5.58614 |
b714eac4-5f87-407d-9d28-90111958f01f | shubham21699/My-LeetCode-Solutions | 1340-jump-game-v/1340-jump-game-v.cpp | class Solution {
public:
int jumps(vector<int>& arr, int i, int n, int d, vector<int>& dp) {
if(i >= n || i < 0) return 0;
if(i == 0 && arr[i] <= arr[i+1]) return 0;
if(i == n-1 && arr[i] <= arr[i-1]) return 0;
if(i>0 && i<n && arr[i] <= arr[i-1] && arr[i] <= arr[i+1]) retur... | ALGO | 0.999972 | 5.714556 |
bc9dac0a-d393-42b2-9368-c78f781fa002 | owl1753/Algorithm_Study | 10000/10996.cpp | #include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= (n / 2) + (n % 2); j++)
{
printf("* ");
}
printf("\n ");
for (int j = 1; j <= (n / 2); j++)
{
printf("* ");
}
printf("\n");
}
} | ALGO | 0.999987 | 3.549649 |
0a478c68-2acd-4f5e-8a3d-33fd6e2da34a | imSarfaroz/Algorithms-and-Data-Structures-2020 | project-01/uva-11588/main.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct Freq
{
char letter;
int count;
Freq(char aLetter, int aCount)
: letter(aLetter), count(aCount)
{
}
};
int main()
{
int nTest;
cin >> nTest;
for (int caseN = 1; caseN <= nTest; caseN++)
... | ALGO | 0.999462 | 4.50408 |
f0da591f-5067-427e-a559-2c0c0373f1fb | fepaf/Competitive-Programming | Tutoria OBI 2020/Aula-06/elemento-solitario.cpp | #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MAX (1<<20)
#define sz(x) (int)(x).size()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define all(x) (x).begin(), (... | ALGO | 0.999785 | 4.176635 |
51221f67-4b40-4468-a8a5-688e98ce321f | sslattery/HMCSA | core/src/OperatorTools.cpp | //---------------------------------------------------------------------------//
// \file OperatorTools.cpp
// \author Stuart R. Slattery
// \brief OperatorTools definition.
//---------------------------------------------------------------------------//
#include "OperatorTools.hpp"
#include <Teuchos_ParameterList.hpp>... | ALGO | 0.986809 | 6.581989 |
d539932f-c117-4d40-b916-f35d47603607 | sjhalayka/qc_for_cs | pd_10_3_2.cpp | #include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <complex>
using namespace std;
// Modified from:
// https://gist.github.com/pwxcoo/72d7d3c5c3698371c21e486722f9b34b
//
// also see:
// Mastering Algorithms with C by Kyle Loudon
// For the use of comp... | ALGO | 0.994973 | 4.174775 |
7d282faf-15f5-436b-867b-e42dd34dd142 | hjiang13/LLMs-in-IR | POJ-104/1/2066.cpp | #include <iostream>
using namespace std;
int count;
void f(int x,int y)
{
int i=0;
if(x>=y)
for(i=y; i<=x; i++)
{
if(i==x)count++;
if(x%i==0) f(x/i,i);
}
}
main()
{
int t;
int n,i,x,j;
cin >> "%d",&n);
for(i=0; i<n; i++)
{
count=0;
cin >> "%d",&x);
f(x,2);
cout << "%d\n",count);
}
} | ALGO | 0.999841 | 3.278353 |
231f4370-0ef7-415d-a6e1-6b98fa597ead | franshamk/scantest | deps/boost_1_82_0/libs/algorithm/example/is_palindrome_example.cpp | #include <vector>
#include <list>
#include <iterator>
#include <functional>
#include <iostream>
#include <boost/algorithm/is_palindrome.hpp>
namespace ba = boost::algorithm;
template <typename T>
bool funcComparator(const T& v1, const T& v2)
{
return v1 == v2;
}
struct functorComparator
{
template <typename... | TEST | 0.990502 | 6.38513 |
a6ef5d31-91fe-43ef-aa75-3d176181f1b0 | eeq8629/GoogleEarthEnterprise | earth_enterprise/src/third_party/sgl/v0_8_6/src/SkFilterProc.cpp | #include "SkFilterProc.h"
/* [1-x 1-y] [x 1-y]
[1-x y] [x y]
*/
static unsigned bilerp00(unsigned a00, unsigned a01, unsigned a10, unsigned a11) { return a00; }
static unsigned bilerp01(unsigned a00, unsigned a01, unsigned a10, unsigned a11) { return (3 * a00 + a01) >> 2; }
static unsigned bilerp02(unsigned ... | ALGO | 0.998587 | 5.601091 |
bce7eb03-b8cf-4384-8cd1-c792db2c1d51 | hjiang13/LLMs-in-IR | POJ-104/103/743.cpp | #include <iostream>
using namespace std;
int main()
{
char str[1001];
cin >> str;
int length = strlen(str);
int count = 1;
for (int i = 1; i < length; i++)
{
if (str[i] == str[i - 1]
|| str[i] - 'a' == str[i - 1] - 'A'
|| str[i] - 'A' == str[i - 1] - 'a')
count++;
else
{
if (str[i - 1] - 'A' >= 0 && str[i - 1] - 'A' ... | ALGO | 0.999589 | 3.640177 |
dbe48c43-df1f-4336-af4a-a9e695118a68 | Abdulsayedd/Sheets-Solutions | Week #3/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
int n; cin>>n;
int arr[n];
for(int i = 0 ; i < n ; i++)
cin>>arr[i];
int mn=INT_MAX,mnpos=0;
for(int i = 0 ; i < n ; i++)
{
if(arr[i]<mn)//first min value
{
mnpos=i;
mn=arr[i];
}
... | ALGO | 0.999978 | 4.118462 |
6cb13f0d-2a2c-4107-9f72-3e8a8cea6e4f | vincentalbert24/Lab-Algo2-222310009 | tugas 1 algoritma dan analisis smester2/tugas1no1.cpp | #include <iostream>
using namespace std;
void selectionSort(int arr[], int n) {
int i, j, maxIndex, temp;
for (i = 1; i <= n-1; i++) {
maxIndex = i;
for (j = i+1; j <= n; j++) {
if (arr[j] > arr[maxIndex]) {
maxIndex = j;
}
}
temp = arr[maxIndex];
arr[maxIndex] = arr[i];
... | ALGO | 0.999984 | 4.798794 |
2a93a3e2-fc5d-4eb8-baed-6dddd935d9c4 | Xilinx/llvm-aie | libc/src/stdbit/stdc_count_zeros_ui.cpp | #include "src/stdbit/stdc_count_zeros_ui.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/math_extras.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(unsigned, stdc_count_zeros_ui, (unsigned value)) {
return static_cast<unsigned>(count_zeros(value));
}
} ... | TOOL | 0.979709 | 6.803085 |
c4888bff-6b48-40a1-9eff-085ee1eee2cd | Cookiefan/ZigZag | Zigzag/May/May 20/B.cpp | #include <bits/stdc++.h>
#define oo 1000000007
using namespace std;
long long f[2002][2002];
int num[20];
int n;
int main()
{
memset(f,0,sizeof(f));
f[0][0]=1;
for (int i=1;i<=1000;i++)
for (int j=0;j<=i;j++)
f[i][j]=(f[i-1][j-1]+f[i-1][j])%oo;
num[0]=1;
for (int i=1;i<=11;i++)
num[i]=num[i-1]*2;
scanf(... | ALGO | 0.999786 | 3.402452 |
f3dfdb70-35c4-46ae-9b2f-b20115257fbf | mimiicteam/OOP | HACKNAO/insertElement.cpp | // #include <iostream>
// using namespace std;
// void input(int a[], int n)
// {
// for (int i = 0; i < n; i++)
// {
// cin >> a[i];
// }
// }
// void display(int a[], int n)
// {
// for (int i = 0; i < n; i++)
// {
// cout << a[i] << " ";
// }
// }
// void insertElement(int ... | ALGO | 0.999981 | 4.389866 |
e6afd211-b328-4305-b9e8-c7fe87627908 | roshnimishraa/Leetcoding | 0328-odd-even-linked-list/0328-odd-even-linked-list.cpp | class Solution {
public:
ListNode* oddEvenList(ListNode* head) {
//corner case
if(head == NULL || head->next == NULL || head->next->next == NULL)
{
return head;
}
ListNode *oddPointer =head;
ListNode *evenPointer = head->next;
ListNode *startOfEven =head->next;
... | ALGO | 0.999724 | 5.487062 |
82560bb3-c8df-44e1-9d39-d0a0e72c4041 | PriyanshK09/Leetcode-Discord-Bot | solutions/minimum-time-to-revert-word-to-initial-state-ii.cpp | // Time: O(n)
// Space: O(n)
// z-function
class Solution {
public:
int minimumTimeToInitialState(string word, int k) {
const auto& ceil_divide = [](int a, int b) {
return (a + b - 1) / b;
};
// Template: https://cp-algorithms.com/string/z-function.html
const auto& z_f... | ALGO | 0.999967 | 6.179254 |
2d799cc3-7d80-4583-b7fe-da20149d7ff9 | dayekuaipao/LeetCode | easy/Valid Anagram.cpp | class Solution {
public:
bool isAnagram(string s, string t) {
map<char,int> m;
if(s.length()!=t.length())
return false;
for(auto i:s)
{
m[i]++;
}
for(auto i:t)
{
if(m[i]!=0)
{
m[i]--;
... | ALGO | 0.999986 | 6.150886 |
8d983187-a80d-4e42-855e-89465bb4e2ae | noelmathen/LeetCode-Journey-CPP | LeetCode Problems/461_Hamming_Distance.cpp | class Solution {
public:
int hammingDistance(int x, int y) {
int n = x^y, count=0;
while(n>0){
count += n&1;
n >>= 1;
}
return count;
}
}; | ALGO | 0.999954 | 5.496766 |
dd56af55-6665-4d73-925f-62610e3f2a10 | snow88/Parallel-Processing-Codes | producer_buffer.cpp | ///run producer in background first
#include<iostream>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<sys/sem.h>
#include<sys/types.h>
#include<sys/time.h>
#include<unistd.h>
using namespace std;
int shmid, semid;
void *addr;
union semun {
int val;
struct semid_ds *buf;
ushort *ar;
};
ti... | ALGO | 0.984609 | 4.126046 |
6a70c2e3-16db-4b32-b976-9fa55d0928ce | WhatTheMUCK/LeetCode | 1786-count-the-number-of-consistent-strings/count-the-number-of-consistent-strings.cpp | class Solution {
public:
int countConsistentStrings(string allowed, vector<string>& words) {
int bitMask = 0;
for (char letter : allowed){
bitMask |= 1 << (letter - 'a');
}
int answer = 0, tempBitMask;
for (string word : words){
tempBitMask = 0;
... | ALGO | 0.999929 | 5.927365 |
b357359c-581f-477d-904c-5595e9483b4d | Dylan13531/CPLUS | C8/test05.cpp | /*************************************************************************
> File Name: test05.cpp
> Author: DylanYang
> Mail: <EMAIL>
> Created Time: 二 1/21 18:09:43 2020
************************************************************************/
#include <iostream>
template<typename T>
T max5(T *);... | ALGO | 0.995573 | 4.750915 |
f2f3e7bc-a896-4441-8a9b-a344eb100aed | kripken/llvm-js | lib/VMCore/InlineAsm.cpp | #include "llvm/InlineAsm.h"
#include "ConstantsContext.h"
#include "LLVMContextImpl.h"
#include "llvm/DerivedTypes.h"
#include <algorithm>
#include <cctype>
using namespace llvm;
// Implement the first virtual method in this class in this file so the
// InlineAsm vtable is emitted here.
InlineAsm::~InlineAsm() {
}
In... | TOOL | 0.872981 | 4.769534 |
c7a11187-ac3f-4c7f-9c99-c96d6347a83a | zichuan-liu/leetcode | c++/link/lc2.cpp | #include<bits/stdc++.h>
using namespace std;
//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* addTwoNumbe... | ALGO | 0.999885 | 5.491405 |
ca434946-009a-4123-98ae-e50cff19d839 | leo-pss/algorithm | leetcode/1448.cpp | #include <algorithm>
using namespace std;
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(left), right(ri... | ALGO | 0.999908 | 6.443497 |
f7191d9b-dacb-47e0-933f-941d88582d23 | Shoyeb45/CompetitiveProgramming | Codeforces/TLE-31_Sheet/1000/ShoeShuffling.cpp | #include<bits/stdc++.h>
using namespace std;
#define range(x) (x).begin(), (x).end()
#define NFS ios_base::sync_with_stdio(false); cin.tie(NULL);
typedef long long ll;
const ll mod = 1000000007;
int n;
vector<int> a;
bool isAllEqual(vector<int> &a) {
for(int i = 0; i < a.size() - 1; i++) {
if(a[i] != a[i +... | ALGO | 0.999776 | 4.080365 |
abad7f46-160a-4e87-8040-e6aaeedcc489 | Taejin1221/Re-PS | Baekjoon/Baekjoon09663.cpp | // Baekjoon09663.cpp
#include <iostream>
using namespace std;
int ans, n;
bool col[16], diag1[32], diag2[32];
void solve(int curr, int row) {
if (curr == n)
ans++;
else {
for (int i = 0; i < n; i++) {
int idx1 = i - row + n - 1, idx2 = row + i;
if (!col[i] && !diag1[id... | ALGO | 0.999984 | 4.908578 |
39a70fd2-9772-4b50-90ae-c46acd5c6885 | 2khs21/boj | 프로그래머스/2/181188. 요격 시스템/요격 시스템.cpp | #include <string>
#include <vector>
#include <stack>
#include <iostream>
#include <algorithm>
using namespace std;
int solution(vector<vector<int>> targets) {
int answer = 0;
sort(targets.begin(), targets.end());
// for (auto t : targets) {
// cout << t[0] << "," << t[1] << " ";
// }
... | ALGO | 0.999815 | 5.473412 |
aeacc276-9c53-49e8-819c-1ff1692abfeb | sacckey/atcoder | abc175/abc175_d.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin >> n >> k;
vector<int> p(n);
vector<long long> c(n);
for (int i = 0; i < n; i++){
cin >> p[i];
p[i]--;
}
for (int i = 0; i < n; i++) cin >> c[i];
long long ans = -1000000000000000000;
for (int i = 0; i < n; i++)
{
... | ALGO | 0.99999 | 3.333882 |
05574f83-3fef-40bb-aeee-895752198b37 | neppiness/TIL | problem-solving/boj/kmp/16916-re-02-05-2023.cpp | #include <bits/stdc++.h>
using namespace std;
const int MX = 1'000'000;
int f[MX + 2];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
string lck, key;
cin >> lck >> key;
for(int i = 1; i < key.length(); i++) {
int j = f[i - 1];
while(key[i] != key[j] && j > 0) j = f[j - 1];
if(key[i] == key... | ALGO | 0.999985 | 3.816816 |
ce2f5924-6a8f-4489-8a2e-f3b2fd045d54 | virtyaluk/leetcode | problems/695/solution.cpp | class Solution {
public:
int maxAreaOfIsland(vector<vector<int>>& grid) {
if (grid.empty() || grid[0].empty()) {
return 0;
}
int ans = 0, m = grid.size(), n = grid[0].size();
function<int(int, int)> findIslandArea = [&](int i, int j) {
int area = 0;
... | ALGO | 0.999872 | 6.839931 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.