text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; typedef bool mat[55][55][35]; mat adja, adjb; char a[55], b[55], x[55], y[55], z[55]; int dp[55][55], k; inline void upd(int &u, int v) { u = min(u, v); } inline void work(char *str, int n, mat adj) { memset(adj, false, 55 * 55 * 35); for (int i = 0; i...
// Check behaviour with out-of-range and undefined array indices // on LHS of procedural continuous (reg) assignment. `ifdef __ICARUS__ `define SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST `endif module top; reg [1:0] array1[2:1]; reg [1:0] array2[1:0]; reg [1:0] var1; `ifndef VLOG95 real array3[2:1]; real array4[1:0]; ...
#include <bits/stdc++.h> using namespace std; const long long N = 5e5 + 1; long long arr[N]; long long n, k; long long sum; long long mnm = -1; long long mxm = -1; void input() { cin >> n >> k; for (long long i = 0; i < n; ++i) { cin >> arr[i]; sum += arr[i]; } sort(arr, arr ...
`define LedBank_NOP 4'h0 `define LedBank_LDI 4'h1 `define LedBank_LD0 4'h2 `define LedBank_LD1 4'h3 `define LedBank_LD2 4'h4 `define LedBank_LD3 4'h5 `define LedBank_LD4 4'h6 `define LedBank_LD5 4'h7 `define LedBank_LD6 4'h8 `define LedBank_LD7 4'h9 `define LedBank_State_Reset 2'h0 `define LedBank_State_Ready 2'h1 `de...
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; long long tmp[1000005]; long long n; void get_tmp() { tmp[1] = -1; for (int i = 1; i <= n; i++) tmp[i + 1] = (tmp[i] + 1) * i % mod; } long long a[1000005]; int main() { cin >> n; get_tmp(); a[1] = 1; ...
#include <bits/stdc++.h> using namespace std; int n; double p[3005][305], f[305][3005], d[305]; inline int read() { int re = 0; char ch = getchar(); while (ch < 48 || ch > 57) ch = getchar(); while (ch > 47 && ch < 58) { re = (re << 3) + (re << 1) + (ch ^ 48); ch = getchar(); } ...
#include <bits/stdc++.h> using namespace std; int main() { string s; int n, i = 0; cin >> n >> s; std::vector<int> v(n); std::vector<bool> cycle(n); for (int i = 0; i < n; i++) cin >> v[i]; for (i = 0; i < n;) { if (i <= -1 || i >= n) break; if (cycle[i] == true) brea...
//-------------------------------------------------------------------------------- //-- Filename: INT_MANAGER.v //-- //-- Description: INTERRUPT MANAGER Module //-- //-- The module receives done signals from CPM module and then gener- //-- ates interrupt singals to notify HOST a request has d...
#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; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, a, moves = 0; cin >> n; while (n--) { cin >> a; moves += a - 1; moves %= 2; cout << 2 - moves << n ; } return 0; }
// // Copyright 2011-2012 Ettus Research LLC // // 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, either version 3 of the License, or // (at your option) any later version. // // This program i...
#include <bits/stdc++.h> using namespace std; const int b = 3e6; long long a[b]; void ans(long long x, long long y, long long k, long long i) { long long sidl = k + k * y, ans = k; long long ez1 = (sidl - 3 + x) / (x - 1); ans += ez1; a[i] = ans; } int main() { long long t, x, y, k, j; ...
#include <bits/stdc++.h> using namespace std; int gcd(long long a, long long b) { if (b == 0) { return a; } else { return gcd(b, a % b); } } int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); ; long long i, j, k, n, m, t = 1; cin >> t; while (t--)...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 08:35:15 11/08/2013 // Design Name: nco // Module Name: C:/Users/Fabian/Documents/GitHub/taller-diseno-digital/Proyecto Final/tec-drums/nco_test.v // Project Name: t...
#include <bits/stdc++.h> using namespace std; const long long MX = 1e2 + 5; vector<long long> g[MX]; long long vis[2][MX], ways[2][MX], dist[2][MX]; void bfs(long long x, long long idx) { vis[idx][x] = 1; queue<long long> q; q.push(x); ways[idx][x] = 1; while (!q.empty()) { long long...
#include <bits/stdc++.h> using namespace std; const int iinf = 1e9 + 10; const long long inf = 1ll << 60; const long long mod = 1e9 + 7; void GG() { cout << Impossible n ; exit(0); } long long mpow(long long a, long long n, long long mo = mod) { long long re = 1; while (n > 0) { if ...
// // Generated by Bluespec Compiler, version 2021.07 (build 4cac6eb) // // // Ports: // Name I/O size props // RDY_server_reset_request_put O 1 reg // RDY_server_reset_response_get O 1 reg // valid O 1 // word_fst O 64 // word_sn...
/*+-------------------------------------------------------------------------- Copyright (c) 2015, Microsoft Corporation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code ...
// // Generated by Bluespec Compiler, version 2019.05.beta2 (build a88bf40db, 2019-05-24) // // // // // Ports: // Name I/O size props // RDY_server_reset_request_put O 1 reg // RDY_server_reset_response_get O 1 // read_rs1 O 64 // read_rs1_port2 ...
#include <bits/stdc++.h> using namespace std; int n, m, p1[2010][2010], p2[2010][2010], p3[2010][2010], p4[2010][2010]; int sun[2010][2010]; int dir[8][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}, {-1, -1}, {-1, 1}, {1, -1}, {1, 1}}; int vis[2010][2010]; int nw, nwr, bel[4000010], cnt[400001...
/* * 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; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t, i, n, x, j; cin >> t; while (t--) { cin >> n; vector<int> a, b; for (i = 0; i < n; i++) { cin >> x; a.push_back(x); } for (i =...
#include <bits/stdc++.h> using namespace std; long long n, m; vector<long long> boxes; vector<int> counts; long long answer; void In() { boxes.clear(); counts.clear(); answer = 0; cin >> n >> m; boxes.resize(m); counts.resize(63); for (int i = 0; i < m; i++) cin >> boxes[i]; } ...
#include <bits/stdc++.h> int main(void) { int i, j, n, k, c = 0; int a[100]; scanf( %d%d , &n, &k); for (i = 0; i < n; i++) scanf( %d , &a[i]); for (i = 0; i < n; i++) { if (a[i] <= k) { c++; } else break; } for (i = n - 1; i >= 0; i--) { if (a[i] <= k) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Muhammad Ijaz // // Create Date: 08/09/2017 09:46:11 PM // Design Name: // Module Name: INSTRUCTION_CACHE_SIMULATION // Project Name: RISC-V // Target Devices: // Tool V...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 7; const int inf = INT_MAX; const long long inff = 1e18; const long long mod = 1e9 + 7; long long n, p, k; long long a[maxn]; set<long long> s; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(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 la...
module circl_s( input wire [4:0] in_addr, output reg [4:0] out_word ); always @* case( in_addr ) 5'h00: out_word = 5'h00; 5'h01: out_word = 5'h05; 5'h02: out_word = 5'h09; 5'h03: out_word = 5'h0B; 5'h04: out_word = 5'h0D; 5'h05: out_word = 5'h0F; 5'h06: out_word = 5...
#include <bits/stdc++.h> const int MAXN = 3e5 + 5; const int SQ = 600; int n, p, m, w[MAXN]; long long sum[MAXN], ans[MAXN]; std::vector<int> vec[SQ]; struct Ques { int a, b; } ques[MAXN]; void ss(int x) { int step = ques[x].b; if (step > m) { long long res = 0; for (int i = ques...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, i, u, v, w = 0, l = 0; scanf( %d%d , &n, &k); for (i = 1; i <= k; ++i) scanf( %d%d , &u, &v), w = (w + u * 1ll * v) % n, l += v; if (l < n) puts( 1 ); else if (l > n) puts( -1 ); else if ((1ll + n) * n / 2...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long _pow(long long a, long long b) { long long x = 1; for (long long j = 0; j < b; j++) { x *= a; } return x; } bool test(int a, int n, in...
#include <bits/stdc++.h> using namespace std; template <class flow_t, const flow_t inf> struct Dinic { struct edge_t { long long to; flow_t cap, flow; edge_t(long long to = 0, flow_t cap = 0, flow_t flow = 0) : to(to), cap(cap), flow(flow) {} }; long long n, s, t; vecto...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 5000 + 5; const int MOD = 1e9 + 7; const double pi = cos(-1); int n, d, ans[MAXN], fa[MAXN]; int c, now, maxx, cnt, pos; int ch[MAXN]; int getdepth() { int ans_t = now; c++; if (c == maxx) { c ...
/* * 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; int main() { int n; string str; cin >> n; for (int i = 0; i < n; i++) { cin >> str; sort(str.begin(), str.end()); for (int j = 0; j < str.size() - 1; j++) { if (str[j + 1] - str[j] != 1) { cout << NO <...
module add3gt4(input wire[3:0] in_val, output reg[3:0] out_val); always @(in_val) begin case (in_val) 4'b0101: out_val <= 4'b1000; 4'b0110: out_val <= 4'b1001; 4'b0111: out_val <= 4'b1010; 4'b1000: out_val <= 4'b1011; 4'b1001: out_val <= 4'b1100; 4'b1010: out_val <= 4...
#include <bits/stdc++.h> using namespace std; int main() { int m, n = 0, x, y, s = 0; cin >> m; vector<int> c(m); for (int i = 0; i < (int)(m); ++i) { cin >> c[i]; n += c[i]; } cin >> x >> y; for (int i = 0; i < (int)(m); ++i) { s += c[i]; if (s <= y && s >= x && ...
module ID_EX_Seg( input Clk, input stall, input flush, input [31:0]PC_Add, input OverflowEn, input[2:0] condition, input Branch, input[2:0] PC_write,//Unknown input[3:0] Mem_Byte_Write, input[3:0] Rd_Write_Byte_en, input MemWBSrc, input Jump, input ALUShiftSrc, input [2:0]MemDataSrc, input ALUSrcA,ALUSrcB, input [3:...
#include <bits/stdc++.h> using namespace std; bool comp(const pair<int, int> &a, const pair<int, int> &b) { return (a.first > b.first && a.second < b.second); } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int a[4], i; for (i = 0; i < 4; i++) { cin >> a[i]; ...
`default_nettype none module seg7 ( input wire clk, input wire reset, input wire [15:0] value, output reg [6:0] seg, output reg dp, output reg [3:0] an ); localparam COUNTER_WIDTH = 18; reg [COUNTER_WIDTH-1:0] counter; reg counter_msb_d1; wi...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_clk_cl_jbi_jbus.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 i...
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; cout << 2 * a - 1 << << 2 << n ; cout << 1 << << 2; }
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:30:37 11/03/2014 // Design Name: // Module Name: // Project Name: // Target Devices: // Tool versions: // Description: HEX to Seven segment display // //...
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0, c; cin >> n; for (long long i = 1; i <= n; i++) { cin >> c; ans += c; } c = (n == 1 ? 1 : n - 1); if (ans == c) cout << YES ; else cout << NO ; return 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 law...
#include <bits/stdc++.h> using namespace std; const int maxN = 1e5 + 5; vector<int> adj[maxN]; int s[maxN], par[maxN]; void dfs(int n, int p) { par[n] = p; for (int i = int(0); i < int((int)adj[n].size()); i++) { if (adj[n][i] != p) dfs(adj[n][i], n); } } int main() { ios_base::sync_...
#include <bits/stdc++.h> using namespace std; signed main() { ios ::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t; cin >> t; while (t--) { long long n, k; cin >> n >> k; string s; cin >> s; vector<long long> cnt(26); for (auto u : s) ++cnt[u - ...
//----------------------------------------------------------------------------- // File : clock.v // Creation date : 03.04.2017 // Creation time : 11:15:26 // Description : // Created by : TermosPullo // Tool : Kactus2 3.4.18 32-bit // Plugin : Verilog generator 2.0d // This file was generated based on I...
#include <bits/stdc++.h> using namespace std; template <class X, class Y> bool minimize(X &x, const Y &y) { X eps = 1e-9; if (x > y + eps) { x = y; return true; } else return false; } template <class X, class Y> bool maximize(X &x, const Y &y) { X eps = 1e-9; if (x + ep...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); int main() { double s, f, r, v; int n; scanf( %d%lf%lf , &n, &r, &v); while (n--) { scanf( %lf%lf , &s, &f); double ans = 0, d = f - s; int cnt = (int)floor(d / (2 * pi * r)); ans += cnt * 2 * pi * ...
module decoder (cx,d); output [5:0] d; input [18:0] cx; reg [5:0] d; reg [12:0] s; reg [18:0] cx1; parameter s0 = 13'b1001001110000; parameter s1 = 13'b1000101100111; parameter s2 = 13'b0010010001011; parameter s3 = 13'b0011100010101; parameter s4 = 13'b1101110101110; parameter s5 = 13'b1110101100010; p...
/* * 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 = 110000; long long init[N], tab[N * 2], ope[N][3], ch[N], h[N], num[N * 8], sum[N * 8], ans[N * 8], nn, ss, aa; bool ini[N * 2]; int sz = 0; inline void Update(int x, int l, int r) { if (l == r) return; int lc = (x << 1), rc = lc + 1; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; ; vector<int> v(n); long long x = 0; for (int i = 0; i < n; i++) { char x; cin >> x; if ((x - 0 ) % 2 == 0) { v.push_back(i + 1); } } for (int i = 0; i < v.size(); i++) { ...
#include <bits/stdc++.h> using namespace std; long long a[1000005]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { scanf( %lld , &a[i]); } sort(a + 1, a + 1 + n); int x = 1; int y = n; long long ans = 0; while (x < y) { ans += abs(a[y] ...
#include <bits/stdc++.h> using namespace std; int cmpint(const void *a, const void *b) { if (((int *)a)[0] == ((int *)b)[0]) return ((int *)a)[1] - ((int *)b)[1]; return ((int *)a)[0] - ((int *)b)[0]; } int prim[500005] = {0}; bool isprim[5000005] = {0}; int prim_len; void count_prim() { int i...
#include <bits/stdc++.h> using namespace std; bool a[2000][2000], b[2000][2000], c[2000][2000]; int n, m; void jian() { memcpy(c, b, sizeof(b)); for (int i = 1; i < n - 1; i++) { for (int j = 1; j < m - 1; j++) { if (!b[i + 1][j] || !b[i][j + 1] || !b[i - 1][j] || !b[i][j - 1]) c...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; using iii = tuple<int, int, int>; using vi = vector<int>; int main(void) { ios::sync_with_stdio(false), cin.tie(NULL); int n; cin >> n; vector<iii> a(n); int maxr = 0, i = 0; for (auto &[r,...
#include <bits/stdc++.h> using namespace std; vector<int> x; int modulo_sum(int a, int b) { return ((a % 1000000007) + (b % 1000000007)) % 1000000007; } int modulo_subtract(int a, int b) { return ((a % 1000000007) - (b % 1000000007)) % 1000000007; } int modulo_mult(int a, int b) { return ((long lo...
#include <bits/stdc++.h> template <typename T> void MACRO_VAR_Scan(T& t) { std::cin >> t; } template <typename First, typename... Rest> void MACRO_VAR_Scan(First& first, Rest&... rest) { std::cin >> first; MACRO_VAR_Scan(rest...); } template <typename T> void MACRO_VEC_ROW_Init(int n, T& t) ...
#include <bits/stdc++.h> template <class T> bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; } template <class T> bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; } using namespace std; const long long MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0)...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (a == 0) { return b; } else { return gcd(b % a, a); } } int main() { int l_a, r_a, t_a; int l_b, r_b, t_b; int l_x, r_x, t_x; cin >> l_a >> r_a >> t_a; cin >> l_b >> r_b >> t_b; if (r_b - l_b...
#include <bits/stdc++.h> using namespace std; const int N = 4e5 + 7, M = 20; char g; struct tree { int a, b, c, t; } tr[N << 1]; struct edge { int a, b; } ed[N], edg[N]; set<int> hig[N]; map<int, int> s[N]; int n, m, k, siz, res, tota, totb, lint, themin, w[N], fa[N], fb[N], st[N], dep...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int intcmp(const void *v1, const void *v2) { return *(int *)v1 - *(int *)v2; } inline int read() { int x = 0, f = 1; char cc = getchar(); while (cc < 0 || cc > 9 ) { if (cc == - ) f = -1; cc = getchar(); } ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, s = 0; scanf( %I64d , &n); while (n > 0) { if (n % 8 == 1) s++; n /= 8; } printf( %I64d , s); return 0; }
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Iztok Jeras. // SPDX-License-Identifier: CC0-1.0 //bug991 module t (/*AUTOARG*/); logic [31:0] array_assign [3:0]; logic [31:0] array_other [3:0]; logic [31:0] larr...
// // Copyright 2011 Ettus Research LLC // // 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, either version 3 of the License, or // (at your option) any later version. // // This program is dis...
/** * 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; #include<algorithm> #include<map> #include<fstream> #define ll long long #define ld long double #define pb push_back #define fi first #define se second #define endl n #define For(i,n) for(long long i=0; i<n; i++) #define FOR(i,f,l) for(long long i=...
#include <bits/stdc++.h> using namespace std; int dp[1 << 20]; int arr[][5] = {{1, 2, -1}, {2, -1}, {-1}, {4, 5, 6, -1}, {5, 6, -1}, {6, -1}, {-1}, {8, 9, 10, 11, -1}, {9, 10, 11, -1}, {10, 11, -1}, {11, -1}, {-1}, {13, 14, 15, -...
///////////////////////////////////////////////////////////////////// //// //// //// FIFO 4 entries deep //// //// //// //// Authors: Rudolf Usselmann, Richard ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int INF = INT_MAX; const int MAX = 4e6 + 5; const int N = 1e5 + 5; long long dx[] = {-1, 0, 1, 0, -1, -1, 1, 1}; long long dy[] = {0, 1, 0, -1, -1, 1, 1, -1}; char dir[] = { U , R , D , L }; long long power(long long a, lo...
// $Id: rtr_flow_ctrl_output.v 5188 2012-08-30 00:31:31Z dub $ /* Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistr...
/** * 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 t, n; string s; int main() { ios_base::sync_with_stdio(false); cin >> t; while (t--) { cin >> s; int mask = 0; n = s.size(); int ok100001 = (s[0] == 1 ); for (int i = 1; i + 1 < n; ++i) ok100001 &= (s[i] == 0 ); ...
#include <bits/stdc++.h> using namespace std; char s[60]; int n; long long f[60][10]; int main() { gets(s + 1); n = strlen(s + 1); for (int j = 0; j < 10; ++j) f[1][j] = 1; for (int i = 1; i < n; ++i) for (int j = 0; j < 10; ++j) { int sum = j + s[i + 1] - 48; if (sum & 1...
module CPUcontrol (clk, rst, n, IMR, instr2Load, loadAdx, regWR, Mem2Reg, ALUop, MemWrEn, ALUsrc, writeSel, regAdx1, regAdx2, writeAdx, imd); input clk, rst, n, IMR; input [31:0] instr2Load; input [6:0] loadAdx; output regWR, Mem2Reg, ALUop, MemWrEn, ALUsrc, writeSel; output [4:0] regAdx1, regAdx2, writeAdx; outp...
#include <bits/stdc++.h> using namespace std; int sa[1007], n, t, x, d[1007], s; bool f[1007], c[1007]; int main() { scanf( %d%d , &n, &x); for (int i = 1; i <= n; ++i) { scanf( %d , &t), sa[t] = i; if (t == 0) c[i] = 1; } for (int i = 1; i <= n; ++i) { if (!c[i]) continue; ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of paris // // Generated // by: lutscher // on: Fri Jun 26 13:24:43 2009 // cmd: /tools/mix/1.9//mix_1.pl -vinc global_project.i -nodelta LP-blue-pin-list.xls LP-paris-pin-list.xls LP-reallity-pin-list...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; long long n, m, l, r, a[N], b[N], dp[N]; void prework() { int k = 1; for (int i = 2; i <= n; ++i) if (a[i + 1] - a[i] > a[k + 1] - a[k]) k = i; r = a[k + 1] - a[k] - 1; for (int i = 1; i <= n; ++i) b[i] = a[i + k]; in...
#include <bits/stdc++.h> using namespace std; const long long INF = 1 << 28; const long long LINF = 1ll << 61; const long long mod = 1e9 + 7; long long kissme(long long x, long long t) { long long ans = 1; while (t > 0) { if (t & 1) ans = ans * x % mod; x = x * x % mod; t >>= 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...
module MemoryArbitrator(input MemoryUseOne, //1 input MemoryWriteOne, input [15:0] MemoryAdrOne, input [15:0] MemoryWriteDataOne, input MemoryUseTwo, //2 input MemoryWriteTwo, input [15:0] MemoryAdrTwo, input [15:0] MemoryWriteDataTwo, input MemoryUseThree...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2003 Matt Ettus // // 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; either version 2 of the License...
/* * 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...
/***************************************************************************** * File : processing_system7_bfm_v2_0_5_ocm_mem.v * * Date : 2012-11 * * Description : Mimics OCM model * *****************************************************************************/ `timescale 1ns/1ps module processing_system7_bfm...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; int num2 = {}, num3 = {}; while (n % 2 == 0) { n /= 2; num2++; } while (n % 3 == 0) { n /= 3...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Frequency_To_Volts.v // Created: 2014-09-08 14:12:04 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // ----------------------------------------------------------...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2010 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. // SPDX-License-Identifier: LGPL-3.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; int main() { int t; cin >> t; while (t--) { long long int n; cin >> n; cout << n << endl; } }
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long n, m; char s[111111], t[111111]; bool ar[111111]; long long fail[111111], f[111111], ff[111111], dp[111111]; void kmp() { int i = 0, j = -1; fail[0] = -1; while (i < m) { while (j > -1 && t[i] != t[j])...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: // Design Name: // Module Name: GDA_St_N8_M8_P3 // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: //...
`define ADDER_WIDTH 013 `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; int dx[] = {-2, -1, 1, 2, -2, -1, 1, 2}; int dy[] = {-1, -2, -2, -1, 1, 2, 2, 1}; template <class T> inline T biton(T n, T pos) { return n | ((T)1 << pos); } template <class T> inline T bitoff(T n, T pos) { return n & ~((T)1 << pos); } template <...
#include <bits/stdc++.h> int main() { int n, p, q; scanf( %d %d %d , &n, &p, &q); char word[n + 1]; scanf( %s , word); if (n == p + q) { printf( 2 n ); for (int i = 0; i < p; ++i) { printf( %c , word[i]); } printf( n ); for (int i = p; i < n; ++i) { p...
/** * 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 law...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2020 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 typedef enum bit[15:0] { ONE = 3, TWO = 5, THREE = 8, FOUR = 13 } Enum; typedef struct p...