uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
256d3b38-113d-4b47-80be-788885a22438 | SBidaibek/acm | cf/500/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define forn(i, x, n) for (int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for (int i = int(n); i >= int(x); --i)
#define x first
#define y second
#define pb push_back
typedef long long ll;
typedef pair <int, int> pii;
typedef long double ld;
typedef vector <ll> ... | ALGO | 0.999988 | 3.674522 |
9daa0797-fa1f-4f9e-ab4e-d2166d49bf21 | ShadowSFX/cpp_stuff | search_easy_problem.cpp | #include <bits/stdc++.h>
using namespace std;
void test_case(){
int n;
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (x == 1){
cout << "HARD";
return;
}
}
cout <<"EASY";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie... | ALGO | 0.998668 | 3.649144 |
34ea194f-fdd3-4553-8556-29ab6add1557 | EdwardOu98/LeetCode | practices/Sorted_Stack.cpp | #include <stack>
using namespace std;
class SortedStack {
private:
stack<int> s1, s2;
public:
SortedStack() {
}
void push(int val) {
// If s1 is empty or the input value is less
// than or equal to the top element of s1,
// directly add the input to s1.
if(s1.emp... | ALGO | 0.999814 | 5.952608 |
904c5b75-cc4c-4554-9d63-c7b2563f329e | sphinge/neural-network-iot | Client_Server/iris/client2/client.cpp | #include <vector>
#include <cmath>
#include <iostream>
#include <algorithm> // for std::shuffle
#include <numeric> // for std::iota
#include <random> // for std::default_random_engine
#include <fstream>
#include <sstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <sys/socket.h>
#include <netin... | DATA | 0.913451 | 6.628128 |
a312931d-9156-4944-aea4-68981529b6b2 | upendra-coder/CP | A_Theatre_Square.cpp | #include <bits/stdc++.h>
using namespace std ;
int main() {
long long n,m,a ;
cin >> n >> m >> a ;
if(n%a != 0) n = n/a + 1;
else n = n/a ;
if(m%a != 0) m = m/a + 1 ;
else m = m/a ;
long long ans = n*m ;
cout << ans << endl ;
return 0 ;
} | ALGO | 0.999546 | 3.376912 |
f63a0736-4a8d-4853-ab90-f9cb1a9e57bc | uoryon/AlgorithmTour | hackerrank/Algorithms/Strings/common-child.cpp | using namespace std;
int main() {
char a[5003], b[5003];
int u = 0, max = 0, i, j;
int lena, lenb;
std::vector< pair <int, int> > v;
scanf("%s", a);
scanf("%s", b);
lena = strlen(a);
lenb = strlen(b);
for (i = 0; i < lena; i++) {
for (j = 0; j < lenb; j++) {
if (a[i] == b[j]) {
v.pu... | ALGO | 0.999916 | 3.446702 |
784ff6d7-03f6-4209-babc-7c1516f8cd08 | Arthur-Yao/Raida_os | cpp/src/ext/genmath/gminterp.cpp | /************************************************************************//**
* File: gminterp.cpp
* Description: Interpolation routines (some taken from "Numerical Recipes in C")
* Project:
* First release: 1997
*
* Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
* All Rights Reserved
... | ALGO | 0.999485 | 4.944794 |
3e94c036-5421-414e-b540-07da471f28c3 | shubhamkatoch/DS-Lab | DS lab 10.cpp | #include<iostream>
using namespace std;
void selectionsort(int A[],int n)
{
int i,k,j,temp,min;
for(int i=0;i<n;i++)
{
min=A[i];
k=i;
for(int j=i;j<n;j++)
{
if(min>A[j])
{
min=A[j];
k=j;
}
}
if(k!=i)
{
A[k]=A[i];
A[i]=min;
}
}
}
void merge(int arr[], int l, int m, int r... | ALGO | 0.999967 | 3.467467 |
d1f5910f-5048-42d8-92c9-5fff64f21831 | Canvas-world/Core | src/common/bloom.cpp | #include <common/bloom.h>
#include <hash.h>
#include <primitives/transaction.h>
#include <random.h>
#include <script/script.h>
#include <script/standard.h>
#include <span.h>
#include <streams.h>
#include <util/fastrange.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <limits>
#include <vector>
s... | ALGO | 0.928543 | 7.494512 |
9e0860a2-dbca-41c1-b30e-e3b80a56b228 | Yash-Agrawal10/chess-engine | src/processing.cpp | #include "processing.h"
// Constants
// Capital is mine, lower is theirs (based on to move)
map<char, int> piece_map = {
{'K', 0},
{'N', 1},
{'B', 2},
{'R', 3},
{'Q', 4},
{'P', 5},
{'p', 6},
{'q', 7},
{'r', 8},
{'b', 9},
{'n', 10},
{'k', 11}};
// Helpers
array<array<int... | ALGO | 0.995672 | 4.027814 |
cb08148e-e0a8-49b5-9ad7-8da9aa29c3fe | thegamer1907/Code_Analysis | Codes/AC/2175.cpp | #include<bits/stdc++.h>
#define up(j,k,i) for(i=j;i<k;i++)
#define down(j,k,i) for(i=j;i>k;i--)
#define pp(n) printf("%lld\n",n)
#define pps(n) printf("%lld ",n)
#define all(x) x.begin(),x.end()
#define ps(s) printf("%s",s)
#define is(n) scanf("%lld",&n)
#define ips(n) scanf("%lld",n)
#define ss(s) scanf("%s",s)
#defin... | ALGO | 0.999983 | 3.259629 |
6142aa44-492c-40dd-ab65-cb6ebedb48ce | kysub99/BOJ | 2630.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int arr[129][129];
int sum[129][129];
int blue = 0;
int white = 0;
bool isAll(int n, int x1, int y1, int x2, int y2) {
int temp = sum[x2][y2] - sum[x1 - 1][y2]
- sum[x2][y1 - 1] + sum[x1 - 1][y1 - 1];
if (temp == n * n) {
blue++;
... | ALGO | 0.999318 | 3.583416 |
c855cc6d-7f59-4f2b-847b-0141fb35d86f | daiwb/Algorithm | ZOJ/1707Automatic Editing.cpp | /*ZJU 1707 Automatic Editing
00:00.00 376K
2003.11.08 By adai*/
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main(void){
char a[10][81],b[10][81];
char text[260];
int num,i,j,t,find,lena,lenb,head,tail; //headʾtextĶʼ
while(scanf("%d",&num)){
getchar();
... | ALGO | 0.999836 | 3.216209 |
b9d64d74-a831-4eb1-a162-44c25eec720c | Iltwats/Competitive-Programming-SolvedProblems | AtCoder/Cream_Puff.cpp | // Problem Statement: https://atcoder.jp/contests/abc180/tasks/abc180_c
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0)
const ll mod = 10e9 + 7;
vector <ll> factors(ll x) {
vector <ll> result;
ll i = 1;
while(i*i <= x)... | ALGO | 0.999595 | 4.786005 |
b195639c-d7e0-4f08-957c-dfe2907f8d76 | ishandutta2007/codeforces | physics0523/normal/688/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,m;
cin >> n >> m;
string tg;
for(int i=0;i<n;i++){tg.push_back('1');}
int res=0,cur=0;
for(int i=0;i<m;i++){
string s;
cin >> s;
if(s==tg){cur=0;}
else{cur++;}
res=max(res,... | ALGO | 0.999882 | 3.940409 |
728471de-2ba5-4ae6-bb55-f997cd2b6839 | diyamittal/OOPS-programs | 0-class.cpp | #include<iostream>
using namespace std;
class start{
public:
int x;
int y;
int function(int x, int y){
return 2*x+3+y;
}
};
int main(){
start s;
cout<<s.function(2,3);
return 0;
} | ALGO | 0.968139 | 4.476645 |
7419d1ff-aab8-473f-b3a9-11532816588b | yxzlwz/oi-code | poj/1651.cpp | #include <algorithm>
#include <iostream>
using namespace std;
const int N = 501;
int f[N][N], n, a[N];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 2; i < n; i++) {
for (int j = 1; j + i <= n; j++) {
f[j][j + i] = 0x3f3f3f3f;
for (int k = j ... | ALGO | 0.999879 | 3.868165 |
8b065dc2-8246-4fcc-9c9a-8767b84604ac | kleistern8z/pytorch | aten/src/ATen/native/SpectralOps.cpp | #include "ATen/ATen.h"
#include "ATen/NativeFunctions.h"
#include "ATen/WrapDimUtils.h"
#include "ATen/ExpandUtils.h"
#include <algorithm>
#include <functional>
#include <numeric>
#include <vector>
namespace at { namespace native {
// Since real-to-complex satisfy the Hermitian symmetry, i.e.,
// X[m, \omega] = X[m,... | ALGO | 0.917726 | 6.536927 |
2858a88b-8936-420c-8c28-4d96cd327e13 | zhr5/Algorithm | 剑指offer/数值的整数次方.cpp | #include<iostream>
using namespace std;
class Solution {
public:
double Power(double base, int exponent) {
double res = 1;
if (exponent == 0) return 1;
if (exponent == 1) return base;
int p = abs(exponent);
while (p>0) {
if (p & 1) {
res = res*base;
}
base = base*base;
p >>= 1;
}... | ALGO | 0.999944 | 5.32146 |
7d85ade2-14a7-40f6-bb98-32364bfeb64b | Mrgig7/DSA_Practice | selectionSort.cpp | #include <iostream>
using namespace std;
void selectionSort (int arr[],int n){
for (int i=0;i<n-1;i++){
int minIndex = i;
for (int j=i+1;j<n;j++){
if (arr[j]<arr[minIndex]){
minIndex = j;
}
}
swap(arr[i],arr[minIndex]);
}
}
int main(){
... | ALGO | 0.999972 | 4.677782 |
4a433f77-34ee-4a99-9006-477ce511c50b | Daye-Lee18/cplusplus | HW/HW6/container/myset.cpp | #include "myset.h"
void MySet::Insert(int data) {
// TODO: insert 'data' into set
// BST
/*
if (bst.Search(bst.GetRoot(), data) == NULL){
bst.Insert(data);
size++;
}
*/
// RBT
if (rbt.Search(rbt.GetRoot(), data)->key == 0){
rbt.Insert(data);
size++;
}
}
void MySet::Erase(int data... | ALGO | 0.979018 | 4.315791 |
4accdb11-8bdf-49c4-bf85-3ec05bfa7316 | Abir-Al-Murad/Data-Structure | DS Assignment/inbuild.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int ar[]={55,88,9,7,5,6,3};
int si = sizeof(ar)/sizeof(ar[0]);
sort(ar,ar+si);
reverse(ar,ar+si);
for(int i =0;i<si;i++){
cout<< ar[i]<<" ";
}
return 0;
}
| ALGO | 0.999788 | 3.595575 |
c7b6e7a6-3773-47fb-8954-4797117fdcdc | Akarshkushwaha/CPP-DSA | PatternQuestion/que5.cpp | /*#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i = 1;
int count = 1;
while(i<=n){
int j = 1;
while(j<=i){
cout<<count<<" ";
count++;
j = j+1;
}
cout<<endl;
i = i+1;
}
}*/
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;... | ALGO | 0.999022 | 3.949616 |
598a33e0-f3c4-4da4-974f-6e72adbc1ad5 | xavigibert/ShearCuda | gpumat-code/matCUDA/src/matcublas/cublasSgemm.cpp | #include <stdio.h>
#include <string.h>
#ifdef UNIX
#include <stdint.h>
#endif
#include "mex.h"
#include "cublas.h"
#include "GPUcommon.hh"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
if (nrhs != 13)
mexErrMsgTxt("Wrong number of arguments");
//transa, transb, m, n, k, a... | ALGO | 0.996856 | 4.773803 |
c06cd672-e838-47b7-861c-d67fc82d1c8b | min9813/algorithm_contest | contest/abc176/a.cpp | #include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
#include <assert.h>
// #include <prettyprint.hpp>... | ALGO | 0.997811 | 3.437788 |
b0ea1000-4028-4c0d-96ed-ca25b182fac0 | patrickfrey/strus | src/storage/booleanBlock.cpp | #include "booleanBlock.hpp"
#include "indexPacker.hpp"
#include "private/internationalization.hpp"
#include <limits>
using namespace strus;
void BooleanBlock::Node::init( strus::Index from_, strus::Index to_)
{
if (from_ == to_)
{
type = PairNode;
alt.elemno2 = 0;
elemno = from_;
}
else
{
type = DiffNode... | TOOL | 0.933505 | 6.903856 |
129c3aa6-aa7f-49f9-b005-40a73962c850 | pankaj-2503/DSA-Standard-Problems | Graphs/Basic/countGraphs.cpp | long long count(int n) {
// your code here
long long connected=n*(n-1);
long long singlevertex=connected/2;
//pick or not pick
long long ans=pow(2,singlevertex);
return ans;
} | ALGO | 0.999437 | 4.504913 |
f5452a5f-709d-4f16-b4fb-21ce8307f2a5 | THUzhangga/DYRIM | GlacialSnow_dll/_hsp_NewRouting/FVMunit.cpp | #include "FVMunit.h"
#include "math.h"
#include "HighSlopeRunoff.h"
#include "functions.h"
/******************************RichardsUnitʵ******************************/
RichardsUnit::RichardsUnit(float theta0,float K0,float D0,float dz0)
:theta(theta0),K(K0),D(D0),dz(dz0)
{
}
RichardsUnit::~RichardsUnit(void)
{
}
/***... | ALGO | 0.997474 | 4.206215 |
1b476bb9-8ae8-47d9-8236-082605e53c76 | Mohammad-Sabbir-Ahmed/Competitive-Programming-1 | All Online Judge Problem/CodeChef/Primality Test Problem Code (PRB01).cpp | #include "bits/stdc++.h"
using namespace std;
#define LL long long
bool solve() {
int n;
cin>>n;
if(n<=1) return 0;
if(n==2) return 1;
if(n%2 == 0) return 0;
for(int i=3;i*i<=n;i+=2)
if(n%i==0) return 0;
return 1;
}
int main()
{
int tc; scanf("%d", &tc);
while(tc--) {
... | ALGO | 0.999699 | 4.614961 |
93bc3877-ff6d-438a-83fc-e2768fe20649 | harshbhar0629/CrackYourInternship | Matrix/04_max_size_rect_with_all_1.cpp | #include <bits/stdc++.h>
using namespace std;
// https://leetcode.com/problems/maximal-rectangle/
class Solution{
int histogram(vector<int>& h){
int n = h.size();
stack<int> st;
vector<int> prev(n, -1), next(n, n);
for (int i = 0; i < n; i++){
while(!st.empty() and h[s... | ALGO | 0.999952 | 6.195589 |
580e08e0-551e-4cfb-9964-f5bbf719fbff | LewisBamf/pendulum-project | pendulum project/pendulum project.cpp | #include <cmath>
#include <SFML/Graphics.hpp>
#include <vector>
#include <iostream>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
const float g = 980.0f; // Acceleration due to gravity
class Vector2 {
public:
float x;
float y;
Vector2() : x(0), y(0) {}
Vector2(float x, float y) : x(x), y(y... | ALGO | 0.999282 | 6.427963 |
89f40e52-520e-4734-9f93-53a8249c0b84 | EgorTarasov1/oop-mai-v19-lab2 | Three.cpp | #include "Three.h"
#include <stdexcept>
#include <algorithm>
#include <cstring>
Three::Three() : len(1), digits(new unsigned char[1]{0}) {}
Three::Three(const size_t &n, unsigned char t) : len(n), digits(new unsigned char[n]) {
if (t >= 3) {
throw std::invalid_argument("Invalid digit for base 3");
}
... | TOOL | 0.916076 | 7.238784 |
fa4e767c-eb2a-4c9c-a782-c0de8d2312ee | mzaraa/webserv | srcs/ConfigParser.cpp | #include "../includes/ConfigParser.hpp"
ConfigParser::ConfigParser(std::string config_file, std::vector<Server> &servers): _server_count(0), _status(NONE) {
struct stat buffer;
if (!stat(config_file.c_str(), &buffer) && S_ISDIR(buffer.st_mode)) {
std::cerr << "Error: cannot find config file" << std::e... | TOOL | 0.961133 | 3.840705 |
2a21774a-cfe7-4297-a092-27bf8970f6b6 | smritiiD7/Leet_Coding | top-k-frequent-elements/top-k-frequent-elements.cpp | class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
unordered_map<int,int> m;
int i;
vector<int> ans;
for(auto i: nums)
{
m[i]++;
}
vector<pair<int,int>> v;
for(auto i= m.begin();i!=m.end();i++)
{
... | ALGO | 0.999992 | 6.0868 |
5dcac4e0-809c-4f51-97f7-0fac33dfd8d8 | KarthikNedunchezhiyan/competitive-programming-solutions | solutions/leetcode/hard/02276-Count-Integers-in-Intervals/solution.cpp | class CountIntervals {
private:
map<int, int> intervals;
int totalIntervals = 0;
public:
CountIntervals() {}
void add(int left, int right) {
auto cit = intervals.upper_bound(left);
if (cit != intervals.begin()) {
auto p = prev(cit);
if (p->second >= left) {
... | ALGO | 0.99999 | 6.057993 |
b357941f-3b9c-4e19-aa8f-9f3dcdfa5443 | Rony1031/PrepBytes | SecondMax.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int x,y,z;
cin>>x>>y>>z;
if(x>y){
if(x>z){
cout<<max(y,z);
}
}
else if(y>x){
if(y>z){
cout<<max(x,z);
}
}else{
cout<<max(x,y);
}
return 0;
} | ALGO | 0.999862 | 4.124293 |
a031fecc-0887-48b7-8f6f-486d8f0db086 | YaminiGarkoti/DSA | series_6.cpp | #include<bits/stdc++.h>
using namespace std;
void series(int n)
{
static int l=1;
if(n>0)
{
cout<<1/pow(l,l)<<" ";
l++;
series(n-1);
}
}
int main()
{
int n;
cin>>n;
series(n);
return 0;
} | ALGO | 0.999904 | 3.512191 |
9927d466-549a-448e-a5ed-f42699034bb5 | mmasztalerczuk/Algorithms | TopCoder/SRM640/CPP/div2_600.cpp | #include<iostream>
#include<vector>
#include<set>
#include<limits>
#include<cstring>
#include<algorithm>
int DEBUG = 1;
#define POS "Possible"
#define IMPO "Impossible"
#define MAXN 11
#define INF std::numeric_limits<int>::max()/2
#define FOR(x,y) for(int x=0;x<y;x++)
#define FOR_S(x,a,y) for(int x=a;x<y;x++)
#defi... | ALGO | 0.999547 | 4.31769 |
c7d9883a-dadc-406e-8dfe-d0a386e252cf | tmuttaqueen/MyCodes | Online Judge Code/[Other] Online-Judge-Solutions-master_from github/SPOJ/Classical/78 - Marbles.cpp | #include <cstdio>
using namespace std;
long long C(int n, int m){
if(m>n-m) m=n-m;
long long ans=1;
for(int i=0;i<m;i++) ans=ans*(n-i)/(i+1);
return ans;
}
int main(){
int T,n,k;
scanf("%d",&T);
for(int tc=1;tc<=T;tc++){
scanf("%d %d",&n,&k);
print... | ALGO | 0.999963 | 4.642064 |
9dcfbdf9-7bf5-4feb-ac62-dcf221390b89 | sakibhossain323/Competitive | Problems/AtCoder/Atcoder-abc283d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define MAX 10001
// #define valid(nr,nc) nr>=1 && nr<MAX && nc>=1 && nc<MAX
// int dr[] = {-1, 1, 0, 0};
// int dc[] = { 0, 0,-1, 1};
// vector <int> adj[MAX];
// bool visited[MAX];
// int parent[MAX];
// int dist[MAX];
// v... | ALGO | 0.999962 | 3.976753 |
6d70fa56-3705-4a22-a27a-7ec9b2f5a65f | VuNA2k2/SPOJ_PTIT | sochiamayman.cpp | #include<bits/stdc++.h>
using namespace std;
bool phantich(int n)
{
int i,ok=0;
while(n>0)
{
i=n%10;
if(i==4||i==7)
{
ok=1;
}
else return false;
n/=10;
}
return true;
}
int main()
{
int n , a[1005]={},i;
cin >> n;
if(n%8==0||n%1... | ALGO | 0.999818 | 3.916864 |
0e8be93d-aac3-42ad-a297-219076111410 | bartvbl/Shapebench | lib/CGAL-5.6.1/examples/Generator/sphere_d.cpp | #include <iostream>
#include <vector>
#include <CGAL/Cartesian_d.h>
#include <CGAL/point_generators_d.h>
typedef CGAL::Cartesian_d<double> Kd;
typedef Kd::Point_d Point;
int main ()
{
int nb_points = 10;
int dim =5;
double size = 100.0;
std::co... | ALGO | 0.922618 | 4.215291 |
850caefb-3447-415e-939a-0204f32ec097 | Kuldeepagrahari/Programming-DSA-Shell-BashScripting-OOPS | CP/leetcode/template.cpp | #include<bits/stdc++.h>
using namespace std;
template <typename Container>
void samPrinter(const Container &samContainer)
{
for (auto samIt = std::begin(samContainer); samIt != std::end(samContainer); ++samIt)
{
std::cout << *samIt << " ";
}
std::cout << std::endl;
}
template <typename Contain... | ALGO | 0.999896 | 4.694182 |
ef300407-804e-4fb6-a4ac-41e76813168a | manikanta2901/ubuntu | .history/random/trees/minEle_20200729182955.cpp | #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 + high) / 2;
build(arr,2 * index,low ,mid);
build(arr,2 * index + 1,mid + 1,high);
... | ALGO | 0.999988 | 4.87842 |
d028a8f8-c141-477b-9f81-4ac889f67869 | AllenYGY/CompetitiveProgramming | Contest/Lanqiao/递归和递推/飞行员兄弟/code.cpp | #include<iostream>
#include<vector>
using namespace std;
const int N=20;
int s[N][N];
int c[N][N];
bool used[N][N];
int ans=17;
vector<vector<int> > path;
void turn(int i,int j){
s[i][j]^=1;
for(int k=1;k<=4;k++){
s[k][j]^=1;
}
for(int k=1;k<=4;k++){
s[i][k]^=1;
}
}
bool check(... | ALGO | 0.999934 | 3.085997 |
f4589b8f-e3e5-443a-87d9-547bcd045a02 | princesharma74/Coding-Practice | - Codeforces Problems/- 1000 - Codeforces - Practice Problems/A_Tram.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define PI 3.1415926535897932384626433832795
const unsigned int mod = 1000000007;
//Problem Link: https://codeforces.com/problemset/problem/116/A
/* Approach: */
void solve(){
int n, cp = 0;
cin >> n;
int a, b;
int cr... | ALGO | 0.999951 | 4.438798 |
80cf5ea0-9832-405c-b62b-6871013b3a50 | ChitrakshiChhabra/Daily-Practice-Problems | maximumLengthOfPairChain.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
static bool compare(vector<int> &v1, vector<int> &v2)
{
return v1[1] < v2[1];
}
int findLongestChain(vector<vector<int>> &pairs)
{
sort(pairs.begin(), pairs.end(), compare);
int prev = 0;
int res = 1;
for (int i = 1; i ... | ALGO | 0.999879 | 4.968822 |
17d31173-ab89-437e-ac25-deff6d3d7733 | Adivatsa/Coding | DP/buyAndSellStock2.cpp | int solve(vector<int>& prices, int index, int canBuy, vector<vector<int>> &t)
{
//Base case
//when any stock bought but didnot sell so 0 profit
if(index==prices.size())
return 0;
if(t[index][canBuy]!=-1)
return t[index][canBuy];
int profit=0;
... | ALGO | 0.999949 | 5.963724 |
0eedfb10-c439-4290-83f2-83229ef9ee14 | sugimotoyuuki/kyopro | contest/ABC/083/b.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// input
ifstream in("b.txt");
cin.rdbuf(in.rdbuf());
int N, A, B;
cin >> N >> A >> B;
int ans = 0;
string tmp;
for (int i = 1; i <= N; ++i) {
int sum = 0;
int j = i;
while (j > 0) {
sum += j % 10;
j /= 10;
}
i... | ALGO | 0.999432 | 4.104474 |
fdeaad57-edf4-46de-a41f-ec1d7360e8c0 | mateor/pdroid | android-2.3.4_r1/tags/1.25/frameworks/base/media/libstagefright/codecs/amrnb/common/src/lsp_az.cpp | /*
Pathname: ./audio/gsm-amr/c/src/lsp_az.c
Funtions: Get_lsp_pol
Lsp_Az
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template. First attempt at
optimizing C code.
Description: Deleted all Lo... | ALGO | 0.98089 | 6.39352 |
da3201b4-1921-4573-ad8b-ce36aa199bd0 | a-dev1/CP-Repo | challenges/May Cookoff/Farmers_League.cpp | #include <bits/stdc++.h>
#define code_brains \
; \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(0);
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double lld;
const int MAX_N = 1e5 + 1... | ALGO | 0.999963 | 4.248267 |
71b09718-2a89-4102-8d43-365eb2f1b388 | zongy17/Cage_AutoGen | include/igl/copyleft/cgal/wire_mesh.cpp | #include "wire_mesh.h"
#include "../../list_to_matrix.h"
#include "../../slice.h"
#include "../../PI.h"
#include "convex_hull.h"
#include "coplanar.h"
#include "mesh_boolean.h"
#include <Eigen/Geometry>
#include <vector>
template <
typename DerivedWV,
typename DerivedWE,
typename Derivedth,
typename DerivedV,... | ALGO | 0.912692 | 6.192359 |
a7566451-bfb6-4000-a086-005cca2e0480 | ishandutta2007/codeforces | gamegame/normal/702/D.cpp | #include<iostream>
#include<unordered_map>
using namespace std;
int main(){
ios::sync_with_stdio(false);
long long d,k,a,b,t;
cin >> d >> k >> a >> b >> t;
if(d<=k) cout << a*d << endl;
else if(a*k+t>b*k) cout << a*k+b*(d-k) << endl;
else{
long long t1=(d-1)/k;
cout << min(a*d+(d-1)/k*t,a*t1*k+b*(d-t1*k)+t*(t... | ALGO | 0.999554 | 3.117352 |
67b3835e-b2b9-407d-abbb-e062614ccb37 | rodriguesxxx/Algorithms | CodeWar/CountByX/solution.cpp | #include <iostream>
#include <vector>
using namespace std;
std::vector<int> countBy(int x,int n){
std::vector<int> multiples;
for(int i = 1; i < n+1; i++) {
multiples.push_back(i * x);
}
return multiples;
}
int main() {
countBy(2, 5);
return 0;
} | ALGO | 0.99944 | 3.488776 |
8ee1b903-bc07-4732-95aa-67cb702a94cc | mrklein/mousse | 0.1.0/src/fv_motion_solver/fv_motion_solvers/displacement/displacement_interpolation_motion_solver.cpp | #include "displacement_interpolation_motion_solver.hpp"
#include "add_to_run_time_selection_table.hpp"
#include "sortable_list.hpp"
#include "iolist.hpp"
#include "tuple2.hpp"
#include "map_poly_mesh.hpp"
#include "interpolate_xy.hpp"
// Static Data Members
namespace mousse {
DEFINE_TYPE_NAME_AND_DEBUG(displacementIn... | ALGO | 0.939443 | 4.988197 |
2729f27d-00cc-4b26-a08a-3c47699d8355 | ishandutta2007/codeforces | kubic/normal/1288/A.cpp | #include <bits/stdc++.h>
using namespace std;
int T,n,d,x;bool fl;
int min(int x,int y) {return x<y?x:y;}
int max(int x,int y) {return x>y?x:y;}
int main()
{
scanf("%d",&T);
while(T--)
{
fl=0;scanf("%d %d",&n,&d);if(d<=n) {puts("YES");continue;}
x=floor(sqrt(d));
for(int i=max(x-10,0);i<=min(x+10,d);++i)
i... | ALGO | 0.99979 | 4.147367 |
28b632d6-1675-480e-ad1c-c357d335b793 | LuningW/Algorithms | CCCC/L1-044 稳赢 (15 point(s)).cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int k,m=0;
cin>>k;
while(1)
{
string str;
cin>>str;
if(str[0]=='E')
return 0;
if(m!=k)
{
if(str[0]=='B')
cout<<"JianDao"<<endl;
else if(str[0]=='C')
... | ALGO | 0.99977 | 3.243367 |
5564ddc0-0145-4203-9d9a-4d8324d20e3f | sradl1981/LIGGGHTS-PUBLIC-ParScale | src/USER-OMP/pair_buck_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "math.h"
#include "pair_buck_omp.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor... | ALGO | 0.999445 | 6.76797 |
a8df7094-4b8d-443c-8a91-77d2968981cb | debarghamitraroy/Competitive-Programming | CodeChef/DIGSMPAR.cpp | #include <iostream>
using namespace std;
void solve();
int main() {
solve();
return 0;
}
int digitSum(int n) {
int temp = n;
int sum = 0;
while (temp != 0) {
int rem = temp % 10;
sum = sum + rem;
temp = temp / 10;
}
return sum;
}
void solve() {
int t;
cin ... | ALGO | 0.999958 | 5.142463 |
46d29341-08d7-44df-9eab-1a3864032f65 | Ddelval/Competitive-programming | Actual contests/2019-12Uvas/L.cpp | // 13
// main.cpp
// Created by David del Val on 31/12/2019
//
//
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define LSB(x) ((x) & (-(x)))
#define echobin(x) cout<<#x<... | ALGO | 0.999933 | 4.567831 |
b6530123-b8ad-4b5f-a102-ea14eb43b8b4 | cechallenge/2025 | llvm/bolt/lib/Passes/ReorderData.cpp | // TODO:
// - make sure writable data isn't put on same cache line unless temporally
// local
// - estimate temporal locality by looking at CFG?
#include "bolt/Passes/ReorderData.h"
#include "llvm/ADT/MapVector.h"
#include <algorithm>
#undef DEBUG_TYPE
#define DEBUG_TYPE "reorder-data"
using namespace llvm;
using n... | ALGO | 0.994475 | 6.039638 |
9b98d0d4-786b-42b1-a2d7-76b9afa8f193 | ImperishableMe/codeforces-submissions | codeforces/462/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef pair<int,int> PII;
const int up = 1e7 + 1;
#define loop(i , a , b) for(int i = int(a); i <= int(b); i++)
#define vi(x) vector<int> x;
int main()
{
... | ALGO | 0.999752 | 4.057232 |
971495cf-b27f-46f8-a9ca-f7c218705b7a | jxson7/CS1PR-Petes-Pizza-Party | lecture-examples/spring/10/meta-gcd.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
template< int a, int b > struct GCD {
static const int RESULT = GCD< b, a % b >::RESULT;
};
template< int a > struct GCD< a, 0 > {
static const int RESULT = a;
};
GCD<25, 50> var;
int main() {
cout << "GCD (25,50) == " << GCD<... | ALGO | 0.996624 | 5.391371 |
f954f18a-2013-46f2-8e17-f48443d90d5b | Paul-St-Young/fs_qmcpack | src/QMCDrivers/DMC/DMCOMP.cpp | #include "QMCDrivers/DMC/DMCOMP.h"
#include "QMCDrivers/DMC/DMCUpdatePbyP.h"
//#include "QMCDrivers/DMC/DMCNonLocalUpdate.h"
#include "QMCDrivers/DMC/DMCUpdateAll.h"
#include "QMCApp/HamiltonianPool.h"
#include "Message/Communicate.h"
#include "Message/OpenMP.h"
#include "Utilities/Timer.h"
#include "OhmmsApp/RandomNum... | TOOL | 0.972759 | 4.566481 |
9f0f9ade-3152-41ee-82a3-9cad52641b5d | AkshatPandey2006/Linked_List | Maximum_Twin_Sum_of_LL.cpp | class Solution {
public:
ListNode* inverse(ListNode* head){
ListNode* temp;
ListNode* curr=head;
ListNode* prev=NULL;
while(curr){
temp=curr->next;
curr->next=prev;
prev=curr;
curr=temp;
}
return prev;
}
int pa... | ALGO | 0.999995 | 5.657638 |
01c60c3c-9154-42dc-87be-8cec62d1a0c8 | maxime-tournier/meuh | math/algo/modulus.cpp | #include "modulus.h"
#include <math/lcp.h>
#include <math/algo/iter.h>
namespace math {
namespace algo {
static vec diagp1(const mat& M) {
return M.diagonal().array() + 1;
}
static mat off_diag(const mat& M ) {
mat res = M;
res.diagonal().setZero();
return res;
}
modul... | ALGO | 0.999911 | 5.607493 |
10f99532-42eb-438c-a520-a05b5e0de783 | hey-saniraj/Practiced-Programs | digitInNum.cpp | #include<iostream>
using namespace std;
int main()
{
int number;
cout<<"Enter Number\n";
cin>>number;
if(number==0)
cout<<"You have entered zero!";
else
{
int counter=0;
while (number!=0)
{
number=number/10;
counter++;
}
cout<<"This numbe... | ALGO | 0.997885 | 3.576506 |
c63ee17a-d84b-431a-8dc0-3e4c336fa7d6 | nehasan/acm-uva | 11934MagicFormula.cpp | #include<iostream>
#include<cstdio>
using namespace std;
int square[1000];
void GenSquareVal(){
for(int i=0;i<1000;i++){
square[i]=i*i;
}
}
int main(){
freopen("test.txt","r+",stdin);
GenSquareVal();
int cx;
long long a,b,c,d,l;
while(scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&l)==5){
if(a==0 && b==0 &&... | ALGO | 0.99931 | 3.046989 |
9544d4b7-e297-4545-9857-1a6f7c84fc94 | nholuongut/ColossalAI | extensions/csrc/kernel/arm/cpu_adam_arm.cpp | #include "cpu_adam_arm.h"
void AdamOptimizer::Step_1(void *_params, void *grads, void *_exp_avg,
void *_exp_avg_sq, size_t _param_size,
at::ScalarType param_dtype,
at::ScalarType grad_dtype,
at::ScalarType exp_a... | ALGO | 0.999657 | 6.358357 |
843571a0-8c26-48c2-9b80-0eb649edb1c3 | AnthonyDugarte/competitive-programming | COJ/3953.cpp | #include <bits/stdc++.h>
using namespace std;
vector<bool> taken_c(256, false);
size_t k;
string s;
bool is_it_beatiful(size_t pos = 0, size_t curr_k = 1)
{
if(curr_k == k)
{
cout << "YES\n";
while(pos < s.size())
cout << s[pos++];
cout << "\n";
return tru... | ALGO | 0.999926 | 4.295265 |
c3a7be90-bea9-4874-8119-f9f7751bad88 | pavankumarsai18/LeetCode | 0203-remove-linked-list-elements/solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* removeElements(ListNode* head, int val) {
auto curr = head;
ListNode* prev = nullptr;
while(curr !... | ALGO | 0.999912 | 5.848695 |
a44aacd4-ddac-4132-8551-bedbe36c14b0 | raincross7/code-similarity | codes/train_code/problem447/problem447_309.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n); for(ll i = 0; i < (ll)n; i++)
int main() {
ll a,b,c; cin >> a >> b >> c;
cout << max(c-(a-b), (ll)0) << endl;
}
| ALGO | 0.999819 | 3.49184 |
05cbecd8-7457-4686-bce2-7a4e661bb8d8 | Nermeen-Mohammad/Problem_Solving_Level1_Using_Cpp | My_abs_Function.Cpp |
#include <iostream>
#include<cmath>
using namespace std;
int ReadNumber()
{
int number;
do {
cout << "Enter negative number";
cin >> number;
} while (number > 0);
return number;
}
int MyAbs(int number)
{
if (number < 0)
return -1 * number;
else
return number;
}
int CppAbs(int number)
{
return abs(numb... | TOOL | 0.994154 | 3.400625 |
8e4c7fab-15b8-4dac-aaff-418decffd7f9 | Shubhamsahu1101/cpp | A_Forked.cpp | #include <bits/stdc++.h>
#define forall(it, cont) for (auto it = cont.begin(); it != cont.end(); it++)
#define forl(i, a, b) for (int i = a; i < b; i++)
#define forr(i, a, b) for (int i = a; i >= b; i--)
#define int long long
#define pb push_back
#define M 1000000007
#define yes cout << "YES" << endl
#define no cout <<... | ALGO | 0.999934 | 4.939247 |
add1d3c4-ec44-4588-9620-89e9ba7437a3 | ishandutta2007/codeforces | krijgertje/normal/453/E.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <climits>
#include <cassert>
#include <ctime>
#include... | ALGO | 0.999727 | 3.572634 |
f5f8d00e-57e8-4bb6-abf2-55ddfc998a86 | Alvee78/Codeforces | D_Apple_Tree.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<vector<ll>>v;
vector<ll>cnt;
ll dfs(ll parent,ll child){
ll count=0;
for(auto cld : v[child]){
if(cld!=parent)
count+=dfs(child,cld);
}
if(v[child].size()==1 && child!=1){
count++;
}
cnt[child]... | ALGO | 0.999516 | 4.253367 |
639fe834-8484-4f45-908d-f3e3aa9dbc4f | CedricKuang/LeetCode | easy/876.middle-of-the-linked-list.cpp | /*
* @lc app=leetcode id=876 lang=cpp
*
* [876] Middle of the Linked List
*/
// @lc code=start
/**
* 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, ... | ALGO | 0.999913 | 6.41129 |
4c74e6e3-7d54-4910-8d65-25d0f4ab16be | gun5046/algorithmStudy | 1806.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <set>
#include <sstream>
#include <cstring>
#include <string>
#include <stack>
using namespace std;
int main() {
int n, s;
vector... | ALGO | 0.99996 | 3.315232 |
5180d4c0-df71-40db-bac9-bb8498c0b81d | jyami-kim/c_language | 9. Structure/lab9_1_my.cpp | #include <stdio.h>
struct Time {
int seconds;
int minutes;
int hours;
};
int main(void) {
struct Time t1, t2, diff;
printf("Enter start time: \n");
printf("Enter hours, minutes and seconds respectively: ");
scanf("%d %d %d", &t1.hours, &t1.minutes,&t1.seconds);
printf("Enter stop time: \n");
printf("Enter ho... | ALGO | 0.997824 | 3.66176 |
6aa0db53-9fb9-4448-b43e-ef3661054dd9 | janbrodowicz/drone_landing | src/VisionProcessing/ObjectParameterAnalysis.cpp | #include "VisionProcessing/ObjectParameterAnalysis.h"
using namespace object;
ObjectParameterAnalysis::ObjectParameterAnalysis(cv::Mat img, cv::Mat stats, int circle_size, int square_size, int height, int width) :
m_image(img),
m_stats(stats),
m_circle_size(circle_size),
m_square_size(square_size),
... | ALGO | 0.993877 | 5.360612 |
d936fc13-0772-4c4c-992b-a5b7065c391c | durjoybarua5327/Online_judge_problem_solution | codeforces/A. Watermelon.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int w;
cin>>w;
if(w%2==0&&w!=2) cout<< " YES";
else cout<< "NO";
return 0;
} | ALGO | 0.999155 | 3.439139 |
e9432f3b-7902-4719-8f85-921eb0024020 | ghozt777/cp | leetcode/c++/blind-75-Leetcode-questions/trees/serealize-and-deserealize-binary-tree/main.cpp | // link : https://leetcode.com/problems/serialize-and-deserialize-binary-tree/
// algo used : Level Order Traversal
#include <bits/stdc++.h>
#include <string>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
/**
... | ALGO | 0.999838 | 6.211777 |
a008bde7-a02e-44c4-905b-6190559224cd | nicolasrgl/thesis-material | src/filter.cpp | #include "filter.h"
bool Filter::isPointTooFarFromCurve(Point fixed, const Curve& curve, distance_t distance)
{
auto dist_sqr = distance * distance;
if (fixed.dist_sqr(curve.front()) <= dist_sqr || fixed.dist_sqr(curve.back()) <= dist_sqr) { return false; }
std::size_t stepsize = 1;
for (PointID pt = 0; pt < curve... | ALGO | 0.999547 | 5.066609 |
99211a11-f66a-4e18-a164-18e325ce5215 | khaledsliti/CompetitiveProgramming | Leetcode/1-99/12.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
vector<pair<int, string>> values = {
{ 1, "I" },
{ 4, "IV" },
{ 5, "V" },
{ 9, "IX" },
{ 10, "X" },
{ 40, "XL" },
{ 50, "L" },
{ 90, "XC"},
{ 100, "C" },
{ 400, "CD" },
{ 500, "D" },
{ 900, "CM" },
{ 10... | ALGO | 0.999818 | 6.372954 |
864a4f41-79b4-44f1-8ca8-4bc2bda432cf | n17y17/kyou_pro_history | At_coder/typical90/typical90_b.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
short n;
cin >> n;
if(n%2 == 1) return 0;
string s;
sort(&s[0],&s[9]);
cout << s << endl;
} | ALGO | 0.999956 | 3.993494 |
8f63e275-9f18-4d84-8fb9-26c52333f033 | Viateur-akimana/Data-structures | arrays/insertion.cpp | #include<iostream>
using namespace std;
int main(){
int arr[10],x,n,pos;
cout <<"Enter the number of elements is an array:\n";
cin >> n;
cout <<"Enter the elements of the array:\n";
for(int i=0; i < n;i++){
cin >> arr[i];
}
cout <<"Enter the element you want to insert:";
cin >... | ALGO | 0.99917 | 3.770224 |
bb02d437-342f-49ab-b011-f8f2b0304619 | Covariance/itmo-ct-y19 | algo-ds/term2/lab/3/K.cpp | //
// Created by covariance on 30.05.2020.
//
#include <bits/stdc++.h>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
using namespace std;
const size_t max_ups = 22;
vector<uint> depth;
vector<vector<size_t>> ups;
vector<uint> translation;
unordered_map<uint, size_t> back_translation;
vector... | ALGO | 0.999781 | 5.331542 |
837a30a6-61dc-4ba5-a997-200e66c24107 | aquatiko/Leetcode-tracker | Till June 9th/Ugly Numbers II.cpp | class Solution {
public:
int nthUglyNumber(int n) {
vector<long long> dp(n+1);
dp[0] = 1;
int idx2 = 0, idx3 = 0, idx5 = 0;
for(int i=1;i<n;i++)
{
long long tmp_ans = LONG_MAX;
tmp_ans = min(tmp_ans, dp[idx2]*2);
tmp_ans = min(tmp_ans, dp[i... | ALGO | 0.999961 | 6.789773 |
a624fa8a-bffb-4346-ba5d-969adade1a2d | marat-curious/learn | cpp/books/cpp-primer/03_4/ex_3_22.cpp | #include <iostream>
#include <string>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::getline;
using std::string;
using std::toupper;
using std::vector;
int main()
{
vector<string> text;
string line;
while (getline(cin, line))
text.push_back(line);
for (auto it... | ALGO | 0.958291 | 4.934614 |
9b00e812-3445-434c-bd65-eff9c398a347 | pybnen/ijtihad | cryptominisat/src/distillerallwithall.cpp | #include "distillerallwithall.h"
#include "clausecleaner.h"
#include "time_mem.h"
#include "solver.h"
#include "watchalgos.h"
#include "clauseallocator.h"
#include "sqlstats.h"
#include <iomanip>
using namespace CMSat;
using std::cout;
using std::endl;
//#define DEBUG_STAMPING
#ifdef VERBOSE_DEBUG
#define VERBOSE_SU... | ALGO | 0.99965 | 5.708004 |
6d576087-06ef-4e42-82d6-f830de5000e2 | sanyamsinghal/Data_Structures_And_Algorithms | DynamicProgramming/AtCoder_DP_Contest_Solutions/Knapsack1.cpp | /*
created by Sanyam Singhal
/*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long int
#define mod 1000000007
#define w(t) int t; cin>>t while(t--)
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define fastIO io... | ALGO | 0.999995 | 4.299415 |
61fed031-9d19-45c6-a198-fbd2bb8fde8a | TH-takahirohara/atcoder_solve | abc210-219/abc215/c_one_more_aab_aba_baa.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a) for(auto &i:a)
// 桁数指定: cout << fixed << setprecision(10)
int main() {
string S;
int K;
cin >> S >> K;
s... | ALGO | 0.999992 | 4.940732 |
e3692e0a-6a20-4765-9997-dcb4f0ee0187 | mud2man/LeetCode | C++/320.GeneralizedAbbreviation/main.cpp | /* DFS + backtrack O(#abbs)
* 1. Append the previous abb, and iterate all the possible abbreviations
* ex: idx = 0 :{ w-ord, 1o-rd, 2r-d, 3d, 4}
* || || ||
* \/ \/ \/
* {wo-rd, w1r-d, w2d... | ALGO | 0.999806 | 6.120661 |
909da0dc-8177-4ca0-b58f-fb5a0f9e1b4f | yuriYanZeXuan/ICPC | DP/STA-Station.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=1000000+10;
vector<int> g[maxn];
int sz[maxn];
int dep[maxn];
int dep_sum[maxn];
int f[maxn],n,rt;
long long mns=-1;
void dfs1(int u,int p){
sz[u]=1;
dep[u]=dep[p]+1;
for(int i=0;i<g[u].size();i++){
if(g[u][i]==p)continue;
dfs1(g[u]... | ALGO | 0.999979 | 4.252485 |
d3574535-023a-4f0b-b233-4a17b20dee18 | ACM-TOMS/CALGO | 0980/Original-Submission/SPQR/Demo/qrdemo_gpu3.cpp | // =============================================================================
// === qrdemo_gpu3.cpp =========================================================
// =============================================================================
// A simple C++ demo of SuiteSparseQR. The comments give the MATLAB equival... | ALGO | 0.943366 | 3.978679 |
cd04de0d-ac37-42b0-bcc0-93b4b76c7640 | anujsoni10001/Data-Structure-Using-C-plus-plus | doubly-linked-list/main.cpp | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
struct list{
int data;
struct list *prev;
struct list *next;
};
struct list* create(int data)
{
struct list *temp;
temp=(struct list*)malloc(sizeof(struct list));
temp->data=data;
temp->prev=NULL;
temp->next=NULL;
return temp;
}
int count(struct list* first)... | ALGO | 0.999905 | 4.009562 |
0995de0a-fa7a-422e-aecd-e4cc99c3c0f2 | Akib-Vijapura/Leetcode | 2316-count-hills-and-valleys-in-an-array/2316-count-hills-and-valleys-in-an-array.cpp | class Solution {
public:
int countHillValley(vector<int>& nums) {
int n = nums.size();
vector<int> v;
int count = 0;
for (int i = 0; i < n - 1 ; i++) {
if (nums[i] != nums[i + 1])
v.push_back(nums[i]);
}
if (v.size() == 0 || v.size() == 1... | ALGO | 0.99997 | 5.536807 |
37ff1eb2-64b9-46fe-9a93-dd361736618e | gilsaia/code-exercise | leetcode/201.数字范围按位与.cpp | /*
* @lc app=leetcode.cn id=201 lang=cpp
*
* [201] 数字范围按位与
*/
// @lc code=start
class Solution2 {
public:
int rangeBitwiseAnd(int left, int right) {
int res=0;
int digit=0;
long long l=left,r=right;
long long cur=left;
while(cur){
if(cur&1){
l... | ALGO | 0.999943 | 6.262652 |
00b04412-e999-42b0-8c18-045a2ce93a66 | leejseo/PS | ACM-ICPC/Korea Regional/2020/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int A[6], B[6];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
for (int i=0; i<6; i++){
cin >> A[i];
}
for (int j=0; j<6; j++){
cin >> B[j];
}
int x = 0, y = 36;
for (int i=0; i<6; i++... | ALGO | 0.999843 | 3.878134 |
8f8d0cae-3d5f-4ff5-9a9f-3cd68d1e240e | ishika-gupta21/Leetcode-Problems-Solutions | 1154-day-of-the-year/1154-day-of-the-year.cpp | class Solution {
public:
bool isLeap(int y)
{
return (y % 4 == 0 && y % 100 != 0) || (y % 400 == 0);
}
int getMonth(int m,int y)
{
if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)
return 31;
if(m==2)
return isLeap(y) ? 29 : 28;
return 30;
}
int dayOfYear(st... | ALGO | 0.999849 | 5.348018 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.