text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; template <typename arg> void debugger(const char* varname, arg&& var) { cout << varname << = << var << endl; } template <typename arg, typename... args> void debugger(const char* varnames, arg&& var, args&&... vars) { const char* comma = strchr(varna... |
/*
PWM Generator
This module will generate a PWM output signal whose duty cycle is determined
by the duty_cycle input. Valid duty_cycle values include the full range from 0 to (2^N)-1,
where N is the PWM_DEPTH in bits (for example, 0-255 for an 8 bit depth).
This design uses an internal counter and comparator to co... |
#include <bits/stdc++.h> using namespace std; const int N = 20; int n; int a[N]; int b[N]; vector<string> ans; int get(int s, int e) { int res = 0; for (int i = s; i < e; ++i) { res = res * 10 + b[i]; } return res; } string getstr(int x, int y, int z, int l) { string s = ; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1000, M = 2000; int head[N + 10], ver[M + 10], nxt[M + 10], tot = 0; void add(int x, int y) { ver[++tot] = y; nxt[tot] = head[x]; head[x] = tot; } int col[N + 10], cnt = 0; void dfs(int x) { col[x] = cnt; for (int i = head[x];... |
#include <bits/stdc++.h> using namespace std; long long int c1, c2, x, y, l, r, mid; int main() { ios::sync_with_stdio(false); cin >> c1 >> c2 >> x >> y; l = c1 + c2; r = 2000000009; while (l < r) { mid = (l + r) / 2; if ((mid - (mid / x) >= c1) && (mid - (mid / y) >= c2) && ... |
#include <bits/stdc++.h> using namespace std; int n; int a[5][101][101]; int sd[5][3]; int main() { scanf( %d , &n); for (int t = 1; t <= 4; t++) { char ss[101]; for (int i = 1; i <= n; i++) { scanf( %s , ss + 1); for (int j = 1; j <= n; j++) { int f = ss[j] - 0 ... |
`timescale 10ns/10ns
module ascii_tb();
// Declare inputs as regs and outputs as wires
reg clk;
reg scan_ready;
reg [7:0] scan_code;
wire [7:0] ascii;
ascii ascii_DUT(
.clk(clk),
.scan_ready(scan_ready),
.scan_code(scan_code),
.ascii(ascii)
);
... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:38:07 04/17/2016
// Design Name: Comparator
// Module Name: D:/Documents/College/CalPolyPomona/SeniorProject/hardware-accelerated-dna-matching-and-variation-detect... |
#include <bits/stdc++.h> using namespace std; string s1, s2; int a, b; int nxt[205], cnt[205]; int main() { scanf( %d%d , &a, &b); cin >> s1 >> s2; for (int i = 0; i < s2.size(); i++) { int pos = i; for (int r = 0; r < s1.size(); r++) { if (s2[pos] == s1[r]) { pos++; ... |
/*
Copyright (c) 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, distribute,... |
/**
* 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: BMSTU
// Engineer: Oleg Odintsov
//
// Create Date: 15:09:47 01/19/2012
// Design Name:
// Module Name: ag_main
// Project Name: Agat Hardware Project
// Target Devices:
// Tool ... |
#include <bits/stdc++.h> using namespace std; const int N = 300005; priority_queue<pair<long long, int> > Q; int h[N], a[N]; int n, m, k, p; bool check(long long lim) { static long long now[N]; for (int i = 1; i <= n; i++) now[i] = lim; while (!Q.empty()) Q.pop(); for (int i = 1; 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... |
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2018, Darryl Ring.
//
// 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... |
/* $Id: edk32.v,v 1.12 2007/12/23 20:40:51 sybreon Exp $
**
** AEMB EDK 3.2 Compatible Core TEST
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <>
**
** This file is part of AEMB.
**
** AEMB is free software: you can redistribute it and/or modify it
** under the terms of the GNU Lesser General Public License as
** pu... |
/*
* 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... |
#include <bits/stdc++.h> using namespace std; int N; int Move[100005], cnt, P[100005]; vector<int> G[100005]; int TT[100005], Next[100005]; int DP[100005], Stack[100005], top; void Read() { scanf( %d , &N); for (int i = 1; i < N; i++) { int father; scanf( %d , &father); ++father;... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t, x, y, f1, f2, f3, f4, LIMH = 100000, LIML = -100000; cin >> t; while (t--) { int q; cin >> q; int hiX, loX, hiY, loY; hiX = LIMH; hiY = LIMH; loX = LIML... |
#include <bits/stdc++.h> using namespace std; vector<int> t; int n, x, i, j, h, sol, temp; int main() { ios::sync_with_stdio(false); cin >> n; for (i = 0; i < n; i++) { cin >> x; t.push_back(x); } cin >> h; sort(t.begin(), t.end()); sol = 0; for (i = 0; i < n; i++) { ... |
// STD 10-30-16
//
// Synchronous 1-port ram with byte masking
// Only one read or one write may be done per cycle.
//
`define bsg_mem_1rw_sync_macro_byte(words,bits,lgEls,mux) \
if (els_p == words && data_width_p == bits) \
begin: macro \
wire [data_width... |
`include "../src/include/asym_ram.v"
`include "../src/include/line_reader.v"
`include "../src/include/scale_1d.v"
`include "../src/mm2s_adv.v"
`timescale 1ns / 1ps
module test();
localparam integer C_PIXEL_WIDTH = 8;
localparam integer C_PIXEL_STORE_WIDTH = 8;
localparam integer C_IMG_STRIDE_SIZE = 1024;
loca... |
#include <bits/stdc++.h> using namespace std; string a[100], b[100]; map<string, int> m; int n, s; int main(void) { scanf( %d , &n); for (int i = 0; i < n; i++) { cin >> a[i]; m[a[i]]++; } for (int i = 0; i < n; i++) { cin >> b[i]; m[b[i]]--; } s += abs(m[ S ]);... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
// clock divider generating clock and clock ... |
#include <bits/stdc++.h> using namespace std; int main() { long long a; cin >> a; if (a < 2520) { cout << 0; } else { cout << a / 2520; } return 0; } |
// 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; const int NMAX = 31400; struct point { int x, y; }; int n; pair<point, point> p[5]; bool used[5]; bool func() { long long s = 0; point MIN, MAX; MIN.x = MIN.y = NMAX; MAX.x = MAX.y = 0; for (int i = 0; i < n; i++) { s += (p[i].s... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
//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; const long long MOD = 1e9 + 7; const long long SIZE = 100000; const int INF = 0x3f3f3f3f; const long long ll_INF = 0x3f3f3f3f3f3f3f3f; const long double PI = acos(-1); const long long MAXN = numeric_limits<long long>::max(); const long long MAX = 2000000; ... |
/**
* 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 M[2002][2002]; struct TA { int a[2002], n; void init(int _n) { n = _n; memset(a, 0, sizeof a); } int get(int p) { int ret = 0; for (p++; p > 0; p -= p & -p) ret ^= a[p - 1]; return ret; } void change(int l) { ... |
/**
* 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 t; cin >> t; while (t--) { int n, i, m, x, s = 0; cin >> n >> m; for (i = 1; i <= n; i++) { cin >> x; s += x; } if (s == m) cout << YES ; else cout << NO ; cout << ... |
////////////////////////////////////////////////////////////////////////////////
// Original Author: Schuyler Eldridge
// Contact Point: Schuyler Eldridge ()
// pipeline_registers.v
// Created: 4.4.2012
// Modified: 4.4.2012
//
// Implements a series of pipeline registers specified by the input
// parameters BI... |
// (sender) Each tile sends a packet to every tile.
// (receiver) The tile assert done_o, when it has received packets from everyone.
module test_tile
import test_pkg::*;
import bsg_noc_pkg::*;
#(parameter dims_p=2
, parameter x_cord_width_p=4
, parameter y_cord_width_p=3
, parameter num_tiles_x_p... |
#include <bits/stdc++.h> using namespace std; struct node { int x, in; } arr[210000], qu[210000]; int n, m, k, ans, len; int head, tail; int cmp(node a, node b) { if (a.x == b.x) return a.in < b.in; else return a.x < b.x; } int main() { int i, j, tp; while (scanf( %d%d%d ... |
#include <bits/stdc++.h> using namespace std; int cnt[200001], n, par; vector<int> adj[200001]; vector<pair<int, int> > v; void count(int h, int p) { cnt[h]++; for (auto it : adj[h]) if (it ^ p) { count(it, h); cnt[h] += cnt[it]; } } int ct(int h, int p) { for (auto... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01:55:33 09/09/2014
// Design Name:
// Module Name: sevensegdecoder
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:07:26 01/23/2017
// Design Name: bi_directional_shift
// Module Name: /home/aaron/Git Repos/CSE311/lab1_reverse/bi_directional_shift_tb.v
// Project Name: lab1_re... |
/**
* 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; template <typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << ( << p.first << , << p.second << ) ; } template <typename T_container, typename T = typename enable_if< !is_same<... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; template <class T> using pq = priority_queue<T>; template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>; template <class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 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... |
/**
* 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 n, s, inp; int c[10]; int best = -1; int b3, b4, b5; struct bezout { long long d, a, b; }; bezout extgcd(long long x, long long y) { if (y == 0) return (bezout){x, 1, 0}; bezout s = extgcd(y, x % y); return (bezout){s.d, s.b, s.a - x / y ... |
// 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:33:47 2017
// Host : KLight-PC running 64-bit major release (bu... |
#include <bits/stdc++.h> using namespace std; struct Edge { int u, v; } e[200050 << 1]; int fa[200050]; int n, color[200050], s, d; int cnt[2], dis[200050]; bool vis[200050]; vector<int> G[200050]; int find(int x) { if (x == fa[x]) return x; return fa[x] = find(fa[x]); } void _union(in... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<long long> a; for (int i = 0; i < n; i++) { long long x; cin >> x; a.push_back(x); } long long m = 0; for (int i = 0; i < (n... |
//-----------------------------------------------------
// Design Name : hw2_A
// File Name : hw2_A.v
// Function : This program designs an One-Pulse Generator.
// Coder : hydai
//-----------------------------------------------------
`timescale 1 ns/1 ns
module hw2_A (
input in,
input clk,
input rst_n,
... |
#include <bits/stdc++.h> using namespace std; vector<int> z; vector<int> pr; vector<vector<int>> ans; int s, f; long long pow(long long n, long long s) { if (s == 0) return 1; else { if (s % 2 == 1) { return (n * (pow(n, s - 1))) % 1000000007; } if (s % 2 == 0) { ... |
#include <bits/stdc++.h> using namespace std; long long head[100005]; long long memory[100005]; int n, m; bool possible(long long t) { int curr = 1; for (int i = 1; i <= n; i++) { long long headloc = head[i]; if (headloc <= memory[curr]) { headloc += t; while (headloc >= me... |
/**
* 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 t, n, k, z, x, s, a[31], v[31][101], c[31]; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); ; cin >> t; for (int zxc = 1; zxc <= t; zxc++) { cin >> n >> k; for (int i = 1; i <= 30; i++) for (int j =... |
//--------------------------------------------------------------------------------
// Project : SWITCH
// File : v7_enet_top.v
// Version : 0.2
// Author : Shreejith S
//
// Description: Merged Ethernet Controller Top File for V7
//
//---------------------------------------------------------------------... |
//¶¥²ãÄ£¿é
module top_greedy_snake
(
input clk,
input rst,
input left,
input right,
input up,
input down,
output hsync,
output vsync,
output [11:0]color_out,
output [7:0]seg_out,
output [3:0]sel
);
wire left_key_press;
wire right_key_press;
wire up_key_press;
wire down_key_press;
wire [1:0]snake... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9 + 7; const int N = 2e2 + 10; int main() { int n, m; cin >> n >> m; int l = 1, r = INF; int ans = 0; while (l <= r) { int mid = (r + l) / 2; int z = mid / 6; int x = mid / 2 - z; int y = mid / 3 - ... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: four_new2.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==========================... |
#include <bits/stdc++.h> using namespace std; vector<int> zp; int zer; int one; int n; int allz; int q() { cout << ? << ; for (int i = 0; i < n; i++) { cout << zp[i]; } cout << endl; int x; cin >> x; return x; } void get(int bg, int ed, int W) { if ((zer != -... |
// $Id: c_dff.v 1752 2010-02-12 02:16:21Z dub $
/*
Copyright (c) 2007-2009, 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 source c... |
#include <bits/stdc++.h> using namespace std; using ll = long long; mt19937 rng; ll MAX = 1e18; const int MN = 1e3 + 100; int get_rand(int x) { return static_cast<int>(static_cast<ll>(rng()) * x / (static_cast<ll>(rng.max()) - rng.min() + 1)); } int N; ll L, E; array<... |
/*
* Character ROM for text mode fonts
* Copyright (C) 2010 Zeus Gomez Marmolejo <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software
* Foundation; ei... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const int inf = 1e9 + 10; const long long INF = 1e18; const long double EPS = 1e-10; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; template <class T> bool chmax(T &a, const 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int a = 0, b = 0, r = 0; while (true) { a = (int)n / 36; r = n % 36; b = (int)r / 3; if (r % 3 == 2) b += 1; if (b >= 12) n = b *... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18 + 7; long long f[105]; long long g[105]; int main() { long long n; cin >> n; f[1] = 2, f[2] = 3; g[1] = 2, g[2] = 4; for (int h = 3; h <= 100; h++) { f[h] = f[h - 1] + f[h - 2]; g[h] = g[h - 1] + g[h - 1];... |
//---------------------------------------------------------------------------
//-- Copyright 2015 - 2017 Systems Group, ETH Zurich
//--
//-- This hardware module 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 ... |
// Copyright 2020 Efabless Corporation
//
// 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 agr... |
/*
* 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 double eps = 1e-10; const int inf = 0x3f3f3f3f, N = 1e7; using namespace std; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } char s[10]; int d(char c) { return c - 0 ; } int main() { while (~scanf( %s , s)) { long long x = d(s[... |
#include <bits/stdc++.h> using namespace std; vector<long long> v[3005]; long long f[20][3005], ans; int n, k; void solve(int l, int r, int d) { if (l == r) { for (int i = (int)(0); i <= (int)(v[l].size() - 1); i++) if (i + 1 <= k) ans = max(ans, v[l][i] + f[d][k - i - 1]); return; ... |
/*
Distributed under the MIT license.
Copyright (c) 2015 Dave McCoy ()
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, mo... |
//----------------------------------------------------------------------------
//-- Memoria ROM genérica
//------------------------------------------
//-- (C) BQ. October 2015. Written by Juan Gonzalez (Obijuan)
//-- GPL license
//----------------------------------------------------------------------------
//-- Memoria... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used *
* solely for design, simulation, implementation and creation of *
* design files limited to Xilinx devices or technologies. Use ... |
/*
----------------------------------------------------------------------------------
Copyright (c) 2013-2014
Embedded and Network Computing Lab.
Open SSD Project
Hanyang University
All rights reserved.
----------------------------------------------------------------------------------
Redistribution and use ... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; long long k; cin >> n; cin >> k; vector<long long> d(n); vector<long long> afterd(n); for (long long i = 0; i < n; i++) cin >> d[i]; for (long long i = 0; i < n; i++) cin >> afterd[i]; vector<pair<long long... |
// --------------------------------------------------------------------
// Copyright (c) 2007 by Terasic Technologies Inc.
// --------------------------------------------------------------------
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synthesis for all Ter... |
`timescale 1ns / 1ps
//-----------------------------------------------
// Company: agh
// Engineer: komorkiewicz
// Create Date: 11:41:13 05/10/2011
// Description: log image to ppm file
//-----------------------------------------------
module hdmi_out
(
input hdmi_clk,
input hdmi_vs,
input hdmi_de,
input [... |
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; template <typename Arg1> void debug_out(const char* name, Arg1&& arg1) { cerr << name << = << arg1 << ] << n ; } template <typename Arg1, typename... Args> void debug_out(const char* nam... |
module ptr(
input wire clk,
input wire reset,
/* IO bus */
input wire iobus_iob_poweron,
input wire iobus_iob_reset,
input wire iobus_datao_clear,
input wire iobus_datao_set,
input wire iobus_cono_clear,
input wire iobus_cono_set,
input wire iobus_iob_fm_datai,
input wire iobus_iob_fm_status,
input... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 75005; const long long maxm = (1 << 15) + 5; long long k, n[16], s[16], a[16][5005], co[maxn], col[maxn], idx, b[maxn], yhp[16], num; long long st[maxn], cnt[16], vis[maxm], lst[maxm], from[maxm], sel[maxn]; long long head[maxn], ecn... |
// MBT 10-26-14
//
//
// Counts the number of set bits in a thermometer code.
// A thermometer code is of the form 0*1*.
//
`include "bsg_defines.v"
module bsg_thermometer_count #(parameter `BSG_INV_PARAM(width_p ))
(input [width_p-1:0] i
// we need to represent width_p+1 values (0..width_p), so
// we need... |
// audio data processing
// stereo sigma/delta bitstream modulator
module paula_audio_sigmadelta
(
input clk, //bus clock
input clk7_en,
input [14:0] ldatasum, // left channel data
input [14:0] rdatasum, // right channel data
output reg left=0, //left bitstream output
output ... |
// 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> int a[200001]; int main() { int n, i, ans = 0; scanf( %d , &n); for (i = 0; i < n; i++) { int x; scanf( %d , &x); if (a[100000 + x] == 0 && x != 0) { ans++; a[100000 + x] = 1; } } printf( %d n , ans); return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int n; string s, t; cin >> n >> s >> t; vector<int> a(n + 1); for (int i = 0; i < n; ++i) a[i] = (s[n - i - 1] - a ) + (t[n - i - 1] - a ); for (int i = 0; i < n; ++i) { if (a[i] >= 26) { ++a[i + 1]; a[i... |
/* Module: vga640x480
Description: Generates VGA signals for 640x480 resolution
using a 25 MHz pixel clock. Once Vertical and
Horizontal sync signals are in between front
and back porch, VIDON is enabled
to display data. */
module vga640x480(
CLK,
CLR,
HSYNC,
VSYNC,
HC,
VC,
VIDON
);
//... |
//Legal Notice: (C)2015 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 int n, m, k, dp[2020][2020]; long long int getDp(long long int x, long long int y) { if (x == n) return y == k; if (~dp[x][y]) return dp[x][y]; long long int &ret = dp[x][y] = 0; ret = getDp(x + 1, y); ret = (ret + (getDp(x + 1, y + 1) * ... |
#include <bits/stdc++.h> using namespace std; int main() { int arr[100][100] = {0}; int n, x; cin >> n >> x; for (int i = 0; i < n; i++) { arr[i][i] = x; } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cout << arr[i][j] << ; } cout << endl; ... |
#include <bits/stdc++.h> using namespace std; long long solve(long long a, long long b, long long c) { long long a1 = a - c; a1 *= a1; long long b1 = c - b; b1 *= b1; long long c1 = b - a; c1 *= c1; return a1 + b1 + c1; } int main() { ios_base::sync_with_stdio(0); cin.tie(0);... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Generate_Position_And_Voltage_Ramp.v
// Created: 2014-09-08 14:12:04
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// ------------------------------------------... |
// $Id: c_prefix_arbiter_base.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:
Redist... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
package pkga;
int pvar;
class MyClass;
int member;
function int getpvar(); return pvar; endf... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, x; cin >> n; vector<long long> a; for (int i = 0; i < n; i++) { cin >> x; a.push_back(x); } for (int i = 0; i < n - 1; i++) { cout << a[i] + a[i + 1] << ; } cout << a[n - 1] << endl; retu... |
#include <bits/stdc++.h> using namespace std; void Solution() { int n, k; cin >> n >> k; int a[n]; vector<int> v; for (int i = 0; i < n; i++) { cin >> a[i]; if (5 - a[i] >= k) { v.push_back(a[i]); } } cout << v.size() / 3 << endl; } int main() { ios_base... |
#include <bits/stdc++.h> using namespace std; const int M = 1e6 + 5, P = 1e9 + 7; long long n, k, m, res, l, T, ans, mi; int dp[2][M], A[M], B[M], sum[M]; int main() { cin >> n >> l >> k; for (int i = 1; i <= n; i++) { scanf( %d , A + i); B[i] = A[i]; } sort(B + 1, B + 1 + n); ... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 500 * 1000 + 10; int n, h[Maxn], ans; vector<int> adj[Maxn], vec; bool mark[Maxn]; void dfs(int v) { mark[v] = true; if ((int)adj[v].size() == 1) vec.push_back(h[v]); for (int i = 0; i < (int)adj[v].size(); i++) if (!mark[adj[v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.