text stringlengths 59 71.4k |
|---|
module butterfly1_8(
enable,
i_0,
i_1,
i_2,
i_3,
i_4,
i_5,
i_6,
i_7,
o_0,
o_1,
o_2,
o_3,
... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: pcx_dp_macb_r.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... |
// (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... |
//% @file fifo_over_ufc_tb.v
//% @brief test bench of FIFO I/O via Aurora 64B66B UFC interface
//% @author Yuan Mei
//%
`timescale 1ns / 1ps
module fifo_over_ufc_tb
#(
parameter FIFO_DATA_WIDTH = 32,
parameter AURORA_DATA_WIDTH = 64
)
();
reg clk;
reg ... |
#include <bits/stdc++.h> #define MOD 998244353 using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define rrep(i, a, b) for(int i = (a-1); i >= (b); --i) #define trav(a, x) for(auto& a : x) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typed... |
#include <bits/stdc++.h> using namespace std; inline int read() { register int res = 0; register char c = getchar(), f = 1; while (c < 48 || c > 57) { if (c == - ) f = 0; c = getchar(); } while (c >= 48 && c <= 57) res = (res << 3) + (res << 1) + (c & 15), c = getchar(); r... |
/**
* 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 law... |
`timescale 1ns/1ps
module tx_packer
( //FX2 Side
input bus_reset,
input usbclk,
input WR_fx2,
input [15:0]usbdata,
// TX Side
input reset,
input txclk,
output reg [31:0] usbdata_final,
output reg WR_final,
output wire test_bit0,
output reg test_bit1
);
reg [8:0... |
module RegisterFileTestBench4;
parameter sim_time = 750*2; // Num of Cycles * 2
reg [31:0] in,Pcin;
reg [19:0] RSLCT;
reg Clk, RESET, LOADPC, LOAD,IR_CU;
wire [31:0] Rn,Rm,Rs,PCout;
//RegisterFile(input [31:0] in,Pcin,input [19:0] RSLCT,input Clk, RESET, LOADPC, LOAD,IR_CU, output [31:0] Rn,Rm,Rs,PCout);
RegisterFil... |
// (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... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 100; int ans[N], link[N]; int main() { ios_base ::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; for (int i = 1; i <= n; ++i) { int x; cin >> x; int down = max(1, i - k); int up = min(n, i + k... |
#include <bits/stdc++.h> using namespace std; bool ask(long long l, long long r) { printf( %lld %lld n , l, r); fflush(stdout); char x[4]; scanf( %s , x); return x[0] == Y ; } long long n, k; int main() { cin >> n >> k; long long l = 1, r = n; srand(time(0)); while (1) { ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; long long int sum = n * (n - 1) / 2; if (n == 0) { cout << 0; return 0; } if ((n % 2 == 0 && n % 4 != 0) || (n % 2 == 1 && n % 4 != 3)) cout << 1; else cout << 0; return 0; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; long long s = 0; cin >> n; for (int i = 2; i <= n / 2; i++) { for (int j = 2; j * i <= n; j++) s += 4 * j; } cout << s << endl; 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 la... |
#include <bits/stdc++.h> using namespace std; const long long int N = 70, M = 11, MA = 1030; long long int dp[M][N][M][MA], dps[M][N][MA], dpt[M][N], n, q, b, l, r, x; vector<long long int> v; long long int get(long long int a, long long int b) { long long int x = a, ans, mask = 0, l; v.resize(0); ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int r, x1, y1, x2, y2; cin >> r >> x1 >> y1 >> x2 >> y2; long long int xd = x2 - x1, yd = y2 - y1; double dist = sqrt(xd * xd + yd * yd); long long int int_part = (int)dist; double frac_part = dist - int_part; long long... |
module auto_module
( input my_clk,
input my_rst_n,
output manually_listed,
/*AUTOINOUTMODPORT("automodport_if" "pure_mp")*/
// Beginning of automatic in/out/inouts (from modport)
output out_pure,
input in_pure,
// End of automatics
//ex: in... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_impctl_dtl_dnrcn.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 redistribu... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i != n; ++i) { cin >> v[i]; v[i] -= (n - i); } sort(v.begin(), v.end()); for (int i = 0; i != n - 1; ++i) { if (v[i] + 1 > v[i + 1]) { cout << :( n ; ... |
`timescale 1ns / 1ps
module RM_ctl # (
parameter integer C_STEP_NUMBER_WIDTH = 32,
parameter integer C_SPEED_DATA_WIDTH = 32
) (
input wire clk,
input wire resetn,
output reg exe_done,
input wire req_abs,
input wire [C_SPEED_DATA_WIDTH-1:0] req_... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d = 0, e = 0, f = 0, g = 0, i, j, k = 1, l = 1, r = 1, n[300001], m[300001], q, u, v, w, y, z[400001], h[400001], p[500001]; string s, t, x; cin >> a >> b >> c; for (i = 1; 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... |
// soc_design_mm_interconnect_0_avalon_st_adapter.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 16.0 211
`timescale 1 ps / 1 ps
module soc_design_mm_interconnect_0_avalon_st_adapter #(
parameter inBi... |
#include <bits/stdc++.h> using namespace std; constexpr int kN = int(1E7 + 10); vector<long long int> prime; int l[kN], mu[kN], s[kN]; long long int n; void pre() { mu[1] = 1; for (int i = 2; i <= n; i++) { if (l[i] == 0) { mu[i] = -1; prime.push_back(l[i] = i); } f... |
// Via http://www.edaplayground.com/s/6/591
// stackoverflow 20556634
// http://stackoverflow.com/questions/20556634/how-can-i-iteratively-create-buses-of-parameterized-size-to-connect-modules-also
// Code your design here
`define macro_args
`define indexed_part_select
module Multiplier_flat #(parameter M = 4, param... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Geza Lore.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/);
wire bit [255:0] C = {32'h1111_1111,
32'h2222_2222,
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01/27/2015 03:47:45 PM
// Design Name:
// Module Name: wildcard_processer
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7, A = 5e5 + 5; vector<vector<long long>> v; long long n, m, val; long long ans[A]; bool vis[A], vis2[A]; void DFS(long long node) { if (vis[node]) return; vis[node] = 1; for (auto child : v[node]) { if (vis[child]) cont... |
#include <bits/stdc++.h> using namespace std; const int maxn = (int)1e5 + 12; int a[maxn], n; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); int cnt = 0; for (int i = 2; i < n; i++) { if (a[1] < a[i] && a[i] < a[n]) cnt++; } cout << cnt... |
module no_clock_model(
input [7:0]in_8bit,
input [23:0]in_24bit,
input [63:0]in_64bit,
input [95:0]in_96bit,
input [7:0]in_mem_8bit[0:9],
input [63:0]in_mem_64bit[0:9],
input [77:0]in_mem_78bit[0:9],
output [23:0]out_24bit,
output [63:0]out_64bit,
output [95:0]out_96bit,
outp... |
#include <bits/stdc++.h> using namespace std; template <class T> T abs(T x) { return x > 0 ? x : -x; } const int LEN = 300; const int MAX = (100000 + LEN - 1) / LEN; int n; int m; int was[100000], x[100000], y[100000]; int l[MAX], r[MAX], w[MAX]; vector<pair<pair<int, int>, int> > v; vector<... |
/* problem : CF1466I The Riddle of the Sphinx reference : https://www.luogu.com.cn/blog/CXY07/solution-cf1466i */ #include <bits/stdc++.h> #define mp std::make_pair #define pb push_back #define fi first #define se second #define gc getchar #define pc putchar #define ep emplace #define eb empla... |
/*
* 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... |
// MBT 7/24/2014
//
// bsg_sync_sync
//
// This is just two synchronization flops.
//
// We use the rp placement flop from synopsys.
// Fixme: move this into asic-specific components.
//
`include "bsg_defines.v"
`ifndef rp_group
`define rp_group(x)
`define rp_place(x)
`define rp_endgroup(x)
`define rp_fill(x)
`d... |
// -- (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
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
#include <bits/stdc++.h> #define int long long using namespace std; const int maxm=5e5+5; int stk[maxm],head; int d[maxm]; int a[maxm]; int n; // int rt[maxm],tot; int lc[maxm*40],rc[maxm*40],ma[maxm*40]; inline void pp(int k){ ma[k]=max(ma[lc[k]],ma[rc[k]]); } void update(int x,int val,... |
#include <bits/stdc++.h> using namespace std; const int N = int(3002), mod = int(1e9) + 7; char second[N][N]; int n, m; long long dp1[N][N], dp2[N][N], a, b, c, d; bool used[N][N]; inline long long dp(int x, int y) { if (x <= 0 || y <= 0) return 0; if (second[x][y] == # ) return 0; if (x == 1... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:05:24 03/30/2016
// Design Name:
// Module Name: Bloque_Top_pruebas
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenc... |
module ARM_CU_ALU_TestBench5;
parameter sim_time = 2000*2; // Num of Cycles * 2
reg Reset , Clk , MEMSTORE,MEMLOAD;
wire [31:0] MEMDAT;
wire MFA,READ_WRITE,WORD_BYTE,MFC;
wire [7:0] MEMADD;
//module memory (inout reg[31:0] Data, output reg MFC, input MFA, ReadWrite, input [7:0] Address, input wordByte, Reset);
memo... |
#include <bits/stdc++.h> int p[100005], q[100005], n, m, V; double a[100005], x[100005], y[100005], dx[100005], dy[100005], h, vx, vy, t, w; bool cmp1(const int i, const int j) { return a[i] < a[j]; } bool cmp2(const int i, const int j) { return x[i] < x[j]; } bool up(double t, double y) { return (h = vy * t ... |
#include <bits/stdc++.h> using namespace std; long long m; int k; vector<int> a; long long memo[66][2][66]; long long dp(int id, int tight, int cnt) { long long &res = memo[id][tight][cnt]; if (res == -1) { res = 0; if (id == a.size()) { if (cnt == k) res = 1; } else { ... |
#include <bits/stdc++.h> using namespace std; double pi = 3.141592653589793238462; string numkey = 0123456789 ; string uni = abcdefghijklmnopqrstuvwxyz ; bool check(char ch) { string s = aeiou ; for (long long int i = 0; i < s.size(); i++) { if (s[i] == ch) return true; } return false... |
#include <bits/stdc++.h> using namespace std; int main() { int i, j, l, n, k, d, max = 0, gen, e = 0; long long p; scanf( %d %d , &n, &k); vector<vector<int> > v(n); for (i = 0; i < n; i++) { scanf( %d , &d); v[d].push_back(i); if (d > max) max = d; } p = 1; for (i ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000 * 1000 * 1000 + 7; const int INF = 2000 * 1000 * 1000; const double EPS = 1e-9; const double pi = acos(-1.0); const int maxn = 1010; const int maxsum = 10010; template <typename T> inline T sqr(T n) { return (n * n); } int n, a... |
#include <bits/stdc++.h> using namespace std; long double add[3 * 100 * 1000]; const long double inf = 1e18; long double max(long double a, long double b, long double c, long double d) { return max(max(a, b), max(c, d)); } struct rmq { int l, r; long double pref, suf, all, best; rmq *left, *... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2017 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
//
/... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Wed Sep 20 21:28:58 2017
// Host : EffulgentTome running 64-bit major rele... |
/*
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... |
#include <bits/stdc++.h> const long long M = 1000005; const long long mod = 1e9 + 7; using namespace std; long long n, m, a, b, fac[M], Ans; inline long long Fpw(long long Base, long long k) { long long temp = 1; while (k) { if (k & 1) temp = (1LL * temp * Base) % mod; Base = (1LL * Base *... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll inf = INT_MAX - 1; bool check(ll r, ll g, ll b, ll w, ll total) { if (r < 0 || g < 0 || b < 0 || w < 0) { return false; } ll numberIsOne = 0; if (r & 1) { numberIsOne++; } if (g & 1) { numberIs... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Fri Sep 22 23:00:32 2017
// Host : DarkCube running 64-bit major release ... |
/*******************************************************************************
* 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 with non-Xilinx ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; while (scanf( %d , &n) != EOF) { int a[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { scanf( %d , &a[i][j]); } } if (n == 1) { printf( %d n , a[0][0]); brea... |
#include <bits/stdc++.h> using namespace std; int const N = 1e5 + 13; int const INF = 1e9 + 13; int n, m; set<int> p[N]; int l[N], r[N]; int pos[N], x[N]; int tsz; int a[N]; int type[N]; vector<int> t[N * 4], tright[N * 4]; vector<long long> F[N * 4]; vector<int> qid; vector<pair<int, int>> ... |
#include <bits/stdc++.h> using namespace std; const int N = 132700; int n; tuple<int, int, int, int> esq[N], dir[N]; vector<tuple<int, int, int, int>> v; int main(void) { ios_base::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) { int a, b, c, d; cin >> a >> b >> c >> d... |
#include <bits/stdc++.h> const double PI = acos(-1.0); using namespace std; int t[100010]; void update(int x, int v) { for (; x < 100010; x += (x & -x)) t[x] += v; } int sum(int r) { int ans = 0; for (; r > 0; r -= (r & -r)) ans += t[r]; return ans; } int sum(int l, int r) { if (l > ... |
#include <bits/stdc++.h> using namespace std; int n, p[3000], k, m = 0, c; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> p[i]; for (int i = 1; i <= n; i++) { k = p[i]; c = 1; while (k > 0) { c++; k = p[k]; } m = max(c, m); } cout << m;... |
#include <bits/stdc++.h> #pragma comment(linker, stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; long long freq[3000005], mul[3000005], n, q, x; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ... |
module main(
// clocks
input fclk,
output clkz_out,
input clkz_in,
// z80
input iorq_n,
input mreq_n,
input rd_n,
input wr_n,
input m1_n,
input rfsh_n,
input int_n,
input nmi_n,
input wait_n,
output res,
inout [7:0] d,
output [15:0] a,
// zxbus and related
output csrom,
o... |
#include <bits/stdc++.h> using namespace std; const int mx=2e5+10; const int INF=0x3f3f3f; long long tes[mx][2][2]; bool flg[mx][2][2]; int hd[mx],nx[mx*2],t[mx*2],vl[mx*2]; int sum; struct Node { int x,y,z; long long jud; bool operator < (const Node &nd) const { r... |
/*
* 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; long long mod = 1000000007; int main() { long long dp[3001][100][2] = {0}; long long n, l; cin >> n >> l; vector<long long> a(n), b(n); for (long long i = 0; i < n; ++i) { cin >> a[i] >> b[i]; dp[a[i]][i][0] = 1; dp[b[i]][i][1] = ... |
module TX_control
#( parameter INTER_BYTE_DELAY = , // ciclos de reloj de espera entre el envio de 2 bytes consecutivos
parameter WAIT_FOR_REGISTER_DELAY = 100 // tiempo de espera para iniciar la transmision luego de registrar el dato a enviar
)(
input clock,
input reset,
input PB, // Push Button... |
#include <bits/stdc++.h> using namespace std; string itos(int a) { if (!a) return 0 ; string res; while (a) { res += (char)( 0 + (a % 10)); a /= 10; } reverse((res).begin(), (res).end()); return res; } int main() { int n; int a[10], can = 0; ; cin >> n; ... |
#include <bits/stdc++.h> using namespace std; inline namespace Infinity { inline namespace Constant { constexpr const int eof = EOF; constexpr const int maxint = INT_MAX; constexpr const long long maxll = LLONG_MAX; } // namespace Constant inline namespace TypeDefine { using uint = unsigned int; us... |
//Legal Notice: (C)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 do... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200005; int n, m; char s[maxn]; long long ans[maxn]; int sz[maxn]; int cnt[1 << 20]; vector<int> g[maxn]; bool die[maxn]; int getsz(int x, int f) { sz[x] = 1; for (int y : g[x]) if (y != f && !die[y]) sz[x] += getsz(y, x); ... |
/*
* 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 "defines.vh"
module primogen #(
parameter WIDTH_LOG = 4
) (clk, go, rst, ready, error, res);
localparam WIDTH = 1 << WIDTH_LOG;
localparam HI = WIDTH - 1;
input clk;
input go;
input rst;
output reg ready;
output reg error;
output reg [HI:0] res;
localparam MAX = {WIDTH{1'b1}};
// Note that incrementing ... |
#include <bits/stdc++.h> int a[1005][1005]; int n; void solve(int x) { for (int flag = 0; flag < n; flag++) { if (a[x][flag] == 0) { for (int flag1 = flag; flag1 < n; flag1++) { a[x][flag1] = a[x][flag1 + 1]; } break; } } } int main() { while (scanf( %... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2013 by Ted Campbell.
// SPDX-License-Identifier: CC0-1.0
//With MULTI_CLK defined shows bug, without it is hidden
`define MULTI_CLK
//bug634
module t (
input ... |
/*
* Copyright (c) 2000 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)
* ... |
#include <bits/stdc++.h> using namespace std; vector<long long int> f(200005, 0), d(200005, 0), l(200005, 0), r(200005, -1); map<pair<long long int, long long int>, long long int> mp; long long int gcd(long long int a, long long int b) { if (b == 0) return a; return gcd(b, a % b); } long long int bp... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200005; int n, MOD; pair<int, int> s[MAXN]; int main() { scanf( %d , &n); int m = 0; for (int i = 1; i <= n; i++) { int a, b; scanf( %d , &a); s[++m] = make_pair(a, i); } for (int i = 1; i <= n; i++) { i... |
#include <bits/stdc++.h> using namespace std; template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << { ; string sep; for (const auto &x : v) os << sep << x, sep = , ; return os << } ; } template <typename T, size_t size> ostream &operator<<(ostream &os, const ... |
#include <bits/stdc++.h> using namespace std; bool issub(string s, string t) { int cur = 0; for (char c : s) { if (c == t[cur]) cur++; if (cur == t.size()) return true; } return false; } int main() { int q, i; cin >> q; while (q--) { string s, t, p; cin >> s >... |
#include <bits/stdc++.h> using namespace std; void _print(long long t) { cerr << t; } void _print(int t) { cerr << t; } void _print(string t) { cerr << t; } void _print(char t) { cerr << t; } void _print(long double t) { cerr << t; } void _print(double t) { cerr << t; } void _print(unsigned long long t)... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<string> words(4 * n); string S; int aabb = 0, abab = 0, abba = 0, aaaa = 0, NO = 0; for (int i = (0); i < (4 * n); ++i) { cin >> S; int size = S.size(); int Kth = 0; string newS... |
`timescale 1ns/1ps
`define CODE_RAM U_ASYNC_MEM.U_SSRAM
module tb;
`include "useful_tasks.v" // some helper tasks
parameter ROM_ADDRESS_SIZE = 14;
reg rst_async_n; // asynchronous reset
wire req0, req1, req2;
wire ack0, ack1, ack2;
reg req0_reg;
reg start;
wire [31:0] data0;
reg [3... |
// (C) 2001-2016 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated docum... |
/* -------------------------------------------------------------------------------
* (C)2012 Korotkyi Ievgen
* National Technical University of Ukraine "Kiev Polytechnic Institute"
* -------------------------------------------------------------------------------
*
* Mesh Network
*
*/
`include "types... |
#include <bits/stdc++.h> using namespace std; struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0); } } _; const int MAXN = -1; int n, m; int main() { int a, b; cin >> a >> b; int n = a + b + 1; for (int i = n - a; i <= n; ++i) cout << i << ; f... |
#include <bits/stdc++.h> using namespace std; int num[100005]; int main() { int n, k; scanf( %d%d , &n, &k); for (int i = 0; i < n; i++) { scanf( %d , &num[i]); } sort(num, num + n); if (n < k) { printf( %d n , num[n - 1]); return 0; } else { vector<int> ans; ... |
#include <bits/stdc++.h> using namespace std; template <typename T> void chmin(T &x, const T &y) { if (x > y) x = y; } template <typename T> void chmax(T &x, const T &y) { if (x < y) x = y; } int read() { char c; while ((c = getchar()) < - ) ; if (c == - ) { int x = (c ... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n; char s[200050]; map<int, map<int, int>> vis, cnt; scanf( %d , &t); while (t--) { vis.clear(); cnt.clear(); int l = -5, r = 0x3f3f3f3f; scanf( %d%s , &n, s); int x = 0, y = 0; vis[x][y] = 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 la... |
#include <bits/stdc++.h> using namespace std; using ll = int64_t; using ii = pair<ll, ll>; int main() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); ll n, m; cin >> n >> m; ll nn = n - 2; ll n1 = nn / 2; ll n2 = nn - n1; ll sm = (n1 + 1) * n1 / 2 + (n2 + ... |
/*
* 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; typedef long long s64; const int MaxN = 100000 + 5; int a[MaxN]; void work() { int n; scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %d , a + i); } sort(a + 1, a + n + 1); s64 ans = a[n]; for (int i = ... |
#include <bits/stdc++.h> using namespace std; const long long o = 101; const long long p = 6e4; struct qwq { long long x, y; } a[o], b[o]; long long n, m, l, r, f[p + 1], ans = -1; bool cmp1(qwq u, qwq v) { return u.x == v.x ? u.y > v.y : u.x < v.x; } bool cmp2(qwq u, qwq v) { return u.x + u.y > v.x... |
#include <bits/stdc++.h> using namespace std; int main() { int fr[301][301]; int al[301]; int i, j, n; cin >> n; for (i = 1; i <= n; ++i) for (j = 1; j <= n; ++j) cin >> fr[i][j]; for (i = 1; i <= n; ++i) cin >> al[i]; int k, best[301], best_time[301], cur; for (j = 1; j <= n; ... |
#include <bits/stdc++.h> using namespace std; long long n, i, j, k, x, y, col; vector<long long> ans; long long last[100100]; int main() { cin >> n; for (i = 0; i < n; i++) { cin >> x >> y; col = 0; j = 1; while (j * j <= x) { if (x % j == 0) { k = x / j; ... |
// MBT BSG 11/13/2014
//
// a data structure that takes one word per cycle
// and allows more than one word per cycle to exit.
// the number of words extracted can vary dynamically.
//
// els_p and out_els_p can be set differently in order
// to increase the amount of buffering internal to the module
//
// * this data ... |
module ArithAlu(
/* verilator lint_off UNUSED */
clk,
opMode,
srca,
srcb,
dst,
sri,
sro
);
input clk;
input[3:0] opMode;
input[63:0] srca;
input[63:0] srcb;
output[63:0] dst;
input[3:0] sri;
output[3:0] sro;
parameter[3:0] UOP_NONE = 4'h00;
parameter[3:0] UOP_ADD = 4'h01;
parameter[3:0] UOP_SUB =... |
#include <bits/stdc++.h> using namespace std; int zero(int n) { if (n == 0) return 0; if (n % 10 == 0) return zero(n / 10); return 10 * zero(n / 10) + (n % 10); } int main() { int a, b; cin >> a >> b; if (zero(a) + zero(b) == zero(a + b)) { cout << YES ; } else { cout <<... |
#include <bits/stdc++.h> using namespace std; int dx[] = {0, 0, -1, 1}; int dy[] = {-1, 1, 0, 0}; const int N = 1e6 + 5; long long ans, sum, d[N]; int n, m; int main() { int a, b; while (~scanf( %d%d , &n, &m)) { memset(d, 0, sizeof(d)); for (int i = 0; i < (m); ++i) { scanf( %... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.