text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, z; int sum1 = 0, sum2 = 0, sum3 = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> x >> y >> z; sum1 += x; sum2 += y; sum3 += z; } if ((sum1 == 0) && (sum2 == 0) && (sum3 == 0)) { cout << ...
/** * 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 mod = 1000000007; const int N = 1000005; class cmp { public: bool operator()(long long &A, long long &B) { return A > B; } }; bool by_sec(pair<long long, long long> &A, pair<long long, long long> &B) { return A.second < B.second; } bool ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:13:33 03/13/2014 // Design Name: // Module Name: alu // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Rev...
#include <bits/stdc++.h> using namespace std; struct UnionFind { vector<int> par; vector<int> rank; vector<int> sz; UnionFind(int n = 0) { if (n > 0) initialize(n); } void initialize(int n) { par.resize(n); rank.resize(n); sz.resize(n); for (int i = 0; i < n; i+...
#include <bits/stdc++.h> using namespace std; char c; string s; set<char> q; int i, sum; int main() { getline(cin, s); for (i = 0; i < s.size(); i++) if (isalpha(s[i])) q.insert(s[i]); cout << q.size() << endl; return 0; }
#include <bits/stdc++.h> using namespace std; char s[105]; int main(void) { int n, f; while (cin >> n) { scanf( %s , s); f = 0; for (int l = (1); l <= (n); ++l) { for (int j = (0); j <= (n - 4 * l - 1); ++j) { if (j + 4 * l >= n) break; if (s[j] == * && s[j ...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 2000 + 10; int n, k, a[MAX_N], dp[MAX_N]; bool check(int x) { for (int i = 0; i < n; i++) { dp[i] = 1; for (int j = i - 1; ~j; j--) if (abs(a[i] - a[j]) <= 1LL * (i - j) * x) dp[i] = max(dp[i], dp[j] + 1); if (n - dp[i...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2003 Matt Ettus // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License...
// (C) 2001-2016 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...
#include <bits/stdc++.h> using namespace std; namespace io { char ibuf[(1 << 20)], *iS, *iT, obuf[(1 << 20)], *oS = obuf, *oT = oS + (1 << 20) - 1, c, qu[55]; int f, qr; inline void flush(void) { return fwrite(obuf, 1, oS - obuf, stdout), oS = obuf, void(); } inline char getch(void) { return...
#include <bits/stdc++.h> using namespace std; int main() { long long n, k, p, d, x; cin >> n >> k >> d; p = n - k; for (int i = 0; i < d; i++) { cin >> x; x--; if (p <= k) { if (x % 2 == 0 && x / 2 < p) { cout << . ; } else { cout << X ; ...
/* * 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...
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/versclibs/data/fuji/CAPTUREE2.v,v 1.1 2010/05/27 18:53:42 yanx Exp $ /////////////////////////////////////////////////////// // Copyright (c) 2009 Xilinx Inc. // All Right Reserved. /////////////////////////////////////////////////////// // // ____ ___ // / ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; const long long mod = 1e9 + 7; template <typename T> inline T gcd(T a, T b) { return !b ? a : gcd(b, a % b); } template <typename T> inline T q_pow(T a, T x) { T ans = 1, tmp = a; while (x) { if (x & 1) (ans *= tmp) ...
// (C) 2001-2017 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 any of the foregoing (including device programming or simulation // files), and any associated docum...
#include <bits/stdc++.h> using namespace std; const int maxn = 110, mod = 1e9 + 7; const long long inf = 1e18; long long a[maxn]; int b[maxn]; long long ans1, ans2, ans3; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { ...
`include "ShiftRegister.v" `include "memory.v" `include "finiteStateMachine.v" `include "programCounter.v" `include "serialClock.v" `include "mosiFF.v" `include "delayCounter.v" module toplevel(led, gpioBank1, gpioBank2, clk, sw, btn); // possible inputs from fpga output [7:0] led; output [3:0] gpioBank1; output [3: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> using namespace std; vector<pair<long long, long long> > con[3]; vector<pair<long long, long long> > sum; int main() { for (long long i = 0; i < ((long long)3); i++) { long long n; cin >> n; for (long long j = 0; j < ((long long)n); j++) { long long x, y; ...
#include<bits/stdc++.h> using namespace std; int a[10]; int main() { int T;scanf( %d ,&T); while(T--) { int sum = 0; for(int i = 1;i <= 3;i++) { scanf( %d ,&a[i]); sum += a[i]; } if(sum % 9 == 0) { if(a[1] >= sum / 9 && ...
#include <bits/stdc++.h> using namespace std; const int maxn = 200020; long long a; int main() { cin >> a; long long l = 1, r = 1e18; long long ans = (((9 * (5 * (9 * (2 * (long long)1e17) % a) % a) % a) % a) + 1) % a; cout << l + (a - ans) << << r + (a - ans) << endl; return 0; ...
#include <bits/stdc++.h> using namespace std; int n; pair<int, int> point[int(2e5 + 10)]; map<int, int> mark_x, mark_y; long long res; void sol() { cin >> n; for (int i = 0; i < n; i++) { cin >> point[i].first >> point[i].second; mark_x[point[i].first]++; mark_y[point[i].second]++;...
// ECE 429 //FIXME: include output port busy module memory(clock, address, data_in, access_size, rw, enable, busy, data_out); parameter data_width = 32; parameter address_width = 32; parameter depth = ; // -1 for 0 based indexed parameter bytes_in_word = 4-1; parameter bits_in_bytes = 8-1; parameter BYTE = 8; paramet...
/* SPDX-License-Identifier: MIT */ /* (c) Copyright 2018 David M. Koltak, all rights reserved. */ // // Tawas Instruction Fetch // // Pick thread for each cycle and decode br and full word instructions. // module tawas_fetch ( input clk, input rst, output ics, output [23:0] iaddr, input [31:0] i...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; int v[1024]; int vv[1024]; int N; int try_it(int last) { for (int i = (0); i < (N); i++) vv[i] = v[i]; for (int i = (last); i < (N); i++) vv[i] = max(0, vv[i] - 1); vv[N] = 0; int NN = N; while (NN > 0 && vv[NN - 1] =...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: moon.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===================================...
#include <bits/stdc++.h> using namespace std; const int MAXN = 400; int x[MAXN], y[MAXN]; inline bool lt(int i, int xx, int yy) { return x[i] < xx || (x[i] == xx && y[i] < yy); } inline bool gt(int i, int xx, int yy) { return x[i] > xx || (x[i] == xx && y[i] > yy); } void mysort(int l, int r) { ...
#include <bits/stdc++.h> using namespace std; const long long maxn = 1000000 + 10; long long d[maxn]; long long ans = 0; int main() { ios_base::sync_with_stdio(false); long long n, m; cin >> n >> m; for (long long i = 0; i < m; i++) { long long v, u; cin >> v >> u; d[u]++; ...
module top; integer ival; real rval; initial begin $display("--- Printing as real ---"); $display("1/0 is %f. (Should be 0 -- x prints as 0)", 1/0); $display("1/0.0 is %f. (Should be inf)", 1/0.0); $display("1.0/0 is %f. (Should be inf)", 1.0/0); $display("1.0/0.0 is %f. (should be inf)", 1.0/...
//Control circuit `include "verilog/mips_instr_defines.v" module control ( input wire[5:0] instr_op_ctl_i, input wire[5:0] instr_funct_ctl_i, output wire reg_src_ctl_o, output wire reg_dst_ctl_o, output wire jump_ctl_o, ou...
#include <bits/stdc++.h> using namespace std; int n; vector<int> adj[100001]; vector<int> cost[3]; long long matrix[3][3] = {0}; int tree[100000]; int output[100000] = {0}; void makeTree(int a, int pos) { tree[pos] = a; for (auto &i : adj[a]) { if (pos == 0 || tree[pos - 1] != i) makeTree(...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5000 + 10; int n, T; double p[MAXN]; int t[MAXN]; double dp[MAXN][MAXN]; int main() { scanf( %d%d , &n, &T); for (int i = 1; i <= n; ++i) { scanf( %lf%d , &p[i], &t[i]); p[i] *= 0.01; } double ans = 0.0; dp[0][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...
/* * 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...
/* ------------------------------------------------------------------------------- * (C)2007 Robert Mullins * Computer Architecture Group, Computer Laboratory * University of Cambridge, UK. * ------------------------------------------------------------------------------- * * XY routing * * Routing Fun...
#include <bits/stdc++.h> using namespace std; int n; char in[100005]; int main() { scanf( %d %s , &n, in); for (int i = 1; i < n; i++) { if (in[i] == in[i - 1]) { for (int j = i;; j++) { in[j] = 1 - (in[j] - 0 ) + 0 ; if (in[j + 1] != in[j]) break; } b...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2003 Matt Ettus // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License...
// Provides a FIFO interface for JTAG communication. module jtag_fifo ( input rx_clk, input [11:0] rx_data, input wr_en, rd_en, output [8:0] tx_data, output tx_full, tx_empty ); wire jt_capture, jt_drck, jt_reset, jt_sel, jt_shift, jt_tck, jt_tdi, jt_update; wire jt_tdo; BSCAN_SPARTAN6 # (.JTAG_CHAIN(1)) jtag...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { int n; int m; cin >> n >> m; vector<vector<bool>> arr(n, vector<bool>(m, 0)); long long int answ = 0; vector<int> hor(n, 0); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { int temp; cin >> temp;...
// file: timer.v // // (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 // laws. // // DISCLAIMER // This disclaimer is ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long mul(long long a, long long b) { return a * b % mod; } long long add(long long a, long long b) { long long res = a + b; if (res >= mod) { res -= mod; } return res; } const long long MAXN = 1e6 + 5; ...
module fourDeepRollingAverage_tc ( input clk, input signed [12:0] in, output reg signed [12:0] out = 13'd0); reg [1:0] mstr_ctr = 2'b00; reg [1:0] ctr1 = 2'b00, ctr2 = 2'b00, ctr3 = 2'b00, ctr4 = 2'b00; reg signed [14:0] acc1 = 15'd0, acc2 = 15'd0, acc3 = 15'd0, acc4 = 15'd0; //reg [14:0] sum = 16'd0; ...
`include "bsg_cache.vh" module bsg_test_master import bsg_cache_pkg::*; #(parameter `BSG_INV_PARAM(num_cache_p) , parameter `BSG_INV_PARAM(data_width_p) , parameter `BSG_INV_PARAM(addr_width_p) , parameter `BSG_INV_PARAM(block_size_in_words_p) , parameter `BSG_INV_PARAM(sets_p) , parameter `BSG...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, l, m, n, p, x, y; string s1, s2, s3, s4; cin >> s1 >> s2; cin >> n; cout << s1 << << s2; cout << endl; for (i = 0; i < n; i++) { cin >> s3 >> s4; if (s3 == s1) { s1 = s4; cout << s1 <<...
#include <bits/stdc++.h> int64_t a[400005], b[200005]; int64_t len; int n; bool check(int64_t value) { std::vector<std::pair<int64_t, int64_t>> v; for (int i = 0; i < n; ++i) { auto rg = std::make_pair(b[i] - value, b[i] + value); if (rg.first < 0) { rg.first += len; rg.secon...
#include <bits/stdc++.h> using namespace std; struct line { long long int a, b, c; }; int main() { long long int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; long long int n; cin >> n; vector<line> data(n); for (auto &p : data) { cin >> p.a >> p.b >> p.c; } vector<bool>...
`timescale 1ns / 1ps module posManager ( input wire clk, output wire [15:0] pos11, output wire [15:0] pos12, output wire [15:0] pos21, output wire [15:0] pos22, output wire [15:0] pos_diff, output reg [31:0] count_clk, input wire m1, input wire m2, input wire [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...
`default_nettype none `timescale 1ns/1ns module tb_sys_level; `include "../task/task_disp_branch.v" `include "../task/task_disp_loadstore.v" localparam PL_CORE_CYCLE = 20; //It's necessary "Core Clock == Bus Clock". This restriction is removed near future. localparam PL_BUS_CYCLE = 20; // localparam PL_DPS_...
#include <bits/stdc++.h> using namespace std; unsigned long long int ans = 1; int main() { int i, j, k, l, c = 0, fuck = 0; string s; cin >> s; l = s.size(); s += 9 ; for (i = 0; i < l; i++) { if (fuck == 1) { if (int(s[i] - 48) + int(s[i + 1] - 48) == 9) c += 1; ...
#include <bits/stdc++.h> struct Mock { Mock(int n, const std::string &s) : n(n), s(s) {} std::vector<std::string> ask(int l, int r) { if (l > r) { return {}; } std::vector<std::string> substrings; for (int i = l - 1; i < r; ++i) { for (int j = 1; i + j <= r; ++j) { ...
Require Import Int63 FloatClass. (** * Definition of the interface for primitive floating-point arithmetic This interface provides processor operators for the Binary64 format of the IEEE standard. *) (** ** Type definition for the co-domain of [compare] *) Variant float_comparison : Set := FEq | FLt | FGt | FNotCom...
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; int n; vector<int> a[200]; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed; cin >> n; int k = (1 + sqrt(1 + 8 * n)) / 2, x = 1; cout << k << endl; for (int i = 1; i <= k; i++) { for (in...
#include <bits/stdc++.h> using namespace std; enum { DUNNO = -1, AB, BA }; vector<pair<int, int> > E[200010]; map<pair<int, int>, int> edge_id; int dir[200010]; int val[200010]; bool vis[200010]; int main() { int N, M; cin >> N >> M; memset(val, 0, sizeof(val)); memset(vis, 0, sizeof(vis...
#include <bits/stdc++.h> using namespace std; int n, cnt; char phone[128]; int main() { scanf( %d , &n); scanf( %s , phone); cnt = 0; for (int i = 0; i < n; i++) { if (cnt == 2 and n - i >= 2) { printf( - ); cnt = 0; } printf( %c , phone[i]); cnt++; } ...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * * 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, version 3 of the License. * * This program is distributed ...
#include <bits/stdc++.h> using namespace std; int main() { int n; long num; cin >> n; set<long> s; while (n > 0) { cin >> num; while (num % 2 == 0) { num = num / 2; } while (num % 3 == 0) { num = num / 3; } s.insert(num); n--; } i...
#include <bits/stdc++.h> using namespace std; int n, cnt[100015], x[100015], y[100015], z[100015]; vector<int> a[100015]; int getpos(int i, int u) { if (x[i] == u) return 0; if (y[i] == u) return 1; if (z[i] == u) return 2; } void dfs(int u, int v) { cout << u << ; if (cnt[v] == 0) { ...
//Legal Notice: (C)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 do...
#include <bits/stdc++.h> using namespace std; int n, m, S[2005]; bool mark[2005][2005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); char c; cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { cin >> c; mark[i][j] = c - 0 ; if (...
#include <bits/stdc++.h> using namespace std; const long long maxs = 1e6 + 5; long long root[maxs]; class cmp { bool operator()(const long long &a, const long long &b) { return a < b; } }; void init() { iota(root, root + maxs, 0); } long long find(long long u) { long long f; if (root[u] == u) ...
#include <bits/stdc++.h> using namespace std; long long int res[100005]; int main() { long long int n; scanf( %lld , &n); if (n % 4 == 2 || n % 4 == 3) { printf( -1 ); exit(0); } long long int c = 2; for (long long int i = 0; i < n / 2; i += 2) { res[i] = c; res[i +...
#include <bits/stdc++.h> using namespace std; vector<int> v; void solve(int n) { int m = 1; while (n > 0) { if (n & 1) v.push_back(m); n >>= 1; m++; } reverse(v.begin(), v.end()); } int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); int n; ...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e6 + 6; int main() { int n; cin >> n; string str = ; while (n) { str += ((n % 2) + 0 ); n /= 2; } reverse(str.begin(), str.end()); while (str.size() < 6) str = 0 + str; string ss = ; ss += str[0];...
#include <bits/stdc++.h> using namespace std; template <typename INT> struct TripleDXY { INT d, x, y; TripleDXY(INT _d = 0, INT _x = 0, INT _y = 0) : d(_d), x(_x), y(_y) {} }; template <typename INT> TripleDXY<INT> egcd(INT a, INT b) { bool neg_a = a < 0; if (neg_a) a = -a; bool neg_b = ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { int a; cin >> a; arr[i] = a; } sort(arr, arr + n); for (int j = 0; j < n; j++) { cout << arr[j] << ; } return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 11, inf = 1e9 + 10; char ch[4] = { D , I , M , A }; int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, -1, 1}, ans = -inf, tans[N][N], n, m; char c[N][N]; bool mark[N][N], indfs[N][N]; bool isOkay(int x, int y) { return (x >= 0 && x < n && y >= 0 &...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; inline bool chmax(int& a, int b) { if (a < b) { a = b; return true; } return false; } constexpr int B = 210; int q, n, e, i, j, ans, res, l, r, val, x, mid; void solve() { cin >> n; vector<vector<in...
module premuat3_8( enable, inverse, i_0, i_1, i_2, i_3, i_4, i_5, i_6, i_7, o_0, o_1, o_2, ...
#include <bits/stdc++.h> constexpr int MAXN = 1e5 + 5; using namespace std; int tot, n, cnt; unordered_map<int, int> Map; vector<int> vec; vector<pair<string, int>> opt; string s; inline void discretization() { sort(vec.begin(), vec.end()); cnt = unique(vec.begin(), vec.end()) - vec.begin(); ...
// // Copyright 2011 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is dis...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2003 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs fastclk ); input fastclk; t_netlist tnetlist (.also_f...
// ----------------------------------------------------------------------- // // Copyright 2004 Tommy Thorn - All Rights Reserved // // 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,...
// megafunction wizard: %LPM_MULT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsquare // ============================================================ // File Name: squarer.v // Megafunction Name(s): // altsquare // // Simulation Library Files(s): // altera_mf // =====================...
/////////////////////////////////////////////////////////////////////////////// // // Silicon Spectrum Corporation - All Rights Reserved // Copyright (C) 2005 // This File is based upon: crt_op_stage.v // This File is copyright Silicon Spectrum Corporation and is licensed for // use by Curtis Wright for use in FPG...
/** * 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 INF = 0x3f3f3f3f; using namespace std; const int N = 1000100; bool isp[N]; void prep() { for (int(i) = (2); (i) < (N); ++(i)) isp[i] = true; for (int i = 2; i * i < N; i++) if (isp[i]) for (int j = i * i; j < N; j += i) isp[j] = false; } int a, b, k...
// ---------------------------------------------------------- // Credit producer block // // This module produces symbol and packet credits by snooping // on the valid, ready and eop signals. // // A symbol credit is added whenever symbols_per_credit symbols // have been detected, or whenever eop is detected. // // Pa...
#include <bits/stdc++.h> using namespace std; double x, y, z, s; int n, a, b, c, v[300010], p[300010], l[300010], r[300010]; bool cmp(int x, int y) { return v[x] < v[y]; } int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &v[i]), l[i] = i - 1, r[i] = i + 1, p[i] = i; sor...
`timescale 1ns / 1ns module RegisterFile(input writeEnb,clk ,input [2:0] readReg1,readReg2,writeReg , input[7:0] writeData , output wire[7:0] readData1,readData2); reg[7:0] registers[0:7]; initial registers[0] = 8'b0; initial registers[1] = 8'b0; initial registers[2] = 8'b0; initial registers[3] = 8'b0; initial r...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2016/05/24 22:19:13 // Design Name: // Module Name: Register_with_synch_reset_set_load_behavior_tb // Project Name: // Target Devices: // Tool Versions: // Descripti...
#include <bits/stdc++.h> long long n, s[2][100010], k; long long dp[100010][2]; long long ans = 1; long long p(long long a, long long b) { if (b == 0) return 1LL; if (b == 1) return a % 998244353; long long x = p(a, b >> 1); x *= x; x %= 998244353; x *= p(a, b & 1); x %= 998244353; ...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * * 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, version 3 of the License. * * This program is distributed in ...
/* ########################################################################### # Function: A mailbox FIFO with a FIFO empty/full flags that can be used as # interrupts. # # E_MAILBOXLO = lower 32 bits of FIFO entry # E_MAILBOXHI = upper 32 bits of FIFO entry # # Notes: ...
/** * 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 "constants.vh" `default_nettype none module exunit_mul ( input wire clk, input wire reset, input wire [`DATA_LEN-1:0] ex_src1, input wire [`DATA_LEN-1:0] ex_src2, input wire dstval, input wire [`SPECTAG_LEN-1:0] spectag, input wire specbit, input wire src1_sign...
//Legal Notice: (C)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 do...
//----------------------------------------------------------------------------- // // (c) Copyright 2009-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; void data() {} const int N = 1e6 + 100; const long long mod = 998244353; const long long mod2 = 1e9 + 7; map<int, int> was, was2; int main() { data(); int t; cin >> t; while (t--) { int n; cin >> n; int a[n + 1]; for (in...
/** * 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; const int M = (int)1e9 + 7; int a[17]; int c[107][107]; int dp[17][107]; int n; int main() { cin >> n; for (int i = 0; i < 10; i++) cin >> a[i]; for (int i = 0; i <= 100; i++) { c[i][0] = c[i][i] = 1; for (int j = 1; j < i; j++) { ...
`timescale 1ns/10ps module pll_0002( // interface 'refclk' input wire refclk, // interface 'reset' input wire rst, // interface 'outclk0' output wire outclk_0, // interface 'outclk1' output wire outclk_1, // interface 'locked' output wire locked ); altera_pll #( ...
//---------------------------------------------------------------------------- // Copyright (C) 2001 Authors // // This source file may be used and distributed without restriction provided // that this copyright statement is not removed from the file and that any // derivative work contains the original copyright notic...
#include <bits/stdc++.h> using namespace std; int n = 0; vector<int> v; int flag[2010]; int countt = 0; int k = 0; int maxt = 0; int main() { cin >> n; cin >> k; for (int i = 0; i < n; i++) { int kari = 0; cin >> kari; v.push_back(kari); if (i == 0) { maxt = k...
#include <bits/stdc++.h> using namespace std; char N[(int)1e6 + 5], B[(int)1e6 + 5]; long long n, b, c; inline long long euler(long long n) { long long ans = n; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { ans = ans / i * (i - 1); while (n % i == 0) n /= i; } } ...
#include <bits/stdc++.h> using namespace std; int A[100005], P[100005]; int other_end[100005]; long long ans[100005], seg[100005]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) scanf( %d , &A[i]); for (int i = 1; i <= n; ++i) scanf( %d , &P[i]); long long res = 0; for (int...