text stringlengths 59 71.4k |
|---|
module lc3_pipeline_stage2(
input reset,
input clk,
input stall,
input [5:0] state,
input [15:0] I_npc,
input [19:0] I_SR1,
input [19:0] I_SR2,
input [19:0] I_DR,
input [1:0] I_WBtype,
input [1:0] I_ALUopr,
input I_SetCC,
input [4:0] I_BRtype,
input [15:0] I_Forcast_pc,
... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014
// Date : Wed Apr 30 22:30:36 2014
// Host : macbook running 64-bit Arch Linux
// ... |
#include <bits/stdc++.h> int n, m, i, ans; int main() { scanf( %d , &n); for (i = 0; i < n; i++) scanf( %d , &m), ans += (i + 1) * m; printf( %d n , ans); 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 law... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n, m, k; cin >> n >> m >> k; long long p[m]; for (long long int i = 0; i < m; i++) cin >> p[i]; sort(p, p + m); long long an = 0, x = 0, c = 0, cp = 1; while (1) { long long y = x, pg = ceil((long double)(p[x] -... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > g[100100]; int fa[100100][18], typ[100100], n; int sum[100100][2], dep[100100]; void dfs(int u) { for (int i = 1; i < 18; ++i) fa[u][i] = fa[fa[u][i - 1]][i - 1]; for (auto v : g[u]) { int A = v.first, tp = v.second; sum... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2018 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] cr... |
/**
* 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 N = 1e6 + 10; int p[N], a[N], idx, pre[N]; void xxs() { int kns = 0; for (int i = 2; i <= N; i++) { if (!a[i]) { p[++idx] = i; kns++; } for (int j = 1; j <= idx && i * p[j] <= N; j++) { a[i * p[j]] = 1; ... |
#include <bits/stdc++.h> using namespace std; bool is_prime[100000]; void gen_is_primes(int n); void gen_prime_groups(int n, vector<bool>& to_match, list<int>& candidate_primes, list<pair<int, int> >& groups); void gen_prime_groups(int n, int p, vector<bool>& to... |
module top(
input PACKAGEPIN,
output PLLOUTCORE,
output PLLOUTGLOBAL,
input EXTFEEDBACK,
input [7:0] DYNAMICDELAY,
output LOCK,
input BYPASS,
input RESETB,
input LATCHINPUTVALUE,
//Test Pins
output SDO,
input SDI,
input SCLK
);
SB_PLL40_PAD #(
.FEEDBACK_PATH("DELAY"),
// .FEEDBACK... |
#include <bits/stdc++.h> using namespace std; const int int_inf = 0x7fffffff; const long long ll_inf = ~(1ll << 63); const double eps = 1e-7; char *p1, *p2, buf[1 << 20]; inline int read() { int f = 1, x = 0; char ch; while (!isdigit( ch = (p1 == p2 && (p2 = (p1 = b... |
/**
* bsg_cache_to_test_dram_rx.v
*
*/
`include "bsg_defines.v"
module bsg_cache_to_test_dram_rx
#(parameter `BSG_INV_PARAM(num_cache_p)
, parameter `BSG_INV_PARAM(data_width_p)
, parameter `BSG_INV_PARAM(dma_data_width_p)
, parameter `BSG_INV_PARAM(block_size_in_words_p)
, parameter `BSG_IN... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n, a, b, dp[200005][2]; cin >> n >> a >> b; string t; cin >> t; memset(dp, 0x3f, sizeof(dp)); dp[0][0] = b; for (int i = 0; i < n; i++) { if (t[i] == 1 ) dp[i + 1][1] = dp[i][1] + a + 2 * b; else ... |
/*
Title: RCFilter
Filters a single bit using a counter with optional hysteresis. The counter
increments when bitIn is high and decrements when it is low. bitOut is set when
bits FILT_WIDTH-1:HYST_BIT of the counter are all high, and clears when they are
all low. To remove hysteresis, just set HYST_BIT to equal FIL... |
// bsg_fifo_1r1w_small
//
// bsg_fifo with 1 read and 1 write
//
// When harden=0 (default), it uses async-read memory implementation
// Otherwise, it uses sync-read hardened memory implementation
// *** Two implementations above are functionally equivalent ***
//
// used for smaller fifos.
//
// input handshake protoc... |
// (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> template <class T1, class T2> inline bool cmin(T1 &a, const T2 &b) { return b < a ? (a = b, true) : false; } template <class T1, class T2> inline bool cmax(T1 &a, const T2 &b) { return a < b ? (a = b, true) : false; } template <class Type> Type read() { Type a; b... |
#include <bits/stdc++.h> using namespace std; string multiply(string num1, string num2) { int len1 = num1.size(); int len2 = num2.size(); if (len1 == 0 || len2 == 0) return 0 ; vector<int> result(len1 + len2, 0); int i_n1 = 0; int i_n2 = 0; for (int i = len1 - 1; i >= 0; i--) { in... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2013(c) Analog Devices, Inc.
// Author: Lars-Peter Clausen <>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, ... |
`ifndef INCLUDE_PARAMS
`include "params.v"
`endif
//32 bit registers - 32 Nos.
module Reg(
input wire clk, // Clock
input wire [`REG_ADDR_LEN - 1:0] ra,
input wire [`REG_ADDR_LEN - 1:0] rb,
output wire [`WIDTH - 1:0] dataA,
output wire [`WIDTH - 1:0] dataB,
output reg st_A, // output strobe
output reg st_B... |
// ----------------------------------------------------------------------
// 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:... |
#include <bits/stdc++.h> using namespace std; int n, d, sum, ans; char s[105]; int main() { scanf( %d %d , &n, &d); for (int i = 0; i < d; i++) { scanf( %s , s); bool ok = true; for (int j = 0; j < n; j++) if (s[j] == 0 ) ok = false; if (ok) sum = 0; else ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<array<int, 2>> a(n); map<int, int> hhor; map<int, int> hver; set<array<int, 2>> hor[n]; set<array<int, 2>> ver[n]; int idhor... |
#include <bits/stdc++.h> using namespace std; const int NMAX = 50505; const int LMAX = 1600505; int N, A[NMAX]; vector<int> G[NMAX]; int currIdx; unordered_map<int, int> allValues; vector<int> newValues; int L[NMAX]; bool mark[NMAX]; vector<int> R; void read() { scanf( %d , &N); for (int... |
#include <bits/stdc++.h> using namespace std; int main() { string s1, s; cin >> s1 >> s; int a[10] = {0}, b[10] = {0}; for (int i = 0; i < s1.size(); i++) { int m = s1[i] - 0 ; if (m == 5 || m == 2) a[2]++; else if (m == 6 || m == 9) a[6]++; else a[m]... |
#include <bits/stdc++.h> using namespace std; inline int gi() { char c = getchar(); while (c < 0 || c > 9 ) c = getchar(); int sum = 0; while ( 0 <= c && c <= 9 ) sum = sum * 10 + c - 48, c = getchar(); return sum; } const int maxn = 100005; int n, a[maxn], cnt[maxn], p[maxn][3], val[... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-2011 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
... |
// (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 "defines.v"
`include "connectRouter_2SNoBuffer.v"
`timescale 1ns/1ps
module tb_connectRouters(
);
reg clk, rst;
reg `control_w port_in, inj;
reg bfull;
wire `control_w port_out, eject;
wire accept, push;
connectRouter_nobuffer r(
.clk(clk),
.rst(rst),
... |
/**
\file "startup-set.v"
Test case with set commands from a prsimrc source.
*/
`timescale 1ps/1ps
`include "clkgen.v"
module timeunit;
initial $timeformat(-9,1," ns",9);
endmodule
module TOP;
wire in;
reg back, probe, g1, g2;
clk_gen #(.HALF_PERIOD(10), .PHASE_SHIFT(2)) clk(in);
// prsim stuff
initial ... |
#include <bits/stdc++.h> using namespace std; vector<int> V; vector<int> E[200005]; int d[200005]; int p[200005]; int find(int x) { while (p[x] != x) p[x] = p[p[x]], x = p[x]; return x; } int rnk[200005]; void meld(int x, int y) { x = find(x), y = find(y); if (rnk[x] > rnk[y]) swap(x, ... |
#include <bits/stdc++.h> using namespace std; inline int min(int _a, int _b) { return _a < _b ? _a : _b; } inline int max(int _a, int _b) { return _a > _b ? _a : _b; } template <class _T> inline void rd(_T &_a) { int _f = 0, _ch = getchar(); _a = 0; while (_ch < 0 || _ch > 9 ) { if (_ch =... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, k, ans = 0; cin >> n >> k; if (n % k > (k / 2)) { cout << (n / k) * k + (k / 2) << endl; } else { cout << n << 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... |
module j1soc#(
//parameter bootram_file = "../../firmware/hello_world/j1.mem" // For synthesis
parameter bootram_file = "../firmware/Hello_World/j1.mem" // For simulation
)
(uart_tx, ledout,
sys_clk_i, sys_rst_i,
bt_tx, bt_rx,ledres,mclk,m... |
#include <bits/stdc++.h> using namespace std; int main() { long long int x; cin >> x; cout << x / 2520; } |
#include <bits/stdc++.h> using namespace std; const int Nmax = 1000005, Mod = 1e9 + 7; const int Mod1 = 1e9 + 7, Mod2 = 1e9 + 9; char A[Nmax], B[Nmax]; int hash1[Nmax], hash2[Nmax]; int inv_hash1[Nmax], inv_hash2[Nmax]; int main() { ios::sync_with_stdio(false); int N, M; cin >> N >> M; cin... |
#include <bits/stdc++.h> using namespace std; int main() { int n = 6; int x, f[12] = {0}; for (int i = 0; i < n; i++) { cin >> x; f[x]++; } bool res = 0; for (int i = 0; i < 10; i++) { if (f[i] >= 4) { res = 1; f[i] -= 4; for (int j = 0; j < 10; j++)... |
/**
* 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 INF = 1LL << 60; long long MOD = 1e9 + 7; namespace output { void pr(short x) { cout << x; } void pr(signed x) { cout << x; } void pr(long x) { cout << x; } void pr(long long x) { cout << x; } void pr(unsigned short x) { cout << x; } void pr(un... |
#include <bits/stdc++.h> using namespace std; long long ansp[200001]; int main() { long long k; memset(ansp, 0, sizeof(ansp)); scanf( %lld , &k); char s[200001], t[200001], ans[200001]; scanf( %s %s , s, t); long long add = 0, dec = 0, again = 0; long long i, j; for (i = 0; i < k; ... |
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> PII; const int maxn=111111,mod=998244353; const double PI=3.141592653589793; #define MP make_pair #define PB push_back #define lson o<<1,l,mid #define rson o<<1|1,mid+1,r #define FOR(i,a,b) for(int i=(a);i<=(b);... |
#include <bits/stdc++.h> using namespace std; int main() { string s; int pearls = 0, links = 0; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == - ) links++; else pearls++; } if (pearls == 0) cout << yes << endl; else if (links % pearls == 0... |
#include <bits/stdc++.h> using namespace std; void JIZZ(string output = ) { cout << output; exit(0); } const long double PI = 3.14159265358979323846264338327950288; const long double eps = 1e-13; const long long mod = 1e9 + 7; struct node { node *l, *r; int mx; node() : l(0), r(0), m... |
#include <bits/stdc++.h> using namespace std; const long long int MOD = 1000000000 + 7; long long int arr[200005]; int main() { ios::sync_with_stdio(0); cin.tie(0); long long int t; cin >> t; while (t--) { long long int n, sum = 0; cin >> n; for (long long int i = 0; i < n;... |
// (C) 2001-2011 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... |
`timescale 1ns / 1ps
//**********************************************************************
// File: spi_master.v
// Module:spi_master
// by Robin zhang
//**********************************************************************
module spi_master_kl(
clk,rst_n,
spi_miso,spi_mosi,spi_clk,
spi_tx_en,spi_rx_en,spi_over... |
#include <bits/stdc++.h> using namespace std; int read() { int num = 0; bool f = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) { f = (ch == - ); ch = getchar(); } while (ch >= 0 && ch <= 9 ) { num = (num << 1) + (num << 3) + ch - 0 ; ch = getchar(); } ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1000005; int N; vector<int> G[MAX_N]; int cyid[MAX_N], Q[MAX_N]; vector<vector<int>> cycles, newcycles; void find_cycle(int s, int curid) { cyid[s] = curid; cycles.back().push_back(s); for (int i = 0; i < G[s].size(); i++) { ... |
/*
* Arithmetic and logical operations for Zet
* Copyright (C) 2008-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
* F... |
/*
* Copyright 2013-2016 Colin Weltin-Wu ()
* UC San Diego Integrated Signal Processing Group
*
* Licensed under GNU General Public License 3.0 or later.
* Some rights reserved. See LICENSE.
*
* reg_slice.v
*
* General purpose register bank. For correct operation, this block requires
* a running clock on ... |
`include "bsg_defines.v"
module bsg_fsb_to_nasti_slave_connector
import bsg_fsb_pkg::RingPacketType;
import bsg_nasti_pkg::bsg_nasti_addr_channel_s;
import bsg_nasti_pkg::bsg_nasti_write_data_channel_s;
import bsg_nasti_pkg::bsg_nasti_read_data_channel_s;
import bsg_nasti_pkg::bsg_nasti_write_response_channel_s;
#(p... |
/*
* 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:39:56 02/27/2014
// Design Name:
// Module Name: seven_seg_dev
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies: ... |
/**
* 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... |
//caution do not edit this file manually it is a template in tenjin format
`define Buff_size 32
////////////////////////////////////////////
module top(clk,rst_n,rs232_rx, BusA, led);
///////////////////////////////////////////
input clk; // 50MHz
input rst_n; //reset, neg edge.
input rs232_rx; // RS232 rec
... |
#include <bits/stdc++.h> char S[1000000 + 5], T[1000000 + 5]; int c[1000000 + 5][26], l[1000000 + 5], f[1000000 + 5], tn, df[1000000 + 5], ff[1000000 + 5], s[1000000 + 5], F[1000000 + 5]; int main() { int n, i, j, x; scanf( %s , S + 1); n = strlen(S + 1); T[0] = 255; for (i = 1; i <= n /... |
#include <bits/stdc++.h> using namespace std; int len; char s[109]; int main() { cin >> len; cin >> s; int interval = 0; for (int i = 0; i < len; i += interval) { cout << s[i]; interval++; } return 0; } |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; long long a[n], b[n]; long long sum = 0, tum = 0, cnt = 0, aod = 0, aev = 0, bod = 0, bev = 0; for (long long i = 0; i < n; i++) { cin >> a[i] >> b[i]; if (a[i] % 2 == 0) aev++; if (a[i] % 2 == ... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-6; const int mod = 1e9 + 7; const int maxn = 2e6 + 100; const int maxm = 2e6 + 100; const int inf = 0x3f3f3f3f; const double pi = acos(-1.0); int t; pair<long long, long long> a[maxn]; long long s; int n; int vis[maxn]; bool c... |
/*
* 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) 1991-2013 Altera Corporation
//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 from any of the foregoing
//(including device programming or simulation files), and any
//associated documentatio... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; int orig[n]; int product = 1; int counter = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; orig[i] = arr[i]; if (arr[i] >= 0) { arr[i] = -arr[i] - 1; } if (arr[i... |
// file: Clock35MHz.v
//
// (c) Copyright 2008 - 2011 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... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0; bool f = 1; char s = getchar(); while ((s < 0 || s > 9 ) && s > 0) { if (s == - ) f ^= 1; s = getchar(); } while (s >= 0 && s <= 9 ) x = (x << 1) + (x << 3) + s - 0 , s = getchar(); ... |
#include <bits/stdc++.h> using namespace std; int a[200005], c[200005], b[200005], ans[200005]; struct node { int x, y; } e[200005]; int main() { int n, m, Max = 0; scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); } for (int i = 1; i <= m; i++) { sc... |
/*
* 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; string ToStr(char k) { stringstream ss; ss << k; return ss.str(); } bool check(string str) { int n = (int)str.length(); for (int i = 0; i < n / 2; i++) { if (str[i] != str[n - i - 1]) return false; } return true; } int main() { ... |
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; const int N = 2e5 + 10; int T, n, a[N], vis[N], d[N], mi, mx; signed main() { cin >> T; while (T--) { cin >> n; mi = 0x3f3f3f3f, mx = -999; for (int i = 1; i <= n; i++) scanf( %d , &a[i]), vis[a[i]] = i; for ... |
/*
Copyright (c) 2014-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... |
//`#start header` -- edit after this line, do not edit this line
// ========================================
// Copyright 2013 David Turnbull AE9RB
//
// 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 o... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Thu May 25 15:27:52 2017
// Host : GILAMONSTER running 64-bit major release (... |
module dut (output reg[31:0] size,
output reg signed [31:0] ival,
output reg [31:0] hval);
parameter string foo = "1234";
string tmp;
real rval;
initial begin
size = foo.len();
ival = foo.atoi();
hval = foo.atohex();
rval = foo.atoreal();
tmp = foo;
... |
/**
* 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
`include "../global.v"
module FPU_top_exception_tb();
reg clk, reset;
reg [3:0] opCode;
reg [1:0] roundingMode;
reg [31:0] A;
reg [31:0] B;
reg [31:0] ER; //expected result
wire resultReady;
wire [31:0] result;
wire invalidOperation, divisionByZero, overflow, unde... |
/**
* 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 = 1e9 + 7; const long long HASH = 1e16 + 7; const long long INF = 1e9; long long tavan(long long a, long long b) { return b ? (tavan(a * a, b >> 1) * (b & 1 ? a : 1)) : 1; } long long gcd(long long a, long long b) { return (a < b) ?... |
//////////////////////////////////////////////////////////////////////
//// ////
//// i2cSlave.v ////
//// ////
//// This file is part of the i2cSla... |
#include <bits/stdc++.h> using namespace std; int main(void) { int a[10] = {0}; int n; string d; cin >> n; cin >> d; for (int i = 0; i < d.size(); i++) { if (d[i] == L ) { for (int j = 0; j < 10; j++) { if (a[j] == 0) { a[j] = 1; break; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100100; vector<int> v; struct mmp { int to, next, len; mmp() {} mmp(int a, int b, int c) { to = a, next = b, len = c; } } e[maxn << 1]; int vis[maxn], st, ed, cnt, head[maxn], val[maxn], len; void add(int u, int v, int len) { e... |
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; bool inBound(int x) { return x >= 0 && x < 30001; } int main() { std::ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0); int n, d; cin >> n >> d; int mx = 30000; vector<int> gems(mx + 1, 0); fo... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int MAXN = (int)3e3 + 5; const long long INF = (long long)1e15; pair<int, long long> dp[MAXN][MAXN]; vector<int> adj[MAXN]; int arr[MAXN]; int sub[MAXN]; int n, m; void dfs(int v, int pr = -1) { fill(dp[v], dp[v] + n + 1, make_pair(-n, -INF)); ... |
#include <bits/stdc++.h> using namespace std; int n, p, start[390000], fin[390000]; map<pair<int, int>, int> mp; int main() { scanf( %d %d , &n, &p); vector<int> cnt(n, 0); for (int i = 0; i < n; i++) { int x, y; scanf( %d %d , &x, &y); x--; y--; if (x > y) swap(x, y); ... |
#include <bits/stdc++.h> using namespace std; long long cubes[100001], x; long long my_pow(long long x) { return x * x * x; } pair<long long, long long> best; void rec(long long m, long long steps, long long subtracted) { if (m == 0) { best = max(best, make_pair(steps, subtracted)); return; ... |
#include <bits/stdc++.h> using namespace std; enum STATE { IN, OUT, BOUNDRY }; const double PI = acos(-1.0); void fast_in_out() { std::ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); } int dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0}; int dy[] = {-1, 1, 0, 0, -1, -1, 1, 1, 0}; int l... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const long long INF = 1e15; using Graph = vector<vector<long long>>; signed main() { long long T; cin >> T; for (long long t = 0; t < T; t++) { long long N; cin >> N; vector<long long> A(N); for... |
#include <bits/stdc++.h> using namespace std; template <class T> using vec = vector<T>; template <typename Iter> ostream &_IterOutput_(ostream &o, Iter b, Iter e, const string ss = , const string se = ) { o << ss; for (auto it = b; it != e; it++) o << (it == b ? : , ) ... |
#include <bits/stdc++.h> #define ed end() #define bg begin() #define mp make_pair #define pb push_back #define vv(T) v(v(T)) #define v(T) vector<T> #define all(x) x.bg,x.ed #define newline puts( ) #define si(x) ((int)x.size()) #define rep(i,n) for(int i=1;i<=n;++i) #define rrep(i,n) for(int i=... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long a, b, x, y; long long best, ansp, ansq; int main() { while (cin >> a >> b >> x >> y) { long long gg = gcd(x, y); x /= gg; y /= gg; best = -1; ... |
#include <bits/stdc++.h> using namespace std; const long long int N = 100005; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); { long long int i, j, k, n, m, ans = 0, cnt = 0, sum = 0; cin >> n; vector<long long int> v; long long int a[n]; ... |
#include <bits/stdc++.h> using namespace std; void read() { freopen( input.txt , r , stdin); } bool check(string s) { long long ans = s[0] - 0 ; ans = ans * 10ll + (s[1] - 0 ); if (ans % 4 == 0) return true; return false; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); ... |
/*
* File: pippo_barrel.v
* Project: pippo
* Designer: fang@ali
* Mainteiner: fang@ali
* Checker:
* Assigner:
* Description: barrel shifter
* Task
* [TBD]ºÏ²¢32λºÍ64Î»ÒÆÎ»Âß¼£»
* [TBO]¶àÖÜÆÚ²ÎÊý»¯
*/
module pippo_barrel (
shift_in,
shift_cnt,
shift_left,
shift_a... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: CHARMAP.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ============================... |
#include <bits/stdc++.h> using namespace std; int n, m; string s, t; vector<char> vv; int main() { cin >> n >> m; cin >> s; for (int i = 0; i < n; i++) vv.push_back(s[i]); sort(vv.begin(), vv.end()); if (((int)(s).size()) < m) { t = s; for (int i = ((int)(s).size()); i < m; i++... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2 * 1000 + 17; int n, init[MAXN][MAXN], hope[MAXN][MAXN], c[MAXN][MAXN], r[MAXN], cnt = 1, comp[MAXN << 2]; vector<int> out[MAXN << 2], in[MAXN << 2], order, trash; vector<pair<string, int>> ans; void add(int i, bool f1, int j, bool f2) { ... |
// ==================================================================
// >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
// ------------------------------------------------------------------
// Copyright (c) 2006-2011 by Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// -------... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long a[n + 10]; for (int i = 1; i <= n; ++i) scanf( %lld , &a[i]); long long x, y; cin >> x >> y; long long h = x + y; long long sum = 0; for (int i = 1; i <= n; ++i) { sum = sum + y * (a... |
/*module ds8dac1(clk, in_data, sout);
input clk;
input [7:0] in_data;
output reg sout;
reg [8:0] PWM_accumulator;
reg [7:0] PWM_add;
initial
begin
PWM_accumulator <= 0;
PWM_add <=0;
end
always @(posedge clk) begin
PWM_accumulator <= PWM_accumulator[7:0] + PWM_add;
PWM_add <= in_data;
end
always @(negedge clk) b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.