uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f32d6614-3f1b-4718-914c-1b3844e61db8 | ishandutta2007/codeforces | timmyfeng/normal/1300/C.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
vector<vector<int>> freq(30);
for (int i = 0; i < n; i++) {
cin >> a[i];
for (int j = 0; j < 30; j++) {
if (a[i] & (1 << j)) {
freq[... | ALGO | 0.999978 | 3.970213 |
33135a36-26e3-4a65-ae02-dee67aafdeaa | Ankit8607/GeeksForGeeks-must-do-problems | graph/Shortest Source to Destination Path.cpp | // https://practice.geeksforgeeks.org/problems/shortest-source-to-destination-path3544/1
class Solution {
public:
int shortestDistance(int N, int M, vector<vector<int>> A, int X, int Y) {
if(A[0][0]==0) return -1;
vector<vector<int>>vis(N,vector<int>(M,-1));
queue<pair<int,int>>q;
... | ALGO | 0.999959 | 5.664682 |
8fb70d61-6a1c-4152-a3e6-b8dda570df21 | Vedantjn/Striver-s-SDE-Sheet | BST_Find_a_Pair_with_given_Sum_in_BST.cpp | class BSTIterator {
stack<TreeNode *> myStack;
// reverse : true -> before
// reverse : false -> after
bool reverse = true;
public:
BSTIterator(TreeNode *root, bool isReverse) {
reverse = isReverse;
pushAll(root);
}
/** @return whether we have a next smallest number */
... | ALGO | 0.999999 | 5.718801 |
2e7c2445-309c-4429-b112-da34efb68ef8 | Jarus77/SDE-SHEET | printAdjancylist.cpp | from typing import List
class Solution:
def printGraph(self, V : int, edges : List[List[int]]) -> List[List[int]]:
# code here
adjList=[[] for _ in range(V)]
for edge in edges:
u,v = edge
adjList[u].append(v)
adjList[v]... | ALGO | 0.99788 | 6.109232 |
f04264d6-98f4-4a87-91c2-e1f69b1e58e0 | AST-TheCoder/CP-Solutions | CodeForces/GNU C++14/1353E | K-periodic Garland/80648712.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
string s;
cin>>s;
int count=0;
for(int i=0;i<n;i++){
if(s[i]=='1') count++;
}
int ans=count;
for(int i=0;i<k;i++){
int x=0,y=0;
for(int j=i;j<n;j+=k) {
if(s[j]=='1') x++;
e... | ALGO | 0.999958 | 3.848071 |
90d910ca-784f-4e8b-ad9d-2c287a671784 | ishandutta2007/codeforces | igori/normal/1268/C.cpp | #include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <fun... | ALGO | 0.999938 | 3.526309 |
97a3b33d-ed46-4102-9165-b012c7d08ec8 | dangarcar/advent-of-code | 2023/24/24_1.cpp | #include <bits/stdc++.h>
using namespace std;
struct Line {
long double x,y,z, dx, dy, dz;
};
/*
Resolves system of equations to determine position using the point and slope formula
y = y1 + m1(x - x1) & y = y2 + m2(x - x2)
y1 + m1x -m1x1 = y2 + m2x - m2x2
(m1 - m2)x = -y1 + y2 + m1x1 - m2x2
x = (-y1 + y2 + m1x1 ... | ALGO | 0.998874 | 4.032496 |
a317a968-7bad-4962-83b5-9d7cdb5bca0e | ra-hul16/Functions | keypair.cpp | //GFG question solved on 8th july
// Given an array arr of positive integers and another number x. Determine whether two elements exist in arr whose sum is exactly x or not.
// Examples:
// Input: x = 16, arr[] = [1, 4, 45, 6, 10, 8]
// Output: true
// Explanation: arr[3] + arr[4] = 6 + 10 = 16
#include<iostream>
#i... | ALGO | 0.999967 | 5.850659 |
7847b222-6067-405a-b304-8b2ea1c4d127 | muthu165/C-Plus-Plus-programs-and-Data-Structures | spare number.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int x=6;
vector<bool> bin;
while(x!=0){
bin.push_back(x&1);
x>>=1;
}
bin.push_back(0);
int n=bin.size();
cout<<"size: "<<n<<endl;
int l = 0;
for(int i=1;i<n-1;i++){
if(bin[i]==1 && bin[i-1]==1 && bin[i+1]!=1){
bin[i+1]=1;
for(int j=i;j>=l;j... | ALGO | 0.999886 | 4.074711 |
0f906255-6e79-45b5-b4b3-5ae5cb907d4c | sahilwep/DSA-Workspace | Leetcode/Medium/2429_Minimize_XOR.cpp | /*
// 2429. Minimize XOR
// Problem Statement:
-> Given two positive integers num1 and num2, find the positive integer x such that:
-> x has the same number of set bits as num2, and
-> The value x XOR num1 is minimal.
-> Note that XOR is the bitwise XOR operation.
-> Return the integer ... | ALGO | 0.999981 | 6.475379 |
1ef54def-e56a-4ee6-9ea0-bfb81c821a4a | jordanhenderson/webapp | ext/opencv/modules/core/src/convert.cpp | #include "precomp.hpp"
namespace cv
{
/****************************************************************************************\
* split & merge *
\****************************************************************************************/
templa... | TOOL | 0.985933 | 4.728064 |
65442631-814b-4b9d-980c-5c5cfedae84a | WAGO/pfc-firmware-sdk-G2 | ptxproj/local_src/config-tools/network_config/src/network_config/OptionParser.cpp | #include "OptionParser.hpp"
#include <functional>
#include <iostream>
#include <stdexcept>
#include <string>
#include "OptionStrings.hpp"
#include "Utils.hpp"
using std::string;
namespace po = boost::program_options;
namespace network_config {
OptionParser::OptionParser()
: options_ { GetOptions() },
fie... | TOOL | 0.982608 | 7.826493 |
771504f5-8142-4fc3-8f03-893ffc73892c | ShuuuShuuu-3/system_core | fastboot/device/utility.cpp | #include "utility.h"
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <fs_mgr.h>
#include <fs_mgr/roots.h>
#include <fs_mgr_dm_linear.h>
... | TOOL | 0.920626 | 7.685638 |
6def4422-2169-420f-8621-3e378bd8813c | cjin/DijkstraCL | Matrix.cpp |
#include <algorithm>
#include <iostream>
#include "Matrix.h"
namespace gsl {
Matrix::Matrix() : m_(NULL) { }
Matrix::Matrix(Index rows, Index cols) {
m_ = gsl_matrix_alloc(rows, cols);
}
Matrix::Matrix(Index rows, Index cols, Scalar initialValue) {
if (initialValue == 0) {
m_ = gsl_matrix_calloc(rows, cols... | TOOL | 0.870067 | 6.608711 |
e674c9a0-0cd6-46ac-bcf6-52474bf5368c | alexandraback/datacollection | solutions_5765824346324992_1/C++/shubhamjha3003/haircut.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
int arr[2000],b;
long long int bin_search(long long int l,long long r,long long int n)
{
if(l==r)
return l;
if(l>r)
return r;
long long mid=(l+r)/2;
int count=0;
for(int i=1;i<=b;i++)
{
count+=(mid/arr[i]);
}
... | ALGO | 0.999986 | 3.479388 |
1b043f8f-b5b3-47d5-9d47-5f1e6bf12668 | dush1729/cp | submission/spoj/abcdef.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=120;
int n,i,j,k,a[N];
long long ans;
unordered_map <int,int> m;
int main()
{
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&a[i]);
for(i=0;i<n;i++)
for(j=0;j<n;j++)
for(k=0;k<n;k++) m[a[i]*a[j]+a[k]]++;
for(i=0;i<n;i++)
{
... | ALGO | 0.999863 | 3.405197 |
f2440a3b-4bff-4487-ac89-91690ab380a9 | snckkund/Cpp | lec55_stack_ques/sort_stack.cpp | #include <iostream>
#include <stack>
using namespace std;
// @Code360:
void sortedInsert(stack<int> &stack, int num) {
// base case
if(stack.empty() || stack.top() <= num) {
stack.push(num);
return;
}
int top = stack.top();
stack.pop();
// recursion
sortedInsert(stack, nu... | ALGO | 0.999977 | 5.606846 |
e7ca9e94-931f-4977-915a-7df19a43466d | ixray-team/xray-vss-archive | xr_3da/xrGame/ui/Restrictions.cpp | #include "stdafx.h"
#include "Restrictions.h"
#ifdef DEBUG
#include "../../xr_ioconsole.h"
#include "../../xr_ioc_cmd.h"
#endif //#ifdef DEBUG
#include "../string_table.h"
CRestrictions g_mp_restrictions;
shared_str g_ranks[_RANK_COUNT];
u32 get_rank(const shared_str §ion)
{
int res = -1;
if( g_ranks[0].size()... | TOOL | 0.886889 | 5.373365 |
ce0ffe50-bc82-47ad-88e8-60dc10c28156 | rasel3780/DSA_Practice | C++/Recursion/Power_Using_Recursion.cpp | #include<iostream>
using namespace std;
int pow(int m, int n)
{
if(n==0)
return 1;
else
return pow(m,n-1)*m;
}
int main()
{
int m=2;
int n=5;
cout<<pow(m, n);
} | ALGO | 0.999934 | 5.191757 |
4db49949-77f7-4de2-860d-6e7005c6c218 | LokeshKumarkumawat/DSA | Stack/27 n Stacks in an Array.cpp | https://www.codingninjas.com/studio/problems/n-stacks-in-an-array_1164271?topList=love-babbar-dsa-sheet-problems&leftPanelTab=0%3Fsource%3Dyoutube&campaign=Lovebabbarcodestudio11thfeb&utm_source=youtube&utm_medium=affiliate&utm_campaign=Lovebabbarcodestudio11thfeb
class NStack
{
int *arr;
int *top;
int *ne... | ALGO | 0.999535 | 4.981349 |
b8fbfdf6-eebd-4843-a698-9cd339d52f39 | Prashil1630/DSA-and-DEV-Prep | AlgoZenith/DSA/ALL/All Codes/Number_of_Intersecting_Diagonals.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long modInverse(long long a,long long m) {
long long result=1;
long long power=m-2;
while (power>0) {
if (power%2==1) {
result=(result*a)%m;
}
a=(a*a)%m;
power/=2;
}
return res... | ALGO | 0.999949 | 5.117049 |
fc05aa05-f36e-4482-93d9-f37c2425bd96 | r-barnes/richdem | programs/tiled_flat_resolution/main.cpp | #include <richdem/common/version.hpp>
#include <richdem/common/Layoutfile.hpp>
#include <richdem/common/Array2D.hpp>
#include <richdem/common/constants.hpp>
#include <richdem/common/timer.hpp>
#include <richdem/tiled/A2Array2D.hpp>
#include <queue>
#include <unordered_set>
#include <iomanip>
#include <iostream>
#includ... | ALGO | 0.979306 | 5.172841 |
0a5bc0bf-afdd-4a69-82b9-ab07d700768b | VicRos15/Adam_sim | paquetes_simulacion/imu_tools/imu_filter_madgwick/src/stateless_orientation.cpp | #include "imu_filter_madgwick/stateless_orientation.h"
#include <tf2/LinearMath/Matrix3x3.h>
#include <tf2/convert.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
template <typename T>
static inline void crossProduct(T ax, T ay, T az, T bx, T by, T bz, T& rx,
T& ry, T& rz)
{
rx ... | ALGO | 0.999416 | 7.000277 |
6dd59f9c-22a4-4911-a7f5-af4cbd5952ed | 731676158/Octree | 3rdparty/pcl_for_ubuntu/surface/src/ear_clipping.cpp | #include <pcl/surface/ear_clipping.h>
#include <pcl/conversions.h>
#include <pcl/pcl_config.h>
/////////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::EarClipping::initCompute ()
{
points_.reset (new pcl::PointCloud<pcl::PointXYZ>);
if (!MeshProcessing::initCompute ... | ALGO | 0.993573 | 7.392186 |
498ce402-dad0-4ae3-ae18-2d88b03a4b70 | hjiang13/LLMs-in-IR | POJ-104/66/1157.cpp | #include <iostream>
using namespace std;
int Runnian(int year);
int main(){
int year,month,day,total=0,i,k;
cin >> "%d %d %d",&year,&month,&day);
for(i=1; i<month; i++){
if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
total+=31;
}
else if(i==4||i==6||i==9||i==11){
total+=30;
}
else if(i==2){
if(year%400==0||(year%4==0&... | ALGO | 0.999832 | 3.390765 |
19b4be0b-3346-49e4-b194-55c32e47f4c4 | thuang86714/leetCodeCpp3rd | ArrayStr_1828_Queries_on_NUmber_of_Points_Inside_a_Circle.cpp | #include <vector>
using namespace std;
class Solution {
public:
vector<int> countPoints(vector<vector<int>>& points, vector<vector<int>>& queries) {
//TC O(p*q) where p is points.size(), q is queries.size()
vector<int> result;
for(auto q:queries){
int count = 0;
for(... | ALGO | 0.999705 | 5.544975 |
e2c37410-0745-4485-8915-1e9fb5dc02ee | 949769682/snake | snake/snake.cpp | #include "pch.h"
#include <iostream>
#include<conio.h>
#include<windows.h>
#include<time.h>
#define random(x,y) (rand()%28+1)
using namespace std;
const char *graph[30][30];
char ch = 'w';
typedef struct snakes
{
int x;
int y;
struct snakes *next;
}snake;
snake *head, *tail;
void Delete_tail()
{
graph[tail->y][tai... | ALGO | 0.995265 | 3.767673 |
7b1697bc-c4bd-4bfa-bbeb-584912f44b85 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_4665_0.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int d[100005];
cin>>n;
for(int i=0;i<n;i++) cin>>d[i];
sort(d,d+n);
cout<<d[n/2]-d[n/2-1]<<endl;
return 0;
}
| ALGO | 0.999924 | 4.047012 |
c1467dfd-1279-4486-b46f-8f6b3eac1a23 | zzz332choi/DS_class | 2023_Kwangwoon_Univ_CE_DS_Project_1/src/NameBST.cpp | #include "NameBST.h"
NameBST::NameBST() : root(nullptr)
{
}
NameBST::~NameBST()
{
}
NameBSTNode* NameBST::getRoot()
{
return root;
}
// insert
void NameBST::INSERT(MemberQueueNode data)
{
NameBSTNode* node = new NameBSTNode;
node->set_name(data.get_name());
node->set_age(data.get_age());
node->set_date(data.... | TOOL | 0.98913 | 3.704163 |
0d17ba98-0041-454e-979c-7722f48e6a47 | MSC19950601/Templates | DP/数位DP.cpp | LL dfs(int x,int pre,int ye,int limit)
{
if(x < 0) return ye;
int &ans = d[x][pre][ye];
if(ans != -1) return ans;
LL res = 0;
int last = limit?dig[x]:9;
for(int i = 0;i <= last;++i)
res += dfs(x-1,i,ye || (当前数满足条件),limit && i == last)
if(!limit) ans = res;
return res;
}
| ALGO | 0.999931 | 3.505868 |
1edd0ea6-65ad-4099-afe7-2babe76481fb | JoseLGomez/Road-Lane-Detector | Lane_detector_ubuntu/ComnUtils/src/Maths/Maths.cpp | #include "Maths.h"
MTRand* CUniqueMersenne::pMersenne = NULL; // initialize pointer
//(copy-paste from krystian)
void invSqrRoot(float &a, float &b, float &c, float &r_l, float &r_m, float &ea)
{
//cout << "in a " << a << " b " << b << " c " << c << endl;
float cos_2t = a - c;
float sin_2t = 2*b;
float r = s... | ALGO | 0.997421 | 3.829009 |
c7f02f25-7f94-4526-9c9b-0d0690f4e8fd | hq2318768188/point2mesh-master-hq-TEST | code/Manifold/3rd/igl/pso.cpp | #include "pso.h"
#include <cassert>
#include <Eigen/StdVector>
#include <vector>
#include <iostream>
template <
typename Scalar,
typename DerivedX,
typename DerivedLB,
typename DerivedUB>
IGL_INLINE Scalar igl::pso(
const std::function< Scalar (DerivedX &) > f,
const Eigen::MatrixBase<DerivedLB> & LB,
... | ALGO | 0.999853 | 6.353269 |
d4e7e8d8-c27d-4afa-923b-6ca3fd69cab2 | KiwNanthawat2149/Kiw.lab7 | lab7_3.cpp | #include<iostream>
using namespace std;
char before(char x){
if(x < 'A' || x > 'Z') return '0';
if(x == 'A') return 'Z';
return x - 1;
}
int main(){
//Test Case
cout << before('A') << "\n";
cout << before('B') << "\n";
cout << before('P') << "\n";
cout << before('T') << "\n";
cout << before('Z') << ... | ALGO | 0.996284 | 3.126269 |
32011269-fd7b-4350-8987-6301bae2471a | Sefatohee/Project-150-2017831012 | Project 150/Type 1/BFS/A Node Too Far UVa 336 .cpp | #include<bits/stdc++.h>
using namespace std;
//code sikhe sikhe korsi
//map of vector er concept vallagse
int bfs(map<int,vector<int>>edge, map<int,int>visited,int s,int ttl)
{
pair<int,int>p;
queue<pair<int,int>>q;
q.push(make_pair(s,ttl));
visited[s]=1;
while(!q.empty())
{
p=q.front()... | ALGO | 0.999159 | 4.639515 |
c7f4e258-6958-48c0-b78b-56a914331dab | alexz429/CompetitiveProgramming | C++/DMOJ/Globex/_19/S2_PredictingCollisions.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int equation[6];
int first[5];
double interval(double a, double b, double increment){
// cout<<a<<" "<<b<<" "<<increment<<endl;
double prev = 0;
for(double i=a; i<=b+increment;i+=increment){
double cal = 0;
for(int j=0;j<6;... | ALGO | 0.999459 | 3.526938 |
227d8f51-1451-4700-a484-f7fb8dd28da7 | CookiC/Codeforces | #403 C. Andryusha and Colored Balloons.cpp | //Author:CookiC
//#include"stdafx.h"
#include<iostream>
#include<vector>
#define maxn 200010
//#pragma warning(disable : 4996)
using namespace std;
int n,k;
int F[maxn],C[maxn];
vector<int> G[maxn];
void Dfs(int u){
int v,cnt=1;
for(auto it=G[u].begin();it!=G[u].end();++it){
v=*it;
if(v!=F[u]){
F[v]=u;
wh... | ALGO | 0.999838 | 4.09446 |
2a863cf5-5623-41b9-8152-ece41ce3b7d0 | ishandutta2007/codeforces | lqs2015/normal/1063/B.cpp | #include<bits/stdc++.h>
using namespace std;
int n,m,r,c,x,y,mp[2222][2222],dist[2222][2222],cur,ans;
char s[11111];
int dx[]={0,-1,0,1};
int dy[]={1,0,-1,0};
void bfs(int x,int y)
{
for (int i=1;i<=n;i++)
{
for (int j=1;j<=m;j++)
dist[i][j]=-1;
}
dist[x][y]=0;
deque<pair<int,int> > q;
q.push_back(make_pair(x... | ALGO | 0.99937 | 3.659411 |
d7cf7cac-5ec2-4140-b907-d49392b35bb9 | myd7349/Ongoing-Study | algorithm/graphics/nice_label/nice_label.cpp | #include "nice_label.h"
#include <algorithm>
#include <cmath>
double nice_number(double x, bool round)
{
int exponent; // exponent of x
double fraction; // fractional part of x
double nice_fraction; // nice, rounded fraction
exponent = std::floor(std::log10(x));
fraction = x / std::pow(10.0, expo... | TOOL | 0.919893 | 6.807614 |
951eecc9-0660-40ae-99d0-44c9f56f6073 | yuvrajkumar12/DSA_JOURNY | STL_Template_Library/04_stack/01_Reverse_sting.cpp | #include<iostream>
#include<stack>
#include<string>
#include<sstream>
using namespace std;
void reverse1(string s){
stack<char>s1;
for(int i=0;i<s.size();i++){
s1.push(s[i]);
}
for(int i=0;i<s.size();i++){
s[i]=s1.top();
s1.pop();
}
cout<<s;
}
int main(){
string s;
... | ALGO | 0.999587 | 5.02473 |
8efe24f7-1313-4982-94f2-d3468a875bb7 | stonne-simulator/stonne | pytorch-frontend/aten/src/ATen/native/quantized/cpu/qlinear.cpp | #include <ATen/ATen.h>
#include <ATen/Parallel.h>
#include <ATen/core/op_registration/op_registration.h>
#include <ATen/native/quantized/cpu/fbgemm_utils.h>
#include <ATen/native/quantized/cpu/packed_params.h>
#include <ATen/native/quantized/cpu/qnnpack_utils.h>
#include <caffe2/utils/threadpool/pthreadpool-cpp.h>
#inc... | TOOL | 0.863572 | 7.197589 |
3c74e118-d913-40cd-92d8-62b62b01d13c | kiendiu/CTDL_GT_CPP | C++ Ctdl/Ctdl_Sort_Stl.cpp | #include<iostream>
#include<algorithm>
using namespace std;
bool cmp(string a, string b){
//return a.length()>b.length();sap xep theo thu tu chieu dai cua chuoi giam dan
//neu cos cung do dai thi la thu tu co thu tu nho hon se in truoc
if(a.length() != b.length()){
return a.length()>b.length();
... | ALGO | 0.99991 | 4.073947 |
df670eb4-d35b-4427-b7fa-e9baccaeba1a | bencq/Webots-Motion-Planning | algorithm/Astar.cpp | #include<bits/stdc++.h>
#define frep(i, a, b) for(int i = a; i <= b; ++i)
using namespace std;
/** useful constants **/
const int dr[] = {-1, 1, 0, 0};
const int dc[] = {0, 0, -1, 1};
/** parameters **/
const int ROW = 30;
const int COL = 30;
int fRec[ROW][COL];
char matrix[ROW][COL];
bool inOpen[ROW][COL];
bool v... | ALGO | 0.999952 | 3.361216 |
fec52a55-94d4-40e3-a36f-3a458fd230b0 | aslezar/CompetitiveProgramming | LeetCode/Daily/Mar23/23Mar23.cpp | #include <iostream>
#include <vector>
using namespace std;
#define el << '\n'
#define ws << ' '
class Solution
{
void dfs(vector<int> adj[], vector<bool> &visited, int src)
{
visited[src] = true;
for (int i : adj[src])
{
if (!visited[i])
{
dfs(ad... | ALGO | 0.999871 | 5.381457 |
01b81777-38c2-42bb-9bde-991adf1f9f33 | Andrew90/nagan | medianFiltre/MedianFiltre.cpp | //#include "stdafx.h"
#include "MedianFiltre.h"
#include <windows.h>
#include "sort.hpp"
MedianFiltre::MedianFiltre()
: length_(11)
, middle(6)
, length(length_)
{
}
//------------------------------------------------------------------------
void MedianFiltre::SetLength(int l)
{
// if(on = l > 1)
{
length_ = l... | ALGO | 0.999273 | 4.45971 |
553288c6-a64c-43fd-8b17-664614ef7860 | lucasdbr05/competitive-programming | fase_2/glsd.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define sws ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
const int MAX= 1010;
const int INF= 0x3f3f3f3f;
int n, m;
int dp[MAX][MAX];
int main(){
cin >> n >> m;
if (m==0){
if (n==1) cout << "0 0"<< endl;
else cout... | ALGO | 0.999989 | 3.726402 |
c585384f-255b-49b7-8689-8345dc0ef1b5 | cs-qyzhang/vitis-learn | merge/merge.cpp | #include <ap_int.h>
#include <hls_stream.h>
typedef hls::stream<int, 256> stream;
void merge_stream(stream& in1_stream, stream& in2_stream, stream& out_stream, int size) {
int in1_cnt = 0;
int in2_cnt = 0;
int in1_data = in1_stream.read();
int in2_data = in2_stream.read();
while (in1_cnt != size ... | ALGO | 0.990485 | 4.279807 |
2d7bc4e8-7f27-4b1d-b95a-5cee688395c6 | lizhaoliu-Lec/AlgorithmCoding | leetcode/76.cpp | /*
* @lc app=leetcode.cn id=76 lang=cpp
*
* [76] 最小覆盖子串
*/
#include <bits/stdc++.h>
using namespace std;
// @lc code=start
class Solution {
public:
string minWindow(string s, string t) {
unordered_map<char, int> window;
unordered_map<char, int> need;
int valid = 0;
for (int i... | ALGO | 0.999933 | 7.045954 |
fbdf1786-bbfa-402c-8151-5135f6d250eb | Yasg-uru/DSA-practice- | Graphs/templates/prims.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <utility> // for pair
using namespace std;
class PrimMST {
public:
// Function to find the MST total weight
static int primMST(int V, vector<vector<pair<int, int>>>& adj) {
vector<bool> inMST(V, false); // To track nodes in MST
... | ALGO | 0.999991 | 6.678377 |
6610917f-aadb-44fa-8922-5fd563f3e339 | yuhi-dev/AtCoder | ABC/387/A/A.cpp | #include <iostream>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
int result = (A + B) * (A + B);
cout << result << endl;
return 0;
}
| ALGO | 0.991396 | 4.937367 |
f94e35a2-68f1-4191-a3f9-9ecce8c142b6 | ishandutta2007/codeforces | cheissmart/normal/1472/E.cpp | #include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << "Line(" << __LINE__ << ") -> " << #x << " is " << x << ... | ALGO | 0.999984 | 3.835337 |
3e8d768d-474b-4e69-9e6d-cb019f2d3604 | Kofrom506/Halte_Bikun | 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.998809 | 6.763549 |
9a92ffe7-d264-4f29-ac95-7e7a6ec02845 | ajay-sehrawat/leetcode | 234. Palindrome 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 {
//Using String Is Considered chea... | ALGO | 0.999681 | 6.027695 |
dbf67c7f-8b7b-4cd3-8cdb-e4494bfdb5c9 | 2809708153/WorkCG | 实验报告1模板.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int Status;
typedef int ElemType; //Ԫ
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef struct {
ElemType* elem;
int length;
int listsize;
}SqList; //
//2 غα£
Status InitList(SqList * L) {
L->elem = (ElemType*)malloc(LIST... | ALGO | 0.999927 | 3.282524 |
454a1620-85dd-4bcd-be5b-192ef0f316f3 | linhongyi0726/LeetCodePractice | 0560.cpp | // First time
/*
Prefix sum + hash map (key: prefix sum, value: numbers of prefix sum)
Use prefix sum i to find prefix sum j which diff is k
[... j ... i]
|_______|
k
*Notice mp[0]=1 to represent the array is empty,
which can let us to count the sum of whole array
T: O(n)/S: ... | ALGO | 0.999945 | 6.155764 |
1b61997f-f2f5-443e-9c51-7ecc10f24b5d | harmeepatel/CP | CodeForces/minCostString_U.cpp | #include <bits/stdc++.h>
using namespace std;
#define ar array
#define ll long long
#define pb push_back
#define to_upper(a) transform((a).begin(), (a).end(), (a).begin(), ::toupper)
#define to_lower(a) transform((a).begin(), (a).end(), (a).begin(), ::tolower)
void solve() {
int n, k;
string ans;
vector<char> v;
... | ALGO | 0.999779 | 3.681032 |
cb21b364-4b23-4c1a-b51b-0e29de2dcb3c | xyzyzl/compprog | probs/timus/1517.cpp | /*input
28
VOTEFORTHEGREATALBANIAFORYOU
CHOOSETHEGREATALBANIANFUTURE
*/
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int INF = 1e9+7;
#define LEFT(x) (2*x)
#define RIGHT(x) (2*x+1)
int n, m, st[4*MAXN];
vector<int> sa, isa, lcp;
string s;
void build(int node, int a, int b) {
if (a... | ALGO | 0.999992 | 3.949627 |
1a7e1418-39da-451c-a161-7fe0dc91eb21 | VShilenkov/AcceleratedCPP | chapter05/exercise11/main.cpp | /**
* @file main.cpp
* @author VShilenkov
* @brief Параграф 5. Упражнение 11. Страница 128.
*
* При обработке текстов зачастую полезно знать, имеет ли некоторое слово выступаю-
* выступающие или свисающие элементы букв. Выступающими являются части строчных букв,
* которые выступа... | ALGO | 0.988337 | 6.120571 |
4f8434bd-85d0-4bae-8778-cfe7df2257f2 | ishandutta2007/codeforces | nik_storm_2010/normal/494/A.cpp | #include <iostream>
using namespace std;
const int N = 2e5;
int ans[N];
int main(int argc, const char * argv[]) {
ios_base::sync_with_stdio(false);
string s;
cin >> s;
int n = (int)s.length();
int balance = 0, cnt = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '(') balance++;
... | ALGO | 0.999429 | 3.733474 |
f9502bdf-dc41-4d79-9c8a-91f47796891b | JohnSovero/Competitive-Programming-Fundamentals | src/TF/Problems/2.cpp | #include <iostream>
#include <cstdio>
#include <set>
using namespace std;
int n, m, q, len, sum;
set<int> pos;
int main()
{
cin >> n >> m >> len >> q;
pos.insert(0);
pos.insert(n + 1);
// cantidad de barcos máximos que entran en el tablero
sum = (n + 1) / (len + 1);
for (int i = 1; i <= q; ++... | ALGO | 0.99968 | 3.267442 |
de249fc6-58c0-42ee-8b31-513d80961817 | sahilsingh025/Codeforces-problems | petya.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int l;
string a, b;
cin >> a;
cin >> b;
l = a.size();
for (int i = 0; i < l; i++)
{
if (islower(a[i]))
{
a[i] = toupper(a[i]);
}
if (islower(b[i]))
{
b[i] = toupper(... | ALGO | 0.999999 | 3.759734 |
7752d8dd-b2a5-4c89-91b6-0b2ff4527aff | chalmersfsd/opendlv-sim-cfsd18-cognition-blackbox | thirdparty/neat/species.cpp | #include "species.h"
#include "organism.h"
#include <cmath>
#include <iostream>
using namespace NEAT;
Species::Species(int i) {
id=i;
age=1;
ave_fitness=0.0;
expected_offspring=0;
novel=false;
age_of_last_improvement=0;
max_fitness=0;
max_fitness_ever=0;
obliterate=false;
average_est=0;
}
Species::Species(... | TOOL | 0.907784 | 5.434216 |
ae9e1ca3-2ceb-42c7-9b00-7e3715ec7e6d | gauravasodariya/leetcode_questions | 0528-swapping-nodes-in-a-linked-list/0528-swapping-nodes-in-a-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* swapNodes(L... | ALGO | 0.999999 | 5.689768 |
b699ea65-d842-48bf-9425-f1cb2f466928 | hieu-ln/IT82-11 | CodeC6/ThuUyen_C6_Bai6.cpp | //#include<iostream>
//#include<stdio.h>
//#include <fstream>
//#include<iomanip>
//using namespace std;
//#define max 20
//int a[max][max];
//int n;
//char vertex[max];
//
//int e1[max];
//int e2[max];
//int wE[max];
//int nE=0;
//
//int t1[max];
//int t2[max];
//int wT[max];
//
//int nT=0;
//int tonTai(int d, int D[... | ALGO | 0.99979 | 3.086543 |
88d2bfb1-57c0-4531-a65b-b9e4421c4a81 | ishandutta2007/codeforces | thebes/normal/116/A.cpp | #include <bits/stdc++.h>
#define gl(x) getline(cin,x)
#define gc(x) cin.get(x)
#define sz(x) (int)(x.size())
#define pu push
#define pb push_back
#define em emplace
#define eb emplace_back
#define sp ' '
#define nl '\n'
#define f first
#define s second
#define lsb(x) ((x)&(-x))
using namespace std;
void sc(){}template<... | ALGO | 0.999967 | 4.207758 |
9ab3972f-a325-44db-a2c4-94ae9f59c4fd | emotionless/Programming-Problem-Solution | codeforces/185_A.cpp | #include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <... | ALGO | 0.998664 | 3.486364 |
c8c3f8d4-2ff1-45b2-a7c4-8e92ea11c4bc | Ashvani-Gurjar/Some_new_Question_in_data_structures | Greedy_algorithm_Maximum_and_minimum.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> a(n);
for(auto &i:a){
cin>>i;
}
sort(a.begin(),a.end());
long long mn =0, mx=0;
for(int i=0;i<n/2;i++){
mx+=(a[i+n/2]-a[i]);
mn+=(a[2*i+1]-a[2*i]);
}
cout<<mx<<" "<<mn<<endl;
return 0;
} | ALGO | 0.999865 | 3.189081 |
e915cca7-cb72-4e87-9de3-97c51e57bc99 | xxcxu/Code | Codeforces/CF1290E.cpp | # include <bits/stdc++.h>
# define int long long
static const int N = 150005;
int n, a[N], pos[N], ans[N];
FILE *fin, *fout, *ferr;
class SGT {
# define ls (x << 1)
# define rs (x << 1 | 1)
private:
class TreeNode {
public:
int sum, l, cnt, mx1, mx2;
... | ALGO | 0.999951 | 3.398236 |
24fa8e60-0239-4b34-9a91-953ed0806fa6 | bv8787879/ITSA | ITSA22.cpp | #include <iostream>
using namespace std;
int main() {
// 題目22. 圈圈叉叉
int input[3][3];
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cin >> input[i][j];
}
}
bool win = false;
for(int i = 0;i < 3;i++)
{
if(input[i][0] == input[i][1]&&
... | ALGO | 0.999774 | 4.330566 |
57eedef7-5417-4886-a752-a90efb9c85d2 | ishandutta2007/codeforces | belonogov/normal/283/A.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <cmath>
using namespace std;
#define mp make_pair
#define pb push_back
#define fr first
#define sc second
#define epr(...) fprint... | ALGO | 0.999161 | 3.336772 |
d4c98d9a-9a7d-486d-b98a-633d1fd69b18 | xli562/3dgs-acceleration | submodules/diff-gaussian-rasterization/third_party/glm/test/gtx/gtx_fast_trigonometry.cpp | #include <glm/ext/scalar_ulp.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_trigonometry.hpp>
#include <glm/gtx/integer.hpp>
#include <glm/gtx/common.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/trigonometric.hpp>
#include <cmath>
#i... | TEST | 0.953434 | 6.273131 |
10803475-6ab5-4117-8d5d-b4efff74e527 | sahilkhan03/CF-Solutions | codeforces/1251/C.cpp | /* ___ |\ /| ____ ____ ____ ____
| | /\ / \ | | | \ / | /\ | \ | \ | | \
|_____| /__\ \____ |_____| | \/ | /__\ |____/ |____/ |__ |____/
| | / \ \ | | | | / \ | | | | \
... | ALGO | 0.999996 | 3.619792 |
c47da6d2-ad77-4cc9-a369-dce1694f533f | awishnick/sidescroller | lib/boost_1_49_0/libs/flyweight/example/fibonacci.cpp | #include <boost/flyweight.hpp>
#include <boost/flyweight/key_value.hpp>
#include <boost/flyweight/no_tracking.hpp>
#include <boost/noncopyable.hpp>
#include <iostream>
using namespace boost::flyweights;
/* Memoized calculation of Fibonacci numbers */
/* This class takes an int n and calculates F(n) at construction t... | ALGO | 0.996048 | 7.784703 |
96468bf5-573b-46c0-b11c-5bfa025ae640 | xin-lover/leetcode-explore | main432.cpp | //432. 全 O(1) 的数据结构
#include <cstdio>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
using namespace std;
class AllOne {
public:
struct LinkList
{
LinkList* pre;
LinkList* next;
int val;
unordered_set<string> keys;
LinkList(int v... | ALGO | 0.999944 | 5.321227 |
6b6a79e2-50ec-4057-a205-5e9af660eb65 | prabhukumarsaw/LeetCode | 701-insert-into-a-binary-search-tree/701-insert-into-a-binary-search-tree.cpp |
Medium
You are given the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of the BST after the insertion. It is guaranteed that the new value does not exist in the original BST.
Notice that there may exist multiple valid ways for the insertion, as long as the tree rema... | ALGO | 0.999999 | 6.689782 |
1b6dedf5-c521-4ceb-83ee-9bb259b6291b | Mansibisen/CPC- | day4/ques7.cpp | //Given lowercase alphabet strings a, b, and c, return the length of their longest common subsequence.
int solve(string a, string b, string c) {
int n = a.length();
int m = b.length();
int l = c.length();
int dp[n+1][m+1][l+1];
for(int i =0 ;i <= n ; i++){
for(int j =0 ; j <= m ; j++){
... | ALGO | 0.995561 | 4.691355 |
85f4e555-d316-455b-aaf7-fa7d8f60df84 | DanielGoncalves666/Programando | URI/C++/1040.cpp | #include<iostream>
using namespace std;
int main(){
double a,b,c,d,e,media;
cin >> a >> b >> c >> d;
media = (a*2 + b*3 + c*4 + d*1)/10;
cout.precision(1);
cout.setf(ios::fixed);
cout << "Media: " << media << endl;
if(media >= 7.0){
cout << "Aluno aprovado." << endl;
}else if(media < 5.0){
cout << "Alun... | ALGO | 0.992406 | 3.487585 |
1f3ea77e-7fb0-4506-9e52-5aca190a4b04 | johannes-riesterer/Verdriller | SoftConstraint.cpp | /*
* File: SoftConstraint.cpp
* Author: johannes
*
* Created on 25. Juli 2014, 10:14
*/
#include "SoftConstraint.h"
SoftConstraint::SoftConstraint() {
};
SoftConstraint::SoftConstraint(Particle *p0, Particle *p1, Particle *p2, Particle *p3) {
this->p0 = p0;
this->p1 = p1;
this->p2 = p2;
this... | ALGO | 0.996458 | 3.943372 |
20f8035c-e870-4234-99b0-7e18f50a1c38 | HACK-WU/C_data_structure | 树和二叉树/二叉树的复制及深度节点数计算.cpp | /二叉树的复制及深度/节点数计算
#include<iostream>
using namespace std;
struct BiTreeNode
{
char data;
BiTreeNode *Lchild;
BiTreeNode *Rchild;
};
typedef BiTreeNode *BiTree;
int n=-1;
char Getch()
{ n++;
char *ch="AB#CD##E##F#GH###";
return *(ch+n);
}
void CreateBiTree(BiTree &T) //DLR遍历创建二叉链表
{
char ch;
ch=Getch(... | ALGO | 0.999931 | 4.11491 |
cbc477a0-6747-4416-b389-bdf4a89b2d58 | guimassoqueto/data-structures-algorithms-studies | PART1/week4_divide_and_conquer/1_binary_search/binary_search.cpp | #include <iostream>
#include <cassert>
#include <vector>
using std::vector;
int binary_search(const vector<int> &a, int x) {
int left = 0, right = (int)a.size();
//write your code here
}
int linear_search(const vector<int> &a, int x) {
for (size_t i = 0; i < a.size(); ++i) {
if (a[i] == x) return i;
}
... | ALGO | 0.999944 | 5.273572 |
122f9d26-eefe-4eee-8566-fa569640592a | zinchuriki/CSES | Missing Number.cpp | #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline")
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long n;
cin>>n;
long long sum=0,a;
for(int i=0; i<n-1; i++){
cin>>a;
sum+=a;
}
cout<<(n*(n+1))... | ALGO | 0.999602 | 3.698966 |
dfd6d70e-e477-4be8-81ea-4313bd1d2df8 | aryaman123456789/DSA | PA6/BigInteger.cpp | // Aryaman Gautam, agautam6, PA6
#include "BigInteger.h"
#include "List.h"
#include <sstream>
#include <algorithm>
#include <cctype>
#include <stdexcept>
using namespace std;
const long base = 1000000000;
const int power = 9;
List scalarMultiply(long scalar, List *B, int* counter) {
List L; // Resulting li... | ALGO | 0.999592 | 4.996828 |
330cc560-d2bc-400f-a427-de3cacf444d3 | Chetanjeeragal/Basic-to-Adv-C-code | Reverse_Integer.cpp | class Solution {
public:
int reverse(int x) {
int ans = 0;
while(x!=0){
int digit = x%10;
if((ans > INT_MAX/10)||(ans < INT_MIN/10)){
return 0;
}
ans = (ans * 10) + digit;
x/=10;
... | ALGO | 0.999927 | 5.855047 |
c87fa6b9-6815-4fdb-bd95-b02847d7d235 | hhuangae/liggghts-src | GPU/pair_lj_sdk_coul_long_gpu.cpp | /* ----------------------------------------------------------------------
Contributing author: Mike Brown (SNL)
------------------------------------------------------------------------- */
#include "math.h"
#include "stdio.h"
#include "stdlib.h"
#include "pair_lj_sdk_coul_long_gpu.h"
#include "atom.h"
#include "ato... | ALGO | 0.997532 | 6.120117 |
60784a9f-034d-46e2-ada9-fe6b3aaac56c | ygeorgi/MPACK | mlapack/library/Ctgsen.cpp | #include <mblas.h>
#include <mlapack.h>
void Ctgsen(INTEGER ijob, LOGICAL wantq, LOGICAL wantz,
LOGICAL * select, INTEGER n, COMPLEX * A, INTEGER lda, COMPLEX * B, INTEGER ldb,
COMPLEX * alpha, COMPLEX * beta, COMPLEX * q, INTEGER ldq, COMPLEX * z, INTEGER ldz,
INTEGER * m, REAL * pl, REAL * pr, REAL * ... | ALGO | 0.999891 | 4.953205 |
cb7ce723-b556-4010-840d-7b0bdf7b9991 | qunarcorp/open_source_startalk | QZxing/zxing/zxing/pdf417/decoder/ec/ErrorCorrection.cpp | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#include <zxing/pdf417/decoder/ec/ErrorCorrection.h>
#include <zxing/pdf417/decoder/ec/ModulusPoly.h>
#include <zxing/pdf417/decoder/ec/ModulusGF.h>
using std::vector;
using zxing::Ref;
using zxing::ArrayRef;
using zxing::pdf417::decoder::ec::Er... | ALGO | 0.999451 | 5.958494 |
00f01c01-8087-46b0-bd16-5a5e49460b98 | SOHAM2543/DSA-CPP---Hands-on | 16. Sum of square of natural numbers.cpp | // Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
int i,n,sum;
cout<<"enter number : ";
cin>>n;
for(i=1; i<n; i++) {
sum = sum + i*i;
}
cout<<"Sum of square of all natural number is: "<<sum;
return 0;
}
| ALGO | 0.992638 | 3.484146 |
1701805e-c896-4d62-8e4f-81feb7c28d9b | ishandutta2007/codeforces | anta.baka/normal/1089/G.cpp | #include <bits/stdc++.h>
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
const int inf = 1e9+100;
const int nax = 1e5;
int main() {
ios::sync_with_stdio(... | ALGO | 0.999743 | 3.446064 |
d846c5b2-427c-494b-84ee-3cb881d0d2a6 | katzhang/algorithms-in-cplusplus | 10.1.binary-quicksort.cpp | /*
author: Robert Sedgewick
PROG: Binary quicksort
*/
#include <iostream>
using namespace std;
const int bitsword = 64;
const int bitsbyte = 8;
const int bytesword = bitsword / bitsbyte;
const int R = 1 << bitsbyte;
inline int digit(long A, int B) {
return (A >> bitsbyte*(bytesword - B - 1)) & (R - 1);
}
template... | ALGO | 0.999342 | 3.728368 |
c6a233d8-6ce3-44a9-bbbe-944ec270c710 | wuyuhang05/My-OI-Code | CF/1371C.cpp | #include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define fi first
#define se second
#define db double
#define U unsign... | ALGO | 0.999748 | 3.304167 |
f4db3476-8742-4856-bd71-321a76413ce3 | KevDi/AoC2023 | day11/day11.cpp | #include <algorithm>
#include <fstream>
#include <iostream>
#include <iterator>
#include <regex>
#include <vector>
int main() {
long groth = 1000000 - 1;
std::ifstream data{"resources/data.txt"};
std::vector<std::string> data_map;
std::vector<std::pair<long, long>> galaxies;
std::regex galaxy_reg{"... | ALGO | 0.996909 | 4.579728 |
3e37d441-d434-484e-a373-1fee17b0d4bc | smhemel/Codeforces-Online-Judge | Codeforces Round #197 (Div.2) - A. Helpful Maths/Codeforces Round #197 A. Helpful Maths/main.cpp | /*#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
char s[10000],s1[10000];
while (cin >> s)
{
int len = (int) strlen(s);
for (int i=0,l=0; i<len; i++)
if(s[i]!='+'){
s1[l]=s[i];
l++;
}
... | ALGO | 0.99985 | 3.819759 |
30238549-cf58-48a7-a3d6-d765d54fbf1d | hsheric0210/Algorithm-Coding | cpp/Common Algorithms/Primality Test/Erastones.cpp | /*
(평소에 쓰던 '야매' 소수탐색 구현이 아닌)
공식적인 에라스토네스의 체 구현
*/
#include<iostream>
#include<vector>
#include<Windows.h> // for performance testing
using namespace std;
int i, j, k, n, * chk;
vector<int> prime;
/*
100000
took 0ms
9592
100000000
took 4000ms
5761455
*/
int main()
{
cin >> n;
ULONGLONG tick = GetTickCount64();
chk... | ALGO | 0.999873 | 5.051475 |
311f376b-bb69-4778-8d96-a33799c10358 | philippesalembier/SckitamVCV | src/2DAffine.cpp | #include "plugin.hpp"
struct _2DAffine : Module {
enum ParamIds {
ANGLE_PARAM,
AMOUNT_PARAM,
SHEARX_PARAM,
SHEARXAMOUNT_PARAM,
SHEARY_PARAM,
SHEARYAMOUNT_PARAM,
XOFF_PRE_PARAM,
YOFF_PRE_PARAM,
XOFF_POST_PARAM,
YOFF_POST_PARAM,
NUM_PARAMS
};
enum InputIds {
CV_INPUT,
CVSHEARX_INPUT,
CVSHE... | TOOL | 0.919182 | 6.280812 |
ebdaa5b4-9b94-4cfc-a7fb-1d9dfd7ca1ed | takhlaq/zephyr | deps/glm/test/core/core_func_integer_find_lsb.cpp | #include <glm/glm.hpp>
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
int nlz(unsigned x)
{
int pop(unsigned x);
x = x | (x >> 1);
x = x | (x >> 2);
x = x | (x >> 4);
x = x | (x >> 8);
x = x | (x >>16);
return pop(~x);
}
int pop(unsigned x)
{
x = x - ((x >> 1) & 0... | ALGO | 0.997585 | 4.794778 |
6cc9332c-fbb6-4699-a8b8-03dffffb5796 | Highmoonlander/Artificial_Intelligence_Codes | 3_UninformedSearch.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
vector<vector<int>> graph = {
{0, 1, 1, 0, 0},
{1, 0, 0, 1, 0},
{1, 0, 0, 0, 1},
{0, 1, 0, 0, 1},
{0, 0, 1, 1, 0}
};
void bfs(int start, int end){
queue<int> q;
vector<int> visited(graph.size(), 0)... | ALGO | 0.999906 | 5.154268 |
d6da755d-7203-41e6-89f9-2a03e6b96380 | MonerMo/Competitive-Programming-Journey | 2Pointers/Find the longest substring of a string containing `k` distinct characters.cpp | //
// Created by orabi on 2/1/2024.
//
#include <bits/stdc++.h>
using namespace std ;
int main(){
string input = "abcbdbdbbdcdabd" ;
//we want to have window pointers and answer pointers
//we will loop with the size of the string
//also we want to have the highest size of the substring
//we want t... | ALGO | 0.999952 | 5.510606 |
7f9431a2-1109-4e51-a193-5213d041977a | benedicka/Competitive-Programming | Gym/102219J/22173284_AC_31ms_8kB.cpp | #include<bits/stdc++.h>
using namespace std;
set< pair < char ,char > > larang;
int main()
{
string s = "ABCDE";
string inp;
for(int i = 0; i < 5; i++) {
cin >> inp;
if(inp[1] == '>')larang.insert({inp[0],inp[2]});
else larang.insert({inp[2],inp[0]});
}
do
{
bool can = true;
for(int i = 0; i < 5 && can... | ALGO | 0.999982 | 3.534282 |
669a0f90-9db4-4494-8961-614eb9c90593 | cnr-isti-vclab/texmetro | src/color_consistency.cpp | #include "color_consistency.h"
#include <QFileInfo>
#include <QDir>
#include <QString>
#include <QImage>
#include <cmath>
typedef std::pair<vcg::Point2d, vcg::Point2d> EdgeUV;
template <typename T> T mix(const T& a, const T& b, double t)
{
return a * (1 - t) + b * t;
}
static void LoadTextures(const Mesh& m, c... | ALGO | 0.960244 | 6.468917 |
a13a9f06-a30a-4361-be78-3333a681270f | Rinus2884/testRepository | ds_linkedlist_simple/ds_linkedlist_simple.cpp | /*
자료구조 data structure:
데이터(자료)들을 담는
임의의 구조물이다.
<-- 각각의 자료구조마다
구조가 다르므로 특성도 다르다.
배열array: '동일한 타입'의 원소들의 '연속적'인 메모리 블럭
링크드리스트linked list:
'노드Node'가 '데이터Data'와 '링크Link'를 가지고
각각의 링크에 의해
한줄로('선형linear'으로)
'연결'되어있는 자료구조
<C로 배우는 알고리즘>1,2권 교재 추천
<C로 배우는 쉬운 자료구조> - 초급용
*/
#include <iostream>
using namespa... | ALGO | 0.998873 | 4.95552 |
e123956f-90ca-42d2-9929-c79a7b6cc59e | otutuchristopher97/spacex_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998756 | 6.772262 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.