uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
16a5bad3-39f9-4731-b0f5-fb2c994cd4cb | msk005/leetcode | 2131-longest-palindrome-by-concatenating-two-letter-words/2131-longest-palindrome-by-concatenating-two-letter-words.cpp | class Solution {
public:
int longestPalindrome(vector<string>& words) {
int ans=0;
unordered_map<string,int>um;
for(auto x:words)
{
string s=x;
reverse(s.begin(),s.end());
if(um[s]>0)
{
... | ALGO | 0.999986 | 5.84616 |
ce217841-7c45-45bb-be42-135a9f1eeb0c | pprajap/boost | libs/compute/example/matrix_transpose.cpp | #include <iostream>
#include <cstdlib>
#include <boost/program_options.hpp>
#include <boost/compute/core.hpp>
#include <boost/compute/algorithm/copy.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/type_traits/type_name.hpp>
#include <boost/compute/utility/source.hpp>
namespace compute = bo... | ALGO | 0.991139 | 4.911959 |
7a650251-af91-4c2a-9b3b-d3bde13b3b1e | DDor-H/leetcode_cpp | code/数据结构/leetcode_0169.cpp | // 分治法
class Solution {
public:
int majorityElement(vector<int>& nums) {
return majority_element_rec(nums, 0, nums.size() - 1);
}
int majority_element_rec(vector<int>& nums, int lo, int hi)
{
if (lo == hi)
return nums[lo];
int mid = ((lo + hi) >> 1);
int lef... | ALGO | 0.999988 | 5.339441 |
b2b9006b-692d-404e-ae7c-465ce0ede1f5 | SaiMohithAmbekar/Cpp_Concepts | advancedpatterns/zigzagpattern.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the number: ";
cin>>n;
for(int i=1; i<=3; i++){
for(int j=1; j<=n; j++){
if(((i+j)%4==0) || ((i==2) && j%4==0)){
cout<<"* ";
}
else{
cout<<" ";
... | ALGO | 0.999836 | 3.169765 |
630d8dd5-d32c-40c7-a31c-6a9090e2f26e | hulikau/vkunicpp | 13/solve.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
set <int> tmp;
tmp.clear();
vector <int> a;
a.clear();
int n = 0;
int m = 0;
cin >> n >> m;
map <int, int> ans;
for (int i = 0; i < n; i++) {
int x = 0;
cin >> x;
a.push_back(x);
}
for (int i = a.size() - 1; i >= 0; i--) {
tmp.insert(a[i]);... | ALGO | 0.999944 | 4.526599 |
3fd01932-f732-44cb-be3f-a9299aead2c6 | Shahriar-Seam/Programming | Codeforces/Gym and Others/527993_M.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int sx, sy, tx, ty, k;
int distx, disty, add = 0;
cin >> sx >> sy >> tx >> ty >> k;
distx = abs(sx - tx);
disty = abs(sy - ty);
if (disty < (distx / k)) {
add += (distx / k) - disty;
}
if (distx < (disty / k)) {
... | ALGO | 0.999897 | 4.739563 |
d4cbb51a-0d30-45c1-8651-afde6ed99777 | qkgoalkeeper/RAMBO_BRS | src/insertBloomfilter.cpp | #include <iomanip>
#include <fstream>
#include <iostream>
#include <chrono>
#include <vector>
#include <math.h>
#include <sstream>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include "smhasher/src/MyBloom.h"
using namespace std;
// the code is mostly file reading
int main(){
st... | DATA | 0.902628 | 3.86491 |
7a8d7691-8b72-42cc-8734-7b81e6599ae4 | ithsarasak/Programming | Compettitive programming/codeforces/dreamoon_like_coloring.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, col[N], ans[N];
int main()
{
scanf("%d %d",&n,&m);
for( int i = 1 ; i <= m ; i++ ) scanf("%d",&col[i]);
for( int i = 1 ; i <= m ; i++ ) {
int x = n - col[i] + 1;
if( x < i ) return !printf("-1\n");
else... | ALGO | 0.999971 | 3.441053 |
0e9c4e07-e502-4143-a7fb-ace0b97b4a1e | corb20/Games202Homework | hw2/prt/ext/eigen/doc/examples/Tutorial_simple_example_fixed_size.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix3f m3;
m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9;
Matrix4f m4 = Matrix4f::Identity();
Vector4i v4(1, 2, 3, 4);
std::cout << "m3\n" << m3 << "\nm4:\n"
<< m4 << "\nv4:\n" << v4 << std::endl;
}
| ALGO | 0.985154 | 3.129515 |
1d018a1a-e317-4545-9977-01eaf1b15b84 | watashi/AlgoSolution | leetcode/weekly-320/2476.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.999976 | 5.748857 |
38d348e4-289e-4552-9b4b-306e72d82149 | chirpyli/data-structure | list/zlist.cpp | // 自组织链表(前移法)实现
#include<iostream>
using namespace std;
// 节点类
template<class T>
class Node {
public:
Node() {
next = 0;
}
Node(T e, Node* p = 0) :data(e), next(p) {}
T data; //节点信息
Node<T>* next; //下一节点地址
};
// 单向链表类
template<class T>
class ZList {
public:
ZList();
virtual ~ZList();
bool ... | ALGO | 0.999569 | 4.611253 |
cd2258fc-0a3c-4f40-a503-679b577cecc6 | sajib-mridha-nor/charity-management | 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 |
ad56cb91-c1a1-420d-8bce-f2c4e675f2ce | ytrsk/ICPC_training_respository | OJ/codeforces/ec94/D.cpp | #pragma GCC optimize(3)
#include <bits/stdc++.h>
#define mp make_pair
#define sqr(x) (x)*(x)
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int maxn=3007;
const ll inf=0x3f3f3f3f;
int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
... | ALGO | 0.999752 | 3.542224 |
4f43b6cb-48ec-4043-982e-d4e1e8f9133b | Thisayang/Codeforces | 624A_Save_Luke.cpp | #include <bits\stdc++.h>
#define LL long long
using namespace std;
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
double d, L, v1, v2;
cin >> d >> L >> v1 >> v2;
cout << setprecision(8) << (L - d) / (v1 + v2);
return 0;
}
| ALGO | 0.99941 | 3.692855 |
e68ec096-6992-4aff-8f91-8a321d7e51ee | toFindMore/algorithm-pratice | 0x00「基本算法」例题/0 POJ1958 Strange Towers of Hanoi.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <queue>
#include <cstring>
#include <set>
#include <bitset>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <stdio.h>
using namespace std;
typedef long long LL;
typedef long d... | ALGO | 0.999679 | 3.509632 |
cf16dbe5-9f97-4335-af62-aebc2a731d01 | frayedPen/sokoban | cpp/main.cpp | #include <iostream>
using namespace std;
const char LAYOUT[9][8] = {
{' ',' ','#','#','#','#','#',' '},
{'#','#','#',' ',' ',' ','#',' '},
{'#','+',' ','O',' ',' ','#',' '},
{'#','#','#',' ','O','+','#',' '},
{'#','+','#','#','O',' ','#',' '},
{'#',' ','#',' ','+',' ','#','#'},
{'#','O',' ','0','O','O','+','#'... | ALGO | 0.973121 | 4.997313 |
60328689-63f2-46e1-9c12-0183ab313cf9 | BHOJANE-VARUN/MyVscode | cp/Contests/contest50/first.cpp | #include<bits/stdc++.h>
typedef long long int ll;
#define Y "YES"
#define N "NO"
#define MOD 1000000007
//const int maxsize = 1e5;
//ll arr[maxsize+1];
#define test int monu;cin>>monu;while(monu--)
using namespace std;
// void inputarrll(ll *arr,ll n)
// { ll temp;
// for(ll i =0;i<n;i++)
// {
// cin>... | ALGO | 0.999955 | 3.801239 |
87738f41-438c-4ccb-b89d-f4aeece961a7 | Lokeswara18/designandanalysis | 33. insert number in a list.cpp | #include <stdio.h>
int main() {
int arr1[100], i, n, p, inval;
printf("Input the size of the array: ");
scanf("%d", &n);
printf("Input %d elements in the array:\n", n);
for (i = 0; i < n; i++) {
printf("element - %d : ", i);
scanf("%d", &arr1[i]);
}
printf("Input the value to... | ALGO | 0.999894 | 4.242549 |
1754179e-e84f-4483-845d-407b4a19454d | jieunko/GuidedBilateral | FirstOpenCV/FirstOpenCV/guidedbilateral.cpp | #include "guidedBilateral.h"
void addSaltandPepper(Mat& tgt, double ratio)
{
Mat noiseImg = tgt.clone();
noiseImg.setTo(Scalar::all(0));
randn(noiseImg, Scalar::all(0.0), Scalar::all(35.0));
addWeighted(tgt, 1.0, noiseImg, 1.0, 0.0, tgt);
}
Mat guidedBilateralFilter(Mat& GuideI, Mat& Src, Mat& Prev, int kernel... | ALGO | 0.999275 | 5.368422 |
63e2939a-64f7-418d-9ded-d0ee7af34a64 | jturner65/RTQL8KinectLibrary | src/apps/knowledge/controller/predicate.cpp | #include "predicate.h"
#include "common/app_cppcommon.h"
#include "rapidxml_helper.h"
#define MININUM_TRANSITION_TIME 0.1
namespace controller {
////////////////////////////////////////////////////////////
// class Predicate implementation
Predicate::Predicate() {
}
Predicate::~Predicate() {
... | TOOL | 0.979824 | 5.587238 |
fde0ef83-606e-4ec6-937a-99ebfa1a2fae | sanketbodakhe68/Airesume-anylsar- | venv/Lib/site-packages/sklearn/svm/src/liblinear/tron.cpp | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "tron.h"
#ifndef min
template <class T> static inline T min(T x,T y) { return (x<y)?x:y; }
#endif
#ifndef max
template <class T> static inline T max(T x,T y) { return (x>y)?x:y; }
#endif
static void default_print(const char *buf)
{... | ALGO | 0.999563 | 5.847107 |
01a0757a-6a36-467c-81e7-a898a96d8569 | HVz11/CodeforcesHVz | 1818B.cpp | #include <bits/stdc++.h>
#define ll long long
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
void solve(){
int n; cin>>n;
vector<int> ans(n);
if(n == 1){
cout<<"1\n"; return;
}
if(n%2 == 1){
cout<<"-1\n";
return;
}
for(int i = 0; i < n; i += 2){
ans[i]... | ALGO | 0.999859 | 4.580653 |
9a7167f9-6e6f-4dc7-97cf-877e956f353c | swimmingkiim/pdf_canvas | example/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.998771 | 6.797273 |
3017bc47-e00e-42bd-ba13-370b2cb79f52 | SuyashJoshi179/ProgramsForProblems | codechef/June Lunchtime 2022 Div 1/A.cpp | #include <bits/stdc++.h>
#include <random>
#include <fstream>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<double, double> pd;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll... | ALGO | 0.999976 | 4.692026 |
c9ba9601-44ad-4696-b127-20a185ff3e8d | mizan92782/LEETCODE-PROBLEM-SOLUTION | 1667-find-kth-bit-in-nth-binary-string/find-kth-bit-in-nth-binary-string.cpp | class Solution {
public:
char findKthBit(int n, int k) {
// Base case: for S1, return '0'
if (n == 1) return '0';
// Calculate the length of Sn
int len = 1 << n; // Equivalent to 2^n
// If k is in the first half of the string, recurse with n-1
if (k < len / 2) {
... | ALGO | 0.999996 | 7.114473 |
cf21e52c-097d-4290-931a-999f9683c238 | BurningTiles/HackerRank | C++/10_AttributeParser1.cpp | /**
* Author : BurningTiles
* Created : 2020-09-05 17:51:28
* Link : GitHub.com/BurningTiles
* Program : Attribute Parser
**/
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, q;
cin >> n >> q;
vector<string> stk;
map<string, map<string, string> > ref;
while (n--) {
string init;
cin ... | ALGO | 0.966429 | 3.927753 |
e0f4be08-6ad9-4bff-9914-dd7f685534b6 | Tasmia22/Codeforce | codeforce/card_con.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll a[1000000];
void card_n()
{
for(ll i=1; i<1000000; i++)
{
a[i]=i*2+(i-1);
a[i] = a[i - 1] + a[i];
}
}
ll index(ll srch)
{
ll first,last,middle,ans;
first = 0;
last = 99999;
middle = (first+last)/2;
whil... | ALGO | 0.999472 | 4.130999 |
05ecbb8c-9dd7-4ffd-9c0b-b150b7169ad1 | professorSergio12/DSA-CODE | PRACTICE QUESTIONS/6.TREE/1.TREE/binaryToDoublyList.cpp | #include <bits/stdc++.h>
using namespace std;
struct node
{
int data;
struct node *left;
struct node *right;
};
struct node *createnode(int data)
{
struct node *n = (struct node *)malloc(sizeof(struct node));
n->data = data;
n->left = NULL;
n->right = NULL;
return n;
}
// TIME COMPLEX... | ALGO | 0.999989 | 5.439717 |
8a6add7b-c232-4942-b789-bc0417286e84 | manuav007/hackerearth | Data Structures/Arrays/1-D/MinimumLength.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
for (int c = 0; c < t; c++) {
int n;
cin >> n;
int a[n],b[n];
for(int i=0; i<n; i++){
cin >> a[i];
}
for(int i=0; i<n; i++){
cin >> b[i];
}
int ... | ALGO | 0.999643 | 3.872905 |
ac8ced62-cde0-4b9e-a17b-8c301c472171 | ark-compiler/monorepo | toolchain/llvm-project/libcxx/test/std/algorithms/alg.nonmodifying/alg.search/search_n.pass.cpp | // <algorithm>
// template<class ForwardIterator, class Size, class T>
// constexpr ForwardIterator // constexpr after C++17
// search_n(ForwardIterator first, ForwardIterator last, Size count,
// const T& value);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
#include "test_iter... | TEST | 0.993728 | 7.379649 |
b46b9af8-c72a-4986-ba25-fcb3c8b5e014 | CDPS/Competitive-Programming | UVA/476 - Points in Figures Rectangles.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<double,double > point;
struct rectangle{
double a,b,c,d;
rectangle(double e,double f,double g,double h){
a= e;b=f;c=g;d=h;
}
};
vector<rectangle> v;
int main(){
char op;
double a,b,c,d,x,y;
while(cin >> op && op!='*'){
... | ALGO | 0.99569 | 3.119371 |
7453db3d-5f42-441e-bdb0-feabe4c4e27e | atChengF/algorithm | AcWing/basic/basic-algorithm/merge_interval.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int, int> PII;
vector<PII> segs;
void merge(vector<PII> &segs){
vector<PII> res;
sort(segs.begin(), segs.end());
int l = -2e9, r = -2e9;
for(int i = 0; i < segs.size(); i ++ ){
PII p = segs[i];
... | ALGO | 0.999848 | 4.77477 |
ea0aaade-94c2-4fcb-ac47-360fbe26d1e7 | refiel-l/caffe-libs | boost/boost_1_56_0/libs/numeric/ublas/doc/samples/vector_binary.cpp | #include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v1 (3), v2 (3);
for (unsigned i = 0; i < (std::min) (v1.size (), v2.size ()); ++ i)
v1 (i) = v2 (i) = i;
std::cout << v1 + v2 << std::endl;
st... | ALGO | 0.972737 | 3.927654 |
a4a1ce8a-dcf6-40af-a4d7-413c3d2403b7 | mrnettek/CPP | CPP1/reverse.cpp | // reverse digits of a number
#include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter a number greater than 0: ";
cin >> n;
if (n <= 0) {
cout << "Illegal." << endl;
exit(1);
}
while (n > 0) {
cout << n % 10;
n = n / 10;
}
cout << endl;
return ... | ALGO | 0.99925 | 4.678467 |
b6eb0266-e9bb-49cb-b79a-d76c24f628d2 | InvalidNamee/OJ-AC-Repository-for-UPC | AC_code/跟随唐克练编程基础系列/3883_选择结构/89_CL_暑期的旅游计划2.cpp | #include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
bool judge(int a[]) {
for (int i = 0; i < 3; ++i) {
if (a[i] >= 90) return true;
}
return false;
}
int main() {
int a[3];
for (int i = 0; i < 3; ++i) scanf("%d", &a[i]);
printf(judge(a) ? ... | ALGO | 0.995965 | 4.335808 |
9e2c0782-8777-4663-a00b-480ab4c6f2ef | Niik4466/Ayudantias-INFO088-20241 | Semana_5/src/Ejercicio3_resueltos.cpp | #include <vector>
#include <random>
using namespace std;
int quickSelect(vector<int> &A, int l, int r, const int k);
int partition(vector<int> &A, int l, int r);
int median_aprox(vector<int> &A, const int l, int r);
void print_vec(vector<int> &A);
void quickSort(vector<int> &A, const int l, const int r);
#define MIN ... | ALGO | 0.999353 | 4.715186 |
44c22256-5bc5-4102-a560-7e04b027cffd | jerry81/codeingame | Practice/Easy/61-80/67BushFire/bush_file_greedy.cpp | /*
Goal
A strip of bushland is on fire. An aerial firefighter is dispatched to the site to put out fire using water drops.
The bushland has an area of 1 x L unit length and each water drop is effective to put out fire in 3 consecutive unit cells.
For example, if a water drop is targeted at cell 4, by splash effect i... | ALGO | 0.998815 | 5.928623 |
85bd1a6a-411e-4cc8-ba7a-aec0cc0148bb | ishandutta2007/codeforces | uuzlovetree/normal/1139/C.cpp | #include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define mp(a,b) make_pair(a,b)
using namespace std;
const ll mod = 1000000007;
#define maxn 100005
int n,k;
int fa[maxn];
ll sz[maxn];
int find(int x)
{
if(fa[x]==x)return x;
else return fa[x]=find(fa[x]);
}
ll fastpow(ll a,ll p)
{
ll ans=1;
whi... | ALGO | 0.999992 | 4.058776 |
f83223be-5650-4c17-b653-761fea5d42d8 | jarodl/Populate | Populate/Populate/libs/Box2D/Collision/Shapes/b2PolygonShape.cpp | #include <Box2D/Collision/Shapes/b2PolygonShape.h>
#include <new>
b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->Allocate(sizeof(b2PolygonShape));
b2PolygonShape* clone = new (mem) b2PolygonShape;
*clone = *this;
return clone;
}
void b2PolygonShape::SetAsBox(float32 hx,... | ALGO | 0.982497 | 7.928057 |
de08579c-920e-48f6-9847-e7dd53aec53e | kevgeo/FOSSEE-Computer-Vision | sci_gateway_new/cpp/opencv_immultiply.cpp | /********************************************************
Function :immultiply
Syntax :C=immultiply(A,B)
Author : Tess Zacharias
********************************************************/
#include <numeric>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv.hpp"
... | TOOL | 0.886412 | 3.854671 |
c577bb7d-e382-488d-87dc-30e90ee5eba6 | barjimal/cg | lib/boost_1_78_0/libs/graph/example/fibonacci_heap.cpp | namespace random_ns = std;
#else
#include <boost/random/mersenne_twister.hpp>
namespace random_ns = boost;
#endif
#include <algorithm>
#include <boost/pending/fibonacci_heap.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/pending/indirect_cmp.hpp>
using namespace boost;
int main()
{
typedef indirect... | TEST | 0.992477 | 5.411488 |
e19f3870-09ca-4191-af0d-74aa2e23e616 | nwjnilsson/PPG-quadtree-reconstruction | visualizer/nanogui/ext/eigen/bench/benchGeometry.cpp | #include <iostream>
#include <iomanip>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
#ifndef REPEAT
#define REPEAT 1000000
#endif
enum func_opt
{
TV,
TMATV,
TMATVMAT,
};
template <class res, class arg1, class arg2, int opt>
stru... | TEST | 0.882618 | 6.062908 |
0fa5f61c-6c94-48dc-a058-845c7215ed87 | TasnimAnas/100DaysOfCodes | Day 6/2.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.999993 | 6.229204 |
89b0f9d0-24ac-4514-b8c9-472742415494 | akintola4/flutter-app-journey | login/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.998499 | 6.785645 |
9d946c89-a8c4-4b77-a6a6-14a33896b683 | zxok365/mandrake | contest/2015-07-31-ZOJ-Monthly-June-2013/B.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
const double eps = 1e-5;
const int N = 2222;
class Point {
public:
double x, y, z;
void read() {
scanf("%lf%lf%lf", &x, &y, &z);
}
};
__inline double sqr(const double &x) {
return x * x;
}
__inline double dist(c... | ALGO | 0.999258 | 4.230596 |
12494b5b-97b5-459d-866c-b0758f992f7f | hoshinon57/Algorithm | AtCoder/ABC301-400/ABC361-370/ABC367-D.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
// const ll INF64 = 1LL << 60;
const ll INF64 = ((1LL<<62)-(1LL<<31)); // 10^18より大きく、かつ2倍しても負にならない数
const int INF32 = 0x3FFFFFFF; // =(2^30)-1 10^9より大きく、かつ2倍しても負にならない数
template<cla... | ALGO | 0.999979 | 4.120446 |
02435d80-73e5-41f0-8ef8-689919e5f12d | yangcx000/panda | libs/INIReader.cpp | // Read an INI file into easy-to-access name/value pairs.
#include <algorithm>
#include <cctype>
#include <cstdlib>
#include "ini.h"
#include "INIReader.h"
using std::string;
INIReader::INIReader(string filename)
{
_error = ini_parse(filename.c_str(), ValueHandler, this);
}
INIReader::~INIReader()
{
// Clean... | TOOL | 0.897462 | 5.950008 |
e74df8b9-f41d-4366-b306-b98fe24100de | sloboy/Marlin2 | Marlin/src/gcode/motion/G2_G3.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(ARC_SUPPORT)
#include "../gcode.h"
#include "../../module/motion.h"
#include "../../module/planner.h"
#include "../../module/temperature.h"
#if ENABLED(DELTA)
#include "../../module/delta.h"
#elif ENABLED(SCARA)
#include "../../module/scara.h"
#endif
#if N_ARC_COR... | TOOL | 0.908675 | 6.707052 |
3e819b16-5af0-4b3d-92ad-f87382cb9cf9 | hina-007528/c-3 | 5q8.CPP | #include<iostream>
using namespace std;
void copyArray(int *src,int *dest,int size){
for(int i=0;i<size;++i){
dest[i]= src[i];
}
}
int main(){
int size;
cout<<"Enter the size of the array:";
cin>>size;
int*sourceArray=new int[size];
int*destinationArray=new int[size];
cout<<"Enter"<<... | TOOL | 0.927719 | 3.382624 |
10f95b1b-f581-45d7-b711-8154bda71d8c | giabaophudinhthcs/CodingProblem | Random.cpp | // For random
#include <bits/stdc++.h>
using namespace std;
const auto seed = chrono::steady_clock::now().time_since_epoch().count();
long long n;
int m;
int main(){
cout << "For int:\n";
mt19937 g1(seed);
for (int i = 1; i <= 10; ++i){
m = g1();
cout << m << "\n";
}
cout << "\nFor long long:\n";
mt19937... | TOOL | 0.893949 | 3.707509 |
4e73df1f-65e7-46be-9c69-72ad33c0edef | umaidansari12/CP_Backup | previous_codes/see_the_sunset.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int CountBuildings(int arr[], int n) {
int count = 0, prevMax = INT_MIN;
for (int i = 0; i < n; i++) {
if (prevMax < arr[i])
count++;
prevMax = max(prevMax, arr[i]);
}
return count;
}
int Rearrange(int n) {
int temp = n;
vector<int> arr... | ALGO | 0.999923 | 5.861798 |
8278f62d-84ad-4dcf-aa42-76fe4803a025 | HKPolyU-UAV/bluerov2 | bluerov2_dobmpc/src/ctrller/pid.cpp | #include "bluerov2_dobmpc/bluerov2_ctrl.h"
#include <cstdlib>
/*
Unusable at this moment: Need to write a cascaded controller.
*/
void BLUEROV2_CTRL::pid_config(ros::NodeHandle& nh)
{
using namespace std;
control_input_pub = nh.advertise<geometry_msgs::Wrench>
("/bluerov2/thruster_manager/... | TOOL | 0.907969 | 4.555286 |
1fb574e0-40a3-4dee-944f-12b6582bad50 | VedantParanjape/gem5 | src/systemc/tests/systemc/misc/user_guide/chpt3.2/counter.cpp | /*****************************************************************************
counter.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/****************************************************************************... | TOOL | 0.920225 | 4.738303 |
a17444bd-17c7-487e-8ef9-2aa0870f9dc9 | swatii2002/100daysOfcode | day55.cpp | class Solution {
public:
int countDigits(int num) {
int temp=num;
int count=0;
while (temp>0)
{
int dig=temp%10;
if (num%dig==0) count++;
temp/=10;
}
return count;
}
};
| ALGO | 0.999863 | 6.003774 |
7137591b-828d-4153-bd93-19044df6b476 | shehab-as/LeetCodeCPP | Medium/406_Queue_Reconstruction_By_Height.cpp | class Solution {
public:
vector<vector<int>> reconstructQueue(vector<vector<int>>& people) {
sort(people.begin(), people.end(), [](vector<int> p1, vector<int> p2) {
return p1[0] > p2[0] || (p1[0] == p2[0] && p1[1] < p2[1]);
});
vector<vector<int>> res;
for(auto person : p... | ALGO | 0.999997 | 6.276588 |
8b93c425-0a40-4054-945a-8dee94aecb61 | prince2520/Data-Structure-and-Algorithm | Binary Search Tree/bst_insert.cpp | #include <iostream>
#include <queue>
using namespace std;
class node {
public:
int data;
node* left;
node* right;
node(int d){
data = d;
left = NULL;
right = NULL;
}
};
node* insertInBST(node* root, int d){
// Base case
if(root == NULL){
return new node(d);
}
// Rec case
if( d <= root->data ){
... | ALGO | 0.999955 | 4.424974 |
c928f30f-dd1e-4d0a-9f4a-572d272c7fa1 | Wentao2017/PSI-Boil | Src/Equation/Floodfill/floodfill_get_region_info.cpp | #include "floodfill.h"
#include "../../Plot/plot.h"
/***************************************************************************//**
* computes the properties of each tmp calc ID region
* - center of mass of each region x,y,z
* - volume of each region
* - average velocity of each region u,v,w
*****************... | ALGO | 0.940563 | 4.667817 |
58b4bb4e-229f-47b9-a9f8-6a5adc05cb1f | bshankar/euler | src/solutions/187.cpp | #include "../lib/euler.hpp"
# define N 100000000
int main(int argc, char *argv[]) {
vector<ul> p = segmented_sieve<ul>(N/2);
ui count = 0;
for (auto i = 0; i < p.size(); ++i)
for (auto j = i; j < p.size(); ++j)
if (p[i]*p[j] < N)
++count;
else
... | ALGO | 0.996082 | 4.082446 |
74a01570-7811-4d97-8700-929ed6308268 | diesuki4/CPP_Understanding_Advanced | 9. C++17의 새로운 기능들/4. 폴드 표현식 (Fold Expression).cpp | #include <iostream>
using namespace std;
/*
* 폴드 표현식 (Fold Expression)
*/
template <int N>
struct Sum1
{
enum { value = N + Sum1<N - 1>::value };
};
template <>
struct Sum1<0>
{
enum { value = 0 };
};
auto Sum2()
{
return 0;
}
template <typename N0, typename... Ns>
auto Sum2(N0 n0, Ns... ns)
{
r... | TOOL | 0.948204 | 4.840594 |
67eb5d27-25f3-4e94-b209-deb4634c8e16 | yyatsuo/atcoder | virtual/abc126/d.cpp | #include <bits/stdc++.h>
#define INF INT_MAX
#define ll long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define repp(i,n) for(ll i=1; i<=n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b... | ALGO | 0.999869 | 3.934742 |
01125c21-bc95-4898-a980-0674df3acdaa | richefeu/mpmxdem | dem/3D_sandstone/mpstest.cpp | #include "PBC3D.hpp"
int main(int argc, char const *argv[]) {
PBC3Dbox box;
box.loadConf(argv[1]);
box.initOutputFiles();
box.updateNeighborList(box.dVerlet);
box.showBanner();
box.computeSampleData();
box.transform(box.Load.f,box.tmax,"conf"); // velocity gradient time step
return 0;
}
| ALGO | 0.92085 | 4.744243 |
b0c41d09-5805-433d-ad70-b888f4ae5225 | ishandutta2007/codeforces | thescrasse/normal/30/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back
#define INF (ll)1e18
#define mod 998244353
#define maxn 110
ll i, i1, j, k, k1, t, n, m, res, flag[10], a, b;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
#if !ONLINE_JUDGE && !E... | ALGO | 0.99998 | 4.447811 |
5b14137b-9f12-400c-9c26-9e141af0d5db | rasinhas/Maratona | codeforces/div2-173/a.cpp | #include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n, x;
string s;
scanf("%d", &n);
for(int i=0;i<n;i++)
{
cin >> s;
if(s[0] == '+') x++;
else if(s[0] == '-') x--;
else if(s[2] == '+') x++;
else if(s[2] == '-') x--... | ALGO | 0.999892 | 3.987619 |
bbee3922-bc20-4c2e-8fe8-f0f3462669be | pratikjade/College | semester 4/Object Oriented Programming/lab1.cpp | #include<iostream>
using namespace std;
void area(int h, int b)
{
float area;
area=(h*b)/2;
cout<<"Area of Triangle ="<<area;
}
void area(int r)
{
float pi=3.141592653,area;
area=pi*(r*r);
cout<<"Area of Circle ="<<area;
}
int main()
{
float r,h,b,choose;
cout<<"Choose 1 for Area of Tri... | ALGO | 0.992349 | 3.18514 |
18047580-7cf9-43ca-93d3-237adcee7704 | squishyjs/daily-python | C++/Tickets.cpp | #include <iostream>
int main() {
int testCases;
std::cin >> testCases;
while (testCases--) {
int n;
std::cin >> n;
//some base cases
if (n == 1 || n == 3) {
std::cout << 1 << std::endl;
continue;
}
int seconds = 1;
... | ALGO | 0.999699 | 4.67249 |
068c7beb-6836-4592-8517-3e18fbfa4da2 | ChuanqiXu9/clangd-for-modules | llvm/lib/CodeGen/MachineStableHash.cpp | #include "llvm/CodeGen/MachineStableHash.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StableHashing.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/ilist_iterator.h"
#include "llvm/Co... | TOOL | 0.855143 | 7.891478 |
aec3b94f-864b-4b39-acb6-72d17fcca9d8 | Bharat2044/365-days-coding-challanges | Day_185/02_taskSchedular.cpp | // Question Link: https://leetcode.com/problems/task-scheduler/
/*
621. Task Scheduler
Given a characters array tasks, representing the tasks a CPU needs to do, where each letter represents a different task. Tasks could be done in any order. Each task is done in one unit of time. For each unit of time, the CPU could ... | ALGO | 0.999926 | 7.121879 |
53bfb592-0fdf-4dda-a106-3354feac2593 | CNU-ComputerEngineeringClassProject/__2020-Senior__ObjectOrientedDesign | week12/실습3.cpp | #include <iostream>
template<typename T>
T min(T x, T y) {
return x < y ? x : y;
}
int main() {
int x = 3;
int y = 2;
double d = 2.1;
double e = 3.3;
std::cout << "min(x,y): " << min(x, y) << ", min(d,e): " << min(d, e) << ", min(d, x): " <<
min<double>(d, x) << std::endl;
return 0;
} | ALGO | 0.998005 | 5.255611 |
f0205543-31ff-4420-b84d-59f90360529b | ishandutta2007/codeforces | njwrz/normal/1566/B.cpp | #pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.en... | ALGO | 0.999816 | 4.474835 |
127168b5-c3d3-4cc1-9007-4321bd74c521 | zouyajing/FLVIS | 3rdPartLib/DBow3/utils/demo_general.cpp | #include <iostream>
#include <vector>
// DBoW3
#include "DBoW3.h"
// OpenCV
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
#ifdef USE_CONTRIB
#include <opencv2/xfeatures2d/nonfree.hpp>
#include <opencv2/xfeatures2d.hpp>
#endif
#include "DescManip.h... | TEST | 0.961722 | 5.414103 |
64297fa7-023d-48ec-9269-027e8c5e01e8 | baixun2307/asd | solution/1300-1399/1352.Product of the Last K Numbers/Solution.cpp | class ProductOfNumbers {
public:
ProductOfNumbers() {
s.push_back(1);
}
void add(int num) {
if (num == 0) {
s.clear();
s.push_back(1);
return;
}
s.push_back(s.back() * num);
}
int getProduct(int k) {
int n = s.size();
... | ALGO | 0.999966 | 6.367495 |
7719944c-0ae5-4e30-b8b4-b552434fc9ed | AzizulBSc/Leetcode | 0015-3sum/0015-3sum.cpp | class Solution {
public:
vector<vector<int>> threeSum(vector<int>& num) {
vector<vector<int> > res;
std::sort(num.begin(), num.end());
for (int i = 0; i < num.size(); i++) {
int target = -num[i];
int front = i + 1;
int back = num.size() - 1;
while (fron... | ALGO | 0.999886 | 5.5941 |
62a99c69-eda1-4975-a21f-acb886c63e74 | Aditya-Nilesh-Deshpande/Data-Structures | linkedlist insertion.cpp | #include<iostream>
using namespace std;
struct node{
int data;
struct node * next; //self referencing structure
};
void Linkedlisttraversal(struct node *ptr){
while(ptr!=NULL){
cout<<ptr->data<<" ";
ptr=ptr->next;
}
}
struct node *InsertAtFirst(struct node* head,int data)
{
struct n... | ALGO | 0.996464 | 3.472955 |
b11da180-afeb-475b-aca7-1c3fe5dfea6f | sarvex/leetcode-haxe | lcof/面试题42. 连续子数组的最大和/Solution.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int ans = INT_MIN;
int f = 0;
for (int& x : nums) {
f = max(f, 0) + x;
ans = max(ans, f);
}
return ans;
}
}; | ALGO | 0.999834 | 6.288599 |
944bca0c-734b-4f70-a04e-a4bc0d241732 | ishandutta2007/codeforces | abeker/normal/986/A.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
const int MAXK = 1e2 + 5;
int N, M, K, S;
vector <int> adj[MAXN];
vector <int> by_type[MAXK];
int dist[MAXN][MAXK];
void load() {
scanf("%d%d%d%d", &N, &M, &K, &S);
for (int i = 1; i <= N; i++) {
int type;
scanf("%d", &type);
by_... | ALGO | 0.99994 | 3.264006 |
86e06729-2df5-4917-a40f-b67f233fe870 | MarcosFelipeBC/competitive-programming | Codeforces/1023C - Bracket Sequence.cpp | //https://codeforces.com/contest/1023/problem/C
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, k;
cin >> n >> k;
string str;
cin >> str;
string ans;
int qtdOpen = 0, qtdClose = 0;
for (int i=0; i<n; i++){
if(str[i] == '('){
if(qtdOpen < k/2) {
qtdOpen++;
ans.push_back('(');
}
... | ALGO | 0.999941 | 4.440905 |
14d7693a-9b6c-4ed0-8608-64ccd45af167 | Rajnikant3862/codingblocks | 25Queues/3Implementation_Queue_using_Array.cpp | //Implementation Queue using Array
#include<iostream>
using namespace std;
class Queue {
int *arr;
int f, r, cs, ms;
public:
//constructor
Queue(int ds = 5) {
arr = new int[ds];
cs = 0;
ms = ds;
f = 0;
r = ms - 1;
}
bool full() {
return cs=... | ALGO | 0.975258 | 4.37778 |
72ffabcf-e10e-43b8-a3eb-da08f76460e7 | Tejas-00/LeetHub-leetcode-track | 0704-binary-search/0704-binary-search.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int left = 0;
int right = nums.size() - 1;
while (left <= right) {
int mid = (right + left) / 2;
if (nums[mid] == target) return mid;
if (nums[mid] > target) right = mid - 1;
... | ALGO | 0.999907 | 6.41781 |
a48efee7-e90b-4026-a9b9-1be42a3f5bb0 | HotswapProjects/openjdk-jdk10 | src/hotspot/share/opto/divnode.cpp | #include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
#include "opto/addnode.hpp"
#include "opto/connode.hpp"
#include "opto/convertnode.hpp"
#include "opto/divnode.hpp"
#include "opto/machnode.hpp"
#include "opto/movenode.hpp"
#include "opto/matcher.hpp"
#include "opto/mulnode.hpp"
#include "opto/phaseX.h... | ALGO | 0.99693 | 5.320421 |
f7543db8-11ea-44be-ba5b-c36c389ce59c | NaveedMalik91/Leet_Code | 0328-odd-even-linked-list/0328-odd-even-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* oddEvenList... | ALGO | 0.99993 | 6.109333 |
169506db-aad0-4665-8eef-4a99c9665a6b | Shamem-Mia/C-programmes-lavel_2-term_1-data-structure-and-algorithm- | Lab3_example3.cpp | #include<iostream>
#include<stdlib.h>
#include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node *next;
Node *bak ;
Node(int x)
{
data = x;
next = nullptr;
bak = nullptr;
}
Node(int x,Node *f , Node *b)
{
data = x;
next = f ;
bak = b ;
}
};
//Creat link
No... | ALGO | 0.999876 | 4.329341 |
206dd720-57cf-49c2-a878-39bffb78c809 | lauragrandoo/exercicios_beecrowd | 1037.cpp | #include <iostream>
using namespace std;
int main() {
float valor;
cin >> valor;
if (valor>=0 && valor<=25) {
cout << "Intervalo [0,25]" << endl;
}
if (valor>25 && valor<=50) {
cout << "Intervalo (25,50]" << endl;
}
if (valor>50 && valor<=75) {
cout << "Inter... | ALGO | 0.996999 | 4.136356 |
16e2450e-3a15-4cb0-a011-283bb0d49001 | Atharva03010/striver_dsa | array/set_matrix_zero.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
class Solution {
public:
void setZeroes(vector<vector<int>>& matrix) {
int col0=-1;
for (int i=0;i<matrix.size();i++){
for(int j=0;j<matrix[0].size();j++){
if(i==0 &&... | ALGO | 0.999513 | 5.491245 |
243d8a54-573c-4432-98fb-fa24f463bae9 | lokeshiitp/CPP-DATA-STRUCTURE-AND-ALGORITHMS | 23 Graphs and DP/37_friends_pairing.cpp | // friends pairing problem
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> dp(n+1, 0);
dp[0]=1;
dp[1]=1;
for(int i=1; i<=n; i++){
dp[i]=dp[i-1]+(i-1)*dp[i-2];
}
cout<<dp[n];
return 0;
} | ALGO | 0.999915 | 4.052709 |
73002b17-adf5-48d9-b658-99bf8d49d9ab | wasimscctech/my-laptop- | 9al.cpp | // Write a C++ program to create a new string with the last char added at the front and back of a given string of length 1 or more
#include <iostream>
using namespace std;
string st(string str){
int n = str.length();
return str[n-1] + str +str[n-1];
}
int main(){
cout<<st("Wasim")<<endl;
... | ALGO | 0.998773 | 4.5226 |
5387383e-2342-4bfa-a940-a187dd70af6b | vell001/ORB_SLAM3_Android | app/src/main/cpp/eigen-3.4.0/bench/sparse_lu.cpp |
// g++ -I.. sparse_lu.cpp -O3 -g0 -I /usr/include/superlu/ -lsuperlu -lgfortran -DSIZE=1000 -DDENSITY=.05 && ./a.out
#define EIGEN_SUPERLU_SUPPORT
#define EIGEN_UMFPACK_SUPPORT
#include <Eigen/Sparse>
#define NOGMM
#define NOMTL
#ifndef SIZE
#define SIZE 10
#endif
#ifndef DENSITY
#define DENSITY 0.01
#endif
#ifnd... | ALGO | 0.998904 | 4.187482 |
f7ad3f07-0bab-416c-8b6a-74468203093d | pyeon9/Algorithms | Baekjoon/C++/1. Step/2. If/9498/exam_score.cpp | #include <iostream>
using namespace std;
int main(){
int score;
cin >> score;
if (score >= 90){
cout << "A";
}
else if (score >= 80){
cout << "B";
}
else if (score >= 70){
cout << "C";
}
else if (score >= 60){
cout << "D";
}
else{
cou... | ALGO | 0.998887 | 3.947623 |
777344f4-88d3-4293-95a5-d26a466a8293 | TinkerBoard-Android/rockchip-android-system-extras | simpleperf/runtest/function_fork.cpp | #include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
constexpr int LOOP_COUNT = 100000000;
volatile int a[2];
void ParentFunction() {
volatile int* p = a + atoi("0");
for (int i = 0; i < LOOP_COUNT; ++i) {
*p = i;
}
}
void ChildFunction() {
volatile int* p = a + atoi("1");
for (int i = 0; i < ... | TOOL | 0.957959 | 5.198478 |
e5ef6aff-467a-42f0-ac98-d3d12383778b | mdalamrahman4/LeetCode-solutions | 1395-count-number-of-teams/1395-count-number-of-teams.cpp | class Solution {
public:
int numTeams(vector<int>& rating) {
int n=rating.size();
int count=0;
for(int i=1;i<n-1;i++){
int smallonleft=0,largeonright=0,largeonleft=0,smallonright=0;
for(int j=0;j<i;j++){
if(rating[j]<rating[i]){
sma... | ALGO | 0.999983 | 5.742047 |
98e97061-7be3-48ba-acf7-9048111a15b3 | HardeepSingh001/Codeforces-Solutons | Closing the gap.cpp | #include<bits/stdc++.h>
#define ll long long
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
using namespace std;
int main() {
ios;
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int a[n];
int s=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
s+=a[i];
}
if(s%n==... | ALGO | 0.999829 | 3.27051 |
44c2db07-c679-438a-aa9e-bd17402d51ce | danydi95/Algoritmi | Esercizi prefatti/4.greedy-knapsack/greedy-knapsack.cpp | #include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
using namespace std;
int extractMax(int *A,int n)
{
int max=0;
for(int i=0;i<n;i++)
{
if(A[i]>max) max=A[i];
}
for(int i=0;i<n;i++)
{
if(A[i]==max)
{
A[i]=-1;
break;
}
}
return max;
}
int main()
{
ifstream input("input... | ALGO | 0.999715 | 3.792559 |
4d1b6300-cd77-4ada-add4-03a775078e25 | soolrin/CPP-Homework | Homework 08/Task07.cpp | // 7) Реверс числа.
// Дано число n, десятичная запись которого не содержит нулей.
// Получите число, записанное теми же цифрами,
// но в противоположном порядке.При решении этой задачи
// нельзя использовать циклы, строки, списки, массивы,
// разрешается только рекурсия и целочисленная арифметика.
// Функция должна во... | ALGO | 0.99861 | 4.574874 |
89f2b597-e093-4813-a5f7-27ce19dab16e | zaburo-ch/icpc_practice | codeiq_siritori.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <set>
#define INF 10000000
using namespace std;
typedef pair<int,int> P;
typedef pair<char,char> Pc;
vector<Pc> s;
int n = 32;
int as[26],ae[26];... | ALGO | 0.999419 | 3.154036 |
6ae2a4ad-f057-4141-acac-c790c0d96ed5 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_6743_9.cpp | #include<iostream>
using namespace std;
int main()
{
int n,x,t;
cin>>n>>x>>t;
cout<<(n+x-1)/x*t;
return 0;
} | ALGO | 0.99964 | 3.496038 |
c3c61ca4-7404-4fd3-8311-14d2e56a52e9 | edricrolandli/AP-2 | Pertemuan 5/vector.cpp | #include <iostream>
#include <string>
#include <array>
#include <vector>
using namespace std;
int main() {
system("cls");
// deklarasi vektor dengan tipe data string, "nama"
vector<string> nama = {"Alya", "Rizky", "Rifki", "Fatih", "Dhafa"};
// for (string karyawan : nama) {
// cout << karyaw... | ALGO | 0.977603 | 4.156173 |
11952e2a-35b5-4465-8e8e-859ae1ccea11 | sarvex/leetcode-g-forth | solution/2200-2299/2220.Minimum Bit Flips to Convert Number/Solution.cpp | class Solution {
public:
int minBitFlips(int start, int goal) {
int t = start ^ goal;
int ans = 0;
while (t) {
ans += t & 1;
t >>= 1;
}
return ans;
}
}; | ALGO | 0.999988 | 5.852087 |
e1d3dedb-9631-432f-809b-daa832e9dacf | Creep-9527/leetcodSolutions | 420.强密码检验器.cpp | /*
* @lc app=leetcode.cn id=420 lang=cpp
*
* [420] 强密码检验器
*/
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
// @lc code=start
class Solution {
public:
int strongPasswordChecker(string password) {
int n = password.size();
cout << n << endl;
bool lower = fals... | ALGO | 0.991953 | 5.344507 |
45771a6e-7d2d-4ad3-90db-ac8821866156 | neal2018/oj_env | icpc/tokyo_2014/d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
constexpr ld eps = 1e-8;
int main() {
cin.tie(nullptr)->sync_with_stdio(0);
cout << fixed << setprecision(10);
ll d, n, b;
cin >> d >> n >> b;
vector<array<ll, 2>> a(n); // position, height
for (auto& [p, h] : a) ... | ALGO | 0.999611 | 4.165383 |
dae78d3b-577a-4957-a731-64a8d8f5a666 | renegeizu/UGR-FP | Codigos/Sesion 11/Ejercicio 2.cpp | #include <iostream>
#include <cmath>
using namespace std;
//Prec: numero_introducido >= 0
string DigitosSinCalculos(int numero_introducido){
string numero = to_string(numero_introducido), digitos = "";
for(int i = 0; i < numero.length(); i++){
digitos += " " + numero.substr(i, 1);
}
return digitos;
}
//Prec: n... | ALGO | 0.998785 | 4.238092 |
1cd32a54-a592-44c6-aa61-50a9d8adc0f5 | sunputawan/POSNC-Archive | betaProgramming/1157.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,k; cin>>n>>k;
deque<pair<int,int>> dq;
int x; cin>>x;
dq.push_back({x,1});
int cost;
for(int i=2;i<=n;i++){
cin>>x;
while(!dq.empty() && i-dq.front().second>k)
dq.pop_front();
cost = x + dq.front... | ALGO | 0.99998 | 3.71537 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.