uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
627d3a61-8bd8-4246-b620-96e6837bfd74 | ishandutta2007/codeforces | yuukakazami/normal/800/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long l... | ALGO | 0.999947 | 4.230733 |
7c9bf9ed-ac29-4256-9066-2e139b9b6d77 | TheRakibJoy/Algorithms | Data Structure/LCA/*LOJ - 1128 - Greatest Parent with LCA.cpp | #include<bits/stdc++.h>
#define Input freopen("in.txt","r",stdin)
#define Output freopen("out.txt","w",stdout)
#define ll long long int
#define ull unsigned long long int
#define pii pair<int,int>
#define pll ... | ALGO | 0.999943 | 3.787503 |
89f92865-93c1-46a7-9c73-3b789349e677 | x1rh/ACAutomaton | leetcode/1385(两个数组间的距离值)/1385(两个数组间的距离值).cpp | /*
这里我采用了求 |arr1[i] - arr2[j]| <= d的个数,然后用arr1.size()减去
*/
class Solution {
public:
bool in_it(int l, int r, int mid){
return l<=mid && mid<=r;
}
int findTheDistanceValue(vector<int>& arr1, vector<int>& arr2, int d) {
sort(arr2.begin(), arr2.end());
int ans = 0;
for(int ... | ALGO | 0.999963 | 5.430083 |
28bb3493-ccd2-471c-8d88-5fecf0b368bc | ShelpAm/competitive_programming | luogu/problem/B2140/main.cpp | #include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstddef>
#include <iostream>
#include <ranges>
#include <string_view>
#include <vector>
using ::std::size_t;
// constexpr bool debug{false};
template<typename T> T read()
{
T tmp;
std::cin >> tmp;
return tmp;
}
template<typename... | ALGO | 0.998797 | 4.665484 |
8668104a-8a19-4c8a-9d12-14bf0ef5a9e6 | Avinash0308/Geeks_For_Geeks_POTD_2024 | 12_Jul_Root_To_Leaf_Path_Sum_Solution.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left, *right;
};
/*you are required to
complete this function */
class Solution
{
public:
bool hasPathSum(Node *root, int target, int cur = 0)
{
// Your code here
if (!root)
return 0;
if (!r... | ALGO | 0.999973 | 6.121318 |
6fb612da-0a89-41f7-99f2-3268ff1bbd41 | memoriesadrift/Advent-of-Code-2020-Solutions | Day One/challenge-1.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
int main() {
std::string line;
std::map<int, int> occurences;
std::vector<int> values;
std::ifstream file ("input-first-challenge.in");
if (file.is_open())
{
while ( getline (file,line) )
{
values.push_back(std::... | ALGO | 0.998122 | 4.841782 |
dc610d01-3719-44b2-93f1-12898ce8d4c8 | prostonur/homework.- | misc_cpp.md/circle.cpp | double x, y;
std::cout « "enter x, y: ";
std::cin » x » y;
double r, R;
std::cout « "enter r, R: ";
std::cin » r » R;
if (sqrt(pow(x, 2) + pow(y, 2)) <= pow(R, 2) and sqrt(pow(x, 2) + pow(y, 2)) >= pow(r, 2))
std::cout « "Mur <3\n";
else
std::cout « "bob\n";
| ALGO | 0.999734 | 3.516623 |
72767960-1849-4784-a3f0-b4f4d557a3b9 | ATHARVA-GAWAS/DSA | 76-minimum-window-substring/minimum-window-substring.cpp | class Solution {
public:
string minWindow(string s, string t) {
int n = t.size();
int m = s.size();
int r=0,l=0,minl=INT_MAX;
int count = 0;
int sindex = -1;
int hash[256] ={0};
for(int i=0;i<n;i++){
hash[t[i]]++;
}
while... | ALGO | 0.999995 | 6.583879 |
6f9b3012-f309-4a25-abc9-4d334b40137d | tiny656/PAT | PAT (Basic Level) Practice (中文)/1110_区块反转 (25).cpp | #include <cstdio>
#include <string>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
struct Node {
string address;
string data;
string next;
};
unordered_map<string, Node> L;
int main() {
ios::sync_with_stdio(false);
string root;
int n, k;
cin >> root >>... | ALGO | 0.999586 | 3.667608 |
06a3b619-c919-47ed-addf-f4e1f2c011a6 | Honghong-Wang/Cosserat_NE | Library/eigen/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)
{
return v.sta... | TEST | 0.982789 | 6.666052 |
31f80923-3fa3-4f7e-b1c0-3137a4f79c1c | mathias-coder/cpp | Repetitive/Odd_Pair/main.cpp | #include <iostream>
using namespace std;
int main (){
int N, x;
cout << "How many inputs? ";
cin >> N;
for(int i = 0; i < N; i++){
cout << "Type a number: ";
cin >> x;
if(x % 2 != 0 && x > 0){
cout << "POSITIVE ODD" << endl;
}
else if(x % 2 != 0 &... | ALGO | 0.975984 | 4.186645 |
059eaa99-a571-4af9-af47-8bc2e85805af | sency90/allCode | plzrunoj/2016_algo_testing/algo-20-0595-hw1-16921/2013122184 윤태인_22944_assignsubmission_file_S2013122184H1.cpp | #include <iostream>
void get_inorder(int *pre, int *post, int size);
int *cutting(int *arr, int start_index, int finish_index);
int count = 0;
int main()
{
int size = 0;
scanf_s("%d", &size);
int *preorder = new int[size];
int *postorder = new int[size];
for (int i = 0; i < size; i++)
scanf_s("%d", &preorder[i]... | ALGO | 0.99998 | 3.640638 |
06b3c869-629e-41b1-8ac5-7e4184276602 | terupro/calender_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998693 | 6.797273 |
c83d5945-0be5-4c33-8502-446c058f01a7 | joshnagulipilli/gfgsolutions | Easy/Fibonacci series up to Nth term/fibonacci-series-up-to-nth-term.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> Series(int n) {
// Code here
vector<int>ans;
int MOD=1e9+7;
int fib=0,fib1=1,fib2;
ans.push_back(fib);
ans.push_back(fib1);
for(i... | ALGO | 0.999867 | 6.009067 |
3abecf80-bbd1-4e53-89a5-720f8493e1f8 | ShuhengLi/LeetCode | offer/1/rainbowSort.cpp | /*75. Sort Colors
* Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.
Note: You are not sup... | ALGO | 0.999913 | 5.6803 |
ec416b01-6019-482f-a9b8-e22b0f22f000 | vaishnaviselvaraj05/LeetCode | 1013-fibonacci-number/fibonacci-number.cpp | class Solution {
public:
int fib(int n) {
int prev = 0, curr = 1, next, i = 2;
if (n <= 1)
return n;
while (i <= n) {
next = prev + curr;
prev = curr;
curr = next;
i++;
}
return next;
}
};
| ALGO | 0.99998 | 6.305099 |
da6e961b-cb22-490b-a945-b961156b83f2 | Pirolye/ProjectCube | deps/physx/source/geomutils/src/contact/GuContactSphereBox.cpp | #include "geomutils/PxContactBuffer.h"
#include "GuContactMethodImpl.h"
using namespace physx;
//This version is ported 1:1 from novodex
static PX_FORCE_INLINE bool ContactSphereBox(const PxVec3& sphereOrigin,
PxReal sphereRadius,
const PxVec3& boxExtents,
// const PxcCachedTransforms& boxCach... | ALGO | 0.978056 | 6.936843 |
949cd4c1-4972-4524-8ad2-6a92b9f3d89b | IroineGrandison/Codeforces-Solutions | A_Magic_Numbers.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
string n;
cin >> n;
int counta = 0;
int countb = 0;
int countc = 0;
for (int i = 0; i < n.size(); i++)
{
if (n[i] != '1' && n[i] != '4')
{
counta++;
}
}
if (n[0] == ... | ALGO | 0.999929 | 4.730865 |
054ef85c-9857-4ccb-a5f6-39223c017abd | Toysoft/NNvision | darknet_apache_nvenc/opencv-3.4.4/3rdparty/carotene/src/convert_depth.cpp | #include "common.hpp"
#include <cstring>
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
template <int shift>
void lshiftConst(const Size2D &size,
const u8 * srcBase, ptrdiff_t srcStride,
s16 * dstBase, ptrdiff_t dstStride)
{
size_t roiw16 = size.width >= 15 ? size.wi... | ALGO | 0.97704 | 6.204195 |
038cd9b4-be9b-4e96-b94e-70f99603a9ca | Rakhi-Pundhir/100daysofcode | day85.cpp | #include<bits/stdc++.h>
using namespace std;
void dfstopo(int i,vector<int> adj[],vector<bool> &vis,stack<int> &st)
{
vis[i]=true;
for(auto it:adj[i])
{
if(vis[it]==false)
{
dfstopo(it,adj,vis,st);
}
}
st.push(i);
}
int main()
{
int v,e;
cin>>v>>e;
ve... | ALGO | 0.999989 | 3.987179 |
4845ca18-1495-48be-b87b-bc47a126f26c | coderyogesh/DSA-CPP | Coding Ninjas Questions Random/setBits.cpp | // https://www.codingninjas.com/studio/guided-paths/basics-of-c/content/118519/offering/1376725?leftPanelTab=1
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int countBits(int n)
{
int count = 0;
while (n != 0)
{
if (n & 1)
{
count++;
}
n >>=... | ALGO | 0.999726 | 5.89865 |
e03b4e6b-7956-4346-a7cf-c39cc86373ab | sunwaylive/proactive-learning-on-scenes | DepthSensing/Include/Eigen_3.1.2/bench/spmv.cpp |
//g++-4.4 -DNOMTL -Wl,-rpath /usr/local/lib/oski -L /usr/local/lib/oski/ -l oski -l oski_util -l oski_util_Tid -DOSKI -I ~/Coding/LinearAlgebra/mtl4/ spmv.cpp -I .. -O2 -DNDEBUG -lrt -lm -l oski_mat_CSC_Tid -loskilt && ./a.out r200000 c200000 n100 t1 p1
#define SCALAR double
#include <iostream>
#include <algor... | ALGO | 0.979425 | 4.304576 |
7489193d-5b93-4749-b3ac-8ff98269eaa9 | Encode-PDEU/App-Dev_Encode_HF22 | expense-tracker/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.998172 | 6.797273 |
4a33f816-a736-40d3-9422-3de0a99e7f15 | dummyummy/luogu | P4389 付公主的背包/main.cpp | #include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
#define N 100000
#define MOD 998244353
int n, m, v[N+5], cnt[N+5];
int f[4 * N + 5], g[4 * N + 5], f1[4 * N + 5], g1[4 * N + 5], h[4 * N + 5];
int fpow(int x, int p)
{
int ret = 1;
while (p)
{
if (p & 1)
ret = 1LL * ret *... | ALGO | 0.999988 | 4.412898 |
f6d07b12-6c3b-4979-87b0-69bdd91f6f25 | torx-cz/solitaire | src/working.cpp | /**
*
* Project: Solitaire Klondike
* Authors: Vladimír Jeřábek (xjerab21)
* Petr Jůda (xjudap00)
*
* Class representing working stack for cards
*
*/
#include "working.h"
bool Working::put(KCard* card){
if (!card->isTurnedFaceUp()) return false;
if (CardList.empty()){
if (card->value... | TOOL | 0.931249 | 5.110911 |
492c52b1-32c3-4bff-bda5-b0499b545687 | snewptl/stationaryTraveller | old-memory/CodeTON Round 1 (Div. 1 + Div. 2, Rated, Prizes!)/D.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>pii;
typedef double db;
const int maxn=2e5+5;
const ll mod=998244353;
const double eps=1e-10;
ll p2[60];
ll n;
int main(){
int T=1;scanf("%d",&T);
while(T--){
int cnt=0;
scanf("%lld",&n);
ll pn=n;
while(n%2==0)cnt++,n/=2;
... | ALGO | 0.99995 | 4.881567 |
e819e249-9fb1-4da2-90d5-d0ea6179faf3 | Mahmoud-Qassem/Vjudge-Solution | CodeForces/25C/38376045_AC_248ms_788kB.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define T int tests; cin >> tests;while (tests--)
#define vi vector<int>
#define vl vector<ll>
#define endl '\n'
#define here cout<<"here"<<endl;
#define pi 3.141592653589793
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#... | ALGO | 0.999941 | 3.895227 |
e774fbc1-e9d0-4733-8f56-902ce6abdd07 | Vtuzhilkin/Algorithms | Algorithms/6.D BFS.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
std::vector<std::vector<int>> read(const int& number_node, const int& number_edge) {
std::vector<std::vector<int>> table(number_node + 1);
for (size_t i = 0; i < number_edge; i++) {
int from, to;
std::cin >> from >> to;
table[from].pus... | ALGO | 0.999952 | 5.156207 |
989039fe-47dc-42a2-800c-4d3c9c529784 | GitP001/Stock | Frontend/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.998391 | 6.776823 |
83568e00-1899-474b-a931-9dcb3c6573f6 | gaivits/code_Kidding | String.cpp | #include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int n;
char b;
string b_ary(string ha,int posi,char data)
{
ha[posi]=data;
for(int i=n-1;i>posi;i--)
{
ha[i]='0';
}
if(posi+1 < n)
{
ha=b_ary(ha,posi+1,'0');
}
data++;
if( data != b)
{
cout<<ha<<endl;
ha=b_ary(ha,posi,da... | ALGO | 0.999812 | 3.486386 |
8a1cc3f8-734e-49ba-90ee-d76c030c679e | Taohid0/C-and-C-Plus-Plus | min priority test/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
struct comp{
bool operator()(const int & a,const int & b)
{
return a<b;
}
};
struct info{
int a,b;
bool operator <(info c) const
{
return a>c.a;
}
};
int main()
{
priority_queue<int,vector<int>,comp >pq;
priority_queue<i... | ALGO | 0.996294 | 3.657873 |
6a7ebf05-d80f-4c11-9fdf-6d684ce64301 | IshaanVerma1130/Strivers-DSA | Binary-Search/OnAnswer/MinShipCapacity.cpp | #include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int fun(vector<int> arr, int capacity) {
int days = 0;
int sum = 0;
for (int i = 0; i < arr.size(); i++) {
sum += arr[i];
if (sum > capacity) {
days += 1;
sum = arr[i];
}
}
... | ALGO | 0.999951 | 5.126142 |
efddd726-6440-4517-8459-c8951d82b392 | EKRoy/daily-practics-problem | week-13/day1/B_Buying_Lemonade.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define TC(t) int t; cin >> t; for(int i = 1; i <= t; i++)
#define pii pair<int,int>
#define ft ios::sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"
#define pb push_back
#defin... | ALGO | 0.99993 | 3.791344 |
a67f5e06-6bb9-4800-b088-b81d2c677291 | sharma39vishal/450-DSA | BST/Largest BST O(N).cpp | class Solution{
public:
int ans=1;
vector<int> sol(Node *root){
if(!root->left&&!root->right){
return {1,root->data,root->data,true};
}
vector<int>l={0,root->data-1,root->data-1,true};
vector<int>r={0,root->data+1,root->data+1,true};
if(root->left){
... | ALGO | 0.999976 | 5.657915 |
b98c47d0-3b35-4c6b-9f3f-83402396490e | Nyarmith/CPP_Algorithms | Problems/a2oj_ladders/lt1300/2_codeforces_263A.cpp | #include <cstdio>
#include <cstdint>
#include <cstdlib>
int main(){
int n, i=0, j=0;
for (int row=1; row<=5; ++row){
for (int col=1; col <=5; ++col){
scanf("%i",&n);
if (n == 1){
i=row; j=col;
}
}
}
printf("%i", std::abs(i-3) + std::abs(j-3));
}
| ALGO | 0.994912 | 3.443642 |
db1891b7-64a7-455b-ab40-edbf632733b1 | Leoyuseu/Code | Algorithm/Sorting/MergeSorted Lists.cpp | // MergeSortedLists.cpp : Defines the entry point for the console application.
//
// ָOfferԹپͱ⡷
// Ȩߣκ
#include "stdafx.h"
#include "..\Utilities\List.h"
ListNode* Merge(ListNode* pHead1, ListNode* pHead2)
{
if(pHead1 == NULL) return pHead2;
if(pHead2 == NULL) return pHead1;
ListNode* pMergedHead = NULL... | ALGO | 0.999861 | 5.606716 |
84c7abf8-375a-42ea-8d69-24a6daabd060 | ishandutta2007/codeforces | hanbyeol_/normal/1637/B.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T; cin >> T; while(T--)
{
int N; cin >> N;
vector<int> V(N);
for(int i=0; i<N; ++i) cin >> V[i];
long long ans = 0;
for(int i=0; i<N; ++i)
{
for... | ALGO | 0.99994 | 4.65792 |
17536b5d-27ff-49e0-86a9-e3ec2fc003a6 | mohitraj23/DSA-LOVE-BABBER | Code/6_Math_DSA/Sieve_Of_Eratoshenes.cpp | #include<bits/stdc++.h>
using namespace std;
int soe(int n)
{
vector <bool> v (n+1,true);
int c=0;
v[0] = v[1] = false;
for(int i=2; i<n; i++)
{
if(v[i] == true)
{
for(int j=2*i; j<n; j=j+i)
v[j] = false;
}... | ALGO | 0.999786 | 4.58595 |
9bd39dd5-cd1a-4278-9602-320982dce311 | TanKhoa1712/LY_THUYET_DO_THI | baitap1.cpp | #include<stdio.h>
#include<iostream>
#include<stack>
using namespace std;
int main (){
stack<int> s;
int n;
printf("nhap so luong phan tu: ");
scanf("%d",&n);
for (int i= 1; i<=n;i++)
{
int tam;
printf("nhap phan tu thu %d: ",i);
scanf("%d",&tam);
s.push(tam);
}
s.pop();
cout<< s.top()<<" ";
s.pop();
s.... | ALGO | 0.999833 | 3.153665 |
ed079182-2a00-4e3b-b725-4f0b0bca79ca | MikeYabz/CompGraphics | Assignment1/ThirdParty/FreeImage-3170/Source/FreeImageToolkit/Colors.cpp | #include "FreeImage.h"
#include "Utilities.h"
// ----------------------------------------------------------
// Macros + structures
// ----------------------------------------------------------
#define GET_HI_NIBBLE(byte) ((byte) >> 4)
#define SET_HI_NIBBLE(byte, n) byte &= 0x0F, byte |= ((n) << 4)
#define GET_... | TOOL | 0.917423 | 5.891572 |
f4e2746a-e8ca-4563-bc97-23c1287ab622 | TasnimAnas/Class_Assignments | 2nd Sem/C++ Codes/Part 11/2.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int row;
cout << "Enter number of rows: ";
cin >> row;
for (int i = row-1; i >= 0; i--)
{
for (int j = 0; j < row - i; j++)
{
cout << " ";
}
for (int k = 0; k <= i; k++)
{
cou... | ALGO | 0.999839 | 4.152338 |
4df3f2d8-bc97-4c98-aecc-7e579067745f | gauriiiiiiiiiiii/practise_DSA | 10. SLIDING WINDOW & 2 POINTER/5. Binary Subarrays With Sum.cpp | /* Binary Subarrays With Sum
Given a binary array nums and an integer goal
return the number of non-empty subarrays with a sum goal
A subarray is a contiguous part of the array
*/
// Prefix Sum + HashMap
class Solution {
public:
int numSubarraysWithSum(vector<int>& nums, int goal) {
unordered_map<int, int>... | ALGO | 0.999992 | 6.679083 |
24c7f5e9-ebea-4f91-993b-a3318b7703e7 | Goldpaper/Practice | Crazy_hanoi.cpp | #include <iostream>
#include <stack>
#define Max 101
using namespace std;
int disc[Max];
int l;
stack<int> hanoi_2;
void hanoi(int, int, int, int, int);
int main()
{
std::ios::sync_with_stdio(false);
int test_case;
int N;
cin >> test_case;
while (test_case--)
{
disc[0] = 0;
cin >> N;
for (int ... | ALGO | 0.999976 | 3.531878 |
27456ff4-2716-4e36-86a7-d4922baedd66 | swarajspatil158/cpp | Arrays/zero_one_two.cpp | #include <iostream>
using namespace std;
void zero_one_two(int a[100], int n)
{
int i = 0;
int zero, one, two;
zero = 0;
one = 0;
two = n-1;
while (one <= two)
{
if (a[one] == 0)
{
swap(a[zero], a[one]);
zero+=1;
one+=1;
}
e... | ALGO | 0.999969 | 3.952146 |
4fd37a86-689c-4383-9dea-5c0fdfb8522d | codewith-Arif/Programming-with-C-plus-plus | CollegeWallahC++10Hours/Chapter_5_FuctionsAndPointers/pascalTriangle.cpp | #include<iostream>
using namespace std;
int fact(int x){
int f = 1;
for(int i=1;i<=x;i++){
f *= i;
}
return f;
}
int ncr(int n, int r){
int a = fact(n);
int b = fact(r);
int c = fact(n-r);
return a/(b*c);
}
int main(){
int n;
cout<<"Enter n : ";
cin>>n;
for(int i=... | ALGO | 0.999928 | 4.232775 |
defd1e77-dbad-462d-bef0-fc30a1292d6f | TTTTao725/Randomized-Algorithm-project2 | .history/project2/hashtable_sketching_20230413200207.cpp | /*
* @Author: Tao
* @Date: 2023-04-10 23:01:25
* @LastEditors: Tao
* @LastEditTime: 2023-04-13 19:35:44
* @Description:
* Email: <EMAIL>
* Copyright (c) 2023 by Tao Tang, All Rights Reserved.
*/
#include <iostream>
#include <vector>
#include <random>
#include <chrono>
#include <fstream>
#include "project2.h"
... | ALGO | 0.980779 | 4.119088 |
54644573-e081-4c4c-a79e-736c348e60f6 | voidcs/Binarysearch.com-Solutions | C++/Condo_Developers/main.cpp | //https://binarysearch.com/problems/Condo-Developers
vector<vector<int>> solve(vector<vector<int>>& matrix){
map<int, int> smallestInRow, smallestInCol;
int n = matrix.size();
int m = matrix[0].size();
for(int i = 0; i < m; i++){
smallestInRow[i] = 0;
for(int j = 0; j < n; j++){
... | ALGO | 0.999972 | 5.69659 |
bf6ef8f6-6f7e-465f-9d1d-e3c3ab965c08 | zzctommy/public-source-code | 码库/UVA12345 Dynamic len(set(a[L:R])).cpp | #include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mkp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define sz(v) (int)v.size()
typedef long long LL;
typedef long double db;
template<class T>bool ckmax(T&x,T y){return x<y?x=y,1:0;}
template<class T>bool ckmin(T&x,T y){return x>y?x... | ALGO | 0.999977 | 3.28839 |
66ac64d1-3cef-40fc-9e1f-c65696a94e58 | Aditya30december2003/Leetcode-GFG | 0150-evaluate-reverse-polish-notation/0150-evaluate-reverse-polish-notation.cpp | class Solution {
public:
int Solve(int a , int b , string str){
int result;
if(str=="+"){
result=a+b;
}
else if(str=="-"){
result=a-b;
}
else if(str=="*"){
result=a*b;
}
else if(str=="/"){
result=a/b;
... | ALGO | 0.999945 | 6.113308 |
091e861c-ebd6-449c-96bf-a702fecee159 | Richard-Zheng/Learning-Algorithms | vjudge/AC/477276D.cpp | #include <iostream>
using namespace std;
const int MAXN = (1e5) + 1;
long long presum[MAXN];
int main() {
int n, q;
cin >> n >> q;
presum[0] = 0;
int in;
for (int i = 1; i <= n; i++) {
cin >> in;
presum[i] = presum[i - 1] + in;
}
int f, t;
for (int i = 1; i <= q; i++) {
... | ALGO | 0.999806 | 4.236238 |
f48ceb56-66d2-44a7-b473-1ffa3261d504 | RishitToteja/Leetcode-Questions | 2196-create-binary-tree-from-descriptions/2196-create-binary-tree-from-descriptions.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.999787 | 5.820716 |
0fef5c9f-139d-4eda-9922-6fbdc91ae168 | Rumyamyamyang/baekjoon | 10xxx/10869.cpp | #include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int A, B;
cin >> A >> B;
cout << ("%d \n", A + B) << endl;
cout << ("%d \n", A - B) << endl;
cout << ("%d \n", A * B) << endl;
cout << ("%d \n", A / B) << endl;
cout << ("%d \n", A % B) << endl;
cin.get();
} | ALGO | 0.99233 | 3.26847 |
3ee97ce3-96aa-41b8-8a31-6c7c70c14ea5 | ishandutta2007/codeforces | shnirelman/normal/1348/D.cpp | #include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using li = long long;
using ld = long double;
using pii = pair<int, int>;
const int INF = 1e9;
const int M = 1e9 + 7;
const int N = 2e5 + 13;
void solve() {
int n;
cin >> n;
int l = -1, r = INF;
while(r - l > 1) {
... | ALGO | 0.999957 | 4.017463 |
9c875f4a-5ef4-499c-bb02-61dd4f55ceb4 | renjun81/live555_backchannel | live555/liveMedia/MP3ADU.cpp | #include "MP3ADU.hh"
#include "MP3ADUdescriptor.hh"
#include "MP3Internals.hh"
#include <string.h>
#ifdef TEST_LOSS
#include "GroupsockHelper.hh"
#endif
// Segment data structures, used in the implementation below:
#define SegmentBufSize 2000 /* conservatively high */
class Segment {
public:
unsigned char buf[Seg... | TOOL | 0.894867 | 5.555785 |
c6dc2e83-0d6f-49c6-8f77-3929508bd773 | cyber-hoax/LeetCodeQues | 1991-find-the-middle-index-in-array/1991-find-the-middle-index-in-array.cpp | class Solution {
public:
int findMiddleIndex(vector<int>& nums) {
int sum = 0 ;
int leftSum = 0;
for(auto x : nums)
sum += x;
for (int i = 0 ; i<nums.size(); i++){
sum -= nums[i];
if(leftSum == sum )
return i;
leftSum += nums[i];
}
... | ALGO | 0.999963 | 5.968891 |
b84f28ce-85f5-424c-8715-e71d56928e83 | evialbert/LeetCode | 2520-count-the-digits-that-divide-a-number/2520-count-the-digits-that-divide-a-number.cpp | class Solution {
public:
int countDigits(int num) {
int copy_of_num = num;
int count = 0;
while(num>0){
int last_digit = num%10;
if(copy_of_num%last_digit == 0)
count = count + 1;
num = num/10;
}
return count;
}
}; | ALGO | 0.99968 | 5.9216 |
98f51f75-cbe7-41be-be77-ca75ca73a27a | ishandutta2007/codeforces | m_99/normal/1462/E2.cpp | #include <stdio.h>
#include <bits/stdc++.h>
#include <utility>
namespace atcoder {
namespace internal {
// @param m `1 <= m`
// @return x mod m
constexpr long long safe_mod(long long x, long long m) {
x %= m;
if (x < 0) x += m;
return x;
}
// Fast moduler by barrett reduction
// Reference: https://en.w... | ALGO | 0.99973 | 4.066662 |
919c4dcd-ca87-4af8-bbde-8edaf9dba7ad | lovingmage/SPECIAL | test/filter.cpp | #include "emp-sh2pc/emp-sh2pc.h"
#include "core/relation.hpp"
#include "core/op_filter.hpp"
#include <iostream>
#include <chrono>
using namespace emp;
// Utility function to initialize a relation with random values
void init_relation(SecureRelation& relation, int num_cols, int num_rows) {
for (int col = 0; col < ... | TOOL | 0.856949 | 6.157308 |
76fa7520-5fe4-46f9-9321-e0371d3bda62 | pri1712/codefoces | 486C.cpp | #include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#define ci(n) cin>>n
#define co(n) cout<<n
#define nl '\n'
#define r0 return 0
#define LLMAX LLONG_MAX
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define printstr(s) for(int i=0;i<(int)s.s... | ALGO | 0.99988 | 3.627175 |
41b9de5d-4529-4fa1-b5ce-199898ac6a8d | jiho7407/PS | Codeforce/Div1/1015/E_Blossom.cpp | #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define rep(i, l, r) for (int i = (l); i < (r); i++)
using namespace std;
const int MX = 6000;
const ll MOD = 1000000007;
ll fact[MX], invfact[MX];
ll modpow(ll a, ll b){
ll res = 1;
while(b){... | ALGO | 0.999028 | 4.518338 |
fe93bd8f-51dc-414f-9996-b6b28aafb019 | daisytuner/sdfglib | src/data_flow/library_nodes/math/ml/matmul.cpp | #include "sdfg/data_flow/library_nodes/math/ml/matmul.h"
#include "sdfg/analysis/analysis.h"
#include "sdfg/analysis/scope_analysis.h"
#include "sdfg/builder/structured_sdfg_builder.h"
namespace sdfg {
namespace math {
namespace ml {
MatMulNode::MatMulNode(
size_t element_id,
const DebugInfo &debug_info,
... | ALGO | 0.866751 | 7.653599 |
a3c7573b-b1be-4721-a9d1-e04d3245cd44 | mushroomfire/lammps_nep | lammps/lib/linalg/zlanhe.cpp | #ifdef __cplusplus
extern "C" {
#endif
#include "lmp_f2c.h"
static integer c__1 = 1;
doublereal zlanhe_(char *norm, char *uplo, integer *n, doublecomplex *a, integer *lda,
doublereal *work, ftnlen norm_len, ftnlen uplo_len)
{
integer a_dim1, a_offset, i__1, i__2;
doublereal ret_val, d__1;
... | ALGO | 0.993312 | 3.361784 |
65b92984-71f4-4055-ac73-dd28ed930774 | swapnilsachan03/apna-college-dsa | Chapter 14 - Bit Manipulation/unique_from_thrice.cpp | #include <iostream>
using namespace std;
bool getBit (int n, int pos) {
return (n & (1 << pos)) != 0;
}
int setBit (int n, int pos) {
return (n | (1 << pos));
}
int unique (int arr[], int n) {
int result = 0;
for(int i = 0; i < 32; i++) {
int sum = 0;
for(int j = 0; j < n; j++) {
if(getBit(arr... | ALGO | 0.999548 | 4.985315 |
33530d83-8178-4ddb-8cc7-8800fe94cb66 | 4aps/CPP | deca1/fact.cpp | #include <iostream>
using namespace std;
int fact(int num){
if (num == 0 || num == 1)
return 1;
else return num * fact(num-1);
}
int main(){
cout << "Enter a number: ";
int num;
cin >> num;
cout << fact(num);
return 0;
}
| ALGO | 0.999413 | 4.533698 |
6b30ecf8-ddc6-450f-8790-f8cf29d8d8ee | simplay/document_analysis | GCMex/graph.cpp | /* graph.cpp */
#include <stdio.h>
#include "graph.h"
Graph::Graph(void (*err_function)(char *))
{
error_function = err_function;
node_block = new Block<node>(NODE_BLOCK_SIZE, error_function);
arc_block = new Block<arc>(NODE_BLOCK_SIZE, error_function);
flow = 0;
}
Graph::~Graph()
{
delete node_block;
delete ... | ALGO | 0.896208 | 5.617796 |
9793314a-5c3a-4425-b84a-7b33060d914b | Apeksha-22/POTD | LEETCODE/JULY/12-07-2025.cpp | //1900. The Earliest and Latest Rounds Where Players Compete
class Solution {
private:
int F[30][30][30], G[30][30][30];
public:
pair<int, int> dp(int n, int f, int s) {
if (F[n][f][s]) {
return {F[n][f][s], G[n][f][s]};
}
if (f + s == n + 1) {
return {1, 1};
... | ALGO | 0.999893 | 5.684914 |
919ac0bd-b3cb-4edd-a659-1e0b1bf7af96 | amce64/ProgramasC | Programa3.cpp | /* Este programa obtiene la tabla de depreciaciones acumuladas y valores reales
de cada Año de un determinado producto */
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
double Coste, Depreciacion, Valor_Recuperacion, Valor_Actual, Acumulado;
int Anyo, Vida_Util;
cout<<"In... | TOOL | 0.877022 | 3.802444 |
38055169-09e2-43fc-a0fd-13e10eec973a | SJTUqizhenlin/SjtuOnlineJudge | sjtu-oj1006.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int tmp = 0;
int max = 0;
int *dp = new int[3];
int *dppre = new int[3];
int *ele = new int[3];
cin >> ele[1];
cin >> ele[2];
dp[2] = ele[1] + ele[2];
dppre[2] = 1;
max = dp[2];
int cur = 2;
for (int i = 3; i <= n; i++)
{
cin >> t... | ALGO | 0.999829 | 3.181708 |
be30b847-0601-4a4e-b854-b69e788013a5 | nbutacm/NBUTACM | 2017级/第五次周赛 (1)/E.cpp | #include<iostream>
using namespace std;
int n,m;
int main(){
while(cin>>n>>m){
if(n==0&&m==0) break;
if(n%2==0||m%2==0) cout<<"Wonderful!"<<endl;
else cout<<"What a pity!"<<endl;
}
}
// 这题可以倒着推一遍,找规律
// http://blog.csdn.net/lttree/article/details/24836839
/*
我们设 1表示先手赢,0表示后手赢
假如 n=m=1,那么图像就为
0
后... | ALGO | 0.998889 | 3.385626 |
59045883-f10d-4003-b65c-e6f59c3c901f | hasibul217/DSA-2-LAB | Assignment_011201217/Problem10.cpp | #include <bits/stdc++.h>
using namespace std;
// Function to find the maximum sum of a subarray that crosses the midpoint
int maxCrossingSum(const vector<int>& arr, int left, int mid, int right) {
int sum = 0;
int left_sum = INT_MIN;
for (int i = mid; i >= left; i--) {
sum += arr[i];
i... | ALGO | 0.999995 | 6.459681 |
2d3f0a1a-bc50-4118-8e1b-500c3d0888f7 | WangWei9705/Data-Structure | 4.8.cpp | // 根据前序和中序遍历还原二叉树
Node* BulidTree(char pre[],char in[],int size){
if(size==0){
return NULL;
}
char rootvalue=pre[0];
int r=-1;
for(int i=0;i<szie;i++){
if(in[i]==rootvalue){
r=i;
break;
}
}
assert(r!=-1);
Node* root =(Node*)malloc(sizeof(Node));
root->value=rootvalue;
root->left=BulidTree(... | ALGO | 0.999944 | 4.36026 |
3caafae2-e19e-44bd-857b-50816b91a415 | kohei-us/mdds | example/packed_trie_state_custom.cpp | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifdef NDEBUG
#undef NDEBUG
#endif
#include <cassert>
#include <iostream>
#include <fstream>
#include <mdds/trie_map.hpp>
//!code-start: value-type
enum affiliated_party_t : uint8_t
{
unaffiliated = 0,
federalist,
democratic_r... | TOOL | 0.955042 | 7.735827 |
55b61f75-9d97-4e81-a1a7-4894859f6322 | pritamchaudhary/DSA-Supreme-2.O | Week 3 Arrays, time complexity and space complexity/week3 assignment/factorialOfALargeNumber.cpp | // gfg -> Factorials of large numbers
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
vector<int> factorial(int N){
vector<int> ans;
ans.push_back(1);
int carry = 0;
for(int i=2; i<=N; i++){
for(int j=0; j<ans.size(); j++){
... | ALGO | 0.999903 | 5.464395 |
f48d348a-89a4-40c8-9b3e-aea3aca302db | phong28zk/Dark_Susss_Algorithm | cpp/thithu2.cpp | #include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cerr.tie(0)
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
#define mp make_pair
#define gl getline
#define pb push_back
#define eb emplace_back
#define ob pop_back
#define ... | ALGO | 0.999563 | 3.471351 |
2b17d570-0803-4d6b-a75c-0813de29eef4 | francose23/Info32023 | Codigos C/Insercionfacherofacherito.cpp | #include<stdio.h>
#include<stdlib.h>
int main(){
int i=0;
int j=0;
int temp = 0;
int A[10];
printf("\n Ordenamiento por Insercion \n Vector A: \n");
for (i=1; i<=10;i++){
A[i]=rand () %100;
printf("%d ",A[i]);
}
for(i=1;i<10;i++){
temp = A[i];
j=i-1;
while(A[j]>temp & j>=1){
A[j+1]=A[... | ALGO | 0.999927 | 3.981223 |
6dc9a8a7-e0e6-4961-8b2e-6586de9dd280 | ishandutta2007/codeforces | endagorion/normal/815/A.cpp | #include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <nume... | ALGO | 0.999612 | 3.05828 |
ff4e24af-02f4-478b-b15a-39e8d5fdb245 | BrennenTaylor/Twisty | Twisty/Curve.cpp | #include "Curve.h"
#include "CurvePerturbUtils.h"
#include <assert.h>
#include <filesystem>
#include <fstream>
namespace twisty {
Curve::Curve(uint32_t numSegments)
: m_numSegments { numSegments }
, m_ds(0.0f)
, m_boundaryConditions()
, m_curvatures(m_numSegments - 1)
, m_positions(m_numSegments ... | TOOL | 0.906483 | 7.453389 |
9028feb9-05ef-48c9-8d70-06cc3d62ae98 | GOR-OM/DSA-Problem-for-placement | Graph/Number of Distinct Islands.cpp | #include <bits/stdc++.h>
using namespace std;
bool isvalid(int i, int j, int n, int m)
{
return i >= 0 && i < n && j >= 0 && j < m;
}
vector<pair<int, int>> moves = {
{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
void dfs(int i, int j, vector<vector<int>> &grid, vector<vector<int>> &vis, vector<pair<int, int>> &ar, int ... | ALGO | 0.999874 | 5.864686 |
764ffbf6-4114-4ce1-a4b2-f686bd1b4976 | Trishna2005Das/Lift-Off-Cpp | Assignment - week 2/Q11-Armstrong.cpp | //Write a C++ program to check whether a number is Armstrong or not
#include <iostream>
using namespace std;
int main()
{
int num;
cout << "Enter a number: ";
cin >> num;
int temp = num;
int sum = 0;
while (temp != 0)
{
int digit = temp % 10;
sum += digit * digit * digit;
... | ALGO | 0.999801 | 5.143418 |
7bed0c70-92ec-461a-b29e-045879044cd3 | Keshav7891/Leetcode-Solutions | 1262-greatest-sum-divisible-by-three/1262-greatest-sum-divisible-by-three.cpp | class Solution {
public:
int help(int index , int rem , vector<int>&nums , vector<vector<int>>&dp)
{
if(index == nums.size())
{
if(rem % 3 == 0)
{
return 0;
}
else
{
return -10000;
}
... | ALGO | 0.999878 | 5.965919 |
a473c65b-d4a8-4f01-9496-8b36eb6c2a10 | RhesusP/ft_irc | src/Utils.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Utils.cpp :+: :+: :+: ... | TOOL | 0.979499 | 6.423995 |
9fc92f4d-f547-41cf-95bd-7bb7a30fa605 | Enabling/EnCo_MQTT | src/Speck.cpp | #include "Speck.h"
#include "Crypto.h"
#include "utility/RotateUtil.h"
#include "utility/EndianUtil.h"
#include <string.h>
/**
* \class Speck Speck.h <Speck.h>
* \brief Speck block cipher with a 128-bit block size.
*
* Speck is a family of lightweight block ciphers designed by the
* National Security Agency (NSA)... | ALGO | 0.996291 | 7.043678 |
0de28c84-1bed-441e-9270-6cebec611a34 | black-dragon74/Learn-With-Me | Learn_CPP/kadanes_algo.cpp | #include <bits/stdc++.h>
using namespace std;
#define print(...) do { fprintf(stdout, __VA_ARGS__); cout << endl; } while (0);
// Basic impl of kadane's algo, common in bitmap handling
int kadanesAlgoSimple(const vector<int> &array) {
int max_so_far = INT_MIN, max_till_here = 0;
for (const auto &num: array)... | ALGO | 0.999922 | 5.080651 |
4b03b93e-8345-4c49-8be2-4bd31059d226 | Nkeyka/Qt-Creator-Cpp-Book | 3.6.3 Forking process. Crossing lines and solving equations/8/main.cpp | #include <iostream>
using namespace std;
int main()
{
float a, b, k, m, x, y;
cout << "y = ax + b\nEnter a, b = ";
cin >> a >> b;
cout << "y = kx + m\nEnter k, m = ";
cin >> k >> m;
if (a == k) cout << "No";
else {
/* a * x + b = k * x + m
* => a * x - k * x = m - b
... | ALGO | 0.99716 | 3.60797 |
bda298b5-e0c5-40c4-b860-1a6a189a6a23 | Liltargetzz/CS_20A_Project_1 | CS_20A_Project_1/main.cpp | #include <iostream>
#include <string>
#include <cstdlib>
#include <chrono>
#include <thread>
#include "life.h"
#include "global.h"
#include "snake.h"
#include "box.h"
#include "boat.h"
#include "bigblink.h"
#include "matrix.h"
#include "simulation.h"
int main() {
const int numLife = 4;
Life** population = new Life ... | TOOL | 0.923427 | 4.616817 |
8e84d7eb-82ef-4332-a52e-0d616db0c490 | misaka19008/cplusplus-primer-plus-answer | U12/exercises/5/main.cpp | #include<iostream>
#include<cstdlib>
#include<ctime>
#include "exec5.h"
using std::cin;
using std::cout;
using std::endl;
using std::ios_base;
const int MIN_PER_HR=60; // 常量,一小时的秒数
bool isNewCustomer(double x);
bool simulator(int cuArrivePerHour);
int main(){
int num_customer=0;
bool isSuccess=false;
d... | ALGO | 0.984411 | 3.665891 |
c04dfacc-a6c2-4d41-adfd-fcc7c8902e1c | ghenriqf/algoritmos-e-programacao | aula-4-algoritmos-e-programacao/complementar_c.cpp | #include <iostream>
using namespace std;
int main(){
double valorCorrida;
cout << "Digite o valor da corrida:";
cin >> valorCorrida;
cout << "O valor final da corrida no periodo diurna:" << valorCorrida+(valorCorrida*0.05) << endl;
cout << "O valor final da corrida no periodo noturno:" << valorCorrid... | ALGO | 0.971035 | 3.873442 |
9071544b-f47a-45cf-91b1-3a5943fe18a4 | heweimin77/shoran_cpp | session3000/problem2600/p2521.distinctPrimeFactors.cpp | #include <gtest/gtest.h>
#include <unordered_set>
using namespace std;
namespace {
class Solution {
public:
int distinctPrimeFactors(vector<int> &nums)
{
int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31};
unordered_set<int> pfactors;
for (auto n : nums) {
for (int *p... | ALGO | 0.975583 | 6.316869 |
66ca2637-78d0-41f1-9bf1-98021d78ad62 | Nanored4498/Code-Forces | icpc_challenge/autumn2023/eval.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <numeric>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <fstream>
using namespace std;
struct Frame {
int size, user, t0, t1;
};
// 1 <= N <= 100: number of users
// 1 <= K <= 10: number of cells
// 1 <= T <= 1000: ... | ALGO | 0.986078 | 3.947861 |
5292b188-1bb5-4156-b861-72e09f4102e2 | alexandraback/datacollection | solutions_5708284669460480_0/C++/mikrosp1/B-small-4.cpp | #include<iostream>
#include<iomanip>
#include<string>
#include<cmath>
#include<fstream>
using namespace std;
int main(){
ifstream fin("B-small-4.in");
ofstream fout("B-small-4.out");
int t;
fin>>t;
for(int e=1;e<=t;e++){
string key,target;
int k,l,s;
fin>>k>>l>>s;
... | ALGO | 0.996648 | 3.398352 |
817ed410-4d3c-477c-86a8-610a1ff3d758 | neal2018/oj_env | atcoder/abc302/c.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<string> a(n);
for (auto& x : a) cin >> x;
vector<int> o(n);
iota(o.begin(), o.end(), 0);
do {
if ([&] {
for (int i = 0; i < n - 1; i++... | ALGO | 0.999999 | 5.254266 |
011f5c17-2ffb-4704-9b72-d9cab73856df | dias-asp/KBTU | ADS/Lab1/A.cpp | #include <bits/stdc++.h>
using namespace std;
int n, test;
int main()
{
cin >> test;
for (int _ = 1; _ <= test; _++)
{
queue < int > q;
cin >> n;
q.push(n);
for (int i = n - 1; i >= 1; i--)
{
q.push(i);
for (int j = 1; j <= i; j++)
... | ALGO | 0.999975 | 4.86569 |
2eb52962-0ce6-473a-a964-57f4f761b4a8 | wjoh0315/BOJSolutions3 | BOJ10757_bignumA+B/bignumA+B.cpp | //https://www.acmicpc.net/problem/10757
#include <iostream>
#include <string>
using namespace std;
void maxmin(string a, string b, string *max, string *min)
{
*max = a.length() >= b.length() ? a : b;
*min = a.length() < b.length() ? a : b;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL)... | ALGO | 0.999952 | 4.542707 |
fdcb9bf3-687d-4ddb-9653-0491728b66dd | mazbox/TukeSprint | TukeSprint/src/apps/deathBox/src/ofxBox2dDeath/scr/lib/Box2D/Source/Dynamics/Contacts/b2PolyContact.cpp | #include "b2PolyContact.h"
#include "../b2Body.h"
#include "../b2WorldCallbacks.h"
#include "../../Common/b2BlockAllocator.h"
#include <memory>
#include <new>
#include <cstring>
b2Contact* b2PolygonContact::Create(b2Shape* shape1, b2Shape* shape2, b2BlockAllocator* allocator)
{
void* mem = allocator->Allocate(sizeof... | ALGO | 0.990532 | 7.368232 |
34ffe380-6cee-4aa2-9d14-e1c61732f797 | Yallaswamy/gfg_solved | Difficulty: Easy/Total count/total-count.cpp | //{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
int totalCount(int k, vector<int>& arr) {
// code here
int sum=0;
for(int i=0;i<arr.size();i++){
... | ALGO | 0.999282 | 5.592073 |
973cabe2-3e8e-4999-a1b3-2876bca6fd89 | ishikabansal04/DataStructures_And_Algorithms | GenericTrees/iterativeTraversals.cpp | #include<iostream>
#include<vector>
#include<stack>
#include<queue>
#include<string>
using namespace std;
class Node{
public:
int data=0;
vector<Node*>children;
};
Node* construct(vector<int>arr){
stack<Node*>stk;
Node* root;
for(int i=0;i<arr.size();i++){
Node* node=new Node;
... | ALGO | 0.999985 | 4.726263 |
daef03a1-b452-4681-a1b3-c7bf8fcd00a6 | mlbismls/PSI_PRO | thirdparty/linux/boost/libs/compute/perf/perf_stl_unique_copy.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
// create ve... | ALGO | 0.963083 | 5.622078 |
4330e22b-b3b9-4629-bf41-e5355180405a | eugnsp/competitive_programming | src/misc/matrix_rotation.cpp | #include "base.hpp"
#include "matrix.hpp"
#include <cassert>
#include <cstddef>
#include <utility>
template<typename T>
void transpose(Matrix<T>& matrix)
{
assert(matrix.rows() == matrix.cols());
for (std::size_t col = 0; col < matrix.cols(); ++col)
for (std::size_t row = 0; row < col; ++row)
std::swap(matrix(r... | ALGO | 0.99917 | 4.940305 |
2db5a8d7-69cd-45b7-85b6-9f8e88a624ad | taptap/TapSDK-UE4 | TapCommon/Source/TapCommon/Tools/StringHelpers.cpp | #include "StringHelpers.h"
namespace TUCommon
{
namespace StringHelpers
{
int32 FindFirstOf(const FString& InString, const FString& SplitAt, int32 FirstPos)
{
if (SplitAt.Len() == 1)
{
// Speical version for only one split character
const TCHAR& FindMe = SplitAt[0];
for (int32 i = FirstPos; i ... | TOOL | 0.956193 | 6.099393 |
f77eea65-f4e1-4850-b495-a110b306940f | harshitgupta2019/khatarnakcoder | codeforces/1249B2-Books Exchange(Hard Version).cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
long long int t,n;
cin>>t;
while(t--)
{
cin>>n;
ll a[n],i;
for(i=0;i<n;i++)
{
cin>>a[i];
--a[i];
}
vector<int> u(n);
vector<int> ans(n);
for (int j = 0; j < n; ++j)
{
if (!u[j])
{
vector<int> c;
... | ALGO | 0.999897 | 4.241072 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.