text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int n, k; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> k; vector<vector<int>> g(n); for (int i = 0; i < n - 1; i++) { int a, b; cin >> a >> b; a--; b--; g[a].push_back(b); g[...
#include <bits/stdc++.h> using namespace std; vector<int> v[200005]; vector<int> par(200005, -1); vector<int> ran(200005, 1); int fi(int c) { while (1) { if (par[c] == -1) return c; else c = par[c]; } } int main() { int n, m; cin >> n >> m; long long int a[n...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int q = 0; q < t; q++) { long long n, m; cin >> n >> m; if (n % m == 0) cout << YES << endl; else cout << NO << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; template <typename t> t in(t q) { cin >> q; return q; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << [ ; for (int i = 0; i < ((int)(v).size()); ++i) { os << v[i]; if (i != ((int)(v).size()) - 1) ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2013 by Sean Moore. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; // Take CRC data and apply to testblo...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2.1 (win64) Build Wed Aug 9 16:32:24 MDT 2017 // Date : Fri Sep 22 17:41:20 2017 // Host : EffulgentTome running 64-bit major re...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int n, a[maxn], ans; int gcd(int x, int y) { if (y == 0) return x; return gcd(y, x % y); } int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; int x = gcd(a[1], a[2]); for (int i = 3; i <= n; i++) ...
module clock_counter( input clk_i, //often, "tags" are added to variables to denote what they do for the user input reset_n, //here, 'i' is used for input and 'o' for the output, while 'n' specifies an active low signal ("not") output reg clk_o ); reg [15:0] count; //register stores the counter va...
#include <bits/stdc++.h> using namespace std; int sum(int a) { int s = 0; while (a > 0) { s += (a % 10); a = a / 10; } return s; } int main() { int n, a, b; cin >> n; while (sum(n) % 4 != 0) { n++; } cout << n << endl; 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 la...
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; string s; map<string, int> m; for (__typeof((n)) i = (0); i < (n); i++) { cin >> s; if (m[s]) cout << YES << endl; else cout << NO << endl; m[s]++; } } int main() { ...
#include <bits/stdc++.h> using namespace std; int n, x, res, p[(1 << 20)]; int main() { for (cin >> n; n--;) scanf( %d , &x), p[x]++; for (int i = 0; i < (1 << 20); i++) res += p[i] & 1, p[i + 1] += p[i] / 2; cout << res << endl; }
/* * 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...
//**************************************************************************************************** //*---------------Copyright (c) 2016 C-L-G.FPGA1988.lichangbeiju. All rights reserved----------------- // // -- It to be define -- // -- ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; vector<vector<long long>> g; vector<long long> a; vector<long long> ans; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n; cin >> n; g = vector<vector<long long>>(n + 1); a = vect...
// pr_region_default_onchip_memory2_0.v // Generated using ACDS version 17.1 240 `timescale 1 ps / 1 ps module pr_region_default_onchip_memory2_0 ( input wire clk, // clk1.clk input wire reset, // reset1.reset input wire reset_req, // .reset_req input wire [6:0] ...
#include <bits/stdc++.h> using namespace std; const double kEps(1e-8); #pragma gcc optimize(2) int gcd(int x, int y) { while (y ^= x ^= y ^= x %= y) ; return x; } void write(int x) { if (x < 0) putchar( - ), x = -x; if (x > 9) write(x / 10); putchar(x % 10 + 0 ); } int qpow(in...
#include <bits/stdc++.h> using namespace std; int N, n, m; long long a[1 << 20], b[1 << 20]; int g[21][100001]; void FWT(long long *P, int opt) { for (int i = 2; i <= N; i <<= 1) for (int p = i >> 1, j = 0; j < N; j += i) for (int k = j; k < j + p; ++k) { long long x = P[k], y = P[...
#include <bits/stdc++.h> using namespace std; int mat[4005][4005]; int acum[4005][4005]; int dp[4005][805]; int step(int n, int k, int min_i, int max_i) { dp[n][k] = dp[min_i - 1][k - 1] + (acum[n][n] + acum[min_i - 1][min_i - 1] - acum[n][min_i - 1] - acum[min_i - 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...
////////////////////////////////////////////////////////////////////// //// //// //// eth_crc.v //// //// //// //// This file is part of the E...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; void solve() { int n, k, d; cin >> n >> k >> d; vector<int> a(n); map<int, int> used; for (int i = 0; i < n; i++) cin >> a[i]; int cnt = 0, ans = INF; for (int i = 0; i < d; i++) { if (used[a[i]] == 0) cnt++; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2015/05/06 14:34:16 // Design Name: // Module Name: configuration // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // //...
module iop_fpga(reset_l, gclk, spc_pcx_req_pq, spc_pcx_atom_pq, spc_pcx_data_pa, pcx_spc_grant_px, cpx_spc_data_rdy_cx2, cpx_spc_data_cx2 ); output [4:0] spc_pcx_req_pq; output spc_pcx_atom_pq; output [123:0] spc_pcx_data_pa; input [4:0] pcx_spc_grant_px; input cpx_spc_data_rdy_cx2; input [144:0] cpx_spc_data...
/*------------------------------------------------------------------------------ * 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> using namespace std; int n, m, k, arr[105][105]; int check(int c[105], int ctC, int secRow) { int ans = INT_MAX; if (ctC > 10) return ans; for (int i = 0; i < (1 << ctC); i++) { int ct = 0; for (int r = 2; r <= n; r++) { if (r != secRow) { int sam...
/** * 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() { ios::sync_with_stdio(false); cin.tie(NULL); ; int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int mi = *min_element(a, a + n); int p = -1; int f = 0; int ans = INT_MAX; for (int i = 0; i < ...
#include <bits/stdc++.h> using namespace std; const int MAX = 3005; int a[MAX], b[MAX], c[MAX], dp[MAX][2]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) cin >> b[i]; for (int i = 1; i <= n; i++) cin >> c[i]; dp[1][0] = a[1]; dp[...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const int N = 1e6 + 10; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, m; cin >> n >> m; int g[n]; for (int i = 0; i < n; ++i) cin >> g[i]; sort(g, g + (sizeof(g) / s...
#include <bits/stdc++.h> const int maxx = 2e6 + 5; using namespace std; long long a[maxx]; long long biaoji[maxx] = {0}; int main() { long long t, i, j, m, n; cin >> n; long long maxl = 0; for (i = 1; i <= n; i++) { scanf( %lld , &a[i]); maxl = max(maxl, a[i]); biaoji[a[i]]++...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: prnf5ccc.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===========================...
module testit; reg clk; reg a_i; reg b_i; reg a_o; reg b_o; reg rst_n; reg [7:0] shreg; //== State enumeration parameter [2:0] // synopsys enum state_info SM_IDLE = 3'b000, SM_SEND = 3'b001, SM_WAIT1 = 3'b010; //== State ...
#include <bits/stdc++.h> using namespace std; template <class T> int len(const T &c) { return (int)c.size(); } template <class T> void cmin(T &a, T b) { if (b < a) a = b; } template <class T> void cmax(T &a, T b) { if (b > a) a = b; } int n; int main() { cin >> n; if (n == 3)...
#include <bits/stdc++.h> using namespace std; int main() { int n, t, i, sum = 0, x, y; cin >> n >> t; int a[n]; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0; i < n - 1; i++) { if ((a[i] >= 0 && a[i + 1] >= 0) || (a[i] <= 0 && a[i + 1] <= 0)) { x = abs(a[i] - a[i + 1]) / t; ...
#include <bits/stdc++.h> using namespace std; int n, a[100100], d[100100]; int main() { cin >> n; int mn = 1000111222, mx = 0; for (int i = 0; i < n; i++) { scanf( %d , &a[i]); mn = min(mn, a[i]); mx = max(mx, a[i]); } for (int i = 0; i < n; i++) { a[i] -= mn; if ...
#include<bits/stdc++.h> #define pii pair<int,int> #define fi first #define sc second #define pb push_back #define ll long long #define trav(v,x) for(auto v:x) using namespace std; const int N = 1e6 + 100; const ll mod = 998244353; int n, m, need; int sa[N], rnk[N]; ll fac[N], ifac[N]; ll...
/** * bsg_mesh_router_buffered.v * */ `include "bsg_defines.v" `include "bsg_noc_links.vh" module bsg_mesh_router_buffered import bsg_mesh_router_pkg::*; #(parameter `BSG_INV_PARAM(width_p ) , parameter `BSG_INV_PARAM(x_cord_width_p ) , parameter `BSG_INV_PARAM(y_cord_width_p ) , parame...
/** * 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<long long, long long> dp; long long fastPow(long long a, long long b) { long long ret = 1; while (b) { if (b & 1) ret = (ret * a) % 1000000007; a = (a * a) % 1000000007; b >>= 1; } return ret; } long long cc(long long y) { ...
////////////////////////////////////////////////////////////////////////////////// // Company: RMIT University // Engineer: Matthew Myungha Kim // , // // Create Date: 14:32:00 18/03/2014 // Design Name: stimulus_gen // Module Name: stimulus_gen // Project Name: Streaming Media on Null Convention Logic // ...
#include <bits/stdc++.h> using namespace std; const double eps(1e-8); const double pi(3.14159265358979); const int K = 33, mod = 1000000007; struct matrix { long long a[K][K]; } t[K] = {}, ans = {{}}, pre[K] = {}, suf[K] = {}; long long n; int k; inline void multi(const matrix &m1, const matrix &m...
#include <bits/stdc++.h> using namespace std; int n, c, a[2], r = 0; int main() { cin >> n >> c >> a[0]; for (int i = 1; i < n; i++) cin >> a[i % 2], r = max(r, a[i % 2 ^ 1] - a[i % 2] - c); cout << r; }
module top; reg pass; reg [2:-1] vec; initial begin pass = 1'b1; vec = 4'bxxxx; assign vec[1'bx] = 1'b1; if (vec !== 4'bxxx) begin $display("Failed vec[1'bx], expected 4'bxxxx, got %b", vec); pass = 1'b0; end deassign vec[1'bx]; vec = 4'bxxxx; assign vec[1'bx:0] = 1'...
/* Copyright (c) 2015 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, distribute,...
module RAMB16_S9_S9( input WEA, input ENA, input SSRA, input CLKA, input [10:0] ADDRA, input [7:0] DIA, input DIPA, // output [3:0] DOPA, output [7:0] DOA, input WEB, input ENB, input SSRB, input CLKB, input [10:0] ADDRB, input [7:0] DIB, input DIPB, // output [3:0] DOPB, output [7:0] ...
//-------------------------------------------------------------------------------- // Project : SWITCH // File : ethernet_controller.v // Version : 0.2 // Author : Shreejith S // // Description: Ethernet Controller Module // //-----------------------------------------------------------------------------...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's register file inside CPU //// //// //// //// This file is part of the OpenR...
#include <bits/stdc++.h> using namespace std; const int maxn = 500; const int maxm = 500000 + 10; struct Edge { int next, v; Edge() {} Edge(int next, int v) : next(next), v(v) {} } e[maxm << 1]; int n, m, timer, num, len; int head[maxm], cnt; int dfn[maxn], low[maxn], belo[maxn]; bool inst...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; int N, dp[5000][5001], cumlcp[5000][5000]; vector<int> sa, ra, rsa, lcp; string s; void saInit() { int l = (int)s.size(); sa.resize(l); iota(sa.begin(), sa.end(), 0); ra.assign(s.begin(), s.end()); for (int k = 1; ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100000 + 10; int SL[MAXN], SR[MAXN]; int A[MAXN][2], n; int main() { while (~scanf( %d , &n)) { SL[0] = SR[0] = 0; for (int i = 1; i <= n; i++) { scanf( %d%d , &A[i][0], &A[i][1]); SL[i] = A[i][0] + SL[i - 1]; ...
// /** // * // */ // synthesis translate_off `timescale 1ns / 1ps // synthesis translate_on // synthesis verilog_input_version verilog_2001 // turn off superfluous verilog processor warnings // altera message_level Level1 // altera message_off 10034 10035 10036 10037 10230 10240 10030 //---------------------...
// megafunction wizard: %FIFO%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: small_fifo.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ============================...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, i, j, k, l1 = 1, l2 = 1, s, r[7], z = 0; cin >> n >> m; for (i = 7; i < n; i *= 7) l1++; for (i = 7; i < m; i *= 7) l2++; if (l1 + l2 < 8) for (i = 0; i < n; ++i) for (j = 0; j < m; ++j) { for (k =...
`timescale 1ns / 1ps `default_nettype none ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10/15/2015 07:58:09 AM // Design Name: // Module Name: SerialServo_tb // Project Name: // Target Devices: // Tool Versions: // D...
#include <bits/stdc++.h> using namespace std; int B, n, m; int li[500008], ri[500008], mx[500008], tag[500008]; short g[480][100008]; int bel[500008], de[500008], ai[500008], pa[500008]; short size[500008]; int find(int x) { if (pa[x] == x) return x; return pa[x] = find(pa[x]); } void link(int...
module Microfono(clk, reset, rec, play, bclk, lrsel, data_in, data_out, ampSD, rd, wr, emptyLED, fullLED); input wire clk; input wire reset; input wire rec; input wire play; output wire bclk; output wire lrsel; input wire data_in; output wire data_out; output wire ampSD; output wire rd; output wire wr; ou...
/* 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; int main() { ios_base::sync_with_stdio(false), cin.tie(0); int n; cin >> n; int ats = 0; list<int> kruv; int kur = 1; for (int i = 0; i < 2 * n; i++) { string c; cin >> c; if (c[0] == a ) { int nr; cin >> nr...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.4 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1 ns / 1 ...
#include <bits/stdc++.h> using namespace std; int mod = 1e9 + 7; struct edge { int v, next; }; int ans, ans2, f[1005][1 << 12]; int Pow(int a, int b) { int rec = 1; for (; b; b >>= 1, a = 1ll * a * a % mod) if (b & 1) rec = 1ll * rec * a % mod; return rec; } struct nade { int h...
#include <bits/stdc++.h> using namespace std; const int N = 200005; int cycl[N], set_val[N], cycl_size[N]; int main() { int h, m, n; cin >> h >> m >> n; vector<int> strt; bool vis[h]; memset(vis, false, sizeof vis); int kk = 0; set<int> dmm[h + 1]; for (long long i = 0; i < m; i+...
// (C) 2001-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 simulation // files), and any associated doc...
/** * 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> const int N = 100005; int K, n, maxb, t; int c[N]; int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of ent_ae // // Generated // by: wig // on: Tue Jul 4 08:39:13 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../verilog.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Author...
#include <bits/stdc++.h> using namespace std; bitset<300000005> pr; int uke[20000005]; int anti_uke(int l, int r) { int ans = 0; for (register int i = 5; i <= r; i += 4) { if (i >= l && pr[i] == 0) ++ans; } if (l <= 2 && r >= 2) ++ans; return ans; } int main() { int l, r; s...
#include <bits/stdc++.h> int start, n, m; bool edge[25][25]; long long memory[25][(1 << 19) + 5]; long long dfs(int u, int mask) { if (memory[u][mask] != -1) return memory[u][mask]; int visit = 0; for (int i = 0; i < n; i++) { if (mask & (1 << i)) visit++; } long long result = 0; i...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b; cin >> a >> b; long long res = 0; while (a >= 1 && b >= 1) { if (a < b) swap(a, b); res += a / b; a %= b; } cout << res; return 0; }
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:14:33 05/25/2015 // Design Name: // Module Name: seven_segment_leds_x_4_no_leading_zeros // Project Name: // Target Devices: // Tool versions: // Descript...
#include <bits/stdc++.h> using namespace std; const int N = 100010; int v[N]; int n, k; int main() { scanf( %d %d , &n, &k); n--; for (int i = 1; i <= n; ++i) scanf( %d , v + i), v[i] += v[i - 1]; int ans = 0x3F3F3F3F; for (int i = k; i <= n; ++i) ans = min(ans, v[i] - v[i - k]); print...
/** * 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 A[5][5], x, y, p, q, sum; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { cin >> A[i][j]; if (A[i][j] == 1) { x = i; y = j; } } cout << endl; } if (x == 2 && y == ...
#include <bits/stdc++.h> using namespace std; vector<int> a; int main() { int n, x, ans; cin >> n >> x; ans = x; a.resize(n); for (int i = 0; i < (int)(n); i++) { cin >> a[i]; } for (int i = 0; i < (int)(n); i++) { for (int j = i; j < n; j++) { ans = max(ans, (x / a...
#include <bits/stdc++.h> using namespace std; template <class T> void DBGpair(T a, string s = ) { cerr << s << (s == ? : : ) << a.first << , << a.second << n ; } template <class T> void DBGvec(vector<T> a) { for (T i : a) cerr << i << ; cerr << n ; } int dx[] = {0, 0, 1, ...
#include <bits/stdc++.h> using namespace std; vector<int> e[200010]; vector<int> a; int n; int siz[200010]; int id[200010]; int d[200010]; int c[200010]; int f[200010]; int dfn; void dfs(int x, int fa) { id[x] = ++dfn; siz[x]++; for (int i = 0; i < e[x].size(); i++) { if (e[x][i]...
// ---------------------------------------------------------------------- // Copyright (c) 2015, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
/** * 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() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; for (int i = 1; i <= t; i++) { int n, k, d; cin >> n >> k >> d; int mn = n; int a[n + 10]; for (int j = 1; j <= n; j++) cin >> a[j]...
#include <bits/stdc++.h> using namespace std; long long a, b, c, d, cnt = 1; string s; bool ok = true, mtest = true; void solve() { cin >> b; vector<int> v(b), vc(b); for (auto& i : v) cin >> i; for (auto& i : vc) cin >> i; sort(v.begin(), v.end()); sort(vc.begin(), vc.end()); for ...
/** * 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 2021 The CFU-Playground 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law ...
#include <bits/stdc++.h> using namespace std; void setIo(string nom) { ios_base::sync_with_stdio(0); cin.tie(0); freopen((nom + .in ).c_str(), r , stdin); freopen((nom + .out ).c_str(), w , stdout); } struct Reine { int x, y, id; vector<int> tris; int indTri; void init(int i)...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2016/06/07 13:33:41 // Design Name: // Module Name: down_counter_tb // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // ...
//////////////////////////////////////////////////////////////////////////////////// // // pGB, yet another FPGA fully functional and super fun GB classic clone! // Copyright (C) 2015-2016 Diego Valverde () // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU Gene...
/** * 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 Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Set_Acceleration.v // Created: 2014-09-08 14:12:04 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // ------------------------------------------------------------...
#include <bits/stdc++.h> using namespace std; int q, ans; char s[300010]; set<int> len, hs[300010]; int p[300010], v[300010]; int main() { int i, l, op; for (i = 1, p[0] = 1; i <= 300000; ++i) p[i] = 1LL * p[i - 1] * 27 % 1000000007; scanf( %d , &q); while (q--) { scanf( %d%s , &...
#include <bits/stdc++.h> const long double eps = 1e-6; struct Point { long long x, y; Point(long long _x = 0, long long _y = 0) : x(_x), y(_y) {} Point operator-(const Point &B) const { return Point(x - B.x, y - B.y); } long double operator*(const Point &B) const { return (long double)x * B.y ...
#include <bits/stdc++.h> using namespace std; const int N = 10200; const int mod = 1e9 + 7; int dp[N]; int len[N]; inline int get_len(int x) { if (x == 0) return 1; int res = 0; while (x) res++, x /= 10; return res; } vector<int> del[N]; vector<int> calc_prefix(string s) { int n = ...
/* * PicoSoC - A simple example SoC using PicoRV32 * * Copyright (C) 2017 Clifford Wolf <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies...
/** * 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...
//---------------------------------------------------------------------- // Title : Configuration Testbench // Project : Virtex-6 Embedded Tri-Mode Ethernet MAC Wrapper // File : configuration_tb.v // Version : 1.3 //----------------------------------------------------------------------------- //...
`timescale 1ns / 1ps module COUNT #( parameter N=7 ) ( A, S ); function integer log2; input [31:0] value; reg [31:0] temp; begin temp = value; for (log2=0; temp>0; log2=log2+1) temp = temp>>1; end endfunction localparam K = log2(N); localparam K2 = log2(N - 2**(K-1)); input [N-1:0] A; out...
#include <bits/stdc++.h> using namespace std; int q; long long int input; long long int lastSum[20]; long long int limit[20]; long long int targetSum(int digit, long long int target) { long long int ret = lastSum[digit - 1] * target; ret += target * (target + 1) * digit / 2; return ret; } lo...