uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9aadc094-fd3d-4b64-82a7-ec8da9d766ad | ishandutta2007/codeforces | lucaperju/normal/1555/A.cpp | #include <bits/stdc++.h>
using namespace std;
/*
const long long mod = 1000000007;
long long fct[200005],invfct[200005],inv[200005];
long long lgput (long long a, long long exp)
{
long long rz=1;
while(exp)
if(exp&1)
exp^=1,rz=rz*1LL*a%mod;
else
exp>>=1,a=a*1LL*a%mod;
... | ALGO | 0.999896 | 4.518324 |
d80047c9-382c-4d0e-96cd-55a82d9b1cc7 | v1rushb/Problem-Solving | Binary Search/Binary Search.cpp | //problem link: https://leetcode.com/problems/binary-search/
class Solution {
public:
int search(vector<int>& nums, int target) {
int l = 0, r = nums.size() - 1;
while(l<=r)
{
int mid = (r-l)/2+l;
if(nums[mid] == target)
return mid;
else ... | ALGO | 0.999904 | 6.554191 |
a4e39dde-810e-4d17-b62d-214ca3be75b9 | adityasharma36/DSA-Series | recursion/findMinimumStep.cpp | #include<iostream>
#include<limits.h>
#include<vector>
using namespace std;
int findMinimumStep(vector<int> array,int target){
if(target==0){
return 0;
}
if(target <0){
return INT_MAX;
}
int mini = INT_MAX;
for(int i = 0;i<array.size();i++){
int ans = findMinimumStep(arra... | ALGO | 0.999993 | 4.699188 |
4938608b-cae6-450e-b427-60885a455b58 | wendy556609/ParticleSystem | cocos2d/cocos/math/Vec2.cpp | #include "math/Vec2.h"
#include "math/MathUtil.h"
#include "base/ccMacros.h"
NS_CC_MATH_BEGIN
// returns true if segment A-B intersects with segment C-D. S->E is the overlap part
bool isOneDimensionSegmentOverlap(float A, float B, float C, float D, float *S, float * E)
{
float ABmin = std::min(A, B);
float AB... | TOOL | 0.959605 | 7.040262 |
a6bca997-82b8-4afa-8176-c2703aa61319 | dhnesh12/codechef-solutions | 04-CodeChef-Hard/97--Plus Equation.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = 121;
const int LIM = 1000001;
string s, n;
bool PLUS[MAX];
bitset<LIM> dp[MAX];
bitset<LIM> vis[MAX];
bool solve(int idx, int rem) {
if (idx == s.length()) {
return rem == 0;
}
if (vis[idx][rem]) {
return dp[idx][rem];
}
vis[idx][rem]... | ALGO | 0.999971 | 4.838389 |
0cdac13e-1271-4458-b318-4d142476fa16 | keetonian/HashSolver | Source/lib/tbb/examples/parallel_for/seismic/universe.cpp | #include "../../common/gui/video.h"
#include <cmath>
#include "tbb/blocked_range.h"
#include "tbb/parallel_for.h"
using namespace std;
#ifdef _MSC_VER
// warning C4068: unknown pragma
#pragma warning(disable: 4068)
// warning C4351: new behavior: elements of array 'array' will be default initialized
#pragma warning(d... | ALGO | 0.959005 | 4.29872 |
11aaee93-e4c8-4de4-9c7b-35d0f4302a1d | jaebaek/SGX-Shield | llvm/lib/CodeGen/DetectDeadLanes.cpp | #include <deque>
#include <vector>
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/PassRegistry.h"
#inclu... | ALGO | 0.98968 | 7.104392 |
c3e5c6a7-ac1e-4795-923b-8196107cc7e8 | davidglo/dyantra | src/attractor.cpp | #include "attractor.h"
attractor::attractor(const ofPoint& center, float radius, float amplitude)
: center(center), radius(radius), amplitude(amplitude) {
}
void attractor::draw() const {
ofNoFill();
int numSegments = 100; // Increase the number of segments for smoother circles
ofBeginShape();
for... | TOOL | 0.998739 | 5.902509 |
3c5c8b25-e6fe-4b7b-b317-972cd96ceb41 | BinomialSheep/Competitive | AtcoderProblems/BootCampMedium/001_Trained.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
// #include <atcoder/all>
// g++ --std=c++14 -I "/mnt/c/Program Files (x86)/Microsoft Visual
// Studio/2019/Community/VC/Tools/MSVC/14.29.30037/include" code.cpp
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MAX 10000
#define INFTY (1 <<... | ALGO | 0.999953 | 4.94813 |
e7d29236-35a5-4935-8f93-9423191ed1fc | Kamlesh-Bhatt-52625/cpp | Loops/13_Palindrome_Number.cpp | // A PROGRAM TO CHECK WHETHER THE GIVEN NUMBER IS A PALINDROME OR NOT
#include<iostream>
using namespace std;
int main(){
int n, r, rev=0;
cout<<"Enter the number: "<<endl;
cin>>n;
int N=n;
while(n>0){
r=n%10;
n=n/10;
rev = rev*10+r;// --> This will store the reversed v... | ALGO | 0.999638 | 4.47359 |
e1a129de-71f8-44d2-adf6-1126ac5aec4c | Harshit16112000/DSA | 2090-number-of-ways-to-arrive-at-destination/number-of-ways-to-arrive-at-destination.cpp | class Solution {
public:
int countPaths(int n, vector<vector<int>>& roads) {
vector<vector<pair<long long,long long>>> adj(n);
for(auto it: roads)
{
adj[it[0]].push_back({it[1],it[2]});
adj[it[1]].push_back({it[0],it[2]});
}
// Min Heap
priori... | ALGO | 0.999977 | 5.725161 |
7628a52e-1d34-466a-8cce-dafdf1e0bfbb | 369Saur/Codeforces | A_Sakurako_s_Exam.cpp | #include<bits/stdc++.h>
using namespace std ;
void solve(){
int a , b ;
cin >> a >> b ;
if(a == 0 && b % 2 == 0) cout << "YES" << endl ;
else if(a == 0 && b % 2 != 0) cout << "NO" << endl ;
else if(a % 2 == 0 ) cout << "YES" << endl ;
else cout << "NO" << endl ;
}
signed main(){
... | ALGO | 0.999756 | 4.822817 |
098649ec-b28f-4312-99e2-879905b00765 | Raj-588/CP_code | sorted check recursion.cpp | #include<iostream>
using namespace std;
bool csort(int arr[],int n)
{
if(n==0 || n==1)
{
return true;
}
if(arr[0]<=arr[1] && csort(arr+1,n-1)==true)
{
return true;
}
else
{
return false;
}
}
int main()
{
int arr[]={1,4,10,8,9};
int n=sizeof(arr)/sizeof(int );
if(csort(arr,n))
{
cout<<... | ALGO | 0.999983 | 4.735468 |
90f96cce-5ef6-4792-873a-3e74aeb6ccbd | sp9820e-kaios/android_external_libcxx | test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, Predicate<auto, Iter::value_type> Pred, class T>
// requires OutputIterator<Iter, Iter::reference>
// && OutputIterator<Iter, const T&>
// && CopyConstructible<Pred>
// void
// replace_if(Iter first, Iter last, Pred pred, const T& new_value);
#inc... | TEST | 0.995965 | 6.572135 |
fc41a95d-1ebe-4730-963a-48c5b9f3097e | Meeperbunny/CompetitiveProgramming | archive/CF988/_C.cpp | #include <bits/stdc++.h>
using namespace std;
#define HEADER ios::sync_with_stdio(0);cin.tie(0);if (fopen("file.in", "r")) {freopen("file.in", "r+", stdin);};
#define all(v) v.begin(), v.end()
using ll = long long;
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T... | ALGO | 0.999699 | 4.463119 |
f9b549b8-a5b8-48a0-a58e-bfffbb044801 | tek1031/AOJ | 2150/2150.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> sieve_of_eratosthenes(int n) {
vector<int> primes(n);
for (int i = 2; i < n; ++i)
primes[i] = i;
for (int i = 2; i*i < n; ++i)
if (primes[i])
for (int j = i*i; j < n; j+=i)
primes[j] = 0;
// primes.erase(remove( pri... | ALGO | 0.999837 | 3.730753 |
4e99651e-a804-438d-962d-1b336bb8fbb5 | TheJustMoose/74HC-CPU | soft/emul/emul.cpp | /*
Cmd system of 74hcpu:
|-----------------------------------------------|f|
| 4 + 3 + 1 + 3 + 5 = 16 |l|
| HIGH BYTE | LOW BYTE | HIGH BYTE |a|
|0 1 2 3 4 5 6 7 8 9 A B C D E F| (again) |g|
|-----------------------------------------------|s|
| ADD | DST |C| SRC |-|Z|z|I|i... | TOOL | 0.912309 | 6.395734 |
d4585edf-c988-4f0c-b2a7-6c11ba62a133 | ishandutta2007/codeforces | bayweiheng/normal/1326/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<vll>... | ALGO | 0.999965 | 3.352354 |
4bf5c680-a4d9-44e4-b992-f01d629740b5 | ANLAB-KAIST/adios | dispatcher/deps/faiss/faiss/impl/NNDescent.cpp | // -*- c++ -*-
#include <faiss/impl/NNDescent.h>
#include <mutex>
#include <string>
#include <faiss/impl/AuxIndexStructures.h>
#include <faiss/impl/DistanceComputer.h>
namespace faiss {
using LockGuard = std::lock_guard<std::mutex>;
namespace nndescent {
void gen_random(std::mt19937& rng, int* addr, const int si... | ALGO | 0.999967 | 6.991111 |
98e38fa7-7afa-457f-b70b-4c023abc2689 | Yimin-zhou/CG-FinalGame | framework/third_party/glm/test/core/core_func_integer_find_msb.cpp | #include <glm/glm.hpp>
#include <cstdio>
#include <cstdlib> // To define "exit", req'd by XLC.
#include <ctime>
#define LE 1 // 1 for little-endian, 0 for big-endian.
int pop(unsigned x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0... | ALGO | 0.998581 | 3.60046 |
c32828f5-2b50-4bdb-a9fb-90343396f065 | GitNerdSavvy/GeeksForGeeks | Difficulty: Medium/Sum of Subarrays/sum-of-subarrays.cpp | class Solution {
public:
int subarraySum(vector<int>& arr) {
// code here
int n = arr.size() , ans = 0 ;
for(int i = 0 ; i < n ; i ++) ans += arr[i] * (i + 1) * (n - i) ;
return ans ;
}
}; | ALGO | 0.999938 | 5.514008 |
1e2e4b75-6882-4249-afe7-cf0b3eb87db6 | sachinsngh165/Competitive-Programing | digjump.cpp | #include <iostream>
#include <list>
#include <limits.h>
using namespace std;
typedef long long ll;
class Graph
{
ll v;
list<ll> *adj;
ll *dis ;
bool *sptSet ;
public:
Graph(ll v);
~Graph();
void addEdge(ll u,ll v);
ll dijkstra_path_len();
list<ll>::iterator k;
void prll_graph()
{
for (ll i = 0; i < v;... | ALGO | 0.999967 | 3.598384 |
8af3e08c-0dd2-4c7e-aa10-2dd353f1b2b9 | TheSadMuffinMan/muffinman_academia | 4.0 CS3 Algorithms Sherine CPP/3. Textbook Code/Y. Connectivity Problem/2. Quick Union/main.cpp | #include <stdio.h>
#include <iostream>
#define N 10000
/* Program 1.2 (in textbook)
Quick-Union Find == "not-too-quick" find.
The Root of the Tree MUST point to itself so that when traversing the pointers up the tree, we know when to stop.
The difference between QUICK UNION and QUICK FIND certainly represents an imp... | ALGO | 0.993277 | 4.833509 |
f6143a77-84cf-49ff-b2a6-a727cc3d64f1 | a1774281/UndergraduateCode | Object Orientated Programming(c++)/practical-01/function-1-4.cpp | #include <iostream>
// Returns number of elements in an array that are equal to desired number
int sumtwo(int array[], int secondarray[], int n) {
int total = 0;
for (int i = 0; i < n; i++) {
if (n < 1) {
return 0;
}
else {
total += array[i] + secondarray[i];
}
}
re... | ALGO | 0.992624 | 4.163652 |
ccc3c536-d9eb-49d8-9689-7a629b6ed752 | sumitt1080/Codeforces--Practice | A_Omkar_and_Bad_Story.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int f=0;
for(int i=0; i< n ;i++){
int x;
cin>>x;
if(x<0)
f=1;
}
if(f==1){
... | ALGO | 0.997264 | 3.424809 |
45777cf4-459e-4e52-877c-b710b9146541 | cybertronayush/CSES | Introductory Problems/apple-division.cpp | #include <bits/stdc++.h>
#define lli long long int
#define li long int
#define ld long double
using namespace std;
const lli mod = 1e9 + 7;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli n, total=0, ans=INT_MAX;
cin >> n;
li arr[n];
for(lli i = 0; i < n; i++) {
cin >> arr[i];
total += arr... | ALGO | 0.999975 | 4.265542 |
e24f0aff-2b6d-4ae1-af39-5dc0da674f86 | ayegenberdiyeva/cpp_pp1_labs | lab11/lab11_8.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
string s;
cin >> n >> s;
for (int i = 0; i<s.size(); i++){
int k = (int) s[i];
if ((k+n) > 90){
k = k+n-26;
} else {
k += n;
}
s[i] = (char) k;
}
cou... | ALGO | 0.99975 | 4.087712 |
b1add235-6368-48c1-a769-35394ee4f8a2 | kristinazhambalova/laba_6 | laba_6.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
int main() {
// 1. Чтение из файла целочисленного одномерного вектора
std::ifstream file("input.txt");
if (!file.is_open()) {
std::cerr << "Error opening file." << std::endl;
return 1;
}
std::vector<int> ... | ALGO | 0.99961 | 4.707398 |
a10efeb4-d6b3-4fa1-bd5c-5ea5bccfea9b | GrossfieldLab/loos | src/AG_linalg.cpp | /*
AG_linalg.cpp
Linear-algebra routines (requiring ATLAS or vecLib) for AtomicGroup
class
*/
#include <ios>
#include <sstream>
#include <iomanip>
#include <assert.h>
#include <algorithm>
#include <boost/random.hpp>
#include <AtomicGroup.hpp>
#include <alignment.hpp>
namespace loos {
std::vector<GCoord> ... | TOOL | 0.991107 | 6.618798 |
5b2dc421-913a-4f8f-b8f7-496aef7871a3 | Seungchan0325/baekjoon | solutions/31249_0.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int t;
cin >> t;
while(t--) {
int n, m;
cin >> n >> m;
if(n > m) swap(n, m);
if(n == 1 && m == 3) cout << "2 5\n";
else if(n == m) cout <<... | ALGO | 0.999815 | 4.556541 |
45831948-8f3d-4c87-9804-3a53a203ff6b | agentsamX/HarmonicOTTER | dependencies/imgui/misc/fonts/binary_to_compressed_c.cpp | // ImGui - binary_to_compressed_c.cpp
// Helper tool to turn a file into a C array, if you want to embed font data in your source code.
// The data is first compressed with stb_compress() to reduce source code size,
// then encoded in Base85 to fit in a string so we can fit roughly 4 bytes of compressed data into 5 by... | TOOL | 0.890489 | 6.363335 |
eae0944d-77f7-4672-952e-ad0397f5b707 | RedBlueBird/competitive-programming | CSES/5-RangeQueries/RangeXorQueries.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
// freopen("../input.txt", "r", stdin);
// freopen("../output.txt", "w", stdout);
//Take inputs
int n, m;
cin >> n >> m;
vector<int> presum(n+1);
for (int i = 1; i <= n; i++){
int a;
cin >> a;
... | ALGO | 0.999993 | 4.514722 |
9513e357-cc4a-48db-a6fa-9a43dabfb0e2 | Zhang-ycc/ADS | lab1/AVL-master/AVL.cpp | /**
@brief An implementation of AVL Tree, including delete, insert, search(skipped cause AVL is one kind of BST)
*/
#include "AVL.h"
#include<iostream>
AVL* New_Node(KEY_TYPE key, AVL* lchild, AVL* rchild, int height)
{
AVL* p_avl = new AVL;
p_avl->key = key;
p_avl->lchild = lchild;
p_avl->rchild = rchild;
p_... | ALGO | 0.999915 | 3.905904 |
830efa8a-94c1-483e-891e-6e12a6036167 | Y-Leo/Day_code | 2019_11_24/2019_11_24/test.cpp | #if 0
//ǵı
#include<iostream>
using namespace std;
#include<vector>
vector<vector<int>> CreatTriangle(int n)
{
vector<vector<int>> v(n, vector<int>(2 * n + 1, 0));
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < 2 * i + 1; ++j)
{
//һΪ1
if (i == 0 || i == 1)
v[i][j] = 1;
//һΪ1
else if (j == 0)... | ALGO | 0.999799 | 4.600994 |
cecd0a67-eb22-4492-a696-a3db42a72482 | Versalight/firestorm-viewer | indra/llmath/llvolumeoctree.cpp | #include "llvolumeoctree.h"
#include "llvector4a.h"
BOOL LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, const LLVector4a& center, const LLVector4a& size)
{
LLVector4a fAWdU;
LLVector4a dir;
LLVector4a diff;
dir.setSub(end, start);
dir.mul(0.5f);
diff.setAdd(end,start);
diff.mul(0.5f... | ALGO | 0.99177 | 6.068963 |
f639b968-8a0d-4cc2-932f-e4b3be97de2d | olha-pelykh/Operating-System | Pelykh_Olha_PZ-26_OS_Lab4/Lab4_6.cpp | #define _POSIX_SOURCE
#include<sys/types.h>
#include<unistd.h>
#include<iostream>
#include <stdio.h>
#include<sys/wait.h>
int main(int argc, char* argv[])
{
int n;
std::cout<<"enter number of process"<<std::endl;
std::cin>>n;
pid_t *p =new pid_t[n];
int *status=new int[n];
pid_t *w =new pid_t[n];
p[0]=fork();
if(p[0]<... | ALGO | 0.997167 | 3.246148 |
590c566b-4de8-4db9-b7a0-edba4de94dd2 | dfmoura/uberhub | 1180.cpp | #include <bits/stdc++.h>
using namespace std;
/* Faça um programa que leia um valor N. Este N será o tamanho
de um vetor X[N]. A seguir, leia cada um dos valores de X, encontre
o menor elemento deste vetor
e a sua posição dentro do vetor, mostrando esta informação.*/
int main(){
vector<int> vet;
int N,aux... | ALGO | 0.999859 | 4.781082 |
99b20bf5-8428-4a4f-b260-5bddd1ce08f5 | skshamagarwal/LoveBabbar450 | 9MinHeight.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
ll l, k;
cout<<"Enter Length of array and k space separated:: ";
cin>>l>>k;
vector<ll> ar;
cout<<"Enter array elements space separated:: ";
for (ll i=0; i<l; i++){
ll ip;
cin>>ip;
ar.push... | ALGO | 0.999869 | 3.738996 |
27dedeae-7c94-49a4-9a33-5460647cc9cb | adsad100/Algorithm_study | backjoon/1712.cpp | // backjoon 1712
// A + Bx < Cx 를 만족하는 자연수 x의 최소값
#include <iostream>
using namespace std;
int main(){
long long a,b,c;
cin >> a >> b >> c;
if(c - b <= 0) cout << -1 << endl;
else{
cout << a / (c - b) + 1 << endl;
}
}
| ALGO | 0.999904 | 3.766186 |
03211df3-ff45-491b-9efe-2c64fc281f17 | Thyme0113/astnn_with_semi-supervised_learning | ssl_1250/data/src/factorial/loop38.cpp | main(){long long n,i;cin>>n;for(i=n;--n;)i*=n;cout<<i<<"\n";}
| ALGO | 0.999905 | 3.574404 |
dff4c88c-02fb-4b5b-b978-674d2dd4f4c8 | jpzhao/exercise_c- | targer/condit.cpp | #include <iostream>
int main(){
using namespace std;
int a,b;
cout<<"Enter two integers: ";
cin>>a>>b;
cout<<"The larger of "<<a<<" and "<<b;
int c=a>b?a:b;
cout<<" is "<<c<<endl;
return 0;
} | ALGO | 0.986326 | 3.052155 |
ae0706ba-8963-4a8b-845a-bee6fcd799f5 | ishandutta2007/codeforces | dvdg6566/normal/1359/A.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define emp emplace
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ... | ALGO | 0.999723 | 3.796499 |
8c9dc92b-ccc8-4e69-87bc-0142b10ee62a | HRS05/Practice-Questions | 938-range-sum-of-bst/938-range-sum-of-bst.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.999992 | 6.583836 |
25d17a42-dc74-4a2c-9a1b-022e9b5dc1f9 | ishandutta2007/codeforces | felerius/normal/498/D.cpp | // Contest: 21 - Codeforces Rating >= 2200 (https://a2oj.com/ladder?ID=21)
// Problem: (49) Traffic Jams in the Land (Difficulty: 6) (http://codeforces.com/problemset/problem/498/D)
// region boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#incl... | ALGO | 0.999836 | 5.763171 |
7ec2548f-f6eb-42a2-90e1-f78348a9d7d5 | ishandutta2007/codeforces | nok0/normal/1495/D.cpp | #line 2 "/home/nok0/documents/programming/library/template/header.hpp"
#include <bits/stdc++.h>
#line 3 "/home/nok0/documents/programming/library/graph/graph.hpp"
#pragma region graph
template <class cost_type = long long>
class graph {
public:
struct edge {
public:
int from, to;
cost_type cost;
int id;
... | ALGO | 0.999126 | 4.269612 |
8a4f58db-3491-448d-af7a-0c63a2782b50 | StatixOS-Extended/android_frameworks_native | libs/binderdebug/BinderDebug.cpp | #include <android-base/logging.h>
#include <android-base/parseint.h>
#include <android-base/strings.h>
#include <binder/Binder.h>
#include <sys/types.h>
#include <fstream>
#include <regex>
#include <binderdebug/BinderDebug.h>
namespace android {
static std::string contextToString(BinderDebugContext context) {
sw... | TOOL | 0.866015 | 6.681052 |
71fff26c-25d4-4328-8290-232b84f390ba | alex-pann/IT_2sem | task_4/task_2 (ref+const).cpp | #include <iostream>
#include <numeric>
class frac{
public:
frac() {
this->a = 0;
this->b = 1;
}
frac(int a) : a(a), b(1) {};
frac(int a, int b) : a(a), b(b) {};
frac(const frac& another) {
this->a = another.a;
this->b = another.b;
}
~frac(){};
auto get_a... | TOOL | 0.956535 | 4.777576 |
5023b8e3-3a6b-4286-8861-dba0bc6708eb | ninad-moree/DataStructuresAlgorithms | Arrays/1291-SequentialDigits.cpp | /*
An integer has sequential digits if and only if each digit in the number is one more than the previous digit.
Return a sorted list of all the integers in the range [low, high] inclusive that have sequential digits.
Example 1:
Input: low = 100, high = 300
Output: [123,234]
*/
#include<bits/stdc+... | ALGO | 0.999941 | 6.522235 |
1f46ca9a-2dde-42a9-a106-4c9f584f0d16 | SohyeonKim-dev/AlgorithmicProblem-2nd | 08_SegmentTree/familyTree.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_N = 100000;
int n;
vector <int> child[MAX_N];
int no2serial[MAX_N];
int serialno2[MAX_N];
int locInTrip[MAX_N];
int depth[MAX_N];
int nextSerial;
void traverse(int here, int d, vector<int>& trip) {
no2serial[here] = next... | ALGO | 0.9999 | 4.133373 |
5a4208aa-e5e1-4dd4-8142-297a7895059f | ishandutta2007/codeforces | sd0061/normal/463/C.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cassert>
using namespace std;
typedef long long LL;
const int N = 2005;
int n , a[N][N];
LL R[N + N] , C[N + N];
vo... | ALGO | 0.999825 | 3.016006 |
4fcd2548-779a-47c6-92c8-fcf4a3791cd6 | phUR99/ps | 2025/02/악덕_영주_혜유.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define ll long long
int n, m;
vector<vector<pair<int, int>>> adj;
priority_queue<array<int, 3>> arr;
int parent[1005];
int find(int u)
{
if (u == parent[u])
return... | ALGO | 0.999961 | 4.215894 |
a6f65edb-cad3-4e6d-b6f8-3908ac5d9db4 | sagar98cyber/DSA_TUTORIAL | Binary Search/easyFindFirstAndLastPOsitionOfAnElementInASortedArray.cpp | #include <bits/stdc++.h>
using namespace std;
int left(vector<int> &nums, int target)
{
int low = 0, high = nums.size()-1;
int ans = -1;
while (low <= high)
{
int mid = low + ((high - low) / 2);
if (nums[mid] >= target)
{
ans = mid;
high = mid - 1;
... | ALGO | 0.999952 | 5.63773 |
35e8a82f-469a-4683-8e53-831754ca4c6e | PrithwishJana/CoTran | CodeGen/data/transcoder_evaluation_gfg/cpp/PADOVAN_SEQUENCE.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( int n ) {
int pPrevPrev = 1, pPrev = 1, pCurr = 1, pNext = 1;
for ( int i = 3;
i <= n;
i ++ ) {
pNext = pPrevPrev + pPrev;
pPrevPrev... | TEST | 0.999564 | 4.840659 |
65e0fd19-e09c-447d-8ac2-3af9b864b906 | jill817/Graph-cluster | src/lp_modeling/nia_ls.cpp | #include "sls_solver/model.h"
std::string date[5] = {"405", "505", "515", "527", "000"};
const int date_index = 4;
// std::string demand_path = "data_by_date/demand/demand_20230" + date[date_index];
// std::string integer_path = "data_by_date/sample/integer_sample_100000_20230" + date[date_index];
std::string demand_... | ALGO | 0.956805 | 4.148179 |
a47ae031-6a3e-4beb-8e5b-e92f2554b722 | aipowermeme/aipowermeme-node | src/util/message.cpp | #include <hash.h> // For CHashWriter
#include <key.h> // For CKey
#include <key_io.h> // For DecodeDestination()
#include <pubkey.h> // For CPubKey
#include <script/standard.h> // For CTxDestination, IsValidDestination(), PKHash
#include <serialize.h> // For SER_GETHASH
#i... | TOOL | 0.903499 | 6.848941 |
183d904f-2e42-486d-90b9-2568fe7fd22c | frawau/easyscan | 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 |
407e1eaa-7074-481c-9705-3a63ea34372d | shrivats2/dynamicProgramming | dp/LongestPalindromicSubsequence.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define yes cout << "YES"<< "\n";
#define no cout << "NO" << "\n";
#define fr(i, a, b) for(int i = a; i<b; i++)
#define vi vector<ll>
#define pb push_back
#define aa(l,n) ll l[n]; fr(i,0,n) cin>>l[i];
#define av(l, n) vector<ll> l(n); fr(i,0,n) cin>... | ALGO | 0.99997 | 4.996783 |
6ba48f97-8dac-43de-93fa-666390fff386 | manusmgowda007/HDA-With-datalogger | tree dsa/tree dsa/tree dsa.cpp | //#include<iostream>
//struct Node {
// int data;
// Node* left;
// Node* right;
//};
//Node* createnode(int dat)
//{
// Node* newnode = new Node();
// newnode->left = newnode->right = nullptr;
// newnode->data = dat;
// return newnode;
//}
////(data left right)
//void printnodepreorder(struct Node* root)
//{
// if (ro... | ALGO | 0.9999 | 4.113883 |
e157f9c3-c23e-42f5-b237-9f46d9305b37 | ishandutta2007/codeforces | potato167/normal/1392/E.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
using namespace std;
using std::cout;
using std::cin;
using std::endl;
using ll=long long;
using ld=long double;
ll ILL=1167167167167167167;
const int INF=2100000000;
const ll mod=1e9+7;
#define rep(i,a) for (int i=0;i<a;i++)
template<class T... | ALGO | 0.999147 | 3.341377 |
a6f9938b-4f95-4b24-adb6-d291b5640c99 | suraj101998/LeetCodeSolutions | 1900-1999/1974.Minimum Time to Type Word Using Special Typewriter/Solution.cpp | class Solution {
public:
int minTimeToType(string word) {
int ans = 0;
int prev = 0;
for (char& c : word) {
int curr = c - 'a';
int t = abs(prev - curr);
t = min(t, 26 - t);
ans += t + 1;
prev = curr;
}
return ans;
... | ALGO | 0.999957 | 6.099496 |
906aa4b5-d219-43b1-9fb4-8ce6ea8fb034 | Jakz/retrozip | src/cli/args.cpp | #include "args.h"
#include <algorithm>
#include <iostream>
#include "tbx/extra/fmt/format.h"
using namespace args;
Parser::Parser()
{
using cmd = cli::Command;
program = "rzip";
version = "0.1a";
copyright = "";
commands = {
{ cmd::LIST_CONTENTS, "l", "list contents of archive" },
{ cmd::TES... | TOOL | 0.943237 | 6.189599 |
f0c28605-1127-40fc-bcce-f9ab23bc9fee | aadits1965/CODEFORCES | LEVEL C/C_Alya_and_Permutation.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
cin.ignore();
while(t--){
long long n;
cin>>n;
if(n%2==0){
long long a=log2(n);
long long b=a+1;
cout<<pow(2,b)-1<<endl;
if(n==6){
cout<<"1 2... | ALGO | 0.999815 | 4.399949 |
00f7f5cb-0335-493c-a359-f0ded28edf68 | rikuTanide/atcoder_endeavor | arc022/arc022_2.cpp | #include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
using namespace std;
const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
... | ALGO | 0.999979 | 4.415519 |
3496d073-9c99-4b94-b2e8-3c216634c257 | craterface77/ucode_c_plus_plus_marathon | sp_03/t05/main.cpp | #include <iostream>
#include <string>
#include <vector>
#include "squareValue.h"
int main() {
std::vector<int> v3(10, 5);
squareValue(v3);
for (auto c : v3) {
std::cout << c << std::endl;
}
} | ALGO | 0.886666 | 3.392975 |
7e2ba5eb-1552-4475-a699-ecb8f95188a9 | chongtianfeiyu/cocos2dx-api-demo | cocos2dx_02_gui/MyCppGame/cocos2d/cocos/math/CCVertex.cpp | #include "math/CCVertex.h"
#include "base/ccMacros.h"
NS_CC_BEGIN
void ccVertexLineToPolygon(Vec2 *points, float stroke, Vec2 *vertices, unsigned int offset, unsigned int nuPoints)
{
nuPoints += offset;
if(nuPoints<=1) return;
stroke *= 0.5f;
unsigned int idx;
unsigned int nuPointsMinus = nuPoin... | ALGO | 0.994138 | 5.802056 |
f377770a-4332-40b8-a114-f25caf7eb91e | Vishal-Agarwal12/Competitive-programming-codes | 1492B.cpp | #include <bits/stdc++.h>
using namespace std;
char nl = '\n';
char sp = ' ';
using ll = long long;
using vb = vector<bool>;
using vl = vector<ll>;
using vvb = vector<vb>;
using vvl = vector<vl>;
using sl = unordered_set<ll>;
using tsl = set<ll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using mll = map<ll, l... | ALGO | 0.999811 | 5.487913 |
57592db2-44bb-47bc-9240-de8e9eaae0d1 | GlockMax/QDXDivide | Collision/Solid/COSph.cpp | /* CHANGED BY ALEX for use in NCManager */
#include "COSph.h"
#include "GEN_MinMax.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#define new DEBUG_NEW
#endif
MT_Scalar COSph::supportH(const MT_Vector3& v) const
{
return m_radius * v.length();
}
MT_Point3 COSph::support(const MT_Vector3& v) ... | ALGO | 0.994375 | 5.620584 |
634826c3-9b0e-4ec8-8d3f-88495e188930 | renbaoshuo/OI-codes | Luogu/P6102/P6102.cpp | #include <bits/stdc++.h>
using namespace std;
int n, x, y, xs, ys, sum;
unsigned int ans, a[500005];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
sum = n * n;
for (int i = 0; i < 32; i++) {
x = y = xs = ys = 0;
for (int j = 1; j <= n; j++) {
... | ALGO | 0.999661 | 3.899546 |
a8765623-2607-4ee5-99c4-29897c30b2f9 | zhushaoben/training | 2020寒假训练/AtCoder Beginner Contest 155/D.Pairs.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
typedef long long LL;
int a[N],b[N];
LL k,s1,s2,s3;
bool check(LL x){
LL ans=0;
if(x>=0){
ans+=s3*(s1+s2)+s3*(s3-1)/2+s1*s2;
int r=s1-1;
for(int i=0;i<r;i++){
while(1ll*a[i]*a[r]>x)r--;
if(i>=r)break;
ans+=r-i;
}
r=s2-1;
for(int i=0... | ALGO | 0.999991 | 3.956402 |
22d8a0f3-476a-4f82-a057-dc3a6f86963e | cthildreth/202 | Source/Ch09/09-08.cpp | //Test for palindrome property.
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
void swap(char& v1, char& v2);
//Interchanges the values of v1 and v2.
string reverse(const string& s);
//Returns a copy of s but with characters in reverse order.
string removePunct(const string& s, const st... | ALGO | 0.993421 | 5.894041 |
0485419a-f113-4456-983f-98f5aa7c4294 | greenbeanpie/OI-training | NOIP2023-ZJ/ZJ-0116/tribool/tribool.cpp | #include<bits/stdc++.h>
using namespace std;
const int TRUE_VALUE=100001;
const int FALSE_VALUE=-TRUE_VALUE;
const int UNKNOWN_VALUE=0;
int n,m;
/*
* FALSE_VALUE 表示 false
* TRUE_VALUE 表示 true
* UNKNOWN_VALUE 表示 unknown
* x > 0 表示 w[x]
* x < 0 表示 !w[x]
*/
int v[100001];
int _fa[200010],*fa=_fa+100005;
int find(... | ALGO | 0.999709 | 4.325947 |
ef0ffc31-30f8-43ed-b213-9f23bf9c2fc3 | HilarioNengareJr/Object-Oriented-Programming | BS/Main.cpp | #include <iostream>
#include "Binary.h"
int main() {
/*
declare 2 Binary String Objects and a result variable to hold
the sum value
*/
Binary object, object1, result;
int N = 5;
int M = 10;
// implicitly declare 2 objects
object = N;
obj... | ALGO | 0.985427 | 5.634367 |
7901d836-1e40-4380-abe8-fd9a1cb06685 | nish235/C-CppAssignments | Sept18/043sGreater5s.cpp | #include<iostream>
using namespace std;
int check(int num[], int arr)
{
int n3=0,n5=0;
for(int i=0;i<arr;i++)
{
if(num[i]== 3)
{
n3++;
}
if(num[i]==5)
{
n5++;
}
}
return n3>n5;
}
int main()
{
int arr;
int arr1[]={1, 5,... | ALGO | 0.998937 | 4.234856 |
72afeddc-b88e-4402-a368-1a989bff2fb6 | tinhangchui/EE451_Proj_Viterbi | parallel_viterbi.cpp | #include <iostream>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <cstring>
#include <omp.h>
#include <algorithm>
#include "parallel_viterbi.h"
/****************************
Parallel Viterbi Algorithm using Linear Tropical Dynamic Programming
****************************/
LTDPViterbi::LTDPViterbi(co... | ALGO | 0.999947 | 5.247016 |
0e8e592b-9dcc-4eff-9e4b-a34ef6402f89 | 3dv-casia/LSLM_VLoc | ConstructLineMap/limap/third-party/libigl/include/igl/copyleft/cgal/projected_cdt.cpp | template <typename Kernel, typename Index>
IGL_INLINE void igl::copyleft::cgal::projected_cdt(
const std::vector<CGAL::Object> & objects,
const CGAL::Plane_3<Kernel> & P,
std::vector<CGAL::Point_3<Kernel> >& vertices,
std::vector<std::vector<Index> >& faces)
{
typedef CGAL::Triangulation_vertex_base_2<Kernel>... | ALGO | 0.972715 | 6.120453 |
a16a50e5-f8f6-4bef-8f10-8785b5efcc60 | melina-delgado/CS427 | hw3/resubmit/conway.cpp | /*
* CS427 Assignment 3
*
* Author: Melina Delgado
* Date: 9/27 11:59pm
*
* conway.cpp
*/
#include "conway.h"
#include <string>
#include <iostream>
#include <sstream>
using std::ostream;
using std::istream;
using std::string;
using std::ostringstream;
using std::endl;
using std::getline;
using std::istringstre... | ALGO | 0.975446 | 5.07791 |
34bcaeaa-81bf-476f-a2dc-c5be26b8a585 | mortie/llvm-axa-backend | libcxx/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end.pass.cpp | // <algorithm>
// template<ForwardIterator Iter1, ForwardIterator Iter2>
// requires HasEqualTo<Iter1::value_type, Iter2::value_type>
// constexpr Iter1 // constexpr after C++17
// find_end(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
... | TEST | 0.970267 | 6.534009 |
e410b6b8-4a99-461f-b568-777356ff4b89 | NaviHX/bupt-tour | src/Tour.cpp | /*
* Copyright © 2021 BUPT-Tour. All rights reserved.
* @author : Navi.HuangXing
* @date : 2021-03-07
* @file : Tour.cpp
* @description :
*/
#include "Tour.h"
#include <fstream>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <cmath>
#include "Bus.h"
#define IN... | ALGO | 0.997857 | 3.918878 |
9a254026-e9de-40ff-aa82-23ebda5e2a3d | julianadesouzamartins/caesegato | 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.998757 | 6.771107 |
f27dc48e-dea6-4500-9c48-c866bfa828a6 | Aditya9395/all-projects | stl program/Program320.cpp | #include<iostream>
using namespace std;
template <class T>
struct node
{
T data;
struct node *next;
};
template <class T>
class SinglyLL
{
public:
struct node<T> * First;
int iCount;
SinglyLL();
void InsertFirst(T no);
void InsertLast(T no);
void InsertAtPos... | ALGO | 0.9928 | 4.154729 |
160a19dd-4744-4b9b-8bdc-63b0f5ccdfcb | omkarponde/Competitive-Programming | TopicsAndCodes/NumberTheory/SieveOfEratosthenes/Finding_the_Kth_Prime.cpp | // Problem Link : https://www.spoj.com/problems/TDKPRIME/
// Implementation of Sieve of Eratosthenes
#include<bits/stdc++.h>
using namespace std;
void solve(vector<int>& arr)
{
const int N = 90000000 ; // N = 9 * 1e7 because if x prime numbers are present in n/ln(n).
bitset<N> primes; // Use bitset for memo... | ALGO | 0.99949 | 4.195789 |
401a32dd-ab78-4478-b027-143e302f5e64 | welidemezene/CSEC-problem-solved | A_Buy_a_Shovel.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// Optimize I/O performance
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int k,r;
cin>>k>>r;
for(int i=1; i<=10; i++){
int total = i*k;
if(total%10==0||total%10==r){
cout<<i;
return 0;
... | ALGO | 0.999284 | 3.489851 |
b862e69f-f05e-4a86-a4b9-66c90723b5e0 | raincross7/code-similarity | codes/train_code/problem321/problem321_45.cpp | #include <iostream>
#include <stdio.h>
#define MAX_N 2000
#define MOD 1'000'000'007
typedef long long ll;
using namespace std;
int A[MAX_N];
int main() {
ll N, K;
cin >> N >> K;
for (ll i = 0; i < N; ++i) {
cin >> A[i];
}
ll res = 0;
for (ll i = 0; i < N - 1; ++i) {
ll _cnt = 0;
ll cnt = 0;... | ALGO | 0.999965 | 4.035477 |
59d483a9-09a5-4424-9c79-58aecc839fc7 | ishandutta2007/codeforces | ishandutta2007/normal/197/A.cpp | /****************************************************************
Author : Ishan Dutta
Email : <EMAIL>
Facebook account : https://www.facebook.com/ishan.dutta
Blog : tessellationsoftechnology.wordpress.com
Topcoder Handle : Ishandutta2007
Codeforces Handle: ishandutta2007
Codechef User... | ALGO | 0.999699 | 3.253485 |
7501c105-e824-44bb-b910-a6ca1d94da3a | chamodlw/bottom_nav_bar | 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 |
d1304e96-2a51-40f8-b32c-6aaf3438a87a | kucars/touch-grasping-pipeline | objectrecognition/src/upsampling.cpp |
#include "objectrecognition/models.h"
#include "objectrecognition_sv/object_model.h"
#include <pcl/io/pcd_io.h>
//#include <pcl/io/ply_io.h>
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <sstream>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>... | DATA | 0.949992 | 4.745596 |
9414b3d9-236c-40a9-af83-bf6bc9012041 | advayaggarwal/Data-Structures-Algorithms | Number Theory/prime_factorization.cpp | /*
AUTHOR: ADVAY AGGARWAL
INSTITUTION: IIIT DHARWAD
*/
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007 //1e9+7 ans%mod
#define ll long long int
#define test_cases(x) int x; cin>>x; while(x--)
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define endl "\n"
const int N ... | ALGO | 0.999935 | 4.340717 |
32156c39-2449-4406-92b3-62f4d890f122 | khushidhir3/Codeforces-problems | Beautiful Matrix2.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main(){
int a[5][5],x,y;
for(int i=0;i<5;i++){
for(int j=0;j<5;j++){
cin>>a[i][j];
if(a[i][j]==1){
x=i;
y=j;
}
}
}
int m=abs(x-2)+abs(y-2);
cout<<m<<endl;
}... | ALGO | 0.999807 | 3.325161 |
c5660e45-9b5a-4d78-8d7c-75bb389689f3 | sbci-brain/ConCon_Alignment | scripts/interpolation/bary_interp_2D_mex.cpp | #include "mex.h"
#include "matrix.h"
#include <iostream>
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
const mxDouble * lh_points = mxGetDoubles(prhs[0]);
const mxDouble * rh_points = mxGetDoubles(prhs[1]);
const mxInt64 * lh_faces = mxGetInt64s(prhs[2]);
const mxInt6... | ALGO | 0.993279 | 6.406476 |
369113e4-6853-424a-ba46-3e365e7707ae | hussainsajib/OOP345_NoteCodes | Chapter 17 - Raw Pointers/pointerSubtraction.cpp | // Pointer Subtraction
// pointerSubtraction.cpp
#include <iostream>
#include <cstddef>
int main(){
int a[] = { 1, 2, 3, 4, 5 }, i = 2, *p, *r;
ptrdiff_t k;
p = &a[4];
r = &a[0];
k = p - r;
std::cout << *(p - i) << std::endl;
std::cout << k << std::endl;
return 0;
} | ALGO | 0.998769 | 3.996906 |
dd5a97a5-9c64-43a2-b09e-c4313a925edc | DangerousCactus/BOJ | Card_Game_Contest.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main() {
cin.tie(0)->sync_with_stdio(0);
int n, m;
cin >> n >> m;
int a... | ALGO | 0.999983 | 4.682393 |
e35187fb-11b7-41db-a37c-a08025d3145c | ishandutta2007/codeforces | .tx/normal/799/A.cpp | #include <bits/stdc++.h>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;
#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hbit(n, i) (((n) >> (i)) & 1)
#define STRESS 0
using lint = long long;
void so... | ALGO | 0.9999 | 3.816147 |
0f635d52-49dd-40fc-a478-e8ebc143e1cd | sakoguchi/pba-sakoguchi | task07/main.cpp | /**
* @file task07: Dirichlet's Energy Minimization with Gauss-Seidel Method
*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <cassert>
#include <random>
#define GL_SILENCE_DEPRECATION
#include <GLFW/glfw3.h>
#include <Eigen/Dense>
#include "../src/pba_util_glfw.h"
#include "..... | ALGO | 0.99966 | 6.280385 |
3569b41c-5ba3-4c00-9802-f64f58615a4d | YeKYLI/leetcode | 待整理/leetcode-0.2.0/solution/2700-2799/2782.Number of Unique Categories/Solution.cpp | /**
* Definition for a category handler.
* class CategoryHandler {
* public:
* CategoryHandler(vector<int> categories);
* bool haveSameCategory(int a, int b);
* };
*/
class Solution {
public:
int numberOfCategories(int n, CategoryHandler* categoryHandler) {
vector<int> p(n);
iota(p.be... | ALGO | 0.999189 | 5.894104 |
05055e0e-4dae-498c-ab3d-0cdfdb490273 | Malarz12/MIMUW | 3 sem/asd/lab06/main.cpp | #include <iostream>
#include <algorithm>
using namespace std;
struct AVLNode {
int val;
int count;
int height;
int subtreeSize;
AVLNode* left;
AVLNode* right;
AVLNode(int _val, int _count) : val(_val), count(_count), height(1), subtreeSize(_count), left(nullptr), right(nullptr) {}
};
inli... | ALGO | 0.999926 | 5.010308 |
29742491-d3da-492d-b71c-ca7a1e5ea919 | goropikari/CompetitiveProgramming | atcoder/abc389/b.cpp | /*https://atcoder.jp/contests/abc389/tasks/abc389_b*/
/*2025年01月18日 21時02分17秒*/
// #include <atcoder/all>
// using namespace atcoder;
// using mint = modint998244353;
// using mint = modint1000000007;
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i, ... | ALGO | 0.999959 | 4.067467 |
95a76091-6c45-450d-bfbf-42b3a4893dad | vedant3598/LeetCode-Problems | src/house-robber.cpp | class Solution {
public:
int rob(vector<int>& nums) {
vector<int> memo;
// In DP problems, you want to have two elements in a dp or memo vector (or array) before recursing or iterating
memo.push_back(0);
memo.push_back(nums[0]);
for(int i = 1; i < nums.size(); i++){
... | ALGO | 0.999809 | 6.411438 |
00a57ae4-ae88-4696-96fb-d1d1f445f55c | Ryb7532/AtCoder | submissions/abc186/a.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define vec vector
#define rep(i,n) for (int i=0; i<(n); i++)
#define print(a) cout << a << endl
#define fix(n) fixed << setprecision(n)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define Yes "Yes"
#d... | ALGO | 0.999356 | 4.089346 |
14c24b5b-8fb2-40bf-a476-d0d27d928efa | germanohn/competitive-programming | codeforces/401/c.cpp | #include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int n, m;
char s[2000005];
int main () {
scanf(" %d %d", &n, &m);
if (n - m > 1 || 2 * n + 2 < m) {
printf("-1\n");
return 0;
}
int p... | ALGO | 0.999922 | 3.402927 |
6a37e27d-29a5-4110-b848-55e0fd2af41e | tanvirmirza/cpp-code | DSAPractice/Recursion/arraysum.cpp | #include<iostream>
using namespace std;
int getSum(int arr[], int size){
if(size == 0)
return 0;
if(size == 1)
return arr[0];
int remainingPart = getSum(arr + 1, size-1);
int sum = arr[0] + remainingPart;
return sum;
}
int main() {
int arr[3] = {10, 20, 30};
int... | ALGO | 0.999827 | 5.301107 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.