text stringlengths 59 71.4k |
|---|
// Copyright 2020-2022 F4PGA 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; int a[200], b[200], res[200]; int main() { int n, count, i, j, m, k, ans; cin >> n >> m >> k; for (i = 0; i < m; i++) cin >> a[i]; for (i = 0; i < k; i++) cin >> b[i]; for (i = 0; i < m; i++) { for (j = 0; j < k; j++) { if (b[j] % a[i... |
#include <bits/stdc++.h> using namespace std; int main() { int n, mncnt = 1000000000, cnt; string a; string c = ACTG ; cin >> n >> a; for (int i = 0; i <= n - 4; i++) { cnt = 0; string b = a.substr(i, 4); for (int j = 0; j < 4; j++) { int x = c[j] - A ; int y ... |
#include <bits/stdc++.h> using namespace std; int v[100001]; int acum[100001]; long long cnt = 0, ans[100001]; struct Q { int i, j, p; Q(int a, int b, int c) : i(a), j(b), p(c){}; Q() {} bool operator<(const Q &other) const { if (i / 300 == other.i / 300) return j < other.j; return... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-9; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; double u, v, w, x, y, l = 1e9, r = 0; cin >> n >> w >> v >> u; while (n--) { cin >> x >> y; l = min(l, x - y / u * v);... |
/*
* 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> using namespace std; int n, m, k; int a[111][111][111]; int color[111][111][111], cc; char second[111]; void visit(queue<pair<pair<int, int>, int> >* q, int x, int y, int z) { if (a[x][y][z] == 1 && color[x][y][z] != cc) { color[x][y][z] = cc; q->push(make_pair(make_... |
#include <bits/stdc++.h> using namespace std; int n, q; const long long N = 2e5 + 100; vector<long long> v[N]; long long dfn[N], num[N], val[N], sz[N], hs[N], tp[N], dep[N], f[N]; inline void dfs(long long x, long long fa) { sz[x] = 1; long long num = 0; dep[x] = dep[fa] + 1; f[x] = fa; ... |
// (C) 2001-2015 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, y; cin >> n >> m; vector<int> deg(n, 0), uf(n), uf_cnt(n, 1); for (int i = 0; i < n; ++i) uf[i] = i; for (int i = 0; i < m; ++i) { cin >> x >> y; deg[--x]++; deg[--y]++; while (x != uf[x]) x = uf[x]; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 4005; int f[maxn][maxn], prea[maxn][26], preb[maxn][26]; char a[maxn], b[maxn]; int n, m, ti, td, tr, te; int main() { int i, j, x, y; scanf( %d%d%d%d , &ti, &td, &tr, &te); scanf( %s%s , a + 1, b + 1); n = strlen(a + 1); m =... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int MAXN = 2500; struct P { int x, y; P() {} P(int x, int y) : x(x), y(y) {} }; long long operator^(const P& a, const P& b) { return (long long)a.x * b.y - (long... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
#include <bits/stdc++.h> int read() { int x = 0, c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) x = x * 10 + c - 0 , c = getchar(); return x; } const int maxn = 205, mod = 1000000009; std::vector<int> G[maxn]; int ins[maxn]; int stack[maxn], sp; int dfn[maxn], low[ma... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a, odd = 0, even = 0; cin >> n; while (n--) { cin >> a; if (a % 2 == 0) { even += 1; } else { odd += 1; } } cout << (odd % 2 == 1 ? odd : even) << endl; 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 la... |
#include <bits/stdc++.h> using namespace std; long long int dp[(1ll << 19)][19]; long long int n, T; long long int t[19], g[19]; long long int ans = 0; long long int solve(long long int mask, long long int cnt, long long int last) { if (cnt > T) return 0; if (cnt == T) return 1; if (dp[mask][las... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, c, e; char s[100]; scanf( %d%d%*d.%d , &n, &m, &c); map<string, int> u; for (int i = 0; i < n; i++) { scanf( %s%d , s, &e); if (e * c / 100 >= 100) u[s] = e * c / 100; } for (int i = 0; i < m; i++) { 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... |
#include <bits/stdc++.h> const int maxn = 100001; int n, a[maxn]; struct Segment { int val, tag; } seg[maxn << 1 | 1]; inline int seg_idx(int L, int R) { return (L + R) | (L < R); } void seg_down(int rt, int lch, int rch) { if (!seg[rt].tag) return; seg[lch].val += seg[rt].tag; seg[lch].tag ... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n, i; string a, b; cin >> t; while (t--) { vector<int> k; cin >> n >> a >> b; for (i = 0; i < n; i++) { if (a[i] != b[i]) { k.push_back(i + 1); k.push_back(1); k.push_back(i + 1)... |
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; cout << 3 * (N - 2) - 2 + (N - 4) * (N - 3) << endl; return 0; } |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
#include <bits/stdc++.h> using namespace std; int n, i, k, u, v, cnt; int head[300005], a[300005]; long long f[300005], ans; struct ff { int to, nxt; } e[2 * 300005]; int fast() { int res = 0, fl = 1; char c = getchar(); while (c < 48 || c > 57) { if (c == - ) fl = -1; c = get... |
#include <bits/stdc++.h> using namespace std; using namespace std; const int N = 3e6 + 5; int a[55][55], b[55][55], aa[55][55], bb[55][55]; int row(int x, int y) { for (int i = 1; i <= x; i++) { int k = 1; for (int j = 2; j <= y; j++) { if (a[i][j] > a[i][k]) { k = j; ... |
#include <bits/stdc++.h> int main() { int num = 0; int a[100]; int i = 0; int m = 0; int yushu; char hex[16] = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , A , B , C , D , E , F }; scanf( %d , &num); if (num == 0) { printf( 1 n ); return 0; ... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const int RLEN = 1 << 20 | 1; inline char gc() { static char ibuf[RLEN], *ib, *ob; (ob == ib) && (ob = (ib = ibuf) + fread(ibuf, 1, RLEN, stdin)); return (ob == ib) ? EOF : *ib++; } inline int read() { char ch = getchar... |
/**
* 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... |
#include <bits/stdc++.h> using namespace std; long long K = 1000000007; long long gcd(long long a, long long b, long long& x, long long& y) { if (a == 0) { x = 0; y = 1; return b; } long long x1, y1; long long d = gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; ... |
#include <bits/stdc++.h> using namespace std; const int N = 400005; int n, m, h[N], p[N]; set<int> S; set<int>::iterator it; inline void read(int &i) { i = 0; char c = getchar(); bool j = 0; for (; !isdigit(c); c = getchar()) if (c == - ) j = 1; for (; isdigit(c); c = getchar()) i... |
// 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... |
#include <bits/stdc++.h> using namespace std; vector<long long> tree; void build(vector<long long> &arr, long long ind, long long l, long long r) { if (l == r) { tree[ind] = arr[l]; return; } long long mid = (l + r) / 2; build(arr, ind * 2, l, mid); build(arr, ind * 2 + 1, mid + 1,... |
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define x first #define y second #define LL long long #define LD long double #define Complex complex<double> #define y1 ___y1 #define next ___next #define left ___left #define right ___right #define pii pai... |
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T--) { string a, b, c; cin >> a >> b >> c; int n = a.size(); bool Ok = true; for (int i = 0; i < n; i++) Ok &= (c[i] == a[i] || b[i] == c[i]); puts(Ok ? YES : NO ); } } |
#include <bits/stdc++.h> using namespace std; const int maxN = 300, maxTreeSize = 1 << 10; struct Tree { private: bool active[maxTreeSize]; int Min[maxTreeSize], Max[maxTreeSize], offset; public: void resize(int n) { offset = 1; while (offset < n) offset *= 2; } void add(i... |
#include <bits/stdc++.h> using namespace std; long long int dp[20][1 << 20]; long long int len[1 << 21] = {0}; std::vector<int> v[1000000]; int n; int r[21][21]; long long int solve(int last, int mask, int pa) { long long int sol = 0; if (r[last][pa] == 1 && len[mask] >= 3) { sol += 1; }... |
#include <bits/stdc++.h> using namespace std; char s[2000][2000]; int n, m; bool h[300][300]; bool v[300][300]; const long long mod = 1000000007; void get(int x, int y, bool& h, bool& v) { int cnt = 0; for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) { if (s[x + i][y + j] == ... |
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { register char c = getchar(); x = 0; for (; c < 0 || c > 9 ; c = getchar()) ; for (; c >= 0 && c <= 9 ; c = getchar()) x = (x << 1) + (x << 3) + c - 0 ; } priority_queue<int> q; int main() { priority_queue... |
#include <bits/stdc++.h> using namespace std; template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { for (auto i : v) os << i << ; return os; } template <typename T> ostream& operator<<(ostream& os, const set<T>& v) { for (auto i : v) os << i << ; return os; } ... |
#include <bits/stdc++.h> using namespace std; int marcg[112], marcb[112], n, m, b, g, xi; int main() { scanf( %d %d , &n, &m); scanf( %d , &b); for (int i = 0; i < b; i++) { scanf( %d , &xi); marcb[xi] = 1; } scanf( %d , &g); for (int i = 0; i < g; i++) { scanf( %d , &xi)... |
`default_nettype none
module l1_inst_cache_counter(
input wire iCLOCK,
input wire inRESET,
//Hit Infomation
input wire iCACHE_VALID,
input wire iCACHE_HIT,
//Infomation
output wire [6:0] oINFO_COUNT
);
reg [99:0] b_counter;
always@(posedge iCLOCK or negedge inRESET)begin
if(!inRESET)begin
b_cou... |
#include <bits/stdc++.h> using namespace std; vector<string> split(const string& s, char c) { vector<string> v; stringstream ss(s); string x; while (getline(ss, x, c)) { v.emplace_back(x); } return move(v); } void err(vector<string>::iterator it) {} template <typename T, typename... |
// --------------------------------------------------
//
// Generic round robin arbiter
//
// A generic round robin arbiter with parameterizeable number of clients
//
// --------------------------------------------------
module rr_arb
#( parameter CLIENTS=2 )
(
input wire clk,
input wire ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2014 ////
//// ////
//// This source file may be used and distributed witho... |
#include <bits/stdc++.h> using namespace std; const int MOD = int(1e9 + 7), maxK = 23, maxN = 107; vector<int> a[maxN]; int n, k; int f[maxN][maxK][maxK], g[2][maxK][maxK]; inline void add(int &a, long long b) { a = (a + b) % MOD; } void calculate(int u, int par) { memset(g, 0, sizeof g); bool fir... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int b[maxn]; char a[maxn]; int num[2 * maxn]; int main() { int n; scanf( %d , &n); int count0 = 0, count1 = 0; memset(num, -1, sizeof(num)); int len = 0, maxlen = 0; scanf( %s , a + 1); for (int i = 1; i <= ... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const double eps = 1e-11; template <class T> T sqr(const T &x) { return x * x; } template <class T> T lowbit(const T &x) { return (x ^ (x - 1)) & x; } inline long long mlog2(long long n) { long long c = 0; c ... |
//Legal Notice: (C)2017 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... |
#include <bits/stdc++.h> using namespace std; int t = 0; int d[300000]; int par[300000]; int t1[300000]; int t2[300000]; void dfs(int s, vector<vector<int> > &ed, int y) { d[s] = y; t1[s] = t++; for (int i = 0; i < ed[s].size(); i++) { if (ed[s][i] != par[s]) { par[ed[s][i]] = s;... |
//Legal Notice: (C)2018 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... |
#include <bits/stdc++.h> using namespace std; inline int dblcmp(double x) { if (abs(x) < 1e-8) return 0; return (x > 0) ? 1 : -1; } inline double sqr(double x) { return x * x; } const double pi = acos(-1.0); struct point { double x, y; point() {} point(double _x, double _y) : x(_x), y(_y... |
////////////////////////////////////////////////////////////////////////////////
//
// Filename: firtap.v
//
// Project: DSP Filtering Example Project
//
// Purpose: Implements a single tap within a FIR filter. This particular
// FIR tap design is specifically designed to make it easier
// for the parent module to a... |
#include <bits/stdc++.h> using namespace std; long long int cost(long long int x[], long long int a, long long int n, long long int r, long long int m, long long int val) { long long int pos = 0; long long int neg = 0; for (int i = 0; i < n; i++) { if (x[i] > val) pos ... |
/**
* 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/1ns
module axi_ms_tb;
reg clk, rst;
wire [31:0] ARADDR;
wire ARVALID;
wire ARREADY;
wire [7:0] ARLEN;
wire [2:0] ARSIZE;
wire RVALID;
wire [31:0] RDATA;
wire RREADY;
wire RLAST;
wire [31:0] AWADDR;
wire AWVALID;
wire ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: pcx_dp_maca_r.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... |
/*
* 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... |
`timescale 1ns / 1ps
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:32:05 11/08/2015
// Design Name:
// Module Name: jace_logic
// Project Name:
// Target Devices:
// Tool versions:
// Description:
/... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: cpx_datacx2_ff.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 an... |
/*******************************************************************************
* 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 with non-Xilinx ... |
//
// bv_count module
//
// bv2.0_programmable
//
// Created by LiJunnan on 16/9/16.
// Copyright (c) 2016year LiJunnan. All rights reserved.
`timescale 1ns/1ps
module bv_count(
reset,
clk,
bv_valid,
bv,
count,
bv_out_valid,
bv_out,
count_out
);
parameter width = 64;
parameter width_count = 6;
parameter ... |
/**
Based on: https://github.com/dirjud/Nitro-Parts-lib-Xilinx
*/
`timescale 1ps/1ps
`default_nettype none
module clock_divider_sim #(
parameter DIVISOR = 2
) (
input wire CLK,
output reg CLOCK
);
integer cnt;
initial cnt = 0;
wire [31:0] DIV;
assign DIV = DIVISOR;
always @(posedge CLK)
if(cnt == DI... |
#include <bits/stdc++.h> using namespace std; int main() { int n, r, x, s = 0; cin >> n >> r >> x; int a[r + 1]; for (int i = 1; i <= r; i++) { a[i] = 10000000; } while (n--) { int l, m; cin >> l >> m; a[l] = min(a[l], m); } for (int i = 1; i <= r; i++) { ... |
#include <bits/stdc++.h> using namespace std; long long findGCD(long long a, long long b) { return ((b == 0) ? a : findGCD(b, a % b)); } map<long long, long long> width; long long wit = 0; vector<pair<long long, long long> > rect[200005]; int main() { long long n; scanf( %lld , &n); for (l... |
/**
* 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... |
module module2(clk_, rst_, bar0, bar1, foo0, foo1);
input clk_;
input rst_;
input [1:0] bar0;
input [1:0] bar1;
output [1:0] foo0;
output [1:0] foo1;
parameter poser_tied = 1'b1;
parameter poser_width_in = 0+1-0+1+1-0+1;
parameter poser_width_out = 0+1-0+1+1-0+1;
parameter poser_grid_width = 5;
pa... |
#include <bits/stdc++.h> using namespace std; int main() { int i, t, m, n; cin >> t; int arr[t]; for (i = 0; i < t; i++) { int sum = 0, k = 0; cin >> n >> m; int arr1[n]; for (int j = 0; j < n; j++) { cin >> arr1[j]; if (j != 0) sum += arr1[j]; } k... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:09:39 08/25/2015
// Design Name:
// Module Name: FSM_Add_Subtract
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencie... |
#include <bits/stdc++.h> using namespace std; const int MAXL = 1e5; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long int k, p; long long int ans = 0; cin >> k >> p; for (int i = 1; i <= k; i++) { int x = i; string str1, str2; while (x... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000005, mod = 1000000007; vector<int> pri; bool vis[80]; int pos[80], a[maxn], n; long long w[80]; long long dp[1 << 21], dp2[1 << 21], f[maxn]; void prework() { for (int i = 2; i < (71); ++i) { if (!vis[i]) { pri.push_bac... |
#include <bits/stdc++.h> using namespace std; void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {... |
#include <bits/stdc++.h> using namespace std; void init() {} const int N = 63e5 + 34; const long long INF = 2e9 + 34; int MD = 30; string sym = AHIMOTUVWXYovwx ; void fail() { cout << NIE ; exit(0); } int main() { init(); string s; cin >> s; int n = s.length(); if (n % 2 ... |
`timescale 1ns / 1ps
// nexys3MIPSSoC is a MIPS implementation originated from COAD projects
// Copyright (C) 2014 @Wenri, @dtopn, @Speed
//
// 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, ... |
/**
* 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 = 100000 + 7; int n; int val[N]; struct edge { int to, nex; } e[N << 1]; int fir[N], eid; int siz[N], fa[N], son[N]; int dfn[N], pos[N], inx; int cnt[N], res[N]; long long mul[N], ans[N]; void addedge(int u, int v) { e[++eid] = (e... |
module j1soc#(
//parameter bootram_file = "../../firmware/hello_world/j1.mem" // For synthesis
parameter bootram_file = "../firmware/Hello_World/j1.mem" // For simulation
)(
uart_tx, ledout,
sys_clk_i, sys_rst_i
);
input sys_clk_i, sys... |
#include <bits/stdc++.h> using namespace std; char c[100003], b[100003]; int ggg[100003]; string a; long long d, e, f, g, ming, oo, ksa, lxy; bool nn, o; int main() { gets(c); c[strlen(c)] = ; a = c; for (int i = 0; i <= a.length(); i++) { if (a.substr(i, 1) == ) { if (... |
#include <bits/stdc++.h> using namespace std; int in; int a[105][105]; int b[100000]; int max(int l, int n) { int m = a[l][0]; int in = 0; for (int x = 0; x < n; x++) { if (m < a[l][x]) { m = a[l][x]; in = x; } } return in; } int main() { int n, m; c... |
/*
* 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... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2005,2006 Matt Ettus
// Copyright (C) 2008 Corgan Enterprises LLC
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free S... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; long long a[N], b[N]; deque<int> mx, mn; int main() { long long n; cin >> n; long long i; for (i = 1; i <= n; i++) cin >> a[i]; for (i = 1; i <= n; i++) cin >> b[i]; long long j, ans = 0; for (j = 1, i = 1; i <= n... |
#include <bits/stdc++.h> using namespace std; map<string, int> ma; int main() { string s; int n; cin >> n; ma.clear(); while (n--) { cin >> s; if (ma[s] == 0) printf( NO n ); else printf( YES n ); ma[s]++; } return 0; } |
#include <bits/stdc++.h> using namespace std; int n; int a[100100], b[100100]; int id[100100], p[100100]; int main() { int T = 1; while (T--) { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); id[a[i]] = i; } for (int i = 1; i <= n; i++) { ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7, siz = 1e6 + 5; long long t, n, m, k, a[siz], inp[siz], cnt, co[siz], less_right[siz], less_left[siz], tree[siz][2]; pair<long long, long long> p[siz]; long long get(long long ind, long long id) { long long ret = 0; for ... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char** argv) { char s[3][3]; bool is = false; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { cin >> s[i][j]; if (s[i][j] == X ) is = true; } } int i = 0, j = 0; bool isY = true; for... |
//--------------------------------------------------------------------------------
//--
//-- 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 with non-Xilinx
//-- devices or te... |
// ******************************************************************************* //
// ** General Information ** //
// ******************************************************************************* //
// ** Module : QM_FIR.v ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21.02.2016 16:25:28
// Design Name:
// Module Name: SPI_MASTER
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Re... |
#include <bits/stdc++.h> int main() { int x1, y1, r1, x2, y2, r2; scanf( %d %d %d %d %d %d , &x1, &y1, &r1, &x2, &y2, &r2); double ans; ans = (sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) - r1 - r2) / 2; if (ans < 0) if (r1 > r2) ans = (r1 - r2 - sqrt((x2 - x1) * (x2 - x1) + (... |
module mod_grid_display(
input in_pix_clk, // Clock to sync all pixel inputs/outputs to
input [9:0] in_pix_x, // Current pixel output position (x,y)
input [9:0] in_pix_y,
input in_latch,
input [7:0] in_pixel_r, // Parent video pixel data to overlay on
input [7:0] in_pixel_g,
input [7:0... |
#include <bits/stdc++.h> using namespace std; const int N = 200018; int arr[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; map<long long, int> mp; long long sum1 = 0; for (int i = 1; i <= n; i++) { cin >> arr[i], sum1 += arr[i]; mp[sum1... |
// (C) 2001-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 doc... |
#include <bits/stdc++.h> using namespace std; int main() { int i; string a[3]; cin >> a[0] >> a[1] >> a[2]; for (i = 0; i < 3; i++) { if ((a[i] == rock ) && (a[(i + 1) % 3] == scissors ) && (a[(i + 2) % 3] == scissors )) { break; } if ((a[i] == scissors ) && (... |
//////////////////////////////////////////////////////////////////////////////////
//
// This file is part of the N64 RGB/YPbPr DAC project.
//
// Copyright (C) 2016-2018 by Peter Bartmann <>
//
// N64 RGB/YPbPr DAC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public ... |
#include <bits/stdc++.h> using namespace std; double max(double a, double b) { if (a >= b) return a; else return b; } int main() { double m[5], s, u; for (int i = 0; i < 5; i++) cin >> m[i]; double sum = 0, sum1; for (int i = 0; i < 5; i++) { sum1 = 0; double x; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.