text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; long long n, m, r, k, tot; int dx[] = {0, -1, 0, 1}; int dy[] = {-1, 0, 1, 0}; struct Cell { long long c, x, y; bool operator<(const Cell &oth) const { return c < oth.c; } }; class Map { private: set<long long> vis; public: bool isVisi...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; char s[1010]; int a[1010], num[1010], b[30]; int prime[1010], notprime[1010]; priority_queue<pair<int, char> > pq; set<pair<int, int> > st; pair<int, int> c[1010]; int ans[1010]; int cnt; void init() { for (int i = 2; i ...
//############################################################################# //# Function: Dual data rate input buffer # //############################################################################# //# Author: Andreas Olofsson # ...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 2e5 + 1; const long long LOG = 20; vector<pair<long long, long long> > edg[MAXN]; long long sz[MAXN]; long long link[MAXN]; long long ans[MAXN]; bool used[MAXN]; vector<pair<long long, long long> > ost[MAXN]; long long dp[MAXN][LOG...
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2015.2 (lin64) Build Fri Jun 26 16:35:25 MDT 2015 // Date : Sat Oct 31 15:04:15 2015 // Host : cascade.andrew.cmu.edu running 64-bit Red H...
#include <bits/stdc++.h> using namespace std; long long abs2(long long a) { return a >= 0 ? a : -a; } long long calc(long long k, long long a) { if (k >= 0) return k / a; return (k - (a - 1)) / a; } long long calc2(long long a1, long long b1, long long a2, long long b2) { long long x = abs2(a1 - a...
////////////////////////////////////////////////////////////////////// //// //// //// eth_shiftreg.v //// //// //// //// This file is part of the Ether...
/******************************************************************************* * 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 ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, sy, sx; cin >> n >> m >> sy >> sx; int up = sy; int down = sy + 1; int l = sx; int r = sx + 1; int k = 2; while (up >= 1) { while (l >= 1) { cout << up << << l << endl; l--; } w...
/* * 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 maxn = 100000 + 1; int n, m, s; int b[maxn]; int p[maxn]; int ansn, anst; bool ok(int k) { int i = n - 1; int j = k - 1; int tansn = 0, tanst = 0; int ss = s; while (j >= 0) { if (i >= 0 && b[i] >= p[j]) { tanst += p...
//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 associate...
/** * 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...
// soc_system_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 15.0 145 `timescale 1 ps / 1 ps module soc_system_mm_interconnect_0_avalon_st_adapter #( parameter inBi...
// Directive indicates that 1ns is the time period used when specifying delays // (i.e., #10 means 10ns); 100ps is the smallest unit of time precision that // will be simulated (100ps = .1ns; thus #.1 is meaningful, #.00001 is equivalent // to #0) `timescale 1ns / 100ps module testbench (); reg clk; reg reset_;...
#include <bits/stdc++.h> const int N = 200100; using namespace std; vector<long long int> v[N]; long long int n, down[N], up[N], k, s[N], a[N]; long long int ans; void f(long long int x, long long int p) { s[x] = a[x]; for (int i = 0; i < v[x].size(); i++) { long long int y = v[x][i]; if...
#include <bits/stdc++.h> using namespace std; #define y1 temp_y1 #define all(x) x.begin(), x.end() const int N = 3e5 + 5; int n; int lst[N]; int fa[N]; vector<int> g[N]; int min_leaf = -1; int ext_cnt = 0; bool ok = true; void dfs1(int u, int k) { for (auto v : g[u]) ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef __int128_t LL; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define F first #define S second #define pb push_back mt19937 rnd; const int N = 1e5 + 10; bool good[N], ban[N]; vector...
#include <bits/stdc++.h> using namespace std; long long a[101][101]; int main() { long long n, m; cin >> n >> m; long long mn = min(m, n); cout << mn + 1 << endl; for (long long i = 0; i <= mn; i++) cout << i << << (mn - i) % (mn + 1) << endl; }
/* * super_memory_if - interface between the memory and * the data bus of the supervisor CPU * * Part of the CPC2 project: http://intelligenttoasters.blog * * Copyright (C)2017 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as ...
#include <bits/stdc++.h> using namespace std; long long sum[2000005]; int main() { long long n; double k; cin >> n >> k; vector<long long> v; for (int i = 0; i < n; i++) { long long a; cin >> a; v.push_back(a); } for (int i = 1; i <= n; i++) { sum[i] = sum[i - 1...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18; const long long Mod = 1e9 + 7; const long double Pi = acos(-1); long long n, m, k; struct Weapon { long long Pow, Val; } a[200009], b[200009]; struct Monster { long long Att, Def, Val; } c[200009]; bool Cmp1(Weapon x, ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Samuel A. Falvo II // // Create Date: 13:06:23 11/06/2011 // Design Name: Program Memory // Module Name: M_mem // Project Name: Kestrel-2 // Target Devices: NEXYS2 // Tool versions:...
/** * 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 a, b[1000002], c = 0, d, e, f, g, h, i, j; int main() { cin >> a; for (i = 1; i <= a; i++) { cin >> d; b[d]++; if (b[d] > c) { c = b[d]; e = d; } } cout << e; return 0; }
#include <bits/stdc++.h> using namespace std; int n; int info[200005], sz[200005], Prev[200005 << 1], to[200005 << 1], cst[200005 << 1], cnt_e; void Node(int u, int v, int c) { Prev[++cnt_e] = info[u], info[u] = cnt_e, to[cnt_e] = v, cst[cnt_e] = c; } long long G, B; void dfs(int u, int ff) { ...
module premuat1_8( enable, inverse, i_0, i_1, i_2, i_3, i_4, i_5, i_6, i_7, o_0, o_1, o_2, ...
// This is a 4 bit serial adder, output will be ready after 4 clock cycles // Assume a,b will change with the clock // Assume carryin will NOT change with the clock i.e. it will remain constant over the 4 clock cycles // The outputs y & carryout will keep changing at posedge to indicate the current state of calculation...
// -- (c) Copyright 2008 - 2012 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...
/* * Copyright 2013, Homer Hsing <> * * 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 to ...
/* * 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...
////////////////////////////////////////////////////////////////////////// // Department of Computer Science // National Tsing Hua University // Project : FIFO for CS4125 Digital System Design // Module : fifo_ctl.v // Author : Chih-Tsun Huang // E-mail : // Revision : 4 // Date : 2014/04/28 // Abstra...
/** * 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...
// divmmc // // Total refactoring. Made module synchroneous. (Sorgelig) // module divmmc ( input clk_sys, input [1:0] mode, // CPU interface input nWR, input nRD, input nMREQ, input nRFSH, input nIORQ, input nM1, input ...
#include <bits/stdc++.h> using namespace std; void solve() {} void no() { cout << NO << n ; exit(0); } const long long maxn = 100050; long long a[maxn]; long long psa[maxn]; signed main() { ios::sync_with_stdio(0); cin.tie(0); long long n; cin >> n; for (long long i = 1; ...
//axi_interconnect.v /* Distributed under the MIT licesnse. Copyright (c) 2017 Dave McCoy () 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 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...
#include <bits/stdc++.h> using namespace std; const int maxn = (int)555; const int mod = (int)1e9 + 7; const int P = (int)1e6 + 7; const double pi = acos(-1.0); int a[maxn][maxn], b[maxn][maxn], n; vector<vector<int> > base{{1, 2, 4}, {5, 3, 8}, {9, 6, 7}}; void rec(int n) { if (n == 3) { for ...
#include <bits/stdc++.h> using namespace std; struct Point { int x, y; Point() {} Point(int a, int b) { x = a; y = b; } }; double hypt(Point A, Point B) { return sqrt((B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y)); } int main() { int k, n; cin >> n >> k; v...
#include <bits/stdc++.h> using namespace std; int main() { int m, n; cin >> m >> n; if (m % 2 == 0) { cout << (m * n / 2); } else { cout << ((m / 2) * n + n / 2); } return 0; }
//lpm_divide CBX_SINGLE_OUTPUT_FILE="ON" LPM_DREPRESENTATION="UNSIGNED" LPM_HINT="LPM_REMAINDERPOSITIVE=TRUE" LPM_NREPRESENTATION="UNSIGNED" LPM_TYPE="LPM_DIVIDE" LPM_WIDTHD=64 LPM_WIDTHN=64 denom numer quotient remain //VERSION_BEGIN 16.0 cbx_mgl 2016:07:21:01:49:21:SJ cbx_stratixii 2016:07:21:01:48:16:SJ cbx_util_mgl...
module signed_logic_operators_bug(); reg [7:0] a, b; wire [15:0] yuu, yus, ysu, yss; wire [15:0] zuu, zus, zsu, zss; initial begin // Example vector a = 8'b10110110; b = 8'b10010010; // Wait for results to be calculated #1; // Display results $display("a = %b", a); $display("b ...
#include <bits/stdc++.h> using namespace std; int a, b; int noOfDivisors(int n) { int till = sqrt(n); int c = 0; for (int i = 1; i < till + 1; i++) { if ((n % i) == 0) { if (i > b) c++; if ((n / i) > b && (n != i * i)) c++; } } return c; } int main() { scanf...
module tacho_fpga(quadA, quadB, mosi, miso, sck, cs, dir, step); parameter COUNT_BITS = 32; input quadA, quadB; output miso; input mosi, sck, cs; output dir, step; wire clk; OSCH #( .NOM_FREQ("53.2") ) internal_oscillator_inst ( .STDBY(1'b0), .OSC(clk) ); reg [COUNT_BITS - 1: 0] step_period; reg dir; ...
#include <bits/stdc++.h> using namespace std; vector<int> e[300020]; int f[300020][3]; inline int Mod(int x) { return x + ((x >> 31) & 998244353); } void DFS(int x, int p) { int i, v; f[x][0] = 1; f[x][1] = 1; f[x][2] = 1; for (i = 0; i < (signed)e[x].size(); i++) if ((v = e[x][i]) !...
#include <bits/stdc++.h> template <typename Arg1> void __f(const char* name, Arg1&& arg1) { std::cout << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, , ); std::cout.writ...
#include <bits/stdc++.h> using namespace std; char a[60][60]; int ch(int r, int c) { int i, j, f = 0; for (i = 0; i < c; i++) { if (a[0][i] == P ) f = 1; } if (f == 0) return 0; f = 0; for (i = 0; i < c; i++) { if (a[r - 1][i] == P ) f = 1; } if (f == 0) return 0; ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) { long long n, g, b; cin >> n >> g >> b; if (g >= b) { cout << n << endl; continue; } long long good_need = n / 2; ...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's register file read operands mux //// //// //// //// This file is part of the OpenR...
// In the name of Allah. // We re nothing and you re everything. // Ya Ali! #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5 + 14, S = 2000; struct Block { int val, cnt; }; struct BlockManager { list<Block> l{{0, maxn}}; int cnt[maxn];...
/* * Redistributions of any form whatsoever must retain and/or include the * following acknowledgment, notices and disclaimer: * * This product includes software developed by Carnegie Mellon University. * * Copyright (c) 2008 James C. Hoe, * Computer Architecture Lab at Carnegie Mellon (CALCM), * Carnegie Mello...
// -------------------------------------------------------------------- // ng_PAR Parity Generator Checker Module // -------------------------------------------------------------------- `include "ControlPulses.h" // -------------------------------------------------------------------- module ng_PAR( input CLK2, ...
/** * 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 <class T1, class T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { os << { << p.first << , << p.second << } ; return os; } template <class T> ostream& operator<<(ostream& os, const vector<T>& p) { os << [ ; int i = 0; ...
// // Copyright (c) 1999 Steven Wilson () // // 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) // ...
//================================================= // NORMALISED THRESHOLD DETECTOR MODULE //================================================= module DETECTOR( input SYS_CLK, input RST, input [13:0] TIME, input [23:0] THRESHOLD, input [29:0] Y, input [25:0] sumXsq, output reg [59:0] Yn_NUM, ...
#include <bits/stdc++.h> using namespace std; char ans[10][10]; long long dp[10][513][513]; pair<pair<long long, long long>, long long> recur[10][513][513]; long long insert[10][513][513]; long long curr, nexty, n, m; long long setBit(long long num, long long i) { return num | (1 << i); } long long unse...
module main; wire [2:0] value1, value2, value3, value4; dut #( .select(1) ) dut1(value1); dut #( .select(2) ) dut2(value2); dut #( .select(3) ) dut3(value3); dut #( .select(4) ) dut4(value4); initial begin #1 $display("value1=%d, value2=%d, value3=%d, value4=%d", value1, value2, value3, v...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 00:26:35 03/30/2016 // Design Name: // Module Name: MAIN // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenci...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2013 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 // Very simple test for interface pathclearing module t (/*AUTOARG*/ // Inputs clk ); input ...
// // Copyright (c) 2003 Launchbird Design Systems, 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: // Redistributions of source code must retain the above copyright notice, this lis...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int MAX = 1000005; int SetBit(int n, int x) { return n | (1 << x); } int ClearBit(int n, int x) { return n & ~(1 << x); } int ToggleBit(int n, int x) { return n ^ (1 << x); } bool CheckBit(int n, int x) { return (bool)(n & (1 ...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; vector<vector<pair<int, int>>> g; vector<pair<int, pair<int, int>>> edg; int cp[100010]; int find(int x) { return cp[x] = cp[x] == x ? x : find(cp[x]); } void union_(int x, int y) { cp[find(x)] = find(y); } int h[100010]; int ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 16:12:26 12/16/2015 // Design Name: uart2_rx // Module Name: H:/Firmware/font5_base_new/font5_base/font5-firmware/uart2_rx_tb.v // Project Name: font5_base // Target...
/** * 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...
/*------------------------------------------------------------------------------ * 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...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.1 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1 ns / 1 ...
// (C) 2001-2011 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated doc...
module gen_test1(clk, a, b, y); input clk; input [7:0] a, b; output reg [7:0] y; genvar i, j; wire [15:0] tmp1; generate for (i = 0; i < 8; i = i + 1) begin:gen1 wire and_wire, or_wire; assign and_wire = a[i] & b[i]; assign or_wire = a[i] | b[i]; if (i % 2 == 0) begin:gen2true assign tmp1[i] = and_wire...
#include <bits/stdc++.h> using namespace std; long long arr[200200]; int main() { string a, b; cin >> a >> b; long long x = 0, y = 0; for (int i = 0; i <= b.size() - a.size(); i++) x += (b[i] - 0 ); for (int i = 0; i < a.size(); i++) { y += (a[i] == 0 ) ? x : (b.size() - a.size() + 1) ...
//2048 words deep, 16 bits wide, fifo //data is written into the fifo when wr=1 //reading is more or less asynchronous if you read during the rising edge of clk //because the output data is updated at the falling edge of the clk //when rd=1, the next data word is selected module paula_floppy_fifo ( input clk, ...
/* * 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; int main() { string s; int n, x = 1, y = 1; cin >> n; while (n--) { cin >> s; if (s == ULDR ) x++, y++; else if (s == UR || s == DL ) x++; else y++; } cout << 1LL * x * y << endl; }
module top; real rval1, rval2; reg val1, val2; reg [3:0] wval1, wval2; reg [1:0] wres; reg res; reg pass; initial begin pass = 1'b1; val1 = 1'b0; val2 = 1'b0; res = val1 <-> val2; if (res !== 1'b1) begin $display("FAILED: 1'b0 <-> 1'b0 returned %b not 1'b1", res); pass = ...
#include <bits/stdc++.h> using namespace std; long long t, n, m; int a[200003]; pair<int, int> p[200003]; int main() { cin >> t; while (t--) { cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; } long long re = 0; for (int i = 1; i <= n;) { int val = a[...
#include <bits/stdc++.h> using namespace std; char ans[444444], a[444444]; long long h1[444444], h2[444444], p[444444]; int d1, d2, n; bool check(int i, int e) { if (i > n) return e; int s = e ? a : a[i]; for (char x = s; x <= z ; ++x) { h1[i] = h1[i - 1] * 241 + x; h2[i] = h2[i - 1...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long t; cin >> t; while (t--) { long long n, m; cin >> n >> m; bool gt = true; long long mn = m, mx = m; long long curt = 0; for (lo...
/** * 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; const int N = 1e5 + 10; const int S = 40; const unsigned long long mod = 998244353; struct poly { int a[S + 10]; inline int& operator[](const int& x) { return a[x]; } poly() { for (int i = 0; i < S; i++) a[i] = 0; } friend poly operator*(...
#include <bits/stdc++.h> using namespace std; int main() { int c, a, b; cin >> a >> b >> c; cout << a * b * c - (a - 1) * (b - 1) * (c - 1); return 0; }
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps / 1ps `include "utils/bus_to_ip.v" `include "utils/cdc_pulse_sync.v...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; int t; void solve(); struct Node { long long q, w, e, r, t; }; int n; vector<Node> a; vector<bool> ans; int res = 0; int main() { ios_base::sync_with_stdio(false); cin.tie(0); t = 1; for (...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_ea_e // // Generated // by: wig // on: Mon Jun 26 08:31:57 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../generic.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Aut...
#include <bits/stdc++.h> namespace algo { using std::swap; const long double PI = 3.141592653589793238462643383279502884L; const long double E = 2.718281828459045235360287471352662498L; const long double EPS = 1e-12L; template <typename T1, typename T2> T1 bin_pow(T1 a, T2 n) { T1 r{1}; while (n >...
#include <bits/stdc++.h> using namespace std; int main() { long int n, m; cin >> n; cin >> m; char str[2002][2002]; long int A[10002][2]; long int cnt = 0; long int i, j; for (i = 0; i < n; i++) { cin >> str[i]; for (j = 0; j < m; j++) { if (str[i][j] == w ) { ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int t; cin >> (t); while (t--) { long long int n, k; cin >> n >> k; long long int a[n + 2]; memset(a, -1, sizeof a); bool ok = f...
/*********************************************************************************************************************** * Copyright (C) 2017 Andrew Zonenberg and contributors * * ...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; struct Point { int x, y; Point(int x_ = 0, int y_ = 0) : x(x_), y(y_) {} Point(std::istream &in) { in >> x >> y; x *= 2; y *= 2; } }; bool operator<(const Point &a, const Point &b) { return (a.x < 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; int main() { int n; cin >> n; string s, soln; cin >> s; soln = s; for (int i = 0, idx = (n - 1) / 2; i < n; i++) { soln[idx] = s[i]; if ((n + i) % 2 == 0) idx += (i + 1); else if ((n + i) % 2 == 1) idx -= (i + 1)...
// Texas A&M University // // cpsc350 Computer Architecture // // $Id: IdealMemory.v,v 1.3 2002/11/19 00:58:22 miket Exp miket $ // // InstrMem is an asynchronous read memory model // // MemSize Wordise parameterize the memory module at instantiation time // module InstrMem (Mem_Addr, Dout); parameter T_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> inline int mymin(int x, int y) { return x < y ? x : y; } bool isprime[22000]; inline void init_prime() { memset(isprime, true, sizeof(isprime)); for (int i = 2; i <= (int)sqrt(20000 * 1.0); ++i) if (isprime[i]) for (int j = 2; i * j <= 20000; ++j) isprime[i * j] = fa...
#include <bits/stdc++.h> using namespace std; const int sz = 1500000; const long long MAX = 10000000000000000; template <typename T> T abs(T a) { return a < 0 ? -a : a; } int main() { int n, m; cin >> n >> m; vector<vector<int> > graph(n); for (long long i = 0; i < m; i++) { int ...
#include <bits/stdc++.h> using namespace std; int n; char a[1000]; int mp[105][150]; int jishu[105][5]; int flag; int main() { scanf( %d , &n); memset(mp, 0, sizeof(mp)); getchar(); for (int i = 1; i <= n; i++) { memset(a, 0, sizeof(a)); gets(a); flag = 0; for (unsi...
#include <bits/stdc++.h> using namespace std; int f[10000001]; int main() { int n, m, l, r; scanf( %d%d , &n, &m); long long ans = 0; int Max0 = max(n * 2, m); for (long long b = 1; b <= n; ++b) { ans += 2 * min(b * b, (long long)m); l = max(0, int(ceil(sqrt(b * b - m)))); r ...
#include <bits/stdc++.h> using namespace std; int N; pair<pair<int, int>, int> V[100005]; vector<int> r; bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) { if (a.first.first != b.first.first) return a.first.first > b.first.first; return a.first.second > b.first.second; } int main...
// ledtest_ARM_MCU_hps_io.v // This file was auto-generated from altera_hps_io_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 17.0 595 `timescale 1 ps / 1 ps module ledtest_ARM_MCU_hps_io ( output wire [14:0] mem_a, // memory.mem_a output wire...