uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
e3c432b8-deca-43d0-8e2f-1339de1461ae | NekoYellow/competitive-programming-templates | datastruct/trie.cpp | // https://www.luogu.com.cn/problem/P2580
#include <bits/stdc++.h>
using namespace std;
struct Trie {
static const int R = 26; int pos;
vector<array<int, R>> t; vector<int> cnt;
Trie(): t(1), cnt(1), pos(1) {}
void insert(const string& s) {
int p = 0;
for (auto c: s) { c -= 'a';
... | ALGO | 0.999935 | 4.768672 |
453344ef-6d14-4332-b6f0-fab365231e34 | nchulucifer/leomaster-oi-code | ybt/ybt1029.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
double a, b, r;
long long k;
cin >> a >> b;
k = a / b;
r = a - k * b;
cout << r << endl;
return 0;
} | ALGO | 0.99956 | 3.136518 |
bcd941e5-db46-46fc-b675-a73685ebddbd | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3719_2.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> ans;
string f = "1";
bool sort2(string &a, string &b) {
if (a.size() == b.size()) {
return a < b;
}
return a.size() < b.size();
}
void calc(string s) {
if (s.size() >= 11) {
return;
}
ans.push_back(s);
s += '1';
calc(s);
s.pop_back()... | ALGO | 0.999949 | 5.01966 |
5051f8aa-d18d-48d5-8f04-c48d11ac2879 | deprecate1/example_cpp | github/Cpp-STL-Examples/test_samples/simple_tests/test_quatre.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
void print(string &other) {
string::iterator start = other.begin();
while(start!=other.end()) {
cout << *start;
start++;
}
cout << endl;
}
int main()
{
string name("Hello, Diman ...");
string une(" -... | TOOL | 0.988263 | 3.948169 |
c7fcc200-bf69-4f5a-a9eb-ec0714c00008 | checkoutb/LeetCodeCCpp | daily_challenge/2021/LT_2021-08-19_Decode_Ways.cpp |
#include "../../header/myheader.h"
class LT
{
public:
// D D
//int num(char a,char b) {
// return (a-'0')*10+(b-'0');
//}
//int numDecodings(string s) {
// int len = s.length();
// vector<int> dp(len+1,0);
// dp[0]=1;
// for (int i = 1;i<=len;i++) {
// if (s[i-1]!='0')
// dp[i] = dp[i... | ALGO | 0.99954 | 4.313731 |
6dd3c8be-a257-417f-aced-a4f6a52eb005 | allwellll/cf_code_jiangly | 1734/1734E-E-RectangularCongruence.cpp | //url:https://codeforces.com/contest/1734/problem/E
//time:2022-09-23 15:48:51
//name:E-RectangularCongruence
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
std::cin >> n;
std::vector<int> b(n);
for (int i... | ALGO | 0.999802 | 4.091939 |
d32bdb4b-69fe-45a1-9cfc-c0f7a2eea9e2 | ishandutta2007/codeforces | piyushsethia1999/normal/489/D.cpp | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
std::vector<int> A;
std::vector<std::vector<int> > adj;
void dfs(int v, int lev) {
if(lev == 2) {
A[v]++;
} else {
for (auto i : adj[v])
{
dfs(i, lev + 1);
}
}
}
int main()
{
ios::sync_with_stdio... | ALGO | 0.999775 | 4.253135 |
21e0eed5-45e2-426a-b4db-35cd7184c425 | gualtierovolpe/fondamenti_di_informatica_2024-25 | esercitazione_02/esercizio_02_02/main.cpp | #include <iostream>
#include <cmath>
int main ()
{
double a, b, c;
double p = 0, area = 0;
std::cout << "Inserire le lunghezze dei tre lati di un triangolo: " << std::endl;
std::cout << "Primo lato: ";
std::cin >> a;
std::cout << "Secondo lato: ";
std::cin >> b;
std::cout << "Terzo lato: ";
std::cin >> c;
... | ALGO | 0.992961 | 4.714615 |
9e857d27-6553-4339-ac7e-5992e698239b | acc-cosc-1337-spring-2020/acc-cosc-1337-spring-2020-ramonwalker | src/classwork/03_assign/main.cpp | //write includes statements
#include<iostream>
#include"loops.h"
//write using statements for cin and cout
using std::cin; using std::cout;
/*
Use a do while loop to prompt the user for
a number, call the factorial function, and display the number's
factorial. Also, loop continues as long as user wants to.
*/
int ... | ALGO | 0.952958 | 4.242208 |
424ed3ee-8316-4eb3-8be9-a07042b7df65 | Madhav-Vats/DSA_implementation | 14.DYNAMIC PROGRAMMING/6.DP ON LIS (INCREASING)/Alternating2.cpp | #include <bits/stdc++.h>
using namespace std;
// this code looks less complex for interview
// Why dont we just calculate the answer of both pattern , increment first and then alternation
// or decrement first and then alternating ,
// after calculaating both we will return the ans;
int frec(int i , vector<int> const... | ALGO | 0.999972 | 4.898653 |
fd4e97df-9a37-4abc-bb01-4811ecfe1d81 | patidartanay/Codeforces | lessthan_1300/215A.cpp | #include"bits/stdc++.h"
using namespace std;
int main() {
int n, m, k, l, count=0, mod=-1,z,t;
cin >> n;
int A[n+10];
for(int i=1; i<=n; i++) {
cin>>A[i];
}
cin>>m;
int B[m+10];
for(int i=1; i<=m; i++) {
cin>>B[i];
}
for(k = 1; k<=n; k++) {
for(l = 1; l<=m... | ALGO | 0.999897 | 3.155318 |
edc1cf7a-ef0d-47bc-a254-81623dae03cc | heinhtetn/heinhtetn.github.io | introC++/Functions/call-by-value,ref.cpp | #include <iostream>
using namespace std;
// call by value
void changeValue(int val) // formal prarmeter
{
val = val + 20;
cout << "\nValue inside function: " << val;
}
// call by ref
void changeValueAnother(int *val)
{
*val = *val + 10;
cout << "\nValue inside function: " << (*val);
}
int main()
{
... | ALGO | 0.999596 | 4.57552 |
2306f3a3-3990-4718-ae47-aafc9cc7097b | ElkeMilne/ADDS | Algorithm-Design-Data-Structures-master/practical-7/Autocomplete.cpp | #include "Autocomplete.h"
#include <bits/stdc++.h>
using namespace std;
void Autocomplete::insert(string word) {
TrieNode* curr = root;
for (char c : word) {
if (curr->children[c - 'a'] == nullptr) {
curr->children[c - 'a'] = new TrieNode();
}
curr = curr->children[c - 'a'];
}
curr->term = ... | ALGO | 0.999741 | 6.00463 |
1b742413-a274-4e5c-9289-4825ac7b6ff9 | Minee25/MSU-ComScience | C Fresher1-1/InClassroom/w8.0.cpp | #include <stdio.h>
int main() {
int num1, num2, num3, makKaoi, noiKaoi;
printf("Enter num (1): ");
scanf("%d", &num1);
printf("Enter num (2): ");
scanf("%d", &num2);
printf("Enter num (3): ");
scanf("%d", &num3);
if (num2 >= num1 && num2 >= num3) {
makKaoi = num2;
} else i... | ALGO | 0.999591 | 4.465078 |
4186f5cb-08c6-4253-a436-dd784275c4c6 | sarvex/leetcode-lol-code | solution/2400-2499/2443.Sum of Number and Its Reverse/Solution.cpp | class Solution {
public:
bool sumOfNumberAndReverse(int num) {
for (int x = 0; x <= num; ++x) {
int k = x;
int y = 0;
while (k > 0) {
y = y * 10 + k % 10;
k /= 10;
}
if (x + y == num) {
return true;
... | ALGO | 0.999948 | 6.079369 |
85a0200e-33ab-4607-9f22-1edd21219cd2 | Siesher/Proced_SOD | FIFO.cpp | #include <iostream>
#include <string>
template<typename T>
struct Queue{
T* data;
std::size_t capacity;
std::size_t front;
std::size_t rear;
};
template<typename T>
void initializeQueue(Queue<T>& q, std::size_t intialcapacity){
q.data = new T[intialcapacity];
q.front = 0;
q.rear = 0;
q... | TOOL | 0.9619 | 4.694734 |
789abcaf-5110-40b5-bf54-0c6b3bf7a141 | ScorcherGray/ProjectF | Stuff/CCSC/Decimals/bisect1.cpp | // bisect1.cpp: Computes a zero by the bisection method.
// This version has the problem that the input tolerance
// may be too small. It has other problems too.
// (We'll do a much better version later in the course.)
#include <cassert>
#include <cmath>
#include <iostream>
#include <limits>
using namespace std;
// "... | ALGO | 0.999981 | 6.080382 |
b9209149-0402-447a-8b4c-61c3873077bc | Pratik-Dhadave/Array_Questions | array_level_2.cpp | #include <iostream>
#include<limits.h>
using namespace std;
void extremPrint(int arr[], int size){
for(int i=0; i<size; i++){
cout<<arr[i]<<" ";
}
cout<<endl<<"Extrem print:"<<endl;
for(int left=0, right=size-1; left<=right; left++,right--){
if(left==right){
cout<<arr[left... | ALGO | 0.993468 | 4.032856 |
9b38ea55-efaa-4231-824c-b8f6cbf7459a | ManglaPalak/DSA-cpp | Binary Search/Book Allocation Problem.cpp | bool ispossible(vector<int>& arr, int n, int m,int mid){
int studentcount=1;
int pagesum=0;
for(int i=0;i<n;i++){
if(pagesum+arr[i]<=mid){
pagesum+=arr[i];
}
else{
studentcount++;
if(studentcount>m || arr[i]>mid){
return false;
... | ALGO | 0.999998 | 5.973605 |
a9701ca6-524a-41c3-84d1-d4579f68a8a5 | Brilliant-Developer1/Module_9_SPath | Floyd_Warshall.cpp | // #include<bits/stdc++.h>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstd... | ALGO | 0.999972 | 4.162709 |
23b9507e-7ae3-46bb-9361-5701951d6287 | kmjp/procon | atcoder/abc351-400/abc360/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.99999 | 4.017175 |
57864d1a-844e-40a1-af15-01ecd32b2923 | VagrantTrack149/Programas-simples-c- | Trabajo en clase corregido xd.cpp | /*Nombre del Programa: HORAS PAGADAS
Elabor: Neil Otniel Moreno Rivera No Lista: 20
Fecha: 7/10/2020
Descripcin: Problema PROGRAMA QUE CALCULA EL PAGO A RECIBIR POR HORAS TRABAJADAS*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
float PN, HE, PE, PT, PD, HT, TN;
system("c... | ALGO | 0.999714 | 3.431578 |
6f56a30e-1047-4e38-9f0e-e915f536073e | 4molybdenum2/DSA | Aditya/leetcode/design_linkedList.cpp | class MyLinkedList {
public:
struct ListNode{
int val;
ListNode *pre;
ListNode *next;
ListNode(int x):val(x),pre(NULL),next(NULL){}
};
ListNode *head=NULL;
ListNode *end=NULL;
int len;
/** Initialize your data structure here. */
MyLinke... | ALGO | 0.999763 | 5.022532 |
3a34c6c8-64ff-4813-8a08-1a31a1dec324 | sarvex/leetcode-odin | solution/1800-1899/1826.Faulty Sensor/Solution.cpp | class Solution {
public:
int badSensor(vector<int>& sensor1, vector<int>& sensor2) {
int i = 0;
int n = sensor1.size();
for (; i < n - 1 && sensor1[i] == sensor2[i]; ++i) {}
for (; i < n - 1; ++i) {
if (sensor1[i + 1] != sensor2[i]) return 1;
if (sensor1[i] !=... | ALGO | 0.999923 | 5.229926 |
b5069d40-3689-4ac4-a74a-632484f24c38 | ishandutta2007/codeforces | invusr/normal/799/E.cpp | #include <algorithm>
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long s64;
inline int getint()
{
static char c;
while ((c = getchar()) < '0' || c > '9');
int res = c - '0';
while ((c = getchar()) >= '0' && c <= '9')
res = res * ... | ALGO | 0.999985 | 3.599569 |
d7341cc9-db7a-499f-9e5e-983411cf1ff0 | kmjp/procon | codeforce/421-440/436/b2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999163 | 4.202413 |
769bf987-a529-4917-9bf8-11e3f2cd6775 | elkebir-group/SharpTNI | src/basetree.cpp | /*
* basetree.cpp
*
* Created on: 08-Jan-2019
* Author: P. Sashittal
*/
#include "basetree.h"
#include <lemon/bfs.h>
BaseTree::BaseTree()
: _tree()
, _nodeToId(_tree)
, _idToNode()
, _nodeToIndex(_tree)
, _indexToNode()
, _arcToIndex(_tree)
, _timestamp(_tree)
, _label(_tree)
, _hostLabel()
, _nhosts()
, _... | ALGO | 0.976986 | 3.189079 |
493aa801-f071-4d1f-9808-f3debe75c70f | black-shadows/LeetCode-Topicwise-Solutions | C++/super-egg-drop.cpp | // Time: O(klogn)
// Space: O(1)
class Solution {
public:
int superEggDrop(int K, int N) {
int left = 1, right = N;
while (left <= right) {
const auto mid = left + (right - left) / 2;
if (check(mid, K, N)) {
right = mid - 1;
} else {
... | ALGO | 0.999976 | 6.383873 |
9532958d-9678-4029-ac8c-b65d9b4920ed | dushulin/LeetCode | d6_stack&queue/347-前K个高频元素.cpp | //给定一个非空的整数数组,返回其中出现频率前 k 高的元素。
//
//
//
// 示例 1:
//
// 输入: nums = [1,1,1,2,2,3], k = 2
//输出: [1,2]
//
//
// 示例 2:
//
// 输入: nums = [1], k = 1
//输出: [1]
//
//
//
// 提示:
//
//
// 你可以假设给定的 k 总是合理的,且 1 ≤ k ≤ 数组中不相同的元素的个数。
// 你的算法的时间复杂度必须优于 O(n log n) , n 是数组的大小。
// 题目数据保证答案唯一,换句话说,数组中前 k 个高频元素的集合是唯一的。
// 你可以按任... | ALGO | 0.999986 | 5.695215 |
6210104a-d1c8-43f9-a59b-b1d1701a49d2 | desiish/SDA_2024_2025 | Sem09/Solutions/task02.cpp | #include <map>
#include <unordered_map>
class Solution {
public:
bool isIsomorphic(string s, string t) {
unordered_map<char, char> sM;
unordered_map<char, char> tM;
for(int i = 0; i < s.size(); i++)
{
if(sM.count(s[i]) == 0 && tM.count(t[i]) == 0)
{
... | ALGO | 0.999979 | 6.201611 |
cae64980-ac63-4043-98cf-70da7b87bfce | harshit-jain52/CP_DSA | codeforces/1886C.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
const int M = 1e9 + 7;
void solve()
{
string s;
cin >> s;
ll n = s.size(), pos;
cin >> pos;
int mark[n] = {0};
int curr = n;
stack<int> st;
for (int i = 0; i < n; i++)
{
while (!st.empty() && s[st.top()] > s[i])
{
m... | ALGO | 0.999989 | 4.40283 |
a452b455-ed7d-4370-b605-771d397edcd8 | NiranjanVpatil/Design-Ananlysis-Of-Algorithm | Knapsack_305.cpp | // Implement 0/I knapsack using Greedy Approach.
// fractional knapsack problem
#include<iostream>
using namespace std;
int knapsack(int n, float w[], float p[],int I[], float max)
{
float tp=0, u=max, x[10];
int i;
for(i=0; i<n; i++)
x[i] = 0;
for(i=0; i<n; i++)
{
... | ALGO | 0.999931 | 4.434324 |
b5da5928-b7c3-4a13-adc1-4666cbedc061 | hrishi7/techInterviewPrep | miscellaneous Problems/inversion_count.cpp |
#include<iostream>
using namespace std;
long long mergeAndGetInversionCount(int arr[],int l, int m, int r){
int i=l, j = m, k=0;
int temp[r - l + 1];
long long count = 0;
while (i < m && j <= r)
{
if (arr[i] <= arr[j])
{
temp[k++] = arr[i++];
}
else
... | ALGO | 0.999969 | 4.3738 |
27d81479-579b-45b2-942a-31bbb1952d53 | menaehab/Codeforces-Solutions | 1001 - 2000 problems/E_K_Balanced_Teams.cpp | #include <bits/stdc++.h>
#define ll long long
#define el '\n'
#define all(arr) arr.begin(), arr.end()
#define allr(arr) arr.rbegin(), arr.rend()
#define pi 3.14159265358979323846
using namespace std;
void setup()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", ... | ALGO | 0.999974 | 4.275002 |
4ed350ed-1052-4367-a24f-3c9e5bae1c44 | Sobhyz/CodeForces-ProblemSolving | AnotherPermutaionProblem.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll t,n;
int main() {
cin>>t;
while(t--){
cin>>n;
ll ans=0;
for(ll i=1;i<=n;i++){
ll tmp=0,x=1,mx=0;
for(ll j=1;j<n-i+1;j++) {tmp+=(j*x);mx=max(mx,j*x);x++;}
for(ll j=n;j>=n-i+1;j--) {tmp+=(j*x)... | ALGO | 0.999763 | 3.654825 |
bc671f8b-3f90-411d-be2f-46931288c369 | AbdulTawabJuly/3rd-Semester | DSA Lab Final Prep/Q2.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <cassert>
using namespace std;
#define EMPTY 0
#define DELETED 1
#define OCCUPIED 2
template<class v>
struct HashItem
{
v value;
short status;
HashItem()
{
status = EMPTY;
}
};
template<class v>
class HashMap
{
protected:
HashItem<v>* hashArray... | ALGO | 0.998969 | 4.647418 |
bb16f778-3dbb-40e9-96d8-3b2e98163e37 | ZiqiChai/DataStructure | problems/daishu_guohe.cpp | #include <iostream>
#include <vector>
using namespace std;
int least_step(int*list, int*pFlag, int len, int index) {
int steps = 0;
if (list[index] + index >= len) {
pFlag[index] = 1;
return 1;
}
if (list[index] == 0) {
pFlag[index] = -1;
return -1;
}
int steps_below = -1;
for (int k = list[index]; k >... | ALGO | 0.999943 | 3.576741 |
ee1f6be0-618e-4f63-beed-5f0ae660d22e | giovaneaf/CompetitiveProgramming | Contests/South America ICPC/2017/C.cpp | /*
Count frequencies and check the possible cases:
if the least frequent value + 2 is equal to the highest frequent value and all between then are equal to
least frequent value + 1 then you need to change the highest frequent to the least frequent.
else if the least frequent value is one less then all other values the... | ALGO | 0.999993 | 3.586564 |
341b2411-d176-4f30-957c-f8c54bdad28b | CFOP2357/competitive_programing | codeforces/Codeforces Round #632 (Div. 2)/F.cpp | #include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<... | ALGO | 0.999726 | 3.791744 |
e258d54e-f02a-45e6-a1b5-9ac20505cf7f | CodderPrince/Other_Practice | Other's Practice/Small_to_Large.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nl endl
int main()
{
ll t;
cin >> t;
for (int i = 1; i <= t; i++)
{
vector<int> arr(3);
for (auto &x : arr)
{
cin >> x;
}
sort(arr.begin(), arr.end());
cout << "Case "... | ALGO | 0.998714 | 4.773406 |
bdfe9dd0-57d2-437b-a8f2-6f2340c292f8 | Moinuddin02/DSA-With-Cpp | switch_case.cpp | #include <iostream>
using namespace std;
int main()
{
int a, b;
cout << "Enter the value of a " << endl;
cin >> a;
cout << "Enter thr value of b " << endl;
cin >> b;
char ch;
cout << "Enter the operation which do you want to perform " << endl;
cin >> ch;
switch (ch)
{
case... | ALGO | 0.889836 | 3.198295 |
1f3fe360-50e5-4dd6-aaf0-d238925f05a3 | kadyan2001/dsa | Array/RotateKelementRight.cpp | #include<bits/stdc++.h>
using namespace std;
void reverse(int arr[],int start,int end){
while(start<=end){
int temp=arr[start];
arr[start]=arr[end];
arr[end]=temp;
start++;
end--;
}
}
void rotateToRight(int arr[],int n,int k){
//reverse first n-k elements
revers... | ALGO | 0.999992 | 4.489401 |
c2755214-4038-4933-9ba1-7ad6d79b7701 | geez6572/leetcode | cpp/medium/SimplifyPath.cpp | #include <string>
using namespace std;
string simplifyPath(string path) {
string rs;
rs.push_back('/');
int index = 1;
while (index < path.size()) {
string cur;
if (path[index] == '.') {
while (index < path.size() && path[index] != '/') {
cur.push_back(path[index]);
index++;
... | ALGO | 0.999626 | 4.936842 |
b02be9b8-057f-4875-aec7-d89ec0477231 | SrayanBhattacharyya/CP_SolvedProblems | codeforces/1620/C.cpp | //Srayan Bhattachrayya JU EE
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(ll i=0;i<n;i++)
#define rev(i,n) for(ll i=n;i>=0;i--)
#define rev_a(i,a,n) for(ll i=n;i>=a;i--)
#define rep_a(i,a,n) for(ll i=a;i<n;i++)
typedef pair <ll, ll> pll;
typedef vector <l... | ALGO | 0.999942 | 4.334771 |
4da64df5-cdab-4440-ad91-66c3c1a01dda | Mohit-106/DSA_Level_2 | ArrayAndString/3_SquareOfSortedArrays.cpp | // class Solution {
// public:
// vector<int> sortedSquares(vector<int>& nums) {
// int i=0,j=nums.size()-1,k=nums.size()-1;
// vector<int>res(nums.size());
// while(i<=j){
// int val1 = nums[i]*nums[i];
// int val2 = nums[j]*nums[j];
// res[k--]=max(val1,... | ALGO | 0.999983 | 5.667402 |
e1acf9cb-e364-4197-8d52-196059311b9e | Metrological/cobalt | src/third_party/llvm-project/libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp | // <set>
// class multiset
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
#include <set>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
int main()
{
{
typedef int V;
typedef std... | TEST | 0.953269 | 4.899806 |
5f4320a6-e36c-4ae5-b73b-3d2809cea0ee | visuraj/100--Days--of--code | Binary Search/search_is_sorted_rotated.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int n = nums.size();
int low = 0;
int high = n - 1;
while(low <= high) {
int mid = (low + high) / 2;
if(nums[mid] == target) return mid;
if(nums[low] <= nums[mid]) { // left half ... | ALGO | 0.999975 | 6.268457 |
75451479-db1c-4619-b980-c654759f2665 | sarvex/leetcode-chicken | solution/1100-1199/1155.Number of Dice Rolls With Target Sum/Solution.cpp | class Solution {
public:
int numRollsToTarget(int n, int k, int target) {
const int mod = 1e9 + 7;
int f[n + 1][target + 1];
memset(f, 0, sizeof f);
f[0][0] = 1;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= min(target, i * k); ++j) {
for (in... | ALGO | 0.99999 | 6.175041 |
21f1acc6-6644-470b-91ee-8f13516abb7d | dipprog/Competitive-Programming | Sorting/quick_sort.cpp | #include<iostream>
using namespace std;
// partitioning the array (finding an element correct position in the array)..
int partition(int *arr, int first,int last){
int pivot = arr[last]; // Pivot element (partioning element taken as last elenment in the array in this case)..
int i = first -1; // initially i is point... | ALGO | 0.999956 | 5.301572 |
d8c010ab-3671-426a-97e2-53a44ce299e5 | ikarus-project/ikarus-examples | src/iks004_kirchhoffPlate.cpp | #include <config.h>
#include <matplot/matplot.h>
#include <numbers>
#include <dune/common/indices.hh>
#include <dune/functions/functionspacebases/boundarydofs.hh>
#include <dune/functions/functionspacebases/subspacebasis.hh>
#include <dune/functions/gridfunctions/analyticgridviewfunction.hh>
#include <dune/geometry/q... | ALGO | 0.989867 | 5.760297 |
90a61fdf-b3fa-4218-8006-549cfca9b024 | FardinShafi/toph-easy-2020975 | bigfactorials.cpp | #include <iostream>
using namespace std;
unsigned long long calculate_factorial(int N) {
unsigned long long result = 1;
for (int i = 1; i <= N; ++i) {
result *= i;
}
return result;
}
int extract_last_4_digits(unsigned long long num) {
return num % 10000;
}
int main() {
int N;
cin ... | ALGO | 0.999603 | 5.310617 |
1a1a6326-c01e-400b-9032-410928fbf933 | kyrre/cryptopals | src/utils.cpp | #include <boost/algorithm/string.hpp>
#include <chrono>
#include <iomanip>
#include <iostream>
#include <random>
#include <sstream>
#include <stdexcept>
#include <string>
#include <thread>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "bytearray.h"
#include "utils.h"
using namespace std... | TOOL | 0.98099 | 4.975317 |
3b148d87-8d2e-40a5-bfde-f235dff2ac69 | gnorambuena/randomCodes | c++/601A.cpp | #include<bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define bits(x) __builtin_popcount(x)
#define gcd(x,y) __gcd(x,y)
#define lcm(x,y) (x)/gcd(x,y)*(y)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
con... | ALGO | 0.999798 | 4.074423 |
5ad09e2a-7660-43d5-87f9-6e3208fe470a | and-gue/NeaTS | lib/sdsl-lite/tutorial/expl-11.cpp | #include <iostream>
#include <sdsl/int_vector.hpp>
#include <sdsl/rank_support_v.hpp>
#include <sdsl/select_support_mcl.hpp>
using namespace std;
using namespace sdsl;
int main()
{
bit_vector b = {0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1};
size_t cnt10 = rank_support_v<10, 2>(&b)(b.size());
select_support_mcl<10,... | ALGO | 0.996505 | 3.91529 |
e07d9d69-7253-4ec5-a3a9-357c060dc490 | jovinlidan/competitive-programming | CodeForces/GNU C++17/1248A | Integer Points/66530271.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long int n, m, N[100005], M[100005], j, k, i, a, b, counts=0, nOdd=0, nEven=0, mOdd=0, mEven=0, nTemp=0, mTemp=0;
int T;
cin >> T;
for(i = 0; i < T; i++)
{
... | ALGO | 0.999941 | 3.439742 |
4be8f999-f697-46d6-b72c-93aefd7c40c8 | masinag/influential_spreaders_multilayer_networks | src/evaluation/evaluate.cpp | #include <fstream>
#include <cassert>
#include <iostream>
#include "ranking.h"
#include "io.h"
string DATASETS_DIRS[2] = {"../../data/multiplex/extracted/", "../../data/multilayer/generated"};
string SIMULATIONS_DIR = "../../results/simulations/";
string ALGORITHMS_DIR = "../../results/algorithms/";
string RANKING_DI... | ALGO | 0.998467 | 4.745659 |
d7640a91-df27-4c0f-8312-7a3c20d5bab1 | AveePB/Algorithms-and-Data-Structures | szkopul/drzewo-sterna-brocota.cpp | #include <bits/stdc++.h>
using namespace std;
int max_lvl{};
void next_element(pair<int, int> left, pair<int, int> mid, pair<int, int> right, int curr_lvl){
if(curr_lvl++ > max_lvl) return;
pair<int, int> new_mid;
new_mid = {
left.first + mid.first,
left.second + mid.second
};... | ALGO | 0.999762 | 3.353796 |
ed19b28d-c409-4bf8-a79a-e8179f89d735 | raincross7/code-similarity | codes/train_code/problem133/problem133_308.cpp | #include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
using namespace std;
int main() {
double x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
printf("%.7f \n", sqrt(pow((x2-x1), (double)2) + pow((y2-y1), (double)2)));
} | ALGO | 0.999014 | 3.743778 |
4e096def-08ec-4bf3-9ca2-16d1ec00724c | shreejitverma/SDE-Interview-Prep | competitive-programming/Bit Manipulation/Find position of set bit.cpp | /*Given a number N having only one ‘1’ and all other ’0’s in its binary representation, find position of the only set bit. If there are 0 or more than 1 set bit the answer should be -1. Position of set bit '1' should be counted starting with 1 from LSB side in binary representation of the number.
Example 1:
Input:
N... | ALGO | 0.999781 | 5.7577 |
65f6d20d-8f41-44aa-92b4-66fdb3c5ddbe | carussell/nvvg | SAGE1.1Src/Demo 00/SAGE/Source/Common/MathUtil.cpp | /////////////////////////////////////////////////////////////////////////////
//
// 3D Math Primer for Games and Graphics Development
//
// MathUtil.cpp - Miscellaneous math utilities
//
// Visit gamemath.com for the latest version of this file.
//
///////////////////////////////////////////////////////////////////////... | TOOL | 0.98303 | 6.748005 |
fa1a13e0-a7b1-46de-b500-0d9831f137b0 | ishandutta2007/codeforces | bench0310/normal/1605/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
string s;
cin >> s;
int res=n+1;
for(int i=0;i<n;i++)
{
array... | ALGO | 0.999736 | 4.024374 |
41fe1742-2332-4c1a-96a5-032df8cb3975 | yuuusha/university-tasks | с++/семинар11.05.2022/2vecmanual.cpp | #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <algorithm>
#include <random>
#include <ctime>
using namespace std;
bool* eratos(int n) {
n++;
bool* a = new bool(n);
a[0] = false;
a[1] = false;
for (int i = 2; i < n; i++)
a[i] = true;
for (int i = 2; i * i < n; i++)
for (in... | ALGO | 0.999551 | 3.926728 |
abc6b314-05ea-4360-8fdc-dbf0b792a798 | ishandutta2007/codeforces | primenumber/normal/322/C.cpp | #include <iostream>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>
#define rep(i,n) for(int i = 0;i < n;i++)
#define rep2(i,n) for(int i = 1;i <= n;i++)
#define each(i,x) for(auto & i : x)
u... | ALGO | 0.999985 | 3.296525 |
f2d917d8-2f4b-497c-a868-738161b8cb98 | anthony-chaudhary/sdc-p10-mpc-linux | quizes/CarND-MPC-Quizzes-master/global_kinematic_model/src/Eigen-3.3/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp | MatrixXd X = MatrixXd::Random(5,5);
MatrixXd A = X + X.transpose();
cout << "Here is a random symmetric 5x5 matrix, A:" << endl << A << endl << endl;
SelfAdjointEigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << ... | ALGO | 0.999617 | 3.056724 |
3ca137c9-0cfc-4a78-9df1-65b7defd6a24 | panda2134/OICode | NOIOJ/1.11/01.cpp | #include <iostream>
using std::cin;
using std::cout;
using std::endl;
long long n, m, a[100010], tmp, ans;
inline long long abs(long long x){
return x>0?x:-x;
}
int find(long long l,long long r){
long long m=(l+r)/2;
//cout<<"l,r,m,tmp "<<l<<' '<<r<<' '<<m<<' '<<tmp<<endl;
if(l==r){
long long t1=abs(tmp-a[l-1]),... | ALGO | 0.999994 | 3.576588 |
949ef1df-5c43-4254-956d-ec7d791bf88d | rishika-on-git/CP | 800 rating/nextRound.cpp |
// #include <iostream>
// using namespace std;
// int main() {
// int n, k;
// cin >> n >> k;
// int cnt = 0;
// int arr[n];
// for (int i = 0; i < n; ++i) {
// cin >> arr[i];
// }
// int k_score = arr[k - 1];
// for (int i = 0; i < n; ++i) {
// if (arr[i] >= k... | ALGO | 0.999981 | 4.868781 |
7e8fdc0c-426b-4278-8260-1d55ccc8a159 | Anshullakhera/DSA-CPP | DP/Count the Coprimes.cpp | class Solution {
public:
int cntCoprime(vector<int>& arr) {
// code here
int n = arr.size(), m = 0;
for(int i = 0; i < n; i++) m = max(m, arr[i]);
vector<int> freq(m + 1, 0), dp(m + 1, 0);
for(int i = 0; i < n; i++) freq[arr[i]]++;
for(int i = m; i >= 1; i--) {
... | ALGO | 0.999908 | 5.051231 |
b2b205ab-50fd-408e-9ee7-4d8bd80973ea | saarang123/Competitive-Programming | codeforces/1417B.cpp | #include <bits/stdc++.h>
using namespace std;
using ld = long double;
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
template<class T> bool remin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool remax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
std::mt19937 ... | ALGO | 0.999984 | 4.299749 |
f12722af-2ac3-4a8d-8a21-218da37a9ef7 | Rhithick02/C-code | Codeforces/1332/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define lli long long
#define For(i,a,n) for(int i=(a);i<n;i++)
#define vi vector<int>
#define vil vector<long long>
#define asc(x) x.begin(),x.end()
#define des(x) x.rbegin(),x.rend()
#define pb push_back
#define pa pair<int,int>
#define pal pair<long long,long long>
#defin... | ALGO | 0.999937 | 3.69815 |
6399d052-a040-42cd-8d84-c273cfdb8936 | gavinsyw/LeetCodeCheck | 39.cpp | // 52ms, 16MB
class Solution {
public:
vector<vector<int>> combinationSum(vector<int>& candidates, int target) {
if (candidates.size() == 0)
return {};
map <int, vector<vector<int>>> solutionSet;
for (int c:candidates) {
for (int i = 0; i < target+1; ++i) {
... | ALGO | 0.999997 | 6.519659 |
a723bc7b-75cf-45a4-a3c8-94c8e41265e8 | bm-mit/Codeforces | 567A_LinelandMail.cpp | //* 202559368 Apr/18/2023 10:30UTC+7 Minh4893IT A - Lineland Mail GNU C++17 Accepted 265 ms 400 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> arr(n);
for (auto &elem : arr)
cin >> elem;
cout << arr[1] - arr.front() << ' ' << arr.back() - arr.f... | ALGO | 0.999601 | 4.15043 |
468f7d52-ae16-4057-850d-2b31da6d894a | alexmaruichen/code | game/3105.cpp | #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long LL;
const int maxn = 110;
LL tot, ans;
int n, top;
int a[maxn], b[35], q[110];
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]), tot += a[i];
sort(a + 1, a + n ... | ALGO | 0.999939 | 3.573436 |
d1d30958-28f8-4e62-8d42-1d982514f335 | marvynclouet/gsbAppFlutter | 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 |
0e342983-4289-4880-808e-ccfb0915cddc | Yang-33/learn-cpp | threads/multithreads.cpp | #include <iostream>
#include <thread>
#include <vector>
#include <mutex>
std::mutex mtx;
void foo(int a){
std::lock_guard<std::mutex> lock(mtx);
std::cout << a << '\n';
std::cout<<"thread id: "<<std::this_thread::get_id()<< std::endl;
}
int main(){
int N; std::cin >>N;
// const int N = 20;
st... | ALGO | 0.887355 | 4.406345 |
c49d99c4-4445-429e-b458-57053661a8f6 | agisna0106/cpp | stack.cpp | #include <iostream>
#define MAX 3
using namespace std;
struct Stack{
int top;
int value[MAX];
};
void initStack(Stack *stack) {
stack->top = -1;
}
bool isEmpty(Stack *stack) {
return stack->top == -1;
}
bool isFull(Stack *stack) {
return stack->top == MAX-1;
}
void push(Stack *stack, int data) {
if(isFull(st... | ALGO | 0.978854 | 4.529287 |
c433c050-e82f-44df-93ae-8ab7e50d889f | abhishekk-788/LeetCode | 962-maximum-width-ramp/962-maximum-width-ramp.cpp | class Solution {
public:
int maxWidthRamp(vector<int>& nums)
{
vector<pair<int, int>> vec;
int n = nums.size(), ans = 0;
for(int i = 0; i < n; i++)
{
int j = i;
if(vec.empty() || vec.back().first > nums[i]) {
vec.push_back({nums[... | ALGO | 0.999981 | 5.803098 |
33c909fe-9a1e-4b00-be52-72b974c7ac5a | PaulinaJuzwicka/MP3---java | KR/ASD2_Paulina_Juźwicka.cpp | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
int calculateChecksum(const string& str, int length)
{
int checksum = 0;
for(int i = 0; i < length; i++)
checksum += (int)str[i];
return checksum;
}
void searchPattern(const string& pattern, const string& text)
{
in... | ALGO | 0.998262 | 4.663596 |
d17a3850-daf2-4cb0-8553-8d3a97e7eed1 | srivaayush/LeetHub-Practice | 2239-find-closest-number-to-zero/2239-find-closest-number-to-zero.cpp | class Solution {
public:
int findClosestNumber(vector<int>& nums) {
int mini=INT_MAX,mn=0;
for(auto &x:nums){
int p=abs(x);
if(mini>p){
mini=p;
mn=x;
}
if(mini==p){
mini=p;
mn=max(mn,x);
... | ALGO | 0.999994 | 5.623051 |
e7c65569-d866-4cf3-8b71-fb8d2d789c22 | ishandutta2007/codeforces | suiseiseki/normal/1572/E.cpp | #include <cstdio>
#include <algorithm>
typedef long long ll;
const ll Inf_ll=0x3f3f3f3f3f3f3f3fll;
const int Inf_int=0x3f3f3f3f;
const int Maxn=200;
int n,K;
int x[Maxn+5],y[Maxn+5];
struct Node{
ll area;
int cnt;
Node(ll _area=0,int _cnt=0){
area=_area;
cnt=_cnt;
}
friend bool operator <(Node a,Node b){
if(... | ALGO | 0.999969 | 4.579653 |
4b14f18e-7e1f-42d6-9626-6649fe8cdb63 | memi1/Uni_Cpp | Basics/lab09_ex9.cpp | #include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
const int INTERVAL = 100;
double pointDist(double x, double y)
{
double sq_x = x * x;
double sq_y = y * y;
double distance = sqrt(sq_x + sq_y);
return distance;
}
double pi(int circle_points, int square_points)
{
double p =(double)... | ALGO | 0.999413 | 4.239548 |
1bc370ce-1eb6-47a7-a7e1-d3b7ca3f22b0 | pathakshubham21/CP-Coding | DSA Topics/String/are_String_Anagram.cpp | // Problem statement
// You have been given two strings 'STR1' and 'STR2'. You have to check whether the two strings are anagram to each other or not.
// Note:
// Two strings are said to be anagram if they contain the same characters, irrespective of the order of the characters.
// Example :
// If 'STR1' = “listen” an... | ALGO | 0.999976 | 6.053581 |
4ec0b0b4-0f19-4d5c-bae9-22108df1b772 | haoranleo/Robo_Lab | core/src/Strategy/skill/PenaltyDefV2.cpp | #include "PenaltyDefV2.h"
#include "skill/Factory.h"
#include <VisionModule.h>
#include <PlayerCommand.h>
#include <CommandFactory.h>
#include <ControlModel.h>
#include "BallStatus.h"
#include <BestPlayer.h>
#include <robot_power.h>
#include "RobotCapability.h"
#include "GDebugEngine.h"
#include "GoaliePosV1.h"
namesp... | TOOL | 0.991164 | 5.901514 |
45473d11-b6dd-44c0-8eb5-855bc5c77074 | lammps-qmdff/lammps-qmdff | lammps-modified/src/USER-SMD/compute_smd_tlsph_shape.cpp | #include <string.h>
#include "compute_smd_tlsph_shape.h"
#include "atom.h"
#include "update.h"
#include "modify.h"
#include "comm.h"
#include "force.h"
#include "memory.h"
#include "error.h"
#include "pair.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Eigen/Eigen>
#include ... | TOOL | 0.984016 | 5.60298 |
b8ccaa32-940c-4d27-9b1b-9e41241b7a7c | pastgonex/Algorithm_go | 03_算法竞赛进阶指南/02_基本数据结构/0x12_Queue/02_Earthworms.cpp | /*
* Project: 0x12_Queue
* File Created:Monday, December 28th 2020, 8:26:16 am
* Author: Bug-Free
* Problem: AcWing133. 蚯蚓
*/
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
const int N = 1e5 + 10;
int n, m, q, u, v, t;
queue... | ALGO | 0.999889 | 3.861533 |
cf991241-2ac5-404f-b2c6-245b3e72defa | earnest2653/DSA010179 | 3.Program to compute the average of three integers.cpp | #include <iostream>
int main() {
// Declare variables to store user input
int num1, num2, num3;
// Read three integers from the user
std::cout << "Enter the first integer: ";
std::cin >> num1;
std::cout << "Enter the second integer: ";
std::cin >> num2;
std::cout << "Enter the third ... | ALGO | 0.956133 | 5.8023 |
59cad2c5-50c8-45b5-8b82-6251d466e6aa | vibhuti-jadav/assesment-cpp | 8-Indicator/Q-2/Cubes.cpp | #include <iostream>
using namespace std;
int cube(int n) {
return n * n * n;
}
int main() {
int rows, cols;
cout << "Enter array's size:";
cin >> rows >> cols;
int arr[rows][cols];
int *ptr = &arr[0][0];
cout << "Enter array elements:\n";
for (int i = 0; i < rows; i++) {
fo... | ALGO | 0.997434 | 4.124767 |
7c37c59d-28a2-4c54-b73f-bc1eba7e880e | tcbrindle/advent_of_code_2021 | dec10/main.cpp |
#include "../common.hpp"
#include <stack>
constexpr auto illegal_char_score = [](char c) -> int
{
switch (c) {
case ')': return 3;
case ']': return 57;
case '}': return 1197;
case '>': return 25137;
default: return 0;
}
};
constexpr auto autocomplete_char_score = [](char c) -> int
{
... | ALGO | 0.998639 | 7.005144 |
7e7c5112-d9de-4629-ae58-b8d430d3cdd0 | leggedrobotics/perfectlyconstrained | open3d_slam_rsl/open3d_slam/open3d_slam/src/OptimizationProblem.cpp | /*
* OptimizationProblem.cpp
*
* Created on: Nov 12, 2021
* Author: jelavice
*/
#include "open3d_slam/OptimizationProblem.hpp"
#include <open3d/io/PoseGraphIO.h>
#include <open3d/pipelines/registration/GlobalOptimization.h>
#include "open3d_slam/Submap.hpp"
#include "open3d_slam/SubmapCollection.hpp"
#inclu... | ALGO | 0.974295 | 6.499749 |
b6e02856-0f4e-4bed-b574-f4eb109c7b05 | xin-yu-liu/ClickHouse | src/Functions/bitAnd.cpp | #include <Functions/FunctionFactory.h>
#include <Functions/FunctionBinaryArithmetic.h>
namespace DB
{
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
}
namespace
{
template <typename A, typename B>
struct BitAndImpl
{
using ResultType = typename NumberTraits::ResultOfBit<A, B>::Type;
static conste... | TOOL | 0.958706 | 7.83195 |
7d3f74a6-6b33-472e-b326-2ac58b03bbe8 | lucelujiaming/mySoxTest | RaytraceGroundUp/Chapter28.4.3_linux_horse/Matrix.cpp | #include "stdafx.h"
// This file contains the definition of the class Matrix
#include "Matrix.h"
// ----------------------------------------------------------------------- default constructor
// a default matrix is an identity matrix
Matrix::Matrix(void) {
for (int x = 0; x < 4; x++)
for (int y = 0; y < ... | ALGO | 0.975311 | 4.025345 |
28e46218-7bcc-4357-8da4-44831983ac8a | doanvandiep/KyThuatLapTrinh_PTIT | QUEUE003 - Tính thời gian cần thiết để mua vé.cpp | #include<bits/stdc++.h>
using namespace std;
int timeRequiredToBuy(vector<int>& tickets, int k) {
int time=0;
queue<int> q;
int n=tickets.size();
for(int i=0;i<n;i++) q.push(i);
while(true)
{
if(tickets[k]==0) break;
int curr=q.front();
... | ALGO | 0.999376 | 4.258949 |
c85b21c2-f8ca-4e46-9386-32cafd00bf7f | ishandutta2007/codeforces | heart_blue/normal/1676/C.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bi... | ALGO | 0.999954 | 4.276194 |
a7142c61-ad78-417f-8f6d-1eb27e82e9e0 | Parvejprv/CPP-DSA-180-Days | Day 036 Binary search hard Interview problems - Aggressive cow, KOKO eating bananas/class challenge/KOKOEatingBananas_optimizedApproach.cpp | /*
OPTIMIZED Approach
-----------------------
Question:-
875. KOKO eating bananas
*/
#include<iostream>
#include<vector>
using namespace std;
int kokoEatingBananas(vector<int>& piles, int n, int h){
int start = 0, end = 0, mid, ans = -1;
long long sum = 0;
for(int i=0; i<n; i++){
sum += piles[i]; // ... | ALGO | 0.999887 | 5.407941 |
8fcef3dd-3f5c-4cc7-98f4-d0f65fc0bdff | avastino7/Algorithms-Data-Structures | Gray Code.cpp | /*
An n-bit gray code sequence is a sequence of 2n integers where:
Every integer is in the inclusive range [0, 2n - 1],
The first integer is 0,
An integer appears no more than once in the sequence,
The binary representation of every pair of adjacent integers differs by exactly one bit, and
The binary representation o... | ALGO | 0.999904 | 6.683695 |
42f87e76-ec1c-4f9b-8ff6-44acb9daaa5a | Murilomsq/precalculated-beziers-opengl | OpenGlTemplate/Libraries/include/glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if (static_cast<unsigned>(n) > 63) { std::printf("r... | ALGO | 0.999235 | 4.846448 |
c3c4fe8c-57a9-42e8-b20c-96e07fd6c774 | raincross7/code-similarity | codes/train_code/problem218/problem218_264.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#d... | ALGO | 0.999693 | 3.39917 |
08aa2988-cbd1-4682-9748-b133bcbe2c69 | ranamihir/CPP-Programs | Sums in a Triangle (Tutorial).cpp | #include <iostream>,<algorithm>
using namespace std;
int main(){
int t,n,i,j;
cin>>t;
while(t--){
cin>>n;
int a[99][99];
for(i=0;i<n;i++)
for(j=0;j<=i;j++)
cin>>a[i][j];
for(i=n-2;i>=0;i--)
for(j=0;j<=i;j++)
a[i][j]+=max(a[i+1][j],a[i+1][j+1]);
cout<<a[0][0]<<endl;
}
return 0;
}
| ALGO | 0.99939 | 3.088831 |
a017664b-609c-4d4d-8cc3-f6df31090822 | moad6127/Study_Cpp | Programmers/Level1_Re/level1_between/main.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
long long solution(int a, int b) {
long long answer = 0;
int m = max(a, b);
int n = min(a, b);
for (n; n <=m; n++)
{
answer += n;
}
return answer;
} | ALGO | 0.999697 | 4.61761 |
13019c24-d6c3-40d7-a838-8f03c3d5914a | Bikubisw/Coding | DATA STRUCTURES AND ALGORITHMS/sum_of_two array_like_a_number.cpp | #include <iostream>
using namespace std;
void sumOfTwoArrays(int input1[], int size1, int input2[], int size2, int output[]){
int carry=0;
int i=size1-1;
int j=size2-1;
int k=max(size1,size2);
while(k>=0){
if(i>=0&&j>=0){
output[k]=input1[i]+input2[j]+carry;
if(output[k]>9){
carry=1;
output[k]=output[k]%10... | ALGO | 0.999994 | 4.044462 |
81aa4964-c564-47ee-9277-2df49d1385e6 | Biggergig/Advent-of-code-2020 | Day 14/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <sstream>
#include <bitset>
using namespace std;
struct mask{
vector<int> adj;
string bMask;
mask(){}
mask(string inp){
stringstream ss(inp);
string temp;
ss>>temp>>temp>>temp;
for(auto c:... | ALGO | 0.988094 | 3.859057 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.