text
stringlengths
59
71.4k
/* * Titor - System - Terminal * Copyright (C) 2013 Sean Ryan Moore * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) a...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int k = 4 * n; for (int i = 0; i < n; i++) { cout << k << ; k -= 2; } cout << endl; } }
#include <iostream> #include <vector> #include <string> #include <queue> #include <algorithm> #include <cmath> #include <map> #include <set> #include <unistd.h> #define rep(i,a,n) for(int i = a;i < n;i++) #define fi first #define se second typedef long long ll; using namespace std; const int...
#include <bits/stdc++.h> using namespace std; const int N = 2 * 1e5 + 5; int v[N]; int c[N]; bool viz[N]; bool check(int len, vector<int> v) { int n = v.size(); for (int i = 0; i < len; i++) { int p = (i + len) % n; while (v[p] == v[(p + len) % n] && p != i) { p = (p + len) % n; ...
//***************************************************************************** // (c) Copyright 2008-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 // ...
#include <bits/stdc++.h> using namespace std; int a[100000]; int b[100001]; int c1[100001]; int c2[100001]; int main() { int n, c = 0, x = 0, y = 0, z1 = 0, z2 = 0, i; long long ans = 0; scanf( %d , &n); for (i = 0; i < n; i++) scanf( %d , &a[i]); for (i = 0; i < n; i++) { b[a[i]]+...
#include <bits/stdc++.h> using namespace std; long long A[100001], B[100001]; bool valid[100001]; int main() { ios::sync_with_stdio(0); int n; cin >> n; for (int i = 0; i < n; ++i) cin >> A[i]; for (int i = 0; i < n; ++i) cin >> B[i]; long long ac = 0, bc = 0; long long mini = (1LL <...
#include <bits/stdc++.h> using namespace std; template <class T> inline T bigmod(T b, T p, T M) { long long ret = 1; for (; p > 0; p >>= 1) { if (p & 1) ret = (ret * b) % M; b = (b * b) % M; } return (T)ret; } template <class T> inline T lcm(T a, T b) { return (a * b) / __gcd...
#include <bits/stdc++.h> using namespace std; int n, k; string s; void solve() {} int main() { std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long test = 1; cin >> test; while (test--) { cin >> n >> k; cin >> s; int ans = 0; int cnt = 0; ...
module SERIAL_OUT(CLK,BYTEIN,ADDR,READ,READY,CLEAR,RX_D,RESET); input CLK,READY,RESET; input [7:0]BYTEIN; output reg RX_D,READ,CLEAR=1; output reg [4:0]ADDR=0; reg [9:0] data_out=0; reg [6:0] count=0; always@(posedge CLK or negedge RESET) begin if(RESET==0) begin count=0; ADDR=0; CLEAR=1; READ=0; RX_D=1...
#include <bits/stdc++.h> using namespace std; const pair<int, int> DD[] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}}; template <class T> T smin(T &a, T b) { if (a > b) a = b; return a; } template <class T> T smax(T &a, T b) { if (a...
`timescale 1ns / 1ps module toplevel( input io_J3, input io_H16, input io_G15, output io_G16, input io_F15, output io_B12, input io_B10, output [7:0] io_led ); wire [31:0] io_gpioA_read; wire [31:0] io_gpioA_write; wire [31:0] io_gpioA_writeEnable; wire io_mainClk...
// Copyright 1986-1999, 2001-2013 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2013.4 (lin64) Build 353583 Mon Dec 9 17:26:26 MST 2013 // Date : Mon Mar 17 09:47:36 2014 // Host : macbook running 64-bit Arc...
/* * 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...
//====================================================================== // // sha512_k_constants.v // -------------------- // The table K with constants in the SHA-512 hash function. // // // Author: Joachim Strombergson // Copyright (c) 2014 Secworks Sweden AB // All rights reserved. // // Redistribution and use in s...
//====================================================================== // // tb_trng.v // ----------- // Testbench for the trng module in the trng. // // // Author: Joachim Strombergson // Copyright (c) 2014, Secworks Sweden AB // All rights reserved. // // Redistribution and use in source and binary forms, with or /...
/* * 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...
// -*- Mode: Verilog -*- // Filename : uart_regs.v // Description : UART Registers // Author : Philip Tracton // Created On : Wed May 27 17:22:20 2015 // Last Modified By: Philip Tracton // Last Modified On: Wed May 27 17:22:20 2015 // Update Count : 0 // Status ...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2018 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> using namespace std; const int SIZE = 200010; const long long INF = 1e17; const long long INF_half = 1e16 + 1e10; struct data { long long v, c; data(long long _v = 0, long long _c = 0) : v(_v), c(_c) {} bool operator<(const data& b) const { return c < b.c || (c == b....
/* * 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 N = 1E5 + 10; string s[N]; map<string, vector<string>> E; map<string, long long> cnt; map<string, long long> len; map<string, bool> vis; vector<pair<string, vector<string>>> e; string to_lower(string &s) { int ret = 0; for (auto &c : s) {...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 03/12/2016 06:26:54 PM // Design Name: // Module Name: shift_mux_array // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revis...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { if (i % 4 == 1 or i % 4 == 3) { for (int j = 0; j < m; j++) { cout << # ; } cout << n ; } else if (i % 4 == 2) { for (int k = 0; k <...
`timescale 1ns / 1ps module wash_mode #(parameter WIDTH = 32, CLK_CH = 25, TIME_SCORE = 2) ( input wash_start, input start, input power, input [31:0]clk, //input wash_control, input [2:0]weight, output reg wash_end_sign, //light output reg water_in_light, output reg washing_light, output [2:0]...
#include <bits/stdc++.h> using namespace std; int n, a[500005]; int st[500005], num[500005], top; long long s[500005], pre[500005], suf[500005]; long long ans, pos; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) { long long now =...
// -------------------------------------------------------------------- // Copyright (c) 2007 by Terasic Technologies Inc. // -------------------------------------------------------------------- // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Terasic De...
#include <bits/stdc++.h> using namespace std; int dp[1 << 25]; int n, m; int a[30][30]; int qi[30][30]; int st[30][30]; char c[30][30]; int lowbit(int x) { return (x & (-x)); } int main() { scanf( %d , &n); scanf( %d , &m); for (int i = 1; i <= n; i++) scanf( %s , c[i] + 1); for (int 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...
#include <bits/stdc++.h> using namespace std; long long a[100010]; int main() { long long n, k; cin >> n >> k; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); long long x = a[0], ans = 0; for (int i = 1; i < n; i++) { if ((a[i] - x) % k != 0) { cout << -1 << endl; ...
#include <bits/stdc++.h> using namespace std; const int N = 500005; int n, a[N], b[N]; vector<int> vec[N]; set<pair<int, int> > S; struct node { int cl, cr, mx, vl, vr, v; node() {} node(int c) { cl = cr = c; mx = vl = vr = v = 1; } } t[N * 4]; node operator+(node a, node b) ...
#include <bits/stdc++.h> using namespace std; bool prime[100005]; int dp[505][505], dp2[505][505]; int main() { long long int h, w, i, j, a, b, c, d, q, sum; cin >> h >> w; char arr[h][w + 1]; for (i = 0; i <= h - 1; i++) cin >> arr[i]; for (i = 0; i <= h - 1; i++) { for (j = 1; j <= 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 la...
/* * 1-bit 8-way multiplexor * Copyright (C) 2008-2010 Zeus Gomez Marmolejo <> * * This file is part of the Zet processor. This processor is free * hardware; 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 ...
#include <bits/stdc++.h> using namespace std; const long long INF = 100000000; const long long MAXN = 20100; int n, a[MAXN], ans; int main() { ans = -INF; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int k = 1; k <= n; k++) { if (n % k == 0) { for (int j...
module de10_standard ( input CLOCK2_50, input CLOCK3_50, input CLOCK4_50, input CLOCK_50, input [3:0] KEY, input [9:0] SW, output [9:0] LED...
#include <bits/stdc++.h> using namespace std; struct node { int t, d, p, id; } s[110]; int dp[2010]; vector<int> v[2010]; int cmp(node a, node b) { return a.d < b.d; } int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d%d%d , &s[i].t, &s[i].d, &s[i].p), s[i]...
#include <bits/stdc++.h> char Puz[105][105], ch; bool flag[105][105], ok; int i, j, k, n, m; int main() { scanf( %d%d , &n, &m); scanf( %c , &ch); for (i = 1; i <= n; i++) { for (j = 1; j <= m; j++) { scanf( %c , &ch); Puz[i][j] = ch; } scanf( %c , &ch); } m...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; vector<int> gr[N]; bool access = true; int p[N], h[N], a[N], g[N]; void dfs(int v, int ancestor = -1) { a[v] = p[v]; int sum_g = 0; for (int to : gr[v]) { if (to == ancestor) continue; dfs(to, v); sum_g += g[t...
#include <bits/stdc++.h> using namespace std; const int MAXN = 600009; const long long MOD = 1e9 + 7; class { public: int n, F[MAXN], G[MAXN]; string s; int Min; void solve() { cin >> n >> s; for (int i = 1; i <= n; ++i) { if (s[i - 1] == ( ) F[i] = F[i - 1] + 1...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long ans = 0; long long a = 1, b = 2, c; while (b <= n) { ans++; c = a + b; a = b; b = c; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int s[105]; int main() { int n, x; while (cin >> n >> x) { for (int i = 0; i < n; i++) { cin >> s[i]; } sort(s, s + n); int index = lower_bound(s, s + n, x) - s; if (s[index] == x) { cout << 1 + x - index << endl; ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int add(int a, int b) { return a + b - (a + b >= MOD) * MOD; } int mult(int a, int b) { return ((long long)a * b) % MOD; } int n, h, w; char s[500013]; int dX[200], dY[200]; int diffx, diffy; int maxx, minx; int maxy, miny; int...
/* * 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; template <typename A> using VE = vector<A>; template <typename A> using USET = unordered_set<A>; template <typename A> using HEAP = priority_queue<A>; template <typename A, typename B> using PA = pair<A, B>; template <typename A, typename B> using UMAP...
// // Copyright 2011 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is dis...
#include <bits/stdc++.h> using namespace std; int main() { int n, x, c = 0; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &x); if (!x && !c) c = 1; else if (c == 1 && !x) c = 2; } if (n == 1) { if (x) printf( YES n ); else ...
#include <bits/stdc++.h> using namespace std; long long n, m, k; int fans = 1; long long getnum(long long x) { long long fx, fy; if (x >= (n - k + 1)) { fx = (n - k + 1 + 1) * (n - k + 1) / 2 + (x - (n - k + 1)) * (n - k + 1); } else { fx = (x - 1 + 1) * (x - 1) / 2 + (n - k + 1); } ...
#include <bits/stdc++.h> using namespace std; struct node { node *c[3]; bool flag; }; node *root; void insert(string a) { node *cur = root; for (int i = 0; i < a.size(); i++) { if (!(cur->c[a[i] - a ])) cur->c[a[i] - a ] = new node(); cur = cur->c[a[i] - a ]; } cur->flag...
#include <bits/stdc++.h> using namespace std; const int INF = 0x7fffffff; long long n, m, k, x, s; const int maxn = 2e5 + 10; long long a[maxn], b[maxn], c[maxn], d[maxn]; int main(void) { cin.sync_with_stdio(false); cin >> n >> m >> k >> x >> s; for (int i = (0); i < (m); i++) { cin >> a[...
module testbench; localparam integer PERIOD = 12000000 / 9600; reg CLK; always #5 CLK = (CLK === 1'b0); reg RX = 1; wire TX; wire LED1; wire LED2; wire LED3; wire LED4; wire LED5; top uut ( .CLK (CLK ), .RX (RX ), .TX (TX ), .LED1(LED1), .LED2(LED2), .LED3(LED3), .LED4(LED4), .LED5(LED...
// (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...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_eac_e // // Generated // by: wig // on: Mon Mar 22 13:27:29 2004 // cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls // // !!! Do not edit this file! Autogenerated by MIX !...
#include <bits/stdc++.h> using namespace std; double p[22], f[(1 << 20) + 10], ans[22]; int n, m; int main() { int cnt = 0; scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { scanf( %lf , &p[i]); if (p[i] > 1e-7) cnt++; } if (cnt <= m) { for (int i = 1; i <= n; i++) ...
#include<bits/stdc++.h> #pragma GCC optimize ( -O3 ) #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long #define double long double #define pb push_back #define mod 1000000007 #define int long long #define endl n #define ss second #define ff first #define INF 1000...
/** * 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; long long n, m, val[105], c[105][105], pref[105][105], calc[105][105], dp[105][10005]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> m; for (long long i = 1; i <= n; ++i) { cin >> val[i]; for (long...
#include <bits/stdc++.h> int main() { char s[15]; char a; int len; scanf( %s , s); len = strlen(s); a = a - 1; for (int i = 0; i < len; i++) { if (a <= s[i]) { a = s[i]; } } for (int i = 0; i < len; i++) { if (s[i] == a) printf( %c , s[i]); } ret...
#include<bits/stdc++.h> #define mod 998244353 using namespace std; int n, A[2], f[200010], pw2; int powmod(int x, int y){ int ans = 1; for(;y;y >>= 1, x = 1ll * x * x % mod) if(y & 1)ans = 1ll * x * ans % mod; return ans; } int main(){ scanf( %d , &n); A[0] = 1; A[1] = 0; pw2 = powm...
#include <bits/stdc++.h> using namespace std; const int M = 200179; int n, q, k, t; int p[M], b[M]; vector<int> pb[M]; set<int> last; int main() { scanf( %d , &n); for (int t = 0; t < n; t++) { scanf( %d%d , &p[t], &b[t]); pb[p[t]].push_back(t); } last.insert(-1); for (int ...
/** * 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 Header Begin ========================================== // // OpenSPARC T1 Processor File: fpu_in2_gt_in1_3to1.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 ...
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-9; const int inf = 1e+9; const double pi = acos(-1.0); long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long xabs(long long a) { return a > 0 ? a : -a; } map<int, vector<string>> s; int sm[9][2] =...
/* * 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; int tot = 0; int ch[5000001][2]; int s[5000001]; void insert(int x) { int Root = 0; for (int i = 30; i >= 0; i--) { int tmp = (x >> i) & 1; if (!ch[Root][tmp]) { ch[Root][tmp] = ++tot; s[tot] = 0; ...
#include <bits/stdc++.h> using namespace std; template <typename T> vector<T>& operator--(vector<T>& v) { for (auto& i : v) --i; return v; } template <typename T> vector<T>& operator++(vector<T>& v) { for (auto& i : v) ++i; return v; } template <typename T> istream& operator>>(istream&...
////////////////////////////////////////////////////////////////////// //// //// //// uart_testbench_utilities.v //// //// //// //// This file is part of the "...
#include <bits/stdc++.h> using namespace std; long long x, xxxxx = 0; string s, word; long long indx = 0, lmt; string v[100009], out = ; bool f_int = false; bool ok() { if (indx > lmt) return xxxxx = 1, false; bool o1, o2; o1 = o2 = false; if (v[indx] == int and indx != 1) { out ...
#include <bits/stdc++.h> using namespace std; set<unsigned int> black[33], white[33]; unsigned int masks[33]; string parseipB(unsigned int x, int mask) { string s = ; for (int i = 0; i < 4; ++i) { for (int j = 0; j < 8; ++j) { s += to_string(1 & x >> 8 * i + j); } if (i != 3)...
// (C) 2001-2015 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated doc...
#include <bits/stdc++.h> using namespace std; int n, k, m; int arr[1005][105][2], arr1[1005], arr2[1005]; long long dp(int i, int s, int hg) { if (s == 0 && hg) return ((i != n) ? ((9 * 1LL * arr2[n - i - 1]) % m) : 1); if (i == n) return 0; if (arr[i][s][hg] != -1) return arr[i][s][hg]; arr[i][...
/* 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,...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t; cin >> t; while (t--) { long long n, i, g = 0, s = 0, b = 0, j; cin >> n; long long a[n]; vector<long long> v(n, 1); for (i = 0; i < n; i++) { ...
module premuat_16( enable, inverse, i_0, i_1, i_2, i_3, i_4, i_5, i_6, i_7, i_8, i_9, i_10, i_11, i_12, ...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, q; cin >> n >> q; while (q--) { long long a, b; cin >> a >> b; if ((a + b) % 2 == 0) { long long ans = 0; ans += (a) / 2 * ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string l, r; cin >> l >> r; vector<stack<int>> l_array; vector<stack<int>> r_array; for (int i = 0; i < 27; i++) { stack<int> buf; l_array.push_back(buf); r_array.push_back(buf); } for (...
/* * yosys -- Yosys Open SYnthesis Suite * * Copyright (C) 2012 Claire Xenia Wolf <> * Copyright (C) 2018 gatecat <> * * 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 permissio...
#include <bits/stdc++.h> using namespace std; template <class T> inline void chkmin(T &a, T b) { if (a > b) a = b; } template <class T> inline void chkmax(T &a, T b) { if (a < b) a = b; } double fail[310][3100], p[310][3100], val[310], nf[3100]; int main() { int N, M, i, j, u; double r...
//----------------------------------------------------------------------------- // // (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property ...
/* * 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 double EPS = 1e-11; long long n, l, v1, v2, k; bool check(double tim) { int tmp = n; double t = 0; double grx = 0, bus = 0; while (tmp > 0) { double del = l - grx; if (del / v2 > tim + EPS / 100) { return 0; } do...
module Datapath( output [3:0] FLAG_out, // Flag Bus output [WORD_WIDTH-1:0] A_bus, // Address out Bus output [WORD_WIDTH-1:0] D_bus, // Data out Bus output [WORD_WIDTH-1:0] D_bus_internal, // Internal data bus output for monitoring input [WORD_WIDTH-1:0] D_in, // Data in bus input [CNTRL_WIDTH-1...
#include <bits/stdc++.h> using namespace std; char ar[] = 1689 , s[1000010]; int val[10], ct[10]; int main() { do { val[atoi(ar) % 7] = atoi(ar); } while (next_permutation(ar, ar + 4)); scanf( %s , s); int len = strlen(s); for (int i = 0; i < len; ++i) ct[s[i] - 0 ]++; for (int i...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m, p[2000], d[2000], s[2000]; cin >> n >> m; for (int i = 0; i < 2 * n; ++i) cin >> p[i]; array<int, 2> a[1000]; memset(d, -1, sizeof(d)); for (int i = 0; i < m; ++i) { c...
#include <bits/stdc++.h> using namespace std; const int maxn = 2005; const long long inf = 1e18 + 5; long long n, m, x; long long a[maxn], b[maxn]; long long ma[maxn * maxn], mb[maxn * maxn]; void input() { cin >> n >> m; for (long long i = 1; i <= n; ++i) { cin >> a[i]; a[i] += a[i - ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout << setprecision(32); int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { int s, f, t; cin >> s >> f >> t; if (s < f) { int k = max(0, t - s + 1); k...
#include <bits/stdc++.h> using namespace std; const int MAX = 2e5 + 5; const int MOD = 998244353; long long p[MAX]; long long mpow[MAX]; int main(int argc, char* argv[]) { if (argc == 2 or argc == 3) freopen(argv[1], r , stdin); if (argc == 3) freopen(argv[2], w , stdout); int n, m; string...
#include <bits/stdc++.h> using namespace std; long long x, y, z, arr[100 * 100005], rearr[100 * 100005]; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); ; cin >> x >> y; for (int i = 0; i < x; i++) { cin >> z; arr[z]++; } z = 0; for (int i = 1e7; i >= 1; i--)...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, q = 0; cin >> n >> m; int k = n * m; char a[k]; for (int j = 0; j < k; j++) { cin >> a[k]; if (a[k] == M || a[k] == Y || a[k] == C ) { q = 1; } } if (q == 1) { cout << #Color << en...
/* * 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:1108864220 ) using namespace std; const int MOD = 1000000007; const int INF = 1000000000; const double EPS = 1e-9; const int HASH_POW = 29; const long double PI = acos(-1.0); mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().c...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); vector<int> a(5); string s; long long q = 0; for (int i = 1; i < 5; ++i) { cin >> a[i]; } cin >> s; for (int i = 0; i < (int)s.size(); ++i) { q += a[s[i] - 0 ]; } cout << q; ...
#include <bits/stdc++.h> using namespace std; int a[23][23]; char s[23][23]; int dp[1 << 23]; int n, m; int cost[23][23]; int st[23][23]; int main() { scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) scanf( %s , s[i]); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) scanf( %d...
module sm (); localparam STATES = 7; localparam /* synopsys enum states */ IDLE = 0, // '001 READ = 1, // '002 THINK = 2, // '004 SEND = 3, // '008 WAIT = 4, // '040 GET_ACK = 5, // '080 WAIT_REGBUS = 6; // '100 reg [STATES-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; vector<int> spl; int p[2000006]; void prime() { p[0] = p[1] = 0; for (int i = 2; i < 1420; i++) { if (!p[i]) { spl.push_back(i); for (int j = i * i; j < 2000006; j += i) p[j] = i; } } } int n, q; int a[100005]; vector<...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, m, x; cin >> n >> m; vector<long long> vPref(n), vSuf(n), vTot(n), vCen(n); for (int i(0), ThkMk(n); i < ThkMk; ++i) { cin >> x; vector<long long...
#include <bits/stdc++.h> using namespace std; using INT = unsigned long long; const int N = 100000; struct Ring { INT a[5]; Ring() { memset(a, 0, sizeof a); } Ring operator+(Ring r) { Ring R = r; for (int i = 0; i < 5; i++) R.a[i] += a[i]; return R; } void operator+=(Ring r...