text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; inline int read(int x = 0, int f = 1, char ch = 0 ) { while (!isdigit(ch = getchar())) if (ch == - ) f = -1; while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return f * x; } const int N = 1e5 + 5; int head[N], ver[N], nxt[N], edge[N];... |
`include "orpsoc-defines.v"
// One master, 2 slaves.
module arbiter_ibus
(
// instruction bus in
// Wishbone Master interface
wbm_adr_o,
wbm_dat_o,
wbm_sel_o,
wbm_we_o,
wbm_cyc_o,
wbm_stb_o,
wbm_cti_o,
wbm_bte_o,
wbm_dat_i,
wbm_ack_i,
wbm_err_i,
wbm_rty_i,
// Slave o... |
#include <bits/stdc++.h> using namespace std; int main() { int tmp = 3; int x = 1, y = 2; int n; cin >> n; bool flag = true; for (int i = 1; i <= n; i++) { int q; cin >> q; if (q == tmp) { flag = false; } if (q == x) swap(tmp, y); else ... |
#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); string a, b; int k; cin >> a >> b >> k; int n = a.length(), l = 0; long long gd = 0, bd = 0; int f = 0; if (a.length() != b.length()) { cout << 0; r... |
#include <bits/stdc++.h> using namespace std; long len; string a, b; const long long mo = 1000000007; long long good[200001], bad[200001]; int x, y, n; int main() { cin >> a >> b >> n; if (a.length() != b.length()) { cout << 0; return 0; } len = a.length(); bool f; for ... |
#include <bits/stdc++.h> using namespace std; int main() { char s1[1000], s2[1000], s3[1000]; int i, l1, l2, l3; scanf( %s%s%s , s1, s2, s3); l1 = strlen(s1); l2 = strlen(s2); l3 = strlen(s3); strcat(s1, s2); sort(s1, s1 + l1 + l2); sort(s3, s3 + l3); if (l1 + l2 == l3) { ... |
#include <bits/stdc++.h> using namespace std; bool sortbysec(const pair<long long, long long> &a, const pair<long long, long long> &b) { return (a.second < b.second); } int main() { long long n; vector<long long> a; vector<pair<long long, long long> > b; cin >> n; for (i... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a[101], b[101], c[101], i; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0; i < n; i++) cin >> b[i]; for (i = 0; i < n; i++) if (a[i] <= b[i]) c[i] = 1; int bs = 0, rc = 0, sett; for (i = 0; i < n; i++) ... |
#include <bits/stdc++.h> using namespace std; int a1, a2, a3, a4; int head; int b, c; int nott(int x) { if (x == 4) return 7; return 4; } int main() { cin >> a1 >> a2 >> a3 >> a4; if (abs(a3 - a4) > 1) { cout << -1 << endl; return 0; } if (a3 > a4) head = 4; if (a4 ... |
#include <bits/stdc++.h> using namespace std; map<long long, bool> isMark; int main() { long long n, x, y, l; cin >> n >> l >> x >> y; bool b = 0, g = 0, d = 0, bd = 0; long long diff = y - x, B = y + x; long long tmp; long long mark = -1, mark2 = -1; bool n1 = 1, n2 = 1; for (int ... |
#include <bits/stdc++.h> using namespace std; map<string, string> vars; struct proc { string name, arg[10]; int argn; proc(string v, bool V) { string til = ; int k = 0; for (int i = 0; i < v.length(); i++) { if (v[i] == ( ) { name = til; til = ; ... |
#include <bits/stdc++.h> using namespace std; int main() { int nofQs; cin >> nofQs; int minSec = INT_MAX; vector<int> custs(nofQs); for (int i = 0; i < nofQs; i++) { cin >> custs[i]; } for (int i = 0; i < nofQs; i++) { int tAmt = 0; for (int j = 0; j < custs[i]; 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; const int N = 1e5 + 100; struct node { int x, y; } f[2 * N]; int n, pos, vt[N], a[N], b[N], dd[N]; vector<pair<int, int> > vec; bool check(int x) { if (x == 0) return 0; while (x) { if (x % 10 != 7 && x % 10 != 4) return 0; x /= 10; ... |
#include <bits/stdc++.h> using namespace std; const int oo = 1e9 + 5; const int N = 1e6 + 5; long long ans = 0; int main() { int n; cin >> n; int a[n + 1]; for (int(i) = (0); (i) < (n); i++) { cin >> a[i]; } sort(a, a + n); int x; x = (n - 1) / 2; cout << a[x]; re... |
// megafunction wizard: %LPM_FIFO+%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: fifo_144x128.v
// Megafunction Name(s):
// scfifo
// ============================================================
// **************... |
/*
* .--------------. .----------------. .------------.
* | .------------. | .--------------. | .----------. |
* | | ____ ____ | | | ____ ____ | | | ______ | |
* | ||_ || _|| | ||_ \ / _||... |
/*
Distributed under the MIT license.
Copyright (c) 2017 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 mod = (int)1e9 + 207; const int N = (int)1e6 + 2; long long n, m, s, t; long long cnt1[N], cnt2[N]; long long D1[N], D2[N]; vector<pair<long long, long long> > G1[N], G2[N]; vector<pair<long long, pair<long long, long long> > > edge; void solve1(... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j, t; ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> t; while (t--) { int b, k; cin >> n >> b >> k; int arr[n]; for (i = 0; i < n; i++) cin >> arr[i]; int flag = 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 law... |
#include <bits/stdc++.h> using namespace std; double pi = acos(-1); void OJ() {} int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long t; cin >> t; while (t--) { long long n, x, od = 0, ev = 0; cin >> n >> x; for (long long i = 0;... |
#include <bits/stdc++.h> using namespace std; long long n, k; inline bool check(vector<long long>& prev, long long x) { long long sz = prev.size(); for (long long i = 0; i < sz; i += x) { long long j = min(i + x - 1, sz - 1); if (prev[j] - i > k) return false; } return true; } int ... |
#include <bits/stdc++.h> using namespace std; int N; pair<pair<int, int>, int> arr[2050]; int vis[2050]; char s[2050]; double angle(pair<int, int> x, pair<int, int> y, pair<int, int> z) { pair<int, int> xy = {y.first - x.first, y.second - x.second}; pair<int, int> xz = {y.first - z.first, y.second -... |
module bug;
reg [7:0] Data[0:3][0:15];
reg [7:0] Expect0;
reg [7:0] Expect1;
reg [7:0] Expect2;
reg [7:0] Expect3;
reg [7:0] Actual0;
reg [7:0] Actual1;
reg [7:0] Actual2;
reg [7:0] Actual3;
integer i;
integer j;
reg Failed = 0;
initial begin
for (i = 0; i < 4; i = i + 1) begin
for (j = 0; j < 16; j = 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... |
#include <bits/stdc++.h> using namespace std; int s, a, n; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; while (n--) cin >> a, s += abs(a); cout << s; return 0; } |
#include <bits/stdc++.h> using namespace std; const int inf = 2147483647; template <typename T> inline T read() { T sum = 0, fl = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == - ) fl = -1; for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - 0... |
module cube_controller
(
input CLOCK_50, // Reference clock
input [1:0] KEY,
input [3:0] SW,
inout [12:0] GPIO_2,
input [2:0] GPIO_2_IN,
inout [33:0] GPIO_0,
input [1:0] GPIO_0_IN,
inout [33:0] GPIO_1,
input [1:0] GPIO_1_IN,
output [7:0] LED
);
wire ... |
#include <bits/stdc++.h> using namespace std; int main() { int T; scanf( %d , &T); while (T--) { int n, a, o; vector<pair<pair<int, int>, int> > M; scanf( %d , &n); M.push_back(make_pair(make_pair(0, 0), 0)); for (int i = 1; i <= n * 2 - 1; i++) { scanf( %d%d , &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; long long int func(long long int n) { long long int res = 0; while (n != 0) { n /= 10; res++; } return res; } int main() { long long int w, m, k; cin >> w >> m >> k; long long int n = func(m), tr = w / k, res = 0; while (t... |
#include <bits/stdc++.h> using namespace std; struct edge { int v, w; edge() {} edge(int V, int W) { v = V, w = W; } }; struct node { long long x, y, z; node() {} node(long long X, long long Y, long long Z) { x = X, y = Y, z = Z; } } p[100005]; vector<edge> G[100005]; int n; long... |
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string s; cin >> s; long long w = 0, o = 0; for (long long i = 0; i < s.length() - 1; i++) { if (s[i] == v && s[i + 1] == v ) w++; else { ... |
/*
Copyright (c) 2014-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, distri... |
#include <bits/stdc++.h> const int P = (1 << 30) - 1; int a, b, c, p[2005], vis[2005]; std::unordered_map<long long, int> mmp[2005]; void sieve(int n) { vis[0] = vis[1] = 1; for (int i = 2; i <= n; ++i) { if (!vis[i]) p[++*p] = i; for (int j = 1; j <= *p && i * p[j] <= n; ++j) { vis[... |
#include <bits/stdc++.h> using namespace std; int a[501][501], b[501][501], i, j, n, m, k; int main() { vector<int> vea; vector<int> veb; cin >> n >> m; for (i = 1; i <= n; i++) { for (j = 1; j <= m; j++) cin >> a[i][j]; } for (i = 1; i <= n; i++) { for (j = 1; j <= m; j++) cin... |
// #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(x) x.begin(), x.end() #define lch (o << 1) #define rch (o << 1 | 1) typedef double db; typedef long long ll; typedef unsigned int ui; typedef pair<int, int> pint; typedef tuple<int, int, int> ti... |
#include <bits/stdc++.h> using namespace std; const int maxn = 21; int a[1 << maxn], n; long long ans[maxn][2]; void mergesort(int l, int r, int dep) { if (r - l <= 1) return; int m = (l + r) / 2; mergesort(l, m, dep - 1); mergesort(m, r, dep - 1); for (int i = l; i < m; i++) { ans[d... |
// --------------------------------------------------------------------------------
//| Avalon ST Packets to Bytes Component
// --------------------------------------------------------------------------------
`timescale 1ns / 100ps
module altera_avalon_st_packets_to_bytes
//if ENCODING ==0, CHANNEL_WIDTH must be... |
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2; cin >> s1 >> s2; for (int i = 0; i < s1.size(); i++) { s1[i] = tolower(s1[i]); s2[i] = tolower(s2[i]); } if (s1 < s2) { cout << -1; } else if (s2 < s1) { cout << 1; } else { cout << 0;... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, r; cin >> a >> b >> r; if (2 * r > min(a, b)) { cout << Second ; } else { cout << First ; } return 0; } |
#include <bits/stdc++.h> using namespace std; const int M = 1e9 + 7; class DSU { public: vector<int> parent; vector<int> sizes; int noOfComponenents; DSU(int N) { parent.resize(N); sizes.resize(N); noOfComponenents = N; for (int i = 0; i < N; ++i) { parent[i] = i... |
#include <bits/stdc++.h> using namespace std; const int N = 10100, M = 1001000, oo = 1000000000; int i, j, k, n, m, ch, Pn, Tn, En, x, y, fx, fy, rt, nm; int h[N * 2], p[N * 2], g[N * 2], tmp[N * 2]; struct edge { int s, n; } E[N * 4]; struct edge2 { int s, n, v; }; struct tree { int l, r;... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int n; int k; map<int, int> mp; int S; long long res; struct linetree { map<int, int> rot; int s[22 * N][2]; int v[22 * N]; int ct; inline void ins(int p, int l, int r, int pos) { v[p]++; if (r - l == 1... |
/*
* DSI Core
* Copyright (C) 2013-2014 twl <>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This... |
/**
* 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 m, l, r, k; struct Matrix { long long W[2][2]; }; Matrix operator*(const Matrix& A, const Matrix& B) { Matrix S; memset(S.W, 0, sizeof(S.W)); for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) for (int l = 0; l < 2; ++l... |
module EmitOneCH
(
input Transmit_CLK, //100M
input RX_Gate, //Transmit Enable
input [7:0] EmitDelay, //7th bit for Transmit Enable, 6:0 for Delay
input [6:0] Emit_Width, //Emit pulse wid... |
//naveen mall #include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define pb push_back #define sz(c) (int)c.size() #define len(c) (int)c.length() #define vec vector #define int lon... |
/////////////////////////////////////////////////////////////
// Created by: Synopsys DC Expert(TM) in wire load mode
// Version : L-2016.03-SP3
// Date : Mon Oct 17 14:34:20 2016
/////////////////////////////////////////////////////////////
module FSM_Add_Subtract ( clk, rst, rst_FSM, beg_FSM, zero_flag_i,
... |
#include <bits/stdc++.h> using namespace std; int main() { int t, a, b, x; cin >> t; while (t--) { cin >> x; if (x % 2 == 0) { cout << x / 2 << << x / 2 << endl; } else { cout << 1 << << x - 1 << endl; } } } |
#include <bits/stdc++.h> using namespace std; int main() { int n; int k; cin >> n >> k; string a; cin >> a; bool no = false; for (int i = 0; i < a.size(); i++) { if (a[i] == N && (i + k) <= a.size() && (i == 0 || a[i - 1] != N )) { int count = 0; int j; f... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const double eps = 1e-9; const int inf = 1e9; int deg[N]; int main() { int t; scanf( %d , &t); while (t--) { int n, x; scanf( %d%d , &n, &x); for (int i = 0; i < n + 10; i++) deg[i] = 0; for (int i = 1;... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) using namespace std; int a[510][510]; int mi[510][510]; int main() { ios_base::sync_with_stdio(0); int n, m, k, q; cin >> n >> m >> k >> q; for (int i = 1; i <= n; i++) ... |
#include <bits/stdc++.h> #pragma optimizitaion_level 3 #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( fast-math ) using namespace std; int n, h; vector<int> b; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> h; b.resize(n); for (auto &... |
/*
* This demonstrates a basic dynamic array
*/
module main;
longint foo[];
int idx;
initial begin
if (foo.size() != 0) begin
$display("FAILED -- foo.size()=%0d, s.b. 0", foo.size());
$finish;
end
foo = new[10];
if (foo.size() != 10) begin
$display("FAILED -- foo.size()=%0d,... |
//Define 32 bit 2s complement
module complement2s(X , x);
// I/O port declaration
output [31:0] X;
input [31:0] x;
reg [31:0]reg1 = 32'd1;
reg reg0 = 1'd0;
//internal nets
wire [31:0]x_not ;
wire shit,shit1;
//internal gate circuitry
not (x_not[0],x[0]);
not (x_not[1],x[1]);
not (x_not[2],x[2]);
not (x_... |
/*
* 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 (c) 2014-2020 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
class Packet;
rand int header;
rand int length;
extern constraint ex;
constraint a { header ... |
#include <bits/stdc++.h> const long base = 151; const long long MM = 1ll * 1000000007 * 1000000007; using namespace std; int BIT(int i, long long x) { return (x & (1 << i)); } long long ONBIT(int i, long long x) { return (x | (1 << i)); } long long OFFBIT(int i, long long x) { return (x & ~(1 << i)); } lo... |
/////////////////////////////////////////////////////////////////////////////
//
// Silicon Spectrum Corporation - All Rights Reserved
// Copyright (C) 2005
//
// Title : Clock switch module for non programmable PLLs
// File : clk_switch.v
// Author : Frank Bruno
// Created : 05-Mar-2005... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n--) { string s; cin >> s; while (s.size() && s[0] == 0 ) { s.erase(s.begin()); } while (s.size() && s[(int)s.size() - 1] == 0 ) { s.erase(s.begin() + (int)s.size() - 1); ... |
#include <bits/stdc++.h> using namespace std; int n; char s[200002]; int cnt[200001][26]; void init() { for (int i = 1; s[i]; ++i) { for (int j = 0; j < 26; ++j) cnt[i][j] = cnt[i - 1][j]; cnt[i][s[i] - a ]++; } } int main() { scanf( %s , s + 1); init(); int q, l, r; s... |
/*
* 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 (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module tdc_s3 #(
parameter BASEADDR = 16'h0000,
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 20; long long n, m, x, y, ans, low, dp[maxn][1 << maxn]; bool f[maxn][maxn]; long long lowbit(long long x) { long long ret = 0; while (x) { if (x & 1) return ret; else ret++; x /= 2; } } int main()... |
#include <bits/stdc++.h> using namespace std; const int MAXSZ = 100000; int req[MAXSZ]; int prob[MAXSZ]; int main(int argc, const char* argv[]) { int n, m, k; scanf( %d%d , &n, &m); int count = 1; for (int i = 0; i < m; i++) { scanf( %d , &k); prob[k]++; req[prob[k]]++; ... |
#include <bits/stdc++.h> static const int MAXLEN = 1e6 + 12; int len = 0; char s[MAXLEN]; char *tokens[MAXLEN]; int token_ct = 0; int max_depth = 0; std::vector<char *> nested[MAXLEN]; int parse_comment_recursive(int start_token, int level) { if (max_depth < level) max_depth = level; nested[leve... |
// megafunction wizard: %LPM_MUX%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: LPM_MUX
// ============================================================
// File Name: chan_mux.v
// Megafunction Name(s):
// LPM_MUX
//
// Simulation Library Files(s):
// lpm
// ===========================================... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1... |
`default_nettype none
`include "setup.v"
`define ECP3VERSA
module top (
// PCI Express
input rstn,
input board_clk,
input FLIP_LANES,
input refclkp,
input refclkn,
input hdinp,
input hdinn,
output hdoutp,
output hdoutn,
// Ethernet PHY#1
output reg phy1_rst_n,
input phy1_125M_clk,
input phy1_tx_clk,
out... |
/*
* 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... |
module branchhistorytable(clk,pcsrcd,pcd,pcbranchd,originalpc,pcnext,clrbp);
input clk;
input [1:0] pcsrcd;
input [31:0] originalpc, pcbranchd, pcd;
output reg [31:0] pcnext;
output reg clrbp;
reg [65:0] branchtargetbuffer[127:0];
reg [31:0] pcstorage;
//66 bits, first 32 bi... |
#include <bits/stdc++.h> using namespace std; int n, a, b, sum; int main() { cin >> n; b = -1; sum = 0; for (int i = 0; i < n; i++) { cin >> a; if (a == 0 || (a == b && b != 3)) { sum++; b = 0; } else if (a == 3 && b == 1) b = 2; else if (a == 3 && b... |
#include <bits/stdc++.h> using namespace std; const int cap = 1e3; int n, m; char grid[cap][cap]; int vis[4][cap][cap] = {}; vector<pair<int, int>> dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; bool dfs(int i, int j, int d, int t) { if (i < 0 || i == n || j < 0 || j == m || grid[i][j] == * || (... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e2 + 2, MAX_K = 1100; int n, k; int Arr[MAX_N]; double ans; double dp[MAX_K][MAX_N][MAX_N]; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n >> k; k = min(k, MAX_K - 1); for (int i = 1; i <= n; i++)... |
#include <bits/stdc++.h> struct circle { double x, y, r; }; double dis(circle a, circle b) { return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)); } bool canGo(circle tar, circle small, circle big) { if (small.r >= tar.r + dis(tar, small)) return true; if (big.r + tar.r <= dis(ta... |
// This is written by Zhiyang Ong
// and Andrew Mattheisen
// for EE577b Troy WideWord Processor Project
module pipe3(dataOut_in, dataOut_out, wbyteen_in, wbyteen_out,
regwren_in, regwren_out, rwraddrd_in, rwraddrd_out,
reginmuxop_in, reginmuxop_out, aluOut_in, aluOut_out,
instruction_in, instruction_ou... |
/* This file is part of JT12.
JT12 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.
JT12 program is distribute... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int b; map<int, long long> mp; long long a = -1; if (n > 1) { for (int i = 0; i < n; i++) { cin >> b; mp[b - i] += b; a = max(a, mp[b - i]); } cout << a; } else { c... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast , unroll-loops , no-stack-protector ) using namespace std; template <class T> using minheap = priority_queue<T, vector<T>, greater<T>>; template <typename T> void setmax(T& a, T b) { a = max(a, b); }; template <typename T> void setmin(T& a, T ... |
#include <bits/stdc++.h> using namespace std; int n, a[1003]; const int mod = 1000000007; int comb[1005][1005], i, j; int main() { int lim = 1002; for (i = 1; i <= lim; i++) comb[i][i] = comb[i][0] = 1; for (i = 2; i <= lim; i++) for (j = 1; j < i; j++) { long long aux = comb[i - 1][... |
#include <bits/stdc++.h> using namespace std; template <class T> void chkmin(T &x, T y) { if (y < x) x = y; } template <class T> void chkmax(T &x, T y) { if (y > x) x = y; } const int N = 105; int a[N], n, x, ans1, ans2[N][N], len; int main() { scanf( %d , &n); for (int i = 1; i <= (... |
#include <bits/stdc++.h> using namespace std; int main() { int t; string s; getline(cin, s); long long n = s.size(), i; for (i = n - 1; i >= 0; i--) { if (isupper(s[i])) { s[i] = tolower(s[i]); } if (s[i] == ? || s[i] == ) { continue; } else if (s[i] ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 2005; bool a[MAX][MAX], row[MAX], col[MAX]; int main() { ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) { char c; cin >> c; a[i][j] = (c == 1 ); ... |
/*!
btcminer -- BTCMiner for ZTEX USB-FPGA Modules: HDL code for ZTEX USB-FPGA Module 1.15b (one double hash pipe)
Copyright (C) 2011 ZTEX GmbH
http://www.ztex.de
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
pub... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: asyn_64_1.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
//
// ======================================================... |
// 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 : Sun Apr 09 07:02:41 2017
// Host : GILAMONSTER running 64-bit major release (... |
/*
Copyright (c) 2014-2018 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
/**
* 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, h, l, r; int a[2000 + 5], dp[2000 + 5][2000 + 5]; int solve(int curr, int idx) { if (idx == n) { if (l <= curr && curr <= r) return 1; else return 0; } if (dp[curr][idx] != -1) return dp[curr][idx]; int p1 = 0, p2 =... |
#include <bits/stdc++.h> using namespace std; long long INF = -10000000; int main() { long long da, db; cin >> da >> db; if (da == db) { cout << da * 10 << << db * 10 + 1; } else if (da == 9 && db == 1) { cout << da * 10 + 9 << << db * 100; } else if (da == 0 && db == 1) { ... |
// (c) Copyright 2011-2013 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not g... |
/**
* 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 = 2e5 + 5; const long long M = (long long)1e9 + 7; int Int() { int x; scanf( %d , &x); return x; } long long Long() { long long x; scanf( %lld , &x); return x; } void Char(char *ch) { scanf( %s , ch); } template <typenam... |
#include <bits/stdc++.h> using namespace std; int main() { int a, ta; cin >> a >> ta; int b, tb, h = 0, m = 0, num = 0; int totmin; cin >> b >> tb; string s; cin >> s; for (int i = 0; i < 2; i++) { h = h * 10 + (s[i] - 0 ); } for (int i = 3; i < 5; i++) { m = m *... |
`include "../network_params.h"
module top_tb();
reg clock;
reg reset;
reg [`SCREEN_X_BITWIDTH:0] screen_x;
reg [`SCREEN_Y_BITWIDTH:0] screen_y;
wire [`CAMERA_PIXEL_BITWIDTH:0] pixel;
wire [`FFN_OUT_BITWIDTH:0] n0;
wire [`FFN_OUT_BITWIDTH:0] n1;
wire prdy;
parameter X_RES_MAX = 600;
parameter Y_RES_MAX = 800;
// DU... |
#include <bits/stdc++.h> using namespace std; int n, m, k, d[1010][1010], inf, sx, sy, tx, ty, dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}; char s[1010][1010]; struct P { int x, y; } u, v; int tmp; queue<P> q; int main() { memset(d, 33, sizeof d)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.