uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f126ec44-57ff-42ca-aebb-8a6909827aa3 | parasailteam/coconet-experiments | pytorch/third_party/eigen/unsupported/test/NumericalDiff.cpp | #include <stdio.h>
#include "main.h"
#include <unsupported/Eigen/NumericalDiff>
// Generic functor
template<typename _Scalar, int NX=Dynamic, int NY=Dynamic>
struct Functor
{
typedef _Scalar Scalar;
enum {
InputsAtCompileTime = NX,
ValuesAtCompileTime = NY
};
typedef Matrix<Scalar,InputsAtCompileT... | TEST | 0.974836 | 6.171012 |
6c5303bc-bfbe-41b0-a9b7-2289c1dd49c4 | michaelchanwahyan/boost-1.68.0 | libs/icl/example/user_groups_/user_groups.cpp | /** Example user_groups.cpp \file user_groups.cpp
\brief Shows the availability of set operations on interval maps.
In the example there is a user group 'med_users' of a hosptial staff
that has the authorisation to handle medical data of patients.
User group 'admin_users' has access to administrative ... | ALGO | 0.898173 | 5.334839 |
cba39a61-869f-4fe1-b2fa-54e08b55783f | WilsNTHU/Leetcode | 0276-paint-fence/0276-paint-fence.cpp | class Solution {
public:
int helper(vector<int> &dp, int k, int i){
if(i == 1) return k;
if(i == 2) return k*k;
dp[i] = helper(dp, k, i-1) * (k-1) + helper(dp, k, i-2) * (k-1);
return dp[i];
}
int numWays(int n, int k) {
// vector<int> dp(n+1, -1);
... | ALGO | 0.999982 | 5.193583 |
7793ecaa-d094-4483-a9f3-73b3d6bc66a9 | sunhaotian0122/ACM | 算法竞赛入门经典的代码/算法竞赛入门经典(第二版) 源码/ch11/UVa1658.cpp | // UVa1658 Admiral
// Rujia Liu
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<algorithm>
#include<cassert>
using namespace std;
const int maxn = 2000 + 10;
const int INF = 1000000000;
struct Edge {
int from, to, cap, flow, cost;
Edge(int u, int v, int c, int f, int w):from(u),to(v),... | ALGO | 0.999798 | 4.157038 |
78f276b7-a7c1-42d1-9341-46652094bfd4 | markshih91/CodeNotes | cpp/leetcode/leetcode200_number_of_islands.cpp | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
void DFS(vector<vector<char>> &grid, vector<vector<int>> &mark, int x, int y){
mark[x][y] = 1;
int xi[] = {-1, 1, 0, 0};
int yi[] = {0, 0, 1, -1};
for (int i = 0; i < 4; i++){
int new_x = x + xi[i];
int new_y = y ... | ALGO | 0.999941 | 5.870605 |
3f47812f-8a49-43cc-b016-1d5818edf92e | backengineering/llvm-msvc | libcxx/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
// requires CopyConstructible<Compare>
// Iter
// max_element(Iter first, Iter last, Compare comp);
#include <algorithm>
#include <functional>
#include <random>
#include <cassert>
#include "test_macros.h"
#include... | TEST | 0.886859 | 6.037132 |
c95cead2-a684-4a4c-b89f-e83fd772ec3a | blackstar2000774/C-plus-plus | Unit_2/FunctionOverloading.cpp | #include<iostream>
#include<math.h>
using namespace std;
//function overloading: same function is overloaded on the basis of:
//1. different number of parameters
//2. differnet data types of parameters
int area(int);
int area(int, int);
double area(double);
int main(void)
{
int l,b;
double r;
cout<<"Enter ... | ALGO | 0.99135 | 3.660986 |
276698e6-5164-4417-836c-edad4bd094eb | theyashsolanki/DSA | Recursion/easy/printAllPermutations.cpp | #include <iostream>
#include <utility>
using namespace std;
void solve(string &s, int index = 0) {
if (index == s.size() - 1) {
cout << s << endl;
return;
}
for (int i = index; i < s.size(); i++) {
swap(s[i], s[index]);
solve(s, index + 1);
swap(s[i], s[index]);
}
}
int main() {
stri... | ALGO | 0.999954 | 4.554124 |
86a120ed-e839-4dbd-ac24-d7a8a8d641b3 | ruds18/DSA-Practice | 0268-missing-number/0268-missing-number.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
sort(nums.begin() , nums.end());
//corner case
if(nums[nums.size()-1] != nums.size()) return nums.size();
int ans =-1;
for(int i=0; i<nums.size(); i++){
if(nums[i] != i){
ans = i;
... | ALGO | 0.999899 | 5.400239 |
04018b9c-96af-4164-b3e6-7aa435a5ba87 | northmachine/pat_test | a1076.cpp | #include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;
const int maxv = 1010;
struct node{
int id;
int layer;
};
vector<node> adj[maxv];
bool inq[maxv] = {false};
int BFS(int s,int l){
int numForward = 0;
queue<node> q;
node start;
start.id = s;
start.layer = 0;
q.push(star... | ALGO | 0.999842 | 3.759019 |
59e9382b-2329-4c0b-bf99-b415eaa08fa5 | catalystforimpactfoundation/classphotoid | 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 |
0dc79b70-d792-478a-93ec-95b1f8124902 | tapanprakasht/Competitive-Programming | algorithms/sorting/insertionsort.cpp | #include <iostream>
#include <iomanip>
using namespace std;
void insertionsort(long long a[],long long n)
{
long long key,i,j;
for(i=1;i<n;i++)
{
key = a[i];
j = i-1;
while(j>=0 && a[j]>key)
{
a[j+1] = a[j];
j--;
}
a[j+1] = key;
}
}
int main(){
long long *a,n,i,num;
cin>>n;
a = new long long[... | ALGO | 0.999967 | 3.327346 |
5a41f708-aecb-49bd-8071-24451725f3cf | TimothyHorscroft/competitive-programming | SPPC/reg2021/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, a, b) for (int i=(a); i<(b); ++i)
#define ROF(i, a, b) for (int i=(a); i>(b); --i)
#define vi vector<int>
#define vvi vector<vi>
signed main() {
ios::sync_with_stdio(0), cin.tie(0);
int n, m, k;
cin >> n >> m >> k;
... | ALGO | 0.999982 | 3.920247 |
d9d7b63f-f458-463f-874f-7a8536bfc4f7 | Bergluis/CPlus | Lista 2/2.cpp | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<locale.h>
main()
{
setlocale(LC_ALL,"Portuguese");
float b;
float h;
float area;
printf("Informe a altura do tringulo:");
scanf("%f", &h);
printf("Informe a base do tringulo:");
scanf("%f", &b);
area=(h*b)/2;
printf("A rea do tringulo : %f\n", area);
getc... | ALGO | 0.984403 | 3.542982 |
3ac21904-c303-45ee-ae80-ba4b6976764b | MvPrashant/Cpp_DSA- | DSA/Sorting/2.InsertionSort.cpp | /*Bubble sort can be made adaptive.
that is :the time complexity changes
lowest time -O(n) //Highest -O(n^2);*/
/*In Bubble sort - 1st element is checked with 2nd and if greater its swapped
*/
#include<bits/stdc++.h>
using namespace std;
void swap(int *x, int *y)
{
int temp=*x;
*x=*y;
*y=temp;
}
void I... | ALGO | 0.999941 | 4.648601 |
263e850d-0a32-4335-a016-dc4c5bfebbae | tpurtell/klee | lib/Solver/IncompleteSolver.cpp | #include "klee/IncompleteSolver.h"
#include "klee/Constraints.h"
using namespace klee;
using namespace llvm;
/***/
IncompleteSolver::PartialValidity
IncompleteSolver::negatePartialValidity(PartialValidity pv) {
switch(pv) {
default: assert(0 && "invalid partial validity");
case MustBeTrue: return MustBeFa... | ALGO | 0.996776 | 7.65318 |
61b72566-f675-4adb-8080-aade54c0e111 | LookAt-MeNow/MyCode | STL/algorithm/2_find/find_if.cpp | //所有找年龄大于20的人
/* find(iterator beg, iterator end, value); */
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
//查找自定义数据类型
class Person{
public:
Person(string name,int age,int hight){
this->name = name;
this->age = age;
this->hight = hight;
... | ALGO | 0.987003 | 3.404514 |
ce3bce25-03f0-4f01-9f5f-22359deefe6b | OpenDigitalTwin-Dev/FENGSim | toolkit/Geometry/cgal/examples/Stream_lines_2/stl_triangular_field.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Stream_lines_2.h>
#include <CGAL/Runge_kutta_integrator_2.h>
#include <CGAL/Triangular_field_2.h>
#include <iostream>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 ... | ALGO | 0.984437 | 3.855139 |
51d26729-c7f2-470c-bec0-8fce3f5c229c | Rajeshnds/Competitive-Programming | codeforces/dragonmas/codeforces(c++)_old/Bus_game/main.cpp | #include<bits/stdc++.h>
using namespace std;
int x,y,k,l;
int main(){
cin>>x>>y;
x*=100;y*=10;
while((x>=100&&y>=120)||(x>=200&&y>=20)||(y>=220)){
k=0,l=0;
if(x>=200)l=200,x-=200;
else if(x>=100)l=100,x-=100;
if(y>=220-l)k=1,y-=(220-l);
if(k){
l=0;
... | ALGO | 0.999308 | 3.211663 |
5a7c0752-75d5-4b45-be47-b9d5b3b6ee0e | shweta281/cpp | longestSquareStreakInAnArray.cpp | class Solution {
public:
// 2 3 4 6 8 16
int longestSquareStreak(vector<int>& nums) {
int n = nums.size();
unordered_map<int, int> map;
for (int i = 0; i < n; i++){
map[nums[i]]++;
}
int ans = -1;
sort(nums.begin(), nums.end());
for (int i = 0; i <... | ALGO | 0.999965 | 5.370134 |
3d5318d3-1b0d-4930-ac2f-591b67010090 | MSzleag/KursC- | Zadanie_3/Zadanie_3/Zadanie_3.cpp | #include <iostream>
using namespace std;
string board[3][3] = { {"1", "2", "3"},{"4", "5", "6"},{"7", "8", "9"} };
bool winning = false;
bool tie = false;
string currentPlayer = "X";
int input;
static void Render() {// Render current game Board in console and print which player won or if it is a tie
system("cls");
... | ALGO | 0.974716 | 4.855573 |
f40f4d9e-bace-428d-8260-ab768c38868e | EPFLRocketTeam/WildhornAV | CA7/hostproc_app/inc/unsupported/doc/examples/MatrixSinh.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXf sinhA = A.sinh();
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
MatrixXf coshA = A.cosh();
std::cout << "cosh(A) = \n"... | ALGO | 0.993818 | 5.914005 |
cb3cce61-d811-4294-84d6-4e64d1e37efc | josestg/prakASD18ITERA | pertemuan3/soal3.cpp | #include "list.cpp"
infotype max (List L){
/* Mengirimkan nilai Info(P) yang maksimum */
int max = -Infinity;
address P = First(L);
while(...(22)...){
if(max<Info(P))
...(23)...
P=Next(P);
}
return max;
}
infotype min (List L){
/* Mengirimkan nilai Info(P) yang minimum */
int min = Infinity;
address P... | ALGO | 0.999867 | 3.826147 |
4e588710-9016-40a8-b92e-ce6db64d296d | hzcool/rust-judger | src/cpp_runner/runner.cpp | #include <unistd.h>
#include <cstring>
#include <thread>
#include <sys/wait.h>
#include <sys/resource.h>
#include <iostream>
#include "runner.h"
#include "rule.h"
#include "status.h"
#include "result.h"
char* copy_c_str(const char* s) {
char* p = new char[strlen(s) + 1];
strcpy(p, s);
return p;
};
Runner... | TOOL | 0.880148 | 4.210896 |
0c47b38f-5d20-46eb-bb56-e11d5132a113 | Hironobu-okubo/AtCoder | APG4b/ch03/3-2Sample2.cpp | #include <bits/stdc++.h>
using namespace std;
/* alias */
using ull = unsigned long long;
using ll = long long;
using vi = vector<int>;
using vl = vector<long>;
using vll = vector<long long>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvll = vector<vll>;
using vs = vector<string>;
using pii = pair<int, int>;... | ALGO | 0.998962 | 3.171374 |
e8d2fb27-8bf0-4fa1-8a1c-66d28a1e4781 | janetian/study | Jane_CIS22C/Midterm/Midterm/Source.cpp | // Jie Tian
#include <iostream>
#include <string>
#include "Array.h";
using namespace std;
// find the largest item in the array
template <class ItemType>
int findLargest(Array<ItemType> theArray, int size)
{
int index = 0;
for (int i = 1; i < size; i++)
{
if (theArray[i] > theArray[index])
{
index = i;
... | ALGO | 0.99851 | 4.908052 |
c5ae2ee8-4c37-4666-b712-e608d9885875 | hyeongseok21/algorithm-codesignal | Interview_Practice/Special_Topics/Common_Techniques_Advanced/getSkyline.cpp | vector<vector<double>> solution(vector<vector<double>> buildings) {
vector<vector<double>> ans;
multiset<double> pq{0};
// (points, height)
vector<pair<double, double>> points;
for(int i = 0; i < buildings.size(); ++i) {
double l = buildings[i][0];
double r = l + buildings[i][1]... | ALGO | 0.999991 | 5.768131 |
8805f0b3-98a8-4c73-97d3-90c12841f456 | Amar-Manjarathkar/LeetCode-Daily_Challenges | Count Number of teams.cpp | class Solution {
public:
int numTeams(vector<int>& rating) {
int n = rating.size();
int count = 0;
for (int mid = 1; mid < n - 1; ++mid) {
int leftSmallerCount = 0, rightGreaterCount = 0;
for (int i = 0; i < mid; ++i) {
if (rating[i] < rating[mid]) {
... | ALGO | 0.999915 | 5.751737 |
1fc8fa9e-d224-46e9-95a2-0dc4d5ba1256 | comdetective-tools/hpctoolkit_backup | src/lib/analysis/Util.cpp | // -*-Mode: C++;-*-
//***************************************************************************
//
// File:
// $HeadURL$
//
// Purpose:
// [The purpose of this file]
//
// Description:
// [The set of functions, macros, etc. defined in the file]
//
//*************************************************************... | TOOL | 0.892716 | 3.177362 |
5a70141a-3fa7-41b5-a422-37807f7b8ae1 | sarvex/leetcode-pascal | solution/2200-2299/2264.Largest 3-Same-Digit Number in String/Solution.cpp | class Solution {
public:
string largestGoodInteger(string num) {
for (char i = '9'; i >= '0'; --i) {
string t(3, i);
if (num.find(t) != string::npos) return t;
}
return "";
}
}; | ALGO | 0.999826 | 6.228439 |
4395d58c-fabc-42a7-b5cc-2288f2bb778f | elokIedfitra/GameTebakAngka | 191015 (tebak angka)/tebak_angka/main.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#define MINACAK 1
#define MAXACAK 10
using namespace std;
int main()
{
srand (time(NULL));
int angka = (rand()%(MAXACAK-MINACAK+1))+MINACAK;
cout << "Selamat datang di Permainan Tebak Kata" << endl;
cout << "====================================... | TOOL | 0.923996 | 3.984551 |
2db26765-e939-48c3-9d7d-1134b81a55c8 | im2sh/Algorithm | Solve/DP/2491 : 수열.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int N, maxNum = -1;
int arr[100001], bdp[100001], mdp[100001];
void FastIO() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
void Init() {
cin >> N;
}
void solve() {
for (int i = 0; i < N; i++) {
bd... | ALGO | 0.999988 | 4.761336 |
9db9d11b-a4ff-452e-9289-dd9cf571095d | okcd00/CDKeeper | Online_training/2020 HDU_MUTC/杭电多校2020 第1场/Codes/Submissions/hunting-monsters-standard.cpp | #include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int ncase, nsum = 0;
for (assert(cin >> ncase); ncase--; ) {
int n; assert(cin >> n);
nsum += n;
assert(n > 0 && n <= 300000);
vector<pair<int, int>> p(n + 1), A, B;
for (i... | ALGO | 0.999877 | 3.882003 |
26336142-964c-4951-8b9e-7b79c2681208 | HoangDung03/CppPTIT | chuvi_hinhtron.cpp | #include<iostream>
using namespace std;
int main() {
double r;
cin >> r;
cout << "Chu vi hinh tron P = " << (r*2)*3.14;
return 0;
}
| ALGO | 0.999541 | 3.684607 |
41d021d7-682b-48ef-94cb-dfb0d420fb99 | balabit-deps/balabit-os-9-llvm-toolchain-14 | libcxx/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp | // <algorithm>
// template<ForwardIterator Iter>
// requires OutputIterator<Iter, Iter::reference>
// && EqualityComparable<Iter::value_type>
// constexpr Iter // constexpr after C++17
// unique(Iter first, Iter last);
#include <algorithm>
#include <cassert>
#include <memory>
#include "test_macr... | TEST | 0.962227 | 6.683553 |
f8e78632-18c1-4a84-8450-6212030c9123 | tanvi2100/LeetCode-Solutions | 414.cpp | class Solution {
public:
int thirdMax(vector<int>& a) {
int n = a.size();
unordered_map<int,int>m;
priority_queue<int,vector<int>,greater<int>>p;
for(int i=0;i<n;i++){
m[a[i]]++;
if(m[a[i]]==1){
p.push(a[i]);
if(p.size()>3){
... | ALGO | 0.999856 | 5.270222 |
bada611c-693a-4be3-9142-287d3bfbaaff | JordanUA/CPP_Practical_Works | cpp_practice#7/cpp_ex1.cpp | #include <iostream>
int main() {
std::cout << "Enter a natural number: ";
int c0;
std::cin >> c0;
int steps = 0;
std::cout << "Collatz sequence for " << c0 << ": " << c0 << std::endl;
while (c0 != 1) {
if (c0 % 2 == 0) {
c0 /= 2;
} else... | ALGO | 0.999944 | 5.468422 |
2ca877eb-dd2f-4118-9edc-7a56de61f2d0 | hathu2004/thuat-toan | buoi3.2.cpp | #include <iostream>
using namespace std;
long long fib(int n)
{
long long f[n+1];
f[0]=0;
f[1]=1;
for(int i=2;i<=n;i++)
{
f[i]=(f[i-1]+f[i-2])%1000000007;
}
return f[n];
}
int main()
{
int n;
cin>>n;
cout<<fib(n);
return 0;
}
| ALGO | 0.99997 | 4.636131 |
811cfb85-b97c-41db-a345-93531ba6eee8 | musnows/Lets-OJ | oj/musnow/newcoder/星际密码.cpp | // write your code here cpp
#include<iostream>
#include<vector>
using namespace std;
//不能用递归,内存超限
// int fib(int a)
// {
// if(a<=2)
// {
// return 1;
// }
// return fib(a-1)+fib(a-2);
// }
#define SIZE 10001
int main()
{
//初始化一个斐波那契数列
vector<int> v;
v.resize(SIZE);
v[0]=v[1]=v[... | ALGO | 0.999522 | 4.610677 |
3d921623-bdb0-4ec4-861c-d229b9b4ecbb | aadityaa-g18/DSA | BinarySearch/FirstAndLastOccurence.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> firstAndlast(vector<int> &arr,int n, int k){
int s = 0;
int e = n - 1;
int firstOccurence = -1;
int lastOccurence = -1;
while(s<=e){
int mid = s + (e-s)/2;
if(arr[mid]==k){
firstOccurence = mid;
e = mi... | ALGO | 0.999976 | 4.902246 |
ae60360f-6ba1-4e8d-b779-fd28934a73d6 | VDJartnet/VDJartnet | src/Config.cpp | #include "Config.hpp"
#include "defaultPresets.h"
Config::Config(std::string configPathTMP) {
configPath = configPathTMP;
loadConfig();
}
void Config::loadConfig() {
std::ifstream fin(configPath);
if (fin.is_open()) {
for (std::size_t i = 0; i < 512; i++) {
channelCommands[i] = {""... | CONFIG | 0.921206 | 5.837553 |
b4fe3af6-3172-454e-a381-5d40512956cd | ishandutta2007/codeforces | hmspmy077/normal/840/B.cpp | #include <cstdio>
#include <cstring>
#include <vector>
const int N = 300000;
int d[N], cur[N], head[N], to[N << 1], next[N << 1];
bool visited[N];
std::vector<int> ans;
void dfs(int pre, int u)
{
visited[u] = true;
for (int it = head[u]; ~it; it = next[it]) {
if (!visited[to[it]]) {
dfs(i... | ALGO | 0.999948 | 3.871329 |
d4a2790c-22f3-4447-bf0b-ad5dc7119a15 | andrew-kovalenk0/code | stack.cpp | #include "pch.h"
#include <iostream>
using namespace std;
struct stack {
int inf;
stack *next;
};
void ad(stack **top, int value) {
stack *q = new stack();
q->inf = value;
if (top == NULL) {
*top = q;
}
else {
q->next = *top;
*top = q;
}
}
int read(stack *top) {
stack *q = top;
return q -> inf;
}
v... | ALGO | 0.999243 | 3.958781 |
139fb3cf-e813-4cd7-8f34-3fa852f10f90 | ishandutta2007/codeforces | ngfam/normal/1101/E.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n; cin >> n;
vector < pair < int, pair < int, int > > > vec(n);
vector < int > num;
for(auto &p : vec) {
char c;
cin >> c >> p.second.first >> p.second.second;
p... | ALGO | 0.999979 | 3.839939 |
908ac51f-4659-4f40-b237-b20e2afdd87d | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7152_13.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int n = s.length();
int a[n + 2][3];
for (int i = 0; i < n + 1; i++)
for (int j = 0; j < 3; j++) a[i][j] = 0;
for (int k = 0; k < s.length(); k++) {
if (s[k] == '.')
continue;
else if (s[k] == 'A') {
a[k][... | ALGO | 0.999902 | 3.857816 |
2a7bfb20-e4c0-43ff-bb25-b467b098fb6e | liudeda/work | c++base/8函数模板/1.cpp | #include <iostream>
using namespace std;
template <typename T>
void my_swap(T &a, T &b)
{
T temp = a;
a = b;
b = temp;
}
int main()
{
int a = 1;
int b = 2;
my_swap(a, b);
cout << "a=" << a << " "
<< "b=" << b << endl;
float fa = 1.1;
float fb = 2.2;
my_swap(fa, fb);
... | ALGO | 0.979608 | 4.079093 |
2234c93e-8e24-4a81-83a7-e7fb68fcd6d2 | H451B/problem_solving | test_burenka.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b,c,d,e;
cin>>a;
while(a--){
cin>>b>>c;
// if(c%4==0){cout<<"NO\n";}
if(c==0){cout<<"NO\n";}
else if(c%2!=0){
cout<<"YES\n";
d=1;e=2;
for(int i=0;i<b/2;i+=1){
... | ALGO | 0.999475 | 3.279961 |
628080f2-39a8-4b28-bd36-77985439b5d8 | ravi2320/GFG-POTD | 364. Stock span problem.cpp | /*
Stock span problem
Difficulty: MediumAccuracy: 43.56%Submissions: 205K+Points: 4
The stock span problem is a financial problem where we have a series of daily price quotes for a stock and we need to calculate the span of stock price for all days. The span arr[i] of the stocks price on a given day i is defined as the... | ALGO | 0.999997 | 7.20113 |
b5234a1a-e774-416b-a7d6-233729ecb790 | wwk1498/VS2022Project01 | Project1/数据结构和算法/双边快排(随机).cpp | /*
*
˫ѭҪ:
1.ѡԪΪ
2.jұȻСģiұȻģһҵ߽н
i
j
3.iiΪ
ע:
1.ڲѭi<j
2.ȴjٴi
3.ԪΪ㣨Ӱ죩
4.дظԪ
*/
#include<iostream>
#include<random>
using namespace std;
//
int random1(int a,int b) {
//
random_device rd;
mt19937 gen(rd());
// ȷֲ
uniform_int_distribution<> dis(a, b);
//
int randomNum = dis(gen);
return... | ALGO | 0.99986 | 3.866152 |
d3a7ae9c-ed16-4a73-8dc1-9dc759d0c595 | Dilip-kumar159/Data-Structure-In-C-plus-plus | Recursion/CheckPalindrome.cpp | #include<iostream>
#include<string>
using namespace std;
bool checkPalindrome(string str, int s, int e){
if(s > e) return true;
if(str[s] != str[e]) return false;
return checkPalindrome(str, s+1, e-1);
}
int main(){
string str;
cout<<"Enter the string -> "<<endl;
cin>>str;
int start =... | ALGO | 0.99975 | 4.879725 |
c0d09253-eb46-4bfe-81b5-37a74ab37f1a | dulte/Comp-Phys | Project4/Project4_Daniel/main.cpp | #include <iostream>
#include <armadillo>
#include <cmath>
#include <random>
#include <fstream>
#include <ctime>
#include <mpi.h>
using namespace std;
using namespace arma;
void output(ofstream & file, vec & expecVal, int Nspin, double temp, double MCsteps);
void metropolis(double Nspins,double MCSteps, double temp, m... | ALGO | 0.998664 | 4.23993 |
8a68e746-6322-47f7-86f9-124d76aa858d | satyams8092/GeeksforGeeks | Difficulty: Medium/Activity Selection/activity-selection.cpp | class Solution {
public:
int activitySelection(vector<int> &start, vector<int> &finish) {
// code here
vector<pair<int, int>>arr;
for(int i=0; i<start.size(); i++){
arr.push_back({start[i], finish[i]});
}
sort(arr.begin(), arr.end());
... | ALGO | 0.999847 | 5.768201 |
838285a6-8427-4a41-9aa6-d3b9dd90a978 | chrisbmatthews/rpgtoolkit | vc/trans3/misc/misc.cpp | /*
* Inclusions.
*/
#include "misc.h"
#include "../common/player.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <vector>
#include <sstream>
/*
* Definitions.
*/
#define KEY_TRANS3 _T("Software\\VB and VBA Program Settings\\RPGToolkit3\\Trans3")
/*
* Split a string.
*/
void split(const STRING str, ... | TOOL | 0.946522 | 6.081237 |
0b59b822-04cb-40dc-b9e7-703bd056a3b2 | mimipaskova/IP_SI_2015 | 2015.12.10_9_Pointers/Demo2_arrays/demo.cpp | #include <cstdio>
using namespace std;
int * func(int* arr){
for(int i=0;i<10;i++){
arr[i]++;
}
return arr;
}
int main()
{
int a[10]={1,2,3,4,5,6,7,8,9,10};
int* b = func(a);
for(int i=0;i<10;i++){
printf("%d",b[i]);
}
return 0;
}
| ALGO | 0.98473 | 3.113662 |
7e0a40b2-8f0d-40e6-ab9f-c69b2687e118 | deadhit-7081/C-plusplus | linklist.cpp | #include<iostream>
using namespace std;
class list_element
{
public:
list_element(int n=0,list_element* ptr = 0):d(n),next(ptr){}
int d;
list_element* next;
};
class list
{
private:
list_element* head;
list_element* cursor;
public:
list():head(0),cursor(0){}
void prepend(int n)... | ALGO | 0.984934 | 3.629228 |
33d935dc-8792-4bfe-ac7a-cc29d91e0722 | abdullahjohar23/newcomer-sheet-solutions | Sheet 4/Q. Reverse Words.cpp | // Codeforces Handle: Abdullah_Johar
// Newcomer Sheet 4: Q. Reverse Words
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
... | ALGO | 0.999989 | 4.581635 |
e4f29ce9-14df-42a6-91bd-c7f688be6f44 | andeplane/AtomifyVisionPro | LAMMPS/src/LEPTON/pair_lepton_coul.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "pair_lepton_coul.h"
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "force.h"
#include "nei... | ALGO | 0.993004 | 6.541265 |
7b388832-4b9d-4721-9e7e-47ab2d6c205a | youngsam-byun/my-notes.github.io | leetcode/src/test/java/Stack/2030.Smallest-K-Length-Subsequence-With-Occurrences-of-a-Letter/2030.Smallest-K-Length-Subsequence-With-Occurrences-of-a-Letter.cpp | class Solution {
public:
string smallestSubsequence(string s, int k, char letter, int repetition)
{
int k0 = s.size() - k;
int count = 0;
for (auto ch: s)
if (ch==letter) count++;
int k1 = count - repetition;
int count0 = 0; //the total number of let... | ALGO | 0.999976 | 5.331274 |
28b32ac8-f97d-4312-8c58-ecde06ac2dda | XuHuiWen12138/leetcode | 重复的子字符串.cpp | class Solution {
public:
bool repeatedSubstringPattern(string s) {
for (int a = 0; a < s.size() / 2; a++) {
if (s.size() % (a + 1)) {
continue;
}
int c = s.size() / (a + 1);
bool flag = true;
for (int j = 0; j < c-1; j++) {
... | ALGO | 0.999825 | 5.660782 |
1846f9b3-da43-41ef-b1b4-92203df36ad3 | shristysingh996/cpp-program | nested for loop1.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter the number of elements in the array: ";
cin >> n;
int arr[100];
cout << "Enter " << n << " elements:\n";
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
cout << "Duplicate elements are:\n";
for (i... | ALGO | 0.996034 | 4.7722 |
89b182cc-b997-49c1-b4a1-755f8e25a261 | mrparth23/Codes | CodeForces/219A.cpp | #include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#define mod 1000000007
#define Debug(x) cout << '>' << #x << ':' << x << endl;
#define FOR(i, a, b) for (long long int i = (a); i < (b); i++)
#define REP(i, a) for (long long int i = (0); i < (a); i++)
const int INF = 1 << 29;
typedef l... | ALGO | 0.999983 | 4.134132 |
104334e7-c3c8-4708-9be7-564cb5686540 | reznord/Data-Structures | AVLTree.cpp | #include<iostream>
using namespace std;
int flag=0;
class node
{
public:
int d;
node *l;
node *r;
int c;
node(int el)
{
d=el;
l=r=0;
c=0;
}
};
class list
{
public:
node *root;
list()
{
root=0;
}
void ins(int el,node *&p)
{
if((p==0)&&(flag==0))
{
root=new node(el... | ALGO | 0.999907 | 3.895463 |
8139a689-32e5-4d0f-bbc4-ac4ce3599655 | vitorcodesalittle/simulador-dfsa | simulador/src/main.cpp | #include <iostream>
#include<chrono>
#include <map>
#include <fstream>
#include "config.h"
#include "Estimator.h"
#include "Simulador.h"
using namespace std;
Estimator* create_estimator(const string &estimatorName, const ExperimentConfig &c) {
if (estimatorName == "lb") {
return new LowerBoundEstimator();... | ALGO | 0.910879 | 4.127485 |
73d938c6-dec8-4ff4-892c-34225354441e | akshat-x64/CPP-programming-practice | 04_18_pattern.cpp | // printing pattern
#include<iostream>
using namespace std;
int main(int argc, char const *argv[])
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (i>=j)
{
cout<<"*";
}
}
cout<<endl;
}
... | ALGO | 0.999839 | 3.233089 |
ee16865c-6628-4cb5-a539-f2fa164e0796 | rayz1065/competitive-programming | advent_of_code/2019/day_16/main.cpp | #include <iostream>
#include <cstring>
#include <assert.h>
#define MAXL 700
#define PART_2_SIZE 600000
#define DEFAULT_PATTERN_LEN 4
#define ITERATIONS 100
using namespace std;
int len(char str[]){
int i = 0;
while(i < MAXL && str[i] != '\0')
i++;
return i;
}
int default_pattern[] = {0, 1, 0, -1}... | ALGO | 0.999801 | 3.928099 |
b73c1851-edc3-4a12-9c89-78f4d50bec36 | NoobCoder2k24/Level-up-from-1star-to-2star | Sorting/Maximise_the_Subsequence_Sum.cpp | #include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <ioman... | ALGO | 0.999923 | 4.703404 |
dc0d2f4e-dee5-42eb-b85a-2eb1127b8fb0 | ishandutta2007/codeforces | endagorion/normal/1209/C.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define... | ALGO | 0.999807 | 4.375503 |
a800c821-4339-4bc2-a050-075e4ebaa31e | HarshYadav175/Leetcode-Questions | 0779-k-th-symbol-in-grammar/0779-k-th-symbol-in-grammar.cpp | class Solution {
public:
int kthGrammar(int n, int k) {
if(k == 1 || n == 1){
return 0;
}
int mid = pow(2, n-1)/2;
if(k<=mid){
return kthGrammar(n-1, k);
}
else{
return !kthGrammar(n-1, k-mid);
}
... | ALGO | 0.999982 | 6.158347 |
fb63ce48-c48f-49ba-a1ab-5d9a24d867dd | ishandutta2007/codeforces | box/normal/53/A.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
string b; string t;
int main() {
cin >> t; int n; cin >> n;
while(n--) {
string v; cin >> v;
if(v.length() < t.length()) continue;
bool ok = true;
for(int i=0; i<t.length(); i++) {... | ALGO | 0.999934 | 4.942063 |
da2c34ba-bfd5-4a4b-8c78-189c1a8c3243 | Hiyabye/Baekjoon | 32xxx/32297.cpp | #include <iostream>
#include <string>
using namespace std;
bool solve(void) {
int n; cin >> n;
string s; cin >> s;
return s.find("gori") != string::npos;
}
int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << (solve() ? "YES" : "NO");
return 0;
} | ALGO | 0.997676 | 3.446675 |
6c7edbb7-b74a-4e35-8fb5-e16287ec187f | trinhminhtriet/leetcode | solutions/1100-1199/1156.swap-for-longest-repeated-character-substring/Solution.cpp | class Solution {
public:
int maxRepOpt1(string text) {
int cnt[26] = {0};
for (char& c : text) {
++cnt[c - 'a'];
}
int n = text.size();
int ans = 0, i = 0;
while (i < n) {
int j = i;
while (j < n && text[j] == text[i]) {
... | ALGO | 0.999982 | 5.989851 |
e9277507-d532-4c84-8162-56c30524588c | ishandutta2007/codeforces | maroonrk/normal/963/B.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
... | ALGO | 0.999982 | 4.170784 |
62cbe72f-d5f1-4533-b828-ec9cd012054c | mynew5/Script-Land | Blizzlike/Arkcore/C++/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp | /* ScriptData
SDName: Boss_The_Best
SD%Complete: 100
SDComment:
SDCategory: Blackrock Spire
EndScriptData */
#include "ScriptPCH.h"
#define SPELL_FLAMEBREAK 16785
#define SPELL_IMMOLATE 20294
#define SPELL_TERRIFYINGROAR 14100
class boss_the_beast: public CreatureScript {
public:
... | TOOL | 0.871806 | 5.620567 |
f0590d1b-768e-4573-96e6-7fc5a95a20ce | shakilahamedriaz/Codeforces_Solutions | 431A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long int a,b,c,d;
char s[100001];
while(cin>>a>>b>>c>>d)
{
cin>>s;
int ans=0;
for(int i=0;i<strlen(s);i++)
{
if(s[i]=='1')
ans+=a;
else if(s[i]=='2')
... | ALGO | 0.995465 | 3.717339 |
4cbaf380-6c0a-490a-a24b-3f6ac40c862b | ahmed-azizz/women_safety_application | 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.998762 | 6.786404 |
52a127f9-2b23-4c19-bf27-b847669ccf3c | Archit-555/181internship2k24 | 55.cpp | #include<iostream>
#include<stack>
using namespace std;
int main(){
stack<int> s;
int choice,element;
while(true){
cout << "\n1. size of the stack"
<< "\n2. insert element into the stack"
<< "\n3. Delete element from the stack"
<< "\n4. Top element of the stac... | TOOL | 0.933475 | 3.73495 |
a1350961-c9e9-494c-be73-255660b08411 | ferin-15/program_contest_library | generate/random_tree.cpp | vector<pair<int,int>> random_tree(int n, unsigned seed1 = 1, unsigned seed2 = 2) {
random_set<int> t(seed1), g(seed2);
vector<pair<int,int>> edges;
for(int i=0; i<n; ++i) g.insert(i);
t.insert(g.pop_random());
for(int i=0; i<n-1; ++i) {
int u = t.random();
int v = g.pop_random();
... | ALGO | 0.894595 | 4.98105 |
8f3a23a5-c63e-4ccb-b036-94c56d67c03e | ishandutta2007/codeforces | tlewpdus/normal/1530/F.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 31607;
int ipow(int a, int n) {
if (!n) return 1;
int t = ipow(a,n/2);
return t*t%MOD*(n%2?a:1)%MOD;
}
int N;
in... | ALGO | 0.999957 | 3.749029 |
5baa8690-6ece-4781-bd6c-beec550937ba | bigbiff/android_bootable_recovery | otautil/rangeset.cpp | #include "otautil/rangeset.h"
#include <limits.h>
#include <stddef.h>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <android-base/logging.h>
#include <android-base/parseint.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
RangeSet::RangeSet(std::vect... | TOOL | 0.891 | 7.344985 |
ff89aa5d-6bcc-4fc9-8ba1-9289ab59691d | sinian666/codes_86_2 | cpp_副本24/chapter_tree/binary_tree_dfs.cpp | /**
* File: binary_tree_dfs.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
// 初始化列表,用于存储遍历序列
vector<int> vec;
/* 前序遍历 */
void preOrder(TreeNode *root) {
if (root == nullptr)
return;
// 访问优先级:根节点 -> 左子树 -> 右子树
vec.push_back(root->val);
preOrder... | ALGO | 0.999614 | 6.116714 |
4caa15e9-3b9a-4f7a-89ab-a6e69e552d7b | lelembut599/Praktikum_SSDAA | Proyek_Akhir_SDAA/Proyek_Akhir_B2_K4.cpp | #include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
using namespace std;
struct alatPendakian {
int idAlat;
string nama;
int harga;
bool isUpdated; // Menandai apakah alat ini merupakan update atau alat baru
bool isAcc; // Menandakan apakah alat sudah di-A... | TOOL | 0.988955 | 4.054068 |
8b3f5a59-3905-452e-9c06-018761cc132a | cccc1412/oceanbase-2022 | src/storage/memtable/ob_row_compactor.cpp | #include "share/config/ob_server_config.h"
#include "lib/stat/ob_diagnose_info.h"
#include "ob_row_compactor.h"
#include "storage/memtable/mvcc/ob_mvcc_row.h"
#include "storage/memtable/ob_memtable.h"
#include "storage/memtable/ob_memtable_data.h"
#include "storage/memtable/ob_memtable_compact_writer.h"
#include "stora... | TOOL | 0.885475 | 6.934771 |
4d84e6e9-0867-44db-9052-db46d2a89664 | liuxiang09/C_Code | binary_tree/inorderTraversal.cpp | #include <iostream>
#include <vector>
using namespace std;
// 定义二叉树节点的结构体
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
// 中序遍历函数
void inorderTraversal(TreeNode *root) {
if (root == NULL) return;
// 递归访问左子树
inorderTraver... | ALGO | 0.999906 | 5.980674 |
d274814a-9802-4acb-9fff-36900dd85e32 | ZengYuming/openjdk7 | openjdk/hotspot/src/share/vm/code/compressedStream.cpp | #include "precompiled.hpp"
#include "code/compressedStream.hpp"
#include "utilities/ostream.hpp"
// 32-bit one-to-one sign encoding taken from Pack200
// converts leading sign bits into leading zeroes with trailing sign bit
inline juint CompressedStream::encode_sign(jint value) {
return (value << 1) ^ (value >> 31)... | TOOL | 0.912505 | 6.411739 |
e1a37c01-59cb-4abf-940f-f674658e84b8 | nczhang88pan/KlotskiSGX | klotski/llvmProgram/libcxx/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class piecewise_linear_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <vector>
#include <iterator>
#include <numeric>
#include <algorithm> // for sort
#include <cassert>
#include <limits>... | ALGO | 0.999602 | 4.43274 |
9b0c9e13-8e55-4221-9cc7-7bc43b9e6b18 | ishandutta2007/codeforces | niyaznigmatul/normal/1037/D.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<vector<int> > edges(n);
vector<int> r(n), order(n), was(n), q(n);
for (int i = 0; i + 1 < n; i++) {
int x, y;
cin >> x >> y;
--x;
--y;
edges[x].push_back(y);
edges[y]... | ALGO | 0.999999 | 4.571589 |
0e730635-b6f1-4173-a1fd-10636a8ab6da | TammyAlok2/Dsa-150-Days | POTD/GFG/DEC_15_2023-reach-then-point.cpp | int mod=1e9+7;
int solve(int i, int n, vector<int>&dp){
if(i==n) return 1;
if(i>n) return 0;
if(dp[i]!=-1) return dp[i];
int one=solve(i+1, n, dp);
int two=solve(i+2, n, dp);
return dp[i]=(one+two)%mod;
}
int nthPoint(int n){
// Code here
v... | ALGO | 0.999984 | 4.868649 |
75eb050b-b084-44d1-8ab5-fcf80d92fd55 | Dwikaputra11/CPP-Project | Competitive/uajy_bunga.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main(){
double harga, jCicil,uang;
cin >> harga >> jCicil >> uang;
double cicil = harga - uang;
cicil /= jCicil;
cicil += (cicil * 10)/floor(100);
cicil = floor(cicil);
cout << cicil;
} | ALGO | 0.997128 | 3.325956 |
923730c0-dc36-4adc-8ca7-c33459b216a8 | Pranta-Saha/codeforces-solved | 1068B.cpp | #include<bits/stdc++.h>
using namespace std;
long long countDivisors(long long n)
{
long long cnt = 0;
for (long long i = 1; i <= sqrt(n); i++) {
if (n % i == 0) {
if (n / i == i)
cnt++;
else
cnt = cnt + 2;
}
}
return cnt;
}
int ... | ALGO | 0.999561 | 4.905641 |
525c4983-24ca-4432-b075-f1611f535425 | IssaPortfolio/Fall-2022 | ovop/Source.cpp | #include <iostream>
#include "rectangleType.h"
using namespace std;
// A
rectangleType operator++(rectangleType& rectangle) {
double width = rectangle.getWidth();
double length = rectangle.getLength();
++width;
++length;
rectangle.setDimension(length, width);
return rectangle;
}
// A
rectangleType operator++(re... | ALGO | 0.97768 | 3.990292 |
e0a40dd4-ed3c-4166-80d8-c1ccc2ee9ce9 | Godhuli11/My-LeetCode-questions | 0513-find-bottom-left-tree-value/0513-find-bottom-left-tree-value.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999994 | 6.143424 |
45b38f14-ef9f-4ac8-bad9-911a7b247b92 | AryamannNingombam/competitive-programming-practice | ary_amann/leetcode/sorting-and-searching/top-k-frequent-elements.cpp | class Solution
{
public:
vector<int> topKFrequent(vector<int> &nums, int k)
{
map<int, int> hash;
for (auto &i : nums)
hash[i]++;
vector<int> result;
priority_queue<pair<int, int>> heap;
for (auto i = hash.begin(); i != hash.end(); i++)
{
h... | ALGO | 0.999983 | 6.112356 |
623b2da9-b9b5-4378-8e6f-9c225f2d48c0 | CarterFitzsimons/CompositeImage-cfitzsimons1 | CompositeImage-cfitzsimons1-master/main.cpp | //Author: Carter Fitzsimons
#include <iostream>
#include "bitmap.h"
#include <string>
#include <vector>
/*So the program doesn't currently work, but all of the funcitons are bilt. I was able to successfully turn each pixels rgb values to 0
but whenever I tried to modify and add the rgb values from allImages[i] to the ... | TOOL | 0.943105 | 3.589943 |
e63fdb46-94ae-468e-b691-3456d6d484ac | raincross7/code-similarity | codes/train_code/problem199/problem199_442.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,M;cin>>N>>M;
priority_queue<int>A;
for(int i=0;i<N;i++){int a;cin>>a;A.push(a);}
for(int i=0;i<M;i++){
long long a=A.top();
A.pop();
A.push(a/2);
}
long long ans=0;
for(int i=0;i<N;i++){ans+=A.top();A.pop();}
cout<<ans<<endl;
} | ALGO | 0.999908 | 3.549177 |
5dda7043-e289-4060-ae5d-7c38cdda39e8 | ishandutta2007/codeforces | 175iq/normal/1151/B.cpp | #include <bits/stdc++.h>
using namespace std;
//Utility functions
#define pb push_back
#define sz size()
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
//Constants
#define EPS 1e-8
#define INF 0x3f3f3f3f
//Printing
#define coutRV(a,L,R) FE(i,L,R) cout<<a[i]<<" \n"[i==R] ;
#define coutV(a... | ALGO | 0.999935 | 3.619654 |
c5f437d6-087d-45df-b41d-c124e2dc501b | ishandutta2007/codeforces | kevinyang/normal/1469/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int t;
cin >> t;
while(t--){
int n,k;
cin >> n >> k;
vector<int>arr(n);
for(int i = 0; i<n; i++){
cin >> arr[i];
}
bool f = true;
int prevmx = arr[0]; int prevmn = arr[0];
... | ALGO | 0.999974 | 4.556342 |
10ebabbf-7aaf-428d-aa0f-c48542818b91 | qinjingyuan/gem5 | src/systemc/tests/systemc/misc/cae_test/general/control/loop/while_fsm/while_fsm.cpp | /*****************************************************************************
while_fsm.cpp --
Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-29
*****************************************************************************/
/****************************************************************************... | ALGO | 0.984224 | 3.464247 |
6f377d5d-3e30-4aab-a5ff-6a584986cf07 | hjiang13/LLMs-in-IR | POJ-104/90/2640.cpp | #include <iostream>
using namespace std;
int num(int m, int n)
{
if(m <= 1) return 1;
if(n == 1) return 1;
int sum = 0, i;
for(i = 1; i <= n; i++)
{
if(i > m) break;
sum += num(m - i, i);
}
return sum;
}
int main()
{
int n, i;
cin >> "%d", &n);
for(i = 0; i < n; i++)
{
int M, N;
cin >> "%d%d", &M, &N);
int r = num(... | ALGO | 0.999919 | 3.961739 |
e1ef0270-6a5d-4932-bf61-a820011ec281 | Alessandro-Castelli/AdvancedProgrammingCpp-C | Exercises/Homework 3/Homework 3/Homework 3 - 2.cpp | #include <iostream>
#include <vector>
using namespace std;
template<class T>
class Stack{
private:
vector<T> elements;
public:
// Constructor
Stack() : elements({}) {}
// Push an element into the stack
void push(const T& el){
elements.insert(elements.begin(), el);
}
// Pop... | ALGO | 0.998237 | 5.016832 |
55c01753-4232-4e37-be52-9ffdf03ea389 | kai-wei-kfuse/daily-code | 2022/202209/20220901/C.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n + 2);
vector<int> b(n + 2);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int ... | ALGO | 0.999977 | 3.617562 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.