uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a193b1f0-76d7-47a7-a267-4c778dcc4b10 | RunAtTekky/DSAandCP | contests/CF/1030Div2/A_Equal_Subsequences.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n, k; cin >> n >> k;
for (int i=0; i<k; i++) {
cout << "1";
}
for (int i=k; i<n; i++) {
cout << "0";
}
cout << "\n";
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int t=1; cin >> t;
... | ALGO | 0.999968 | 3.797773 |
f2478817-a6cb-4386-a84a-43c60648423d | Giordan0/URIOJ | Matemática/1170.cpp | #include <iostream>
using namespace std;
int main() {
int n;
double c;
cin >> n;
for(int i = 0; i < n; i++) {
int cont = 0;
cin >> c;
while(c > 1) {
c /= 2;
cont++;
}
cout << cont << " dias" << endl;
}
return 0;
} | ALGO | 0.999941 | 3.945153 |
1f14b09f-5e14-49b8-aac9-7e0bcc789b92 | superj6/autogen-geodash | src/collision_box.cpp | #include "collision_box.hpp"
CollisionBox::CollisionBox() : position(0.0f), size(1.0f), velocity(0.0f), acceleration(0.0f){}
glm::vec2 CollisionBox::movePredict(float dt){
return position + velocity * dt + 0.5f * acceleration * dt * dt;
}
void CollisionBox::move(float dt){
position = movePredict(dt);
velocity ... | ALGO | 0.942976 | 5.806343 |
edbb9b49-a5e2-4eba-9d37-984ee82b6cfe | jakujobi/CSC-250-with-Cpp | P1 - Snowball Team Score Checker/Version 1.0/snowball_JCA_V1.cpp | /*
Program 1 - Snowball Fight Team Score Checker
It allows the user to enter a team’s ID and displays the number of hits for that team
Created by: John Akujobi
Date: 22nd of January 2023
Class: CSC 250 Fall 2023
*/
/* Detailed program requirements
A text file named snowball.txt contains a 3-digit Team ID, number o... | ALGO | 0.996287 | 6.455919 |
fa6b34b4-dc02-4c0e-8a52-e62208939e71 | Cysheper/ACM-Note | 数据结构/基础数据结构/链表/P_1160_队列安排.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
// #define int ll
struct node {
int l, r;
node() {
l = 0;
r = 0;
}
}lst[100005];
void solve() {
int n; cin >> n;
int head = 1;
for(int i = 2; i <= n; ++ i) {
int x, op; cin >> x >> op;
if(x ==... | ALGO | 0.999985 | 4.411299 |
351dda47-7ade-4d35-b51d-b384b8bdbfa9 | zxyDEDIRE/ACM_CODE | 多校/on/H.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pp(x) array<int,x>
using ull=unsigned long long;
using ll=long long;
using pii=pair<int,int>;
using pdd=pair<double,double>;
const int dx[]={0,0,1,-1,1,-1,1,-1};
const int dy[]={1,-1,0,0,1,-1,-1,1};
const int mod=998244353;
const int inf=0x3f3f3f3f;... | ALGO | 0.999744 | 3.373298 |
6d82d47a-5d12-4914-9bfe-e3fd93d34861 | squaresLab/BatFix | results/transcoder/translations/java/SORT_1_N_SWAPPING_ADJACENT_ELEMENTS.cpp | bool sortedAfterSwap ( int A [ ] , bool B [ ] , int n ) {
int i , j ;
for ( i = 0 ;
i < n - 1 ;
i ++ ) {
if ( B [ i ] ) {
j = i ;
while ( B [ j ] ) j ++ ;
qsort ( A + i , 1 + j , sizeof ( int ) * i ) ;
i = j ;
}
}
for ( i = 0 ;
i < n ;
i ++ ) {
if ( A [ i ] != i + 1 )... | ALGO | 0.999636 | 4.978934 |
aedd91b8-d501-4b6d-9593-151984fe72ef | Arjun3000/DSA_FUll_using_cpp | cpp/stack/next_largest.cpp | #include<iostream>
#include<vector>
#include<stack>
using namespace std;
vector<int> nextgreat(vector<int> &arr)
{
int n;
vector<int>result(n,-1);
stack<int>st;
for(int i = n-1; i >= 0; i--)
{
while(!st.empty() && st.top()<=arr[i])
{
st.pop();
}
if(!st.em... | ALGO | 0.999936 | 4.313755 |
a3cd4c51-439b-44b3-8043-ea8f643d9122 | arpu-nagar/Coding | atcoder/abc178/C.cpp | /**
* author: arpunagar
*
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
#define inv(v) \
for (auto &it : v) \
cin >> it;
#define MOD 1000000007
#define pb push_back
#d... | ALGO | 0.999874 | 4.372924 |
2670ad3b-890b-4f91-9bc9-5865c3129526 | Fightinggi/DaimaSuiXiangLu | TanXin/763-partitionLabels/763-partitionLabels.cpp | #include<vector>
#include<queue>
#include<iostream>
#include<stack>
#include<string>
#include <map>
using namespace std;
//ַ S СдĸɡҪַΪܶƬΣͬһĸһƬСһʾÿַƬεijȵб
//
//ʾ
//
//룺S = "ababcbacadefegdehijhklij"
//[9, 7, 8] ͣ ֽΪ "ababcbaca", "defegde", "hijhklij" ÿĸһƬС
// "ababcbacadefegde", "hijhklij" ĻǴģΪֵƬ١
class Solution {
pub... | ALGO | 0.999678 | 4.826896 |
3a2c0f89-e45f-4f8d-b7f9-51c81c44f0f8 | Time1ess/MyCodes | Interview/legacy/Google/构造拥有N个平衡括号对的字符串/solution.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution
{
public:
string shortest_balance_parentheses(int N)
{
if(N == 0)
return "";
int base = 1;
while(base * base <= N)
base++;
base--;
int div = N / base;
int mod = N %... | ALGO | 0.999883 | 4.972918 |
6f247135-d6a2-439e-9f1a-bd90f1a4f612 | priyansh19/data-structures-and-algorithms | algorithms/InsertionSort-Iterative.cpp | /*
* File: main.cpp
* Author: Priyanka
*
* Created on June 7, 2019, 9:52 PM
*/
#include <iostream>
using namespace std;
void printArray(int *array[], int size)
{
int j;
for (j = 0; j < size; j++)
{
cout<<" "<< array[j];
}
cout<<endl;
}
void insertSort(int a[],int n)
{
for(int i=0;i<n;i++)
... | ALGO | 0.999882 | 4.911794 |
35083373-97a5-4b15-9816-8fc3d6349412 | MaTianmao/src | src/boost/libs/numeric/ublas/doc/samples/banded_matrix.cpp | #include <boost/numeric/ublas/banded.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
banded_matrix<double> m (3, 3, 1, 1);
for (signed i = 0; i < signed (m.size1 ()); ++ i)
for (signed j = (std::max) (i - 1, 0); j < (std::min) (i + 2, signed (m.size2 ... | ALGO | 0.964042 | 3.750736 |
cb5abb45-bdd4-40fd-a125-bd74c7dece34 | aryanb203/Stack | BalancedParanthesisStack.cpp | #include<iostream>
#include<stack>
#include<string>
using namespace std;
int IsValid(string s){
stack<char> st;
for(int i=0; i<s.length(); i++){
if(s[i]=='(' || s[i]=='{' || s[i]=='[')
st.push(s[i]);
else if(s[i]==')' && st.top()=='(')
st.pop();
else if(s[i]=='}' && st.top()==... | ALGO | 0.999588 | 4.418047 |
ae1d184e-35cc-4131-86fe-0e67f2b5ecee | IsadoraPiropop/Programacao_DEV-C- | Questao 1173.cpp | #include <iostream>
using namespace std;
int main() {
int V;
cin>> V;
for(int i=0; i<10; i++) {
cout<<"N[" <<i<< "] = " << V <<endl;
V = V * 2;
}
return 0;
}
| ALGO | 0.99959 | 3.708339 |
aa2b003e-f1ce-493a-b3e5-ac8af732e150 | coder-ashwani/LeetCode | 0025-reverse-nodes-in-k-group/0025-reverse-nodes-in-k-group.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* reversell(... | ALGO | 0.999985 | 5.85624 |
c32c9374-5a79-4c89-bb1e-495280312f39 | prathameshpatel07/UW_ME759_HPC | HW9/task2.cpp | #include <iostream>
#include <cstdlib>
#include <algorithm>
#include <chrono>
#include <ratio>
#include <string.h>
#include <omp.h>
#include "montecarlo.h"
using namespace std;
using namespace chrono;
int main(int argc, char** argv){
size_t n = atoi(argv[1]);
unsigned int t = atoi(argv[2]);
float *x, *y;
int ... | ALGO | 0.999661 | 4.879628 |
01d8b624-6d9a-4a16-af36-b2f3bd69287f | dvkcool/competitive | hackerearth/2019/oct-circuit-2019/diffpermu.cpp | #include<iostream>
#define lli long long int
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int t, n;
lli fact[12];
fact[1] = 1;
t = 2;
while(t<12){
fact[t] = t * fact[t-1];
t++;
}
cin>>t;
while(t>0){
t--;
cin>>n;
lli s = (n * n) - ((n)*(n+1)/2);
... | ALGO | 0.999904 | 4.411797 |
e29a32bd-13c0-40b4-aa6b-b2732a3bd35c | rocky-pc/AutoAi | classic/frontend/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998066 | 6.76073 |
926ad925-cabb-467c-b719-4e16da21513f | nguyenquitai/nguyenquitai-monc | Chapter4/Challenges/bai25.cpp | #include <iostream>
int main() {
const double PACKAGE_A_BASE_COST = 39.99;
const double PACKAGE_B_BASE_COST = 59.99;
const double PACKAGE_C_BASE_COST = 69.99;
const int PACKAGE_A_INCLUDED_MINUTES = 450;
const int PACKAGE_B_INCLUDED_MINUTES = 900;
const double ADDITIONAL_RATE_A = 0.45;
con... | TOOL | 0.968738 | 7.251027 |
070007b4-0365-4f51-bfac-7a18fc2b354d | memcpy0/LeetCode-Conquest | Solutions/2551-2560/2559. Count Vowel Strings in Ranges[前缀和,字符串] 中等.cpp | /*
** Problem: https://leetcode.cn/problems/count-vowel-strings-in-ranges/
** Article: https://memcpy0.blog.csdn.net/article/details/131046346
** Author: memcpy0
*/
class Solution {
public:
vector<int> vowelStrings(vector<string>& words, vector<vector<int>>& queries) {
function<bool(char)> is_vowel = [&](cha... | ALGO | 0.999523 | 6.332601 |
0d275a0a-0c8c-4207-b2a6-26e0bbc8c467 | giovanniberi93/audio_compression | miosix-kernel/miosix/kernel/sync.cpp | //Miosix kernel
#include "sync.h"
#include "kernel.h"
#include "kernel/scheduler/scheduler.h"
#include "error.h"
#include "pthread_private.h"
#include <algorithm>
using namespace std;
namespace miosix {
//
// class Mutex
//
Mutex::Mutex(Options opt): owner(0), next(0), waiting()
{
recursiveDepth= opt==RECURSIV... | TOOL | 0.946053 | 5.865309 |
5d461864-2aea-44d7-bc4d-56a735c5cae4 | michimani/atcoder | abc/001-100/029/cpp/c.cpp | #include <iostream>
using namespace std;
using ui = unsigned int;
void gen(ui &n, string s)
{
if (s.size() == n)
{
cout << s << endl;
return;
}
gen(n, s + 'a');
gen(n, s + 'b');
gen(n, s + 'c');
}
int main()
{
ui n;
cin >> n;
gen(n, "a");
gen(n, "b");
gen(n, "c");
return 0;
} | ALGO | 0.999089 | 4.058179 |
c1857f02-6e61-4bae-bd83-7d9e423964f9 | minh711/cpp-algorithms | Library/find_min.cpp | #include <iostream>
using namespace std;
// Function prototype
int find_min(int a[], int n);
int main()
{
int a[] = {8, 4, 9, 5, 7, 6, 3, 2};
int min = find_min(a, 8);
cout << min << endl;
}
/**
* @brief Find the minimum value.
*
* @param a Integer array.
* @param n Length of the array.
*/
int find... | ALGO | 0.999852 | 5.99446 |
22c44d98-4288-4b8c-a6ff-69721970c5a1 | nkoturovic/Programming | c++/examples/monad/monad_backup/composition.cpp | #include <utility>
template <class G, class F>
constexpr auto compose (G &&g, F &&f) {
return [g,f](auto ... args) { return f(g(args...)); };
}
template <class G, class F, class ... Hs>
constexpr auto compose (G &&g, F &&f, Hs&& ... hs) {
return compose(std::forward<G>(g), compose(std::forward<F>(f), std::fo... | ALGO | 0.999104 | 5.850177 |
53ee6b15-3232-4e28-9d22-164b8171753a | sruucodes/Strivers_A2Z_Sheet | Dynamic Programming/9. DP on Squares/01. Maximal Square.cpp | /*
QUESTION:
Given an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.
Example:
Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]
Output: 4
APPROACH:
- This problem can be solved using dynamic programm... | ALGO | 0.999984 | 7.477911 |
c4c75714-2a8c-4ae5-86c3-dcfd2bdcbcdd | ishandutta2007/codeforces | realfzzzz/normal/1129/E.cpp | #include<bits/stdc++.h>
using namespace std;
inline int readint(){
int x=0;
bool f=0;
char c=getchar();
while(!isdigit(c)&&c!='-') c=getchar();
if(c=='-'){
f=1;
c=getchar();
}
while(isdigit(c)){
x=x*10+c-'0';
c=getchar();
}
return f?-x:x;
}
const int maxn=500+5;
int n,size[maxn],ord[maxn];
vector<int> ... | ALGO | 0.99986 | 3.13189 |
1fd69ad6-3eea-497a-ab84-e224d50248b9 | HenriJ/aeretina | cpp/eyetracker_old/main.cpp | #include <iostream>
#include <string.h>
#include <cmath>
#include <boost/timer.hpp>
#include <GL/glew.h>
#ifdef __APPLE__
# include <GLUT/glut.h>
#else
# include <GL/freeglut.h>
#endif
#include "../aer/event2d.h"
#include "../aer/fileevent2dreader.h"
#include "circle.h"
#include "precompexp.h"
using namespace st... | ALGO | 0.88393 | 4.173281 |
41925f47-39c7-47d0-a874-774c281ee0db | AmitBhardwaj26/Crack_my_Internship | _024_Game of Life.cpp | // link: https://leetcode.com/problems/game-of-life/
class Solution {
public:
void gameOfLife(vector<vector<int>>& board) {
int n=board.size(),m=board[0].size();
vector<vector<int>> ans(n,vector<int> (m,0) ) ;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
... | ALGO | 0.999948 | 6.247899 |
97b4594c-ab67-429f-99b9-829f2058ab80 | owlpaw20/CPArchive | USACO Training/[USACO Training 3.1] Agri-Net.cpp | #include <vector>
#include <iostream>
#include <algorithm>
#define endl '\n'
using namespace std;
struct Edge {
int u, v, w;
Edge() {}
Edge(int _u, int _v, int _w) : u(_u), v(_v), w(_w) {}
bool operator<(const Edge &t) const {
return w < t.w;
}
};
struct DisjointSet {
vector<int> p;
void init(... | ALGO | 0.999996 | 4.282088 |
1cf161ab-0132-4d3b-b417-abd66a43ad6a | FMonitor/SZUOJ | 程序设计基础/222/图案.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
for(int i=1; i<=n; i++){
for(int j=i; j<n; j++){
cout << ' ';
}
for(int j=1;j<=i*2-1; j++){
cout <<'#';
}
cout << endl;
}
return 0;
} | ALGO | 0.999957 | 3.580066 |
122600bd-252e-4677-8707-09fcf4334509 | Vindraxx/Struktur-Data | StrukDat(SIngleLinkList).cpp | #include <stdio.h>
#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <windows.h>
void gotoxy(int x, int y)
{
COORD coord;
coord.X=x;
coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
using namespace std;
struct TNode{
int data;
TNode *next;
};
TN... | ALGO | 0.995071 | 3.254562 |
476860ab-1c19-457d-b6fd-18b10751b737 | aryangagan/codsoft | To do list/To do list.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
struct Task {
string description;
bool completed;
Task(string desc) : description(desc), completed(false) {}
};
vector<Task> tasks;
// Function to add a task
void addTask() {
string taskDesc;
cout << "Enter task descri... | TOOL | 0.917374 | 6.900983 |
5f74bad7-9711-4f63-86d6-2efbb884c5f1 | tanmoykdas/Codeforces-problem | inbox.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n], c = 0;
vector<int> v;
for(int i = 0; i < n; i++) {
cin >> a[i];
v.push_back(a[i]);
}
while(true) {
if(v[v.size() - 1] == 0)
v.pop_back();
else
break;
}
... | ALGO | 0.999962 | 4.117287 |
2ff8546f-e0ec-4769-9455-5ea2d9e6b0b6 | Liu-Steve/leetcode-sign-in | 20230914-1222.cpp | #include "bits/stdc++.h"
#define io \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
using namespace std;
#define MOD 1000000007LL
typedef long long ll;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typ... | ALGO | 0.999992 | 4.504353 |
3a881296-0109-43ad-b2fe-0e44eb0359f8 | kingarthur11/leetcode | solution/0100-0199/0123.Best Time to Buy and Sell Stock III/Solution.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int f1 = -prices[0], f2 = 0, f3 = -prices[0], f4 = 0;
for (int i = 1; i < prices.size(); ++i) {
f1 = max(f1, -prices[i]);
f2 = max(f2, f1 + prices[i]);
f3 = max(f3, f2 - prices[i]);
f4 = max... | ALGO | 0.999967 | 5.765332 |
a99498e1-7661-483c-9ff1-30fdea81b351 | Coder-X15/codeforces | jan27_2025/petya_and_strings.cpp | # include <iostream>
using namespace std;
int main(){
string a, b;
cin >> a;
cin >> b;
int n_a = 0;
int n_b = 0;
for(int i = 0 ; i < a.length() ; i++){
if(isupper(a[i])){
n_a = a[i] - 'A';
} else {
n_a = a[i] - 'a';
}
if(isupper(b[i])){
... | ALGO | 0.999996 | 3.949763 |
3609afd7-6d20-44fd-ae98-ec944581d883 | scanno/android_frameworks_av_shuttle | media/libstagefright/codecs/amrnb/common/src/residu.cpp | /*
Pathname: ./audio/gsm-amr/c/src/residu.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template. First attempt at
optimizing code.
Description: Deleted stores listed in the Local Stores Needed/Modified... | ALGO | 0.999938 | 4.224214 |
a31429d6-96ba-4784-a571-7b33f34356e7 | Vladikolev0321/TUES-School-11th-grade | MathFundamnetalsOfProgramming/Project2/№7_Kolev_Vladislav.cpp | #include <iostream>
#include <string>
#include <list>
#include <fstream>
#include <sstream>
#include <math.h>
#include <vector>
using namespace std;
class Point
{
public:
double x;
double y;
Point(){};
Point(double x, double y)
{
this->x = x;
this->y = y;
}
};
///To add Ball class
class Table
{
int count_po... | ALGO | 0.996002 | 3.681593 |
5fb06f2c-e9de-4a7f-88b3-5208286b0357 | mohamedaminebennacef/Problem-Solving | contest/leetcode/weekly/454/Q1/Q1.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define em emplace_back
#define mp make_pair
#define sz(a) (int)(a.size())
string generateTag(string s)
{
vector<string> v;
string word = "#";
word += tolower(s[0]);
fo... | ALGO | 0.99831 | 3.882154 |
c70705a2-2b90-420f-b7ae-befaa661ea29 | cebastian707/Leetcode-997-Squares-of-a-Sorted-Array | Squares of a Sorted Array/main.cpp | /*BY::Cebastian Santiago
* Leetcode 997
*/
#include<iostream>
#include<vector>
#include<algorithm>
std::vector<int> sortedSquares(std::vector<int>& nums) {
//variables
std::vector<int> temp;
int count = 0;
//loop through the vector and times it by itself
for (auto i : nums){
count = i * i;
temp.push_back(co... | ALGO | 0.999673 | 5.601755 |
382b2d0e-060b-44ee-9af8-12f3c23623d3 | simonmikkelsen/the-errors-tour-of-code | cpp/fft/fft_14.cpp | /*
* Welcome to this delightful program that performs a Fast Fourier Transform (FFT)!
* This program is designed to bring joy and learning to all who read it.
* It is filled with whimsical variable names and functions that will make you smile.
* Enjoy the journey through this colorful code!
*/
#include <stdio.h>
... | ALGO | 0.999956 | 6.107683 |
80c91a91-64c5-4b2b-82ba-987443b22d2a | Chirag001001/Data-Structure-and-Algorithm | Recursion/Staircase/Staircase.cpp | int staircase(int n){
if(n==0){
return 1;
}
//stauircase(0)+1
if(n==1){
return 1;
}
//staircase(1)+staircase(0)
if(n==2){
return 2;
}
// if n=3 (staircase(2)+staircase(1)+staircase(0)) //4 1 1 1 1 2 2 1 3
// if n=4 (stair... | ALGO | 0.999783 | 3.697444 |
1c0bda05-c51b-4bf0-a2b9-9f0178879b46 | himanshunita009/DSA | Recursion/Generate Parentheses.cpp | void solve(int o,int c,string str,vector<string> & ans){
if(o == 0 && c ==0){
ans.push_back(str);
return;
}else {
if(o == c)
solve(o-1,c,str+"(",ans);
else if(o < c){
if(o > 0)
solve(o-1,c,str+"(",ans);
if(c > 0)
... | ALGO | 0.999885 | 5.014511 |
20d53990-9d3d-4879-864f-eb0e609b567b | fmi-lab/up-kn-2019-group-4 | Practicum/Week03 (17.10)/Solutions/Task03.cpp | #include <iostream>
using namespace std;
int main() {
string weekdays[7] = {"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"};
int number;
cout << "Enter number: ";
cin >> number;
cout << "Days is: " << weekdays[number] << endl;
if (number > 4)
{
cout... | TOOL | 0.995646 | 3.983573 |
60e2961a-5ec9-498c-a8e4-4938079798c8 | CedricKuang/LeetCode | others/count_bits.cpp | #include <iostream>
using namespace std;
int count_bits(int x)
{
int ans = 0;
while (x > 0)
{
ans += (x % 2);
x /= 2;
}
return ans;
}
int main()
{
cout << count_bits(18) << endl;
return 0;
} | ALGO | 0.999407 | 5.379391 |
83514518-4a10-4b01-9864-ff7f083fdcff | Tinosaboteur/ctdlonline | SXchonTT.cpp | #include <stdio.h>
void sapxep(int a[], int n)
{
for (int i = 0; i < n - 1; i++)
{
int min = i;
for (int j = i + 1; j < n; j++)
if (a[min]>a[j]){
int t = a[min];
a[min] = a[j];
a[j] = t;
}
}
}
void xuatmang(int a[],int n)
{
for (int i = 0; i < n;... | ALGO | 0.999957 | 4.074726 |
5e973c46-9439-4a34-a26b-ca65b436821a | yudainakazaki/leetcode | 20/1.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
class Solution {
public:
bool isValid(string s) {
stack<char> stk;
for (char &c : s) {
switch (c) {
case '(':
case '[':
case '{':
stk.push(c);... | ALGO | 0.999589 | 5.674959 |
adbbb789-ee68-43b5-b35e-8f7b426d7524 | bigjr-mkkong/algo_template | dij.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn = 100010;
struct edge {
int to, val;
edge(int to_, int val_) {
to = to_;
val = val_;
}
};
struct node
{
int dis;
int pos;
bool operator <(const node &x)const
{
return x.dis < dis;
}
};
vector<edge> gpe[maxn];
int dis[maxn], ans[maxn], rut[maxn]; ... | ALGO | 0.999968 | 3.537523 |
c1b332d1-a7f4-4e53-95d3-1337cd0cf9ac | AnasJadoon31/DSA-in-CPP | modules/student.cpp | /// This checks that how many students have a total score higher than the first student.
#include <iostream>
#include "student.h"
using namespace std;
class Student
{
private:
int scores[5] = {};
public:
void input()
{
for (int & score : scores) // range-based loops require '&' to modify the ori... | ALGO | 0.999173 | 5.243359 |
eecdb9f8-dcad-4a9d-b39b-3179b8ecfd15 | FranciscoThiesen/OldProblems | Codeforces/round358/c.cpp | #include <cmath>
#include <climits>
#include <queue>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream> // istringstream buffer(myString);
#include <stack>
#include <algorithm>
#include <cstring>
#include <cassert>
#in... | ALGO | 0.999661 | 4.034864 |
228ec593-019c-43ed-bcd0-99aaa65d499b | anurag-garg01/LeetcodeSolutions | 0198-house-robber/0198-house-robber.cpp | class Solution {
public:
int func(vector<int> nums, int ind,vector<int> &dp) {
// base case
if (ind == 0) {
return nums[ind];
}
if (ind < 0) {
return 0;
}
// take and not take
// not_take
if(dp[ind]!=-1){
return... | ALGO | 0.999968 | 5.802044 |
b2fde446-f94d-4c13-b8b0-ccb904193ab5 | tunak7up/c-program | 1 so tip/buoi 5 vong lap while/bai 17.cpp | #include <stdio.h>
#include <math.h>
int main() {
long long n; scanf("%lld", &n);
int chan = 0;
int le = 0;
if(n == 0){
printf("NO");
}
else{
while(0 < n && n <= pow(10, 18)){
int cs = n % 10;
if(cs % 2 == 0){
chan++;
}
else{
le++;
}
n /= 10;
}
if(chan == le){
printf("YES");
}
els... | ALGO | 0.999936 | 3.615403 |
69943fe9-97d6-43f2-a593-595052459f11 | baheti07/C- | binomialcoeff.cpp | #include<iostream>
using namespace std;
int binomialcoeff(int r,int k)
{
int res=1;
if(k>r-k)
k=r-k;
for(int i=0;i<k;i++)
{
res*=(r-i);
res/=(i+1);
}
return res;
}
int main()
{
int r=4,k=2;
cout<<binomialcoeff(r,k);
return 0;
} | ALGO | 0.999844 | 4.927588 |
80f8737e-d153-42bb-bdb6-dfb9016a5b38 | HPC-AI-Team/lammps-fugaku-threadpool-sc23 | src/KOKKOS/fix_rx_kokkos.cpp | // clang-format off
#include "fix_rx_kokkos.h"
#include "atom_kokkos.h"
#include "atom_masks.h"
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "fix_property_atom.h"
#include "force.h"
#include "kokkos.h"
#include "math_special_kokkos.h"
#include "memory_kokkos.h"
#include "modify.h"
#include "neigh... | ALGO | 0.999333 | 6.596202 |
0c63b384-fe87-4f38-b178-3b196379c9b4 | jztlucky6264/Cpp_basic-to-advanced | array/reverse.cpp | #include <iostream>
using namespace std;
void reverse(int arr[] , int n){
int start=0;
int end=n-1;
while(start<=end)
{
swap(arr[start],arr[end]);
start++;
end--;
}
}
void printarray(int arr[] , int n){
for (int i = 0; i < n; i++)
{
cout<<arr[i]<<" ";
}
cout<<e... | ALGO | 0.99779 | 4.833675 |
40ffc3b0-2fee-4084-a511-00eb040fb80f | RiteshSharmaop/Java | CodeChef/Date_16_05_22/PARTY2.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t!=0){
int n,x,k;
cin>>n>>x>>k;
if(n*x<=k)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
t--;
}
return 0;
}
| ALGO | 0.999299 | 3.579608 |
3e97860d-6dab-4add-8bca-3b27dd612be0 | ViniciusHenriqueB/Cplusplus | estudos/08-Estruturas_Condicionais/1-if_else.cpp | #include <iostream>
using namespace std;
int main() {
/*
Operadores de comparação em C++ (SÃO OS MESMOS DE PYTHON):
== != > >= < <=
*/
// if:
int num1 = 10;
int num2 = 20;
if (num1 > num2) {
cout << "num1 eh maior do que num2\n\n"; // não vai exibir nada... | TOOL | 0.915542 | 3.261759 |
f466b88a-3f05-427f-938b-99acbddafa43 | spcl/DNN-cpp-proxies | proxies/dlrm.cpp | /*********************************************************************
*
* Description: DLRM
* python -m torch.distributed.launch --nproc_per_node=4 dlrm_s_pytorch.py
* --arch-embedding-size="80000-80000-80000-80000" --arch-sparse-feature-size=128
* --arch-mlp-bot="128-128-128-128" --arch-mlp-top="512-512-512... | DATA | 0.88796 | 4.548947 |
968988f6-ec77-4bb3-b069-9c18ae0c1a53 | ishandutta2007/codeforces | moransky/normal/1326/D2.cpp | // Skyqwq
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
template <typename T> bool chkMax(T &x, T y) { return y > x ? x = y, 1 : 0; }
template <typename T> bool chkMin(T &x, T y) { if (y < ... | ALGO | 0.999986 | 3.772905 |
2c7ae18f-63ba-4c5f-901d-8a4789ee563b | powerLEO101/Work | Code/LOJ/LOJ10153/code.cpp | /**************************
* Writer : Leo101
* Problem : LOJ #10153. 「一本通 5.2 例 1」二叉苹果树
* Tags : Tree Dp
**************************/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define File(s) freopen(#s".in", "r", stdin); freopen(#s".out", "w", stdout)
#define gi get_int()
#def... | ALGO | 0.999847 | 3.785065 |
7fd1f88d-54d5-4bf4-bd17-8528a7579a64 | borispopoff/caelus-cml-unofficial | src/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy_app.cpp | #include "calc.hpp"
#include "fvc.hpp"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void CML::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{
bool writeResults = !args.optionFound("noWrite");
IOobject Uheader
(
"U",
runTime.timeName(... | ALGO | 0.978878 | 5.406013 |
6014c00f-d4d6-4917-9b68-cb19a943afc6 | kartikdev1211/DSA | Binary Tree/height.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* left;
Node*right;
Node(int d){
this->data=d;
this->left=NULL;
this->right=NULL;
}
};
class Solution{
public:
int height(Node*node){
if(node==NULL){
return 0;
... | ALGO | 0.999726 | 4.946499 |
1c4df7a9-c78a-4905-93a3-e218822524db | sinian666/code_86_6 | cpp_副本/chapter_graph/graph_adjacency_matrix.cpp | /**
* File: graph_adjacency_matrix.cpp
* Created Time: 2023-02-09
* Author: what-is-me (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 基于邻接矩阵实现的无向图类 */
class GraphAdjMat {
vector<int> vertices; // 顶点列表,元素代表“顶点值”,索引代表“顶点索引”
vector<vector<int>> adjMat; // 邻接矩阵,行列索引对应“顶点索引”
public:
/* 构造方法 */
... | ALGO | 0.999394 | 6.276136 |
486edd43-42df-4e74-833b-79ab9dfd0250 | QW1k0YA/HIT-Data-Structures-and-Algorithms | 2022111568-郑乔译-实验2/comprerate.cpp | //
// Created by User on 2024-04-11.
//
#include "def.h"
#include "fstream"
using namespace std;
double comprerate(const string& filename1,const string& filename2)
{
/*
int i = 0;
while( (1 << i) < num)
{
i++;
}
cout << i << endl;
//最少用i位二进制编码能进行区分
*/
int simplecode = 0;
... | ALGO | 0.920422 | 3.455791 |
593a7357-e358-436d-b510-6cb32802bd8e | shoaib842/6companies30dayschallenge | Maximum Length of Repeated Subarray/main.cpp | class Solution {
public:
int findLength(vector<int>& nums1, vector<int>& nums2) {
int m = nums1.size();
int n = nums2.size();
int ans = 0;
// dp[i][j] := the maximum length of a subarray that appears in both
// nums1[i..m) and nums2[j..n)
vector<vector<int>> dp(m + 1,... | ALGO | 0.999942 | 5.973491 |
b2463f4c-a8d2-4dee-91fe-55013ad1ec55 | wangdingqiao/programmer-evolution-plan | language/c++/templates/template-queue-4.cpp | #include <iostream>
#include <algorithm>
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
#include <assert.h> /* assert */
#include <string>
template<class T> class DoubleQueue; // 类模板的前向声明
template<class T> class DoubleLinkListNode;
// 方法模板的前向声明
template<typename T> std::ostream& opera... | TEST | 0.895205 | 4.935925 |
4b2e1c7d-59bf-4062-8c9e-25d24b42ad4b | Katsudon10/Competitive-programming | Atcoder/ABC/ABC156/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
const int inf = INT_MAX;
using ll = long long;
//fixed << setprecision(5)
int main(){
int n;
cin >> n;
vector<int>x(n);
rep(i,n) cin >> x[i];
int ans=inf;
sort(x.begin(),x.end());
for(int i=1;i<=x[n-1];i++){... | ALGO | 0.99989 | 3.683963 |
7b68714d-dde9-4b5f-a1d9-508cba976d11 | OoRyseoO/StarGateEmu | dep/g3dlite/source/MeshAlg.cpp | #include "G3D/MeshAlg.h"
#include "G3D/Table.h"
#include "G3D/Set.h"
#include "G3D/Box.h"
#include "G3D/Sphere.h"
#include "G3D/vectorMath.h"
#include "G3D/AABox.h"
#include "G3D/Image1.h"
#include <climits>
namespace G3D {
const int MeshAlg::Face::NONE = INT_MIN;
void MeshAlg::generateGrid(
Array<V... | ALGO | 0.998918 | 7.262485 |
f8ca1377-a111-40f0-b018-acc19caaa385 | devanshikapla/Graph | Shortest path to get all keys.cpp | class Solution {
public:
vector<vector<int>> directions{{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int shortestPathAllKeys(vector<string>& grid) {
int m = grid.size();
int n = grid[0].size();
queue<vector<int>> q; //{x, y, steps, current_key_status_decimal}
int count =... | ALGO | 0.999723 | 5.903814 |
3b539088-bc66-411c-83f0-0246ccf8aa1e | SaqlainAveiro/Competitive-Programming-Solves | LightOj/1001 - Opposite task.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
lli i,j,k,l,m,n,t,a,b,c,d,x,y,p,q,sum=0,total=0;
#define read(in) freopen("Input.txt","r",stdin)
#define write(out) freopen("Ouput.txt","w",stdout)
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(0);
//read(in);
cin>... | ALGO | 0.999866 | 4.364078 |
355461ed-c22d-43bd-a39a-b11f2fd53f1d | Saurabhn16/CP-dsa | DAA LAB/daa/DAA LAB/final-lab/classproblems/kmp.cpp | #include <bits/stdc++.h>
void computeLPSArray(char* pat, int M, int* lps);
// Prints occurrences of txt[] in pat[]
void KMPSearch(char* pat, char* txt)
{
int M = strlen(pat);
int N = strlen(txt);
// create lps[] that will hold the longest prefix suffix
// values for pattern
int lps[M];
// Preprocess the patte... | ALGO | 0.999962 | 6.25831 |
fe415b96-844a-4c8b-9f18-cb11449052a4 | RahulRajGiri15/Competitive-Programming | GFG/Linked List/DoublyLinkedList.cpp | ///////Introduction to Doubly LinkedList
#include <bits/stdc++.h>
using namespace std;
#include<iostream>
class Node {
public:
int data;
Node* next;
Node* prev;
public:
Node(int data1, Node* next1, Node* prev1){
data = data1;
next = next1;
prev = prev1;
}
public:... | ALGO | 0.999822 | 4.916963 |
68236759-42ed-4954-87a5-d914edcb6e0e | freezer-glp/leetcode-submit | src/Palindrome Number.cpp | //Palindrome Number
/*Determine whether an integer is a palindrome. Do this without extra space.*/
class Solution {
public:
bool isPalindrome(int x) {
if(x < 0)
return false;
else{
int a1=x,a2=0;
while(a1 != 0){
a2 = a2 * 10 + a1 %10;
a1 = a1 /10;
}
if(a2 == x)
return true;
}
... | ALGO | 0.999345 | 5.078775 |
b17394bd-7031-4d52-b8f5-461d2637d167 | ishandutta2007/codeforces | hitman623/normal/1074/B.cpp | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define all(a) (a).begin(),(a).end()
#define x first
#d... | ALGO | 0.999975 | 4.019475 |
14208a75-d3dc-482a-8039-294d831b1b69 | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J00694/sticks/sticks.cpp | #include<iostream>
using namespace std;
int n0,n;
int t;
bool flag=true;
int num[11];
int main(){
freopen("sticks.in","r",stdin);
freopen("sticks.out","w",stdout);
cin>>t;
num[0]=6;
num[1]=2;
num[2]=5;
num[3]=5;
num[4]=4;
num[5]=5;
num[6]=6;
num[7]=3;
num[8]=7;
num[9]=6;
for(int c=1;c<=t;c++){
cin>>n0;
n=n0;
... | ALGO | 0.999617 | 3.444944 |
3364b814-4796-49cd-9207-1ed6ee2d0dee | mjww3/codeforces | evenodds.cpp | #include <stdio.h>
#include <iostream>
#include <list>
#include <vector>
using namespace std;
int main()
{
long long int n,k;
cin>>n>>k;
vector<long long int> arr1;
arr1.push_back(1);
vector<long long int> arr2;
arr2.push_back(2);
int sum=3;
while(sum<=n)
{
if(sum%2!=0)
{
arr1.push_back(sum);
}
e... | ALGO | 0.999974 | 3.210634 |
1e76788e-6b0f-46d3-88e1-30819774f7ee | selfboot/LeetCode | DynamicProgramming/309_BestTimeBuySellStockWithCooldown.cpp | /*
* @Author: <EMAIL>
* @Last Modified time: 2016-08-23 15:09:48
*/
class Solution {
public:
/* Dynamic Programming.
A very good explanation come with thinking process is here:
https://leetcode.com/discuss/71354/share-my-thinking-process
States definition:
buy[i]: The maxProfit for any sequ... | ALGO | 0.999953 | 6.037251 |
dff068ad-fbed-400a-b022-109db91d8d40 | vikrant0/c-cpp | os/lab5/lab5_2.cpp | #include <iostream>
#include <fcntl.h>
#include <sys/stat.h>
#include <semaphore.h>
#include <fstream>
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
using namespace std;
#define ERROR_CREATE_THREAD -1
#define ERROR_JOIN_THREAD -2
sem_t * sem= new sem_t;
ofstream file;
void *func(void... | TOOL | 0.930368 | 3.16638 |
ecfa1e9d-bc05-4bf3-af8d-c2fbd50dda91 | pjump3226/baekjoon | Q15652.cpp | #include <iostream>
#include <vector>
using namespace std;
int n, m;
vector<int> v;
void dfs(int num, int cnt) {
if (cnt == m) {
for (int i = 0; i < v.size(); i++) {
cout << v[i] << " ";
}
cout << '\n';
return;
}
for (int i = num; i <= n; i++) {
v.push_back(i);
dfs(i, cnt + 1);
v.pop_back();
}
}
... | ALGO | 0.999953 | 4.571763 |
3d306789-d2a8-45fc-8064-1f00dec31ebb | jyqiu1216/Rino | sdk/boost_1_62_0/libs/spirit/example/qi/compiler_tutorial/calc8/vm.cpp | #include "vm.hpp"
#include <boost/assert.hpp>
#if defined(_MSC_VER)
# pragma warning(disable: 4800) // forcing value to bool 'true' or 'false'
// (performance warning)
#endif
namespace client
{
int vmachine::execute(
std::vector<int> const& code
, std::vector<int>::co... | TOOL | 0.871186 | 5.679599 |
07346eee-dbc4-43bd-9295-58840effe3fc | shirsho-roy/DSA | DynamicP/countSortedVowelStrings.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int vwel(int n,int i, vector<vector<int>> &dp){
//the moment is n reduce to 0 we et the required set and we can count 1
if(n==0) return 1;
if(i>=5) return 0;//No further vowels
int pick,notpick;
i... | ALGO | 0.999932 | 5.412815 |
a61fb342-c637-443d-98c4-bc100ecb8e74 | nhannttdevvn/LapTrinhC | LapTrinhC++/DE0X1211_NguyenThiThanhNhan_Bai1.cpp | #include <iostream>
using namespace std;
bool ktnt(int n)
{
for (int i = 2; i <= sqrt(n); i++)
{
if (n % i == 0)
{
return false;
}
}
return true;
}
bool ktcp(int n)
{
for (int i = 2; i < sqrt(n); i++)
{
if (sqrt(n) == round(sqrt(n)))
return true;
}
return false;
}
int main()
... | ALGO | 0.999172 | 3.270564 |
00595c3a-2fba-4aea-9576-d25e77a49ab3 | access-softek/llvm-project | lldb/test/API/python_api/thread/main2.cpp | #include <stdio.h>
#include <stdlib.h>
int a(int);
int b(int);
int c(int);
int a(int val)
{
if (val <= 1)
return b(val);
else if (val >= 3)
return c(val);
return val;
}
int b(int val)
{
int rc = c(val);
void *ptr = malloc(1024); // thread step-out of malloc into function b.
i... | TOOL | 0.975292 | 3.954445 |
44931ea7-ebe6-45ea-82b3-5ef05340db83 | moonstruck2003/Problem-Solving-Codeforces | dasd.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
string s;
cin>>s;
set<char>d;
for(int i=0;i<n;i++){
d.insert(toupper(s[i]));
}
if(d.size()==26) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
} | ALGO | 0.999979 | 4.015304 |
43e9f0c0-f3de-4950-acba-cf8ff3a79993 | Priyesh3105/cpp-Programming | stack/stack_05_postfic.cpp | #include<iostream>
#include<stack>
#include<math.h>
using namespace std;
int postfixEval(string s){
stack<int> st;
for(int i=0; i<s.length(); i++){
if(s[i]>='0' && s[i]<='9'){
st.push(s[i]-'0');
}
else{
int op2 = st.top();
st.pop();
... | ALGO | 0.999849 | 4.795006 |
3c01c623-3793-4e1c-8336-3705730a6f83 | sumonmd/Data-Structure- | BST.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node* left;
Node* right;
};
Node* Root =NULL;
void insert(int value)
{
Node* nptr = new Node;
nptr->data = value;
nptr->left = NULL;
nptr->right = NULL;
if(Root==NULL){
Root = nptr;
}
else{
Node... | ALGO | 0.99986 | 4.682987 |
317421ea-6863-46b1-bd1b-b1d6849678b8 | AntennaeVY/CP | CodeForces/1300/Lose It!.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for(auto &ai : a) cin >> ai;
map<int, vector<int>> m;
for(int i=0; i < n; i++) {
m[a[i]].push_back(i);
}
int ans = 0;
while(true) {
if (m[4].empty())
break;
int prev = m[4].back();
bool empty = ... | ALGO | 0.999263 | 3.788848 |
9d1ac434-18b7-41f4-865d-a8c2c7670fc9 | chenxiaohui/leetcode | lintcode/MaximumSubarrayDifference.cpp | /*
Given an array with integers.Find two non-overlapping subarrays A and B, which |SUM(A) - SUM(B)| is the largest.Return the largest difference.
Note
The subarray should contain at least one number
Example
For [1, 2, -3, 1], return 6
Challenge
O(n) time and O(n) space.
*/
#include "common.h"
class Solution {
pub... | ALGO | 0.999312 | 6.214256 |
dcec6afd-9be8-4e47-961f-dc19af98eb76 | HJ-Zhao/Leetcode | 128longestConsecutive.cpp | #include <vector>
#include <unordered_set>
using namespace std;
class Solution {
public:
int longestConsecutive(vector<int>& nums) {
unordered_set<int> nums_set;
for (auto num : nums) {
nums_set.insert(num);
}
int ans = 0;
for (int num : nums_set) {
... | ALGO | 0.999873 | 5.585152 |
10b1f34a-48c8-40fc-8863-512d2a1e998e | sahilkhan03/CF-Solutions | codeforces/276/D.cpp | /*
Author : DemonStar
*/
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define ordered_set tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,... | ALGO | 0.999924 | 4.150356 |
c7abde3a-50cc-423a-8c28-946294d075fb | ishandutta2007/codeforces | egor.lifar/normal/421/B.cpp | #include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
int n;
string s;
int main() {
cin >> s;
int n = s.size();
for (int i = 0; i < n / 2; i++) {
if (s[i] != s[n - i - 1]) {
... | ALGO | 0.999815 | 4.014924 |
b4569faf-5837-4906-8cd3-b66753f1d1a7 | raincross7/code-similarity | codes/train_code/problem029/problem029_415.cpp | #include <iostream>
using namespace std;
int mat[100][100];
int main(){
int n;
cin >> n;
for(int i=0;i<n;++i){
int u,k;
cin >> u >> k;
for(int j=0;j<k;++j){
int v;
cin >> v;
mat[u-1][v-1] = 1;
}
}
for(int i=0;i<n;++i){
for(int j=0;j<n;++j){
cout << mat[i][j];
... | ALGO | 0.999656 | 3.06109 |
c71efb8e-e816-4c18-9359-280ab7291225 | FDA12345/smart_home | sdk/boost_1_73_0/libs/phoenix/example/find_if.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
int
main()
{
using boost::phoenix::arg_names::arg1;
int init[] = { 2, 10, 4, 5, 1, 6, 8, 3, 9, 7 };
std::vector<int> c(init, init + 10);
typedef std::vector<int>::iterator... | ALGO | 0.975624 | 5.04283 |
90151e9e-14d8-4bee-a212-87cc1966b996 | akshita2703/TREE | Question/02_DiameterOfbinaryTree.cpp | //https://leetcode.com/problems/diameter-of-binary-tree/description/
// diameter of tree - longest path between two nodes
// - path does not need to pass via root
#include <bits/stdc++.h>
#include <vector>
using namespace std;
/**
* Definition for a binary tree node.
*/
struct TreeNode {
int ... | ALGO | 0.999898 | 7.022081 |
3aed0668-c570-4725-ba6d-d0ab3e80054d | shin5774/BaekjoonPractice | 2164.cpp | #include <deque>
#include <iostream>
using namespace std;
int main() {
int n;
deque<int> dq;
cin >> n;
for (int i = 1; i <= n; i++) {
dq.push_back(i);
}
while (dq.size() != 1) {
dq.pop_front();
dq.push_back(dq.front());
dq.pop_front();
}
cout << dq.fr... | ALGO | 0.999902 | 4.416875 |
3c814952-03d6-4bb1-ab0a-4fbf073ca088 | ishandutta2007/codeforces | djqtxdy/normal/316/E3.cpp | /*
9999G99X999999999999999X9X999X9X9X9X9X9X999X9X9X99999999G9GX99G9GG9S9M9SS9SHG9G9GGGG999999G99X9X9999999X99999X99999X999X9X999X9X99999999999X999X999X99
9XX9X9XXX9XXSXSXSSSXSXSXSXSXSSHSHXSXSXXXSXSXSXX9SXX99X522sssrsrrrsr:isirrrrH9SX9XHsss25S2X59SX99999XXXX9XXX9X9S9SXSXSXSSSXSXS9XXSXSXSXX9SXXXSXSXSXSXSS
9X99999X999X9X9... | ALGO | 0.999769 | 3.006656 |
150407e6-d51f-4a33-84b2-d20f0fde6424 | ishandutta2007/codeforces | tonyjjw/normal/461/C.cpp | //*
#include<stdio.h>
//#pragma warning(disable:4996)
#define TN 131072
int N,Q,rev=0;
int T[2*TN];
void add(int n,int v){
for(n+=TN;n>0;n>>=1){
T[n]+=v;
}
}
int sum(int l,int r){
int v=0;
for(l+=TN,r+=TN;l<=r;l>>=1,r>>=1){
if(l&1){
v+=T[l++];
}
if(!(r&1)){
v+=T[r--];
}
}
return v;
}
int main(... | ALGO | 0.999278 | 3.22996 |
baaa9629-8667-49bd-9e69-617827c411b6 | tesla-android/android-frameworks-av | media/codecs/amrnb/dec/src/preemph.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/preemph.c
Functions:
Date: 02/04/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Removed the functions preemphasis_init and pre... | ALGO | 0.99899 | 6.637343 |
e7998116-477e-4153-8583-e17d70810e86 | toshiki19/atcoder | atcoder/2025_05_17/b.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<long long> A(N);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
long double log_display = 0;
long long display = 1;
for (int i = 0; i < N; ++i) {
lo... | ALGO | 0.999988 | 4.74268 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.