text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); return 0; } void sd() { int n; cin >> n; n = 2 * n; vector<vector<pair<int, long long>>> adj(n + 1); vector<int> cnt(n + 1, 1); int i;...
#include <bits/stdc++.h> using namespace std; const int N = 100010; string s; int n; int main() { cin >> s; n = s.length(); for (int i = 1; i < n - 1; i++) { if (s[i - 1] == . || s[i] == . || s[i + 1] == . ) continue; int c1 = s[i - 1] - A + 1; int c2 = s[i] - A + 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 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...
// (C) 2001-2019 Intel Corporation. All rights reserved. // Your use of Intel Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files from any of the foregoing (including device programming or simulation // files), and any associated ...
/** * 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; map<string, int> Map; char str[2200][22]; int p[2200], q[2200]; int main() { int num, n, k1, k2, cnt; char s1[22], s2[22]; while (scanf( %d , &n) != EOF) { memset(p, 0, sizeof(p)); memset(q, 0, sizeof(q)); cnt = 1; num = 0; ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; string s; long long nb, nc, ns, push_back, pc, ps, money, cntb, cntc, cnts, l, r, mid, mb, ms, mc; int main() { ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> s >> nb >> ns >> nc >> push_back >> p...
#include <bits/stdc++.h> using namespace std; const int maxx = 600010; const double pi = acos(-1.0); const double eps = 1e-15; stack<int> h; vector<int> g[maxx]; int t, n, m; int ans = 0, total = 0, sum = 0, cnt = 0; int a[maxx], bj[maxx], vis[maxx], dfn[maxx], low[maxx]; char ch[3111]; char c[311...
#include <bits/stdc++.h> using namespace std; const int maxn = 1000 + 5; map<string, int> mat; int fonction(string a, string b, string c) { int x = (mat[b] - mat[a] + 12) % 12; int y = (mat[c] - mat[b] + 12) % 12; int z = (mat[c] - mat[a] + 12) % 12; if (x == 4 && y == 3 && z == 7) return 1; ...
#include <bits/stdc++.h> using namespace std; const int N = 15; const int M = 11005; const int mo1 = 317503; const int mo2 = 1000000007; const int BAS = 2333; const int P = 3000005; int n, m, k, Hash[N], bel[N], tot, matching[M][N][2], temp_matching[N][2], bin[N]; long long ans, jc[N]; vector<...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; vector<int> p; long long dp1[555555]; long long dp2[555555]; long long fp(long long x) { long long ret = 1; long long mul = 2; while (x) { if (x & 1) { ret *= mul; ret %= mod; } mul *= mul; ...
//----------------------------------------------------------------------------- // Pretend to be an ISO 14443 tag. We will do this by alternately short- // circuiting and open-circuiting the antenna coil, with the tri-state // pins. // // We communicate over the SSP, as a bitstream (i.e., might as well be // unframed,...
#include <bits/stdc++.h> using namespace std; unsigned long long l, r, x, y; unsigned long long gcd(unsigned long long a, unsigned long long b) { while (b > 0) { unsigned long long t = b; b = a % b; a = t; } return a; } int main() { cin >> l >> r >> x >> y; if (x == y) { ...
#include <bits/stdc++.h> using namespace std; int n, a[200001], b[200001], m; int main() { cin >> n >> m; n = n + m; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); } vector<int> vec; for (int i = 1; i <= n; i++) { scanf( %d , &b[i]); if (b[i] == 1) { vec.push_...
#include <bits/stdc++.h> const int LG = 21; const int N = 1000005; const long long MOD = 1e9 + 7; const long long INF = 1e9; const long long INFLL = 1e18; using namespace std; int cx[4] = {-1, 0, 1, 0}; int cy[4] = {0, -1, 0, 1}; string Yes[2] = { No , Yes }; string YES[2] = { NO , YES }; long l...
#include <bits/stdc++.h> using namespace std; const int MX = 200200, MSK = (1 << 20) - 1; int T, n, m, i, x, y, z, pos, cnt, le, ri, h, fi[MX], lst[MX], s[MX], t[MX], ch[MX], a[18][MX], npw[MX], L[MX], R[MX], A[MX]; priority_queue<long long, vector<long long>, greater<long long>> q; long long seg[MX * 8...
#include <bits/stdc++.h> using namespace std; int main() { string str; cin >> str; int n = str.size(); int fl = 1; vector<char> v; for (int i = 0; i < str.size(); i++) { if (str[i] == / ) { while (str[i] == / ) { i++; } i--; v.push_back( / );...
#include <bits/stdc++.h> using namespace std; long n, m, a, b, ar[200][200], ans; long arp[10000], fl, l; void dfs(long v, long par) { arp[v] = 1; l++; for (int i = 1; i <= n; i++) if (ar[v][i] == 1) { if (i == par) continue; if (arp[i] == 1) { fl = 1; retur...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: ninja2.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // =================================...
//Legal Notice: (C)2018 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 do...
#include <bits/stdc++.h> using namespace std; const int INF = 2e9; FILE* stream; mt19937 rng(1337); void solve() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < int(n); i++) { cin >> a[i]; } vector<int> b(n); for (int i = 0; i < int(n); i++) { if (i % 2) { ...
//////////////////////////////////////////////////////////////////////////////// // // Filename: pipemem.v // // Project: Zip CPU -- a small, lightweight, RISC CPU soft core // // Purpose: A memory unit to support a CPU, this time one supporting // pipelined wishbone memory accesses. The goal is to be able // to issu...
//Legal Notice: (C)2012 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associate...
#include <bits/stdc++.h> using namespace std; long long i, i1, j, k, k1, t, n, m, res, flag[10], a, b, mt[110][110], s; char c; vector<array<long long, 6>> sl; vector<array<long long, 3>> cl; void mv(long long a, long long b, long long c, long long d, long long e, long long f) { sl.push_back({...
/* * 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...
// Double pumped single precision floating point multiply // Latency = 7 kernel clocks // // (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, an...
/** * 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 = 100010, M = 100010, inf = 1e18; long long m, n, p, d[N], a[M], f[M], sum[M], g[M], x[M], y[M]; inline long long read() { char ch = getchar(); long long as = 0, f = 1; for (; ch < 0 || ch > 9 ; ch = getchar()) if (ch == - ) f...
#include <bits/stdc++.h> using namespace std; int nxt[500005], to[500005], head[500005], fa[500005], f[500005][22], dep[500005], ru[500005], tot; bool vis[500005], used[500005]; queue<int> q; vector<int> ei[500005]; void add(int u, int v) { nxt[++tot] = head[u]; head[u] = tot; to[tot] = v;...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2018 Xilinx, Inc. // // 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 // /...
#include <bits/stdc++.h> using namespace std; constexpr int maxn = 2e5 + 10, N = 260, M = 5e6 + 10; constexpr int MAX_INF = 0x3f3f3f3f; int mp[maxn]; int main() { int T; cin >> T; while (T--) { int n, m; scanf( %d%d , &n, &m); int root = 0; memset(mp, 0, sizeof(mp)); ...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Fri Jan 13 17:35:24 2017 // Host : KLight-PC running 64-bit major release (bu...
#include <bits/stdc++.h> using namespace std; const int M = 23e4 + 5; int sum[M], n, fen[M]; int Get(int p) { int u = p; int ans = 0; for (; p > 0; p -= p & -p) ans += fen[p]; for (u++; u < M; u += u & -u) fen[u]++; return ans; } int get(int p) { int cur = 0; for (int i = 17; ~i;...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:41:46 03/26/2015 // Design Name: multiplier // Module Name: /home/vka/Programming/VHDL/workspace/sysrek/martix_multiplier/tb_multiplier.v // Project Name: martix_...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const long long int mod = 1e9 + 7; long double dp[111][11111], ans; long long int a[111], n, k, x; int main(void) { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; i...
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; const int maxm = 100010; struct Arc { int to, next; } arcs[maxm]; int head[maxn], ne, out[maxn], ans[maxn]; inline void add_arc(int u, int v); priority_queue<int> Q; int main() { int n, m, i, u, v, k; while (scanf( %d%d...
#include <bits/stdc++.h> using namespace std; map<string, int> m; int main() { int n; cin >> n; string x, y; for (int i = 0; i < n; i++) { cin >> x >> y; m[y]++; } int t1, t2, temp, temp1; t1 = m[ hard ]; t2 = m[ soft ]; if (t1 > t2) { temp = t1; t1 = t2...
#include <bits/stdc++.h> using namespace std; template <typename T> T cross(complex<T> a, complex<T> b) { return imag(conj(a) * b); } template <typename T> T dot(complex<T> a, complex<T> b) { return real(conj(a) * b); } struct __Query { static bool query; }; bool __Query::query = false; ...
`ifdef __ICARUS__ `define SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST `endif /* * Copyright (c) 2001 Stephan Boettcher <> * * 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 ...
`default_nettype none module thinpad_top(/*autoport*/ //inout base_ram_data, ext_ram_data, flash_data, sl811_data, dm9k_data, //output base_ram_addr, base_ram_be_n, base_ram_ce_n, base_ram_oe_n, base...
#include <bits/stdc++.h> using namespace std; long long arr1[100][10000], arr[10000]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t, i, j, k, n, m, x, y, z, a, b, mx; cin >> t; while (t--) { cin >> n; for (i = 0; i < n; i++) { cin >> arr[i]; ...
#include <bits/stdc++.h> using namespace std; int main() { int i, c, a, b; cin >> a >> b >> c; c -= 1; while (c) { c--; i = a + b; a = b; b = i; } cout << b << endl; }
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014 // Date : Thu May 22 15:29:26 2014 // Host : macbook running 64-bit Arch Linux // ...
#include <bits/stdc++.h> using namespace std; using LL = long long; const int N = 2.5e5; vector<int> adj[N]; int dep[N], par[N]; bool leaf[N]; bool dfs(int u, int p = -1, int d = 1) { if (dep[u] > 0) return false; dep[u] = d; par[u] = p; leaf[u] = true; for (int v : adj[u]) { if ...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); long long n, k; cin >> n >> k; long long ans[6][3] = {0, 1, 2, 1, 0, 2, 1, 2, 0, 2, 1, 0, 2, 0, 1, 0, 2, 1}; cout << ans[n % 6][k] << n ; return 0; }
#include <bits/stdc++.h> using namespace std; int dp[2][2005]; int a[2005]; int cnt2[2005]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i >= 1; i--) { cnt2[i] = cnt2[i + 1]; if (a[i] == 2) cnt2[i]++; } for (int i = 0; i <= 2; i++)...
#include <bits/stdc++.h> int main(int argc, char* argv[]) { int t, cups = 0, medals = 0, n, shelives_needed = 0; for (int i = 0; i < 3; i++) { scanf( %d , &t); cups += t; } for (int i = 0; i < 3; i++) { scanf( %d , &t); medals += t; } scanf( %d , &n); if (cups % 5 !...
module uart_tx #(parameter BAUD_DIV=2, parameter BAUD_DIV_WIDTH=8, parameter W=8) // data width (input c, input [W-1:0] in, input in_en, output in_ack, output out, output busy); // as implemented below, BAUD_DIV must be >= 2. Lower values are ignored. wire tx_r_en, tx_sel; wire [W+1:0] tx; r #(W+2) tx_r (.c(c...
// 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 module t (/*AUTOARG*/ // Inputs clk ); input clk; // packed structures struct packed { logic e...
/* * PCI Express to FIFO - Xilinx ADC interface * Copyright (C) 2014 Harmon Instruments, 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 yo...
/* * Copyright (c) 2001 Stephan Boettcher <> * * 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) *...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Thu May 25 15:18:26 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; long long int n, k; int a[200005]; int main() { int t; scanf( %d , &t); while (t--) { scanf( %d%d , &n, &k); int pos = 0, mn = 1000000000; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); if (i > k && a[i] - a[i - k] <...
//Legal Notice: (C)2017 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int tt; cin >> tt; while(tt--) { int n; cin >> n; vector<int> a(n); for(int i = 0; i < n; i++) { cin >> a[i]; } set<int> s; s.insert(a[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; const int MAXN = 5; const int MAXM = 20; int n, m; int a[MAXN], b[MAXM]; int num[MAXM]; char ans[MAXN][MAXM]; set<int> states[MAXM]; int getState(int mask, int num[MAXM]) { int res = mask; for (int i = 0; i < n; ++i) { res = res * MAXN + num[...
#include <bits/stdc++.h> using namespace std; const int N = 200200; vector<long long int> g[N], e[N]; set<pair<long long int, long long int> > S; int n, m; long long int d[N]; int main() { ios_base::sync_with_stdio(0); cin >> n >> m; for (int i = 1; i <= m; i++) { long long int x, y, z; ...
#include <bits/stdc++.h> const int maxn = 1000010; const int P = 1000000007; int k, w; int f[maxn], g[maxn]; int pow(int x, int y) { int e = 1; while (y) { if (y & 1) e = (long long)e * x % P; x = (long long)x * x % P; y >>= 1; } return e; } int main() { int i, d, t, ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
module busInterface ( input wire [31:0] mem_addr, input wire [31:0] mem_rdata_gpio, input wire [31:0] mem_rdata_uart, input wire [31:0] mem_rdata_uartRx, input wire [31:0] mem_rdata_timer, input wire [31:0] mem_rdata_prng, input wire [31:0] mem_rdata_mem...
#include <bits/stdc++.h> using namespace std; inline char gc() { static char buf[131072], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 131072, stdin), p1 == p2) ? EOF : *p1++; } inline void read(int& x) { x = 0; char c = gc(); while ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; int c[n], w[m]; for (int i = 0; i < n; i++) cin >> c[i]; for (int i = 0; i < m; i++) cin >> w[i]; int res = 0; int j = 0; for (int i = 0; i < n...
#include <bits/stdc++.h> using namespace std; int ar[310]; bool mp[310][310]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> ar[i]; string str; for (int i = 1; i <= n; i++) { cin >> str; for (int j = 0; j < n; j++) if (str[j] == 1 ) mp[i][j + 1] = true...
#include <bits/stdc++.h> using namespace std; inline int gc() { static const int BUF = 1e7; static char buf[BUF], *bg = buf + BUF, *ed = bg; if (bg == ed) fread(bg = buf, 1, BUF, stdin); return *bg++; } inline int ri() { int x = 0, f = 1, c = gc(); for (; c < 48 || c > 57; f = c == - ?...
#include <bits/stdc++.h> using namespace std; int n, l, a[110], s, x, len; int main() { cin >> n >> l; for (int i = 1; i <= n; i++) { cin >> a[i]; if (a[i] > s) s = a[i]; } for (int i = l; i <= s; i++) { for (int j = 1; j <= n; j++) x += a[j] / i; if (len < i * x) len = i *...
#include <bits/stdc++.h> #pragma GCC optimize(3, Ofast , inline ) using namespace std; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); const long long maxn = (long long)1e6 + 5; const long long mod = 998244353; const long long inf = 0x3f3f3f3f; long long T = 1; vector<lon...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1024000000,1024000000 ) using namespace std; const int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; int n, m; int u[N], v[N]; vector<int> G[N]; bool check(int m) { for (int i = 1; i <= n; ++i) G[i].clear(); vector<int> in(n + 1, 0); fo...
module io1_sub (/*AUTOARG*/); /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated-module outputs) wire [w-1:0] pin; // To/From MD31_pad of autoinst_lopaz_srpad.v wire [2*w-1:0] pin_in; // From MD31_pad of autoinst_lopaz_srpad.v, ... wire templated; // To/F...
#include <bits/stdc++.h> std::string input() { static char buf[1000]; scanf( %s , buf); return std::string(buf); } int main() { int inv[5] = {0, 1, 3, 2, 4}; int n, m; std::cin >> n >> m; static int a[500][1000]; for (int i = 0; i < m; i++) { a[i][i + n] = 1; } for (i...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 9; const int MAX1 = 1e6 + 9; const double pi = acos(-1); const long long int inf = 1e9; const long long mod = 1e9 + 7; bool prime[MAX]; int pfactors[MAX]; long long int fact[MAX]; long long int ifact[MAX]; long long int mexp(long ...
// File: FourToSeven.v // Generated by MyHDL 0.8dev // Date: Mon Mar 25 09:12:03 2013 `timescale 1ns/10ps module FourToSeven ( ByteIn, Enable, Polarity, SegOut ); input [3:0] ByteIn; input Enable; input Polarity; output [6:0] SegOut; reg [6:0] SegOut; always @(Polarity, ByteIn, Enable) begin:...
// Copyright (C) 2013 Simon Que // // This file is part of DuinoCube. // // DuinoCube is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later ...
#include <bits/stdc++.h> using namespace std; long long pw(int x, int y, int z) { if (y == 0) return 1 % z; long long a = pw(x, y / 2, z); if (y % 2 == 0) return (a * a) % z; else return (((a * a) % z) * x % z) % z; } int main() { ios_base::sync_with_stdio(false); cin.tie(NUL...
`include "constants.vh" `include "alu_ops.vh" `include "rv32_opcodes.vh" `default_nettype none module exunit_branch ( input wire clk, input wire reset, input wire [`DATA_LEN-1:0] ex_src1, input wire [`DATA_LEN-1:0] ex_src2, input wire [`ADDR_LEN-1:0] pc, input wire [`DATA_LEN-1:0]...
#include <bits/stdc++.h> using namespace std; long long INF = 1e18; int INFi = 2e9; double eps = 1e-6; long long mod = 1e9 + 7; vector<char> used; vector<vector<int>> edge; vector<int> p; vector<int> cnt; int sz = 0; void add(int beg, int end) { while (beg != end) { cnt[beg]++; beg...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
module framebuffer (input reset_n, input vga_clk, input next_n, input fb_hblank, input fb_vblank, output reg [7:0] red, output reg [7:0] green, output reg [7:0] blue ); reg wait_for_posedge; reg [7:0] blue_shift; always @(posedge vga_clk or negedge reset_n or posedge ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int n; pair<int, int> a[N]; pair<int, int> ra[N]; int ans[N]; pair<int, int> cross(pair<int, int> a, pair<int, int> b) { if (a > b) swap(a, b); return pair<int, int>(b.first, min(a.second, b.second)); } void solve() { ra...
#include <bits/stdc++.h> using namespace std; int n, i, k, x; string s; int main() { cin >> n >> k >> s; for (i = 0; i < n; i++) { if (s[i] == # ) x++; else x = 0; if (x == k) { cout << NO ; return 0; } } cout << YES ; }
`timescale 1ns / 1ps /* Group Members: Nikita Eisenhauer and Warren Seto Lab Name: Adder Design Design Description: Verilog test fixture to test the 64-bit look ahead adder */ module look_ahead_adder_test; // Inputs reg [63:0] A; reg [63:0] B; // Outputs wire [63:0] SUM; wire CARRY; // In...
#include <bits/stdc++.h> using namespace std; int mod = 998244353; const int M = 2e5 + 10; const int N = 5e2 + 10; inline long long read() { long long b = 1, sum = 0; char c = getchar(); while (!isdigit(c)) { if (c == - ) b = -1; c = getchar(); } while (isdigit(c)) { sum...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2009 Altera Corporation, San Jose, California, USA. ...
#include <bits/stdc++.h> using namespace std; const int mod = 1000003; long double pi = 3.1415926536; const int mx = 1000003; long long gcd(long long x, long long y) { if (y == 0) return x; return gcd(y, x % y); } long long bp(long long a, long long b) { long long ans = 1; while (b > 0) { ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2005 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc = 0; reg [7:...
////////////////////////////////////////////////////////////////////////////////// // AXI4LiteSlaveInterfaceWriteChannel for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Kibin Park <> // Yong Ho Song <> // // This file is part of Cosmos OpenSSD. // // Cosmos OpenSSD ...
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> inline void chmin(A &a, B b) { if (a > b) a = b; } template <typename A, typename B> inline void chmax(A &a, B b) { if (a < b) a = b; } struct UnionFindTree { vector<long long> par, sz; UnionFindTree(long lon...
(** * Extraction: Extracting ML from Coq *) (* $Date: 2013-01-16 20:29:57 -0700 (Wed, 16 Jan 2013) $ *) (** * Basic Extraction *) (** In its simplest form, program extraction from Coq is completely straightforward. *) (** First we say what language we want to extract into. Options are OCaml (the most mature),...
#include <bits/stdc++.h> int main() { int i, n, k; scanf( %d %d , &n, &k); int a[n]; int count = 0, j = 0; for (i = 0; i < n; i++) { scanf( %d , &a[i]); } for (i = 0; i < n; i++) { if (a[i] <= k) count++; else { j = 1; break; } } if (...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; vector<long long> v[N]; long long vis[N]; long long col[N]; set<long long> che; void dfs(long long x) { vis[x] = 1; che.insert(x); for (auto it : v[x]) { if (!vis[it]) { dfs(it); } } } void solve()...
//Legal Notice: (C)2017 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; void solve() { int n; std::cin >> n; std::vector<int> v(101); for (int i = 0; i < n; ++i) { int temp; std::cin >> temp; v[temp]++; } int mex_A = -1; int mex_B = -1; bool flag1 = 1; for (int i = 0; i < n; ++i) { ...
/* Copyright (c) 2016-2018 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...
/** * 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) { return b == 0 ? a : gcd(b, a % b); } long long qpow(long long a, long long b, long long m) { long long r = 1; a %= m; for (; b; b >>= 1) { if (b & 1) r = r * a % m; a = a * a % m; } return r; ...
// $Id: c_scatter.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: Redistributions of...
#include <bits/stdc++.h> using namespace std; inline int readInt() { char c; int tmp = 0, x = 1; c = getchar(); while (c > 9 || c < 0 ) { if (c == - ) x = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { tmp = tmp * 10 + c - 0 ; c = getchar(); } return...