text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const unsigned long long inf = 1e18; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<unsigned long long> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } unsi...
//------------------------------------------------------------------- // // COPYRIGHT (C) 2011, VIPcore Group, Fudan University // // THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI...
#include <bits/stdc++.h> using namespace std; vector<int> vec[1000006], V; struct Node { int x, y, w; bool operator<(const Node& a) const { return y < a.y; } } node[500006]; int n; struct Info { long long len, mx, w; int p; Info() {} Info(long long _len, long long _mx, long long _w, ...
//==================================================== // This is FSM demo program using single always // for both seq and combo logic // Design Name : fsm_using_single_always // File Name : fsm_using_single_always.v //===================================================== module fsm_using_single_always ( clock ,...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int x; cin >> x; cout << x / 2 << endl; } }
#include <bits/stdc++.h> const long long int maxn = 2e7 + 5; const long long mod = 1e9 + 7; using namespace std; long long int power(long long int a, long long int b) { long long int res = 1; while (b > 0) { if (b % 2 == 1) res = res * a; a = a * a; b = b / 2; } return res; }...
/** * 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 T> using vec = vector<T>; template <class T> using vvec = vector<vec<T>>; struct fast_ios { fast_ios() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; template <class 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...
/* ---------------------------------------------------------------------------------- Copyright (c) 2013-2014 Embedded and Network Computing Lab. Open SSD Project Hanyang University All rights reserved. ---------------------------------------------------------------------------------- Redistribution and use ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; vector<long long int> v(n); for (long long int i = 0; i < n; i++) { cin >> v[i]; } sort((v).begin(), (v).end()); set<long long> s...
#include <bits/stdc++.h> typedef int iarrN[100003][35]; struct IO { template <typename T> inline IO operator>>(T &n) { n = 0; char c = getchar(); while (c < 0 || c > 9 ) c = getchar(); while (c >= 0 && c <= 9 ) n = (n << 3) + (n << 1) + (c ^ 48), c = getchar(); re...
/* * 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; void input() {} const int N = 1e5 + 4, mod = 1e9 + 7; int t, k, l, r; long long dp[N]; int solve(int i = 1e5) { if (i < 0) return 0; if (i == 0) return 1; long long &ret = dp[i]; if (~ret) return ret; ret = solve(i - 1) % mod; ret += solv...
// AUTOGEN module iobus_6_connect( // unused input wire clk, input wire reset, // Master input wire m_iob_poweron, input wire m_iob_reset, input wire m_datao_clear, input wire m_datao_set, input wire m_cono_clear, input wire m_cono_set, input wire m_iob_fm_datai, input wire m_iob_fm_status, input wire m_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...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const int manx = 1e5 + 100; const int INF = 0x3f3f3f3f; int main() { int n, a[200], b[200], cnt = 0, numb1 = 0; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); if (a[i]) cnt++; } for (int i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long N = 1e5 + 10; long long power(long long a, long long b) { long long ret = 1; while (b) { if (b & 1) ret *= a; a *= a; if (ret >= MOD) ret %= MOD; if (a >= MOD) a %= MOD; b >>= 1; ...
// // 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; const int INPUT_MAXCHARS = 1 << 16; char buffer[INPUT_MAXCHARS]; struct FastReader { char *p; FastReader() { fread(buffer, 1, sizeof buffer, stdin); p = buffer; } int next() { int remchars = INPUT_MAXCHARS - (p - buffer); if (...
#include <bits/stdc++.h> using namespace std; string ans[10] = { , , 2 , 3 , 223 , 5 , 53 , 7 , 7222 , 7332 }; int main() { int n; string s, a = ; cin >> n; cin >> s; for (int i = 0; i < n; i++) { if (s[i] == 0 || s[i] == 1 ) continue; a += ans[(s[i] - 0 )]; } ...
`timescale 1ns / 1ps //File: hsyncModule2015fall.v //Author: Jianjian Song //Date: November 1, 2015 //to generate hsync signal and x position coordinate for VGA video display //Rose-Hulman Institute of Technology //PixelClock provides the reference time for pixel duration //Restart is not synchronized with PixelClock /...
#include <bits/stdc++.h> using namespace std; const int N = 4000 + 5, mod = 1000000009; int n, x, y; long long P[N], d[N][N]; int main() { scanf( %d , &n); scanf( %d , &x); scanf( %d , &y); for (int i = 0; i <= max(x, y); i++) d[i][0] = 1; for (int i = 1; i <= max(x, y); i++) for (in...
`timescale 100 ps / 100 ps module tb_FFT_Mag(); reg clk, reset, next; wire next_out; integer i, j, k, l, m; reg [15:0] counter; reg [11:0] in [3:0]; wire [11:0] X0; wire [11:0] Y0; wire [11:0] X1; wire [11:0] Y1; wire [11:0] X2; wire [11:0] Y2; wire [11:0] X3; wire [11:0] Y3; ...
#include <bits/stdc++.h> using namespace std; template <typename T> inline T read() { register T sum = 0; register char cc = getchar(); int sym = 1; while (cc != - && (cc > 9 || cc < 0 )) cc = getchar(); if (cc == - ) sym = -1, cc = getchar(); sum = sum * 10 + cc - 0 ; cc = getc...
#include <bits/stdc++.h> using namespace std; const int N = 105; int n, res = 1e9, a[5][N][N]; void calc(int a[N][N], int b[N][N], int c[N][N], int d[N][N]) { int tmp = 0, tmp2 = 0; for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) { if (a[i][j] != (i + j) % 2) ++tmp; ...
#include <bits/stdc++.h> inline int rd(int f = 1, int x = 0, char ch = ) { while (!isdigit(ch = getchar())) if (ch == - ) f = -1; while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return f * x; } const int N = 1e5 + 5; int n, a[N], ans; int main() { for (int T = rd(); T--;) ...
#include <bits/stdc++.h> using namespace std; long long n, s, s1, m, k, sum = 0, l, r, a, a1, p; const int N = 1e5 + 1; int main() { int q; cin >> q; while (q--) { cin >> l >> r; if (l % 2) { if (r % 2) { p = (r / 2) - (l / 2) + 1; s = (l + r) * p; s...
#include <bits/stdc++.h> using namespace std; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1}; const int dx8[] = {-1, 0, 1, 0, 1, 1, -1, -1}; const int dy8[] = {0, -1, 0, 1, 1, -1, 1, -1}; void solve() { long long n; cin >> n; vector<long long> a(n); vector<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 law...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int maxn = 2e5 + 10; int n; int d[maxn]; int main() { scanf( %d , &n); for (int i = 1; i < n; i++) { int u, v; scanf( %d%d , &u, &v); d[u]++; d[v]++; } for (int i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 1) cout << 5; else cout << 25; return 0; }
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sparc_exu_eclbyplog_rs1.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 redistrib...
#include <bits/stdc++.h> using namespace std; long long n, a, b, c; long long d; long long cnt1, cnt2; long long r; int main() { cin >> n >> a >> b >> c; d = b - c; if (n >= a) { cnt1 = n / a; r = n % a; if (r >= b) cnt1 += (r - b) / d + 1; } if (n >= b) { r = n -...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using D = double; using uint = unsigned int; template <typename T> using pair2 = pair<T, T>; const long double pi = acos((ld)-1.0); const int maxn = 1 << 16; complex<double> oddc[maxn], evenc[maxn], tmp[maxn]...
#include <bits/stdc++.h> using namespace std; inline long long gcd(long long x, long long y) { return x ? gcd(y % x, x) : y; } const long long mod = 1e9 + 7; inline signed rd() { signed ans = 0; char last = , ch = getchar(); while (!(ch >= 0 && ch <= 9 )) last = ch, ch = getchar(); while (...
#include <bits/stdc++.h> using namespace std; const unsigned long long INF = 1000 * 1000 * 1000; const double eps = 1e-9; int main() { string s; cin >> s; int pos = 0; for (char c = z ; c >= a ; c--) { int tek = pos; for (int i = tek; i < s.size(); i++) if (s[i] == c) { ...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 1; int bit[N] = {0}; void update(int x, int val) { for (; x <= N; x += x & (-x)) bit[x] += val; } int query(int x) { int sum = 0; for (; x >= 1; x -= x & (-x)) sum += bit[x]; return sum; } int a[N]; int main() { int ...
// // 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; int dfn[2100], low[2100], tim, dis[2100], n, i, x, y, M, be[2100], m, j, ans, du[2100]; vector<int> E[2100], e[2100], q; void tarjan(int x, int ff) { dfn[x] = low[x] = ++tim; q.push_back(x); for (int i = 0; i < e[x].size(); ++i) if (e[x][i] !...
#include <bits/stdc++.h> using namespace std; const int MX = 100000; long long l[MX], a[MX + 1], mn[MX + 1]; char s[MX + 1]; int main() { int n; ignore = scanf( %d , &n); for (int i = 0; i < n; i++) ignore = scanf( %lld , l + i); ignore = scanf( %s , s); long long e = 0, ans = 0; for (...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2010 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. module t (); `ifndef VERILATOR `...
#include <bits/stdc++.h> using namespace std; void setIO() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const long double PI = 4 * atan((long double)1); const int INF = 1e9 + 7; const long long _INF = 1e18; int main() { setIO(); int t; cin >> t; while (t--) { int...
/* Module from the schematic_gui program written by Andreas Ehliar <> This Verilog file is licensed under the CC0 license. */ module add #(parameter WIREWIDTH = 1) (input wire ci, input wire [WIREWIDTH:0] op1, op2, output reg [WIREWIDTH:0] res, output reg co); initial begin $schematic_b...
//-------------------------------------------------------------------------------------------- // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version : 1.0 // \ \ Application : NULL MGT Tile // / / Filename : null_pair_example.v // /___/ /\ Date : 10/0...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: AGH UST // Engineer: Wojciech Gredel, Hubert Górowski // // Create Date: // Design Name: // Module Name: MarioScore24x1 // Project Name: DOS_Mario // Target Devices: Basys3 // To...
#include <bits/stdc++.h> using namespace std; signed main(signed argc, const char* argv[]) { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int cnt = 0; for (int i = 0; cnt < n; ++i) { cout << 3 << << i << endl; ++cnt; if (cnt == n) break; ...
//////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2013, University of British Columbia (UBC); All rights reserved. // // // // Redistribution and use in source and binary forms, w...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2004 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", ...
#include <bits/stdc++.h> using namespace std; const int N = 110, size = 1 << 20, mod = 998244353, inf = 2e9; const long long INF = 1e15; template <class o> void qr(o& x) { char c = getchar(); x = 0; int f = 1; while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } whi...
(* Copyright (c) 2008-2012, Adam Chlipala * * This work is licensed under a * Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 * Unported License. * The license text is available at: * http://creativecommons.org/licenses/by-nc-nd/3.0/ *) Require Import Coq.Logic.Eqdep Coq.Lists.List. Requi...
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> using namespace std; int n,m; char s[200009],t[200009]; int f[200009],g[200009]; vector<int> p[30]; int main() { scanf( %d%d ,&n,&m); scanf( %s%s ,s+1,t+1); for(int i=1;i<=n;i++) s[i]-= a -1; ...
#include <bits/stdc++.h> using namespace std; int n, m, loc[250] = {}, isi[250] = {}, idx = 0; int kosong() { for (int i = 0, _n = (n); i < _n; i++) if (isi[i] == -1) return i; return -111; } int main() { memset(isi, -1, sizeof isi); scanf( %d %d , &n, &m); for (int i = 0, _n = (m); ...
#include <bits/stdc++.h> using namespace std; char s[400010]; int a[200]; vector<int> S; vector<int> d, q; int main() { int n; scanf( %d %s , &n, s); for (int i = 0; i < n; i++) a[s[i]]++; int p = 0; for (int i = 0; i < 128; i++) { if (a[i] % 2) p++, a[i]--, S.push_back(i); i...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:55:41 12/10/2012 // Design Name: // Module Name: spis // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Re...
#include <bits/stdc++.h> using namespace std; struct dato { int i, j, val; }; int main() { int n, m, k; cin >> n >> m >> k; vector<dato> input(k); for (int t = 0; t < k; t++) { dato &d = input[t]; cin >> d.i >> d.j >> d.val; d.i--; d.j--; } long long int p; ...
#include <bits/stdc++.h> using namespace std; int main() { long b, c, m, n, k, l; cin >> m >> k; l = k; for (int i = 0; i < k; i++) { if (m % 10 == 0) m /= 10; else m--; } cout << m; }
#include <bits/stdc++.h> using namespace std; template <typename T> inline void ckmax(T& x, T y) { x = (y > x ? y : x); } template <typename T> inline void ckmin(T& x, T y) { x = (y < x ? y : x); } namespace Fread { const int SIZE = 1 << 21; char buf[SIZE], *S, *T; inline char getchar() { ...
#include <bits/stdc++.h> int main() { long long n, x; int q, i; scanf( %lld %i , &n, &q); while (q--) { scanf( %lld , &x); while (!(x & 1)) { x += (n - (x >> 1)); } printf( %lld n , (x + 1) / 2); } return 0; }
#include <bits/stdc++.h> int x[10]; int cp, dp; using namespace std; void print() { for (int i = 0; i < 10; ++i) { cout << x[i]; if (i == 9) cout << n ; else cout << ; } } int pp(char a, int &dp) { if (a == < ) { dp = -1; return -2; } else ...
`include "timescale.v" module fb_rxcounters ( MRxClk, Reset, MRxDV, RxValid, StateIdle, StateFFS, StatePreamble, StateData, StateFrmCrc, MRxDEqDataSoC, TotalRecvNibCntEq0, TotalRecvNibCnt, RxRamAddr, FrmCrcNibCnt, FrmCrcStateEnd ); input MRxClk; input Reset; input MRxDV; input ...
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; const int inf = 1e9; int n, l[maxn], c[maxn], ans, cnt, pri[maxn], lst, cur, p[maxn], st[maxn], f[maxn]; bool tf[maxn]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , l + i); for (int i = 1; i <=...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
////////////////////////////////////////////////////////////////////// //// //// //// File name "ge_1000baseX_test.v" //// //// //// //// This file is part of the : ...
/****************************************************************************** * File Name : jhash_in.v * Version : 0.1 * Date : 2008 08 29 * Description: jash in module * Dependencies: * * * Company: Beijing Soul * * BUG: * *************************************************...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int n, k1, k2, m1 = INT_MIN, m2 = INT_MIN, tmp; cin >> n >> k1 >> k2; for (long long int i = 0; i < k1; i++) { cin >> tmp; m1 = max(m1, tmp); } for ...
#include <bits/stdc++.h> using namespace std; const int N = 2.5 * 1e5 + 5; int n, m, k; int d[N]; struct Edge { int num; int next; } edge[4 * N]; int tot, last[N]; vector<int> q; vector<int> ans[N]; vector<int> path; int anss; bool flag; void Add(int i, int j) { tot++; edge[tot...
/* * 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 int maxn = 1e5 + 6; const long long int MOD = 1e9 + 7; vector<int> prim(1000005, 1); int fact[maxn]; long long int binomialCoeff(long long int n, long long int k) { long long int res = 1; if (k > n - k) k = n - k; for (long long int i...
// Copyright (c) 2000-2011 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, publ...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; int n, m, dis[55][55], fast[55], slow[55], g1, g2, s1, s2; long long f[55][55][55]; bool cang[55], cans[55], canb[55]; long long work(int g, int b, int su, int sd) { memset(f, 0, sizeof(f)); memset(cang, false, sizeof(cang)); mem...
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. //////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version : ...
// This file is part of Verilog-65c816. // // Copyright 2017 by FPGApeeps // // Verilog-65c816 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 the License, or (at // your option) any la...
#include <bits/stdc++.h> using namespace std; int Read() { char c; while (c = getchar(), (c != - ) && (c < 0 || c > 9 )) ; bool neg = (c == - ); int ret = (neg ? 0 : c - 48); while (c = getchar(), c >= 0 && c <= 9 ) ret = ret * 10 + c - 48; return neg ? -ret : ret; } const ...
/******************************************************************************* * Module: dly01_16 * Date:2014-05-30 * Author: Andrey Filippov * Description: Synchronous delay by 1-16 clock cycles with reset (will map to primitive) * * Copyright (c) 2014 Elphel, Inc. * dly01_16.v is free software; you can red...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; unsigned long long sum{}; int cur{1}; for (int i{}; i < m; i++) { int x; cin >> x; if (cur < x) { sum += x - cur; cur = x; } else if (cur > x) { sum += n - cur + x;...
//Legal Notice: (C)2016 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
`ifndef INCLUDE_PARAMS `include "params.v" `endif `ifndef INCLUDE_ISA `include "ISA.v" `endif module HazardDetect ( input [`WIDTH - 1:0] IR_ID, input [`WIDTH - 1:0] IR_EXE, input [`WIDTH - 1:0] IR_MEM, output reg IsStall_IF, output reg IsStall_ID ); wire [4:0] Rs; wire [4:0] Rt; assign Rs = IR_ID[20:16]; ...
#include <bits/stdc++.h> using namespace std; long long n, crush[100005], ans = -1; bool exi[100005]; long long ms(int o, int x, int p) { if (p > 2 * n) return -1; if (crush[x] == x) return p ? -1 : 0; if ((x == o) && p) return 0; int t = ms(o, crush[x], p + 1); return (t < 0 ? t : t + 1); ...
module top; reg pass; reg result; reg [3:0] expr; initial begin pass = 1'b1; result = $onehot0(1'b0); if (result != 1) begin $display("FAILED: for 1'b0 expected 1, got %b", result); pass = 1'b0; end result = $onehot0(1'b1); if (result != 1) begin $display("FAILED: fo...
//Legal Notice: (C)2016 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associate...
#include <bits/stdc++.h> using namespace std; int p[6005], q[6005]; bool check(int a, int b, int x) { return x > a && x < b; } bool check2(int a, int b, int x) { return x >= a && x <= b; } bool isOK(int a, int b) { return a == b; } int sx[1005], sy[1005]; int main() { int n, t, i, j, a, x, k; mems...
/* 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 law or agreed...
`ifndef _lineto_v_ `define _lineto_v_ /** * Bresenham's Line Drawing algorithm. * Generate straight lines from the current point to the * destination. x_in/y_in can be reset at any time with the strobe. */ module lineto( input clk, input reset, input strobe, input [BITS-1:0] x_in, input [BITS-1:0] y_in, o...
#include <bits/stdc++.h> const int INF = 1e9 + 100; const long long lINF = 4e18; const double EPS = 1e-12; using namespace std; const int N = 5e5 + 100; int n, k, h[N], s[N], mn = INF, mxh[N], should = INF; vector<int> graph[N]; vector<int> can, need; void dfs1(int v, int par = -1, int mx = INF) { ...
// +UEFSHDR--------------------------------------------------------------------- // FILE NAME : sp_rom.v // AUTHOR : João Carlos Nunes Bittencourt // AUTHOR'S E-MAIL : // ----------------------------------------------------------------------------- // RELEASE HISTORY // VERSION DATE ...
// // 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) // ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:11:35 03/19/2015 // Design Name: fsm2 // Module Name: /home/lsriw/SR/Wojciech Gumula/repo/fsm2/tb_fsm2.v // Project Name: fsm2 // Target Device: // Tool version...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); string s; cin >> s; long long i; bool flag = true; for (i = 0; i < s.length(); i++) { if (s[i] == 0 ) { s.erase(i, 1); flag = false; break; } } ...
#include <bits/stdc++.h> using namespace std; signed main() { long long int n, max = 0; cin >> n; map<string, long long int> m; string s; while (n--) { cin >> s; m[s]++; } for (auto it = m.begin(); it != m.end(); it++) { if (it->second > max) { max = it->second;...
#include <bits/stdc++.h> using namespace std; char s1[200100], s2[200100]; vector<int> pos[26]; long long sum1[27][200100]; long long sum2[27][200100]; int main() { int n; scanf( %d , &n); long long res2 = 0; for (int i = (1); i < (n + 1); ++i) res2 += (n - i + 1) * 1ll * (n - i + 1); sc...
// 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 : Sun Jun 18 18:22:31 2017 // Host : DESKTOP-GKPSR1F running 64-bit major releas...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen * for EE577b Troy WideWord Processor Project */ `timescale 1ns/10ps /** * `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 ...
// Copyright (c) 2014 Takashi Toyoshima <>. // All rights reserved. Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. module MC6502Accumulator( i_a, i_m, i_c, i_d, i_s, o_a, o_n, o_z, o_c, o_v); input [7:0] i_a; input [7:...
// Copyright 2012 Sriram Radhakrishnan, Varun Sampath, Shilpa Sarode // // This file is part of PVS. // // PVS 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 the License, or (at ...
/* * 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 la...