uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0935de1a-5012-4446-9968-9abb6c3f8860 | mayankchaudhary26/DS_Algo | basics/functions__prototypes12.cpp | #include<iostream>
using namespace std;
// Function prototypes
int sum(int a, int b);
void g(void);
int main(){
int num1, num2;
cout<<"first value is "<<endl;
cin>>num1;
cout<<"second value is "<<endl;
cin>>num2;
cout<<"answer is "<<sum(num1, num2);
g();
return 0;
}
int sum(int a, ... | TOOL | 0.9978 | 3.845733 |
f9ff1118-1ef0-4990-92fe-0488ae7a2843 | Mingyuanz1111/test | test_folder/sums_of_four_values.cpp | #include <bits/stdc++.h>
#define pii pair<int,int>
#define f first
#define s second
#define INF (int)1e9
typedef long long ll;
using namespace std;
int main(){
int n;
pii tar;
cin >> tar.f >> tar.s >> n;
pii a[n];
for(int i=0; i<n; i++) cin >> a[i].f >> a[i].s;
sort(a,a+n);
for(int l=0; l<n;... | ALGO | 0.999821 | 3.494974 |
5aaf6473-b767-471f-b06d-6af96b659ba5 | ampl/coin | Couenne/Couenne/src/bound_tightening/BTPerfIndicator.cpp | #include "CouenneTypes.hpp"
#include "CouennePrecisions.hpp"
#include "CouenneProblem.hpp"
#include "math.h"
#include "CouenneBTPerfIndicator.hpp"
using namespace Couenne;
///
void CouenneBTPerfIndicator::update (const CouNumber *lb, const CouNumber *ub, int depth) const {
assert (oldLB_ != NULL &&
oldUB_ != ... | ALGO | 0.999188 | 5.08119 |
2157ff78-8bb7-47c4-afa9-0672c20f2ce2 | yigityalin/leetcode-problems | solutions/109 - ConvertSortedListToBinarySearchTree.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) {}
* };
*/
/**
* Definition for a binary tree node.
* struc... | ALGO | 0.999995 | 6.490008 |
f85fc97c-abb8-4b2d-bf9d-03236a91be60 | hoarffrost/loving-DSA | Linked List 2/All Programs/even_after_odd.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
};
Node *takeinput()
{
int data;
cin >> data;
Node *head = NULL, *tail = NULL;
while (data != -1)
{
Node *newnode = new Node(data);
if (head == NULL)
{
he... | ALGO | 0.998201 | 5.110722 |
ee220744-89ac-4754-9d55-d251533a433c | uquendo/calc | apps/quest06/newton.cpp | #include "newton.hpp"
#include "calcapp/math/dense_linear_solver_func.hpp"
#include "numeric/newton_solver.hpp"
#include <cmath>
#include <algorithm>
namespace Calc
{
namespace newton
{
//
struct rosenbrock_gradient : numeric::MPFuncBase<rosenbrock_gradient,AlgoParameters,bool>
{
template<typena... | ALGO | 0.997604 | 6.105222 |
ae9c11df-a5d3-4e45-8ed1-dbd09f618edf | KunalNasa/DSA | DynamicProgramming/MinCostTicketsDP.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int solve(int n, vector<int> &days, vector<int> &cost, int index)
{
if(index >= n)
{
return 0;
}
// case 1
int opt1 = cost[0] + solve(n, days, cost, index + 1);
// case 7 & 30
int i;
for(i = index; i < n && days[i... | ALGO | 0.999557 | 4.152803 |
29499ac3-0a92-4dcc-8408-2404cd4f5b77 | SantiagoNinoX/Competitive_Programming | way_too_long_words.cpp | #include <iostream>
using namespace std;
int main(){
int n;
string word;
cout << "Give me the number of words: " << endl;
cin >> n;
if(1 <= n && n <= 100){
while(n--){
cin >> word;
if (word.length() > 10){
cout << word[0] << word.length()-2 << word[wor... | ALGO | 0.997327 | 3.657266 |
89106a1e-5f01-47c9-a908-da4ed49c8f2e | guipingxie1/book_problems | book_chap6.5/UVA11151.cpp | #include <bits/stdc++.h>
using namespace std;
int dp[1005][1005];
string s;
int t;
int lcp(int b, int e) {
if (b > e)
return 0;
if (b == e)
return 1;
if (dp[b][e] != -1)
return dp[b][e];
if (s[b] == s[e])
return dp[b][e] = 2 + lcp(b + 1, e - 1);
... | ALGO | 0.99985 | 5.081123 |
32cef373-ad30-4bef-995e-7eecf0c8c6b9 | ZJU-DAILY/HNSW-Flash | third_party/eigen/doc/special_examples/Tutorial_sparse_example.cpp | #include <Eigen/Sparse>
#include <vector>
#include <iostream>
typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double
typedef Eigen::Triplet<double> T;
void buildProblem(std::vector<T>& coefficients, Eigen::VectorXd& b, int n);
void saveAsBitmap(const Eigen::VectorXd& x, in... | ALGO | 0.996065 | 5.585103 |
606cbc14-8115-4b8f-b717-aa9d47782130 | ishandutta2007/codeforces | ugly2333/normal/873/D.cpp | //CF 873D
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
const int N = 111111;
int n,k;
int ans[N];
void solve(int l,int r){// [l,r)
if(... | ALGO | 0.999966 | 3.229243 |
55c5a2d5-a7d0-4c84-bca1-67971e4729f7 | Hann28-s/Lesson10-C | Bai10.2.cpp | #include <stdio.h>
void sapXepBubble(int arr[], int n) {
for (int i = 0; i < n-1; i++) {
for (int j = 0; j < n-i-1; j++) {
if (arr[j] > arr[j+1]) {
int tam = arr[j];
arr[j] = arr[j+1];
arr[j+1] = tam;
}
}
}
}
int main() {
... | ALGO | 0.999851 | 4.48003 |
60426552-80d9-4daf-a34b-fff3e8030d22 | hummingg/LeetCode | 950.按递增顺序显示卡牌.cpp | /*
* @lc app=leetcode.cn id=950 lang=cpp
*
* [950] 按递增顺序显示卡牌
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// @lc code=start
class Solution {
public:
// 13 5;
vector<int> deckRevealedIncreasing(vector<int>& deck) {
// 递归分治,一半一半处理
sort(deck.begin(), deck.... | ALGO | 0.99997 | 6.14898 |
88c4e944-5542-4f08-89cd-39c57758bfeb | Roh1t-Sharma/Data-Structure-Algorithms | DSA/Knapsack.cpp | #include <iostream>
#include <algorithm>
using namespace std;
// Structure for an item
struct Item {
int value, weight;
};
// Comparison function to sort items by value-to-weight ratio
bool cmp(Item a, Item b) {
double r1 = (double)a.value / a.weight;
double r2 = (double)b.value / b.weight;
return r1 ... | ALGO | 0.999994 | 5.629787 |
a30fc72d-070c-46bb-a0c9-74ae4558b345 | stucci/.leetcode | 1048.longest-string-chain.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,x,n) for(int i=x;i<(int)n;++i)
#define vout(v) rep(i,0,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
/*
* @lc app=leetcode id=1048 lang=cpp
*
* [1048] Longest String Chain
*/
// @lc code=start
class Solution {
public:
int longestStrChain(vector<strin... | ALGO | 0.999994 | 5.875836 |
daca0c11-e0c2-4c58-9f05-7f306d959e93 | spad1e/competitive-programming | Olympiads/TOI/TOI17_wall/wall.cpp | #pragma once
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pl... | ALGO | 0.999347 | 4.655917 |
d56032d1-aedd-450f-8974-273e23bd3287 | komura-athushi/GC2021_SampleGame | k2EngineLow/ExEngine/bulletPhysics/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp | #if defined (_WIN32) || defined (__i386__)
#define BT_USE_SSE_IN_API
#endif
#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
#include "btConvexPolyhedron.h"
#include "LinearMath/btConvexHullComputer.h"
#include <new>
#include "LinearMath/btGeometryUtil.h"
#include "LinearMath/btGrahamScan2dConvexHu... | ALGO | 0.979896 | 7.034167 |
3326f461-836b-4592-8342-6451192d5cf2 | rahul-shoundic/Code | EXPIRY.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
float n,m,k;
cin>>t;
while(t--)
{
cin>>n>>m>>k;
if((n/m)<=k)
cout<<"Yes\n"<<endl;
else
cout<<"No\n";
}
return 0;
}
| ALGO | 0.999615 | 3.736426 |
64c9b896-c237-4fa3-8239-8283070bb172 | MyTamSW/MaTran_NMLT_ThayKhang | Bai055/Bai055.cpp | #include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <string>
using namespace std;
void Nhap(int[][500], int&, int&);
void Xuat(int[][500], int, int);
int DemChan(int[][500], int, int);
int main()
{
int b[500][500];
int k;
int l;
Nhap(b, k, l);
cout << "Ma tran... | ALGO | 0.997418 | 4.340507 |
91a313a8-acea-493a-810d-df5b3787e295 | esa-kian/algos | C-Plus-Plus-master/sorting/heap_sort.cpp | /**
* \file
* \brief [Heap Sort Algorithm
* (heap sort)](https://en.wikipedia.org/wiki/Heapsort) implementation
*
* \author [Ayaan Khan](http://github.com/ayaankhan98)
*
* \details
* Heap-sort is a comparison-based sorting algorithm.
* Heap-sort can be thought of as an improved selection sort:
* like selec... | ALGO | 0.999978 | 6.388883 |
cf3876f4-cf96-4e16-9d40-93c0f4725996 | zhangxiaohu057/SensorsCalibration | online_calib/radar2carcenter/eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Eigen::MatrixXf m(2,2);
m << 1, 2,
3, 4;
//get location of maximum
MatrixXf::Index maxRow, maxCol;
float max = m.maxCoeff(&maxRow, &maxCol);
//get location of minimum
MatrixXf::Index minRow, m... | ALGO | 0.999683 | 4.008351 |
2d6b1072-cf29-4738-98e7-1ffa31f3e75b | inexdroid/frameworks_av | media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "LVC_Mixer_Private.h"
#include "VectorArithmetic.h"
/**********************************************************************... | ALGO | 0.979422 | 5.958285 |
995c5360-c2b9-4f4f-b100-22427e1a9225 | praymeta/Code-Up-Algorithm | BOJ_22966_TheProblemOfFindingTheEasiestProblem.cpp | #include <iostream>
using namespace std;
int main(void) {
int n, difficulty, easiest = 5;
string problem, easiestProblem;
cin >> n;
for(int i = 0; i < n; i++) {
cin >> problem >> difficulty;
if(difficulty < easiest) {
easiestProblem = problem;
easiest = difficult... | ALGO | 0.999405 | 4.10665 |
81f731c7-a7c5-44f3-bc8b-dc817f8e3264 | keqhe/leetcode | round2/leetcode302.cpp |
class Solution {
public:
//first idea is DFS, see ref: https://leetcode.com/discuss/68233/java-dfs-solution-and-seeking-for-a-binary-search-solution
//because the black pixels are connected, so this is why DFS is possible
//DFS time complexity is O(m*n), i.e., the board size
int minX = numeric_limits<i... | ALGO | 0.998925 | 6.749396 |
603d2ce1-17d3-4ad4-9424-3cfcd73fb381 | Nu-NSDI23/Nu | bench/bench_real_mem_pressure.cpp | #include <runtime.h>
#include <signal.h>
#include <sync.h>
#include <sys/mman.h>
#include <sys/sysinfo.h>
#include <thread.h>
#include <timer.h>
#include <unistd.h>
#include <algorithm>
#include <atomic>
#include <cstdint>
#include <cstring>
#include <fstream>
#include <iostream>
#include <thread>
#include <vector>
#... | TOOL | 0.880118 | 5.532146 |
a1cd3ab2-442e-4cfa-81e7-f19118a17f5a | pbalakshin/Parallel | Book/listings/raceConditionalExample1.cpp | int a = 0;
#pragma omp parallel num_threads(2) shared(a)
{
if (omp_get_thread_num() == 0) //first thread
a = 2; //changes global variable value
else { //second thread
printf("%d",a); //print var value: 0 or 2?
}
} | ALGO | 0.977573 | 3.470913 |
89148729-1620-49c4-8b56-92670d46f2e8 | NUKEDO/practice_coding | aizu_online_judge/ALDS1_10_C.cpp | // https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_C&lang=ja
// 螺旋本を参考に作成
// 二重配列なのでC++14で提出
#include <bits/stdc++.h>
using namespace std;
void LCS(string A, string B) {
int A_size = A.size(), B_size = B.size();
vector<vector<int>> c(A_size + 1, vector<int>(B_size + 1, 0));
A = ' ' + A;
B =... | ALGO | 0.999902 | 4.928812 |
493654b5-30a1-4b43-b6f6-e2d82073ce7e | Fedbxy/competitive-programming | programming.in.th/0009.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
vector<int> a(3);
for(int i=0;i<3;i++) cin>>a[i];
sort(a.begin(), a.end());
string s;cin>>s;
for(int i=0;i<3;i++) cout<<a[s[i]-'A']<<(i==2 ? "\n" : " ");
return 0;
} | ALGO | 0.99986 | 3.574853 |
473e4460-1b7e-43e1-b8ee-c3e56bc49b60 | ishandutta2007/codeforces | dragonslayerintraining/normal/919/E.cpp | #include <iostream>
#include <stdint.h>
int64_t inv[1000003];
int main(){
int64_t A,B,P,X;
std::cin>>A>>B>>P>>X;
inv[1]=1;
for(int64_t i=2;i<P;i++){
inv[i]=(P-P/i)*inv[P%i]%P;
}
int64_t a_n=1;
int64_t cnt=0;
for(int64_t i=0;i<P-1;i++,a_n=a_n*A%P){
cnt+=(X-((i+P-B*inv[a_n]%P)%P*(P-1)+i)+P*(P-1)... | ALGO | 0.999881 | 3.802346 |
1efc1849-37f5-4ce8-804a-ee917208c43d | vrangr1/competitive-programming | contests/codeforces/cf_rounds/cf_round_8--/codeforces_893_div2/b.cpp | #if 0
me=`basename $0 .cpp`
rm -f $me $me.out
only_compile=${1:-0}
if [ $only_compile == compile ]; then
g++ -std=c++20 $me.cpp -o $me -Wall -O2 -Wextra -Wno-sign-conversion -Wshadow
exit
fi
g++ -std=c++20 -DLOCAL $me.cpp -o $me -Wall -O2 -Wextra -Wno-sign-conversion -Wshadow
... | ALGO | 0.999975 | 4.704736 |
5a095037-3881-4af4-a28a-1140c0a4e8a5 | EngrMatin/Data_Structures | Tree/Exam 08 Assignment 02/Symmetric tree2.cpp | // C++ program to check if a given Binary Tree is symmetric or not
#include<bits/stdc++.h>
using namespace std;
struct Node
{
int key;
struct Node* left, *right;
};
Node *newNode(int key)
{
Node *temp = new Node;
temp->key = key;
temp->left = temp->right = NULL;
return (temp);
}
bool isSymmet... | ALGO | 0.999986 | 6.624925 |
76836253-69f5-4485-ad2d-96596d18dd49 | kevin9foong/cp | codechef/mathforcp/chefprms.cpp | #include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
vector<int64_t> sieve(int64_t n) {
bool isPrime[n + 1];
vector<int64_t> result;
if (n < 2) {
return result;
}
for (int64_t i = 0; i < n + 1; i++) {
isPrime[i] = true;
}
isPrime[0] =... | ALGO | 0.999791 | 5.647217 |
45bb441c-920c-4850-806e-ac0849811737 | Thinklab-SJTU/ML4CO-Kit | ml4co_kit/algorithm/mis/c_arw/kamis-source/lib/mis/ils/local_search.cpp | /**
* local_search.cpp
* Purpose: Apply the local search algorithm to a maximum independent set.
*
* The original code from Andrade et. al. was kindly provided by Renato Werneck.
*
*****************************************************************************/
#include "ils/local_search.h"
#include <algorithm>
... | ALGO | 0.999999 | 6.525851 |
cbdec6ad-ef71-4b62-bd6f-ba512d12df15 | ajay2312/Interview-Preparation | 2145-count-the-hidden-sequences/2145-count-the-hidden-sequences.cpp | class Solution {
public:
long long numberOfArrays(vector<int>& arr, long long low, long long high) {
long long n=arr.size(),mx,mn;
vector<long long> ans(n+1);
ans[0]=arr[0];
mn=mx=arr[0];
for(long long i=0;i<n;i++){
ans[i+1]=ans[i]+arr[i];
mn=min(ans[i... | ALGO | 0.999883 | 5.736986 |
3cd7bba6-90f2-4830-9815-3a1c353901d1 | YanLi26/leetcode-summer | BFS/542. 01 Matrix/542. 01 Matrix.cpp | class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& matrix) {
queue<pair<int, int>> zero;
for(int i = 0; i < matrix.size(); ++i) {
for(int j = 0; j < matrix[i].size(); ++j) {
// know how to insert pair into a container
if(matrix... | ALGO | 0.999943 | 6.394925 |
637405d5-e880-4e9c-a178-347e5cda2a02 | RamPrateek24/Leetcode | 2649-count-total-number-of-colored-cells/count-total-number-of-colored-cells.cpp | class Solution {
public:
long long coloredCells(int n) {
long long sum = 1;
if(n==1) return 1;
for(long long i=1; i<n; i++){
sum+= (i*4);
}
return sum;
}
}; | ALGO | 0.999972 | 5.099126 |
44bbaba0-a634-4e9b-b34d-3a65091c97cf | Deepti675/Leet_Code | daily_challenge/Minimum Time to Make Rope Colorful.cpp | https://leetcode.com/problems/minimum-time-to-make-rope-colorful/
class Solution {
public:
int minCost(string colors, vector<int>& neededTime) {
int res=0;
for(int i=0;i<colors.size();i)
{
int j=i;
int max_ind=i;
int mx=neededTime[i];
while(j<c... | ALGO | 0.999799 | 6.227664 |
2af65a32-3b04-4e91-8702-777f0b4ef5ac | aksharanigam1112/Practice | string/compress.cpp | // Compress string with continuous count if possible ( aabbbcdeeaaa => a2b3c1d1e2a3 )
#include<iostream>
#include<string>
using namespace std;
string compress(string str)
{
str.append(" ");
string comp="";
char prev = str[0];
int count = 1;
for(int i=1;i<str.length();i++)
{
if(str[... | ALGO | 0.999978 | 4.910845 |
f5c04833-fc88-46e8-978d-b2a85f966cb6 | Praveenraj49/Udacity | CarND-MPC-Project/src/Eigen-3.3/lapack/svd.cpp | #include "lapack_common.h"
#include <Eigen/SVD>
// computes the singular values/vectors a general M-by-N matrix A using divide-and-conquer
EIGEN_LAPACK_FUNC(gesdd,(char *jobz, int *m, int* n, Scalar* a, int *lda, RealScalar *s, Scalar *u, int *ldu, Scalar *vt, int *ldvt, Scalar* /*work*/, int* lwork,
... | ALGO | 0.999006 | 5.526819 |
746a123c-e276-49fc-97b6-a1a039cb3ee4 | ravikumarmakwana/C-and-CPP-Programs | templatefunction.cpp | #include<iostream>
using namespace std;
template <class T>
class Sort
{
T a[10];
public:
void getdata()
{
for(int i=0;i<10;i++)
cin>>a[i];
}
void putdata()
{
cout<<"Sorted Numbers:\n";
for(int i=0;i<10;i++)
cout<<a[i]<<endl;
}
void sortdata... | ALGO | 0.999422 | 3.835228 |
db86816b-df77-4130-ab0e-5e751fb5696b | sungrae98/Cpp-Programming | 202014181_C++/Assignment10/Assignment10/Assignment10.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
template<typename T>
vector<T>& operator+=(vector<T>& container, const T& data) {
container.push_back(data);
return container;
}
template<typename T>
vector<T>& operator-=(vector<T>& container, T& data) {
data = container.back();... | TOOL | 0.987925 | 3.846941 |
89864417-152b-47f0-9d32-8762bfda9249 | denis-gubar/Leetcode | Greedy/0410. Split Array Largest Sum.cpp | class Solution {
public:
int calc(vector<int> const& nums, int m, int N)
{
if (F[m][N] < 0)
{
int result = numeric_limits<int>::max();
if (m == 1)
result = accumulate(nums.begin(), nums.begin() + N, 0);
else
{
int sum = 0;
for (int k = 1; N - k >= m - 1; ++k)
{
sum += nums[N - k];... | ALGO | 0.999964 | 5.844517 |
1e45ea3e-fc32-4807-88a8-fd5b9f67cc00 | Bit-Net/VpnCoin | src/rpcdump.cpp | #include <iostream>
#include <fstream>
#include "init.h" // for pwalletMain
#include "bitcoinrpc.h"
#include "ui_interface.h"
#include "base58.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/variant/get.hpp>
#include <boost/algorithm/string.hpp>
#define printf OutputDebugStringF
using namesp... | TOOL | 0.939804 | 6.026768 |
cbe25b07-ba71-4463-b1eb-4dd8fe09ade9 | Sohardbegraj/leetcodesyned | 3683-find-the-lexicographically-largest-string-from-the-box-i/find-the-lexicographically-largest-string-from-the-box-i.cpp | class Solution {
public:
string answerString(string word, int numFriends) {
string ans="";
int n=word.length();
if(numFriends==1){
return word;
}
int len=n-(numFriends-1);
for(int i=0;i<n;i++){
int possible=min(len,n-i);
ans=max(an... | ALGO | 0.999989 | 5.821085 |
fb1618bf-a4d8-4297-ba1b-f2c81b73e8d8 | gpdev-Pilcothink/GPCPP-Coding_TEST | 프로그래머스/0/120851. 숨어있는 숫자의 덧셈 (1)/숨어있는 숫자의 덧셈 (1).cpp | #include <string>
#include <vector>
using namespace std;
int solution(string my_string) {
int answer = 0;
for(int i=0; i<my_string.size(); i++)
{
if(my_string[i]>='0' && my_string[i]<='9')
answer+= my_string[i] - '0';
}
return answer;
} | ALGO | 0.99685 | 4.97927 |
8be7aff7-40f0-438e-b0f7-6836b6cc10aa | RayLee234/Competitive-Programming-Stuff | Graph Theory/Telephone Lines/main.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <cstdio>
#include <queue>
using namespace std;
int n, p, k, u[10010], v[10010], len[10010], f[10010], ans = 1e6+1;
vector < pair<int,int> > g[1001];
int main() {
scanf("%d %d %d", &n, &p, &k);
for(int i=1;i<=p;++i) scanf("%d %d %d", &u[i], &v[i],... | ALGO | 0.999923 | 3.515449 |
94c38061-f4b1-4d5b-bad3-23333ba72d46 | DinaAdib/OS-Scheduler | scheduler.cpp | #include "headers.h"
/*----------Global variables-----------*/
priority_queue <struct processData> readyQ;
queue <struct processData> roundRobinQ;
vector <struct processBlock> processTable;
struct processData topProcess, runningProcess;
struct msqid_ds buf;
key_t schedulerRcvQid;
string remainingTimeStr;
int choice= 0... | ALGO | 0.999898 | 3.049407 |
ba1ae4a1-428d-4d67-b8f3-708683d7d015 | K2000ran/tcs_past-prepartion-code | remo.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
string st;
getline(cin,s);
for(int i=0;i<s.length();i++){
char ch=tolower(s[i]);
if(ch=='a'|| ch=='e'|| ch=='i'|| ch=='o'|| ch=='u'){
continue;
}
else{
st+=ch;
... | ALGO | 0.987935 | 3.441931 |
849ee60e-d625-4165-8d54-077432bae39c | gbhb/Cplusplus | A10/A10-107502558.cpp |
/*****************************************
* Assignment 10
* Name: fɿ
* Student Number: 107502558
* Course: 2018-CE1001
******************************************/
#include <iostream>
using namespace std;
class matrix{
public:
int m[3][3];
matrix();
void inputmatrix(int,int,int);
void printall();
... | ALGO | 0.969128 | 3.772032 |
4dfeef55-6bcd-4419-9cee-056174145184 | raincross7/code-similarity | codes/train_code/problem233/problem233_168.cpp | #include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
int main(){
int N,K;
cin >> N >> K;
vector<int> a(N);
for(auto &ai:a)... | ALGO | 0.999956 | 3.697036 |
1332c150-85fb-4159-9e13-280a8363f9b8 | tarekalmowafy/Compatetive_Programming | uva/11541_decoding.cpp | #include <cstdio>
#include <iostream>
#include <string>
#define is_alpha(x) (x <= 'Z' && x >= 'A')
using namespace std;
int count_alpha(string s) {
int k = 0;
for (int i = 0; i < s.length(); i++) {
if (is_alpha(s[i])) {
k++;
}
}
return k;
}
int main(void) {
int T;
scanf("%d", &T);
getchar();... | ALGO | 0.988293 | 3.66475 |
0ad1d72f-fcbb-4cdc-b062-6c2e01da5ad1 | Krythz43/CP-Archieve | codeforces/1185f.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<int> a(n);
f1
or(int i=0;i<n;i++){
}
}
}
| ALGO | 0.992687 | 4.091026 |
adb5ce25-4afb-4070-95dd-3c74fb186d72 | jjthrash/OpenCV-2.2.0-iphone | modules/imgproc/src/rotcalipers.cpp | #include "precomp.hpp"
typedef struct
{
int bottom;
int left;
float height;
float width;
float base_a;
float base_b;
}
icvMinAreaState;
#define CV_CALIPERS_MAXHEIGHT 0
#define CV_CALIPERS_MINAREARECT 1
#define CV_CALIPERS_MAXDIST 2
/*F///////////////////////////////////////////... | ALGO | 0.999677 | 4.946341 |
240dcbdd-19b6-46a4-99af-b6ad6081973d | broskoy/Tetris | ai.cpp | #include <math.h>
#include "common.h"
#include "mechanics.h"
int evaluate_board (Board b)
{
int y=0, ymin=20, ymax=0, hole=0, delta=0, yy=0, depth=0;
for (int i=0; i<10; i++)
{
for (int j=0; j<20 && b[j][i]==0; j++)
y = j;
for (int j=y; j<20; j++) {
if (b[j][i]==0) ... | ALGO | 0.999134 | 5.225214 |
3da79584-2a2d-4ddf-a494-6dc2c9ccf5a4 | LorienLV/_PAPER-JP23_RISC-V_for_Genome_Data_Analysis_Opportunities_and_Challenges | benchmarks/chain/src/main.cpp | #include <cstdio>
#include <vector>
#include <time.h>
#include <sys/time.h>
#include <getopt.h>
#include <string>
#include <iostream>
#include <fcntl.h>
#include <unistd.h>
#include <cstring>
#include "omp.h"
#include "host_data_io.h"
#include "host_data.h"
#include "host_kernel.h"
#define PRINT_OUTPUT 1
#if RAPL_ST... | TOOL | 0.994532 | 3.667908 |
e0053234-5f8d-40ee-915e-ae2f3bcd447a | JackDrogon/Study | ProgrammingLanguage/Script/AHK/Source/AutoHotkey_L/source/mt19937ar-cok.cpp | #include "stdafx.h" // Pre-compiled headers
//#include <time.h> // Don't rely on any of these functions due to their code size.
#include "mt19937ar-cok.h"
// Period parameters
#define N 624
#define M 397
#define MATRIX_A 0x9908b0dfUL // constant vector a
#define UMASK 0x80000000UL // most significant w-r bi... | ALGO | 0.998791 | 5.383347 |
75d73161-dfe3-4a03-8a6d-8c451fe9bda8 | Mlenaa/fundamentos | suma.cpp | #include <iostream>
using namespace std;
int main() {
float x, y, z;
cout<< " Ingreso 2 numero xy: " ;
cin>>x>>y;
z=x+y;
cout<< " El resultado es: " ;
cout<<z<<endl;
return 0;
}
| ALGO | 0.952075 | 3.328463 |
931f7101-be22-4bb4-acce-a65f283790dd | MirazShahin/Competitive-Programming | Problem_Solving_in_Different_Online_Judge/Codeforces/C - Raspberries.cpp | #include <bits/stdc++.h>
#define FastIO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define vii vector<int>
#define vll vector<ll>
#define nn '\n'
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b) / gcd(a,b)
#define sp " "
#d... | ALGO | 0.999897 | 4.498497 |
c57f8a28-e152-4e4d-8cc7-41623f4bbcae | chakraphat/FRA262STUIII | eigen-3.4.0/doc/examples/TutorialLinAlgExComputeSolveError.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(100,100);
MatrixXd b = MatrixXd::Random(100,50);
MatrixXd x = A.fullPivLu().solve(b);
double relative_error = (A*x - b).norm() / b.norm(); // norm() is L2 norm
cout << "The ... | ALGO | 0.999662 | 3.625966 |
dc931860-2b9a-4777-a925-9b7430d5a50d | AEljaa/EIE1_Proeng | Term 2/11.1 Member Functions/Triangle Points OOP/main.cpp | #include <iostream>
#include <cmath>
struct Point{
double x;
double y;
std::string to_s() const{
return "(" + std::to_string(x) + ", " + std::to_string(y) + ")";
}
double distance(Point p) const {
return std::sqrt(std::pow((x - p.x), 2) + std::pow((y - p.y), 2));
}
};
struct Tri... | ALGO | 0.962387 | 4.381416 |
ce26a33b-7d54-48ee-b014-a82d3eb66fb9 | ayushsaha1018/CrackYourPlacement | ValidPalindrome2.cpp | // TC : O(n), SC : O(1)
class Solution {
public:
bool check(string &s, int st, int en){
while(st < en){
if(s[st] != s[en])
return false;
else{
st++;
en--;
}
}
return true;
}
bool validPalindrome(st... | ALGO | 0.999966 | 6.370697 |
72c8c93f-aadc-4493-ae92-b77fde41d22f | palilo815/ps | baekjoon/15000/15686.cpp | #include <bits/stdc++.h>
#define loop(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef pair<int, int> P;
const int max_N = 50;
int ans, N_house, N_bbq;
vector<P> house, BBQ;
vector<int> vt;
int chicken_dist()
{
int ret = 0;
for (P p : house) {
int dist = INT_MAX;
for (int i : vt)
... | ALGO | 0.999941 | 4.354387 |
5c2540cc-9748-438f-bb91-bd3505a47560 | coderex2522/leetcode | 394.cpp | #if 0
#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
string decodeString(string s)
{
stack<char> sc;
int i=s.size()-1;
string res;
int cntRight=0;
while(i>=0)
{
if(s[i]=='[')
{
cntRight--;
i--;
... | ALGO | 0.999809 | 3.997125 |
c278b0cd-a7fe-4c83-81c5-d4838c33bf00 | quick0831/0804117 | ch6/6-1-5.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
main(){
int a,b,op;
while(true){
cout<<"Ш̧ǿJ2ӼƦr(0 0 T{})G";
cin>>a>>b;
if(a==0 && b==0) break;
cout<<"пܹB覡(1)[k(2)k(3)k(4)kG";
cin>>op;
cout<<"BGG";
switch(op){
case 1:
cout<<a<<"+"<<b<<"="<<a+b<<endl<<endl;
bre... | ALGO | 0.992748 | 3.357786 |
3965252b-fbc8-4b2b-849a-4b6f579ec67e | yiqun-liu/Algo-Lab-ETHz | week2/burning_coins/burning_coins_recursive.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
const int MAX_N = 2500, UNDEFINIED = -1;
int v[MAX_N];
int gain[MAX_N][MAX_N];
// parameters: endpoints of closed interval
int opponent(int l, int r);
int player(int l, int r)
{
if (gain[l][r] != UNDEFINIED) // memoization
return gain[l][r];
i... | ALGO | 0.999904 | 4.317803 |
ef0540ac-b26c-432f-a7c9-88293990a1bf | xodn0802/codetree-TILs | 240212/아스키코드 변환/convert-to-ascii.cpp | #include <iostream>
using namespace std;
int main() {
char a;
int b;
cin >> a >> b;
cout << (int)a << " " << (char)b;
// 여기에 코드를 작성해주세요.
return 0;
} | TOOL | 0.96503 | 5.038713 |
e2ddcb7f-e191-48be-bcfc-0686f7496066 | fmjtoend/Student-Management-System | UseScore.cpp | #ifndef USESCORE_H
#define USESCORE_H
#endif // !USESCORE_H
#include "UseScore.h"
#include"Usefstream.h"
#include"vectors.h"
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
void UseScore::Input(vectors* v) {
int flag = 1;
while (flag == 1) {
int num;
cout << "Ҫ¼ݸ\n"... | TOOL | 0.850677 | 3.177747 |
5186457a-72b1-45e0-8fc5-5252e3cfca32 | ishandutta2007/codeforces | marckess/normal/633/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)
typedef long l... | ALGO | 0.999634 | 4.397105 |
6d4ae3bb-9e37-4db6-8ff9-d18c3a02d8f7 | VeerSinghLodhi/100-Days-Series | 100-Days-Series/Day 49/LinkedListDS.cpp | #include<iostream>
#include<stdlib.h>
using namespace std;
struct LinkedList{
int data;
struct LinkedList *next;
};
struct LinkedList *head=nullptr;
void addNode(){
LinkedList *ptr=new LinkedList;
if(ptr==nullptr){
cout<<"\nCouldn't allocated memory!";
}else{
cout<<"\nEnter data : ";... | ALGO | 0.999226 | 4.063145 |
fc7e0faa-d4d7-4439-a97b-e88a12b4d036 | Denwiliusz27/PRiR | cw_openMP/getThreadsOutsideParallel.cpp | #include<iostream>
#include<omp.h>
using namespace std;
int main( void ) {
cout << "Liczba wątków: " << omp_get_num_threads() << endl;
#pragma omp parallel
{
#pragma omp single
{
cout << "parallel" << endl;
cout << "Liczba wątków: " << omp_get_num_threads() << endl;
}
... | TOOL | 0.92783 | 4.088493 |
cb18b908-ebb2-4a58-9eaf-157c3343ac67 | jccarvalhosa/maratona | uva/asian/phuket/counting.cpp | #include <iostream>
using namespace std;
typedef long long ll;
const int M = 500005;
ll s0[M], s1[M], s2[M], s3[M];
int main() {
for(ll i=1;i<M;i++) {
s0[i] = s0[i-1];
s1[i] = s1[i-1];
s2[i] = s2[i-1];
s3[i] = s3[i-1];
if(i&1) {
s0[i] += 1;
s1[i] += i;
s2[i] += i*i;
s3[i] += i*i*i;
}
}
ll ... | ALGO | 0.99991 | 3.726569 |
3d6c8661-80a0-466f-a4ba-8e009111818a | wzx140/ProgramDesign-Algorithm | DataStructureFoundation/week7/q2.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::stack;
using std::queue;
// 2. 树的镜面映射
struct TreeNode {
char data;
TreeNode* leftMostChild;
TreeNode* rightSibling;
TreeNode(char ch) :data(ch), leftMostChild(NU... | ALGO | 0.999981 | 4.092588 |
4f101827-f73b-4871-b381-c78d2c8a4234 | iampreetsimar/dsa-practice | 6. 2DArrays/2. spiralPrint.cpp | #include <iostream>
#include <algorithm>
using namespace std;
void spiralPrint(int a[][1000], int m, int n) {
int startRow = 0, endRow = m - 1;
int startCol = 0, endCol = n - 1;
while(startRow <= endRow and startCol <= endCol) {
for(int i = startCol; i <= endCol; i++) {
cout<<a[sta... | ALGO | 0.999775 | 3.511721 |
3f400d24-eab5-4e7f-a039-a63ad336782a | ChanceMaker/C_Practice | NOTES/isSameTree.cpp |
class Solution {
public:
bool isSameTree(TreeNode* p, TreeNode* q) {
//check to see if p and q are both null and if so return true;
if(p == NULL && q == NULL)return true;
//if q is equal to NULL OR p is equal to NULL return false;
if(q == NULL || p == NULL) return false;
... | ALGO | 0.999972 | 6.489048 |
75923349-eaa6-4f8f-b1b1-cda6da1ec0e3 | kuzux/olimpcan | usaco_oct09/sinavcan/diet.cpp | /*
PROG: diet
LANG: C++
ID: kuzux921
*/
#include <fstream>
#include <iostream>
using namespace std;
int N, H;
int sizes[500];
int dyn[501];
int main(){
ifstream in("diet.in");
ofstream out("diet.out");
in >> H >> N;
for(int i=0;i<N;i++) in >> sizes[i];
for(int i=1;i<=N;i++){
for(int j=i;j>=0;j--){... | ALGO | 0.999952 | 3.498069 |
baf71f1b-86cf-4aa4-b4f0-8a69e584b9c4 | Wuyanqiao/- | HW2(v3)Vector.cpp | #include <iostream>
#include "Vector.h"
int dotproduct(float array1[], float array2[], int N)
{
float dotproductresult = 0;
for (int i = 0; i < N; ++i)
{
dotproductresult += array1[i] * array2[i];
}
std::cout << "Dot product result is: " << dotproductresult << std::endl;
return 0;
}
in... | ALGO | 0.966477 | 4.694582 |
7501ead3-79de-4a85-994f-84df711737e4 | chm994483868/HMDailyLearningRecord | OfferReview/OfferReview/01_38/27_MirrorOfBinaryTree/MirrorOfBinaryTree.cpp | #include "MirrorOfBinaryTree.hpp"
void MirrorOfBinaryTree::mirrorRecursively(BinaryTreeNode* pRoot) {
if (pRoot == nullptr) {
return;
}
BinaryTreeNode* temp = pRoot->m_pLeft;
pRoot->m_pLeft = pRoot->m_pRight;
pRoot->m_pRight = temp;
if (pRoot->m_pLeft != nullptr) {
mir... | TEST | 0.9975 | 5.707881 |
41b19674-7b9c-4d4a-93de-827a90536979 | koosaga/olympiad | JOI/camp11_ioi.cpp | #include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef long long lint;
typedef pair<lint, lint> pi;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int k, n, m; cin >> k >> n >> m;
vector<lint> a(k), s;
for(auto &i : a) cin >>... | ALGO | 0.999941 | 3.852716 |
5bba5373-fc7f-407b-92e1-b6438bb053dd | JayantGoel001/Dynamic-Programming | GoldMineProblem.cpp | #include<iostream>
using namespace std;
//Time complexity is O(m*n) and Space Complexity is O(m*n)
int goldMine(int **ar,int m,int n)
{
int **dp=new int*[m];
for(int i=0;i<m;i++)
{
dp[i]=new int[n];
}
int maxi=-1;
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
... | ALGO | 0.999971 | 4.637316 |
007b1e8c-0027-447a-a6e7-583d6a715ff7 | JrSousaJ/Uri-Solved-Problems | 1800.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,n2;cin >> n >> n2;
set<int>conj;
while(n2--)
{
int x;cin >> x;
conj.insert(x);
}
while(n--)
{
int x;cin >> x;
if(conj.find(x)==conj.end())
{
printf("1\n");
conj.insert(x);
}
else printf("0\n");
}
return 0;
} | ALGO | 0.999809 | 3.389847 |
3375e3b4-9c4c-45f5-a47b-c5631bb2f3e0 | fmsdwifull/c-plus | boost/src/boost_1_66_0/libs/graph/example/dfs-parenthesis.cpp | char name[] = "abcdefghij";
struct parenthesis_visitor : public boost::default_dfs_visitor
{
template <class Vertex, class Graph> void
start_vertex(Vertex v, const Graph &)
{
std::cout << ' ';
}
template <class Vertex, class Graph> void
discover_vertex(Vertex v, const Graph &)
{
std::cout << "(" ... | ALGO | 0.999453 | 6.164797 |
48beb8a9-4e88-44c3-ad58-dfb552e7af6f | mhnam/Data-Structure | Chp6/kruskal_v4.cpp | #include <stdio.h>
#include <stdlib.h>
#define MAX_VERTICES 100
#define MAX_EDGES 100
int simpleFind(int i, int* parent);
void simpleUnion(int i, int j, int* parent);
void KruskalMCST(int num_vertex, int num_edge, int edgeList[][3], int TreeEdge[][2], int* parent);
void main() {
int n, graph[MAX_VERTICES][MAX_VERTI... | ALGO | 0.999841 | 3.572179 |
609064bb-9b22-4ebe-a681-92935b29f7e4 | Tushar3002/DSA | leetcode/leet48_rotatematrix.cpp | #include<iostream>
#include<vector>
using namespace std;
void solve(vector<vector <int>>& v){
int n=v.size();
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
swap(v[i][j],v[j][i]);
}
}
for(int i=0;i<n;i++){
int s=0,e=n-1;
while(s<e){
swap(v[i][s],v... | ALGO | 0.999994 | 4.566278 |
3618e712-58f4-4146-aa18-6e8a8042b0a9 | rraallvv/Ball-in-maze | cocos3d/cc3PVR/PVRT/PVRTTrans.cpp | /******************************************************************************
@File PVRTTrans.cpp
@Title PVRTTrans
@Version
@Copyright Copyright (c) Imagination Technologies Limited.
@Platform ANSI compatible
@Description Set of functions used for 3D transformations and projec... | ALGO | 0.999579 | 7.601064 |
76afb6e8-3164-4967-8818-bf0f0ea0c0c5 | nguyenvu9405/online-judge | html/submissions/901/submission.cpp | #include<cstdio>
#include<cstring>
#include<cmath>
int p[101], f[21], a[21], n;
long cnt=0;
void sieve(int nmax)
{
memset(p, 1, sizeof(p));
p[1]=p[0]=0;
int i, j, lim=sqrt(nmax);
for (i=2; i<=lim; ++i)
if (p[i]) for (j=2; j<=nmax/i; ++j) p[i*j]=0;
}
void print()
{
//for (int i=1; i<=2*n;... | ALGO | 0.999505 | 3.415594 |
9d268599-7053-4533-a7ea-f4315b4956e1 | hongli26/LeetCodePractice | stackContinuation/503.cpp | class Solution {
public:
vector<int> nextGreaterElements(vector<int>& nums) {
int n = nums.size();
vector<int> res(n, -1);
stack<int> st;
for (int i = 0; i < 2 * n; ++i) {
int num = nums[i % n];
while (!st.empty() && nums[st.top()] < num) {
res... | ALGO | 0.999962 | 5.794897 |
22b9e278-9dcb-494f-88bf-4870fa611178 | omapzoom/platform-external-skia | src/effects/SkPerlinNoiseShader.cpp | #include "SkDither.h"
#include "SkPerlinNoiseShader.h"
#include "SkFlattenableBuffers.h"
#include "SkShader.h"
#include "SkUnPreMultiply.h"
#include "SkString.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "gl/GrGLEffect.h"
#include "gl/GrGLEffectMatrix.h"
#include "GrTBackendEffectFactory.h"
#include "SkGr.h"
... | TOOL | 0.958426 | 7.472758 |
cbb7d714-5a54-4761-951c-07ca8eb22bb9 | myasincifci/jetbrains-test-task | test_data/C++/subset_sum.cpp | /**
* @file
* @brief Implementation of the [Subset
* Sum](https://en.wikipedia.org/wiki/Subset_sum_problem) problem.
* @details
* We are given an array and a sum value. The algorithm finds all
* the subsets of that array with sum equal to the given sum and return such
* subsets count. This approach will have exp... | ALGO | 0.999805 | 6.33181 |
e9e405f4-a6af-48d7-8851-853fb12fcde4 | Tusharsingh110/DSA | DSA2/q9.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int f(string &s1,string &s2,int m,int n,vector<vector<int>> &dp) {
if(m==0 or n==0) return 0;
if(dp[m][n] != -1) return dp[m][n];
if(s1[m-1]==s2[n-1]) { return dp[m][n]=1+f(s1,s2,m-1,n-1,dp); }
else return dp[m][n]... | ALGO | 0.999992 | 5.68806 |
959c3c84-93c4-43b6-a57c-3df974e113f1 | raincross7/code-similarity | codes/train_code/problem034/problem034_213.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename T>
T gcd(T a, T b){
T n = min(a,b);
T m = max(a,b);
if(n == 0){ return m;}
else {
return gcd(n, m % n);
}
}
template<typename T>
T gcdAll(std::vector<T> & vals){
int size = vals.size();
T gcdVal =... | ALGO | 0.999994 | 5.720459 |
484d026a-ad85-41db-a291-9b3135ad7331 | okaryo/CompetitiveProgramming | AtCoder/ARC/041~050/041/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y, k;
cin >> x >> y >> k;
int ans;
if (y >= k) ans = x + k;
else ans = x + 2*y - k;
cout << ans << endl;
}
| ALGO | 0.999946 | 3.532208 |
0e6554f3-9d77-47ae-af5f-a54e6095ae5f | sebas095/Competitive-Programming | URI/The Pronalância Puzzle.cpp | #include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl '\n'
using namespace std;
int main() {
fast;
string s;
cin >> s;
reverse(s.begin(), s.end());
cout << s << endl;
return 0;
}
| ALGO | 0.999751 | 4.842189 |
18e438b5-aca9-4a9c-bcd7-ff513605474a | GaurishIIITNR/CP-Problems-Solutions-2 | 977D.cpp | // हर हर महादेव
#define F first
#define S second
#define dbl double
using namespace std;
#define pb push_back
#define vin(name, size) \
for (i = 0; i < size; i++) \
cin >> name[i]
#define vout(name) \
for (i = 0; i < name.size(); i++) \
cout << name[i] << " "; \
c... | ALGO | 0.999946 | 3.292463 |
18496ddc-8bc3-4237-a7af-b69c62af0b52 | ArefinAlter/ProblemSolving | codeforces/1352/G.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 3e5 + 9;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t; cin >> t;
while (t--) {
int n; cin >> n;
if (n <= 3) cout << -1 << '\n';
else {
for (int i = n - (1 - n % 2); i >= 1; i -= 2) cout << i << ' ';
cout << 4 << ' ' << 2 <<... | ALGO | 0.999244 | 4.196712 |
7acfdaae-23e1-436f-80bc-959d1304b0d8 | codingwithsakshi-b/DSA_Learning_With_CPP | Lectures/9_lecture/1_Max_subarray.cpp | #define _WIN32_WINNT 0x0600
#include <iostream>
#include "rang.hpp"
using namespace std;
using namespace rang;
void printSubarray(int arr[], int n)
{
cout << fg::magenta << "\nSubarrays are :-\n";
// for starting index
for (int st = 0; st < n; st++)
{
// for last index
for (int end =... | ALGO | 0.999855 | 5.231653 |
62d92a01-6712-4422-9b74-d125c4a474a4 | Aman-Sirmaur19/Pixel_Adventure_Game | 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 |
ab10fdd6-7542-48d5-89b2-5da1e110ef36 | sebastiaan-dev/advent-of-code-2024 | src/days/day2/solver.cpp | //
// Created by Sebastiaan Gerritsen on 25/02/2025.
//
#include "solver.h"
#include <fstream>
#include <assert.h>
#include <iostream>
#include <list>
#include <map>
#include <sstream>
namespace day2 {
Input Solver::readInput(std::string path) {
std::ifstream file(path);
assert(file.is_open());... | ALGO | 0.980129 | 6.322388 |
aae70086-930a-4770-92c1-9a9db8957e9c | hmkang/facerec | Face Recognition Library/ThirdParty/OpenCV/samples/gpu/stereo_match.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <stdexcept>
#include "opencv2/gpu/gpu.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
using namespace std;
struct Params
{
Params();
static Params read(int argc, char** argv);
string left;
string righ... | ALGO | 0.927024 | 6.177573 |
306db5d0-5556-4de7-97e7-8433a22dc0dc | Orlentino/vertex-k-connected-MPI | vertex-k-connected MPI/Source.cpp | #include <iostream>
#include <fstream>
#include <algorithm>
#include <chrono>
#include "mpi.h"
using namespace std;
long long Combination(int n, int k)
{
long long C = 1;
for (int i = 1; i <= k; i++)
C = C * (n - k + i) / i;
return C;
}
void DFS(int st, int** graph, int n, int* visited)
{
vis... | ALGO | 0.999906 | 4.740863 |
369ccc6e-9870-4c4c-aa1e-215603b59e88 | karandixit10/Interview_DS_Algo | 2006-find-the-student-that-will-replace-the-chalk/2006-find-the-student-that-will-replace-the-chalk.cpp | class Solution {
public:
int chalkReplacer(vector<int>& chalk, int k) {
long long totalChalk = 0;
for(int i = 0 ; i < chalk.size(); i++) {
totalChalk += chalk[i];
}
// Find remaining chalk after complete rounds
k %= totalChalk;
for (int i = 0; i < chalk.s... | ALGO | 0.999972 | 5.859186 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.