text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; int report[105], folder[105]; int main() { int n; cin >> n; int k = 1, am = 0; for (int i = 1; i <= n; i++) cin >> report[i]; for (int i = 1; i <= n; i++) { if (report[i] < 0 && am == 2) { k++; folder[k]++; am = 1; ...
#include <bits/stdc++.h> using namespace std; long long i, j, n, t, sum = 0, k, c1 = 1; int main() { cin >> n; vector<string> c(n); vector<string> s(n); for (i = 0; i < n; i++) { cin >> c[i] >> s[i]; } for (i = 1; i < n; i++) { k = 0; for (j = i - 1; j >= 0; j--) { ...
#include <bits/stdc++.h> #pragma GCC optimize( O2 ) using namespace std; const int N = 1e5 + 10; const long long mod = 1e9 + 7; const long long mod2 = 998244353; const int inf = 1e9; const int LOG = 22; long long pw(long long a, long long b, long long M) { return (!b ? 1 : (b & 1 ? (a...
#include <bits/stdc++.h> using namespace std; const int N = 300005, mod = 998244353; int qp(int a, int b) { int ans = 1; while (b) { if (b & 1) ans = 1ll * ans * a % mod; a = 1ll * a * a % mod; b >>= 1; } return ans; } int rv[N], w[N]; void ntt(vector<int> &a, int f) { ...
////////////////////////////////////////////////////////////////// //// //// //// AES CORE BLOCK //// //// //// //// This file is part of the APB to AES128 project //// //// http://www.opencores.org/cores/apbtoaes128/ //// //// //// //// Description //// //// Implementation of APB IP core according to //// //// aes128...
/******************************************************************************* * 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 ...
// file: Clock.v // // (c) Copyright 2008 - 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 lice...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; cin >> a[0]; int count = a[0]; int max = a[0]; for (int i = 1; i < n; i++) { cin >> a[i]; } for (int i = 1; i < n; i++) { count = count + a[i] - a[i - 1]; if (max < count) max ...
#include <bits/stdc++.h> using namespace std; vector<vector<long long int> > dp; vector<long long int> a; long long int check(long long int l, long long int r) { if (l >= r) return 0; if (dp[l][r]) return dp[l][r]; if (l + 1 == r) { dp[l][r] = a[r]; return a[r]; } dp[l][r] = -1; ...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's instruction fetch //// //// //// //// This file is part of the OpenR...
#include <bits/stdc++.h> using namespace std; set<long long> mod; int main() { long long n, k; scanf( %I64d%I64d , &n, &k); bool result = true; for (long long i = 1LL; i <= k; i++) { long long x = n % i; if (mod.find(x) != mod.end()) { result = false; break; } ...
/** * 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 std::max; const int MAXN = 500111; int N; struct Data { int Cnt, Id; long long Val; int next; Data() {} Data(int _c, int _i, long long _v) { Cnt = _c; Id = _i; Val = _v; } } T[MAXN << 2]; int Tcnt; namespace Map { struct Vert { ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; long long n, q; struct interv { long long l, r, ubonus, lbonus; interv(long long L, long long R, long long UBONUS, long long LBONUS) { l = L; r = R; ubonus = UBONUS; lbonus = LBONUS; } bool operator<(const interv& x) const { ret...
/* * 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 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 n, ans, flag; int a[100005], b[100005], xb[100005]; void solve() { int i, j, ma; ans = -1; b[1] = xb[1] = 0; for (i = 2; i <= n; i++) { ma = 0; flag = 0; j = i - 1; while (a[j] < a[i] && j) { if (!b[j]) { ...
#include <bits/stdc++.h> using namespace std; const int N = 2e3; bool possible, check[N << 2], mark[N << 2]; vector<int> topol, from[N << 2], to[N << 2]; int n, m, c, d[N], com[N << 2], row[N], col[N], a[N][N], b[N][N]; void dfs_scc(int u, int c) { com[u] = c; mark[u] = true; for (auto v : to[u]...
#include <bits/stdc++.h> template <typename T, int NDIMS> struct tensor_view { static_assert(NDIMS >= 0, NDIMS must be nonnegative ); protected: std::array<int, NDIMS> shape; std::array<int, NDIMS> strides; T* data; tensor_view(std::array<int, NDIMS> shape_, std::array<int, NDIMS> strides_,...
#include <bits/stdc++.h> using namespace std; long long m[1000001], cd, kq[100000]; map<long long, long long> ruler; int main() { cin >> cd; for (long long i = 1; i <= cd; i++) { cin >> m[i]; ruler[m[i]] = 1; } for (long long i = 1; i <= cd; i++) { long long e = 1; kq[e] ...
module etx_io (/*AUTOARG*/ // Outputs txo_lclk_p, txo_lclk_n, txo_frame_p, txo_frame_n, txo_data_p, txo_data_n, tx_wr_wait, tx_rd_wait, // Inputs tx_lclk_io, tx_lclk_div4, tx_lclk90, txi_wr_wait_p, txi_wr_wait_n, txi_rd_wait_p, txi_rd_wait_n, tx_data_slow, tx_frame_slow ); parameter PLATFORM...
(**********************************************************************) (* Equations *) (* Copyright (c) 2009-2020 Matthieu Sozeau <> *) (**********************************************************************) (* This file is distributed under the terms of the ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t = 1; cin >> t; while (t-- > 0) { int n; cin >> n; string srr[n]; for (int i = 0; i < n; i++) { cin >> srr[i]; } vector...
//Control circuit `include "verilog/mips_instr_defines.v" module control ( input wire[5:0] instr_op_ctl_i, input wire[5:0] instr_funct_ctl_i, output wire reg_src_ctl_o, output wire reg_dst_ctl_o, output wire jump_ctl_o, ou...
#include <bits/stdc++.h> using namespace std; long long n, x, y, ans; struct Edge { long long to, next; } edge[2 * 300001]; long long head[300001], sze; long long fa[300001], Tsze[300001], deep[300001]; inline char gc() { static char now[1 << 20], *S, *T; if (T == S) { T = (S = now) + fr...
module AUDIO_DAC_FIFO ( // FIFO Side iDATA,iWR,iWR_CLK, oDATA, // Audio Side oAUD_BCK, oAUD_DATA, oAUD_LRCK, oAUD_XCK, // Control Signals iCLK_18_4, iRST_N ); parameter REF_CLK = 18432000; // 18.432 MHz parameter SAMPLE_RATE = 48000; // 48 KHz par...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2019 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 interface secret_intf(); logic secret_a; integer secret_b; endinterface module t (/*AUTOARG*/ //...
#include <bits/stdc++.h> const long long INF = 0x3f3f3f3f; using namespace std; void sol() { long long n, m; while (cin >> n >> m) { string s; cin.ignore(); cin >> s; long long x[6][n]; string a[6] = { abc , acb , bca , bac , cab , cba }; memset(x, 0, sizeof(x)); ...
#include <bits/stdc++.h> using namespace std; int a[20]; int main() { int n, b[20]; cin >> n; for (int i = 0; i < n; i++) cin >> b[i]; int kol = 1; for (int i = 0; i < n; i++) kol *= 2; for (int i = 0; i < kol; i++) { int sum = 0; a[n - 1]++; for (int j = n - 1; j > 0; j-...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9; struct outgoing { long long wt = INF, to = -1; }; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; vector<long long> stations; vector<pair<long long, long long>> connections; ...
#include <bits/stdc++.h> using std::cerr; using std::cin; using std::cout; using std::endl; using std::list; using std::map; using std::max; using std::min; using std::pair; using std::set; using std::sort; using std::string; using std::swap; using std::vector; const int MAXN = 100005; c...
#include <bits/stdc++.h> using namespace std; const long long INF = (long long)-1e18; const int N = 200 * 1000 + 100; vector<int> g[N]; vector<int> w[N]; vector<pair<long long, long long> > cur; long long add[N]; long long ans[N]; int a[N]; long long dfs2(int v) { ans[v] = add[v]; for (int i...
#include <bits/stdc++.h> using namespace std; const long long maxn = 1005, maxk = 12; string s, t; long long d[maxn][maxn][maxk][2]; long long n, m, k; int main() { ios_base::sync_with_stdio(false); cin >> n >> m >> k >> s >> t; for (long long i = 0; i <= n; i++) { for (long long j = 0; j ...
#include <bits/stdc++.h> using namespace std; int main() { string a; cin >> a; if (a[0] >= a && a[0] <= z ) a[0] -= 32; cout << a; 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; int main(int argc, char** argv) { int T; cin >> T; while (T--) { long long a, b, c, d; cin >> a >> b >> c >> d; d -= min(a, d / c) * c; if (d > b) puts( NO ); else puts( YES ); } return 0; }
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: bg4_new.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ============================...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2018.2 // Copyright (C) 1986-2018 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1 ns / 1 ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, m, rt; int p[20][N], sz[N]; bool vis[N]; int dep[N], yr[N]; int cur = 1, pos[N], chainhd[N], chain[N], rpos[N]; int L[100 * N], R[100 * N], t[100 * N], root[N], nxt = 1, num; int query[N], a[N], b[N], k[N], y[N]; vector<int>...
//lpm_divide CBX_SINGLE_OUTPUT_FILE="ON" LPM_DREPRESENTATION="UNSIGNED" LPM_HINT="LPM_REMAINDERPOSITIVE=TRUE" LPM_NREPRESENTATION="UNSIGNED" LPM_TYPE="LPM_DIVIDE" LPM_WIDTHD=32 LPM_WIDTHN=64 denom numer quotient remain //VERSION_BEGIN 16.0 cbx_mgl 2016:04:27:18:06:48:SJ cbx_stratixii 2016:04:27:18:05:34:SJ cbx_util_mgl...
/** * 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> long long nmax[11] = {0, 9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999, 9999999999LL}; long long P[11][11]; long long cnt[11][11][11], C[11][11], totalcnt[11][11], tmp; long long nsel[11][11][11][11][11], fact[11], nw...
/* * Milkyminer * * Copyright (c) 2011 * Copyleft 2012 * * 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 distributed in the hope that it...
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair using namespace std; typedef pair <int, int> pii; struct UF { int fa[3010]; void clear(int n) { for (int i = 1; i <= n; i++) { fa[i] = i; } } int find(int x) { if (fa[x] == x) return x; re...
`default_nettype none `define WIDTH 16 module j1( input wire clk, input wire resetq, output wire io_rd, output wire io_wr, output wire [15:0] mem_addr, output wire mem_wr, output wire [`WIDTH-1:0] dout, input wire [`WIDTH-1:0] io_din, output wire [12:0] code_addr, input wire [15:0] insn); r...
/* * yosys -- Yosys Open SYnthesis Suite * * Copyright (C) 2012 Clifford Wolf <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * T...
/* * 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 M = 1200000; const int inf = 0x3f3f3f3f; int n, m, k; vector<int> g[M]; int ans; int dfs(int u, int f) { vector<int> v = {0, 0}; for (int to : g[u]) { if (to == f) continue; v.push_back(dfs(to, u)); } sort(v.begin(), v.end...
#include <bits/stdc++.h> using namespace std; long long f[2][1000005]; long long h[1000005]; int n; int main() { scanf( %d , &n); for (int i = (0); i < (n); i++) scanf( %lld , h + i); long long res = 0; for (int i = (1); i < (n + 1); i++) { long long mx = h[i - 1] - 1; f[1][i] = h[...
/*********************************************************************************************************************** * Copyright (C) 2016 Andrew Zonenberg and contributors * * ...
/** * 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...
//***************************************************************************** // (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 /...
#include <bits/stdc++.h> using namespace std; long long int sum; vector<int> x; int main() { int n; cin >> n; x.push_back(-2099999999); for (int i = 0; i < n; i++) { int a; cin >> a; x.push_back(a); } sort(x.begin(), x.end()); for (int i = 1; i <= n; i++) sum += abs...
//***************************************************************************** // (c) Copyright 2008-2010 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 // ...
`timescale 1 ps / 1 ps module zynq_1_wrapper (BRAM_PORTB_addr, BRAM_PORTB_clk, BRAM_PORTB_din, BRAM_PORTB_dout, BRAM_PORTB_we, DDR_addr, DDR_ba, DDR_cas_n, DDR_ck_n, DDR_ck_p, DDR_cke, DDR_cs_n, DDR_dm, DDR_dq, DDR_dqs_n, DDR_dqs_p, DDR_odt, DDR_ra...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:37:00 11/09/2016 // Design Name: // Module Name: button_painter // Project Name: // Target Devices: // Tool versions: // Description: // // ...
/* * 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 / 100ps /* This module creates a byte-wide assembly of GPIA_BIT_INs. */ module GPIA_BYTE_IN( input [7:0] out_i, input [7:0] inp_i, input [7:0] ddr_i, input stb_i, output [7:0] q_o ); GPIA_BIT_IN bit0( .out_i(out_i[0]), .inp_i(inp_i[0]), .ddr_i(ddr_i[0]), .stb_i(stb_i), .q_o(q_o[0]) ); GP...
//------------------------------------------------------------------------------ // // Copyright 2011, Benjamin Gelb. All Rights Reserved. // See LICENSE file for copying permission. // //------------------------------------------------------------------------------ // // Author: Ben Gelb () // // Brief Description: //...
#include <bits/stdc++.h> using namespace std; const int inf(1010101010); struct uf { int par[5005], rank[5005]; int ff(int x) { return par[x] == x ? x : par[x] = ff(par[x]); } void uu(int x, int y) { x = ff(x), y = ff(y); if (x == y) return; if (rank[x] > rank[y]) par[y] = x;...
// (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; using int64 = long long; constexpr int64 P = 1000000007; struct FiniteField { private: int64 x; public: FiniteField(int64 x) : x(x) { if (x > P || x < 0) { cerr << Invalied FiniteField! << endl; exit(1); } } Fin...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); string s; int i = 0; cin >> s; int z = 0, o = 0; while (s[i] == 0 ) { i++; } for (; i < s.length(); i++) { if (s[i] == 0 ) { z++; ...
// $Id: tss_max32.v,v 1.6 1999/01/20 17:34:54 wsnyder Exp $ //============================================================================ `time_scale module tss_max32 (/*AUTOARG*/ // Outputs max, // Inputs a, b ); //====================================================================== // Input...
`default_nettype none //`include "gci_std_display_parameter.h" module gci_std_display_top #( parameter P_VRAM_SIZE = 307200, parameter P_VRAM_INDEX = 0, parameter P_AREA_H = 640, parameter P_AREA_V = 480, parameter P_AREAA_HV_N = 19, parameter P_MEM_ADDR_N = 23 )( //System input wire iCLOCK, input ...
#include <bits/stdc++.h> using namespace std; int n, m; long long f(const string& s) { long long res = 0; for (int i = 0; i + 1 < s.size(); ++i) { if (s[i] != s[i + 1]) { res += (m - 1) * (n - i - 1); } } return res; } long long g(const string& s) { long long res = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n, i, j, k, p, c, x, m, a, b, d, y, t; cin >> t; while (t--) { cin >> n >> a >> b >> c >> d; x = (a - b) * n; y = (a + b) * n; if ((y < (c - d)) || (x...
#include <bits/stdc++.h> using namespace std; long long int tc, n, m, k; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; cin >> n; long long int k1, k2; cin >> k1; queue<long long int> q1; for (__typeof(k1) i = (0) - ((0) > (k1)); i != (k1) - ((0...
#include <bits/stdc++.h> using namespace std; const int MAXS = 75, MAXK = 10, MAXQ = 30; const long long INF = 0x3f3f3f3f3f3f3f3f; int x, k, n, q, c[MAXK]; struct node { int p, w; } d[MAXQ]; bool operator<(const node &aa, const node &bb) { return aa.p < bb.p; } int sta[MAXS], scn, cnt[300], id[300];...
#include <bits/stdc++.h> using namespace std; int main() { int _; for (cin >> _; _; _--) { int n; scanf( %d , &n); double a = 3.1415926535 / n; double cosa = cos(a); double r = sqrt(0.5 / (1 - cosa)); a = a / 4; cosa = cos(a); printf( %.9lf n , r * cosa * 2); ...
#include <bits/stdc++.h> int main() { int tc; scanf( %d , &tc); while (tc--) { int n, i, z = -1, o = -1, s = 0, max = -1; scanf( %d , &n); char ss[n + 5], at[2]; scanf( %s , ss); int a[n], b[n], zero[n], one[n]; for (i = 0; i < n; i++) { at[0] = ss[i]; a...
/* * 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 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 fun(pair<int, int> x, pair<int, int> y) { return x.second < y.second; } int main() { vector<pair<int, int> > vii; int n, k; cin >> n >> k; for (int i = 0; i < n; i++) { int x; cin >> x; vii.push_back(make_pair(x, x % 10)); } ...
#include <bits/stdc++.h> using namespace std; void solve() { int v; cin >> v; int a[9]; int t = 100000, x; for (long long i = 0; i < 9; ++i) { cin >> a[i]; t = min(t, a[i]); } if (t > v) { cout << -1; return; } x = v / t; while (x--) { for (int i...
// bsg_front_side_bus_hop_in // // this implements the front side bus // input side. it does *not* have backwards // flow control, since nodes are supposed // to have enough buffering to accept // all incoming packets. // `include "bsg_defines.v" module bsg_front_side_bus_hop_in_no_fc #(parameter `BSG_INV_PARAM(width...
`include "uart.vh" module uart_rx( input clk_i, input rx_i, output [DATA_LENGTH - 1 : 0] tx_o, output tx_o_v ); localparam SAMPLE_RATE = `UART_RX_SAMPLE_RATE; localparam SAMPLE_UPPER = `UART_RX_SAMPLE_UPPER; localparam SAMPLE_MID = `UART_RX_SAMPLE_MID; localpa...
module lsu_in_flight_counter( in_rd_en, in_wr_en, in_mem_ack, out_lsu_ready, clk, rst ); parameter MAX_INFLIGHT_DATA_MEM = 16; parameter MAX_INFLIGHT_DATA_MEM_LOG2 = 4; input [3:0] in_rd_en; input [3:0] in_wr_en; input in_mem_ack; output out_lsu_ready; input clk; input rst; wire rd_en; wire wr_en; wir...
#include <bits/stdc++.h> using namespace std; vector<int> myvec[100001]; set<int> myset[2]; set<int>::iterator it; int mark[100001]; bool isbipartite(int src) { int color[100001]; memset(color, -1, sizeof(color)); queue<int> q; q.push(src); mark[src] = 1; color[src] = 1; myset[co...
#include <bits/stdc++.h> using namespace std; long long MOD = 998244853; long long mpow(long long a, long long b) { if (b == 0) return 1; long long t1 = mpow(a, b / 2); t1 *= t1; t1 %= MOD; if (b % 2) t1 *= a; t1 %= MOD; return t1; } long long mpow(long long a, long long b, long lo...
#include <bits/stdc++.h> using namespace std; int main() { int n, x; cin >> n >> x; if (n == 3) { cout << >vv << endl << ^<. << endl << ^.< << endl; cout << 1 << << 3; } if (n == 5) { cout << >...v << endl << v.<.. << endl << ..^.. << endl ...
#include <bits/stdc++.h> const double EPS = 0.00000001; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int32_t t; std::cin >> t; for (int32_t cs = 1; cs <= t; cs++) { int32_t n, l; std::cin >> n >> l; std::vector<int32_t> a(n); for (auto &x : a...
#include <bits/stdc++.h> using namespace std; map<int, int> mp; std ::map<int, int>::iterator x, l, s; int main() { int n, p; cin >> n; mp[0] = 0; mp[1 << 30] = 0; for (int i = 0; i < n; i++) { cin >> p; x = mp.lower_bound(p); l = x--; s = x->second > l->second ? x : ...
/* * Titor - System - Minimal system to test the underlying processor * 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 Foundation, either version 3 of ...
/* Copyright (c) 2014 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,...
/** * 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 = 2 * 1e5 + 100, mod = 1e9 + 7; int n, k, a, b; int dp[5010][5010], pr[5010][5010]; int add(int a, int b) { a += b; if (a < 0) a += mod; if (a >= mod) a -= mod; return a; } int main() { scanf( %d%d%d%d , &n, &a, &b, &k); dp[...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: I.T.C.R // Engineer: Jafet Chaves Barrantes // // Create Date: 17:02:57 02/28/2016 // Design Name: // Module Name: Conversor_BCD_7seg // Project Name: // Target Devices: // Tool versions: // ...
/* ------------------------------------------------------------------------------- * (C)2007 Robert Mullins * Computer Architecture Group, Computer Laboratory * University of Cambridge, UK. * ------------------------------------------------------------------------------- * * FIFO * ==== * * Implementation not...
#include <bits/stdc++.h> using namespace std; long long INF = 1e9; const int MAX = 1e5 + 7, N = 1e5 + 3; double pi = acos(-1); long long r, l, k, m, n, ans; int main() { cin >> n; cin >> k >> l; long long m1 = k - 1 + l - 1; long long m2 = n - k + n - l; if (m1 <= m2) { cout << Wh...
//***************************************************************************** // (c) Copyright 2008-2010 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 // ...
module main; wire eq1, eq2, eq5; wire ne1, ne2, ne5; reg [7:0] x, y; eqne dut(.eq1(eq1), .eq2(eq2), .eq5(eq5), .ne1(ne1), .ne2(ne2), .ne5(ne5), .x(x), .y(y)); initial begin for (x = 0 ; x < 'h20 ; x = x+1) for (y = 0 ; y < 'h20 ; y = y+1) begin #1 $display("x=%h, y=%h: ", x, ...
`timescale 1ns / 1ps /* Copyright 2015, Google 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 http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
#include <bits/stdc++.h> using namespace std; int n, a[105], p[105]; long long g[105]; long long d[105][105][105]; bool ok[105][105]; char c[105]; void read(int& x) { char c = getchar(); x = 0; while (!isdigit(c)) c = getchar(); while (isdigit(c)) { x = x * 10 + c - 0 ; c = ge...
#include <bits/stdc++.h> using namespace std; int N; vector<int> a, b, c; multiset<int> m; int main(void) { ios::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL); cin >> N; a.resize(N); b.resize(N); c.resize(N); for (int i = 0; i < N; i++) { cin >> a[i]; } for (i...
//begin #include <Core> /* * Package: StandardCodeLibrary.Core * Last Update: 2012-12-21 * */ #include <iostream> #include <fstream> #include <sstream> #include <iomanip> #include <utility> #include <vector> #include <list> #include <string> #include <stack> #include <queue> #include <d...
#include <bits/stdc++.h> using namespace std; map<pair<string, string>, pair<int, int> > mp; set<pair<string, string> > st; int main() { int n, d; cin >> n >> d; for (int i = 0; i < n; ++i) { string s, q; int x; cin >> s >> q; scanf( %d , &x); if (mp.count({q, s})) { ...
// **************************************************************************** // Copyright : NUDT. // ============================================================================ // FILE NAME : outPUT_CTL.v // CREATE DATE : 2013-12-03 // AUTHOR : ZengQiang // AUTHOR'S EMAIL : // AUTHOR'S TEL : // ==========...
#include <bits/stdc++.h> using namespace std; constexpr int full = 0x7fffffff; bool is_valid(const vector<int> &idx, const int max_i, const int i) { if (max_i < 0) return true; if (idx.at(i) == max_i) { return is_valid(idx, max_i - 1, i + 1); } int j; for (j = 1; idx.at(i) + j <= max_i; ...