text stringlengths 59 71.4k |
|---|
module \$__MUL18X18 (input [17:0] A, input [17:0] B, output [35:0] Y);
parameter A_WIDTH = 18;
parameter B_WIDTH = 18;
parameter Y_WIDTH = 36;
parameter A_SIGNED = 0;
parameter B_SIGNED = 0;
MULT18X18D _TECHMAP_REPLACE_ (
.A0(A[0]), .A1(A[1]), .A2(A[2]), .A3(A[3]), .A4(A[4]), .A5(A[5]), .A6(A[6]), .A7(A[7]), ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x; cin >> n >> x; int s = 0; for (int i = 0; i < n; ++i) { int a; cin >> a; s += a; } s += n - 1; if (s == x) { cout << YES << endl; } else { cout << NO << endl; } return 0; ... |
#include <bits/stdc++.h> using namespace std; long long n, m, ans; int main() { scanf( %I64d%I64d , &n, &m); if (n > m) swap(n, m); if (n == 2) { if (m <= 2) ans = 0; else { ans = n * m; if (m == 3) ans -= 2; else if (m == 7) ans -= 2; ... |
module mojo_top(
// 50MHz clock input
input clk,
// Input from rst button (active low)
input rst_n,
// cclk input from AVR, high when AVR is ready
input cclk,
// Outputs to the 8 onboard leds
output[7:0]led,
// AVR SPI connections
output spi_miso,
input spi_ss,
input spi_... |
#include <bits/stdc++.h> using namespace std; int c[100004], i, n, t, q, w, nr, r, d, s; char a[100004], b[100004]; int main() { scanf( %d %d n , &n, &t); for (i = 1; i <= n; i++) scanf( %c , &a[i]); scanf( n ); for (i = 1; i <= n; i++) scanf( %c , &b[i]); for (i = 1; i <= n; i++) { 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 la... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const double PI = 3.141592653589793238463; const int N = 1e5 + 100; vector<int> v[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; int x; cin >> x; int r, l; for... |
#include <bits/stdc++.h> using namespace std; signed main() { string s; cin >> s; char zero = 0 ; s = 00 + s; long long n = (long long)s.size(); for (long long i = 0; i < n - 2; i++) { long long temp = 100 * (s[i] - zero); for (long long j = i + 1; j < n - 1; j++) { te... |
#include <bits/stdc++.h> using namespace std; map<long long, vector<long long> > mp; long long a[200005]; long long t[200005]; set<long long> s; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n; cin >> n; for (long long i = 0; i < n; i++) cin >> a[i], s.insert(a[... |
#include <bits/stdc++.h> using namespace std; int main() { long long p, d, i, j, tmp, res; cin >> p >> d; res = p; for (i = 999999999999999999ll; i; i /= 10) { j = i + 1; if (i > p) continue; if (i == p) break; if (p % j == i) { tmp = (p / j) * j + i; if (p - ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2008-2008 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [63:0] crc;
reg [63:0] sum;
wire [9:0] I1 = crc[9:0];
... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Tue Oct 17 02:51:11 2017
// Host : Juice-Laptop running 64-bit major relea... |
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2006, 2007 Dennis van Weeren //
// ... |
/**
* 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... |
//======================================================================
//
// avalanche_entropy.v
// -------------------
// Top level wrapper of the entropy provider core based on an external
// avalanche noise based source. (or any other source that can
// toggle a single bit input).
//
// Currently the design consis... |
#include <bits/stdc++.h> using namespace std; int arr[100][100]; int row[100]; vector<pair<pair<int, int>, pair<int, int> > > v; int pos[30000][2]; int main() { int n; int sum = 0; while (scanf( %d , &n) == 1) { v.clear(); sum = 0; for (int i = 1; i <= n; i++) scanf( %d , &ro... |
#include <bits/stdc++.h> using namespace std; int main() { int n, count = 0; cin >> n; int home[n], guest[n]; for (int i = 0; i < n; ++i) { cin >> home[i] >> guest[i]; } for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (home[i] == guest[j]) count++; } ... |
/*
* 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 inf = 1e17; const int MAXM = 1e5 + 5; const int MAXN = 1e6 + 4; long long fact[MAXM]; long long nChoosek(long long n, long long k) { if (k > n) return 0; if (k * 2 > n) k = n - k; if (k == 0) return 1; long long result = n; fo... |
#include <bits/stdc++.h> using namespace std; long long M[110000 * 4]; long long lazy[110000 * 4]; void down(int x) { if (lazy[x] != -1) { M[x * 2] = max(M[x * 2], lazy[x]); M[x * 2 + 1] = max(M[x * 2 + 1], lazy[x]); lazy[x * 2] = max(lazy[x], lazy[x * 2]); lazy[x * 2 + 1] = max(lazy... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; if (n == 1 || n == 2) { cout << -1 ; return 0; } else if (n % 2 == 1) { long long k = (n - 1) / 2; cout << 2 * k * k + 2 * k << << 2 * k * k + 2 * k + 1; } else { long long k = n ... |
//==================================================================================================
// Filename : KOA_c_v2.v
// Created On : 2016-10-06 00:34:18
// Last Modified : 2016-10-24 23:31:21
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tecnologico de Co... |
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:1024000000,1024000000 ) template <typename T> T Max(T a, T b) { return a > b ? a : b; } template <typename T> T Min(T a, T b) { return a < b ? a : b; } template <typename T> T Abs(T A) { return A > 0 ? A : -1 *... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e4 + 10; const int INF = 1e9; int n; char s[maxn]; int P, M; struct node { int l, r; int left, right; } Tree[maxn]; int cur; vector<int> stk; void addNode(int x, bool flag) { ++cur; Tree[cur].l = x; if (!stk.empty(... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:38:55 02/11/2016
// Design Name:
// Module Name: PC_counter
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100; char s[maxn]; int l; long long make(int x, long long u) { int z = l - x; long long k = 1, u1 = 0; for (int i = 0; i < z; i++) { u1 += (s[l - 1 - i] - 0 ) * k; k *= 10; } u1 += u / k * k; if (u1 <= u) u1 +=... |
/*
* Phase accumulator clock generator:
* Output Frequency Fo = Fc * N / 2^bits
* Output Jitter = 1/Fc
*
* Copyright (c) 2009,2010 Zeus Gomez Marmolejo <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the G... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:43:26 02/26/2016
// Design Name: signExt
// Module Name: C:/Users/Ranolazine/Desktop/Lab/lab4/test_signExt.v
// Project Name: lab4
// Target Device:
... |
#include <bits/stdc++.h> using namespace std; int test, n; long long f[2000001][2]; const int P = 1000000007; int main() { memset(f, 0, sizeof(f)); f[3][0] = 0; f[3][1] = 4; for (int i = 4; i <= 2000000; i++) f[i][0] = max(f[i - 1][0], f[i - 1][1]) + max(f[i - 2][0], f[i - 2][1]) * 2, ... |
/*
* 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> inline long long Input() { long long ret = 0; bool isN = 0; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) isN = 1; c = getchar(); } while (c >= 0 && c <= 9 ) { ret = ret * 10 + c - 0 ; c = getchar(); } return isN ? -... |
/**
* 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 t; cin >> t; int a[3]; while (t--) { memset(a, 0, sizeof(a)); int n; cin >> n; for (int i = 0; i < n; i++) { int in; cin >> in; a[in % 3]++; } if (a[2] >= a[1]) { cout <... |
/**
* 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... |
// (C) 1992-2014 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 simulati... |
/**
* This is written by Zhiyang Ong
* for EE577b Extra Credit Homework , Question 2
*
* Behavioral model for the large XOR gate
*/
module large_xor (a,b,out);
// Output vector
output reg [14:0] out;
// Input vector
input [14:0] a;
// Another input vector
input [15:1] b;
// Declare "reg" signals...
... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); long long t; cin >> t; while (t--) { vector<vector<long long> > a(2); vector<long long> ans; long long n; string b; cin >> n >> b; ... |
// $Header: $
///////////////////////////////////////////////////////
// Copyright (c) 2011 Xilinx Inc.
// All Right Reserved.
///////////////////////////////////////////////////////
//
// ____ ___
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 2012.2
// \ \ ... |
/**
* 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, 2003-2007 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
// verilator lint_on GENCLK
reg [31:0] long;
reg [6... |
#include <bits/stdc++.h> using namespace std; void solve() { long long int n, k; cin >> n >> k; vector<long long int> a(n); for (long long int i = 0; i < n; i++) cin >> a[i]; long long int ans = -1e18; for (long long int i = 0; i < n; i++) { for (long long int j = i; j < n; j++) { ... |
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; template <typename T> void print(vector<T> v) { for (T &i : v) cout << i << ; cout << n ; } void solve() { unsigned long long int n, x; cin >> n >> x; vector<unsigned long long int> v(n); for (unsigned long l... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &x) { static char _c; static bool _f; x = 0; _f = 0; _c = getchar(); while (_c < 0 || 9 < _c) { if (_c == - ) _f = true; _c = getchar(); } while ( 0 <= _c && _c <= 9 ) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int n = s.length(); if (n <= 10) { cout << s << endl; } else { cout << s.at(0); cout << n - 2; cout << s.at(n - 1) << endl; } ... |
#include <bits/stdc++.h> using namespace std; const int N = 400, D = 8; int vis[N][N]; int T[30]; bool used[N][N][D][6][31]; struct obj { int x, y, d, t, i; void move() { if (d == 0 || d == 1 || d == 7) x++; if (d == 5 || d == 4 || d == 3) x--; if (d == 1 || d == 2 || d == 3) y++; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:31:46 04/05/2017
// Design Name:
// Module Name: DSP48E_1
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
/... |
//------------------------------------------------------------------------------
// File : tri_mode_eth_mac_v5_2_mod.v
// Author : Xilinx Inc.
//------------------------------------------------------------------------------
// Description: This package holds the top level component declaration
// ... |
/*
* 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 la... |
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time base for each unit, ranging from seconds
* to femtoseconds, and must be... |
module Mux2(select,data_i00,data_i01,data_o);
parameter Size = 8;
input wire [('d1) - ('b1):0] select;
input wire [(Size) - ('b1):0] data_i00;
input wire [(Size) - ('b1):0] data_i01;
output reg [(Size) - ('b1):0] data_o;
always @ (select or data_i00 or data_i01) begin
case (select)
'b0:... |
/**
* tb_draw_fifo.v: test bench for draw fifo
*/
module tb_draw_fifo;
localparam STEP = 2;
localparam REG_FIFO = 32'h0;
localparam REG_STATUS = 32'h4;
wire [15:0] x1, y1, x2, y2, x3, c1, c2, c3;
wire ap_rstn, ap_start;
reg ap_done;
wire ap_idle;
reg ap_clk;
reg s00_axi_aclk;
reg s00_axi_aresetn;
reg [2:0] s00_axi... |
#include <bits/stdc++.h> using namespace std; long long f[500005]; int main() { string s; cin >> s; for (int i = 1; i <= s.size(); i++) f[i] = (s[i - 1] == I || s[i - 1] == O || s[i - 1] == E || s[i - 1] == A || s[i - 1] == U || s[i - 1] == Y ); for (int i = 1; i <= ... |
#include <bits/stdc++.h> using namespace std; int n; void solve_1() { if (n < 6) { printf( -1 n ); return; } puts( 1 2 ); puts( 2 3 ); puts( 2 4 ); puts( 4 5 ); puts( 4 6 ); for (int i = 7; i <= n; i++) { printf( 2 %d n , i); } } void solve_2() { for (... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC optimize( unroll-loops ) using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<tuple<int, int, int, int> > v(n); vector<int> used(n, 0); for (int i = 0; i < n; i++) { in... |
#include bits/stdc++.h using namespace std; #define ll long long #define Rip_classic_loki_for_glorious_purpose ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #pragma GCC target ( avx2 ) #pragma GCC optimization ( O3 ) #pragma GCC optimization ( unroll-loops ) // need for speed ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; int n; int a[200005]; int mv; int main() { scanf( %d , &n); mv = n / 2; if (n % 2 == 0) mv--; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); } sort(a + 1, a + n + 1); int ret = 2000000000; for (int i = 0; i <= mv; i++) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a = 0, b = 0, count = 0; char ch, c; cin >> n >> c; if (c == U ) b++; else a++; n--; while (n--) { cin >> ch; if (a == b && ch != c) { count++; c = ch; } if (ch == U ) ... |
#include <bits/stdc++.h> using namespace std; const int mx = 1e6 + 10, inf = 1e9 + 10; long long int t, n, ans, a[mx]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> t; while (t--) { cin >> n; cout << (n + 1) / 10 << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll N = 1e6 + 10; ll n, m, q, v; ll kl, ke; ll l[N]; ll e[N]; void umin(ll &a, ll b) { a = min(a, b); } signed main() { ios::sync_with_stdio(0), cin.tie(0); cin >> n >> m; cin >> kl >> ke; cin >> v; for (ll i ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long infinity = 1000000000000000000; const int inf = 1e9 + 5; bool do_debug = false; template <typename T> ostream& operator<<(ostream& os, vector<T>& v) { for (auto element : v) { os << element << ; ... |
#include <bits/stdc++.h> const int N = 120005; int n, p[N], m; int stack1[N], top1, stack2[N], top2; struct query { int l, r, id; } q[N]; bool operator<(query a, query b) { return a.r < b.r; } int min[N << 2], num[N << 2], tag0[N << 2], tag1[N << 2]; long long sum[N << 2], ans[N]; void build(int o... |
#include <bits/stdc++.h> using namespace std; inline int read() { long long f = 1; long long x = 0; char ch = getchar(); while (ch > 9 || ch < 0 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) x = (x << 3) + (x << 1) + ch - 0 , ch = getchar()... |
// MBT 11/9/2014
//
// Synchronous 2-port ram.
//
// When read and write with the same address, the behavior depends on which
// clock arrives first, and the read/write clock MUST be separated at least
// twrcc, otherwise will incur indeterminate result.
//
// See "TSN45GS2PRF: TSMC 45nm (=N40G) General Purpose Superb... |
#include <bits/stdc++.h> using namespace std; int main() { int n, s = 0; cin >> n; int a[n]; for (int x = 0; x < n; ++x) { cin >> a[x]; s += a[x] * (x + 1); } cout << s << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long a = 0, b = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ) b = -1; c = getchar(); } while (isdigit(c)) { a = a * 10 + c - 0 ; c = getchar(); } return a * b; } const l... |
#include <bits/stdc++.h> using namespace std; const int M = 1e6 + 10; int n, ans; void swap(int &x, int &y) { int t = x; x = y; y = t; } int main() { cin >> n; vector<char> x(n), y(n); for (auto &i : x) cin >> i; for (auto &i : y) cin >> i; for (int i = 0; i < n - 1; ++i) { ... |
`default_nettype none
// Copyright 2020 Efabless Corporation
//
// 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... |
#include <bits/stdc++.h> using namespace std; long long n, a, b, t, p, i; int main() { cin >> n >> a >> b; p = b * n; while (n > 1) { t += 2 * a + 1; n--; } cout << t << << p; return 0; } |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5, inf = 1e9; int a[maxn]; struct segtree { int lb, rb; int mn = 0; segtree *l, *r; segtree(int _lb, int _rb) { lb = _lb, rb = _rb; if (lb == rb) mn = a[lb]; else { int t = (lb + rb) / 2; l... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int x = 0, y = 0, z = 0; for (int i = 0; i < n; i++) { int a, b, c; cin >> a >> b >> c; x += a; y += b; c += z; } if (!x && !y && !z) cout << YES ; else cout << NO ; ... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2>& a) { in >> a.first >> a.second; return in; } template <typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> a) { out << a.first << << a.second;... |
#include <bits/stdc++.h> using namespace std; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; template <class T> inline void smin(T &a, T b) { if (a > b) a = b; } template <class T> inline void smax(T &a, T b) { if (a < b) a = b; } int qf, qb, q[11111111]; long long res[555], a[555][55... |
#include <bits/stdc++.h> using namespace std; const int maxn = 27, maxm = 5e4 + 20, inf = 1e9; vector<int> ar[maxn][maxn][maxn][maxn]; int q, a[maxm], bs[4], bs2[4]; string s, qs, qss; map<pair<string, string>, int> mp; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> s >... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 100; long long x[maxn]; char type[maxn], t; vector<long long> B, R, G; long long szR, szB, n, pos; void Put(long long st, long long en) { R.clear(); B.clear(); for (int i = st; i <= en; ++i) { if (type[i] == 1) ... |
//*****************************************************************************
// (c) Copyright 2009 - 2013 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
/... |
`timescale 1ns / 1ps
module Print(
input mclk,
input [15:0] num,
output reg [7:0] display,
output reg [3:0] an
);
reg [3:0] tmp;
reg [15:0] counter;
parameter [15:0] MAX_COUNTER = 16'D5_0000;
initial begin
an = 4'B0111;
counter = 0;
end
always@(posedge mc... |
#include <bits/stdc++.h> using namespace std; void processTest(int n, int64_t m, int64_t k) { vector<int64_t> path(n); int64_t bag = m; for (auto &v : path) { cin >> v; } for (int i = 1; i < path.size(); ++i) { auto toEq = max(path[i] - k, int64_t(0)); bag += path[i - 1] - toEq... |
module uart_divider
#(parameter COUNT = 0, CLK2_MUL = 5)
(input sys_clk,
input reset,
output reg outclk,
output reg outclk2);
// COUNT values:
// 2.88MHz:
// Input @ 144MHz, COUNT = 25
// 576kHz:
// Input @ 144MHz, COUNT = 125
// 115.2kHz:
// Input @ 28.8MHz, CO... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cout.precision(10); int n; cin >> n; set<string> st; while (n--) { string s, ss; cin >> s; for (int i = s.size() - 1; i >= 0; i--) { if (s[i] == u ) { ss += oo ; ... |
#include <bits/stdc++.h> using namespace std; int number[1003][1003][2]; int n, m, sum; int part = -1; int parts[1000003]; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; string s[1003]; bool isvalid(int x, int y) { if (x >= 0 && x < n && y >= 0 && y < m) return 1; return 0; } int find... |
/*
* 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; template <class T> using vec = vector<T>; template <typename Iter> ostream &_IterOutput_(ostream &o, Iter b, Iter e, const string ss = , const string se = ) { o << ss; for (auto it = b; it != e; it++) o << (it == b ? : , ) ... |
`default_nettype none
/****
HOLD
0 START
1 MOVE_K2U
1 MOVE_UK
2 EMD
****/
module execute_exception(
input wire iCLOCK,
input wire inRESET,
input wire iRESET_SYNC,
//Event CTRL
input wire iEVENT_HOLD,
input wire iEVENT_START,
input wire iEVENT_IRQ_FRONT2BACK,
input wire iEVENT_IRQ_BACK2FRONT,
in... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:200000 ) const int INF = 1e9 + 7; const double EPS = 1e-6; const double pi = acos(-1); const int MOD = 1e9 + 7; const int N = 1e5 + 1000; using namespace std; double mid; struct node { int pos, val; node() { pos = val = 0; } node(int... |
/**
* bsg_mem_1rw_sync_mask_write_bit_banked.v
*
* This module has the same interface/functionality as
* bsg_mem_1rw_sync_mask_write_bit.
*
* This module can be used for breaking a big SRAM block into
* smaller blocks. This might be useful, if the SRAM generator does not
* support sizes of SRAM that are t... |
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __prin... |
/*
rom_init_rtl.v
Altera "Recommended HDL Coding Styles"
ROM с инициализацией и разрешением такта
*/
//`include "vconst_lib.v"
module rom_init_rtl(clk, clk_ena, addr_a, q_a);
parameter DATA_WIDTH = 8;
parameter ADDR_WIDTH = 8;
input clk, clk_ena;
input [ADDR_WIDTH-1:0] addr_a;
output reg [DATA_WIDTH-1... |
//
// .. hwt-autodoc::
//
module FullAdder (
input wire a,
input wire b,
input wire ci,
output reg co,
output reg s
);
always @(a, b, ci) begin: assig_process_co
co = a & b | (a & ci) | (b & ci);
end
always @(a, b, ci) begin: assig_process_s
s = a ^ b ^ ci;
en... |
//+FHDR------------------------------------------------------------------------
//Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved
//GLADIC Open Source RTL
//-----------------------------------------------------------------------------
//FILE NAME :
//DEPARTMENT : IC Design / Veri... |
#include <bits/stdc++.h> using namespace std; long long int MOD = 1e9 + 7; long long int INF = 1e18; long long int power(long long int base, long long int exp) { long long int res = 1; while (exp > 0) { if (exp % 2 == 1) res = (res * base); base = (base * base); exp /= 2; } ret... |
#include <bits/stdc++.h> using namespace std; using namespace std; const long long mod2 = 998244353; long long fpow(long long x, long long y) { x = x % 1000000007; long long sum = 1; while (y) { if (y & 1) sum = sum * x; sum %= 1000000007; y = y >> 1; x = x * x; x %= 10... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000 * 100 * 3 + 10; long long int mod = 998244353; long long int x[MAXN]; long long int y[MAXN]; pair<long long int, long long int> p[MAXN]; long long int f(long long int n) { long long int m = 1; for (int i = 1; i <= n; 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 la... |
#include <bits/stdc++.h> using lint = long long int; using pii = std::pair<int, int>; using std::vector; int ve[200100]; bool check[200100]; int main(void) { int N, hol = 0; scanf( %d , &N); for (int i = 1; i <= N; i++) { int temp; scanf( %d , &temp); ve[i] = temp; } fo... |
/**
* 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; template <class T> inline bool chkmin(T& x, T y) { return x > y ? x = y, true : false; } template <class T> inline bool chkmax(T& x, T y) { return x < y ? x = y, true : false; } inline int read(void) { int x, f = 1; char ch = getchar(); f... |
#include <bits/stdc++.h> using namespace std; inline int getint() { int res = 0, fh = 1; char ch = getchar(); while ((ch < 0 || ch > 9 ) && ch != - ) ch = getchar(); if (ch == - ) fh = -1, ch = getchar(); while (ch <= 9 && ch >= 0 ) res = res * 10 + ch - 0 , ch = getchar(); return r... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 100; const long long INF = 1e13; int u, v, c, b, laz[MAXN], C[MAXN], n, m, st[MAXN]; bool vis[MAXN]; multiset<pair<int, int> > Q[MAXN]; multiset<pair<int, int> >::iterator it; vector<pair<int, int> > W[MAXN]; vector<int> G[MAXN]; p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.