uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d874364c-3ebb-495e-bfbb-73af381f9f80 | nighbee/ADScourse | lab3/k.cpp | #include <iostream>
#include <vector>
#include <climits>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> arr(n);
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
int minLength = INT_MAX;
int currentSum = 0;
int start = 0;
for (int end = 0; end < ... | ALGO | 0.999921 | 4.908117 |
99a4218b-b234-4231-ad55-ef7c8f29acd9 | ravibhushan10/ROHIT-DSA | CONVERSION/LECTURE13/sumof_digit_in_singledigit.cpp | // sum of digit in single digit
#include<iostream>
using namespace std;
int main()
{
int num, rem;
cout << "enter the number:";
cin >> num;
while (num > 9)
{
int ans = 0;
while (num > 0)
{
rem = num % 10;
num = num / 10;
ans = ans + rem;
... | ALGO | 0.999915 | 4.806699 |
19031c2d-81f7-4234-a683-044a9a8ac0b2 | imrangit07/LEARNING-CPP | ESalary/salary.cpp | #include <iostream>
using namespace std;
int main()
{
int salary, da, in;
cout << "Enter your salary: ";
cin >> salary;
if (salary < 150000)
{
da = (salary / 100) * 20;
in = (salary / 100) * 10;
cout << salary + da + in;
}
else if (salary > 150000 && salary < 35000... | TOOL | 0.960226 | 3.330989 |
947e1934-9e5c-4040-ae36-9f78a50fc9ab | Ahmadkashif/ProblemSolving_LeetCode | Recursion/1752_CheckifArrayIsSortedandRotated.cpp | class Solution {
public:
int count = 0;
int getNum(vector<int>& n,int i){
if( i == n.size() - 1)
return n[i];
else{
count = (getNum(n,i + 1) - n[i] >= 0 ? count : count + 1);
return n[i];
}
}
bool check(vector<int>& nums) {
... | ALGO | 0.999982 | 5.576359 |
101b117b-7895-49a7-805c-57adae42044f | maria2021831011/codefilecpp | p.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
long long k;
cin >> n >> k;
vector<int> d(n);
for (int i = 0; i < n; ++i) {
cin >> d[i];
}
sort(d.begin(),... | ALGO | 0.999881 | 4.102088 |
4f4fd4ef-4d0f-4b0c-aabe-c03888b13346 | avplayer/proxy | third_party/boost/libs/interprocess/example/doc_spawn_vector.cpp | #include <boost/interprocess/detail/workaround.hpp>
//[doc_spawn_vector
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/container/vector.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <string>
#include <cstdlib> //std::system
//<-
#include "../test/get_process_id_name.hpp"
... | TEST | 0.956856 | 3.227905 |
6346d1a2-1bf5-4502-b700-2d96dcdce742 | Raj-nikam26/DS-LAB | DS lab/ASSIGN 1/split.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter the size of the array: ";
cin >> n;
int arr[n];
cout << "Enter the elements of the array: ";
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
int index = n / 2;
int size1 = index;
int size2 = ... | ALGO | 0.99971 | 4.673013 |
06e878dc-73ee-4f98-9e03-58a3720ae0d7 | thesaravanakumar/competative-programming | codeforces/800/34A-Reconnaissance.cpp | #include <bits/stdc++.h>
#define ll long long int
#define w(t) int t; cin>>t; while(t--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define mii map<int,int>
#defin... | ALGO | 0.999917 | 3.987926 |
39d4a2c3-92b0-4ce8-b5e2-ae7545d933ea | Khush786Mohammad/Data-Structures-and-Algorithms | Algorithms/DivisorOfN.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> divisors(int num)
{
vector<int> ans;
int sqrtN = sqrt(num);
for(int i = 1 ; i<= sqrtN ; i++)
{
if(num%i == 0)
{
ans.push_back(i);
if(i != num/i)
{
ans.push_back(num/i);
... | ALGO | 0.999865 | 5.169635 |
da20014d-b482-4f10-8556-738524e09dac | HG-IMMORTALS/SDE-SHEET | SDE-SHEET-main/140_Partial BST.cpp | // Time Complexity -> O(n)
// Space Complexity -> O(n)
bool validateBST(BinaryTreeNode<int> *root) {
// Write your code here
if(!root)
return true;
bool left1 = true, right1 = true;
left1 = validateBST(root->left);
right1 = validateBST(root->right);
if(left1 and right1)
... | ALGO | 0.999981 | 6.86315 |
532ed85b-4c55-4694-8157-871e010f7232 | truongson0804/bai-CT-GT | bai4.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, L, R;
cout << "Nhap so phan tu n: ";
cin >> n;
vector<int> v(n);
cout << "Nhap " << n << " phan tu: ";
for (int i = 0; i < n; i++) {
cin >> v[i];
}
cout << "Nhap chi so L va R: ";
cin >> L >> R... | ALGO | 0.999351 | 3.645119 |
6b910741-c615-4dbf-8b5d-59111bfa2538 | amumu-dev/nokuno | cc/topcoder/TheLargestLuckyNumber.cpp | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include... | ALGO | 0.998131 | 5.011567 |
6c864ccb-4981-4703-a3c9-fe46154d5de9 | sushant2508/Sushant_7 | 199-binary-tree-right-side-view/199-binary-tree-right-side-view.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.999804 | 6.286272 |
45005706-7644-4048-8787-9488d3dd9ccc | mhikichi-nkhs-gmail/etrobo2024_A | measure/LowPassFilter.cpp | #include "LowPassFilter.h"
LowPassFilter::LowPassFilter()
{
prev=0.0;
mRate = 0.4;
}
LowPassFilter::~LowPassFilter()
{
}
void LowPassFilter::addValue(double value)
{
prev = prev*mRate + value*(1-mRate);
}
double LowPassFilter::getFillteredValue()
{
return prev;
}
void LowPassFilter::setRate(doub... | TOOL | 0.956966 | 4.486558 |
f4df80ff-4344-4a09-99f2-8cba976daa8e | RohitKotha/geeksforgeeksprograms | Difficulty: Hard/LRU Cache/lru-cache.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// design the class in the most optimal way
#include <unordered_map>
#include <list>
using namespace std;
class LRUCache {
private:
int capacity;
list<pair<int, int>> cache; // Doubly-linked list to store key-value pai... | ALGO | 0.997483 | 6.429832 |
4cc2f111-506e-478f-82d8-f540c198f4fa | Arpit-2802/Codeforces-Sheet-A-and-B-Solutions | composite.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n;
cin>>n;
cout<<(n*9)<<" "<<(n*8)<<endl;
}
// int isComposite(int n)
// {
// if(i == 1)
// return 1; // return statement terminates the recursive funtion
// else
// {
// if(n%i == 0)
// ... | ALGO | 0.999547 | 3.520491 |
765494e4-11b8-4893-9b8d-d91a7ca7228f | bensapp/Stretchable-Models-for-Motion-Parsing | cps/thirdparty/OpenCV-2.0.0/tests/cv/src/aoptflowhs.cpp | #include "cvtest.h"
#if 0
/* Testing parameters */
static char FuncName[] = "cvCalcOpticalFlowHS";
static char TestName[] = "Optical flow (Horn & Schunck)";
static char TestClass[] = "Algorithm";
static long lImageWidth;
static long lImageHeight;
static float lambda;
#define EPSILON 0.0001f
static int fmaCalcOptic... | ALGO | 0.986722 | 4.341403 |
12649fa0-9cf5-44d9-9fb5-082497a64ada | bbrightsoon/Baekjoon | Baekjoon13415.cpp | #include <iostream>
#include <algorithm>
using namespace std;
#define MAXARRSIZE 100000
#define INF 0x7fffffff
int N;
int K;
int prevL;
int numArr[MAXARRSIZE];
int setArr[MAXARRSIZE][2];
int cpyArr[MAXARRSIZE];
void swapNumArr(int a, int b) {
int tmp = 0;
tmp = numArr[a];
numArr[a] = numArr[b];
numArr[b] = tmp;... | ALGO | 0.999994 | 3.527498 |
38ee15a3-f5d3-4ddf-a949-69e4a885f5a8 | Subhadip757/DSA-Journey | C++/Dynamic Programming/Longest Common Subsequence (LCS)/Memoization/sol_TLE.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int solve(string s1, string s2, int n, int m, vector<vector<int>> &dp){
if(n == 0 || m == 0){
return 0;
}
if(dp[n][m] != -1) return dp[n][m];
if(s1[n - 1] == s2[m - 1]){
return dp[n][m] =... | ALGO | 0.999982 | 5.762101 |
4c6941bb-d134-48a9-94cd-bd5f3d062017 | ngthvan1612/Codeforces | 670A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, res1 = 0, res2 = 0;
cin >> n;
if (n % 7 == 0) cout << n / 7 * 2 << ' ' << n / 7 * 2;
else if (n % 7 == 1) cout << n / 7 * 2 << ' ' << 1 + n / 7 * 2;
else if (n % 7 <= 5) cout << n / 7 * 2 << ' ' << 2 + n / 7 * 2;
else cout << n / 7 * 2 + 1 << ' '... | ALGO | 0.999325 | 3.625124 |
9fc27249-d5cc-4c90-8fb1-222775db7fc0 | sarvex/leetcode-solidity | solution/2600-2699/2647.Color the Triangle Red/Solution.cpp | class Solution {
public:
vector<vector<int>> colorRed(int n) {
vector<vector<int>> ans;
ans.push_back({1, 1});
for (int i = n, k = 0; i > 1; --i, k = (k + 1) % 4) {
if (k == 0) {
for (int j = 1; j < i << 1; j += 2) {
ans.push_back({i, j});
... | ALGO | 0.999852 | 4.73722 |
a2102145-55d5-476c-bacf-e276f97a85cb | andredalton/bcc | 2015/MAC0327/189/C.cpp | #include <iostream>
#include <list>
using namespace std;
int main() {
int n,
i,
j,
pos = 0,
mov = 0,
a[200000],
b[200000];
cin >> n;
for (int i=0; i<n; i++){
cin >> a[i];
}
for (int i=0; i<n; i++){
cin >> b[i];
}
pos = 0;
... | ALGO | 0.999874 | 3.107485 |
57c11cf4-d55f-462d-bbb8-3a74f3610992 | rofi93/Codechef | Splitting Candies.cpp | /* -------------------------------- */
/* Name: MD. Khairul Basar */
/* Institute: HSTU */
/* Dept: CSE */
/* Email: <EMAIL> */
/* -------------------------------- */
#include <bits/stdc++.h>
/* all header files included */
#define mod 1000000007
#define pi ... | ALGO | 0.999815 | 4.409164 |
ea50baa2-dbd2-4b5a-98a2-4f1eff1d56d5 | ishandutta2007/codeforces | estinka/normal/1620/C.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <iomanip>
#include <cmath>
typedef long long ll;
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
int n;
ll k, x;
str... | ALGO | 0.999753 | 3.385743 |
a1b4250e-a743-4d3c-868c-a0b11288fdf7 | soonkwan1/beakjoon | bj18247.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#define endl "\n"
#define ll long long
#define fastio cin.tie(NULL), cout.tie(NULL), ios_base::sync_with_stdio(f... | ALGO | 0.999452 | 4.21125 |
938d4108-7a8f-4152-9436-c3fcdc31f457 | AnshRehan04/oops | Questions/no_of_occurence.cpp | #include <iostream>
using namespace std;
int main(){
int arr[5]={1,1,2,2,2};
int k=2;
int count=0;
for (int i = 0; i <5; i++)
{
if (arr[i]==k)
{
count++;
}
}
cout<<count;
} | ALGO | 0.999486 | 3.989359 |
6f100f49-c35b-4e8b-84b7-2e83574a4c08 | Unknowkubbrother/Data-Structure | Hashtable/HashTable1_V2.cpp | #include <iostream>
using namespace std;
class Node{
public:
int key;
string value;
Node *next;
Node(){
this->key = -1;
this->value = "-";
this->next = NULL;
}
Node(int key,string value){
this->key = key;
this->value = value;
this->next = NULL;
}
};
class separate_chaining{
pub... | ALGO | 0.98677 | 3.484895 |
bd7173f6-d571-4aa0-b9b7-78273de5a31d | jim2832/Algorithm | HW/HW4/Leetcode690.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
class Employee {
public:
int id;
int importance;
vector<int> subordinates;
};
// BFS solution
class Solution {
public:
int getImportance(vector<Employee*> employees, int id) {
queue<int> q;
... | ALGO | 0.99995 | 5.881962 |
41d7f142-9feb-4ff5-b73e-8d674ac9ad5d | Abhishek-k30/DSA | 0446-arithmetic-slices-ii-subsequence/0446-arithmetic-slices-ii-subsequence.cpp | class Solution {
public:
int numberOfArithmeticSlices(vector<int>& nums) {
int n = nums.size();
long res = 0;
unordered_map<long, long> mp[n];
for(int i = 0; i<n; i++){
for(int j = 0; j<i; j++){
long long diff = 1LL*nums[i]-1LL*... | ALGO | 0.999855 | 6.285781 |
79a6551a-e42b-407b-a6ec-f3445d911988 | riya-jindal28/DSA | Recursion/10.cpp | #include<iostream>
#include<math.h>
using namespace std;
void pattern(int n){
if(n==0){
return;
}
pattern(n-1);
cout<<n<<"^"<<n<<" + ";
}
int main(){
int n;
cin>>n;
pattern(n);
return 0;
} | ALGO | 0.997711 | 3.668431 |
d22226db-86d0-4371-8982-606aea783a65 | cmaestrofdez/opencloth | OpenCloth_ExplicitEuler_TextureMapped_Lit/OpenCloth_ExplicitEuler_TextureMapped_Lit/main.cpp | #include <GL/glew.h>
#include <GL/wglew.h>
#include <GL/freeglut.h>
#include <vector>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp> //for matrices
#include <glm/gtc/type_ptr.hpp>
#pragma comment(lib, "glew32.lib")
using namespace std;
const int width = 1024, height = 1024;
int numX = 20, numY=20;
co... | ALGO | 0.920919 | 3.26308 |
839c750b-0ed2-4aec-aa80-fc57f68812a6 | bolatov/contests | informatics.mccme.ru/p2962.cpp | #include <bits/stdc++.h>
using namespace std;
#ifndef int64
#define int64 long long
#endif
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
int n, m;
cin >> n >> m;
queue<pair<int, int>> q;
q.push({1, 1});
int64 r = 0;
while (!q.empty()) {
auto p = q.fron... | ALGO | 0.999956 | 4.301476 |
d6259bf3-d08a-4712-a061-bbda72af14b8 | overflow218/Algorithms | 0402-1.cpp | #include <string>
#include <vector>
#include <cmath>
using namespace std;
long long solution(int k, int d)
{
long long answer = 0;
long long x = 0;
long long limit = (long long)d * (long long)d;
while (limit - x * x >= 0)
{
long long y = limit - x * x;
int div = sqrt(y);
ans... | ALGO | 0.997101 | 3.60302 |
939525e9-d1e2-4c19-a70e-fece29a1c516 | jackboom2510/DSA-PTIT | code/4.1. Ngan xep/DSA07010_BIEN_DOI_TIEN_TO_HAU_TO.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vpii = vector<pii>;
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define a... | ALGO | 0.999968 | 5.191391 |
e6905681-9af2-4e88-b8cd-bc9596ca6ee1 | GKcodebase/DSA | CPP/Linked List/Singly Linked List/Merge_List.cpp | /**
* @file Merge_List.cpp
* @author Gokul
* @brief Merging two sorted list
* @version 0.1
* @date 2022-12-12
*
* @copyright Copyright (c) 2022
*
*/
#include <iostream>
using namespace std;
/**
* @brief Node Template class
*
*/
class Node
{
public:
int val;
Node *next;
Node(int val)
{
... | ALGO | 0.999926 | 5.626481 |
2d4f2417-be1d-4090-9d1a-a3a000ebd400 | praveenkulkarni1996/compete | 1426F.cpp | #include <cassert>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using int64 = long long;
int kMod = 1e9 + 7;
int readInt() {
int x;
cin >> x;
return x;
}
string readStr() {
string s;
cin >> s;
return s;
}
int main() {
const int n = readInt();
const string s = readStr... | ALGO | 0.99991 | 4.178802 |
71a4b30d-c547-4e00-b9c3-fdbd95ae4843 | VibhorSingh19/DynamiProgramming | subsetsumdp.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int arr[]={3, 4, 5, 2};
int l=sizeof(arr)/sizeof(arr[0]);
//int l=4;
int sum=6;
int ar[100][100];
for(int i=0;i<=l;i++)
{
for(int j=0;j<=sum;j++)
{
if(i==0)
ar[i][j]=0;
... | ALGO | 0.999973 | 3.287526 |
1cfcf5f2-86ee-43ef-976c-7c3aa10c6008 | RahulScripted/CodeChef | Complete C++/Structure Pointer File Handling/CodingProblem3.cpp | // You run the library at your college. Since you are an avid programmer, you decided to use your recent knowledge of Structures to update the catalog of books present in the library. You have been provided some data about the purchasing sequence of the books and their addition to the library. Note that the same book c... | ALGO | 0.999611 | 4.940719 |
45c4b3ad-3e2e-4114-a2ea-20d968cfc118 | lwher/Algorithm-exercise | C++/SJTU/sjtu 1346.cpp | #include<iostream>
#include<map>
#include<queue>
#include<cmath>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int n, T, len, ans;
char s[10];
bool mark[10][100001];
void dfs(int now, int top, int k, int L){
if(top == L + 1){
mark[L][now] = 1;
ret... | ALGO | 0.999391 | 4.036825 |
41eec943-0964-4e78-8fc4-149a9acff154 | sagar-viradiya/DS-Algo-C | Leetcode/FlattenDoubleLinkList.cpp | // Leetcode July challenge Week 2, Problem 3
#include<iostream>
using namespace std;
class Node {
public:
int val;
Node* prev;
Node* next;
Node* child;
};
Node* flattenList(Node* head) {
while(head->next != nullptr || head->child != nullptr) {
if (head->child != nullpt... | ALGO | 0.999978 | 5.275877 |
a937916c-1692-458e-9751-52434c3ba9fb | Johniel/contests | atcoder/abc344/B/main.cpp | // github.com/Johniel/contests
// atcoder/abc344/B/main.cpp
#include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
#define makepair(a, b) make_pair(a, b)
// #define endl "\n"
using namespace std;
template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> ... | ALGO | 0.999927 | 5.030314 |
161b9b0d-9773-458a-8a0a-bac98cff81d8 | vlluvia/algorithm | leetcode/[101]-对称二叉树.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool isSymmetric(TreeNode* root) {
return dfs(root, root);
}
... | ALGO | 0.999961 | 6.752307 |
71295cd7-030d-42ef-8791-4fed0868d894 | shubhkamble26/HackerRank-Solutions | HackerRank-30-days-Code/Day_14_Scope.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<climits>
using namespace std;
class Difference {
private:
vector<int> elements;
public:
int maximumDifference;
// Add your code here
Difference (vector<int> elements_):elements(elements_),maxi... | ALGO | 0.999748 | 4.593984 |
848bc25c-a19d-493e-a192-f00acadd38fc | Caesar-Victory/ACWing | Prim[pure]/Source.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int N = 510, INF = 0x3f3f3f3f;
int n, m;
int g[N][N];
int dist[N];
bool st[N];
int prim(void) {
// ȰоʼΪ
memset(dist, 0x3f, sizeof dist);
// С棬бߵij֮
int res = 0;
// ÿһαҵǰ⣬̵ĵ
// ÿһε·ʱѾ·ܳȣ˱ n Σ n - 1
for ... | ALGO | 0.999833 | 4.567463 |
43ea716b-c23e-46c1-9137-aee95bac1520 | Juhwa-Lee1023/Study_Algorithms | 프로그래머스/2/172927. 광물 캐기/광물 캐기.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;
class Mineral {
public:
int diamond;
int iron;
int stone;
Mineral(int diamond, int iron, int stone)
: diamond(diamond), iron(iron), stone(stone) {}
};
int solution(vector<int... | ALGO | 0.997566 | 5.611194 |
217c06da-39ee-4357-aaf0-d882df894713 | danyalmendigali/programming_scientific_codes | auto_scientific_codes/array---string/array_sort()_function.cpp | #include <bits/stdc++.h>
#include <windows.h>
#include <iterator>
using namespace std;
#define ar array
#define ll long long
#define FOR(i, a, b) for(int i = a; i < b; i++)
// sort(): Эта функция сортирует элементы массива в порядке возрастания или по заданному компаратору.
int main() {
cin.tie();
SetConsole... | ALGO | 0.999272 | 4.364099 |
b86b436c-d9a5-4f7e-9c99-39ad639986d1 | vfolunin/archives-solutions | LeetCode/1014.cpp | class Solution {
public:
int maxScoreSightseeingPair(vector<int> &a) {
int maxAdd = a[0], res = 0;
for (int i = 1; i < a.size(); i++) {
res = max(res, a[i] - i + maxAdd);
maxAdd = max(maxAdd, a[i] + i);
}
return res;
}
}; | ALGO | 0.999864 | 5.819301 |
db456df1-c436-42f4-bfff-091b894762e1 | MoinVinchhi/cse205-ds | assignment/16.08.2023/77.cpp | class Solution {
public:
void solve(int i, int n,int k,vector<int> &subsets,vector<vector<int>> &ans){
if(k == 0){
ans.push_back(subsets);
return;
}
// because after that we need certain amount of element in combiation
if(k > n-i+1) {
... | ALGO | 0.999986 | 6.13453 |
6378fb00-11fa-41fa-98f6-344bf8531701 | QuiverDance/Algorithm | studyG5/15686.cpp | /*
#15686 치킨 배달
*/
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int n, m, ret = 1e9;
vector<pair<int, int>> h, c;
vector<vector<int>> c_list;
void combi(int idx, vector<int> b){
if(b.size() == m){
c_list.push_back(b);
return;
}
for(int i = idx; i < c.size();... | ALGO | 0.999888 | 4.534457 |
03c9846f-cfb2-4f92-89e6-782377f12bca | rezwan4029/UVA-CODES | 967 - Circular.cpp | /*
Rezwan_4029 , AUST
*/
#include <bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(),x.end()
#define ms(a,v) memset(a,v,sizeof a)
#define makeUnique(a) a.resize(unique(a.begin(), a.end()) - a.begin())
#define II ({int a; scanf("%d", &a); a;})
#define LL ({Long a; scanf("%lld", &a); a;})
#define DD ({dou... | ALGO | 0.999434 | 3.864218 |
b4a6176e-5417-494c-8c07-165de4a52b88 | AnasImloul/Leetcode-Solutions | scripts/algorithms/C/Count Vowel Substrings of a String/Count Vowel Substrings of a String.cpp | // Runtime: 0 ms (Top 100.0%) | Memory: 6.90 MB (Top 63.9%)
class Solution {
public:
bool isVowel(char c) {
return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
};
int atMostK(string &s, int k) {
int res = 0, i=0, n = s.size();
unordered_map<char, int> mp;
... | ALGO | 0.999835 | 5.844594 |
4a6bf2aa-635b-4e65-a72b-339d09aaf6b7 | SJMA11723/Problem-solving | atcoder/AtCoder Beginner Contest 361/F.cpp | /**
* Author: Jorge Raul Tzab Lopez
* Github: https://github.com/SJMA11723
*/
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int64_t n; cin >> n;
/**
Consideremos x = a^b, para algun 2 <= b <= 64 y la factorizacion en primo... | ALGO | 0.999825 | 4.81146 |
5c0735b4-bc4b-4396-a69e-4ccf78bdd3d6 | shihabLuminar/free_api_sample_may | 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 |
e1c63784-34dd-4e86-ab1e-97a969da46c5 | kentzhang-geek/LearnRayTracing | Mat_PBR_CookTorrance.cpp | //
// Created by kent on 2021/12/22.
//
#include <iostream>
#include "Mat_PBR_CookTorrance.h"
#include "MathTools.h"
bool
Mat_PBR_CookTorrance::scatter(const Ray &in, const Eigen::Vector3d hit_pos, HitObject *hp, Eigen::Vector3d &attenuation,
Ray &out) {
out.origin = hit_pos;
out... | ALGO | 0.991805 | 5.86105 |
86b380a4-6b40-455b-95e4-15b680a6988d | W-void/Just-No-Name | Advancing C/PAT_Advanced/1045 Favorite Color Stripe.cpp | // 经典的动态规划
/*
1045 Favorite Color Stripe(30 分)
Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by
cutting off those unwanted pieces and sewing the remaining parts together to form her favorite color stripe.
It is said that a normal h... | ALGO | 0.999848 | 3.825328 |
13ee9550-5461-465e-88e1-1b532a31e5d1 | mptoolkit/mptoolkit-old | mp/old/mp-makesqueeze.cpp | namespace prog_opt = boost::program_options;
using std::sin;
// the int count here is the number of filled components
std::map<int, MPOperator>
AddSqueezedPart(std::map<int, MPOperator> const& In, MPOperator const& Filled, MPOperator const& Empty,
int MaxFilled)
{
std::map<int, MPOperator> Result;
... | ALGO | 0.996685 | 5.435627 |
66c12c70-e59f-404a-ad1f-4590d6ff5de1 | SDhinakar/C-plus | LOOPS/sumofodd_integers.cpp | #include<iostream>
using namespace std;
int main()
{
int n,sum=0;
cout<<"enter n: ";
cin>>n;
for(int i=0;i<=n;i++)
{
if(i%2 !=0)
{
sum+=i;
}
}
cout<<"Sum of odd integers between "<<n<<" is: "<<sum<<endl;
} | ALGO | 0.999775 | 4.319404 |
a7be7242-dabb-4155-9f94-8af56f9a99ed | JB-Github/CrossCompiler-PythonToCPP11 | compiler (Programmteile einzeln)/p.cpp | #include <array>;
#include <cmath>;
#include <iostream>;
using namespace std;
/*
Testprogramm fuer codegen
*/
double f(double x) {
/*rechnen*/
return pow(x, 2)+ x*4 - (x-3) /(double) x-1.3e2+2
+5; //comment
}
S= "abc\n";
int main() {
array<double,10> L; L.fill(1+1);
for (int i= 0; i<L.... | ALGO | 0.998332 | 3.333982 |
a04c756b-b1cf-441f-99ed-bbf7c8205c5b | karasova/moduls | file.cpp | #include <iostream>
#include "file.h"
#include <fstream>
#include "geometry.h"
using namespace std;
int countPoints(const char* fileName)
{
ifstream in(fileName);
if (!in.is_open()) return -1;
double x, y;
int i;
for (i = 0; ; i++)
{
in >> x >> y;
if (in.fail()) break;
}
return i;
}
istream& operator >>(... | TOOL | 0.876342 | 4.318382 |
7a268bc8-23e3-4cc9-8ed2-d878406482f9 | jonyroy/online-judge-problem-solutions | www.codeforces.com/188B.cpp | #include<set>
#include<list>
#include<map>
#include<stack>
#include<bitset>
#include<ctime>
#include<string>
#include<deque>
#include<queue>
#include<cstdio>
#include<cmath>
#include<utility>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<cstring>
#include<cassert>
#include<fstream>
#include<sstream>
#in... | ALGO | 0.999992 | 3.250727 |
8eaa08ad-bd48-4b93-bb6d-50e9d8621962 | andimion666/OBX | src/crypto/scrypt.cpp | #include "crypto/scrypt.h"
#include "uint256.h"
#include "utilstrencodings.h"
#include <openssl/sha.h>
#include <string>
#include <string.h>
#include <stdint.h>
static inline void be32enc(void *pp, uint32_t x)
{
uint8_t *p = (uint8_t *)pp;
p[3] = x & 0xff;
p[2] = (x >> 8) & 0xff;
p[1] = (x >> 16) & 0x... | ALGO | 0.998799 | 5.312294 |
46f1c876-6b5c-4d45-8e10-dc5aa61d04a9 | profornnan/Problem-Solving | SWEA/미분류/3282-0,1 Knapsack.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void) {
cin.tie(NULL)->sync_with_stdio(false);
int T;
cin >> T;
for (int tc = 1; tc <= T; tc++) {
int N, K;
cin >> N >> K;
vector<vector<int>> dp(N + 1, vector<int>(K + 1));
vector<int> volume(N + 1);
vector<int> ... | ALGO | 0.999888 | 3.964609 |
d4cc1412-1f1f-4a9e-b490-ad01459cdb45 | BinomialSheep/Competitive | AtcoderContest/ABC329/A2.cpp | #pragma region header
#include <bits/stdc++.h>
// デバッグ用マクロ:https://naskya.net/post/0002/
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
using namespace std;
using ll = long long;
using vi = vector<int>... | ALGO | 0.999936 | 4.598479 |
62bdd6e7-21d1-4964-a530-d391b0145aa4 | PRANAVJARANDE/Leetcode-Solutions | hard/Longest Subsequence Repeated k Times.cpp | class Solution {
public:
string longestSubsequenceRepeatedK(string s, int k)
{
int n=s.size();
vector<char>v1;
map<char,int>freq;
for(auto x:s)
{
freq[x]++;
if(freq[x]==k)v1.push_back(x);
}
sort(v1.begin(),v1.end(),greater<char>())... | ALGO | 0.999996 | 5.808902 |
4975cc7e-1bd1-46c1-842c-bb433587252d | sabhisharma-ise/cpp | 4. Pattern Questions/Kunal-Kushwaha/Pattern12/optimized.cpp | #include<iostream>
int main () {
int n;
std::cout << "Enter a number: ";
std::cin >> n;
for (int row = 1; row <= 2 * n; row++) {
int totalSpacesInRow = (row <= n) ? (row - 1) : (2 * n - row);
int totalColInRow = (row <= n) ? (n - row + 1) : (row - n);
for (int s = 1; s <= t... | ALGO | 0.999333 | 4.66037 |
47a0fe02-239b-4665-bbce-24659ba3c538 | juanplopes/hackerrank | implementation/manasa-and-stones.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#define MAX 100100
using namespace std;
string T[300];
int main() {
int tests; cin >> tests;
int N, A, B;
while(cin >> N >> A >> B) {
if (A == B) {
cout << (N-1) * A << endl;
continue;
}
... | ALGO | 0.999525 | 3.518759 |
5cec4b7e-cb59-4023-a209-90007976d92f | noochila/-DSA- | 0542-01-matrix/0542-01-matrix.cpp | class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {
int n=mat.size();
int m=mat[0].size();
queue<pair<int,pair<int,int>>>q;
vector<vector<int>> vis(n,vector<int>(m,-1));
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
... | ALGO | 0.999979 | 6.188039 |
fa198a05-0b50-4adf-8ce6-692f067b1faa | skhameedoutlook/llvm-seperate | libcxx/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy.pass.cpp | // <algorithm>
// template<InputIterator InIter, typename OutIter, class T>
// requires OutputIterator<OutIter, InIter::reference>
// && OutputIterator<OutIter, const T&>
// && HasEqualTo<InIter::value_type, T>
// constexpr OutIter // constexpr after C++17
// replace_copy(InIter first, InIte... | TEST | 0.972498 | 6.778248 |
9c445dfd-18f4-4a04-9502-7890ba7bf9da | geaninasandu/PA-Tema01-2020 | bani.cpp | #include <bits/stdc++.h>
#define BILLS_NUMBER 5
using namespace std;
class Task {
public:
void solve() {
read_input();
print_output(count_combinations());
}
private:
int N, instructions_set;
int number_of_combinations;
const int kMod = 1e9 + 7;
void read_input() {
... | ALGO | 0.999897 | 5.335238 |
220d8685-c1f1-4f9d-8346-1086cb80a04c | nucleargezi/acm-icpc | codeforces/edu/80-89/1342 edu86 -F/1342C.cpp | #include "MeIoN_Lib/MeIoN_all.hpp"
void before() {}
#define tests
NAME MeIoN_is_UMP45() {
LL(a, b, q);
if (a > b) std::swap(a, b);
vector<int> c(a * b);
FOR(i, a * b) {
c[i] = i % a != i % b % a;
}
c = pre_sum(c);
meion f = [&](ll x) -> ll {
iroha x / (a * b) * c[a * b] + ... | ALGO | 0.998645 | 4.260705 |
fb9d2981-5d5b-4fef-9835-dda53e46e761 | hrithikhack007/DSA | Binary Trees/constructTreeFromInorderAndPreorder.cpp | // so we will set idx to -1, declare an unordered map to store the indexes of inorder elements.
// then we will call buildTree function by passing st=0,en=n-1,pre,idx=-1,mp as arguments. then in each rec. call,
// EDGE CASE: if the range is invalid i.e. start > en then we will simply return NULL, else if the range is v... | ALGO | 0.999999 | 6.762541 |
b915a36e-975f-4553-9f51-6a7faa5088c3 | KumarNitin19/DSA | mountainPeak.cpp | #include<iostream>
using namespace std;
int peakValue(int arr[], int n){
int start =0, end =n-1, mid=start+(end-start)/2;
while(start<end){
if(arr[mid]<arr[mid+1]){
start = mid+1;
}else{
end = mid;
}
mid=start+(end-start)/2;
}
return arr[start];
}... | ALGO | 0.999872 | 4.138796 |
5869d7a3-fd3c-46e1-a922-27619b13a382 | jginsburgn/Estructura-De-Datos | Xcode/AI/AI/main.cpp | #include "City.h"
#include "Road.h"
#include <iostream>
#include <unistd.h>
#include <time.h>
#include "Graph.h"
#include "Helper.h"
#include "FileManager.h"
#include "AI.h"
Graph<City, Road> map;
std::vector<std::string> currentSession;
void parse(std::vector<std::string> args);
std::string buildString(std::vector<... | TOOL | 0.926757 | 3.5555 |
5ec1ed62-fded-4a49-8210-ecc6412801a9 | harrysince1999/DSA | 1675-minimize-deviation-in-array/1675-minimize-deviation-in-array.cpp | class Solution {
public:
int minimumDeviation(vector<int>& arr) {
int n = arr.size();
set<int> s;
for(int i = 0; i < n; i++) // making every odd element to even
{
if(arr[i] % 2 == 1) // if it is odd
{
arr[i] = 2 * arr[i]; // multiply it by 2
... | ALGO | 0.999856 | 5.24571 |
4f0dba42-4540-4834-ad54-ad4f77ff921d | lyappletree/algorithm_leetcode | appearOnce.cpp | #include <iostream>
#include <map>
char FindFirstAppear(char* head)
{
map<char, int> mymap;
map<char, int>::iterator it;
char* p = head;
std::cout<<"ying liu...2\n";
while(*p!='\0')
{
it = mymap.find(*p);
std::cout<<"ying liu..."<<*p<<"\n";
if(it== mymap.end())
mymap.insert(std::pair<cha... | ALGO | 0.999625 | 3.385053 |
5ca2b46f-5a7e-41b8-b7dc-be85c27060c7 | Devesh0403/DSA-Supreme-3.0-By-CodeHelp | Stacks & Queues/08-InfixToPostfix.cpp |
class Solution {
public:
int prec(char c) {
if (c == '^')
return 3;
else if (c == '/' || c == '*')
return 2;
else if (c == '+' || c == '-')
return 1;
else
return -1;
}
string infixToPostfix(string& s) {
stack<char>st;
string ans;
for(int i=0;i<s.size();i++){
... | ALGO | 0.999888 | 5.280352 |
7b4c5a57-3202-49df-ba56-bc20642cf8b7 | aswaunni/Cpp-Progamming-Questions | Binary/Addition.cpp | /*
Given two integers a and b, return the sum of the two integers without using binary opertaion.
*/
int getSum(int a, int b) {
while (b != 0) {
unsigned carry = a&b;
a = a^b;
b = carry<<1;
}
return a;
}
| ALGO | 0.99903 | 5.622162 |
31d5413b-35ca-45b7-a361-e84828c50dd9 | gustavofadel/Exercises | URI/1082.cpp | # include <bits/stdc++.h>
using namespace std;
# define _ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
char a, b;
int e, t, v;
map<char, int> vis;
map<char, set<char>> adj;
set<char> st;
void dfs (char a) {
st.insert(a); vis[a] = 1;
for (char b: adj[a]) if (!vis[b]) dfs(b);
}
int main () {_... | ALGO | 0.999727 | 4.37618 |
04b27447-4821-473b-95ce-d1471c7442b7 | yashikajotwani12/DataStructures_Algorithms | queues/generate_binary_num.cpp | #include<bits/stdc++.h>
using namespace std;
vector<string> generate(int n)
{
vector<string>ans;
queue<string>q;
q.push("1");
for(int i=1;i<=n;i++ )
{
string binary = q.front();
q.pop();
ans.push_back(binary);
q.push(binary+"0");
q.push(binary+"1");
}
... | ALGO | 0.999935 | 4.688657 |
e5cf4941-051b-401d-8d6a-4cc4a1fe52c6 | ut0s/atcoder | ABC/ABC042/b.cpp | /**
@file b.cpp
@title B - 文字列大好きいろはちゃんイージー / Iroha Loves Strings (ABC Edition)
@url https://atcoder.jp/contests/abc042/tasks/abc042_b
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)
int main() {... | ALGO | 0.999798 | 3.950139 |
7bcda998-e5f9-4dc1-a66e-1cda064fac37 | classroomhub/toolset | diff/source/diff/diff.cpp | #include "diff.h"
#include "sha256.h"
#include<iostream>
#include<vector>
#include<fstream>
using namespace std;
using namespace Toolset;
Diff::Diff(const string file1,const string file2) {
ifstream input(file1.c_str(), ios::in);
SHA256 sha256;
string line;
while (getline(input, line)){
this... | TOOL | 0.986901 | 4.365758 |
17363c72-5cb2-469c-8b6c-d447fd7b9b81 | LemonLord616/DBus_configurationManager | apps/confManagerApplication1/TimeoutApp.cpp | #include "TimeoutApp.hpp"
#include <chrono>
#include <csignal>
#include <cstdint>
#include <fstream>
#include <functional>
#include <iostream>
#include <regex>
#include <thread>
const std::filesystem::path expandUserPath(const std::string &path) {
if (!path.empty() && path[0] == '~') {
const char *home = getenv("HO... | TOOL | 0.963981 | 6.690266 |
feccfa98-9d40-4b37-89fa-076fbe155ff8 | itKhaiNDdotDev/MyWorkSpace_CodeDemo | Source Demo Code for DS&A BK/BST.cpp | #include <iostream>
using namespace std;
typedef struct BNode
{
int id;
BNode* leftChild;
BNode* rightChild;
} BNode;
typedef struct BNode* nodePointer ;
BNode* makeNode(int v)
{
BNode* p=new BNode;
p->id= v;
p->leftChild= NULL;
p->rightChild= NULL;
}
nodePointer insertNode(nodePointer r,... | ALGO | 0.999713 | 3.816473 |
a372b649-bf4b-4ba8-8fa3-da26bfbe17bf | neppiness/TIL | problem-solving/boj/random-defense/2224-10-08-2023.cpp | #include <bits/stdc++.h>
using namespace std;
const string ARROW = " => ";
bool dist[55][55];
int ctoi(char c) {
if (c >= 'A' && c <= 'Z') return c - 'A';
return c - 'a' + 26;
}
char itoc(int x) {
if (x < 26) return (char)x + 'A';
return (char)x - 26 + 'a';
}
int main() {
ios::sync_with_stdio(0);
cin.t... | ALGO | 0.998969 | 3.818261 |
1448b07f-469c-463a-a214-1536b00a3b8d | sarvex/leetcode-matlab | solution/1600-1699/1616.Split Two Strings to Make Palindrome/Solution.cpp | class Solution {
public:
bool checkPalindromeFormation(string a, string b) {
return check1(a, b) || check1(b, a);
}
private:
bool check1(string& a, string& b) {
int i = 0, j = b.size() - 1;
while (i < j && a[i] == b[j]) {
++i;
--j;
}
return i ... | ALGO | 0.999968 | 6.280802 |
5b9f170d-b6d7-478a-8418-d86b1a0457fa | RifahSanjida/CSE_284 | Lab_7/L7_Ex1.cpp | //Example 1: A C++ program to find the sum of two complex numbers using binary operator overloading.
#include<iostream>
using namespace std;
class Complex
{
private:
float real;
float imag;
public:
Complex()
{
real = 0;
imag = 0;
}
void input(... | ALGO | 0.860708 | 4.840281 |
03a6f31d-5d55-4119-b8a0-a045754ed5d8 | lxq2537664558/Reign-of-Darkness | src/gettext.cpp | #include <string>
#include <string.h>
#include <iostream>
#include <stdlib.h>
#include "gettext.h"
#include "util/string.h"
#if USE_GETTEXT && defined(_MSC_VER)
#include <WinNls.h>
#include <map>
#include <direct.h>
#include "filesys.h"
#define setlocale(category,localename) \
setlocale(category,MSVC_LocaleLookup(lo... | TOOL | 0.976821 | 6.048425 |
d783f529-6889-4eb5-8914-5503246ebe6f | 21lj/C_projects | project_cppGame.cpp | #include<iostream>
#include<ctime>
using namespace std;
class Game
{
private:
char player,computer,c;
public:
char Userchoice();
char Ai();
void Showchoice(char C);
void Winner(char P,char C);
};
void Game:: Showchoice(char C)
{
if(C=='R'||C=='r')
{
cout<<"CHOICE IS ROCK!";
}
... | ALGO | 0.926186 | 3.351734 |
a104f99c-c8dc-4dcb-b168-ceef37133d18 | zaipitunsian1/6Companies30days | Adobe/Amend The Sentence .cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
string amendSentence (string s)
{
string a = "" ;
a += tolower(s[0]) ;
int i=1 ;
while( s[i] != '\0') {
if(isupper(s[i])) a += " " ;
a += to... | ALGO | 0.999576 | 6.024337 |
361106c5-bd87-4ebd-b06a-c794801de748 | mjwybrow/dunnart | libogdf/src/energybased/multilevelmixer/ModularMultilevelMixerLayout.cpp | /*
* $Revision: 1.0 $
*
* last checkin:
* $Author: bartel $
* $Date: 2008-01-26 15:44:58 +0100 (Sa, 26 Jan 2008) $
***************************************************************/
//#define USE_OGL_DRAWER
#include <ogdf/basic/basic.h>
#include <ogdf/energybased/multilevelmixer/ModularMultilevelMixerLayout.h... | ALGO | 0.993106 | 5.235798 |
3a1a3e2e-7d31-40d6-b130-65a4f181d5f1 | We1chJ/CP-CPP | Codeforces/practices/A.MakeitBeautiful.cpp | #include "bits/stdc++.h"
using namespace std;
int main(){
cin.tie(0)->sync_with_stdio(0);
int t;
cin >> t;
while(t--){
int n;
cin >> n;
vector<int> arr(n);
int mx = -1;
int cnt = 0;
for(int i = 0; i < n; i++){
cin >> arr[i];
... | ALGO | 0.999897 | 3.972203 |
2a34bfb9-3d65-44fd-a3c7-d2bbd654b9db | sirraghavgupta/cpp-data-structures-and-algorithms | problems/imageRotation_greaterSpaceComplexity.cpp | /*##############################################################################
AUTHOR : RAGHAV GUPTA
DATE : 6 june 2019
AIM : to rotate an nXn matrix image by 90 degree anticlockwise
STATUS : !!! success !!!
space complexity : O(n)
##############################################################################*/
... | ALGO | 0.999754 | 5.709035 |
3c5febab-11d8-4e0f-bd72-d236e7024171 | sa-cyl/DPDK-Graph | dpdk-graph/exec/toolkits/parsers/consecutive_matrix_market.cpp | #include <cstdio>
#include <map>
#include <iostream>
#include <map>
#include <omp.h>
#include <assert.h>
#include "CE_Graph_basic_includes.hpp"
#include "../collaborative_filtering/timer.hpp"
#include "../collaborative_filtering/util.hpp"
#include "../../example_apps/matrix_factorization/matrixmarket/mmio.h"
#include "... | DATA | 0.952055 | 4.514889 |
9d951bff-3525-4d08-bfd6-e9e51b591b14 | toan207/Competitive-Programming | Leetcode/contest/Biweekly/57/1944_NumberOfVisiblePeopleInAQueue.cpp | #include <bits/stdc++.h>
using namespace std;
#define fxdp fixed<<setprecision
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define pii pair<int, int>
#define pll pair<long, long>
#define mli map<long long, int>
#define msi map<string, int>
#define all(a) a.begin(),... | ALGO | 0.999846 | 5.692505 |
59ecaf43-7217-47bf-896b-4612c9c8d4df | SSAFY0916/Algorithm_Study_Java_C | WEEK12/A_BOJ_10025/main_10025_게으른백곰.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
bool compare(pair<int, int> a, pair<int, int> b) {
return a.first < b.first;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int N, K, A = 0;
cin >> N >> K;
int g, x;
vector<pa... | ALGO | 0.999885 | 3.709099 |
055a2d6d-e036-49b3-95de-1b4e98ee7f63 | kirilliliychalgosy/algosy4sem | 1contest/d.cpp | #include <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <optional>
#include <vector>
namespace string_separators {
const char kSeparator = '#';
}
/// \brief Calculates value of prefix function
/// \param str - reference to string prefix function is being calculated of
/// \return std::v... | ALGO | 0.999957 | 6.092881 |
a52d6965-a560-4088-bc58-c3e122263d4a | yamkim/algorithm_AOJ | CHAPTER01/FESTIVAL.cpp | #include <iostream>
#include <vector>
#include <string.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < n; i++)
#define INF (987654321.0)
int N, L;
double getPrice(vector<double> &cost) {
double ret = INF;
for (int i = 0; i < N; ++i) {
double sum = 0.0;
for (int j = i; j < N; ++j) ... | ALGO | 0.999577 | 3.391558 |
cccbe90e-292d-4f22-ab36-6554566feaef | akashdas95/leetcode_solving | Matrix/2684. Maximum Number of Moves in a Grid.cpp | class Solution {
public:
int m;
int n;
vector<int>direction={-1,0,1};
int dfs(int r, int c, vector<vector<int>>& grid, vector<vector<int>>&t){
if(t[r][c]!=-1){
return t[r][c];
}
int moves = 0;
for(int &dir : direction){
int newR = r+dir;
... | ALGO | 0.999993 | 6.374363 |
bdbaec33-22bf-4bc8-bc1f-a535570dad4d | lazydev01/15-days-of-code | mutual_of_numbers.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int a;
cin >> a;
int b;
cin >> b;
int gcd_a_b = __gcd(a, b);
int count = 0;
int temp = ceil(sqrt(gcd_a_b));
for(int i=1; i<temp; i++){
if(gcd_a_b%i==0){
count++;
}
}
count*=2;
if(temp*temp==g... | ALGO | 0.99992 | 4.361275 |
e734708b-2f3d-424a-8ca8-5c605b0b7a25 | kabuto64425/Atcoder | ABC/ABC001_100/ABC024/A.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define ALL(x) x.begin(),x.end()... | ALGO | 0.999689 | 3.793037 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.