text
stringlengths
59
71.4k
/** * 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 x, y, x1, y1; cin >> x >> y >> x1 >> y1; int X = abs(x1 - x), Y = abs(y1 - y); cout << max(X, Y); return 0; }
/** * Author: Evan Lavelle, Riverside Machines Ltd. * Version: 0.1 (2007-05-22) * Licence: This code is released into the public domain. * * Test implicit Verilog-95 style ports. According to 12.3.2 of the 2005 * LRM: * * "The port reference for each port in the list of ports at the top of each * module decla...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Mon May 22 19:34:37 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 15; const int LL = 1e9 + 15; const int SSS = 1e6 + 15; int dx[10] = {0, 1, -1, 1, -1, 2, -2, 2, -2}; int dy[10] = {0, 2, 2, -1, -1, 1, 1, -1, -1}; int n, ii, a[5010], ans[5010], mx, st[5010]; int main() { cin >> n; for (int i = 1;...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, k; cin >> n >> k; long long r = (n * (n - 1)); r = (r >> 1); if (r > k) { for (long long i = 0; i < n; i++) { cout << 0 << << i <...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const long long int INF = 1e12; int n, k; int memo[101][101][101]; int solve(string &str, int i, int N, int _max) { _max = max(N, _max); int &a = memo[i][N][_max]; if (a != -1) return a; if (i == n) return a = (_max == k)...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<long long> p(n); vector<int> a(n), b(n); for (int i = 0; i < n; ++i) cin >> p[i]; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) ...
`timescale 1ns / 1ps // // KIA registers // `define KQSTAT 0 `define KQDATA 1 module KIA( input CLK_I, input RES_I, input [0:0] ADR_I, input WE_I, input CYC_I, input STB_I, output ACK_O, output [7:0] DAT_O, input D_I, input C_I ); reg [7:0] queue[0:15]; reg [3:0] rp; reg [3:0] wp; wire [3:0] next_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; int ask(int c, int d) { cout << ? << c << << d << endl; fflush(stdout); int x; cin >> x; return x; } void go(int a, int b) { cout << ! << a << << b << endl; fflush(stdout); exit(0); } bool same[50]; signed main() {...
/////////////////////////////////////////////////////////////////////////////// // // File name: axi_protocol_converter_v2_1_8_b2s_rd_cmd_fsm.v // /////////////////////////////////////////////////////////////////////////////// `timescale 1ps/1ps `default_nettype none (* DowngradeIPIdentifiedWarnings="yes" *) module a...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int tc; cin >> tc; int z; for (int t = 1; t <= tc; t++) { cin >> z; int a, s, d = 0; s = 0; a = 0; int x; for (int q = 1; q <= z...
#include <bits/stdc++.h> using namespace std; const int INF = INT_MAX; const int N = 2 * 1e3 + 10; const long double eps = 1e-9; const int mod = 998244353; char a[N][N]; int d[N][N], v[N][N], n, m; bool used[N][N]; void nxt(char c, int &x, int &y) { if (c == U ) --x; else if (c == D ) ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fll; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n, x, y; cin >> n >> x >> y; long long a1 = y - n + 1; if (a1 <= 0 or a1 * a1 + n - 1 < x) return cout <...
/** * 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 2013-2015 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 propert...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int test; cin >> test; while (test--) { int n, m; cin >> n >> m; int array[n]; for (int i = 0; i < n; i++) cin >> array[i]; int sum = 0; for (int i = 0;...
`timescale 1ns / 1ps //********************************************************************** // File: button_hold.v // Module:button_hold // by Robin zhang //********************************************************************** module button_hold( rst,clk,out_status,pin_select,press_done ); input rst; input clk; i...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:64777216 ) using namespace std; template <class T> inline T sqr(T x) { return x * x; } const double pi = acos(-1.0), eps = 1e-9; const int INF = 1000 * 1000 * 1000, MAXN = 1000005, MOD = 1000000007; const long long INFL = 1000000000000000000; ...
/* * 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, m, G[1005][1005], ans = 1000000000; char str[1005][1005]; bool vis[1005][1005]; int dfs(int x, int y, int wx, int wy) { vis[x][y] = true; if ((G[x + wx - 1][y + wy] - G[x - 1][y + wy] - G[x + wx - 1][y + 1 - 1] + G[x - 1][y + 1 - 1]) == wx ...
// megafunction wizard: %CRC Compiler v10.1% // GENERATION: XML // ============================================================ // Megafunction Name(s): // altpcierd_rx_ecrc_128_altcrc // ============================================================ // Generated by CRC Compiler 10.1 [Altera, IP Toolbench 1.3.0 Build...
`timescale 1ns/1ps module SensorFSM #( parameter DataWidth = 8 ) ( input Reset_n_i, input Clk_i, // top level input Enable_i, output reg CpuIntr_o, output [2*DataWidth-1:0] SensorValue_o, // to/from Measure-FSM ...
#include <bits/stdc++.h> using namespace std; const int inf(1010101010); int n, k; struct node_t { node_t(char edge, int h) : edge(edge), hier(0), pop(0), h(h) {} char edge; int hier, pop; int h; vector<node_t *> child; }; void ins(node_t *x, char *pos) { x->pop++; if (!pos[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; vector<int> bomb[5005]; int n, m, st_time[5005], sol[5005], dist_min[5005]; int main() { cin >> n >> m; for (int i = 1; i <= n; ++i) dist_min[i] = 2 * 5005; int pos, val; for (int i = 1; i <= m; ++i) { cin >> pos >> val; bomb[pos].push_ba...
#include <bits/stdc++.h> using namespace std; int n, m; int p[100]; char mm[100]; int main() { while (scanf( %d , &n) != EOF) { scanf( %s , &mm); int len = strlen(mm); m = 0; for (int i = 0; i < len; ++i) m = m * 10 + (mm[i] - 0 ); if (n == 0) { if (strlen(mm) != 1) ...
#include <bits/stdc++.h> using namespace std; int n, s, x, v, t, y, i, nr1, nr2, v1[100004], v2[100004], c[1000004], d[1000004]; long long st, dr, m, Min, Min1, x1, x2, a[100004], b[100004]; double nr; bool ok; int main() { scanf( %d %d , &n, &s); for (i = 1; i <= n; i++) { scanf( %d %d ...
#include <bits/stdc++.h> using namespace std; void run_case() { int n, k; cin >> n >> k; vector<int> A(n); for (int &a : A) { cin >> a; } vector<int> ans; for (int i = 1; i < n; i++) { ans.push_back(A[i - 1] - A[i]); } sort(ans.begin(), ans.end()); ; int res =...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: sfifo_112x256_la.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ==========================...
/* Module from the schematic_gui program written by Andreas Ehliar <> This Verilog file is licensed under the CC0 license. */ module mux5 #(parameter WIREWIDTH = 1) (input wire [2:0] s, input wire [WIREWIDTH:0] d0, d1, d2,d3, d4, output reg [WIREWIDTH:0] o); initial begin $schematic_boundingbox(4...
#include <bits/stdc++.h> using namespace std; vector<int>::iterator IntIter; vector<long long>::iterator LLIter; int main(int argc, char *argv[]) { int i, j; int a[3][3]; for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) cin >> a[i][j]; int b[3][3] = {1}; b[0][0] = (a[0][0] + a[0][1] + a...
#include <bits/stdc++.h> using namespace std; const int M = 2010; int A[M][M]; int col[M]; int diag[M]; int main() { ios_base::sync_with_stdio(false); int i, j, k, n; char str[M]; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %s , str); for (j = 0; j < n; j++) A[i][j] = s...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 5; constexpr int SQRT = 1000; struct query { int x, y, pos; short sqrt; bool operator<(const query &b) const { if (sqrt == b.sqrt) { return ((sqrt & 1) ^ y < b.y); } return sqrt < b.sqrt; } }; quer...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2003 Matt Ettus // // 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 2 of the License...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.3.1 (lin64) Build Thu Oct 30 16:30:39 MDT 2014 // Date : Wed Apr 8 20:38:45 2015 // Host : parallella running 64-bit Ubuntu 14.04.2 ...
#include <bits/stdc++.h> using namespace std; int n, m; bool reachable(vector<set<int>> g, int u, int v) { if (g[u].find(v) == g[u].end()) { for (auto x : g[u]) { if (g[x].find(v) != g[x].end()) return true; } } else { return true; } return false; } int main() { 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...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's Instruction Cache top level //// //// //// //// This file is part of the OpenR...
/* * 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...
#include <bits/stdc++.h> using namespace std; const long long N = 1e3 + 10; long long q, x, v, u, w, ans; map<long long, long long> len; int main() { cin >> q; for (int i = 1; i <= q; i++) { cin >> x >> v >> u; if (x == 1) { cin >> w; while (v != u) { if (v > u) {...
/** * 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; unsigned long long int power(unsigned long long int n, unsigned long long int p) { unsigned long long int m = 1; while (p > 0) { m *= n; p--; } return m; } void sieveOfEratosthenes(int n, bool prime[]) { ...
#include <bits/stdc++.h> const int maxn = 2 * 100000; const int inf = 99999999; class array { public: int num; int left; int right; array() { left = right = inf; } } a[maxn + 1]; int queue[maxn + 1]; int head = 1, tail = 1; int main() { int n; scanf( %d , &n); int nowzero = ...
/* * Copyright 2018-2022 F4PGA 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 to in...
/** * 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> #pragma GCC optimize( O3 , unroll-loops ) using namespace std; namespace { const int MOD107 = 1000000007; const int MOD998 = 998244353; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; using pll = pair<ll, ll>; template <class T> using min...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int t; cin >> t; while (t--) { long long x, y; cin >> x >> y; if (x == y + 1) { cout << NO n ; } else { cout << YES n ; } } 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...
`timescale 1ns/10ps module vga_pll_0002( // interface 'refclk' input wire refclk, // interface 'reset' input wire rst, // interface 'outclk0' output wire outclk_0, // interface 'outclk1' output wire outclk_1, // interface 'outclk2' output wire outclk_2, // interface 'outclk3' output wire outclk_3, ...
module FpuFp64FromInt( clk, enable, is32, src, dst ); input clk; input enable; input is32; input[63:0] src; output[63:0] dst; reg sgn; reg sgnc; reg[12:0] exa; reg[12:0] exb; reg[12:0] exc; reg[12:0] exm; reg[63:0] tFracA; reg[63:0] tFracB; reg[63:0] tFracC; reg[63:0] tFracA1; reg[63:0] tFracB1; reg[...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
#include <bits/stdc++.h> using namespace std; inline long long read() { register long long w = 1, x = 0, ch = getchar(); for (; ch < 0 || ch > 9 ; ch = getchar()) if (ch == - ) w = -1; for (; ch >= 0 && ch <= 9 ; ch = getchar()) x = x * 10 + ch - 0 ; return x * w; } const long long...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distributed in ...
///////////////////////////////////////////////////////////////////// //// //// //// Simple Asynchronous Serial Comm. Device //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p); string to_str...
//------------------------------------------------------------------- // // COPYRIGHT (C) 2011, VIPcore Group, Fudan University // // THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI...
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; } template <typename T1, typename T2> inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; } inline int readChar(); template <class T = int> inline T readInt()...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { for (const auto& x : v) os << x << ; return os << n ; } template <typename T> void opera...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1.01E6; vector<int> ans[MAXN]; char C[MAXN]; int A[MAXN]; int B[MAXN]; int n, top1, top2; int main(void) { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> (C + 1), n = strlen(C + 1); for (int i = 1; i <= n; ++i) { ...
#include <bits/stdc++.h> using namespace std; const int mod = (int)1e9 + 7, maxn = (int)1e5 + 5; int a[maxn], d[maxn]; int mpow(int A, int N) { int ret = 1; while (N) { if (N & 1) ret = (ret * 1ll * A) % mod; A = (A * 1ll * A) % mod; N >>= 1; } return ret; } int main() { ...
// // 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) // ...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const long long maxn = 3e6; const long long mod = 1e9 + 7; const long double PI = acos((long double)-1); long long pw(long long a, long long b, long long md = mod) { long long res = 1; ...
#include <bits/stdc++.h> using namespace std; string a, b; int t; string ssort(string x) { if (x.size() & 1) return x; int len = x.size() / 2; string xx, yy; xx = ssort(x.substr(0, len)); yy = ssort(x.substr(len, len)); if (xx < yy) return xx + yy; else return yy + xx; ...
#include <bits/stdc++.h> using namespace std; int main(int argc, char* argv[]) { char dt[1002]; memset(dt, 0, sizeof(dt)); char gr[1002]; memset(gr, 0, sizeof(gr)); cin >> dt >> gr; int n = strlen(dt); int m = strlen(gr); map<char, int> dtc; map<char, int> gtc; for (int i = 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...
module top ( input wire i_clk, input wire i_clkb, input wire i_rst, input wire i_ce, output wire o_q1, output wire o_q2, input wire [11:0] io ); // BUFGs wire clk; wire clkb; BUFG bufg_1 (.I(i_clk), .O(clk)); BUFG bufg_2 (.I(i_clkb), .O(clkb)); // Generate...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; const int mod = 1e9 + 7; const int maxm = 2e5 + 5; const long long inf = 0x3f3f3f3f3f3f3f3f; int xx[] = {0, 0, 1, -1}; int yy[] = {1, -1, 0, 0}; int N, M, K; vector<pair<int, long long> > vec[maxn]; vector<int> V; vector<long ...
// +---------------------------------------------------------------------------- // GNU General Public License // ----------------------------------------------------------------------------- // This file is part of uDLX (micro-DeLuX) soft IP-core. // // uDLX is free soft IP-core: you can redistribute it and/or modify ...
/* * 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...
module autoinst_vertrees_slv (/*AUTOARG*/ // Outputs i2c_mst_data, i2c_read, i2c_slv_scl_out, i2c_slv_sda_out, i2c_spc_scl_state, i2c_start, i2c_strobe, slv_bit_st, slv_put, i2c_spc_scl_fall, i2c_spc_sda_state, i2c_spc_start, i2c_spc_stop, // Inputs ck_ref, i2c_slv_data, i2c_slv_scl_in, i2c_slv_sda...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; set<int> s; for (int i = 0; i < n; i++) { int x; cin >> x; if (x != 0) s.insert(x); } cout << s.size(); }
/** * 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 (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> using namespace std; struct SegTree { const int INF = 1e9; vector<pair<int, int>> max_vc; vector<int> add; int h = 1; pair<int, int> combine(pair<int, int> a, pair<int, int> b) { if (a.first == b.first) return {a.first, a.second + b.second}; else ...
//***************************************************************************** // (c) Copyright 2009 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....
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 1; long double pi = 3.141592653589793238; int main() { long long t; cin >> t; while (t--) { long long x; cin >> x; long double ans; long double n = 2.0000000000000 * (long double)x; long double angle = ...
// Test array variables inside a constant function module constfunc14(); function [7:0] concat1(input [7:0] value); reg [3:0] tmp[1:2]; begin {tmp[1], tmp[2]} = {value[3:0], value[7:4]}; {concat1[3:0], concat1[7:4]} = {tmp[2], tmp[1]}; end endfunction function [7:0] concat2(input [7:0] value); reg [3:0] tmp[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; template <typename T> T BigMod(T b, T p, T m) { if (p == 0) return 1; if (p % 2 == 0) { T s = BigMod(b, p / 2, m); return ((s % m) * (s % m)) % m; } return ((b % m) * (BigMod(b, p - 1, m) % m)) % m; } template <typename T> T ModInv(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 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 long long mod = 1e9 + 7; const int N = 1e5 + 4; const long long MOD = 998244353; bool ans[2 * N]; long long POW(long long base, long long exponent) { long long result = 1; while (exponent > 0) { if (exponent % 2 == 1) result = (result * base)...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string s; char big = a ; string s1 = ; cin >> s; for (int i = s.size() - 1; i >= 0; i--) { if (int(s[i]) >= int(big)) { s1 += s[i]; big...
/** * 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...
/******************************************************************* Company: UNSW Original Author: Lingkan Gong Project Name: XPCIe Create Date: 15/07/2011 Design Name: adder *******************************************************************/ `timescale 1ns/1ns module adder ( input ...
/* * 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> #pragma comment(linker, /STACK:16777216 ) using namespace std; int n, k; char g[3][100005]; bool f; bool isval(int i, int j) { if (j >= n) return true; if (j < 0) return false; if (g[i][j] == X ) return false; return true; } void dfs(int i, int j, int t) { ...
#include <bits/stdc++.h> using namespace std; int a[222], b[222]; int main() { int n, ans = 0; cin >> n; int p, q, r, s; for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; for (int i = 0; i < n; i++) { p = q = r = s = 0; for (int j = 0; j < n; j++) { if (j == i) continue; ...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: sun.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ====================================...
#include <bits/stdc++.h> using namespace std; map<int, int> card; void init() { for (int i = 6, j = 1; i < 15; i++, j++) card.insert(make_pair(i, j)); } int isCard(char num) { int res = 0; if (num >= 0 && num <= 9 ) res = num - 0 ; else { if (num == T ) res = 10; ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2015.4 // Copyright (C) 2015 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1ns/1ps modul...
// 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:12:07 2017 // Host : EffulgentTome running 64-bit major rele...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } if (arr[0] < arr[n - 1]) { cout << YES << endl; } else cout << NO <<...
`include "../include/tune.v" // PentEvo project (c) NedoPC 2010 // // generates horizontal vga sync, double the rate of TV horizontal sync // // KVIK PHEEKS just to double HSYNC not scan-doubling // beginning of every other vga_hsync coincides with beginning of tv_hsync // length is HSYNC_END clocks @ 28mhz ...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5; long long n, x, y, z, ans; long long a[N], b[N], par[N], sz[N]; long long get(long long x) { if (par[x] == x) return x; return par[x] = get(par[x]); } void merge(long long x, long long y) { long long root_a = get(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 la...
#include <bits/stdc++.h> using namespace std; int II() { int q; scanf( %d , &q); return q; } void solve() { long long N, M; cin >> N >> M; long long ar[N + 10], br[N + 10], cr[N + 10]; for (long long i = 1; i <= N; i++) { cin >> ar[i] >> br[i] >> cr[i]; } long long mi =...
#include <bits/stdc++.h> using namespace std; inline bool invowel(char ch) { ch = tolower(ch); return (ch == a || ch == e || ch == i || ch == o || ch == u ); } inline bool isprime(int n) { if (n < 2 || (n % 2 == 0 && n != 2)) return false; for (int i = 3; i * i <= n; i += 2) if (n...