text
stringlengths
59
71.4k
module arm9_soft( input coe_M1_RSTN, coe_M1_CLK, output rso_MRST_reset, output cso_MCLK_clk, output [31:0] avm_M1_writedata, input [31:0] avm_M1_readdata, output [29:0] avm_M1_address, output [3:0] avm_M1_byteenable, output avm_M1_write, output avm_M1_read, output avm_M1_begintransfer, input ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int a[100005], n, k; bool cmp(int x, int y) { return x % 10 > y % 10; } int main() { cin >> n >> k; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n, cmp); for (int i = 0; i < n; i++) { if (a[i] % 10 == 0 || k < 10 - a[i] % 10) break; ...
//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...
/** * 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; #pragma comment(linker, /STACK:36777216 ) template <class T> void chmax(T& l, const T r) { l = max(l, r); } template <class T> void chmin(T& l, const T r) { l = min(l, r); } void reader(int& x) { int k, m = 0; x = 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...
#include <bits/stdc++.h> using namespace std; int n, m; void update(int *c, int x, int v) { while (x <= m) { c[x] += v; x += x & -x; } } long long sum(int *c, int x) { long long ret = 0; while (x > 0) { ret += c[x]; x -= x & -x; } return ret; } long long cal...
// Copyright (C) 1991-2011 Altera Corporation // 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 from any of the foregoing // (including device programming or simulation files), and any // associated docume...
/* Module: nes_controller Description: Fetches nes controller buttons and returns them as an array of 8 stored in buttons. A FSM is implemented to fetch data, also taking into account the correct clock speed by scaling down the clock slow enough for the controller to read ...
`timescale 1ns / 1ps module Sine_Cosine_CORDIC_tb; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% parameter W=32, W_Exp = 8, W_Sgf = 23, S_Exp = 9; //declaration of signals //Input Signals reg clk; ...
/* Distributed under the MIT license. Copyright (c) 2015 Dave McCoy () 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, mo...
#include <bits/stdc++.h> using namespace std; const int N = 5010; inline int read() { int s = 0, w = 1; register char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) s = (s << 3) + (s << 1) + (ch ^ 48), ch...
#include <bits/stdc++.h> using namespace std; int n, m; string a[33]; int z[33][33]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cerr.tie(nullptr); cin >> n >> m; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) for ...
#include <bits/stdc++.h> using namespace std; struct unionfind_t { vector<int> parent, rank; unionfind_t(int n) : parent(n), rank(n, 0) { iota(parent.begin(), parent.end(), 0); } int find(int v) { if (parent[v] == v) return v; return parent[v] = find(parent[v]); } int join(...
#include <bits/stdc++.h> using namespace std; int n, x, m, y; int main() { int i, j, k, flag; long long ans; int l1, l2, r1, r2, l, r; int cnt; while (scanf( %d%d%d%d , &n, &x, &m, &y) != EOF) { if (x > y) { k = x; x = y; y = k; } ans = 1; flag =...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; bool b1[N]; int Z, num[N], in[N], dp[N][20], dep[N], freq[2][N], f[N]; long long fans[N]; vector<int> g[N], v; map<int, int> mp; struct qq { int in, l, r, c; qq(int a, int b, int e, int d) { in = a, l = b, r = e, c = d; } b...
#include <bits/stdc++.h> using namespace std; long long modpow(long long a, long long n, long long temp) { long long res = 1, y = a; while (n > 0) { if (n & 1) res = (res * y) % temp; y = (y * y) % temp; n /= 2; } return res % temp; } long long ison(long long mask, long long po...
// megafunction wizard: %LPM_MULT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_mult // ============================================================ // File Name: cx4_mul.v // Megafunction Name(s): // lpm_mult // // Simulation Library Files(s): // lpm // =============================================...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; set<int> s; for (int i = 0, x; i < n; i++) { cin >> x; s.insert(((x + i) % n + n) % n); } puts(s.size() == n ? YES : NO ); } 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 law...
#include <bits/stdc++.h> using namespace std; long long numC[200011]; long long numQ[200011]; long long numBC[200011]; long long numBQ[200011]; long long numQC[200011]; long long numQQ[200011]; long long triple(int n) { if (n < 0) return 0; if (n == 1) return 3; if (n == 0) return 1; lon...
#include <bits/stdc++.h> using namespace std; const int INF = numeric_limits<int>::max(); int n; vector<int> d, a; int get_longest(int l) { vector<int> d; while (l > a.size()) for (int i = 0; i < n; ++i) a.push_back(a[i]); d.assign(l + 10, INF); d[0] = -INF; for (int i = 0; i < l; ++...
#include <bits/stdc++.h> using namespace std; int Count(int ar[], int m, int n) { int count = 0, i; for (i = 0; i < n; i++) { if (ar[i] == m) { count++; } } return count; } void change(int br[], int ar[], int n, int clr, int d, int m) { int count = 0, i; for (i = 0; i...
#include <bits/stdc++.h> using namespace std; const int N = 105; int S[N], E[N], T[N], C[N]; int t[N], W[N]; int main() { int n, m; scanf( %d %d , &n, &m); int i; for (i = 1; i <= n; i++) { t[i] = 1006; W[i] = -1; } for (i = 1; i <= m; i++) { scanf( %d %d %d %d , &S[i...
#include <bits/stdc++.h> using namespace std; const int N = 66666; const int M = 55; const int sM = 105; const int inf = 1e9 + 7; const double pi = acos(-1); inline int read() { int x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { long long a, b, x, y; cin >> a >> b >> x >> y; long long distX = x - a, distY = y - b; cout << distX * distY + 1 << n ; } }
#include <bits/stdc++.h> using namespace std; template <class T> inline void umin(T &a, T b) { a = min(a, b); } template <class T> inline void umax(T &a, T b) { a = max(a, b); } const int INF = 0x3f3f3f3f; long long mod = 1e9 + 7; const int N = 100005; char s[N]; struct Trie { static...
/** * 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 int N = 1e5 + 100; const int M = 1e9 + 100; long long a[N]; int main() { int n, m; long long x, y; while (~scanf( %d %d , &n, &m)) { x = -M; y = M; for (int i = 0; i < n; i++) { scanf( %lld , &a[i]); x = max(a[i]...
#include <bits/stdc++.h> using namespace std; string getbiner(long long n) { string ret = ; while (n) { if (n % 2) ret += 1 ; else ret += 0 ; n /= 2; } return ret; } long long getnum(string s) { long long ret = 0; long long now = 1; cout << t ...
// 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...
/* * Copyright (c) 2002 Stephen Williams () * * 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; long long n, i; long long a[2019]; int b[2100], ok[2100]; const int MAXN = 2000; long long C[MAXN + 1][MAXN + 1]; void init() { int i, j; for (i = 0; i <= MAXN; ++i) { C[0][i] = 0; C[i][0] = 1; } for (i = 1; i <= MAXN; ++i) { ...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps/1ps `default_nettype none module timestamp_core #( parameter ABUSWIDTH = 1...
#include <bits/stdc++.h> using namespace std; const int N = 15; const int K = 500; int a[N][N]; const int INF = 1e9 + 7; int calc(int x, int y, int h, int w) { int cnt = 0; for (int i = x; i < x + h; i++) { for (int j = y; j < y + w; j++) { cnt += a[i][j]; } } return cnt;...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef string str; #define pb push_back #define ppp pop_back #define pii pair<int,int> #define fi first #define se second #define stie std::tie #define vec vector #define forn(i, l, r) for (int i=l; i...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; struct Edge { int to, nxt; } e[N << 1]; int h[N], idx, a[N]; void Ins(int a, int b) { e[++idx].to = b; e[idx].nxt = h[a]; h[a] = idx; } long long dis[N], siz[N]; void dfs(int u, int fa) { siz[u] = a[u]; for (...
#include <bits/stdc++.h> using namespace std; int id[200005], sz[200005]; vector<pair<int, int> > edges; int n, m, s1, s2, l1, l2; bool bad(int x) { return x == s1 || x == s2; } bool cmp(pair<int, int> p1, pair<int, int> p2) { bool b1 = bad(p1.first) || bad(p1.second); bool b2 = bad(p2.first) || bad...
/* * 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> const int md = 1e9 + 7; const long long hs = 199; const long double eps = 1e-9, pi = acos(-1); using namespace std; struct node { int val, x, y; node(int _v = -1, int _x = -1, int _y = -1) { val = _v, x = _x, y = _y; } }; struct query { int t, x, y; query(int _t = ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2012.2 // Copyright (C) 2012 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps mod...
`include "defines.v" module brouter #(parameter addr = 4'b0101) ( input `control_w port0_ci, input `control_w port1_ci, input `control_w port2_ci, input `control_w port3_ci, input `control_w port4_ci, input `data_w port0_di, input `d...
/* * 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:10:55 03/06/2016 // Design Name: // Module Name: mult4 // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenc...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2014 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ Version : 201...
#include <bits/stdc++.h> using namespace std; long long int a[200005]; long long int dist[200005]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long int n; cin >> n; for (long long int i = 0; i < n; i++) dist[i] = INT_MAX; for (long long int i = ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; if (m == 0) { cout << n << n ; return 0; } string hint[m]; getline(cin, hint[0]); vector<vector<string> > h(m); for (int i = 0; i < m; i++) { getline(cin, hint[i]); stringstr...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Mon Feb 20 13:53:58 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; long long a[18] = {0}; long long int get(long long int n, int l) { if (!n) return 0; if (l == 1) return n; long long int t = a[l]; if (n == t) return l; if (n < t) return min(get(n, l - 1), l + get(t - n, l - 1)); else return min((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...
/* * 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 09/05/2016 04:17:53 PM // Design Name: // Module Name: pipelined_multiplier // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencie...
// -------------------------------------------------- // // Multi-input router controller // // Router controller which takes multiple sources of traffic // via input FIFOs, arbitrates amongst the sources of traffic // that have data to transfer, and then delivers the data to // the output FIFO controller. The delay p...
/* * Copyright (c) 2000 Intrinsity, Inc. * * 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; long long n, k; long long ans; long long matriz[505][505]; int main() { ans = 0; cin >> n >> k; long long aux = (n - k + 1) * n; aux = n * n - aux + 1; long long curr1 = 1; long long curr2 = aux; for (int i = 0; i < n; ++i) { int ...
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); int n1 = n, dig, x = 0, y = 0, z = 0, r; while (n1 > 0) { dig = n1 % 10; if (dig != 4 && dig != 7) { x++; break; } n1 = n1 / 10; } if (x == 0) { printf( YES ); z++; } else if (...
module crc_gen ( input Reset, input Clk, input Init, input [7:0] Frame_data, input Data_en, input CRC_rd, output [31:0] CRC_out, output reg CRC_end ); reg [31:0] CRC_reg; reg [3:0] Counter; function[31:0] NextCRC; input[7:0] D; input[31:0] C; reg[31:0]...
#include <bits/stdc++.h> using namespace std; int n, a, b; int main() { cin >> n >> a >> b; n -= a; b++; cout << (n > b ? b : n); return 0; }
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2014 Francis Bruno, All Rights Reserved // // 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 Found...
#include <bits/stdc++.h> using namespace std; inline bool equal(double _x, double _y) { return _x > _y - 1e-9 && _x < _y + 1e-9; } int l[105], r[105], t[105], c[105], ans, mx, id; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < m; i++) scanf( %d%d%d%d , &l[i], &r[i], &t[i], &...
#include <bits/stdc++.h> using namespace std; long long int n, m, a[1000005]; multiset<long long int> st; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin >> n; for (long long int i = 1; i <= n; i++) cin >> a[i]; long long int ans = 0; for (long long int i = 1; i <= n; i++) {...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: cmp_pcxandcpx.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 and...
/* * Some more detailed tests of the abs() function. * * Copyright (C) 2007-2008 Cary R. () * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * ...
#include <bits/stdc++.h> using namespace std; void solve(void) { int N; long int s = 0; cin >> N; for (int i = 2; i <= N; i++) s += i - 1; cout << s * 6 * 2 + 1 << endl; } int main(int argc, char const *argv[]) { solve(); return 0; }
#include <bits/stdc++.h> using namespace std; long long int d[400001], num[400001]; int decr[400001], inc[400001]; priority_queue<pair<long long int, int>, vector<pair<long long int, int> >, greater<pair<long long int, int> > > H1; priority_queue<pair<long long int, int> > H2; int mai...
#include <bits/stdc++.h> using namespace std; struct node { int go[2], sum; node(int x0, int x1, int _sum) { go[0] = x0, go[1] = x1, sum = _sum; } }; node root(-1, -1, 0); vector<node> t = {root}; int get_sum(int v) { return v == -1 ? 0 : t[v].sum; } int go(int v, int id) { if (t[v].go[id] == ...
#include <bits/stdc++.h> class Scanner { private: static const int BUFFER_SIZE = 10000; char buff[BUFFER_SIZE]; int buffPos, buffLim; public: Scanner() { buffLim = fread(buff, 1, BUFFER_SIZE, stdin); buffPos = 0; } private: inline void flushBuff() { buffLim = f...
#include <bits/stdc++.h> using namespace std; const int maxn = 1000010; int n, m, cnt, head[maxn], vis[maxn], mark[maxn], ans[maxn], tot; struct edge { int to, next; } e[maxn]; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = ...
#include <bits/stdc++.h> using namespace std; template <typename T> bool chmax(T &x, const T &y) { return (x < y) ? (x = y, true) : false; }; template <typename T> bool chmin(T &x, const T &y) { return (x > y) ? (x = y, true) : false; }; constexpr long long int MOD = 10; constexpr long long in...
// limbus_mm_interconnect_0_avalon_st_adapter_006.v // This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 15.1 185 `timescale 1 ps / 1 ps module limbus_mm_interconnect_0_avalon_st_adapter_006 #( parameter inBi...
/* * Copyright (c) 2000 Stephen Williams () * * 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 main() { ios::sync_with_stdio(false); int n, x; vector<int> a, b, c; cin >> n; for (int i = 0; i < n; i++) { cin >> x; if (x == 1) a.push_back(i + 1); else if (x == 2) b.push_back(i + 1); else c.pus...
#include <bits/stdc++.h> using namespace std; const int maxn = 10000001; int a, n, x[maxn]; int main() { scanf( %d%d , &a, &n); for (int i = a; i <= a + n - 1; i++) x[i] = i; for (int i = 2; i * i <= a + n - 1; i++) { int p = i * i; int t = ((a + p - 1) / p) * p; for (int j = t; j ...
#include <bits/stdc++.h> using namespace std; int pos[109], npos[109]; int main() { int n, k; cin >> n >> k; for (int i = 1; i <= n; ++i) pos[i] = i; for (int i = 1; i <= k; ++i) { int cnt; cin >> cnt; int el = (1 + cnt) % n; if (el == 0) el = n; cout << pos[el] << ...
/* * 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...
/* * This tests the synthesis of a case statement that has an empty case. */ module main; reg clk, bit, foo, clr; // Synchronous device that toggles whenever enabled by a high bit. always @(posedge clk or posedge clr) if (clr) foo = 0; else case (bit) 1'b0: ; 1'b1: foo <= ~foo; ...
/* * 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...
/* * 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...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 3; const int mod = 998244353; int n; map<int, int> a; char s[N]; long long ans = 0; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %s , s + 1); int x = 0, l = strlen(s + 1); for (int j = 1; j...
#include <bits/stdc++.h> using namespace std; int max(int a, int b) { if (a > b) return a; else return b; } long long min(long long a, long long b) { if (a < b) return a; else return b; } int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int lcm(int a, in...
#include <bits/stdc++.h> using namespace std; struct bigint { int len, num[70]; bigint(int m = 0) { memset(num, 0, sizeof num); len = 1; num[1] = m; } bigint operator+(const bigint &b) { bigint c; c.len = max(len, b.len); int x = 0, y = 0; for (int i = 1; i ...
#include <bits/stdc++.h> using namespace std; string s; int n, i, k = 0; int main() { cin >> s; for (i = 0; i < s.size(); i++) { while (s[i] == s[i + 1] && s.size()) { s.erase(i, 2); i--; k++; } } if (k % 2 != 0) cout << YES << endl; else if (k % 2...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2005 by Wilson Snyder. module t (clk); input clk; reg [7:0] crc; wire [61:59] ah = crc[5:3]; wire [61:59] bh = ~crc[4:2]; wire [41:2] al = {crc,crc,crc,crc,crc}; ...
/* * 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() { int n, c = 0; string s; cin >> n >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == 1 ) c++; else { c++; break; } } cout << c; return 0; }
#include <bits/stdc++.h> using namespace std; inline int read() { int sum = 0, ff = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) ff = -1; ch = getchar(); } while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar(); return sum * ff; } int Q, n, a[10005], ...
#include <bits/stdc++.h> using namespace std; bool bi[12][12]; int main() { int a, b, c, d, e, x, y, z, n, k, N, M; scanf( %d %d , &N, &M); scanf( %d %d , &z, &k); for (a = 0; a < z; a++) { scanf( %d %d , &x, &y); bi[x][y] = true; } z = 0; for (a = 1; a <= N; a++) { f...
`timescale 1ns / 1ps /* * File : RegisterFile.v * Project : University of Utah, XUM Project MIPS32 core * Creator(s) : Grant Ayers () * * Modification History: * Rev Date Initials Description of Change * 1.0 7-Jun-2011 GEA Initial design. * * Standards/Formatting: * V...
#include <bits/stdc++.h> using namespace std; vector<int> q[100002]; int ans[100002]; int flag, v[100002]; int k; void dfs(int len, int x, int f) { int i; v[x] = len; ans[len] = x; for (i = 0; i < q[x].size(); i++) { int j = q[x][i]; if (j == f) continue; if (v[j] != -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...
/** * 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: 01:04:28 04/05/2016 // Design Name: // Module Name: ALU_1bit_overflow // Project Name: // Target Devices: // Tool versions: // Description: // ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11/18/2016 01:33:37 PM // Design Name: // Module Name: scaler // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision: // R...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 7; const long long llinf = 1ll * inf * inf; const double eps = 1e-12; const int N = 1e5 + 10; int f[N], h[N], g[N]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= int(n); ++i) scanf( %d , &f[i]); map<int, vector...
/* * 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; long long a[300005]; string s, p; vector<long long> v; int main() { ios_base::sync_with_stdio(false); long long i, j, k, l, m, x, y, r, n, t; cin >> n >> m; for (i = 1; i <= n; i++) { cin >> x; if (x < 300005) a[x] = 1; } long l...
#include <bits/stdc++.h> using namespace std; string s1, s2; int len1, len2; int dp[5002][5002]; int func(int p1, int p2) { if ((p1 == len1) || (p2 == len2)) { return 0; } if (dp[p1][p2] != -1) { return dp[p1][p2]; } int ans = 0; if (s1[p1] == s2[p2]) { ans = (1 + ans...
#include <bits/stdc++.h> using namespace std; template <class T> inline string itos(T n) { return (n) < 0 ? - + itos(-(n)) : (n) < 10 ? (string)( ) + (char)( 0 + (n)) : itos((n) / 10) + itos((n) % 10); } string name[60]; map<string, int> mp; int point[60], _plus...