uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2b829c6f-56f4-46b1-9e9f-07e3ae7da000 | GIT-TUR/algorithm-study | fru1tworld/extra/leetcode75/binarySearch/leet374/leet2300/leet2300.cpp | class Solution {
public:
vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {
int n = spells.size();
int m = potions.size();
vector<int> pairs(n, 0);
sort(potions.begin(), potions.end());
for (int i = 0; i < n; i++) {
int spe... | ALGO | 0.999465 | 5.866104 |
930c403d-01a9-4047-b17e-0a2bfbcbbd72 | Mneach/Competitive-Programming-Notes | Dynamic Programming Algorithms/Basics of Recursion/tilling_problem.cpp | #include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
// given a "4 x n" and tiles of size
// "4 x 1", count the number of ways
// to tile the given board using the 4 x 1 tiles
// a tile either be placed horizontally
// i.e as a 1 x 4 tile or vertically
// i.e as a 4 x 1 tile
// input -> n
// outp... | ALGO | 0.999959 | 4.311731 |
1f7a8204-e19f-4874-ac5a-c4c88d705f43 | 1123581321345589144233377610/Homework | homework-31/31-1/main.cpp | #include <iostream>
#include <future>
#include <vector>
template<class Iterator>
Iterator Minimum(Iterator begin, Iterator end, std::promise<Iterator> promise) {
Iterator minimum{begin};
for (Iterator index{ begin }; index != end; std::advance(index, 1)) {
if (*index < *minimum) {
minimum = index;
}
}
promi... | ALGO | 0.999798 | 5.580335 |
e1bd1f9f-3009-443c-87a7-83e85ff1fa71 | Living-Hell/LeetCode | Binary Search/#410-SplitArrayLargestSum.cpp | // M1
// Using Binary Search
// Faster than 100% (-ms)
class Solution
{
public:
int solve(vector<int> &nums, int target)
{
int k = 1, sum = 0;
for (int i = 0; i < nums.size(); i++)
{
if (sum + nums[i] <= target)
sum += nums[i];
else
{
... | ALGO | 0.999984 | 5.521108 |
71705ce7-59d9-4e4c-ba24-d6be5c870d02 | Jikky1618/AtCoder | ABC/ABC300-349/ABC319/c.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
const int FACT = 362880;
const vector<vector<int>> bingo = {
{0, 1, 2},
{3, ... | ALGO | 0.99945 | 4.476554 |
1709bf90-47d2-4cae-bd91-7fa33db7904d | Banbury/starshatter-open | Opcode/OPC_AABBTree.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | ALGO | 0.991008 | 7.532262 |
dd6b776f-284f-481e-b410-2ce3b01be407 | eloipuertas/ES2015A | March Death/Assets/UnityRecast/src/Detour/Source/DetourNavMesh.cpp | #include <float.h>
#include <string.h>
#include <stdio.h>
#include "DetourNavMesh.h"
#include "DetourNode.h"
#include "DetourCommon.h"
#include "DetourMath.h"
#include "DetourAlloc.h"
#include "DetourAssert.h"
#include <new>
inline bool overlapSlabs(const float* amin, const float* amax,
const float* bmin, const... | ALGO | 0.9655 | 7.510998 |
fb48cab9-2224-415f-b633-4cef2c01a14e | viiku/competitive-programming-problems | codechef/ITER4.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;string str,str1;cin>>t;while(t--){
cin>>str>>str1;
map<char,int>mp,mp1;
for(int i=0;i<(int)str.size();i++){
mp[str[i]]++;
}
for(int i=0;i<(int)str1.size();i++){
mp1[str1[i]]++;
}
... | ALGO | 0.999947 | 4.052685 |
ae89476f-56ac-428b-99d0-b83db8f8890f | yqw1212/fuzztruction-llvm17.0.6 | llvm/lib/Transforms/Scalar/BDCE.cpp | #include "llvm/Transforms/Scalar/BDCE.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/DemandedBits.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"... | ALGO | 0.892843 | 7.94149 |
7b1a84df-a3a4-422d-a29a-93e4e3aa78da | SwingOlive/kASA | stxxl/tests/containers/test_map.cpp | #include <algorithm>
#include <cmath>
#include <stxxl/map>
#include <stxxl/stats>
typedef unsigned int key_type;
typedef unsigned int data_type;
struct cmp : public std::less<key_type>
{
static key_type min_value()
{
return std::numeric_limits<key_type>::min();
}
static key_type max_value()
... | TOOL | 0.922153 | 4.086797 |
cd7b7985-f62f-4bfc-b893-ebf9058d6ccd | oblsort/oblsort | tests/sort.cpp | #include <gtest/gtest.h>
#include <unordered_map>
#include "external_memory/algorithm/ca_bucket_sort.hpp"
#include "external_memory/algorithm/kway_butterfly_sort.hpp"
#include "external_memory/algorithm/kway_distri_sort.hpp"
#include "external_memory/algorithm/waks_on_off.hpp"
#include "testutils.hpp"
using namespac... | TEST | 0.952229 | 5.287557 |
655162e6-1bda-4728-b4bd-a231d8ea4aaf | WEGFan/Algorithm-Contest-Code | online-judge/HihoCoder/HihoCoder 1223.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
string x, op[100];
int num[100];
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> x >> op[i] >> num[i];
}
int ans = 1;
for (double i = -5; i <= 1005; i += 0.5)
{
int cnt = 0;
... | ALGO | 0.999866 | 3.937509 |
ae283811-22e9-44c7-bc38-826c79863ebc | anagorko/algorytmika | home/fwitkowski/choinka.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
int k;
cin >> n;
for(int i=0; i<n; i++){
int m=n-i;
k=(2*n+1)-(2*m);
if(k==0) k=1;
for(int j=0; j<m+1; j++){
cout<<" ";
}
for(int j=0; j<k; j++){
cout<<"*";
}
for(int j=0; j<m+1; j++){
cout<<" ";
}
... | ALGO | 0.999988 | 3.523818 |
6c6dd136-3da6-4438-ad8c-8cde67c8815f | ishandutta2007/codeforces | vercingetorix/normal/1716/B.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <queue>
#include <cstring>
#include <set>
#include <bitset>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <stdio.h>
using namespace std;
typedef long long ll;
typedef long do... | ALGO | 0.999196 | 3.577513 |
aefad33f-cf87-4d51-820e-66a90bbdd888 | arpitsangwan/Friendly-contests | 14 Fourteenth/1524. Number of Sub-arrays With Odd Sum.cpp | //https://leetcode.com/problems/number-of-sub-arrays-with-odd-sum/
class Solution {
public:
int numOfSubarrays(vector<int>& ar) {
int m=1000000000+7;
int n=ar.size();
long long int odd=0,even=0;
long long int ans=0;
int cs=0;
for(int i=0;i<n;i++){
... | ALGO | 0.999985 | 5.372016 |
335f427e-697f-4d64-9ab1-56219ab70e2c | yy4556028/Messi | lib_lpr/src/main/jni/src/FastDeskew.cpp | //
// Created by 庾金科 on 02/10/2017.
//
#include "../include/FastDeskew.h"
#include <cmath>
#include <vector>
#include <opencv2/core/types.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/opencv.hpp>
namespace pr{
const int ANGLE_MIN = 30 ;
const int ANGLE_MAX = 150 ;
... | ALGO | 0.96215 | 4.759274 |
c988368f-cc3d-455e-b19f-8fa9d85904fd | sajjadhussains/data-structure | sorting-algorithm/insertionSort.cpp | #include<bits/stdc++.h>
using namespace std;
void printArray(int arr[],int size)
{
for(int i=0;i<size;i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;
}
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
cout<<"Before sorting: ";
pr... | ALGO | 0.999991 | 4.674247 |
e794992d-2ab9-4728-bbb8-e481b626bda4 | klotte/boost | src/boost_1_44_0/libs/spirit/classic/example/fundamental/functor_parser.cpp | #include <boost/spirit/include/classic_core.hpp>
#include <boost/spirit/include/classic_functor_parser.hpp>
#include <boost/spirit/include/classic_assign_actor.hpp>
#include <iostream>
#include <vector>
#include <string>
///////////////////////////////////////////////////////////////////////////////
//
// Demonstrate... | TOOL | 0.893878 | 7.243232 |
cc8d9483-6eb8-4c02-b036-0971d4c0ec28 | Piyush-io/Cpp | coutninversions.cpp |
//{ Driver Code Starts
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
// arr[]: Input Array
// N : Size of the Array arr[]
// Function to count inversions in the array.
long long merge(long long arr[], long long low, long long mid, long... | ALGO | 0.999913 | 6.086159 |
3be4620d-01f1-4ca8-a880-51e8f2a32262 | rajyan/AtCoder | ABC/ABC193/E.cpp | #ifdef _DEBUG
#include "../../../library/src/debug_template.hpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#inclu... | ALGO | 0.999808 | 3.928038 |
aaa49c0c-221b-4aa1-8770-8ef960b6a1cd | padjal/compare-algorithms | CompareAlgorithms/algorithms/bubble-sort.cpp | /*
* Implements the bubble sort algorithm.
*/
#include <vector>
void bubbleSort(std::vector<int>& numbers) {
bool array_sorted = false;
for (int index = 0; index < numbers.size() - 1 && !array_sorted; ++index) {
int swaps_per_iteration = 0;
for (int j = 0; j < numbers.size() - index - 1; ++... | ALGO | 0.999991 | 6.817777 |
b9cd849e-5867-4169-a530-233d829ba99a | Shanu2409/Recursive-Funcion | sayDigit.cpp | #include<iostream>
using namespace std;
void sayD(int n, string* arr){
if (n == 0) return ;
int dig = n % 10;
sayD(n/10, arr);
cout<<arr[dig]<< " ";
}
int main()
{
string arr[10] = {"Zero", "One", "Two", "Three", "Four", "Five", "Sx", "Seven", "Eight", "Nine"};
sayD(32100, arr);
ret... | ALGO | 0.995732 | 4.23206 |
403b5023-8d4c-4df8-a17a-cc12d0ab719a | Ayushluthra2001/LeetCode-CN-POTD | Min Max Game(cn).cpp | class Solution {
public:
int minMaxGame(vector<int>& nums) {
if(nums.size()==1) return nums[0];
int n=log2(nums.size());
vector<int>ans=nums;
while(n>0){
bool flag=true;
vector<int>temp;
for(int i=0;i<ans.size();i+=2){
if(f... | ALGO | 0.999973 | 5.527485 |
1e7634d5-a049-42ab-97ff-0d3296f54737 | ZhangZhenmiao/GenomeDecoder | src/LJA/src/projects/error_correction/tournament_correction.cpp | #include "tournament_correction.hpp"
#include "bulge_path_marker.hpp"
#include "error_correction.hpp"
#include "dimer_correction.hpp"
#include "reliable_fillers.hpp"
using namespace dbg;
size_t tournament(const Sequence &bulge, const std::vector<Sequence> &candidates, bool dump) {
size_t winner = 0;
std::vecto... | ALGO | 0.999409 | 5.906537 |
128132b1-b28e-49d8-95fe-964791a1eee8 | HMD-CVA/Code | Fibo/main.cpp | #include <bits/stdc++.h>
using namespace std;
//ifstream cin("FIBO.INP");
//ofstream cout("FIBO.OUT");
string F[1000001];
long long xl(long long n)
{
if (n==0) cout << "0" << endl;
if (n==1) cout << "1" << endl;
if (n >= 2)
{
long long fn,f0=0,f1=1;
for (int i=2;i<=n;i++)
{
... | ALGO | 0.999905 | 4.201202 |
f65be40a-b260-4c35-ac06-0ef25eff7cfb | kaywsy/Algorithms | trapped_water_II.cpp | //given n x m non-negative intergers representing an elevation map 2d
//where the area of each cell is 1 x 1
//compute how much water it is able to trap after raining
// [12, 13, 0, 12]
// [13, 4, 13, 12]
// [13, 8, 10, 12]
// [12, 13, 12, 12]
// [13, 13, 13, 13]
// return 14
#include <iostream>
#include <vector>
#inc... | ALGO | 0.999957 | 6.607435 |
13ee983a-5b0d-4bd2-9c2b-1cd6decbf530 | arnavarora1710/Competitive_Programming | Codeforces/1352A.cpp | // https://codeforces.com/contest/1352/problem/A
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pi;
#define f first
#define s second
#define mp make_pair
#define MULTI_TEST (1)
const int maxn = 2e5 + 5, ... | ALGO | 0.999706 | 5.508619 |
9a0ba537-1c7f-4c56-9e0e-324370e55cb8 | J-Gann/alltrans | benchmarks/benchmarks_source/12_level/cpp/test/algorithm/searching/ternary_search.cpp | #include <cmath>
#include "third_party/catch.hpp"
#include "algorithm/searching/ternary_search.hpp"
using std::vector;
/*
TODO: refactor
*/
unsigned int cur = 0;
unsigned int a = 13674324, b = 1233;
unsigned int nextRand24() {
cur = cur * a + b;
return cur >> 8;
}
vector<int> nextRandUnimodal(int size... | TEST | 0.999552 | 6.898491 |
e31ca37e-63dd-47a5-9912-c17548f3740e | Rootkehta/Rootkehta | src/tests/Interop/PInvoke/Generics/GenericsNative.VectorD.cpp | #include <stdio.h>
#include <stdint.h>
#include <xplatform.h>
#include <platformdefines.h>
typedef struct {
double e00;
double e01;
} VectorD128;
typedef struct {
double e00;
double e01;
double e02;
double e03;
} VectorD256;
static VectorD128 VectorD128Value = { };
static VectorD256 VectorD25... | TOOL | 0.928235 | 5.771221 |
53cdd15e-737d-469d-8380-c74d0e0fd534 | vietunitydev/SourceCodePTIT | SPOJ PTIT/PTIT121B.cpp | // https://www.spoj.com/PTIT/problems/PTIT121B/
// PTIT121B - Mã Nhị Phân Gray
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<string> v;
v.push_back("0");
v.push_back("1");
for (int i = 2; i < pow(2, n); i *= 2)
{
for (int j = i - 1; j >= 0; j--)... | ALGO | 0.999996 | 4.303477 |
d967cdcc-4370-48f1-9cec-5fd2b32a8aad | Brianhoet4000/DoomAIObjectDetection | 3rdParty/opencv/sources/samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo2.cpp | /**
* @function generalContours_demo2.cpp
* @brief Demo code to obtain ellipses and rotated rectangles that contain detected contours
* @author OpenCV team
*/
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace std;... | ALGO | 0.998344 | 7.74176 |
e01d140d-790b-4549-82bc-259f45becdd9 | Davin-Liang/farming_ws | src/robot_localization/src/ukf.cpp | #include <robot_localization/filter_common.hpp>
#include <robot_localization/ukf.hpp>
#include <Eigen/Cholesky>
#include <vector>
namespace robot_localization
{
Ukf::Ukf()
: FilterBase(),
uncorrected_(true)
{
size_t sigma_count = (STATE_SIZE << 1) + 1;
sigma_points_.resize(sigma_count, Eigen::VectorXd(STATE_SIZE... | ALGO | 0.992849 | 7.801241 |
970a3e81-4233-45ee-80e6-5c24e413eaec | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-coop-gpt35/Codenet/p00550/851984789/improved.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m, q, a[210000], b[210000], c, dist[110000], T[110000], cnt, U[110000];
vector<pair<int, int>> x[110000], y[110000];
bool used[210000];
int main() {
scanf("%d%d%d", &n, &m, &q);
for (int i = 0; i < m; i++) {
scanf("%d%d", &a[i], &b[i]);
x[a[i]].push_back(... | ALGO | 0.999879 | 3.947224 |
52c0ec5a-8c15-4ec5-b100-6c217bb66922 | mirrorer/libbpg | jctvc/TLibCommon/TComWeightPrediction.cpp | /** \file TComWeightPrediction.h
\brief weighting prediction class (header)
*/
// Include files
#include "TComSlice.h"
#include "TComWeightPrediction.h"
#include "TComInterpolationFilter.h"
static inline Pel weightBidir( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset, Int clipBD)
{
retu... | ALGO | 0.997486 | 6.030519 |
6978e343-0b8d-4dba-a8a7-f19107add152 | sogapalag/problems | kickstart/2019g1.cpp | #include <bits/stdc++.h>
using namespace std;
//void solve() {
// int n,m,q;
// cin >> n >> m >> q;
// int sq = n < 50000 ? 300 : 400;
// vector<int> a(n+1, 0);
// vector<int> cnt(sq, 0);
// for (int _ = 0; _ < m; _++) {
// int x; cin >> x;
// a[x]++;
// for (int i = 1; i < sq... | ALGO | 0.999628 | 3.885532 |
0b184baf-3523-4ca0-b04d-29459d71a797 | YoeaKai/leet_code | topic/find_mode_in_binary_search_tree/find_mode_in_binary_search_tree.cpp | #include <vector>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};
class Solu... | ALGO | 0.999985 | 6.050142 |
29c70a9c-9803-410b-a1db-df22974228a4 | ishandutta2007/codeforces | chitanda/normal/855/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define ll long long
#define pii pair<int, int>
#define M 1000000007
#define all(a) a.begin(), a.end()
const int inf = (1e9) + 7;
int n, q, r;
ll p;
int x;
int main(){
scanf("%d%lld%d%d", &n, &... | ALGO | 0.99995 | 3.078953 |
1c3574da-7faa-4d2d-ba25-2528cbdf7fec | namnghiem112/Lap-Trinh-C-C- | day trung binh lon nhat.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{ long long n,k;
cin >>n>>k;
long long a[n],mang[n],max=0;
for (int i = 0; i < n; i++)
{
cin >> a[i];
if(a[i]<0) max+=a[i];
... | ALGO | 0.999965 | 3.727814 |
91c08463-d24c-4ce5-a0db-b33fc249c946 | saurabhh-svg/Contests | CodeForces/B_Pleasant_Pairs.cpp | #include <bits/stdc++.h>
#include <unordered_map>
#define _ ios_base::sync_with_stdio(0);
#define fs cin.tie(0);
#define ll long long int
#define pb push_back
#define fl(i,n) for(int i=0;i<n;i++)
using namespace std;
void solve(){
int n, ans = 0;
cin >> n;
ll a[n + 1];
for (int i = 1; i < n + 1; i++) c... | ALGO | 0.998395 | 3.604609 |
06bd9408-94f2-41c7-a2ac-aa0f789219fb | zhangshiyun/LAMMPS_STABLE | LAMMPS_STABLE/fix_spring_self.cpp | /* ----------------------------------------------------------------------
Contributing author: Naveen Michaud-Agrawal (Johns Hopkins University)
------------------------------------------------------------------------- */
#include "stdlib.h"
#include "string.h"
#include "fix_spring_self.h"
#include "atom.h"
#includ... | ALGO | 0.891632 | 6.234886 |
18942658-2841-4733-b3ba-523d88ced8b6 | anuja2004/test-gfg | Medium/Buy Maximum Stocks if i stocks can be bought on i-th day/buy-maximum-stocks-if-i-stocks-can-be-bought-on-ith-day.cpp | //{ Driver Code Starts
/* Driver program to test above function */
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int buyMaximumProducts(int n, int k, int price[]){
//Write your code here
pair<int, int> price_day[n];
for (int i = 0; i < n; ++i) {
... | ALGO | 0.999784 | 5.382919 |
3d4fdb06-f59b-45ae-8fdd-18ec1e134d28 | raincross7/code-similarity | codes/train_code/problem264/problem264_302.cpp | #include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);
int main() {
int n;
cin >> n;
vec... | ALGO | 0.999947 | 3.555776 |
0c039f08-b01e-4ef0-92c1-6b9b5b8a3cab | Tahmid999/Cpp | 52problemsolve/pasceltraingle.cpp | #include<iostream>
using namespace std;
int main()
{
int row;
cin>>row;
for (int i = 1; i <= row; i++)
{
int num =1;
for (int j = 1; j<= row-i; j++)
{
cout<<" ";
}
for (int k = 0; k<=i; k++)
{
cout<<num<<" ";
... | ALGO | 0.999973 | 3.727211 |
92951966-4ac9-491e-91c4-9788ef8130d1 | kshitij4/CAP-202 | frnd.cpp | #include <iostream>
using namespace std;
class time
{
int hr,mi,sec;
public:
void init(int x,int y,int z)
{
hr=x;
mi=y;
sec=z;
}
void disp()
{
cout<<hr<<":"<<mi<<":"<<sec<<"\n";
}
friend time sum(time,time);
};
time sum(time M,time N)
{
time O;
... | ALGO | 0.993663 | 3.826114 |
eba32bd4-242b-469e-8f07-cb4a12e9dc82 | muradhaji/ProblemSolutions | Codeforces/cpp/25A.cpp | //Link: https://codeforces.com/problemset/problem/25/A
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, num, odd_count = 0, even_count = 0, odd_index, even_index;
cin >> n;
for(int i = 0 ; i < n ; i++) {
cin >> num;
if(num % 2 == 1) {
odd_count += 1;
odd_index = i + 1;
}
else {
ev... | ALGO | 0.999956 | 4.36417 |
ca6c23ba-16e7-4a76-87c4-711668d670d6 | Sahil-Mahawer/Leetcode_problem | 2264-largest-3-same-digit-number-in-string/2264-largest-3-same-digit-number-in-string.cpp | class Solution {
public:
string largestGoodInteger(string s) {
int n = s.size();
unordered_map<char, int> char_freq;
string result="";
char value;
int check = -1;
int digit = 0;
for(int i=0;i<n;i++){
char_freq[s[i]]++;
}
... | ALGO | 0.999973 | 6.45098 |
f9713b26-510a-4faa-893c-90beb862ed8e | bsudharshan2001/MyRespository | College/Semester-6/19CSE312-DistributedSystems/LabAssignment-1.cpp | // LabAssignment-1.cpp
// Program done by: B Sudharshan - CB.EN.U4CSE19008 - CSE A
// Athota Surya - CB.EN.U4CSE19007 - CSE A
//Question 1 - Point-to-Point Communication between Node 1 and Node 0
/*
#include <mpi.h>
#include <stdio.h>
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
// I... | ALGO | 0.994929 | 3.260389 |
f0982d03-cebc-4bcd-b7a9-2954247e11a4 | ishandutta2007/codeforces | amshz/normal/1219/G.cpp | # include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
# define F first
# define S second
# define endl '\n'
# define sep ' '
# define pb push_back
# define fast_io ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
const ll md = 1e9+7;
const int xn = 1e5+10;
const int x... | ALGO | 0.999962 | 3.609903 |
b40cd818-49bd-4af8-b081-e7ace0458b3f | abhinav5-0/GeeksForGeeks-POTD | 2025/May/26(May) 2025/Problem-Name.cpp | class Solution {
public:
Node* sortedInsert(Node* head, int data) {
Node* newNode = new Node(data);
// Case 1: Empty list
if (head == NULL) {
newNode->next = newNode;
return newNode;
}
Node* curr = head;
// Case 2: Insert before head (new ... | ALGO | 0.999982 | 6.358152 |
69ab5681-9d23-4329-8d8e-dac07ef57c21 | NervanaSystems/eigen | bench/perf_monitoring/trmv_up.cpp | #include "gemv_common.h"
EIGEN_DONT_INLINE
void trmv(const Mat &A, const Vec &B, Vec &C)
{
C.noalias() += A.triangularView<Upper>() * B;
}
int main(int argc, char **argv)
{
return main_gemv(argc, argv, trmv);
}
| ALGO | 0.992463 | 4.860907 |
76e19e5f-44d3-4a65-91cd-138227022643 | mvaibhav77/coding | DSA_supreme 2.0/class codes/8_functions/homework/create_a_number_using_digits.cpp | #include <bits/stdc++.h>
using namespace std;
int create(int num)
{
int number = 0;
for (int i = 0; i < num; i++)
{
cout << "enter the digit : "<<endl;
int digit;
cin >> digit;
number = number * 10 + digit;
}
return number;
}
int main()
{
int number;
cout <<... | ALGO | 0.978503 | 3.764843 |
c253ff8c-b483-4da9-a5c3-15364dd42afa | mihirbarad/FlutterJourney | Flutter_Practice/bugetapp/bugettracker/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.99764 | 6.785645 |
0d74a7e3-827b-4c01-88ea-583bc02ae58a | raincross7/code-similarity | codes/train_code/problem426/problem426_29.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;
int r,c,n;
int ans;
char map[1005][1005];
bool book[1005][1005];
int dir[4][2]={{-1,0},{0,-1},{0,1},{1,0}};
struct point
{
int x,y;
int step;
}p[11],now,last;
bool check(int x,i... | ALGO | 0.999747 | 3.084522 |
c4dbcf57-a70e-4878-9516-5be30fec6f9d | Pink-Hat-Hacker/CISC220_DLLPlaylist | DLL.cpp | /*
* DLL.cpp
*
* Created on: Oct 9, 2021
* Author: pinkhathacker
*/
#include "DNode.hpp"
#include "DLL.hpp"
#include "Song.hpp"
#include <iostream>
#include <stdlib.h>
using namespace std;
DLL::DLL(){ // constructor - initializes an empty list
last = NULL;
first = NULL;
numSongs = 0;
}
DLL::DLL(strin... | TOOL | 0.954922 | 3.139137 |
d857a961-375e-4529-827c-5eff560d2a84 | ValterYudi/competitive-programming | Codeforces/div2/47/a.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int, int> ii;
void solve(){
string a, b, c; cin >> a >> b >> c;
map<char, int> m;
if(a[1] == '>'){
m[a[0]]++;
}else
m[a[2]]++;
if(b[1] == '>'){
... | ALGO | 0.999979 | 4.012437 |
f267d355-88a3-4c8a-8c5b-8f2b4c8b1c01 | ayush8303/Galgotias-University-Adv.-DSA-Training-program | Day 35, 36 - Dynamic Programming (Part 3)/Interleaved String.cpp | class Solution
{
public:
string s1, s2, s3;
vector<vector<int>> memo;
int dp(int i, int j)
{
int k = i + j;
if (k == s3.size())
return true;
if (memo[i][j] != -1)
return memo[i][j];
int ans = 0;
if (i < s1.size() && s1[i] == s3[k])
{
ans |= dp(i + 1, j);
}
i... | ALGO | 0.999771 | 5.573811 |
cfc0763d-d8ca-40cc-90be-48a6de818d2f | sia162/LeetcodeQuestions | 0003-longest-substring-without-repeating-characters/0003-longest-substring-without-repeating-characters.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
int ans = 0;
unordered_map<char,int> m;
for(int i=0,j=0;i<=j && j<s.length() && i<s.length();){
if(m.find(s[j]) == m.end()){
ans = max(ans,j-i+1);
m[s[j]] = j;
... | ALGO | 0.999948 | 6.079603 |
0777b70b-ea09-4022-8fcf-90be37fa9f88 | ishandutta2007/codeforces | ei133333/normal/1119/C.cpp | #include<bits/stdc++.h>
using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
cerr << fixed << setprec... | ALGO | 0.999998 | 4.046374 |
f902c7ee-7065-4ea9-9f38-388bea3fea63 | GonzaloHer97/TAIS | Grafos dirigidos/Prob16_LaMaquinaCalculadora/Prob16_LaMaquinaCalculadora/Source.cpp |
// Gonzalo Hernndez Hernndez
// TAIS39
// Comentario general sobre la solucin,
// explicando cmo se resuelve el problema
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include "Digrafo.h" // propios o los de las estructuras de datos de clase
using namespace std;
const i... | ALGO | 0.999934 | 4.489402 |
4e7fe30c-6cf5-4d47-9ffa-5a9a99f7de3a | AmanGupt2020/dsa_practice_6 | print-a-binary-tree-in-vertical-order.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
... | ALGO | 0.99996 | 6.442143 |
bea019e1-28b4-4f18-aa50-3cda47e3c1a2 | theanupambista/second_semester_c-_labsheet | assignment_three/09.cpp | #include <iostream>
using namespace std;
int main()
{
int n, reversed = 0;
cout << "Enter a number: ";
cin >> n;
while (n != 0)
{
reversed = reversed * 10 + n % 10;
n /= 10;
}
cout << "Reversed number: " << reversed << endl;
return 0;
}
| ALGO | 0.998439 | 5.161656 |
ad79f4bd-1c5c-4042-ad77-1bedc254ed4a | ishandutta2007/codeforces | dlalswp25/normal/1462/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int N;
pii A[202020];
vector<int> L, R;
int main() {
int tc; scanf("%d", &tc);
while(tc--) {
L.clear(); R.clear();
scanf("%d", &N);
for(int i = 1; i <= N; i++) {
scanf("%d%d", &A[i].first, &A[i].second);
L.push_back(A[i].first);
... | ALGO | 0.999784 | 4.503989 |
e46b05ba-90d8-4a2c-a75b-ff209d3c661e | ShirRinghao/Data-Structure | Labs/Lab13/check2/polygons.cpp | #include "polygons.h"
bool Polygon::HasAllEqualSides() {
double side = DistanceBetween(verts_[0], verts_[1]);
for (unsigned int i = 2; i < verts_.size(); i++) {
if (!EqualSides(side, DistanceBetween(verts_[i-1], verts_[i]))) return false;
}
return true;
}
bool IsoscelesTriangle::isIsoscelesTriangle(const ... | ALGO | 0.992198 | 5.393956 |
ff10f5af-11cf-46df-91ef-c392ed8ff42d | Stef-GMS/pong_using_flame_behaviors | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
63ee3670-4b9c-4b96-a317-ed46e67cdea1 | musfiqurR661/Data_Structure_II_UIU | Divide and Conquer/Indersion.cpp | #include <iostream>
using namespace std;
long long countInversions(int arr[], int left, int mid, int right) {
int sizeLeft = mid - left + 1;
int sizeRight = right - mid;
int leftArr[sizeLeft], rightArr[sizeRight];
for (int i = 0; i < sizeLeft; i++)
leftArr[i] = arr[left + i];
for (int j =... | ALGO | 0.999895 | 5.14571 |
116c05b4-9134-4b69-99aa-e0fdf394933c | NirantK/interview_practice | 2015-2018/LISTCYCLE.cpp | /*LISTCYCLE*/
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define tr(container, it) for( auto it = container.begin(); it != container.end(); it++)
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};... | ALGO | 0.999975 | 4.065356 |
e1a8ce7c-ceb8-489d-bc1b-4e293af1d4aa | sjtuyinjie/M3DGR | baseline_systems/VIW_Fusion_M3DGR/src/loop_fusion/src/ThirdParty/DBoW/BowVector.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include "BowVector.h"
namespace DBoW2 {
// --------------------------------------------------------------------------
BowVector::BowVector(void)
{
}
// -------------------------------------------------------------------... | TOOL | 0.927147 | 5.316598 |
424e67a2-ad6f-4b67-a1f6-0e89a86b0cce | RickAnMorty163/Algorithm_Learning | Basic_Algorithm/merge_Pair_Count.cpp | #include <iostream>
#include <vector>
using namespace std;
const int N = 10 + 10e5;
vector<int> arr(N);
int left_bound(int l, int r, int target)
{
while (l < r)
{
int mid = (l + r) >> 1;
if (arr[mid] >= target)
r = mid; // C1:arr[i]<k c2:arr[i]>=k 初始位置转化为求C2的左边界
else
... | ALGO | 0.99998 | 4.589736 |
424276f5-4273-4233-82c0-5ed0175d42bb | filipemlins/Automatic-Music-Transcription-Harmonica | tools/essentia-2.1_beta3/src/algorithms/filters/lowpass.cpp | #include "lowpass.h"
#include "essentiamath.h"
using namespace essentia;
using namespace standard;
using namespace std;
const char* LowPass::name = "LowPass";
const char* LowPass::category = "Filters";
const char* LowPass::description = DOC("This algorithm implements a 1st order IIR low-pass filter. Because of its de... | ALGO | 0.991129 | 5.275912 |
aadf2859-5dae-46b4-af7a-131cff73838f | arjun5354/-6Companies30Days | Goldman Sachs/Day-4/Qs1.cpp | /*
Question Source : https://www.proelevate.in/dsa-practice/6-companies-30-days
Asked By : goldman sachs
Leetcode : 1765. Map of Highest Peak
*/
class Solution {
public:
vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {
int row=isWater.size();
int col=isWater[0].size();
vector... | ALGO | 0.999951 | 6.309617 |
e329824b-5e64-4a3b-a153-b2a3d7bab53a | AdityaCM65/DAA | MATRIX.CPP | #include<iostream.h>
#include<conio.h>
class demo
{
int a[10][10],b[10][10],c[10][10],i,j,row1,row2,col1,col2;
public:
void dis();
void add();
void sub();
void get();
void trans();
void mul();
};
void demo::get()
{
cout<<"\n enter the row :";
cin>>row1;
cout<<"\n enter the column";
cin>>col1;
for(... | ALGO | 0.999102 | 3.399885 |
f6290e3e-e81e-4614-9b94-4d8cb98c3d38 | Soumyo001/Online_Judge_Solves | Algorithms/AI Algorithms/search algorithms/uninformed search/uniform cost search.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
vector<pair<int,int>> graph[N];
void inputGraph(int edges){
for(int i=0;i<edges;++i){
int u,v,cost;cin>>u>>v>>cost;
graph[u].push_back({v,cost});
//graph[v].push_back({u,cost});
}
}
struct Node
{
int id;
int cost;
... | ALGO | 0.999962 | 4.381033 |
3fe3a5ea-15f3-4e34-aa39-9bf9ba9cc538 | AdvTrainEvalSrcDomain/adv-train-evaluation-source-code-domain | code-imitator/data/dataset_2017/dataset_2017_8_formatted_macrosremoved/marcospqf/8294486_5630967708385280_marcospqf.cpp | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long int ll;
typ... | ALGO | 0.999777 | 4.121486 |
27e7384a-46f8-4fd0-a96e-0f234a4c840d | AlaminPu1007/leet-code | Leet-Code/652 count subarrays with fixed bound/2444_count_subarrays_with_fixed_bound.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
long long countSubarrays(vector<int> &nums, int minK, int maxK)
{
int n = nums.size();
long long res = 0;
int positionOfMinK = -1, positionOfMaxK = -1, positionOfCulpritIndex = -1;
for (int i = 0; i < n; i++)
{
// fi... | ALGO | 0.999791 | 5.104501 |
e4721f02-38ec-432e-a163-fe72619f7ef6 | ishandutta2007/codeforces | zhoushang2003/normal/725/F.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=2e5+1;
long long n,x,y,X,Y,q[N],t,A;
int main()
{
cin>>n;
while(n--&&cin>>x>>y>>X>>Y)
if(x+y>=X+Y)
q[++t]=x+y,q[++t]=X+Y,A+=x+X;
else if(x>Y)
A+=x-Y;
else if(y>X)
A+=X-y;
sort(q+1,q+t+1);
for(int i=1;i<t;i+=2)
A-=q[i];
cout<<A;
return 0;
} | ALGO | 0.999345 | 3.427297 |
7ca0f1b0-729d-42b8-8c72-1bb6f58febe9 | carykees98/advent-of-code-22 | day2/day2.cpp | #include <iostream>
#include <vector>
#include <fstream>
int main(int argc, char const *argv[])
{
std::ifstream infile("./day2.txt");
char elfPlay, myPlay;
int answer1 = 0;
int answer2 = 0;
while (infile >> elfPlay >> myPlay)
{
if (elfPlay == 'A')
{
if (myPlay == 'Y')
answer1 += (6 + 2);
else if (... | ALGO | 0.998224 | 4.16844 |
4fe876d2-fa03-4d55-9f48-e3380f0088c6 | kcherd/cyclic-list | cyclic_list/Source.cpp | #include "Header.h"
#include "HeaderLine.h"
void main()
{
setlocale(LC_ALL, "Russian");
int act;
char nameFile[] = "Test.txt";
cout << "Выберите действие:" << "\n" << "1: добавление" << "\n" << "2: удаление" << "\n" << "3: замена элемента" << "\n" << "4: сортировка" << endl;
cin >> act;
switch (act)
{
case 1:... | TOOL | 0.929521 | 3.369476 |
525ba3b8-9d76-4424-add8-68c2adb682b3 | ashutoshdas1212/DSA-Everyday | returnsubsetsumkofficial.cpp | int subset(int input[], int n, int output[][50], int k, int startindex)
{
if (startindex == n)
{
if (k == 0)
{
output[0][0] = 0;
return 1;
}
else
{
return 0;
}
}
int row = 0;
int smalloutput1[3000][50], smalloutput2... | ALGO | 0.999932 | 4.241691 |
29197a37-48e1-4b77-8efd-e82f87b61715 | pdhyeong/Junglepdh | 프로그래머스/2/17677. [1차] 뉴스 클러스터링/[1차] 뉴스 클러스터링.cpp | #include <string>
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <cctype>
#include <cmath>
using namespace std;
map<string,int> mymap1;
map<string,int> mymap2;
vector<string> change_str(string str1){
vector<string> check1;
for(int i = 0;i<str1.size()-1;i++){
string sub = st... | ALGO | 0.999778 | 4.674364 |
e0e93fac-60b0-45be-aaab-5d5fa337ca9f | tsugitta/atcoder | contests/hitachi2020/hitachi2020_b/main.cpp | // https://atcoder.jp/contests/hitachi2020/tasks/hitachi2020_b
#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i <... | ALGO | 0.99999 | 5.150208 |
4f0ecd48-79fe-4774-a687-efc91e198aad | hzhua/oiprogram | TrueKM/km.cpp | /*
KM算法只能在两边点数相等的情况下使用
|X|!=|Y|的时候如果能保证X有完备匹配
如果不相等,可以用补0点法
*/
#include<cstring>
#include<stdio.h>
#define INF 21474836
int n,m;
int conn[200][200];
int w[200][200];
int pre[201];
int lx[201],ly[201];
bool sx[201],sy[201];
int slack[201];
bool hun(int pos)
{
sx[pos]=true;
for(int i=1;i<=conn[pos][0];i++)
{
int ... | ALGO | 0.999958 | 3.555706 |
dbc70d27-724a-428c-8660-51ba86f92fee | divysoni03/full_cpp | vector/Tasks/Task4.cpp | // find the second largest element in the vector
#include <iostream>
#include <climits>
#include <vector>
using namespace std;
int main() {
vector<int> nums(10);
cout << "Enter values of the array" << endl;
for(int i = 0; i < nums.size(); i++) {
cout << "Enter " << i << "'th value: ";
cin >... | ALGO | 0.999859 | 4.628642 |
8f7dd653-153d-4869-bc72-d48f3e4874d6 | sneha390/DSA_Track | array/medium/sortTheKScore.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> sortTheStudents(vector<vector<int>>& score, int k) {
int mx;
for(int i = 0; i < score.size() ; i++){
mx = i;
for(int j = i ; j < score.size() ; j++){
if(score[j][k] > score[mx][... | ALGO | 0.999694 | 5.693915 |
8b537a66-5143-4bc1-8836-62417b00bbd2 | mdNurAman/Codeforces | C_Superultra_s_Favorite_Permutation.cpp | #include <bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long int
#define loop(n) for (int i = 0; i < n; i++)
bool isPrime(int n)
{
if (n <= 1)
return false;
if (n <= 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (int i = 5; i * i <= n; i +=... | ALGO | 0.999848 | 4.975036 |
e0495c97-09d1-47a3-afaf-8293c852fc36 | kevinmtang/kattis-solutions | solved/4-5/muzicari.cpp | //https://stackoverflow.com/questions/36730711/find-a-subset-with-sum-within-a-range
#include <bits/stdc++.h>
using namespace std;
int main(){
int T, N;
cin >> T >> N;
vector<int> arr;
for(int i = 0; i < N; i++){
int n; cin >> n;
arr.push_back(n);
}
bool dp[N][T+1];
for(int i = 0; i < T+1; i++... | ALGO | 0.999976 | 3.390333 |
cb96b6a4-d39b-4584-8aba-fb03c7f2c8cf | ishandutta2007/codeforces | gyh20/normal/1252/J.cpp | #include<bits/stdc++.h>
#define re register
using namespace std;
inline int read(){
re int t=0;re char v=getchar();
while(v<'0')v=getchar();
while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
return t;
}
const int M=998244353;
inline void add(re int &x,re int y){(x+=y)>=M?x-=M:x;}
inline int ksm(re int x,re int y){
re... | ALGO | 0.999993 | 4.119308 |
f7c828f0-1268-4218-8840-cd9ca799ba5a | farshadahmadian/webserv | webserv/src/transfer/HttpRequest.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* HttpRequest.cpp :+: :+: :+: ... | WEB | 0.967755 | 4.621553 |
060a356a-80d7-4a1e-bfd0-32a2e2374584 | EdsonMateus1/codigos-em-C-C-faculdade | aula03_sources/Lista02.cpp | #include <stdio.h>
#include <stdlib.h>
// Definio da Estrutura
typedef struct tipo_no no;
struct tipo_no {
int info;
struct tipo_no *prox;
};
void insereInicio(int n, no **inicio);
int main(){
// Inicializao da lista
no *lista = NULL;
// Insere na lista
insereInicio(3, &lista);
inser... | ALGO | 0.996437 | 4.449309 |
8d5ac517-4743-4f14-b0a7-caf1de54d909 | dlwlehd/BOJ_Cpp | Gold_5/14502.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
#define x first
#define y second
int n, m;
int mx = -1;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int board[8][8];
bool vis[8][8];
vector<pi> blank;
void input() {
ios::sync_with_stdio(0);
cin.tie(0);
}
bool oob(int x, int ... | ALGO | 0.999483 | 4.169917 |
8cf16cd8-b2d8-4ca9-8a79-6a1ff0989702 | eric2003/ModernCpp | codes/std/concept/05b/main.cpp | #include <string>
template <typename T>
concept Averagable =
requires(T x, T y){
(x + y) / 2;
};
template <Averagable T>
T Average(T x, T y){ return (x + y) / 2; }
int main(int argc, char* argv[])
{
Average(3, 5);
std::string A{"Hello"};
std::string B{"World"};
Average(A, B);
return 0;
}
| TOOL | 0.9183 | 7.180717 |
3a6a7611-b4a8-4986-a19e-756019142cf8 | JunShimura/CPP2g2022 | list10_2/list10_2.cpp | #include <iostream>
using namespace std;
// 関数テンプレートで定義したgetMin関数
template <class T> T getMin(T a, T b) {
return a < b ? a : b;
}
// main関数
int main() {
// int型のgetMin関数を呼び出す
int a, b, c;
a = 123;
b = 456;
c = getMin(a, b);
cout << c << endl;
// double型のgetMin関数を呼び出す
double x, y, z;
x = 1.23;
y = 4.56;
z... | ALGO | 0.997469 | 4.524656 |
716643d6-1db4-4165-920d-068f0eea7253 | HossamElDeenKamal2003/codeforces-solutions | CodeForces/C++17 (GCC 7-32)/1535A | Fair Playoff/177503428.cpp | #include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
for (int i=0;i<t;i++){
int num1,num2,num3,num4;
cin>>num1>>num2>>num3>>num4;
int max_1=max(num1,num2);
int min_1=min(num1,num2);
int max_2=max(num3,num4);
int min_2=min(num3,num4);
... | ALGO | 0.999426 | 3.570205 |
4c121971-998e-4622-9a8b-36258e8fee43 | TU-Berlin-DIMA/Hawk-VLDBJ | source/lib/cogadb/src/hardware_optimizations/radix_cluster.cpp | #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#define PRIME 1442968193
#include <assert.h>
#include <math.h>
#include <stdint.h>
#include <iostream>
//#include <cstdint>
#include <bitset>
#include <boost/shared_ptr.hpp>
#include <cstring>
#include <vector>
using namespace std;
typedef unsigned int TID;... | ALGO | 0.996411 | 3.907379 |
b537093e-9dd5-402f-8b1a-3986136b6a32 | ehnryx/acm | neerc-2015-moscow-cf100792/e.cpp | //#pragma GCC optimize("O3")
//#pragma GCC target("sse4,avx2,abm,fma,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
//#define FILENAME sadcactus
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ... | ALGO | 0.999855 | 4.524795 |
102dc30c-621f-4597-94f2-1a7a03b50b27 | hyeok00/Algorithms | 프로그래머스/lv1/72410. 신규 아이디 추천/신규 아이디 추천.cpp | #include <string>
#include <vector>
using namespace std;
string solution(string new_id) {
string answer = "";
string my_step1 = new_id;
int len = my_step1.length();
for(int i=0; i<len; ++i)
{
if('A'<=my_step1[i] && my_step1[i]<='Z') // step 1
my_step1[i]=my_step1[i]-'A... | ALGO | 0.999622 | 6.021129 |
bdd9bbc4-043a-4db4-8516-33aad04a3069 | StefanPiscu/competitive-programming-work | programe/other/NorthwestRussia2021Regional2/l.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
bool a[302][302];
bool checkF(int x, int y){
if(y+2>m) return 0;
bool ret=a[x][y+1]&&a[x][y+2]&&a[x+2][y+1];
if(ret){
a[x][y+1]=0;
a[x][y+2]=0;
a[x+2][y+1]=0;
}
return ret;
}
bool checkQ(int x, int y){
if(y<=2) return 0;
bool ret=a[x][y-1]&&a[x][y-... | ALGO | 0.999882 | 3.546794 |
2f5c1641-10e3-45fc-a0ae-2722b7fd4606 | Anshullakhera/DSA-CPP | Tree/Left View of Binary Tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
};
// } Driver Code Ends
/* A binary tree node
struct Node
{
int data;
struct Node* left;
struct Node* right;
Node(int x){
data = x;
left = ... | ALGO | 0.997636 | 7.088707 |
a14ab792-5788-4a6e-bc3f-fe88fd0e5494 | xxcxu/SchoolCode | P2292.cpp | #pragma region
#include <bits/stdc++.h>
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;
using i128 = __int128_t;
using u32 = uint32_t;
using u64 = uint64_t;
#define ep emplace
#define eb emplace_back
#define all(x) x.begin(), x.end()
FILE *fin, *fout, *ferr;
i32 read() {
i32 t = 0, f = 0;
char ch = f... | ALGO | 0.999994 | 5.269797 |
a20eaf32-80c9-4d64-8040-72fc6636f2c0 | suyasho786/LEETCODE_PROBLEMS | 2598-smallest-missing-non-negative-integer-after-operations/2598-smallest-missing-non-negative-integer-after-operations.cpp | class Solution {
public:
int findSmallestInteger(vector<int>& nums, int k) {
int n=nums.size();
unordered_map<int,int>m;
for(int i=0;i<n;i++){
int x=(nums[i]%k+k)%k;
// cout<<x<<endl;
m[x]++;
}
int i=0;
int res=0;
while(i>=0... | ALGO | 0.999946 | 5.376526 |
a543190f-e572-4c0e-bba0-884467c71ad6 | rahul-aggarwal000005/Data-Structures-and-Algorithms | Day-10/Search in Rotated Sorted Array.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int s = 0, n = nums.size();
int e = n-1;
while(s<=e){
int mid = (s+e)/2;
if(nums[mid] == target) return mid;
if(nums[mid] > nums[e]){
if(nums[mid] > target and nums[s] <= ... | ALGO | 0.999968 | 6.318349 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.