uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5cf96c0c-6302-4d7e-b1b4-78a4fce1a1e3 | Gauravglitch/third-year-first-sem | computer graphics lab/lab2side.cpp | #include<stdio.h>
#include<graphics.h>
#include<conio.h>
#include<math.h>
void DDA(int,int,int,int);
int main()
{
initwindow(1000,1000,"DDA");
int x1,x2,y1,y2;
printf("enter two end points:(x1,y1,x2,y2)\n");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
DDA(x1,y1,x2,y2);
getch();
closegraph();
return 0;
}
void DDA(int x1... | ALGO | 0.998144 | 3.661472 |
c12015e8-4238-4721-918c-424e8044baa7 | TimidLion/baekjoon | 11404_floyd.cpp | #include<stdio.h>
#include<string.h>
#include<algorithm>
#define INF 100001
using namespace std;
int map[101][101];
int main()
{
int n,m;
scanf("%d",&n);
scanf("%d",&m);
for(int i=0;i < 101; i++)
for(int j=0; j < 101; j++)
map[i][j] = INF;
int a,b,c;
for(int i=0;i < m; i++)... | ALGO | 0.999976 | 3.450421 |
9fc331cf-607d-4081-8c9f-c340f274cf02 | raincross7/code-similarity | codes/train_code/problem312/problem312_99.cpp | #include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k); i > (n); i--)
#define FORre(i, k, n) for(int i = (k); i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (... | ALGO | 0.999999 | 4.207721 |
9611c0d9-da82-4d36-a43d-0e6b680a47f5 | siyuqtt/Leetcode-C- | PartitionList.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *partition(ListNode *head, int x) {
ListNode dump1(-1), dump2(-1);
ListNode * less = &dump1;
ListNo... | ALGO | 0.99999 | 5.41456 |
2e3471e3-012c-4e67-97e9-0dd2d5df0c4d | zkalykov/31github | C_PLUS_PLUS_CODE/dfs.cpp | #include<bits/stdc++.h>
using namespace std;
#define I_am_first 1
#define never_give_up puts("I never give up !!! ")
#define until_zero 0
#define ll long long
#define fastUI ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(a) push_back(a);
#define pf(a) push_front(a);
#define ret return
#define ff first
#... | ALGO | 0.999906 | 3.957632 |
457f266b-8e55-4eb8-a92c-ed8e90626947 | Tasmia22/Codeforce | codeforce/Div 2/A. Déjà Vu.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
bool palindrome(string s)
{
for (int i=0;i<=s.size()/2;i++)
{
if(s[i]==s[s.size()-1-i])
return false;
}
}
int main()
{
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;... | ALGO | 0.999201 | 3.866946 |
955df135-2b25-4808-be3f-74b9a80f1415 | leaptop/reposCopy | чистка 1 курс/Задания по проге 1-й курс(решённые)/Лабы второй семестр/Lab6_2.cpp | #include <stdio.h>
#include <clocale>
int Func(int m, int n, float &pd, float &pm){
if (m&&n&&(n>m)){
int j; float c=1.;
for(j=0; j<n-m; c*=float(n-j)/(j+1), j++ );
int i; float p=0.45, q=0.55; float r=0.45,t=0.55;
for (i=0; i<m; i++) p*=0.45,t*=0.55;
for (i=0; i<n-m; i++) q*=0.55,r*=0.45;
pd=c*p*q; pm=c*r... | ALGO | 0.998513 | 3.258258 |
a9fbb964-f280-4602-9ed6-b7e572e259f3 | miao-hub/HUST_C | C实验作业第一次/C语言第一次1.1.cpp | #include<stdio.h>
#define PI 3.14159
int main()
{
int f ;
short p, k ;
double c , r , s ;
/* for task 1 */
printf("Input Fahrenheit:" ) ;
scanf("%d",&f ) ;
c = 5.0/9*(f-32) ;
printf( " \n %d (F) = %.2f (C)\n\n ", f, c ) ;
return 0;
}
| ALGO | 0.991641 | 3.584901 |
3a67d99c-9159-4059-ac17-225f36b2b8de | sachi097/leetcode | 1129-longest-string-chain/1129-longest-string-chain.cpp | class Solution {
public:
bool predecessor(string& prev, string& curr) {
int m = prev.length();
int n = curr.length();
if(m >= n || n-m != 1)
return false;
int i = 0, j = 0;
while(i < m && j < n) {
if(prev[i] == curr[j]) {
... | ALGO | 0.999995 | 6.010464 |
30e8ea29-31f0-4739-8186-f49e5df7a819 | ch1hyun/algorithm | LeetHub/Easy/1971-find-if-path-exists-in-graph/1971-find-if-path-exists-in-graph.cpp | #include <cstring>
#include <vector>
class Solution {
public:
vector<bool> visited;
vector<vector<int>> e;
bool validPath(int n, vector<vector<int>>& edges, int source, int destination) {
visited.resize(n, false);
e.resize(n);
for (auto& edge : edges) {
e[edge[0]].pu... | ALGO | 0.999962 | 6.137046 |
f5a21d20-d144-4af1-8322-45acf78b3be0 | ishandutta2007/codeforces | jtnydv25/normal/853/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &(x))
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, iknt>
#define F first
#define S second
const int N = 1e6 + 10;
int A[N], perm[N];
bool cmp(int i, int j){
return A[i] > A[j];
}
set<int> ms;
int ans[N]... | ALGO | 0.999997 | 3.189578 |
c55c475f-7baf-4eea-af3e-488466619baf | carlosolarte/lip-ect | docs/13-ordenacao/code/circulos.cpp | #include <iostream>
#include <cmath>
#define TAM 100
using namespace std;
struct Ponto {
double x, y;
};
struct Circulo{
Ponto c;
double raio;
};
void swap(Circulo v[], int p1, int p2){
Circulo temp;
temp = v[p1];
v[p1] = v[p2];
v[p2] = temp;
}
void ordenar(Circulo v[], int n){
int i... | ALGO | 0.999321 | 4.3634 |
e78ceedd-5d90-4df8-90fb-cc15bee50ded | agegold/openpilot_084-atom | selfdrive/controls/lib/cluster/fastcluster_R_dm.cpp | struct pos_node {
t_index pos;
int node;
};
void order_nodes(const int N, const int * const merge, const t_index * const node_size, int * const order) {
/* Parameters:
N : number of data points
merge : (N-1)×2 array which specifies the node indices which are
merged in each ... | ALGO | 0.999984 | 6.393015 |
5a8d5c44-6ae8-4133-ada6-4428d71be03e | tapoban123/My-Public-Flutter-Projects | google_clone/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.998706 | 6.762122 |
f31dc00c-3431-4d4e-b07e-f33058d91565 | son556/coding_test | coding_test/5th_week/2638.cpp | #include "test.hpp"
//#include <bits/stdc++.h>
using namespace std;
int n, m;
int arr[100][100], visited[100][100], cnt[100][100];
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};
bool check() {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (arr[i][j])
r... | ALGO | 0.999789 | 4.709692 |
d941f45c-8b1b-40c0-8bf8-4ade4266c417 | NhanHoThanh/DSA_HCMUT | Lab3/BinarySearchTree/levelAlterTraverse.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
class Node
{
public:
int val;
Node *left;
Node *right;
Node()
{
this->left = this->right = nullptr;
}
Node(int val)
{
this->val = val;
this->left = th... | ALGO | 0.999997 | 4.997032 |
ca4714df-cb4a-400e-827a-3e07faa3feea | rajprem4214/LeetCode | Permutation with Spaces - GFG/permutation-with-spaces.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
void helper(string sb,string s,vector<string> &vc){
if(s.length()==0){
vc.push_back(sb);
return;
}
char c1 = s[0];
helper(sb+" "+c1,s.substr(1),vc);
helper(sb+c1... | ALGO | 0.998041 | 6.412535 |
cfd8d28d-3b46-43cc-840f-b8d963dfb4fc | Mandey4172/DMGwGB | DMGwGB/DMGwGB/GrainGrowthRule.cpp | #include "GrainGrowthRule.h"
#include <vector>
void GrainGrowthRule::transition(unsigned int * cell, std::vector<unsigned int> & neighborhood)
{
if (!neighborhood.empty())
{
std::vector<unsigned int> unique_grains;
std::vector<unsigned int> count_grain;
for (unsigned int n : neighborhood)
{
bool exist = ... | ALGO | 0.99896 | 4.43516 |
2360a414-8f3b-4856-aa93-b07b5fb91878 | juniorandrade1/Competitive-Programming | Codeforces/educational33/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n; scanf("%d", &n);
int go = 3;
for(int i = 0; i < n; ++i) {
int x; scanf("%d", &x); x--;
if(!((go >> x) & 1)) {
puts("NO");
return 0;
}
int lose = (go ^ (1 << x));
go = ((1 << 3) - 1) ^ lose;
}
puts("YES");
re... | ALGO | 0.999935 | 3.840605 |
4e82b3ff-abbc-4f92-af11-99aa5a537951 | GalloLuigi/Post-quantum-cryptography-on-MCUs-Implementation-and-performance-analysis | Porting/Arduinonano33BLE/Saber_on_ArduinoNano33/src/Saber/verify.cpp | /*-------------------------------------------------
This file has been adapted from the implementation
(available at https://github.com/pq-crystals/kyber) of
"CRYSTALS – Kyber: a CCA-secure module-lattice-based KEM"
by : Joppe Bos, Leo Ducas, Eike Kiltz, Tancrede Lepoint,
Vadim Lyubashevsky, John M. Schanck, Peter ... | ALGO | 0.998161 | 4.990298 |
54658825-2934-4164-aa72-f51d89c038ea | the-chosen-wan/Leetcode | 2790.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#include<chrono>
const int inf = (1e9) + 7;
#define pb push_back
#define pf push_front
#define mp make_pair
int ans(vector<int>& nums) {
int n = nums.size();
auto check = [&](ll k)->bool{
... | ALGO | 0.999784 | 5.101994 |
f7911e10-e01c-4141-9206-771789040a8d | otavioon/COLA-2022-Tools | datasets/src/optz/codenet/1/p04045_s136053902.cpp | #include <iostream>
#include <vector>
//#include <string>
#include <algorithm>
using namespace std;
int SolveCSub(int pay, int digit, const bool hate[10], int N){
if(digit <= 0){
if(pay >= N) return pay;
else return 100000;
}
int iret = 100000;
for(int i = 0; i < 10; i++){
if(hate[i] && !(i == 0 ... | ALGO | 0.994985 | 3.602239 |
71ca0bb1-f414-403c-89ef-f2efdde3f160 | m7913d/xlnt-community | source/detail/serialization/vector_streambuf.cpp | // Copyright (c) 2016-2022 Thomas Fussell
// Copyright (c) 2024-2025 xlnt-community
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the... | TOOL | 0.88986 | 7.82014 |
52c7b033-831e-4c56-b438-99784a15bda5 | nillerusr/srcsdk | utils/vrad/disp_vrad.cpp | #include "disp_vrad.h"
#include "utllinkedlist.h"
#include "utlvector.h"
#include "iscratchpad3d.h"
#include "scratchpadutils.h"
//#define USE_SCRATCHPAD
#if defined( USE_SCRATCHPAD )
static IScratchPad3D *g_pPad = 0;
#endif
int FindNeighborCornerVert( CCoreDispInfo *pDisp, const Vector &vTest )
{
CDispUtilsHelper ... | ALGO | 0.973145 | 5.761774 |
e928c0a7-0946-45f3-9a4b-dcf3791a0b6f | maketripcoin/maketrip-MTRIP | src/crypto/hmac_sha256.cpp | #include "crypto/hmac_sha256.h"
#include <string.h>
CHMAC_SHA256::CHMAC_SHA256(const unsigned char* key, size_t keylen)
{
unsigned char rkey[64];
if (keylen <= 64) {
memcpy(rkey, key, keylen);
memset(rkey + keylen, 0, 64 - keylen);
} else {
CSHA256().Write(key, keylen).Finalize(rke... | ALGO | 0.985362 | 5.856034 |
3d621085-f4df-4bbc-9b51-89e9adf9c176 | ishandutta2007/codeforces | oipotato/normal/1475/A.cpp | #include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<map>
#include<cassert>
#include<string>
using namespace std;
#define pb push_back
#define mp make_pair
#defin... | ALGO | 0.999266 | 4.064585 |
73b254e3-e2ed-4c1c-8eb0-dad916a013a7 | NEsbolganov/Programming | ACMP/6.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
if(s.length()!=5){
cout<<"ERROR";
return 0;
}
// cout<<int(s[0]);
if(s[2]!='-'){
cout<<"ERROR";
return 0;
}
// cout<<'b'-'a'<<" "<<'7'-'4';
if((int(s[0])<=64 or int(s[0])>=73) a... | ALGO | 0.994412 | 3.447167 |
9afe2030-993c-4e3c-8057-452ae354f463 | pratikdhulubulu/Cpp | pattern8.cpp | #include<iostream>
using namespace std;
int main(){
int row;
cout<< "Enter rows: "<< endl;
cin>> row;
int i = 1;
int count = 1;
while(i<=row){
int j = 1;
while(j<=i){
cout<< count<< " ";
count++;
j++;... | ALGO | 0.998178 | 3.897798 |
18f6da1d-1088-44d4-b488-3f1c49d83126 | rishabh27goel/DSA-Extra-Questions | Leetcode/Isomorphic_Strings.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
class Solution {
public:
bool isIsomorphic(string s, string t) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n = s.size();
unordered_map<char, char> mps;
... | ALGO | 0.999983 | 5.922741 |
d17c1aff-932c-44d7-9da2-bfa1b9e4be37 | shentoumengxin/2024Autumn | Data Structure and Algorithm Anlysis/CS203 DSAA Code/lab4/E.cpp | #include<iostream>
using namespace std;
struct people{
public:
long long height;
int position;
int left;
int right;
};
int main(){
int T;
cin>>T;
people *a=new people[50000+5];
people *stack=new people[50000+5];
for(int i=1;i<=T;i++){
printf("Case %d:\n",i);
int n;
... | ALGO | 0.999856 | 3.451735 |
02ddfebc-34a6-4151-ac97-fee25e41ed19 | mmhlego/Cheatsheet-2024 | _test.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll, ll>
#define vll vector<ll>
#define sll set<ll>
#define DEB(x) cout << #x " : " << x <<endl;
#define MOD 1000000007
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll n, m, q;
string s;
complex<double> a = co... | ALGO | 0.961936 | 3.516767 |
35f47d7d-bee9-414a-a319-4e51aa9eaf97 | lovejg/baekjoon | 1920.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define endl '\n'
using namespace std;
vector<int> v; // 함수에서도 쓸거라서 전역으로 선언
void Init()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
bool bs(int target) // 이진 탐색 함수
{
int left = 0;
int right = v.size() - 1;
while (... | ALGO | 0.999988 | 5.686894 |
77914597-3937-41c1-8e40-759af7b393d6 | SequoiaDB/SequoiaDB | thirdparty/boost/libs/phoenix/example/factorial.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/function.hpp>
struct factorial_impl
{
template <typename Sig>
struct result;
template <typename This, typename Arg>
struct result<This(Arg)>
: result<This(Arg const &)>
... | TOOL | 0.953555 | 5.839092 |
2643a7ee-7361-4fc4-88b4-1bba7af70215 | otemitayo1212/Data_Structures | My_Work/Homework/HW7/Main.cpp | #include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <regex>
#include <list>
#include <map>
#include <cctype> // For std::isalnum
#include <algorithm>
// Function to count the occurrence of a keyword in a document
int Count_doc_and_KeyWord(std::ifstream& infile, const std::string& keywo... | ALGO | 0.996055 | 5.632789 |
668a619a-aa00-497f-a19a-f391e3f8403a | ryanick5/CPP | calc.cpp | #include <iostream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
// A simple function to evaluate + and * only for this example
int evaluate_expression(const vector<string> &expression)
{
int result = stoi(expression[0]);
for (int i = 1; i < expression.size(); i += 2)
{
... | ALGO | 0.988184 | 6.542466 |
600c5c0e-fb69-4c97-8df4-880a17eadc5c | AlexandruValeanu/Competitive-Programming | Varena/GPS.cpp | #include <bits/stdc++.h>
using namespace std;
#define Point pair<int,int>
#define x first
#define y second
const int Nmax = 5000 + 1;
const int MOD = 100003;
int X[Nmax], Y[Nmax];
Point P[Nmax];
int N;
int aib[Nmax];
int lsb(int x)
{
return x & (-x);
}
void update(int aib[], int p, int v)
{
while (p <= N... | ALGO | 0.999916 | 4.036458 |
fb0b7025-e681-40d9-b8da-e78c08c3dd8f | pth573/DSA-PTIT | _DSA02025.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int used[2000];
int n;
//vector<vector<int>> ans;
string ans[2000];
int kq = INT_MAX;
int x[2000];
int check(int x, int y)
{
int dem = 0;
string tmp1 = ans[x];
string tmp2 = ans[y];
int n = tmp1.size();
int m = tmp2.size();
int h = 0, k = 0;
w... | ALGO | 0.999976 | 4.315542 |
f883eb8b-965c-43ca-b90b-547b0b8ccfcf | shu8Cream/atcoder-archive | atcoder.jp/abc057/abc057_a/Main.cpp | /**
* author: shu8Cream
* created: 24.07.2021 20:49:41
**/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); i++)
#define rrep(i,n) for (int i=(n-1); i>=0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using ll = long long;
using P = pair<l... | ALGO | 0.999646 | 3.988515 |
474d109a-b1f0-4f72-b094-e30a51a4e559 | austin880625/problem_solving | ZJ/a815.cpp | #include<iostream>
#include<queue>
#include<stack>
#include <stdio.h>
#include<string.h>
using namespace std;
struct poi
{
int row,col;
bool operator ==(const poi &rhs)const
{
return row==rhs.row&&col==rhs.col;
}
bool operator !=(const poi &rhs)const
{
return row!=rhs.row||col!... | ALGO | 0.999939 | 4.224615 |
f71d8292-4f98-4564-97d4-296b57f34243 | steve-cw-chung/codewars_CPP | 30.Compression.cpp | #include <string>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
string compressedString(string message) {
string retVal = "";
int consecutive = 0;
// for loop through the string
// starting from 0
// if consec == 0 then consec+1 then i++
// if consec > 0 then compare with previous charact... | ALGO | 0.999994 | 5.364107 |
f0ecd707-be8b-4336-999f-35d9a6b49aa5 | pacha2880/competitive_programming_codes | A. Deletions of Two Adjacent Letters.cpp | #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/rope>
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define eq(a, b) (fabs(a - b) < EPS)
#define md(a, b) ((a) % b +... | ALGO | 0.999846 | 4.841167 |
ded373b5-9c6c-45b3-a394-5c02436f8cae | Sujal-prajapati07/College_programs | C++/program_75/_69_Relational_operator_wc_WRNA.cpp | #include<iostream>
using namespace std;
class rel_oprt{
public:
int X,Y,Z,C,P,R;
int a,b;
int rel_func()
{
X=(a>b);
Y=(a<b);
Z=(a>=b);
C=(a<=b);
P=(a==b);
R=(a!=b);
return 1;
}
}obj;
int main()
{
int ans;
cout<<"Enter... | ALGO | 0.999721 | 3.211869 |
3ab81d75-a5ee-4589-825f-c8ac224080c6 | pranavjawale01/cp.exe | LeetCode/3133-minimum-array-end/3133-minimum-array-end.cpp | class Solution {
public:
long long minEnd(int n, int x) {
n--;
vector<int> xBit(64, 0), nBit(64, 0);
for (int i = 0; i < 32; i++) {
xBit[i] = (x >> i) & 1;
nBit[i] = (n >> i) & 1;
}
for (int i = 0, j = 0; i < 64 && j < 32; i++) {
if (xBit[i... | ALGO | 0.999954 | 5.866158 |
d1eead10-1588-4194-895e-f9b002198bcb | barak/adolc | ADOL-C/test/powexam.cpp | /****************************************************************************/
/* INCLUDES */
#include <adolc/adolc.h> /* use of ALL ADOL-C interfaces */
#include <iostream>
using namespace std;
/**********************************************... | ALGO | 0.993481 | 6.167822 |
6ddca70c-be4e-493f-91f0-3b50d24491eb | leibidontknow/lb-cpp-codes | 图灵矩阵/hdu5015.cpp | #include<bits/stdc++.h>
using namespace std;
#define max(a,b) [](int c,int d){return c>d?c:d;}(a,b)
#define min(a,b) [](int c,int d){return c<d?c:d;}(a,b)
const int mod =1e7+7;
int n,m;
struct Matrix{
int x,y;
vector<vector<int> >a;
Matrix(int r,int c):x(r),y(c){
a=vector<vector<int> >(r+1,vector<in... | ALGO | 0.999984 | 3.56496 |
b628a6f3-6314-44bd-8390-59565bc6039f | JamesQAQ/Coding-Practices | LeetCode/Easy/0705. Design HashSet/2022-08-05_Accepted.cpp | class MyHashSet {
set<int> s;
public:
MyHashSet() {
s.clear();
}
void add(int key) {
s.insert(key);
}
void remove(int key) {
s.erase(key);
}
bool contains(int key) {
return s.find(key) != s.end();
}
};
/**
* Your MyHashSet object ... | ALGO | 0.995067 | 5.161794 |
8a4af6e1-aca6-442c-9a31-0bde482256eb | ishandutta2007/codeforces | chenyu_qiu/normal/1735/C.cpp | #include <bits/stdc++.h>
using namespace std;
int par[26];
int find(int x) {
return x == par[x] ? x : (par[x] = find(par[x]));
}
void solve() {
int n;
cin >> n;
string s;
cin >> s;
vector<int> to(26, -1);
vector<bool> tag(26);
iota(par, par + 26, 0);
int cnt = 0;
for (int i =... | ALGO | 0.999986 | 5.22185 |
9c9b38bd-affc-4582-9263-e648e4ed4bda | ishandutta2007/codeforces | xellos/normal/1672/C.cpp | // iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <chrono>
#include <random>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include ... | ALGO | 0.999933 | 4.025167 |
52fc8e5a-6b19-4543-ae57-e4b93c75da28 | playbar/compress | 7z/CPP/7zip/Crypto/RandGen.cpp | // RandGen.cpp
#include "StdAfx.h"
#include "RandGen.h"
#ifndef USE_STATIC_SYSTEM_RAND
#ifndef _7ZIP_ST
#include "../../Windows/Synchronization.h"
#endif
#ifdef _WIN32
#ifdef _WIN64
#define USE_STATIC_RtlGenRandom
#endif
#ifdef USE_STATIC_RtlGenRandom
#include <ntsecapi.h>
EXTERN_C_BEGIN
#ifndef RtlGenRandom
... | TOOL | 0.861249 | 5.347535 |
45081886-1654-4a09-a44c-63f3f2a18522 | WYK15/swift-Ollvm12 | libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp | // <algorithm>
// template<class ForwardIterator1, class ForwardIterator2>
// constexpr bool // constexpr after C++17
// is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
// ForwardIterator2 first2);
#include <algorithm>
#include <cassert>
#include "test_iterators.h"
#include "t... | TEST | 0.935131 | 7.495915 |
cbc12ce4-6188-40ca-b13c-0a578eabc4df | ishandutta2007/codeforces | forza_ferrari/normal/605/E.cpp | #include<iostream>
#include<cstdio>
using namespace std;
int n;
double p[1001][1001],val[1001],dis[1001];
bool vis[1001];
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;++i)
for(int j=1;j<=n;++j)
{
scanf("%lf",&p[i][j]);
p[i][j]/=100;
}
for(int i=1;i<n;++i)
... | ALGO | 0.999968 | 3.00906 |
cf15e95c-c9bc-4073-8ed3-e0082e13c958 | himanshisharma1110/DSA | 27-remove-element/remove-element.cpp | class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int j=0;
for(int i=0;i<nums.size();i++)
{
if(nums[i]!=val)
{
nums[j]=nums[i];
j++;
}
}
return j;
}
}; | ALGO | 0.999694 | 5.933859 |
b40823f4-f19e-4095-8f5a-11febaad8a3e | premiumjibles/teamVision | greyObjectDetector.cpp | #include "ObjectDetector.hpp"
#include <algorithm>
#include <limits>
#include <vector>
#include "Ransac.hpp"
#include "yuv.hpp"
#include "J48Tree.hpp"
#include "utils/Logger.hpp"
#include "utils/basic_maths.hpp"
#include "utils/BresenhamPtr.hpp"
#include "utils/SPLDefs.hpp"
#include "utils/body.hpp"
#include "Camera... | ALGO | 0.976065 | 5.632764 |
68810f6d-f25e-46a8-a508-a27edce274c0 | Ujwal-Gaonkar/Ds-Algo- | devide and conquer/nqueen.cpp | #include<bits/stdc++.h>
using namespace std;
bool isSafe(vector<vector<int>>&vis, int row, int col, int n) {
for (int i = row, j = col; i >= 0 && j >= 0; i--, j--)
if (vis[i][j] == 1) return false;
for (int i = row, j = col; i >= 0 && j >= 0; i, j--)
if (vis[i][j] == 1) return false;
for (int i = row, j = col; ... | ALGO | 0.999941 | 5.047665 |
0a361ebe-9bd5-4a15-8897-a4ee89a90e22 | GreeneTechPC/Lulzbot-TAZ-4-5-Marlin-2.0.9.1-BLTOUCH-10x10-ITWorks-Titan-Aero | Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp | #if defined(__arm__) || defined(__thumb__)
#define MODULE_NAME "UNWARM_ARM"
#include <stdio.h>
#include "unwarm.h"
/** Check if some instruction is a data-processing instruction.
* Decodes the passed instruction, checks if it is a data-processing and
* verifies that the parameters and operation really indicate a d... | TOOL | 0.876563 | 4.125165 |
73cad5a3-30fb-4938-a58a-5f78b825588f | baixun2307/asd | solution/1200-1299/1254.Number of Closed Islands/Solution.cpp | class Solution {
public:
int closedIsland(vector<vector<int>>& grid) {
int m = grid.size(), n = grid[0].size();
int ans = 0;
int dirs[5] = {-1, 0, 1, 0, -1};
function<int(int, int)> dfs = [&](int i, int j) -> int {
int res = i > 0 && i < m - 1 && j > 0 && j < n - 1 ? 1 : ... | ALGO | 0.999899 | 6.219828 |
73596303-25c6-4a9b-80da-b0689c70767b | yeeeeeeti/3D_feature_extract | src/asiAlgo/editing/asiAlgo_FindNonmanifold.cpp | // Own include
#include <asiAlgo_FindNonmanifold.h>
// OCCT includes
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
//-----------------------------------------------------------------------------
void asiAlgo_Fi... | ALGO | 0.992924 | 6.905715 |
ead579c4-5578-4f7f-b406-97d0c6b30609 | kwl3434/boj | 3649.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int x,n;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
while(cin>>x>>n){
int MAX=-1,MAX1=0,MAX2=0;
vector<int> b(n);
for(int i=0;i<n;i++){
... | ALGO | 0.999958 | 3.422098 |
03c760ca-774f-4c8c-8f1a-01e30952b47a | Sughandhan/Competitive-Programming | codeforces/1283/B.cpp | #include<iostream>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n, k;
cin>>n>>k;
int a, b, x = k/2;
// for(int i = 1; i<=n; i++){
// if((i*k)>n){
// a = (i-1);
// break;
// }
// }
a... | ALGO | 0.999925 | 3.515429 |
a1dfbc05-93d1-474c-9eb8-000ecd3136e6 | ne0z/gecko-nokia-8110 | gfx/skia/skia/src/pathops/SkPathOpsSimplify.cpp | #include "SkAddIntersections.h"
#include "SkOpCoincidence.h"
#include "SkOpEdgeBuilder.h"
#include "SkPathOpsCommon.h"
#include "SkPathWriter.h"
static bool bridgeWinding(SkOpContourHead* contourList, SkPathWriter* simple,
SkChunkAlloc* allocator, bool* closable) {
bool unsortable = false;
do {
... | ALGO | 0.999119 | 5.998689 |
ecd0bb6d-c58a-48c8-8d58-c38a6211a914 | DocDoor/CompetitiveProgramming | templates/mint.cpp | //you can define md with template or inside the struct for other uses
constexpr int md = int(1e9) + 7;
struct Mint {
int val = 0;
Mint() : val{} {}
template<typename T> Mint(T x) {
if (x >= -md && x < md) {
val = x;
} else {
val = x % md;
}
if (val < 0) {
val += x;
}
}
... | ALGO | 0.999562 | 4.460942 |
803a603f-c294-49d2-a462-19223a0a73d3 | pranjal9424/DP | 28.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,sum;
cin>>n>>sum;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
//logic start from here
int l,r;
sort(arr,arr+n);
for(int i=0;i<n-2;i++)
{
l=i+1;
r=n-1;
while(l<r){
if(arr[i... | ALGO | 0.999988 | 4.167517 |
9ec43c95-eee7-4a9f-b9b6-1b786aec2590 | jqzhangiii/OJ_Code | BZOJ/bzoj 5063 旅游 splay.cpp | #include<bits/stdc++.h>
typedef long long LL;
const int INF = 0x7fffffff;
using namespace std;
#define N 100010
struct data
{
int fa , c[2] , si , rev;
}a[N];
int root , ans[N] , tot;
inline void rever(int x)
{
swap(a[x].c[0] , a[x].c[1]) , a[x].rev ^= 1;
}
inline void pushup(int x)
{
a[x].si = a[a[x].c[0]]... | ALGO | 0.999997 | 3.910024 |
58f8623d-43a6-48d6-b0ac-930d2aa06c0b | 511172176/codebook | code/BST有序樹轉二元樹, 數組模擬樹.cpp | //POJ3437
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string s; // 輸入的字符串
int i, n = 0, height1, height2; // 迭代變量 i, 樹的編號 n, 兩種高度變量
// 遞迴構建二元樹並計算高度
void calculateHeights(int level1, int level2) {
int tempson = 0; // 當前節點的子節點數量
while (s[i] ... | ALGO | 0.999236 | 4.342985 |
ad002820-5df1-4b8a-b334-6ca5c84301df | Asjad-Raza-10/Programming-Course | 1. Programming Fundamentals/5. 1D Arrays/Set 2/Problem 8.cpp | #include <iostream>
using namespace std;
int main()
{
int arr[20] = { 0 }, size = 0, i = 0, j = 0, flag = 1, temp = 0, missing_number = 0;
cout << "Enter the array size(maximum 20): ";
cin >> size;
cout << "Enter " << size << " values: ";
for (i = 0; i < size; i++)
{
cin >> arr[i];
}
int arr_2[20] = { 0 };... | ALGO | 0.999572 | 3.242633 |
446d0e54-3d88-43a9-ac1e-82e5e249ac6b | debjani1413/DSA-Practice | 1. Count nodes of linked list - GFG/1.-count-nodes-of-linked-list.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
next = NULL;
}
};
// } Driver Code Ends
/* Link list node */
/*
struct Node
{
int data;
Node* next;
Node(int x) { data = x; next... | ALGO | 0.999289 | 5.763474 |
9ecb78ce-bf49-4e1f-8533-1378e4145a67 | Harrolee/misc-work-n-tools | C++/jamOTMonth.cpp | // Jam of the Month club
/*
There are three packages. Each package has a unique monthly rate, count of free jams, and additional jam jar rate.
Ask the user which package they subscribe to.
Ask the user how many jams they ordered that month.
Total the cost of a monthly subscription and the count of jams purchased... | TOOL | 0.882877 | 6.577044 |
129cd846-a8b5-4f04-a088-31c07a919a98 | rudrakshraghuvar/leetcode | 0125-valid-palindrome/0125-valid-palindrome.cpp | class Solution {
public:
bool isPalindrome(string s) {
string str = "";
for(auto c : s) {
if(c >= 'A' && c <= 'Z')
str += c+32;
else if(c >= 'a' and c <= 'z')
str += c;
else if(c >= '0' && c <= '9')
str += c... | ALGO | 0.999551 | 6.222958 |
341413c7-bacf-4e4b-8474-17fc9ab8b343 | fciapsa/Competitive-Programming | UVa/11310DeliveryDebacle.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
std::ios::sync_with_stdio(false);
vector<ll> v(41);
v[1] = 1;//n=1 hay 1 forma
v[2] = 5;//n=2 hay 5 formas
v[3] = 11;//n=3 hay 11 formas
for (int i = 4; i < 41; ++i) v[i] = v[i - 1] + 4 * v[i - 2] + 2 * v[i - 3];
... | ALGO | 0.999879 | 4.703259 |
6998da0b-6316-43e9-a7af-aca1065a5bc4 | hackifme1/InterviewBit | Graph Data Structure & Algorithms/Path in Directed Graph.cpp | // By Chandramani Kumar
// Keep moving and must be simple bro!!!!!
// Espérons le meilleur mais préparez-vous au pire 😎
/* Problem Statement :
Given an directed graph having A nodes labelled from 1 to A containing M edges given by matrix B of size M x 2such that there is a edge directed from node
B[i][0] to node B[... | ALGO | 0.999795 | 5.188918 |
61d71b1b-2b09-4691-9583-2916e6e41db7 | ishandutta2007/codeforces | shadowlight/normal/1178/E.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
//freopen("E.in", "r", stdin);
//freopen("E.out", "w", stdout);
ios_base::sync_with_stdio(false);
string s;
cin >> s;
int l = 0, r = s.size() - 1;
int sz = s.size();
string res = "";
while (r - l + 1 >= 4) {
vector <int> cnt(3,... | ALGO | 0.999997 | 3.458716 |
60abd035-54ee-4bbf-a5b7-2951634f1ed4 | bavernet/codejam | Algospot/Fence/Fence_dc.cpp | // problem: https://algospot.com/judge/problem/read/FENCE
// hint: divide and conquer
// level: easy
#include <iostream>
#include <vector>
using namespace std;
int getMaxRectangle(const vector<int> &planks, int s, int e) {
if (e - s == 0)
return 0;
if (e - s == 1)
return planks[s];
int m = (s + e) / 2;
int ... | ALGO | 0.999593 | 6.464915 |
38c28685-1c37-4a90-af14-b7298c483054 | atlaska826/ElevatorSimulation | src/elevator_controller.cpp | #include "elevator_controller.h"
// Constructor
ElevatorController::ElevatorController(int numFloors, int numElevators, int elevatorCapacity)
: numFloors(numFloors), numElevators(numElevators), elevatorCapacity(elevatorCapacity), currentTime(0), totalWaitTime(0), totalPassengersServed(0) {
// Initialize eleva... | ALGO | 0.900024 | 6.291702 |
fa607480-2dd3-419b-88b4-61b6aca516f5 | ADHIKSHA/cpp_files | UNITGCD.cpp | #include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define ll long long int
bool ismatched(ll k,ll num,int128_t arr[]){
if(__gcd((ll)arr[k],num)==1)
return 1;
else
return 0;
}
vector <vector<ll> > addprimes(ll n)
{... | ALGO | 0.999817 | 3.505843 |
05255903-2b3d-4623-943c-4cd8ab506287 | ShivanshGupta02/DSA | 1510-stone-game-iv/1510-stone-game-iv.cpp | class Solution {
// TC : O(N sqrt(N))
// TC : O(N)
public:
bool winnerSquareGame(int n) {
vector<int>dp(n+1,false);
for(int i=0;i<n;i++)
{
if(dp[i]) continue;
for(int k=1; i+k*k <=n; k++) dp[i+k*k]=true;
... | ALGO | 0.999899 | 5.929599 |
770b1c24-f22a-4451-8ec3-e2b5617d7834 | estebanramirezm/Fundamentals-Of-Programming | lab-7-estebanramirezm/lab07.cpp | /*
Lab #7
Purpose: This program displays the cosine, sine, and tangent of an angle given by the user, then displays the exponential of a pseudo-random number (between -10 and 10) as well as the natural logarithm, base-10 logarithm, and square root of its absolute value
Author: Esteban Ramirez
Date: Feb 24th
*/
#define... | ALGO | 0.993148 | 3.256934 |
ef7e95ff-2d91-4c14-8661-589870c79656 | akuma294/MLIRForPIM | llvm/tools/llvm-reduce/deltas/ReduceValuesToReturn.cpp | #define DEBUG_TYPE "llvm-reduce"
#include "ReduceValuesToReturn.h"
#include "Delta.h"
#include "Utils.h"
#include "llvm/IR/AttributeMask.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
usi... | TOOL | 0.852747 | 7.710829 |
9943cb58-6f9a-466a-8a0a-855c23325fce | AnnaAD/scale-gpm | arya_asap/tbb-2017~U7/examples/graph/dining_philosophers/dining_philosophers.cpp | #if _MSC_VER
// Suppress "decorated name length exceeded, name was truncated" warning
#pragma warning (disable: 4503)
#endif
#include "tbb/flow_graph.h"
#include "tbb/task_scheduler_init.h"
#include "tbb/tick_count.h"
#include "tbb/tbb_thread.h"
#include "tbb/atomic.h"
#include "tbb/spin_mutex.h"
#include <ios... | ALGO | 0.986282 | 4.71564 |
f1338361-21eb-48f6-8cea-7327014eb437 | fatemehkarimi/uvaSolutions | uva-105.cpp | //uva 105
//The Skyline Problem
#include <iostream>
#include <vector>
using namespace std;
struct building
{
int left;
int height;
int right;
};
int findHeight(vector <building> & b, int coordinate);
int main(void)
{
vector <building> buildings;
int t1 = 0, t2 = 0, t3 = 0;
while (cin >> t1 >> t2 >> t3) {
... | ALGO | 0.999774 | 3.896762 |
ed792b82-da0d-4d65-92b3-78742b66554e | righthand0521/LeetCode | src/1289.cpp | #include <algorithm>
#include <iostream>
#include <limits>
#include <vector>
using namespace std;
class Solution {
public:
int minFallingPathSum(vector<vector<int>>& grid) {
int retVal = 0;
int gridSize = grid.size();
vector<vector<int>> dp(gridSize, vector<int>(gridSize, numeric_limi... | ALGO | 0.999796 | 6.39487 |
42ef22b3-d25b-451e-b334-040af30d9d1b | pradeepcredenceid/tabasco_libcore | luni/src/main/native/cbigint.cpp | #include <string.h>
#include "cbigint.h"
#define HIGH_IN_U64(u64) ((u64) >> 32)
#define LOW_IN_U64(u64) ((u64) & 0x00000000FFFFFFFFLL)
#define TEN_E1 (0xALL)
#define TEN_E2 (0x64LL)
#define TEN_E3 (0x3E8LL)
#define TEN_E4 (0x2710LL)
#define TEN_E5 (0x186A0LL)
#define TEN_E6 (0xF4240LL)
#define TEN_E7 (0x989680LL)
#de... | TOOL | 0.995199 | 4.529637 |
085bc096-0f95-4071-a553-5b7c185a0e8a | singhdipesh14/CP | LEETCODE/695.cpp | #include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
using namespace std;
// ll powFunc(ll p, ll n)
// {
// ll result = 1;
// for (ll i = 0; i < n; i++)
// {
// result *= p;
// }
// return result;
// }
// ll fact(ll n)
// {
// ll ans = 1;
//... | ALGO | 0.999932 | 4.882494 |
5669a473-51cc-4331-979f-2dc6df1182e4 | yuki62599/code | List/225.cpp | #include <bits/stdc++.h>
using namespace std;
class MyStack1 {
public:
queue<int> qa;
queue<int> qb;
MyStack1() {
}
void push(int x) {
qa.push(x);
}
int pop() {
// 留下最后一个元素输出
while (qa.size() > 1) {
qb.push(qa.front());
qa.pop();
... | ALGO | 0.999822 | 4.780038 |
ff181900-8d71-4b01-8c62-fd06d38cd44a | kokohuhusave/Programmers_Coding_Test | 프로그래머스/1/12937. 짝수와 홀수/짝수와 홀수.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
string solution(int num) {
if(num % 2 == 0){
return "Even";
}else{
return "Odd";
}
} | ALGO | 0.999825 | 5.564799 |
97063162-d7b7-42f9-b3b7-9377a5e47fe1 | SaiHarsha9992/Code-Chef | Lucky Numbers.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
int t ;
cin >> t ;
while(t--)
{
int n , r , c = 0 ;
cin >> n ;
while (n!=0)
{
r = n % 10 ;
if ( r == 7 )
{
c++;
}
n = n / 10 ;
}
if ( c > 0 )
{
... | ALGO | 0.99967 | 4.081876 |
36e660fc-bb1b-4b7d-b035-c452fee34a8d | Rahul8945/rahulfitness | tutorial17.cpp | #include <iostream>
using namespace std;
inline int product(int a,int b){
return a*b;
}
//default agrument are write in right
float moneyreceived ( int currentmoney, float factor=1.04){
return currentmoney * factor;
}
// int strlen(cons char *p){ // constant argument means they not change the value
// }
int... | TOOL | 0.94557 | 3.780138 |
dce6f085-f168-4af4-ab47-c1da419002a6 | ishandutta2007/codeforces | fataleagle/normal/433/C.cpp | #include <bits/stdc++.h>
using namespace std;
int N, M;
int A[100001];
vector<int> val[100001];
long long orig;
int main()
{
scanf("%d%d", &N, &M);
for(int i=0; i<M; i++)
scanf("%d", A+i);
for(int i=1; i<M; i++)
orig+=abs(A[i-1]-A[i]);
for(int i=0; i<M; i++)
{
if(i>0 && A[... | ALGO | 0.999976 | 4.299081 |
08fe568d-1e92-4d7e-83dd-0d8760fe7bff | jitensinha98/Software_Engineering_Lab_Programs | Area_friend_class.cpp | #include<iostream>
using namespace std;
class Data
{
private:
int side,radius;
public:
void getData()
{
cout << "Enter side length of square : \n";
cin >> side;
cout << "Enter radius of circle : \n";
cin >> radius;
}
friend class Area;
};
class Area
{
public:
void find_area(Data d)
{
... | TOOL | 0.987485 | 3.863752 |
2fb91ae9-a523-4682-a7cf-ce0860259053 | gempei/Atcoder | 20190622_ABC131/a.cpp | /*
#include <iostream>
#include <string.h>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main(void){
string s;
cin >> s;
for (int i=0; i<3;i++)
if(s[i]==s[i+1])
cout << "Bad" << endl;
return 0;
}
*/
#include <iostream>
#include <string>
using std::cin;
usi... | ALGO | 0.994142 | 3.82061 |
544f8674-393e-41d9-9d28-ca00f0a38729 | ScorcherGray/ProjectF | test/Stuff/ACCU/code/C06/CountNotEqual.cpp | using namespace std;
int main() {
int a[] = { 10, 20, 30 };
const size_t SIZE = sizeof a / sizeof a[0];
cout << count_if(a, a + SIZE,
not1(bind1st(equal_to<int>(), 20)));// 2
} ///:~
| ALGO | 0.899825 | 4.559816 |
8b58895b-d45b-4c5b-861c-f20343aed8c4 | Mahmood-Darwish/CodeForces-Problem-Solutions | Problems/New Year and Curling/New Year and Curling.cpp | #include <bits/stdc++.h>
#define SF(x) scanf("%d",&x)
#define F first
#define S second
#define MEM(a,b) memset(a,b,sizeof(a))
#define DB(x) cout << #x << " is " << x << endl
#define ffs(x) __builtin_ffs(x) // This function returns 1 + least significant 1-bit of x. If x == 0, returns 0. Here x is int, this function with... | ALGO | 0.999987 | 3.227141 |
4cdd83a9-1e80-4c44-9b7a-12cf21bbcdf4 | spad1e/competitive-programming | codeforces/cf2065/H.cpp | #include "header.hpp"
const int MOD = 998244353;
const int INF = 0x3fffffff;
const ll LINF = 0x1fffffffffffffff;
const char nl = '\n';
const int MX = 2e5 + 3;
struct fenwick {
vector<ll> t;
int n;
fenwick(int _n) {
n = _n; t.assign(n+2, 0);
}
void update(int i, int val) {
for (; i <= n; i += i&-i) t... | ALGO | 0.999944 | 5.053343 |
2a636e05-674d-4e1f-a25d-f6f6d56a1134 | sakshamrathi21/Competitive_Programming | problems_solved/nim_game_i.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main () {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int x;
cin >> x;
n--;
int xor_product = x;
while (n--) {
cin >> x;... | ALGO | 0.999536 | 3.920746 |
9a1b4a01-d655-4a84-b1ec-7f873b3fbc0c | bhavyawig/Competitive-Programming | D_Three_Activities.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
bool cmp(const pair<lli,lli> &a, const pair<lli,lli> &b)
{
return a.first>b.first;
}
int main()
{
lli test;
cin>>test;
for(lli e=0;e<test;e++)
{
lli n;
cin>>n;
vector<pair<lli,lli>> a,b,c;
for(lli... | ALGO | 0.999716 | 3.803478 |
d44ae49a-38a4-4538-907f-d960216dd81e | Sibaso/Applied-Algorithms | 07. A. CHANGE.cpp | #include<iostream>
#include<vector>
using namespace std;
int N;
int a[6]={1,5,10,50,100,500};
int thamLam(int n){
int ans=0;
for(int i=5;i>=0;i--){
ans+=n/a[i];
n%=a[i];
}
return ans;
}
int main(){
cin>>N;
cout<<thamLam(1000-N)<<endl;
return 0;
}
| ALGO | 0.999319 | 3.667377 |
d7d549bf-e470-4a71-adfd-fd11e202d4b1 | geekerliu/Cplusplus-Primer-Plus-6thE-Code-Example | Code/Chapter 9/static.cpp | // static.cpp -- using a static local variable
#include <iostream>
// constants
const int ArSize = 10;
// function prototype
void strcount(const char * str);
int main()
{
using namespace std;
char input[ArSize];
char next;
cout << "Enter a line:\n";
cin.get(input, ArSize);
while (cin)
{
... | ALGO | 0.930615 | 5.545693 |
fd543c77-0f51-421b-ad25-76f3409357d3 | Prathamesh-Mandiye-0423/CSES-and-CP | cses_4.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
string dna;cin>>dna;
ll max_l=0;
ll curr_l=0;
char curr;
for(ll i=0;i<dna.length();i++){
if(dna[i]!=curr){
max_l=max(max_l,curr_l);
curr_l=1; //reset the current length
}else{
curr_l++;
}
curr=dna[... | ALGO | 0.999661 | 4.003659 |
1fe47cd8-dc23-475c-85fe-0451470d4978 | tanmesh/curly-doodle | abrakadabra/Pair of Topics.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define F first
#define S second
#define pb push_back
#define ll long long
#define f(i, a, n) for(int i=a; i<n; ++i)
#define find(a, b) (find(a.begin(), a.end(... | ALGO | 0.999991 | 3.449098 |
46501bd2-ed80-44e6-b4df-7a011c59ac47 | Iann1978/Explore-To-OpenCV | thirdparty/opencv-3.4.2-vc14_vc15/opencv/sources/samples/cpp/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.cpp | #include <iostream>
#include "opencv2/core.hpp"
#ifdef HAVE_OPENCV_XFEATURES2D
#include "opencv2/calib3d.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/xfeatures2d.hpp"
using namespace cv;
using namespace cv::xfeatures2d;
using std::cout;
using st... | ALGO | 0.984983 | 6.25555 |
c156a3db-9f3a-4b37-aff5-9f64be5c1e9a | Riu-Rathor/Leetcode | 2573-remove-nodes-from-linked-list/remove-nodes-from-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* removeNodes... | ALGO | 0.999981 | 5.864674 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.