uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2f38e427-5913-429d-8101-bf832bdd0999 | Danacus/llvm-project-ami-cfl | libcxx/test/libcxx/fuzzing/pop_heap.pass.cpp | // UNSUPPORTED: c++03, c++11
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <vector>
#include "fuzz.h"
extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) {
if (size < 2)
return 0;
std::vector<std::uint8_t> working(data, data + size);
std::make_h... | TEST | 0.948526 | 4.610919 |
90c02307-3668-4c95-9c13-3bc29d98d5ac | andrey-golubev/algorithms_and_etc | clique/straightforward/main.cpp | #include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <cstdint>
#include <vector>
#include <chrono>
#include <limits>
#include <algorithm>
#include <map>
namespace
{
using vertex = std::uint64_t;
using vertex_array = std::vector<vertex>;
using vertex_matrix = std::vector<vert... | ALGO | 0.998928 | 5.359874 |
60a5f39e-9642-4373-90d6-5882ca6d860d | GodHVoid/CSE-100 | Lab07/hashTable.cpp | #include <iostream>
#include <bits/stdc++.h>
#include <string>
using namespace std;
class Hash
{
int M;
list<int> *table;
public:
Hash(int z);
int hashFunction(int key)
{
return(key % M);
}
void insert(int key);
void delet3(int key);
void search(int key);
void output();
};
Hash::Hash(int ... | ALGO | 0.995723 | 4.133174 |
6a9b57c9-5499-4697-b5be-ffddb1b90b76 | givensik/Algorithmic-Problem | Tree/Treap.cpp | #include <iostream>
#include <utility>
using namespace std;
class Node
{
public:
int key;
int priority, size;
Node *left, *right;
Node(const int& _key) : key(_key), priority(rand()),size(1), left(NULL), right(NULL){
}
~Node();
void setLeft(Node *newLeft){left = newLeft; calcSize();}
void setRight(Node *newR... | ALGO | 0.999744 | 4.485507 |
eabe00de-6480-4051-889d-7e88c142533d | LiunxPaisley/LeetCode | 328. Odd Even Linked List/328. Odd Even Linked List/328. Odd Even Linked List.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <array>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <list>
#include <deque>
#include <tuple>
#include <algorithm>
#include <utility>
#in... | ALGO | 0.99992 | 5.858472 |
ec95e53a-7255-417c-8ca2-2a4a51fdf5a1 | susmoysengupta/online-judge-solutions | LeetCode/single-number.cpp | /*
author: Susmoy Sen Gupta
email: <EMAIL>
github: github.com/SusmoySenGupta
Judge: Leetcode
problem no: single-number
problem name: 136. Single Number
problem link: https://leetcode.com/problems/single-number
Tags: Array, Bit manipulation
Technique, time & space complexity:
*/
#include <iostream>
... | ALGO | 0.999771 | 5.774383 |
36938a5c-17d3-4dfe-8c28-a966d47bf400 | ishandutta2007/codeforces | saba2000/normal/339/B.cpp | #include<iostream>
#include<cmath>
using namespace std;
long long n,m,k,q,ans,p;
main()
{
q=1;
cin>>n>>m;
for (int i=0; i<m; i++)
{cin>>p;
ans+=(p-q+n)%n;
q=p;
}
cout<<ans<<endl;
} | ALGO | 0.999987 | 3.071792 |
e76a172d-2a91-4ea5-a17b-13cd2e8e999f | princekumar1291/The-Complete-FAANG-Preparation-DSA- | _14_DP/_07_DPonLIS/_01_LongestIncreasingSubsequence.cpp | //Problem Link: https://leetcode.com/problems/longest-increasing-subsequence/description/
class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
int n=nums.size();
vector<int> dp(n,1);
for(int i=0;i<n;i++){
for(int prev=0;prev<i;prev++){
if(nums[prev]<nums... | ALGO | 0.999998 | 6.355669 |
9a64d151-45c9-4efd-88a8-a2513f5f00a4 | vadiwalker/assembler-course | second/main.cpp | #include <bits/stdc++.h>
int trivial_count(std::string const& s) {
int ret = 0;
for (int i = 0; i < (int) s.size(); i++) {
if (s[i] != ' ' && (!i || s[i - 1] == ' '))
ret++;
}
return ret;
}
int count(std::string const& s) {
if (s.size() < 64) {
return trivial_count(s);
}
char const... | ALGO | 0.993418 | 3.795388 |
207ea27b-1fa7-4d01-a1f5-64de9557c8fc | jiyeershi/WSGameHallCocos-js | frameworks/cocos2d-x/cocos/platform/linux/CCDevice-linux.cpp | #include "platform/CCPlatformConfig.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
#include "platform/CCDevice.h"
#include "platform/CCFileUtils.h"
#include <X11/Xlib.h>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <sstream>
#include <fontconfig/fontconfig.h>
#... | TOOL | 0.926938 | 5.662224 |
1f330522-c54f-43e9-b706-d9c52a7514b1 | geiziry/vibPerformance | thirdparty/Eigen/unsupported/doc/examples/EulerAngles.cpp | #include <unsupported/Eigen/EulerAngles>
#include <iostream>
using namespace Eigen;
int main()
{
// A common Euler system by many armies around the world,
// where the first one is the azimuth(the angle from the north -
// the same angle that is show in compass)
// and the second one is elevation(the angl... | ALGO | 0.995398 | 5.125681 |
102f4dec-240a-40ed-a2c8-efcaa237d258 | Arnav17Sharma/CodeForces | B_250_Thousand_Tons_of_TNT.cpp | #include <bits/stdc++.h>
using namespace std;
//Speed
#define fastio() ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
//Macros
#define f(i,j) for(int i=0;i<j;i++)
#define rf(i,j) for(int i=j-1;i>=0;i--)
#define all(x) x.begin(), x.end()
//Typedef
typedef long long ll;
typedef pair<int, int> p... | ALGO | 0.998785 | 3.749093 |
b0020563-54c0-4661-8e5b-f930b33c7e9a | bentrengrove/B2DWrapper-Cocos2d-Sample | Box2dTutorial/libs/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp | #include <Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h>
#include <Box2D/Common/b2BlockAllocator.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <new>
using namespace std;
b2Contact* b2PolygonAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
{
void*... | ALGO | 0.981858 | 7.215241 |
73c56a7b-b490-4992-bf0a-fe9a2236d6c2 | PetterS/spii | thirdparty/FADBAD++/examples/ExampleBADFAD4.cpp | #include "badiff.h"
#include "fadiff.h"
#include <iostream>
using namespace std;
using namespace fadbad;
class Func
{
public:
template <class T>
T operator()(const T& x, const T& y)
{
T z=sqrt(x);
return y*z+sin(z);
}
};
template <class C>
class FDiff
{
public:
template <class T>
T operator()(
T& o_dfdx... | ALGO | 0.999781 | 7.116502 |
e16e44cf-84af-48db-a3fc-2eba465704c7 | Ayush-865/TLE | 1300/30.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
int n, k;
cin >> n >> k;
vector<int> nums(n);
vector<int> prefix(n, 0);
for (int i = 0; i < n; i++)
cin >> nums[i];
prefix[0] = nums[0];
for (int i = 1; i < n; i++)
prefix[i] = prefix[i - 1] ... | ALGO | 0.999766 | 3.895485 |
f8fe37f5-974e-4a16-9b30-e73167aeab0b | niortizva/SubtractionAlgorithm | OpticalFlow_Times/FB.cpp | #include "opencv2/video/tracking.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <ctype.h>
#include <stdio.h>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include "FB.h"
using namespace cv;
using namespace std;
int main(){
... | ALGO | 0.993595 | 3.146686 |
446b3cdc-0c69-45a3-906f-1c1ab23ba36f | orangecamtus/BaitapLaptrinhHam | Bai_074/Bai_074.cpp | #include <iostream>
#include <cmath>
using namespace std;
float Tong(int, int);
int main()
{
int x;
cout << "Nhap x: ";
cin >> x;
int n;
cout << "Nhap n: ";
cin >> n;
cout << "Tong s = ";
cout << Tong(x, n);
return 0;
}
float Tong(int xx, int nn)
{
float s = 0;
int t = 1;
int m = 1;
int i = 1;
while ... | ALGO | 0.999603 | 3.870625 |
024f8f48-2ae7-44fb-9932-1a2cf17163bb | dpjudas/VkDoom | src/utility/nodebuilder/nodebuild_classify_nosse2.cpp | #include "doomtype.h"
#include "nodebuild.h"
#define FAR_ENOUGH 17179869184.f // 4<<32
int FNodeBuilder::ClassifyLine(node_t &node, const FPrivVert *v1, const FPrivVert *v2, int sidev[2])
{
double d_x1 = double(node.x);
double d_y1 = double(node.y);
double d_dx = double(node.dx);
double d_dy = double(node.dy);
... | ALGO | 0.997871 | 4.793776 |
03b4f634-4987-451c-9bea-9776cf928e8b | Ajborjas/Tarea_Analisis_Algoritmos | heap_sort.cpp | #include <iostream>
#include <chrono>
using namespace std;
using namespace std::chrono;
void heapify(int arr[], int n, int i) {
int largest = i;
int left = 2 * i + 1;
int right = 2 * i + 2;
if (left < n && arr[left] > arr[largest])
largest = left;
if (right < n && arr[right] > arr[larges... | ALGO | 0.999452 | 5.182244 |
b2165b20-b516-4eda-83a9-266f577b7831 | Fardin2112/Leetcode_solution | Plus One.cpp | class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
int n = digits.size();
for(int i=n-1; i>=0; i--){
if(digits[i]<9){
++digits[i];
return digits;
}else{
digits[i] = 0;
}
}
digits[0] ... | ALGO | 0.999923 | 6.637008 |
b29e6761-e722-44db-9f8c-efe0af255b57 | ishandutta2007/codeforces | yuu/normal/1196/F.cpp | #include <bits/stdc++.h>
using namespace std;
// clang-format off
namespace { // forbidden c++
// must be an operator that execute from left to right to make sense.
// need concept to use <<, >>, so we use | for now
#define PREFERED_OPERATOR operator|
enum general_operation_t {REVERSE, };
enum comparable_operation_t {... | ALGO | 0.999986 | 5.108819 |
636c13c4-09e6-47a5-a43b-936e24fdbce3 | jeevan01/python-extra-class | opencv/samples/tapi/squares.cpp |
#include "opencv2/core.hpp"
#include "opencv2/core/ocl.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int thresh = 50, N = 11;
const char* wndname = "Square Detection ... | TOOL | 0.996732 | 6.82863 |
e54ffed1-2670-4b29-828f-72194df1dbee | wwjszz/learn_agm | 贪心/绝对值不等式/货仓选址.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int N = 100010;
int n;
int a[N];
int main(){
scanf("%d",&n);
int i;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
sort(a,a+n);
int res = 0;
for(i=0;i<n;i++)
res += abs(a[i] - a[n/2]);
printf("%d\n",res);... | ALGO | 0.99986 | 4.236764 |
86e2f31b-2336-4ed5-b312-1d13ac4ff3c4 | VladimirCech/Complex_calculations | primes.cpp | #include "primes.h"
#include <vector>
#include <QTimer>
#include <QEventLoop>
void Primes::startPrimesCalculation(unsigned long long number) {
QString result = "";
cancelFlag = false;
pauseFlag = false;
bool *numbers = new bool[number];
std::fill_n(numbers, number, true);
for (unsigned long l... | ALGO | 0.995581 | 4.261154 |
271a4c59-f38d-4a8a-9d9c-3ad59baaa359 | coin-tests/bookcoin | src/versionbits.cpp | #include "versionbits.h"
ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex* pindexPrev, const Consensus::Params& params, ThresholdConditionCache& cache) const
{
int nPeriod = Period(params);
int nThreshold = Threshold(params);
int64_t nTimeStart = BeginTime(params);
int64_... | ALGO | 0.989687 | 6.926895 |
fbd4b3ad-f10f-4cc1-9132-a881b1acbec7 | qcad/qcad | src/3rdparty/legacy/opennurbs/opennurbs_sumsurface.cpp | /* $NoKeywords: $ */
#include "opennurbs.h"
ON_OBJECT_IMPLEMENT( ON_SumSurface, ON_Surface, "C4CD5359-446D-4690-9FF5-29059732472B" );
void ON_SumSurface::DestroyRuntimeCache( bool bDelete )
{
ON_Surface::DestroyRuntimeCache(bDelete);
if ( 0 != m_curve[0] )
m_curve[0]->DestroyRuntimeCache(bDelete);
if ( 0 !... | TOOL | 0.953011 | 5.982741 |
c0c9c349-d60f-44f5-8ccc-e2403ba2f644 | epsilonrt/RadioHead | piduino/3rdparty/crypto/AES256.cpp | #include "AES.h"
#include "Crypto.h"
#include <string.h>
#if defined(CRYPTO_AES_DEFAULT) || defined(CRYPTO_DOC)
/**
* \class AES256 AES.h <AES.h>
* \brief AES block cipher with 256-bit keys.
*
* \sa AES128, AES192, AESTiny256, AESSmall256
*/
/**
* \brief Constructs an AES 256-bit block cipher with no initial k... | ALGO | 0.964068 | 7.559134 |
dd9c9562-9b88-4049-a2fb-b4b7775d30ad | NoLimitCoder/CompetitiveProgramming | cses/Graph/ShortestRoutes2.cpp | #include <bits/stdc++.h>
#define ios() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const ll INF = 1e18;
int main(){
ios();
int n, m, q;
cin >> n >> m >> q;
// dist[i][j] = shortest distance from... | ALGO | 0.999972 | 5.046127 |
b7f7b3aa-381b-40b3-856c-1cdee060fb3f | BKHlovesgt7/test2 | JUCE/modules/juce_box2d/box2d/Dynamics/Joints/b2FrictionJoint.cpp | #include "b2FrictionJoint.h"
#include "../b2Body.h"
#include "../b2TimeStep.h"
// Point-to-point constraint
// Cdot = v2 - v1
// = v2 + cross(w2, r2) - v1 - cross(w1, r1)
// J = [-I -r1_skew I r2_skew ]
// Identity used:
// w k % (rx i + ry j) = w * (-ry i + rx j)
// Angle constraint
// Cdot = w2 - w1
// J = [0 ... | ALGO | 0.995108 | 7.607123 |
6acb75fa-df83-426a-b769-dfe9408a8d30 | pr-db/cp | Google/Kickstart /F/B.cpp | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define FastIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
class Graph
{
public:
ll v;
vector<vector<ll>> adj;
vector<int> vis;
Graph(ll _V)
{
this->v = _V;
this->adj... | ALGO | 0.999795 | 4.113345 |
fe3ec794-eb88-417f-9a33-55fc8fd16fda | jhy979/CodingTest | Baekjoon/알고리즘 다지기/파이프 옮기기1.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int n;
int map[17][17];
int sum = 0;
bool condition(int x,int y) {
if (x < 0 || x >= n || y < 0 || y >= n)
return false;
if (map[x][y] == 1)
return false;
return true;
}
bool condition_D(int x, int y) {
if (x+1 <... | ALGO | 0.999775 | 4.934524 |
41168d83-93d9-4546-8fc0-5a40a2f74ab8 | sinian666/code_102_7 | cpp_副本22/chapter_tree/binary_tree.cpp | /**
* File: binary_tree.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
/* 初始化二叉树 */
// 初始化节点
TreeNode *n1 = new TreeNode(1);
TreeNode *n2 = new TreeNode(2);
TreeNode *n3 = new TreeNode(3);
TreeNode *n4 = new TreeN... | ALGO | 0.991516 | 5.482699 |
f247b7a9-2ee2-4758-b6e1-32e679839daa | ManiMarami/Kattis-Solutions | challenge.cpp | #include <iostream>
using namespace std;
int main()
{
int n,m;
cin >> n >> m;
n = (n % m);
cout << n;
return 0;
} | ALGO | 0.999435 | 3.171691 |
ceb3464c-06cb-40ab-a1a0-22f3508f6ca0 | caleb399/GMRESpy | ext/eigen/bench/benchEigenSolver.cpp |
// g++ -DNDEBUG -O3 -I.. benchEigenSolver.cpp -o benchEigenSolver && ./benchEigenSolver
// options:
// -DBENCH_GMM
// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3
// -DEIGEN_DONT_VECTORIZE
// -msse2
// -DREPEAT=100
// -DTRIES=10
// -DSCALAR=double
#include <iostream>
#include <Eigen/Core>
#include <Eigen/QR>
#in... | TOOL | 0.989957 | 5.850217 |
61877cda-5e9a-4e4b-b162-b9678c9c18fa | Ashjha75/Practice-cpp | Practice/CountSubsequenc.cpp | //program to count the number of subsequences having sum equal to K
#include<bits/stdc++.h>
using namespace std;
int PrintSubsequence(int ind,int arr[],int n,int sum,int s){
if(ind==n){
if(s==sum)
{
return 1;
}
return 0;
}
s+=arr[ind];
int left=PrintSubsequence(ind+1,arr,n,sum,s);
s-=... | ALGO | 0.999897 | 5.043743 |
cdee93c7-a48b-4ab1-93ce-63628e88c42c | ctk0418/data_static | src/1/2-2-1.cpp | #include <windows.h>
#include <math.h>
#include <stdio.h>
#include <malloc.h>
double dividewangxx=(double)32767*(double)32767*(double)32767;
double uniform_simulated(double alpha,double beta)
{
double tep1,tep=0,dividewangx;
again:
tep1=((double)rand()*(double)32767*(double)32767+(double)rand()*(double)32767... | ALGO | 0.999627 | 3.817191 |
f39f5582-39cc-4c7d-a585-9dce72053810 | archit2604/RRT | boost_1_61_0/libs/geometry/doc/index/src/examples/rtree/interprocess.cpp | //[rtree_interprocess
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/foreach.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/allocators/alloc... | TOOL | 0.993897 | 3.959213 |
5236047c-a2ed-4fd0-9eda-1acb7210112e | PPPW/Financial-Simulations | BinomialTree.cpp | /**
@author Pei Wang
*/
#include "BinomialTree.hpp"
#include <iostream>
#include <math.h>
#include <vector>
BinomialTree::BinomialTree(double spot_,
double r_,
double dvdnt_,
double vol_,
double expiry_,
... | ALGO | 0.999826 | 5.591358 |
1e3eaea8-3dea-4bc9-b103-3530bea0cf8c | rohit141914/LeetCode | 1468-check-if-n-and-its-double-exist/1468-check-if-n-and-its-double-exist.cpp | class Solution {
public:
bool checkIfExist(vector<int>& arr) {
unordered_set<int>st;
for(auto s:arr){
if(st.find(2*s)!=st.end()||(s%2==0 &&st.find(s/2)!=st.end())){
return true;
}
st.insert(s);
}
return false;
}
}; | ALGO | 0.999227 | 5.743514 |
6637af88-c3c0-47ac-87bb-dad657ec2ae4 | stainsatin/jxtd | vendors/opencv-4.6.0/modules/video/src/tracking/tracker_dasiamrpn.cpp | #include "../precomp.hpp"
#ifdef HAVE_OPENCV_DNN
#include "opencv2/dnn.hpp"
#endif
namespace cv {
TrackerDaSiamRPN::TrackerDaSiamRPN()
{
// nothing
}
TrackerDaSiamRPN::~TrackerDaSiamRPN()
{
// nothing
}
TrackerDaSiamRPN::Params::Params()
{
model = "dasiamrpn_model.onnx";
kernel_cls1 = "dasiamrpn_ke... | ALGO | 0.997926 | 6.786883 |
33178939-2afc-430a-b065-20f7d8c9d2f7 | YeluriKetan/project-TREADS | LeetCode/1-100/53. Maximum Subarray/Solution.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int maxSub = INT_MIN;
int currSubArr = 0;
for (int i = nums.size() - 1; i > -1; --i) {
currSubArr = max(currSubArr + nums[i], nums[i]);
maxSub = max(maxSub, currSubArr);
}
return maxSub;
... | ALGO | 0.999971 | 6.535949 |
a8a0d1ff-798c-42ab-8d2a-c3584ca4efd7 | chapuni/libcxx | test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp | // <algorithm>
// template<InputIterator Iter, Predicate<auto, Iter::value_type> Pred>
// requires CopyConstructible<Pred>
// Iter
// find_if(Iter first, Iter last, Pred pred);
#include <algorithm>
#include <functional>
#include <cassert>
#include "test_iterators.h"
int main()
{
int ia[] = {0, 1, 2, 3, 4,... | ALGO | 0.998499 | 6.261253 |
2aa79102-f067-48be-85d0-c327d4f3e9f4 | X-czh/Algorithms-LeetCode | 000-099/003-Longest-Substring-Without-Repeating-Characters.cpp | // Sliding Window
// Time complexity: O(N).
// Extra space complexity: O(N).
class Solution {
public:
int lengthOfLongestSubstring(string s) {
unordered_set<char> lookup;
int max_len = 0;
int left = 0;
int right = 0;
while (right < s.size()) {
if (lookup.find(s[... | ALGO | 0.999909 | 6.594666 |
c46fb64c-e8f3-4514-9561-abfe7a446916 | 2Yubi/algorithm-note | code/c++/2. graph-theory/sample/bfs_sample.cpp | #include<bits/stdc++.h>
using namespace std;
int n, m;
int sy, sx, ey, ex;
int adj[104][104], visited[104][104];
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, 1, 0, -1};
queue<pair<int, int>> q;
void bfs(int y, int x){
visited[y][x] = 1;
q.push({y, x});
while(q.size()){
tie(y, x) = q.front(... | ALGO | 0.999631 | 4.831258 |
8f165f2d-fd51-40d9-8ec7-7883ab9df2ff | ishandutta2007/codeforces | krk/normal/128/C.cpp | #include <iostream>
using namespace std;
typedef long long ll;
const int Maxn = 2005;
const int mod = 1000000007;
int n, m, k;
int C[Maxn][Maxn];
int main()
{
for (int i = 0; i < Maxn; i++) {
C[i][0] = C[i][i] = 1;
for (int j = 1; j < i; j++)
C[i][j] = (C[i - 1][j - 1] + C[i - 1][j])... | ALGO | 0.999996 | 4.499397 |
e5ead69a-0a60-488a-bfbe-69b523906831 | snlw/Codeforces | A/1180A.cpp |
#include<iostream>
using namespace std;
int main(){
int n, cells = 1;
cin >> n;
if (n >1 ){
while (n-1){
cells += 4*(n-1);
n--;
}
}
cout << cells;
return 0;
}
| ALGO | 0.999897 | 4.134006 |
a80e2f3f-f47f-46ee-86d2-848ee5eea61e | konfiker-kido/DSA-Course | Array/nextSmaller.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> nextSmaller(vector<int> arr)
{
vector<int> ans;
for (int i = 0; i < arr.size(); i++)
{
bool flag = false;
for (int j = i + 1; j < arr.size(); j++)
{
if (arr[j] < arr[i])
{
... | ALGO | 0.99998 | 4.857995 |
a5545ca7-7b5b-48d1-a6cb-5ea8976491b3 | nachofullin/CoderForcesTPs | TP2/AvFinal.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <tuple>
using namespace std;
class DisjointSet {
vector<int> rank, parent;
public:
DisjointSet(int n) {
rank.resize(n + 1, 0);
parent.resize(n + 1);
for(int i = 0; i < n + 1; i++){
parent[i] = i;
}
... | ALGO | 0.999611 | 4.227315 |
daf78411-0033-4c78-b5d3-d8f2a1752e21 | ashotmartiros/face_reconstruction | third_party/eigen/bench/benchmark-blocking-sizes.cpp | #include <iostream>
#include <cstdint>
#include <cstdlib>
#include <vector>
#include <fstream>
#include <memory>
#include <cstdio>
bool eigen_use_specific_block_size;
int eigen_block_size_k, eigen_block_size_m, eigen_block_size_n;
#define EIGEN_TEST_SPECIFIC_BLOCKING_SIZES eigen_use_specific_block_size
#define EIGEN_T... | TOOL | 0.886959 | 5.95051 |
208f1ff2-581b-44a4-abe7-147a3d8b8a55 | randbatch-md/lammps-rbe | src/OPENMP/pair_lj_cut_thole_long_omp.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Paul Crozier (SNL)
------------------------------------------------------------------------- */
#include "pair_lj_cut_thole_long_omp.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"
#includ... | ALGO | 0.999417 | 5.967518 |
a92773c9-3d00-49cd-8a44-b5ec31c047b0 | raincross7/code-similarity | codes/train_code/problem359/problem359_91.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int N=1e5+5;
#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define point complex<double>
ll mod=1e9+7;
ll inf=2e18;
double eps=1e-10;
double pi=acos(-1);
double dot(point a, point ... | ALGO | 0.999982 | 3.108231 |
d8f35ced-f7a4-41d5-b6ea-da43e9846912 | ishandutta2007/codeforces | tiwairoao/normal/1244/B.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
char s[1000 + 5]; int n;
void solve() {
scanf("%d%s", &n, s + 1);
int ans = n;
for(int i=1;i<=n;i++)
if( s[i] == '1' )
ans = max(ans, max(2*i, 2*(n-i+1)));
printf("%d\n", ans);
}
int main() {
int t; scanf("%d", &t);
while( t-- ) solve();
} | ALGO | 0.999795 | 3.734101 |
720bdbd5-78cc-4948-817d-e215deebbe33 | Tayyab-Khurram/LinkedList-Operations | Singly_Linked_List/DeletefromBeg.cpp | #include <iostream>
using namespace std;
class node
{
public:
int data;
node *link;
void display(node *head)
{
int count = 0;
node *temp = head;
while (temp != NULL)
{
cout << temp->data << " ";
temp = temp->link;
count++;
}
... | ALGO | 0.988667 | 4.706946 |
89bc526b-52ae-4df5-be56-32353741b03f | law4percent/Sustian-a-Bottle-with-Object-Detection | EI-Library/ei-sustainabottle-arduino-1.0.4/SUSTAINABOTTLE_inferencing/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/sub.cpp | #include "edge-impulse-sdk/tensorflow/lite/micro/kernels/sub.h"
#include "edge-impulse-sdk/tensorflow/lite/c/builtin_op_data.h"
#include "edge-impulse-sdk/tensorflow/lite/c/common.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/common.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/quanti... | ALGO | 0.978063 | 7.838466 |
c6e6db66-ada5-4347-853d-882dc61af0c0 | rockyappdev/goMMD | goMMD/goMMD/Src_Bullet_287/BulletCollision/BroadphaseCollision/btDbvt.cpp | ///btDbvt implementation by Nathanael Presson
#include "btDbvt.h"
//
typedef btAlignedObjectArray<btDbvtNode*> tNodeArray;
typedef btAlignedObjectArray<const btDbvtNode*> tConstNodeArray;
//
struct btDbvtNodeEnumerator : btDbvt::ICollide
{
tConstNodeArray nodes;
void Process(const btDbvtNode* n) { nodes.push_bac... | ALGO | 0.994614 | 6.21424 |
2501cadc-5ec6-46a9-a7b6-4ad8c8339f65 | singhkhushi3026/DSA-PROBLEMS | Pairs with certain difference - GFG/pairs-with-certain-difference.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int maxSumPairWithDifferenceLessThanK(int arr[], int N, int K)
{
sort(arr,arr+N);
int ans=0;
for(int i=N-1;i>0;i--){
if(arr[i]-arr[i-1]<K){
... | ALGO | 0.999625 | 6.002277 |
48eefa40-1b50-4bfc-b7b2-9185797aa500 | Kody851/algorithom | code/practice/list.cpp | #include<iostream>
using namespace std;
struct ListNode{
int val;
struct ListNode* next;
ListNode(int x):
val(x), next(NULL){}
};
ListNode* FirstNodeCircle(ListNode*head){
if(head==NULL || head->next==NULL || head->next->next==NULL) return NULL;
ListNode *p1 = head->next, *p2 = head->next... | ALGO | 0.999972 | 4.307254 |
75b62c7d-91df-4bef-a63d-17a4d35eaf78 | krishnaprasad0/News-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.998733 | 6.76775 |
41147419-d001-4612-b000-778f117752eb | mammix2/boostcoin | src/script/sign.cpp | #include "script/sign.h"
#include "key.h"
#include "keystore.h"
#include "policy/policy.h"
#include "primitives/transaction.h"
#include "script/standard.h"
#include "uint256.h"
#include <boost/foreach.hpp>
using namespace std;
typedef std::vector<unsigned char> valtype;
TransactionSignatureCreator::TransactionSign... | ALGO | 0.940841 | 6.640901 |
a9f417f3-d793-4ea7-832d-588d279b32de | eth-cscs/SummerSchool2016 | topics/openacc/practicals/shared/blur_openacc.cpp | #include <iostream>
#include <cassert>
#include <omp.h>
#define NO_CUDA
#include "util.h"
// TODO: This must be called from an OpenACC region
double blur(int pos, const double *u)
{
return 0.25*(u[pos-1] + 2.0*u[pos] + u[pos+1]);
}
void blur_twice_gpu_naive(double* in , double* out , int n, int nsteps)
{
do... | ALGO | 0.998993 | 6.027471 |
c3862a6e-21c3-4ef0-af24-21d4b130a54d | BRUCE11111/llvm_review | libc/src/math/amdgpu/lrintf.cpp | #include "src/math/lrintf.h"
#include "src/__support/common.h"
#include "declarations.h"
namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long, lrintf, (float x)) {
return static_cast<long>(__builtin_rintf(x));
}
} // namespace LIBC_NAMESPACE
| TOOL | 0.983992 | 5.445033 |
1f0d9dd9-924e-4d92-8168-b71e8bd3864a | Jackarain/tinyrpc | third_party/boost/libs/spirit/example/qi/compiler_tutorial/calc8/vm.cpp | #include "vm.hpp"
#include <boost/assert.hpp>
#if defined(_MSC_VER)
# pragma warning(disable: 4800) // forcing value to bool 'true' or 'false'
// (performance warning)
#endif
namespace client
{
int vmachine::execute(
std::vector<int> const& code
, std::vector<int>::co... | TOOL | 0.91087 | 5.679599 |
2261facc-fd58-4d5b-b503-1a1d38e04ac3 | mnpostree/mptcoin | src/univalue/lib/univalue.cpp | #include <stdint.h>
#include <errno.h>
#include <iomanip>
#include <limits>
#include <sstream>
#include <stdexcept>
#include <stdlib.h>
#include <string.h>
#include "univalue.h"
namespace
{
static bool ParsePrechecks(const std::string& str)
{
if (str.empty()) // No empty string allowed
return false;
... | TOOL | 0.870386 | 6.600841 |
3ec6fd03-ff0f-4f12-97c5-de82f1c4f9eb | ehnryx/acm | kattis/dicebetting.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<ld> pt;
typedef vector<pt> pol;
const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1... | ALGO | 0.999923 | 3.965065 |
8c845623-f394-4e05-9c14-fbbd34dde25e | wrg2674/BaekJoon | 백준 문제/1074.cpp | // Z 1074
#include <iostream>
using namespace std;
int calculate(int n, int r, int c) {
if (n == 0) {
return 0;
}
int half = 1 << (n - 1);
if (r < half && c < half) {
return calculate(n - 1, r, c);
}
else if (r < half && c >= half) {
return half*half+calculate(n - 1, r, c - half);
}
else if (r >= half &... | ALGO | 0.999496 | 3.600747 |
509ccfb8-793e-4af9-8aea-3d3f96901284 | bowenzhao1020/leet-code-study-Cpp | 709. To Lower Case/solution.cpp |
string toLowerCase(string s) {
for(auto &str : s)
{
if(int(str) <= 90 && int(str) >= 65)
{
str = int(str) + 32;
cout << str << endl;
}
}
return s;
} | ALGO | 0.979882 | 3.895792 |
4f7c56b7-373a-4208-afbb-e5db8ef371f8 | pranayd17/CP-Problem-Solutions | Transpose Matrix.cpp | class Solution {
public:
vector<vector<int>> transpose(vector<vector<int>>& matrix) {
int m = matrix.size();
int n = matrix[0].size();
vector<vector<int>>ans(n , vector<int>(m));
for(int i = 0;i<m;i++){
for(int j = 0;j<n;j++){
ans[j][i] = matrix[i][j];
... | ALGO | 0.999952 | 6.248401 |
4b46fb05-c407-4817-b061-328e646d7f45 | jyc/gecko | js/src/gc/Marking.cpp | #include "gc/Marking-inl.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/IntegerRange.h"
#include "mozilla/ReentrancyGuard.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/TypeTraits.h"
#include "jsfriendapi.h"
#include "builtin/ModuleObject.h"
#include "gc/GCInternals.h"
#incl... | TOOL | 0.867827 | 7.296704 |
a039b7d2-4aaf-4217-a417-004c8b0d0c80 | ishandutta2007/codeforces | chen_zexing/normal/1155/C.cpp | #include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <cmath>
#include <assert.h>
#include <algorithm>
#include <stdlib.h>
#include <queue>
#include <climits>
#include <set>
#include <unordered_map>
#include <time.h>
#include <map>
#include <stack>
#include <unordered_s... | ALGO | 0.999941 | 3.158932 |
e932ca07-8007-4501-b917-6d5d21461ae8 | v1lly2707/olimpiada | Zadanie Lizak (liz).cpp | //24% score
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int arr[1000005] = {};
char a;
int cnt = 0, W = 0, T = 0;
int n, m, k; // n-> dlugosc lizaka, m->rozpatrywanie wartosci
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
cin >> a;
if (... | ALGO | 0.999968 | 3.507576 |
269e4883-4255-4852-b31f-1461604b5906 | thegamer1907/Code_Analysis | contest/1542590028.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include ... | ALGO | 0.999215 | 3.030627 |
6a1da7eb-6d6d-4f84-847a-354f8be8b818 | Ebejay95/cpp02 | ex03/bsp.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bsp.cpp :+: :+: :+: ... | ALGO | 0.997659 | 5.714637 |
def40a25-3e3d-4f42-a246-afe85b2268d1 | Aayush-Pandey05/DSA | practice questions/priority.cpp | // == and != has less priority than relational operators as >, <, <=, >=
#include<iostream>
using namespace std;
int main(){
int x;
x = 5>8 ? 10: 1!=2<5 ? 20: 30;
/*Here 5 is samller than 8 therefore the code will go to the other
ternary operator and execute it and there it will execute the
r... | ALGO | 0.998121 | 3.548394 |
276e1a7d-7143-4de5-ab64-917cacb08a98 | zhiqiangxu/client | editor/cocos2d/cocos/base/CCConfiguration.cpp | #include "base/CCConfiguration.h"
#include "platform/CCFileUtils.h"
#include "base/CCEventCustom.h"
#include "base/CCDirector.h"
#include "base/CCEventDispatcher.h"
NS_CC_BEGIN
extern const char* cocos2dVersion();
Configuration* Configuration::s_sharedConfiguration = nullptr;
const char* Configuration::CONFIG_FILE_... | CONFIG | 0.932644 | 6.127709 |
607a140b-b02f-4079-acae-02f5fd1dbff2 | jjuyeon-park/jjuyeon.github.io | 2043. 서랍의 비밀번호/study_1.cpp |
#include<iostream>
using namespace std;
int main()
{
int test_case;
int T;
int F;
freopen_s(new FILE*, "Text.txt", "r", stdin);
cin >> T >> F;
for (test_case = 1; test_case <= T; ++test_case)
{
// 10 йȣ array Ƽ йȣ index ϶
int pass;
int array[10] = { 0, };
cin >> pass;
for (int i = 0; i < F; i++)
... | ALGO | 0.995243 | 3.305016 |
838e22aa-e0bb-4db6-86ac-1a129d291b56 | kotyara38/- | variant1.cpp | //Выбор варианта по номеру в списке
#include <iostream>
using namespace std;
int main()
{
int number, quantity, variant;
cin >> number >> quantity;
variant = number % quantity +1;
cout << variant << endl;
return 0;
} | ALGO | 0.974051 | 3.171064 |
9a1d761e-6475-4436-b12a-9b894ee37a0f | sika7492/inteledge | C++/231221/2-1.cpp | #include <iostream>
using namespace std;
int main(){
int n;
for (n = 1; n < 101; n++) {
cout << n << " ";
if (n % 10 == 0)cout << "\n";
}
} | ALGO | 0.995772 | 3.827861 |
d10b37cd-e20a-4d94-94df-c84910968e22 | IcEy-999/MyUESource | Engine/Source/ThirdParty/PhysX3/APEX_1.4/shared/general/meshimport/src/utils/MiMapSet.cpp | ///////////////////////////////////////////////////////////////////////////////
// Written by Paul Pedriana.
//
// Refactored to be compliant with the PhysX data types by John W. Ratcliff
// on March 23, 2011
//////////////////////////////////////////////////////////////////////////////
namespace mimp
{
// Forward... | ALGO | 0.999041 | 7.448421 |
cac1e259-b688-4dc4-b91a-ac8e64ccd9a9 | fivt-300-groups-advanced-a/fivt-2013-advanced-a | Khismatullin/Task 2/Invariant_test.cpp | #include "gtest/gtest.h"
#include "Cheap.h"
#include <iostream>
#include <fstream>
#include <cstdio>
#include <string>
#include <set>
using namespace std;
const int insert_N = 1000;
const int bigtest_N = 1000000;
const int pointtest_N = 100000;
struct point
{
int x, y;
};
class compare
{
public:
bool operator (... | TEST | 0.92565 | 4.952334 |
15ba8641-4bbf-48ce-b6dc-44bfee3d9e29 | leonardoAnjos16/Competitive-Programming | Codeforces/coins.cpp | #include <bits/stdc++.h>
using namespace std;
#define llong long long int
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t; cin >> t;
while (t--) {
llong n, k;
cin >> n >> k;
llong diff = n - k;
if (!(diff & 1LL)) cout << "YES\n";
else if (... | ALGO | 0.999694 | 4.555749 |
0dc5475a-3242-41b9-ae24-9da1834608aa | surya3214/coding | LeetCode/CourseScheduleII.cpp | // AC #Medium
#include <bits/stdc++.h>
using namespace std;
struct N {
N() { deps = added = 0; next.clear(); }
int deps;
vector<int> next;
bool added;
};
class Solution {
public:
vector<int> findOrder(int numCourses, vector<vector<int>>& prerequisites) {
ios::sync_with_stdio(0);
cin.tie(0);
cout.t... | ALGO | 0.999987 | 5.897335 |
5d69cd3a-c80b-46b1-8ae0-194b356fe0c6 | SMUG201911188CYS/Programmers-Baekjoon | 프로그래머스/2/131701. 연속 부분 수열 합의 개수/연속 부분 수열 합의 개수.cpp | #include <string>
#include <vector>
#include <set>
#include <iostream>
using namespace std;
int solution(vector<int> elements) {
int answer = 0;
int Size = elements.size();
set<int> List;
vector<vector<int>> DP(Size, vector<int>(Size, 0));
for(int i = 0; i < Size; i++)
{
DP[0][i] ... | ALGO | 0.999713 | 4.967686 |
d7178fe7-eb56-4d2c-a080-1023a800bdd8 | madhav-bits/Coding_Practice | leetJumpGameII.cpp | /*
*
//**************************************************************45. Jump Game II.*******************************************************
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that pos... | ALGO | 0.99999 | 6.019862 |
40e0cc98-6439-4211-b3fb-bffcf9edff09 | AlJamilSuvo/LeetCode | code1305.cpp | #include "tree_node_util.hpp"
class Solution
{
public:
vector<int> getAllElements(TreeNode *root1, TreeNode *root2)
{
vector<int> r1, r2;
getInOrderList(root1, r1);
getInOrderList(root2, r2);
int i = 0;
int j = 0;
vector<int> r;
while (i < r1.size() || j ... | ALGO | 0.999971 | 5.967375 |
4870f55a-deab-4140-a0a5-cb6875f0a66a | celestebarnaby/ImageEye | eusolver/thirdparty/z3/src/tactic/arith/card2bv_tactic.cpp | #include"tactical.h"
#include"cooperate.h"
#include"ast_smt2_pp.h"
#include"card2bv_tactic.h"
#include"pb2bv_rewriter.h"
#include"ast_util.h"
#include"ast_pp.h"
#include"filter_model_converter.h"
class card2bv_tactic : public tactic {
ast_manager & m;
params_ref m_params;
publ... | ALGO | 0.990309 | 5.77762 |
fb75580e-98c3-4ffd-811f-8092f9bf4d17 | parthdesai24/LeetCode | 0472-concatenated-words/0472-concatenated-words.cpp | class Solution {
public:
int n;
unordered_map<string, bool> mp;
bool isConcat(string word, unordered_set<string>& st) {
if(mp.find(word) != mp.end())
return mp[word];
int l = word.length();
for(int i = 0; i<l; i++) {
string prefix =... | ALGO | 0.999666 | 5.974885 |
fdd2a6e5-6de3-4ea9-8543-cea76dda84be | TuringKi/llvm-project-12-wasi | libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp | // REQUIRES: asan
// <vector>
// reference operator[](size_type n);
#include <vector>
#include <cassert>
#include <cstdlib>
#include "asan_testing.h"
#include "min_allocator.h"
#include "test_iterators.h"
#include "test_macros.h"
extern "C" void __sanitizer_set_death_callback(void (*callback)(void));
void do_exit... | TEST | 0.859324 | 5.755341 |
a79d94a7-6606-466c-8dcc-47ef03e734fe | zealzhu/DDZClient | cocos2d/cocos/base/ccUTF8.cpp | #include "base/ccUTF8.h"
#include "platform/CCCommon.h"
#include "base/CCConsole.h"
#include "ConvertUTF.h"
NS_CC_BEGIN
namespace StringUtils {
std::string format(const char* format, ...)
{
#define CC_MAX_STRING_LENGTH (1024*100)
std::string ret;
va_list ap;
va_start(ap, format);
char*... | TOOL | 0.970495 | 6.070928 |
3eb841b7-95f4-49c6-807f-9911440c964e | ImperishableMe/codeforces-submissions | codeforces/146/E.cpp | /// HK 108 Times
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std ;
#define ll long long
#define pb push_back
typedef pair <int,int> PII ;
... | ALGO | 0.999917 | 4.204411 |
b8744bc7-5aea-4492-8daa-b7d2ddcb0458 | DaielChom/Dev-UIS | [C++] Estrucutras/Pila.cpp | #include "iostream"
using namespace std;
struct nodo
{
int dato;
nodo *sig;
};
class Pila
{
private:
nodo *tope; //tope es la entrada a la pila
public:
Pila();
char meter(int valor);
char sacar(int &valor);
~Pila();
void limpiarPila(); // quita todos los elementos de la pila
int cimaPila(); //obtiene el ele... | TOOL | 0.948762 | 3.675032 |
2bb453b8-c37c-4d54-92fc-825a4d6f23ed | bdcbqa314159/leetCodeWork | 0191-number-of-1-bits/0191-number-of-1-bits.cpp | class Solution {
public:
int hammingWeight(uint32_t n) {
int res = 0;
while (n){
res+=(n%2);
n>>=1;
}
return res;
}
}; | ALGO | 0.999822 | 6.244864 |
a5d7f202-a971-412f-a885-3701c724bc60 | jw0r1n/coleetde | code/a1098.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <array>
#include <iomanip>
#include <queue>
#include <climits>
using namespace std;
int main(int argc, const char * argv[]) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long ni;
cin >> ni;
vector<long lon... | ALGO | 0.999957 | 3.682123 |
97906c68-77ba-4aa8-a815-981f21ced1bd | gatsjy/algorithm | Bakjoon/20056(마법사 상어와 파이어볼).cpp | #include <vector>
#include <stdio.h>
#include <iostream>
using namespace std;
namespace _20056 {
struct FIREBALL {
int x, y;
int m, s, d;
};
const int dx[8] = { -1,-1,0,1,1,1,0,-1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };
int N, M, K;
vector<FIREBALL> ball; // ̾ ġ
vector<int> map[50][50];
void move(... | ALGO | 0.999856 | 4.890615 |
cd164c76-a2c2-4b67-a7dd-9ea302ca2f66 | parthawasthi25/Leetcode | 28-find-the-index-of-the-first-occurrence-in-a-string/find-the-index-of-the-first-occurrence-in-a-string.cpp | class Solution {
public:
int strStr(string haystack, string needle) {
if(haystack.size()<needle.size()) return -1;
int found=0;
for(int i=0;i<haystack.size()-needle.size()+1;i++){
if(haystack[i]==needle[0]){
found=1;
for(int j=1;j<needle.size();j++... | ALGO | 0.99997 | 5.733129 |
251ad1e1-a65e-49b2-9c34-08a82845ac5d | codeaholic-shub/ALGO-ADDICT | LEETCODE/C++/super-palindromes.cpp | // Time: O(n^0.25 * logn)
// Space: O(logn)
class Solution {
public:
int superpalindromesInRange(string L, string R) {
const auto K = static_cast<int>(pow(10, (R.length() + 1) * 0.25));
const int64_t l = stol(L), r = stol(R);
int result = 0;
// count odd length
for (int k ... | ALGO | 0.999555 | 6.141988 |
a9eb5598-a01a-43c5-8e63-9288684cf553 | Dhruvdubey17/Coding-Practice | Stacks/recRevStack.cpp | #include<iostream>
#include<stack>
using namespace std;
void insertAtBottom(stack<int> &s,int x) {
if(s.empty()) {
s.push(x);
return;
}
int data = s.top();
s.pop();
insertAtBottom(s,x);
s.push(data);
}
void recReverese(stack<int> &s) {
if(s.empty()) {
return;
}
int x = s.top();
s.pop();
recReverese(... | ALGO | 0.999883 | 4.589521 |
cfe3973e-001f-405d-a79d-991713644c74 | tiger0132/code-backup | Luogu/P5000~P5999/P5055 【模板】可持久化文艺平衡树/gen.cpp | #include <algorithm>
#include <cstdio>
#include <cstring>
const int K = 1e6, N = 1e4;
int rnd(int l, int r) { return rand() % (r - l + 1) + l; }
int n, sz[N + 1000];
int main() {
srand((unsigned long long)new char);
freopen("1.in", "w", stdout);
n = N;
printf("%d\n", n);
for (int i = 1, v; i <= n; i++) {
print... | ALGO | 0.999048 | 3.002103 |
e3c42e76-9186-470c-8223-5d6a63320db2 | xenron/sandbox-algorithm-LintCode | C++/shape-factory.cpp | // Time: O(1)
// Space: O(1)
/**
* Your object will be instantiated and called as such:
* ShapeFactory* sf = new ShapeFactory();
* Shape* shape = sf->getShape(shapeType);
* shape->draw();
*/
class Shape {
public:
virtual void draw() const=0;
};
class Rectangle: public Shape {
public:
virtual void draw()... | TOOL | 0.857423 | 6.772099 |
07325186-5d13-4bfe-aa2f-ceb76c605da1 | harsh13579/CPP-Codeforces-Codes | 800/grab_the_candies.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n,sum_odd=0,sum_even=0;
cin>>n;
int arr[n];
for(int i=0; i<n; i++)
{
cin>>arr[i];
if(arr[i]%2==0)
{
sum_even+=arr[i];
... | ALGO | 0.999719 | 4.577271 |
c8a4fee1-14c4-4917-bc5b-9dee0b7219a3 | inerc/Algorithms_and_Data_Structures | Modul2/3_4.cpp | #include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
struct Segm
{
int X;
int Vid;
};
void Sort(Segm *S, int K);
int main()
{
int M, N, i, j, K, L;
long Lp;
K = -1;
cin >> N;
Segm* S = new Segm[2*N];
for(int i = 0; i< N; i++)
{
K = K + 2;
cin... | ALGO | 0.999871 | 3.657627 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.