text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int a[105][105], t, m, n, ret, cnt, mn; int main(void) { cin >> t; for (int i = 0; i < t; i++) { ret = 0, cnt = 0, mn = 101; cin >> n >> m; for (int j = 0; j < n; j++) { for (int k = 0; k < m; k++) { cin >> a[j][k]; ... |
/* A small simple asynchronous transmitter/receiver
For documentation see the wiki pages. */
/*
MIT License
Copyright (c) 2016 Baard Nossum
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 th... |
/**
* Fill the screen ram with initial values.
*/
module screen_init(
clk,
reset,
address,
out,
load
);
input clk;
input reset;
output load;
output [12:0] address; // ram address to write the pixel data
output [15:0] out; // pixel values for ram address in the buffer
... |
/**
* 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 max(int a, int b) { return (a > b) ? a : b; } struct player { int i; int j; int pos; }; int main() { bool firstwon1 = false; bool secondwon1 = false; bool firstwon2 = false, firstwon3 = false, firstwon4 = false; bool secondwon2 = fa... |
module test;
parameter PVALUE = 12;
localparam LVALUE = 88;
enum byte unsigned { UVAL[256] } unsignedbyte_enum;
enum byte { SVAL[100] } signedbyte_enum;
enum { ADD = 10, SUB[5], JMP[6:8]} E1; // page 28 LRM
enum { REGISTER[2] = 1, REGISTER[2:4] = 10 } vr; // page ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; long long ans; ans = (n - 2) * (n - 2); cout << ans << n ; return 0; } |
#include <bits/stdc++.h> using namespace std; int to1[1000010], w[1000010], begin1[1000010], next1[1000010], v[1000010], p[1000010], d[1000010], e; void add(int x, int y, int z) { to1[++e] = y; next1[e] = begin1[x]; begin1[x] = e; w[e] = z; } void ins(int x) { int i; for (i = 30;... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Thu Oct 26 22:45:01 2017
// Host : Juice-Laptop running 64-bit major release ... |
/**
* 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 x, y, a, b, n; void init() { scanf( %d , &n); puts( YES ); for (int i = 1; i <= n; i++) { scanf( %d%d%d%d , &x, &y, &a, &b); printf( %d n , 2 * abs(x % 2) + abs(y % 2) + 1); } } int main() { init(); return 0; } |
// Copyright 2020-2022 F4PGA 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 or agreed... |
#include <bits/stdc++.h> using namespace std; const int maxn = 7050; int dp[2][maxn]; vector<int> g[2]; int state[2][maxn]; void dfs(int player, int cur, int n) { if (state[player][cur] == 1) return; state[player][cur] = 1; for (int i = 0; i < g[player].size(); i++) { int v = (cur + g[play... |
//==================================================================================================
// Filename : tb_soc.v
// Created On : 2015-05-31 20:25:47
// Last Modified : 2015-05-31 20:50:46
// Revision : 0.1
// Author : Ángel Terrones
// Company : Universidad Simón Bolívar
// E... |
//`#start header` -- edit after this line, do not edit this line
`include "cypress.v"
//`#end` -- edit above this line, do not edit this line
// Generated on 04/23/2015 at 13:22
// Component: FIFO
module FIFO (
output drq,
input clk,
input [7:0] D,
input load
);
//`#start body` -- edit after this line, do n... |
#include <bits/stdc++.h> using namespace std; int max(int a, int b) { return a > b ? a : b; } pair<int, int> a[100], ans[1000], p; vector<pair<int, int>> v; int main() { int n, k; cin >> n >> k; for (int i = 0; i < n; i++) { cin >> a[i].first; a[i].second = i + 1; } sort(a, a +... |
/**
* 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... |
// Full Adder rtl
module full_adder (a0, b0, c0, a1, b1, c_out, s_out, s2, s3);
// Inputs_top
input a0;
input b0;
input c0;
input a1;
input b1;
// End of inputs_top
// Outputs_top
output c_out;
output s_out;
output s2;
output d1;
output s3;
// End of outputs_top
// Wires
wire c1;
wire c2... |
/*
Copyright (c) 2015-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... |
#include <bits/stdc++.h> using namespace std; using ll = long long; template <typename T> using PQ = priority_queue<T>; template <typename T> using GPQ = priority_queue<T, vector<T>, greater<T>>; template <class L, class R> ostream& operator<<(ostream& os, pair<L, R> p); template <class T> ostream& ... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 300000; vector<int> g[MAX_N]; int sz[MAX_N]; int x[MAX_N]; int p[MAX_N]; int N; int dfs(int v) { sz[v] = 1; p[v] = N; x[N++] = v; for (int i = 0; i < g[v].size(); i++) { sz[v] += dfs(g[v][i]); } return sz[v]; ... |
/*
* 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 ... |
#include <bits/stdc++.h> using namespace std; string bad; int k, ans = 0; struct node { node *edges[26]; node() { for (int i = 0; i < 26; i++) edges[i] = NULL; } }; void insert(node *trie, string s) { for (int i = 0; i < s.size(); i++) { if (trie->edges[s[i] - a ] == NULL) trie-... |
/**
* 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(int argc, const char* argv[]) { ios_base::sync_with_stdio(false); cin.tie(NULL); int c, m, t, r, i, W[301], tot, j; map<int, bool> used; map<int, bool> ends; map<int, bool> G; cin >> m >> t >> r; for (i = 0; i < m; i++) { c... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; inline long long getint() { long long _x = 0, _tmp = 1; char _tc = getchar(); while ((_tc < 0 || _tc > 9 ) && _tc != - ) _tc = getchar(); if (_tc == - ) _tc = getchar(), _tmp = -1; while (_tc >= 0 && _tc <= 9 ) _x... |
#include <bits/stdc++.h> using namespace std; int dp[5005][15], oo = 1e5; char str[5005]; int solve(int i, int s) { if (str[i] == 0 and s == 2) { return 0; } else if (str[i] == 0 and s != 2) { return oo; } else if (~dp[i][s]) { return dp[i][s]; } else { int ans = 0; ... |
#include <bits/stdc++.h> using namespace std; int main() { int k, i; cin >> k; int a[12]; for (i = 0; i < 12; i++) cin >> a[i]; sort(a, a + 12); int sum = 0, c = 0; while (sum < k && i > 0) { i--; sum = sum + a[i]; c++; } if (sum >= k) cout << c; else ... |
/**
* 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... |
// DEFINES
`define BITS 2 // Bit width of the operands
module bm_dag2_log_mod(clock,
reset_n,
a_in,
b_in,
c_in,
d_in,
out0,
out1);
// SIGNAL DECLARATIONS
input clock;
input reset_n;
input [`BITS-1:0] a_in;
input [`BITS-1:0] b_in;
input c_in;
input d_in;
output [`BITS-1:0] out0;
output ... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; long double scal(long double x, long double y, long double x1, long double y1) { return x * y1 - x1 * y; } int n, m; int a[20][2], b[20][2]; int aa[20][10], bb[20][10]; int p[10]; int main() { cin >> n >> m; for (int ... |
/* -----------------------------------------------------------------------------
* (C)2012 Korotkyi Ievgen
* National Technical University of Ukraine "Kiev Polytechnic Institute"
* -----------------------------------------------------------------------------
*/
module LAG_router (i_flit_in, i_flit_out,
i_cn... |
#include <bits/stdc++.h> using namespace std; int getValue(vector<int> &ai, int n, int sum) { int val = 0; int mval = ai[ai.size() - 1]; for (int i = 1; i <= mval; i++) { if (n * i >= sum) { val = i; break; } } return val; } int main() { int q; scanf( %d ,... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n; k = (20.0 + pow(1.0 + 3 * n, 0.5)) / 3.0; while (k--) { if (3 * k * k - 2 * k <= n) break; } n -= 3 * k * k - 2 * k; if (n - k <= 0) { cout << k - 2 * n << << 2 * k << endl; return ... |
`include "config.v"
module fx2_timetag(
fx2_clk,
fx2_flags,
fx2_slwr,
fx2_slrd,
fx2_sloe,
fx2_wu2,
fx2_pktend,
fx2_fd,
fx2_fifoadr,
ext_clk,
delta_chs,
strobe_in,
led
);
input fx2_clk;
input [2:0] fx2_flags;
output fx2_slwr;
output fx2_slrd;
output fx2_sloe;
output fx2_wu2;
outp... |
/**
* 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; std::vector<int> res; std::vector<int> adj[200005]; std::vector<int> DEPTH(200005); std::vector<int> NODENUM(200005); std::vector<int> funct(200005); vector<bool> taken(200005); vector<bool> visited(200005); int dfs(int v, int depth) { int nodeNum = 0;... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000 + 123; char res[maxn][maxn]; int a[maxn]; int n; int sumx, maxy, miny, nowy; int main() { scanf( %d , &n); sumx = maxy = miny = nowy = 0; int flag = 1; for (int i = 0; i < n; ++i) { scanf( %d , a + i); sumx += ... |
/**
* 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... |
// file: clk_gen.v
//
// (c) Copyright 2008 - 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 property
// laws.
//
// DISCLAIMER
// This disclaimer is not a li... |
#include <bits/stdc++.h> #pragma optimization_level 3 #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) #pragma GCC optimization( unroll-loops ) using namespace std; const long long N = 1e6 + 5; const long long mod = 1e+9 + 7; const long long INF = 0x7f7f7f7f7f7f7f7f; const int INFi = 0... |
#include <bits/stdc++.h> using namespace std; const int M = 100010; int n, m; struct road { int to, th; bool f; } in; struct dot { int come_road; int come_point; bool func; } r[M]; vector<road> work[M]; vector<road> not_work[M]; vector<road> rw[M]; vector<road> rnw[M]; bool v... |
#include <bits/stdc++.h> using namespace std; int main() { long long x, r, r1, s, s1, pos, pos1, nx = 0; int digits[19], index = 0; cin >> x; pos = 1; do { pos1 = pos; pos *= 10; r = x % pos; s = (x - r) / pos; r1 = r % pos1; s1 = (r - r1) / pos1; digits... |
//
// 8192 bytes, 32bit interface
`timescale 1ns/1ps
module bb_ram(clk, addr, data_in, data_out, we, en, reset);
input clk;
input [12:2] addr;
input [31:0] data_in;
output [31:0] data_out;
input [3:0] we;
input en;
input reset;
wire [3:0] dip;
RAMB16_S9_altera ram0 (
.address ( addr[12:2] ),
.clock ( clk ),
... |
#include <bits/stdc++.h> using namespace std; int stak1[200010], tot1, stak0[200010], tot0; int pre[200010], nex[200010]; char s[200010]; int a[200010]; int n, ans; int stak_ans[200010], tot_ans; int main() { int i, j, k; scanf( %s , s); n = strlen(s); for (i = 0; i < n; i++) a[i + 1] = ... |
`default_nettype none
module gci_std_display_sequencer #(
//Area
parameter P_AREA_H = 640,
parameter P_AREA_V = 480,
parameter P_AREAA_HV_N = 19,
parameter P_MEM_ADDR_N = 23
)(
input wire iCLOCK,
input wire inRESET,
input wire iRESET_SYNC,
//Req
input wire iIF_VALID,
output wire oIF_BUSY,
inp... |
// megafunction wizard: %LPM_MULT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_mult
// ============================================================
// File Name: lpm_mult_4_hybr_ref.v
// Megafunction Name(s):
// lpm_mult
//
// Simulation Library Files(s):
// lpm
// =================================... |
#include <bits/stdc++.h> int n, from[300005], p[300005], dis[300005], a[300005], b[300005]; std::queue<int> que; std::set<int, std::greater<int>> l; void work(int now) { if (now != n) work(from[now]), std::cout << p[now] << ; } void print(int now) { std::cout << dis[now] + 1 << std::endl; wor... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: obc_lower.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:15:38 01/18/2017
// Design Name: left_barrel_shifter
// Module Name: /home/aaron/Git Repos/CSE311/lab1_reverse/left_barrel_shifter_tb.v
// Project Name: lab1_reve... |
#include <bits/stdc++.h> using namespace std; using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; int b[n]; vector<int> c; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
// (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... |
/***********************************************************************************************************************
* Copyright (C) 2016 Andrew Zonenberg and contributors *
* ... |
/*
eTeak synthesiser for the Balsa language
Copyright (C) 2012- The University of Manchester
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)... |
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __prin... |
// Identifies the sequence 11101
// includes a overlap bit sequence as well
module jfsmMealyWithOverlap(dataout, clock, reset, datain);
output reg dataout;
input clock, reset, datain;
reg[2:0] cs, ns;
parameter a = 3'b000;
parameter b = 3'b001;
parameter c = 3'b010;
parameter d = 3'b011;
parameter... |
// $Header: $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ ... |
#include <bits/stdc++.h> using namespace std; string to_string(string s) { return + s + ; } string to_string(char s) { return string(1, s); } string to_string(const char* s) { return to_string((string)s); } string to_string(bool b) { return (b ? true : false ); } template <typename A> string to_... |
#include <bits/stdc++.h> using namespace std; template <class T> void chmin(T &t, T f) { if (t > f) t = f; } template <class T> void chmax(T &t, T f) { if (t < f) t = f; } int INF = (1 << 29); int n, m; int table[8][8]; void init() {} void input() { cin >> n >> m; for (int i = (0... |
// $Header: $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ ... |
#include <bits/stdc++.h> struct task { task() : pc(-1), indegree(0), outgoing() {} int pc; int indegree; std::vector<int> outgoing; }; int solve(int pc, std::vector<task> tasks) { std::queue<int> todo[3]; for (__decltype((tasks).begin()) t = (tasks).begin(), t_end = (tasks).end(); ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100005, maxl = 200005, maxsg = 60; int n, f, SG, cnt, maxx; int p[maxl], c[maxl], sg[maxl], A[maxn], B[maxn]; bitset<maxl> ok, have[maxsg]; void sieve(int n) { c[1] = 1; for (int i = 2; i <= n; i++) { if (c[i] == 0) p[++cnt] = i, o... |
#include <bits/stdc++.h> using namespace std; int main() { int x; cin >> x; cout << 25; } |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; char c; bool ch = false; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> c; if (c == C || c == M || c == Y ) { ch = true; break; } }... |
// 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 : Sun Jun 04 00:42:38 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int const MAX_N = 1e5 + 10; int n, p, l[MAX_N], r[MAX_N]; int get_count(int l, int r) { int ans = 0; if (l % p == 0) ++ans; l -= l % p; r -= r % p; ans += (r - l) / p; return ans; } double get_prob(int a, int b) { long long count = 0;... |
/////////////////////////////////////////////////////////////////////////
// Copyright (c) 2008 Xilinx, Inc. All rights reserved.
//
// XILINX CONFIDENTIAL PROPERTY
// This document contains proprietary information which is
// protected by copyright. All rights are reserved. This notice
... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2016 by Adrian Wise
//bug1104
module t (input clk);
simple_bus sb_intf(clk);
simple_bus #(.DWIDTH(16)) wide_intf(clk);
mem mem(sb_intf.slave);
cpu cpu(sb_intf.master);
... |
`timescale 1ns / 1ns
`define HALT 5'h1F
module opctb();
reg [7:0] mem [ 2047:0 ];
reg clk, reset_b;
wire [10:0] addr;
wire rnw ;
wire ceb = 1'b0;
wire oeb = !rnw;
wire [7:0] data = ( !ceb & rnw & !oeb ) ? mem[ addr ] : 8'bz ;
// OPC CPU instantiation
opccpu dut0_u (.address(addr), .data(data), .... |
#include <bits/stdc++.h> using namespace std; const int MaxN = 100000 + 5; int N; map<int, int> Numbers; int main(void) { scanf( %d , &N); if (N % 2) { printf( NO n ); return 0; } for (int i = 0; i < N; i++) { int Number; scanf( %d , &Number); Numbers[Number]++; ... |
/*
* 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... |
// This file has been automatically generated by goFB and should not be edited by hand
// Compiler written by Hammond Pearce and available at github.com/kiwih/goFB
// Verilog support is EXPERIMENTAL ONLY
// This file represents the Basic Function Block for BfbOneWayCtrl
//defines for state names used internally
`defi... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`ifdef SMV
`ifdef SUBDIR
`include "std_ovl_defines.h"
`else
`include "ovl_ported/std_ovl_defines.h"
`endif
`else
`include "std_ovl_defines.h"
`endif
`module ovl_always_on_edge (clock, reset, en... |
/*
Copyright (c) 2015-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... |
/*
* BCH Encode/Decoder Modules
*
* Copyright 2014 - Russ Dill <>
* Distributed under 2-clause BSD license as contained in COPYING file.
*/
`timescale 1ns / 1ps
module compact_matrix_vector_multiply #(
parameter C = 4,
parameter R = C
) (
input [C+R-2:0] matrix,
input [C-1:0] vector,
output [R-1:0] out
);
`... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int n; double a, d; double p[maxn], t[maxn], v[maxn], s[maxn]; int main() { scanf( %d %lf %lf , &n, &a, &d); for (int i = 0; i < n; i++) scanf( %lf%lf , &t[i], &v[i]), p[i] = t[i] + v[i] / a; s[0] = t[0] + v[0] / a + (... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int mod = 998244353; void reduce(int &a) { a += a >> 31 & mod; } int Mod(int x) { return x >= mod ? x - mod : x; } long long read() { long long x = 0; int f = 1; char ch = getchar(); for (; !isdigit(ch); ch = g... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) x = (x << 3) + (x << 1) + (c ^ 0 ), c = getchar(); return x * f; } c... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:40:21 03/23/2015
// Design Name:
// Module Name: serial_interface
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencie... |
#include <bits/stdc++.h> using namespace std; struct edge { int v, to, cap, scap; edge(int a, int b, int c) { v = a, to = b, cap = c, scap = c; } edge() {} }; struct rect { int x1, y1, x2, y2; }; struct tri { int y1, y2, x; }; bool operator<(const tri &a, const tri &b) { return a.y1 ... |
#include <bits/stdc++.h> using namespace std; struct node { long long l, r; int now; vector<pair<int, int> > v; } st[250005 * 4]; int pi, ri, n, N; int p[250005], m[250005]; long long r, sp[250005]; pair<long long, int> d[250005]; queue<int> q; vector<long long> rr; bool vis[250005]; v... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int ch = 0, nch = 0; int x; int b; if (n >= m) { b = m; } else { b = n; } for (int i = 0; i < n; i++) { cin >> x; if (x % 2 == 0) { ch++; } else { nch... |
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; int main() { int n; cin >> n; vector<vector<int> > xy(n, vector<int>(2)); for (int i = 0; i < n; i++) { cin >> xy[i][0] >> xy[i][1]; } int k = 0; for (int i = 0; i < n - 2; i++) { if (xy[i][0] == ... |
module spi
#(parameter N=8,
parameter tope=50000)
(
input [N-1:0] datain,
input en,
input reset,
input clk,
input miso,
output reg [N-1:0] dataout,
output reg done,
output reg mosi,
output reg cs,
output reg sclk
);
integer countd=0;
integer div=0;
reg [N-1:0] datase=0;
reg [N-1:0] datare=0;
reg run=0... |
// megafunction wizard: %LPM_AND%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_and
// ============================================================
// File Name: gl_and20.v
// Megafunction Name(s):
// lpm_and
//
// Simulation Library Files(s):
// lpm
// ===============================================... |
/**
* 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... |
// (C) 2001-2016 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... |
/*
* I expect the following statistics results:
* 0 x 0 x x x
* 1 x 1 x 0 0
* 2 1 2 x 1 0
* 3 1 3 x 2 1
* 2 1 3 3 2 2
* 2 1 3 3 3 2
* 3 1 3 3 4 2
* 1 1 3 3 1 3
* 0 1 3 2 x 3
* 1 2 3 2 0 2
* 0 2 3 1 x 3
* 1 3 3 1 0 2
* 2 2 3 1 1 2
* 3 2 3 1 2 2
*
* x implies there is no defin... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; long long i; cin >> n >> m; long long cnt = 0; for (i = 1; i <= n; i++) { cnt += (m + i) / 5 - i / 5; } cout << cnt; return 0; } |
#include <bits/stdc++.h> using namespace std; int ts, kk = 1; template <class T> inline T _sq(T a) { return a * a; } template <class T, class X> inline T _pow(T a, X y) { T z = 1; for (int i = 1; i <= y; i++) { z *= a; } return z; } template <class T> inline T _gcd(T a, T b... |
// NIOS_SYSTEMV3_tristate_conduit_pin_sharer_0.v
// This file was auto-generated from altera_tristate_conduit_pin_sharer_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 13.0sp1 232 at 2015.10.21.10:55:06
`timescale 1 ps / 1 ps
module NIOS_SYSTEMV3_tristate_conduit_pi... |
#include <bits/stdc++.h> using namespace std; double PI = acos(-1); double EPS = 1e-7; int INF = 1000000000; int MOD = 1000000007; int MAXINT = 2147483647; long long INFLL = 1000000000000000000LL; long long MAXLL = 9223372036854775807LL; int mx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}; int my[8] = {0, 0, -1... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; vector<long long> arr; arr.push_back(0); int sz = 1; long long max_ele = -1; long long pre_ind = 0; while (q--) { int x; cin >> x; if (x == 1) { long long v; cin >> v; ... |
module main();
// Parameters
parameter PER=10;
// In this example we perform a 3x3 convolution of an 8x8 input image
// Therefore the window size here is (3-1)*8+3 = 19
parameter IMAGE_WIDTH = 8;
parameter KERNEL_WIDTH = 3;
// Line buffer parameters
parameter DATA_WIDTH = 8;
parame... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: fpu_denorm_3b.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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.