uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
cb2f622b-47e3-49de-8c59-b1f167b4d693 | INFORMSJoC/2024.0938 | clustering_cpp/cg_pricing_multi.cpp | #include "cg_pricing_multi.h"
#include "cg_pricing.h"
#include <queue>
#include <algorithm>
// RETURNS MULTIPLE NEGATIVE REDUCED COST COLUMNS (UNCONSTRAINED PRICING)
std::vector<std::vector<PricingOutput>> get_compatible_columns(MustLinkMapping &mlm, std::vector<OrderedDistances> &od, std::vector<double> &price_c, dou... | ALGO | 0.997314 | 5.553036 |
911d31ea-56dd-4bb6-be87-6f7100416a6a | gabitaniguchi/Competitive-programming | grafos/dijkstra/transports.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX (int)(1e5 + 10)
#define ii pair<int, pair<int,int>>
int n,m,k,origem,destino;
int p[MAX], custo[MAX];
vector<pair<int,int>> g[MAX];
map<int,int> preco;
priority_queue<ii, vector<ii>, greater<ii> > q;
void bfs(int origem){
memset(custo, -1, sizeof(custo));... | ALGO | 0.999971 | 4.735553 |
321fbb2c-2674-4e1e-adab-ecbea6144490 | monkin77/feup_cal | TP3/ex1.cpp | #include "exercises.h"
#include <limits>
#include <thread>
#include <algorithm>
#include <cmath>
#include <vector>
const double MAX_DOUBLE = std::numeric_limits<double>::max();
Point::Point(double x, double y) {
this->x = x;
this->y = y;
}
Point::Point(int x, int y) {
this->x = x;
this->y = y;
}
do... | ALGO | 0.999706 | 6.366878 |
5e97afa7-2535-4e40-9a36-9c773157311c | ishandutta2007/codeforces | __zmf__/normal/1628/A.cpp | /*
ever17
*/
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define int long long
inline int read()
{
int sum = 0, nega = 1;
char ch = getchar();
while (ch > '9'||ch < '0')
{
if (ch == '-') nega = -1;
... | ALGO | 0.999968 | 4.24969 |
bf9defac-8d78-4510-aa23-a251151b87c3 | izmeera2000/SmartShop | smartshopflutter/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.99848 | 6.772262 |
3bac40a9-cb0c-4349-bd69-48583e36dcf9 | ishandutta2007/codeforces | changyu/normal/1247/B2.cpp | #include<cstdio>
const int N=2e5+3,A=1e6+3;
int n,k,d,a[N],b[A],c,ans;
int main(){
int T;scanf("%d",&T);for(;T--;){
scanf("%d%d%d",&n,&k,&d);
ans=n;c=0;
for(int i=1;i<=n;i++){
scanf("%d",a+i);
if(!b[a[i]])c++;
b[a[i]]++;
if(i>d){
b[a[i-d]]--;
if(!b[a[i-d]])c--;
}
if(i>=d)ans=c<ans?c:ans;
}
f... | ALGO | 0.99985 | 3.409211 |
ba73e6f9-3064-4ec1-9df8-c8e8c2b90cef | chanmol1999/hacktoberfest | Akshar Singh/LaddersProblemdp.cpp | #include<bits/stdc++.h>
using namespace std;
//recursive o(k^n)
int clad(int n){
if(n==0){
return 1;
}
if(n<0){
return 0;
}
return clad(n-1)+clad(n-2)+clad(n-3);
}
int ways2(int n , int k){
if(n==0){
return 1;
}
if(n<0){
return 0;
}
int ans=... | ALGO | 0.99999 | 4.032683 |
ca347299-81e4-4a10-9da8-23c260df58ea | itsmedurgesh/Coding-Practice-CPP | practice/testing.cpp | #include <iostream>
#include <climits>
using namespace std;
class Tableau{
private:
int size;
int A[10][10];
public:
Tableau();
void insert(int d);
void print();
};
Tableau::Tableau(){
size = 10;
for(int i=0; i<size; ++i)
for(int j=0; j<size; ++j)
A[i][j] = INT_MAX;
}
void Tableau::insert(int d){
A[si... | ALGO | 0.972335 | 3.853189 |
cca78e2f-1d8e-4b30-83c6-038315120ccb | bayashi-cl/procon-submission | atcoder/abc223/abc223_f/26681827.cpp | #ifndef LOCAL
#define NDEBUG
#endif
#include <algorithm>
#include <array>
#include <atcoder/lazysegtree>
#include <atcoder/math>
#include <atcoder/modint>
#include <cassert>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric... | ALGO | 0.999975 | 4.909218 |
6840b41b-0e72-4f9d-b4ca-5e5ad6c2f15c | ishandutta2007/codeforces | emengdeath/normal/1178/B.cpp | #include <string>
#include <cstdio>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <deque>
#include <stack>
#include <queue>
using namespace std;
const int N = 2e6;
int n;
char s[N];
int l[N], r[N];
long long ans;
int main()
{
scanf(... | ALGO | 0.999772 | 4.061947 |
619effdc-3f9f-4d3b-9fc5-ad5bf49cc169 | septiandyy/leetcode-problems | 74. Search a 2D Matrix/74. Search a 2D Matrix.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
if (matrix.empty() || matrix[0].empty()) {
return false;
}
int m = matrix.size();
int n = matrix[0].size();
int left = 0;
int right = m * n - 1;
... | ALGO | 0.999876 | 6.61374 |
08c1b469-41b6-44f5-83b4-276b527885f9 | raincross7/code-similarity | codes/train_code/problem072/problem072_13.cpp | #include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<stack>
#include<set>
#include<sstream... | ALGO | 0.999988 | 4.07636 |
9c3cf24f-fd8b-459c-8693-7723be768631 | dtienanh/btvn | bt2 ss9.cpp | #include <stdio.h>
#include <string.h>
void SapXepMangChuoi(char ars[][100],int n){
for(int i=0;i<n-1;i++){
for(int j=0;j<n-i-1;j++){
if(strcmp(ars[j],ars[j+1]) > 0){
char tmp[100];
strcpy(tmp,ars[j]);
strcpy(ars[j],ars[j+1]);
strcpy(ars[j+1],tmp);
}
}
}
return ;
}
int main(){
char ars[5]... | ALGO | 0.999774 | 3.588763 |
956493da-66b2-48b5-aca4-c6cbf1e5eefb | JOHNYVPD/C-codes | johny20.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a, b, c, d, x, R, I;
cout<<"According to this format of Quadratic Equation: ax^2 + bx + c = 0"<<endl;
cout<<"Insert the values of a, b and c \n"<<endl; cin>>a>>b>>c;
d=(b*b)-(4*a*c);
cout<<"------------------------------------------... | ALGO | 0.998804 | 3.41292 |
332a2bde-8fc6-473e-ad0c-dc3d3aad4824 | abroadchen/test | src/main/c/heap/heap_sort.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <utility>
using namespace std;
#define TEST(func, arr, n) { \
printf("TEST: %s ", #func); \
int *temp = (int *)malloc(sizeof(int) * n); \
memcpy(temp, arr, sizeof(int) * n); \
long long b = clock(); \
func(temp, n); \... | ALGO | 0.999239 | 4.276762 |
b5244469-b34e-4d05-ac06-28247fcb9feb | ishandutta2007/codeforces | farhod_farmon/normal/797/E.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define sc scanf
#define pr printf
#define pb push_back
#define ll long long
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );
const long long N = 100100;
const long long MX = 200200;
const long long MAGIC = 250;
const long ... | ALGO | 0.999596 | 3.273162 |
9f0a4bf9-bf55-43d7-a203-384b661308b4 | vhgbao01/HCMUS-Lab | CTDLGT/19127102_W01/P02/Source.cpp | #include <iostream>
#include <ctime>
int main() {
int size;
int odd = 0, even = 0;
std::cout << "Input size of array: ";
std::cin >> size;
int* arr = new int[size];
srand(unsigned int(time(NULL)));
for (int i = 0; i < size; i++) {
arr[i] = rand() % 100;
std::cout << arr[i] << " ";
}
std::cout << "\n\nSort... | ALGO | 0.999823 | 4.312848 |
d7e6e899-22d4-44c2-97fa-d2d1b4a45328 | owenjchen/cpp | week5/homework/p7.cpp | /*
7) Write a function that determines whether an input integer is a prime or not.
function name: isPrime()
input: int
output: bool
*/
#include <iostream>
#include <cmath>
using namespace std;
bool isPrime(int n);
bool isPrime(int n) {
if (n <= 1) {
return false;
}
for (int i = 2; i ... | ALGO | 0.999012 | 4.770441 |
c266eba4-7a6a-4861-aa90-1187094109e9 | Saif-000001/Introduction-to-Algorithms-Problem-Solving-Part---III | AlgorithmGraph/Modul_13_5P/pathBFS.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> adj_list[N];
int visited[N], parent[N], level[N];
void bfs(int src)
{
queue<int> q;
visited[src] = 1;
level[src] = 0;
// parent[src] = -1;
q.push(src);
while (!q.empty())
{
int head = q.front();
... | ALGO | 0.999986 | 4.603177 |
fc4839fb-f908-4100-9d9c-9cab8d9ffd79 | sam-astro/TPT-Biological-Mod | src/simulation/Gravity.cpp | #include "Gravity.h"
#include <cmath>
#include <iostream>
#include <sys/types.h>
#include "CoordStack.h"
#include "Misc.h"
#include "Simulation.h"
#include "SimulationData.h"
Gravity::Gravity()
{
// Allocate full size Gravmaps
unsigned int size = (XRES / CELL) * (YRES / CELL);
th_ogravmap = new float[size];
th_g... | ALGO | 0.987734 | 5.012324 |
e8bbe296-30c9-4005-9d86-af261689a012 | YangZhongLou/Blender | blender/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp | #include "btContinuousConvexCollision.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h"
#include "LinearMath/btTransformUtil.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "btGjkPairDetector.h"
#include "btPo... | ALGO | 0.999676 | 4.88414 |
8fbff7e6-46a0-435d-816a-1e4cfb684c45 | Prathap120/CSA5173-crypto | 24.RSA system.cpp | #include <stdio.h>
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int modInverse(int a, int m) {
int m0 = m, t, q;
int x0 = 0, x1 = 1;
if (m == 1)
return 0;
while (a > 1) {
q = a / m;
t = m;
m = a % m;
a = t;
t = ... | ALGO | 0.999753 | 3.818471 |
ac6f224b-ef87-4939-a68a-c1b97b1160aa | JohnLeong/SP4 | SP4/Base/Source/Utility.cpp | #include "Utility.h"
Position operator*(const Mtx44& lhs, const Position& rhs)
{
float b[4];
for(int i = 0; i < 4; i++)
b[i] = lhs.a[0 * 4 + i] * rhs.x + lhs.a[1 * 4 + i] * rhs.y + lhs.a[2 * 4 + i] * rhs.z + lhs.a[3 * 4 + i] * 1;
return Position(b[0], b[1], b[2]);
} | TOOL | 0.930039 | 4.461782 |
9b7191fc-1a4c-49c8-9903-f318836923e0 | gopal-02/Learning-Cpp | Pattern/pat8.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int r=1;r<=n;r++){
//int val=r;
for(int c=1;c<=r;c++){
//cout<<val--;
cout<<r-c+1;
}
cout<<endl;
}
return 0;
} | ALGO | 0.999925 | 3.615757 |
c49ce771-bcb9-40ca-8402-dbeeabd2457c | ben01b/HW4-real | main.cpp | #include<iostream>
#include "recursive.h"
#include "hw4.h"
#include "hw7.h"
bool ListEqual(list_t l1, list_t l2)
// EFFECTS: reeturns true of l1 and l2 are equal, false otherwise
{
// If either are empty, both must be empty for equality
if (list_isEmpty(l1) || list_isEmpty(l2)) {
return (list_isEmpty(l1) ... | TEST | 0.900948 | 3.880918 |
f1d3855d-c00f-494a-91ab-6f47d8177d29 | Nishantkumar1905/week3-KS003-ChipherSchools | lecture14_I.cpp | #include <iostream>
using namespace std;
void swap(int *x, int* y){
int c;
c = *x;
*x = *y;
*y = c;
cout << "swapping is complete" << endl;
}
int main(){
// int a,b;
// a=3;
// b=4;
// swap(&a,&b);
// cout << "the values of a and b after the swap are: "<< a << " " <<b;
... | ALGO | 0.998428 | 4.109751 |
2b7f3bfb-691b-4f86-8521-ac5d0d912b46 | Wisno33/KattisSolutions | CPP/heimavinna.cpp | //Homework https://open.kattis.com/problems/heimavinna
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int total = 0;
string questions, split_questions;
cin >> questions;
stringstream ss(questions);
while(getline(ss , split_que... | ALGO | 0.950374 | 3.633673 |
8067c2fd-5c7e-4af1-b846-3fefc217de15 | yashss1/Sublime_CP | generator_for_graphs.cpp | #include <bits/stdc++.h>
using namespace std;
#define N 10
#define K 10
#define T 5
#define X 100
// Generator for Graphs
// https://codeforces.com/problemset/problem/954/D
void init_code() {
#ifndef ONLINE_JUDGE
freopen("inputf.txt", "r", stdin);
freopen("inputf.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
int m... | ALGO | 0.901915 | 3.556956 |
9c93e61e-dddb-4ca8-af5a-d02243ebab7a | archp4/flutter_portfolio_v1 | 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.998667 | 6.789978 |
3e29275c-5fa0-4a2b-b8f9-71237d3fa561 | sharmishtha2401/leetcode | reverse-linked-list/reverse-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseList... | ALGO | 0.999569 | 5.589193 |
b7a1c471-9042-491b-9154-246f684b05e9 | huangdarz/vilot | src/vilot/chassis.cpp | #include "vilot/chassis.h"
#include "pros/rtos.hpp"
#include "units.h"
#include <algorithm>
#include <variant>
#define MAX_VOLTAGE_MV 12000.f
using namespace units::voltage;
using namespace units::angular_velocity;
using namespace units::angle;
using namespace units::length;
namespace vilot::chassis {
void Differen... | ALGO | 0.996686 | 6.438332 |
e08b36d0-4bea-4730-9b20-0151ea8b19bf | CS23-143/IPMP1921 | WEEK6/greedy/permuting two arrays.cpp | string twoArrays(int k, vector<int> A, vector<int> B) {
sort(A.begin(),A.end());
sort(B.begin(),B.end(),greater<int>());
for(int i=0;i<A.size();i++){
if(A[i]+B[i]<k)
return "NO";
}
return "YES";
}
| ALGO | 0.999981 | 4.221942 |
c8353310-e6c2-45c8-afc3-275af848985d | xiguayizu/ollvm4.0-and-llvm9.0 | llvm/lib/Support/KnownBits.cpp | #include "llvm/Support/KnownBits.h"
using namespace llvm;
static KnownBits computeForAddCarry(
const KnownBits &LHS, const KnownBits &RHS,
bool CarryZero, bool CarryOne) {
assert(!(CarryZero && CarryOne) &&
"Carry can't be zero and one at the same time");
APInt PossibleSumZero = ~LHS.Zero + ~RHS... | ALGO | 0.99913 | 7.330819 |
c591fd0f-a894-4f61-ab8a-bfcd7d981834 | Tiphereth-A/CP-lib | test/aizu-alds1/alds1_12_c.test.cpp | #define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/all/ALDS1_12_C"
#include "../../include/graph/alist.hpp"
#include "../../include/graph/dijkstra.hpp"
using namespace tifa_libs;
int main() {
std::cin.tie(nullptr)->std::ios::sync_with_stdio(false);
u32 n;
std::cin >> n;
graph::alistw<u64... | ALGO | 0.999355 | 4.056404 |
066c1cfc-9d71-4ab7-b57c-2d3c212a799d | OnlyFuture/dualarmrobot | eigen-eigen-323c052e1731/doc/examples/DenseBase_template_int_middleCols.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(:,1..3) =\n" << A.middleCols<3>(1) << endl;
return 0;
}
| ALGO | 0.97307 | 3.154174 |
ec168aa0-cfe0-402b-9aa7-981ca1a52f73 | umang537/Recursion | CPP Recursion Practice Ques/4_Array_Check_Sorted_or_not.cpp | //Check if array is sorted or not
#include <iostream>
using namespace std;
bool check_sort(int a[], int n)
{
if (n == 1)
return true;
if (a[0] < a[1])
return check_sort(a + 1, n - 1);
else
return false;
}
int main()
{
int arr[5] = {4, 5, 36, 34, 67};
if (check_sort(arr, 5... | ALGO | 0.999713 | 4.984589 |
256ff062-50d1-440b-b667-400bb9acc897 | anaswara1000/learning | C++/leetcode_single_number.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
sort(nums.begin(),nums.end());
for(int i=1;i<nums.size();i+=2){
if(nums[i]!=nums[i-1])
return nums[i-1];
}
return nums[nums.size()-1];
}
};
Given a non-empty array of integers nums, every element appears twice excep... | ALGO | 0.999921 | 5.473192 |
d51e3ade-ff1b-4848-88c9-a03c873e3e9d | swapnilhota/interviewBit | Arrays/Add One To Number.cpp | vector<int> Solution::plusOne(vector<int> &A) {
int carry = 0;
int n = A.size();
int x = A[n-1]+1;
A[n-1] = x%10;
carry = x/10;
for(int i=n-2; i>=0; i-- ) {
int x = A[i]+carry;
A[i] = x%10;
carry = x/10;
}
vecto... | ALGO | 0.999846 | 5.617113 |
cb6197e9-ba4c-410f-b3a3-8b16337a7ae7 | Ajayreddy404/LeetCode-Submissions | 0215-kth-largest-element-in-an-array/0215-kth-largest-element-in-an-array.cpp | class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
priority_queue<int, vector<int>, greater<int>> pq;
for(int x: nums){
pq.push(x);
if(pq.size()>k) pq.pop();
}
return pq.top();
}
}; | ALGO | 0.99984 | 5.100866 |
c0ad812d-699a-40ac-bdc1-fbc5ec7af51d | meherajmithun/problem-solving | codeforces/D_Distinct_Split.cpp | // IN THE NAME OF ALLAH
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define print(x) cout<<x<<'\n'
#define mod 1000000007
void solve() {
int n; cin>>n;
string s; cin>>s;
map<char,int>mp;
for(int i=0; i<n; i++){
mp[s[i]]++;
}
map<char,int>mp2;
... | ALGO | 0.999746 | 4.934451 |
f2a05d3f-91b1-4e77-8513-a0a4b5835d73 | pranali21pawar/Competitive-Coding | HackerRank/Algorithms/Strange Counter.cpp | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#inc... | ALGO | 0.999484 | 3.555313 |
c3953a05-841d-4ed1-a845-4974c1435113 | germanohn/competitive-programming | codeforces/1463/c.cpp | // tag:implementation,difficulty:medium,
#include<bits/stdc++.h>
using namespace std;
#define N 112345
#define MAX 1e12
typedef long long ll;
ll t[N], x[N];
/*
ll sig(ll a) {
if (a < 0)
return -1;
return a > 0;
}
*/
ll signal(ll pos, ll goal_pos) {
if (pos > goal_pos)
return -1;
re... | ALGO | 0.999922 | 3.806145 |
718b7c98-096b-41ed-b4a7-2f8be7902389 | Dartpixel/Competitive-Coding | CODECHEF/DIFFCONSEC.cpp | #include <iostream>
using namespace std;
int main()
{
int testcase;
cin >> testcase;
while (testcase--)
{
int n;
cin >> n;
string str;
cin >> str;
int c = 0;
for (int i = 0; i < str.length(); i++)
{
if (str[i] == str[i + 1])
... | ALGO | 0.999878 | 4.349488 |
28cd4e1c-ca6c-40a8-8a31-a02d07597350 | ShaynaCodes/MyGameMod | idlib/hashing/CRC8.cpp |
#include "../precompiled.h"
#pragma hdrstop
/*
CRC-8
*/
#define CRC8_INIT_VALUE 0x0000
#define CRC8_XOR_VALUE 0x0000
#ifdef CREATE_CRC_TABLE
static byte crctable[256];
/*
Generate a table for a byte-wise 8-bit CRC calculation on the polynomial:
x^8 + x^2 + x^1 + x^0
*/
void make_crc_table( void ) {
i... | ALGO | 0.999228 | 5.548545 |
12dda798-c6fa-4099-a141-388389d4d254 | pavan1071/cpp_practise | Num_theory/vid_9_2_lar_exp_2.cpp | /*
if(b <= 1e18) use this
ETF - Euler Totient Function - says phi(n) = n*pro[(1 - (1/p)]) p - all prime factors
phi(n) - no.of co-primes which are less than n ; phi(prime number) is (n-1)
Euler's theorem - (a^b)%m = ((a)^(b%phi(m)))%m ;
que link : https://leetcode.com/problems/super-pow/description/
*/
#include<bits... | ALGO | 0.999992 | 5.376736 |
9fc0a0e9-f568-4cb5-95d8-6004b15f79ea | ishandutta2007/codeforces | tadijasebez/normal/1140/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int n,k,i;
scanf("%i %i",&n,&k);
multiset<int> st;
ll sum=0,ans=0;
vector<pair<int,int>> v(n);
for(auto &p:v) scanf("%i %i",&p.second,&p.first);
sort(v.begin(),v.end());
for(i=n-1;~i;i--)
{
st.insert(v[i].... | ALGO | 0.999979 | 3.380868 |
c3b71d20-c687-4b90-9b56-a9979c8250e0 | praesepe/study | leetcode/414-Third-Maximum-Number/derek_bst.cpp | class Solution {
public:
int thirdMax(vector<int>& nums) {
set<int> st;
for (auto num: nums) {
st.insert(num);
if (st.size() > 3) {
st.erase(st.begin());
}
}
if (st.size() < 3) {
return *st.rbegin();
}
... | ALGO | 0.999967 | 5.7304 |
a4a33646-89ec-4a8c-9f68-9948062b6fe5 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12203_11.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int N = 2e5 + 5;
inline int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getchar();
}
while ('0' <= ch && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
ret... | ALGO | 0.999905 | 4.154079 |
a4490188-2347-4536-b27e-4758c54239c5 | Mannxxx/codeforces | 158D - Ice Sculptures.cpp | //4030436 Jul 6, 2013 2:16:09 PM fuwutu 158D - Ice Sculptures GNU C++0x Accepted 15 ms 100 KB
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
int n, t[20000], sum(0), partsum[20000];
scanf("%d", &n);
for (int i = 0; i < n; ++i)
{
scanf("%d", &t[i]);
sum +=... | ALGO | 0.999948 | 3.854991 |
23cce34d-631f-4656-aa0e-b04ccbddb59a | svn2github/qmcpack | branches/simd-20110220/src/QMCHamiltonians/SkEstimator_CUDA.cpp | #include "QMCHamiltonians/SkEstimator_CUDA.h"
#include "Particle/MCWalkerConfiguration.h"
namespace qmcplusplus {
void
SkEstimator_CUDA::addEnergy(MCWalkerConfiguration &W,
vector<RealType> &LocalEnergy)
{
int nw = W.WalkerList.size();
gpu::host_vector<CUDA_PRECISION> rhok_host;
int stride... | ALGO | 0.97226 | 4.766521 |
2f2d2087-8d0f-4ba1-a370-f0cbd92e70cf | guptamanya18/VisEraseNet-1.0 | main/detectron2/layers/csrc/nms_rotated/nms_rotated_cpu.cpp | namespace detectron2 {
template <typename scalar_t>
at::Tensor nms_rotated_cpu_kernel(
const at::Tensor& dets,
const at::Tensor& scores,
const double iou_threshold) {
// nms_rotated_cpu_kernel is modified from torchvision's nms_cpu_kernel,
// however, the code in this function is much shorter because
... | ALGO | 0.995426 | 7.66435 |
62da8b25-16f4-4165-855d-c30019ef4b11 | nei1ee/WDAlgorithmsNote | 第2章暴力破解/2.2模拟/1.图形排版/2-4输出梯形.cpp | #include<iostream>
using namespace std;
int main() {
int h;
while(scanf("%d",&h)!=EOF) {
int col=h+(h-1)*2;
for(int i=0; i<h; i++) {
for(int j=0; j<col; j++) {
if(j<col-(h+2*i)) {
printf(" ");
} else {
printf("*"... | ALGO | 0.999925 | 3.197197 |
e180d8cd-f23a-4486-9f9f-9b8c4ee666d9 | aufanam/Competitive-Programming | 898A.cpp | #include <bits/stdc++.h>
#define ll long long
#define int long long
#define ld long double
#define ull unsigned long long
#define itn ... | ALGO | 0.999637 | 4.348277 |
7e689a68-3d7b-4500-b221-f9ec859222f8 | jindalshivam09/cppcodes | ACM/online acm/statues.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
bool all_equal (vector<int> &arr,int n) {
for(int i=1;i<n;i++) {
if(arr[i] != arr[0])
return false;
}
return true;
}
int min_moves (vector<int> &arr,int n) {
sort(arr.begin(),arr.end());
int count = 0;
while(!all_equal(arr... | ALGO | 0.999766 | 3.796817 |
f732adec-493e-4b90-af32-9f2e1de81d7c | ishandutta2007/codeforces | ra16bit/normal/482/C.cpp | #include <stdio.h>
#include <string.h>
int n,m,i,j,k,mask,b[1100100];
double c,r,f[1100100];
long long a[1100100];
char s[55][55];
int main() {
scanf("%d",&n);
for (i=0; i<n; i++) scanf("%s",s[i]);
m=strlen(s[0]);
for (i=0; i<n; i++) for (j=i+1; j<n; j++) {
for (mask=k=0; k<m; k++) if (s[i][k]==s[j][k]) mas... | ALGO | 0.999638 | 3.560092 |
da5a5b8a-049a-40d2-bdd0-08b62de4d8d4 | ishandutta2007/codeforces | hloya_ygrt/normal/682/C.cpp | #include <iostream>
#include <fstream>
// #include <bits/stdc++.h>
#include <sstream>
#include <list>
#include <unordered_set>
#include <stack>
#include <deque>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <assert.h>
#include <bitset>
#include <vector>
#include <cmath>
#include <string>
#i... | ALGO | 0.99989 | 3.485595 |
233f3ffa-03be-4ad3-88bb-416cbb74b4f7 | Xeokj/Baekjoon | 1753.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> edge;
vector<edge> graph[20001]; //
vector<int> dist; // ִ Ÿ
priority_queue < edge, vector<edge>, greater<edge>> pq;
// ġ top 켱 ť
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int V, E, K, u, v, w;
cin >> V >> E >> K;
... | ALGO | 0.999944 | 4.311931 |
9de04144-075b-4087-a941-10d10a10a9c1 | G0maa/DS_Course_DrMostafaSaad | 60_1DArrayPractice.cpp | #include <bits/stdc++.h>
using namespace std;
// If solution not found => Too easy.
void max2_1loop() {
// Also 'find pair values of maximum sum' will be solved using this.
// can set them with values of arr[0] and arr[1] accordingly
int max1 = -1, max2 = -1;
int arr[6] {20, 10, 15};;
for(int i = ... | ALGO | 0.9999 | 3.761824 |
15848e4a-1ade-4d73-9408-8bee8313ac6a | mew177/cpp-practice | leetcode/415 - Add Strings/415 - Add Strings/main.cpp | #include <iostream>
#include <string>
using namespace std;
class Solution {
private:
int toInt(char c) {
return int(c) - int('0');
}
public:
string addStrings(string num1, string num2) {
reverse(num1.begin(), num1.end());
reverse(num2.begin(), num2.end());
int ... | ALGO | 0.999742 | 6.455623 |
611c2dfc-bd8d-45a0-b788-06daacae2b54 | JayateerthaH/business | controltraffic.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <sstream>
using namespace std;
#define INF INT_MAX / 2
class DijkstraWithHeap {
public:
int totalNodes; // Total number of nodes in the graph
vector<int> distances, predecessors, visited; // Distance, predecessor... | ALGO | 0.999279 | 5.990865 |
6367e01d-816e-4dde-83b1-e1f095d7a259 | riya231203/flutter | Class_App/Codes/to_do_list/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.996415 | 6.76775 |
8021b797-8252-4227-9ad2-a1f23ad87f7e | istiak7/CompettiveProgramming | codeforces/110/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int len=s.length();
int cnt=0;
for(int i=0; i<len; i++)
{
if(s[i]=='4'||s[i]=='7')
cnt++;
}
if(cnt==4||cnt==7)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return 0;
}
| ALGO | 0.999577 | 3.717206 |
1688446a-edb6-4c72-8e04-5f4bd1c89365 | Shekhu04/CODECHEF | WhoIsTaller.cpp | #include <iostream>
using namespace std;
int main() {
int H1,H2;
cin>>H1>>H2;
if(H1>H2)cout<< "Abhishek" <<endl;
else cout<< "Harshal" <<endl;
return 0;
}
| ALGO | 0.993465 | 3.331998 |
7364aaf2-e2d2-4ddd-bce8-57e0eb1d993d | EgorLis/AistrLab2 | ShenonTest/ShenonTest.cpp | #include "pch.h"
#include "CppUnitTest.h"
#include "../AISDLAB2b/ShenonList.cpp"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace ShenonTest
{
TEST_CLASS(ShenonTest)
{
public:
TEST_METHOD(CodingTest)
{
List<char>* word;
word = new List<char>();
word->push_back('z');
word->pu... | TEST | 0.986856 | 4.247087 |
dd9d7113-08d6-456e-94c0-b00e78c225ed | wilsonify/cuda-samples | 6_Advanced/sortingNetworks/main.cpp | /**
* This sample implements bitonic sort and odd-even merge sort, algorithms
* belonging to the class of sorting networks.
* While generally subefficient on large sequences
* compared to algorithms with better asymptotic algorithmic complexity
* (i.e. merge sort or radix sort), may be the algorithms of choice for... | ALGO | 0.999654 | 6.052044 |
9baebf82-51f9-4bb3-b510-24b90b7284f3 | kimjisoo/packages_apps_SnapdragonCamera | jni/feature_stab/db_vlvm/db_utilities_poly.cpp | /* $Id: db_utilities_poly.cpp,v 1.2 2010/09/03 12:00:10 bsouthall Exp $ */
#include "db_utilities_poly.h"
#include "db_utilities.h"
/*****************************************************************
* Lean and mean begins here *
****************************************************... | ALGO | 0.999576 | 5.307293 |
7226722c-99bd-40ab-808c-97347d3cef97 | sarvex/leetcode-typescript | solution/1300-1399/1332.Remove Palindromic Subsequences/Solution.cpp | class Solution {
public:
int removePalindromeSub(string s) {
if (s.empty())
return 0;
string t = s;
reverse(s.begin(), s.end());
if (s == t)
return 1;
return 2;
}
}; | ALGO | 0.999895 | 6.590424 |
05963ac7-cdd7-491f-9358-0e90f287ff4b | OdiSeU/BaekJoon | Baekjoon_C++/Baekjoon_C++/2164.cpp | #include <iostream>
using namespace std;
int main() {
int N, i = 2;
cin >> N;
while (i < N) i = i << 1;
cout << (N == 1 ? 1 : i - (i - N) * 2);
return 0;
} | ALGO | 0.999903 | 4.180874 |
1dbdf55e-760b-4255-bf3e-aa2ca390f0b7 | Sahil-Shimpi/CodeStudio | 025. Remove Consecutive Duplicates.cpp | // Problem: https://www.codingninjas.com/codestudio/guided-paths/basics-of-c/content/118818/offering/1381766?leftPanelTab=2
#include <iostream>
#include <cstring>
using namespace std;
string removeConsecutiveDuplicates(string input)
{
int n = input.size();
char arr[n];
int ptr = 0;
arr[0] = input[0];
... | ALGO | 0.999954 | 5.874042 |
102f3539-8cec-4f57-9203-3faf6a29d103 | JA-Arthur/CPE | Lista 2 Questão 3.cpp | /*
Lista 1, Questo 3
Autor: Joo Arthur
Data 30/03/2024
*/
#include <iostream>
using namespace std;
int main(){
float raio;
const float pi = 3.14159;
cout << "Digite o valor do raio: \n";
cin >> raio;
float diametro;
diametro = raio * 2;
float area;
area = pi * raio * raio;
cout << "O dimetro da circunfe... | ALGO | 0.97928 | 4.504025 |
95ac9747-62b0-4fad-a7df-45a38ec9b49c | kangjianwei/Data-Structure | Dev-C++/ExerciseBook/06.70/06.70.cpp | #include <stdio.h>
#include <stdlib.h> // ṩmallocreallocfreeexitԭ
#include "Status.h" //**01 **//
#include "BiTree.h" //**06 Ͷ**//
/*
* Ķṹ
*/
Status Algo_6_70(BiTree* T, FILE* fp);
int main(int argc, char* argv[]) {
BiTree T;
FILE* fp;
printf("T...\n");
fp = fopen("TestData.txt", "r... | ALGO | 0.999121 | 3.312832 |
302be9c5-a29c-48a8-879a-aa96323b5a4f | vugartaghiyev/e-olymp-cplus | aldatma8683.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
string a="34050628916015625";
cin>>n;
unsigned long long end;
if(n==10)cout<<a;
else end=pow(45,n); cout<<end;
return 0;
}
| ALGO | 0.999304 | 3.83161 |
e021e578-5aac-405b-beec-f1291a72296a | raincross7/code-similarity | codes/train_code/problem048/problem048_44.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fore(b,c) for(int val0=b;val0<c;val0++)
#define forr(k,c,s) for(int k=c;k<s;k++)
#define pb push_back
#define mmp make_pair
using namespace __gnu_pbds;
using namespace std;
template<typename T>
using oset = tr... | ALGO | 0.999998 | 3.372026 |
e4565849-e5c2-479f-bd05-29cbd7de6ab3 | forking-altcoins/C4T | src/messagesigner.cpp | #include "base58.h"
#include "hash.h"
#include "main.h" // For strMessageMagic
#include "messagesigner.h"
#include "masternodeman.h" // For GetPublicKey (of MN from its vin)
#include "tinyformat.h"
#include "utilstrencodings.h"
bool CMessageSigner::GetKeysFromSecret(const std::string& strSecret, CKey& keyRet, CPubKey... | TOOL | 0.968652 | 7.220028 |
caf5376e-ea30-40d6-ad5c-0b29ce02e815 | aniruddh-joshi/LeetCode | 0399-evaluate-division/0399-evaluate-division.cpp | class Solution {
unordered_map<string, vector<pair<string, double>>> adjList;
unordered_map<string, bool> visited;
double queryAns;
public:
bool dfs(string startNode, string endNode, double runningProduct){
if(adjList.find(startNode) == adjList.end() || adjList.find (endNode) == adjList.en... | ALGO | 0.999935 | 6.161748 |
ddcf775b-58a6-413f-a51d-61ece7d7bf6d | austinguish/lammps | src/USER-MEAMC/meam_dens_final.cpp | #include "meam.h"
#include "math_special.h"
using namespace LAMMPS_NS;
void
MEAM::meam_dens_final(int nlocal, int eflag_either, int eflag_global, int eflag_atom, double* eng_vdwl,
double* eatom, int ntype, int* type, int* fmap, int& errorflag)
{
int i, elti;
int m;
double rhob, G, dG, Gbar... | ALGO | 0.998813 | 5.006556 |
47b98d26-c21f-42ab-acd0-9d89c9b109ee | KaiDD27/IOI2024 | NZOI/2024-1-5.cpp | #include <algorithm>
#include <array>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
#define endl "\n"
int n, m;
vector<ll> t;
vector<vector<ll>> adj, dp;
// dfsNextButNotSubTree是dfs
// 先序遍历里面排在当前节点之后,且不是当前节点的子节点的第一个节点,其实就是先序遍历排在当前节点后面的第一个兄弟节点
void dfs(int a, int dfsNextButNotSubTree,... | ALGO | 0.999961 | 4.312284 |
2ed367e3-e4f1-4d32-bb8c-530e36c9337d | ShashwatShukla0/Daily_DSA | LinkedList/DeketionLL.cpp | #include<iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
};
void addFront(Node** head,int new_data) {
Node* new_node = new Node();
new_node->data=new_data;
new_node->next=(*head);
(*head)=new_node;
}
void deleteBegin( Node** head) {
Node* temp;
te... | ALGO | 0.996475 | 4.592338 |
153f00f3-9cb7-4468-951e-65f78a1d9e96 | avinashw50w/ds_algo | Arrays/find the nearest smallest no around a given no in an array.cpp | /*find the nearest smallest no around a given no in an array*/
/*Given an array A of n elements, find for each i, the largest j < i such that a[j] < a[i] */
#include <bits/stdc++.h>
using namespace std;
int main() {
int a[] = {1, 2, 3, 4, 5, 4, 3, 2, 1, 6};
int n = sizeof(a)/ sizeof(a[0]);
int l[n+1];
memset(l, ... | ALGO | 0.99997 | 4.261436 |
538d8278-a65a-4b66-97bf-70acc4224a16 | BCChangEBFE/CarND-Path-Planning-Project | src/Eigen-3.3/unsupported/doc/examples/EulerAngles.cpp | #include <unsupported/Eigen/EulerAngles>
#include <iostream>
using namespace Eigen;
int main()
{
// A common Euler system by many armies around the world,
// where the first one is the azimuth(the angle from the north -
// the same angle that is show in compass)
// and the second one is elevation(the angl... | ALGO | 0.989945 | 5.125681 |
9ab6e54d-4b0a-4696-a083-a3c405ec39f3 | OmarAliTag/random_quote | 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 |
cf4e2757-e2d2-4daf-84b4-5735e302dbd4 | powerLEO101/Work | Code/LG/LG3191/code.cpp | /**************************
* Writer : Leo101
* Problem : Luogu P3191 [HNOI2007]紧急疏散EVACUATE
* Tags : 网络流,二分答案,广度优先搜索
**************************/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#define File(s) freopen(#s".in", "r", stdin); freopen(#s".out", "w", std... | ALGO | 0.999933 | 3.775696 |
78b74498-5cd9-4bd8-bf23-d25f4b7b25e9 | Ranjana993/AtoZdSA | Week06/Lecture2.cpp | #include <bits/stdc++.h>
using namespace std;
void printArr(int arr[], int n, int i)
{
if (i >= n)
{
return;
}
cout << arr[i] << " ";
printArr(arr, n, i + 1);
}
int findMax(int arr[], int n, int i, int &maxi)
{
if (i >= n)
{
return maxi;
}
if (arr[i] > maxi)
{
... | ALGO | 0.999935 | 4.098399 |
46a7c8de-cc9f-43c9-b7c3-f044f8fe8826 | ishandutta2007/codeforces | kmjp/normal/1010/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999887 | 4.824758 |
66084c68-93c9-47a3-8f82-e307f9cd3684 | jainsras/Leetcode-monthly-challenge-2021 | March 2021/17.Generate Random Point in a Circle.cpp | class Solution {
public:
double r, x, y;
public:
Solution(double radius, double x_center, double y_center) {
r = radius;
x = x_center;
y = y_center;
srand(time(0));
}
double random(){
return (double)rand()/RAND_MAX;
}
vector<double> randPoin... | ALGO | 0.996776 | 5.118958 |
217e2444-9fcb-4a2f-9e6d-1bcd9eb9df04 | KevinBaileyCrum/PermutationMadness | perm.cpp | #include <iostream>
#include <stdlib.h>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
class Program {
public:
int OGpos;
int currPos;
char value;
Program ( int, char );
};
Program::Program ( int a, char b ){
... | ALGO | 0.996136 | 3.562809 |
ec265995-69ec-46cd-bf0b-5459732a99a6 | EASINTUHA/Coding-Journey-reset | April 2025 past/Chef_and_Spells.cpp | //codechef 965
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) ... | ALGO | 0.999893 | 4.48378 |
dc321043-beaa-47ff-abc1-df1a3aabddb5 | anarchydevs/aoia | ThirdParty/Boost/libs/graph/test/relaxed_heap_test.cpp | // Authors: Douglas Gregor
// Andrew Lumsdaine
#ifndef BOOST_RELAXED_HEAP_DEBUG
# define BOOST_RELAXED_HEAP_DEBUG 0
#endif
#include <boost/pending/relaxed_heap.hpp>
#include <boost/test/minimal.hpp>
#include <utility>
#include <iostream>
#include <vector>
#include <boost/optional.hpp>
#include <boost/rando... | TEST | 0.974575 | 5.807666 |
669a1a25-5d98-4916-995c-d9e04fdd7d3c | vfolunin/archives-solutions | EOlymp/4729.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int length = 0;
while (1) {
int value;
cin >> value;
if (!value)
... | ALGO | 0.997571 | 3.224556 |
35199391-4964-4220-966d-e7a5d22e08f7 | Stradex/librecoop | idlib/math/Simd_AltiVec.cpp | #include <math.h>
#include <float.h>
#include "sys/platform.h"
#include "idlib/math/Simd_AltiVec.h"
// Doom3 SIMD Library version 0.5
// Patrick Flanagan (<EMAIL>)
// Sanjay Patel (<EMAIL>)
// Architecture & Performance Group, Apple Computer
//===============================================================
//
// Al... | TOOL | 0.941069 | 5.336633 |
b49ddb18-68fb-4b5a-ae5a-644904abae7b | Aman-Gupta-Ji/Practice-Code | try2.cpp | #include<bits>/stdc++.h>
vector<int> balanceOrNot(vector<string>& expressions, vector<int> maxReplacements) {
int n = expressions.size();
vector<int> res(n);
for(int i = 0; i < n; i++) {
string exp = expressions[i];
int maxR = maxReplacements[i];
int o = 0, e = 0;
for(char c... | ALGO | 0.99933 | 4.511243 |
f11a4b6e-173d-468d-beca-7c9ea057a82c | cjlcarvalho/maratona | URI/2533.cpp | #include <iostream>
using namespace std;
int main(){
int n;
while(cin >> n){
double* notas = new double[n];
double* cargas = new double[n];
for(int i = 0; i<n; i++)
cin >> notas[i] >> cargas[i];
double sumNC = 0;
double sumC = 0;
for(int i = 0; i<n; ... | ALGO | 0.997289 | 3.983212 |
2a6b0c4e-db31-4eb7-b67f-904c89b3087f | manikanta2901/ubuntu | .history/random/trees/maxiEle_20200729184144.cpp | // Using Segment tree
// Finding the imum between given range l and r
// For large number of queries
#include<bits/stdc++.h>
using namespace std;
#define m 10000
int tree[4 * m];
void build(int arr[],int index,int low,int high){
if(low == high){
tree[index] = arr[low];
}else{
int mid = (low + ... | ALGO | 0.999967 | 4.539897 |
5bc0636c-3a7c-40b8-9238-50baf7a0e17c | hal-uw/gem5-multiChiplet-micro24 | src/systemc/tests/systemc/misc/unit/data/datawidth_signed/truncation/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.970669 | 5.331775 |
a4fc74aa-1a56-4824-8071-4adf23abf3fb | phuocchubeo123/Codeforces | Contests/Code Jam/2022/1A/dsol.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vt vector
#define forlr(i, l, r, k) for (int i = l; i < r; i += k)
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
const int N = 2e5 + 4;
int T;
void prepare(){
}
void solv... | ALGO | 0.997349 | 3.453387 |
6f3f1e44-51de-46fb-8bd6-dc3cbb3b6711 | TheRishavRoy/DS_Algo_Interview | Tree/LC - 222 : Count Complete Tree Nodes.cpp | 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 Solution
{
pub... | ALGO | 0.999649 | 5.93487 |
920f3254-6ecc-409c-b00c-f719aab4f17b | aarya280404/Leetcoder | 0496-next-greater-element-i/0496-next-greater-element-i.cpp | class Solution {
public:
vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {
int n=nums1.size(),m=nums2.size();
unordered_map<int,int>nge;
stack<int>st;
for(int i=m-1;i>=0;i++){
while (!st.empty() && st.top() <= nums2[i]){
... | ALGO | 0.999825 | 5.853031 |
ae270f49-8d7c-41ae-b706-0998d54e119f | Xiaovy/acm | codeforces/Edu_Round_76/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while (t--) {
int n,x,a,b;
cin >> n >> x >> a >> b;
if (a > b) swap(a , b);
int tmp = x;
x -= min(a - 1 , tmp);
a -= min(a - 1 , tmp);
b += min(n - b , x);
cout << b - a << endl;
}
}
| ALGO | 0.998901 | 3.70717 |
c0fa56eb-87fe-4c56-91c0-46194087c1e1 | matthewmazzuca/bridge-construction | finite_element_analysis/contrib/eigen/doc/examples/Tutorial_ArrayClass_cwise_other.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXf a = ArrayXf::Random(5);
a *= 2;
cout << "a =" << endl
<< a << endl;
cout << "a.abs() =" << endl
<< a.abs() << endl;
cout << "a.abs().sqrt() =" << endl
<< a.abs().sqrt() << endl... | ALGO | 0.932646 | 3.130341 |
014108b0-58b6-49d4-8a74-698548893ad4 | monicasanthi/Object-oriented-program-Program | Inheritance/Lab programs/11.cpp | #include <iostream>
using namespace std;
const int size = 3;
class vector {
int v[size];
public:
vector();
vector(int *x);
friend vector operator*(int a, vector b);
friend vector operator*(vector b, int a);
friend istream &operator>>(istream &din, vector &b);
friend ostream &operator<<(ostre... | ALGO | 0.996688 | 3.428649 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.