text
stringlengths
59
71.4k
`include "cpu_data.v" module Decoder( word, operator_group, operator, rg1, rg2, val, flags, relative_addr); input [15:0] word; output [3:0] operator; output reg [3:0] operator_group; output [2:0] rg1, rg2; output [7:0] val; output [7:0] flags; output [9:0]...
#include <bits/stdc++.h> using namespace std; int const N = 1000000; int n, m; vector<vector<pair<int, int> > > adj; bool valid; int ans[N]; int cnt; int st[N * 3]; void readin() { int u, v; char b[10]; scanf( %d%d , &n, &m); valid = true; adj.clear(); adj.resize(n + 1); fo...
#include <bits/stdc++.h> const long long MOD = 1000000007, HMOD = 1234321237, HBAS = 23333, HIBAS = 1116618209; int N, K; char a[2002], b[2002], c[2002]; long long POW[2002], IPOW[2002], HA[2002], HB[2002], HC[2002], HIA[2002], HIB[2002]; long long aemp[2002][2002], bemp[2002][2002], a...
#include <bits/stdc++.h> using namespace std; int countDigit(long long n) { int count = 0; while (n != 0) { n = n / 10; ++count; } return count; } int main() { long long int t; cin >> t; while (t--) { int k, s; cin >> s; int n = s % 10, ans; k = co...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 10; const int inf = 0x3f3f3f3f; long long mod = 998244353; pair<int, int> a[maxn]; int n, len; long long aa, b, c, d, sta; int check(int x) { long long tmp = sta; for (int i = 1; i <= n; i++) { if (a[i].second) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[1000]; int m = 0; for (int i = 0; i < n; i++) { cin >> a[i]; m = max(m, a[i]); } for (int i = 1; i <= m; i++) { for (int j = 0; j < n; j++) a[j]--; bool f[1000]; f[0] = (a[0] >...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[k]; for (int i = 0; i < k; i++) cin >> a[i]; list<int> leader; for (int i = 1; i <= n; i++) leader.insert(leader.end(), i); int l = 1; int i = 0; int begin = 0; while (k--) { l = (...
/* Distributed under the MIT license. Copyright (c) 2011 Dave McCoy () Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, mo...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long lcm(long long a, long long b) { return a * b / gcd(a, b); } struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; ...
#include <bits/stdc++.h> using namespace std; const int N = 210000, K = 60; int n, k, p; int a[N], sum[N], f[N][K]; int main() { scanf( %d%d%d , &n, &k, &p); for (int i = 1; i <= n; i++) scanf( %d , &a[i]), sum[i] = (sum[i - 1] + a[i] % p) % p; memset(f, -0x3f, sizeof(f)); f[0][0] = 0; ...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
#include <bits/stdc++.h> #pragma optimize( O3 ) using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e9 + 7; const int base = 2e5 + 1; const int MAX = 1e5 + 2; const double EPS = 1e-9; const double PI = acos(-1.); const int MAXN = 1e6 + 47; mt19937 rng(chrono::steady_clock::now...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int f = n * 1.0 / 3 + 0.5; cout << f / 12 << << f % 12 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; const double PI = acos(-1.0); const long long EPS = (1e-10); const long long N = 1e5 * 2 + 10; const long long inf = 1e9 * 2 + 10; const ll INF = 1e18 * 2 + 10; const long long...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:30:32 05/09/2017 // Design Name: axi_spi_if // Module Name: E:/University/AXI_SPI_IF/ise/axi_spi_test_registers.v // Project Name: axi_spi_if // Target ...
`timescale 1ns/1ps `define TEST2 module test_bench; function integer log2; input integer number; begin log2=0; while(2**log2<number) begin log2=log2+1; end end endfunction // log2 wire [255:0] user_buffer_data; wire user_data_available; wire user_read_buffer; ...
#include <bits/stdc++.h> using namespace std; int n, a, b; char str[100005]; int main() { scanf( %d %d %d , &n, &a, &b); scanf( %s , str + 1); if (str[a] == str[b]) { puts( 0 ); return 0; } puts( 1 ); }
// megafunction wizard: %LPM_RAM_DP+% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: dpram_128_32x32_be.v // Megafunction Name(s): // altsyncram // ============================================================ /...
#include <bits/stdc++.h> using namespace std; int main() { int m, x, y, a[1005] = {0}, b[1005] = {0}; cin >> m; for (int i = 1; i <= m; i++) { cin >> x >> y; a[x]++; a[y]++; } for (int i = 1; i <= 5; i++) if (a[i] != 2) { cout << WIN ; return 0; } ...
`define WIDTH_P 2 `include "bsg_defines.v" /**************************** TEST RATIONALE ******************************* 1. STATE SPACE The output of the function is undefined if there is more than a single 1 bit set in the function, so that fortunately limits the state space that needs to be tested, and mean...
#include <bits/stdc++.h> using namespace std; int a[1010][1010]; int mapa[1010][1010]; int n, m; int TIME = 0; bool ok(int val) { for (int i = 0; i < n; i++) { vector<int> row; for (int j = 0; j < m; j++) { if (a[i][j] >= val) row.push_back(j); } for (int first = 0; first...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int n, a[100000], s = 0, nz = 0; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (int i = 0; i < n; i++) { if (a[i] == a[i + 1] && a[i] != 0) s++; if (a[i] == 0) nz++; } cout << n - s - nz << en...
#include <bits/stdc++.h> using namespace std; int main() { long int n; cin >> n; int a[n], b[n], i; for (i = 0; i < n; ++i) cin >> a[i] >> b[i]; for (i = 0; i < n; ++i) { if (a[i] != b[i]) break; } if (i == n) { for (i = 1; i < n; ++i) { if (a[i] <= a[i - 1]) ...
#include <bits/stdc++.h> using namespace std; vector<int> primes; void sieve() { vector<int> a(1000000, 0); for (int u = 2; u <= 1000000; u++) { if (a[u]) continue; for (int i = 2 * u; i <= 1000000; i += u) a[i] = u; } for (int i = 2; i <= 1000000; i++) { if (!a[i]) primes.push_b...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long a[14], tmp[14]; for (long long i = 0; i < 14; i++) cin >> a[i]; long long anss = 0; for (long long i = 0; i < 14; i++) { for (long long j = 0; j < 14; j++) tmp[j] = a[j...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.length(); int m; cin >> m; int a[m]; for (int i = 0; i < m; i++) { cin >> a[i]; } sort(a, a + m); for (int i = 0; i * 2 < s.size(); i++) { int pos = upper_bound(a, a + m, i + ...
//----------------------------------------------------------------------------- // (c) Copyright 2012 - 2013 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual proper...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> angles(n); for (int i = 0; i < n; i++) { int angle; cin >> angle; angles[i] = angle; } int difference = 360; for (int i = 0; i < n; i++) { int current_angle = angles[i]; ...
module tx_packer ( //FX2 Side input bus_reset, input usbclk, input WR_fx2, input [15:0]usbdata, // TX Side input reset, input txclk, output reg [31:0] usbdata_final, output reg WR_final); reg [8:0] write_count; /* Fix FX2 bug */ always @(posedge usbclk) begin if(bus_r...
#include <bits/stdc++.h> using namespace std; long long n, m; vector<vector<long long> > a, b, orig; bool swapd = false; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> m; orig.resize(n); for (long long i = 0; i < n; i++) { orig[i].resize...
(* Definitions of configuration options. *) (* Use these types to instantiate the configuration type classes below. *) Inductive Yes : Type := yes. Inductive No : Type := . (* Each configurable feature is represented by a type class which contains a type. To turn on a configuration, provide a type class insta...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int Tests = 1; while (Tests--) { long long int N; cin >> N; vector<long long int> A(N); for (long long int i = 0; i < N; i++) cin >> A[i]; if (N == 1) 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 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> const int oo = 0x3f3f3f3f; template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; } template <typename T> inline bool chkmin(T &a, T b) { return a > b ? a = b, true : false; } template <typename T> T read(T &first) { int f = 1; ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5 * 100 * 1000 + 14; vector<int> comp[MAXN], adj[MAXN]; set<int> res; int ans = 0; void dfs(int v) { comp[ans].push_back(v); auto it = res.begin(); while (it != res.end()) { if (find(adj[v].begin(), adj[v].end(), *it) == adj[v]...
#include <bits/stdc++.h> using namespace std; const long long INF = 0x3f3f3f3f; const int N = 2e5 + 10; const long long mod = 1e9 + 7; const bool debug = false; int F[N], Finv[N], inv[N]; void init() { inv[1] = 1, F[0] = Finv[0] = 1; for (int i = 2; i < N; i++) inv[i] = (mod - mod / i) * 1ll...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; int div[] = {1, 2, 3, 4, 6, 12}; while (t--) { string s; cin >> s; vector<pair<int, int> > dimen; int n, m; int i, j, k; for (k = 0; k < 6; k++) { n = div[k]; m = 12 / 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...
/** * 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() { string s; getline(cin, s); bool in_quotes{false}; string sub; vector<string> vec; for (int i{}; i < s.size(); ++i) { if (s[i] == ) { if (!in_quotes) { in_quotes = true; if (!sub.empty()) vec.push_...
module rgb2hsv ( input clk, input res, input read, input [15:0] data, output [4:0] saturation, output [4:0] value, output [8:0] hue, output reg hue_invalid, output reg done ); parameter DIVLATENCY = 4'h8; parameter FETCH = 3'h0, COMPARE = 3'h1, DIVSET = 3'h2, DIVIDE = 3'h3, HUE = 3'h4; wir...
#include <bits/stdc++.h> using namespace std; int mod = 1e9 + 7; struct node { long long x, l, r; } a[10005]; long long b[20005]; int is[20005][4], ed[20005][4]; int l = 2; struct Matrix { long long v[3][3]; Matrix() { memset(v, 0, sizeof(v)); } Matrix operator*(const Matrix B) { M...
#include <bits/stdc++.h> using namespace std; int f[1005][1005], s[1005][1005]; int n, k, a[1005], ans; inline int X(int x) { for (int i = 1; i <= k; i++) for (int j = 1; j <= n; j++) f[i][j] = s[i][j] = 0; for (int i = 1; i <= n; i++) f[1][i] = 1; for (int i = 1; i <= k; i++) { int l = ...
`timescale 1 ns / 1 ns ////////////////////////////////////////////////////////////////////////////////// // Company: Rehkopf // Engineer: Rehkopf // // Create Date: 01:13:46 05/09/2009 // Design Name: // Module Name: address // Project Name: // Target Devices: // Tool versions: // Description: Address logic w/ S...
#include <bits/stdc++.h> using namespace std; const int N = 2e6 + 10; int mod = 1e9 + 7; long long power(long long a, long long b) { long long res = 1; while (b) { if (b & 1) res = res * a % mod; a = a * a % mod; b >>= 1; } return res; } long long INV(long long a) { return ...
#include <bits/stdc++.h> using namespace std; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << [ << *it << = << a << ] ; err(++it, args...); } template <typename Tk, typename Tv> ostream& o...
#include <bits/stdc++.h> using namespace std; vector<int> cc[100000]; int num[100000]; int main() { int n, k, m; cin >> n >> k >> m; for (int j = 0; j < n; cin >> num[j++]) ; sort(num, num + n); for (int j = 0; j < m; cc[j++].clear()) ; cc[0].push_back(0); for (int j = 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 lis(vector<int>& a) { if (a.empty()) return 0; int n = a.size(); int INF = 1000; vector<int> b(n + 1, INF); b[0] = -INF; for (int i = 0; i < n; ++i) { int val = a[i]; int pos = upper_bound(b.begin(), b.end(), val) - b.begin(); ...
#include <bits/stdc++.h> using namespace std; long long PosMod(long long a) { return a >= 0 ? a : a + 998244353; } long long AddMod(long long a, long long b) { return PosMod((a + b) % 998244353); } long long MultMod(long long a, long long b) { return PosMod((a * b) % 998244353); } long long powll(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef string str; #define pb push_back #define ppp pop_back #define pii pair<int,int> #define fi first #define se second #define stie std::tie #define vec vector #define forn(i, l, r) for (int i=l; i...
#include <bits/stdc++.h> using namespace std; const long long INF = 0x1fffffffffffffff; const double INFD = 1e20; const double EPS = 1e-9; const double PI = atan(1) * 4; const long long M = 998244353; long long mod(long long x) { return ((x % M) + M) % M; } long long add(long long a, long long b) { retu...
#include <bits/stdc++.h> using namespace std; void smain(); int main() { ios_base::sync_with_stdio(0); cout.precision(12); cout << fixed; smain(); return 0; } int n; int ans[1000001]; int f[1000001]; inline int sum(int r) { int result = 0; for (; r >= 0; r = (r & (r + 1)) - 1...
#include <bits/stdc++.h> using namespace std; int n, T, a[200010], x, y, d[200010], q[200010], l, r; vector<int> v[200010], Q; int main() { scanf( %d , &T); while (T--) { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]), a[i] = 2 - a[i], v[i].clear(); for (int i...
#include <bits/stdc++.h> using namespace std; const long long oo = 1000000000000000000LL; const int N = 100005; vector<pair<int, int>> ds; long long data[2][100005]; int x[N], p[N], c[N], st[N]; long long val[N]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int x; string y, z; cin >> x >> y >> z; if (z[0] == w ) { int fd = 5, ans = 0; for (int i = 1; i <= 366; ++i) { if (fd == x) ans++; fd++; if (fd == 8) fd = 1; } ...
#include <bits/stdc++.h> using namespace std; string s; int n; long long ans; vector<int> ls, rr; long long cal(int l, int r) { long long val = 0; long long tmp = s[l] - 0 ; for (int i = l + 1; i < r; i += 2) { if (s[i] == * ) tmp *= s[i + 1] - 0 ; else { val += tm...
#include <bits/stdc++.h> using namespace std; int T, arr[100005], a, b, ans; int cal(int v) { int vv = v * (v - 1); return (vv >> 1); } int main() { cin >> T; for (int i = 1; i < T; i++) { cin >> a >> b; arr[a]++; arr[b]++; } for (int i = 1; i <= T; i++) { if (a...
// -- (c) Copyright 2010 - 2011 Xilinx, Inc. All rights reserved. // -- // -- This file contains confidential and proprietary information // -- of Xilinx, Inc. and is protected under U.S. and // -- international copyright and other intellectual property // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not a...
#include <bits/stdc++.h> using namespace std; long long int n; long long int ppow(long long int i, long long int j) { if (i >= 998244353) i %= 998244353; long long int res = 1LL; while (j) { if (j & 1LL) { res *= i; if (res >= 998244353) res %= 998244353; } i *= i; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c = 0; cin >> n; while (n) { cin >> a >> b; if (b > a + 1) c += 1; n--; } cout << c; }
#include <bits/stdc++.h> using namespace std; int ans[3][1010], dp[3][1010][55][55]; int n, p, k, r, s, x; int teto(int a, int b) { return (a + b - 1) / b; } int main() { while (scanf( %d %d %d , &n, &p, &k) != EOF) { memset(ans, 0, sizeof(ans)); scanf( %d , &r); for (int i = 0; i < r; i...
/* * Copyright (c) 2002 Stephen Williams () * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_108x256.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ==============================...
#include <bits/stdc++.h> using namespace std; int dx[] = {0, 0, -1, 1}; int dy[] = {-1, 1, 0, 0}; const int mod = 1000000007; const int INF = 1000000010; int n; char S[5020]; int L[5010]; int C[5010]; int RV; pair<int, int> RM; int lookup[5010]; int val[5010][15]; int hp[5010][5010]; int H...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: c2i_sdp.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/or //...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 50; const int mod = 1e9 + 9; long long qpow(long long a, long long b) { long long base = a; long long ans = 1; while (b) { if (b & 1) { ans = (ans * base) % mod; } base = (base * base) % mod; b = b >...
/************************************************ * * * Derek Prince * * ECEN 2350: Digital Logic * * 2n-bit Comparator on the terasiC DE0 board * * Altera Cyclone 3 EP3C16F484 * * ...
#include <bits/stdc++.h> using namespace std; int main() { cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit); int n; cin >> n; vector<long long> a(n); long long s = 0; for (int i = 0; i < n; i++) { cin >> a[i]; s += a[i]; } sort(a.begin(), a.end()); ...
`timescale 1 ps / 1 ps module onetswitch_top( inout [14:0]DDR_addr, inout [2:0]DDR_ba, inout DDR_cas_n, inout DDR_ck_n, inout DDR_ck_p, inout DDR_cke, inout DDR_cs_n, inout [3:0]DDR_dm, inout [31:0]DDR_dq, inout [3:0]DDR_dqs_n, inout [3:0]DDR_dqs_p, inout DDR_odt, inout DDR_ras_n...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; inline long long sub(long long &a, long long b) { a -= b; if (a < 0) { a += MOD; } } inline long long mult(long long a, long long b) { return (a * 1ll * b) % MOD; } inline long long b_pow(long long a, long long p)...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: dram_pad_logic.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 an...
/* Copyright (c) 2014-2016 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
#include <bits/stdc++.h> using namespace std; int a[200009]; int s1[200009]; int s2[200009]; int id1[200009]; int id2[200009]; int main() { int n; cin >> n; for (int i = 1; i <= 2 * n; ++i) id1[i] = -1; for (int i = 1; i <= 2 * n; ++i) id2[i] = -1; for (int i = 0; i < n; ++i) { c...
// ============================================================================ // Copyright (c) 2010 // ============================================================================ // // Permission: // // // // Disclaimer: // // This VHDL/Verilog or C/C++ source code is intended as a design reference ...
module ZedBoardWrapper(input clk, input reset, output csr_AWREADY, input csr_AWVALID, input [31:0] csr_AWADDR, input [2:0] csr_AWPROT, output csr_WREADY, input csr_WVALID, input [31:0] csr_WDATA, input [3:0] csr_WSTRB, input csr_BREADY, output csr_BVALID, output[1:0] csr_B...
#include <bits/stdc++.h> using namespace std; typedef struct { int op, l, r, x, y; } query; int n, m, seed, vmax, a[100000]; query qs[100000]; int rnd() { int ret = seed; seed = (1LL * seed * 7LL + 13LL) % 1000000007LL; return ret; } long long get_num(map<int, long long>& mp, int 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; int a, b, c, d, arr[200001], arr2[200001], e, f, g, mn = 1e9, ans, sum, ct, t, ct2, mx, sum2; bool kk; int main() { cin >> a; for (int i = 0; i < a; i++) { cin >> arr[i]; sum += arr[i]; } ...
////////////////////////////////////////////////////////////////// // // // Multiplication Module for Amber 25 Core // // // // This file is part of the Amber project ...
#include <bits/stdc++.h> using namespace std; int fa[100010]; int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); } bool merge(int x, int y) { int f1 = find(x), f2 = find(y); if (f1 == f2) return false; fa[f2] = f1; return true; } int main() { int n, k; scanf( %d %d , &n, ...
`timescale 1ns / 1ps /*********************************************************************************************************************** * * * ANTIKERNEL v0.1 ...
#include <bits/stdc++.h> using namespace std; template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; } template <class c> auto dud(c *x) -> decltype(cerr << *x, 0); template <class c> char dud(...); struct debug { ~debug() { cerr <...
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; vector<int> v; map<int, int> mp; int main() { ios::sync_with_stdio(0); int T; cin >> T; while (T--) { string s1, s2; cin >> s1 >> s2; reverse(s1.begin(), s1.end()); reverse(s2.begin(), s2.end()); ...
/* Legal Notice: (C)2009 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...
#include <bits/stdc++.h> using namespace std; int arr[100001]; int tree[100001 * 3]; void init(int node, int b, int e) { if (b == e) { tree[node] = arr[b]; return; } int Left = node * 2; int Right = node * 2 + 1; int mid = (b + e) / 2; init(Left, b, mid); init(Right, mid ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; void solve() { long long n; cin >> n; vector<long long> v(n); for (long long i = 0; i < n; ++i) { cin >> v[i]; } long long ans = 0; map<long long, long long> mp; for (long long i = 0; i < n; i++) ...
//UART Version 3 /* Distributed under the MIT license. Copyright (c) 2014 Cospan Design LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the ri...
// file: dacclk_mmcm_tb.v // // (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is n...
#include <bits/stdc++.h> using namespace std; long long make(long long n) { if (n % 4 == 3) return 0; if (n % 4 == 0) return n; if (n % 4 == 1) return 1; if (n % 4 == 2) return (n ^ 1); } int main() { long long n; cin >> n; long long i, nim = 0; for (i = 0; i < n; i++) { lo...
#include <bits/stdc++.h> using namespace std; long long arr[1001], ans; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == 0 ) arr[i]++; } cin >> s; for (int i = 0; i < s.size(); i++) { ...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12/13/2015 12:37:17 PM // Design Name: // Module Name: SD_Module_Interface // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies...