text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { long int sum, i, j, k, n; char str[200002]; scanf( %ld , &n); scanf( %s , &str[0]); for (i = 0; i < n; i++) { if (str[i] == 0 ) { j++; } else k++; } if (j > k) j = k; sum = n - 2 * j; printf( ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T bigmod(T p, T e, T M) { long long int ret = 1; for (; e > 0; e >>= 1) { if (e & 1) ret = (ret * p) % M; p = (p * p) % M; } return (T)ret; } template <class T> inline T gcd(T a, T b) { if (b == 0) return... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; vector<int> ans[N]; int a[N], b[N], c[N]; int n, k, p; int main() { scanf( %d%d%d , &n, &k, &p); int s = 0; int _x = 0, _y = 0; for (int i = 0; i < n; ++i) { scanf( %d , &a[i]); s += a[i]; if (a[i] & 1) ... |
#include <bits/stdc++.h> const unsigned long long mod = 1e9 + 7; using namespace std; const int N = 1e3 + 5; const double esp = 1e-5; int n, x, pos, lsum = -1, rsum; unsigned long long f[N], a[N]; unsigned long long qpow(unsigned long long a, unsigned long long b) { unsigned long long ans = 1, base = ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int r, g, b, w; cin >> r >> g >> b >> w; int evens = (r % 2 == 0) + (g % 2 == 0) + (b % 2 == 0) + (w % 2 == 0); int odds = (r % 2 == 1) + (g % 2 == 1) + (b % 2 == 1) + (w % 2 == 1); if... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
`define ADDER_WIDTH 128
`define DUMMY_WIDTH 128
`define 2_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000 + 10; vector<int> v[maxn]; int dp[maxn]; int a[10][maxn]; int main() { int n, K; cin >> n >> K; for (int i = 0; i < K; i++) { for (int j = 0; j < n; j++) scanf( %d , &a[i][j]), v[a[i][j]].push_back(j); } memset(dp,... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2007 by Peter Debacker.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg [10:0] in;
reg signed[7:0] min;
reg signed[7... |
#include <bits/stdc++.h> using namespace std; void solve() { int n, m; cin >> n; cout << (((1ll << (n / 2)) - 1) * 2) << n ; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; int t = 1; cin >> t; while (t--) solve(); return 0; } |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
//------------------------------------------------------------------------------
// SHARED CODE
//------------------------------------------------------------------------------
`ifdef OVL_SHARED_CODE... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/*****************************************************************************
* File : processing_system7_bfm_v2_0_sparse_mem.v
*
* Date : 2012-11
*
* Description : Sparse Memory Model
*
*****************************************************************************/
/*** WA for CR # 695818 ***/
`ifdef XILINX_SI... |
#include <bits/stdc++.h> using namespace std; void input(vector<long long>& v, long n) { for (long long i = 0; i < n; i++) { long long in; cin >> in; v.push_back(in); } } void output(vector<long long> v) { for (long long i = 0; i < v.size(); i++) cout << v[i] << ; } long lon... |
// -- (c) Copyright 2009 - 2011 Xilinx, Inc. All rights reserved.
// --
// -- This file contains confidential and proprietary information
// -- of Xilinx, Inc. and is protected under U.S. and
// -- international copyright and other intellectual property
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
#include <bits/stdc++.h> using namespace std; int a[30], col[100100] = {}; int main() { string s; cin >> s; for (int i = 0; i < 26; i++) a[i] = -1; for (int i = 0; i < s.size(); i++) a[s[i] - a ] = i; int p = 25; for (int i = 0;;) { while (p >= 0 && a[p] < i) p--; if (p < 0) b... |
// Copyright (C) 2017-2020 The Project X-Ray Authors.
//
// Use of this source code is governed by a ISC-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/ISC
//
// SPDX-License-Identifier: ISC
module idelay_histogram #
(
parameter UART_PRESCALER = 868 // UART prescaler... |
///////////////////////////////////////////////////////////////////////////////
// Project: Aurora 64B/66B
// Company: Xilinx
//
//
// (c) Copyright 2012 - 2013 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S.... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
... |
#include <bits/stdc++.h> using namespace std; const int N = 2e3 + 5; int n, deg[N], a[N]; bool ed[N][N]; void change(int u) { for (int v = 0; v < n; v++) { deg[u] -= ed[u][v], deg[u] += ed[u][v] ^= true; deg[v] -= ed[v][u], deg[v] += ed[v][u] ^= true; } } bool check() { copy(deg, d... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// deser12.v
`timescale 1ns / 1ps
module deser160_serpar_delay
(
input clk,
input sync,
input reset,
input [2:0]delay,
input in,
output out
);
reg [7:0]shift;
always @(posedge clk or posedge reset)
begin
if (reset) shift <= 0;
else if (sync) shift <= { shift[6:0], in };
end
as... |
module IDDR (/*AUTOARG*/
// Outputs
Q1, Q2,
// Inputs
C, CE, D, R, S
);
//Default parameters
parameter DDR_CLK_EDGE = "OPPOSITE_EDGE";
parameter INIT_Q1 = 1'b0;
parameter INIT_Q2 = 1'b0;
parameter [0:0] IS_C_INVERTED = 1'b0;
parameter [0:0] IS_D_... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s, f, i; cin >> n >> m >> s >> f; long long t; map<long long, pair<int, int>> h; pair<int, int> R; for (i = 0; i < m; i++) { cin >> t >> R.first >> R.second; h[t] = R; } i = 1; if (s < f) while... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
module m26_rx_ch
(
input wire RST,
input wire CLK_RX,
input wire MKD_RX,
input ... |
#include <bits/stdc++.h> using namespace std; int arr[310], nex[310], T, N; bool can, isRoot[310]; void dfs(int x, int val) { if (T < 0) return; arr[x] += val; if (nex[x] != -1) { T -= arr[x]; dfs(nex[x], arr[x]); } } long long int memo[310][100000 + 100]; long long int solve(i... |
//======================================================================
//
// entropy.v
// ---------
// digital HW based entropy generator.
//
//
// Author: Bernd Paysan, Joachim Strombergson
// Copyright (c) 2014, Bernd Paysan, Secworks Sweden AB
// All rights reserved.
//
// Redistribution and use in source and bi... |
// -- (c) Copyright 2010 - 2011 Xilinx, Inc. All rights reserved.
// --
// -- This file contains confidential and proprietary information
// -- of Xilinx, Inc. and is protected under U.S. and
// -- international copyright and other intellectual property
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); bool getcell(vector<vector<bool>>& b, int i, int j) { if (i >= b.size() || j >= b[0].size() || i < 0 || j < 0) return false; return b[i][j]; } bool isPlus(vector<vector<bool>>& b, int i, int j) { return getcell(b, i + 1, j... |
#include <bits/stdc++.h> using namespace std; const long long maxx = 1e6 + 7; const long long maxn = 5000 + 7; const long long mod = 998244853; const long long maxs = 5 * (1E5) + 7; const long long maxm = 4e5 + 7; const long long maxk = 1008 + 7; const long long maxw = 100 + 7; const long long maxh = ... |
#include <bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define INP(arr,n) for(int a=0;a<n;a++)cin>>arr[a] #define OTP(arr,n) for(int a=0;a<n;a++)cout<<arr[a]<< #define ll long long int #define pb(v,a) v.push_back(a) int main() { IOS;int t = 0;cin... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5; long long read() { long long s = 0; char c = getchar(), lc = + ; while (c < 0 || 9 < c) lc = c, c = getchar(); while ( 0 <= c && c <= 9 ) s = s * 10 + c - 0 , c = getchar(); return lc == - ? -s : s; } void... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; scanf( %lld , &n); if (n == 1 || n == 2) { puts( -1 ); return 0; } if (n & 1) { n -= 1; n /= 2; printf( %lld %lld n , 2 * n * n + 2 * n, 2 * n * n + 2 * n + 1); } else { n /= 2; ... |
/*
* Copyright 2013-2016 Colin Weltin-Wu ()
* UC San Diego Integrated Signal Processing Group
*
* Licensed under GNU General Public License 3.0 or later.
* Some rights reserved. See LICENSE.
*
* spi_top.v
* Top-level module which encompasses the SPI map containing all the
* control registers, and the digital... |
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/glbl.v,v 1.15 2011/08/25 22:54:30 fphillip Exp $
`timescale 1 ps / 1 ps
module glbl ();
parameter ROC_WIDTH = 100000;
parameter TOC_WIDTH = 0;
//-------- STARTUP Globals --------------
wire GSR;
wire GTS;
wire GWE;
wir... |
#include <bits/stdc++.h> using namespace std; const int INF = 987654321; double f[107][107][107]; int main() { ios::sync_with_stdio(false); cout.precision(10); cout << fixed; int R, S, P; cin >> R >> S >> P; memset(f, 0, sizeof(f)); f[R][S][P] = 1.0; for (int r = R; r >= 0; --r) ... |
#include <bits/stdc++.h> using namespace std; bool s[] = {1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0}; int main() { string str; cin >> str; for (int x = 0; x < str.length() / 2; x++) { if (str[x] != str[str.length() - 1 - x]) { cout << NO ... |
#include <bits/stdc++.h> using namespace std; const int A = 26; const int maxn = 5e3 + 5; const long long mod = 1e9 + 7; char s[maxn]; int n; int nxt[maxn][A]; long long fat[maxn], inv[maxn]; long long dp[maxn][maxn]; string t; void fillNxtTable() { t = s; t = $ + t; int last[A]; ... |
#include <bits/stdc++.h> using namespace std; long long t, n, m, cap, lis[200500], high, low; long long f(long long x) { long long res = 0, cnt = 0, buf = 0; for (int i = (0); i <= ((int)(n)-1); i++) if (lis[i] <= x) { if (!cnt) { res += buf; buf = 0; } cn... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:03:37 10/29/2015
// Design Name:
// Module Name: ControllerReadTempI2C
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depend... |
#include <bits/stdc++.h> using namespace std; const int N = 1000005; long long f[N], g[N], a[N], ans; int n, F1, F2, F3, F4, F5, F6, k; inline void upd(long long &x, long long y) { if (x < y) x = y; } inline int calc(int y, int x) { if (x * 9 < y) return -1e9; if (y % 3 == 0) return y / 3; ... |
#include <bits/stdc++.h> using namespace std; const int INF = (int)1e9; const int EPS = 1e-6; const int mod = 1000000007; const long double PI = 3.14159265359; const int dx4[4] = {0, 1, 0, -1}; const int dy4[4] = {-1, 0, 1, 0}; const int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0}; const int dy8[8] = {-1, 0,... |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math ) const int maxn = 1e6 + 50; int seg[2 * maxn], ans[maxn], last_pos[maxn], next_pos[maxn]; int n, m; vector<int> v, get_val, partial_xor; vector<pair<pair<int, int>, int> > ques; void upda... |
/* Labkit project demonstrating SD controller use. */
`timescale 1ns / 1ps
// Be sure to enable SD_CD, SD_RESET, SD_SCK, SD_CMD, and SD_DAT in the
// constraints file.
module labkit(input CLK100MHZ, input SD_CD, output SD_RESET, output SD_SCK, output SD_CMD,
inout [3:0] SD_DAT, output [15:0] LED, input BTNC);
// ... |
#include <bits/stdc++.h> using namespace std; const int Imx = 2147483647; const long long Lbig = 2e18; const int mod = 1e9 + 7; struct fastio { char s[100000]; int it, len; fastio() { it = len = 0; } inline char get() { if (it < len) return s[it++]; it = 0; len = fread(s, 1, ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1005, MAXM = 200005; int n, m, q, f[MAXN][MAXN], head[MAXM], nxt[MAXM], x[MAXM], y[MAXM]; struct Q { int l, r, s, t; } s[MAXM]; bool ans[MAXM]; int main() { scanf( %d%d%d , &n, &m, &q); for (register int i = 1; i <= m; ++i) scanf( ... |
/*
----------------------------------------------------------------------------------
Copyright (c) 2013-2014
Embedded and Network Computing Lab.
Open SSD Project
Hanyang University
All rights reserved.
----------------------------------------------------------------------------------
Redistribution and use ... |
// This file has been automatically generated by goFB and should not be edited by hand
// Compiler written by Hammond Pearce and available at github.com/kiwih/goFB
// Verilog support is EXPERIMENTAL ONLY
// This file represents the Basic Function Block for CanisterCounter
//defines for state names used internally
`de... |
`timescale 1 ns / 1 ps
module rp_adc #
(
)
(
// ADC IC
input [ 14-1: 0] adc_dat_a_i , //!< ADC IC CHA data connection
input [ 14-1: 0] adc_dat_b_i , //!< ADC IC CHB data connection
input adc_clk ,
output [ 2-1: 0] adc_clk_source , // optional ADC clock s... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11.06.2015 12:30:30
// Design Name:
// Module Name: testcase_basic
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
/... |
// `define READ read_good
module top;
reg clk;
reg dout;
reg [7:0] data;
integer lp;
always #10 clk = ~clk; // Build a clock generator.
always @(negedge clk) dout = ~dout; // Build a bit stream.
initial begin
clk = 0;
dout = 0;
@(negedge clk);
for (lp=0; lp<4; lp=lp+1) begin
#0... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; long long int n, m, i, j, k, l, T, u, v, q, t = 0, t1 = 0, te, c = 0; long long int a[1010], b[1010]; long long int gcd(long long int p, long long int q) { if (q == 0) return p; else return gcd(q, p % q); } int main() { std::ios::sync_wit... |
#include <bits/stdc++.h> using namespace std; int slope[150 + 1]; int main(void) { int w, h; scanf( %d%d , &w, &h); for (int i = 0; i < 2; i++) { int ww, hh; scanf( %d%d , &ww, &hh); slope[hh] = ww; } while (h > 0) { w += h; if (slope[h] > 0) w = max(0, w - slope[... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int k = 0, l = 0, i = 0, count = 0, x = -1, y = 0; vector<int> alpha(26, 0); string s; cin >> k >> s; char temp[105][105]; for (i = 0; s[i] != 0 ; i++) { alpha[s[i] - a ] += 1; if ... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual pro... |
#include <bits/stdc++.h> void read(long long &t) { char c; while ((c = getchar()) < 0 || c > 9 ) ; t = c - 0 ; while ((c = getchar()) >= 0 && c <= 9 ) (t *= 10) += c - 0 ; } static const long long N = 100010; long long a[N], cnt[45]; bool is_power(long long t) { return !(t - (t &... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int N = (int)500; const int linf = (int)1e9 + 7; const int mod = (int)1e9 + 7; const int sN = (int)27000; inline void ioi2020() {} using ll = long long; using ld = long double; using ull = unsigned long long; ll n, m, k; ll a[N]; ll dp[(1 << 20... |
#include <bits/stdc++.h> using namespace std; string minEqui(string s) { int n = s.size(); if (n % 2 == 1) return s; else { string s1 = minEqui(s.substr(0, n / 2)), s2 = minEqui(s.substr(n / 2, n / 2)); if (s1 < s2) return s1 + s2; else return s2 + s1... |
/*
* Copyright 2020-2022 F4PGA Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01:00:49 10/12/2013
// Design Name:
// Module Name: FSM_Bola
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
/... |
#include <bits/stdc++.h> using namespace std; void scanint(int &x) { register int c = getchar(); x = 0; int neg = 0; for (; ((c < 48 || c > 57) && c != - ); c = getchar()) ; if (c == - ) { neg = 1; c = getchar(); } for (; c > 47 && c < 58; c = getchar()) { x = (... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 5; unordered_map<bitset<maxn>, int> ma, flag; bitset<maxn> s[35]; int t1, t2; void dfs1(bitset<maxn> z, int cost, int pos) { if (pos > t1 + t2) { if (flag[z] == 0) ma[z] = cost; else ma[z] = min(ma[z], cost)... |
/**
* Copyright 2014 Kevin Townsend
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<pair<long long, long long> > f(n); for (int i = 0; i < n; ++i) cin >> f[i].first >> f[i].second; sort(f.begin(), f.end()); vector<long long> v(n); v[n - 1] = f[n - 1].second; for (int i = n - 2; i >= 0... |
#include <bits/stdc++.h> using namespace std; unordered_map<char, long long> s, p; bool check() { long long any = s[ ? ]; long long sub = 0; for (auto it = p.begin(); it != p.end(); it++) { if (s[it->first] > p[it->first]) return false; else if (s[it->first] < p[it->first]) ... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> constexpr int mod = 1e9 + 7; int main() { using namespace std; ios_base::sync_with_stdio(false), cin.tie(nullptr); int tt; cin >> tt; while (tt--) { int n, k; cin >> n >> k; vector<uint16_t> a(n); for (uint16_t &x : a) cin >> x; sort(a.begin(), a.end(), greater<u... |
/**
# Configurable PID Controller
Implements a low-logic-footprint PID control block, configurable at compile time.
only.
To save on logic, this controller only implements bit shifts for gain constants.
These gain constants, KI, KP, and KD, are set as number of bits to shift
**down** by. They are thus equivalent t... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/*
Distributed under the MIT license.
Copyright (c) 2017 Dave McCoy ()
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 rights to
use, copy, mo... |
#include <bits/stdc++.h> using namespace std; unordered_map<string, vector<string> > m; set<string> q; string SS(char C) { string p = ; p += C; return p; } void dfs(string s, long n) { if (n == 0) { q.insert(s); return; } for (auto i : m[SS(s[0])]) dfs(i + s.substr(1, s... |
`timescale 1ns / 1ps
module ringbuf_t;
// ins
reg clk;
reg rst;
reg [23:0] data_i;
reg we_i;
reg pop_i;
reg [3:0] offset_i;
ringbuf uut(
.clk(clk), .rst(rst),
.data_i(data_i), .we_i(we_i),
.pop_i(pop_i), .offset_i(offset_i));
parameter TCLK = 41.0; // ~40.69ns (24.576Mhz)
initial... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); long long n; cin >> n; long long k1 = 0, k2 = 1023; for (long long i = 0; i < n; i++) { long long k; char c; cin >> c >> k; if (c == | ) {... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14.03.2017 23:31:58
// Design Name:
// Module Name: frequency_analyzer_synch
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependenci... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int main() { int t; cin >> t; while (t--) { long long a, b; cin >> a >> b; int tmp = b + 1; long long len = -1; while (tmp != 0) { tmp /= 10; len++; } long long ans = a *... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <cmath> #include <bitset> #include <vector> #include <unordered_map> using namespace std; const int N = 100007, M = 500007, INF = 0x3f3f3f3f; typedef long long ll; typedef int itn; int n, m, t, x; i... |
//////////////////////////////////////////////////////////////////////////////////
// Company: RMIT University
// Engineer: Matthew Myungha Kim
// ,
//
// Create Date: 16:54:00 06/03/2014
// Design Name: tb_uncle_gates
// Module Name: tb_uncle_gates
// Project Name: Streaming Media on Null Convention Logic... |
/* This file is part of JT12.
JT12 program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
JT12 program is distributed... |
#include <bits/stdc++.h> using namespace std; const long long Maxn = 10000; const long double pi = acos(-1); const long long mod = 1000000007; template <class T> ostream &operator<<(ostream &out, vector<T> &A) { for (auto x : A) out << x << ; return out; } template <class T> ostream &operat... |
module audio_buffer ( rclk, // read from avalon bus
wclk, // write to audio_effects
reset,
audio_ip,
read, //sample_req from audio_codec
audio_out,
audio_irq
);
input rclk,wclk,reset,read;
input [15:0] audio_ip;
output [15:0] audio_out;
output audio_irq;
reg [15:0] buffer1 [0:99];
reg [15... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int n, m; int w; int q; vector<int> adj[5000 + 1]; vector<pair<int, int>> store[5000 + 1]; bool vis[5000 + 1]; int dfs(int g, int r, int a) { for (int i = 1; i <= n; i++) vis[i] = false; queue<pair<int, int>> q; priority_queue<pair<int, int>> pq;... |
#include <bits/stdc++.h> using namespace std; long long a1, a2, b1, b2, c1, c2; struct Point { long long x, y; Point(long long x = 0, long long y = 0) : x(x), y(y) {} }; int exgcd(int a, int b, int& x, int& y) { if (b == 0) { x = 1; y = 0; return a; } int d = exgcd(b, a %... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } template <class T> inline void gn(T &first) { char c, sg = 0; while (c =... |
#include <bits/stdc++.h> using namespace std; void Print() { cout << endl; } template <typename T1, typename... T> void Print(const T1 &t1, const T &...t) { cout << t1 << ; Print(t...); } template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << ( ... |
#include <bits/stdc++.h> using namespace std; bool agm(pair<int, int> a, pair<int, int> b) { if (a.first == b.first) { if (a.second > b.second) return true; else return false; } else if (a.first < b.first) return true; else return false; } void solve(vector<in... |
#include <bits/stdc++.h> using namespace std; int k; string n, m; int a[1001], b[1001], ns, ms; int fs, ss; int lcm(int, int); int gcd(int, int); int main() { cin >> k >> n >> m; ns = n.size(); ms = m.size(); for (int i = 0; i < ns; i++) { a[i] = (n[i] == R ? 0 : (n[i] == P ? 1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.