source_code stringlengths 26 62k | lang_cluster stringclasses 11
values | src_uid stringlengths 32 32 | code_uid stringlengths 32 32 | difficulty int32 -1 3.5k ⌀ | exec_outcome stringclasses 1
value |
|---|---|---|---|---|---|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class AntonAndCurrency {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String input... | Java | bc375e27bd52f413216aaecc674366f8 | 5e4df66adad07f5b81db71092ac21fc2 | 1,300 | PASSED |
#include <cstdio>
#include <algorithm>
#include <cmath>
typedef long long LL;
inline int read()
{
char ch=getchar();
int x=0,f=1;
while(ch<'0'||ch>'9') { if(ch=='-') f=-1; ch=getchar(); }
while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); }
return x*f;
}
const int MAXN=2e5+10,INF=0x3f... | C++ | a2a785ec219f7554383780a6efd4fd2b | 0bbef3c05367a51887a1b2a784864d96 | 2,100 | PASSED |
#include <bits/stdc++.h>
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb emplace_back
using namespace std;
typedef long l... | C++ | a2a785ec219f7554383780a6efd4fd2b | e2f4ddc1688245be1fee0d54e1377729 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
long long l[200001];
long long r[200001];
long long left_[200001];
long long right_[200001];
long long dp[200001][3];
vector<int> b;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
int n, m, k, q;
cin >> n >> m >> k >> q;
long long max_heigh... | C++ | a2a785ec219f7554383780a6efd4fd2b | a45ca72ec942373c33e8d419b0c3e708 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
int n,m,k,q;
long long b[200005];
long long l[200005],r[200005];
long long pos[200005][4];
long long f[200005][4];
int main() {
memset(f,0x3f,sizeof(f));
scanf("%d%d%d%d",&n,&m,&k,&q);
for (int i=1;i<=n;i++) {
l[i] = INF;
r[i... | C++ | a2a785ec219f7554383780a6efd4fd2b | fbe2785f774e77cea3db98caff534fc7 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200000 + 1;
int n, m, k, q;
unordered_map<int, int> head, tail;
bool safe[MAX_N];
int left_safe[MAX_N], right_safe[MAX_N];
void init() {
int last_safe = 0;
for (int i = 1; i <= m; i++) {
if (safe[i]) last_safe = i;
left_safe[i] ... | C++ | a2a785ec219f7554383780a6efd4fd2b | 11f07542010b37c31514a02e9882367c | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
#define int long long
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
inline int read()
{
int ret=0,f=0;char c=gc();
while(!isdigit(c)){if(c=='-')f=1;c=... | C++ | a2a785ec219f7554383780a6efd4fd2b | 9e448df7b548b7c58341f9454edb51d5 | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
#define int long long
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
inline int read()
{
int ret=0,f=0;char c=gc();
while(!isdigit(c)){if(c=='-')f=1;c=... | C++ | a2a785ec219f7554383780a6efd4fd2b | 0ec138ca7d14831c3b6c76a892850079 | 2,100 | PASSED |
#include <bits/stdc++.h>
#define FOR(i, n) for(int i=0; i<(n); i++)
#define RNG(i, f, t) for(int i=(f); i<=(t); i++)
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef signed long long ll;
typedef unsigned long long ull;
int main() {
ios_base::sync_with_std... | C++ | a2a785ec219f7554383780a6efd4fd2b | 29a3538ac61db8d10e20cf5b4dcfdabc | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5+10;
int l[maxn],r[maxn];
typedef long long ll;
ll INF = 1e15+10;
ll dp[maxn][4];
int wz[maxn][4];
int wzl[maxn];
int main()
{
// int p[10];
// for(int i = 0;i<10;i++){
// p[i] = i+1;
// }
// for(int i = 0;i<=11;i++){
// ... | C++ | a2a785ec219f7554383780a6efd4fd2b | aedadea5aea3338a90346430858395a4 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5 + 10;
const long long INF = 1e15;
typedef pair < int, int > II;
int cL[MAXN], cR[MAXN], l[MAXN], r[MAXN], b[MAXN];
long long f[5][5];
int n, m, k, q, id;
long long calcL(II p, int np, int lim, int row, int id, int type) {
int l = cL[np], ... | C++ | a2a785ec219f7554383780a6efd4fd2b | b3a745cc849aec2fa606d7297f0cec4f | 2,100 | PASSED |
#include <bits/stdc++.h>
#define y1 fjne9w8err
typedef long long LL;
using namespace std;
const int N = 2e3 + 10;
int n1,n2;
LL ans,sum1,sum2,k,d = 0;
LL f1[N],f2[N];
struct Node{
int x,y;
LL s;
}s1[N * N / 2],s2[N * N / 2];
map<LL,bool>u1,u2;
int t1,t2;
int xp[3],yp[3];
bool cmp(Node A,Node B){return B.s < A.... | C++ | b8016e8d1e7a3bb6d0ffdcc5ef9ced19 | 4d5a3396f530d681d88d57e2e4ccb21f | 2,200 | PASSED |
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
typedef long long ll;
const int M=2e3+5;
#define pii pair<int,int>
#define mkp(a,b) make_pair(a,b)
int A[M],B[M],n,m,allc;
ll sum1,sum2;
struct node{
ll s;int p1,p2;
inline bool operator < (const node &tmp)const{
return... | C++ | b8016e8d1e7a3bb6d0ffdcc5ef9ced19 | cf7bbd2b4b32a3d1691ccd72ab694642 | 2,200 | PASSED |
#include<iostream>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<set>
using namespace std;
const long long inf=(1ll<<61);
int n,m;
int a[2011],b[2011];
long long suma=0ll,sumb=0ll,sb;
long long labs(long long a)
{
if (a<0) return -a;
else return a;
}
long long v[3];
int x11,y11,x21,y21,x22,y22;
set<l... | C++ | b8016e8d1e7a3bb6d0ffdcc5ef9ced19 | 6a233bd669ad7a4b494e1a880e998a97 | 2,200 | PASSED |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n,m;
long long sa=0,sb=0,t;
vector<long long> a,b;
vector<pair<long long,pair<int,int> > > v;
pair<long long,pair<int,int> > binarySearch(long long x)
{
int l=0,r=v.size()-1;
long long Min=1e18;
while(l<r)
{
int ... | C++ | b8016e8d1e7a3bb6d0ffdcc5ef9ced19 | ef8b291826074dba641e5ce30b606f74 | 2,200 | PASSED |
#include<bits/stdc++.h>
#define MAX 4000000
#define ll long long
using namespace std;
vector< pair<ll,pair<int,int> > > A,B;
int n,m;
ll INF=INT_MAX;
ll dif,D,ans1,ans2;
pair<int,int> p[2],q;
bool cmp(const pair<ll,pair<int,int> > &a,const pair<ll,pair<int,int> > &b)
{
return (a.first)<(b.first);
}
bool cmpf(cons... | C++ | b8016e8d1e7a3bb6d0ffdcc5ef9ced19 | 50361f9ce89a8d71416cfeb8023d75e4 | 2,200 | PASSED |
#include <iostream>
#include <cstdio>
#include <map>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
int a[2010], b[2010];
vector<pair<long long, pair<int, int> > > va;
vector<pair<long long, pair<int, int> > > vb;
int main() {
int n, m;
scanf("%d", &n);
long long sum = 0;
for (int... | C++ | b8016e8d1e7a3bb6d0ffdcc5ef9ced19 | 2569dd20dcae9529fbb32d2ac10da621 | 2,200 | PASSED |
#include<iostream>
#include<stdio.h>
#include<queue>
#include<algorithm>
#include<math.h>
#include<string>
#include<string.h>
#include<vector>
#include<map>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define drep(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
typedef long long LL;
const int MN=201000;
const in... | C++ | b8016e8d1e7a3bb6d0ffdcc5ef9ced19 | abb4a1867c1c1f988b16028d72757c56 | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,int> par;
const ll oo = ( 1ll << 60ll );
const int MAXN = 4000100;
ll a[MAXN] , b[MAXN];
struct it{
ll v;
int c1, c2;
it(){}
it( int cc1 , int cc2 , ll vv ){
c1 = cc1;
c2 = cc2;
v = vv;
... | C++ | b8016e8d1e7a3bb6d0ffdcc5ef9ced19 | 3ce448dcd2545ed14ea817b2cc4e3a2b | 2,200 | PASSED |
#include<bits/stdc++.h>
#define LL long long
#define Pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
const int maxn = 2000 + 5;
using namespace std;
LL a[maxn],b[maxn],n,m,cnt1,cnt2, num , dira[maxn*maxn] ,dirb[maxn*maxn];
Pii idx[maxn*maxn][3];
LL suma,sumb,da[maxn*maxn],db[maxn*maxn],ans;
... | C++ | b8016e8d1e7a3bb6d0ffdcc5ef9ced19 | bf2ece13e0dc6c5c0f635e5c1f9f4353 | 2,200 | PASSED |
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
int n, m;
int a[10001], b[10001];
ll sum1 =... | C++ | b8016e8d1e7a3bb6d0ffdcc5ef9ced19 | 505bdee74e119487c62b977a1dbed828 | 2,200 | PASSED |
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static int find_less_than_avg(int arr[], int avg, int m){
for(int i = 1; i <= m; i++)
if(arr[i] < avg)
return i;
return -1;
}
public static void process()throws IOException
{
... | Java | 0d89602f5ed765adf6807f86df1205bd | 9f7def9dc65fbd12d1360f80591b4adb | 1,600 | PASSED |
import java.util.*;
import java.io.*;
public class PolycarpattheRadio {
// https://codeforces.com/contest/723/problem/C
public static void main(String[] args) throws IOException, FileNotFoundException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader in = new Buffer... | Java | 0d89602f5ed765adf6807f86df1205bd | f091070b08a221d54f4fea4c38144533 | 1,600 | PASSED |
#pragma GCC optimize("Ofast")
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <cstdlib>
#include <exception>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <tuple>
#incl... | C++ | 0d89602f5ed765adf6807f86df1205bd | fd642d9ffe191c446d8f127fa420a6d6 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl "\n"
#define long long int
#define pb push_back
#define mp make_pair
#define vll vect... | C++ | 0d89602f5ed765adf6807f86df1205bd | 8cd51201775ae50e7b4d1fd687784232 | 1,600 | PASSED |
// Problem: C. Polycarp at the Radio
// Contest: Codeforces - Codeforces Round #375 (Div. 2)
// URL: https://codeforces.com/contest/723/problem/C
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
typedef long lon... | C++ | 0d89602f5ed765adf6807f86df1205bd | 9a048da451c88b06725281e662d927b5 | 1,600 | PASSED |
#include <iostream>
#include <map>
using namespace std;
int count(int k, int ar[], int n)
{
int count = 0;
for(int i =0;i<n;i++)
{
if(ar[i]==k)
{
count++;
}
}
return count;
}
/*
bool isMax(int k,int ar[],int n)
{
int max_freq = 0,max_element = 0;
map<int... | C++ | 0d89602f5ed765adf6807f86df1205bd | 2cb1eff5d81006dd5cff0e1552385c8f | 1,600 | PASSED |
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef ... | C++ | 0d89602f5ed765adf6807f86df1205bd | 462d5c2275c74d63a4112fcb46770cc3 | 1,600 | PASSED |
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;
/********** TEMPLATE STARTS HERE ***********/
#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define all(v) v.begin(), v.end(... | C++ | 0d89602f5ed765adf6807f86df1205bd | 4cd1698a3c5ef0c4eb970966176fb938 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld double
#define oo 666666666
int main()
{
ios::sync_with_stdio(0);
int n,m;
cin>>n>>m;
vector<int>A(n),F(n+1);
for(int i=0; i<n; i++)
cin>>A[i],F[(A[i]>n ? 0 : A[i])]++;
int opt = n/m;
int ats = 0;
f... | C++ | 0d89602f5ed765adf6807f86df1205bd | ecfb84bc913bbcbc5a68e8647cec7b12 | 1,600 | PASSED |
#include <bits/stdc++.h>
#define pi acos(-1)
#define fastcin ios::base_sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f;
const LL LL_INF = 1LL << 62;
const int maxn = 2000 + 10;
const int mod = 1e9 + 7;
int a[maxn];
map<int... | C++ | 0d89602f5ed765adf6807f86df1205bd | 52f5ebe374fe7576c88dc60345f32b7e | 1,600 | PASSED |
a=int(input())
c=[]
for i in range(a):
c.append(input().split())
k=int(input())
for i in range(a):
if k>=int(c[i][0]) and k<=int(c[i][1]):
print(a-i) | Python | 2545b6af730f99193041a8810b728cb3 | 4e6b2de7ea39146f86a879e874e940fc | 800 | PASSED |
n = int(input())
end = []
for i in range(n):
t = input().split()
end.append(int(t[1]))
k = int(input())
print(len([i for i in end if i >= k])) | Python | 2545b6af730f99193041a8810b728cb3 | c823988f2c54bfc5a5c0162bf233b997 | 800 | PASSED |
n = int(input())
list_in = []
for i in range(n):
a = [int(x) for x in input().split()]
list_in.append(a)
k = int(input())
index = 0
while(k-1 >= list_in[index][1] and index < n):
index += 1
print(n-index)
| Python | 2545b6af730f99193041a8810b728cb3 | 4e1e9a70b7ff8bab4d9b7a40492a5364 | 800 | PASSED |
def f(n, l_r_arr, k):
now = 0
for i in range(n):
if l_r_arr[i][0] <= k <= l_r_arr[i][1]:
now = i
break
return n - now
# print(f"{f(3, [(1, 3), (4, 7), (8, 11)], 2)} = 3")
# print(f"{f(3, [(1, 4), (5, 9), (10, 12)], 9)} = 2")
# print(f"{f(3, [(1, 4), (5, 9), (10, 12)], 1)} ... | Python | 2545b6af730f99193041a8810b728cb3 | 9e3a0e154311a68e0722bca22342b5f8 | 800 | PASSED |
from array import *
data = array('i', [])
n = int(input())
b = n
for i in range(b):
x, y = input().split()
x = int (x)
y = int (y)
for j in range(x, y+1):
data.insert(len(data), n)
n = n - 1
k = int(input())
print(data[k - 1])
| Python | 2545b6af730f99193041a8810b728cb3 | 1ee711b6af4ce118db7f6bc54619e7b9 | 800 | PASSED |
n = int(input())
l = []
for i in range(n):
a, b = map(int, input().split())
l.append(b)
k = int(input())
c = 0
for i in l:
if i < k:
c +=1
print (n - c)
| Python | 2545b6af730f99193041a8810b728cb3 | 3055a2648dfd7ee1abda82cc76775e79 | 800 | PASSED |
n = gets.to_i
l = Array.new(n)
r = Array.new(n)
n.times do |i|
l[i], r[i] = gets.split.map(&:to_i)
end
k = gets.to_i
puts r.count { |rr| rr >= k }
| Ruby | 2545b6af730f99193041a8810b728cb3 | 1d127c66bf839bec12f350469578cb70 | 800 | PASSED |
n = gets.to_i
ch = []
(1..n).each do |i|
ch << gets.split(" ").map(&:to_i)
end
k = gets.to_i
res = 0
(0..n-1).each do |i|
if k > ch[i][1]
res += 1
end
end
puts n-res
| Ruby | 2545b6af730f99193041a8810b728cb3 | f5e63aad18e71b258aee7f43268fb7c2 | 800 | PASSED |
n = gets.to_i
l, r = [], []
n.times do
li, ri = gets.split.map(&:to_i)
l << li
r << ri
end
k = gets.to_i
i = 0
loop do
break if k <= r[i]
i += 1
end
puts n - i
| Ruby | 2545b6af730f99193041a8810b728cb3 | 58cf9bd9d139aef311f99621b8c946dc | 800 | PASSED |
n = input()
a = []
for i in range(n) :
f,l = map(int, raw_input().split())
a.append(l)
k = input()
out = 0
for e in a :
if e >= k :
out += 1
print out | Python | 2545b6af730f99193041a8810b728cb3 | da97d83992896b0284786da34708c563 | 800 | PASSED |
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<cassert>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<cmath>
#define DEBUGLEVEL
#ifdef DEBUGLEVEL
#define printf_debug(fmt, args...) fprintf(stderr, fmt, ##args)
#else
#define ... | C++ | 9f36d49541e6dd7082e37416cdb1949c | fabadf7eeb1f75d67506abd7c0961124 | 2,100 | PASSED |
#include <iostream>
#include <cstdio>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
#define TRACE(x) cout << #x << " = " << x << endl;
typedef long long int llint;
const int MAXN=100010,mod=1000000009;
int n;
int kx[MAXN],ky[MAXN],moji[MAXN],u_setu[MAXN],izbacen[MAXN];
... | C++ | 9f36d49541e6dd7082e37416cdb1949c | 96bfdad69a61ca47816f831e02e99689 | 2,100 | PASSED |
#if 1
#include <functional>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdlib>
#include <cassert>
#include <cstring>... | C++ | 9f36d49541e6dd7082e37416cdb1949c | 47f13d35479ca9f164b634f5a961f4a1 | 2,100 | PASSED |
#include<iostream>
#include<cmath>
#include<iomanip> //Per quan vulguis fer 'cout' currats (p.e. amb 4 decimals)
#include<vector>
#include<map>
#include<queue>
#include<fstream> //Per a fer que l'entrada i/o la sortida siguin fitxers
#include<algorithm>
#include<string>
#include<stack> //Poc útil
#include<numeric> //Po... | C++ | 9f36d49541e6dd7082e37416cdb1949c | 5912198501fa0d96fdbd547a642812d3 | 2,100 | PASSED |
#include<iostream>
#include<cmath>
#include<iomanip> //Per quan vulguis fer 'cout' currats (p.e. amb 4 decimals)
#include<vector>
#include<map>
#include<queue>
#include<fstream> //Per a fer que l'entrada i/o la sortida siguin fitxers
#include<algorithm>
#include<string>
#include<stack> //Poc útil
#include<numeric> //Po... | C++ | 9f36d49541e6dd7082e37416cdb1949c | 4812b90e0beedc44d6375bedac89b3cd | 2,100 | PASSED |
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int,int>apio;
typedef pair<int,apio>ioi;
const int maxN=100010,modP=1000000009;
#define fi "A.INP"
#define fo "A.OUT"
#define foru(i,l,r) for(int i=l;i<=r;+... | C++ | 9f36d49541e6dd7082e37416cdb1949c | 07ffd602ce85276d09591babd20c64ce | 2,100 | PASSED |
#include <iostream>
#include <sstream>
#include <numeric>
#include <set>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <strings.h>
#include <math.h>
#include <string.h>
#include <string>
#include <bitset>
#include <limits.h>
#include <iomanip>
using n... | C++ | 9f36d49541e6dd7082e37416cdb1949c | 9413e3a9e44411cf763092cd9edad287 | 2,100 | PASSED |
//#include <cstdio>
//#include <cstring>
//#include <cstdlib>
//#include <string>
//#include <iostream>
//#include <algorithm>
//#include <sstream>
//#include <cmath>
//using namespace std;
//#include <queue>
//#include <stack>
//#include <vector>
//#include <deque>
//#define cler(arr, val) memset(arr, val, sizeof(a... | C++ | 9f36d49541e6dd7082e37416cdb1949c | 61789dda7f857a9506adf1758ec6d39b | 2,100 | PASSED |
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<map>
#include<algorithm>
using namespace std;
const int MOD = 1E9+9;
const int N = 1E5+10;
typedef long long ll;
int scan(){int i=0;scanf("%d",&i);return i;}
int n,m,ans,du[N],chu[N];
int tree[N],all;
short v[N];
void push(int x,int val){all+=val;for(x++;x<=n;... | C++ | 9f36d49541e6dd7082e37416cdb1949c | f7417e0245c9ea395aacddcedc06ba5e | 2,100 | PASSED |
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <set>
using namespace std;
#define MAX (1000000009)
#define MAXN (100000)
map<pair<int, int>, int> position;
int x[MAXN], y[MAXN];
set<int> freePoint;
int result[MAXN];
int visit[MAXN];
bool checkFree(int x, int y){
bool notFree ... | C++ | 9f36d49541e6dd7082e37416cdb1949c | 377a993b74b46e7cb9bc6308e236586b | 2,100 | PASSED |
import collections
n,m=map(int,input().split())
m+=2
arr=list(map(int,input().split()))
arr.append(0)
arr.append(n)
arr=sorted(arr)
g,r=map(int,input().split())
q=collections.deque()
q.append((0,0))
dist=[[0]*(g+1) for _ in range(m+2)]
checked=[[0]*(g+1) for _ in range(m+2)]
checked[0][0]=1
ans=-1
while len(q)!=0:
v... | Python | 64625b26514984c4425c2813612115b3 | 9f6be0f2190dd59bef5b14e895e712b1 | 2,400 | PASSED |
import collections
n,m=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr)
g,r=map(int,input().split())
q=collections.deque()
q.append((0,0,0))
checked=[[-1]*(g) for _ in range(m)]
checked[0][0]=0
while len(q)!=0:
v,t,cnt=q.popleft()
if v!=m-1:
cost1=arr[v+1]-arr[v]
if t+cost1<=g:
... | Python | 64625b26514984c4425c2813612115b3 | 30e6f583b76bdc4b451ef600494e9c7d | 2,400 | PASSED |
import sys
sys.setrecursionlimit(10000)
from collections import deque
from heapq import heappush, heappop
class Memoize:
def __init__(self, f):
self.f = f
self.memo = {}
def __call__(self, *args):
if not args in self.memo:
self.memo[args] = self.f(*args)
return self... | Python | 64625b26514984c4425c2813612115b3 | 218cacd8bb448f90308e21fcfd96dbfe | 2,400 | PASSED |
@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")
import java.io.PrintWriter
import java.util.ArrayDeque
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println ... | Kotlin | 64625b26514984c4425c2813612115b3 | f0d2f190830ef4e4ea517aeda0a3ec7e | 2,400 | PASSED |
import java.io.*;
import java.util.*;
/*
procrastinating
*/
public class Main {
static FastReader in;
static PrintWriter out;
static Random rand = new Random();
static final int INF = (int) (1e9 + 10), MOD = (int) (1e9 + 7), LOGN = 60;
static final long IINF = (long) (2e18 + 10);
static clas... | Java | 64625b26514984c4425c2813612115b3 | 717f4df48dbacb4ce2bec7baa2cfc24f | 2,400 | PASSED |
import java.io.*;
import java.util.*;
/*
procrastinating
*/
public class Main {
static FastReader in;
static PrintWriter out;
static Random rand = new Random();
static final int INF = (int) (1e9 + 10), MOD = (int) (1e9 + 7), LOGN = 60;
static final long IINF = (long) (2e18 + 10);
static clas... | Java | 64625b26514984c4425c2813612115b3 | bf18b12fac907e49706064932faae78d | 2,400 | PASSED |
/**
* @author derrick20
*/
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
public class UnexpectedGuestREDO {
public static void main(String[] args) throws Exception {
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int N = sc.next... | Java | 64625b26514984c4425c2813612115b3 | db21d04edb4c5ef152c833408a143119 | 2,400 | PASSED |
import java.io.*;
import java.util.*;
public class E {
public static void main(String... args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
int m = sc.nextInt();
ArrayList<Integer> arr = new ArrayList<Integer>();
for(int i = 0; i < m; i++) arr.add(sc.nextInt());
Collections.sort(arr);
in... | Java | 64625b26514984c4425c2813612115b3 | b89d58dfb1c6ee6b8a3e89661b086b22 | 2,400 | PASSED |
import java.io.*;
import java.util.*;
import java.util.zip.Adler32;
public class Contest1 {
static class node implements Comparable<node> {
int idx, time;
int cost;
public node(int a, int b, int c) {
idx = a;
time = b;
cost = c;
}
@Over... | Java | 64625b26514984c4425c2813612115b3 | 94c3c6b33ff4f21ae2aae8da6d7b0c2c | 2,400 | PASSED |
import java.io.*;
import java.util.*;
public class Sol2{
static class node {
private int idx;
private int time;
public node(int idx, int time) {
this.idx = idx;
this.time = time;
if(this.time==g) this.time=0;
}
}
public static int n, g, r, m;
public static int arr[];
public static int dist[][];
... | Java | 64625b26514984c4425c2813612115b3 | f459e339756ee5d997eea1cdf60f0da4 | 2,400 | PASSED |
///*Bismillahir Rahmanir Rahim***///
///**Author Thasin Sheikh**///
/* #include <regex>
...
std::string string("hello $name");
string = std::regex_replace(string, std::regex("\\$name"), "Somename");
*/
/*while(a)
{
if(a%2==0)
dvi.push_back(0);
else
dvi.push... | C++ | 5fcc22cdc38693723d8a9577d685db12 | ed98eb528775e18342d423e67e19adc8 | 1,000 | PASSED |
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sf scanf
#define pf printf
#define ln printf("\n")
#define mkp(a,b) make_pair(a,b)
#define pii pair<ll,ll>
#define mem(a,b) memset(a,b,sizeof a... | C++ | 5fcc22cdc38693723d8a9577d685db12 | a317e8ccdc064a410cf09d19f26637d2 | 1,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll inf=1e15;
const int N=1e5+6;
int n,a[N],vis[N];
char s[N];
int main()
{
memset(vis,0,sizeof(vis));
scanf("%d",&n);
scanf("%s",s+1);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
int pos=1;... | C++ | 5fcc22cdc38693723d8a9577d685db12 | cef2684dea4652596e91de0c8bcb268a | 1,000 | PASSED |
#include <iostream>
using namespace std;
int main(){
int n;
string s;
cin >> n >> s;
int a[n];
for(int i = 0; i < n; i++) {
cin >> a[i];
}
int cur = 0;
for (int i = 0; i < 2 * n; i++) {
if (s[cur] == '>') {
cur += a[cur];
} else {
... | C++ | 5fcc22cdc38693723d8a9577d685db12 | afc8b643e973b232b315e353c91fa49d | 1,000 | PASSED |
#include <iostream>
using namespace std;
int main(){
int n;
string s;
cin >> n >> s;
int a[n];
for(int i = 0; i < n; i++) {
cin >> a[i];
}
int cur = 0;
for (int i = 0; i < n; i++) {
if (s[cur] == '>') {
cur += a[cur];
} else {
... | C++ | 5fcc22cdc38693723d8a9577d685db12 | 424334da29ee826d0cdf0b63cf505f3f | 1,000 | PASSED |
#include <bits/stdc++.h>
using namespace std ;
//
typedef long long ll ;
typedef unsigned long long llu ;
//#define eps 1e-9
//#define pi acos(-1.0)
//#define INF 100000001
//#define MAX 10100
//int rr[]= {-1,-1,0,0,1,1};
//int cc[]= {-1,0,-1,1,0,1};
//int rr[]= {0,0,1,-1};/*4 side move*/
//int cc[]= {-1,1,0,0};/*4 ... | C++ | 5fcc22cdc38693723d8a9577d685db12 | 92b43c81950a0fac554a81fd41ce824a | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
long long int curr;
string str;
int arr[100010];
map<int, int> s;
scanf("%d", &n);
getchar();
getline(cin, str);
for(int i = 1; i <= n; i++){
scanf("%d", &arr[i]);
}
str = "+" + str;
curr = 1;
s[1]++;
for(int i = 1; i <= n; i++){
... | C++ | 5fcc22cdc38693723d8a9577d685db12 | 3ee20225993d37cc481f400a47adf699 | 1,000 | PASSED |
#include <stdio.h>
int main()
{
long n, i;
scanf("%ld", &n);
long a[n];
char c[n+1];
scanf("%s", c);
long sum = 1, flag = 0;
for( i = 0 ; i < n ; i++){
scanf("%ld", &a[i]);
if( c[i] == '<')a[i] = -a[i];
}
for( i = 0 ; i < n ; i++){
sum = sum + a[sum - 1];
... | C++ | 5fcc22cdc38693723d8a9577d685db12 | fe85e836daef1dbb36924b0955503f5a | 1,000 | PASSED |
#include <stdio.h>
int main()
{
long n, i;
scanf("%ld", &n);
long a[n];
char c[n+1];
scanf("%s", c);
long sum = 1, flag = 0;
for( i = 0 ; i < n ; i++){
scanf("%ld", &a[i]);
if( c[i] == '<')a[i] = -a[i];
}
for( i = 0 ; i < n ; i++){
sum = sum + a[sum - 1];
... | C++ | 5fcc22cdc38693723d8a9577d685db12 | 0c957683df5fbe6e3b3aed2ff5c2e85e | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int cnt,a[100001],n;
string s;
int main(){
cin >> n >> s;
for(int i = 0; i < n; ++i)
cin >> a[i];
for(int i = 0; i < n; ++i){
cnt++;
if(cnt == n*2){
cout << "INFINITE";
return 0;
}
if(s[i] == '>'){
if(a[i] + i >= n){
cout << "FINITE";
return 0;
... | C++ | 5fcc22cdc38693723d8a9577d685db12 | 32bb9474a2462971ca1542f1b24c5388 | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace :: std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
const int maxn=5010;
const ll inf=1e16+900;
int t[maxn];
int x[maxn];
ll dp[maxn];
bool dpp[maxn][maxn];
ll disX(int a,int b){
return abs(x[a]-x[b... | C++ | f20e9ac7d071e6bd0ccc2b72bd52a25d | cd2614f0436e06c54275c8605a1802d7 | null | PASSED |
#include <bits/stdc++.h>
using std::cin;
using std::cout;
typedef long long ll;
typedef std::pair <int, int> pr;
const int N = 5054;
struct cake {
int t, x;
friend std::istream & operator >> (std::istream &in, cake &B) {return in >> B.t >> B.x;}
} a[N];
int n, m = 0;
bool f[N][N];
int r1[N], r2[N];
inline void up... | C++ | f20e9ac7d071e6bd0ccc2b72bd52a25d | fbeec58e83830279b0f085f6b2d7be17 | null | PASSED |
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
struct Cake {
long long t;
long long x;
bool operator < (const Cake &o) const {
return t < o.t;
}
};
long long dp[5005][5005];
int main(int argc, char**argv) {
if (argc == 2) {
freopen(argv[1], "r", std... | C++ | f20e9ac7d071e6bd0ccc2b72bd52a25d | 5bf1c74ab4d4535d797cf6ae32e9eb52 | null | PASSED |
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
#define LL long long
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;
inline LL read(){
LL x=0,f=1; char c=getc... | C++ | f20e9ac7d071e6bd0ccc2b72bd52a25d | c7765ab95f5c32be93f725fe4f84e084 | null | PASSED |
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#define maxn 5005
using namespace std;
int n,i,j,k,f[maxn][maxn],s[maxn][maxn];
int t[maxn],x[maxn],ans,id[maxn],xx[maxn];
int cmp(int i,int j){return x[i]<x[j];}
int findl(int a,int b,int res){
int l=1,r=xx[b],mid,ans;
while (l<=r){
mid=(l+r)... | C++ | f20e9ac7d071e6bd0ccc2b72bd52a25d | a9fd4b04b857f7f77a445155b78567d8 | null | PASSED |
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
int n,t[5010],x[5010];
long long g[5010],walk[5010][5010];
bool T[5010][5010];
bool good[5010],h[5010];
long long abs(long long a){
return a<0?-a:a;
}
signed main(){
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
scanf... | C++ | f20e9ac7d071e6bd0ccc2b72bd52a25d | 1ee171dbfa5e47f960b48f577ab325c5 | null | PASSED |
#include<bits/stdc++.h>
using namespace std;
struct node{
int t,x;node(){t=x=0;}
bool operator <(const node& a)const{return t<a.t;}
}a[5005];
int f[5005][5005],mint[5005],n;
int main(){
scanf("%d",&n);
fill(mint+1,mint+n+1,2e9);
for(int i=1;i<=n;i++)
scanf("%d%d",&a[i].t,&a[i].x);
sort(a+1,a+n+1);
f[0][0]=1;
... | C++ | f20e9ac7d071e6bd0ccc2b72bd52a25d | bd3aa9196467100706d28cfd50be42f1 | null | PASSED |
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;
template <typename _T>
inline void read(_T &f) {
f = 0; _T fu = 1; char c = getchar... | C++ | f20e9ac7d071e6bd0ccc2b72bd52a25d | 7ecaf7592f539f5ebe09d505d3e7bf47 | null | PASSED |
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;
template <typename _T>
inline void read(_T &f) {
f = 0; _T fu = 1; char c = getchar... | C++ | f20e9ac7d071e6bd0ccc2b72bd52a25d | 40477b02a33f8d06f0fb1306113b6007 | null | PASSED |
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;
template <typename _T>
inline void read(_T &f) {
f = 0; _T fu = 1; char c = getchar()... | C++ | f20e9ac7d071e6bd0ccc2b72bd52a25d | 5ca63c3a63316db0ef2851be4bd4c5f9 | null | PASSED |
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define maxn 100005
#define mo 1000000007
#define ll long long
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
struct mat{
ll a[2][2];
}tmp,now;
str... | C++ | 64224070d793e242070b1094aa967b13 | 9ba82c5d5583d73dfc21b5f1dd22720f | 2,300 | PASSED |
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#define L tree[t][0]
#define R tree[t][1]
using namespace std;
typedef long long LL;
const int mod=1e9+7;
const int maxn=1e5+10;
const int maxnodes=maxn*2;
struct data{int x,y,a[3][3];}E,T,op[maxn];
data operator + (const dat... | C++ | 64224070d793e242070b1094aa967b13 | a667f13846ff34713d8162bc111651e0 | 2,300 | PASSED |
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#define L tree[t][0]
#define R tree[t][1]
using namespace std;
typedef long long LL;
const int mod=1e9+7;
const int maxn=1e5+10;
const int maxnodes=maxn*2;
struct data{int x,y,a[3][3];}E,T,op[maxn];
void read(int &a)
{
a=0; ... | C++ | 64224070d793e242070b1094aa967b13 | dec188e6f6b89b437cee11ebdb1146b9 | 2,300 | PASSED |
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#define L tree[t][0]
#define R tree[t][1]
using namespace std;
typedef long long LL;
const int mod=1e9+7;
const int maxn=1e5+10;
const int maxnodes=maxn*2;
struct data{int x,y,a[3][3];}E,T,op[maxn];
void read(int &a)
{
a=0; char ch=getchar()... | C++ | 64224070d793e242070b1094aa967b13 | 84da77ae8083eafdec96abdc357ae7df | 2,300 | PASSED |
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb(x) push_back(x)
#define cout2(x, y) cout << x << " " << y << endl
#define N 100005
#define MOD 1000000007
#define v1 (2 * node)
#define v2 (2 * node + 1)
#define me (ini + fin)/2
using namespace std;
struct node{
long long f1, f2, flag;
node()... | C++ | 64224070d793e242070b1094aa967b13 | 2f863cf3f96e91e22067b6ebdc3131b4 | 2,300 | PASSED |
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
#include <deque>
#include <stack>
#include <stdio.h>
#include <map>
#include <set>
#include <time.h>
#include <string>
#include <fstream>
#include <queue>
#include <bitset>
#include <cstdlib>
#define X first
#define Y second
... | C++ | 64224070d793e242070b1094aa967b13 | 6537e8b64973a888bbf7ebff727aea81 | 2,300 | PASSED |
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
#include <deque>
#include <stack>
#include <stdio.h>
#include <map>
#include <set>
#include <time.h>
#include <string>
#include <fstream>
#include <queue>
#include <bitset>
#include <cstdlib>
#define X first
#define Y second
... | C++ | 64224070d793e242070b1094aa967b13 | 4b315f49eebc07056967fe412e38ed37 | 2,300 | PASSED |
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
#include <deque>
#include <stack>
#include <stdio.h>
#include <map>
#include <set>
#include <time.h>
#include <string>
#include <fstream>
#include <queue>
#include <bitset>
#include <cstdlib>
#define X first
#define Y second
... | C++ | 64224070d793e242070b1094aa967b13 | d7c4afc29f8d699088bbac8017626b88 | 2,300 | PASSED |
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
#include <deque>
#include <stack>
#include <stdio.h>
#include <map>
#include <set>
#include <time.h>
#include <string>
#include <fstream>
#include <queue>
#include <bitset>
#include <cstdlib>
#define X first
#define Y second
... | C++ | 64224070d793e242070b1094aa967b13 | bcb7db3b453d3f0f64831067308b2349 | 2,300 | PASSED |
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#define lson l,m,x<<1
#define rson m+1,r,x<<1|1
using namespace std;
const long long mod=1000000007;
struct Matrix
{
long long a[4];
void init()
{
a[0]=1;
a[1]=0;
a[2]=0;
a[3]=1;
}... | C++ | 64224070d793e242070b1094aa967b13 | 56ea83dc4e6b38bf2da81a38f9fb5874 | 2,300 | PASSED |
"""
def sort(n,m):
t={}
m=m.split()
m=[int(m[i]) for i in range(len(m))]
if len(m)!=n:
return "Incorrect input"
if len(m)==1:
return m[0]
d = {
'1': 4
}
d = dict([(i,0) for i in range(-100,101,1)])
while(score(d)!=len(m)):
d = dict([(i, 0) for i in ra... | Python | 1d89df4153d70087d212b711852eba5f | 92992543073fe321090e5c484c8e2e67 | 1,000 | PASSED |
t=int(input())
for i in range(t):
n=int(input())
#m,n = map(int, input().strip().split(' '))
lst = list(map(int, input().strip().split(' ')))
lst.sort(reverse=True)
for j in range(n):
print(lst[j],end=" ")
print()
| Python | 1d89df4153d70087d212b711852eba5f | ccd7f52ca8a2ff3f208f67dc07803a58 | 1,000 | PASSED |
t=int(input())
while(t):
t-=1
n=int(input())
l=list(map(int,input().strip().split()))
l.sort(reverse=True)
for i in l:
print(i,end=" ")
print() | Python | 1d89df4153d70087d212b711852eba5f | 82835a04c01f914f39f608c7480fb118 | 1,000 | PASSED |
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
print(*a) | Python | 1d89df4153d70087d212b711852eba5f | f893761fa3bfb6f6c9e5c3df62a18783 | 1,000 | PASSED |
for _ in range(int(input())):
n = int(input())
l = list(map(int , input().split()))
l.sort(reverse = True)
for i in l:
print(i , end = ' ') | Python | 1d89df4153d70087d212b711852eba5f | 363c8519ae19ee30d0caaf7de00b3d8a | 1,000 | PASSED |
def solve():
n = eval(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n - 1, -1, -1):
print(a[i], end=" ")
print("")
t = eval(input())
while t:
solve()
t -= 1 | Python | 1d89df4153d70087d212b711852eba5f | 7eb09b60a56762e902643dfa808d73a2 | 1,000 | PASSED |
for _ in range(int(input())):
n=int(input())
li=list(map(int,input().split()))
li=sorted(li,reverse=True)
print(' '.join(map(str,li)))
| Python | 1d89df4153d70087d212b711852eba5f | 952ead1905d36d2e0afd2efc544d8a3a | 1,000 | PASSED |
'''
@judge CodeForces
@id 1312A
@name Two Regular Polygons
@tag Geometry
'''
from sys import stdin
input()
for _, arr in zip(*[ iter(stdin) ] * 2):
print(' '.join(sorted(arr.split(), key=lambda x: -int(x)))) | Python | 1d89df4153d70087d212b711852eba5f | 25fe2a413e4bc11b5cc2f1cbd7c7fcce | 1,000 | PASSED |
for _ in range(int(input())):
n = int(input())
print(*sorted(list(map(int, input().split())), reverse=True)) | Python | 1d89df4153d70087d212b711852eba5f | 9d18b577d3a077c547d231d1896b2c07 | 1,000 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.