uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
dbe8104e-621b-4ff4-a0eb-f4ad6e9caee6 | dkduyy/LTCB-L01 | for, while/b10.cpp | #include <stdio.h>
int main()
{
int n;
printf("Nhap n: "); scanf("%d", &n);
long long f1 = 1, f2 = 1, fn = 1;
for(int i = 3; i <= n; i++) {
fn = f1 + f2;
f2 = f1;
f1 = fn;
}
printf("fibonacci thu %d la: %ld", n, fn);
return 0;
}
| ALGO | 0.999775 | 3.562592 |
79d7b9db-1c35-4844-a9f1-d22133fb2bf2 | ameyjain99/LeetCode | Algorithms/C++/sort-linked-list-already-sorted-using-absolute-values.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
ListNode* sortLinkedList(ListNode* head) {
auto tail = head;
auto curr = head->next;
head->next = nullptr;
while (curr) {
auto nxt = curr->next;
if (curr->val > 0) {
curr->next = nullptr;
... | ALGO | 0.999993 | 5.774411 |
57967737-0c53-41a2-86a9-3dcb609aebc7 | Eeman1113/Leetcode | Problems/501.cpp | struct T {
int pro;
int cap;
T(int pro, int cap) : pro(pro), cap(cap) {}
};
class Solution {
public:
int findMaximizedCapital(int k, int W, vector<int>& Profits,
vector<int>& Capital) {
auto compareC = [](const T& a, const T& b) { return a.cap > b.cap; };
auto compareP = [](... | ALGO | 0.999921 | 5.367036 |
f1474512-d9d2-49e8-b514-7d9fc7cf39f9 | CodeToLearnScience/2d_shallow_water | src/diss_movers_h1.cpp | #include "global_declarations.h"
#include "basic_functions.h"
template <typename T>
T Movers(T Fr, T Fl, T Ur,T Ul,T L_max, T L_min);
template <typename T>
T MaxEigVal(T ur, T ul, T vr, T vl, T ar, T al, T nx, T ny);
template <typename T>
T MinEigVal(T ur, T ul, T vr, T vl, T ar, T al, T nx, T ny);
void Diss_MOVERS... | ALGO | 0.999926 | 4.476017 |
26f8bd3f-5641-4a32-b794-5030cda4c9bf | Rahul1202sahu/college-work | Ada Progrms/binarysearch.cpp | // Binary Search in C++
#include <iostream>
using namespace std;
int binarySearch(int array[], int x, int low, int high) {
// Repeat until the pointers low and high meet each other
while (low <= high) {
int mid = low + (high - low) / 2;
if (array[mid] == x)
return mid;
if (array[mid] < x)
... | ALGO | 0.999977 | 6.305723 |
76268886-97f9-44c8-acde-a0e578edbe3f | ishandutta2007/codeforces | daniel_jiang/normal/1530/E.cpp | // wish to get better qwq
#include<bits/stdc++.h>
#define re register int
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define dec(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
template<class T> ... | ALGO | 0.999977 | 3.82942 |
6d6f0980-11e8-4f57-852f-56f4edb28131 | ishandutta2007/codeforces | sert/normal/1015/B.cpp | #pragma GCC diagnostic ignored "-Wunused-result"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = (int)1e6 + 34;
//const ll INF = (ll)1e18 + 41;
const int INF = (int)1e9 + 41;
const ll MD = (ll)1e9 + 7;
bool D = false;
void solve() {
int n;
cin >> n;
string s... | ALGO | 0.999961 | 3.632628 |
f7694718-a909-45ee-8958-d7528e98a1c2 | johnnyoh555/Baekjoon | 24.02/1149_RGB거리.cpp | // https://www.acmicpc.net/problem/1149
#include <iostream>
int d[1001][3];
using namespace std;
int main(void){
ios::sync_with_stdio(0);
cin.tie(0);
int N;
cin >> N;
for (int i = 1; i <= N; i++) {
for (int j = 0; j < 3; j++) {
cin >> d[i][j];
}
}
for (int i = 2; i <= N; i++) {
d[i][0] += min(d[i ... | ALGO | 0.999846 | 4.324983 |
1ac04986-648c-4edc-8075-592c3d1c4f62 | Dhiru12321/DSA-GFG | DSA (deepanshu)/LINKEDLIST/SINGLY/6_deleteAtTail.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *next;
Node(int x)
{
data = x;
next = NULL;
}
};
Node *deleteAtTail(Node *head)
{
if (head == NULL)
return NULL;
if (head->next == NULL)
{
delete (head);
return NULL;
... | ALGO | 0.998707 | 5.181451 |
4ec2edd7-3d2a-491c-8ac1-66a59178fbcc | rustem24liu/Programming-Principles--1 | upsolvingforq3/E.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
string s;
cin >> s;
int sum = 0;
for(int i = 0; i<s.size(); ++i){
if(s[i] > '0' && s[i] <= '9')
sum += s[i] -48;
}
cout << sum;
} | ALGO | 0.998372 | 3.678947 |
38bd0022-c94b-407f-8ed6-ff97aa8dd992 | kbingham/libcamera | src/ipa/ipu3/algorithms/agc.cpp | #include "agc.h"
#include <algorithm>
#include <chrono>
#include <libcamera/base/log.h>
#include <libcamera/base/utils.h>
#include <libcamera/control_ids.h>
#include <libcamera/ipa/core_ipa_interface.h>
#include "libipa/colours.h"
#include "libipa/histogram.h"
/**
* \file agc.h
*/
namespace libcamera {
using ... | TOOL | 0.87582 | 7.191854 |
f180c147-4985-4452-a838-3dbf5659d155 | AnuragMacOS/DSA | Basic Maths/4.Armstrong.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter a number :";
cin>>n;
int dup=n;;
int sum=0;
while(n>0)
{
int ld=n%10;
sum=sum+(ld*ld*ld);
n=n/10;
}
if(dup==sum)
cout<<" its an armstrong number ";
else
cout<<"its not an armstrong number";
return 0;
} | ALGO | 0.999536 | 3.986245 |
402e282f-c4ef-45ba-892e-efef9090573b | ermine27/competitive-programming | src/atcoder/abc/088/088-d.cpp | #include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = (int)(s); i < (int)(n); ++i)
#define rep(i,n) reps(i,0,n)
#define repf(i,n) reps(i,1,n+1)
#define all(v) v.begin(), v.end()
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
const int dx[] = {1, 0, -1, 0, 1, -1, -1,... | ALGO | 0.999302 | 4.774014 |
0745c464-66f9-43cf-8662-bb40c6b2df37 | rexa0310/Leet_Ques | 454-4sum-ii/454-4sum-ii.cpp | class Solution {
public:
int fourSumCount(vector<int>& n1, vector<int>& n2, vector<int>& n3, vector<int>& n4)
{
int c=0;
unordered_map<int,int>m;
for(int i=0;i<n1.size();i++)
for(int j=0;j<n2.size();j++)
m[n1[i]+n2[j]]++;
for(int i=0;i<n3.size();i++)... | ALGO | 0.999565 | 6.205486 |
bb47c056-e14a-4c5e-9989-0c9be2df0734 | Aviral1-jain/CP_DSA | GraphsQues/Find the string in grid.cpp | //https://practice.geeksforgeeks.org/problems/find-the-string-in-grid0111/1
int dr[8]={-1,1,0,0,-1,-1,1,1};
int dc[8]={0,0,-1,1,-1,1,-1,1};
bool dfs(int i,int j,int addx,int addy,string &word,vector<vector<char>> grid,int ind){
if(ind==word.size()){
return true;
}
... | ALGO | 0.999531 | 5.936212 |
4b8b80e1-416d-40d8-bb7b-47a4b6ab6bc3 | Alexchiuu/programming_contest_code | TIOJC++/1005/main.cpp | #include <iostream>
#include <iomanip>
#include <math.h>
#include <algorithm>
using namespace std;
/*
bool isPrime(int a, int b){
while(!(a == 0 || b == 0)){
if(a > b){
a = a % b;
}else{
b = b % a;
}
if(a == 1 || b == 1){
return true;
}
... | ALGO | 0.999759 | 3.769993 |
7e82a85b-6db6-4fc1-8a2d-79284cdfcd9d | Shubhamm1211/GFG- | Difficulty: Medium/Flood fill Algorithm/flood-fill-algorithm.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<vector<int>> floodFill(vector<vector<int>>& image, int sr, int sc,
int newc) {
// Code here
int n = image.size();
int m = image[0].s... | ALGO | 0.97931 | 6.222286 |
83dbd8b2-8d34-471a-85b9-154f0737a14f | Sanjeev2697UCSD/CSE237C_FinalProject | filter_downsampler/polyphase_baseline/filter.cpp | /*
Filename: correlator.cpp
The input signal is filtered, downsampled and sent to a bank of correlators to see which signal the input is correlating the maximum with.
INPUT:
input_signal : signal (chirp)
OUTPUT:
output_signal : filtered and downsampled
*/
#include "filter.h"
void filter (
data_t *output_... | ALGO | 0.999176 | 3.695213 |
1b5dc0e6-edc5-4f5c-b0c1-0798314d6b9e | vidit1999/daily_coding_problem | data/dailyCodingProblem892.cpp | #include <bits/stdc++.h>
using namespace std;
/*
The power set of a set is the set of all its subsets.
Write a function that, given a set, generates its power set.
For example, given the set {1, 2, 3}, it should return
{{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}.
You may also use a list or array to repres... | ALGO | 0.999613 | 5.879125 |
d88d68b6-7f15-4c31-86ec-8cdcecd0d9bc | C-2024-1-3/240310wangtingzhong | 实验三,四/实验四1.cpp | #include <iostream>
int main() {
int arr[10];
int count = 0;
for (int i = 0; i < 10; i++) {
int num;
std::cin >> num;
bool isNew = true;
for (int j = 0; j < count; j++) {
if (arr[j] == num) {
isNew = false;
break;
}
... | ALGO | 0.999688 | 4.582667 |
1b026540-cff7-4e89-85d2-11173a60dd0b | alexandraback/datacollection | solutions_2751486_0/C++/gaurav708/a.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <functional>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> p... | ALGO | 0.999674 | 3.751871 |
a1bc1065-fc29-4cd9-9f7c-ecaf1fa6c6a6 | ouaguenouni/PDI_Project | src/PRP_1-16_CPLEX.cpp | #include <ilcplex/ilocplex.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm> // std::min
#include"PRP.h"
#define epsilon 0.00001
using namespace std;
int main_1_16 (int argc, char**argv){
string name,nameext, nameextsol;
ostringstream varname;
////////////... | ALGO | 0.999843 | 3.047012 |
13b15f5f-a9e0-4630-93c5-ead0c0140618 | Starship-Android/android_system_core | init/init_parser.cpp | #include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "init.h"
#include "parser.h"
#include "init_parser.h"
#include "log.h"
#include "property_service.h"
#include "u... | TOOL | 0.960926 | 5.577711 |
598e97e0-0bd0-414e-9902-8541022df52c | PX4/PX4-Autopilot | src/modules/ekf2/EKF/aid_sources/external_vision/ev_yaw_control.cpp | /**
* @file ev_yaw_control.cpp
* Control functions for ekf external vision yaw fusion
*/
#include "ekf.h"
void Ekf::controlEvYawFusion(const imuSample &imu_sample, const extVisionSample &ev_sample,
const bool common_starting_conditions_passing, const bool ev_reset, const bool quality_sufficient,
es... | ALGO | 0.978608 | 5.885619 |
adce2297-6065-44d6-b42d-5736cf1dc088 | iyeeun/codingtest | chap8/1699.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> dp(n+1);
dp[0] = 0;
dp[1] = 1;
for(int i = 2; i <= n; i ++) {
dp[i] = i;
for(int j = 1; j*j <= i; j ++) {
if(dp[i-j*j] + 1 < dp[i]) {
dp[i] = dp[i-j*j] + 1;
}
}
}
co... | ALGO | 0.999852 | 4.081789 |
812f6d5d-0188-415f-b02b-9289e566a7ce | melihcgn/Sabanci | DataStructures/HW4/mcagan_Ari_MelihCagan_hw4.cpp | #include <iostream>
#include <string>
#include"SortsSearches.h"
#include <sstream>
#include <fstream>
#include <chrono>
using namespace std;
struct PhoneInfo // struct to keep the datas in the files
{
string name;
string surname;
string phoneNum;
string city;
PhoneInfo(string n ="", string sn="", string pn="", st... | ALGO | 0.999387 | 4.125658 |
3696d6d7-de4a-40d3-86cb-6395024ed5a2 | ck89119/Algorithm | Luogu/1102.cpp | #include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << __LINE__ << " : "<< #x << " = " << (x) << endl
#define clr(a, x) memset(a, x, sizeof(a)) //0:0, -1:-1, INF:0x3f, -INF:0xc0
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define lowbit(x) x & (-x)
typedef long long ll;
typedef pair<i... | ALGO | 0.999982 | 3.370415 |
460b6dd8-546e-4bd2-b00c-65ff6456d30b | linyuting26/Programming | 107_1高中職程式設計基礎課程(臺北科技大學)/6-Scoop and Lifetime作業6(1)/fn_GetSumR.cpp | #include "fn_GetSum.h"
int fn_GetSumR(int int_Var, int int_Var2){
int int_Temp =-1;
int_Temp=(int_Var,int_Var2);
return int_Temp;
}
| TOOL | 0.96066 | 4.76562 |
36c11d56-6c98-475f-bf3a-06ab032f86e1 | BrandonZu/LeetCode | C++/3rd_072021-102022/298_BinaryTreeLongestConsecutiveSequence.cpp | //
// Created by BrandonZu on 12/11/21.
//
#include "common.h"
#include "TreeNode.h"
// Runtime 32ms(>81%) | Memory Usage 32.6MB(>63%)
class Solution {
int max_len;
public:
int postorder(TreeNode* root) {
int l = 0, r = 0;
if(root->left) {
int tmp = postorder(root->left);
... | ALGO | 0.999916 | 5.754618 |
317adec8-0a63-4d65-9835-31d7f677c60c | AbhiramChitta/III-SEM-LABS | DS/LAB-10/recursive.cpp | #include <iostream>
using namespace std;
struct Node{
Node *lc, *rc;
int data;
};
class Tree{
private:
Node *root;
public:
Tree(){
root= createTree();
}
Node* createTree(){
int val;
cout<<">";
cin>>val;
if(val==-1)
return NULL;
... | ALGO | 0.999812 | 4.385229 |
dea88a4c-0fd1-4c84-9a9e-c8f992e4c16f | H1m9n5hu/Data-Structures-and-Algorithms | CodeCheif/C54.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--)
{
int N, X;
cin >> N >> X;
int deposite[N], Y;
for(int i = 0; i < N; i++)
{
cin >> Y;
deposite[i] = Y;
}
sort(deposite, deposite + N, greater<int>());
int sum = 0, ... | ALGO | 0.999938 | 4.21242 |
80f85b27-b176-4419-9de5-d215e9cb388b | shubhamthrills/Placement-Drive-Questions | TCS Codevita/Solutions/optimised_alphabet.cpp | #include<bits/stdc++.h>
using namespace std;
set <int> vect;
int main()
{
char str[1000];
int x,num,num1;
cin>>str;
for(x=0;x<strlen(str)-1;x++)
{
num= (int)(str[x])-'0';
vect.insert(num);
num1= (int)(str[x+1])-'0';
if(num1==7 || num1== 9)
{
num= (num-1) % 4;
}
else
{
num= (num-1)%3;
}
... | ALGO | 0.997766 | 3.527636 |
c06bb023-75f4-4c2f-858b-f0796dd8ed70 | Adhmkty99/Vayu | libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/ranges_rotate.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
// <algorithm>
// template<permutable I, sentinel_for<I> S>
// constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
//
// template<forward_range R>
// requires permutable<iterator_t<R>>
// constexpr borrowed_sub... | TEST | 0.951992 | 7.894946 |
fd384ed0-6a8b-482c-92f2-ad6354e637df | IshanGupta10/Competitve_Coding | CSAcademy_SortingPartition.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(int argc, char const *argv[])
{
int n, t, min, total = 1;
vector<int> v;
cin>>n;
for (int i = 0; i < n; ++i)
{
cin>>t;
v.push_back(t);
}
t = 0;
for (int i = 0; i < n - 1; ++i)
{
if(v[i +... | ALGO | 0.99997 | 4.243519 |
c560b5a4-d031-4ed7-9c5c-334dbda4d102 | dsnow-team/digitalSnow | radiativeTransfer/customPhotonTracing/pbrt-v2_dupli/src/core/rng.cpp | // core/rng.cpp*
#include "stdafx.h"
#include "rng.h"
// Random Number Method Definitions
#define M 397
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
void RNG::Seed(uint32_t seed) c... | ALGO | 0.999287 | 6.48981 |
e8f22681-beb4-4853-9c71-7611a6d9830e | Sejalkaur/DSA | Section03/Lec02./Sort012.cpp | //Link: https://www.naukri.com/code360/problems/sort-an-array-of-0s-1s-and-2s_892977?utm_source=striver&utm_medium=website&utm_campaign=a_zcoursetuf&leftPanelTabValue=SUBMISSION
#include <bits/stdc++.h>
void sortArray(vector<int>& arr, int n)
{
// Write your code here
int low = 0, high = n-1, mid = 0;
whil... | ALGO | 0.999961 | 5.277483 |
7f51f93d-2ff2-4223-ba4c-f89eccc6a6a5 | soundariyav/LeetcodePractice | 1529. Minimum Suffix Flips.cpp | class Solution {
public:
int minFlips(string target) {
int count=0;
char prevno='0';
for(int i=0;i<target.size();i++)
{
if(prevno!=target[i])
{
count++;
prevno = target[i];
}
}
return count;
}
};
| ALGO | 0.999406 | 6.019439 |
970389d0-ae30-4add-89bc-cffa3e3fec47 | karasuma-2401/IT001 | HW(final)_2Darray && string/hw14.1.cpp | #include <iostream>
#include <sstream>
using namespace std;
int main(){
string s;
getline (cin, s);
stringstream ss (s);
string word;
int count =0;
while (ss >> word){
bool ok = true;
for (int i =0; i < word.length(); i++){
if ( isdigit(word[i])) ok = false;
... | ALGO | 0.99073 | 3.915466 |
928d7ad7-2b5b-46c7-83cb-9df5d995dfc0 | bwilhelm0/15-418-Vehicle-Routing-Problem | src/VRPBottomUp.cpp | using namespace std;
#include "VRP.h"
// Function to print the final routes taken to solve the final problem
void printRoutes(vector<vector<point>> routes) {
int numRoutes = (int)routes.size();
for (int route = 0; route < numRoutes; route++) {
cout << "Vehicle: " << route << ", ";
int nodes = (int)routes[r... | ALGO | 0.999907 | 4.446515 |
b32caf3b-0c43-4d54-89cd-3f528fd501ca | Harshitmishra001/Programming_Practice | Distance_Overload.cpp | #include <iostream>
using namespace std;
class Distance{
public:
int feet;
Distance(double x=0.0):feet(static_cast<int>(x)){};
friend Distance operator*(double scalar, const Distance &obj);
friend Distance operator*(const Distance &obj1, const Distance &obj);
void display(){
cout<<"Dista... | TOOL | 0.852569 | 4.064195 |
c57233cf-cae9-46a8-b3f5-7c5aad0406c4 | PlanarG/Code | Contest/4.26/T2.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 500010;
typedef long long LL;
int num[N]; vector<LL> dp[2][N * 4];
inline void check(LL &x, LL y) {
if (y > x) x = y;
}
void process(int rt, int l, int r) {
if (l == r) return dp[0][rt] = {0, num[l]}, dp[1][rt] = {0, -num[l]}, void();
int mid ... | ALGO | 0.999914 | 3.76944 |
94ae6bee-83f5-41c1-8b69-3d4b722de9d2 | AbhishekChauhan9036/Arrays-in-C- | 03). Recursion/_1)_Print_Subset_Strings.cpp | #include <iostream>
using namespace std;
void printSub(string str, string curr, int index)
{
if(index == str.length())
{
cout<<curr<<" ";
return;
}
printSub(str, curr, index + 1);
printSub(str, curr+str[index], index + 1);
}
int main()
{
string str = "ABC";
cout<<"Sub Strings:- ";
printSub(str, "", 0);... | ALGO | 0.999045 | 4.583445 |
b2aaad2d-79ca-427e-95be-354d87c983c1 | luthanhy/LearnCode | Datastructures_And_Algorithms/Single_Linked_List/ss.cpp | #include "iostream"
using namespace std;
int main(){
int A[10];
for(int i = 0;i<3;i++){
cin>>A[i];
}
int count =0;
for(int i = 0;i<3;i++){
for(int j = i+1 ;j < 3 ;j++){
if(A[i]+A[j]==4){
count++;
}
}
}
cout<<"\n dd "<<count;
}
| ALGO | 0.99994 | 4.925283 |
f82b8a55-e5eb-4080-a382-c651f6d60a93 | ImranPasha247/Codes | C++/project/index.cpp | #include <bits/stdc++.h>
using namespace std;
const int TABLE_SIZE = 100;
struct Contact {
string name;
string phone;
Contact* next;
};
Contact* hashTable[TABLE_SIZE] = {nullptr};
int hashFunction(string key) {
int sum = 0;
for (char ch : key) sum += ch;
return sum % TABLE_SIZE;
}
string to... | TOOL | 0.998632 | 6.127163 |
99b2fab5-ea55-4736-a7ee-0c9bb5b6d5a2 | ManavRastogi03/DSA | One-Dimension-Array/Array-2/LastIndex.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> v;
v.push_back(2);
v.push_back(4);
v.push_back(5);
v.push_back(1);
v.push_back(3);
v.push_back(2);
v.push_back(1);
for(int i=0;i<v.size();i++){
cout<<v[i]<<" ";
}
int target;
cin>>tar... | ALGO | 0.999754 | 4.027136 |
0a092987-f299-43b0-867e-850579b16336 | paulo-werle/uffs | progamacao-competitiva/lista-8/beecrowd-1487-six-flags.cpp | #include <iostream>
#include <vector>
using namespace std;
struct Atracao {
int duracao;
int pontuacao;
};
int calcularPontuacaoMaxima(int tempoDisponivel, const vector<Atracao>& atracoes) {
int n = atracoes.size();
vector<vector<int>> dp(n + 1, vector<int>(tempoDisponivel + 1, 0));
// Preencher a tabela ... | ALGO | 0.999841 | 6.773571 |
b00f6b07-35b8-4fdf-a833-c65eff5ace76 | netxpto/NetPlanner | sdf/heuristic/Final/lib/path_generator_20190302.cpp | # include "..\include\path_generator_20190302.h"
# include "..\include\Dijkstra_20190309.h"
using namespace std;
void PathGenerator::initialize(void) {
numberOfOutputSignals = (int)outputSignals.size();
numberOfOutputSignals = (int)inputSignals.size();
}
bool PathGenerator::runBlock(void) {
// Components of a "... | ALGO | 0.995749 | 3.283994 |
868b9556-5c12-4455-a5a7-aae0c676e5d3 | manassur/dogcatalogapp | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
5104acc3-ec3a-4238-82e0-4c9679ebb8c9 | mostaphaelansari/Leetcode | Python/6-zigzag-conversion/zigzag-conversion.cpp | class Solution {
public:
string convert(string s, int numRows) {
if (numRows == 1 || numRows >= s.length()) return s;
vector<string> rows(min(numRows, int(s.length())));
int currRow = 0;
bool goingDown = false;
for (char c : s) {
rows[currRow] += c;
... | ALGO | 0.999993 | 6.568345 |
2985491f-a1f5-41ba-a07e-a41fdbecff67 | shishirRsiam/CSE-Fundamentals-With-Phitron | 5. XPSC - Problem Solving Club/Week 12/Day 2/Restaurant_Customers.cpp | #include<bits/stdc++.h>
#define str string
#define ll long long
#define by "\n";
#define pi pair<ll,ll>
#define vec vector<ll>
#define py cout<<"YES\n"
#define pn cout<<"NO\n"
#define pb push_back
#define bee(x) x.begin(), x.end()
#define pyn cout<<"YES\n":cout<<"NO\n"
#define shishirRsiam cin.tie(NULL);
#define code ... | ALGO | 0.999917 | 4.751595 |
cd3369b3-f380-4568-bc63-89a292f73424 | L1nkus/cpptemplates | convexhulltrick.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr... | ALGO | 0.999687 | 4.217364 |
f03445f1-750c-40c6-a809-a744cc820c18 | GautamKJ/LeetCode | Rotation - GFG/rotation.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
int findKRotation(int arr[], int n) {
int l=0,h=n-1;
while(l<h)
{
int mid=(l+h)/2;
if(arr[mid]>arr[h])
... | ALGO | 0.999872 | 5.766463 |
99fb3ced-5dfc-478e-96bf-ede4d81e5f4e | SouthJH/M2S | opencl_version/m2s_api.cpp | #include "m2s_api.h"
/*
* target API: clGetPlatformIDs
*
* Supposed that we have single platform
* for now, i use only NVIDIA GPU
* therefore, the single platform will be nvidia opencl platform
*/
m2s_int m2sGetPlatformIDs(m2s_uint num_entries, m2s_platform_id *platforms, m2s_uint *num_platforms)
{
#ifdef DEBUG_MODE
... | TOOL | 0.915519 | 5.658892 |
45a85b1e-2281-4a92-8b91-5ffaaa072cb9 | u-m-i/Cpp-Chanllenges | FlowControl/first_N_numbers.cpp | /**
* Print the _n_ numbers
*/
#include<iostream>
int main()
{
int user_number;
std::cin >> user_number;
for(int i = 1 ; i < user_number + 1 ; ++i)
{
std::cout << i << '\n';
}
return 0;
}
| ALGO | 0.987038 | 3.987277 |
91eb06a2-a278-4d52-a92e-ce73d37d59ef | jeannie068/Fixed-Outline-Floorplanning-Optimization-Tool | 2023CAD_0618/TREE.cpp |
#include "myGraph.h"
#include "TREE.h"
#include "parser.h"
#include <bits/stdc++.h>
using namespace std;
int TreeNode:: GetNodeID()
{
return m_nNodeID;
}
int TreeNode:: GetChildNum()
{
return (int)m_vecChild.size();
}
TreeNode* TreeNode:: GetChild(int v_id)
{
if (v_id < 0 || v_id >= (int)m_vecChild.size... | ALGO | 0.929367 | 3.289543 |
91ce22d4-84e9-483a-a59a-942105dfbd28 | 304314/Code-Size-Global-Optimization | llvm/lib/CodeGen/RDFLiveness.cpp | using namespace llvm;
static cl::opt<unsigned> MaxRecNest("rdf-liveness-max-rec", cl::init(25),
cl::Hidden,
cl::desc("Maximum recursion level"));
namespace llvm::rdf {
raw_ostream &operator<<(raw_ostream &OS, const Print<Liveness::RefMap> &P) {
... | ALGO | 0.998452 | 6.341732 |
28cdfac4-60e0-43f5-9294-f7d26799f9e8 | shrutijpg/DSA | 40-combination-sum-ii/combination-sum-ii.cpp | class Solution {
public:
void findCombinations(int indx,int target,vector<int> & arr,vector<vector<int>> &ans,vector<int>&ds){
if(target == 0){
ans.push_back(ds);
return;
}
for(int i = indx;i<arr.size();i++){
if(i>indx && arr[i] == arr[i-1]) continue;
if(arr[i]>target) break... | ALGO | 0.99999 | 6.208827 |
51341f75-84ba-4e22-a580-e588377714ff | bigtreetech/Octopus-Max-EZ | Firmware/Marlin-bugfix-2.1.x/Marlin/src/libs/least_squares_fit.cpp | /**
* Least Squares Best Fit by Roxy and Ed Williams
*
* This algorithm is high speed and has a very small code footprint.
* Its results are identical to both the Iterative Least-Squares published
* earlier by Roxy and the QR_SOLVE solution. If used in place of QR_SOLVE
* it saves roughly 10K of program memory. I... | ALGO | 0.998764 | 5.833176 |
9fbb1a08-86ac-4665-9c2e-81dc717bf64d | harshit3154/SortingAlgorithm | QuickSort.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int counter(vector<int> &nums,int s,int e){
int pivot=nums[s],count=0;
for(int i=s;i<=e;i++){
if(nums[i]<pivot)
count++;
}
int pivot_index=s+count;
swap(nums[s],nums[pivot_index]);
while(s<pivot_index && e>pivot_index){
whi... | ALGO | 0.999969 | 5.476753 |
864f18ca-df29-4003-ace5-d2fc31c543be | GuacheSuede/MSSubmission1234567890 | submission/ema/boost_1_69_0/libs/geometry/example/c05_custom_point_pointer_example.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
#include <iostream>
#include <boost/foreach.hpp>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/length.hpp>
#include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/... | TOOL | 0.997359 | 4.589649 |
1d4be754-0843-4468-b6ef-061d356c5ad8 | gitlarky/PoreDy | include/Eigen/failtest/bdcsvd_int.cpp | #include "../Eigen/SVD"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
BDCSVD<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| TEST | 0.852039 | 3.23104 |
0ed228e8-2ab3-4a7b-948f-61fcda7420f4 | MahediKamal/Template | MCM.cpp | // possible parenthesize = 2nCn / (n+1)
#include <bits/stdc++.h>
using namespace std;
#define inf 1<<30
int DP[1001][1001];
int P[1001][1001];
vector< pair<int,int> >matrix;
int n;
int cost(int s,int e){
cout<<s+1<<" "<<e+1<<endl;
int res=inf;
for(int i=s;i<e;i++){
int r=DP[s][i]+DP[i+1][e]+matri... | ALGO | 0.999616 | 3.815065 |
6d1bb084-83a2-4312-83a7-c3bf9c371b1c | swastikpratik-bit/Codeforces_practice | July2k24/08/B_Restore_the_Permutation_by_Merger.cpp | // Problem Link ->
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define set_bits __builtin_popcountll
#define leadingzero __builtin_clzll
#define trailingzero __builtin_ctzll
#define bitsParity __builtin... | ALGO | 0.999965 | 4.301085 |
5a1620c9-48c2-4d06-84c9-e82a0288b1e4 | nkirov/nkirov.github.com | 2014/NETB101/sources/ch8/sqrtest3.cpp | #include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
using namespace std;
/**
Sets the seed of the random number generator.
*/
void rand_seed()
{ int seed = static_cast<int>(time(0));
srand(seed);
}
/**
Compute a random floating point number in a range
@param a the bottom of the rang... | ALGO | 0.997631 | 5.267598 |
a0775fb0-0e71-49e3-aaef-10d79d5f8d30 | Exadios/boost | libs/geometry/test/algorithms/distance_pointlike_areal.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
#include <iostream>
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_pointlike_areal
#endif
#include <boost/test/included/unit_test.hpp>
#include "test_dista... | TEST | 0.85268 | 7.609731 |
932537e5-bc19-4896-88b5-1a2eb306256b | Taufique-07/Cpp | Stack.Linked list.cpp | #include<iostream>
using namespace std;
class stack
{
public:
int data;
stack *next;
stack *top;
stack()
{
top=nullptr;
}
stack(int value)
{
data=value;
next=nullptr;
}
void push(int value)
{
stack* newnode = new stack(value);
ne... | ALGO | 0.998632 | 3.888361 |
98d80942-919f-4c11-87a6-a42eb26089fe | artnharsh/DSA-LeetCode-Que-s | DSA extra que's/Decimal_to_Binary.cpp | #include<iostream>
using namespace std;
int main(){
int n,i = 1;
cin >> n;
int bit;
int ans = 0;
while(n > 0){
bit = n & 1; //bitwise AND operation to get the last set bit in n. If it is 0 then no set bits are left else there is at least one set bit
ans = (bit * (1 * i)) + ans;
... | ALGO | 0.999973 | 4.690851 |
8b9d2dd6-8b63-43ed-99d0-80df912d3a96 | ishandutta2007/codeforces | user202729_/normal/1249/C2.cpp | #include<iostream>
#include<vector>
int main(){
std::ios::sync_with_stdio(0);std::cin.tie(0);
int ntest;std::cin>>ntest;
std::vector<char> digits;
while(ntest--){
int64_t n;std::cin>>n;
digits.clear();
for(auto x=n;x;){
digits.push_back(x%3);
x/=3;
}
digits.push_back(0);
for(auto i=digits.size();... | ALGO | 0.999868 | 4.149939 |
d6975dce-53e3-482b-84ed-18c0cd1cf16c | black-shadows/LeetCode-Topicwise-Solutions | C++/add-and-search-word-data-structure-design.cpp | // Time: O(min(n, h)), per operation
// Space: O(min(n, h))
class WordDictionary {
public:
struct TrieNode {
bool isString = false;
unordered_map<char, TrieNode *> leaves;
};
WordDictionary() {
root_ = new TrieNode();
root_->isString = true;
}
// Adds a word into ... | ALGO | 0.999784 | 7.034464 |
ed057428-0cd4-4d6a-a421-6629808696b3 | MariaChrysafis/CompetitiveProgramming | Codeforces/1506B.cpp | #include <iostream>
#include <fstream>
#include <iostream>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,a... | ALGO | 0.999748 | 3.702744 |
cf70757a-eeac-4af9-80b8-18946092b88e | smowton/llpe | llvm-3.2.src/lib/CodeGen/LatencyPriorityQueue.cpp | #define DEBUG_TYPE "scheduler"
#include "llvm/CodeGen/LatencyPriorityQueue.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
bool latency_sort::operator()(const SUnit *LHS, const SUnit *RHS) const {
// The isScheduleHigh flag allows nodes with wraparound dependencies that... | ALGO | 0.959701 | 7.358959 |
ec5fca08-ff9b-4043-8e25-cbc66eecaefc | bothemrun/CAP-Complete-Algorithmic-Programming | Leetcode_All_Solved/2971.cpp | //O(n)
#include<algorithm>
#include<iostream>
static auto _ = [](){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return nullptr;
}();
class Solution {
public:
long long largestPerimeter(vector<int>& nums) {
int n = nums.size();
sort(nums.begin(), nums.end());
... | ALGO | 0.999635 | 4.609669 |
fa542192-aaf0-443d-9ca8-71ffc0817358 | ngochahh2005/PTIT-code | CodePTIT-DSA/BinaryTrees/DSA11029 - ĐƯỜNG ĐI TỚI NODE LÁ.cpp | #include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define lmt 1000000
using namespace std;
vector<set<int>> adj;
int n, m;
vector<bool> dd;
map<int, vector<int>> rs;
void bfs() {
queue<int> qu;
qu.push(1);
dd[1] = true;
rs[1] = {1};
while (qu.size()) {
int u = qu.front(... | ALGO | 0.999968 | 5.495365 |
6fa5f827-bf14-4c6b-96f9-c466bf115610 | raincross7/code-similarity | codes/train_code/problem026/problem026_480.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
if (A < B) {
if (A == 1) {
cout << "Alice" << endl;
return 0;
}
cout << "Bob" << endl;
} else if (A > B) {
if (B == 1) {
cout << "Bob" << endl;
return 0;
}
cout << "Alice" <... | ALGO | 0.999986 | 4.027193 |
1e9ca461-9562-406f-8296-4f022d3dea99 | ishandutta2007/codeforces | estinka/normal/1685/C.cpp | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
typedef long long ll;
typedef long double ld;
using namespace std;
vector<int> pf;
int sum(int l, int r)
{
return pf[r + 1] - pf[l];
}
vector<pair<int, int> > solve()
{
... | ALGO | 0.999371 | 3.565373 |
a328e797-90b7-4025-8cad-073d008ca33d | longJ91/Algorithm | Codeground/5월 멤버십 문제/쿼터 문자판 최단 거리.cpp | /*
You should use the statndard input/output
in order to receive a score properly.
Do not use file input and output
Please be very careful.
*/
#include <iostream>
#include <string>
using namespace std;
string Answer;
string Set[3][7] = { {"Q","W","E","R","T","Y","U"},{ "A","S","D","F","G","H","J" },{ "Z","X","C",... | ALGO | 0.999522 | 3.53002 |
7d1d3937-4010-468a-af7f-f0bec782513b | Elliotshui/leetcode_solution | 278.first-bad-version.cpp | /*
* @lc app=leetcode id=278 lang=cpp
*
* [278] First Bad Version
*/
// @lc code=start
// The API isBadVersion is defined for you.
// bool isBadVersion(int version);
class Solution {
public:
int firstBadVersion(int n) {
long l = 0, r = n;
while(l < r) {
long m = (l + r) / 2;
bool bad = isBadVersion(... | ALGO | 0.999524 | 6.99928 |
0475939e-9bc1-4961-ad72-5a718ceec67f | ishandutta2007/codeforces | bench0310/normal/1312/D.cpp | #include <bits/stdc++.h>
using namespace std;
const long long mod=998244353;
long long fpow(long long b,long long e)
{
long long res=1;
while(e)
{
if(e&1) res=(res*b)%mod;
b=(b*b)%mod;
e/=2;
}
return res;
}
int main()
{
long long n,m;
scanf("%I64d%I64d",&n,&m);
... | ALGO | 0.999996 | 4.765937 |
e23cbe3f-9426-4a59-add6-82d9559082ba | equadras/CompetitiveProgramming | codeforces/thinkcell1/a.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "debug.h"
#else
#define debug(...)
#endif
#define endl "\n"
typedef long long ll;
void solve(){
int n; cin >> n;
vector<int> a(2*n);
for (int &i : a) cin >> i;
sort(a.rbegin(),a.rend());
int res = 0;
for (int i = 0; i... | ALGO | 0.999507 | 4.446782 |
76e83ff3-3114-4705-b3b6-a4792b3e26b7 | karan123Sharma/C-_Practice | Binary_Search2.Cpp | #include<iostream>
using namespace std;
int Binary_search(int arr[],int size,int ele){
int start = 0;
int end = size-1;
while(start<=end){
int mid = start + ((end -start) /2);
if(ele==mid){
return mid;
}
else if(ele < mid){
start = mid+1;
}
... | ALGO | 0.99991 | 4.985338 |
5982a00f-1ca8-478d-8fad-f09a4acc47b7 | LegendaryArk/CompProg | DMOJ/dpl.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 3000 + 5;
int N;
vector<ll> a;
ll memo[MM][MM];
ll dp(int l, int r) {
if (l == r) return a[l];
if (memo[l][r] != -1) return memo[l][r];
return memo[l][r] = max(-dp(l + 1, r) + a[l], -dp(l, r - 1) + a[r]);
}
int main() {
ios_base:... | ALGO | 0.999914 | 4.336499 |
f2bd9050-ee63-470c-9822-95979b0bef3d | priyanshukoshta5/MOB100-Leetcode-GFG | 1921-eliminate-maximum-number-of-monsters/1921-eliminate-maximum-number-of-monsters.cpp | class Solution {
public:
int eliminateMaximum(vector<int>& dist, vector<int>& speed) {
int n = dist.size();
vector<double> arrivals;
for(int i = 0; i < n; i++)
arrivals.push_back(dist[i] / (1.0 * speed[i]));
sort(arrivals.begin(), arrivals.end());
int we... | ALGO | 0.999973 | 5.97652 |
cfebc240-ce3d-4771-a410-1035705d12ba | trandoduy28072004/MyCode | BackTracking/MaDiTuan.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int X[9] = {0, -1, -2, -2, -1, 1, 2, 2, 1};
int Y[9] = {0, -2, -1, 1, 2, 2, 1, -1, -2};
int n;
int Free[100][100];
void INIT() {
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
Free[i][j] = 0;
}
}
}
void sho... | ALGO | 0.999329 | 3.257155 |
3f13334d-0815-46a5-af11-c0b100e9ebf2 | Trindad/circuito-industrial | src/main.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <random>
#include <stdio.h>
#include <climits>
#include <chrono>
#include <ctime>
#include "main.h"
#define BUFFER 9000
#define LIMIT 11 //número máximo de ligações que um nó pode ter
#define PON... | ALGO | 0.996732 | 3.428185 |
4900c715-653b-4670-8c26-345a75758fd8 | bixl007/DSA-CPP | 221_pascalsTriangleI.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<vector<int>> generate(int numRows)
{
vector<vector<int>> res;
for (int i = 0; i < numRows; i++)
{
vector<int> rows(i + 1, 1);
for (int j = 1; j < i; j++)
{
... | ALGO | 0.999949 | 4.980345 |
e31ff530-316e-4a27-acf8-71669082f070 | TusharCSE35/Online-Programming | Codeforces/E_Lagest_sum_consecutive.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
vector< tuple<int, int, int> > myVec;
int n,i,a,b,c;
cin >> n;
for(i=0; i<n; i++)
{
cin >> a>>b>>c;
myVec.push_back(make_tuple(c, b, a));
}
sort(myVec.begin(), myVec.end());
for (auto i : myVec){
... | ALGO | 0.999906 | 4.169928 |
8d45d82d-048a-4b67-ba0a-85a6f885f382 | rishabh27goel/DSA-Extra-Questions | Leetcode/Insert_Greatest_Common_Divisors_in_Linked_List.cpp | #include <iostream>
#include <vector>
using namespace std;
// 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 {
p... | ALGO | 0.999943 | 5.405796 |
537fd402-63cb-4699-ad3c-c55f3cae5d25 | nibtehaz/Codechef | CK87QUER.cpp | /* بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ */
/* رَّبِّ زِدْنِى عِلْمًا */
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <iostream>
#include <string>
#include <map>
#include <list>
#include <stack>
#include ... | ALGO | 0.999545 | 3.367831 |
4d85ff5d-a0b9-4583-8146-46ac5e793ced | ishandutta2007/codeforces | staniewzki/normal/1132/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define REP(i, a) FOR(i, 0, a - 1)
#define ST first
#define ND second
#define V vector
#define RS resize
#define EB emplace_back
#define ALL(a) a.begin(), a.end()
#define S(a) (int)a.size()
template<class T> void db(T a) { ce... | ALGO | 0.999821 | 3.62278 |
642dc92a-461e-43a0-a1f9-364f6eddd641 | AnatolyKorablyov/OOP | lab02/task01/task01/main.cpp | // task1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "VectorProcessor.h"
using namespace std;
int main()
{
vector<double> numbers(istream_iterator<double>(cin), (istream_iterator<double>()));
ProcessVector(numbers);
copy(numbers.begin(), numbers.end(), ostream_iterat... | TOOL | 0.956736 | 3.667559 |
74e1cbe6-696f-4e51-b6e2-85a88843f76a | panyan7/CP | Codeforces/Div3/490/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define pll pair<long long,long long>
int tt = 1, n, m, k;
vector<vector<int>> adj, adj_rev;
vector<bool> vis;
vector<int> order, components;
vector<vector<int>> res;
void dfs1(int v) {
vis[v] = true;
for (int u : adj... | ALGO | 0.999937 | 4.420155 |
ce36fa50-d7f2-4a92-85b3-52dcbc13905b | tongm/mpu6500 | Middlewares/eigen3/unsupported/doc/examples/MatrixPower.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
Matrix3d A;
A << cos(1), -sin(1), 0,
sin(1), cos(1), 0,
0 , 0 , 1;
std::cout << "The matrix A is:\n" << A << "\n\n"
"The matrix power A^(pi/4) is:\n"... | ALGO | 0.999746 | 3.790203 |
5bf18c66-7c5f-4214-918b-fd64d3fed062 | blue-monkey0/C | C_Algorithm/chapter01/Q4.cpp | #include <stdio.h>
int med3(int a, int b, int c)
{
if (a >= b) // a>=b>=c
if (b >= c)
return b;
else if (a <= c) // c>=a>=b
return a;
else
return c; // a>=c>=b
else if (a > c) // b>a>c
return a;
else if (b > c) // b>c>a
return c;
else
return b; // c>b>a
}
int main(void)
{
printf("med3 (... | ALGO | 0.999959 | 4.490123 |
303c0c60-26b0-49be-8b26-cb37b471cbc3 | enzoyoshio/maratona | atcoder/kenkoooo/ABC115D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int sz[55];
int patties[55];
int ans(int n, int x) {
if(x <= 0) return 0;
if(n == 0) {
return 1;
}
int res = 0;
// se eu tenho q comer mais ou igual q a metade do sanduiche
// eu subtraio a qt de comida de da metade que vai ser s... | ALGO | 0.99992 | 4.436637 |
5d91c433-fc31-49a1-92cb-72e4084e1a6d | liziwei233/WaveformAnalysis | Src/Detector.cpp | #include "Detector.h"
Detector::Detector()
{
}
Detector::~Detector()
{
}
void Detector::SetWaveY(std::vector<float> wave)
{
waveform_y = wave;
}
void Detector::SetWaveX(std::vector<float> wave)
{
waveform_x = wave;
}
void Detector::SetMCP()
{
type = -1;
}
void Detector::SetTR()
{
type = 0;
}
void ... | TOOL | 0.864353 | 4.477892 |
0172e058-864f-4fb7-9299-7581c36b9cbd | huangallen2008/cppcode | code/luogu/P10814/P10814.cpp | #include<bits/stdc++.h>
using namespace std;
// #pragma GCC optimize("O3,unroll-loops,fast-math")
// #pragma GCC target("avx2,sse4,bmi,popcnt")
#define int long long
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define RREP1(i,n) for(int i... | ALGO | 0.999973 | 4.41918 |
ace4b871-936c-4d79-947f-b647f4aad0a5 | AV2409/DSA_NEW | 20-valid-parentheses/valid-parentheses.cpp | class Solution {
public:
bool isValid(string s) {
int n=s.size();
int valid=true;
stack<int>st;
for(int i=0;i<n;i++){
if(s[i]=='('||s[i]=='{'||s[i]=='['){
st.push(s[i]);
}
else{
if(st.empty()) return false;
... | ALGO | 0.999604 | 6.262345 |
7ef1863d-2f20-402a-b566-e0a427714134 | Mritunjay1729/Codeforces | Chewbacca_and_Number.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
string str;
cin >> str;
if(str[0]-'0' > '9'-str[0] && str[0] != '9') str[0] = '0'+'9'-str[0];
for(int i=1; i < str.length(); i++) {
if(str[i]-'0' > '9'-str[i]) str[i] = '0'+'9'-str[i];
}
cout << str << endl;
re... | ALGO | 0.999694 | 4.837935 |
948c8680-16b1-42ea-82fd-c50d7a66afd3 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_8132_0.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t) {
t--;
long long a, b;
cin >> a >> b;
cout << (a - 1) * 9 + b << "\n";
}
return 0;
}
| ALGO | 0.999441 | 4.448809 |
6225cf50-6b98-44a6-9656-df690450765d | yuika-sama/code-ptit-solutions | DSA - PTIT/KT1/TongGiaTriLonNhat.cpp | #include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2")
#pragma GCC target("avx,avx2,fma")
#define faster() {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define ll long long
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<long long>
#define mii map<int, int>
#define si s... | ALGO | 0.999688 | 3.835702 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.