text
stringlengths
59
71.4k
`timescale 1ns / 100ps // UART Protocol Layer module QMFIR_uart_if (/*AUTOARG*/ // Outputs uart_dout, uart_addr, uart_mem_we, uart_mem_re, reg_we, uart_tx, // Inputs uart_mem_i, uart_reg_i, clk, arst_n, uart_rx ); output [31:0] uart_dout; output [13:0] uart_addr; output uart_m...
#include <bits/stdc++.h> using namespace std; int n, m, v; pair<int, int> p[10]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; ++i) { scanf( n ); for (int j = 1; j <= m; ++j) { char ch = getchar(); if (ch == * ) p[++v] = make_pair(i, j); } } if (...
#include <bits/stdc++.h> using namespace std; int dp[1024], n, m, c1, c2, c3, c4, an[1024], am[1024]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> c1 >> c2 >> c3 >> c4; cin >> n >> m; for (int i = 0; i < n; ++i) cin >> an[i]; for (int i = 0; i < m; ++i) cin >> am[i]; 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...
#include <bits/stdc++.h> using namespace std; map<string, string> mp; set<string> st; int n; char in[30]; string read() { scanf( %s , in); return (string)in; } int main() { scanf( %d , &n); for (int i = 1; i <= n; i += 1) { string a = read(); string b = read(); if (st....
/////////////////////////////////////////////////////////////////////////////// // // File name: axi_protocol_converter_v2_1_7_b2s_b_channel.v // /////////////////////////////////////////////////////////////////////////////// `timescale 1ps/1ps `default_nettype none (* DowngradeIPIdentifiedWarnings="yes" *) module ax...
#include <bits/stdc++.h> using namespace std; const int block_size = 320; const long long mod = 1e9 + 7; const long long inf = 1e9 + 7; const long double eps = 1e-9; const double PI = atan(1) * 4; template <typename T> inline int sign(const T &a) { if (a < 0) return -1; if (a > 0) return 1; ...
// $Id: c_credit_tracker.v 2061 2010-05-31 05:10:37Z dub $ /* Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions ...
#include <bits/stdc++.h> using namespace std; int v[100005]; int st[100005][22]; bool mark[100005]; long long dp[100005]; int n, k; void build() { int i, j; for (j = 1; 1 << j <= n; j++) { for (i = 0; i + (1 << j) <= n; i++) { st[i][j] = min(st[i][j - 1], st[i + (1 << (j - 1))][j - 1...
/* Copyright (c) 2014-2016 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> using namespace std; int mv = pow(10, 5) + 1; void pfn() { char x[mv], y[mv]; cin >> x >> y; int ly = strlen(y) - 1, i; i = ly; while (i >= 0 && y[i] != 1 ) i--; int lx = strlen(x) - 1 - ly + i; i = lx; while (i >= 0 && x[i] != 1 ) i--; cout << lx - 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 la...
#include <bits/stdc++.h> using namespace std; const int kd[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int n, i, j; char s[666666]; int cnt[42][42][42]; int mx, ad, am, ay; int main() { scanf( %s , s); int n = strlen(s); memset(cnt, 0, sizeof(cnt)); for (i = 0; i + 9 < n; i+...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable 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; template <typename T> T inline SQR(const T &a) { return a * a; } long long MOD = 1000000007LL; long long mypow(long long a, long long p) { if (p == 0) return 1LL; long long ans = mypow(a, p / 2); ans *= ans; ans %= MOD; if (p & 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...
/* * 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2019 by Todd Strader. // SPDX-License-Identifier: CC0-1.0 module foo #(parameter type bar = logic) (output int bar_size); localparam baz = $bits(bar); assign bar_size = b...
#include <bits/stdc++.h> using namespace std; const int inf = 1e7; const long long MOD = 1e9 + 7; const long long mod = 998244353; const int MAX_N = 1e5 + 5; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << : << arg1 << endl; } template <typename Arg1, typenam...
//---------------------------------------------------------------------------- // Copyright (C) 2001 Authors // // This source file may be used and distributed without restriction provided // that this copyright statement is not removed from the file and that any // derivative work contains the original copyright notic...
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T& x) { x = 0; char c; int sign = 1; do { c = getchar(); if (c == - ) sign = -1; } while (c < 0 || c > 9 ); do { x = x * 10 + c - 0 ; c = getchar(); } while (c <= 9 && c >= 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...
/* * File: imx_cbu.v * Project: pippo * Designer: kiss@pwrsemi * Mainteiner: kiss@pwrsemi * Checker: * Assigner: * Description: Core Bridge Unit - ÇŽÓcoreµÄimxºÍƬÉÏ»¥Á¬Ð­Òé * IMXºÍWBµÄÒìͬ 1£¬IMXÎÞÐèslaveʹÓÃrtyÐźţ¬masterÔÚslaveûÓзµ»Øackǰ±£³ÖÇëÇó 2£¬IMXÐèÒª·µ»Øµ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100100; int n, m; int was[MAXN]; vector<int> g[MAXN]; bool was2[3][MAXN]; bool dfs(int v, int col = 1) { was[v] = col; for (int i = 0; i < (int)g[v].size(); ++i) { if (!was[g[v][i]]) { if (dfs(g[v][i], 3 - col)) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 06/03/2015 04:15:25 PM // Design Name: // Module Name: source // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Rev...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `ifndef DV1 `define DV1 6 `define FX1_d 3 `define FX1_m 10 `define FX2_d 8 `define FX2...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: swrvr_dlib.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/or...
/* * 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 2021 The XLS 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
// niosii_mm_interconnect_0_avalon_st_adapter_004.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 15.1 185 `timescale 1 ps / 1 ps module niosii_mm_interconnect_0_avalon_st_adapter_004 #( parameter inBi...
#include <bits/stdc++.h> using namespace std; long long strL[200005], patL[200005], n, m, pref[200005], ans, tempL[200005]; char strC[200005], tempC[200005]; vector<long long> endings; string patC = ; long long lenP, lenS; void calcPrefixFunction() { for (long long i = 1, k = 0; i < m - 2; i++) { ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 7; const int maxm = 1e9 + 7; int n; int a[maxn], b[maxn], c[maxn], ans[maxn]; map<int, int> mp; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); b[i] = a[i]; } queue<int> q; ...
#include <bits/stdc++.h> using namespace std; char ch[100001]; int N, n, m; long long a[1 << 20], b[1 << 20]; int g[21][100001]; void FWT(long long p[], int flag) { int temp = N; for (int i = 2; i <= temp; i *= 2) { int t = i / 2; for (int j = 0; j < temp; j += i) { for (int k = ...
#include <bits/stdc++.h> using namespace std; void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); } bool isSubSequence(string str1, string str2, int m, int n) { if (m == 0) return true; if (n == 0) return false; if (str1[m - 1] == str2[n - 1]) return isSubSequence(str1, str2...
#include <bits/stdc++.h> using namespace std; mt19937 gen(chrono::system_clock::now().time_since_epoch().count()); const int N = 1e6 + 10; const long long MOD = 1e9 + 7; const long long p1 = 57, M1 = 1e9 + 3; const int rx[4] = {-1, 0, 1, 0}; const int ry[4] = {0, 1, 0, -1}; const int hx[8] = {-2, -2, -1...
#include <bits/stdc++.h> using namespace std; const int INF = (int)2e9; int main() { int k, n, m, q; cin >> k >> n >> m >> q; map<string, map<string, int>> rec; vector<string> art(n); map<int, map<string, int>> b; for (int(i) = (int)(0); (i) < (int)n; ++(i)) cin >> art[i]; sort(art.beg...
// 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 Apr 14 18:32:23 2017 // Host : LAPTOP-IQ9G3D1I running 64-bit major releas...
/** * 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() { ios::sync_with_stdio(0); cin.tie(0); int T; cin >> T; while (T--) { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } if (n == 1) { if (a[0] == k) ...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0), eps = 1e-4; double fgcd(double a, double b) { return fabs(a) < eps ? b : (fabs(b) < eps ? a : fgcd(b, fmod(a, b))); } int main() { double a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; c -= a; e -= a; d -...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module fei4_rx_core #( parameter DSIZE =...
#include <bits/stdc++.h> using namespace std; char rd; int sig; template <class T> inline void read(T &a) { for (a = 0, rd = getchar(); ( 0 > rd || rd > 9 ) && rd != - ; rd = getchar()) ; for (rd == - ? sig = -1, rd = getchar() : sig = 1; 0 <= rd && rd <= 9 ;) a *= 10, a +...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) #pragma GCC optimization( unroll-loops ) using namespace std; long long max3(long long x, long long y, long long z) { return max(max(x, y), z); } long long min3(long long x, long long...
module avr109tx ( input rst, input clk, input[7:0] tx_data, input tx_avail, output txd, output tx_ready ); parameter CLK_FREQUENCY = ; parameter BAUD_RATE = 19200; function integer log2; input integer value; begin value = value-1; for (log2=0; value>0; log2=l...
#include <bits/stdc++.h> using namespace std; int n, a, ans; int main() { cin >> n; int sq; ans = -1e9; for (int i = 0; i < n; i++) { cin >> a; if (a < 0) { ans = max(ans, a); continue; } sq = sqrt(a); if (sq * sq != a) { ans = max(ans, a); ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; vector<long long> h(n + 5); vector<long long> deg(n + 5, 0), a(n + 5, 0); for (long long i = 1; i <= n; i++) cin >> h[i]; for (long long i = 1;...
/***************************************************************************** * File : processing_system7_bfm_v2_0_arb_hp0_1.v * * Date : 2012-11 * * Description : Module that arbitrates between RD/WR requests from 2 ports. * Used for modelling the Top_Interconnect switch. ************************...
// File name : UniversalCounter10bitsV5.v // Written by : Jianjian Song // 4-bit universal bidirectional counter `timescale 1ns / 1ps module UniversalCounter10bitsV5(P,BeginCount, EndCount, Q,S1,S0,TerminalCount, Reset, CLOCK) ; parameter length = 10; input S1, S0, Reset, CLOCK; input [length-1:0] P, BeginCount, EndC...
module datacache (A,D,Q,M,WEN,clk); input [9:0] A; input [128+22-1:0] D; output reg [128+22-1:0] Q; input clk; input WEN; input [15:0] M; reg [21:0] MemU [1023:0]; reg [7:0] Mem1 [1023:0]; reg [7:0] Mem2 [1023:0]; reg [7:0] Mem3 [1023:0]; reg [7:0] Mem4 [1023:0]; reg [7:0] Mem5 [1023:0]; reg [7:0] Mem6 [1...
#include <bits/stdc++.h> using namespace std; int i, n, k, x, ans, c; pair<int, int> a[100005]; int main() { cin >> n >> k; for (i = 0; i < n; i++) { cin >> x; a[i].first = 10 - x % 10; a[i].second = x; } sort(a, a + n); for (i = 0; i < n; i++) { if (a[i].second < 100...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
//Com2DocHDL /* :Project FPGA-Imaging-Library :Design ContrastTransform :Function Change the contrast of an image. Give the first output after mul_delay + 1 cycles while the input enable. :Module Main module :Version 1.0 :Modified 2015-05-16 Copyright (C) 2015 Tianyu Dai (dtysky) <> This library is free softwa...
/** * Fill the memory with initial values. */ module memory_init( input clk, input reset, output [7:0] out ); reg [12:0] address; reg m1_we, m2_we, m3_we; wire [15:0] q1, q2, q3; reg [15:0] d; reg [7:0] out_buf; always @(posedge clk or posedge reset) begin if (re...
#include <bits/stdc++.h> using namespace std; const int maxN = 1e5 + 1; struct Node { int t, x, l, c; } pnt[maxN]; long long t, pos[maxN]; int m, n; int solve(long long t) { int l, r, m; while (t > 0) { l = 1, r = n + 1; while (l + 1 < r) { m = (l + r) >> 1; if (pos...
// EE 454 // Spring 2015 // Lab 2 Part 2 // John Timms // accumulator_memory.v // // clk, reset - self explanatory // op - operation desired by the processor // signal - memory tells the processor when it's done // read - // write - // load - indicates that the testbench wants to load numbers // full - goes high when t...
/* * 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) * ...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:100000000 ) using namespace std; int matrix[22][22]; int mas[22]; int matrix1[22][22]; int matrix2[22][22]; int best = 0; int minv[22]; bool used[22]; int u[22]; int v[22]; int p[22]; int way[22]; int getresult(int n) { int res = 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...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: fpu_cnt_lead0_lvl2.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; int arr[100009], mark[100009], vis[100009]; map<pair<int, int>, int> mp; map<pair<int, int>, int>::iterator ii; int main() { int n, i; scanf( %d , &n); for (i = 0; i < n; ++i) scanf( %d , &arr[i]); memset(mark, 0, sizeof mark); for (i = 0; i < ...
#include <bits/stdc++.h> int main() { int m, n, i, j, p, q; scanf( %d %d , &m, &n); scanf( %d %d , &p, &q); int ar[m], br[n]; for (i = 0; i < m; i++) { scanf( %d , &ar[i]); } for (i = 0; i < n; i++) { scanf( %d , &br[i]); } if (ar[p - 1] < br[n - q]) printf( YES n...
/** * 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...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2017 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. // SPDX-License-Identifier: LGPL-3.0-...
/* Copyright (c) 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, distribute,...
#include <bits/stdc++.h> using namespace std; const int N = 300000 + 10; struct Node { int x, y; Node(int x, int y) : x(x), y(y) {} bool operator<(const Node& rhs) const { return x < rhs.x || (x == rhs.x && y < rhs.y); } }; int n, m, size[N], color[N], col = 1; vector<int> G[N], grp[N]...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
#include <bits/stdc++.h> using namespace std; template <typename T> using V = vector<T>; const int MM = 5e5 + 5; using T = long long; bool QUERY; struct Line { mutable T a, b, p; T Eval(T first) const { return a * first + b; } bool operator<(const Line& o) const { return QUERY ? p < o.p : a < ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e6 + 7; const int ALPHA = 40; const long long INF = 1e16 + 7; const int MOD = 1e9 + 7; const int LOG = 22; const int BASE[2] = {313, 239}; long long n, d; bool ns[MAXN], seen[MAXN]; vector<long long> group[MAXN], plast[MAXN]; void sol...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of ent_a // // Generated // by: wig // on: Wed Jul 19 05:51:36 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../intra.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Author: wig ...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; using ll = long long; using vi = vector<int>; using pii = pair<int, int>; const int BSZ = 600; const int N = 100228; const int LG = 17; int n, m; vector<vi> g; vi pred; vi in, out; int timer; int up[LG][N]; vi ts; v...
#include <bits/stdc++.h> const int N = 22; const int M = (1 << 22); const int INF = 0x3f3f3f3f; bool dp[M] = {0}; int neib[N] = {0}, ex[M] = {0}; int main() { int m, n, u, v; scanf( %d%d , &n, &m); for (int i = 0; i < n; ++i) { neib[i] = (1 << i); dp[1 << i] = true; } for (in...
#include <bits/stdc++.h> using namespace std; const int maxn = 3000 + 50; const int maxm = 3000 + 50; const int maxt = 3000000 + 100; const int maxk = 10 + 3; const long long unit = 1LL; const int INF = 0x3f3f3f3f; const long long Inf = 0x3f3f3f3f3f3f3f3fLL; const double eps = 1e-3; const double inf...
// megafunction wizard: %RAM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: Ram_Real.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===============================...
#include <bits/stdc++.h> using namespace std; namespace io { const int __SIZE = (1 << 21) + 1; char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof; inline void flush() { fwrite(obuf, 1, oS - obuf, stdout), ...
#include <bits/stdc++.h> using namespace std; void swap(long long &a, long long &b) { auto tm = a; a = b; b = tm; } const long long mod = 1000000009; const long long mod2 = 998244353; const long long INF = (1LL << 20) - 1; const long long N = 2e5 + 25; long long n, m, a, b; vector<long lon...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, k, i, x, y, s, p; cin >> n >> m; s = 0; k = 1; for (i = 1; i <= n; i++) { cin >> x >> y; k = x - k; p = k % m; x -= p; s += y - x + 1; k = y + 1; } cout << s << endl; }
#include <bits/stdc++.h> using namespace std; int n, m; char arr[1503][1503]; int inix, iniy; bool visit[4503][4504]; int X[] = {0, 0, 1, -1}; int Y[] = {1, -1, 0, 0}; int nn, mm; int colax[4503 * 4503]; int colay[4503 * 4503]; bool dentro(int a, int b) { if (a < 0 || b < 0 || a >= nn || b >= ...
#include <bits/stdc++.h> using namespace std; const int N = 100111; long long n, arr[N], x, k; int main() { cin >> n; while (n--) { cin >> k >> x; long long u = 9 * k; cout << u - (9 - x) << endl; } }
module add_tb; parameter N_BITS_A = 3; parameter BIN_PT_A = 1; parameter N_BITS_B = 4; parameter BIN_PT_B = 3; parameter N_BITS_OUT = 6; parameter BIN_PT_OUT = 3; reg [N_BITS_A-1:0] a; reg [N_BITS_B-1:0] b; wire [N_BITS_OUT-1:0] sum; initial begin a = 3'b0_0_0; // 0 b = 4'b...
#include <bits/stdc++.h> using namespace std; int n; int da[550]; int dp[550][1050]; int dp2[550][550]; struct kutija { int in, out, w, s, v; } K[505]; bool cmp(const kutija &a, const kutija &b) { if (a.in != b.in) return a.in < b.in; if (a.out != b.out) return a.out > b.out; return a.s ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int a[maxn], b[maxn]; int main() { int n, x, T; cin >> T; while (T--) { cin >> n; set<int> s; s.clear(); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) { scan...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n + 1]; int b[2 * n + 1]; int temp[2 * n + 1]; for (int i = 1; i <= 2 * n; i++) temp[i] = 0; bool con1 = false, con2 = false; for (int i = 1; i...
#include <bits/stdc++.h> using namespace std; using ll = long long; using db = long double; using pl = pair<ll, ll>; using pi = pair<int, int>; vector<pi> viz[100010]; pi p[100010]; double num[100010]; bool no; set<int> val; vector<int> in; void dfs(int u) { in.push_back(u); for (auto x ...
#include <bits/stdc++.h> using namespace std; bool ans[310000]; struct Query { int x1, y1, x2, y2, id; } querys[310000]; bool operator<(Query a, Query b) { return a.x2 < b.x2; } struct Point { int x, y; } points[310000]; bool operator<(Point a, Point b) { return a.x < b.x; } int minv[310000 <<...
/** * 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 string FILENAME = input ; vector<pair<int, int> > best; vector<int> a; int main() { int n, m; cin >> n >> m; vector<int> has(2 * n, 0); vector<int> pr(2 * n, -1); vector<pair<int, int> > next(2 * n, {0, 0}); for (int i = 0; i < 2 * n...
#include <bits/stdc++.h> using namespace std; const long double PI = 3.141592653589793238462643383; int w; int visit[37] = {0}; int Ceil(int a, int b) { if (a % b == 0) return a / b; else return (a / b) + 1; } struct TrieNode { struct TrieNode *children[37]; bool isEndofWord; ...
#include <bits/stdc++.h> using namespace std; bool good() { string input; cin >> input; stack<int> pm; for (int i = 0; i < input.length(); i++) if (pm.empty() || input[i] != pm.top()) pm.push(input[i]); else pm.pop(); return pm.empty(); } int main() { cout << ...
#include <bits/stdc++.h> using namespace std; int a[100001], n; int main() { int i, h; scanf( %d n , &n); for (i = 1; i <= n; ++i) scanf( %d n , &a[i]); h = a[1]; for (i = 2; i <= n; ++i) if (a[i - 1] < a[i]) h += a[i] - a[i - 1] + 1; else h += a[i - 1] - a[i] + 1; ...
#include <bits/stdc++.h> using namespace std; long long const N = 1e5 + 100, INF = 1ll * 1e9 * 1e9 + 100; long long n, m, s, t; long long h[N], d[N], dis[2][N], ans[N]; pair<pair<long long, long long>, long long> e[N]; vector<long long> f[N], g[N]; set<pair<long long, long long> > st; bool vis[N]; voi...
// file: clk_wiz_0.v // // (c) Copyright 2008 - 2013 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 ...
`timescale 1ns / 1ps `include "constants.vh" module tb_Absorb; reg [263:0] state_in; reg clk; reg rst; reg en; reg [175:0] data; wire [263:0] state_out; wire rdy; Absorb uut ( .state_in(state_in), .state_out(state_out), .clk(clk), .rst(rst), .en(en), .rdy(rdy)...
/** * 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, m, i, j; const double eps = 1e-9; struct nd { double x, y; }; nd operator-(nd x, nd y) { return (nd){x.x - y.x, x.y - y.y}; } bool cmp(nd x, nd y) { if (x.x == y.x) return x.y < y.y; return x.x < y.x; } double dis(nd x, nd y) { return ab...
/** * 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 module sim_menu; // Inputs reg clk; reg reset; reg boton_arriba; reg boton_abajo; reg boton_izq; reg boton_der; reg boton_elige; // Outputs wire text_red; wire text_green; wire text_blue; wire [9:0] char_scale; wire es_mayuscula; wire nuevo; wire guardar; ...
// ----------------------------------------------------------------------------- // // Copyright 2014(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // - Redistrib...
//Legal Notice: (C)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 do...
/* * Titor - Barrel Processor - A convenience module for referencing fields of the instruction * Copyright (C) 2012 Sean Ryan Moore * * 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 Foundat...