text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; inline 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 * 10 + ch - 0 ; ch = getchar(); } r... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2009 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] crc;
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; void inputOutput() {} signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; inputOutput(); string yelo = AHIMOTUVWXY ; string s; cin >> s; long long int n = s.length(); for (long long int i = 0; i <... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:20:44 04/16/2015
// Design Name: BinaryExponentiation
// Module Name: H:/Users/asw011/Downloads/PrimeFactorization (1)/PrimeFactorization/test_binary_exponentiatio... |
#include <bits/stdc++.h> using namespace std; int main() { string s = ROYGBIV ; long long int n, i; cin >> n; for (i = 0; i < n - 3; i++) { cout << s[i % 4]; } cout << BIV ; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long n, x, y, a, b, c, t, q; string s; while (cin >> n >> q) { if ((n / q) % 2 == 0) { cout << NO << endl; } else cout << YES ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; map<long long, vector<long long> > m; map<long long, bool> v; map<long long, long long> c; vector<long long> b; long long i, j, k, x, y, r; for (i = 1; i <= n; i++) { cin >> x >> y; if (x ==... |
// 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 : Tue Jun 06 02:45:58 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include<bits/stdc++.h> using namespace std; const int N = 3e5 + 9; const long long inf = 2e18; int a[N], c[N], n, m; long long s1[N], s2[N]; long long f(int mid) { for (int i = mid; i <= n; i++) { if (a[i] < i - mid + 1) return 0; } return 1; } int32_t main() { ios_base::... |
#include <bits/stdc++.h> using namespace std; const int N = 505, M = 100500; int read(int &n) { char ch = ; int q = 0, w = 1; for (; (ch != - ) && ((ch < 0 ) || (ch > 9 )); ch = getchar()) ; if (ch == - ) w = -1, ch = getchar(); for (; ch >= 0 && ch <= 9 ; ch = getchar()) q = q... |
#include <bits/stdc++.h> using ll = long long; using ld = long double; using ull = unsigned long long; using namespace std; const int N = 2002, NN = 502, mod = 1e9 + 7, mod1 = 1e9 + 9, Base = 317, Base1 = 371; int n, K, pw[NN], pw1[NN], lcp[N], mn[N][11], id[N]; string s[N]; struct Hash { ... |
#include <bits/stdc++.h> using namespace std; const int N = 52; struct node { int v, w, nxt; } e[N << 1]; int s, n, m, first[N], cnt = 1, siz[N], de[N]; inline void add(int u, int v, int w) { e[++cnt].v = v; e[cnt].w = w; e[cnt].nxt = first[u]; first[u] = cnt; ++de[u]; } inline v... |
#include <bits/stdc++.h> using namespace std; int vp, vd, time_s, time_b, dist; int main() { scanf( %d%d%d%d%d , &vp, &vd, &time_s, &time_b, &dist); if (vd <= vp) { puts( 0 ); return 0; } int ans = 0; double now = 1.0 * vp * time_s; while (now < dist) { double Overtake = ... |
/*
* Copyright 2010, Aleksander Osman, . 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 of
* con... |
#include <bits/stdc++.h> using namespace std; int main() { long long q; cin >> q; while (q--) { long long n, a, b; cin >> n >> a >> b; if (a + b >= n) cout << max(a, b) - (a + b - 1 - n) << endl; else cout << min(a, b) + 1 << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; struct node { int va, id; } a[200015], b[200015]; int n, Q, rv[200015]; long long dp[200015]; inline bool cmp(node x, node y) { return x.va > y.va; } int main() { scanf( %d%d , &n, &Q); for (int i = 1; i <= n; i++) scanf( %d , &a[i].va), a[i].id = ... |
/**
* 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::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; vector<long long> x(n); for (long long i = 0; i < n; i++) cin >> x[i]; unordered_map<int, int> m; for (auto num : x) { m[num]++; } if ... |
module cache(clk,rst_n,addr,wr_data,wdirty,we,re,rd_data,tag_out,hit,dirty);
input clk,rst_n;
input [13:0] addr; // address to be read or written, 2-LSB's are dropped
input [63:0] wr_data; // 64-bit cache line to write
input wdirty; // dirty bit to be written
input we; // write enable for cache line
inpu... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2016 Xilinx, Inc.
//
// 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
//
//... |
#include <bits/stdc++.h> using namespace std; long long int f(long long int a) { long long int i, r = 0; for (i = 1; i <= a; i++) { r += i * (9 * (pow(10, i - 1))); } return r; } int main() { long long int i, n, a; cin >> n; for (i = 1; n % (long long int)(pow(10, i)) != n; 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... |
/**
* 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... |
/* SPDX-License-Identifier: MIT */
/* (c) Copyright 2018 David M. Koltak, all rights reserved. */
/*
* rcn bus slave interface - one cycle read delay
*
*/
module rcn_slave
(
input rst,
input clk,
input [68:0] rcn_in,
output [68:0] rcn_out,
output cs,
output wr,
output [3:0] mask,
... |
#include <bits/stdc++.h> using namespace std; int main() { int n, ans, num; scanf( %d , &n); for (int i = 17; i >= 1; i--) { num = (pow(2, i) - 1) * pow(2, i - 1); if (n % num == 0) { ans = num; break; } } printf( %d n , ans); } |
`include "common.vh"
`timescale 1ns/10ps
module TwoPortRAM(
clka, ena, wea, clkb, enb, web, acka, ackb,
addra, dina, douta, addrb, dinb, doutb
);
parameter INIT = 0;
parameter ZERO = 0;
parameter LOADH = 0;
parameter LOADB = 0;
parameter LOADFILE = "default.memh";
paramet... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000 + 10; int n, m, cnt, counter, b[maxn * maxn], par[maxn][maxn]; char a[maxn][maxn]; vector<pair<int, int> > adj[maxn][maxn]; bool mark[maxn][maxn]; void dfs(int x, int y) { mark[x][y] = true; par[x][y] = cnt; counter++; for... |
#include <bits/stdc++.h> using namespace std; int a[512]; int main() { int n, t; scanf( %d , &t); while (t--) { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); vector<int> ans; for (int i = 1; i <= n; i++) { for (int j = 1; j < n - 1; 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> enum { MAXN = 102 }; int reverse[MAXN], target[MAXN], init[MAXN]; int n; int eq(int *a, int *b) { int i; for (i = 1; i <= n; i++) if (a[i] != b[i]) return 0; return 1; } void proc(int *a, int *b) { int ans[MAXN], i; for (i = 1; i <= n; i++) { ans[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... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2003 Matt Ettus
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License... |
#include <bits/stdc++.h> using namespace std; const int MAX = 100005; int n; unordered_map<int, int> bit[MAX]; unordered_map<int, int> idx; int inf = 1000000001; void update(int pos, int t, int val) { for (; t < inf; t += (t & -t)) { bit[pos][t] += val; } } int get(int pos, int t) { ... |
#include <bits/stdc++.h> using namespace std; template <typename A> ostream &operator<<(ostream &cout, vector<A> const &v); template <typename A, typename B> ostream &operator<<(ostream &cout, pair<A, B> const &p) { return cout << ( << p.first << , << p.second << ) ; } template <typename A> os... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; int vis[200005]; int comp_size; int cycle_length; void dfs(int cur, int prev, int t, vector<vector<int>> &edges) { vis[cur] = t; comp_size++; for (int e : edges[cur]) { if (vis[e] == -1) { dfs(e, cur, 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... |
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; int n, k, now, last; long long dp[2][505][505], sum[505], ans = 0, s; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n >> k; memset(dp[1], 0, sizeof dp[1]); dp[1][1][1] = 1; for (int i... |
#include <bits/stdc++.h> using namespace std; int main() { int n, jump[100005]; bool visited[100005]; string s; cin >> n; cin >> s; for (int i = 0; i < n; i++) cin >> jump[i]; int pos = 0; fill(visited, visited + n, false); while (!visited[pos]) { visited[pos] = true; ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2004 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
by_width #(1) w1 (.clk(clk));
by_width #(31) w31 (.clk(clk));
by_width #(32) w32 (.cl... |
// file: clk_200_400_exdes.v
//
// (c) Copyright 2008 - 2011 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 i... |
#include <bits/stdc++.h> using namespace std; int aa(int n) { int a = 0; for (int i = 2; i <= n - 1; i++) if (n % i == 0) { a = 1; break; } else a = 0; return a; } int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { if (aa(i) == 1 && aa(... |
#include <bits/stdc++.h> using namespace std; class trio { public: long long first, second, third; }; long long gcdExtended(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 gcd = gcdExtended(b % a, a,... |
#include <bits/stdc++.h> using namespace std; map<int, bool> childL, childR; int main() { ios::sync_with_stdio(false); cin.tie(0); ; int n, a; cin >> n; cin >> a; multiset<int> mulset; mulset.insert(a); for (int i = 1; i < n; i++) { cin >> a; auto ite = mulset.lower... |
/**
* 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; inline int read() { register int x = 0; register bool f = 0; register char ch = getchar(); while (!isdigit(ch)) { f ^= !(ch ^ - ); ch = getchar(); } while (isdigit(ch)) { x = ((x + (x << 2)) << 1) + (ch ^ 0 ); ch = getch... |
/**
* 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 i, j; int n; scanf( %d , &n); if ((n * n) % 2 == 1) { printf( %d n , ((n * n) / 2) + 1); } else { printf( %d n , (n * n) / 2); } for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { if ((i + j) % 2 ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:00:00 11/10/2015
// Design Name: clk_generator
// Module Name: C:/WINDOWS/system32/Timer/gen_clk_tst.v
// Project Name: Timer
// Target Device:
// Tool versions... |
#include <bits/stdc++.h> using namespace std; int n, a, b; vector<vector<int> > adj; vector<int> col; queue<int> x, y; void colorear(int u, int c) { col[u] = c; for (int v : adj[u]) if (col[v] == -1) colorear(v, 1 - c); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); c... |
#include <bits/stdc++.h> using namespace std; int ct[300005]; vector<pair<int, int> > val; int n, m; bool check(int vl) { for (int i = 0; i < 300005; i++) ct[i] = 0; int count = 0; for (int i = 0; i < m; i++) { if (vl != val[i].first && vl != val[i].second) { count++; ct[val[... |
/*
Copyright (c) 2015-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(c) Superion Technology Group Inc., 2015
// ALL RIGHTS RESERVED
// $Id: $
//=================================================================
//
// File name: : xlr8_f... |
#include <bits/stdc++.h> using namespace std; struct ACfixed { static const int ASZ = 10; struct node { array<int, ASZ> to; int link = -1; int tlink = -1; int id = -1; }; vector<node> d = {{}}; int add(string s, int id) { int v = 0; for (auto C : s) { ... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2013, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
`include "assert.vh"
`include "cpu.vh"
module cpu_tb();
reg clk = 0;
//
// ROM
//
localparam MEM_ADDR = 6;
localparam MEM_EXTRA = 4;
localparam STACK_DEPTH = 7;
reg [ MEM_ADDR :0] mem_addr;
reg [ MEM_EXTRA-1:0] mem_extra;
reg [ MEM_ADDR :0] rom_lower_bound = 0;
reg ... |
/*
* Copyright (c) 2008 Zeus Gomez Marmolejo <>
*
* This file is part of the Zet processor. This processor is free
* hardware; 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, or (at your option) an... |
#include <bits/stdc++.h> const int N = 1e5 + 10; const int MOD = 1e9 + 7; const int INF = 2e9; const long long INFLL = 1e18; const double PI = acos((double)-1); inline int mult(int a, int b, int p = MOD) { return (1ll * a * b) % p; } inline int add(int a, int b, int p = MOD) { return (1ll * a + b) % p; } ... |
/*
* 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... |
(* FASM_PARAMS="INV.TA1=TAS1;INV.TA2=TAS2;INV.TB1=TBS1;INV.TB2=TBS2;INV.BA1=BAS1;INV.BA2=BAS2;INV.BB1=BBS1;INV.BB2=BBS2" *)
(* whitebox *)
module C_FRAG (TBS, TAB, TSL, TA1, TA2, TB1, TB2, BAB, BSL, BA1, BA2, BB1, BB2, TZ, CZ);
// Routing ports
input wire TBS;
input wire TAB;
input wire TSL;
in... |
#include <bits/stdc++.h> using namespace std; void lwr(string& s) { for (int i = 0; i < s.size(); i++) { if (s[i] >= A and s[i] <= Z ) s[i] = s[i] - A + a ; } } pair<int, int> _rank(const string& s) { int ret = 0; for (int i = 0; i < s.size(); i++) ret += s[i] == r ; return pair... |
`timescale 1ns / 10ps
module led_controller_testbench;
reg clk;
reg reset_n;
reg test_panel_select_n;
reg [31:0] chunk_data;
reg [3:0] chunk_addr;
reg chunk_write_enable;
reg [3:0] row_addr;
reg [1:0] panel_addr;
wire serial_clk;
wire ... |
#include <bits/stdc++.h> int n, arr[100]; bool vis[100]; int Cycle(int st) { int l = 1; int node = arr[st]; vis[st] = true; while (node != st) { if (vis[node]) return -1; l++; vis[node] = true; node = arr[node]; } return l; } long long GCD(long long a, long long... |
//////////////////////////////////////////////////////////////////////////////////
// NPCG_Toggle_SCC_PI_reset for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Kibin Park <>
// Ilyong Jung <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD... |
module top;
reg [1:0] lv, rv;
reg res, pass;
initial begin
pass = 1'b1;
lv = 2'b00;
rv = 2'b00;
res = lv ==? rv;
if (res !== 1'b1) begin
$display("Failed: %b ==? %b returned 1'b%b not 1'b1", lv, rv, res);
pass = 1'b0;
end
lv = 2'b00;
rv = 2'b01;
res = lv ==? rv;
... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a[n]; int count[5005] = {0}; for (int i = 0; i < n; i++) { cin >> a[i]; count[a[i]]++; } int c[n]; int d = 1; for (int i = 1; i <= 5000; i++) { if (count[i] > k) { co... |
module adder(a, b, sum_ab);
parameter integer N_BITS_A = 4;
parameter integer BIN_PT_A = 3;
parameter integer SIGNED_A = 1;
parameter integer N_BITS_B = 4;
parameter integer BIN_PT_B = 2;
parameter integer SIGNED_B = 0;
// ... |
#include <bits/stdc++.h> using namespace std; char s[2005]; int n, c[2005][2005], ans = 0x3f3f3f3f, was, ot[2005]; bool chk() { static int ar[2005]; int sum = 0; for (int i = (1), LIM = (n); i <= LIM; i++) ar[i] = ot[i], sum += ot[i]; sort(ar + 1, ar + 1 + n); int sm = 0; for (int i = (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 main() { string s; int i, j, n, k, imp, c, h; int f[200]; { imp = 0; memset(f, 0, sizeof(f)); cin >> k; cin >> s; n = ((int)s.size()); h = n % 2 + n / 2; for (i = 0; i < n; i++) if (isalpha(s[i])) f[s... |
#include <bits/stdc++.h> using namespace std; int n, tans, a[100005], qaq[100005], que[1 << 15]; bool vis[1 << 15]; struct node { int x, y, z; } ans[100005 << 1]; struct node2 { int ty, lst, pos; } pre[1 << 15]; void ins(int x, int y, int z) { a[x] ^= 1, a[y] ^= 1, a[z] ^= 1; ans[++tans]... |
#include <bits/stdc++.h> using namespace std; long long ar[200004]; long long prefix[200004]; long long D[200004]; void calc(long n) { D[n] = 0; long long mx = -1000000000000000000; for (long i = n - 1; i >= 1; i--) { D[i] = max(mx, prefix[i + 1] - D[i + 1]); mx = max(mx, D[i]); } ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////
//
// This file is part of Descrypt Ztex Bruteforcer
// Copyright (C) 2014 Alexey Osipov <giftsungiv3n at gmail dot com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of ... |
/******************************************************************************
* 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 la... |
#include <bits/stdc++.h> using namespace std; long long int lar(long long int a, long long int b) { return ((a >= b) ? a : b); } long long int les(long long int a, long long int b) { return ((a <= b) ? a : b); } int main() { string s; cin >> s; vector<string> v; long long int a = 0, ... |
#include <bits/stdc++.h> using namespace std; bool is_opening(char c) { switch (c) { case ( : case [ : case { : case < : return true; break; case ) : case ] : case } : case > : return false; break; } } bool is_match_... |
/**
* 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() { cout << INTERCAL n ; return 0; } |
#include <bits/stdc++.h> using namespace std; long long num[100500]; long long d1[15], d2[15]; int main() { long long n; long long ans = 0; scanf( %lld , &n); for (int i = 1; i <= n; i++) { scanf( %lld , &num[i]); } for (int i = 1; i <= n; i++) { long long digit = 0; lo... |
// Copyright (c) 2012 Ben Reynwar
// Released under MIT License (see LICENSE.txt)
// This is a wrapper around the channelizer module so that it can be
// accessed from the myhdl test bench.
module dut_channelizer;
reg clk;
reg rst_n;
reg [`WIDTH-1:0] in_data;
reg ... |
// system_acl_iface_mm_interconnect_2_avalon_st_adapter.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 185
`timescale 1 ps / 1 ps
module system_acl_iface_mm_interconnect_2_avalon_st_adapter #(
pa... |
#include<bits/stdc++.h> using namespace std; const int N=1505; const int Q=11; int read() { int s=0; char c=getchar(),lc= + ; while (c< 0 || 9 <c) lc=c,c=getchar(); while ( 0 <=c&&c<= 9 ) s=s*10+c- 0 ,c=getchar(); return lc== - ?-s:s; } void write(int x) { if (x<0) putchar( - ),x=-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 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; int main() { int n; scanf( %d , &n); n = (int)((double)n / 3 + 0.5); cout << n / 12 << << n % 12 << n ; } |
#include <bits/stdc++.h> using namespace std; const int ZIMAX = 3005; int n, v; int cnt[ZIMAX]; int main() { cin >> n >> v; for (int i = 1; i <= n; ++i) { int ai, bi; cin >> ai >> bi; cnt[ai] += bi; } int ans = 0; int before = 0; for (int i = 0; i < ZIMAX; ++i) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j, sum, count; cin >> n; int a[n][n]; int row[n], col[n]; for (i = 0; i < n; i++) { sum = 0; for (j = 0; j < n; j++) { cin >> a[i][j]; sum += a[i][j]; } row[i] = sum; } for (j = 0... |
#include <bits/stdc++.h> using namespace std; unordered_set<int> int_set; set<int, greater<int> > divisors; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; string a; cin >> a; if ((a.size()) == 1) { cout << a << a << n ; return 0; } else { str... |
//bug1061
//typedef logic [7:0] foo_t;
module ptype
(
/*AUTOINPUT*/
// Beginning of automatic inputs (from unused autoinst inputs)
input foo_t a, // To b0 of ptype_buf.v, ...
// End of automatics
/*AUTOOUTPUT*/
// Beginning of automatic outputs (from unused autoinst outputs)
ou... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100100; bool vis[maxn]; long long val[3][maxn]; long long mii[3]; vector<int> g[maxn]; vector<int> a; int ans[maxn]; int d[maxn]; void dfs(int now) { a.push_back(now); vis[now] = 1; for (int i = 0; i < g[now].size(); i++) { ... |
#include <bits/stdc++.h> const double pi = 3.14159265358979323846; using namespace std; long long fastexp(long long a, long long b) { long long ans = 1; long long temp = a; while (b > 0) { if (b & 1) ans *= (temp); temp *= temp; b >>= 1; } return ans; } long long GCD(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 law... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1000000000000000; const int maxn = 1e5 + 100; long long dp[maxn][2], c[maxn]; string reverse(string s) { string t = ; for (int i = s.size() - 1; i >= 0; i--) t += s[i]; return t; } int main() { int n; scanf( %d , &n)... |
#include <bits/stdc++.h> using namespace std; int main() { int s[10], a, b, c; cin >> a >> b >> c; s[0] = a + (b * c); s[1] = a * (b + c); s[2] = a * b * c; s[3] = (a + b) * c; s[4] = a + b + c; s[5] = (a * b) + c; sort(s, s + 5, greater<int>()); cout << s[0] << endl; ret... |
#include <bits/stdc++.h> using namespace std; long long n, s, ans, a[200001], f[200001]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for (register long long i = 1; i <= n; ++i) { cin >> a[i]; s ^= a[i]; long long x = a[i]; for (register ... |
#include <bits/stdc++.h> using namespace std; long long f(long long n) { long long t = n; for (long long i = 2; i * i <= n; i++) if (n % i == 0) { t = t / i * (i - 1); while (n % i == 0) n /= i; } if (n > 1) t = t / n * (n - 1); return t; } int main() { long long ... |
#include <bits/stdc++.h> using namespace std; string A, B; int has[10]; string res; void Create(int from) { for (int i = 0; i < 10; i++) { for (int j = 0; j < has[i]; j++) { res[from++] = i + 0 ; } } } int main() { cin >> A >> B; int st = 0; for (int i = 0; i < A.l... |
`include "probador_Rx.v"
`include "Rx_Module.v"
module test_bench_Rxt;
//cables de comunicacion entre modulos
wire clock;
wire reset;
wire start;
wire [7:0] RX_BUF_FRAME_TYPE; //B2..0 110b: Received Cable Reset
wire [15:0] ALERT; //B3 Hard Reset
wire [7:0] RECEIVE_DETECT;
wire [7:0] RECEIVE_BYTE_COUNT;
wi... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); double a, b, c[100005], mx; int n; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %lf %lf , &a, &b); c[i] = (atan2(b, a) * 180) / pi; } sort(c, c + n); for (int i = 0; i < n - 1; i++) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.