uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a36e58c2-b671-491a-bd8b-4d3d57d84458 | wouterkool/dpdp | problems/tsptw/TSPTW/tsptwsolution.cpp | #include "tsptwsolution.h"
//------------------------------------------------------------------------------
TSPTWSolution::TSPTWSolution(TSPTW *tspAux)
{
this->tsp = tspAux;
this->solution = new int[this->tsp->numNodes];
}
//------------------------------------------------------------------------------
TSPTWSol... | ALGO | 0.999547 | 5.05574 |
479509e6-2b18-4297-bb87-d73f31a8326c | alifrommars/object-oriented-programming | Sem_02/EnumExample_ConvertStringToNumber.cpp | #include <iostream>
enum class ErrorCode
{
OK,
InvalidSymbol,
EmptyString,
NullptrGiven
};
struct ConvertResult
{
ErrorCode errorCode;
unsigned result;
};
bool isDigit(char ch)
{
return ch >= '0' && ch <= '9';
}
unsigned short convertCharToDigit(char ch)
{
return ch - '0';
}
Convert... | TOOL | 0.965342 | 6.340567 |
81f378e6-c3af-4f82-a260-3786f5fa6204 | jaquerinte/Var2017 | P1/OpenCV/modules/imgproc/src/phasecorr.cpp | #include "precomp.hpp"
#include <vector>
namespace cv
{
static void magSpectrums( InputArray _src, OutputArray _dst)
{
Mat src = _src.getMat();
int depth = src.depth(), cn = src.channels(), type = src.type();
int rows = src.rows, cols = src.cols;
int j, k;
CV_Assert( type == CV_32FC1 || type == C... | ALGO | 0.993115 | 5.966908 |
5a4d2985-7054-4242-be66-1bf1bf6ab50d | JannaKim/PS | etc/stack/10845_classQ.cpp | #include <stdio.h>
#include <string>
#include <cstring>
#include <iostream>
using namespace std;
class Queue{
private:
public:
int queue[10000+1];
int top;
int bottom;
Queue(){
top=0;
bottom=0;
}
void push(int number)
{
... | ALGO | 0.999357 | 3.961485 |
127167c4-b2b9-43e6-adc3-e025e2ce7829 | sinian666/code_41_12 | cpp_副本13/chapter_backtracking/permutations_i.cpp | /**
* File: permutations_i.cpp
* Created Time: 2023-04-24
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 回溯算法:全排列 I */
void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &selected, vector<vector<int>> &res) {
// 当状态长度等于元素数量时,记录解
if (state.size() == choices.size()... | ALGO | 0.999966 | 5.578971 |
2651d9bf-c5cd-423c-8cbf-ab51f92ba387 | sarvex/leetcode-harbour | lcof2/剑指 Offer II 094. 最少回文分割/Solution.cpp | class Solution {
public:
int minCut(string s) {
int n = s.size();
vector<vector<bool>> dp1(n, vector<bool>(n));
for (int i = n - 1; i >= 0; --i) {
for (int j = i; j < n; ++j) {
dp1[i][j] = s[i] == s[j] && (j - i < 3 || dp1[i + 1][j - 1]);
}
}
... | ALGO | 0.999965 | 6.101069 |
7409a678-f558-45f9-b071-b9d2e73efc6e | LLNL/b-mpi3 | examples/test4.cpp | #include<iostream>
#include<vector>
#include<cstdlib>
#include<mpi.h>
#include <sys/time.h>
#include <ctime>
#include <boost/multi_array.hpp>
double getTime() {
struct timeval tv;
gettimeofday(&tv, NULL);
return double(tv.tv_sec)+double(tv.tv_usec)/1000000.0;
}
void mySum(void *in_, void *out_, int *len, MPI_Da... | ALGO | 0.999722 | 4.290072 |
26a08ab0-3c05-437a-95ee-2c30aab8de18 | MOkASiH/Labs_PSTU_2023 | Sem_1/2/2_18/2_18.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
setlocale(LC_ALL, "RU");
int n, r = 0;
cout << " : ";
cin >> n;
while (n > 0) {
r = 10 * r + n % 10;
n /= 10;
}
cout << r;
return 0;
} | ALGO | 0.999793 | 4.147461 |
e35593ea-84a5-475c-923e-fe66f3d1aeb3 | BabaYaga1221/Competitive-programming | ballsB.cpp | //bismillahi rehmanir-raheem
#include<bits/stdc++.h>
using namespace std;
void solve()
{
int n,c=0;
bool p=true;
cin>>n;
std::vector<int>v(n);
for(int i=0;i<n;i++)
cin>>v[i];
sort(v.begin(),v.end());
for(int i=0;i<n-1;i++)
{
if(v[i]!=v[i+1] && p==true)
c++,p=... | ALGO | 0.999797 | 4.363294 |
cd1e3ffb-4b2b-408f-b8b4-792749483259 | ChandanKhamitkar/DSA-in-C | Stacks/linked_list_implementation.cpp | #include<stdio.h>
#include<stdlib.h>
int item;
struct node{
int data;
struct node *link;
};
int isempty(struct node *top){
return (top == NULL);
}
struct node* createnode(int value){
struct node *newnode = (struct node*)malloc(sizeof(struct node));
if(newnode==NULL){
printf("Memory allocation failed.\n");
... | ALGO | 0.999543 | 4.136329 |
cb5356ef-e0dc-4122-9591-d2040813d1cc | thebird-/ts-stream-server-client | boost_1_61_0/libs/math/example/negative_binomial_example1.cpp | // negative_binomial_example1.cpp
// Example 1 of using negative_binomial distribution.
//[negative_binomial_eg1_1
/*`
Based on [@http://en.wikipedia.org/wiki/Negative_binomial_distribution
a problem by Dr. Diane Evans,
Professor of Mathematics at Rose-Hulman Institute of Technology].
Pat is required to sell candy ... | ALGO | 0.998633 | 7.131633 |
c5d57cdf-9a44-4bbf-84c5-41c2130ea985 | Lan-ce-lot/LeetCode | everyDay/2216.美化数组的最少删除数.cpp | /*
* @lc app=leetcode.cn id=2216 lang=cpp
*
* [2216] 美化数组的最少删除数
*/
// @lc code=start
class Solution {
#define debug(x) std::cout << #x << ": " << (x) << std::endl
public:
int minDeletion(vector<int>& nums) {
int r = 0, n = nums.size();
if (n == 0) return 0;
// 相邻合并
int now = nu... | ALGO | 0.999973 | 6.217576 |
59b67c7c-d7e2-45c6-a952-0da4cb4e0ea3 | uvazke/AtCoder | ABC/ABC252/D.cpp | #include <iostream>
#include <vector>
#include <numeric>
#include <cmath>
#include <algorithm>
#include <climits>
#include <string>
#define myfor(i,N) for(i=0;i<N;i++)
#define myforFL(i,f,l) for(i=f;i<l;i++)
#define ll long long
using namespace std;
int main(void) {
int N, M;
int A[200000], B[200000], C[200000];
in... | ALGO | 0.999955 | 3.669068 |
4b77ded8-38cb-4f2d-a8cc-0f42ebe7d5de | YashPawar10/DSA | dp & graph/994_Rotting_Oranges.cpp | #include <vector>
#include <queue>
using namespace std;
class Solution {
public:
vector<vector<int>>dir={{1,0},{-1,0},{0,1},{0,-1}};
int orangesRotting(vector<vector<int>>& grid) {
int r=grid.size();
int c=grid[0].size();
queue<pair<int,int>>q;
int cnt=0;
for(int i=0;i<r;... | ALGO | 0.999911 | 5.821047 |
87fa6667-df59-4b8a-8b48-6078de81ade9 | vedantchawla07/DSARepo | Neetcode/Stack/test.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int calledFunction(vector<int>& nums) {
sort(nums.begin(), nums.end(), [](int a, int b)
{
return a > b;
});
for (auto it : nums)
cout << it << " ";
cout << endl;
return 0;
}
};
int main() {
int n;
cin >> n;
vector<int> num... | ALGO | 0.99951 | 4.756534 |
30bfbce7-761e-4b47-babe-5938a30cf665 | DSC-IIITKota/coding-platform | GeeksForGeeks/Shortest Source to Destination Path.cpp | #include <bits/stdc++.h>
using namespace std;
int x[4] = {0,1,0,-1};
int y[4] = {1,0,-1,0};
void solve(int src, int end, vector<vector<int>> &a, int n, int m, int &ans, int count, int &flag){
if(a[src][end] == 2){
ans = min(ans, count);
flag=1;
return;
}
if(a[src][end] == 0 || a[sr... | ALGO | 0.9999 | 4.256458 |
703548ee-fd3c-40b9-94c1-7499beb2541b | rahulyadav97185966/StriverSDESheet | LinkedList Part II/PalindromeLL.cpp | /****************************************************************
Following is the class structure of the LinkedListNode class:
template <typename T>
class LinkedListNode
{
public:
T data;
LinkedListNode<T> *next;
LinkedListNode(T data)
{
this->data = da... | ALGO | 0.999907 | 4.7022 |
387d3318-cdca-49c9-ae7b-cc5be2fff20b | PerfectLifeG/Algorithm-Competition | Nowcoder/W34/a.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define no cout<<"No"<<endl
#define yes cout<<"Yes"<<endl
#define endl '\n'
// #define x first
// #define y second
typedef pair<int,int> PII;
const int N=200010;
const int mod=998244353;
const int INF=0x3f3f3f3f3f3f3f3f;... | ALGO | 0.9999 | 4.469501 |
25d53aeb-a747-451e-8cec-acb234f49dcf | TheAndrewthompson/COM326W6 | Vectors/Main.cpp | #pragma once
#include <iostream>
#include <string>
#include <vector>
#include <memory>
#include <random>
#include <iterator>
using namespace std;
float GenerateRandomNumber();
void PopulateVector(vector <int> &v, int size);
void RemoveRepeating(vector<int> &vec1, vector<int> &vec2);
int main(int argc, const char * ... | TOOL | 0.989464 | 5.280099 |
c0d214b3-d9ee-4316-9942-40dc2eb63f31 | tnameera/CSCI135 | class_excercise/labquiz/E9.3.cpp | /*
Author: Syeda Nameera Tahseen
Course: CSCI-135
Instructor: Tong Yi
Assignment: E9.3
Simulate a circuit for controlling a hallway light that has switches at both ends of the hallway. Each switch can be up or down, and the light can be on or off. Toggling either switch turns the lamp on or off. Provide member functio... | TOOL | 0.869429 | 5.062089 |
6a79a763-4505-4124-96d9-7b7b69737d4e | architjindalcs/Leetcode-Solutions | min-cost-to-connect-all-points/min-cost-to-connect-all-points.cpp | class Solution {
public:
int minDist(vector<bool>& inMST,vector<int>& dist){
int minm=INT_MAX,idx=-1;;
for(int i=0;i<inMST.size();i++){
if(!inMST[i]){
if(dist[i]<minm){
minm=dist[i];
idx=i;
}
}
}
... | ALGO | 0.99998 | 5.855728 |
91382be6-0d2a-40e7-8972-db704924f6d5 | Altu-Bitu-5/Altu-Bitu-SongYeLin | 02_스택_큐_덱/1918.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
using namespace std;
int priority(char op)
{ // 우선순위를 값으로 return
switch (op)
{
case '(':
case ')':
return 0;
case '+':
case '-':
return 1;
case '*':
case '/':
return 2;
... | ALGO | 0.999948 | 5.165746 |
50723e70-b056-44b6-8805-bff5569db4fb | Javtor/competitive-programming-problems | Other/FreeRestrictedFlights.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#define pb push_back
#define fst first
#define snd second
#define ALL(cont) cont.begin(), cont.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define fore(i, a, b) for (int i = a, almo5t = b; i < almo... | ALGO | 0.999956 | 3.814066 |
320711bc-49c3-462d-923e-0055273c7df9 | shubham25kr07/Attendance_via_face_Recognition | opencv-master/modules/core/src/stat_c.cpp | #include "precomp.hpp"
CV_IMPL CvScalar cvSum( const CvArr* srcarr )
{
cv::Scalar sum = cv::sum(cv::cvarrToMat(srcarr, false, true, 1));
if( CV_IS_IMAGE(srcarr) )
{
int coi = cvGetImageCOI((IplImage*)srcarr);
if( coi )
{
CV_Assert( 0 < coi && coi <= 4 );
sum ... | TOOL | 0.951684 | 4.080977 |
5eae381d-ee98-4267-be77-ed9e0889ec5b | Derekzcx/Sorts | C++_排序/排序算法(单个版)/Count_Sort.cpp | /*
* ʵ
* ڷDZȽ
*/
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void Count_Sort(vector<int> &vec){
if(vec.size() <= 2) return;
//1 ҵСԪ
//int max = *max_element(vec.begin(), vec.end());
//int min = *min_element(vec.begin(), vec.end());
// or
int max = INT_MIN;
int min = IN... | ALGO | 0.999962 | 4.912218 |
5e018bb9-859a-4432-980d-0604485afd0a | SichenPa221/MVA_Robotic_Optimal_Control | robotics-codes-from-scratch-master/cpp/src/iLQR_manipulator.cpp | #include <GL/glut.h>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <cmath>
#include <eigen3/unsupported/Eigen/KroneckerProduct>
#include <iostream>
#include <vector>
namespace
{
// define the parameters that influence the behaviour of the algorithm
struct Parameters
{
int num_iterations = ... | ALGO | 0.999482 | 6.136781 |
b5c725f1-bc42-499d-adef-11cffc8cd233 | EogoK/uir_2022_liceum | src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Trung Nguyen (Northwestern)
------------------------------------------------------------------------- */
#include "pair_lj_cut_coul_cut_dielectric_omp.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "m... | ALGO | 0.999668 | 6.092618 |
c6fd7ab3-0881-468a-afbb-a1d880d8399d | rph-pl/wavelet-stego | wavelet.cpp | #include "wavelet.hpp"
#include <algorithm>
#include <cmath>
#include <gsl/gsl_wavelet.h>
#include <gsl/gsl_wavelet2d.h>
namespace Stego
{
Wavelet::Wavelet() :
m_size(0)
{
}
Wavelet::Wavelet(const Image& image) :
m_size(image.m_width),
m_red(image.m_red),
m_green(image.m_green),
m_blue(image.m_blue),
... | TOOL | 0.969913 | 5.496087 |
a2786d26-ca75-4dbf-acd1-39cb1605af8e | izp001/gsoc2011sfm | EuclideanReconstruction/main.cpp |
#include "macro.h"
#include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
#include <string>
#include <opencv2/calib3d/calib3d.hpp>
#include <boost/filesystem.hpp> // includes all needed Boost.Filesystem declarations
#include "EuclideanEstimator.h"
#include "MatcherSparseFlow.h"
#include "Camer... | TOOL | 0.933424 | 5.412903 |
77bef746-8f7c-4331-b819-df1a3bfcbfd4 | SarbajitPbappy/CF | 1374E1-ReadingBooksEasyVersion.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
int main(){
long n, k; scanf("%ld %ld", &n, &k);
std::vector<long> a, b, d;
for(long p = 0; p < n; p++){
long t, x, y; scanf("%ld %ld %ld", &t, &x, &y);
if(x && y){d.push_back(t);}
else if(x){a.push_back(t);}
else i... | ALGO | 0.999918 | 3.730985 |
f3e94799-86c8-49b1-8d15-f034d925e7fb | shiridikumar/cp | 1500/866a.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int test;
cin>>test;
for(int tes=0;tes<test;tes++){
int a,b,c;
cin>>a>>b>>c;
if(a+b>=10 || b+c>=10 ||c+a>=10){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
... | ALGO | 0.999716 | 4.128373 |
9f19a31e-67d1-4cd8-9fbd-4efebff6e98a | vinikruger12/cpp | cses/rangequeries/oddqueries.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int t; cin >> t;
while(t--){
int n, q; cin >> n >> q;
vector<int> vec(n+1), pref(n+1);
for(int i = 1;i <= n;i++) cin >> vec[i];
pref[0] = 0;
for(int i = 1;i <= n;i++){
pref[i] = ... | ALGO | 0.999924 | 3.954939 |
81404205-5db7-4bbd-b210-487d4412eabd | SPRINGPEACHVINH/IT001 | VS14_Gifts.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
long long n, a;
cin >> n >> a;
int arr[n+1];
for (int i = 1; i <= n; i++)
{
cin >> arr[i];
}
sort(arr+1,arr+n+1);
for (int i = n; i >= 1; i--)
{
if(arr[i] > a) continue;
else if(arr[i]+... | ALGO | 0.999991 | 3.159442 |
b7b303a8-ceb1-41e4-8e2b-13340ee6e2b0 | sipho-mancam/common_module | Dependencies/libs/msm/doc/PDF/examples/Orthogonal-deferred2.cpp | #include <iostream>
// back-end
#include <boost/msm/back/state_machine.hpp>
//front-end
#include <boost/msm/front/state_machine_def.hpp>
#include <boost/msm/front/functor_row.hpp>
namespace msm = boost::msm;
namespace mpl = boost::mpl;
using namespace boost::msm::front;
namespace
{
// events
struct play {};
... | TOOL | 0.902726 | 7.328291 |
0d402205-67cf-4a0c-b826-54ee513c0197 | zkr1990/RoutingLookup | RHF_64/router_mega/Builder/PerfectRouterBuilder1.cpp | //---------------------------------------------------------------------------
#include <stdio.h>
#include <iostream>
#include <bitset>
#include "PerfectRouterBuilder1.h"
#include "../IntUtils.h"
#include "../City64.h"
//---------------------------------------------------------------------------
struct TSlotInfo
{
uint... | ALGO | 0.999483 | 4.214667 |
c8f50573-a013-412f-bacb-6399d1cfcdd0 | larissahchiu/Amazon-Final-Project | util.cpp | #include <iostream>
#include <sstream>
#include <cctype>
#include <algorithm>
#include "util.h"
using namespace std;
std::string convToLower(std::string src)
{
std::transform(src.begin(), src.end(), src.begin(), ::tolower);
return src;
}
/** Complete the code to convert a string containing a rawWord
to a ... | TOOL | 0.969974 | 5.15279 |
95cd8041-4646-4c59-9c8e-5b83a0eda85d | rampageoppa/An-approch-for-Stable-Neo-Hookean-Flesh-Simulation | extern/libigl/python/py_igl/py_map_vertices_to_circle.cpp | m.def("map_vertices_to_circle", []
(
const Eigen::MatrixXd& V,
const Eigen::MatrixXi& bnd,
Eigen::MatrixXd& UV
)
{
assert_is_VectorX("bnd",bnd);
return igl::map_vertices_to_circle(V,bnd,UV);
}, __doc_igl_map_vertices_to_circle,
py::arg("V"), py::arg("bnd"), py::arg("UV"));
| ALGO | 0.966495 | 6.207091 |
f97dda67-74de-4ae8-9a87-68f88ae1ea0b | Dhananjay10313/GitDemo | edu141.cpp | // (ASCII) a=97 A=65
#include <bits/stdc++.h>
using namespace std;
#define test int T;cin>>T;while(T--)
#define int long long
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)((x).size())
#define fr first
#define... | ALGO | 0.999998 | 3.381269 |
c33ef123-335d-4e61-9dba-80067ea8aeed | Itashi19/DSA-Practice | Arrays/countpairs-gfg.cpp | /*
Count pairs with given sum
Easy Accuracy: 41.59% Submissions: 97788 Points: 2
Given an array of N integers, and an integer K, find the number of pairs of elements in the array whose sum is equal to K.
Example 1:
Input:
N = 4, K = 6
arr[] = {1, 5, 7, 1}
Output: 2
Explanation:
arr[0] + arr[1] = 1 + 5 = 6
and arr[... | ALGO | 0.999868 | 6.122547 |
7c6477e0-79d7-4440-90b5-fe23ee5df5be | zhipingx/LA2ASB | L2/src/graph.cpp | // by: Zhiping
#include <graph.h>
namespace L2 {
void Graph::add_edge(std::string var1, std::string var2) {
neighbours[index[var1]].insert(index[var2]);
neighbours[index[var2]].insert(index[var1]);
}
void Graph::add_edge(int i1, int i2) {
neighbours[i1].insert(i2);
neighbours[i2].insert(i1);
... | ALGO | 0.965182 | 4.899987 |
3cfc4d50-0adc-428f-9d6c-0c41d397dc69 | RapDoodle/LeetCode-Solutions | cpp/0100-0199/138. Copy List with Random Pointer/solution2.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* next;
Node* random;
Node(int _val) {
val = _val;
next = NULL;
random = NULL;
}
};
*/
class Solution {
public:
/* O(1) space complexity */
Node* copyRandomList(Node* head) {
if (!head)
... | ALGO | 0.99974 | 5.579193 |
58a60548-baa4-416b-96c3-21512372b65f | eGuardianDev/LeetCode | 150InterviewQuestions/151/test.cpp |
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
**************************************... | ALGO | 0.996885 | 5.486074 |
7400e8d5-a8dc-45ff-a595-d61285ecba06 | manishya1669/MyLeetcodeJourney | 645-set-mismatch/645-set-mismatch.cpp | class Solution {
public:
vector<int> findErrorNums(vector<int>& nums) {
int duplicate =0;
int missing =0;
map<int,int>m;
vector<int>v(2);
for(int i=1;i<=nums.size();i++){
m[i]++;
}
for(auto x:nums){
m[x]++;
}
fo... | ALGO | 0.999687 | 5.460773 |
e5974ec5-b409-4143-8cb7-5af23969083f | alogeclock/Problem-Solving | BOJ/Platinum/[14003] 가장 긴 증가하는 부분 수열 5.cpp |
// idea: lis, dp, binary search
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll, ll>
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3fLL
#define PINF 1000000007
ll arr[1000100], dp[1000100], vst[1000100];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie... | ALGO | 0.999997 | 3.750107 |
dc9c105c-a9f1-49bd-b478-f15cff6b18fc | Bhavya-Goyal-Git/DSA-practice | 144_TopologicalSort.cpp | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
// NOTE: TOPOLOGICAL sorting exists only for Directed Acyclic Graphs (DiaGraphs)
// Problem link : https://www.naukri.com/code360/problems/topological-sort_982938?topList=love-babbar-dsa-sheet-problems&leftPanelTab=0&utm_source=youtube&utm_me... | ALGO | 0.999997 | 6.006352 |
7cc45f0d-2da8-4e49-9391-4683f4fc2ca6 | nafi103/CP-Templates | String/permutationExpo.cpp | vector<int> applyPermutation(vector<int> sequence, vector<int> permutation) {
vector<int> newSequence(sequence.size());
for(int i = 0; i < sequence.size(); i++) {
newSequence[i] = sequence[permutation[i]];
}
return newSequence;
}
vector<int> permute(vector<int> sequence, vector<int> permutation... | ALGO | 0.999977 | 5.519814 |
bb65a296-1399-446b-a936-d5fb9509543b | AdityaRaut21/LP5_Codes | HPC/2_parallel_bubble_sort_linux.cpp | #include<iostream>
#include<omp.h>
#include<vector>
using namespace std;
void BubbleSort(vector<int>& arr){
int n= arr.size();
for(int i=0;i<n;i++){
for(int j=0 ; j<n-i-1 ;j++){
if(arr[j]>arr[j+1]){
swap(arr[j],arr[j+1]);
}
}
}
}
void pBubbleSort(vector<int>& arr){
int n=arr.size();
for(int i=0;i<... | ALGO | 0.999863 | 4.398502 |
ce95ae1c-0228-4670-a868-a003e26e62f7 | priojeetpriyom/competitive-programming | uva/10812 - Beat the Spread!.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main ()
{
int maxx,minn,abs,sum,t;
scanf("%d",&t);
while (t--) {
scanf("%d %d",&sum,&abs);
if (sum>=abs) {
maxx = (sum+abs)/2;
minn = sum-maxx;
printf("%d %d\n",maxx,minn);
}
else printf("i... | ALGO | 0.999351 | 3.564006 |
73d9b2bc-667c-49f6-a6c0-8f12c1a0108b | SH7072/DSA-cpp | 1_Arrays/2Darrays/matrixTranspose.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
int arr[n][m];
//input
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cin >> arr[i][j];
}
}
//transpose
for (int i = 0; i < n; i++)
{
for (... | ALGO | 0.99978 | 3.006519 |
18987885-75da-4670-b702-8bb3f7897f64 | Apurba94/10-Years-of_Competitive-Programming-Resources-Collection | Codeforces From 2011-2023/0200-0299/271A-BeautifulYear.cpp | #include <cstdio>
bool isBeautiful(int year){
int a = year %10;
int b = (year / 10)%10; if(b == a){return 0;}
int c = (year / 100) % 10; if(c == a || c == b){return 0;}
int d = (year / 1000) % 10; if(d == a || d == b || d == c){return 0;}
return 1;
}
int main(){
int number; scanf("%d\n", &num... | ALGO | 0.995653 | 3.717099 |
a97c2462-144d-4dd7-8a0e-e472c72b5b17 | allem40306/Competitive-Programming | uva/Volume101/uva10137.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=1005;
int main(){
int n;
double a[N],avg,ans1,ans2;
while(cin>>n,n){
avg=0.0;
for(int i=0;i<n;i++){
cin>>a[i];
avg+=a[i];
}
avg=(double)(int)((avg/n)*100+0.5)/100;
ans1=ans2=0;
f... | ALGO | 0.999317 | 3.495117 |
04d0f411-1446-4ded-8dee-f426bc242581 | shivangi-2001/DSA-python-Cplus | C++/7.Character&String/557.cpp | #include<iostream>
#include<string>
#include<sstream>
using namespace std;
string reverseWords(string s) {
istringstream ss(s);
string word, result;
while(ss >> word){
string newword = word;
reverse(newword.begin(), newword.end());
result += newword + " ";
}
result.pop_ba... | ALGO | 0.999923 | 5.02606 |
5d3272db-c0b5-40b9-82b8-ca8c2f7db2cd | Tomuus/Zadanka | kolko_staszic/berlin.cpp | #include <ios>
#include <iostream>
#include <vector>
using namespace std;
int szef[1000007];
int team;
int find(int x)
{
if(szef[x]==0) return x;
szef[x]=find(szef[x]);
return szef[x];
}
void join(int x,int y)
{
int a=find(x);
int b=find(y);
if(a==b) return;
szef[b]=a;
}
int main()
{
... | ALGO | 0.999947 | 3.914826 |
99933d79-06ca-4af1-8c83-ea8419cffe0d | MD-MAFUJUL-HASAN/HackerRank_Interview-Preparation-Kits | 1 Month Preparation Kit/Week 3/Balanced Brackets/Balanced Brackets.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'isBalanced' function below.
*
* The function is expected to return a STRING.
* The function accepts STRING s as parameter.
*/
string isBalanced(string s) {
int size;
while (s.siz... | ALGO | 0.999569 | 6.304529 |
818b1880-fa4e-4f5c-bbc4-f50aaeb60c79 | PeaJune/opencv-4.3.0 | samples/cpp/segment_objects.cpp | #include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/video/background_segm.hpp"
#include <stdio.h>
#include <string>
using namespace std;
using namespace cv;
static void help(char** argv)
{
printf("\n"
"This program demonstrated a simple method... | ALGO | 0.939704 | 5.580627 |
c04f1e43-df4e-464c-aac2-7e6ae4befc2a | Kawser-nerd/CLCDSA | Source Codes/AtCoder/agc003/E/3423034.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
typedef long long lint;
const int N=1e5+2;
int n,m;
lint st[N],cnt[N],add_p[N];
template <class T> inline T nxi(){
T x=0;
char c;
while((c=getchar())>'9'||c<'0');
while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
return x;
}
int main(){
#ifnd... | ALGO | 0.999971 | 3.226154 |
44cec7fa-b337-41fd-9707-e6ad41bfbc45 | Rewasvat/Faculdade | MAC420_ComputacaoGrafica/EP2/BulletLib/src/BulletCollision/Gimpact/btGImpactBvh.cpp | /*! \file gim_box_set.h
\author Francisco Leon Najera
*/
#include "btGImpactBvh.h"
#include "LinearMath/btQuickprof.h"
#ifdef TRI_COLLISION_PROFILING
btClock g_tree_clock;
float g_accum_tree_collision_time = 0;
int g_count_traversing = 0;
void bt_begin_gim02_tree_time()
{
g_tree_clock.reset();
}
void bt_end_gim0... | ALGO | 0.999516 | 7.141726 |
fa1b40f0-8b6a-4eaf-bb3d-e1770dfebc2a | Tamim0133/XCPC | Week - 14/Day - 03 (Fop exam preparation)/pascal_triangle.cpp | // // C program to print Pascal’s Triangle
// // using combinations in O(n^2) time
// // and O(1) extra space function
// #include <stdio.h>
// void printPascal(int n)
// {
// for (int line = 1; line <= n; line++) {
// for (int space = 1; space <= n - line; space++)
// printf(" ");
// // used to represent C(lin... | ALGO | 0.999748 | 5.72592 |
f2a5c0d5-a019-4ce6-b8aa-600eb701312e | Jrana1/leedCode_problem_solutions | merge_string_alternately.cpp | // problem link: https://leetcode.com/problems/merge-strings-alternately
#include <bits/stdc++.h>
using namespace std;
string mergeAlternately(string word1, string word2)
{
string ans = "";
int i = 0, j = 0, k = 0;
int len1 = word1.size();
int len2 = word2.size();
while (i < len1 && j < len2)
... | ALGO | 0.999843 | 5.289711 |
8bc1b501-b2b9-430a-80b8-9f441b864970 | StrawHatWess/Competitive-Programming-Solutions | Codeforces/Rated/Edu 116/B.cpp | //Never stop trying
#include "bits/stdc++.h"
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
typedef long long ll;
#define int ll
typedef string str;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector... | ALGO | 0.999953 | 4.225131 |
93db4f78-0cf5-4607-b30e-3b78f8b81e86 | Stenardt-9002/CODECHEF-Datastructure-and-algo | List-question/BST/E-Linked_list_Balanced_BST.cpp | // https://www.geeksforgeeks.org/sorted-linked-list-to-balanced-bst/?ref=lbp
#include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *left, *right;
Node(int val)
{
data = val ;
left = right = NULL;
}
} ;
class LiNode
{
public:
int data ;
... | ALGO | 0.999995 | 5.456158 |
aa4cc435-62f6-4872-a2d0-617f9e31c98a | ishandutta2007/codeforces | yp155136/normal/1091/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
int y,r,b;
cin >> y >> b >> r;
for (int i=1;i<=1000;++i) {
if (i <= y && i+1 <= b && i+2 <= r) {
;
}
else {
cout << i-1 + (i) + (i+1) << endl;
return 0;
}
}
} | ALGO | 0.999611 | 3.068745 |
a3142f70-df31-4c6a-8874-ae8b4b6517fb | mdshakebakhtar003/C-plus-plus | prevgreatest.cpp | // Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
int arr[6]={0,1,2,3,1,2};
int i,j;
for(i=0;i<=5;i++){
int max=arr[i-1];
for(j=i-1;j>=-1;j--){
if(arr[j]>max){
max=arr[j];
}
} cout<<max;
}
re... | ALGO | 0.999857 | 3.46781 |
2593ea0d-eea9-413e-92d8-1c317ffdd0c3 | wanyuzha/InverseKinematics | eigen/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.999173 | 4.659281 |
863d43cf-a7a4-4477-8fc7-3815c339a088 | shishirRsiam/CSE-Fundamentals-With-Phitron | 5. XPSC - Problem Solving Club/Week 2/Day 1/I_All_Distinct.cpp | #include<bits/stdc++.h>
#define loop(s,i,n) for(int i=s;i<n;i++)
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int t; cin>>t;
while(t--)
{
int n; cin>>n;
unordered_map<int,int>mp;
loop(0,i,n)
{
int a; cin>>a;
m... | ALGO | 0.999686 | 3.934655 |
afc5ccef-d8da-474f-9ece-18cf44434037 | flxcsx/Cf_solved | 1741a.cpp | #include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
for(int i = 0;i<t;i++)
{
string s1;
cin >> s1;
int r1;
int q1 = s1.length();
if (s1[q1-1] == 'S')
r1 = -q1;
else if (s1[q1-1] == 'L')
r1 = q1;
else
... | ALGO | 0.999959 | 3.415128 |
50df1128-e7e5-40a6-8eca-472c12d37edc | david-irvinne/cp_scripts | problem_setting/gura_dan_persamaan_2/a.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define Int __int128_t
#define dbg(x) cout<<"["<< #x <<"] : "<<(x)<<endl;
#define bpc(x) (__builtin_popcountll(x))
int bpow(int a, int b, long long mod=LLONG_MAX){
int res=1;while(b){if(b%2)res=res*a%mod;a=a*a%mod;b/=2;}return res;
}
int inv(int a, i... | ALGO | 0.999781 | 3.676121 |
17f3e4e4-67df-436d-bc00-749a75f3a181 | SahilSC/USACO | 2023/Open/Silver/field_day.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <string>
#include <queue>
#include <algorithm> // added this header for std::min
using namespace std;
int C, Q;
int main(){
cin >> C >> Q;
vector<int> arr(Q);
vector<int> ans(Q);
int totalss = int(pow(2, C));
int ma... | ALGO | 0.99977 | 4.121854 |
d73debb9-90e9-4126-beab-b1d9616bdef3 | peterpaul2512/bai_tap_nmlt | bai_tap/bai_tap_struct/bai_512.cpp | // Bài 512: Qui đồng phân số
#include <iostream>
using namespace std;
struct PhanSo {
int tu;
int mau;
};
PhanSo nhapPhanSo();
void xuatPhanSo(PhanSo ps);
PhanSo quiDongPhanSo(PhanSo ps1, PhanSo ps2);
int main() {
PhanSo ps1 = nhapPhanSo();
xuatPhanSo(ps1);
PhanSo ps2 = nhapPhanSo();
xuatPh... | ALGO | 0.998707 | 4.220632 |
ccb13e5b-70e6-4aeb-8858-6f76d6c43614 | CarlosTinin/corretor_avaliacao | main.cpp | #include <stdio.h>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
vector<vector<Point> > contornos;
vector<Vec4i> hierarchy;
void questoes( char src[], int vetor[] );
int main(){
int tota... | ALGO | 0.927205 | 3.649973 |
29f5a64c-ef60-420d-ac4c-01df0c4cbb31 | hoodieman0/university-projects | Advanced C++ OOP (CSCI-4526)/P2-KorideMok/State-KorideMok.cpp | // Written by James Mok and Neelakanta Bharadwaj Koride
#include "State-KorideMok.hpp"
// ---------------------------------------------------------------------
// State Constructor
// Precondition: None
// Postcondition: State object is created
State::
State(char input) : value(input){
if (input != '-'){
... | TOOL | 0.916519 | 3.864151 |
97c1ed90-ddea-48ee-82fd-48d853820d55 | fithisux/FSL | extras/include/boost/libs/intrusive/example/doc_positional_insertion.cpp | using namespace boost::intrusive;
//A simple class with a set hook
class MyClass : public set_base_hook<>
{
public:
int int_;
MyClass(int i) : int_(i) {}
friend bool operator< (const MyClass &a, const MyClass &b)
{ return a.int_ < b.int_; }
friend bool operator> (const MyClass &a, const MyClas... | TEST | 0.93624 | 6.161618 |
3c4b3e03-b0ac-4c77-90ec-9bfddb1b3ba4 | megait004/28tech-oj | lythuyetsotoanhoc/bai25tochuc.cpp | #include<iostream>
#include<cmath>
using namespace std;
// để kiểm tra số lượng ước của 1 số có phải là số lẻ hay không thì
// ta tạo 1 hàm kiểm tra số chính phương vì số lượng ước của số đó chính là số chính phương
bool chinhphuong(long long n){
long long can = sqrt(n);
if(can * can == n){
return true;
}
else... | ALGO | 0.999951 | 4.545328 |
badcb1bc-8528-43bf-b877-b5ec2fdf7fd6 | BlackFrogKok/test | src/libigl/igl/comb_frame_field.cpp | #ifdef WIN32
#define _USE_MATH_DEFINES
#endif
#include <cmath>
#include "comb_frame_field.h"
#include "local_basis.h"
#include "PI.h"
template <typename DerivedV, typename DerivedF, typename DerivedP>
IGL_INLINE void igl::comb_frame_field(const Eigen::PlainObjectBase<DerivedV> &V,
... | ALGO | 0.988402 | 6.043769 |
b5a24366-d5b3-46f5-80ae-4e8c9f00fbed | terencekam/2042TutorialSolution-non-offical-ByHudie.cos.hk | PastPaper/2223_2_A1_b.cpp | //#include <iostream>
//#include <iomanip>
//
//using namespace std;
//int main() {
//
// int mode;
// double temp;
// int dp;
// double tmp;
//
// cout << "Input: ";
//
// cin >> mode >> temp >> dp ;
// switch (mode) {
// case 0:
// tmp = (temp*9/5)+32;
// cout << temp... | ALGO | 0.992924 | 4.021976 |
63a2be6c-0f4a-4de8-84ba-a209c6795d21 | shashank-iiitdelhi/matrix | app/src/main/cpp/eigen-3.4.0/doc/examples/TutorialLinAlgInverseDeterminant.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
A << 1, 2, 1,
2, 1, 0,
-1, 1, 2;
cout << "Here is the matrix A:\n" << A << endl;
cout << "The determinant of A is " << A.determinant() << endl;
cout << "The inverse of A is:\n... | ALGO | 0.99964 | 4.186114 |
047dbcb0-307b-4f22-9f46-f7592a1a7078 | akash-gupta0/DSA | BitManipulation/19_HCF.CPP | #include <bits/stdc++.h>
using namespace std;
int hcf(int a,int b)
{
if(a==0)
return b;
else
return hcf(b%a,a);
}
int main()
{
int a,b;
cout << "enter value of a and b" << endl;
cin >>a>>b;
int h =hcf(a,b);
cout<<h;
return 0;
} | ALGO | 0.999863 | 4.291632 |
9a2bd6ac-b045-4426-9ad4-016a4b2d5907 | MyckelChamorro/Estructuras_Grupo_5 | Parcial I/Extras/KARLA CAJAS/EXTRA 3/Numeros.cpp |
/* UNIVERSIDAD DE LAS FUERZAS ARMADAS ESPE
DEPARTAMENTO DE CIENCIAS DE LA COMPUTACION
INGENIERA DE SOFTWARE
AUTOR: LIZBETH RECALDE - <EMAIL>
ENUNCIADO:Realizar un programa utilizando template.
FECHA DE CREACION: 31-10-2021
FECHA DE MODIFICACION: 31-10-2021*/
#include "Numero.h"
template <type... | ALGO | 0.983092 | 4.079569 |
1ac2b012-b1a8-4ab7-a2db-262b80099c1b | dusal1111/codetree-TILs | 240920/특정 문자로 시작하는 문자열/strings-that-start-with-a-specific-character.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
string str;
char c[20];
int len[20];
cin >> n;
for (int i=0;i<n;i++){
cin >> str;
c[i]=str[0];
len[i]=str.length();
}
char a;
cin >> a;
int cnt=0, sum=0;
for(int i=0;i<n;i... | ALGO | 0.996713 | 3.463953 |
adbfda09-c7ab-468d-bbd7-220f7c0935bf | lydrainbowcat/tedukuri | 配套光盘/习题/0x29 搜索 总结与练习/The Buses/IOI1994/POJ1167 The Buses.cpp | //Author:XuHt
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 60, INF = 0x3f3f3f3f;
int n, cnt[N], ans = 17;
struct P {
int x, y, z;
bool operator < (const P a) const {
return z > a.z;
}
};
vector<P> b;
int pd(int x, int y) {
for (int i = x; i < N; i += y)
if (!cnt... | ALGO | 0.999683 | 3.406322 |
51036cac-918d-4265-ad93-95656c65f2af | Rishi-11-2/CP | B_tcaF.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace chrono;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define debug(x...) { cout << "(" << #x << ")" << " = ( "; PRINT(x); }
tem... | ALGO | 0.999971 | 4.422503 |
42976968-4fe2-42ef-a589-2e98f1c75546 | vctorChamizo/algorithms-data-structure | Iteratives/eda_prob36_Problema2/eda_prob36.cpp | // Nombre del alumno: Vctor Chamizo Rodrguez
// Usuario del Juez: EDA12
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
void EstricCreciente(std::vector<int> & v) {
int aux = 0;
for (int i = 0; i < v.size(); ++i) {
if (v[i] % 2 == 0) {
v[aux] = v[i];
aux++;
}
}
v.resi... | ALGO | 0.999471 | 4.797812 |
6542fcc2-12dc-4dbc-b432-4c54938b684f | wndgur2/study_algorithm | 김원래/BaekJoon/1749_점수따먹기.cpp | #include <iostream>
#include <vector>
#include <time.h>
#define INF 2147483647
using namespace std;
vector<vector<int>> sums;
int N, M;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
std::cout.tie(0);
cin >> N >> M;
sums.resize(N + 1);
sums[0].resize(M + 1, 0);
for (int i = 1; i < N + 1; i++)
{
su... | ALGO | 0.99998 | 3.256641 |
9a3216c2-9a3f-4779-bd26-dc8b5425022a | DanielAugusto191/Competitive_Programming | Solved/C++/A. A+B?.cpp | // https://codeforces.com/contest/1772/problem/A
#include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define dbg(a) cout << a << " -- DEBUG -- "<< endl;
#define Adbg(a) for(auto e: a){cout << e << ' ';};cout << endl;
#define Mdbg(a) for(auto e: a){cout << ... | ALGO | 0.999299 | 4.253132 |
822736ca-b3a6-4828-abce-1f1c218be919 | gopal-panigrahi/Leetcode | Medium/Maximum Twin Sum Of A Linked List/MaximumTwinSumOfALinkedList.cpp | // https://leetcode.com/problems/maximum-twin-sum-of-a-linked-list
/**
* 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(n... | ALGO | 0.999771 | 6.009609 |
8dd982df-9642-438d-a714-085aafaf35ce | IcEy-999/MyUESource | Engine/Plugins/Experimental/GeometryProcessing/Source/DynamicMesh/Private/NormalFlowRemesher.cpp | #include "NormalFlowRemesher.h"
#include "Async/ParallelFor.h"
#include "InfoTypes.h"
void FNormalFlowRemesher::RemeshWithFaceProjection()
{
if (Mesh->TriangleCount() == 0)
{
return;
}
ModifiedEdgesLastPass = 0;
ResetQueue();
// First we do fast splits to hit edge length target
for (int k = 0; k < MaxFast... | ALGO | 0.997747 | 7.102427 |
f0227dd5-a2f8-4a98-8b5f-883d367c16da | Smit6/LeetCode | MergeTwoBinaryTrees.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.999986 | 6.324249 |
624f1897-040b-4ddd-9554-4b1f37d6b477 | mcbapo/mpsdyn | src/programs/banulsm/dos/chebyDoS_Tn.cpp | /*
* Calculate T_n(\tilde{H}) and save them.
* Output the truncation error of each term, Tr(T_n(H)) and Tr(T_n(H)O) for O
* in opList.
* */
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <random>
#include <sstream>
#include <string>
#include <vector>
#include "Contractor.h"
#include "MPS.h"
... | ALGO | 0.99029 | 5.543863 |
6bde7c12-0589-492e-b7f4-d465304182fc | BaeAshuai/CppCode | homework/16.cpp | #include <iostream>
using namespace std;
class Array
{
private:
int *p;
int n;
public:
Array(int *ptr, int len)
{
p = ptr;
n = len;
}
Array(const Array &a)
{
p = a.p;
n = a.n;
}
Array &operator++()
{
int *_p = p;
for (int i = 0; i... | ALGO | 0.985791 | 4.264687 |
4cfa2963-d65b-4641-bbb2-db5293c87876 | leonardoAnjos16/Competitive-Programming | Codeforces/ternary_xor.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = 5e4 + 5;
int main() {
int t; scanf("%d", &t);
while (t--) {
int n; scanf("%d", &n);
char num[MAX]; scanf("%s", num);
char a[MAX], b[MAX];
a[0] = b[0] = '1';
a[n] = b[n] = '\0';
bool equal = true;
... | ALGO | 0.999923 | 3.745783 |
9fafd5fe-73e8-495f-94c5-aafdc6a9495b | w-jin/leetcode | src/68_text_justification.cpp | #include <iostream>
#include <string>
#include <vector>
class Solution {
public:
std::vector<std::string> fullJustify(const std::vector<std::string> & words, int maxWidth) {
std::vector<std::string> text;
int i = 0;
while (i < words.size()) {
int j = i;
int length = 0;
while (j < words.size() && length... | ALGO | 0.99889 | 5.682588 |
0b5a4366-04c9-41bf-8494-8eb896c00491 | yoon-yk/LeetcodeSubmission | 169-majority-element/169-majority-element.cpp | class Solution {
public:
int majorityElement(vector<int>& nums) {
int majority = 0;
for (unsigned int i = 0, mask = 1; i < 32; i++, mask <<= 1) {
int bits = 0;
for (int num : nums)
if (num & mask)
bits++;
if (bits > nums.size(... | ALGO | 0.999736 | 5.921214 |
9fe478f5-20c9-4aad-a753-06ccfe1d18bf | mehamasum/competitive-programming | graph theory/bfs_uva/uva_10004.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.996367 | 4.827384 |
e4b766da-51a6-4f15-bf48-38a164b06b0d | Mellow-Sky/code | CpEditor_code/240611A.cpp | // Problem: A. Creating Words
// Contest: Codeforces - Codeforces Round 952 (Div. 4)
// URL: https://codeforces.com/contest/1985/problem/0
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
const int N = 1e3;
using namespace std;
using ll = long l... | ALGO | 0.999846 | 5.313082 |
40175d1e-ca54-4587-868e-4319c647b516 | M4573R/competitive-programming-archive | codeforces/beta-round-65/div-2/way_too_long_words.cpp | #include <iostream>
#include <string>
using namespace std;
constexpr unsigned int normal_word_limit {10};
inline
void use_io_optimizations()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main()
{
use_io_optimizations();
unsigned int words_count;
cin >> words_count;
for (unsig... | ALGO | 0.999717 | 5.688107 |
73d3957e-3a50-4580-b324-63e1c675c160 | ishandutta2007/codeforces | xellos/normal/1402/C.cpp | // iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <chrono>
#include <random>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include ... | ALGO | 0.999972 | 3.776297 |
31f87c75-4462-4015-8bf8-dd579e7570f5 | conradsoon/competitive_programming | codeforces/round748/A_Elections.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
using vvi = vector<vi>;
using vvl =... | ALGO | 0.999689 | 4.79704 |
3ef31072-90d6-418e-ac7a-bffbc59b2fab | ObeWan99/SkillBoxCplus | module7/main2.cpp | #include <iostream>
using namespace std;
int main() {
int milk, water;
int americano_cups = 0, latte_cups = 0;
cout << "Введите количество миллилитров молока в кофемашине: ";
cin >> milk;
cout << "Введите количество миллилитров воды в кофемашине: ";
cin >> water;
while (true) {
cout... | TOOL | 0.969031 | 4.761775 |
5875cab0-fe83-4981-bca2-8eabe1d0526d | bptomasi/conways-time-travel | src/rgol.cpp |
#include <chrono>
#include <z3++.h>
#include "matrix.hpp"
/*
* time_it()
*
* Measures the execution time of a provided code block and adjusts
* the remaining timeout accordingly.
*
* @timeout: A reference to an unsigned integer representing the
* remaining timeout in milliseconds. After executing the cod... | ALGO | 0.999444 | 7.141123 |
994479c2-7d78-4a4f-89bc-91b0896f0578 | ishandutta2007/codeforces | leafseek/normal/1501/B.cpp | #include<bits/stdc++.h>
#define rep(a,b,c) for(register int a=(b);a<=(c);++a)
#define dow(a,b,c) for(register int a=(b);a>=(c);--a)
using namespace std;
const int MaxN=1000000+5;
int a[MaxN];
bool usd[MaxN];
int main()
{
register int T;
scanf("%d",&T);
register int n;
while(T--)
{
scanf("%d",&n);
rep(i,1,n)
... | ALGO | 0.999767 | 3.378401 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.