text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; long long int n, k, p[100005]; long long int dp[100005]; long long int f(long long int s) { if (dp[s] != -1) return dp[s]; if (p[s] == 0) { long long int lo = max(0LL, s - k - 1); long long int hi = min(n, s + k); return dp[s] = max(0LL, hi... |
#include <bits/stdc++.h> using namespace std; const int L = 1000 + 10; int b[L]; int w, m, l = 0; int main() { cin >> w >> m; if (w > 3) while (m) { int q = m % w; m /= w; if (q > 1 && q < w - 1) { cout << NO << endl; return 0; } if (... |
module signalinput(
input [1:0] testmode, // 00, 01, 10, 11 分别代表4种频率,
// 分别为 3125, 250, 50, 12500Hz, 使用 SW1~SW0 来控制
input sysclk, // 系统时钟100M
output sigin1 // 输出待测信号
);
reg [20:0] state;
reg [20:0] divide;
reg sigin;
assign sigin1 = sigin;
initial
begin
sigin = 0;
st... |
#include <bits/stdc++.h> using namespace ::std; const long double PI = acos(-1); const long long MOD = 1000000000 + 7; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long add(long long a, long long b, long long m = MOD) { if (a >= m) a %= m; if (b >= m) b %= m; ... |
#include <bits/stdc++.h> using namespace std; const int Maxl = 26; const int Maxn = 30005; const int Maxstr = 200005; const int Inf = 2000000007; char str[Maxstr]; int t; int n, m, k; int freq[Maxl]; bool dp[Maxn]; int res; int main() { scanf( %d , &t); while (t--) { scanf( %d %d %... |
/**
* 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... |
// ==========================================================================
// CRC Generation Unit - Linear Feedback Shift Register implementation
// (c) Kay Gorontzi, GHSi.de, distributed under the terms of LGPL
// ==========================================================================
module sd_crc_7(BITVAL, ENA... |
#include <bits/stdc++.h> using namespace std; const int NMax = 100005; const int sqrNMax = 330; int N; int Nb[NMax][sqrNMax + 5]; int A[NMax], B[sqrNMax + 5][2 * sqrNMax + 5], Start[sqrNMax + 5], Block[NMax], totalB, Size[sqrNMax + 5]; void Read() { scanf( %d , &N); for (int i = 1; i <= N; i... |
#include <bits/stdc++.h> namespace solution {} namespace solution { class ISolution { public: virtual void init(){}; virtual bool input() { return false; }; virtual void output(){}; virtual int run() = 0; }; } // namespace solution namespace solution { using namespace std; const long... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Cal Poly Pomona
// Engineer: Byron Phung
//
// Create Date: 23:23:50 04/27/2016
// Design Name:
// Module Name: Search_8Comparators
// Project Name:
// Target Devices:
// Tool versions... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of vgch_suba
//
// Generated
// by: wig
// on: Fri Jul 7 06:44:20 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../bugver.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Auth... |
/**
* 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 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Fri Oct 27 10:19:56 2017
// Host : Juice-Laptop running 64-bit major relea... |
#include <bits/stdc++.h> int main() { std::ios_base::sync_with_stdio(false); std::string s; std::cin >> s; int n = s.length(); std::vector<int> prefix_fun(n, 0); for (int i = 1; i < n; i++) { int j = prefix_fun[i - 1]; while (j > 0 && s[i] != s[j]) { j = prefix_fun[j - 1]; ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void rread(T& num) { num = 0; T f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) num = num * 10 + ch - 0 , ch = getchar(); ... |
/* verilator lint_off WIDTH */
module emesh_monitor(/*AUTOARG*/
// Inputs
clk, reset, itrace, etime, emesh_access, emesh_packet, emesh_wait
);
parameter AW = 32;
parameter DW = 32;
parameter NAME = "cpu";
parameter PW = 104;
//BASIC INTERFACE
input clk;
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01/30/2017 01:18:01 AM
// Design Name:
// Module Name: top_new
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Re... |
#include <bits/stdc++.h> using namespace std; int n, k; const int MAXN = 500000; int A[MAXN + 10]; int main() { scanf( %d %d , &n, &k); for (int i = 1; i <= n; i++) scanf( %d , &A[i]); A[n + 1] = INT_MAX; A[0] = INT_MIN; sort(A + 1, A + n + 1); int l = 1, r = n; for (l = 2; l <= n ... |
//altera message_off 10230
module alt_mem_ddrx_list
# (
// module parameter port list
parameter
CTL_LIST_WIDTH = 3, // number of dram commands that can be tracked at a time
CTL_LIST_DEPTH = 8,
CTL_LIST_INIT_VALUE_TYPE = "INCR", // INCR, ZE... |
/*
* 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 Header Begin ==========================================
//
// OpenSPARC T1 Processor File: cluster_header_ctu.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 i... |
#include <bits/stdc++.h> using namespace std; map<vector<long long>, long long> mp; int main() { long long n; cin >> n; long long a[] = {2, 3, 5, 7}; vector<long long> t; for (long long mask = 1; mask < (1 << 4); mask++) { t.clear(); for (long long j = 0; j < 4; j++) { if (... |
#include <bits/stdc++.h> using namespace std; inline char gc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++; } inline long long read() { long long x = 0; char ch = getcha... |
//Code By CXY07 #include<bits/stdc++.h> using namespace std; //#define FILE //#define int long long #define debug(x) cout << #x << = << x << endl #define file(FILENAME) freopen(FILENAME .in , r , stdin), freopen(FILENAME .out , w , stdout) #define LINE() cout << LINE = << __LINE__ << endl #d... |
#include <bits/stdc++.h> using namespace std; void pause() {} bool sortbysecdesc(const pair<int, int> &a, const pair<int, int> &b) { return a.second > b.second; } int rec(int n, int i, int a[], int c) { c++; if (n == i) return c; rec(a[n - 1], i, a, c); } int main() { ios_base::sync_wi... |
/*
* Copyright (c) 2012, Stefan Kristiansson <>
* All rights reserved.
*
* Based on vga_fifo_dc.v in Richard Herveille's VGA/LCD core
* Copyright (C) 2001 Richard Herveille <>
*
* Redistribution and use in source and non-source forms, with or without
* modification, are permitted provided that the following con... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 7; int n, m, a[maxn]; map<int, int> mp, rmp; int main() { scanf( %d%d , &n, &m); int id; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); if (a[i] == m) id = i; } int cnt = 0; for (int i = id; i >= 1; i-... |
#include <bits/stdc++.h> using namespace std; struct comp { bool operator()(const vector<int>& lhs, const vector<int>& rhs) const { return lhs.size() > rhs.size(); } }; struct comps { bool operator()(const string& lhs, const string& rhs) const { return lhs > rhs; } }; bool ff(pai... |
/**
* 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 = 1e6; const int inf = 1e6; int n, m; int a[maxn + 5], b[maxn + 5]; int tag[maxn << 2], mx[maxn << 2]; void seta(int p, int d) { tag[p] += d; mx[p] += d; } void push(int p) { seta(p + p, tag[p]); seta(p + p + 1, tag[p]); ... |
#include <bits/stdc++.h> using namespace std; const int base = 1000 * 1000 * 1000, inf = 1000 * 1000 * 1000; int buf = 0; long long gcd(long long a, long long b) { while (b) b ^= a ^= b ^= a %= b; return a; } int p[10], e[10][10]; string a[10]; int main() { int n, k, ans = inf; cin >> n ... |
#include <bits/stdc++.h> using namespace std; char buf[25]; struct node { long long x, y; bool operator<(node tp) const { if (x != tp.x) return x < tp.x; return y < tp.y; } }; map<long long, long long> h1, h2; map<node, long long> t, q; const long long inf = 1e17; const long long... |
#include <bits/stdc++.h> using namespace std; long long p; map<long long, int> m[123]; int main() { int characters_value[26]; long long i; for (i = 0; i < 26; i++) cin >> characters_value[i]; string s; cin >> s; long long ans = 0; for (i = 0; i < s.size(); i++) { ans += m[s[i]]... |
#include <bits/stdc++.h> using namespace std; const int INF = int(1e9); long long n, m; pair<long long, long long> p = make_pair(0, 0); long long b[222222]; long long c[222222]; long long ans; map<long long, long long> mp; int main() { ios_base::sync_with_stdio(false); cin >> n; for (int i... |
#include <bits/stdc++.h> using namespace std; int on[100005]; int prime[100005], cnt = 0; void ola() { for (int i = 2; i <= 100005; i++) { if (!on[i]) prime[cnt++] = i; for (int j = 0; j < cnt && i * prime[j] <= 100005; j++) { on[i * prime[j]] = 1; if (i % prime[j] == 0) break; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:16:06 08/03/2009
// Design Name:
// Module Name: ctrl
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Re... |
// nios_system_nios2_qsys_0.v
// This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 14.1 186 at 2016.05.03.15:20:15
`timescale 1 ps / 1 ps
module nios_system_nios2_qsys_0 (
input wire clk, ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03.06.2015 14:58:39
// Design Name:
// Module Name: harness
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Re... |
// megafunction wizard: %LPM_CLSHIFT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: LPM_CLSHIFT
// ============================================================
// File Name: SHIFT.v
// Megafunction Name(s):
// LPM_CLSHIFT
//
// Simulation Library Files(s):
//
// =====================================... |
//================code===================// //#define TLE #ifdef TLE #pragma GCC optimize( O3 ) #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #endif #include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> #include <random> #include <ctime> ... |
#include <bits/stdc++.h> using namespace std; int dx[] = {-1, 0, 0, 1}; int dy[] = {0, -1, 1, 0}; int dx1[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1}; int dy1[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1}; const double eps = 1e-9; const int inf = 2000000000; const long long int infLL = 9000000000000000000; const long lon... |
#include <bits/stdc++.h> using namespace std; int n, m, now; int a[3005], b[3005]; int vis[3005], f[3005], c[3005]; int ok[3005]; int findcir(int *a, int n) { int ret = 0; for (int i = 1; i <= n; i++) b[a[i]] = i; memset(vis, 0, sizeof(vis)); for (int i = 1; i <= n; i++) { if (vis[i]) ... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_zero_one_hot (clock, reset, enable, test_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width = 32;
parameter proper... |
// part of NeoGS project
//
// (c) NedoPC 2007-2008
//
// modelling is in tb_dma1.*
// look also at dma_access.png
module dma_access(
input clk,
input rst_n,
input dma_req, // DMA request
input [21:0] dma_addr, // DMA address (2mb)
input dma_rnw... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: cmp_dram_mon.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/... |
// `include "define.v"
module ForwardControl (
input rst,
input[`RegAddrWidth-1:0] reg_data_1_addr_ID,
input[`RegAddrWidth-1:0] reg_data_2_addr_ID,
input[`RegAddrWidth-1:0] reg_data_1_addr_EX,
input[`RegAddrWidth-1:0] reg_data_2_addr_EX,
input[`RegAddrWidth-1:0] target_EX,
input WriteReg_EX,
input[`... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:59:52 03/09/2015
// Design Name:
// Module Name: Register_Group
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:... |
/*
Copyright (c) 2014-2017 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... |
`define bsg_xnor_macro(bits) \
if (harden_p && (width_p==bits)) \
begin: macro \
bsg_rp_tsmc_40_XNR2D1BWP_b``bits xnor_gate (.i0(a_i),.i1(b_i),.o); \
end
module bsg_xnor #(parameter `BSG_INV_PARAM(width_p)
, parameter hard... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:55:51 07/09/2015
// Design Name:
// Module Name: Component_encoder
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenci... |
#include <bits/stdc++.h> using namespace std; inline int in() { int32_t x; scanf( %d , &x); return x; } inline long long lin() { long long x; scanf( %lld , &x); return x; } inline string get() { char ch[2000010]; scanf( %s , ch); return ch; } const int MAX_LG = 21; ... |
#include <bits/stdc++.h> using namespace std; int nod(int a, int b) { while (a && b) { int c = a % b; a = b; b = c; } return a | b; } int Abs(int a) { return a >= 0 ? a : -a; } int main() { int n, m; cin >> n >> m; vector<vector<int> > e(n); for (int i = 0; i < m;... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x7fffffff; inline int reint() { int d; scanf( %d , &d); return d; } inline long relong() { long l; scanf( %ld , &l); return l; } inline char rechar() { scanf( ); return getchar(); } inline double redouble(... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base ::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; vector<long long> a(n); long long i, j; for (i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); for (i = 0; i < n; i++) { ... |
`include "defines.v"
`include "injector.v"
`include "ejector.v"
module nodeRouter
#(parameter addr = 4'b0010)
(
input `control_w port0_ci,
input `control_w port1_ci,
input `control_w portl0_ci,
input `control_w portl1_ci,
output portl0_ack,
... |
#include <bits/stdc++.h> using namespace std; vector<int> g[100005]; double dfs(int i, int ult) { double ans = 0; int c = g[i].size() - (i != 1); for (int j = 0; j < g[i].size(); j++) { if (g[i][j] != ult) { ans += (dfs(g[i][j], i) + 1.0) / c; } } return ans; } int main... |
#include <bits/stdc++.h> using namespace std; long long n, t; std::vector<pair<long long, long long> > v; long long dp[(1 << 15) + 5][226][4]; long long solve(long long x, long long y, long long z) { if (x == 0) return 1; if (x < 0) return 0; if (dp[y][x][z] != -1) return dp[y][x][z]; long lon... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010 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 distribut... |
/******************************************************************************
This Source Code Form is subject to the terms of the
Open Hardware Description License, v. 1.0. If a copy
of the OHDL was not distributed with this file, You
can obtain one at http://juliusbaxter.net/ohdl/ohdl.txt
Description: Data ca... |
#include <bits/stdc++.h> using namespace std; char q[7][50] = { Anka , Chapay , Cleo , Troll , Dracul , Snowy , Hexadecimal }; map<string, int> h; int a[3], u[7], v[3], w[7], r, rb, m[7][7]; void upd() { int i, mx, mn, j, k; for (i = 0; i < 3; v[i] = 0, i++) ; ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2005 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg [11:0] in_a;
reg [31:0] sel;
... |
#include <bits/stdc++.h> using namespace std; const int MX = 5e5 + 100, INF = 1e9; int N, M, X[MX], cnt; map<int, int> mp; struct Seg { int z; int l, r; Seg *L, *R; void update(int x) { z = min(z, x); } void pushdown() { L->update(z), R->update(z); } void init(int a, int b); void M... |
//Legal Notice: (C)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 do... |
module cla_adder(
input [31:0] A,
input [31:0] B,
input Cin,
output [31:0] Sum,
output Cout
);
wire [31:0] a_plus_b_cin_0;
wire [31:0] a_plus_b_cin_1;
full_adder fa_00_cin_0
full_adder fa_01_cin_0
full_adder fa_02_cin_0
full_adder fa_03_cin_0
full_adder fa_00_cin_0
full_adder fa_00_cin_0
full_adder fa... |
/**
* bsg_cache_decode.v
*
*/
`include "bsg_defines.v"
module bsg_cache_decode
import bsg_cache_pkg::*;
(
input bsg_cache_opcode_e opcode_i
, output bsg_cache_decode_s decode_o
);
always_comb begin
case (opcode_i)
// double
AMOSWAP_D, AMOADD_D, AMOAND_D, AMOOR_D, AMOXOR_D,
... |
// (c) Copyright 1995-2017 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 ... |
#include <bits/stdc++.h> using namespace std; long long int a[1000000]; struct cr { int l; int r; int d; } op[1000000]; long long int kt[1000000]; long long int ktt[1000000]; long long int fiop[1000000]; long long int vp[1000000]; long long int vpp[1000000]; long long int mba[1000000]; ... |
#include <bits/stdc++.h> using namespace std; int main() { int T; long long a, b, c; for (scanf( %d , &T); T; T--) { cin >> a >> b >> c; if (a >= c) { printf( -1 ); } else printf( 1 ); if (a * b > c) printf( %I64d n , b); else printf( -1 n ... |
#include <bits/stdc++.h> using namespace std; void readi(int &x) { int v = 0, f = 1; char c = getchar(); while (!isdigit(c) && c != - ) c = getchar(); if (c == - ) f = -1; else v = v * 10 + c - 0 ; while (isdigit(c = getchar())) v = v * 10 + c - 0 ; x = v * f; } void ... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int l = s.length(); cout << 4 << endl; cout << R << l - 1 << endl; cout << L << 2 << endl; cout << L << l + 1 << endl; cout << L << 2 << endl; return 0; } |
/*
* Copyright (c) 2003 Stephen Williams ()
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form 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)
* ... |
/***************************************************************************************************
* *
* Module: Altera_UP_PS2_Data_In *
* Description: *
* This module acce... |
#include <bits/stdc++.h> using namespace std; const int N = 1024; int dp[N]; int n, k; vector<int> ans; int f(int i) { if (i >= n) return 0; if (i + k >= n) return 1e9; if (dp[i] != -1) return dp[i]; return dp[i] = f(i + 2 * k + 1) + 1; } int main() { ios_base::sync_with_stdio(0); ... |
module fifo_128_8(
input wire i_clk,
input wire i_rst_n,
input wire i_slv_valid,
output wire o_slv_rdy,
input wire [63:0] i_slv_data,
output reg [7:0] o_mst_data,
output wire o_mst_valid,
input i_mst_rdy
);
reg [63:0] mem [0:15];
reg [3:0] wr_addr;
re... |
// -----------------------------------------------------------------------------
// -- --
// -- (C) 2016-2022 Revanth Kamaraj (krevanth) --
// -- ... |
#include <bits/stdc++.h> using namespace std; const long long INF(0x3f3f3f3f3f3f3f3fll); const long long inf(0x3f3f3f3f); template <typename T> void read(T &res) { bool flag = false; char ch; while (!isdigit(ch = getchar())) (ch == - ) && (flag = true); for (res = ch - 48; isdigit(ch = getcha... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 2e9; const long double PI = acos((long double)-1); const long double EPS = 1e-9; inline bool isPrime(long long x) { if (x <= 1) return 0; if (x <= 3) return 1; if (!(x % 2) || !(x % 3)) return 0; ... |
#include <bits/stdc++.h> using namespace std; void read(long long a = 0) { freopen( in , r , stdin); if (a) freopen( out , w , stdout); } long long a[100009 * 10], b[100009 * 10]; long long n, m; bool bs(long long num) { bool vis[100009 * 10] = {}; long long space = 0; for (int i = num... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: fifo_128_49.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ===========================================... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; const long double INF = 1e18; const long double PI = acos(-1.0); int n; pair<long long, long long> o, origin, p[N]; long long r_1 = 0; long double r_2 = INF; long long sqDist(pair<long long, long long> a, pair<long long, long long> b)... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int N = 600050; long long a[N], dp[N][3]; int main() { int n, x; scanf( %d%d , &n, &x); for (int i = 1; i <= n; i++) { scanf( %lld , &a[i]); } long long ans = 0; for (int i = 1; i <= n; i++) { dp[i][0] = max(dp[i][0], max(dp... |
#include <bits/stdc++.h> using namespace std; int n, a[1005]; long long dp[1005]; long long dpsum[1005]; bool b[1005]; long long ch[1005][1005]; long long gc(int c, int x) { if (x == 0 || c == x) return 1; if (!ch[c][x]) { ch[c][x] = (gc(c - 1, x - 1) + gc(c - 1, x)) % 998244353; } r... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; if (s.size() == 1) { if (s[0] == ? ) printf( a n ); else cout << s << n ; } else { int f = 0; for (int i = 0; i < s... |
#include <bits/stdc++.h> using namespace std; long long a = 0, b = 0, f = 0, t = 0, x[101010], s2 = 0, s3 = 0, i = 0, j = 0, p = 0, k = 0; string d1, d2, d3; int main() { cin >> a >> p; for (b = 1; b <= a; b++) { cin >> f; if (f > p) s2 += 2; else s2 += 1; ... |
#include <bits/stdc++.h> using namespace std; string ans = ; set<int> s[26]; map<int, bool> vis; void solve(char a) { ans += a; vis[a - a ] = true; for (auto it : s[a - a ]) { if (!vis[it - a ]) { solve(it); } } } int main() { ios_base::sync_with_stdio(false); ... |
/*
* Testbench for Zet processor
* 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
* Foundation; eit... |
#include <bits/stdc++.h> using namespace std; template <typename T> T sqr(T x) { return x * x; } template <typename T> T abs(T x) { return x < 0 ? -x : x; } template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } set<vector<int> > s; vector<pair<char, pair<int, int> >... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5; long long int n, x, y, b, a[3]; int main() { long long int x, y; cin >> x >> y; long long int a = 0; while (true) { if (a % 2 == 0) { if (x >= 2 && y >= 2) { x -= 2; y -= 2; } else { ... |
#include <bits/stdc++.h> using namespace std; const long long N = 100005; string A; void solve() { long long n, mi = 0, pl = 0; cin >> A; A = + + A; n = A.size() - 1; stack<char> s; for (__typeof((n)) i = (1); i <= (n); i++) { if (s.empty()) s.push(A[i]); else if (s... |
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T &x) { x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) f = 1; for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); if (f) x = -x; } template <typename F> i... |
// precompute lookup table for each digit? #include <iostream> #include <unordered_map> #include <utility> #include <algorithm> using namespace std; #define MP make_pair<int, int> int main() { unordered_map<int, int> lookup[10]; lookup[1].insert(MP(0, 1)); lookup[2].insert(MP... |
#include <bits/stdc++.h> using namespace std; const int inf = 1000000000; long long mod = 1000000007LL; long long mod2 = 998244353LL; long long t, l, r; long long dp[5000005]; long long prm[5000005]; long long pw[5000005]; long long dfs(int x) { if (dp[x] >= 0) return dp[x]; if (x == 1) return... |
/**
* 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... |
//////////////////////////////////////////////////////////////////////
//// ////
//// RMON.v ////
//// ////
//// This file is part of the Ether... |
//`define USE_TEST_RAM
module uart_fifo
#(parameter TX_RAM_ADDRESS_BITS = 10,
RX_RAM_ADDRESS_BITS = 10)
(input reset,
input sys_clk,
input tx_wren, // When this goes high, there's new data for the fifo
input [7:0] tx_data,
input tx_accept, // UART signals when it can accepted tx ... |
// (C) 2001-2018 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 from any of the foregoing (including device programming or simulation
// files), and any associated ... |
#include <bits/stdc++.h> using namespace std; inline int read() { char ch = getchar(); int w = 1, c = 0; for (; !isdigit(ch); ch = getchar()) if (ch == - ) w = -1; for (; isdigit(ch); ch = getchar()) c = (c << 1) + (c << 3) + (ch ^ 48); return w * c; } const int mod = 1e9 + 7, M = 1e6... |
// $Header: $
///////////////////////////////////////////////////////
// Copyright (c) 2010 Xilinx Inc.
// All Right Reserved.
///////////////////////////////////////////////////////
//
// ____ ___
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 13.1
// \ \ ... |
/*
DCPU16 Verilog Implementation
Copyright (C) 2012 Shawn Tan <>
This program 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 version. ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.