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 |
|---|---|---|---|---|---|---|
6a7ca45a-981e-413a-a155-ed2cca5cc042 | SyedSaifAli1234/Threads-OSLab6 | Q1_164082.cpp | #include <iostream>
using namespace std;
#include <string.h>
struct Args{
int length;
char ** array;
};
void* Average(void* param){
float avg = 0;
Args *test =(Args*) param;
for(int i=1; i<test->length; i++){
cout<<test->array[i]<<endl;
avg = avg + atoi(test->array[i]);
}
test->length... | ALGO | 0.999422 | 3.798885 |
3b301242-0a20-4da3-b7fe-b0d91cafb240 | KimberlyRaymer/coms327 | project1.09/pokemon.cpp | #include <cstdlib>
#include <algorithm>
#include <math.h>
#include "pokemon.h"
#include "db_parse.h"
#include "poke327.h"
static bool operator<(const levelup_move &f, const levelup_move &s)
{
return ((f.level < s.level) || ((f.level == s.level) && f.move < s.move));
}
static int pkmn_lvl()
{
int md = (abs(world.... | TOOL | 0.948062 | 5.552415 |
ee382102-d663-4193-853b-db73c4a6aa4a | subodhnarayan/100DayofCoding | day294.cpp | -- -- -- -- -- -- -- -- -GFG - POTD - 14 / 02 / 2025 -- -- -- -- -- -- -- -- -- -- -- -- -- -------
Fixing Two nodes of a BST
Difficulty: HardAccuracy: 53.68%Submissions: 59K+Points: 8Average Time: 45m
Given the root of a Binary search tree(BST), where exactly two nodes were swapped by mistake. Your task is to fix (or... | ALGO | 0.999846 | 5.561158 |
9f20f1b8-2a79-4c24-a5b3-29e417cde3b3 | CodeTrans-Research/RefuTra | result/translate/transcoder/java2cpp/c++/ANALYSIS_OF_ALGORITHMS_SET_2_ASYMPTOTIC_ANALYSIS.cpp | int f_gold ( int arr [ ] , int n , int x ) {
int i ;
for ( i = 0 ;
i < n ;
i ++ ) {
if ( arr [ i ] == x ) {
return i ;
}
}
return - 1 ;
} | ALGO | 0.999285 | 4.403124 |
bd5f1096-458e-4b88-bd9e-e3711ff04d5b | wangyupengCC/basalt | thirdparty/basalt-headers/thirdparty/eigen/doc/examples/DenseBase_middleRows_int.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(2..3,:) =\n" << A.middleRows(2,2) << endl;
return 0;
}
| ALGO | 0.953887 | 3.307581 |
f47c7694-947d-415c-8cb0-c891b94728b1 | 0xEbrahim/CodeForces-Problem-Solving | Completed Training From Zero/Frequency Array/N - Sticky Spelling Situation.cpp | #define _CRT_SECURE_NO_DEPRECATE
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <vector>
#include <utility>
#include <iomanip>
#include <cstring>
#include <string>
#include <set>
#inclu... | ALGO | 0.999975 | 4.305929 |
592287b7-e199-4dbd-84ce-3df62505e759 | Nedj/CG-Blizzlike | dep/g3dlite/source/Quat.cpp | /**
@file Quat.cpp
Quaternion implementation based on Watt & Watt page 363
@author Morgan McGuire, graphics3d.com
@created 2002-01-23
@edited 2010-03-31
*/
#include "G3D/Quat.h"
#include "G3D/Any.h"
#include "G3D/stringutils.h"
#include "G3D/BinaryInput.h"
#include "G3D/BinaryOutput.h"
namespace G... | TOOL | 0.959562 | 6.977787 |
c4514749-db5e-4bd6-a3cd-3e5c40a32f3f | sarvex/cpp-leetcode | 0521.Longest Uncommon Subsequence I.cpp | class Solution {
public:
int findLUSlength(string a, string b) {
return a == b ? -1 : max(a.size(), b.size());
}
}; | ALGO | 0.998532 | 5.402235 |
1e0517b2-c024-43dc-9549-d81e4c38522f | saurabh8434/-CrackYourPlacement | sorting and searching/permutations_in_array.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution{
public:
bool isPossible(long long a[], long long b[], int n, long long k) {
// Your code goes here
sort(a, a+n);
sort(b, b+n, greater<int>());
for(int i=0; i<n; i++){
if(a[i]+b[i] < k)
... | ALGO | 0.999959 | 4.892313 |
a0425bb5-14fd-44e9-aa5e-3cd26f96dc51 | Tarequl-islam/Programming-competition | Codeforces/336 a.vasily the bear and triangle.cpp | #include<bits/stdc++.h>
using namespace std;
#define fo(i, n) for (i = 0; i < n; i++)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define pb push_back
#de... | ALGO | 0.999879 | 3.763249 |
f72bfbd8-a886-4288-aa00-23e6ee06e626 | raincross7/code-similarity | codes/train_code/problem366/problem366_160.cpp | #include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
int A,B,C,K; cin>>A>>B>>C>>K;
if(K<=A){
cout<<K<<endl;
}else if(K<=A+B){
cout<<A<<endl;
}else{
cout<<A-(K-A-B)<<endl;
}
} | ALGO | 0.999905 | 3.234543 |
3389a5e0-455f-4230-9342-54c97e22c7f4 | Rajneesh2002/college-code | lab9/9.7.cpp | #include <stdio.h>
int main(){
int n,i,j,k,count =0;
printf("enter the size of the array : ");
scanf("%d", &n);
int arr[n];
printf("enter the elements of the array: ");
for(i =0; i<n;i++){
scanf("%d", &arr[i]);
}
for(i = 0;i<n;i++){
for(j=i+1; j<n; j++){
if(ar... | ALGO | 0.999535 | 3.463879 |
72afe66f-4d6e-4e12-b24f-08b04addd2d0 | Samrat-ahammed/firebase_Verify_Phone_Number | 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 |
8b9b2e29-a265-4d17-8ebe-c82f31237f0d | Madhax/Kata | leetcode/subsets2/bitmasking.cpp | class Solution {
public:
vector<vector<int>> subsetsWithDup(vector<int>& nums) {
int n = nums.size();
// Sort the generated subset. This will help to identify duplicates.
sort(nums.begin(), nums.end());
vector<vector<int>> subsets;
int maxNumberOfSubsets = pow(2, n);
... | ALGO | 0.999722 | 6.649602 |
deae9398-8363-4135-be77-95d068af4ced | AdhamHammoda/Competitive-Programming | CODEFORCES_RATING/800/A- Adjacent Replacements.cpp | #include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
void test_case()
{
ll n;
cin>>n;
for(int i=0;i<n;i++)
{
ll a;
cin>>a;
cout<<a-(a%2==0)<<" ";
}
}
int main()
{
FIO
// freopen("input.in... | ALGO | 0.999443 | 3.466151 |
f92cd1e4-ba2e-4fb3-a894-236c27c57a08 | liguigui/kamyu104-LeetCode | C++/non-decreasing-array.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
bool checkPossibility(vector<int>& nums) {
int cnt = 0;
for (int i = 1, prev = nums[0]; i < nums.size(); ++i) {
if (prev > nums[i]) {
if (cnt++) {
return false;
}
i... | ALGO | 0.999997 | 6.028127 |
77716580-657c-404b-81b5-f712ed2f33c2 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_2954_7.cpp | #include <bits/stdc++.h>
using namespace std;
int sg(long long x) {
if (x < 4)
return 0;
else if (x < 16)
return 1;
else if (x < 82)
return 2;
else if (x < 6724)
return 0;
else if (x < 50626)
return 3;
else if (x < 2562991876LL)
return 1;
else
return 2;
}
int main() {
int n;
... | ALGO | 0.999545 | 4.23338 |
42bff253-2134-437f-b3c3-d1b4cde73a29 | takaoki-cpp/atcoder | Contests/AtCoder Beginner Contest 099/Programs/Good Grid.cpp | #include <cstdio>
#define min(a, b) (a < b ? a : b)
const int MAX_N = 505, MAX_COLOURS = 35;
int cost[MAX_COLOURS][MAX_COLOURS], frequency[MAX_COLOURS][3];
int all_different(int x, int y, int z)
{
return (x != y && y != z && z != x);
}
int main()
{
int n, no_of_colours;
scanf("%d %d", &n, &no_of_colours)... | ALGO | 0.999474 | 3.810599 |
a635bf88-b1e8-4e49-a0ff-68996cfe39c6 | wzao1515/R2S | ra2sql/ra2sql/include/boost_1_55_0/libs/move/example/doc_clone_ptr.cpp | //[clone_ptr_base_derived
class Base
{
BOOST_COPYABLE_AND_MOVABLE(Base)
public:
Base(){}
Base(const Base &x) {/**/} // Copy ctor
Base(BOOST_RV_REF(Base) x) {/**/} // Move ctor
Base& operator=(BOOST_RV_REF(Base) x)
{/**/ return *this;} // Move assign
Base& ... | TOOL | 0.964316 | 6.82993 |
5077b3cf-cc60-4f8b-8b0b-d688f080f64c | Ignavar/30DaysOfLeetCode | 0238-product-of-array-except-self/0238-product-of-array-except-self.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
vector<int> ans(nums.size());
vector<int> leftProducts(nums.size());
vector<int>rightProducts(nums.size());
leftProducts[0] = 1;
for(int i=1;i<nums.size();i++)
leftProducts[i] = leftProduc... | ALGO | 0.999972 | 6.269916 |
6931e06a-375d-4834-8d69-a40849c9c4d5 | sarvex/leetcode-erlang | solution/1600-1699/1655.Distribute Repeating Integers/Solution.cpp | class Solution {
public:
bool canDistribute(vector<int>& nums, vector<int>& quantity) {
int m = quantity.size();
int s[1 << m];
memset(s, 0, sizeof(s));
for (int i = 1; i < 1 << m; ++i) {
for (int j = 0; j < m; ++j) {
if (i >> j & 1) {
... | ALGO | 0.999969 | 5.620241 |
08c49d75-c594-423b-84a4-1f654f48f72d | Talibb555/codeforces | Eastern_Exhibition.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;cin>>t;
while (t--)
{
int n;cin>>n;
long long x[n],y[n];
for(int i=0;i<n;i++) cin>>x[i]>>y[i];
sort(x,x+n);
sort(y,y+n);
if(n&1) cout<<1<<endl;
else cout<<(x[n/2]-x[n/2-1]+1LL)*(y[n/2]-y... | ALGO | 0.999684 | 3.690965 |
0c6a06a6-ea6e-4301-89e9-4c200392f1c6 | Haemanth-V/IPMP1921 | Week-1/sorting/merge_sort.cpp | #include <bits/stdc++.h>
using namespace std;
void merge(int arr[], int l, int mid, int r){
int n1 = mid-l+1, n2 = r-mid;
int i,j,k;
int L[n1], R[n2];
for(i=0; i<n1; i++)
L[i] = arr[l+i];
for(i=0; i<n2; i++)
R[i] = arr[mid+i+1];
i = 0;
j = 0;
k = l;
while(i<n... | ALGO | 0.999746 | 4.280952 |
89a6c11b-1d55-435f-af4e-476479b2f72d | zwjuan/DataStruct | DList/DList.cpp | #include"DList.h"
List::List()
:_head(NULL)
,_tail(NULL)
{}
void List::Clear()
{
Node* cur = _head;
while(cur)
{
Node* next = cur->_next ;
delete cur;
cur = next;
}
_head = _tail = NULL;
}
List::~List()
{
Clear();
}
void List::PushBack(const DataType& x)
{
if(_head == NULL)//ڵ
{
_head = new Node(x... | TOOL | 0.944998 | 3.788199 |
20364fdd-b8dd-4006-a0fc-f2baf5f14d28 | kashishpratap9/DSA | 1058-lexicographically-smallest-equivalent-string/lexicographically-smallest-equivalent-string.cpp | class Solution {
public:
char dfs(char src, vector<int>&visited, unordered_map<char, vector<char>>&adj){
visited[src-'a']=1;
char mini=src;
for(auto & nbr: adj[src]){
if(visited[nbr-'a']==0){
mini= min(mini,dfs(nbr, visited, adj));
}
}
return mini;
}
string smalle... | ALGO | 0.999992 | 6.489677 |
eab97b48-d33f-46a7-a5a2-22c9ee93b231 | ishandutta2007/codeforces | rainair/normal/1463/B.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define DB double
#define U unsigned
#define P std::pair
#define LL long long
#define LD long double
#define pb push_back
#define MP std::make_pair
#define SZ(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define F... | ALGO | 0.999694 | 3.427714 |
5e51ed3a-60c1-4a14-b6de-fe17b82b0861 | TKJ-Kasih-Ananda/X-TKJ-2023-2024 | Chriswell-Pangaribuan/chriswell_whiledo(1).cpp | #include <iostream>//perintah yang digunakan untuk memasukkan header file iostream ke dalam program yang sedang dikembangkan.
using namespace std;//untuk mendeklarasikan/ memberitahukan kepada compiler bahwa kita akan menggunakan semua fungsi/class/file yang terdapat dalam namespace std.
int main() {//jenis tipe data ... | ALGO | 0.992646 | 3.382299 |
fe0d4bc5-b869-4448-8b28-f978e7a36d07 | DlutMedimgGroup/MouseCTSegmentation | 3D-Caffe/src/caffe/layers/argmax_layer.cpp | #include <algorithm>
#include <functional>
#include <utility>
#include <vector>
#include "caffe/layers/argmax_layer.hpp"
namespace caffe {
template <typename Dtype>
void ArgMaxLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
const ArgMaxParameter& argmax_param =... | DATA | 0.912094 | 6.633445 |
28e40de9-c574-4b1e-aa3f-d94aa419ece1 | Lucas-Morais-Freire/PDI | histogram_manip/histogram_manip.cpp | #include <iostream>
#include <opencv2/opencv.hpp>
int main(int argc, char** argv){
cv::Mat image;
cv::Mat imageBRG;
int width, height;
cv::VideoCapture cap;
std::vector<int> hist(256, 0);
int key;
cap.open(0);
if(!cap.isOpened()){
std::cout << "cameras indisponiveis";
return -... | TOOL | 0.953596 | 4.413498 |
d17c79b5-fe05-4cb7-b661-410bff25b942 | JODE-HRK/Algorithm-Question | nowcode/2020MultiSchool/First/B.cpp | /*
* @Descripttion:
* @version:
* @Author: JODEHRK
* @Date: 2020-07-11 21:06:32
* @LastEditors: JODEHRK
* @LastEditTime: 2020-07-11 21:45:37
*/
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
int n, x, ans = 0;
int a[maxn], b[maxn];
int f[maxn], dp[maxn], posa[maxn], posb[maxn];
int ppo... | ALGO | 0.999941 | 3.990943 |
5ecb3ece-ca5a-4783-8ab3-298dc1164d19 | KerakTelor86/AlgoCopypasta | source/07_Strings/06_KMP.cpp | auto get_kmp = [&](string S, string T) -> vector<int> {
// S is the text, T is the pattern // ababa aba -> expected: {1 2 3 2 3}
int N = S.size(), M = T.size();
vector<int> lps(M), kmp(N);
for(int i = 1, j = 0; i < M;) {
if(T[i] == T[j])
lps[i++] = ++j;
else {
if(j)
j = lps[j - 1];
... | ALGO | 0.999656 | 5.861119 |
98de9516-0725-4e32-9ed7-c2a8b1437609 | leekilhun/ws_stm32g030c6t6 | stm32g030c6t6_cube_io/App/ap/en/enStepMotor.cpp | /*
* enStepMotor.cpp
*
* Created on: Jul 10, 2023
* Author: gns2.lee
*/
#include "ap.hpp"
#include "s_curve.h"
#include "enStepMotor.hpp"
static uint8_t remaining_flag {};
void enStepMotor::SetRel(int steps, uint32_t speed)
{
int position = steps ;
this->dir = (steps < 0);//CCW
this->Direction((ste... | TOOL | 0.965466 | 5.115674 |
0b91f6f1-e39e-443d-89fe-d0e5c9592910 | donalshijan/Competitive_Programming | binary_search_approaches.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fastio ios::sync_with_stdio(false); cin.tie(0);
// ----------------------------------------------------
// 1. STANDARD BINARY SEARCH - EXACT MATCH
// ----------------------------------------------------
// 1.1 Standard iterative implementation... | ALGO | 0.999945 | 5.897764 |
413eeaf1-e744-47b6-bb95-e389603f4c4c | Garzzza7/zadania | AtCoder/AtCoder_Library_Practice_Contest/SCC.cpp | #include <bits/stdc++.h>
#define MAX_N 500001
using namespace std;
// https://atcoder.jp/contests/practice2/tasks/practice2_g
int n, m;
vector<vector<int>> adj(MAX_N, vector<int>());
vector<vector<int>> rev_adj(MAX_N, vector<int>());
stack<int> Stack;
vector<bool> visited(MAX_N, 0);
int cntComponents = 0;
map<int,... | ALGO | 0.999932 | 5.20046 |
fd2f5bc5-4a53-4edf-b106-0112acca6605 | Heatwave/cpp-primer | ch3/bsearch.cpp | #include <vector>
#include <iostream>
using std::vector;
using std::cin;
using std::cout;
using std::endl;
int mainbsearch()
{
vector<int> ivec{ 1,2,3,4,5 };
int sought = 5;
auto beg = ivec.begin(), end = ivec.end();
auto mid = ivec.begin() + (end - beg) / 2;
while (mid != end && *mid != sought)
{
if (sought ... | ALGO | 0.999666 | 4.798248 |
91814c6e-6902-4dec-b572-2a06ede8c8e5 | marvin-2102/LIP | valoresdamatriz.cpp | #include <iostream>
#include <iomanip>
#define TAM 30
using namespace std;
int main () {
int n, m;
cin >> n >> m;
int M[TAM][TAM], i, j, maiorV, menorV;
for(i = 0; i < n; i++) {
for(j = 0; j < m; j++) {
cin >> M[i][j];
if((i && j) == 0) {
maiorV = M[i][j];
menorV = M[i][j... | ALGO | 0.999588 | 3.753042 |
67fcf85f-8f48-4613-ab7c-e3f780c1bc23 | Thyme0113/astnn_with_semi-supervised_learning | ssl_2000/data/src/fibonacci/recursive99.cpp | int f[45];
int fib(int n)
{
if(n==0 || n==1) return f[n]=1;
if(f[n]!=-1) return f[n];
return f[n]=fib(n-1)+fib(n-2);;
}
int main()
{
int n;
cin >> n;
for(int i=0;i<=44;i++) f[i]=-1;
cout << fib(n) << endl;
return 0;
}
| ALGO | 0.999992 | 4.587425 |
2660659d-2965-4fdf-980b-a1a54a5c9b04 | 1604078-MEHEDI/Codeforces | codeforces/1466/D.cpp | /*بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم*/
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
using pii = pair<int, int>;
const double PI = acos(-1.0)... | ALGO | 0.999845 | 3.806679 |
bee01f96-aade-4f88-a840-370685950e06 | ishandutta2007/codeforces | juve45/normal/1220/C.cpp | #include <bits/stdc++.h>
#define st first
#define nd second
using namespace std;
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prn... | ALGO | 0.999951 | 3.619248 |
163cdbf1-8279-4c01-b6c2-3da360e36839 | bytedance/terark-zip | 3rdparty/boost-include/libs/bimap/example/population_bimap.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is misleading and unsettling, there are no
// po... | TOOL | 0.986102 | 5.798679 |
39d107ca-e5eb-44cb-ab70-1358e778149f | Prakhar-002/LEETCODE | 🍄 Daily Challenge 2025 🍳/🔬 Examine Thoroughly 🧬/01 Jan 🪼/21 - 01 - 2025 --- 2017. Grid Game ☃️ 🍁 🍰 🎲/🎲CPP - 2017. Grid Game.cpp | //! https://github.com/Prakhar-002/LEETCODE
// Todo 💎 QUESTION NUMBER 2017
//? ⌚ Time complexity ➺ O(n) 👉🏻 n = len(grid[0])
//? 🧺 Space complexity ➺ O(1)
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
class Solution {
public:
long long gridGame(vector<vector<int>>& grid)... | ALGO | 0.999963 | 6.482971 |
456261f5-73f8-469e-a420-fa560632a574 | xhaktmchl/Algorithm_study | Sejong Algorithm Training/[세종대 알고리즘 트레이닝 Level20.5 04번 O] 겹치지 않도록.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
/*
[세종대 알고리즘 트레이닝 Level20.5 04번 O] 겹치지 않도록
문제:
접근:완탐
풀이:
//1.입력
//2.완탐: 이차배열 둘 다 1인 부분 있는지 탐색
// 있으면 flag=1, 중단
//3.출력:
시간복잡도: O()=
*/
int a[10][10],b[10][10];
bool flag = 0;
int main() {
ios::sync_with... | ALGO | 0.999718 | 3.681597 |
f35203ac-20df-44d9-8f8f-3b690af62a90 | sslab-gatech/Sense | src/systemc/tests/systemc/misc/v1.0/dash6/dist.cpp | /*****************************************************************************
dist.cpp -- Implementation of the odometers.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/************************************************************... | ALGO | 0.995471 | 6.573743 |
bfeb2b88-2986-4d82-b3c7-3242812fdee7 | ishandutta2007/codeforces | chemthan/normal/852/I.cpp | #include <bits/stdc++.h>
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
... | ALGO | 0.999808 | 4.09412 |
d056ff91-4bd9-4c39-990b-1d9f94ef3eb5 | RidhikaJoshi/A2Z_DSA_Sheet | Arrays/Max_Consecutive_Ones.cpp | /*
Given a binary array nums, return the maximum number of consecutive 1's in the array.
*/
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums)
{
int count=0,max=-1;
for(int i=0;i<nums.size();i++)
{
if(nums[i]... | ALGO | 0.999862 | 5.774329 |
9e5543e6-54d7-4f0a-8dbe-cde533111b44 | hoshinon57/Algorithm | AtCoder/ABC101-200/ABC131-140/ABC136-E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
const ll INF64 = 1LL << 60;
const int INF32 = 0x3FFFFFFF; // =(2^30)-1 10^9より大きく、かつ2倍しても負にならない数
#define YesNo(T) cout << ((T) ? "Yes" : "No") << endl; // T:bool
// ABC136 https://... | ALGO | 0.999967 | 4.607994 |
c39fdfe7-cba7-4065-8a2e-93646e658999 | EricElevencione/Flutter_Project | cis228_unit_3_todo/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.996972 | 6.76775 |
b6cfb1ca-2538-4442-8f35-b8fb1acf63ea | AyushAgnihotri2025/CP-Solutions | GeeksforGeeks/C++/Medium/Pairs violating BST property/pairs-violating-bst-property.cpp | //{ Driver Code Starts
//Author- Sajal Agrawal
//<EMAIL>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
int indx,ans;
struct Node{
int data;
Node *left,*right;
Node(int d){
data=d;
left=right=NULL;
}
};
int pairsViolatingBST(Node *root,i... | ALGO | 0.999689 | 5.308979 |
f8de2f7d-6df7-4d6e-896d-ce68a8e9977e | Ssantosh12/CP-Favourite-Problems | Atcoder/Made Up (Problem C of ABC).cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
//find no of (i,j) such that Ai=Bci;
//we iterate through each element of array c, its each element takes us to any element of array B(diff ele of C can take us to same ele of B)
//we just use map to see how many ele of A are equal to that ele of B, that ... | ALGO | 0.999897 | 3.398427 |
e960e272-2585-4926-8b5e-7a27e9152764 | BCAPATHSHALA/DSA-SUPREME-2-0-NOTES | DSA SUPREME 2.0 CODES/66. CLASS CODE/PROBLEM01.CPP | // 2. Fixed size window
// Problem 01: Sliding Window Maximum (Leetcode-239)
/*
Problem Statement:
You are given an array of integers nums, there is a sliding window of size 'k'which is moving from the very left of the array to the very right. You can only see the 'k' numbers in the window. Each time the sliding wind... | ALGO | 0.999954 | 6.465588 |
564badb0-1eb8-4b57-b9b2-1472af51d64f | rohitpatilpr/Code-with-abhi | DSA/prime.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
for(int i=2; i<n; i++){
if(n%i==0){
cout<<"not prime";
exit(1);
}
}
cout<<"prime";
}
| ALGO | 0.999762 | 3.729512 |
8ca320c4-e412-44f6-9def-9aa6d8452951 | Zaberahmed/mixed-programming | CPP and C/Contest/Toph-3.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
int sum = 0;
cin >> n;
for (int i = 0; i <= n; i++)
{
for (int j = n - i; j > 0; j--)
{
cout << " ";
}
for (int k = i; k > 0; k--)
{
cout << k << " ";
if (i ... | ALGO | 0.999716 | 3.122027 |
1e6e32b8-3060-4732-bb5d-e32cec5c70f1 | mdshakib007/XPSC-4 | Week-13(SZ)/Day-6/B_Vaccination.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n, k, d, w;
cin >> n >> k >> d >> w;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int ans = 0, valid, remaining = k;
for (int i = 0; i < n; i++)
{
if (i == 0 || valid < a[i] || remaining == 0)
... | ALGO | 0.999818 | 3.807081 |
77fbcc69-83ed-4c8c-8094-b0d0ae80f8ef | the-belal/UVa | UVa/11504 - Dominos.cpp | #include<bits/stdc++.h>
using namespace std;
struct sl{
int x,y;
};
bool cmp(sl i,sl j)
{
return i.x<j.x;
}
int main ()
{
sl a[100005];
int i,j,n,m,k,cnt,tc,temp,ans,maxi;
scanf("%d",&tc);
while (tc--)
{
scanf("%d%d",&n,&m);
for (i=0;i<m;i++)
{
scanf("%d%... | ALGO | 0.999943 | 3.90623 |
225e1540-7ee5-44dd-abef-878dd7e36ba4 | batchenRothenberg/AllRepair | src/cegis/symex/candidate_factory.cpp | /*******************************************************************\
Module:
Author: Daniel Kroening, <EMAIL>
\*******************************************************************/
#include <algorithm>
#include <util/bv_arithmetic.h>
#include <goto-programs/goto_trace.h>
#include <cegis/options/literals.h>
#incl... | ALGO | 0.910037 | 7.464181 |
14ac0456-0056-4911-af4a-57bb5bf87bbe | dirtyfilthy/llvm-project-14.0.6 | llvm/lib/Analysis/ScalarEvolutionNormalization.cpp | #include "llvm/Analysis/ScalarEvolutionNormalization.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
using namespace llvm;
/// TransformKind - Different types of transformations that
/// TransformForPostIncUse can do.
enum TransformKind {
/// Normalize - Normalize accordi... | TOOL | 0.952736 | 6.143797 |
42445326-4546-4d88-b853-fb6446c2a131 | zhanzhanfu/Games101 | Include/eigen3/unsupported/doc/examples/MatrixSquareRoot.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(2,2);
A << cos(pi/3), -sin(pi/3),
sin(pi/3), cos(pi/3);
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix square root of A is:... | ALGO | 0.9996 | 3.930508 |
c4519ea1-cfb8-4cc9-81a0-836993835116 | yhnnd/wordlab | WordLab/Prerequisites/readfile/Find/all_read_file_find.cpp | #include "find.cpp"
#include "findStrict.cpp"
#include "findinfolder.cpp"
#include "findreverse.cpp"
| TOOL | 0.925942 | 3.182913 |
cf580e9f-9012-475e-b5fa-189eaba8e1d5 | karvind08/Object-oriented-design-and-programming | Unit 5/STL/vector1.cpp | #include <vector>
#include <iostream>
using namespace std;
int main()
{
vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8, 9};
vector<int>::iterator i;
cout << v[1] << endl;
for (i = v.begin(); i < v.end(); i++)
{
cout << *i << " ";
}
for (i = v.begin(); i < v.end(); i++)
{
if (*i ... | ALGO | 0.988811 | 4.028026 |
54ea1d81-980f-4701-9e1a-dfd0ddbc09e1 | Negrini085/FSA | idealBosons/canBoxRec/canBoxRec.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <TRandom3.h>
using namespace std;
// ATTENZIONE: il file param.dat contiene i parametri da fornire per la simulazione
// 1° riga --> beta minimo
// 2° riga --> beta massimo
// ... | ALGO | 0.962459 | 4.721771 |
7c123ec3-b4b5-4e72-adf7-4cf3e1fd8701 | chaoshxxu/AlgoSolution | UESTC/1704.cpp | #include<stdio.h>
#include<math.h>
#include<algorithm>
#define PI 3.14159265358979323846
#define eps 1e-8
using namespace std;
//ά
struct pt {
double x, y;
void read(){scanf("%lf %lf", &x, &y);}
};
// ()
double cpr(const pt &a,const pt &b,const pt &c){return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);}
double dpr(cons... | ALGO | 0.999663 | 3.490119 |
5aae9aae-59f3-4010-aa0a-7bee0bebe027 | charite/Q | src/Q_EvaluateSignalsPvalue.cpp | #include "Q_EvaluateSignalsPvalue.h"
#include "Q_ReadInFiles.h"
int get_saturation_score(Chromosome &chromosome, int radius)
{
for(int i=0;i<chromosome.sum_num;i++)
{
chromosome.SUMMITS[i].saturation_score = (chromosome.SUMMITS[i].q_beg_chip+chromosome.SUMMITS[i].q_end_chip)-(chromosome.SUMMITS[i].q_beg_ctrl+chrom... | ALGO | 0.998211 | 4.218334 |
ac45807c-3f7e-490a-b456-d193a599a9eb | Yosskavo/cpp-abo-hadhoud | C4/ex12.cpp | #include <iostream>
using namespace std;
void print_max(int one, int sec)
{
if (one > sec)
cout << one << endl;
else
cout << sec << endl;
}
int main()
{
int number_o;
int number_s;
cout << "inter a first mamber : ";
cin >> number_o;
cout << "inter a second number : ";
cin >> number_s;
print_max(numbe... | ALGO | 0.986986 | 3.67451 |
4c232266-7271-406e-a4b3-9d116836e406 | aheschl1/Kattis-Solutions | sacredtexts.cpp | #include<iostream>
#include<vector>
#include<map>
#include<unordered_map>
#include<string>
#include<algorithm>
#include<set>
#include<cmath>
typedef long long int ll;
typedef unsigned long long ull;
using namespace std;
char string_to_alph(string s, int offset){
int score = 0;
for(char c : s){
score ... | ALGO | 0.999768 | 3.797011 |
28d72830-7454-4c30-a401-8347439d8072 | thanakitth/ENGCE117 | Lab13/Lab13.1.cpp | #include <stdio.h>
int *KnapsackDP( int *w, int *v, int n, int wx ) ;
int main() {
int n = 5 , wx = 11 ;
int w[ 5 ] = { 1, 2, 5, 6, 7 } ;
int v[ 5 ] = { 1, 6, 18, 22, 28 } ;
int *x ;
x = KnapsackDP( w, v, n, wx ) ;
for( int i = 0 ; i < n ; i++ ) printf( "%d ", x[ i ] ) ;
return 0 ;
}//end function
int *Knapsa... | ALGO | 0.99993 | 3.646754 |
0eb11ab2-5cb7-4114-a64b-d33cf8fe7c5f | kismeter/vlc | modules/access/dshow/crossbar.cpp | /*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#ifndef _MSC_VER
/* Work-around a bug in w32api-2.5 */
# define QAC... | TOOL | 0.947032 | 5.231729 |
f92d9818-7e27-4cbb-8715-4054b4799d13 | Miguel-Reda/OOP-Assignment2- | Task1/Miguel 20220352/3.cpp | // File: 3.cpp
// Purpose: The program take a string and separate all the elements and delete spaces and store it in a vector.
// Author: Miguel Reda
// Section: S9 Wednesday 2nd slot
// ID:20220352
// TA: Samar Sabry Shaker
// Date: 28 Oct 2023
#include <bits/stdc++.h>
using namespace std;
// The split function takes... | ALGO | 0.999427 | 5.871212 |
feaf3dee-9e67-4b09-b762-d26b5c077ead | AnujCodeZ/DSA | DP/NStairsDP.cpp | // N_StairsDP
#include <iostream>
using namespace std;
int NStairs(int n,int k,int *a){
if(n==0){
a[n] = 1;
return 1;
}
if(n<0){
return 0;
}
if(a[n] != -1){
return a[n];
}
int sum = 0;
for(int i=1;i<=k;i++){
sum += NStairs(n-i,k,a);
}
a[n] = sum;
return sum;
}
int BottomUp(int n,int k){
int... | ALGO | 0.999965 | 3.453362 |
7736c9f0-9c63-45b5-b287-bdd4648bfba7 | RomanLeshchuk/ChessBot | src/GameState.cpp | #include "GameState.h"
#include "Move.h"
GameState::GameState()
{
for (std::uint8_t pos = 0; pos < BoardData::cellsCount; pos++)
{
if ((m_board.get(pos) & Bit::type) == Bit::king)
{
if (m_board.get(pos) & Bit::white)
{
m_whiteKingPos = pos;
}
... | ALGO | 0.974454 | 5.141131 |
02db75dd-87da-4c80-b263-d2c04e57e164 | BilalAhmad50/PDF_reader | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
b0e59389-57e1-482a-8ce2-2b099e722823 | ZanabrE/cppcode | stadiumSeating.cpp | //This program will calculate beisball tickets sold.
//This program will use the fixed point notation
//and the header to use is #include <iomanip>.
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
//Variables to hold the data.
const double classA = 15.00,
classB = 12.00... | ALGO | 0.973225 | 5.36075 |
c0c2d60a-9d4a-4786-bf94-0c6c0f393d1c | KolotVadym/Programing-Essentials-in-C- | First labs in cpp/Lab 2.3+css/Lab 2.3.6/file.cpp | #include <iostream>
using namespace std;
int main()
{
int i, j, rows;
cin>>rows;
if(rows<3||rows>8)
cout<<"You entered wrond number\n";
else
{
for(i=1; i<=rows; i++)
{
for(j=i; j<rows; j++)
{
cout<<" ";
}
for(j=1; j<=(2*i-1); j++)
... | ALGO | 0.999698 | 3.498486 |
907aa9cb-ad02-4a70-a5c7-f1f20a8f6d17 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_12856_5.cpp | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int maxN = 31000;
const long long inf = 1000000000000000000LL;
int n, q;
int w[maxN], h[maxN];
int a[maxN], b[maxN], p[maxN];
int pos[maxN];
int id[maxN];
bool comp(int x, int y) { return w[x] < w[y]; }
bool comp2(int x, int... | ALGO | 0.999767 | 3.323709 |
c8b6c6f8-eb20-4484-b40e-abb17e4d6ce2 | ShalabhDevliyal/Leetcode | 0011. Container With Most Water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int l=0,h=height.size()-1;
int mn,area=0;
while(l<h)
{
mn=min(height[l],height[h]);
area=max(area,mn*(h-l));
if(mn==height[l])
l++;
else
h--;
... | ALGO | 0.999945 | 6.582952 |
231a89d1-1065-41d2-b49c-546d2f7f290f | Vergiochek/Algorithms-and-data-structures | 5.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
vector <vector <pair <int, int>>> graph;
vector <pair <int, int>> item;
long long answer[100001];
bool checkedVertex[100001];
struct Vertex {
int thisNumba;
long long thisWeigth;
bool operator<(const Vertex& anth) const {
... | ALGO | 0.999921 | 4.203686 |
f74271b1-4a69-4907-b126-abf242512a19 | jollyjinx/idl4k | boost_1_53_0/libs/msm/doc/HTML/examples/SimpleWithFunctors3.cpp | #include <vector>
#include <iostream>
// back-end
#include <boost/msm/back/state_machine.hpp>
//front-end
#include <boost/msm/front/state_machine_def.hpp>
// functors
#include <boost/msm/front/functor_row.hpp>
#include <boost/msm/front/euml/common.hpp>
// for And_ operator
#include <boost/msm/front/euml/operator.hpp>
/... | TOOL | 0.852198 | 6.583641 |
b8631eb1-d314-4ccf-bda4-f38d22201d89 | DeCalvin2006/Codeforces | Contests/1077/d/d_2.cpp | /*
* Author : AFGXF
* Date : 2022-06-30 14:00:02
* */
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2E5 + 10;
struct num {
int i, cnt;
} s[MAXN];
int n, k;
int maxs = 0, cnt = 0;
bool cmp(const num &a, const num &b) {
return a.cnt == b.cnt ? a.i < b.i : a.cnt > b.cnt;
}
bool ok(int f) {
int c... | ALGO | 0.999999 | 3.761668 |
f3487396-f381-4f23-bcb2-824bb6331583 | iqtree/iqtree3 | simulator/alisimulatorheterogeneityinvar.cpp | //
// alisimulatorheterogeneityinvar.cpp
// model
//
// Created by Nhan Ly-Trong on 23/03/2021.
//
#include "alisimulatorheterogeneityinvar.h"
AliSimulatorHeterogeneityInvar::AliSimulatorHeterogeneityInvar(Params *params, double invar_prop) :
AliSimulatorHeterogeneity(params) {
invariant_proportion = invar_pro... | ALGO | 0.996717 | 4.454989 |
6ba07f23-db01-4d98-aa25-0d4a7c0e21cd | adong001/C-DS-CPP | Boost库/boost_1_58_0/libs/spirit/classic/example/fundamental/stuff_vector.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// This sample demontrates a parser for a comma separated list of numbers
// This is the phoenix version of number_list.cpp.
// This is discussed in the "Phoenix" chapter in the Spirit User's Guide.
//
// [ JDG 1/12/2004 ]
//
///////... | TOOL | 0.978521 | 7.116484 |
086a406f-7110-4b70-b331-00725275cee1 | ManduTheCat/Algorithm_training | Code_plus/foundaional_algorithm/math/GCD_LCM/GCD_LCM.cpp | #include <iostream>
using namespace std;
int f_gcd(int a, int b)
{
int max;
if(a < b)
max = b;
else
max = a;
while(max != 0)
{
if((int)((int)(a % max) == 0) && ((int)(b % max) == 0))
return max;
max--;
}
return 0;
}
int ff_gcd(int a, int b)
{
while(b != 0)
{
int temp;
temp = b;
b = a % b;
... | ALGO | 0.999964 | 5.143318 |
a661d59c-0c91-42d3-93af-d0a620f192d5 | Nolin7777/Rebirth | dep/alglib-3.8.2/src/diffequations.cpp | #include "stdafx.h"
#include "diffequations.h"
// disable some irrelevant warnings
#if (AE_COMPILER==AE_MSVC)
#pragma warning(disable:4100)
#pragma warning(disable:4127)
#pragma warning(disable:4702)
#pragma warning(disable:4996)
#endif
using namespace std;
////////////////////////////////////////////////////////////... | ALGO | 0.999727 | 7.338173 |
d9c3fd1b-1931-4f27-8a94-efc9896b12ae | Ivanhoe160676/reservar_canchas | 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 |
8286ba6e-9f79-4d87-ab8b-d672b64a59cf | gleonell/cpp_yandex_course_1 | week1/min_of_string.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string one, two, free3;
cin >> one >> two >> free3;
if (one <= two && one <= free3)
cout << one;
else if (two <= one && two <= free3)
cout << two;
else
cout << free3;
return 0;
} | ALGO | 0.99878 | 3.455056 |
21cb0f87-ee56-456f-8b7c-d1fec757e89b | medav/perf-tools | pin-3.17/source/tools/Smc/sse.cpp | #include <iostream>
#include <iomanip>
using std::cout;
using std::endl;
#define N 1024
int main(int argc, char** argv);
#if defined( __GNUC__)
#include <stdint.h>
typedef uint8_t UINT8; //LINUX HOSTS
typedef uint16_t UINT16;
typedef uint32_t UINT32;
typedef uint64_t UINT64;
typedef int8_t INT8;
typedef int16_t I... | TOOL | 0.892978 | 3.539395 |
1eb8fc32-9dc3-4503-9c69-14911034efbf | arnab9997/DSA-Problems-Personal | Codeforces/Div 3/CF 667 (Div 3)/A. Yet Another Two Integers Problem.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
//#define REP(i, a, n) for(int i=a; i<n; ++i)
#define REP(i, st, en) for(__typeof(en) i=(st)-(st>en); i!=(en)-(st>en); i+=1-2*(st>en))
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
typedef ... | ALGO | 0.999227 | 4.579462 |
748e2623-3001-427f-9e3a-eb5edf878225 | llvm-pic/llvm-pic | libc/src/math/generic/fminimum_mag_numf128.cpp | #include "src/math/fminimum_mag_numf128.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float128, fminimum_mag_numf128, (float128 x, float128 y)) {
return fputil::fminimum_mag_num(x, y)... | ALGO | 0.989239 | 6.034577 |
bdeb65b9-5879-4472-8913-ddfaf4708e2b | mfooo/Core | dep/src/g3dlite/GImage_bayer.cpp | /**
@file GImage_bayer.cpp
@author Morgan McGuire, http://graphics.cs.williams.edu
@created 2002-05-27
@edited 2006-05-10
*/
#include "G3D/platform.h"
#include "G3D/GImage.h"
namespace G3D {
void GImage::BAYER_G8B8_R8G8_to_Quarter_R8G8B8(int width, int height, const uint8* in, uint8* out) {
debugAssert(... | ALGO | 0.935614 | 6.128072 |
7b2e622f-fddd-4919-b12c-5b5df4edfe8a | Sallmahussien/LeetCode | 1894-Find-the-Student-that-Will-Replace-the-Chalk.cpp | class Solution {
public:
string mergeAlternately(string word1, string word2) {
int i = 0, j = 0;
string res {};
for (; i < word1.size() && j < word2.size(); i++, j++) {
res += word1[i];
res += word2[j];
}
while (i < word1.size()) res += word1[i++];
... | ALGO | 0.999968 | 6.128329 |
39a6de5a-9ac6-4e4c-ba26-10a903d996d0 | Macaulay2/M2 | M2/Macaulay2/e/skewpoly.cpp | #include "skewpoly.hpp"
#include "gbring.hpp"
#include "skew.hpp"
SkewPolynomialRing::~SkewPolynomialRing() {}
bool SkewPolynomialRing::initialize_skew(M2_arrayint skewvars)
{
is_skew_ = true;
skew_ = SkewMultiplication(nvars_, skewvars->len, skewvars->array);
return true;
}
SkewPolynomialRing *SkewPolynomialRi... | ALGO | 0.919285 | 5.326157 |
bd6feed9-56bd-410f-8e1e-b3bb6bd64611 | Rohitrky2021/JavaSourceCode | =C--P/Coding-blocks-CP-master/Coprime_Numbers/Coprime_Numbers.cpp | /*
Two integers a and b are said to be coprime if the only positive
integer that divides both of them is 1 i.e their greatest common
divisor or GCD is 1.
Example: 5 and 7, as gcd(5, 7) = 1
9 and 11, as gcd(9, 11) = 1
*/
#include<bits/stdc++.h>
using namespace std;
int isCoprime(int a, int b)
{
if(__gcd(a, b) == ... | ALGO | 0.999913 | 4.187599 |
e4c8c7dd-b828-4009-af0f-b06ddac0e909 | coleworld223/CP | DP/AtcoderDP/LCS.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int sz = 1e5;
void solve () {
string a, b;
cin >> a >> b;
ll n = a.size(), m = b.size();
vector <vector <ll>> dp (n + 1, vector <ll> (m + 1));
for (ll i = 1; i <= n; i += 1) {
for (ll j = 1; j <= m; j += 1) {
... | ALGO | 0.999996 | 5.283167 |
86a28f45-ba69-4d68-8b6f-60487a673fd8 | zoulu995/LeetCode | 88.合并两个有序数组.cpp | /*
* @lc app=leetcode.cn id=88 lang=cpp
*
* [88] 合并两个有序数组
*/
// @lc code=start
class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int i = m - 1, j = n - 1;
int k = m + n - 1;
while (i >= 0 && j >= 0) {
if (nums1[i] >= nums2[j]) nums1[... | ALGO | 0.99996 | 5.946469 |
f6020391-fa0d-4542-aef1-0576681a2c73 | m4oughi/100DaysofCode | pureCPP/0039. Day 39/STL Algorithms/058. Numeric Algorithms - exclusive_scan, inclusive_scan/001. Basic Inclusive Scan/main.cpp | #include <iostream>
#include <vector>
#include <numeric>
int main() {
std::vector<int> numbers = {1, 2, 3, 4, 5};
std::vector<int> inclusive_result(numbers.size());
std::inclusive_scan(numbers.begin(), numbers.end(), inclusive_result.begin());
std::cout << "Inclusive Scan (Cumulative Sum): ";
for... | ALGO | 0.999846 | 7.054272 |
3b0e8b16-bb38-4873-9955-6dc23295a765 | SeMin4/AlgorithmStudy | C++/C++ Basic 3/B_11944.cpp | //
// Created by SeMin on 2020-03-05.
//
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main(){
string n, m;
cin >> n >> m;
if(stoi(n) < stoi(m)){
for(int i = 0; i< stoi(n); ++i){
cout << n;
}
cout << '\n';
}
else{
for(i... | ALGO | 0.999839 | 3.593564 |
dc07fa92-47d1-4459-991f-7bf1236f12a2 | suraj101998/LeetCodeSolutions | 2500-2599/2564.Substring XOR Queries/Solution.cpp | class Solution {
public:
vector<vector<int>> substringXorQueries(string s, vector<vector<int>>& queries) {
unordered_map<int, vector<int>> d;
int n = s.size();
for (int i = 0; i < n; ++i) {
int x = 0;
for (int j = 0; j < 32 && i + j < n; ++j) {
x = x <... | ALGO | 0.999861 | 6.046253 |
90a54644-ad45-462a-8df9-1203d2e13ecb | leverimmy/Advanced-Computer-Programming-Homework | OJ3/eigen/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp | #include <iostream>
#include <Eigen/Dense>
int main() {
Eigen::Matrix2f A;
A << 1, 2, 2, 3;
std::cout << "Here is the matrix A:\n" << A << std::endl;
Eigen::SelfAdjointEigenSolver<Eigen::Matrix2f> eigensolver(A);
if (eigensolver.info() != Eigen::Success) abort();
std::cout << "The eigenvalues of A are:\n" ... | ALGO | 0.999652 | 4.087702 |
027d485d-4512-4943-b038-cffda2ca89cd | leontalukdar/Codeforces | con 339B/main.cpp | #include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;
int main()
{
int n,Countf=0,Count,one,flag=1;
string s;
string s2;
cin>>n;
for(int i=0;i<n;i++)
{
Count=one=0;
cin>>s;
Count = count(s.begin(),s.end(),'... | ALGO | 0.999961 | 3.904246 |
24cfe62a-d5ca-454f-8612-343ee2ec0735 | Joyal-Patel14/CPP | String Algo/rabin-karp_Algo.cpp | #include <bits/stdc++.h>
using namespace std;
// Calculate the indices of the occurrences of string s in t.
int p = 31;
const int N = 1e5 + 7, m = 1e9 + 7;
vector<long long> powers(N);
int main()
{
string s = "na";
string t = "apnaacollegena";
int T = t.size(), S = s.size();
powers[0] = 1;
for ... | ALGO | 0.999939 | 5.468647 |
dbc06ee6-3b06-4916-b149-2114f5d7494a | mikolasan/cpp-by-example | serialization/save-number.cpp | #include <iostream>
#include <stdint.h>
#define MIN(a, b) ((a < b) ? a : b)
void print_number(int64_t n) {
for (int i = 0; i < 8; ++i) {
std::cout << static_cast<int>((n >> (i * 8)) & 0xFF) << " ";
}
std::cout << std::endl;
}
int main(int argc, char const *argv[])
{
int little = 1; // little ... | ALGO | 0.993422 | 3.969661 |
f0cbb36a-2744-4beb-9e1a-31a5d3171cb2 | ishandutta2007/codeforces | heno239/normal/1462/B.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target ("sse4")
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#inc... | ALGO | 0.999796 | 4.635405 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.