text
stringlengths
59
71.4k
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int v[26][N]; int main() { int n; cin >> n; string s; for (int i = 0; i < n; ++i) { cin >> s; for (int j = 0; j < s.size(); j++) if (s[j] != ? ) v[s[j] - a ][j]++; } string ans = ; int pos = ...
#include <bits/stdc++.h> using namespace std; const int N = 400000 + 10; const int M = 26; namespace Trie { int trie[N][M], cnt[N], size; void init() { size = 0; memset(trie[0], 0, sizeof(trie[0])); cnt[0] = 0; } void insert(char str[]) { int u = 0, v; for (int i = 0; str[i]; i++) { ...
/******************************************************************************* * 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 ...
module peripheral_ultrsnd (clk , reset , d_in , cs , addr , rd , wr, d_out, echo, done, trigger, [15:0]distance); input clk; input rst; input [15:0]d_in; input cs; input [3:0]addr; // 4 LSB from j1_io_addr input rd; input wr; output reg [15:0]d_out; input echo; output trigger //--------...
#include <bits/stdc++.h> template <typename T> inline bool MIN(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template <typename T> inline bool MAX(T &a, const T &b) { return a < b ? a = b, 1 : 0; } using namespace std; int n, m, K, p; int exgcd(int a, int b, int &x, int &y) { if (b ==...
// // Copyright (c) 2012 Simon W. Moore // Copyright (c) 2013 Jonathan Woodruff // All rights reserved. // // This software was developed by SRI International and the University of // Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 // ("CTSRD"), as part of the DARPA CRASH research programme. //...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; const int inf = 0x3f3f3f3f; const long long INF = 0x3f3f3f3f3f3f3f3f; const int mod = 1000000007; const double eps = 1e-6; const double PI = acos(-1); int tar, n, tot, a[N], hs[N], cnt[N], mx[N], now[N]; vector<int> vc; bool check(...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, k; cin >> n >> k; map<char, long long> mp; for (long long i = 0; i < n; i++) { char x; cin >> x; mp[x]++; } vector<pair<lo...
#include <bits/stdc++.h> #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) const long long INF = 0x3f3f3f3f3f3f3f3f; const long long llinf = (1LL << 62); const int inf = (1 << 30); const long long nmax = 5e5 + 50; const int mod = 1e9 + 7; using namespac...
#include <bits/stdc++.h> using namespace std; int n; int a[200000 + 5]; vector<int> g[200000 + 5]; int cnt = 0; void dfs(int x, int fa) { cnt++; if (cnt > n) return; printf( %d , x); for (int i = 0; i < g[x].size(); i++) { int y = g[x][i]; if (y == fa) continue; dfs(y, x);...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16000000 ) using namespace std; const int Maxn = 1000005; const int Maxm = 4194304; const int Inf = 1000000000; int n, c; pair<int, int> lef[Maxn], rig[Maxn]; int me[Maxn]; int res[Maxn], rlen; int st[Maxm]; void Insert(int v, int l, int r, ...
module dct_ctrl( clk, rst, i_valid, i_transize, i_valid_4, i_transize_1, i_transize_2, i_transize_3, i_transize_4 ); // ******************************************** // // INPUT / OUTPUT DECLARATION ...
/* * 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...
/* * 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 hv[5]; map<string, int> dys; string dyi[5] = { S , M , L , XL , XXL }; int order[5][5] = {{0, 1, 2, 3, 4}, {1, 2, 0, 3, 4}, {2, 3, 1, 4, 0}, {3, 4, 2, 1, 0}, {4, 3, 2, 1, 0...
//================================================================================================== // Filename : subRecursiveKOA_1c.v // Created On : 2016-10-27 23:29:04 // Last Modified : 2016-10-31 11:41:40 // Revision : // Author : Jorge Esteban Sequeira Rojas // Company : Institut...
#include <bits/stdc++.h> using namespace std; long long vet[9], used[9], available[9]; int dp[100][32]; int dp2[100][32]; vector<int> itens, itens2; void comp() { for (int i = 1; i <= 8; i++) { long long j = 1; used[i] = min(used[i], (long long)32 / i); while (used[i]) { itens....
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2011 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 distribut...
#include <bits/stdc++.h> using namespace std; int const N = 1e5 + 5; int di[] = {1, 1, -1, -1}; int dj[] = {1, -1, 1, -1}; long long n, k; long long solv() { long long st = 0, ed = k, ans; while (st <= ed) { long long x = (k * (k + 1)) / 2; long long mid = (st + ed) / 2; long long ...
/* * Copyright (c) 2003 Michael Ruff (mruff @ chiaro.com) * * This source code is free software; rou 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 ro...
#include <bits/stdc++.h> using namespace std; int kor = 1e7; int main() { long long n, rad, v; cin >> n >> rad >> v; for (int i = 0; i < n; i++) { int l, r; cin >> l >> r; long long d = r - l; int ma = 0; while (d < kor) { d *= 10; rad *= 10; ma++;...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int mc = 0, i = 1, j = n; while (1) { cout << i << ; mc++; if (mc == n) break; cout << j << ; i++; j--; mc++; if ...
Require Import Fiat.Common Fiat.Computation Fiat.ADT Coq.Sets.Ensembles. Generalizable All Variables. Set Implicit Arguments. Section MethodRefinement. (** Old and new representations **) Variables oldRep newRep : Type. (** Abstraction Relation *) Variable AbsR : oldRep -> newRep -> Prop. Notation "ro ≃ ...
/** * 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-2013 Altera Corporation, San Jose, California, USA. * ...
/* Copyright (c) 2014 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,...
/* * Milkymist 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 distribut...
/* * 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...
#include <bits/stdc++.h> typedef struct { long long s, l, r, m; } value; long long maxll(long long a, long long b) { return a > b ? a : b; } void sum(value *v, value *l, value *r) { v->s = l->s + r->s; v->l = maxll(l->l, l->s + r->l); v->r = maxll(r->r, r->s + l->r); v->m = maxll(l->r + r->l...
#include <bits/stdc++.h> using namespace std; const int inf = 2e9; const int mod = 1e9 + 7; const int N = 1234; int n, m; long long k; int a[N][N], h[N * N], p[N * N]; long long b[N][N]; bool used[N][N]; vector<pair<int, int> > go = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; bool check(int x, int y) { re...
#include <bits/stdc++.h> using namespace std; int N, M; signed long long L[100020], R[100020], T[100020]; signed long long Q[100020]; vector<pair<signed long long, signed long long> > QP; signed long long PP[200200]; signed long long AS[200200], BS[200200], ret[200200]; vector<signed long long> S[200200...
#include <bits/stdc++.h> using namespace std; long long GCD(long long a, long long b) { if (b) return GCD(b, a % b); return a; } bool u1[10]; bool u2[10]; int main() { long long n, m, v; vector<long long> a, b; ios_base::sync_with_stdio(0); cin >> n >> m; for (long long i = 0; i ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int k1, k2, k3; cin >> k1 >> k2 >> k3; int n = k1 + k2 + k3; int maps[n]; for (int i = 0; i < n; i++) { int inp; cin >> inp; inp--; if (i < k1) ...
#include <bits/stdc++.h> using namespace std; int a[100005]; int main() { int n, k, sum = 0; scanf( %d%d , &n, &k); for (int i = 0; i < n; i++) { scanf( %d , a + i); sum += a[i]; } sort(a, a + n); int res = a[n - 1]; for (int t = n - k, i = n - k - 1; i >= 0; i--, 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 la...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:14:09 03/08/2014 // Design Name: // Module Name: obc1 // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revision: // ...
#include <bits/stdc++.h> using namespace std; const long double eps = (long double)1e-9; const long double PI = (long double)acos(-1.0); const int inf = 1e9 + 5; const long long linf = 1e18L + 5; const int mod = 1e9 + 7; void solve() { int n, q, r, c; cin >> n >> q; unordered_set<int> s[3]; ...
/* * Copyright (c) 2015-2017 The Ultiparc Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list...
#include <bits/stdc++.h> using namespace std; int N, K; int h[100005]; bool isok[100005]; int check(int L) { deque<int> A, B; int ret = 0; for (int i = 1; i <= N; ++i) { while (A.size() && A.front() + L <= i) A.pop_front(); while (B.size() && B.front() + L <= i) B.pop_front(); wh...
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 9, B = 511; inline long long read() { long long res = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { res = (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...
/* * 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...
`define ADDER_WIDTH 016 `define DUMMY_WIDTH 128 `define 3_LEVEL_ADDER module adder_tree_top ( clk, isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1, sum, ); input clk; input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 20; int h[maxn], n, q, cnt; string s; struct Node { int ans, mx, mn, l, r, lazy; Node(int a = 0) { ans = mn = mx = l = r = lazy = a; } void update(Node a, Node b) { ans = max({a.ans, b.ans, a.l + b.mx, b.r + a.mx}); m...
#include <bits/stdc++.h> using namespace std; int N, M; bitset<2020> mat[2020]; int main() { int T; scanf( %d , &T); while (T--) { scanf( %d%d , &N, &M); vector<pair<int, int> > E; int deg[2020] = {}; for (int i = 1; i <= M; i++) { int x, y; scanf( %d%d , &x, ...
#include <bits/stdc++.h> using namespace std; const int maxN = 2 * 1000 * 100 + 100; const int maxS = 4 * maxN; vector<int> seg[maxS]; int f[maxS], toxor[maxS]; int n; inline vector<int> merge(vector<int> a, vector<int> b) { for (auto x : b) { for (auto y : a) if (x & (y & -y)) x ^= y; ...
/** * 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, x, minn = 3; bool m1[100005], m2[100005]; int read() { int w = 0, f = 1; char c = getchar(); while (c > 9 || c < 0 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { w = (w << 3) + (w ...
#include <bits/stdc++.h> using namespace std; int main() { int n1, n2; cin >> n1 >> n2; int k, m; cin >> k >> m; long long a[n1], b[n2]; for (int i = 0; i < n1; i++) cin >> a[i]; for (int i = 0; i < n2; i++) cin >> b[i]; int count = 0; for (int i = 0; i < n1; i++) { if (a[i...
/* * From IEEE 1800-2012 * * 5.8 Time literals * * Time is written in integer or fixed-point format, followed without a space by a * time unit ( fs ps ns us ms s ). * For example: * 2.1ns * 40ps * The time literal is interpreted as a realtime value scaled to the current time * unit and rounded to the cur...
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; const long long N = 2005; void init() {} long long n, m, k; long long dp[N][N]; void solve() { scanf( %lld%lld%lld , &n, &m, &k); dp[1][0] = m; for (long long i = 2; i <= n; i++) { for (long long j = 0; j < i;...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are...
`timescale 1ns / 1ps `default_nettype none ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:02:15 03/12/2015 // Design Name: // Module Name: pal_generator // Project Name: // Target Devices: // Tool versions: // Description...
/* * 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 k, n, root, par[100005]; vector<int> v[100005]; bool vis[100005], fr; void findroot(int u, int l) { int i; if (v[u].size() == 1 && l == 2 * k) { fr = true; root = u; } for (i = 0; i < v[u].size(); i++) { if (fr) break; 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 law...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<long long> a(n); for (long long& v : a) cin >> v; vector<long long> p(n); for (long long& v : p) cin >> v; int m; cin >> m; vector<long long> b(m); ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; vector<vector<int> > v(N); int col[N]; int par[N]; int n; int in[N], out[N]; int timer; bool all_same[N]; bool can[N]; int euler[2 * N]; int tree[8 * N]; int answer = -1; void dfs(int node) { all_same[node] = true; ...
module SuperAdder(a,b,cin,s,cout); input wire [3:0]a; input wire [3:0]b; input wire cin; output wire [3:0]s; output wire cout; wire [3:0]c; wire [3:0]G; wire [3:0]P; assign G[3]=a[3]&&b[3]; assign G[2]=a[2]&&b[2]; assign G[1]=a[1]&&b[1]; assign G[0]=a[0]&&b[0]; assign P[3]=a[3]&&~b[3]||~a[3]&&b[3]; assign...
#include <bits/stdc++.h> using namespace std; double pie = 3.14159265358979323846; bool isPowerOfTwo(long long int n) { if (n == 0) return false; return (ceill(log2l(n)) == floorl(log2l(n))); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int ...
#include <bits/stdc++.h> using namespace std; int bit[100005], n, dt; set<int> ms; vector<int> nums, ops; void add(int pos, int val) { while (pos <= (int)nums.size()) { bit[pos] += val; pos += (-pos) & pos; } } int sum(int pos) { int res = 0; while (pos > 0) { res += bit[...
#include <bits/stdc++.h> using namespace std; int n; char A[200]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) cin >> A[i]; for (int i = 1; i <= n; i++) { for (int j = 1; 4 * j <= n; j++) { if (A[i] == * ) ...
#include <bits/stdc++.h> using namespace std; const long long N = 2e9; long long sum(long long l, long long r) { return (l + r) * (r - l + 1) / 2; } int main() { long long n, H; cin >> n >> H; long long l = H, r = 2e9, ans = -1; while (l <= r) { long long mid = (l + r) >> 1; if (n >=...
#include <bits/stdc++.h> using namespace std; using namespace rel_ops; using ll = int64_t; using Pii = pair<int, int>; using ull = uint64_t; using Vi = vector<int>; void run(); int main() { cin.sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10); run(); return 0; } ...
//***************************************************************************** // (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[100005], b[100005], f[100005], cnt[100005], ans[100005]; int main() { int i, j, k, l, n, m; cin >> n >> m; for (i = 1; i <= n; i++) { cin >> j; if (!cnt[j]) f[j] = i; cnt[j]++; } int flag = 1; l = 1; for (i = 1; i <=...
#include <bits/stdc++.h> using namespace std; void calcula(long long int n, long long int m, long long int r[10000], long long int sumar[10000], long long int k, long long int p) { priority_queue<long long int> q; for (int i = 0; i < n; i++) q.push(r[i]); for (int paso = 1; paso <= k; pas...
#include <bits/stdc++.h> using namespace std; const int MAX = (1 << 22) + 5; int n, m; bool is[MAX], seen[MAX]; int conj(int x) { int r = 0; for (int i = 0; i < n; ++i) if (!(x & (1 << i))) r += (1 << i); return r; } void dfs(int st, bool p = 0) { if (seen[st]) return; seen[st] =...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2016/06/07 20:11:30 // Design Name: // Module Name: _4bit_binary_multiplier // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencie...
#include <bits/stdc++.h> const int maxn = 2e5 + 5; using namespace std; int rd() { int x = 0, f = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) x = (x << 3) + (x << 1) + c - 0 , c = getchar(); return x * f; } int n, ...
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995-2011 Xilinx, Inc. All rights reserved. //////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version : ...
#include <bits/stdc++.h> int main() { int q; std::cin >> q; std::vector<int> V; for (int i = 0; i < q; ++i) { int n; std::cin >> n; std::vector<int> v1; std::vector<int> v2(n); for (int j = 0; j < n; ++j) { std::cin >> v2[j]; v1.push_back(j + 1); } ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fll; map<int, int> memo; int solve(int mask) { if (!mask) return 0; if (memo.find(mask) != memo.end()) return memo[mask]; map<int, bool> canreach; for (int i = 0; i < 32; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a[n]; for (int i = 0; i < n; ++i) cin >> a[i]; m--; int cnt = 0; for (int i = 0; i < n; ++i) if (1) { bool ok = 0; for (int j = i + m; j >= 0 && j >= i - m; --j) if (j ...
/** * 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 mo = 998244353; long long bin_fun(long long chto, long long vkak) { if (vkak == 0) return 1; if (vkak == 1) return chto; if (vkak % 2 == 0) return bin_fun(chto * chto % mo, vkak / 2); else return (bin_fun(chto * chto % mo, vkak / ...
/** * 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() { ios_base::sync_with_stdio(0); int n; cin >> n; long long m_min = 1ll << 62; long long ans = 0; for (int i = 0; i < n; i++) { long long x; cin >> x; ans += x; if (x % 2 == 1) m_min = min(m_min, x); } if...
module fifo_TB; reg clk; reg reset; reg rd; reg wr; reg[7:0] dataint; fifo uttf(.rd(rd),.wr(wr),.din(dataint),.clk(clk),.reset(reset)); always begin clk =1'b1; #10; clk=1'b0; #10; end initial begin reset = 1'b1; #4 reset = 1'b0; end initial begin wr = 1'b0; #34300; wr=1'b1; #343000; wr = 1'b0; #343000; /*wr = 1...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s1 = 0, s2 = 0; cin >> n; vector<int> v1(n); for (int i = 0; i < n; i++) cin >> v1[i]; cin >> m; vector<int> v2(m); for (int i = 0; i < m; i++) cin >> v2[i]; sort(v1.begin(), v1.end()); sort(v2.begin(), v2.end()...
#include <bits/stdc++.h> using namespace std; int n, m; string s; set<string> st; int main() { ios_base::sync_with_stdio(0); cin.tie(0); while (cin >> s) { st.clear(); for (int i = 0; i < s.size(); i++) { string s1 = ; for (int j = 0; j < s.size(); j++) s1 += s[(i + j...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chkmin(T &a, T const &b) { return a > b ? a = b, 1 : 0; } template <class T> inline bool chkmax(T &a, T const &b) { return a < b ? a = b, 1 : 0; } const int M = 35; const int N = 205; const int Mod = 998244353; lo...
#include <bits/stdc++.h> using namespace std; const long long inf = LLONG_MAX / 2; const long long MX = 1e5 + 10; int a[MX]; set<int> s; vector<int> v; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; for (long long(i) = (0); (i) <= (n - 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 law...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:16:05 04/24/2015 // Design Name: // Module Name: StartCastle // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: /...
/** \file "channel-expect-fail.v" Chain a source and sink in prsim to verilog. $Id: $ */ `timescale 1ns/1ps `include "standard.v" module timeunit; initial $timeformat(-9,1," ns",9); endmodule module TOP; reg l0, l1, re; wire le, r0, r1; DELAY #(0.01) d0(l0, r0); DELAY #(0.01) d1(l1, r1); DELAY #(0.01) d...
#include <bits/stdc++.h> int kx[8] = {+2, +2, -2, -2, +1, +1, -1, -1}; int ky[8] = {+1, -1, +1, -1, +2, -2, +2, -2}; int d9x[9] = {+1, +1, +1, +0, +0, +0, -1, -1, -1}; int d9y[9] = {+1, +0, -1, +1, +0, -1, +1, +0, -1}; int dx4[4] = {+0, +0, +1, -1}; int dy4[4] = {+1, -1, +0, +0}; long long int gcd(unsigne...
/* * 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; long long sum[500001], ans; long long solve(long long a, long long b, long long c, long long hh) { if (a < b + c) return 0ll; long long now = min(a - b - c, hh); return (now + 1) * (now + 2) / 2; } int main() { long long a, b, c, l, i; scanf( %...
/* * 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 GCC optimization( unroll-loops ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4 ) using namespace std; const int BASE = 1000000; char what[1 << 20]; pair<int, int> nxt[10][1 << 20]; inline long long Calc(long long x) { long long suff = x /...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11.06.2017 19:09:30 // Design Name: // Module Name: Display // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revis...
#include <bits/stdc++.h> using namespace std; int n, a[60]; int abs(int x) { return x > 0 ? x : -x; } int f(int x) { int sum = 0; for (int i = 0; i < n / 2; ++i) sum += abs(i * 2 + x - a[i]); return sum; } int main() { scanf( %d , &n); for (int i = 0; i < n / 2; ++i) scanf( %d , a + 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...
/* b2d.v - A decoder from 4-bit input to 7seg Displays * * Copyright (c) 2014, Artem Tovbin <arty99 at gmail dot com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This...
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; void qread(int &x) { int neg = 1; x = 0; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) neg = -1; c = getchar(); } while (c >= 0 && c <= 9 ) x = 10 * x + c - 0 , c = getchar(); x *= ne...
/* * 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...