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 law...
#include <bits/stdc++.h> using namespace std; vector<int> di = {0, 0, 1, -1}; vector<int> dj = {1, -1, 0, 0}; int main() { ios::sync_with_stdio(0), cin.tie(0); vector<vector<int>> dpa(1001, vector<int>(1001, 2140000000)); vector<vector<int>> dpb(1001, vector<int>(1001, 2140000000)); vector<vecto...
#include <bits/stdc++.h> using namespace std; const long long int MOD = 1e9 + 7; long long int t; string s; long long int n; long long int dp[100][2501]; long long int adp[100][2501]; long long int l, r, sm; void solve() { cin >> s; n = s.length() - 1; sm = 0; for (auto it : s) sm += i...
// (C) 1992-2014 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulati...
/*********************************************************************************************************************** * Copyright (C) 2016 Andrew Zonenberg and contributors * * ...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen */ `timescale 1ns/100ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time base...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 10; const int MAXN = 1e4 + 10; const int MOD = 1e9 + 7; const int inf = 1e9; const double pi = acos(-1.0); const double eps = 1e-6; int dx[] = {0, -1, 0, 1}; int dy[] = {1, 0, -1, 0}; map<int, int> mymap, mymap1; int n, m; vecto...
/* * 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() { long long t; cin >> t; while (t--) { long long n; cin >> n; if (n == 1) cout << 1 << endl; else cout << (n / 2) << endl; } return 0; }
/* * Verification test for increment/decrement operators * * Author: Prasad Joshi <> */ module main; logic la; logic lb; int ia; int ib; bit ba; bit bb; real ra; real rb; real rc; initial begin /* logic tests */ la = 0; #1 lb = ++la; #1 if (la != lb) begin $display("FAILED"); $finish; e...
`timescale 1ns / 1ps module tb_fmrv32im_max10; reg sim_end; reg RST_N; reg CLK; wire [3:0] led; initial begin sim_end = 1'b0; RST_N = 1'b0; CLK = 1'b0; force u_fmrv32im_max10.RST_N = 1'b0; #100; @(posedge CLK); RST_N = 1'b1; force u_fmrv32im_max10...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Engineer: Ryan // // Create Date: 06/07/2017 // Module Name: Main Module // Project Name: Joystick controller // Target Devices: ICE40/Icestick // Tool versions: APIO/Icestorm // Description: This...
#include <bits/stdc++.h> using namespace std; const int N = 200010; int n, a[7], cnt[7], t[N]; void GetData() { int i; scanf( %d , &n); for (i = 0; i < 3; ++i) scanf( %d , &a[i]); for (i = 0; i < n; ++i) scanf( %d , &t[i]); } void Solve() { int i, j, ans, mn; bool flag = false; s...
/** * 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 double eps = 1e-12; const int INF = 1 << 30; const long long LINF = 1ll << 61; const int BUFFER_SZ = 1 << 20; const int MOD = 1000 * 1000 * 1000 + 7; char BUFFER[BUFFER_SZ]; int gi() { int x; scanf( %d , &x); return x; } double gd() { ...
#include <bits/stdc++.h> using namespace std; pair<long long, long long> add_pair(pair<long long, long long> a, pair<long long, long long> b) { return make_pair(a.first + b.first, a.second + b.second); } long long power(long long a, long long b) { long long res = 1;...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_dtl_bscan.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 a...
////////////////////////////////////////////////////////////////////////////////// // d_BCH_CS_X.v for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Jinwoo Jeong <> // Ilyong Jung <> // Yong Ho Song <> // // This file is part of Cosmos OpenSSD. // // Co...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const double pi = acos(-1.0); const int inf = 0x3f3f3f3f; const long long oo = 1LL << 60; const int N = 10010; const int E = 200010; class Graph { public: int pnt[E], nxt[E], id[E]; int head[N], nv, ne; void init(const...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const ld eps = 1e-8; template <class U, class V> ostream& operator<<(ostream& out, const pair<U, V>& p) { return out << ( << p.first << , << p.second << ) ; } template <size_t i, class T> ostream& pri...
#include <bits/stdc++.h> using namespace std; int main() { long long t; scanf( %lld , &t); while (t--) { long long a, b, c, d, k; scanf( %lld%lld%lld , &a, &b, &c); scanf( %lld %lld , &d, &k); long long x = (a - 1 + c) / c; long long y = (b + d - 1) / d; if (x + y <= ...
// *************************************************************************** // *************************************************************************** // Copyright 2013(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are...
/* Copyright (c) 2015 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...
// Copyright (c) 2000-2012 Bluespec, Inc. // 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, pub...
#include <bits/stdc++.h> using namespace std; int main(int argc, const char* argv[]) { ios_base::sync_with_stdio(false); cin.tie(NULL); int a, b, c, x, y, z; int spa = 0, spb = 0, spc = 0; int req = 0; cin >> a >> b >> c; cin >> x >> y >> z; if (a > x) spa = a - x; else ...
#include <bits/stdc++.h> using namespace std; inline int read() { int f = 1, x = 0; char ch; do { ch = getchar(); if (ch == - ) f = -1; } while (ch < 0 || ch > 9 ); do { x = (x << 3) + (x << 1) + ch - 0 ; ch = getchar(); } while (ch >= 0 && ch <= 9 ); retu...
#include <bits/stdc++.h> using namespace std; map<int, int> mp; int n, m, p; int a[200004], b[200004]; int sol[200004]; int ns = 0; int main() { scanf( %d%d%d , &n, &m, &p); for (int i = 1; i <= n; ++i) scanf( %d , &a[i]); for (int i = 1; i <= m; ++i) scanf( %d , &b[i]); int num = m; f...
#include <bits/stdc++.h> const int M = 2000; int T, n, x, ans, f0[M + 10], f1[M + 10]; inline int min(int x, int y) { return x < y ? x : y; } inline int max(int x, int y) { return x > y ? x : y; } void work() { for (int i = 0; i <= M; ++i) f0[i] = i; scanf( %d , &n), ans = 114514; while (n--) { ...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen */ `timescale 1ns/100ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time bas...
#include <bits/stdc++.h> using namespace std; long long n, m, res, t, k, o; long long a[1000100], b[1000100]; priority_queue<int, vector<int>, greater<int> > q; int main() { scanf( %lld %lld , &n, &k); for (long long i = 1; i <= n; i++) { scanf( %lld , &a[i]); } scanf( %lld , &m); fo...
#include <bits/stdc++.h> using namespace std; vector<vector<int> > g(7); vector<int> vis(7); int cycles = 0; int nds = 0; bool allvis() { for (int i = 1; i <= 5; i++) if (!vis[i]) return false; return true; } bool dfs(int node, int par, int cnt) { if (vis[node]) { cycles++; ...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's Tick Timer //// //// //// //// This file is part of the OpenR...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2004 Xilinx, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // //...
#include <bits/stdc++.h> const int mod = 1e9 + 7; const int MAXN = 1e5 + 5, MAXSIZ = 3; template <typename _T> void read(_T &x) { x = 0; char s = getchar(); int f = 1; while (s < 0 || 9 < s) { f = 1; if (s == - ) f = -1; s = getchar(); } while ( 0 <= s && s <= 9 ...
#include <bits/stdc++.h> using namespace std; const int mx = 2e6 + 10; int n, m; bool vis[mx]; int sta[mx], siz, is; int dfn[mx], id[mx]; int be[mx], ty; vector<int> g[mx]; void tarjan(int u) { dfn[u] = id[u] = ++is; sta[++siz] = u; vis[u] = 1; for (int v : g[u]) { if (!dfn[v]) {...
module Vga_control( // Host Side input [3:0] iRed, input [3:0] iGreen, input [3:0] iBlue, output [9:0] oCurrent_X, // Max horizontal pixels: 1023. output [9:0] oCurrent_Y, // Max vertical pixels: 1023. output [21:0] oAddress, output oRequest, output reg oTopOfScreen, // 1 when a...
// Copyright (c) 2000-2009 Bluespec, Inc. // 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, pub...
/** * 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 BlockFall(clock0,clock180,reset,vga_hsync,vga_vsync,vga_r,vga_g,vga_b); input wire clock0; input wire clock180; input wire reset; output wire vga_hsync; output wire vga_vsync; output wire vga_r; output wire vga_g; output wire vga...
#include <bits/stdc++.h> using namespace std; long long ans[100010]; long long ans2[100010]; int main() { int n, p; int l, r; while (cin >> n >> p) { for (int i = 0; i < n; i++) { scanf( %d%d , &l, &r); ans[i] = r / p - l / p; ans2[i] = r - l + 1; if (l % p == 0...
////////////////////////////////////////////////////////////////////// //// //// //// usbHostSlaveAvalonWrap.v //// //// //// //// This file is part of the usbhos...
#include <bits/stdc++.h> using namespace std; template <typename Q> void inin(Q &x) { x = 0; int f = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = 1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 0 , ch = getchar(); x = f ? ...
// $Header: $ /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2011 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ ...
// (C) 2001-2016 Intel Corporation. All rights reserved. // Your use of Intel Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated docum...
#include <bits/stdc++.h> using namespace std; int mat[105][105]; int nodes[105]; int n, m; int cycles = 0; void cycle_det(int cur, int parent); int main() { cin >> n >> m; memset(mat, 0, sizeof mat); memset(nodes, 0, sizeof nodes); for (int i = 0; i < m; i++) { int _1, _2; cin ...
#include <bits/stdc++.h> using namespace std; struct SegmentTree { struct Node { Node *lch, *rch; long long sum; Node() { lch = rch = nullptr; sum = 0; } void up() { sum = 0; if (lch != nullptr) sum += lch->sum; if (rch != nullptr) sum += rch...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int m; cin >> m; int i; map<int, int> ipattern; for (i = 1; i <= n; i++) { int x; cin >> x; ipattern[i] = x; } int max = 0; for (i = 1; i <= n; i++) { if (ipattern[i] > max) { ...
#include <bits/stdc++.h> using namespace std; inline int Max(int a, int b) { return (((b - a) >> (32 - 1)) & (a ^ b)) ^ b; } inline int Min(int a, int b) { return (((b - a) >> (32 - 1)) & (a ^ b)) ^ a; } string s; long long num[2][1000005], len[2][1000005]; long long rnum[2][1000005]; int main() { cin...
#include <bits/stdc++.h> using namespace std; int a[500], c, i, n, big; int main() { while (~scanf( %d %d , &n, &c)) { for (i = 0; i < n; i++) { scanf( %d , &a[i]); } big = 0; for (i = 0; i < n - 1; i++) { if (a[i] - a[i + 1] - c > big) big = a[i] - a[i + 1] - c; ...
/* * 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 I2C_HDMI_Config ( // Host Side iCLK, iRST_N, // I2C Side I2C_SCLK, I2C_SDAT, HDMI_TX_INT, READY ); // Host Side input iCLK; input iRST_N; // I2C Side output I2C_SCLK; inout I2C_SDAT; input HDMI_TX_INT; output READY ; // Internal Registers...
(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2015 *) (* \VV/ **************************************************************) (* // * Th...
/*! * \file ram_subcell.v * \brief RAM cell instance, uses feedback signal to perform read-modify-write operations * \author Luca Maggiani * \version 1.0 * \date Jan 2014 * \pre It needs ram_module instances * \see ram_subcell * \see ram_module */ module ram_subc...
#include <bits/stdc++.h> using namespace std; template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { for (auto i : v) os << i << ; return os; } template <typename T> ostream& operator<<(ostream& os, const set<T>& v) { for (auto i : v) os << i << ; return os; } ...
#include <bits/stdc++.h> using namespace std; const long long bl_size = 320; int n, m; long long k; long long res; long long a[100005]; unordered_map<long long, long long> cnt; struct Query { int l, r, id; bool operator<(Query other) const { if (l / bl_size != other.l / bl_size) re...
#include <bits/stdc++.h> using namespace std; int is_prime(long long int n) { for (long long int i = 2; i * i <= n; i++) { if (n % i == 0) return 0; } return 1; } int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int a, b, c, d, k; cin >> a >> b >> c >> d >> k...
#include <bits/stdc++.h> using namespace std; vector<int> a[200100]; int cnt[200100]; vector<int> res; int main() { int n; scanf( %d , &n); int q; for (int i = 1; i <= n; i++) { scanf( %d , &q); a[q].push_back(i); } int pos = 0; while (true) { if (cnt[pos] < a[pos...
#include <bits/stdc++.h> using namespace std; const int SIZE = 1000009; char s[SIZE]; long long int dsum[SIZE]; int dtotal; long long int usum[SIZE]; int utotal; int main() { int N; scanf( %d%s , &N, s + 1); for (int i = 1; i <= N; i++) { if (s[i] == U ) { ++utotal; us...
#include <bits/stdc++.h> using namespace std; const long long maxN = 3e2 + 2, N = 1e5 + 7, MOD = 1e9 + 7, Mod = 1e9 + 6, INF = 1LL << 56; long long n, m, k, x, y, z, dp[maxN][maxN], ans[maxN][maxN]; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); cin >> 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 law...
#include <bits/stdc++.h> using namespace std; const long long p = 998244353; long long n, ans, a[1000010], c[1000010], cnt[1000010]; long long ksm(long long x, long long y) { long long xlh = 1; while (y) { if (y & 1) xlh = xlh * x % p; x = x * x % p; y /= 2; } return xlh; } ...
/** * 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 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Wed Mar 01 09:53:13 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; int read() { int x = 0, flag = 1; char c = getchar(); while ((c > 9 || c < 0 ) && c != - ) c = getchar(); if (c == - ) flag = 0, c = getchar(); while (c <= 9 && c >= 0 ) { x = (x << 3) + (x << 1) + c - 0 ; c = getchar(); } ...
/** * 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 maxN = 2e5 + 13, mod = 1e9 + 7; long long r, g, odp[maxN], ans; bool can(long long x) { if (x * (x + 1) / 2 <= r + g) return 1; return 0; } int32_t main() { cin >> r >> g; long long lf = 0, rg = max(r, g) + 1; while (rg - lf >...
#include <bits/stdc++.h> using namespace std; const int N =9999999; const double pi=acos(-1); int n,t,ans,a[N],k,s1,s2; int main(){ cin>>t; while(t--){ cin>>n>>k; if(n%2==1)cout<<((k-1)+((k-1))/(n/2))%n+1<<endl; else cout<<(k-1)%n+1<<endl; } return 0; }
#include <bits/stdc++.h> #pragma comment(linker, /STACK:100000000 ) #pragma GCC ostarimize( O500 ) using namespace std; const bool db = false; set<pair<int, int>> s; int a[200100]; int main() { int n, k, q; scanf( %d %d %d n , &n, &k, &q); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); ...
`timescale 1ns / 1ps //********************************************************************** // File: spi_master.v // Module:spi_master // by Robin zhang //********************************************************************** module spi_master( clk,rst_n, spi_miso,spi_mosi,spi_clk, spi_tx_en,spi_rx_en,spi_over,mo...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none // clock divider generating clock and clock enable mo...
`define DROP_SFD module gmii2fifo9 # ( parameter Gap = 4'h2 ) ( input sys_rst, input gmii_rx_clk, input gmii_rx_dv, input [7:0] gmii_rxd, // FIFO output [8:0] din, input full, output reg wr_en, output wr_clk ); assign wr_clk = gmii_rx_clk; parameter STATE...
#include <bits/stdc++.h> using namespace std; struct edge { int v, id; edge *next; } * h[233333], pool[555555]; int top; inline void addedge(int u, int v, int id) { edge *tmp = &pool[top++]; tmp->v = v; tmp->id = id; tmp->next = h[u]; h[u] = tmp; edge *pmt = &pool[top++]; p...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n + 1]; int i, m, k, l, x, y; for (i = 1; i <= n; i++) cin >> a[i]; cin >> m; for (i = 0; i < m; i++) { cin >> x >> y; a[x - 1] += y - 1; a[x + 1] += (a[x] - y); a[x] = 0; } ...
#include <bits/stdc++.h> using namespace std; #define ll int #define vl vector<long long> #define fr(i,a,n) for(ll i=a; i<n; i++) #define all(x) x.begin(), x.end() int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll t; cin>>t; while(t--){ ll n, x=0, z...
module test_001(clk, a, a_old, b); // test case taken from: // http://www.reddit.com/r/yosys/comments/1wvpj6/trouble_with_assertions_and_sat_solver/ input wire clk; input wire a; output reg a_old = 0; output reg b = 1; wire assertion = (a_old != b); always @(posedge clk) begin ...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int64_t dr8[] = {1, 1, 0, -1, -1, -1, 0, 1}; int64_t dc8[] = {0, 1, 1, 1, 0, -1, -1, -1}; int64_t dr4[] = {1, 0, 0, -1}; int64_t dc4[] ...
#include <bits/stdc++.h> using namespace std; const int max_n = 2005; string str[max_n]; int dp[max_n][max_n][4]; inline void solve() { register int n, m, i, j, k; long long ans = 0; cin >> n >> m; for (i = 0; i < n; ++i) cin >> str[i]; for (i = 0; i < n; ++i) { dp[i][0][0] = 1; ...
#include <bits/stdc++.h> using namespace std; inline char gc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++; } inline long long read() { long long x = 0; char ch = getcha...
/***************************************************************************** * File : processing_system7_bfm_v2_0_gen_clock.v * * Date : 2012-11 * * Description : Module that generates FCLK clocks and internal clock for Zynq BFM. * *****************************************************************************/...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:55:04 12/14/2010 // Design Name: // Module Name: msu // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revision: // R...
#include <bits/stdc++.h> using namespace std; const int inf = 2147483647; int main() { string st; int i; cin >> st; for (i = 0; i < (int)st.size(); ++i) { if (st[i] == 0 ) { { st.erase(i, 1); break; } } else { if (i == (int)st.size() - 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; long long GCD(long long a, long long b) { while (b) { a %= b; swap(a, b); } return a; } int main() { int n, k, i; long double x, y, xant, yant; scanf( %d%d , &n, &k); double sol = 0; for (i = 0; i < n; i++) { cin >> ...
`timescale 1 ns / 1 ps module axi_bram_writer # ( parameter integer AXI_DATA_WIDTH = 32, parameter integer AXI_ADDR_WIDTH = 32, parameter integer BRAM_DATA_WIDTH = 32, parameter integer BRAM_ADDR_WIDTH = 10 ) ( // System signals input wire aclk, input wire ...
/** * 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(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; long long r1, r2, r3, d; cin >> n >> r1 >> r2 >> r3 >> d; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector<vector<long long>> dp(n, vector<long long...
/** * 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; inline long long read() { long long s = 0, w = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while ( 0 <= ch && ch <= 9 ) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar(); r...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2003 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); parameter PAR = 3; m1 #(PAR) m1(); m3 #(PAR) m3(); mnooverride #(10) mno(); input clk; integ...
#include <bits/stdc++.h> using namespace std; inline long long qr() { register long long ret = 0, f = 0; register char c = getchar(); while (c < 48 || c > 57) f |= c == 45, c = getchar(); while (c >= 48 && c <= 57) ret = ret * 10 + c - 48, c = getchar(); return f ? -ret : ret; } const int ma...
#include <bits/stdc++.h> using namespace std; int a[1153][1153]; int n, m; unsigned long long int b[1153][1153]; bool pos(int minval) { memset(b, 0, sizeof(b)); int i, j, k; for (i = 0; i < n; i++) { int ccnt = 0; for (j = 0; j < 1024; j += 63) { unsigned long long int blk = 0;...
//############################################################################# //# Function: Clock synchronizer # //############################################################################# //# Author: Andreas Olofsson # ...
/** * 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/100ps `define DEBUG 1 `include "../define.v" `include "../regfile.v" `include "../pipeline_CPU.v" `include "../hilo_reg.v" `include "../BranchControl.v" `include "../HazardControl.v" `include "../ForwardControl.v" `include "../IF.v" `include "../IF_ID.v" `include "../ID.v" `include "../ID_EX.v" `include ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: ctu_clsp_clkgn_clksel.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 redistribut...
/** * 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 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017 // Date : Tue Oct 17 02:50:46 2017 // Host : Juice-Laptop running 64-bit major release ...
#include <bits/stdc++.h> using namespace std; int a[4]; int main() { cin >> a[0] >> a[1] >> a[2] >> a[3]; sort(a, a + 4); if (a[0] + a[1] > a[2] || a[1] + a[2] > a[3]) { cout << TRIANGLE ; return 0; } else if (a[0] + a[1] == a[2] || a[1] + a[2] == a[3]) { cout << SEGMENT ; ...
/** * 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...