text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; long long n, m; bool judge(long long k) { if (n == 1) return 1; long long num = (long long)m * k, res = 1, C = 1; for (int i = 1; i <= k; i++) { if (num < i) return 0; if ((long long)(k - i + 1) * C >= (long long)n * i) C = n; els...
#include <bits/stdc++.h> using namespace std; void read (int &x) { char ch = getchar(); int f = 0; x = 0; while (!isdigit(ch)) { if (ch == - ) f = 1; ch = getchar(); } while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar(); if (f) x = -x; } const int N = 3e5 + 5; int n, a[N], f[N], fr...
`define TV80_CORE_PATH tb_top.tv80s_inst.i_tv80_core module tb_top; reg clk; reg reset_n; reg wait_n; reg int_n; reg nmi_n; reg busrq_n; wire m1_n; wire mreq_n; wire iorq_n; wire rd_n; wire wr_n; wire ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; cout << (n / k + 1) * k; }
#include <bits/stdc++.h> using namespace std; void parseArray(long long* A, long long n) { for (long long K = 0; K < n; K++) { cin >> A[K]; } } long long modInverse(long long a, long long b) { return 1 < a ? b - modInverse(b % a, a) * b / a : 1; } long long gcd(long long a, long long b) { ...
`include "defines.vh" /** * @module branch_target_buffer * @author sabertazimi * @email * @brief branch target buffer for branch prediction * @param DATA_WIDTH data width * @input clk clock signal * @input rst reset signal * @input en enable signal * @input branch imply whether current instruction is branch ...
#include <bits/stdc++.h> using namespace std; const int N = 10; int A[N][N * N], B[N][N * N], C[N][N * N]; int main() { int n, m, k; cin >> n >> m >> k; for (int i = 0; i < n; i++) { string s; cin >> s; for (int j = 0; j < m; j++) cin >> A[i][j] >> B[i][j] >> C[i][j]; } int...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t = 1; while (t--) { long long int i, j, k = 0, n, m; cin >> n >> m; vector<long long int> a(n); for (i = 0; i < n; i++) { long long int x, y; ...
#include <bits/stdc++.h> using namespace std; int dy[] = {1, -1, 0, 0, -1, 1, 1, -1}; int dx[] = {0, 0, 1, -1, 1, -1, 1, -1}; void file() {} void fast() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); } const int N = 2e5 + 9; int arr[N], qi[N], qs[N], qe[N]; long long qans[N], cnt; int f...
#include <bits/stdc++.h> using namespace std; stack<char> st; char s[100005]; int main() { scanf( %s , s); int len = strlen(s); for (int i = 0; i < len; ++i) { if (st.empty() || st.top() != s[i]) st.push(s[i]); else st.pop(); } if (st.empty()) puts( Yes ); ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; int n, x, bac[maxn], a[maxn], b[maxn]; inline int read() { char ch = getchar(); int u = 0, f = 1; while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) { u = u * 10 + ch - ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 4, Mod = 1e9 + 7; struct Mint { int res; Mint() { res = 0; } Mint(int a) : res(a) {} friend Mint operator+(Mint A, Mint B) { return Mint((A.res + B.res >= Mod) ? (A.res + B.res - Mod) :...
//***************************************************************************** // (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; int ar[100001]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, cur = 0; string s; cin >> n; cin >> s; for (int i = 0; i < n; i++) { cin >> ar[i]; } for (int i = 0; i < 10000000; i++) { if (s[cur]...
/* * 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; string second; int n, k; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); ; cin >> second >> k; if (second.size() < k) return cout << impossible n , 0; set<char> st; for (auto i : second) st.insert(i); if (st.size() > ...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
/* * 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...
// (C) 2001-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 doc...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2014 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; reg [63:0] crc; ...
/*+-------------------------------------------------------------------------- Copyright (c) 2015, Microsoft Corporation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2007 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; reg toggle; integer cyc; initial cyc=1; Test test (/*AUTOINST*/ // Inputs ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long INFL = 0x3f3f3f3f3f3f3f3fLL; const long double eps = 1e-8; const int MAXN = 100000 + 5; pair<long double, long double> X[MAXN << 2]; inline pair<long double, long double> calc(const int& a, const int& b) { long d...
//Legal Notice: (C)2015 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; int mas[1010][1010]; int mas1[1001][1001]; bool check(int i, int j) { return mas[i][j] && mas[i + 1][j] && mas[i + 2][j] && mas[i + 2][j + 1] && mas[i + 2][j + 2] && mas[i + 1][j + 2] && mas[i][j + 2] && mas[i][j + 1]; } void draw(int i...
`begin_keywords "1364-2005" module top; reg pass = 1'b1; reg clk = 0; reg [7:0] result; reg [3:0] bit; always #10 clk = ~clk; initial begin // Since the bit is not defined this assignment will not happen. // We will check to verify this fact 1 time step after it should // happen (50). res...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m, a[4005], b[4005]; bitset<4005> adj[4005]; cin >> n >> m; vector<int> tam(n + 1); for (int i = 0; i < m; i++) { cin >> a[i] >> b[i]; adj[a[i]][b[i]] = 1; adj[b[...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:03:29 05/19/2015 // Design Name: opening3x3 // Module Name: /home/vka/Programming/VHDL/workspace/sysrek/skin_color_segm/tb_opening3x3.v // Project Name: vision //...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6; const int LOGN = 20; int n, k; vector<int> graph[MAXN + 5]; int pa[LOGN + 1][MAXN + 5]; int depth[MAXN + 5]; int par[MAXN + 5]; void dfs(int u, int p, int d) { depth[u] = d; par[u] = p; pa[0][u] = p; for (int j = 1; j ...
#include <bits/stdc++.h> using namespace std; int A[100010]; int B[100010]; int C[100010]; int main() { int n; scanf( %d , &n); int m, k; scanf( %d%d , &m, &k); for (int i = 0; i < m; i++) { scanf( %d%d%d , A + i, B + i, C + i); } long long sum = 0; for (int i = 0; i < k;...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); vector<int> a(n); int i; for (i = 0; i < n; i++) { scanf( %d , &a[i]); } vector<int> b(n); for (i = 0; i < n - 1; i++) { b[i] = a[i] + a[i + 1]; } b[n - 1] = a[n - 1]; for (i = ...
#include <bits/stdc++.h> using namespace std; int a[200000]; int s[200000]; int n, p, k; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int tc; cin >> tc; while (tc--) { cin >> n >> p >> k; for (int i = 0; i < n; ++i) cin >> a[i]; sort(a, a + n); int ...
/* ------------------------------------------------------------------------------- * (C)2007 Robert Mullins * Computer Architecture Group, Computer Laboratory * University of Cambridge, UK. * ------------------------------------------------------------------------------- * * Matrix Arbiter * * See Dally/Towle...
#include <bits/stdc++.h> using namespace std; const int N = 1700; int n, m, tim, res[N * N], num[N * N], a[N][N], s[N][N], id[N][N]; bool ray[N][N]; bool check(int x, int y) { return s[x + 3][y + 3] - s[x - 4][y + 3] - s[x + 3][y - 4] + s[x - 4][y - 4] <= 15; } void dfs1(int ...
#include <bits/stdc++.h> using namespace std; const int Maxn = 507; int n, m; int E[Maxn][Maxn]; vector<int> V[Maxn]; int ans[Maxn]; bool mark[Maxn]; void dfs(int v) { mark[v] = true; for (int i = 0; i < V[v].size(); i++) { int u = V[v][i]; if (!mark[u]) ans[u] = 2 - ans[v], ...
#include <bits/stdc++.h> using namespace std; long long min(long long x, long long y) { return (x < y) ? x : y; } long long max(long long x, long long y) { return (x > y) ? x : y; } const int N = 1000009; const int E = 1000000; int x, y, n, m, e, i, u, w, mx, z, sum, l, r, best, cnt, g, j, k, t; int a[N],...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int main() { int t; scanf( %d , &t); ; while (t--) { int n; scanf( %d , &n); ; if (n % 2 == 0) { n = n / 2; while (n--) { cout << 1; } cout << n ; } else {...
#include<bits/stdc++.h> using namespace std; typedef long long ll; int n,m,pre,N; string s,t; ll ans; map<string,vector<string> >S; map<string,bool>vis; int main(){ ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); cin>>n; for(int i=1;i<=n;i++){ cin>>s;t=s; sort(t.begin(),t.end()); ...
/* * 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 maxn = 1e6 + 50; const long long inf = 0x3f3f3f3f3f3f3f3f; const long long mod = 1e9 + 7; const long double eps = 1e-20; const long long HASH = 131; using namespace std; long long a[maxn]; signed main() { std::ios::sync_with_stdio(false...
#include <bits/stdc++.h> using namespace std; const long double PI = 3.1415926535897932384626433832795; const long double EPS = 1e-11; int n, m, first, second; bool a[110][110]; pair<long double, int> find_k(int s, int e) { queue<int> q; int ur[110]; long double kr[110]; memset(ur, 0xFF, siz...
#include <bits/stdc++.h> using namespace std; int n; string s; int l = 0, u = 0, d = 0; int main() { cin >> n; for (int i = 0; i < n; i++) { int l = -1, u = -1, d = -1; cin >> s; for (int j = 0; j < s.length(); j++) { if (isdigit(s[j])) d = j; if (islower(s[j])) l = j...
#include <iostream> using namespace std; int t, n, f[100005]; long long k; void Solve() { if (n < 63 && (1ll<<(n-1)) < k) { cout << -1 n ; return; } int p = max(1, n - 62); long long power = (1ll<<(n-p)); for(int i=1; i<p; ++i) f[i] = i; for(int i=p; i<=n; ++i) { powe...
//////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. // // // // Redistribution and use in source and binary forms, w...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) f = -1; for (; isdigit(c); c = getchar()) x = x * 10 + c - 0 ; return x * f; } const int MAXN = 200010; inline void solve() { ...
#include <bits/stdc++.h> using namespace std; const int matmul[][6] = {{2, 1, 1, 1, 0, 0}, {1, 2, 1, 1, 0, 0}, {1, 0, 1, 0, 0, 0}, {0, 1, 0, 1, 0, 0}, {1, 1, 1, 1, 1, 0}, {2, 2, 2, 2, 1, 1}}; long long N, sx, sy, dx, dy, t; struct matrix { int m, n; ...
/* * blockram_spool.v - Spools data to the processor from block ram * * Used to spool data to/from the SD Card buffer. Expects the block ram to be 8-bit * Only one clock domain allowed * * Registers: * * 0 - Set/Get A(low) * 1 - Set/Get A(high) * 8 - Read/Write Data * 15 - Operation Request/Status * Bit ...
#include <bits/stdc++.h> using namespace std; void fun() {} const long long int inf = 1e18; const long long int md = 1e9 + 7; const long long int N = 300050; long long int __gcd(long long int a, long long int b) { if (b == 0) return a; return __gcd(b, a % b); } long long int poww(long long int a...
#include <bits/stdc++.h> using namespace std; int d[1000000]; int main() { int n, k; scanf( %d%d , &n, &k); for (int i = 0; i < (n); ++i) { int(x); scanf( %d , &x); d[i % k] += x; } int mi = (int)1e9; int id = -1; for (int i = 0; i < (k); ++i) { if (mi > d[i]) {...
#include <bits/stdc++.h> using namespace std; vector<int> primes; bool sums[1003]; int n, k; bool pr[1003]; void sieve() { pr[1] = pr[0] = 1; for (int i = 2; i <= n; i++) if (!pr[i]) { for (int j = i + i; j <= n; j += i) pr[j] = 1; primes.push_back(i); } return; } ...
#include <bits/stdc++.h> using namespace std; int n, a[200010], pos[200010][3], tag[200010][3]; long long ans, num1, num2, cnt1, cnt2; int main() { int i; scanf( %d , &n); for (i = 1; i <= n * 2; i++) { scanf( %d , &a[i]); pos[a[i]][0]++; pos[a[i]][pos[a[i]][0]] = i; } pos[...
#include <bits/stdc++.h> using namespace std; const int Mo = 998244353; const int N = 2e5 + 50; const int md = 998244353; inline void add(int &x, int y) { x += y; if (x >= md) { x -= md; } } inline void sub(int &x, int y) { x -= y; if (x < 0) { x += md; } } inline i...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016 // Date : Tue Oct 17 15:09:03 2017 // Host : vldmr-PC running 64-bit Service Pack 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 law...
#include <bits/stdc++.h> using namespace std; int main() { long long t, s, n, e; cin >> t; for (int i = 0; i < t; i++) { cin >> s >> n >> e; long long l = 0, r = e + 1, m; if (e == 0) { if (s > n) cout << 1 << endl; else cout << 0 << endl; co...
//----------------------------------------------------------------------------- // // (c) Copyright 2012-2012 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of n0_1 // // Generated // by: wig // on: Tue Apr 1 13:31:51 2008 // cmd: /cygdrive/c/eclipse/MIX/mix_0.pl -strip -nodelta ../noassign.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // ...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009, 2010 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 distri...
/******************************************************************************* * 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 with non-Xilinx ...
#include <bits/stdc++.h> typedef long long int ll; typedef long double ld; typedef unsigned long long ull; #define RESET(a, b) memset(a, b, sizeof(a)) int INF = 1000000005; long long INFF = 1000000000000000005LL; using namespace std; struct monster { ll health, attack_power; }; ...
/** * 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...
//Legal Notice: (C)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 //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { char ch = getchar(); x = 0; while (!isdigit(ch)) ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar(); } const int N = 1e5 + 10; int n, a[N], s[N], c[N << 1]; inline void add(int x) { for (; x; x...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `include "std_ovl_defines.h" `module ovl_quiescent_state (clock, reset, enable, state_expr, check_value, sample_event, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter width ...
#include <bits/stdc++.h> using ul = std::uint32_t; using ull = std::uint64_t; using li = std::int32_t; using ll = std::int64_t; using vull = std::vector<ull>; using vul = std::vector<ul>; const ul sz = 1 << 18; const ul base = 1e9 + 7; class scaler { public: ul v = 0; scaler() = default; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2) { cout << 7; n -= 3; } while (n) { cout << 1; n -= 2; } return 0; }
/* -*- verilog -*- * * USRP - Universal Software Radio Peripheral * * Copyright (C) 2005 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 Lice...
#include <bits/stdc++.h> using namespace std; int n; int a[210000]; void work() { int cnt[33]; memset((cnt), (0), sizeof(cnt)); int xorsum = 0; cin >> n; for (int i = 0; i < n; i++) { scanf( %d , &a[i]); xorsum ^= a[i]; for (int j = 0; j <= 30; j++) cnt[j] += (a[i] >> j) & ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ara[n]; int temp = n; int k = 0; while (n--) { cin >> ara[k++]; } sort(ara, ara + temp); queue<int> Q; for (int i = 0; i < temp; i++) { Q.push(ara[i]); } int i; for (i = 1;...
#include <bits/stdc++.h> using namespace std; long long a, b, c; long long n, m, k; int arr[100050]; int main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >> n; bool odd = false, even = false; for (int i = 1; i <= n; i++) { cin >> arr[i]; if ((arr[i] - 0 ) % 2 == ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a; int b; cin >> a; cin >> b; if (a != b) { cout << Happy Alex ; return 0; } } cout << Poor Alex ; 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 / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: franp.com // Engineer: Fran Pregernik <> // // Create Date: 12/30/2016 10:48:02 AM // Design Name: // Module Name: azimuth_signal_generator // Project Name: // Target Devices: // Tool Versions: // Descrip...
/** * 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...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
/** * 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) 2015-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; int log2(int x) { return 31 - __builtin_clz(x); } int main(void) { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int n, q; cin >> n >> q; vector<long long> a(n); for (int i = 0; i < (int)(n); i++) { cin >> a[i]; } for...
#include <bits/stdc++.h> int Max(int n); int main(void) { long n, i, j; long long m; scanf( %ld , &n); m = Max(n); j = m; for (i = 1; i <= 4; i++) { m = m * j; m %= 100000; } if (m == 0) { printf( 00000 n ); } else if (m < 10) { printf( 0000%lld n , m); ...
/* This file is part of JT12. JT12 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 later version. JT12 is distributed in the hope tha...
#include <bits/stdc++.h> using namespace std; const int maxl = 2e5 + 10; int n, m, cnt, tot, cas, ans; int a[maxl], b[maxl], num[maxl * 32]; int ind[maxl * 32], sz[maxl * 32], tr[maxl * 32][2]; bool vis[maxl], pr[maxl]; char s[maxl]; vector<int> e[maxl]; inline void prework() { scanf( %d , &n); ...
#include <bits/stdc++.h> using namespace std; inline int read() { char c = getchar(); int x = 0, f = 1; for (; !isdigit(c); c = getchar()) if (c == - ) f = -1; for (; isdigit(c); c = getchar()) x = x * 10 + c - 0 ; return x * f; } inline void chkmax(int &x, int y) { x = x > y ? x : y...
// 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 ); input clk; reg _ranit; reg rnd; reg [2:0] a; reg [2:0] b; reg [31:0] wide; // surefi...
#include <bits/stdc++.h> using namespace std; int a[101][101], c[101], D[101], d[101], size[101], n, m, i, j, k, l, x, y, h, t, tot, Tot; long long jc[101], Jc[101], f[101][101], g[101], F[101][101]; bool bz[101], Bz[101], bz2[101], bz3[101], bz4[101]; long long qpower(long long a, int b) { long lon...
// -*- verilog -*- // Copyright (c) 2012 Ben Reynwar // Released under MIT License (see LICENSE.txt) // A qa_wrapper with only the message_stream_combiner. // The input stream and an empty stream go to the combiner. module qa_wrapper #( parameter WIDTH = 32 ) ( input wire clk, input ...
#include <bits/stdc++.h> using namespace std; class TwoSAT { private: const static int maxm = 100010 * 2; int S[maxm], c; vector<int> G[maxm]; bool DFS(int u) { if (vis[u ^ 1]) return false; if (vis[u]) return true; vis[u] = 1; S[c++] = u; for (auto &v : G[u]) ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long t; cin >> t; while (t--) { int n, k, x, rem; cin >> n >> k; x = k / (n - 1); rem = k - x * (n - 1); if (!rem) cout...
//----------------------------------------------------- // Design Name : sfifo // File Name : sfifo.v // Function : Synchronous (single clock) FIFO // Coder : Deepak Kumar Tala //----------------------------------------------------- module sfifo ( clk , // Clock input rst , // Active high reset wr_...
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> dp[2001][26]; int q[2000]; pair<int, int> ans[2001][2001]; int nxt[2001][26]; pair<int, int> jump(pair<int, int> p, char c) { if (p.first < m) { p.second = dp[q[p.first]][c - a ][p.second]; if (p.second == -1) { p...
module cia_timera ( input clk, // clock input clk7_en, input wr, // write enable input reset, // reset input tlo, // timer low byte select input thi, // timer high byte select input tcr, // timer control register input [7:0] data_in,...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18 + 7; const long double EPS = 1e-8; const long long MAXI = 20000; const long long MOD = 16714589; const long long MAXST = 2000000; const long double PI = 3.14159265358979323; ostream &operator<<(ostream &stream, const pair<long long...
#include <bits/stdc++.h> using namespace std; long long dx[] = {1, -1, 0, 0}; long long dy[] = {0, 0, 1, -1}; const int sz = 2e6 + 5, mod = 998244353; long long t, n, m, k; const int MAXN = 2e5 + 7; const long long lim = 1e18; const long long inf = 1e15; vector<long long> Prime; vector<bool> sie(sz,...
#include <bits/stdc++.h> using namespace std; int N; long long A[10], rem[10]; int totnum, numv[10], pos[10], tat[10]; int result = 0x3f3f3f3f; inline bool compare(const int& i1, const int& i2) { return numv[i1] > numv[i2]; } void Back(int x) { if (x == N + 1) { int num0 = 0; for (in...
#include <bits/stdc++.h> using namespace std; int n, m, x[101]; double e[2][101 * 1001], sume[101 * 1001]; int main(int argc, const char* argv[]) { scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) scanf( %d , x + i); if (m == 1) { puts( 1.00 ); return 0; } int cur = 0, pre = 1;...
module cn0363_dma_sequencer ( input clk, input resetn, input [31:0] phase, input phase_valid, output reg phase_ready, input [23:0] data, input data_valid, output reg data_ready, input [31:0] data_filtered, input data_filtered_valid, output reg data_filtered_ready, input [31:0] i_q, input i_q_valid, ou...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int n; long long mmax = 0; long long sum = 0; long long num; cin >> n; for (int i = 1; i <= n; i++) { cin >> num; sum += num; mmax = max(mmax, num); } cout << 2 * mmax - sum + 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 16:35:53 05/31/2016 // Design Name: // Module Name: Contador_AD_Mes // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies...
#include <bits/stdc++.h> using namespace std; bool isBeautiful(int n) { bool flag[10]; for (int i = 0; i < 10; i++) flag[i] = false; while (n > 0) { int digit = n % 10; if (flag[digit]) return false; flag[digit] = true; n = n / 10; } return true; } int main() { io...
/** * 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...