uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
aff9bdb6-bbe1-4a1c-b2dd-b4d65c59fcae | Geeteshsood/leetcode | 2165-smallest-value-of-the-rearranged-number/2165-smallest-value-of-the-rearranged-number.cpp | class Solution {
public:
long long smallestNumber(long long num) {
string str = to_string(num);
int n = str.size();
if(str[0] == '-'){
sort(str.rbegin(),str.rend()-1);
}
else{
sort(str.begin(),st... | ALGO | 0.999847 | 5.573097 |
3ac5c17e-4501-44ca-a09e-bcfa46281cf7 | moabo3li/problems | 98-Validate-Binary-Search-Tree.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.999918 | 7.054631 |
a826ee11-e25a-4662-bbf5-bd33d3673177 | liaohuangg/RfCgraTrans | llvm/libcxx/utils/google-benchmark/cmake/std_regex.cpp | #include <regex>
#include <string>
int main() {
const std::string str = "test0159";
std::regex re;
re = std::regex("^[a-z]+[0-9]+$",
std::regex_constants::extended | std::regex_constants::nosubs);
return std::regex_search(str, re) ? 0 : -1;
}
| ALGO | 0.928991 | 5.855292 |
c24e1213-0558-453e-9e8e-64c8638adeb6 | horn-ice/sorcar | z3-4.8.4/src/api/api_parsers.cpp | #include<iostream>
#include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
#include "api/api_util.h"
#include "api/api_ast_vector.h"
#include "cmd_context/cmd_context.h"
#include "smt/smt_solver.h"
#include "parsers/smt2/smt2parser.h"
#include "solver/solver_na2as.h"
#include "tactic/portfolio/... | TOOL | 0.987588 | 5.796151 |
24ae3196-0cd7-46e9-a274-414d8b7cfc16 | caranicas/3D-steering-behaviors | bower_components/ammo.js/bullet/src/BulletCollision/Gimpact/btContactProcessing.cpp | #include "btContactProcessing.h"
#define MAX_COINCIDENT 8
struct CONTACT_KEY_TOKEN
{
unsigned int m_key;
int m_value;
CONTACT_KEY_TOKEN()
{
}
CONTACT_KEY_TOKEN(unsigned int key,int token)
{
m_key = key;
m_value = token;
}
CONTACT_KEY_TOKEN(const CONTACT_KEY_TOKEN& rtoken)
{... | ALGO | 0.996041 | 4.895882 |
0dd2240d-960e-4c95-91b7-387b44c02029 | palilo815/ps | baekjoon/18000/18783.cpp | #include <bits/stdc++.h>
using namespace std;
const int mxN = 1e5;
int a[mxN], jump[2][mxN];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("in", "r", stdin);
freopen("out", "w", stdout);
#endif
int n, m, k;
cin >> n >> m >> k;
iota(a, a + n, 0);
move(... | ALGO | 0.999996 | 3.465584 |
579778cb-5fa4-46ac-a9a7-2356c271e74e | priyanshscpp/CS50-Harvard-Advance-Data_Structures-Algorithms | StacksnQueue/Intro.cpp | #include<bits/stdc++.h>
using namespace std;
// this is the introductory lecture on the stacks and how to implement it accordingly ...
//Stack basically works on the LIFO (Last in First Out principle ...) E.g. SL Arora ...Learning Technique ..
int main()
{
/* Stack Implementation */
// stack<int> s;
// s.p... | ALGO | 0.978817 | 4.079719 |
c2975a7b-2cb3-4e82-861c-237736369b9f | vinayak0505/Data-Structures | Majority Element II.cpp | #include "vector"
using namespace std;
class Solution {
bool valid(vector<int>&nums,int a){
int count = 0;
for(int num:nums) if(num == a) count++;
return (nums.size()/3) < count;
}
public:
vector<int> majorityElement(vector<int>& nums) {
int num1 = INT_MAX,num2 = INT_MAX,c... | ALGO | 0.999988 | 5.441076 |
647f7a25-6a4c-45f0-a88f-7b343743d48e | igorbragaia/algorithms | leetcode/1646.cpp | class Solution {
public:
int getMaximumGenerated(int n) {
if(n==0)
return 0;
if(n==1)
return 1;
int maxAns = 1;
vector<int>ans = {0,1};
for(int i=2;i<=n;i++)
ans.push_back(0);
for(int i=2;i<=n;i++){
if(i%2==0)
... | ALGO | 0.999996 | 5.957475 |
f5e4cf28-033b-4879-a4f1-f6469c7f2f5b | ashuvo25/Codeforces_problem_Solve | B_Triple.cpp | #include<iostream>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
int n;cin>>n;
int a[n];
int a2[n+1] = {0};
for(int i = 0;i<n;i++){
cin>>a[i];
int temp = a[i];
a2[temp]+=1;
}
int num = 0;
int cou = 0;
for(int i ... | ALGO | 0.999924 | 3.811116 |
e9c93c1f-cdd1-4c97-a01f-055f4bc31dc9 | ricardo27637/primer-semestre-programas-c- | Calcular la transpuesta de una matriz.cpp | #include <iostream> //Ricardo Emanuel Quiñones Castillo 24041218
using namespace std;
void imprimirMatriz(int matriz[][10], int filas, int columnas) {
for (int i = 0; i < filas; i++) {
for (int j = 0; j < columnas; j++) {
cout << matriz[i][j] << " ";
}
cout << endl;
}
}
v... | ALGO | 0.999827 | 5.357741 |
17f1fda9-73ad-454e-a082-8cbad38f4be0 | M70000/Nirvana | CSGOSimple/features/backtrack.cpp | #include "backtrack.hpp"
#include "aimbot.hpp"
#include "../helpers/math.hpp"
void Backtrack::OnMove( CUserCmd *pCmd ) {
if( !g_EngineClient->IsInGame( ) || !g_LocalPlayer || !g_LocalPlayer->IsAlive( ) ) {
data.clear( );
return;
}
auto pWeapon = g_LocalPlayer->m_hActiveWeapon( );
if( !pWeapon || !pWeapon->IsG... | TOOL | 0.965013 | 4.148657 |
1cdce2e7-8974-4273-9931-0e0007c610cc | AMReX-Combustion/PeleLMeX | Source/PeleLMeX_Timestep.cpp | #include <PeleLMeX.H>
#include <PeleLMeX_K.H>
amrex::Real
PeleLM::computeDt(int is_init, const TimeStamp& a_time)
{
BL_PROFILE("PeleLMeX::computeDt()");
amrex::Real estdt = 1.0e200;
//----------------------------------------------------------------
// Store prev dt(s)
m_prev_dt = m_dt;
//---------------... | ALGO | 0.999744 | 6.379143 |
cf9fd9ed-4d31-41cc-a26d-02af935d1e2d | Upsurge-11/DSA | Leetcode/CPP/boatsToSavePeople.cpp | #include <bits/stdc++.h>
using namespace std;
int numRescueBoats(vector<int> &people, int limit)
{
int ans = 0;
sort(people.begin(), people.end());
int l = 0, r = people.size() - 1;
while (l <= r)
{
if (people[l] + people[r] <= limit)
{
ans++;
l++;
r--;
}
else
{
a... | ALGO | 0.999994 | 5.282621 |
205b1f46-0b30-4351-9f53-2b54da1dee93 | Kirsephuc3/on-thi-cslt | 8.cpp | //#include <iostream>
//#include <cstdlib>
//#include <ctime>
//using namespace std;
//void Nhap(int a[], int n)
//{
// srand((NULL));
// for (int i = 0; i < n; i++)
// {
// a[i] = rand() % 20 + 1;
// cout << a[i] << " " << endl;
// }
//}
//void Xuat(int a[], int n)
//{
// for (int i = 0; i < n; i++)
// {
// cout <<... | ALGO | 0.999462 | 3.429904 |
f7bc6d79-8bff-4756-929b-3f8f9c95f23d | phoenixAbhi2002/GFG | Print Diagonally - GFG/print-diagonally.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
vector<int> downwardDigonal(int N, vector<vector<int>> A)
{
// Your code goes here
vector<int>ans;
//for upper half of the matrix
for(int i=0;i<N;i++){
int row=0, col=i;
while(c... | ALGO | 0.999815 | 5.388158 |
9064eaec-9cdd-47a5-9ea4-dffdaf962026 | saadman-galib/Problem-Solving | codeforces/problemset/71A/main.cpp | #include <iostream>
using namespace std;
int main() {
// Your code goes here
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
if(s.length() > 10){
cout << s[0] << s.length() - 2 << s[s.length() - 1] << endl;
}
else{
cout << s <<... | ALGO | 0.999566 | 5.304701 |
2bbe6ab2-1c5d-4c54-95b9-b939883eb223 | Nilesh2000/ErrorFreeCodes | Stack/checkForRedundantParantheses.cpp | //A program to check for redundant parantheses in an expression
// ((a + b)) has redundant parantheses.
// (a + b) has no redundant parantheses.
// ((a) + b) has redudnant parantheses.
/*
The logic here is to use a stack.
If we encounter anything other than ), we push it to top of the stack.
If we encounter a ), we set... | ALGO | 0.999182 | 6.365928 |
04bfcd68-254e-4b3b-af2c-1d53f615fb85 | xjl6070/CFD-homework | MUSCL/源.cpp | #include <iostream>
using namespace std;
#define pi 3.1415926
#include <math.h>
int main()
{
int i, j;
double vp = 400.0; // ɻٶ
double vm = 600.0;//ٶ
double D = 10.0;//ɱ˰뾶
double yp = 10000 * sin(pi / 3);//ɻ
double xm[2000];
double ym[2000];
double xp[2000];
xm[0] = 0;//ʼ
ym[0] = 0;//ʼ
xp[0] = 10000 * cos(pi... | ALGO | 0.999265 | 3.002556 |
d7a8b5e0-d913-45e9-932d-d6798d5e2790 | aborlean/LeetCode | monotonic-array.cpp | class Solution {
public:
bool isMonotonic(vector<int>& nums) {
if(nums.size() < 2)
return true;
int direction = 0;
for(int i = 1; i < nums.size(); i++) {
if(nums[i] > nums[i - 1]) {
if(direction == 0)
direction = 1;
... | ALGO | 0.99996 | 6.09587 |
61a97697-285c-4be1-8fdf-d2acf02b91d9 | ishandutta2007/codeforces | okwedook/normal/1329/C.cpp | #pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <sstream>
#include <deque>
#i... | ALGO | 0.999917 | 4.010159 |
e44610b7-af91-42ec-89c0-2bc9c2578b9f | amitsvg/Leetcode-submissions | 0977-squares-of-a-sorted-array/0977-squares-of-a-sorted-array.cpp | class Solution {
public:
vector<int> sortedSquares(vector<int>& nums) {
map<int,int>mp;
for(auto i: nums){
mp[i*i]++;
}
nums.clear();
for(auto [k,v]: mp){
while(v--){
nums.push_back(k);
}
}
return nu... | ALGO | 0.999987 | 5.712491 |
2e599246-0b3b-4ab7-898e-938d4a12ce05 | opencv/opencv_contrib | modules/line_descriptor/src/LSDDetector.cpp | #include "precomp.hpp"
//using namespace cv;
namespace cv
{
namespace line_descriptor
{
Ptr<LSDDetector> LSDDetector::createLSDDetector()
{
return Ptr<LSDDetector>( new LSDDetector() );
}
Ptr<LSDDetector> LSDDetector::createLSDDetector(LSDParam params)
{
return Ptr<LSDDetector>( new LSDDetector(params) );
}
/* c... | ALGO | 0.997013 | 5.213098 |
3681b833-2792-4ec6-8a7d-c2febd8d484d | haowanwuyifan/data_structure_and_algorithm | 单调队列与单调栈/hzoj372.cpp | /*------------------------------------------------------------------------------
* @file HZOJ372.CPP
* @author FIRMWARE TEAM
* @date 2024/01/03 22:25:15
* @brief THIS FILE PROVIDES ALL THE FIRMWARE FUNCTIONS.
* -----------------------------------------------------------------------------
/* Define to pr... | ALGO | 0.999957 | 4.314559 |
643ba339-5d7b-4960-adfe-4c99c9fff1ed | sarvex/leetcode-basic | lcof2/剑指 Offer II 083. 没有重复元素集合的全排列/Solution.cpp | class Solution {
public:
vector<vector<int>> permute(vector<int>& nums) {
int n = nums.size();
vector<vector<int>> res;
vector<int> path(n, 0);
vector<bool> used(n, false);
dfs(0, n, nums, used, path, res);
return res;
}
void dfs(int u, int n, vector<int>& nu... | ALGO | 0.999994 | 6.796368 |
2a97121e-78fb-448b-a550-f3bd0b99a95c | MakinoRuki/Codeforces | R837/1771B.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <ctime>
#define N 300005
#define M 520
#define eps 1e-7
using namespace std;
typedef long long ll;
const ll ... | ALGO | 0.999928 | 4.091568 |
6eeb33fa-f6c8-49a5-beeb-ccda0a0f69b8 | Warwick-Stats-Resources/r-programming-exercises | solutions/wmean.cpp | #include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
double wmean_cpp(NumericVector x, NumericVector w) {
int n = x.size();
double total = 0, total_w = 0;
for(int i = 0; i < n; ++i) {
total += x[i] * w[i];
total_w += w[i];
}
return total / total_w;
}
| ALGO | 0.999646 | 5.388344 |
f9bfaa8f-c766-44e8-b567-282055cdec45 | srini1392/Programming-in-Cpp | Competitve Programming & Online Problems/Sololearn/Palindrome.cpp | #include <iostream>
using namespace std;
bool isPalindrome(int x) {
//complete the function
int reverse = 0; //to store the reverse of the given number
int remainder = 0;
int n1 = x; //storing the original number for comparing later
//logic to compute the reverse of a number
while (x != 0)
... | ALGO | 0.999695 | 5.445838 |
1a7672d0-0a94-483c-b209-55be47202781 | Yashgabani845/hiring-portal | hiring-portal/Backend/temp/yin61t1.cpp | #include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
int sum = a + b;
cout << sum << endl;
return 0;
}
| ALGO | 0.975836 | 4.21445 |
af358db9-0296-4cfe-8c4a-e067a4096b7d | sanjosh/smallprogs | basic/misc/boolean_parenthizations.cpp |
/*
http://www.geeksforgeeks.org/program-nth-catalan-number/
*/
// A recursive function to find nth catalan number
unsigned long int catalan(unsigned int n)
{
// Base case
if (n <= 1) return 1;
// catalan(n) is sum of catalan(i)*catalan(n-i-1)
unsigned long int res = 0;
for (int i=0; i<n; i++)
... | ALGO | 0.999146 | 6.040809 |
c9c01558-fd32-43af-98a4-2c2a7dbf683e | Shrikant-AI/Leetcode | Easy/66. Plus One.cpp |
#include <iostream>
#include <vector>
using namespace std;
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;
... | ALGO | 0.999613 | 6.477557 |
6984bc11-c111-42af-ab86-cd7a536e51d7 | srajan-kush/CodeForces | 266B.cpp | #include<iostream>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
string s;
cin >> s;
for(int i = 0; i < m; i++){
for(int i = 1; i < n; i++){
if(s[i] == 'G' && s[i - 1] == 'B'){
swap(s[i],s[i-1]);
i++;
}
}
}... | ALGO | 0.99988 | 3.49999 |
3997a9e5-b14b-4813-acd7-22712c113cc7 | amoudgl/leetcode-solutions | src/clone-graph.cpp | // Author: Abhinav Moudgil [ https://leetcode.com/amoudgl/ ]
/**
* Definition for undirected graph.
* struct UndirectedGraphNode {
* int label;
* vector<UndirectedGraphNode *> neighbors;
* UndirectedGraphNode(int x) : label(x) {};
* };
*/
class Solution {
public:
UndirectedGraphNode *cloneGraph(U... | ALGO | 0.99955 | 6.368489 |
715d2466-11f9-4616-831e-e281e4d58335 | CHIANGEL/leetcode | leetcode_algorithms/cpp/0017_LetterCombinationsofaPhoneNumber/LetterCombinationsofaPhoneNumber.cpp | class Solution {
public:
vector<string> letterCombinations(string digits) {
if (!digits.length())
return res;
maps.push_back({ 'a', 'b', 'c' });
maps.push_back({ 'd', 'e', 'f' });
maps.push_back({ 'g', 'h', 'i' });
maps.push_back({ 'j', 'k', 'l' });
maps.push_back({ 'm', 'n', 'o' });
maps.push_back({ ... | ALGO | 0.999765 | 6.266523 |
a9adbda1-11e0-457b-a522-1c98835a6fc1 | Nikhilpri/SPORTS_PROGRAMMING | 0151-reverse-words-in-a-string/0151-reverse-words-in-a-string.cpp | class Solution {
public:
string reverseWords(string s) {
reverse(s.begin(),s.end());
int i=0;
int n=s.size();
int left=0,right=0;
while(i<n){
while(i<n&&s[i]==' '){
i++;
}
if(i==n)break;
while(i<n&&s[i]!=' '){
... | ALGO | 0.999987 | 6.075264 |
acb36cd4-57db-4e2d-9cff-6ac9359c43b9 | moon-Light404/Acm | 2021蓝桥杯代码/砝码称重.cpp | ////
////1 4 6
////1 4 6 3 5 11 2 7 10 9
#include <iostream>
#include <cmath>
using namespace std;
// dp[i][j]ʾǰiǷԳƳj t or f
const int M = 100005;
bool dp[106][M];
int a[M]; // ÿ
int main() {
int N, sum = 0;
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> a[i];
sum += a[i];
}
for (int i = 1; i <= N; i++) { /... | ALGO | 0.999968 | 3.574207 |
501b4a47-7eaf-4eb2-b9dc-771d26de23ea | SaeedJannati/LeetCodeProblems | LeetCodeProblemsCpp/LeetCodeProblemsCpp/Problems/LeetCode226InvertBinaryTree.cpp | #include "LeetCode226InvertBinaryTree.h"
void LeetCode226InvertBinaryTree::Run()
{
}
TreeNode* LeetCode226InvertBinaryTree::invertTree(TreeNode* root)
{
if (root == nullptr)
return nullptr;
SwapLeftAndRight(root);
return root;
}
void LeetCode226InvertBinaryTree::SwapLeftAndRight(TreeNode* node)
{... | ALGO | 0.999603 | 6.451541 |
18db6327-4153-44b5-a052-4347f6a8beb2 | ishandutta2007/codeforces | ekzhang/normal/1156/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const double PI = 4 * atan(1);
#define MAXN 200013
#define MAXLG 18
int N;
int A[MAXN], iA[MAXN];
int T[MAXLG][MAXN];
LL ans = 0;
inline int qry(int lo, int hi) {
int len = (hi - lo + 1);
int k = 31 - __builtin_clz(len);
return max(T[k][lo], T[k]... | ALGO | 0.999976 | 4.402627 |
a13b281f-e2a9-4182-a0a9-9b3ab3ca1274 | HRF05/DMOJSolutions | mci2p5.cpp | #pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long long unsigned llu;
typedef pair<int,int> pii;
typede... | ALGO | 0.99997 | 3.619115 |
6c61fbdc-866a-45e6-b0af-21463a1c4aa3 | harshabangi/leetcode | cpp/others/two_sum_duplicates_and_distincts.cpp | //
// Created by Harsha Vardhan on 16/06/22.
//
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
vector<pair<int, int>> findPairs(vector<int> arr, int target) {
//4, 1, 2, 3, 2, 4
unordered_map<int, int> umap;
for (int i = 0; i < arr.size(); i++) {
umap[arr[i]]+... | ALGO | 0.999791 | 5.844301 |
5f76ecf3-859d-488e-9078-ec700d558baa | Lutetium0/MHL | Client/HybridCLRData/StrippedAOTDllsTempProj/StandaloneWindows64/Il2CppOutputProject/IL2CPP/libil2cpp/mono/ThreadPool/threadpool-ms.cpp | #include "il2cpp-config.h"
#include <stdlib.h>
#define _USE_MATH_DEFINES // needed by MSVC to define math constants
#include <algorithm>
#include <cmath>
#include <complex>
#include "math.h"
#include "il2cpp-api.h"
#include "gc/GarbageCollector.h"
#include "gc/GCHandle.h"
#include "gc/WriteBarrier.h"
#include "icalls... | TOOL | 0.907314 | 6.026057 |
8766af4f-1904-4d5d-9508-a7bdc4ef0bbc | muhammadasawirkhan/lab-task-programming | asawir_programming6.cpp | // C Program to calculate circumference of a circle
#include <iostream>
using namespace std;
#define PI 3.141
int main(){
float radius, circumference;
cout << "Enter radius of circle\n";
cin >> radius;
// Circumference of Circle = 2 X PI x Radius
circumference = 2*PI*radius;
cout << "Cir... | ALGO | 0.98493 | 3.958267 |
112c1a4a-6d4d-4d6c-93cb-b26641afc802 | conanOrien/gameModMidterm | idlib/math/Ode.cpp |
#include "../precompiled.h"
#pragma hdrstop
//===============================================================
//
// idODE_Euler
//
//===============================================================
/*
=============
idODE_Euler::idODE_Euler
=============
*/
idODE_Euler::idODE_Euler( const int dim, deriveFunction_t dr,... | ALGO | 0.999667 | 6.257967 |
07543a09-bc23-4590-889d-468d40f9a673 | xXHachimanXx/LPA | exercicios/Tp6/Tp6.cpp | #include <stdio.h>
#include <iostream>
#include <limits.h>
#define infinity 1000000
using namespace std;
int resp = infinity;
class Grafo
{
public:
int vertices;
int arestas;
int **matriz;
int menorDistancia(int *distancias, bool *visitados);
int tamanhoDM;
Grafo* menoresCaminhos;
int *pa... | ALGO | 0.999712 | 4.33252 |
623e48e5-476b-4d72-becf-bfa1a24a8477 | UMANG-GAKHAR/Hackerblocks-DCB-Problems | Unique Number-II.cpp | #include<iostream>
using namespace std;
int main() {
int n;
int a[100005];
cin>>n;
int no;
int res=0;
for(int i=0;i<n;i++){
cin>>no;
a[i]=no;
res = res^no;
}
//xor=a^b
int temp=res;
int pos=0;
while((temp&1)!=1){
pos++;
temp=temp>>1;
}
int mask=(1<<pos);
//find those number which contain set ... | ALGO | 0.999936 | 3.51813 |
a34f37a0-8b1e-461d-91bd-6911b9bea214 | leeharok/cos-practice | 5/bit-vector.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#define BIT_VECTOR_LENGTH 4
#define MSB_INDEX BIT_VECTOR_LENGTH -1
#define LSB_INDEX 0
#define TRUE 1
#define FALSE 0
void print_command(char *argv[]);
int check_validity(char *input);
void init_bit_vector(char *input, char *bv);
void print_bit_vector(char *bv);
... | ALGO | 0.983802 | 5.564872 |
707cb6ec-1787-466c-9189-549281215e3e | IIIIIIIIIU/onlysky | 1177.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn=1505;
int n,m,k,sum[maxn][maxn],ul[maxn][maxn],ur[maxn][maxn],dl[maxn][maxn],dr[maxn][maxn];
int ans,prer[maxn][maxn],r[maxn][maxn],prec[maxn][maxn],c[maxn][maxn];
inline int get(int prex,int prey,int sufx,int sufy)
{
return sum[sufx][sufy]-sum[sufx][prey... | ALGO | 0.9999 | 3.322983 |
c5686622-8979-401b-bba7-0edb5242cef2 | raincross7/code-similarity | codes/train_code/problem349/problem349_92.cpp | // -*- mode:c++; coding:utf-8; c-basic-offset:2; -*-
// ALDS1_2-C: Stable Sort
#include <cstring>
#include <algorithm>
#include <iostream>
struct Card {
char suit;
unsigned int rank;
bool operator<(const Card& rhs) { return rank < rhs.rank; }
};
std::ostream& operator<<(std::ostream& os, const Card& card)
{
... | ALGO | 0.999738 | 6.096065 |
731d2208-97fd-4c4a-88ea-09bf07f956b0 | PrashamModi/gfg | Easy/Max Sum without Adjacents/max-sum-without-adjacents.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
int f(int ind, int *arr, vector<int> &dp) {
if(ind == 0) return arr[0];
if(ind < 0) return 0;
if(dp[ind] != -1) return dp[ind];
int t... | ALGO | 0.999768 | 6.46075 |
40a7920e-187e-4365-9a7a-3a43c542ce78 | JawwadUmar/Coding | More_Cookies.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int MOD = 1e9+7;
#define endl '\n'
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_up... | ALGO | 0.999977 | 4.344317 |
f4ecd0a7-c294-4e0b-b4c9-b6b738de460a | Saimongu007/Code_Force-Problem | Multiple cf.cpp | #include<iostream>
using namespace std;
int main()
{
int A,B;
cin>>A>>B;
if(A%B==0 || B%A==0)
{
cout<<"Multiples";
}
else
{
cout<<"No Multiples";
}
return 0;
}
| ALGO | 0.999416 | 4.059814 |
b780c88a-a780-48b2-9cc8-b99b04c40d83 | aldew5/Competitive-Programming | AtCoder/Alsing Contest 2020/Two_Snuke.cpp | /*
Aldew (credit to BigBag)
LANG: C++14
PROG: Two Snuke
CLASSIFICATION: math, polynomials
*/
#include <bits/stdc++.h>
#define check(x) cout<<(#x)<<": "<<x<<" ";
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ss second
#define ff first
typedef long long ll;
typedef unsigned long long ull;
u... | ALGO | 0.999854 | 4.332215 |
c9137e23-2a8a-4f33-bd90-dcdfcc6eb02d | tamasmeszaros/libnest2d | src/libnest2d.cpp | #include <libnest2d/libnest2d.hpp>
namespace libnest2d {
template class _Nester<NfpPlacer, FirstFitSelection>;
template class _Nester<BottomLeftPlacer, FirstFitSelection>;
template std::size_t _Nester<NfpPlacer, FirstFitSelection>::execute(
std::vector<Item>::iterator, std::vector<Item>::iterator);
template ... | ALGO | 0.995279 | 4.957174 |
3d5747fe-b88a-4735-9709-2cbfef279490 | prateeksahu-me/DSA3 | Linked List Problems/Reversing a Linked List/ReverseLinkList.cpp | #include "../crio/cpp/ds/ListNode/ListNode.hpp"
/*
class ListNode {
public:
int val;
ListNode* next;
ListNode() {}
ListNode(int x) {
val = x;
next = NULL;
}
};
*/
ListNode* reverseLinkedList(ListNode *head) {
if(head == NULL)
{
return NULL;
}
L... | ALGO | 0.999614 | 4.789817 |
e684d377-9228-4cf6-96c7-584dd3b8c9db | raincross7/code-similarity | codes/train_code/problem496/problem496_225.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a.at(i);
}
sort(a.begin(),a.end());
int64_t ans=0;
for(int i=0;i<(n-k);i++){
ans+=a.at(i);
}
cout<<ans<<endl;
}
| ALGO | 0.999971 | 3.61407 |
eb8b62c3-4ea8-42fb-b5d9-4a41d117f660 | ismaellimadb/Programas-C- | Exercicios/30-09/Ex1Reajuste.cpp | #include <stdio.h>
#include <locale.h>
main()
{
setlocale(LC_ALL,"Portuguese");
float salario,aumento,reajuste;
printf("Escreva o salrio: ");
scanf("%f",&salario);
if(salario<=750)
{
aumento=salario*0.05;
reajuste=salario+aumento;
printf("O salrio ser de: %.2f\n",reajuste);
}
else if(salario>=751&&salario... | ALGO | 0.996435 | 3.355705 |
d98a09c8-25a5-4cc5-bdf2-6e7567557275 | ualberta-mueller-group/MCGS | src/cgt_dyadic_rational.cpp | //---------------------------------------------------------------------------
// Simple combinatorial games - dyadic rationals
//---------------------------------------------------------------------------
#include "cgt_dyadic_rational.h"
#include "cgt_integer_game.h"
#include "game.h"
#include "safe_arithmetic.h"
#incl... | ALGO | 0.988081 | 6.842845 |
b96e0edf-eb42-4a1f-8265-63fa5a7a91ba | ishandutta2007/codeforces | ifsmirnov/normal/293/C.cpp | #include <functional>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <ctime>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define f... | ALGO | 0.999953 | 3.619379 |
0688ed3f-6986-4a79-a953-2831c3f38437 | AvinasheeTech/Ardupilot | ArduPlane/servos.cpp | /*
main logic for servo control
*/
#include "Plane.h"
#include <utility>
/*****************************************
* Throttle slew limit
*****************************************/
void Plane::throttle_slew_limit(SRV_Channel::Aux_servo_function_t func)
{
#if HAL_QUADPLANE_ENABLED
const bool do_throttle_slew = ... | TOOL | 0.907492 | 6.570207 |
e64377bc-908a-4451-9334-43b690e12955 | vankiaio/vkt_old | libraries/wasm-jit/Source/Platform/Windows.cpp | #if _WIN32
#include "Inline/BasicTypes.h"
#include "Inline/Errors.h"
#include "Platform.h"
#include <inttypes.h>
#include <algorithm>
#include <Windows.h>
#include <DbgHelp.h>
#undef min
namespace Platform
{
static Uptr internalGetPreferredVirtualPageSizeLog2()
{
SYSTEM_INFO systemInfo;
GetSystemInfo(&systemI... | TOOL | 0.960808 | 7.087747 |
5087f14f-0da0-48c7-b629-aa05f9482a9b | AnantKumawat22/Problem_Solving | leetcode/Easy/917. Reverse Only Letters.cpp | string reverseOnlyLetters(string s)
{
int i = 0, j = s.length() - 1, t, checki, checkj;
while (i < j)
{
checki = s[i] >= 'a' && s[i] <= 'z' || s[i] >= 'A' && s[i] <= 'Z';
checkj = s[j] >= 'a' && s[j] <= 'z' || s[j] >= 'A' && s[j] <= 'Z';
if (checki && checkj)
{
... | ALGO | 0.86083 | 5.46941 |
d5aca9e2-93e6-4b9e-ab05-1d3578ed42cd | beomsuong/Acmicpc | 합_8393.cpp | #include <string>
#include <vector>
#include<iostream>
using namespace std;
int main() {
int a, b=0;
cin >> a;
for (int i = 1;i <= a;i++) {
b += i;
}
cout << b;
}
| ALGO | 0.998059 | 3.749218 |
68caab0d-7e0b-4cdb-827d-20ec05d14045 | yaweihe/Leetcode-practice | 28Implementstr.cpp | /*
Implement strStr().
Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Example 1:
Input: haystack = "hello", needle = "ll"
Output: 2
Example 2:
Input: haystack = "aaaaa", needle = "bba"
Output: -1
Clarification:
What should we return when needle is an empty ... | ALGO | 0.99979 | 6.071929 |
a65e50b5-6132-4f82-8c68-5f19d971c4f3 | TimTam725/Atcoder | ABC/c126/d.cpp | #include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long l;
typedef pair<int,int> P;
const ll INF=100000000000000001;
const double PI=3.141592653589;
struct edge{
int to,l;
};
vector<vector<edge>> g(100005);
bool memo[100005];
bool ans[1... | ALGO | 0.99997 | 4.139808 |
35ae7820-0d73-4466-8c05-fd1c805df00f | ishandutta2007/codeforces | xuanyi/normal/1375/F.cpp | #include<bits/stdc++.h>
#define D(...) fprintf(stderr,__VA_ARGS__)
#define int long long
#define LL long long
#define MP make_pair
#define PB push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) ... | ALGO | 0.999626 | 3.17501 |
3ce988ab-c0ba-41e4-a840-8370cd65c999 | wisniewskij/CP-Solutions | CSES.FI/Introductory Problems/1083 - Missing Number.cpp | // github.com/wisniewskij/Code
// cses.fi/problemset/task/1083
// Missing Number
#include <bits/stdc++.h>
#define ndl '\n'
#define ll long long
#define INF 1000000007
#define st first
#define nd second
#define debug(x) cout << #x << ": " << x << ndl
#define all(x) (x).begin(), (x).end()
using namespace std;
int ma... | ALGO | 0.999902 | 4.127585 |
aa5ffcbd-8511-42d1-81dd-1ac456809d93 | saidul-07/ProblemSolving | Vjudge/Odommo Marathon - 2/F.cpp | #include<bits/stdc++.h>
using namespace std;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vll vector<ll>
#define vs ... | ALGO | 0.99984 | 3.376734 |
ef7f3286-f2d5-4eea-a4eb-7c7d2a8d14c9 | yimok/yimok.github.io | data/01_knapsack_backtracking/Backtracking 01 Knapsack.cpp |
#include <stdio.h>
#include <stdlib.h>
#include <vector> //vector ̺귯
using std::vector;
//1. Ʈ ӸԴ´
//2. Ʈ ʳ Ѵܰ Ʈŷؼ ʰ ٸ Դ´.
//3. ö鼭 ٲ㰡鼭 ִ´.
#pragma warning(disable:4996)
#define SIZE 500 //
int maxprice, itemnum=SIZE, W, totprice;
int numbest=0; // 캻 ǵ( )
vector<char> bestset(SIZE+1, 0); // ִ ϶ ǵ
vector<c... | ALGO | 0.999267 | 3.391591 |
7631197d-f29b-4129-9a25-4bf4ea691b10 | KurisZ/leetcodeC- | algorithms/cpp/decodeXORedPermutation/DecodeXoredPermutation.cpp | // Source : https://leetcode.com/problems/decode-xored-permutation/
// Author : Hao Chen
// Date : 2021-02-17
/*****************************************************************************************************
*
* There is an integer array perm that is a permutation of the first n positive integers, where n is... | ALGO | 0.999972 | 6.186042 |
11ab33bd-2f5b-44f2-aee3-a6e697cd2439 | Anup0099/450DSA_Question | src/cf/mergeSimilarItem.cpp | #include <bits/stdc++.h>
using namespace std;
// You are given two 2D integer arrays, items1 and items2, representing two sets of items. Each array items has the following properties:
// items[i] = [valuei, weighti] where valuei represents the value and weighti represents the weight of the ith item.
// The value of e... | ALGO | 0.99999 | 5.283294 |
4430b613-d947-4456-b6d0-bb6da3970855 | shay-ff/competitive-programming-setup | templates/tree/segment-tree.cpp | struct SegmentTree {
// TO CHANGE
struct Node { // set default values
...
template<typename T>
void apply(int l, int r, T val) { // update value and save push
...
}
};
Node merge(const Node& left, const Node& right) {
...
}
void push(int v, int l, int r) {
if (tree[v].??? != ...) {
int mid =... | ALGO | 0.999954 | 6.037952 |
2911fa0e-7477-4c2e-beda-440c7de73ed5 | virtualxiaoman/LeetCode | kaoyan/array/367.cpp | //// Created by virtual小满 on 2025/3/3.
//// 给你一个正整数 num 。如果 num 是一个完全平方数,则返回 true ,否则返回 false 。
////完全平方数 是一个可以写成某个整数的平方的整数。换句话说,它可以写成某个整数和自身的乘积。
////示例 1:
////输入:num = 16
////输出:true
////解释:返回 true ,因为 4 * 4 = 16 且 4 是一个整数。
//
//#include <iostream>
//#include <vector>
//#include <algorithm>
//
//using namespace std;
/... | ALGO | 0.99886 | 5.247689 |
54eb8205-b058-4a7b-b389-a910437d2788 | xiezy0/MultiParty-PSI | thirdparty/win/miracl/miracl_osmt/source/curve/pairing/bandw.cpp | //
// Program to find Brezing & Weng pairing friendly curves
// http://eprint.iacr.org/2003/143
//
// Finds families of elliptic curves with groups of points of order r over the prime field p with
// embedding degree k, where k>2. The program tries to find curves with minimum rho=log(p)/log(r),
// as such curves may... | ALGO | 0.99937 | 3.745702 |
555325ba-d0c0-4671-9737-8ad2245aebd7 | zrss/LeetCode | CountCompleteTreeNodes.cpp | #include <iostream>
struct TreeNode {
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
Solution():lack(0) {}
int countNodes(TreeNode* root) {
if (root == NULL)
return 0;
lack = 0;
level = 0;
// ... | ALGO | 0.999875 | 6.11529 |
093ab4c4-bf5d-4238-860b-b9c65963213a | Krigo-Liu/CMOR-521-High-Performance-Computing | Assignments/HW1/main_transpose.cpp | #include "./include/matrix_transpose.hpp"
#include <iostream>
using namespace std;
int BLOCK_SIZE = 16;
int threshold = 16;
bool header_written = false;
int main(int argc, char *argv[])
{
vector<int> sizes = {32, 64, 128, 256, 512, 1024, 2048};
vector<int> block_sizes = {8, 16, 32, 64, 128};
vecto... | ALGO | 0.99669 | 6.059682 |
ca796e86-cac2-44a6-a370-badf587956e2 | UGR-IntelligentSystemsGroup/HPDL-Planner | src/replan.cpp | #include "replan.hh"
#include "problem.hh"
bool RePlan::undoUntilDepth(int depth) {
// StackNode * next=0;
//
// int cd = p->stack.size();
// // mientras no se alcance la profundidad pasada como argumento
// while(cd >= depth){
// // si entra otra vez en el bucle y queda algo por borrar
// if(next){
// ... | ALGO | 0.998116 | 4.12661 |
3c0126f2-523e-42c8-b2c4-199c96e94d96 | JakobAarestrup/PRJ4 | TrainBrain/software/TableDetector/opencv_all/opencv-4.1.0/samples/cpp/squares.cpp |
// The "Square Detector" program.
// It loads several images sequentially and tries to find squares in
// each image
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
static void he... | TOOL | 0.993328 | 5.924704 |
369df9ce-0280-459d-8297-23b0643d0694 | sohardforaname/ACM_ICPC_practice | leetcode/227.基本计算器-ii.cpp | #include "../base.h"
/*
* @lc app=leetcode.cn id=227 lang=cpp
*
* [227] 基本计算器 II
*/
// @lc code=start
class Solution {
public:
unordered_map<char, int> mp;
long long calculate(string s)
{
mp['+'] = mp['-'] = 1;
mp['*'] = mp['/'] = 2;
stack<long long> ids;
stack<char> ops... | ALGO | 0.999823 | 5.174087 |
814976f2-169b-4f75-b18a-793e7184cbd7 | MiguelTaibo/MT_CSES_ProblemSet | IntroductoryProblems/gridPaths.cpp |
#include <list>
#include <stdlib.h>
#include <iostream>
struct Solution {
int grid[7][7];
char path[48]="???????????????????????????????????????????????";
int suma = 0;
int x = 0;
int y = 0;
};
bool inRange(int n)
{
bool res = (0<=n && n<7);
return res;
}
int * checkNeightbors(int grid[7... | ALGO | 0.999789 | 3.805898 |
a1e8fbfc-a3a0-4a13-8164-20684d4c6dab | sarvex/leetcode-clojurescript | solution/0800-0899/0868.Binary Gap/Solution.cpp | class Solution {
public:
int binaryGap(int n) {
int ans = 0;
for (int i = 0, j = -1; n; ++i, n >>= 1) {
if (n & 1) {
if (j != -1) ans = max(ans, i - j);
j = i;
}
}
return ans;
}
}; | ALGO | 0.999962 | 6.122662 |
c9d601c0-ec22-4d7c-bc99-ca126cabfdd5 | cec0904/Baekjoon | 프로그래머스/0/250126. [PCCE 기출문제] 8번 / 창고 정리/[PCCE 기출문제] 8번 / 창고 정리.cpp | #include <string>
#include <vector>
using namespace std;
string solution(vector<string> storage, vector<int> num) {
int num_item = 0;
vector<string> clean_storage(storage.size());
vector<int> clean_num(num.size());
for(int i=0; i<storage.size(); i++){
int clean_idx = -1;
for(int j... | ALGO | 0.999743 | 5.729202 |
0c3a5c1a-a92c-4b3c-a8db-c1ff2c1dbf1c | QuocAnh189/167LDTT_UIT | 215121360_LĐTT/Bai108/Bai108.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
float x;
cout << "Enter x: ";
cin >> x;
float S = 1;
float T = 1;
int M = 1;
float i = 1;
float e = 1;
float dau = -1;
while (e >= pow(10, -6))
{
T = T * x;
M = M * i;
e = T / M;
S = S + e;
i = i + 1;
}
cout << "Result is " ... | ALGO | 0.999906 | 3.577526 |
147886b8-7fdb-45ca-baec-514167d8fa1b | MaxMSun/cpp_weekly_homework | Stroustrup_5/2/date_calculate.cpp | #include <iostream>
using namespace std;
struct Date{
int year;
int month;
int day;
};
void initialize(Date *);
void output(Date *);
void calculate(Date *);
int main(){
Date date;
initialize(&date);
output(&date);
calculate(&date);
return 0;
}
void initialize(Date * date){
cout << "input year: ";
... | ALGO | 0.97929 | 4.052762 |
3a5812ef-f4ef-4ede-bcad-70c6570ae7cb | babu-thomas/interviewbit-solutions | kth-manhattan-distance-neighbourhood_solve.cpp | int max_of(int a, int b, int c, int d, int e) {
return max(max(max(a, b), max(c, d)), e);
}
// Time - O(N * K), Space - O(N)
// where N = size of 2d array, K = distance given
vector<vector<int> > Solution::solve(int A, vector<vector<int> > &B) {
int rows = B.size();
int cols = B[0].size();
int max_dis... | ALGO | 0.999974 | 5.730708 |
74bb586b-39ae-40d1-bad3-9310e065fcae | pce913/Algorithm | baekjoon/11005.cpp | #include<stdio.h>
#include<string>
using namespace std;
int main(){
int N,B;
scanf("%d %d",&N,&B);
string ans;
while (N>0){
int r = N%B;
if (r >= 10)
ans += (char)(r + 55);
else
ans += (char)(r + 48);
N /= B;
}
auto it = --ans.end();
for (;it != ans.begin();it--)
printf("%c",*it);
printf("%c", ... | ALGO | 0.999954 | 3.031385 |
6cbcc753-8a91-47e0-9a34-752ca41fa450 | bhyeanhasan/Competitive-Programming-Solutions | Code Forces Problem Solutions/Contest/cf_13_april_/A. Ichihime and Triangle.cpp | /**===========================================================================================
B H Yean Hasan (Noyen)
Patuakhali Science and Technology University
Faculty of Computer Science and Engineering
<EMAIL> /<EMAIL>
/... | ALGO | 0.997995 | 3.437697 |
789f31e1-ed7a-4920-8e4d-023ff4b618d4 | Henrik-Yao/NEUQ-ACM-Solution | week5/谢海源/1哥德巴赫最新猜想.cpp | #include<bits/stdc++.h>
using namespace std;
bool pd(int x)//是否为质数
{
if(x<2) return 0;
for(int i=2;i<=x/i;i++)
{
if(x%i==0) return 0;
}
return 1;
}
int f(int n)
{
if(pd(n)==1) return 1;
else if(n%2==0) return 2;
else if(pd(n-2)==1) return 2;
return 3;
}
int main()
{
int t,n;
cin>>t;
while(t--)
{
cin>>n... | ALGO | 0.999809 | 4.563599 |
a0ab91dd-ea75-415e-b705-60ec03b62c2a | master-hkshenoycse/CP | Contests/Codeforces/Div2_668/C.cpp | #include<bits/stdc++.h>
#include <iterator>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll long long
#define ull long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd long double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#defin... | ALGO | 0.999883 | 3.988822 |
455cc05b-1514-4e1c-bcd3-7cf45b0bc953 | ShravanChandrachud/Daa_codes | 0025_ShravanChandrachud_Ass_5_DAA.cpp | #include <iostream>
#include <vector>
using namespace std;
bool isSafe(const vector<vector<int>> &arr, int x, int y, int n)
{
// Check column for previous rows
for (int row = 0; row < x; row++)
{
if (arr[row][y] == 1)
{
return false;
}
}
// Check upper left diag... | ALGO | 0.999827 | 6.627896 |
c3724dff-43e3-4ae8-b306-021ac7831a2f | TheCalculas/LeetCode | 210-course-schedule-ii/210-course-schedule-ii.cpp | class Solution
{
public:
vector<int> findOrder(int N, vector<vector < int>> &P)
{
vector<vector < int>> G(N);
vector<int> ans, indegree(N);
for (auto &pre: P)
G[pre[1]].push_back(pre[0]),
indegree[pre[0]]++;
queue<int> ... | ALGO | 0.999959 | 5.787673 |
fdaf0337-50e4-4a8f-b830-920458022266 | vuongnguyen168/Ki3nam3 | c++/ptit/CPP0517_DanhSachNhanVien.cpp | #include<bits/stdc++.h>
using namespace std;
struct NhanVien{
string name,gen,dob,add,num,date;
};
long cnt=0;
void nhap(struct NhanVien &a){
if (cnt==0) cin.ignore();
cnt++;
getline(cin,a.name);
getline(cin,a.gen);
getline(cin,a.dob);
getline(cin,a.add);
// cin>>a.num>>a.date;
getline(cin,a.num);
getline(cin,... | ALGO | 0.980112 | 4.37914 |
479b338a-0405-4b86-aeb9-3c9b7acef562 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-cot-gpt35/Codenet/p01393/200960152/response_2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
inline void modify(double& seta) {
if (seta > M_PI)
seta -= 2 * M_PI;
if (seta < -M_PI)
seta += 2 * M_PI;
}
inline bool in_upper(const double& seta) {
return (seta > 1e-8 && seta < M_PI ... | ALGO | 0.998768 | 3.915426 |
2336ebc0-afe9-4260-a876-9afd9b9ce6e5 | SnowySparks/Algorithm_Solve | BackJoon_solved/트리_다이나믹프로그래밍/27501_RGB트리.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
#define F(a,b) for (int i = a ; i <= b ; i++)
const int MAX = 5E5+1;
int dp[MAX][3];
bool v[MAX];
int c[MAX];
vector<int> gh[MAX];
void dfs(int root) {
v[root] = true;
for (auto e : gh[root]) {
if (v[e]) c... | ALGO | 0.999881 | 4.204084 |
fad1c0b2-6710-4b23-9640-13d85efcc701 | zigzig731/Subdivision2 | Szamitogepes_grafika/Subdiv.cpp | #include "Subdiv.hpp"
using namespace std;
Mesh _mesh;
Mesh loadMesh(string fileName)
{
Mesh mesh;
ifstream stream(fileName);
string str;
getline(stream, str);
getline(stream, str);
getline(stream, str);
getline(stream, str);
stream >> str;
while (str == "v")
{
Mesh::Vertex temp;
GLfloat x, y, z;
s... | ALGO | 0.891092 | 4.087857 |
ca4c648c-2cd0-4e3b-8110-f2fb003a96bb | Reddy-Sree217/Cpp-Practice | DSA/MiddleNodeOfTheLinkedList.cpp | //GFG
// https://www.geeksforgeeks.org/write-a-c-function-to-print-the-middle-of-the-linked-list/
#include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
};
void insertNode(Node **head, int value)
{
Node *newNode = new Node();
newNode->data = value;
newNode->next = *he... | ALGO | 0.9999 | 5.435184 |
f2ab1beb-12ab-4dcb-9e48-184d78ea558b | bajtyibity/programowanie-laboratorium-cpp-3 | 4/console.cpp | #include <iostream>
using namespace std;
int main()
{
int liczba, ile = 0, suma = 0, n;
cout << "ile liczb pobrac: ", cin >> n;
cout << endl;
if (n > 0)
for (int i = 0; i < n; i++)
{
cout << "podaj liczbe: ", cin >> liczba;
if (liczba % 2 == 0)
{
ile++;
suma += liczba;
}
}
else
{
c... | ALGO | 0.995981 | 4.168929 |
c449ef4f-20f2-4b09-8d4b-4acb76c9d765 | ktechbyte/leetcode | 0455-assign-cookies/0455-assign-cookies.cpp | class Solution {
public:
int findContentChildren(vector<int>& g, vector<int>& s) {
sort(g.begin(), g.end());
sort(s.begin(), s.end());
int l = 0, r = 0;
while(l<g.size() && r<s.size()){
if(g[l]<=s[r]) l++;
r++;
}
return l;
}
}; | ALGO | 0.999858 | 5.885488 |
b64f0755-4420-4409-a4b1-ae0fea487249 | abhinav-gif/CodingNinjasDSA | Recursion/sumArr.cpp | #include <iostream>
#include <vector>
using namespace std;
int sum(vector<int> v)
{
if (v.size() == 0)
{
return 0;
}
int last = v.back();
v.pop_back();
return last + sum(v);
}
int main()
{
int n;
cin >> n;
vector<int> v;
while (n--)
{
int t;
cin >> t... | ALGO | 0.999919 | 4.546728 |
2982d4d2-d68a-4e44-a03e-26a45b099d30 | RainerGrimm/ConcurrencyWithModernCpp | atomicFlagWait.cpp | #include <atomic>
#include <iostream>
#include <thread>
std::atomic_flag atomicFlag{};
void doTheWork(){
std::cout << "Processing shared data." << '\n';
}
void waitingForWork(){
std::cout << "Worker: Waiting for work." << '\n';
atomicFlag.wait(false);
doTheWork();
std::cout << "Work done." << '\n... | TOOL | 0.893152 | 6.459132 |
6807eb73-b21e-40d8-ac8e-031297b63042 | Xeokj/Baekjoon | 15486.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int N, i;
cin >> N;
vector<int> T(N + 1), P(N + 1), dp(N + 1);
for (i = 0; i < N; i++)
cin >> T[i] >> P[i];
dp[N] = 0;
int Max = 0;
for (i = N - 1; i >= 0; i--) {
int end = i + T[i];
if (end <= N... | ALGO | 0.999921 | 3.270442 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.