text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; char A[3][3], B[3][3]; int main() { scanf( %s , A[0]); scanf( %s , A[1]); scanf( %s , B[0]); scanf( %s , B[1]); string a = A[0], b = B[0]; a += A[1][1]; a += A[1][0]; b += B[1][1]; b += B[1][0]; for (int i = 0; i < a.length(); i...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2020 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-...
#include <bits/stdc++.h> using namespace std; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); const int N = 19; int g[N]; unsigned long long dp[1 << N][N + 1]; unsigned long long ok[1 << N]; unsigned long long slen[N + 1][1 << N]; unsigned long long cur[N + 1][1 << N]; un...
// -*- Mode: Verilog -*- // Filename : uart_tasks.v // Description : UART Tasks // Author : Philip Tracton // Created On : Mon Apr 20 16:12:43 2015 // Last Modified By: Philip Tracton // Last Modified On: Mon Apr 20 16:12:43 2015 // Update Count : 0 // Status ...
/** * 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 a[1000][1000]; int w, h; int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; } int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; } int main() { scanf( %d%d , &h, &w); for (int y = 0; y < h; y++) for...
#include <bits/stdc++.h> using namespace std; const long long int MOD = 1000000007; const long long int ll_MAX = 1e15; long long int fast_expo(long long int x, long long int p) { if (p == 0) return 1; else if (p % 2 == 0) { long long int t = fast_expo(x, p / 2) % MOD; return (t * t) % ...
#include <bits/stdc++.h> using namespace std; vector<int> A; int F(int q, int w, int pr) { if (w - q <= 2) return w - q; int s = q; int g = 0; int ans = 2; while (s < w) { int f = s; int st = 1; while (st <= (A[s] - pr)) st <<= 1; st = pr + (st >> 1); while (f < w...
#include <bits/stdc++.h> const int INF = 1e9 + 7; int ds[100]; int hs[100]; int solve() { int N, X; scanf( %d %d , &N, &X); for (int i = 0; i < N; i++) { scanf( %d %d , &ds[i], &hs[i]); } int last = *std::max_element(ds, ds + N); if (last >= X) return 1; int dec = 0; for (i...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; using pil = pair<int, ll>; using pli = pair<ll, int>; using pll = pair<ll, ll>; const ll MOD = 1e9 + 7; const int inf = (1 << 30) - 1; const ll INF = (1LL << 60) - 1; const ld EP...
#include <bits/stdc++.h> using namespace std; int a, c, d[205], f, n, b, x, i; string s, s1, s11, s12; char i1, i2, j; int main() { cin >> n; for (i = 1; i <= n; i++) { cin >> s1; b = s1.size(); c = c + b; s = s + % ; s = s + s1; } c = c + n - 1; for (i1 = a...
////////////////////////////////////////////////////////////////// // // // Main memory for simulations. // // // // This file is part of the Amber project ...
#include <bits/stdc++.h> using namespace std; int n, m, in[100010], sum1, sum2; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { int x, y; cin >> x >> y; in[x]++; in[y]++; } for (int i = 1; i <= n + 1; i++) if (in[i] == 1) sum1++; else if (in[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...
// (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...
module axi_slave_stub( output S2M_AXI_ACLK, // Read interface input S2M_AXI_ARVALID, output S2M_AXI_ARREADY, input [31:0] S2M_AXI_ARADDR, input [11:0] S2M_AXI_ARID, output S2M_AXI_RVALID, input S2M_AXI_RREADY, output S2M_AXI_RLAST, output [31:0] S2M_AXI_RDATA, output [11:0...
#include <bits/stdc++.h> void print(int n) { if (n == 4) { printf( 1 * 2 = 2 n ); printf( 3 * 4 = 12 n ); printf( 2 * 12 = 24 n ); } else if (n == 5) { printf( 5 * 4 = 20 n ); printf( 3 + 2 = 5 n ); printf( 5 - 1 = 4 n ); printf( 20 + 4 = 24 n ); } } int main(...
// *************************************************************************** // *************************************************************************** // Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved. // // In this HDL repository, there are many different and unique modules, consisting // of...
#include <bits/stdc++.h> using namespace std; long long a[200020]; long long va[200020]; long long b[200020]; long long c[200020]; char ans[200020]; char ansstring[200020]; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); long long n, k; cin >> n >> k; for (int i = 1; i <= n...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, xx; cin >> n >> m >> xx; map<char, long long int> mp; vector<char> v[n]; for (long long int i = 0; i < n; i++) { string s; cin >> s; for (auto j : s) v[i].push_back(j); for (long long int j = 0...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const long long mod = 1e9 + 7; const int inf = 1 << 30; const int maxn = 600500; const double EPS = 1e-7; void solve() { int q; scanf( %d , &q); while (q--) { long long n; scanf( %lld , &n); int a, b; ...
#include <bits/stdc++.h> using namespace std; int n, a, b, k; long long MOD = 1000000007; long long pref[5005][2], dp[5005][2]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> a >> b >> k; for (int i = 0; i < n + 5; i++) { pref[i][0] = pref[i][1] = dp[...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2019 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 `define stop $stop `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got...
/** * 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 ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12:29:32 03/26/2014 // Design Name: // Module Name: mul // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencie...
#include <bits/stdc++.h> using namespace std; string simplify(string s) { string a; for (int i = 0; i < s.length(); i++) { if (isalpha(s[i])) { s[i] = tolower(s[i]); a.push_back(s[i]); } } return a; } int main() { ios::sync_with_stdio(0); cin.tie(NULL); st...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2008 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; reg [63:0] crc; ...
#include <bits/stdc++.h> using namespace std; const int N = 2 * 1e6; int a[N]; int main() { std::ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; ++i) { int tmp; cin >> tmp; a[tmp]++; } int res = 0; for (int i = 0; i < N; ++i) { if (a[i] % ...
/** * bsg_nonsynth_non_blocking_dma_model.v * * There is nothing non-blocking about the DMA model, * Rather this is only to be used with bsg_cache_non_blocking. * */ module bsg_nonsynth_non_blocking_dma_model import bsg_cache_non_blocking_pkg::*; #(parameter `BSG_INV_PARAM(addr_width_p) ,parameter `B...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e18; const long long MAX = 100100; void pre() {} void solve() { long long n; cin >> n; vector<long long> p(n), c(n); for (long long i = 0; i < n; ++i) cin >> p[i] >> c[i]; for (long long i...
#include <bits/stdc++.h> using namespace std; int n, k, dp[2000 + 10][2000 + 10]; bool v[2000 + 10][2000 + 10]; vector<int> vec[2000 + 10]; int solve(int curr, int kk) { if (kk > k) return 0; if (kk == k) return 1; if (v[curr][kk]) return dp[curr][kk]; for (int i = 0; i < vec[curr].size(); i++...
///////////////////////////////////////////////////////////// // Created by: Synopsys DC Ultra(TM) in wire load mode // Version : L-2016.03-SP3 // Date : Sun Nov 20 02:48:27 2016 ///////////////////////////////////////////////////////////// module LOAGDA_St_N16_M4_P8 ( in1, in2, res ); input [15:0] in1; in...
#include <bits/stdc++.h> using namespace std; long long n, a, b; int main() { cin >> n; a = (n + 2) * (n + 1) / 2 * n / 3; b = (n + 4) * (n + 3) / 2 * (n + 2) / 3 * (n + 1) / 4 * n / 5; cout << a * b; }
#include <bits/stdc++.h> using namespace std; int main() { string s, t; getline(cin, s); getline(cin, t); int x = -1, y = -1; for (int i = 0, j = 0; j < t.length(); j++) { i += s[i] == t[j]; if (i == s.length()) { x = j; break; } } for (int i = s.length(...
#include <bits/stdc++.h> int main() { int num; scanf( %d , &num); int res = 0; for (int i = 0; i < num; i++) { char shape[30]; scanf( %s , shape); switch (shape[0]) { case T : res += 4; break; case C : res += 6; break; ...
// ************************Declaration*************************************** // // File name: decoders38.v // // Author: firedom // // ...
#include <bits/stdc++.h> using namespace std; int a[1000004]; int main(void) { int n; scanf( %d , &n); int s = 1000000 + 1; printf( %d n , n); int p = 0; for (int i = 0; i < n; i++) { int t; scanf( %d , &t); a[t] = 1; if (a[s - t] == 1) p++; } for (int i = 1...
#include <bits/stdc++.h> using namespace std; int n; string queue_[6] = { , Sheldon , Leonard , Penny , Rajesh , Howard }; int main() { cin >> n; double count = 1; bool used = false; while (count * 5 < n) { n -= count * 5; count *= 2; used = true; } int x = ceil(n...
/** * 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; bool good(long long int a, long long int b) { while (a and b) { if (a % 2 == 0 and b % 2 == 1) return false; a /= 2; b /= 2; } return true; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; ...
/** * 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 N = 1e5 + 5; long long n; long long nim[N], prefnim[N]; vector<pair<long long, long long> > sum[N]; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; cin >> n; for (long long 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 law...
#include <bits/stdc++.h> using namespace std; int a[100005]; map<int, int> s; int main(void) { long long ans = 0, z = 0; int k, b, n; scanf( %d%d%d , &k, &b, &n); int zcnt = 0; s[0]++; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); zcnt = (a[i] ? 0 : zcnt + 1); z +=...
/* * 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 (c) 2015 by Semillero ADT. // -------------------------------------------------------------------- // // -------------------------------------------------------------------- // // web: https://sites.google.com/site...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int t; cin >> t; while(t--) { string s; cin >> s; char c = a ; int n = s.size(); if(n&1) { for(int i=0;i<=n/2;i++) { if(s[n-i-1...
#include <bits/stdc++.h> using namespace std; const long long inf = (1ll << 60); int n, k, p; int a[2005], b[2005]; long long dp[2005][2005]; long long rec(int pos, int key) { if (pos == n) { return 0; } if (key == k) return inf; long long &ret = dp[pos][key]; if (ret != -1) return...
/** * 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 k, n, ch = 0; string s, g; cin >> n >> k >> s; for (int i = 1; i <= n && ch == 0; i++) { string t = s.substr(0, i); string temp = 0 ; int count; (n % i == 0) ? count = n / i : count = (n / i) + 1; for (int...
/** * 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 linked_fifo_gold(rst, clk, push, push_fifo, pop, pop_fifo, d, q, empty, full, count); parameter WIDTH = 8; parameter DEPTH = 32; parameter FIFOS = 8; parameter FIFO_LOG2 = log2(FIFOS-1); parameter DEPTH_LOG2 = log2(DEPTH-1); input rst, clk, push; input [FIFO_LOG2-1:0] push_fifo; i...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int n, m; struct node { int from, to, w; } edge[maxn]; int in[maxn]; vector<int> e[maxn]; int top[maxn]; bool topsort(int mid) { memset(in, 0, sizeof(in)); int cnt = 0; queue<int> q; for (int i = 1; i <= n; ++...
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0; cin >> n; ans = (n * (n + 1)) / 2; if (ans & 1) cout << 1 << endl; else cout << 0 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { int res[100]; memset(res, 0, sizeof(res)); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { int r; cin >> r; if (i < j) continue; switch (r) { ...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int n, m; char c[2000][2000]; int rowcount[2000]; int colcount[2000], wallcount = 0; for (int i = 0; i < 2000; i++) { rowcount[i] = 0; colcount[i] = 0; } scanf( %d , &n); scanf( %d , &m...
module tester; reg rrst; reg [88:0] rsetup_data; reg [1047:0]rdata; reg [23:0] rtoken; reg [31:0] rsync2; reg [7:0] rsync; wire [1047:0]wdata_out; wire [7:0]wtoken_out; reg [4:0] crc_cero =0; wire [4:0] sum_crc; reg [10:0] rtoken_mensaje; reg [7:0]pid ; reg [7:0]pid2 ; reg [6:0]addr ; reg [63:0]setup_mesage; ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_e_e // // Generated // by: wig // on: Tue Mar 30 18:39:52 2004 // cmd: H:\work\mix_new\MIX\mix_0.pl -strip -nodelta ../../autoopen.xls // // !!! Do not edit this file! Autogenerated by MIX !!! ...
#include <bits/stdc++.h> using namespace std; vector<vector<int> > adj(601); vector<int> unvisited, even, odd; int d[601], parent[601]; bool visited[601]; map<vector<int>, int> M; void RemoveFromUnvisited(int v) { int i = 0; for (; i < unvisited.size() && unvisited[i] != v; ++i) ; unvisi...
/* ****************************************************************************** * File Name : tb_ada_core.v * Project : ADA processor * Version : 0.1 * Date : Sept 2nd, 2014 * Author : Angel Terrones <> * * Disclaimer : Copyright (c) 2014 Angel Terrones * ...
// // Wishbone wrapper for seven-segment LED display controller // // Copyright (C) 2015 Andrzej <> // // Redistribution and use in source and non-source forms, with or without // modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above cop...
#include <bits/stdc++.h> using namespace std; void File() { freopen( CF1045H.in , r , stdin); freopen( CF1045H.out , w , stdout); } template <typename T> void read(T &_) { _ = 0; T f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) f = -1; for (; is...
#include <bits/stdc++.h> using namespace std; char mp[1001][1001]; int visit[1001][1001]; int dist[1001][1001]; int N, M; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; bool chk(int x, int y) { return 0 <= x && x < N && 0 <= y && y < M; } void dfs(int x, int y, bool isfirst) { visit[x][y] = 1...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 08:03:21 10/28/2014 // Design Name: // Module Name: uart // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Re...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:102400000,102400000 ) const int MOD = 1e9 + 7; const int N = 1e5 + 7; int n, m, x, L, R; long long pre[N][6]; long long sum[N << 2][6]; int laz[N << 2]; inline void pushup(int rt) { for (int i = int(0); i <= int(5); ++i)...
#include <bits/stdc++.h> using namespace std; int mark[201000 << 2]; int A[201000], n, m; struct ST { int val[2], las, len; void update(ST a, ST b) { b.val[1] -= a.las; b.val[0] += a.las; if (b.len & 1) b.las -= a.las; else b.las += a.las; val[0] = min(a.val...
/** * 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 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...
#include <bits/stdc++.h> using namespace std; const int N = 5e6 + 5; int a, b, c; long long gcd(long long a, long long b, long long& x, long long& y) { if (!b) { x = 0; y = 1; return a; } long long x1, y1; long long d = gcd(b, a % b, x1, y1); x = y1 - (a / b) * x1; y = ...
#include <bits/stdc++.h> using namespace std; template <class T> struct node { T val; T lazy; int l, r; node* left; node* right; node(int l, int r) { this->l = l; this->r = r; this->left = nullptr; this->right = nullptr; } }; template <class T, int SZ> str...
/* * 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 input; vector<int> ret; cin >> input; for (int i = 1; i < input; i += 2) { ret.push_back(i + 1); ret.push_back(i); } if (ret.empty() || ret.size() != input) ret = {-1}; for (auto &d : ret) { cout << d << ...
#include <bits/stdc++.h> using namespace std; const int M = 1e9 + 7; long long gcd(long long a, long long b) { while (b > 0) { long long p = a % b; a = b; b = p; } return a; } long long bexp(long long a, int b) { long long res = 1; while (b > 0) { if (b & 1) res = r...
/** * 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 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; long long a[100005]; deque<long long> q; long long mi[100005]; void add_q(long long ae) { while (!q.empty() && q.back() > ae) q.pop_back(); q.push_back(ae); } void pop_q(long long re) { if (!q.empty() && q.front() == re) q.pop_front(); } void s...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; if (n == 2 || n == 3 || n == 4 || n == 5 || n == 6 || n == 7) cout << 1 << endl; else if (n % 7 == 1) cout << ((n - 1) / 7) + 1 << endl; else ...
#include <bits/stdc++.h> using namespace std; int dp[510][510]; long long MOD; vector<string> v; long long nc2(long long num) { return (num * (num - 1)) / 2; } int recur(int ones, int zeros) { if (ones == 0 and zeros == 0) return 1; if (dp[ones][zeros] != -1) { return dp[ones][zeros] % MOD; ...
`timescale 1ns/1ps module tb_cocotb #( parameter ADDR_WIDTH = 32, parameter DATA_WIDTH = 32, parameter STROBE_WIDTH = (DATA_WIDTH / 8) )( input clk, input rst, //Write Address Channel input AXIML...
#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); } int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n; cin >> n; string s; cin >> s; vector<long long int> col; int zero = 0, o...
// Copyright (c) 2012-2013 Ludvig Strigeus // This program is GPL Licensed. See COPYING for the full license. // CLK is 24Mhz. MCLK is divided by two (12Mhz). 24Mhz divide by 16 produces SCLK. // Divide by 48 produces LRCK. // produce LRCK = 32kHz. We output 16-bit samples, but internally the DAC // is in 24-bit mode....
module memory (inout [31:0] Data, output reg MFC, input MFA, ReadWrite, input [7:0] Address, input wordByte,Reset); //dataOut: bus to return value for Load instruction //dataIn: bus to input value to store fot Store instruction //MFA: memory function active (memory on) //MFC: memory function complete (memory finished)...
#include <bits/stdc++.h> using namespace std; size_t ham_dist(const string &a, const string &b) { size_t ct = 0; for (size_t i = 0; i < a.size(); ++i) if (a[i] != b[i]) ++ct; return ct; } string opp(const string &a) { string r = ; for (size_t i = 0; i < a.size(); ++i) r += (a[i] == ...
//***************************************************************************** // (c) Copyright 2008-2010 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; int n, m; int pos[100010]; int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; bool check(int i, int j) { int x = (i - 1) / m + 1, y = (i - 1) % m + 1; int x2 = (j - 1) / m + 1, y2 = (j - 1) % m + 1; for (int k = 0; k < 4; k++) if (x + dx[k] == x2 &&...
#include <bits/stdc++.h> using namespace std; int sub_tern(int c, int a) { int temp_c; int temp_a; int diff; long sum = 0; int three_power = 1; while (c > 0 || a > 0) { temp_c = c % 3; c = c / 3; temp_a = a % 3; a = a / 3; diff = temp_c - temp_a; if (diff ...
#include <bits/stdc++.h> #pragma GCC optimize(3) using namespace std; const int Mod = 1e9 + 7; const int N = 5e5 + 100; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3f; inline long long dpow(long long a, long long b) { long long r = 1, t = a; while (b) { if (b & 1) r = ...
#include <bits/stdc++.h> using namespace std; int dx[4] = {-1, 0, 0, 1}; int dy[4] = {0, -1, 1, 0}; bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { if (a.first == b.first) return a.second < b.second; return (a.first < b.first); } int main() { ios_base::sync_with_stdio(false); ...
/** * 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...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(0), cin.tie(0); ; int n, m; cin >> n >> m; vector<vector<char>> v(n, vector<char>(m)); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> v[i][j]; bool st = 1; in...
#include <bits/stdc++.h> using namespace std; mt19937 rnd(time(0)); const long long N = 3e5 + 7; const long long MOD = 1e9 + 7; long long pw(long long b, long long p) { b %= MOD; long long res = 1; while (p > 0) { if (p & 1) res = res * b % MOD; b = b * b % MOD; p >>= 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...
#include <bits/stdc++.h> using namespace std; int p[100003]; int n; int main() { int i; scanf( %d , &n); if (n == 1) { printf( 1 n ); return 0; } if (n == 2) { printf( -1 n ); return 0; } if (n % 2 != 0) p[n / 2 + 1] = n / 2 + 1; p[1] = 2; p[2] = n; ...
#include <bits/stdc++.h> using namespace std; template <class T> T abs(T x) { return x > 0 ? x : (-x); } template <class T> T sqr(T x) { return x * x; } int a[100000][2]; void save() { printf( -1 n ); exit(0); } const int n = 65536; int tree[57000 * 4 + 10]; int delta[57000 * 4...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2003 by Wilson Snyder. // ====================================================================== module sub ( input clk, input fastclk, input reset_l ); // Example c...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:02:57 01/08/2017 // Design Name: // Module Name: number // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // ...