uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f4930baf-4bde-4eec-abe2-157962098b72 | PawelMasluch/Programming-tasks-and-my-solutons | pl.spoj.com/Łatwe/[723] [PTROL] - ROL.cpp | #include<cstdio> // AC
using namespace std;
#define REP(i,a,b) for(int i=a; i<=b; ++i)
const int MAX_N = 100;
int q, n, t[MAX_N];
void wczytaj()
{
scanf( "%d", &n );
REP(i,0,n-1)
{
scanf( "%d", &t[i] );
}
}
void odwroc(int pocz, int kon) // 0 <= pocz <= kon
{
int tmp, dl = kon - pocz ... | ALGO | 0.999869 | 3.607607 |
637d4cc1-2f89-4b23-9d9e-fc6f2c4fc7f4 | ishandutta2007/codeforces | leaf1415/normal/576/D.cpp | #include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
... | ALGO | 0.999914 | 3.888624 |
46301cec-9cfa-4672-96c8-dfd99573d593 | MdAsimKhan/Striver-SDE-2022-Solutions | PalindromePartitioning.cpp | bool isPalindrome(string &s, int a, int b){
while(a<b){
if(s[a++]!=s[b--]) return false;
}
return true;
}
void pp(int ind, string &s, vector<string> &temp, vector<vector<string>> &ans){
if(ind>=s.size()){
ans.push_back(temp);
return;
}
... | ALGO | 0.999972 | 5.972197 |
7a0cbbf0-2771-414e-93c6-e6b0557e8ae4 | wisdompeak/LeetCode | Greedy/3027.Find-the-Number-of-Ways-to-Place-People-II/3027.Find-the-Number-of-Ways-to-Place-People-II.cpp | class Solution {
public:
int numberOfPairs(vector<vector<int>>& points)
{
sort(points.begin(), points.end(), [](vector<int>&a, vector<int>&b){
if (a[0]==b[0]) return a[1]>b[1];
else return a[0]<b[0];
});
int n = points.size();
int ret = 0;
... | ALGO | 0.999946 | 5.868072 |
8f6c1a32-453a-40fc-b85f-a3b1f65947e1 | besquared/Retsu-db | source/statistics/shape.cpp | #include "shape.h"
// Sample variance
double Retsu::Statistics::variance(const std::vector<double>& values) {
double sum = 0;
double x_bar = mean(values);
std::vector<double>::const_iterator value;
for(value = values.begin(); value != values.end(); value++) {
sum += (*value - x_bar) * (*value - x_bar);
}... | ALGO | 0.955536 | 6.872667 |
7208eac4-5951-4fc0-9566-2e44f062d4ea | abdulhanan1000/27-QUESTION-CPP-ASSIGNMENT | QUESTION 19.cpp | #include<iostream>
#include<conio.h>
#include<cctype>
#include<cmath>
#include<string>
using namespace std;
void main() {
//**********ASSIGNMENT 3*************
//QUESTION 19
char str[5];
cout << "enter 5 characters: ";
cin.getline(str,6);
char c;
for (int i = 0; i < 5; i++) {
c = str[i];
putchar(toupper(... | TOOL | 0.909634 | 3.569967 |
edc0daa9-06f7-45eb-97fa-1d23d5c44c5e | DibloTempest/ThinhLucifer | CPP/BI-KIP-LUYEN-RONG.cpp | #include <bits/stdc++.h>
using namespace std;
struct ch
{
int x, y;
};
ch a[1004];
bool cmp(ch A, ch B)
{
return (A.x < B.x or (A.x == B.x and A.y > B.y));
}
int n, s;
main()
{
cin >> s >> n;
for (int i = 1; i <= n; i++)
cin >> a[i].x >> a[i].y;
sort(a + 1, a + n + 1, cmp);
int d = 0;
... | ALGO | 0.999952 | 3.292042 |
4d3e9737-aae4-45d9-9e04-717e5e872102 | Armenuhi-Qocharyan/ITC-8 | Homework/Mary_Antonyan/C++/14_03_2017/Olympic_Table/functions.cpp | #include <cstdlib>
#include <ctime>
#include <iomanip>
#include "functions.hpp"
int* generateMedals(const int& size) {
int* arr = new int[size];
srand(time(0));
for (int i = 0; i < size; ++i) {
arr[i] = 7 + rand() % 10;
}
return arr;
}
void swap(int& a, int& b) {
a = a + b;
b = a -... | ALGO | 0.906534 | 5.031383 |
6d908e2c-f9e9-4c73-9069-8b9a12a725e2 | yenling-wong/leetcode | arrays/1346. Check If N and Its Double Exist/brute-force.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
bool checkIfExist(vector<int>& arr) {
int n = arr.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i != j && arr[j] == 2 * arr[i]) {
return true;
}
... | ALGO | 0.99795 | 6.14993 |
f3921189-d14c-4750-b69c-c629a743e60b | shikhar-dev/CodeX | LeetCode/binary-tree-inorder-traversal.cpp | // Problem URL: https://leetcode.com/problems/binary-tree-inorder-traversal/
/**
* 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:
vector<int> inorde... | ALGO | 0.999992 | 6.578904 |
654821d7-95fc-4c20-80de-5fce1b16ef60 | chetan-2002/Leetcode-DSA-Questions | 349.intersection-of-two-arrays.cpp | /*
* @lc app=leetcode id=349 lang=cpp
*
* [349] Intersection of Two Arrays
*/
// @lc code=start
class Solution
{
public:
vector<int> intersection(vector<int> &nums1, vector<int> &nums2)
{
vector<int> ans;
sort(nums1.begin(), nums1.end());
sort(nums2.begin(), nums2.end());
i... | ALGO | 0.999946 | 6.052022 |
50895d7c-42ba-4be9-996e-140cfa8e6c1a | MikaG-1952764/bachelorproef2425 | Research/Flutter/flutter_good_practices_example/stress_measurement_app/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.998058 | 6.76775 |
a036d138-1fe2-440b-9920-c21e735619a1 | pranayharishchandra/DAILY-DSA | STRIVER 450/DYNAMIC PROGRAMMING/1D DP/01 Fibonacci.cpp | #include <vector>
using namespace std;
/**============= memoization =================
Time Complexity: O(N)
Reason: The overlapping subproblems will return the answer in constant time O(1).
Therefore the total number of new subproblems we solve is ‘n’. Hence total time complexity is O(N).
Space Complexity: O(N)
Rea... | ALGO | 0.999998 | 6.02646 |
e688b4d3-3ec6-4c5b-8efc-8dc744288006 | ishandutta2007/codeforces | pashka/normal/1610/F.cpp | #include <bits/stdc++.h>
#define long long long int
using namespace std;
// @author: pashka
int n, m;
int mm;
int fr[5000000];
int e[5000000];
int ww[5000000];
bool used[5000000];
struct graph {
vector<vector<int>> g;
int odd = 0;
void add_edge(int x, int y) {
e[mm] = y;
fr[mm] = x;
... | ALGO | 0.999985 | 3.912365 |
e62ec9c6-6c31-46bb-9ef9-41b12b40d4d3 | winco0811/UI-seminar | programs/random_neighbour_hill_climb.cpp | /*this program uses random neighbours approach to hill climbing:
* we take the solution and look at all of its neighbours
* if at least one of them is larger then the solution we
* make the new solution that neighbour
* if there is no higher neighbour but there are equal ones we pick any random neighbour
* we rep... | ALGO | 0.999987 | 4.888115 |
9f4ab48d-614e-400c-a5cf-571b039d0721 | shridharGits/DSA | Sorting/ll.cpp | #include<bits/stdc++.h>
using namespace std;
struct node{
int data;
node *next;
};
node *makenode(int data){
node *newnode = new node;
newnode->data = data;
newnode->next = NULL;
return newnode;
}
node *createnode(node *head, int data){
node *newnode, *temp;
newnode = makenode(da... | ALGO | 0.999984 | 5.037106 |
f78b19ac-2739-48d2-b7fc-dd840be1986c | suxutao/LeetcodeList | cn/53-maximum-subarray .cpp | #include "../../../stdc.h"
using namespace std;
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
public:
int maxSubArray(vector<int>& nums) {
int a=0,MAX=INT_MIN,sum=0;
while(a<nums.size()&&nums[a]<0) a++;
if (a==nums.size()){
for (int i = 0; i... | ALGO | 0.999958 | 5.825831 |
b0dd3732-a34c-4a7e-8d78-4519915598be | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_8493_7.cpp | #include <bits/stdc++.h>
using namespace std;
const long long max_n = 300011, log_n = 32, max_m = 111, mod = 1000000007,
inf = 1011111111111111111LL, p = 1009, p2 = 997;
int n, k, l, r;
int get_ans(int l, int r) {
if (l == r) {
return l;
}
if (l + 1 == r) {
cout << "1 " << l << " " << r <<... | ALGO | 0.999963 | 3.35119 |
e3793892-f35f-4163-ae9a-50aa54decdec | iamsandeepshekhawat/Leetcode-Submission | 854-making-a-large-island/making-a-large-island.cpp | class Solution {
vector<int> dir={-1,0,1,0,-1};
bool isValid(int& n,int& x,int& y){
return (x>=0 and x<n and y>=0 and y<n);
}
int markIsland(vector<vector<int>>& grid,int& island_number,int& n,int x,int y){
grid[x][y] = island_number;
int count = 1;
for(int i=0;i<4;i++){
... | ALGO | 0.999959 | 6.445682 |
df8497e2-0b62-45c7-9415-74dd0ac2f638 | t-head-aosp/platform-frameworks-av | media/codecs/amrnb/common/src/log2.cpp | /*
Filename: /audio/gsm_amr/c/src/log2.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template. Moved Log2_norm
function to its own file.
Description: Changed l_shl.c to l_shl.h in Include section.
Desc... | ALGO | 0.996431 | 6.583379 |
3fc83894-91f2-4fc4-af34-6216e61708a9 | JohnWicc64209/programmingFundamentals | PF Lab 06/Lab 06 Task 04.cpp | // this program displays Fibonacci Series
#include <iostream>
using namespace std;
main()
{
int n, n1 = 0, n2 = 1, nextnum = 0;
cout << "Enter the number: ";
cin >> n;
// get the values
cout << "Fibonacci Series: ";
// use the for loop to determine whether to use a comma or enter the next num... | ALGO | 0.999654 | 4.031812 |
ba89b1aa-3e3d-40b1-9ea4-4e5cba4e187a | Ram-potadar/DSA | Array/88Merge_sorted_array.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int i = m - 1, j = n - 1, k = m + n - 1;
while (i >= 0 && j >= 0) {
if (nums1[i] > nums2[j]) {
nums1[k--] = nums1[i--]... | ALGO | 0.999968 | 4.271668 |
26384be6-2d6e-473e-9e94-1bd16e25d7cf | 1119-2916/competitive-programming | atcoder/other/uku/hoge.cpp | #include <bits/stdc++.h>
using namespace std;
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb ... | ALGO | 0.999991 | 3.813344 |
6ea81ccc-e773-4d74-9d28-c2a727326be0 | ishandutta2007/codeforces | tute7627/normal/1566/E.cpp | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define spa << " " <<
#define fi first
#... | ALGO | 0.999913 | 4.298189 |
3000d783-45a0-46af-81c1-f4ce474de106 | Ghar777/PublicWork | pract1_4b_kurakov/main.cpp | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double varianta (double x)
{
return (x-1)*(x-1)-3;
}
double variantb (double x,double i)
{
return exp(x-i)-sqrt(x+1);
}
void findotveta (double (*varianta)(double),double a, double b, double Exp)
{
cout<<"x"<<setw(15)<<"F(x)"<... | ALGO | 0.999599 | 3.457696 |
180c8cde-1ab0-417f-812a-6534aad40f36 | iamakashrout/Data-Structures-and-Algorithms | 06. Linked Lists/merge_K_sorted_lists.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{ // LINKED LIST CLASS
public:
int data;
Node* next;
Node(){
data=0;
next=NULL;
}
Node(int data){
this->data=data;
this->next=NULL;
}
};
Node* mergeTwoLists(Node* a, Node* b){
if(a==NULL){
return... | ALGO | 0.999989 | 4.101915 |
2ad8f04d-788b-4a18-aa74-f9777dc2dd07 | KatoIT/devC | AnToanBMTT/MaHoaChuDon.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n = -1;
char M[100], K[100];
// Nhap M
cout<<"Dung ky tu '0' de ket thuc chuoi!\nM = ";
for(int i = 0; i <= 100; i++){
cin>>M[i];
n++;
if(M[i] == '0'){
break;
}
}
// Nhap Key
cout<<"K = ";
for(int i = 0; i <= 100; i++){
cin>>K[i];
if(K... | ALGO | 0.999906 | 3.04044 |
df1da78a-0a5c-44c4-8ceb-cfc92055ebcd | JRL-CARI-CNR-UNIBS/human_aware_cost_functions | ssm15066_estimators/src/ssm15066_estimators/ssm15066_estimator2D.cpp | #include <ssm15066_estimators/ssm15066_estimator2D.h>
namespace ssm15066_estimator
{
SSM15066Estimator2D::SSM15066Estimator2D(const rosdyn::ChainPtr &chain, const double& max_step_size):
SSM15066Estimator(chain,max_step_size){}
SSM15066Estimator2D::SSM15066Estimator2D(const rosdyn::ChainPtr &chain, const double &m... | ALGO | 0.999121 | 5.279045 |
524ba731-a90b-4077-9315-e574df05a4eb | jain-arihant-2002/DSAsem1 | CQueue.cpp | #include <bits/stdc++.h>
using namespace std;
const int queueSize = 5;
int front = -1;
int rear = -1;
struct node
{
int data;
node *next;
};
node *FRONT = NULL;
node *REAR = NULL;
void mainMenu()
{
cout << "\n==============Main Menu==============\n";
cout << "1.Enqueue in Queue(Linked List)\n";
co... | ALGO | 0.998152 | 4.411262 |
6efa3acb-e29c-47c1-834d-40d5c5de56f8 | openvinotoolkit/open_model_zoo | demos/social_distance_demo/cpp/src/geodist.cpp | #include <cmath>
#include <tuple>
#include <vector>
#include "geodist.hpp"
typedef std::pair<cv::Point2d, cv::Point2d> Line2d;
std::pair<double, double> getLineComponent(const cv::Point2d& p1, const cv::Point2d& p2) {
double run = p2.x - p1.x;
double rise = p2.y - p1.y;
double a = 0;
if (std::fabs(ru... | ALGO | 0.999877 | 5.984632 |
d2823c60-3df4-4df5-a9e6-8833bc57088e | rahulnagurtha/Mycode | spoj/matsum.cpp | #include <bits/stdc++.h>
using namespace std;
static struct IO {
char tmp[1 << 10];
// fast input routines
char cur;
//#define nextChar() (cur = getc_unlocked(stdin))
//#define peekChar() (cur)
inline char nextChar() { return cur = getc_unlocked(stdin); }
inline char peekChar() { return cur; }... | ALGO | 0.997948 | 4.003847 |
b1525ac6-b845-464f-a38a-fcd749403e35 | zhongfq/cocos-lua | frameworks/cocos2d-x/extensions/Particle3D/PU/CCPUForceField.cpp | #include "CCPUForceField.h"
NS_CC_BEGIN
const Vec3 PUForceFieldCalculationFactory::DEFAULT_WORLDSIZE(500.0f, 500.0f, 500.0f);
//-----------------------------------------------------------------------
unsigned short PUForceFieldCalculationFactory::getOctaves() const
{
return _octaves;
}
//------------------------... | TOOL | 0.967997 | 6.590559 |
38fe69fe-1663-4bc4-8d73-61d3d1b25f3a | ilzelda/codetree-TILs | 240107/전항의 두 배/twice-the-previous.cpp | #include <iostream>
int main() {
// 여기에 코드를 작성해주세요.
using namespace std;
int arr[10] ={};
cin >> arr[0] >> arr[1];
for(int i=2;i<10;i++){
arr[i] = arr[i-1] + 2 * arr[i-2];
}
for ( int i =0; i<10; i++){
cout << arr[i] << ' ';
}
return 0;
} | ALGO | 0.998106 | 3.452652 |
5d53a6b9-a0de-45ea-b100-af1169fc08b8 | KshitizBisht/my_pet | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
be301017-78b1-4891-aec4-fabfd8c9d668 | raincross7/code-similarity | codes/train_code/problem086/problem086_493.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int N;
cin >> N;
vector<long long int> A(N), B(N);
for (int i = 0; i < N; i++) cin >> A.at(i);
for (int i = 0; i < N; i++) cin >> B.at(i);
long long int SA = 0, SB = 0;
for (int i = 0; i < N; i++) {
SA += A.at(i);
SB += B.at(i);... | ALGO | 0.999995 | 3.470014 |
a7592496-74c3-4276-8e85-f0871639d147 | lacoon2874/baekjoon | 단계별/기하 1/2477.cpp | #include <iostream>
int main(void) {
std::cin.tie(NULL);
std::ios::sync_with_stdio(false);
int k, temp;
int len[6];
std::cin >> k;
for (int i = 0; i < 6; i++) {
std::cin >> temp >> len[i];
}
int max1 = 0, max2 = 1;
for (int i = 2; i < 6; i += 2) {
if (len[i] > len[max1]) {
max1 = i;
}
}
for (int ... | ALGO | 0.999487 | 3.575538 |
40e9ee9f-970c-439f-998b-da442a1bd2c2 | Patapom/GodComplex | Intro/Procedural/Generators/Generators.cpp | #include "../../GodComplex.h"
//////////////////////////////////////////////////////////////////////////
// Normal Map
//
struct __NormalStruct
{
const TextureBuilder* pSource;
float HeightFactor;
bool bNormalize;
};
void FillNormal( int _X, int _Y, const float2& _UV, Pixel& _Pixel, void* _pData )
{
__NormalSt... | ALGO | 0.980801 | 3.531604 |
31edb055-5f5c-4c54-a8fe-30d2cb697913 | tausif39/Leetcode | 2554-maximum-number-of-integers-to-choose-from-a-range-i/2554-maximum-number-of-integers-to-choose-from-a-range-i.cpp | class Solution {
public:
int maxCount(vector<int>& banned, int n, int maxSum) {
unordered_set st(banned.begin(), banned.end());
int res = 0;
int currSum = 0;
for(int i=1; i<=n; i++){
if(!st.count(i)){
currSum += i;
res++;
... | ALGO | 0.999963 | 6.250224 |
d5550207-bfce-4d1d-bad4-addba0f1db74 | Mohamad-Isam/Code-wars-solutions-cpp | level 7/Array Leaders (Array Series #3).cpp | #include <vector>
using namespace std;
vector<int> arrayLeaders(const vector<int>& numbers)
{
vector<int> v;
int sum = 0;
for(size_t i = 0; i < numbers.size(); i++)
{
for(size_t j = i + 1; j < numbers.size(); j++)
sum += numbers[j];
if(numbers[i] > sum)
v.push_back(numbers[i]);
sum = ... | ALGO | 0.999973 | 3.910085 |
3efa3c34-1b7b-44a6-bd0f-45dde32824a0 | Kishansingh01/DSA-Raghav-Bhaiya | Prefix-Evaluation.cpp | //Given perfix=> -/*+79483 , We will traverse in reverse order
// first put all number in reverse like as 38497 int val1=7
// and val2=9 and traverse from left to right
#include<iostream>
#include<stack>
using namespace std;
int solve(int val1,int val2,int ch){
if(ch=='+') return val1+val2;
if(ch=='-') retu... | ALGO | 0.99993 | 4.340284 |
daaabb09-c3f3-49cc-8389-08294ed218f1 | dan-lara/Uri-problems-Beecrowd | 6 - 1790 - Detectando Pontes.cpp | #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int qtd;
int low[60], father[60], num[60];
int bridges;
vector<vector<int>> AdjList;
void init(int n)
{
memset(low, -1, sizeof low);
memset(father, -1, sizeof father);
memset(num, -1, siz... | ALGO | 0.999079 | 5.184021 |
e63911a3-ce17-49c4-b6ed-f3b02d395327 | walkerL0u15/OnlineJudgeCode | ZeroJudge/a042.cpp | #include<iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
unsigned int N,ans;
while(cin>>N){
if(N==0){
cout<<"1\n";
continue;
}
ans=2;
for(;N>=2;--N)
ans+=2*N-2;
cout<<ans<<"\n";
}
return 0;
} | ALGO | 0.999913 | 3.784617 |
9b0be725-4cf3-440d-8d8c-c8886728b9a8 | PharaHoG/DailyAlgo | Practice/61_rotate-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* rotateRight... | ALGO | 0.99999 | 5.54486 |
5ae6899b-ead8-43ae-8cde-3896b96ab4a6 | Sahil124-prog/Striver-DSA-sheet-sol | Day_12 15oct24/selectionsort.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int select(int arr[], int i, int n)
{
int minIndex = i;
for (int j = i + 1; j < n; j++)
{
if (arr[j] < arr[minIndex])
{
minIndex = j;
}
}
... | ALGO | 0.999962 | 4.968902 |
66a36956-7943-4fee-be7f-ec811a101607 | theaquibjaved/DSA | 13-roman-to-integer/13-roman-to-integer.cpp | class Solution {
public:
int romanToInt(string s) {
unordered_map<char, int> roman =
{{'I', 1},
{'V', 5},
{'X', 10},
{'L', 50},
{'C', 100},
{'D', 500},
{'M', 1000}};
int res = 0;
int n = s.length();
for(i... | ALGO | 0.999818 | 6.301764 |
be289c2f-9ec5-4ac7-bb71-2fe945e5bc3f | Altu-Bitu/Altu-Bitu_jaeseo | 11월 16일 - 트리/2011.cpp | #include <iostream>
#include <vector>
using namespace std;
const int MOD = 1e6;
int cntPassword(int n, string s) {
vector<int> dp(n + 1, 0);//각 인덱스 번째 숫자까지 읽을 수 있는 단어의 갯수
if (s[0] == '0')//0만 있으면 어떠한 알파벳도 아니기 때문에 0
return 0;
dp[0] = dp[1] = 1; //s[0]의 암호 해석 경우의 수 1로 초기화
for (int i = 2; i <= n... | ALGO | 0.999641 | 4.518408 |
2801d308-9025-4341-8cc0-dd93623bbc8b | sikanjicjovana/Osnovi-operativnih-sistema-projektni | BankersAlgorithm.cpp | #include "BankersAlgorithm.h"
BankersAlgorithm::BankersAlgorithm(int numOfProcesses, vector<string> processesNames, int numOfResources,
vector<string> resourcesNames, vector<int> numOfInstances, vector<int> availabilityVector,
vector<vector<int>> allocationMatrix, vector<vector<int>> maxMatrix, vector... | ALGO | 0.99874 | 4.56623 |
f38fb005-133b-4144-8fb4-ae134aec7f72 | ral-stevens/CPE631Final | pedsim_simulator/src/simulate_diff_drive_robot.cpp | #include <geometry_msgs/Twist.h>
#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
double g_updateRate, g_simulationFactor;
std::string g_worldFrame, g_robotFrame;
geometry_msgs::Twist g_currentTwist;
tf::Transform g_currentPose;
boost::shared_pt... | ALGO | 0.948145 | 6.736794 |
01770016-6e97-404b-b372-beaf369329b8 | youfeng243/hackerrank | Domains/Data Structures/Swap Nodes [Algo]/Swap Nodes [Algo].cpp | #include <iostream>
using namespace std;
class Node{
public:
Node(){
m_left = -1;
m_right = -1;
}
void setLeft( int left ){
m_left = left;
}
void setRight( int right ){
m_right = right;
}
int getLeft( void ){
return m_left;
}
... | ALGO | 0.999691 | 4.040646 |
9977eb75-171b-41ae-9dec-833f76f53ec0 | 2e2guk/codeforces | 1400/479C.cpp | // codeforces 479C
// https://codeforces.com/problemset/problem/479/C
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
int main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
int n; cin >> n;
vector<pi> schedule(n);
for(int i = 0; i < n; i++) cin >> schedule[i].first ... | ALGO | 0.999979 | 5.27841 |
c9348f1e-edf2-4d35-b059-d63f8d9e12d9 | DeepanshuRohilla15/Constructive-Algo | Delete node in doubly linked list.cpp | class Solution {
public:
Node* deleteNode(Node* head, int x) {
if(x == 1)
{
head = head->next;
head->prev = NULL;
return head;
}
int node = 1;
Node* temp = NULL;
while(node < x )
{
if(!temp)
{
... | ALGO | 0.999983 | 5.124797 |
ee0926f3-f613-43ac-9d1c-528d9ec9ad8a | danieltrt/SBFL | playground/java_codex/semantics/CALCULATE_SUM_OF_ALL_NUMBERS_PRESENT_IN_A_STRING.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>
#include <algorithm>
using namespace std;
int f_gold ( string str ) {
string temp = "";
... | ALGO | 0.994 | 6.228528 |
b887174d-0899-4872-8767-a42b5f09fd01 | matheusAFONSECA/C202 | AULA TEORIA (C202-C)/TRABALHOS/Exercícios em sala - for/e01.cpp | #include <iostream>
#include <cmath>
#include <locale>
using namespace std;
int main()
{
setlocale (LC_ALL, "Portuguese");
//declarao de variveis
double x, n, s=0;
//entrada do valor de x
cout<<"Declare o valor de X: ";
cin>>x;
cout<<"Declare o nmeros de termos: ";
cin>>n;
//primeiro julga se possivel... | ALGO | 0.999123 | 3.963622 |
2d80a909-e1bb-4b27-9dc9-773946bf67ec | hmoustaphaousmane/flutter-guided-projects | shopping_list/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.998653 | 6.76073 |
92233fc6-5d39-4e75-b9d2-a8ca56cb6b07 | conan1005/DSA-Questions | Leetcode/10-graphs/medium/2359-find-closest-node-to-given-two-nodes.cpp | /*******************************************************************
*******************************************************************/
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int closestMeetingNode(vector<int>& edges, int node1, int node2) {
int n = edg... | ALGO | 0.999972 | 5.304599 |
555f2580-8142-4450-853b-2dc7cdd05b73 | Eng-Gamal-megahed/Problem_Solving | First element at least X.cpp | // "ولا تقولن لشيء إني فاعل ذلك غدا"
// "إلا أن يشاء الله واذكر ربك إذا نسيت وقل عسى أن يهديني ربي لأقرب من هذا رشدا"
// LINK : https://codeforces.com/edu/course/2/lesson/4/2/practice/contest/273278/problem/C
#include <bits/stdc++.h>
#define ll long long
#define nl '\n'
#define sp ' '
#define all(a) a.begin(),a.end()
... | ALGO | 0.999961 | 5.071663 |
525ebf19-3985-49fc-b907-ddefd04d823f | Beenking/cplusplus | notify_all/源.cpp | #include <thread>
#include <iostream>
#include <condition_variable>
#include <mutex>
#include <queue>
std::mutex mu;
std::condition_variable cv;
std::queue<int> que;
void producer(int min, int max)
{
for (int i = min; i <= max; ++i)
{
std::unique_lock<std::mutex> locker(mu);
que.push(i);
... | TOOL | 0.944983 | 4.231535 |
49de4445-5024-41e5-a707-ef70b2d4dcda | Arun-sharma-1/Dsa | 7_Heap/11_bst_to_maxHeap.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
void inorder(Node *root, vector<int> &v)
{
Node *p = root;
stack<Node *> s;
while (p != nullptr || !s.empty())
{
while (p != nullptr)
{
s.push(p);
p = p... | ALGO | 0.999984 | 5.576786 |
86dc895c-872f-4a88-9ab6-d2541ba6c370 | raincross7/code-similarity | codes/train_code/problem413/problem413_301.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const ll inf = 1e7+5;
bool visited [inf];
int dist[inf];
int main() {
vector<int> vec = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int k; cin >>k;
cout << vec[k-... | ALGO | 0.999904 | 3.311645 |
dfd67052-e56f-454e-9be9-7214fdc8a22a | Sovol3d/SV05-Source-Code | Marlin/src/lcd/tft/ui_common.cpp | #include "../../inc/MarlinConfigPre.h"
#if HAS_GRAPHICAL_TFT
#include "ui_common.h"
#include "../lcdprint.h"
#include "../../libs/numtostr.h"
#include "../menu/menu.h"
void menu_pause_option();
static xy_uint_t cursor;
#if ENABLED(TOUCH_SCREEN)
bool draw_menu_navigation = false;
#endif
#if HAS_TOUCH_SLEEP
bo... | TOOL | 0.873926 | 6.772039 |
e60aa0a2-b161-448b-b7e2-e2448760792c | theRTLmaker/GPU-Characterization | DNN_Primitives/code/amd/gemm_bench.cpp | #include <chrono>
#include <iomanip>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <tuple>
#include <vector>
#include <cmath>
#include <rocblas.h>
#include "tensor.h"
#include "gemm_problems.h"
int time_gemm(Tensor<float> A, Tensor<float> B, Tensor<float> C, bool a_t, bool b_t, rocblas_handle ha... | ALGO | 0.971342 | 6.613152 |
df2ca477-10d8-4882-8657-80bb3c265700 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/CodeLlama/top0-100/find-k-pairs-with-smallest-sums-Solution.kSmallestPairs/177906_DoS_Exec_Code_Overflow.cpp | SplashPath *Splash::makeDashedPath(SplashPath *path) {
SplashPath *dPath;
SplashCoord lineDashTotal;
SplashCoord lineDashStartPhase, lineDashDist, segLen;
SplashCoord x0, y0, x1, y1, xa, ya;
GBool lineDashStartOn, lineDashOn, newPath;
int lineDashStartIdx, lineDashIdx;
int i, j, k;
lineDashTotal = 0;
... | ALGO | 0.996988 | 4.663292 |
a938587b-99d9-4cf7-b115-81ecede8179e | mayank7jha1/CP | Lecture 33 (Extra)/Length_LCS.cpp | class Solution {
public:
int dp[1001][1001];
int LengthLCS(string &s, string &t, int i, int j) {
if (i >= s.length() or j >= t.length()) {
return 0;
}
if (dp[i][j] != -1) {
return dp[i][j];
}
if (s[i] == t[j]) {
return dp[i][j] = 1 + LengthLCS(s, t, i + 1, j + 1);
} else {
//S[i] is in my ... | ALGO | 0.999979 | 5.97848 |
d86f6b24-5ba1-4c86-9992-5091eb125536 | mint6421/kyopro | codeforces/1119/1119A.cpp |
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i... | ALGO | 0.999842 | 3.655397 |
e2400d5c-dd45-477d-a86b-a0c4a217289d | ishandutta2007/codeforces | andr0901/normal/1439/A1.cpp | //#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#defi... | ALGO | 0.99997 | 3.047106 |
483f8d73-04dd-432f-a7c2-eafafe97580c | dipu-bd/OJ-Codes | LightOJ/1132 - Summing up Powers.cpp | /*============================
/\u7h0r : 5ud!p70 ch@ndr@ d@5
=============================*/
//C headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <ctype.h>
#include <assert.h>
//cpp headers
#include <iostream>
#include <iomanip>
#include <sstream>
#incl... | ALGO | 0.999716 | 3.549768 |
3e7fb35d-8826-4ebc-a922-4ed9a6d119a5 | kai-wei-kfuse/daily-code | 2022/202204/20220407/h.cpp | #include <bits/stdc++.h>
using namespace std;
struct edge {
int num;
char s;
};
bool is_six(int x) {
while (x) {
x = x / 16;
if (x == 0)
return false;
else if (x == 1)
return true;
}
}
char alpha[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
... | ALGO | 0.999964 | 4.284453 |
27a6ba14-463e-4aff-a7fe-d62d5d9f7678 | Danziger/CarND-T2-Model-Predictive-Control-MPC-Quizzes | 003-MPC/src/Eigen-3.3/blas/double.cpp | #define SCALAR double
#define SCALAR_SUFFIX d
#define SCALAR_SUFFIX_UP "D"
#define ISCOMPLEX 0
#include "level1_impl.h"
#include "level1_real_impl.h"
#include "level2_impl.h"
#include "level2_real_impl.h"
#include "level3_impl.h"
double BLASFUNC(dsdot)(int* n, float* x, int* incx, float* y, int* incy)
{
... | ALGO | 0.995633 | 5.138801 |
652e46a6-9175-41eb-82c0-d90aee3ee1fd | raincross7/code-similarity | codes/train_code/problem057/problem057_480.cpp | #include "bits/stdc++.h"
using namespace std;
int main() {
string S;
cin >> S;
string ansS;
for (int i = 0;i<S.size();++i) {
if (0 == i%2) {
ansS += S[i];
}
}
cout << ansS << endl;
return 0;
} | ALGO | 0.999923 | 3.772726 |
127a1b06-6c86-4ff3-a091-c86b5fbe5cb5 | nbyaya/LegionCore-7.3.5 | dep/g3dlite/source/Welder.cpp | /**
\file Welder.cpp
\author Morgan McGuire, Kyle Whitson, Corey Taylor
\created 2008-07-30
\edited 2011-07-04
*/
#include "G3D/platform.h"
#include "G3D/Vector2.h"
#include "G3D/Vector3.h"
#include "G3D/Sphere.h"
#include "G3D/PointHashGrid.h"
#include "G3D/Welder.h"
#include "G3D/Stopwatch.h" // for profilin... | TOOL | 0.98047 | 7.77295 |
341cfe1c-b901-4f72-8fee-aa6a8d89bdd7 | chengyiwei/algorithm | nowcoder/2024winter_camp_6/I/I.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL ans;
int main() {
freopen("I.in", "r", stdin);
int n, m; scanf("%d%d", &n, &m);
vector<LL> a(n + 1), b(m + 1), sum_a(n + 1, 0), sum_b(m + 1, 0);
for (int i = 1; i <= n; i++) scanf("%lld", &a[i]), sum_a[i] = sum_a[i - 1] + a[i];
f... | ALGO | 0.999948 | 3.26039 |
0a2920a0-5c23-4de7-a614-2447aa033bc9 | ishandutta2007/codeforces | heart_blue/normal/1573/B.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.999868 | 3.652201 |
703d2866-fd74-4dad-b8f2-7bae7f21e46b | SuYuxi/yuxi | Algorithms/Array/1122. Relative Sort Array.cpp | class Solution {
public:
vector<int> relativeSortArray(vector<int>& arr1, vector<int>& arr2) {
map<int, int> cnt;
for(int& num : arr1) cnt[num]++;
vector<int> res;
for(int& num : arr2)
{
for(int i = 0; i < cnt[num]; i++) res.emplace_back(num);
cnt.erase(num);
... | ALGO | 0.99999 | 5.794109 |
3f5d3a96-0d6a-4c5e-8329-d45cd582b83d | codenics/selfStudy | c++/lynda/Exercise Files/Chap04/typeid.cpp | // typeid.cpp by Bill Weinman <http://bw.org/>
// version of 2018-10-28
#include <cstdio>
#include <typeinfo>
using namespace std;
struct A { int x; };
struct B { int x; };
A a1;
B b1;
int main() {
if(typeid(a1) == typeid(A)) {
puts("same");
} else {
puts("different");
}
return 0;
}
| TOOL | 0.865157 | 4.203146 |
a18d5aa1-d272-4eb7-ad4d-f6bbac9a0602 | jmxz994/RSS-DL-for-SPDZ | Yao/YaoGarbleWire.cpp | /*
* YaoWire.cpp
*
*/
#include "YaoGarbleWire.h"
#include "YaoGate.h"
#include "YaoGarbler.h"
#include "YaoGarbleInput.h"
#include "GC/ArgTuples.h"
#include "Tools/pprint.h"
#include "GC/Processor.hpp"
#include "GC/Secret.hpp"
#include "GC/Thread.hpp"
#include "GC/ShareSecret.hpp"
#include "GC/ThreadMaster.hpp"
#i... | TOOL | 0.893805 | 4.704908 |
acf0d2c1-e49c-4301-871d-3218777aff6c | isaaclo97/programacion-competitiva | Problemas/UVA/11151.cpp | #include <bits/stdc++.h>
using namespace std;
string word;
int memo[1005][1005];
bool mark[1005][1005];
int DP(int start,int end)
{
if(start==end) return 1; //ara quedara r
if(start+1==end)
{
if(word[start]==word[end]) return 2; // arra 4
return 1; //araa sera ra y la a coincidira ara
}
... | ALGO | 0.99992 | 4.471724 |
0bc99695-f752-4192-92b6-f31896a477eb | ManuelaBerrioCabeza/hw5 | wordle.cpp | #ifndef RECCHECK
// For debugging
#include <iostream>
// For std::remove
#include <algorithm>
#include <map>
#include <set>
#include <string>
#endif
#include "wordle.h"
#include "dict-eng.h"
using namespace std;
// Add prototypes of helper functions here
int countLetters(const string& str, char c);
void wordleHelper... | ALGO | 0.96 | 5.631673 |
1e4fc896-dda7-428b-b3ab-f137d3ce77cd | mstr2/jfxcore | modules/javafx.web/src/main/native/Source/WebCore/platform/audio/EqualPowerPanner.cpp | #include "config.h"
#if ENABLE(WEB_AUDIO)
#include "EqualPowerPanner.h"
#include "AudioBus.h"
#include "AudioUtilities.h"
#include <algorithm>
#include <wtf/MathExtras.h>
// Use a 50ms smoothing / de-zippering time-constant.
constexpr float SmoothingTimeConstant = 0.050f;
namespace WebCore {
EqualPowerPanner::Equ... | ALGO | 0.973751 | 7.449374 |
9a6c4223-e5b3-43e2-bdf6-968b75f6132e | VincentQu888/cp-solutions | dmoj/dmopc21c6p4.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#define ll long long
#define pii pair<int, int>
#define inf 0x7fffffff
#include <ctime>
int main() {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
int N, M;
cin >> N >> M;
... | ALGO | 0.999823 | 4.402445 |
75e09493-9b1f-4503-858c-4b9cb8830944 | joshualass/CP | Solutions/NonProblems/Crypt/computation.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
ll MOD;
template <typename T, typename D>
std::ostream& operator<<(std::ostream& os, const pair<T,D> &p) {
os << '(' << p.first << ", " << p.second << ") ";
return os;
}
template<typename T>
std::ostream& operator<<(st... | ALGO | 0.999939 | 4.513579 |
577f699e-bd24-4944-be0c-a174d1f68878 | tooweakchen/leetcode | leetcode003.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
const int maxn=1e5+10;
int visit[500];
int dp[maxn];
class Solution
{
public:
int lengthOfLongestSubstring(string s)
{
int i, j;
int last_start = 0; // һӴʼλ
int maxl... | ALGO | 0.999875 | 4.376993 |
983d31cd-6ad8-43b1-983b-5c774d4c1d88 | mashhood-0530/OOP-LAB | OOP LAB 3/oops lab3 q3.cpp | #include <iostream>
using namespace std;
class Glass {
public:
int LiquidLevel;
Glass() {
LiquidLevel = 200;
}
void Drink(int milliliters) {
if (milliliters > 0 && milliliters <= LiquidLevel) {
LiquidLevel -= milliliters;
}
if (LiquidLevel ... | TOOL | 0.872735 | 6.099156 |
d9dc4fb7-f5fe-4b9a-9fd1-5055304d8ac3 | V-Kariuki/programmingii | function.cpp | #include <iostream>
using namespace std;
// Function declaration
int add(int a, int b);
float add(float a, float b);
int main() {
int num1, num2;
float num3, num4;
// Input two numbers
cout << "Enter two numbers: ";
cin >> num1 >> num2;
cout << "Enter two numbers: ";
cin >> num3 >> num4;
... | ALGO | 0.980555 | 5.857678 |
fb21c091-2403-4007-a2ea-27a66320d237 | jpdotcom/comp_prog-archive | Auto_Upload_Codeforces/Codeforces_Testing_Round_1/C_Circular_RMQ.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define FOR(b) for(int i=0;i<(int)b;i++)
#define mp(a,b) make_pair(a,b)
typedef std::vector<int> vi;
typedef std::pair<long long,long long> pi;
typedef long long ll;
#define F first
#define S sec... | ALGO | 0.999899 | 4.28949 |
d33ae7b1-772f-405c-8af5-e872b5c3bd18 | Karthikraut/Leetcode-Questions | 917-boats-to-save-people/boats-to-save-people.cpp | class Solution {
public:
int numRescueBoats(vector<int>& people, int limit) {
int n= people.size();
int i=0,j=n-1;
int boat =0;
sort(people.begin(),people.end());
while(i<=j){
if(people[i]+ people[j]>limit && i!=j){
boat++;
j--;
... | ALGO | 0.999996 | 5.912462 |
16fba8e5-4d50-40dc-85cb-98f1701bfc83 | GuacheSuede/MSSubmission1234567890 | submission/macd/boost_1_69_0/libs/compute/perf/perf_stl_partition_point.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
bool less_than_20(int value)
{
return value < 20;
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::c... | ALGO | 0.991561 | 6.115492 |
d365f5fe-bb35-4166-b2ab-7e477ec9c794 | nicoring/aoc-2021 | src/day5/run.cpp | #include <fstream>
#include <iostream>
#include <regex>
#include <string>
#include <vector>
std::vector<std::string> read_lines() {
std::vector<std::string> lines;
std::string line;
std::ifstream myfile("src/day5/input.txt");
if (myfile.is_open()) {
while (getline(myfile, line)) {
l... | ALGO | 0.995476 | 6.056063 |
45461c9a-53f7-4129-a07c-6dddf3b09f59 | handstuyennn/geo | geo/third_party/geos/algorithm/CGAlgorithumsDD.cpp | #include <cmath>
#include <geos/algorithm/CGAlgorithmsDD.hpp>
#include <geos/geom/Coordinate.hpp>
#include <geos/util/IllegalArgumentException.hpp>
#include <sstream>
using namespace geos::geom;
using namespace geos::algorithm;
namespace {
inline int OrientationDD(const DD &dd) {
static DD const zero(0.0);
if (dd ... | ALGO | 0.999589 | 7.115016 |
d3789dfe-63ef-406b-98d1-1be634ede3a5 | ishandutta2007/codeforces | shenxy13/normal/1450/E.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int, int> ii;
vector<int> adjlist[200];
int bip[200];
bool dfs(int v, int p) {
for (int i: adjlist[v]) {
if (i == p) continue;
if (bip[i] == -1) {
bip[i] = 1 - bip[v];
if (!dfs(i, v)) return false;
} else if (bip[i] ... | ALGO | 0.999971 | 4.21185 |
5a55ac5e-e394-49fc-832d-23b4f3e8ad97 | anshukandhari/C-Cpp-Code | Tree/tries.cpp | //READ FROM GEEKSFORGEEKS http://www.geeksforgeeks.org/archives/13067
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ARRAY_SIZE(a) sizeof(a)/sizeof(a[0])
// Alphabet size (# of symbols)
#define ALPHABET_SIZE (26)
// Converts key current character into index
// use only 'a' through 'z' and lower ... | ALGO | 0.999644 | 4.051454 |
0a4aec28-134a-4346-9aa4-bf55cfd1a75c | rushirao17/Codechef-Solution | Penalty_Shots.cpp | #include <iostream>
using namespace std;
int main(){
int i,n,A,B,a1,a2,a3,a4,a5,b1,b2,b3,b4,b5;
cin>>n;
for(i=1;i<=n;i++){
cin>>a1>>b1>>a2>>b2>>a3>>b3>>a4>>b4>>a5>>b5;
A=a1+a2+a3+a4+a5;
B=b1+b2+b3+b4+b5;
if(A>B){
cout<<1<<endl;}
else if(A==B){cou... | ALGO | 0.999824 | 3.174943 |
5e4c34ff-ef63-44b5-9c90-d40521ac29d8 | lohith171/Coding-Practice-Problems | Dp + Bitmasking/Maximum Compatibility Score Sum.cpp | //https://leetcode.com/problems/maximum-compatibility-score-sum/
/*
There is a survey that consists of n questions where each question's answer is either 0 (no) or 1 (yes).
The survey was given to m students numbered from 0 to m - 1 and m mentors numbered from 0 to m - 1. The answers of the students are represented by... | ALGO | 0.999742 | 6.567947 |
82bf81f2-cbd7-41b7-a341-6ec0b87ccfd0 | stalker5217/problem-solving | SWEXPERTACADEMY/1984.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char** argv)
{
int test_case;
int T;
//freopen("input.txt", "r", stdin);
cin >> T;
for (test_case = 1; test_case <= T; ++test_case)
{
vector<int> arr;
for (int i = 0; i < 10... | ALGO | 0.999208 | 3.765162 |
85d1047d-8884-46b8-bb40-2289b207c4de | Amit-O5/Cpp | BinarySearch.cpp | #include<iostream>
using namespace std;
void binarysearch(int arr[], int size, int element) {
int start = 0;
int end = size - 1;
int mid;
while (start <= end) {
mid = (start + end) / 2;
if (arr[mid] == element) {
cout << "Element found at index " << mid << endl;
... | ALGO | 0.999906 | 5.996694 |
42f0d3a0-b77b-4119-a143-484297d5be66 | Kyaki101/Competitive-Programming | Math/CDDrinks.cpp | /*
*https://codeforces.com/problemset/problem/200/B
*/
#include <bits/stdc++.h>
typedef long long int ll;
typedef std::vector<int> vec;
using namespace std;
void sol(){
int n;
int a;
cin >> n;
int counter = 0;
for(int i = 0; i < n; i++){
cin >> a;
counter += a;
}
cout << (... | ALGO | 0.997456 | 4.199376 |
acb44dee-e529-4d69-8d8f-4fb373b70149 | SanketGadhe/Sanket | queue.cpp | #include<iostream>
using namespace std;
int rear=0;
int front=0;
int arr[100];
void enqueue(int element){
if(rear==100){
cout<<"Queue is full";
}
arr[rear]=element;
rear++;
}
void dequeue(){
if(rear==front){
cout<<"Queue Underflow";
}
else{
front++;
if(front==rear){
front=0;
... | ALGO | 0.995325 | 4.193787 |
7b92cde4-1076-41a0-adf4-f4ca8ce4dab0 | OscarJin/leetcode-cpp | 42.trapping-rain-water.cpp | // @before-stub-for-debug-begin
#include <vector>
#include <string>
#include "commoncppproblem42.h"
using namespace std;
// @before-stub-for-debug-end
/*
* @lc app=leetcode id=42 lang=cpp
*
* [42] Trapping Rain Water
*/
// @lc code=start
class Solution {
public:
int trap(vector<int>& height) {
int re... | ALGO | 0.999974 | 7.307512 |
15370431-8721-452f-8987-8a506e4fe93b | Nrgeup/Algorithm-practice | poj/1028.cpp | #include<iostream>
#include<string>
#include<cstring>
using namespace std;
class node
{
public:
node* last;
node* next;
string data;
node(){
last =NULL;
next = NULL;
data = "";
}
};
int main(){
string comment,url;
node* root = new node;
root->data = "http://www.acm.org/";
node* pos = ... | ALGO | 0.996949 | 3.632946 |
d5e7315b-706b-4c19-b839-36cc43e8b9b4 | dsnehasish74/Strivers_DSA_Sheet | Day1/preorder.cpp | /*
Following is Binary Tree Node structure:
class TreeNode
{
public:
int data;
TreeNode *left, *right;
TreeNode() : data(0), left(NULL), right(NULL) {}
TreeNode(int x) : data(x), left(NULL), right(NULL) {}
TreeNode(int x, TreeNode *left, TreeNode *right) : data(x)... | ALGO | 0.999996 | 5.962136 |
022165de-051b-485d-98e4-e6cd3df41ec6 | Winkey86/SegmentedDequeOnSequence | cpp/SegmentedDeque.cpp | #include "SegmentedDeque.h"
#include "Types.h"
#include <algorithm>
#include <functional>
template <class T>
SegmentedDeque<T>::SegmentedDeque(int segCap)
: segmentCapacity(segCap), totalSize(0)
{
data = new MutableListSequence<MutableArraySequence<T>>();
}
template <class T>
SegmentedDeque<T>::SegmentedDeque... | TOOL | 0.968711 | 6.365248 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.