uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0ca66951-881e-46ad-944c-363a05fe15d4 | ironwaste/acm | codeforce/edu/edu177/e.cpp | // 看什么看,以为我厉害吗?
// 我只是戾气很重,不厉害只需要114514分钟就能变厉害了
// 而你我的朋友只需要2.5年就可以了
#include<bits/stdc++.h>
#include<climits>
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define i64 long long
#define fi first
#define se second
#define endl '\n'
#define mod3 998244353
#define mod7 1000000007
#define de(x) cerr << #x ... | ALGO | 0.999788 | 4.335556 |
58c984c1-a886-467e-8053-80fc8ced84e3 | tjgolubi/boost | libs/math/example/policy_ref_snip11.cpp | // Note that this file contains quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
#include <iostream>
using std::cout; using std::endl;
// Setting (approximate) precision 25 bits in a single function call using make_policy.
//[policy_ref_snip11
#include <boost/math... | ALGO | 0.993936 | 4.541284 |
3d6d46df-a6ea-4a27-bc2d-3796cfa462f8 | Phantom-liu/algorithm-studying | 动态规划DP/Coin change(dp).cpp | #include<bits/stdc++.h>
using namespace std;
int least(int now,int cnt)
{
if (now < 0)return 1e5;
if (now == 0)return cnt;
return min(min(least(now - 5, cnt + 1), least(now - 7, cnt + 1)),least(now - 2, cnt + 1));
}
int main()
{
int m;
cin >> m;
clock_t start = clock();
cout << least(m, 0)<<"\n";
clock_t end = ... | ALGO | 0.99983 | 3.70238 |
f5f6d4d3-11cd-453d-9732-dbdbb9aa1c29 | code229/online_judge_code | B. Fence.cpp |
//بسم الله الرحمن الرحيم
//الله أكبر
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
... | ALGO | 0.999981 | 3.774844 |
ea6d1148-4dff-4b18-90d4-3e7d8b0d41e4 | torquerxf/Algo-stuffs | Problems/PatternProblem1.cpp | #include <bits/stdc++.h>
using namespace std;
void solution(){
int n,m;cin>>n>>m;
for (int i = 0; i < 3*n+1; i++)
{
for (int j = 0; j < 3*m+1; j++)
{
if(i%3==0 || j%3==0){
cout<<"*";
}
else cout<<".";
}
cout<<endl;
}
... | ALGO | 0.998916 | 3.466964 |
f341c406-5f40-4bda-9a0c-4e1e85a99d96 | bitcoinbam/btcbam | src/rpc/mining.cpp | #include <amount.h>
#include <chain.h>
#include <chainparams.h>
#include <consensus/consensus.h>
#include <consensus/params.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <validation.h>
#include <key_io.h>
#include <miner.h>
#include <net.h>
#include <policy/fees.h>
#include <pow.h>
#include <rpc/bl... | WEB | 0.991021 | 6.608153 |
1c90ec6e-d9be-4769-8b92-c5ef6d4fab4a | koosaga/olympiad | USACO/open18_train.cpp | #include <algorithm>
#include <iostream>
#include <queue>
#include <cassert>
#include <cstring>
using namespace std;
using lint = long long;
using pi = pair<int, int>;
const int B = 1000;
#include "grader.h"
/*
namespace ggwp{
int n, k, ds[5500];
int a[1010101];
int ptr, pass;
int ptr2;
priority_queue<pi, vector<... | ALGO | 0.998667 | 3.427431 |
09296cdc-14b0-45ac-91c7-39cd23e6a164 | ahmednasser111/Codeforces | 268B.cpp | // Queue at the School
#include <bits\stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
int n, t;
string s;
scanf("%d %d", &n, &t);
cin >> s;
for (int j = 0; j < t; j++)
{
for (int i = 0; i < n - 1; i++)
{
if (s[i] == 'B' && s[i + 1] == 'G')
{
s[i] = 'G';
... | ALGO | 0.999846 | 3.762703 |
6c53a5c9-6a92-4e20-9279-a50cc1d324ec | aryangupta02092002/AugustChallenge2023 | GFG/SubarrayWithGivenSum.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find a continuous sub-array which adds up to a given number.
vector<int> subarraySum(vector<int>arr, int n, long long s)
{
// Your code here
int start = 0, e... | ALGO | 0.999398 | 5.606833 |
d293a3b6-e4a8-429d-9c3c-4ba171f60978 | BigJohnn/ModelIt | deps/geogram/include/geogram/third_party/amgcl/tutorial/4.Stokes/stokes_ucube.cpp | #include <iostream>
#include <string>
#include <amgcl/backend/builtin.hpp>
#include <amgcl/adapter/crs_tuple.hpp>
#include <amgcl/value_type/static_matrix.hpp>
#include <amgcl/adapter/block_matrix.hpp>
#include <amgcl/preconditioner/schur_pressure_correction.hpp>
#include <amgcl/make_solver.hpp>
#include <amgcl/make_b... | ALGO | 0.998772 | 5.155244 |
556174d1-9f5b-4090-bf15-fcc70b1ae16e | haozihong/leetcode-zh | archive/ks_2020_F_3_PaintersDuel.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
// #define sz(x) (int)(x).size()
#define fi first
#define se second
using vi = vector<int>;
using ll = long long;
using pii = pair<int, int>;
constexpr int MXN = 6;
int N, S, RA, PA, RB, PB, Cn;
unordered_map<ll, signed char> dp[MXN][MXN... | ALGO | 0.999361 | 3.795952 |
b680a92d-4d60-4ba2-9ed0-a185acd47536 | trinayreddy4/ATCODER | abc50a.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
char op;
cin>>a>>op>>b;
if(op=='+')
{
cout<<a+b<<endl;
}
else
{
cout<<a-b<<endl;
}
}
| ALGO | 0.999813 | 3.928972 |
20df7594-4a89-4948-9e28-9b6b2b49616f | varshhhy7/wayne-GFG | Difficulty: Hard/The Painter's Partition Problem-II/the-painters-partition-problem-ii.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
int minTime(vector<int>& arr, int k) {
int start=0,end=0,mid,ans;
for(int i=0; i<arr.size();i++){
start=max(start,arr[i]);
... | ALGO | 0.999555 | 6.13748 |
5b1f2d56-1aee-443d-9d55-eae640bc9eba | NKI-CCB/bcm3 | src/stats/GMM.cpp | #include "Utils.h"
#include "checks.h"
#include "GMM.h"
#include "mvn.h"
namespace bcm3 {
GMM::GMM()
: full_logl(std::numeric_limits<Real>::quiet_NaN())
, aic(std::numeric_limits<Real>::quiet_NaN())
{
}
bool GMM::Set(const std::vector<VectorReal>& means, const std::vector<MatrixReal>& covariances, VectorReal... | ALGO | 0.999022 | 6.375159 |
1664eef0-aa87-4b24-b88f-50a609c89423 | manoj-ayyappan/DSA | modular.cpp | // practice for a modular program
// code to take length and breadth from user and display area and perimeter
#include<stdio.h>
#include<iostream>
using namespace std;
// processing is done outside the main function
int area(int length, int breadth) {
return length*breadth;
}
int peri(int length, int breadth) {... | TOOL | 0.85333 | 3.865283 |
26db8746-7bea-4197-8565-c3bfb3334615 | vladdavid98/learning | PDP Learning/C++/Polynom Multiplication/Polynom Multiplication.cpp | #include <iostream>
#include <thread>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
vector<pair<int, int>> splitWork(int n, int t)
{
vector<pair<int, int>> intervals;
int index = 0;
int step = n / t;
int mod = n % t;
while (index < n)
{
intervals.emplace_back(index, index + step +... | ALGO | 0.999895 | 3.517613 |
dc891c34-e2c9-4e1e-84e2-22aa03e0663e | ishandutta2007/codeforces | 18michael/normal/1285/F.cpp | #include<bits/stdc++.h>
#define Mx 100000
#define LL long long
using namespace std;
int n,st_t=0,p_t=0,res;LL ans=1;
int a[100002],cnt[100002],st[100002],mu[100002],p[100002],mnp[100002];
bool u[100002];
vector<int> vec[100002];
inline void init()
{
mu[1]=1;
for(int i=2;i<=Mx;++i)
{
if(!mnp[i])p[++p_t]=i,mu[i]=-1;... | ALGO | 0.99998 | 3.789924 |
f0ed093b-e58c-4541-b86b-a6f7959a1df2 | luobuyu/Code-test-daily | leetcode/daily/2451.cpp | // #pragma GCC optimize(2)
#include <bits/stdc++.h>
#include "head.h"
#define ll long long
#define lll long long
#define PII pair<int, int>
namespace FAST_IO
{
inline char nextChar()
{
static char buf[1000000], *p1 = buf, *p2 = buf;
return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, s... | ALGO | 0.999962 | 4.674571 |
d3112655-67fb-493f-aef3-a19dcb3ccfda | Nih1tGupta/Leetcode-GFG | Difficulty: Easy/K-Pangrams/kpangrams.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool kPangram(string str, int k) {
// code here
int mp[26]={0};
int len=0;int count=0;
for(int i=0;i<str.length();i++){
if(str[i]!=' '){mp[str[i]-'a']++... | ALGO | 0.998143 | 5.402696 |
cb8d16c8-57e7-4777-84ed-0b193451b17b | IcanChen/Icangit | SwordOffer/ReconstructBinaryTree/main.cpp | /* +---------------------------------------------------------------------------+
| File:main.cpp |
| Authors:Ican chen E-mail:<EMAIL> |
| Date:2015/11/16 |
| Describe... | ALGO | 0.99988 | 4.827961 |
68d32f6b-3fde-4919-9b7f-12e252bb57bf | Wool-yang/My-C-Code | ACwing/DataStructure/Stack/MonotonousStack.cpp | #include <iostream>
using namespace std;
const int N = 1e5 + 10;
int st[N], tt = 0;
int main()
{
int x, m;
cin >> m;
for (int i = 0; i < m; i++)
{
cin >> x;
while (tt && st[tt] >= x)
tt--;
if (tt)
cout << st[tt];
else
cout << -1;
... | ALGO | 0.999958 | 4.089721 |
23ded3fa-f46b-4486-9139-2eaf1e43e90f | Anurag-daundkar/LoveBabbar-Lecture-Codes-Continued | Lecture 065 Binary Tree FAANG Interview Questions Part-3/Sum of Longest BloodLine/Sir_Approach.cpp | // Sum of nodes on the longest path
// Difficulty: MediumAccuracy: 52.39%Submissions: 123K+Points: 4
// Given a binary tree root[], you need to find the sum of the nodes on the longest path from the root to any leaf node. If two or more paths have the same length, the path with the maximum sum of node values should be ... | ALGO | 0.999982 | 5.770132 |
41f4ffc4-0ffa-4cf0-892f-83e486890041 | ian-colon6/Advanced-Prog.-Labs | Adv_Prog_labs/lab4/lab4_part2.cpp | #include <string>
#include <cmath>
class Triangle {
private:
Point2D *p1;
Point2D *p2;
Point2D *p3;
public:
/*
* Constructs a Triangle object with the given parameters
*/
Triangle(Point2D *p1, Point2D *p2, Point2D *p3) {
this->p1 = p1;
... | ALGO | 0.898432 | 5.296103 |
51a55938-c8cd-4915-8cde-35fb360c6f6f | Lakshmivallala/Understanding-CPP-and-More | 0C++Fundamentals/Queues/1Array.cpp | #include<iostream>
#include<climits>
using namespace std;
/*
O/p:
20 enqueue into queue
50 enqueue into queue
45 enqueue into queue
30 enqueue into queue
15 enqueue into queue
Dequeued: 20
Front item: 50
Rear item: 15
*/
// Insertion, enque: O(1)
// deletion,deque : O(1)
// front : O(1)
// rear : O(1)
//Space compl... | ALGO | 0.997301 | 4.892922 |
779ded5e-1c1e-4b35-bbac-d87ad1725b04 | syhu0630/nchu_algorithm | Tabu Search/main.cpp | #include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include "Ts.h"
using namespace std;
int main(int argc, char *argv[]){
int bits = stoi(argv[1]);
int iter = stoi(argv[2]);
int size = 10;
int cost = 0, index = 0, count = 0, max = 0;
time_t start, end;
srand (time(NULL));
T... | ALGO | 0.99973 | 3.916751 |
fd438882-6ea3-4c12-bb91-c44bfddaff97 | SH-Broar/PSParty | algorithm/17071.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
int main()
{
cin.tie(NULL);
cout.tie(NULL);
cin.sync_with_stdio(false);
int a, b;
cin >> a >> b;
queue<pair<int,int>> crow;
vector<int> OddZone;
vector<int> EvenZone;
OddZone.resize(500001, -1);
EvenZone.resize(500001, -1);
crow.p... | ALGO | 0.999994 | 3.945872 |
745b5e25-1e65-4e72-8dcd-c71485a664f5 | Jackarain/avpn | third_party/boost/libs/hana/example/map/map.cpp | #include <boost/hana/assert.hpp>
#include <boost/hana/at_key.hpp>
#include <boost/hana/contains.hpp>
#include <boost/hana/map.hpp>
#include <boost/hana/pair.hpp>
#include <boost/hana/string.hpp>
#include <functional>
#include <string>
#include <vector>
namespace hana = boost::hana;
template <typename ...Events>
struc... | TEST | 0.858132 | 6.747247 |
13da5a9b-5433-4ad3-a6cf-538e2ee1328b | shubhammshubs/stackoverflow_login_api | 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.9988 | 6.76073 |
17cc1ce0-7443-45eb-9dda-bc8f6264cde4 | sikuner/book-code | 3rdparty/cryptopp565/dh2.cpp | // dh2.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "dh2.h"
NAMESPACE_BEGIN(CryptoPP)
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
void DH2_TestInstantiations()
{
DH2 dh(*(SimpleKeyAgreementDomain*)NULL);
}
#endif
bool DH2::Agree(byte *agreedValue,
const byte ... | ALGO | 0.928497 | 6.232456 |
49333c70-8d5b-4513-8c1f-3e7005d65fc8 | Syedasif101/DataStructure_CPP | InsertAtEnd.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int val)
{
data = val;
next = NULL;
}
};
void insertAtTail(Node *&head, int val)
{
Node *n = new Node(val);
if (head == NULL)
{
head = n;
return;
}
Node *te... | ALGO | 0.99947 | 4.555566 |
c7fc6d9f-c696-45a2-8e42-6d54152dbba1 | miguelps/OpenCV.xcframework | modules/imgproc/src/spatialgradient.cpp | #include "precomp.hpp"
#include "opencv2/core/hal/intrin.hpp"
#include <iostream>
namespace cv
{
/* NOTE:
*
* Sobel-x: -1 0 1
* -2 0 2
* -1 0 1
*
* Sobel-y: -1 -2 -1
* 0 0 0
* 1 2 1
*/
template <typename T>
static inline void spatialGradientKernel( T& vx, T& vy... | ALGO | 0.996456 | 6.386929 |
5af6df0d-79af-43fd-9baa-b4636a12eb7a | petermatts/Learning | Crypto/Crypto-Research/C++/DataStructures/Node.cpp | #include <iostream>
using namespace std;
typedef int T;
class Node {
public:
Node(T x) : val(x), Next(0) {}
T value() const { return val; }
Node* next() { return Next; }
void link(Node *p) { Next = p; }
private:
T val;
Node* Next;
};
| ALGO | 0.99833 | 3.617733 |
064fd6f9-c7c4-46bd-92bd-f3c64be33bb5 | EthanKim8683/High-School-Competitive-Programming | Codeforces/Problemset/Graphs/1552d.cpp | #include<iostream>
#include<cstdio>
using namespace std;
using I=int;
using B=bool;
const I N=10;
I a_arr[N];
I sum=0,cnt=0;
B res=0;
I n;
void dfs(I d){
if(d==n){
if(!sum&&cnt)res=1;
return;
}
for(I i=-1;i<=1;i++){
sum+=i*a_arr[d];
cnt+=!!i;
dfs(d+1);
sum-=i*a_arr[d];
cnt-=!!i;
... | ALGO | 0.999467 | 3.653237 |
0c1c5f1b-02e8-4d91-9f35-0fc1c0d761ba | tmwilliamlin168/CompetitiveProgramming | USACO/Contests/1819_1P/Gathering.cpp | #include <bits/stdc++.h>
using namespace std;
const int mxN=1e5;
int n, m, ui, vi, anc[mxN][17], dt, ds[mxN], de[mxN], gu[mxN], gd[mxN+1], ai, bi;
vector<int> adj1[mxN], adj2[mxN];
bool vis[mxN], act[mxN], fk, a1[mxN];
void dfs1(int u=0, int p=-1) {
ds[u]=dt++;
anc[u][0]=p==-1?-1:p;
for(int i=1; i<17; ++i)
anc[u... | ALGO | 0.999969 | 4.379448 |
2457b196-2479-468f-8309-679837bc857a | NandiSoham/Leetcode-POTD-Daily-Coding-Challenge | Year 2024/07_July/day10_1598. Crawler Log Folder.cpp | // Problem Link -> https://leetcode.com/problems/crawler-log-folder/description/
// ------------------------------- Approach - 1 ------------------------------
class Solution {
public:
int minOperations(vector<string>& logs) {
stack<string> depthStack;
for (string& log : logs) {
if (l... | ALGO | 0.994292 | 5.909211 |
c3545f17-7107-4af1-9308-0205b5ed715a | niloy1hasan/Codeforces-Problem-solve | ICPC Assiut University/contest_3/F_Front_End.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
vector<long long> arr;
long long a;
for(int i=0; i<n; i++){
cin >> a;
arr.push_back(a);
}
int i = 0, j=arr.size()-1;
if(j%2==0){
while(i<j){
cout << arr[i+... | ALGO | 0.999923 | 3.328424 |
4a7f1fdd-480d-4ac9-a271-4b0a999d253d | saptarshisarkar20/Hacktoberfest2023 | Pull Here/CodeChef/SHROUTE/sroute.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007
#define m(x) int x;cin>>x;while(x--)
void solve(){
int i;
int n,m; cin>>n>>m;
int a[n];
int b[m];
for (i=0;i<n;i++) {
cin>>a[i];}
for(i=0;i<m;i++){
cin>>b[i];}
... | ALGO | 0.999971 | 3.995481 |
eb7c04d8-17f2-4c68-bd8d-742827bf155d | Yawn-Sean/Daily_CF_Problems | daily_problems/2025/05/0521/personal_submission/cf275b_dinghc.cpp | #include <bits/stdc++.h>
using namespace std;
constexpr int S = 50;
char grid[S + 1][S + 1];
int n, m;
bool solve() {
vector<pair<int, int>> rows(n, make_pair(-1, -1));
vector<pair<int, int>> cols(m, make_pair(-1, -1));
for (int i = 0; i < n; i++) {
auto& [l, r] = rows[i];
for (int j = 0; ... | ALGO | 0.999913 | 5.044662 |
88f10644-9b06-4543-8e08-9c6468008d65 | Feng1983/codeforces | 818div2/D.cpp | #include<bits/stdc++.h>
using namespace std;
constexpr int P = 1e9+7;
using i64 = long long;
int norm(int x){
if(x <0){
x+=P;
}
if(x>=P){
x-=P;
}
return x;
}
template<class T>
T power(T a, i64 b){
T res =1;
for(;b;b/=2, a*=a){
if(b%2){
res*=a;
}
}
return res;
}
struct Z {
in... | ALGO | 0.999945 | 4.740675 |
429b3d73-f48e-4fca-b177-4ec4f233a2e8 | atharvarakshak/competitivecoding | lineTrip.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,t;
cin>>t;
while(t--){
int x,k,m=0;
cin>>n>>x;
vector<int> a(n);
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int p=0;
p=a[0];
m=p;
fo... | ALGO | 0.999915 | 3.893633 |
0f78b798-a9f5-45c6-afc1-eaee50b08e09 | IvanDrf/Vector-Int | Vector.cpp | #include "Vector.hpp"
#include <exception>
#include <limits>
namespace {
const size_t kDefaultSize{8};
const size_t kGrowFactor{2};
} // namespace
namespace {
void QuickSort(Vector& vector, size_t left, size_t right) {
if (left >= right || vector.Empty()) {
return;
}
int pivot{vector[(left + ri... | TOOL | 0.955941 | 5.742983 |
b31c9b59-715e-4ca5-b90a-9d4c35c9b8f2 | yakode/CandCPP-practice | LeetCode/0054_Spiral-Matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
const int m = matrix.size(); // how many row
const int n = matrix[0].size(); // how many column
const int cnt = m * n;
vector<int> ans(m * n);
int x = 0, y = 0;
for(int i = 0, j = 0; j <... | ALGO | 0.999996 | 6.42382 |
014317f3-33d4-4e78-b7aa-e59739812a55 | reynaldineo/ITS-Struktur-Data | .praktikum/modul-2/STD/revisi/std-1.cpp | #include <stdlib.h>
#include <stdbool.h>
#include <string.h>
// #include <stdio.h>
#include <iostream>
using namespace std;
/**
* Node structure and
* uniqueBST structure
*/
typedef struct bstnode_t {
int key, stamina;
struct bstnode_t
*left, *right;
} BSTNode;
typedef struct bst_t {
BSTNode... | ALGO | 0.999891 | 4.028539 |
52d1cba6-ded5-4dda-80c6-c168d774d18c | ishandutta2007/codeforces | ormlis/normal/1025/F.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
#define rep1n(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = (n) - 1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(), (a).end()
#define r... | ALGO | 0.999928 | 4.267865 |
18191fe7-170d-419e-aaf2-c886be39cc36 | Rajeshnds/Competitive-Programming | codeforces/dragonmas/codeforces(c++)_old/jzzhu_and_sequences/main.cpp | #include<bits/stdc++.h>
using namespace std;
long long m=1000000007,x,y,n;
int main(){
cin>>x>>y>>n;
long long a[6]={x-y,x,y,y-x,-x,-y};
cout<<(a[n%6]+m*2)%m;
}
| ALGO | 0.99992 | 3.824219 |
2703af79-25ca-4284-8886-1daf7a2e4f66 | RuddyGuerrero/Competitive-Programming | Competitions/Codeforces/contest_851/A. Arpa and a research in Mexican wave.cpp | /*
2017-09-04 17:44:15
https://codeforces.com/contest/851/problem/A
*/
#include <bits/stdc++.h>
using namespace std;
long long n, k, t;
int main(){
scanf ("%lld%lld%lld",&n,&k,&t);
if (t < k) printf ("%lld\n", t);
else if (t <= n) printf ("%lld\n", k);
else printf ("%lld\n", k+n-t);
... | ALGO | 0.999969 | 3.679036 |
63d4afcb-5aaa-4401-81e1-69f82bf9660d | g-akash/codechef_codes | powers.cpp | #include <iostream>
#include <vector>
#include <math.h>
#include <iomanip>
using namespace std;
#define ll long long int
int lstk(ll n, ll k)
{
vector<ll> vec,p2;
vec.resize(32);
p2.resize(32);
vec[0]=n;
p2[0]=1;
ll rem = (ll)pow(10,k);
for(int i=1;i<32;i++)
{
vec[i]=(vec[i-1]*vec[i-1])%rem;
p2[i]=p2[i-1]... | ALGO | 0.998601 | 3.689553 |
b4065714-b1d7-44dc-9443-df89ecf3468b | bensapp/Stretchable-Models-for-Motion-Parsing | cps/thirdparty/OpenCV-2.0.0/src/cv/cvaccum.cpp | #include "_cv.h"
namespace cv
{
inline float sqr(uchar a) { return CV_8TO32F_SQR(a); }
inline float sqr(float a) { return a*a; }
inline double sqr(double a) { return a*a; }
inline Vec3f sqr(const Vec3b& a)
{
return Vec3f(CV_8TO32F_SQR(a[0]), CV_8TO32F_SQR(a[1]), CV_8TO32F_SQR(a[2]));
}
inline Vec3f sqr(... | TOOL | 0.994474 | 7.058478 |
7c85fab9-e404-4f4f-8202-5da95d38bb32 | imatyukin/cpp | Programming_PrinciplesAndPracticeUsingCPP/Chapter04/exercise.4.20.cpp | // 20. Modify the program from exercise 19 so that when you enter a name, the program will output the corresponding
// score or name not found.
#include "std_lib_facilities.h"
int main(){
vector<string> names;
vector<int> scores;
vector<string> entered_twice;
string name = "";
int score = 0;
bo... | ALGO | 0.99298 | 4.813719 |
044b8a85-576d-4c7a-b361-9dea8c40f1c0 | TannerRogalsky/Demoloops | src/loop054.cpp | #include "demoloop.h"
#include "graphics/3d_primitives.h"
#include "graphics/mesh.h"
#include "helpers.h"
#include "graphics/shader.h"
#include <glm/gtx/rotate_vector.hpp>
using namespace std;
using namespace demoloop;
const uint32_t CYCLE_LENGTH = 10;
const static std::string shaderCode = R"===(
uniform mediump floa... | ALGO | 0.980866 | 4.803871 |
6cacc2b5-a80e-496a-ae59-9f6be5cb33d9 | TanmayMuthiyan/Programs-in-C-C-Java | program306.cpp | #include<iostream>
using namespace std;
typedef struct node
{
int data;
struct node *next;
}NODE, *PNODE, **PPNODE;
class SinglyLL
{
private:
PNODE First; // Characteristics
int iCount; // Chracteristics
public:
SinglyLL();
void InsertFirst(int no);
... | ALGO | 0.998421 | 4.645709 |
2e5c7ad8-6372-4796-adf4-e840cf7ebb4e | pn3425/Leet-Code | Array New/Two Sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int>ans;
map<int,int>mpp;
for(int i=0;i<nums.size();i++){
int a = nums[i];
int more = target - a;
if(mpp.find(more) != mpp.end()){
ans.push_back(mpp[more]);
ans.p... | ALGO | 0.999973 | 6.073155 |
07207d65-9ae2-45f0-9910-7b9a6e85705f | tyask/procon | atcoder/agc/agc017/C/main.cpp | #include <bits/stdc++.h>
namespace {
using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
template<typename T> using vec = vector<T>;
template<typename T> using vvec = vec<vec<T>>;
const ll LINF=0x1fffffffffffffff;
const ll MINF=0x7fffffffffff;
const int INF=0x3ffff... | ALGO | 0.999866 | 3.588544 |
f2c3b8b1-cce1-40af-af8d-4eeba660bb64 | FlashForge/Orca-Flashforge | src/slic3r/Utils/Bonjour.cpp | #include "Bonjour.hpp"
#include <cstdint>
#include <algorithm>
#include <array>
#include <vector>
#include <string>
#include <map>
#include <thread>
#include <boost/endian/conversion.hpp>
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include... | TOOL | 0.936972 | 4.329266 |
f06bb7d2-ee2b-44fb-bf05-644440561bac | TJUUAVLaboratory/Autonomous-mobile-robot | src/ros_navigation/costmap_2d/src/array_parser.cpp | #include <cstdio> // for EOF
#include <string>
#include <sstream>
#include <vector>
namespace costmap_2d
{
/** @brief Parse a vector of vector of floats from a string.
* @param input
* @param error_return
* Syntax is [[1.0, 2.0], [3.3, 4.4, 5.5], ...] */
std::vector<std::vector<float> > parseVVF(const std::string... | TOOL | 0.93427 | 5.081814 |
874b6a96-ec9c-490f-8c71-db8a693c3646 | mdabrowski-phd/c_programming_class | egz/rozw_wzorcowe/zad3/testNaukowiec.cpp | /*testowanie, klasa Naukowiec Michal Dabrowski*/
#include <iostream>
#include "Naukowiec.h"
using namespace std;
int main () {
Naukowiec Bogdan("Bogdan",50,300), Czeslaw; //tworzenie Naukowcow Bogdan i Czeslaw
cin >> Czeslaw; //wczytujemy informacje o Naukowcu Czeslaw
cout << Czeslaw.indeks() << endl; //obliczamy... | TOOL | 0.948156 | 3.998462 |
fd971844-ff5e-4646-972e-4b3b57ebb4d8 | ngthanhtrung23/CompetitiveProgramming | codeforces/508/D.cpp | #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
#define EACH(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define DEBUG(x) { cout << #x << " = "; cout << (x) << end... | ALGO | 0.999989 | 3.770317 |
91675ce2-c51c-4b50-8042-be296c3af0de | 2018331109/CodeForces_October_2023 | Educational-156/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define no cout<<"NO"<<endl;
#define yes cout<<"YES"<<endl;
#define neg cout<<-1<<endl;
const int mod=1e9+7;
void solve()
{
int n;
cin >> n;
int res = n - 1 - 2;
if (res > 0 && res % 3 != 0 && res != 1 && res !=... | ALGO | 0.999848 | 4.162719 |
9c73e33f-bd7b-44ff-a2c1-e0b98b566167 | yashasvirpratap/LeetCode-DSA-Solutions | 0080-remove-duplicates-from-sorted-array-ii/0080-remove-duplicates-from-sorted-array-ii.cpp | #include <vector>
class Solution {
public:
int removeDuplicates(std::vector<int>& nums) {
int n = nums.size();
if (n <= 2) {
return n;
}
int pos = 1;
int count = 0;
for (int i = 1; i < n; i++) {
if (nums[i] == nums[... | ALGO | 0.999808 | 6.5621 |
2c4610d3-0127-4f1b-96cb-aa1a66a80c9e | yfuka86/pc | others/100/52.cpp | #pragma GCC optimize("Ofast")
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <vector>
#include <algorithm>
#include <limits>
#include <climits>
#include <bitset>
#include <numeric>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define re... | ALGO | 0.999986 | 3.99558 |
5b9b39fe-9b89-46e5-8132-b58602645599 | Bungmint/competitiveprogramming | contest/OIs/KOI/KOI2021_hs_A.cpp | using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpi = vector<pii>;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pll>;
using ld = long double;
template <typename T, size_t SZ>
using ar = array<T, SZ>;
template <typename T>
using pqg = priority_... | ALGO | 0.999424 | 4.836928 |
41998aa3-0b61-421c-85f3-edc073ef7c5c | PokerM/OfferRoad | 5_Others/EverydayCode/2019/7/0703/124maxPathSum.cpp | class Solution {
//返回从根节点到叶节点最大,其中re保存当前树的最大路径和
int maxToRoot(TreeNode *root, int &re) {
if (!root) return 0;
int l = maxToRoot(root->left, re);
int r = maxToRoot(root->right, re);
if (l < 0) l = 0;
if (r < 0) r = 0;
if (l + r + root->val > re) re = l + r + root->... | ALGO | 0.999966 | 5.615786 |
b2e7fa65-5ae1-4999-b5a9-bf98c1602342 | kapil4457/Striver-A2Z-Sheet | 15. Graphs/15.3/Cycle Detection in Directed Graph (BFS Way).cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
private:
bool dfsCheck(int node, vector<int> adj[], int vis[], int pathVis[]) {
vis[node] = 1;
pathVis[node] = 1;
for (auto it : adj[node]) {
if (!vis[it]) {
if (dfsCheck(it, adj, vis, pathVis) =... | ALGO | 0.999722 | 6.551236 |
06f92b85-99a7-4705-9ce1-a43f1bf5e589 | alexis-jacq/image_scaling | src/dcci.cpp | #include <algorithm>
#include <iostream>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdlib.h>
#include <stdio.h>
using namespace cv;
using namespace std;
float attract(float x, float y, float z, float t, float expose){
//expose = 1.;
//if(expose!=1.){expose=3.;}
... | ALGO | 0.984196 | 3.929055 |
c0abb8d4-4c4d-4b92-9050-9a9e85b93b55 | AseaHu/planner-px4-gazebo | src/Fast-Planner/fast_planner/plan_env/src/raycast.cpp | #include <Eigen/Eigen>
#include <cmath>
#include <iostream>
#include <plan_env/raycast.h>
int signum(int x) {
return x == 0 ? 0 : x < 0 ? -1 : 1;
}
double mod(double value, double modulus) {
return fmod(fmod(value, modulus) + modulus, modulus);
}
double intbound(double s, double ds) {
// Find the smallest posi... | ALGO | 0.997007 | 5.565468 |
dbe17869-68e0-4204-8d73-f46b9b4953b6 | manishbisht/Competitive-Programming | Codeforces/Codeforces Round #367 (Div. 2)/Hard problem.cpp | #include <bits/stdc++.h>
using namespace std;
long long int n, a[100005], i, ans;
string s[100005];
int main()
{
cin>>n;
for(i=0;i<n;i++){
cin>>a[i];
}
for(i=0;i<n;i++){
cin>>s[i];
}
ans=0;
for(i=1;i<n;i++){
if(s[i-1].compare(s[i])>0){
reverse(s[i-1].begin... | ALGO | 0.99978 | 3.315702 |
4a4f11db-c062-403c-a2c3-8d58a31635c5 | axandrei1234/TUCN-Projects | xcode_sem1/Exercitiul5_Lab12/Exercitiul5_Lab12/AxenteAndrei_Ex5_Lab12.cpp | /*Folosind structura de la exemplul precedent , să se scrie un program care citeşte datele personale pentru n persoane (nume, prenume, data naşterii, codul numeric personal, data angajării) şi apoi le afişează în ordinea datei angajării.*/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include ... | TOOL | 0.914019 | 3.666686 |
2bcb3b60-2260-469d-9f5c-a55af8bf1815 | HirenJoshi16/Self_dsa | 148-listSum.cpp | // Program to add lists ~ O(l1+l2) & O(1) ~ `Two Approaches 'coded by vHiren
#include <bits/stdc++.h>
using namespace std;
// Basic template
struct node{
int data;
node* next;
};
// Creates node & initializes its data
node* createNode(int data){
node* n = new node;
n->data = data;
n->next = NULL;
... | ALGO | 0.999412 | 5.307692 |
fa59e271-13c3-457a-815d-facba6b2a4da | ZaneorZayn/flutter_project | 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 |
4c174fb4-bfbf-45b3-89ba-592c336b4198 | reyalo/Project_Synapse | lib/catalan_number.cpp | #include<bits/stdc++.h>
using namespace std;
//It is less efficient and time complexity is high
long long catalanNumber(int n){
long long res = 0;
if (n<=1)
{
return 1;
}
for (int i = 0; i < n; i++)
{
res += catalanNumber(i) * catalanNumber(n - i - 1);
}
return res;
}
long long ncr(int n... | ALGO | 0.999797 | 4.462895 |
2bfe981e-de84-4519-9b15-1665c321319d | 0lvsia/ZMP2025 | l6/z2/287362_z2.cpp | #include <iostream>
#include <algorithm>
using namespace std;
// wezel drzewa binarnego
struct Node
{
int data; //wartosc wezel
Node* left; //wskaznik do lewego dziecka
Node* right; //wskaznik do prawego dziecka
Node() //pusty wezel
{
data = 0;
left = nullptr;
right = null... | ALGO | 0.998545 | 4.103282 |
f09c5f03-3854-4fce-8240-ace7feb7a966 | seo-bo/ProblemSolving | 백준/Silver/10546. 배부른 마라토너/배부른 마라토너.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main(void)
{
ios::sync_with_stdio(0);
cin.tie(0);
unordered_map<string, int>m;
int n = 0;
cin >> n;
for (int i = 0; i < n; ++i)
{
string str;
cin >> str;
m[... | ALGO | 0.999879 | 3.760036 |
5891034d-8291-4325-a9fd-1d1f122071e5 | MarkKim1/Leetcode | 289-game-of-life/289-game-of-life.cpp | class Solution {
public:
void gameOfLife(vector<vector<int>>& board) {
vector<vector<int>> result(board.size(),vector<int>(board[0].size(),0));
vector<int> x = {-1,-1,-1,0,0,1,1,1};
vector<int> y = {-1,0,1,-1,1,-1,0,1};
int row = board.size();
int col = board[0].size... | ALGO | 0.999966 | 6.746212 |
3a263d8b-f688-47f5-8b20-f189aec8331b | FennelDumplings/leetcode-maxed_out | algorithm/cpp/prob1001-1500/prob1406_hard_one-Game-3.cpp | // prob1406: one Game III
/*
* https://leetcode-cn.com/problems/stone-game-iii/
*/
#include <vector>
#include <string>
#include <climits>
using namespace std;
class Solution {
public:
string stoneGameIII(vector<int>& stoneValue) {
int sum = 0;
for(int i: stoneValue) sum += i;
int n = s... | ALGO | 0.999741 | 5.535959 |
97fdf3a3-f4b6-4a31-8bfe-899e183b9b05 | adembudak/algs4-cpp | tests/QuickUnionUF_test.cpp | #include <algs4/QuickUnionUF.h>
#include <algs4/StdIn.h>
#include <algs4/StdOut.h>
// $ QuickFindUF_test < tests/algs4-data/tinyUF.txt
int main(int argc, const char *argv[]) {
using namespace algs4;
int n = StdIn::readInt();
QuickUnionUF uf(n);
while (!StdIn::isEmpty()) {
int p = StdIn::read... | ALGO | 0.98992 | 5.195288 |
b60cad58-6436-4714-a1e4-6800385ac096 | rjrishika/campus_assist | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
55f46eb0-283b-48ab-84dd-27b329f2e8ad | StanleyJo-37/competitive-programming-chatbots-comprasion | submissions/chatgpt/sub270.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
// Helper function to check if a character is a vowel
bool is_vowel(char c) {
return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
}
// Main solve function as per the problem statement
std::string solve(const std::string& s) ... | ALGO | 0.999948 | 7.004721 |
6e03a601-08a2-463f-9d47-b2dacd698450 | rishii3468/DSA | Graphs/prims.cpp | #include<bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define ll long long int
vector<list<pair<int,int>>> gr;
void add_edge(int u, int v,int wt, bool bidir=true){
gr[u].push_back({v,wt});
if(bidir){
gr[v].push_back({u,wt});
}
}
ll prims(int src,int n){
priority_queue<pp, vect... | ALGO | 0.999867 | 4.456971 |
2087a51a-c225-4fa5-9d8d-a518e04b916c | MoOo2mini/SSUalgo | 이소현/17127.cpp | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
vector<int> v;
int mult(int a, int b){
int cnt=1;
for(;a<=b;a++){
cnt*=v[a];
}
return cnt;
}
void solve(){
int n;
cin>>n;
for(int i=0;i<n;i++){
int tmp;
cin>>tmp;
v.push_back(tmp)... | ALGO | 0.999813 | 3.928535 |
f72a1c8e-fa70-4c95-8fc3-bd88b62684c1 | vivekchaurasiya12/Data-Structure-Algo | BinarySearchWithProblem/searrchDuplicateElement.cpp | #include <bits/stdc++.h> // Include standard libraries for input/output and utilities
using namespace std;
// This function performs a binary search to find the target element in a rotated sorted array.
// If the target is found, it returns true, otherwise it returns false.
bool SearchElement(vector<int> &arr, int low... | ALGO | 0.999991 | 6.455495 |
4d133a4c-a4ea-4633-966b-cc41a3e20943 | wanpinglee/fastaq | examples/CountKmer.cpp | #include <vector>
#include <list>
#include "fastaq/fasta.h"
#include "fastaq/reference.h"
int main (int argc, char** argv) {
if (argc != 3) {
std::cerr << "USAGE: " << argv[0] << " <FASTA> <kmer_size>" << std::endl;
return 1;
}
std::vector<std::string> ref_names;
std::list<std::list<uint64_t> > kmer;
Fastaq... | TOOL | 0.862599 | 5.698059 |
025fa5e5-b0d8-485d-b353-eefba17b3fcc | AmyLuSunshine/NYU_Tandon_Bridge | wk4/HW4 Code/yl10952_hw4_q4.cpp | /*
Question 4:
Write two versions of a program that reads a sequence of positive integers from the user,
calculates their geometric mean, and print the geometric mean.
Notes:
1. In mathematics, geometric mean of a dataset {a1, a2… , a3} containing positive
numbers, is given by: '√a1 ∙ a2 ∙ a3 =
For example, the geo... | ALGO | 0.997297 | 4.144354 |
5729266b-1210-4899-b5b5-ac45bbec30e6 | KoreaFriedChips/Competitive-Programming | An Animal Contest/aac1p1.cpp | #include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define ll long long
#define pb push_back
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define vi vector<int>
#define endl '\n'
#define F first
#define S second
#define gp greater<pii>
#defi... | ALGO | 0.991458 | 3.6605 |
4fc03887-be72-4790-99be-9985dae0572a | masoudbehzadinasab/Trilinos_12_11 | packages/moertel/example/TwoSquares/TwoSquares.cpp | /*!
* \file TwoSquares.cpp
*
* \brief Simple serial example showing Moertel usage and solver interfaces
*
* \date Last update do Doxygen: 20-March-06
*
*/
#ifdef HAVE_MPI
#include "mpi.h"
#include "Epetra_MpiComm.h"
#else
#include "Epetra_SerialComm.h"
#endif
// MOERTEL headers
#include "mrtr_manager.H"
#includ... | ALGO | 0.996733 | 4.528894 |
f2b7ac5c-9ce9-4afb-9c9f-90609d1cb95a | ishandutta2007/codeforces | clovers/normal/229/B.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define setIO(x) freopen(x".in", "r", stdin), freopen(x".out", "w", ... | ALGO | 0.999956 | 3.685612 |
57a97704-6c26-4d53-899a-5e5d5a61347c | alps-jbnu/25ALPStudy | 2025-1/Basic/daebok/WritingTips/2753.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
int main()
{
int a;
std::cin >> a;
int b = 0;
if ((0 != a % 100 || 0 == a % 400) && 0 == a % 4)
b = 1;
std::cout << b;
return 0;
} | ALGO | 0.999737 | 3.579162 |
1a5e73c2-dc11-424a-9e13-f95079bc9644 | Vijaymalav/LeetCode-solution | 1332-remove-palindromic-subsequences/1332-remove-palindromic-subsequences.cpp | class Solution {
public:
int removePalindromeSub(string S) {
int ans=1;
if (S == "") return 0;
for (int i = 0, j = S.size() - 1; i < j; i++, j--)
if (S[i] != S[j]){
ans=2;
break;
}
return ans;
}
}; | ALGO | 0.999804 | 6.170897 |
8d1b805e-84ff-4397-a14f-70362d430f16 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4506_38.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t = 0;
cin >> t;
while (t--) {
long long int a, b, c;
cin >> a >> b >> c;
cout << a + b + c - 3 << '\n';
}
}
| ALGO | 0.999775 | 5.035288 |
01255d4a-2e48-4815-b618-975c027e32e3 | b2389085/src | gnu/llvm/llvm/lib/Transforms/IPO/PartialInlining.cpp | #include "llvm/Transforms/IPO/PartialInlining.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/A... | ALGO | 0.998346 | 7.931074 |
8213e016-0c1e-4dbf-9dd2-2172072cda30 | vivekbiragoni/Leetcode | placementRush/146-lru-cache/lru-cache.cpp | class LRUCache {
public:
class node{
public:
int key;
int val;
node * next;
node * prev;
node(int _key, int _val){
key = _key;
val = _val;
}
};
node * head = new node(-1, -1);
node * tail = new node(-1, -1);
int cap;
... | ALGO | 0.999635 | 6.206477 |
f735de74-45fa-4621-a2bd-05e26a4df5a4 | Wiggrim/vins_with_encoder | vins_estimator/src/estimator/feature_manager.cpp | #include "feature_manager.h"
int FeaturePerId::endFrame()
{
return start_frame + feature_per_frame.size() - 1;
}
FeatureManager::FeatureManager(Matrix3d _Rs[])
: Rs(_Rs)
{
for (int i = 0; i < NUM_OF_CAM; i++)
ric[i].setIdentity();
}
void FeatureManager::setRic(Matrix3d _ric[])
{
for (int i = ... | ALGO | 0.891012 | 6.053565 |
beec150e-96d5-4f51-bbc8-942040ad6be4 | kdomi18/LeetCodeQuestionsKejdiDomi | HammingDistance.cpp | #include <bitset>
#include <iostream>
class Solution
{
public:
int hammingDistance(int x, int y)
{
std::bitset<32> bx{static_cast<unsigned long long>(x)};
std::bitset<32> by{static_cast<unsigned long long>(y)};
return (bx ^ by).count();
}
};
int main()
{
Solution sol{};
... | ALGO | 0.999637 | 5.865397 |
7edf7415-b138-4f5e-b2de-e1a86446b714 | bycore/atcoder | arc066-070/arc069c.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 500000 + 5;
ll n, m;
int main()
{
scanf("%lld%lld", &n, &m);
if (2 * n >= m) {
cout << min(n, m / 2) << endl;
} else {
ll cha = m - 2 * n;
cout << n + cha / 4 << endl;
}
return 0;
} | ALGO | 0.999818 | 3.251838 |
88ece048-0e3b-4f4a-91c0-fb5735ffd878 | roy0701/AtCoder | ABC/ABC301/ABC301E.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define INF 1000000000
int H, W;
char A[300][300];
int dx[4] = {-1, 0, 0, 1};
int dy[4] = {0, -1, 1, 0};
vector<vector<int>> dist(int si, int sj) {
vector res(H, vector<int>(W, INF));
res[si][sj] = 0;
queue<pair<int, int>> q;
q.push(... | ALGO | 0.999707 | 4.131232 |
463889e0-c73e-40db-9fa1-957cecf8008f | Rajeshnds/Competitive-Programming | codeforces/dragonmas/codeforces(c++)/H_Happy_Birthday.cpp | #include<bits/stdc++.h>
using namespace std;
int n,a[10];
void solve(){
int k=0;
for(int i=0;i<10;i++){
cin>>a[i];
if(a[i]+!i<a[k]+!k)k=i;
}
if(!k)cout<<1;
for(int i=0;i<=a[k];i++)cout<<k;
}
int main(){
int t;
for(cin>>t;t--;cout<<endl){
solve();
}
} | ALGO | 0.997193 | 3.199371 |
52a44530-3e4c-459a-b2ae-ff3a0e261282 | PrivoraCore/Privora | src/libspark/bpplus.cpp | #include "bpplus.h"
#include "transcript.h"
namespace spark {
// Useful scalar constants
const Scalar ZERO = Scalar((uint64_t) 0);
const Scalar ONE = Scalar((uint64_t) 1);
const Scalar TWO = Scalar((uint64_t) 2);
BPPlus::BPPlus(
const GroupElement& G_,
const GroupElement& H_,
const std::v... | ALGO | 0.996955 | 7.140163 |
ac3a454c-ab87-41c0-a318-c3eb6e3bb9bb | vanshbansal986/leetcode | arrays/easy/missing_number.cpp | //https://leetcode.com/problems/missing-number/
#include<iostream>
#include<vector>
using namespace std;
int missingNumber(vector<int>& nums) {
int n = nums.size();
int sum = (n)*(n+1)*0.5;
int arr_sum = 0;
for(int i=0; i<n; i++){
arr_sum += nums[i];
}
return sum - arr_sum;
... | ALGO | 0.99861 | 5.12005 |
2bedf1c9-4931-4fa8-a7c0-a27d69bcffc9 | akuma294/MLIRForPIM | libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/ranges.sort.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
// <algorithm>
// template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
// class Proj = identity>
// requires sortable<I, Comp, Proj>
// constexpr I
// sort(I first, S last, Comp comp = {}, Proj proj = {}); ... | TEST | 0.997605 | 7.828547 |
44f863ac-6b0f-46ab-a3ec-ec904d7d2b44 | inferenceengine/shadernn | core/3rdparty/eigen-3.4.0/unsupported/doc/examples/MatrixSinh.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXf sinhA = A.sinh();
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
MatrixXf coshA = A.cosh();
std::cout << "cosh(A) = \n"... | ALGO | 0.990509 | 5.890235 |
66ae2720-85c2-4661-8d8a-e55ff73af4a1 | Gon20000/my-cpp-journey | cp/Leetcode/minimum_path_sum.cpp | #include <bits/stdc++.h>
using namespace std;
using memo_t = map<pair<int, int>, int>;
using ll = long long;
int solve(vector<vector<int>>& grid, int i, int j, memo_t& memo, ll sum) {
if(i < 0 || j <0)
return INT_MAX;
else if(i == 0 && j == 0)
return grid[i][j];
pair<int, int> cur... | ALGO | 0.999906 | 4.882453 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.