text stringlengths 59 71.4k |
|---|
// Trying to simulate how an automatic naive (non-pipelined) translation
// of _IDIVMOD could work.
module idivmodhw(input clk,
input reset,
input rq,
input [31:0] dividend,
input [31:0] divisor,
... |
#include <bits/stdc++.h> using namespace std; long long int func(vector<vector<long long int>> &d, vector<int> &v, int i, int k) { if (d[k][i - 1] != 0) return d[k][i - 1]; if (k && (i + v[i - 1] <= d[0].size())) { d[k][i - 1] = -1; long long int y = func(d, v, i + v[i - 1],... |
// ICNBC functions
// Copyright (c) 2014 Dominic Spill, Tariq Bashir
// This file is part of Unambiguous Encapsulation
// License: GPL v2
//
`timescale 1ns/1ps
module icnbc
#(parameter N = 3,
parameter depth=1024,
parameter width=N, //same as N
parameter addr_sz=$clog2(depth)
)
(input clk,
in... |
/*
* 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 input() { long long x = 0, f = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) f |= ch == - , ch = getchar(); while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 0 , ch = getchar(); return f ? -x : x; } const int N = 107; string s... |
#include <bits/stdc++.h> using namespace std; const int N = 100010; long long read() { long long x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = (x << 3) + (x << 1) + ch - 0 ; ... |
#include <bits/stdc++.h> using namespace std; template <typename _T> inline void read(_T &f) { f = 0; _T fu = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) { fu = -1; } c = getchar(); } while (c >= 0 && c <= 9 ) { f = (f << 3) + (f << ... |
#include <bits/stdc++.h> using namespace std; const long long int N = 1e6, N2 = 5e3, delta = 46639, mod = 1e9 + 7, oo = 1e16; const long double PI = 3.141592653589793; int main() { long long int n, cnt1 = 1, cnt2 = 1, mx = 0; string s; cin >> n >> s; for (long long int i = 0; i < n; i++) { ... |
// 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 : Wed Mar 01 09:53:17 2017
// Host : GILAMONSTER running 64-bit major release (... |
/**
* 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... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: rep_jbi_sc1_2.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... |
// 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
// bug749
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
genvar g;
for (g=1; g<3; +... |
module GrayToBinary_tb ();
//////////////////////////////////////////////////////////////////////////////
// Module Parameters & Signals
//////////////////////////////////////////////////////////////////////////////
parameter WIDTH = 32;
// Inputs
reg clk; ///< System clock
reg r... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// (C) 1992-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 simulati... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:26:11 07/23/2010
// Design Name:
// Module Name: dac_test
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:... |
#include <bits/stdc++.h> using namespace std; long long t, n, m, u, v, cnt = 0; long long head[400005], depth[200005], visited[200005]; vector<long long> ve[5]; struct edge { long long next; long long to; } e[400005]; queue<long long> q; inline void add_edge(long long u, long long v) { cnt++... |
#include <bits/stdc++.h> using namespace std; int const nMax = 40000; map<pair<int, int>, int> Q; int main() { int n; int ans = 0; scanf( %d , &n); pair<int, int> a; for (int i = 0; i < n; i++) { scanf( %d%d , &a.first, &a.second); if (Q.find(a) == Q.end()) { Q[a] = 1; ... |
////////////////////////////////////////////////////////////////////////////////
//
// PS2-to-Kempston Mouse
// (C) 2017 Sorgelig
//
// 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... |
#include <bits/stdc++.h> const int inf = 1e5 + 10; using namespace std; int main() { int to[5][5]; int a[5]; memset(a, 0, sizeof(a)); memset(to, 0, sizeof(to)); ios::sync_with_stdio(0); int n; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { if (s[i] == 0 ... |
#include <bits/stdc++.h> using namespace std; static int N, K, M, G, U[500003], V[500003], W[500003], fa[500003], sup[500003], dep[500003]; static bool spe[500003]; static vector<pair<bool, int>> edge[500003]; static long long ans; int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); } voi... |
// (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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23.09.2016 08:48:06
// Design Name:
// Module Name: linescanner_image_capture_unit
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Depe... |
/**
* 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 n, a, ns[10005] = {}; cin >> n; for (int i = 0; i < n; i++) { cin >> a; ns[a]++; } int ans = 0; for (int i = 0; i < 10000; i++) { int j = i + 1; while (ns[i] > 1) { for (; j < 10000 && ns[j] != 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... |
//----------------------------------------------------------------------------
//--By Kyle Williams, 11/20/2012-----------------------------------------------------
//--MODULE DESCRIPTION---------------------------------------------------------------
//----------------Simple single Port Ram used to store data----------... |
#include <bits/stdc++.h> using namespace std; int destroy(list<int> row) { int totalDestroyed = 0, lastDestroyed = -1; int combo = 1; while (lastDestroyed != 0) { lastDestroyed = 0; combo = 1; list<int>::iterator it = row.begin(); list<int>::iterator prev = it++; for (; it ... |
//
// Copyright (c) 1999 Thomas Coonan ()
//
// 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)
// ... |
/*
* Copyright (c) 2001 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)
* ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2021 by Geza Lore. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only... |
#include <bits/stdc++.h> using namespace std; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long int TESTS, k, a, n, b, c, d, m, x, i, y, z; cin >> TESTS; while (TESTS--) { cin >> n; cin >> s; long long int ans = n; for... |
#include <bits/stdc++.h> using namespace std; const int sz = 317; int t[100002], a[100002]; int l[100002], r[100002]; long long sum[2][100002]; long long ans[100002]; struct node { int b, r, i; }; bool cmp(node a, node b) { if (a.b != b.b) return a.b < b.b; return a.r < b.r; } int n, k... |
#include <bits/stdc++.h> template <typename element_type> std::vector<element_type> read_vector(int size); using namespace std; int main() { int particles; string direction; while (cin >> particles >> direction) { vector<int> start = read_vector<int>(particles); int best = -1; 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 gi() { int x = 0, c = getchar(); bool f = 0; for (; !isdigit(c); c = getchar()) if (c == - ) f = 1; for (; isdigit(c); c = getchar()) x = x * 10 + (c & 15); return f ? -x : x; } const int N = 300005; const int mod = 998244353; int ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:05:37 11/06/2013
// Design Name:
// Module Name: sound_selector
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:... |
/*
* 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; char seat[10][1005]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int mark = 2000; int flag; for (int i = 0; i < n; i++) { cin >> seat[0][i] >> seat[1][i] >> seat[2][i] >> seat[3][i] >> seat[4][i]; if (... |
/*
* 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 MOD = (long long)1e9 + 7; const long long N = (long long)2e6 + 222; const long long INF = (long long)1e18; const double eps = (double)1e-6; long long n, m, l, r, used[N]; vector<long long> g[N]; set<long long> s; long long cnt = 0; void d... |
#include <bits/stdc++.h> using namespace std; template <class T> long long size(const T& x) { return x.size(); } #pragma GCC optimize( Ofast ) template <class T> T smod(T a, T b) { return (a % b + b) % b; } long long pw(long long a, long long b) { long long res = 1; while (b > 0) { ... |
module wb_stream_reader_cfg
#(parameter WB_AW = 32,
parameter WB_DW = 32)
(
input wb_clk_i,
input wb_rst_i,
//Wishbone IF
input [4:0] wb_adr_i,
input [WB_DW-1:0] wb_dat_i,
input [WB_DW/8-1:0] wb_sel_i,
input wb_we_i ,
... |
// CREDIT:
// John Loomis (http://www.johnloomis.org/)
// http://www.johnloomis.org/digitallab/ps2lab1/ps2lab1.html
module keyboard(keyboard_clk, keyboard_data, clock50, reset, read, scan_ready, scan_code);
input keyboard_clk;
input keyboard_data;
input clock50; // 50 Mhz system clock
input reset;
input read... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:20:54 03/02/2016
// Design Name:
// Module Name: alu
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencie... |
/*
Copyright (c) 2016 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,... |
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/blanc/BUFH.v,v 1.3 2008/11/11 21:41:06 yanx Exp $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
////////////////////////////////////////////////////////... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; int a[m]; for (int i = 0; i < m; ++i) a[i] = 1e7; for (int i = 0; i < n; ++i) { int r, c; cin >> r >> c; a[r - 1] = min(a[r - 1], c); } int ans = 0; for (int i = 0; i < m; ++... |
/**
* 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... |
(* techmap_celltype = "$_NOT_" *)
module _90_lut_not (A, Y);
input A;
output Y;
wire [`LUT_WIDTH-1:0] AA;
assign AA = {A};
\$lut #(
.WIDTH(`LUT_WIDTH),
.LUT(4'b01)
) lut (
.A(AA),
.Y(Y)
);
endmodule
(* techmap_celltype = "$_OR_" *)
module _90_lut_or (A, B, ... |
// Filename: channel_tb1.v
// Author: Danny Dutton
// Date: 03/23/15
// Version: 1
// Description: Module connecting transmit to receive. This uses a clock of
// sufficent period to ensure that the parity gen can keep up.
`timescale 1ns/100ps
module channel_tb1();
reg enable; // Enable for c... |
#include <bits/stdc++.h> using namespace std; template <class T> void mini(T& a, T b) { a = min(a, b); } template <class T> void maxi(T& a, T b) { a = max(a, b); } template <class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> a) { return out << a.first << << a.second; ... |
#include <bits/stdc++.h> using namespace std; int k, n; bool contain_same; string s[5005], t[5005]; bool check(int x, int y) { swap(s[0][x], s[0][y]); for (int i = 1; i < k; ++i) { int dif = 0; for (int j = 0; j < n; ++j) { if (s[0][j] != s[i][j]) ++dif; } if (dif == 2 ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; if (n == 1) cout << m; else if (n - m > m - 1 && n - m != 0) cout << m + 1; else cout << m - 1; return 0; } |
#include <bits/stdc++.h> using namespace std; bool near(long long A, long long B, long long X, long long Y, long long T) { if ((X - Y * T) < 0) return (0); if ((A - B * T) * Y != (X - Y * T) * B) return ((A - B * T) * Y > (X - Y * T) * B); return (B < Y); } int main() { int t1, t2, x1, x2,... |
#include <bits/stdc++.h> using namespace std; unsigned long long int w, v, qt = 0, n; inline unsigned long long int f(unsigned long long int x) { return w * (1 - x) * (1 - x) + v; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> v >> w; char c; while (cin >> c) qt +... |
#include <bits/stdc++.h> const long long INF = 1e18; const long long N = 2e5 + 50; const long long MOD = 1e9 + 7; using namespace std; vector<long long> prime, graph[N]; long long n, k, a[N], m, z; long long POWER(long long base, long long expo) { long long ret = 1; while (expo) { if (expo &... |
#include <bits/stdc++.h> using namespace std; const int maxn = 30; struct Node { int pos, val; bool operator<(const Node& a) const { return val < a.val; } } p[maxn]; int ans[maxn]; int n; int main() { cin >> n; for (int i = 1; i <= n; ++i) cin >> p[i].val, p[i].pos = i; sort(p + 1, p +... |
#include <bits/stdc++.h> using namespace std; const int N = int(1e5) + 500; int n, m, a[N], s, h, mm; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> s; for (int i = 1; i <= n; i++) { cin >> h >> mm; a[++m] = h * 60 + mm; } if (a[1] >= s + 1) { cout <... |
#include <bits/stdc++.h> using namespace std; bool comp(const pair<int, int> &a, const pair<int, int> &b) { if (a.first > b.first) return true; if (a.first == b.first) return a.second > b.second; return false; } int main() { int n; scanf( %d , &n); vector<pair<int, int> > v; for (int... |
#include <bits/stdc++.h> using namespace std; int p[35], d[35], g[35], h[35], w[55], n, a, b, c, s, MOD; bool f[35][35][50005], v[35][35][50005]; int main() { int i, j, k, r = 0, x; scanf( %d%d , &n, &MOD); for (i = 0; i <= 40; i++) { if (i < 10) w[i] = 10 % MOD; else w[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() { int n; cin >> n; while (n--) { int a, s, d; cin >> a >> s >> d; if (a > s) swap(a, s); if (a > d) swap(a, d); if (s > d) swap(s, d); if (s == d) { cout << YES << endl; cout << a << << a <... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2016.1
// Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1 ... |
// (C) 2001-2011 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... |
`default_nettype none
`define CLKFREQ 25000000 // frequency of incoming signal 'clk'
`define BAUD 115200
// Simple baud generator for transmitter
// ser_clk pulses at 115200 Hz
module baudgen(
input wire clk,
output wire ser_clk);
localparam lim = (`CLKFREQ / `BAUD) - 1;
localparam w = $clog2(lim... |
/**
* 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 n, m; cin >> n >> m; vector<pair<int, pair<int, int> > > E(m); { int cnt = 0; for (int i = 0; i < m; i++) { cin >> E[i].first >> E[i].second.first; E[i].second.second = i; if (E[i].second.first == 1) c... |
#include <bits/stdc++.h> using namespace std; long long int sub2(long long int n) { return (n + 3 * n * n) / 2; } int main() { long long int t; cin >> t; vector<long long int> ans; while (t--) { long long int k; cin >> k; long long int m = 0; while (k >= 2) { long l... |
#include <bits/stdc++.h> #define arr(i,n) for(ll i=0;i<n;i++) #define ARR(i,n) for(ll i=n-1;i>=0;i--) #define f(i,a,b) for(ll i=a;i<b;i++) #define F(i,a,b) for(ll i=b-1;i>=a;i--) #define float double #define PI 3.14159265358979323846 #define pb push_back #define mp make_pair #define vi vector<ll> ... |
#include <bits/stdc++.h> using namespace std; const int mx = 8e3; void run_case(void) { int n; cin >> n; vector<int> x(n); for (int i = 0; i < n; i++) cin >> x[i]; int d = x[1] - x[0]; for (int i = 1; i < n - 1; i++) { if (x[i + 1] - x[i] != d) { cout << x[n - 1] << endl; ... |
#include <bits/stdc++.h> using namespace std; long long add(long long a, long long b) { a += b; if (a >= 998244353) { a -= 998244353; } return a; } long long sub(long long a, long long b) { a -= b; if (a < 0) { a += 998244353; } return a; } long long mul(long long... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int N = 110; const int memsize = 20000; struct Node { char val; int kill = 0; Node *failed = NULL; Node *pre = NULL; vector<Node *> child; Node() {} Node(char _val, Node *_pre) : val(_val), pre(_pre) {} int find_char(char c) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int a[10000], b[10000]; for (int n = 0; n < N; n++) { cout << ? << 0 << << n << endl; cin >> a[n]; } for (int n = 0; n < N; n++) { cout << ? << n << << 0 << endl; cin >> b[n]; ... |
#include <bits/stdc++.h> using namespace std; int c[110]; int main() { int n, i, x, y, j; cin >> n; for (i = 0; i < n; i++) { cin >> x; for (j = 0; j < x; j++) { cin >> y; c[y]++; if (c[y] == n) { cout << y << ; } } } return 0; }... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200000 + 10; int num[maxn], ans; void Solve() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , num + i); sort(num + 1, num + 1 + n); int nn = unique(num + 1, num + 1 + n) - (num + 1); for (int i = 1; i <= nn... |
/*
* 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 a[1005], b[1005]; int x[1005], y[1005]; int main() { int n; while (scanf( %d , &n) != EOF) { memset(x, 0, sizeof(x)); memset(y, 0, sizeof(y)); for (int i = 0; i < n; ++i) { scanf( %d%d , &a[i], &b[i]); x[a[i]]++; ... |
#include <bits/stdc++.h> using namespace std; int k[10] = {2, 7, 2, 3, 3, 4, 2, 5, 1, 2}; int main(void) { int n; scanf( %d , &n); int x = n / 10, y = n % 10; printf( %d n , k[x] * k[y]); } |
#include <bits/stdc++.h> int main() { unsigned short x; std::cin >> x; (x > 1) ? std::cout << x << << x : std::cout << -1; } |
`timescale 1ns / 1ps
//-----------------------------------------------------
// Design Name : syn_fifo
// File Name : syn_fifo.v
// Function : Synchronous (single clock) FIFO
// Coder : Deepak Kumar Tala
//-----------------------------------------------------
module syn_fifo (
clk , // Clock input
rst ... |
/*
Teak synthesiser for the Balsa language
Copyright (C) 2007-2010 The University of Manchester
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 opti... |
#include <bits/stdc++.h> using namespace std; bool visited[100005] = {0}; vector<int> v[100005]; int color[100005]; int dfs(int s) { int result = 0; visited[s] = 1; for (int i = 0; i < v[s].size(); i++) { if (!visited[v[s][i]]) { if (color[v[s][i]] != color[s]) result += (1... |
#include <bits/stdc++.h> using namespace std; long long int a1, b1, a2, b2; int main() { scanf( %lld %lld , &a1, &b1); scanf( %lld %lld , &a2, &b2); long long int p, q, ans = 0; p = (a1 * b1); q = (a2 * b2); long long int tp = 0, tq = 0, thp = 0, thq = 0; while ((p % 3) == 0) { p... |
// header_detector.v
module header_detector
(
input clk,
input reset,
input [1:0]din,
output reg davail,
output reg [3:0]dout,
output reg tbm_hdr,
output reg tbm_trl,
output reg roc_hdr
);
reg [4:0]timeout;
wire active = timeout[4];
// --- data path -----------------------------... |
`include "defines.vh"
module divrem #(
parameter WIDTH_LOG = 4
) (clk, go, rst, num, den, ready, error, quot, rem);
localparam WIDTH = 1 << WIDTH_LOG;
localparam HI = WIDTH - 1;
input clk;
input go;
input rst;
input [HI:0] num;
input [HI:0] den;
output reg ready;
output reg error;
output reg [HI:0] quot;
output re... |
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c; cin >> a >> b >> c; vector<long> v; for (int i = 1; i <= 81; i++) { long long sum = i; for (int j = 2; j <= a; j++) sum *= i; sum *= b; sum += c; if (sum > 0 && sum < 1000000000) { ... |
/*
* 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... |
/*
* Check that the initial value can be out of range and that the next()/prev()
* enumeration methods do not change to a defined state.
*/
module top;
reg pass;
enum bit [3:0] {a2 = 1, b2 = 2, c2 = 3, d2 = 4} evar2;
enum reg [3:0] {a4 = 1, b4 = 2, c4 = 3, d4 = 4} evar4;
initial begin
pass = 1'b1;
... |
/**
* 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 n; cin >> n; int arr[n]; for (int i = 0; i < n; ++i) { cin >> arr[i]; } for (int j = 0; j < n; ++j) { if (arr[j] == 0) if (j == (n - 1)) cout << EASY << endl; else continue; ... |
#include <bits/stdc++.h> using namespace std; char buf[2000]; int dx[4] = {0, 0, -1, 1}; int dy[4] = {-1, 1, 0, 0}; int n, m; pair<int, int> tbl1[1 << 23]; pair<int, int> tbl2[1 << 23]; const int Prime1 = 262139, Prime2 = 40999999; const int Prime3 = 100003, Prime4 = 40999799; const pair<int, int> Z... |
// 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;
integer cyc; initial cyc=1;
// Life analysis checks
reg [15:0] life;
// Ding case
... |
/**
* 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... |
import env;
concept SQLite
{
mandatory abstract feature Parameters {
//This macro determines if SQLite creates databases with the auto_vacuum flag set by default to OFF (0), FULL (1), or INCREMENTAL (2). The default value is 0 meaning that databases are created with auto-vacuum turned off. In any case the compile-t... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; long long n, a[1005]; map<long long, int> x; int ans; void f(long long a, long long b) { long long cur = a + b; vector<long long> q; q.push_back(a); q.push_back(b); int len = 2; x[a]--; x[b]--; while (x[cur] > 0) { x[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 la... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.