text
stringlengths
59
71.4k
// Copyright (c) 2012 Ben Reynwar // Released under MIT License (see LICENSE.txt) module dut_qa_contents; reg clk; reg rst_n; reg [`WIDTH-1:0] in_data; reg in_nd; reg [`MWIDTH-1:0] in_m; reg [`MSG_WIDTH-1:0] in_msg; reg ...
/** * 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 under the Creative Commons Public Domain, for // any use, without warranty, 2015 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 `define checkhw(gotv,w,expv) do if (gotv[(w)*32+:$bits(expv)] !== (expv)) begin $write("%%Error: %s:%0d: ...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; const int NN = 1 << 20; int qpow(int a, int b) { int ret = 1; while (b) { if (b & 1) ret = (long long)ret * a % mod; a = (long long)a * a % mod; b >>= 1; } return ret; } namespace NTT { const int g =...
#include <bits/stdc++.h> using namespace std; struct time { int s; int e; }; int main() { int n; cin >> n; int s, e; int minc = INT_MAX, maxc = -1; for (int i = 0; i < n; i++) { cin >> s >> e; if (minc > e) { minc = e; } if (maxc < s) { maxc = ...
#include <bits/stdc++.h> const int inf = 1000000007; const double pi = 2 * acos(0.0); using namespace std; int gcd(int a, int b) { a = abs(a); b = abs(b); while (b) { a = a % b; swap(a, b); } return a; } int main() { map<long long, int> m; long long n, k; scanf( %...
#include <bits/stdc++.h> using namespace std; void precalc(){}; const int N = 3010; int n, m; vector<vector<int>> g; vector<vector<int>> dist; pair<int, int> pre[N][3], post[N][3]; void bfs(int x) { queue<int> q; q.push(x); while (q.size()) { int head = q.front(); q.pop(); ...
/* * 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 MAXN = 5e4 + 5; const int SQRN = 210; const int BSZ = 256; vector<int> g[MAXN]; int v[MAXN], lvl[MAXN], pai[MAXN]; int jump[MAXN], best[MAXN][SQRN]; int trie[BSZ * 20 + 5][2]; int n, q, cnt_trie = 1; void predfs(int cur, int p) { for (auto ...
`default_nettype none `timescale 1ns/1ns module tb_membusif(); wire clk, reset; clock clock(clk, reset); // avalon reg a_write = 0; reg a_read = 0; reg [31:0] a_writedata = 0; reg [1:0] a_address; wire [31:0] a_readdata; wire a_waitrequest; // membus wire b_rq_cyc; wire b_rd_rq; wire b_wr_rq; wire [21...
/** * 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> const int MAX_N = (int)1e5 + 123; const double eps = 1e-6; const int inf = (int)1e9 + 123; using namespace std; int n, k; int mini = inf; string second; int sum[MAX_N]; int main() { cin >> n >> k >> second; for (int i = 0; i < int((second).size()); i++) sum[i] = ...
// When triggered, turn the output to maximum and start fading to black // by teknohog module pwm_fade (clk, trigger, drive); input trigger; input clk; output drive; `define FADE_BITS 27 parameter LEVEL_BITS = 8; // Average block interval in clock cycles is // 2**32 / (clk * 0.5**ll2 * miners) ...
// (c) Copyright 1995-2017 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 license and does not grant ...
//----------------------------------------------------------------------------- // The way that we connect things in low-frequency read mode. In this case // we are generating the unmodulated low frequency carrier. // The A/D samples at that same rate and the result is serialized. // // Jonathan Westhues, April 20...
/** * 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; using ll = long long; const int N = 2e5L + 11, M = N * 2; int a[M], b[M], c[M]; int back[M]; struct SegTree { ll flag[N * 8]; ll val[N * 4]; void push(int x) { val[x] += flag[x]; flag[2 * x] += flag[x]; flag[2 * x + 1] += flag[x]; ...
`include "project_defines.v" module rgb_generator #( parameter X_FRONT_PORCH = 32, parameter X_BACK_PORCH = 32 )( input clk, // 100MHz system clock signal input rst, // reset signal //Generated Signals to Drive Display output ...
#include <bits/stdc++.h> using namespace std; int32_t main() { long long int a, b; cin >> a >> b; if (a == 9 and b == 1) { cout << 9 << << 10; } else if (a == b) { cout << a * 10 << << a * 10 + 1; } else if (b - a == 1) { cout << a * 10 + 9 << << b * 10 << endl; ...
/** * 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...
module umult8(reg_A, reg_B, result); // INPUTS input [0:7] reg_A, reg_B; // OUTPUTS output [0:15] result; // REGISTERS reg [0:15] p8a_0; reg [0:15] p8b_0; reg [0:15] pt; reg [0:15] result; // INTEGERS (contols for loops) integer i; always @ (reg_A or reg_B) begin // reg_B /...
/** * 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...
`timescale 1ns / 1ps module Selector_Casillas( clk, boton_arriba, boton_abajo, boton_izq, boton_der, boton_elige, turno_p1, turno_p2, guarda_c1, guarda_c2, guarda_c3, guarda_c4, guarda_c5, guarda_c6, guarda_c7, guarda_c8, guarda_c9, p1_mm, p2_mm, cuadro ); in...
#include <bits/stdc++.h> using namespace std; ifstream fin( in.in ); ofstream fout( out.out ); const int N = 1e5 + 10; int n, m, erased[N], cnt[N], rem[N]; vector<int> a[N], v[N]; deque<vector<int> > ind[N]; queue<int> q; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; using vb = vector<bool>; using vd = vector<double>; using vs = vector<string>; using pii = pair<int, int>; using pll = pair<ll, ll>;...
// (C) 2001-2019 Intel Corporation. All rights reserved. // Your use of Intel Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files from any of the foregoing (including device programming or simulation // files), and any associated ...
module autoinst_precomment ( why, /*AUTOARG*/ // Inputs nnnot ); input why; input nnnot; autoinst_wildcard_sub sub0 ( .sd_ras_ (foo...
#include <bits/stdc++.h> using namespace std; template <typename T> inline T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <typename T> inline T lowbit(T x) { return x & -x; } const int N = 2e5 + 10; int n, m; int q; int res; int les[N], more[N]; bool vis[N]; void solve() ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1 << 17; const int INF = 7 << 28; struct T { int maxa, minr; T() : maxa(0), minr(INF) {} T(int a, int b) : maxa(a), minr(b) {} T operator+(T t) const { return T(max(maxa, t.maxa), min(minr, t.minr)); } }; T a[MAXN * 2]; int del...
////////////////////////////////////////////////////////////////////// //// //// //// spi_clgen.v //// //// //// //// This file is part of the SPI I...
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2014 Francis Bruno, All Rights Reserved // // This 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...
#include <bits/stdc++.h> using namespace std; struct BIT { int bit[200005]; void init() { memset(bit, 0, sizeof(bit)); } void add(int k, int x) { k++; while (k < 200005) { bit[k] += x; k += k & -k; } } int get(int k) { k++; int ret = 0; while (...
#include <bits/stdc++.h> using namespace std; using namespace std; const int maxn = 3e5 + 7; int n, f[maxn][20], dep[maxn]; set<int> s1, s2; int mx = 0; long long ans = 0; int path(int o, int p) { if (dep[o] < dep[p]) swap(o, p); int dis = dep[o] - dep[p]; for (int i = 19; i >= 0; --i) { ...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * * This 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, version 3 of the License. * * This program is distribut...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const double pi = acos(-1.0); int a[32][101111], n, m, d[32][111111], b[111111], t[400111]; pair<pair<int, int>, int> p[111111]; int bit(int mask, int i) { return (mask & (1 << i)) > 0; } void build(int v, int tl, int tr) { if (tl ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:44:46 09/24/2013 // Design Name: Data_Parameters // Module Name: C:/Users/Fabian/Documents/GitHub/taller-diseno-digital/Lab3/laboratorio3/test_data_parameters.v //...
/* * 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 maxn = 2e3 + 5; const int mod = 1e9 + 9; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; cout << (2 * n) - 1 << << 2 << endl << 1 << << 2 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> starts(m), ends(m), results; for (int i = 0; i < n; i++) { int l, r; cin >> l >> r; starts[l - 1]++; ends[r - 1]++; } int open = 0; for (int i = 0; i < m; i++) { ...
/* * 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...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int maxN = 1e5 + 10; int n, m, s, f; int t[maxN], l[maxN], r[maxN]; bool inside(int l, int m, int r) { return l <= m && m <= r; } void slv() { int d = f > s ? 1 : -1; m++; t[m] = inf, l[m] = inf, r[m] = -inf; i...
//*******************************************************************************************************************************************************/ // Module Name: reg_array_dual // Module Type: Synchronous Dual Port Memory Array // Author: Shreyas Vinod // Purpose: General Purpose Register Array for Neptune...
/* * 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2003 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=1; supply0 [1:0] low; supply1 [1:0] high; reg [7:0] isized...
#include <bits/stdc++.h> #pragma warning(disable : 4996) #pragma comment(linker, /STACK:1024000000,1024000000 ) const long double pi = acosl(-1.); int T; const long long mod = 258280327; long long gcd(long long x, long long y) { if (!y) return x; return gcd(y, x % y); } long long quickfind(long...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: rep_jbi_sc3_2.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it and...
#include <bits/stdc++.h> using namespace std; inline char nc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++; } inline void read(int &x) { char c = nc(), b = 1; for (; !(c...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; long long max(long long a, long long b) { if (a > b) { return a; } else { return b; } } long long min(long long a, long long b) { if (a < b) { return a; } else { return b; } } long l...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 08/14/2016 05:02:16 PM // Design Name: // Module Name: top // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revisi...
#include<bits/stdc++.h> #define rep(i,a,b) for(long long i=a;i<b;i++) #define pb push_back #define f first #define s second #define is insert #define vector_int vector<int> #define ll long long #define pqi priority_queue<int> #define all(x) x.begin(),x.end() #define mem(x,y) memset(x,y,sizeof(x)) ...
//================================================================================================== // Filename : DECO_CORDIC_OP.v // Created On : 2016-10-03 13:00:49 // Last Modified : 2016-10-03 14:44:53 // Revision : // Author : Jorge Sequeira Rojas // Company : Instituto Tecnologico...
#include <bits/stdc++.h> long long gcd(long long x, long long y) { if (x > y) std::swap(x, y); return y % x == 0 ? x : gcd(y % x, x); } using namespace std; int main() { int n; scanf( %d , &n); int a[20]; bool flag = true; for (int i = (1); i <= (n); i++) scanf( %d , a + i); for ...
/* * 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 MAX_N = 1e5 + 100; vector<int> v[MAX_N]; int dp[MAX_N], ans, deep[MAX_N]; void dfs(int x, int fa, int dep) { int i; deep[x] = dep; for (i = 0; i < v[x].size(); i++) { int y = v[x][i]; if (y == fa) continue; dfs(y, x, dep + 1...
/** * 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 (C) 1991-2013 Altera Corporation //Your use of Altera Corporation's design tools, logic functions //and other software and tools, and its AMPP partner logic //functions, and any output files from any of the foregoing //(including device programming or simulation files), and any //associated documentatio...
module tb_SystolicDataSetupRow #( parameter DATA_BITS = 8, parameter MATRIX_SIZE = 8, parameter OUTPUT_SIZE = 2*MATRIX_SIZE-1 ) (); reg clock; reg reset; integer count; reg [DATA_BITS-1:0] data_in [0:MATRIX_SIZE-1][0:MATRIX_SIZE-1]; wire [DATA_BITS-1:0] data_out [0:MATRIX_SIZE-1][0:...
//############################################################################# //# Function: A Padring IO Domain # //# Copyright: OH Project Authors. ALl rights Reserved. # //# License: MIT (see LICENSE file in OH repository) # ...
`timescale 1 ns / 1 ps module s2mm # ( // Users to add parameters here parameter integer C_PIXEL_WIDTH = 8, parameter integer C_IMG_WBITS = 12, parameter integer C_IMG_HBITS = 12, parameter integer C_DATACOUNT_BITS = 12, parameter integer C_PIXEL_STORE_WIDTH = 8, // User parameters ends // Parameters of Axi...
#include <bits/stdc++.h> using namespace std; int n, t, lim = 16; int w[4], g[1005]; char ch[4][1005]; int num[4][4]; int s[4][4][4]; int dp[1005][16][16][16][16]; int main() { scanf( %d , &n); for (int i = 0; i < 4; i++) scanf( %d , &w[i]); for (int i = 0; i < 4; i++) scanf( %s , ch[i]); ...
#include <bits/stdc++.h> using namespace std; namespace fio { streambuf* in = cin.rdbuf(); char bb[1000000], *s = bb, *t = bb; inline long long read() { long long x = 0; char ch = (s == t && (t = (s = bb) + in->sgetn(bb, 1000000), s == t) ? EOF : *s++); while (ch < 48) ch = (s == t &...
/* * 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; inline char gc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++; } inline int read() { int x = 0; char ch = getchar(); boo...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 5; int st[maxn << 2]; int a[maxn], b[maxn]; vector<int> pos[maxn]; void build(int id, int l, int r) { if (l == r) { st[id] = a[l]; return; } int mid = (l + r) >> 1; build(id << 1, l, mid); build(id << 1 | 1,...
//Legal Notice: (C)2017 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associate...
#include <bits/stdc++.h> using namespace std; string s, t; int dp[1005][1005]; int solve(int i, int j) { if (i == s.size()) return t.size() - j; if (j == t.size()) return s.size() - i; if (dp[i][j] != -1) return dp[i][j]; if (s[i] == t[j]) return solve(i + 1, j + 1); int c1 = solve(i + 1, j ...
#include <bits/stdc++.h> using namespace std; double eps = 1e-12; const int MOD = 1e9 + 7; const int INF = 0x3f3f3f3f; const double PI = acos(-1.0); const int MAXN = 1; double l, v1, v2; int n, k; bool Judge(double m) { double t = (l - m * v1) / (v2 - v1); if (t < 0) return false; double p...
// (C) 2001-2015 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated doc...
#include <bits/stdc++.h> using namespace std; inline long long mod(long long n, long long m) { long long ret = n % m; if (ret < 0LL) ret += m; return ret; } long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); } long long exp(long long a, long long b, long long m) { i...
#include <bits/stdc++.h> using namespace std; int n; int ans; bool one, two, three; vector<int> v; int main() { scanf( %d , &n); while (one == false || two == false || three == false) { for (int i = 1; i <= n; i++) { if (!one) { if (i % 2 == 0) { ans++; ...
module LCDCONTROL ( input CLK, RST, input WRITE, input [8:0] WRDATA, output reg STATUS, output LCD_BLON, // LCD Back Light ON/OFF output LCD_RW, // LCD Read/Write Select, 0 = Write, 1 = Read output LCD_EN, // LCD Enable output LCD_RS, // L...
#include <bits/stdc++.h> constexpr int Maxn = 2e5 + 7; constexpr int Maxm = 1e6 + 7; constexpr int Mod = 1e9 + 7; int n, k, sum, root; void add(int bit[], int p, int v) { for (; p < Maxn; p += p & -p) bit[p] = (bit[p] + v) % Mod; } int query(int bit[], int p) { int res = 0; for (; p; p -= p & ...
#include <bits/stdc++.h> int main() { int i, l, j; char t; char kb[100] = qwertyuiopasdfghjkl;zxcvbnm,./ ; char s[1000]; scanf( %c , &t); scanf( %s , s); l = strlen(s); for (i = 0; i < l; i++) { for (j = 0; j < 30; j++) { if (kb[j] == s[i]) { if (t == R ) { ...
#include <bits/stdc++.h> using namespace std; int maze[1500][1500]; pair<int, int> was[1500][1500]; int n, m; int sr, sc; inline int rem(int x, int y) { x %= y; return (x < 0) ? x + y : x; } bool dfs(int r, int c) { int rm = rem(r, n), cm = rem(c, m); if (maze[rm][cm] == 1) { retur...
#include <bits/stdc++.h> using namespace std; const int limit = 320; int v[100000]; int dp[limit][100000]; int n; static int bruteforce(int p, int k) { int cnt = 0; while (p < n) { cnt++; p = p + v[p] + k; } return cnt; } int main() { cin >> n; for (int i = 0; i < n; ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; long long a[MAXN], b[MAXN]; long long n, s; bool check(long long k) { for (int i = 1; i <= n; i++) b[i] = 0; long long sum = s - 1, p = 2, q = 1, h = 1; a[1] = b[1] = 1; while (p <= n) { q *= k, h++; for (int i ...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Fri Jan 13 17:31:20 2017 // Host : KLight-PC running 64-bit major release (bu...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch <= 9 && ch >= 0 ) { x = 10 * x + ch - 0 ; ch = getchar(); } return x * f;...
/******************************************************************************* * 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 ...
#include <bits/stdc++.h> using namespace std; int n, sz[100005], msz[100005], xsz[100005], lsz[100005], son[100005], ans[100005]; vector<int> G[100005]; void dfs(int u) { sz[u] = 1; lsz[u] = n; son[u] = -1; for (int v : G[u]) { dfs(v), sz[u] += sz[v]; if (son[u] == -1 || sz[v] ...
/** * 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...
/* * BCH Encode/Decoder Modules * * Copyright 2014 - Russ Dill <> * Distributed under 2-clause BSD license as contained in COPYING file. */ `timescale 1ns / 1ps `include "bch_defs.vh" /* Make the ECC on erased flash be all 1's */ module bch_blank_ecc #( parameter [`BCH_PARAM_SZ-1:0] P = `BCH_SANE, parameter BI...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:100000000 ) int matrix[900][900]; int tmp[900][900]; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; vector<pair<int, int> > all; void go(int x, int y) { queue<pair<int, int> > q; tmp[x][y] = 1; q.push(make_p...
#include <bits/stdc++.h> using namespace std; int f[100][300] = {0}; int main() { std::ios::sync_with_stdio(false); string s1, s2; cin >> s1 >> s2; int t1 = 0, t2 = 0, q = 0; for (int i = 0; i < s1.length(); i += 1) { if (s1[i] == + ) t1++; else t1--; } for...
/** * 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; const int MAX = 1000000 + 10; const int Mod = 998244353; const int alp = 3; int n, S; int C[MAX]; int dp[MAX]; namespace opt { int N; int a[MAX], b[MAX], w[MAX], tmp[MAX]; int Pow(int a, int b) { int k = 1; for (; b; b /= 2, a = (long long)a * ...
#include <bits/stdc++.h> inline int read() { char c = getchar(); while (c != - && (c < 0 || c > 9 )) c = getchar(); int k = 0, kk = 1; if (c == - ) c = getchar(), kk = -1; while (c >= 0 && c <= 9 ) k = k * 10 + c - 0 , c = getchar(); return kk * k; } using namespace std; void w...
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); long long x; cin >> x; for (long long i = 1; i <= x; i++) { for (long long j = i; j <= x; j++) { if (j % i == 0 && i * j > x && j / i < x) { cout << j << << i << end...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; long long A[N]; int n; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> A[i]; int ans = 1; int len = 1; for (int i = 1; i < n; i++) { if (A[i] <= 2 * A[i - 1]) len++, ans = max(len, ans); els...
#include <bits/stdc++.h> using namespace std; int a[4]; int cur[100005]; void work(int x, int y, int z, int w, int tp) { if (x + z < y + w) return; if (x + z >= y + w + 2) return; int nlen = x + y + z + w; for (int pl = 1; pl <= nlen; pl += 2) { if (x) cur[pl] = 0, x--; else ...
/* Single BiQuad IIR Filter. Uses a single DSP block and Scaling factor = 17-clog2(max(abs(COEFF))) Multiply COEFFs by 2^SCALING */ module BiquadSingle #( parameter WIDTH_D = 18, // Data path width parameter WIDTH_C = 18, // Coeffecient bit width parameter COEFF_B0 = 0, // Coeffecient B0 parameter ...
/** * 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; pair<int, int> a[210000], b[2100000]; vector<pair<int, int> > ans; int main() { int N, M, i, j, k; scanf( %d%d , &N, &M); if (N <= M) { puts( -1 ); return 0; } for (i = 0; i < N; i++) scanf( %d%d , &a[i].first, &a[i].second); sort...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; char str[MAXN]; int main() { scanf( %s , str); int n = strlen(str); printf( 3 nL 2 nR 2 nR %d , 2 * n - 1); return 0; }
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; genvar g; reg [31:0] gen_pre_PLUSPLUS = 32'h0; reg [31:0] gen_pre_MI...
#include <bits/stdc++.h> using namespace std; void display(vector<int> &a) { for (int z : a) cout << z << ; cout << endl; } int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; const int mod = 998244353; const long long INF64 = 3e18; void smxl(long long &a, long long b) { if (a < b) 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...