text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); string str; cin >> str; bool flag = false; for (int i = 0; i < str.size(); i++) { if (str[i] == H || str[i] == Q || str[i] == 9 ) { flag = true; break; } } if (flag) ... |
#include <bits/stdc++.h> using namespace std; long long dp[5011][5011]; void solve() { long long n, m; cin >> n >> m; string s1, s2; cin >> s1 >> s2; s1 = . + s1; s2 = . + s2; long long ans = 0; for (long long i = 1; i <= n; i++) { for (long long j = 1; j <= m; j++) { ... |
#include <bits/stdc++.h> using namespace std; int read() { int kkk = 0, x = 1; char c = getchar(); while ((c < 0 || c > 9 ) && c != - ) c = getchar(); if (c == - ) c = getchar(), x = -1; while (c >= 0 && c <= 9 ) kkk = (kkk << 3) + (kkk << 1) + (c - 0 ), c = getchar(); return ... |
/*
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... |
//*******************************************************************************************************************************************************/
// Module Name: smr_reg
// Module Type: Synchronous Register
// Author: Shreyas Vinod
// Purpose: Memory Address Register (MAR) and Program Counter (PC) for Nept... |
/*
* 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; inline void chkmax(long long &a, long long b) { if (a < b) a = b; } inline void chkmin(long long &a, long long b) { if (a > b) a = b; } inline long long read() { long long a = 0, fh = 1; char c = getchar(); while (c > 9 || c < 0 ) { ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sctag_dir_ctl.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... |
/*
* 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 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
/////////////////////////////////////////////////////////////////////
//// ////
//// Forward Discrete Cosine Transform and ZigZag unit ////
//// ////
//// Author: Richard Herveille ... |
module blinki (
(* intersynth_port = "Reset_n_i" *)
input Reset_n_i,
(* intersynth_port = "Clk_i" *)
input Clk_i,
(* intersynth_port = "Outputs_o", intersynth_conntype = "Bit" *)
output reg LED_o,
(* intersynth_param = "PeriodH_i", intersynth_conntype = "Word" *)
input[15:0] PeriodH_i,
(* intersynth_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 la... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int inf = 0x3f3f3f3f; const double eps = 1e-10; const long long INF = (1LL << 60); int main() { int a, b; scanf( %d%d , &a, &b); if (a == b) { printf( %d n , a); return 0; } double ans = -1; ... |
#include <bits/stdc++.h> using namespace std; int top = 0; int N, Q, NN; int K, M, R; vector<int> Adj[100005]; int dep[100005]; int anc[100005][21]; int pre[100005], pst[100005], tt; void dfs(int u) { pre[u] = ++tt; for (int j = 1; j <= 20; j++) { if (dep[u] <= (1 << j)) break; anc... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 9; int main() { long long n, m; cin >> n >> m; vector<int> row(n), col(n); int r = 0, c = 0; int x, y; long long ans = n * n; for (int i = 0; i < m; i++) { scanf( %d %d , &x, &y); long long v = 0; ... |
#include <bits/stdc++.h> using namespace std; typedef struct { long long j, x1, x2; } inter; struct comp1 { bool operator()(const inter& a, const inter& b) const { return a.x1 < b.x1; }; }; struct comp2 { bool operator()(const inter& a, const inter& b) const { return (a.x2 == b.x2) ? (a.x1... |
#include <bits/stdc++.h> using namespace std; vector<int> vi; void primefact(int n) { while (n % 2 == 0) { vi.push_back(2); n /= 2; } int i = 3; while (i <= n) { while (n % i == 0) { vi.push_back(i); n /= i; } i += 2; } if (n > 2) vi.push_back(... |
//-----------------------------------------------------------------
// FPGA Audio Project SoC IP
// V0.1
// Ultra-Embedded.com
// Copyright 2011 - 2012
//
// Email:
//
// License: LGPL
//
// If you wo... |
#include <bits/stdc++.h> using namespace std; int arr[200000 + 10]; int arr2[200000 + 10]; int main() { int n, num1 = 0, num2 = 0, tem1, l1 = 0, l2 = 0, num = 0; long long ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> tem1; if (tem1 == 0) { ans += num; } else ... |
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * INRIA, CNRS and contributors - Copyright 1999-2019 *)
(* <O___,, * (see CREDITS file for the list of authors) *)
(* \VV/ *********... |
#include <bits/stdc++.h> const double pi = acos(-1.0); const int INF = 0x3f3f3f3f; const double eps = 1e-8; const int MAXN = 1e3 + 10; const int mod = 1e9 + 7; const int dir[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; const int seed = 131; int cases = 0; char str[MAXN]; int mp[MAXN], col[MAXN], cnt[3... |
module ShowControl(clk, enhe, outcont, Reset, change, Z, Start, EN, creaenhe, Init, Shift, Ready, Cycend, rst, Beg, scrinit);
input clk, enhe, outcont, Reset, change, Z, Ready, Cycend;
output reg Start, EN, creaenhe, Init, Shift, rst, Beg;
output reg [2:0]scrinit;
reg [3:0] current_state;
reg [3:0] next_state;
... |
//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 associated do... |
// (c) Copyright 1995-2016 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 license and does not grant ... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-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
... |
#include <bits/stdc++.h> using namespace std; long long H; int N, M, K; long long A[100002], C[100002]; long long add[100002]; bool can[100002]; long long minget[10002]; set<pair<long long, int> > Q; set<pair<int, int>, greater<pair<int, int> > > S; int main() { cin.sync_with_stdio(false); c... |
// The shader asserts row lines for a length of time that is proportional
// to the intensity value stored in the values vector.
// Synchronous active low reset.
module shader(input clk,
input rst_n,
input [(32*5-1):0] values,
output reg [31:0] rows
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; const int mod = 1e9 + 7; const long long inf = 1e17; char a[maxn], b[maxn], s[maxn]; int v[200]; int main() { int q; scanf( %s%s , a, b); int n = strlen(a); for (int i = 0; i < n; ++i) v[a[i]] = 1; n = strlen(b); ... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; vector<int> g[2 * N]; vector<pair<int, int> > mark[N]; int n, m; long long val[N]; struct Bit { long long c[N]; int lowbit(int x) { return x & -x; } long long Sum(int x) { long long res = 0; while (x > 0) { ... |
#include <bits/stdc++.h> using namespace std; int pro(int *a, int *b, int t, int s) { int k = 0; for (int i = 1; i < t; i++) { if (b[i] != s) { return 2; } if (b[i] == 0) { k++; } } if (k == (t - 1)) { return 3; } return 1; } int main() { ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, m, tren, pos[N], cnt[N]; vector<int> g[N]; int dist(int a, int tr) { if (a > tr) return a - tr; else return n + a - tr; } bool cmp(int a, int b) { if (dist(a, tren) < dist(b, tren)) return true; return ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:28:59 05/19/2015
// Design Name: cpu_behav
// Module Name: C:/Users/joseph/Desktop/SPRAM/test_cpu.v
// Project Name: SPRAM
// Target Device:
// Tool ... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2.1 (win64) Build Wed Aug 9 16:32:24 MDT 2017
// Date : Fri Sep 22 14:43:38 2017
// Host : EffulgentTome running 64-bit major re... |
#include <bits/stdc++.h> using namespace std; const int oo = 0x3f3f3f3f; const double eps = 1e-9; const int maxn = 100000 + 10; int go[maxn][26], fail[maxn]; int I[maxn], F[maxn], S[maxn], FIN[maxn]; int total; void push(string &s, int index, int freq) { int u = 0; for (auto c : s) { int x... |
#include <bits/stdc++.h> using namespace std; #pragma GCC target( avx2 ) #pragma GCC optimization( unroll-loops ) #pragma GCC optimize( O2 ) constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1}; constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1}; constexpr long long INF = 1999999999999999997; constexpr int in... |
module v7_emac_controller
(
// asynchronous reset
input glbl_rst,
// 200MHz clock input from board
input clkin200,
output phy_resetn,
//added SGMII serial data and reference clock ports
input gtrefclk_p, // Differenti... |
/*
** Copyright (C) 2009 Onno Kortmann <>
**
** 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, or
** (at your option) any later version.
**
** This program ... |
`timescale 1ns/1ps
module match(
clk,
reset,
localbus_cs_n,
localbus_rd_wr,
localbus_data,
localbus_ale,
localbus_ack_n,
localbus_data_out,
metadata_valid,
metadata,
action_valid,
action,
action_data_valid,
action_data
);
input clk;
input reset;
input localbus_cs_n;
input ... |
#include <bits/stdc++.h> using namespace std; long long a[2000000]; int main() { long long n, t, i; cin >> n; for (i = 0; i < n; i++) { scanf( %lld , &a[i]); } cin >> t; for (i = 0; i < t; i++) { long long x; scanf( %lld , &x); a[x - 1] = -a[x - 1]; } stack<... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2011 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
interface intf;
typedef logic [7:0] octet;
typedef octet [1:0] word;
octet [1:0] octets;
word ... |
#include <bits/stdc++.h> using namespace std; constexpr int inf = 1e9; int main() { int n, m; cin >> n >> m; vector<int> d(m), h(m); for (int i = 0; i < m; ++i) { cin >> d[i] >> h[i]; } int ans = max(h[0] + d[0] - 1, h.back() + (n - d.back())); for (int i = 0; i + 1 < m; ++i) { ... |
`timescale 1ns/10ps
module ROMMatrixSim;
reg clock;
reg reset;
reg [11:0] inst;
reg inst_en;
wire out;
wire testrom_data_o;
wire [15:0] rommatrix_rom_addr;
initial begin
#0 $dumpfile(`VCDFILE);
#0 $dumpvars;
#1000 $finish;
end
... |
#include <bits/stdc++.h> using namespace std; template <class T> using VV = vector<vector<T>>; template <class T> inline T SMIN(T& a, const T b) { return a = (a > b) ? b : a; } template <class T> inline T SMAX(T& a, const T b) { return a = (a < b) ? b : a; } template <class Iter> void dump... |
#include <bits/stdc++.h> using namespace std; bool visited[10000]; int main() { ios::sync_with_stdio(false); ios_base::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); string input; int counter; while (cin >> input) { counter = 0; for (int i = 0; i < input.size() - ... |
module membusif(
input wire clk,
input wire reset,
// Avalon Slave
input wire [1:0] s_address,
input wire s_write,
input wire s_read,
input wire [31:0] s_writedata,
output reg [31:0] s_readdata,
output wire s_waitrequest,
// Membus Master
output reg m_rq_cyc,
output reg m_rd_rq,
output reg m_wr_rq,
outp... |
#include <bits/stdc++.h> using namespace std; int par[200010]; bool isLeaf[200010]; vector<int> adj[200010]; long long f[200010], dp[200010], s[200010], ans = 0, n; void duyet(int u) { s[u] = 1; f[u] = 0; for (int i = 0; i < adj[u].size(); i++) { int v = adj[u][i]; if (par[u] != v) {... |
#include <bits/stdc++.h> using namespace std; struct square { int r1, c1, r2, c2; square(int R1, int C1, int R2, int C2) { r1 = R1; c1 = C1; r2 = R2; c2 = C2; } bool same(int R1, int C1, int R2, int C2) { if (R1 != r1) return false; if (C1 != c1) return false; ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: Sdram_RD_FIFO.v
// Megafunction Name(s):
// dcfifo
// ============================================================
// ****************************... |
#include <bits/stdc++.h> using namespace std; bool cmp(const pair<long long, long long> &a, const pair<long long, long long> &b) { return (a.second < b.second); } long long power(long long x, long long y) { long long res = 1; x = x; if (x == 0) return 0; while (y > 0) { if (... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int c[maxn], up[maxn], h[maxn]; bool visited[maxn]; set<int> s[maxn]; vector<int> g[maxn]; void dfs(int v, int par = -1) { c[v] = v; visited[v] = 1; up[v] = h[v]; int cnt = 0; for (auto u : g[v]) { if (u == ... |
#include <bits/stdc++.h> int main() { char s[100]; scanf( %s , s); int ans = 0; for (int i = 0; s[i]; ++i) { if (isalpha(s[i])) { if (s[i] <= Z ) ans += s[i] - A + 1; else ans -= s[i] - a + 1; } } printf( %d n , ans); return 0; } |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2013 Xilinx Inc.
//
// 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
//
// ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 7; vector<pair<int, int> > G[MAXN]; int n; int sz[MAXN]; long long MAX, MIN; void dfs(int u, int fa) { sz[u] = 1; for (pair<int, int> edge : G[u]) { int v = edge.first; if (v == fa) continue; dfs(v, u); sz... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01/07/2017 08:59:22 AM
// Design Name:
// Module Name: mux_sim
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Re... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:56:12 06/23/2014
// Design Name: Top_Muliti_IOBUS
// Module Name: C:/Users/Deus/Windows Sync/Xilinx Workspace/Multi_Cycle_CPU/top.v
// Project Name: M_C_... |
// Warning R1: No reset specified
// Created by fizzim.pl version $Revision: 5.0 on 2014:07:06 at 16:03:00 (www.fizzim.com)
module DE1_disp (
output reg [3:0] DISPn,
output reg [6:0] HEX,
input wire [6:0] HEX0,
input wire [6:0] HEX1,
input wire [6:0] HEX2,
input wire [6:0] HEX3,
input wire clk
);
/... |
#include <bits/stdc++.h> using ll = long long int; using namespace std; struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t oper... |
#include <bits/stdc++.h> using namespace std; int main() { char cell; short r, c, rr, cc, e; int res = 0, i, cat[100], cnt = 0; cin >> r >> c; rr = r; cc = c; for (i = 0; i < r; i++) { e = 0; for (int I = 0; I < c; I++) { cin >> cell; if (cell == S ) { ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; const long long mod = 1000000007; void solve() { int n, m, u, v; cin >> n >> m; vector<int> adj[n + 1]; for (int i = 0; i < m; i++) { cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } v... |
#include <bits/stdc++.h> const int N = 5000 + 10; struct node { int l, r, id; }; node a[N]; bool pre[N], suf[N]; std::vector<node> vector; bool cmp(const node& i, const node& j) { if (i.r ^ j.r) return i.r < j.r; else return i.l < j.l; } bool cc(const node& i, const node& j) { ... |
module pulse
#(parameter dly=3,
parameter len=2)
(input rstn,
input clk,
output reg pulse);
localparam width = $clog2(dly+len)+1;
reg [width-1:0] cnt;
always @(posedge clk or negedge rstn) begin
if (~rstn)
cnt <= 1'b0;
else if (cnt != dly+len)
cnt <= cnt + 1'b1;
end
alwa... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:12:38 06/05/2016
// Design Name:
// Module Name: Prueba_Alarma
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies: ... |
// (C) 2001-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 associated doc... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) using namespace std; const int MAX_N = 200004; char s[MAX_N], t[MAX_N]; int l[MAX_N], r[MAX_N]; vector<int> p[40]; int read() { int x; scanf( %d , &x); return x; } int num(char x) { return x - a ; } bool find(int x, int... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); int n, k; cin >> n >> k; string s; cin >> s; int c = 0; if (k == 0) cout << s << endl; else if (n == 1) { cout << 0 << endl; } else if (k >= 1... |
#include <bits/stdc++.h> using namespace std; long long mcd(long long a, long long b) { if (b > a) swap(a, b); if (b == 0) return a; else return mcd(b, a % b); } long long i, j, n, m, q, a, l, r, b; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); cin... |
#include <bits/stdc++.h> using namespace std; int main() { int n, l; cin >> n >> l; vector<int> v = vector<int>(n); for (int i = 0; i < n; i++) cin >> v[i]; sort(v.begin(), v.end()); int vals = 1; int prev = v[0]; vector<pair<int, int>> vp; vp.push_back(make_pair(prev, 1)); f... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; const int MOD = 1e9 + 7; void solve() { int n, m; cin >> n >> m; vector<int> a(n), b(m + 1), la(m + 1); for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 1; i < m + 1; ++i) cin >> b[i]; int mid = 0, l = 0, r = n -... |
module ITU_656_Decoder( // TV Decoder Input
iTD_DATA,
// Position Output
oTV_X,
oTV_Y,
oTV_Cont,
// YUV 4:2:2 Output
oYCbCr,
oDVAL,
// Control Signals
iSwap_CbCr,
iSkip,
iRST_N,
iCLK_27 );
input [7:0] iTD_DATA;
input iSwap_CbCr... |
#include <bits/stdc++.h> using namespace std; char inp[1005], ans[1005]; int n, p; bool possible(int pos, int ok) { if (pos == n) return ok; int start = ok ? 0 : inp[pos] - a ; int i; for (i = start; i < p; i++) { ans[pos] = i + a ; if (pos > 0 && ans[pos - 1] == ans[pos]) continue... |
#include <bits/stdc++.h> using namespace std; using namespace std; struct node { int l, m, r; }; node t[3000005]; int arr[300005], n, m; long long a[300005]; int sign(long long x) { if (x > 0) return 1; if (x < 0) return -1; return 0; } void cal(int x, int l, int r) { int m = (l ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000000 + 10, MOD = (int)1e+9 + 7; long long fac[MAXN], Ifac[MAXN], T; int k, w; long long Pow(long long a, long long b) { long long d = 1; for (; b; d = (b & 1) ? d * a % MOD : d, a = a * a % MOD, b /= 2) ; return d; } long ... |
/**
* 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, arr[110], c1, c0; int main() { scanf( %d , &n); for (int i = 0; i < n; ++i) scanf( %d , &arr[i]), c1 += arr[i]; int out = 0; for (int i = 0; i < n; ++i) { c0 += (!arr[i]); out = max(out, c0 + c1); c1 -= arr[i]; } cout <... |
#include <bits/stdc++.h> using namespace std; const int di[] = {-1, -1, -1, 0, 1, 1, 1, 0, 0}, dj[] = {-1, 0, 1, 1, 1, 0, -1, -1, 0}; int st[20][20][20] = {}; bool fr[20][20][20 * 20] = {}; int n; void file_open() { freopen( input.txt , r , stdin); freopen( output.txt , w , stdout); ... |
/* Copyright (c) 2015 Convey Computer Corporation
*
* This file is part of the OpenHT toolset located at:
*
* https://github.com/TonyBrewer/OpenHT
*
* Use and distribution licensed under the BSD 3-clause license.
* See the LICENSE file for the complete license text.
*/
module HtResetFlop1x2x (
input clkhx,
inpu... |
#include <bits/stdc++.h> using namespace std; void canhazfast() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <typename T> T extgcd(T a, T b, T &x, T &y) { T x0 = 1, y0 = 0, ... |
`timescale 1ns/1ps
module I2C_testbench();
reg [6:0] address;
reg [7:0] register;
reg clk;
wire sys_clk;
wire refresh_clk;
reg mode;
reg en;
reg reset;
reg Start;
reg Stop;
reg repeat_start;
wire [7:0] out;
tri1 sda;
tri1 scl;
wire ack;
wire sda_master, sda_slave;
reg sda_master_... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; long long a[n]; long long m = 1e9; long long sum = 0; for (long long i = 0; i < n; ++i) cin >> a[i], m = min(m, a[i]), sum += a[i]; for (long long i = 0; i < n; ++i) { if ((a[i] - m) % k != 0)... |
// UC Berkeley CS251
// Spring 2018
// Arya Reais-Parsi ()
`include "const.vh"
module RegisterFile #(
parameter LOG2_NUM_REGISTERS = 5,
parameter NUM_REGISTERS = 1 << (LOG2_NUM_REGISTERS)
)(
input clk,
input reset,
// NOTE(aryap): This should just be 4:0 for the initial code.
input [LOG2_NUM_REGISTERS-1:... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:23:37 11/08/2015
// Design Name:
// Module Name: Integradorv2
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
... |
#include <bits/stdc++.h> using namespace std; int n, m, x, y; int p[100010], q[100010]; vector<int> t[100010], v[100010]; int mn[100010]; bool flag[100010]; inline int dist(int x, int y) { if (p[x] - q[y] >= 0) return p[x] - q[y]; else return q[y] - p[x]; } int main() { scanf( ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.precision(10); int n; cin >> n; int m; cin >> m; std::vector<std::vector<long long> > re(n, std::vector<long long>(m, 0)); long long ta = 0; for (int i = 0; i < n; ++i)... |
#include <bits/stdc++.h> using namespace std; struct Edge { long long to, dis, next, cost; } edge[24050]; long long num = -1; bool vis[10010]; long long mincost; long long pre[10010], head[10010], cost[10010], last[10010], flow[10010], n, k, a[110], b[110], s, t, maxflow; long long to[110]; ... |
/**
* 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 int modpow(long long int a, long long int n, long long int temp) { long long int res = 1; while (n > 0) { res = (res * res) % temp; if (n & 1) res = (res * a) % temp; n /= 2; } return res; } long long int gcd(long long int... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int i, temp, temp2, a[n + 1]; for (int i = 0; i < n + 1; i++) a[i] = 0; for (int i = 0; i < n - 1; i++) { cin >> temp >> temp2; a[temp]++; a[temp... |
#include <bits/stdc++.h> using namespace std; int n, a[100000], outpalsz, inn, b[100000]; long long result; int inicount[100001], iniodd; int ccount[100001], codd; int main() { cin.sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1 - i && a[i... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > vec[2102100]; pair<int, int> tr[2102100]; int lz[2102100]; int id[2102100]; int l[2102100]; int r[2102200]; int b[2102100]; int path[2102100]; int st[2102100]; void build(int p, int l, int r) { tr[p] = {0, -1}; lz[p] = 0... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Thu Sep 28 10:19:23 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
// (C) 2001-2014 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
//name : file_writer
//tag : c components
//input : input_a:16
//source_file : file_writer.c
///===========
///
///*Created by C2CHIP*
`timescale 1ns/1ps
module file_writer(input_a,input_a_stb,clk,rst,input_a_ack);
integer file_count;
integer output_file_0;
input clk;
input rst;
input [63:0] in... |
#include <bits/stdc++.h> using namespace std; int main() { int arr[6], i, sum = 0; for (i = 0; i < 5; i++) { scanf( %d , &arr[i]); sum = sum + arr[i]; } if (sum == 0) { printf( -1 n ); } else if (sum % 5 == 0) { printf( %d , sum / 5); } else { printf( -1 ); ... |
#include <bits/stdc++.h> using namespace std; const long long int MAXN = 2e5 + 51; long long int n, r; long long int prefix[MAXN], f[MAXN]; inline long long int read() { register long long int num = 0, neg = 1; register char ch = getchar(); while (!isdigit(ch) && ch != - ) { ch = getchar();... |
// (C) 1992-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 simulati... |
#include <bits/stdc++.h> using namespace std; const long long N = 100005; long long t, l, i, j, k, p, q, u, v, n, color[1000005]; string s; vector<long long> zro; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> q; for (l = 1; l <= q; l++) { cin >> n >... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:25:47 04/26/2015
// Design Name: register_file
// Module Name: /media/BELGELER/Workspaces/Xilinx/processor/test_register_file.v
// Project Name: processor
// Targ... |
#include <bits/stdc++.h> using namespace std; const int OO = 1e9; const double EPS = 1e-9; template <class T> void _db(const char* dbStr, T e) { cout << dbStr << = << e << endl; } template <class T, class... L> void _db(const char* dbStr, T e, L... r) { while (*dbStr != , ) cout << *dbStr++... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.