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.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
/**
* Use pen and paper. Solve on paper then code.
* If there is some reasoning e.g. sequence/paths, try printing first 100 elements or 100... | Java | 5139d222fbbfa70d50e990f5d6c92726 | 3298d2ce159c5d4aec53a3b37f4c070e | 1,100 | PASSED |
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
int n=sc.nextInt();
int a[]=new int[n];
for(int j=0;j<n;j++)
a[j]=sc.nextInt();
... | Java | 5139d222fbbfa70d50e990f5d6c92726 | b4272fa2b0dc67ca068e2f0e065338e8 | 1,100 | PASSED |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class G_YetAnotherPalindrome {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System... | Java | 5139d222fbbfa70d50e990f5d6c92726 | fb571e22d55294450f6e35f757ceeffc | 1,100 | PASSED |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
public class yetAnotherPalindromeProblem {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = ... | Java | 5139d222fbbfa70d50e990f5d6c92726 | ae701041d860f96d9735be80892b9069 | 1,100 | PASSED |
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static FastReader sc=new FastReader();
public static void main(String[] args)
{
//StringBuffer sb=new StringBuffer("");
int t = i();
outer :while (t-- > 0)
{
int n=i();
in... | Java | 5139d222fbbfa70d50e990f5d6c92726 | ecadd35107d4e96ba352c85ac60d8ba2 | 1,100 | PASSED |
import java.util.*;
import java.math.*;
public class PalindromProblem
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int runs = sc.nextInt();
while(runs-->0)
{
int n = sc.nextInt();
int[] arr = new int[n];
for(int i = 0;i<n;i++)
{
arr[i] = sc.nextInt(... | Java | 5139d222fbbfa70d50e990f5d6c92726 | 1904173bf05406e0aabc1ac3efc74e32 | 1,100 | PASSED |
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
string s;
int n, a, b, inf = 100100100;
... | C++ | 081f30ac27739002855e9d2aebe804c7 | 97c04fb5129264033a8221911904712b | 1,200 | PASSED |
#include<bits/stdc++.h>
using namespace std;
char s[100000];
main(){
int n,a,b;
cin>>n>>a>>b;
cin>>s;
if(s[a-1]==s[b-1]) cout<<0<<endl;
else cout<<1<<endl;
}
| C++ | 081f30ac27739002855e9d2aebe804c7 | 8eba23fc45a1b5cd055cf2fcd6a336e3 | 1,200 | PASSED |
#include <bits/stdc++.h>
#define NN 100100
using namespace std;
char str[NN];
int main(){
#ifndef ONLINE_JUDGE
freopen("in.in", "r", stdin);
freopen("out.out", "w", stdout);
#endif
int n, a, b;
scanf("%d%d%d", &n, &a, &b);
cin>>str;
if(str[a - 1] == str[b - 1]) puts("0");
else puts("1");
return 0;
}
... | C++ | 081f30ac27739002855e9d2aebe804c7 | 45f761a3096c4eac3eafd818d8be6ff7 | 1,200 | PASSED |
#include<bits/stdc++.h>
#define NN 110000
using namespace std;
char st[NN];
int cnt[NN];
int main(){
#ifndef ONLINE_JUDGE
freopen("in.in","r",stdin);
freopen("out.out","w",stdout);
#endif
int n,a,b;
cin>>n>>a>>b;
cin>>st;
for(int i=1;i<=n;i++)cnt[i]=st[i-1]-'0';
if(cnt[a]==cnt[b]){
printf("0");
return 0;
}... | C++ | 081f30ac27739002855e9d2aebe804c7 | c076fe22e746d1cbfa9ed614681cfd1c | 1,200 | PASSED |
#include<bits/stdc++.h>
using namespace std;
char s[10000000];
main(){
int n,a,b;
cin>>n>>a>>b;
cin>>s;
if(s[a-1]==s[b-1]) cout<<"0"<<endl;
else cout<<"1"<<endl;
}
| C++ | 081f30ac27739002855e9d2aebe804c7 | 7289746894bf5ae0652f67d6e715fddc | 1,200 | PASSED |
#include<bits/stdc++.h>
#define NN 110000
using namespace std;
char st[NN];
int cnt[NN];
int main(){
#ifndef ONLINE_JUDGE
freopen("in.in","r",stdin);
freopen("out.out","w",stdout);
#endif
int n,a,b;
cin>>n>>a>>b;
cin>>st;
for(int i=1;i<=n;i++)cnt[i]=st[i-1]-'0';
if(cnt[a]==cnt[b]){
printf("0");
return 0;
}... | C++ | 081f30ac27739002855e9d2aebe804c7 | 1adeb9fb46be6f00262a4734bec2d0b6 | 1,200 | PASSED |
#include <bits/stdc++.h>
#define x first
#define y second
#define mod 1e9+7
#define NN 200010
#define eps 1e-9
#define bclz(x) (__builtin_clz(x))
using namespace std;
typedef long long INT;
typedef double DO;
typedef pair<int,int>pii;
int power(int a, int b, int m, int ans=1) {
for(; b; b>>=1, a=1LL*a*a%m) if(b&1) ... | C++ | 081f30ac27739002855e9d2aebe804c7 | b6ead4048a3616f74d874e79db3334d1 | 1,200 | PASSED |
#include <bits\stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define TEST 0
#define ll long long
#define ull unsigned long long
#define fr first
#define sc second
#define mp make_pair
#define pr pair
#define vec vector
#define u_map unordered_map
#define u_set unordered_set
#define doub pair<ll, ll>
#def... | C++ | 081f30ac27739002855e9d2aebe804c7 | 6bda7dc5d76f3dbec55b0ac66556e016 | 1,200 | PASSED |
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <set>
#include <algorithm>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
a--; b--;
string str;
cin >> str;
if (str[a] == str[b])
cout << 0 << endl;
else
cout << 1 << endl;
return 0;
} | C++ | 081f30ac27739002855e9d2aebe804c7 | aa84db1dda81337736f3c696120e4cc2 | 1,200 | PASSED |
#include <iostream>
using namespace std;
int n,a,b;
int main(){
string s;
cin>>n>>a>>b;
cin>>s;
if (s[a-1]==s[b-1])
cout<<0;
else
cout<<1;
return 0;
} | C++ | 081f30ac27739002855e9d2aebe804c7 | 9527c2a97194d6e900cd5977d8af4245 | 1,200 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define w(e) int e ; cin >> e ; while (e--)
#define ll long long
#define endl "\n"
#define mod 10000000007
#define pi 3.1415926535897932384626433
#define setbit(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define ff firs... | C++ | da2b3450a3ca05a60ea4de6bab9291e9 | 09ffb52d6f7d4609270b773dc6736641 | 1,600 | PASSED |
// {{{ Headers
// vim:filetype=cpp:foldmethod=marker:foldmarker={{{,}}}
#include <cassert>
#include <cctype>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <deque>
#include <functional>
#include <iterator>
#include <list>
#inc... | C++ | da2b3450a3ca05a60ea4de6bab9291e9 | 15c472fd9fd40c1bca7f32e3e99782b7 | 1,600 | PASSED |
// {{{ Headers
// vim:filetype=cpp:foldmethod=marker:foldmarker={{{,}}}
#include <cassert>
#include <cctype>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <deque>
#include <functional>
#include <iterator>
#include <list>
#inc... | C++ | da2b3450a3ca05a60ea4de6bab9291e9 | 894d0fba16f0a347adc8dc6ed2965c04 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
string s; cin>>s;
int k; cin>>k;
s=s+'&';
string arr[k];
for(int i=0;i<k;i++){
cin>>arr[i];
}
int steps=0;
for(int i=0;i<k;i++){
int zeroth=0,first=0;
f... | C++ | da2b3450a3ca05a60ea4de6bab9291e9 | cc8b22a21aa187655a508bcf8e034961 | 1,600 | PASSED |
/*||>>>> Praveen Ojha <<<<>>>> 11 June 2019 <<<<>>>> 08:43:16 <<<<||*/
// #pragma GCC optimize("Ofast") //(Very Fast but Inaccurate)
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //(Small operations in many loops)
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/st... | C++ | da2b3450a3ca05a60ea4de6bab9291e9 | 8e646336360c3177c510da34bf81cf24 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
//#define PB push_b... | C++ | da2b3450a3ca05a60ea4de6bab9291e9 | a08c1334b426bfb369eb5398155bc871 | 1,600 | PASSED |
#include<bits/stdc++.h>
#define f(i,a,b) for(i=a;i<b;i++)
#define f_(i,a,b) for(i=a;i>=b;i--)
#define T_ ll t; cin>>t; while(t--)
#define NeedForSpeed ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define read(a,n) for(i=0;i<n;i++) cin>>a[i]
#define pr(... | C++ | da2b3450a3ca05a60ea4de6bab9291e9 | dfc5a3209c68990b990bfd5dc186fd1b | 1,600 | PASSED |
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s;cin>>s;
int n = s.length();
int k;cin>>k;
int ans=0;
while(k--){
vector<int> v;
string l;cin>>l;
for(int i=0;i<n;i++){
if(s[i]==l[0] || ... | C++ | da2b3450a3ca05a60ea4de6bab9291e9 | d1a83f0ff7ca608465ec27f5f888560a | 1,600 | PASSED |
/****** BISMILLAH HIR RAHMANIR RAHIM ******/
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;
typedef long long ll;
typede... | C++ | da2b3450a3ca05a60ea4de6bab9291e9 | 16da98ff39ab8943964766dd326fe7ed | 1,600 | PASSED |
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define inf (ll)(1e9+7)
#define inf2 (ll)(1e18)
#define pb push_back
#define F first
#define S second
#define R return
#define C continue
#define B break
#define MP make_pair
#define MOD (ll)(1e9+9)
using namespace std;
string s;
int q;
vec... | C++ | da2b3450a3ca05a60ea4de6bab9291e9 | 2530b3dbca22fae9d11906c7f02d6dc0 | 1,600 | PASSED |
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC o... | C++ | 86146bbbfd46634b68b1141e45201a41 | 759f12932655d16829db1de66f670e6f | 2,000 | PASSED |
/*
* Author : raj1307 - Raj Singh
* Date : 24.12.19
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <unordered_set>
#include <unorder... | C++ | 86146bbbfd46634b68b1141e45201a41 | 986515aa7c770e5ec7bf3a4660060add | 2,000 | PASSED |
/*
* Author : raj1307 - Raj Singh
* Date : 24.12.19
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <unordered_set>
#include <unordered... | C++ | 86146bbbfd46634b68b1141e45201a41 | 7570d5d97c6614c87c43553d293b08b5 | 2,000 | PASSED |
/*
* Author : raj1307 - Raj Singh
* Date : 24.12.19
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <unordered_set>
#include <unordered... | C++ | 86146bbbfd46634b68b1141e45201a41 | 4f055ef6c0b6ec7c79fcde017561c06b | 2,000 | PASSED |
#include<bits/stdc++.h>
#define ll long long
#define m (l+r)/2
#define ls o*2
#define rs o*2+1
using namespace std;
const int maxn = 3e5+10;
int a[maxn],N;
struct node {
int mx,mn,ans;
node operator+(const node &t)const {
node tmp;
tmp.mx= max(mx,t.mx);
tmp.mn=min(mn,t.mn);
i... | C++ | 86146bbbfd46634b68b1141e45201a41 | f133768ca5be035770dafa0bd7cca7f1 | 2,000 | PASSED |
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int Maxn=100100;
const int Inf=0x3f3f3f3f;
int n;
int sl[Maxn<<1];
int A[Maxn<<1];
struct SegTree{int l,r,Maxv,Minv;}T[1001000];
inline int read()
{
int fl=1,rt=0; char ch=getchar();
while(ch<'0'... | C++ | 86146bbbfd46634b68b1141e45201a41 | 18f815a2383050dc39106d5426a59064 | 2,000 | PASSED |
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int Maxn=100100;
const int Inf=0x3f3f3f3f;
int n;
int sl[Maxn<<1];
int A[Maxn<<1];
struct SegTree{int l,r,Maxv,Minv;}T[1001000];
inline int read()
{
int fl=1,rt=0; char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=... | C++ | 86146bbbfd46634b68b1141e45201a41 | 8fcfc376f3bd7f90c392544c76c21764 | 2,000 | PASSED |
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define LD long double
#define ULL unsigned long long int
#define pii pair<int, int>
#define ump unordered... | C++ | 86146bbbfd46634b68b1141e45201a41 | c1d670e142e5f571c75026a783d86750 | 2,000 | PASSED |
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define LD long double
#define ULL unsigned long long int
#define pii pair<int, int>
#define ump unordered... | C++ | 86146bbbfd46634b68b1141e45201a41 | 9a15bade9dc8b4ea17de2cf086061d6a | 2,000 | PASSED |
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define LD long double
#define ULL unsigned long long int
#define pii pair<int, int>
#define ump unordered... | C++ | 86146bbbfd46634b68b1141e45201a41 | 8ebccc11d545c599412f49d8dbba82a8 | 2,000 | PASSED |
import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int a = 0; a < t; a++) {
int n = sc.nextInt();
int numOf9 = n - (((n - 1) / 4) + 1);
char [] arr = new char[n];
for (int i = 0; i < n; i++) {
arr... | Java | 80c75a4c163c6b63a614075e094ad489 | 06b9e13698ac70a65216d86916476989 | 1,000 | PASSED |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.par... | Java | 80c75a4c163c6b63a614075e094ad489 | e01acfa2cf6825c4e8df2372b79aab8e | 1,000 | PASSED |
import java.io.*;
import java.util.*;
import java.lang.*;
public class Solution
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int t = input.nextInt();
for(int i = 0; i < t; i++)
{
int n = input.nextInt();
int a = 0;
... | Java | 80c75a4c163c6b63a614075e094ad489 | 4c81ef8dab44d5cd43c1b727c62ce985 | 1,000 | PASSED |
import java.util.*;
import java.io.*;
public class B {
public static void main(String[] args) throws IOException {
FastScanner in = new FastScanner(System.in);
int c = in.nextInt();
for (int cases = 0; cases < c; cases++) {
int n = in.nextInt();
for (int i = 0; i < ... | Java | 80c75a4c163c6b63a614075e094ad489 | e2186359e7d7c6fc747a6e6890aaf678 | 1,000 | PASSED |
import java.util.*;
import java.io.*;
public class B {
public static void main(String[] args) throws IOException {
FastScanner in = new FastScanner(System.in);
int c = in.nextInt();
for (int cases = 0; cases < c; cases++) {
int n = in.nextInt();
for (int i = 0; i < ... | Java | 80c75a4c163c6b63a614075e094ad489 | a402b3ed153f5e605adb9aee2ebbdf27 | 1,000 | PASSED |
import java.lang.*;
import java.util.*;
public class ct1 {
static class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
left=null;
right=null;
}
}
static class ListNode {
int val;
ListNode next;
ListNode(int ... | Java | 80c75a4c163c6b63a614075e094ad489 | 55529bcbc2d0f93257a606fed254b9c1 | 1,000 | PASSED |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | 80c75a4c163c6b63a614075e094ad489 | f381239710ad1b1ab7825093e15fb727 | 1,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main()
{
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int x = ceil(n/4.0);
for (int i=0; i<n-x; ++i)
cout << 9;
for (int i=0; i<x; ++i)
cout << 8;
cout << endl;
... | C++ | 80c75a4c163c6b63a614075e094ad489 | 14191773e8d367c76614bd279728a3c6 | 1,000 | PASSED |
#include <iostream>
#define ll long long
#define floop(i,x,n,y) for(i = x ; i < n ; i = i+y)
using namespace std;
int main()
{
int testcases,i,j,n;string s;
cin>>testcases;
while(testcases--)
{
cin>>n;
int k = (n/4);
if(n%4) k++;
floop(i,0,n-k,1)
cout<<9;
floop(i,0,k,1)
cout<<8;
... | C++ | 80c75a4c163c6b63a614075e094ad489 | 48937ddb54cfc52693bde87dfcc38786 | 1,000 | PASSED |
var T = +readline();
while (T) {
T -= 1;
var n = +readline();
var ans = "";
var cnt = Math.floor((n + 3) / 4);
for (var index = 0; index < n - cnt; index++) {
//const element = array[index];
ans += "9";
}
for (var index = 0; index < cnt; index++) {
//const element = a... | Javascript | 80c75a4c163c6b63a614075e094ad489 | e86ee52ab2cda447d8661887195c08dd | 1,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define mem(m,v) memset(m,v,sizeof(m))
#define pb push_back
#define mp make_pair
#define si(n) scanf("%d",&n)
#define all(x) (x.begin() , x.end() )
#define sz(x) x.size();
template<class t> inline void checkmax(t &a,t &b)
{if(b>a)a = b;}
templat... | C++ | 6cfd3b0a403212ec68bac1667bce9ef1 | bc40939bd5e4f7f730a636a9ff73d21b | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define mem(m,v) memset(m,v,sizeof(m))
#define pb push_back
#define mp make_pair
#define si(n) scanf("%d",&n)
#define all(x) (x.begin() , x.end() )
#define sz(x) x.size();
template<class t> inline void checkmax(t &a,t &b)
{if(b>a)a = b;}
templat... | C++ | 6cfd3b0a403212ec68bac1667bce9ef1 | 7c8b281f3794ee3ad3dc32abc6dad3b2 | 1,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
#define pb push_back;
#define mp make_pair
#define LL long long
#define PI acos(-1.0)
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a)|(b))
#defin... | C++ | 6cfd3b0a403212ec68bac1667bce9ef1 | 8309d80ae914fc9d07e1806c091c2f4a | 1,300 | PASSED |
//Archit Rai
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(a) (int)(a.size())
#define all(c) (c).begin(),(c).end()
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define REP(i,a,b) for(int i=int(a);i<=(int)b;i++)
#defin... | C++ | 6cfd3b0a403212ec68bac1667bce9ef1 | 684ef67ef8d75606a29f33a90c39f291 | 1,300 | PASSED |
#include <iostream>
#include <set>
#include <cstring>
#include <algorithm>
using namespace std;
void print_arr(int arr[], int n)
{
for(int i = 0; i <= n; i++)
{
cout << arr[i] << " ";
}
cout << endl;
}
int main()
{
int n;
cin >> n;
set<int> people;
int hidden_people[n];
in... | C++ | 6cfd3b0a403212ec68bac1667bce9ef1 | 544a7fe94cbab8557fb2eba6fc915c06 | 1,300 | PASSED |
#include <iostream>
#include <set>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
set<int> people;
int hidden_people[n];
int real_people[n];
for(int i = 0; i < n; i++)
{
hidden_people[i] = 0;
real_people[i] = 0;
}
for(in... | C++ | 6cfd3b0a403212ec68bac1667bce9ef1 | ae3ca9eea190d0cf977168e0b054442b | 1,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int x[1000007];
int main()
{
int n,a,i,j,sum=0,sss=0;
char s;
scanf("%d",&n);
for(i=0;i<n;i++){
getchar();
scanf("%c %d",&s,&a);
if(s=='+'){
sss++;
x[a]++;
}
else if(s=='-' && x[a]==1){
... | C++ | 6cfd3b0a403212ec68bac1667bce9ef1 | 336cf13975bcc030ad0748529fb366bf | 1,300 | PASSED |
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
//||
//\n
int cmpfunc (const void * a, const void * b)
{
return ( *(int*)b - *(int*)a );
}
int main()
{
int a,b,c,d,e,i,j,k=0,sum=0,sum1=0,vis=0;
char v[3],r[3],p[3]="+",q[3]="-";
int x[101],y[1000002... | C++ | 6cfd3b0a403212ec68bac1667bce9ef1 | 76ec451954111f9f0d7fd8fcc0915b63 | 1,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int x[1000007]={0};
int main()
{
int n,a,i,j,sum=0,sss=0;
char s;
scanf("%d",&n);
for(i=0;i<n;i++){
getchar();
scanf("%c %d",&s,&a);
if(s=='+'){
sss++;
x[a]=1;
}
else if(s=='-' && x[a]==1){
... | C++ | 6cfd3b0a403212ec68bac1667bce9ef1 | 09dc5ad7e82e19c1ef14d8398c4af134 | 1,300 | PASSED |
//
// main.c
// Berland National Library
//
// Created by _Apple on 8.08.2015.
// Copyright (c) 2015 fmc. All rights reserved.
//
#include <stdio.h>
typedef struct operation{
char operationType;
long long int operationNum ;
}Operation;
int main(int argc, const char * argv[]) {
long long in... | C++ | 6cfd3b0a403212ec68bac1667bce9ef1 | 8b46d77277aca4f7d0586d97817b3dbd | 1,300 | PASSED |
n = int(input())
for i in range(n):
word = input()
if len(word)>10:
print(word[0]+str(len(word)-2)+word[-1])
else:
print(word) | Python | 6639d6c53951f8c1a8324fb24ef68f7a | f46fe9561cb2f7414d7bdee6ff990c7d | 800 | PASSED |
n = int(input())
for i in range(n):
word = input()
if len(word)>10:
print(word[0]+str(len(word)-2)+word[-1])
else:
print(word) | Python | 6639d6c53951f8c1a8324fb24ef68f7a | a3f0f8088cfad477ee98d1f6b40c1452 | 800 | PASSED |
import sys
inputs = sys.stdin.read().split()
for j in range(int(inputs[0])):
i = inputs[j+1]
if len(i)>10:
print(i[0]+str(len(i)-2)+i[-1])
else: print(i)
| Python | 6639d6c53951f8c1a8324fb24ef68f7a | b8e3fb590355393033d42c16bda0e7ba | 800 | PASSED |
"""
A. Way Too Long Words
time limit per test : 2 seconds
memory limit per test : 256 megabytes
input : standard input
output : standard output
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is qu... | Python | 6639d6c53951f8c1a8324fb24ef68f7a | 2533017e74ae604eea2cb19dac4e3bb1 | 800 | PASSED |
# import sys
# inp = open('A.txt')
def get():
return input()
# class reader():
# def __init__(self, descr):
# self.descr = descr
# if descr == 'input':
# self.next = self.next_input
# else:
# self.next = self.next_file
# def next_input(self):
# while True:
# yield input()
# def next_file(self):
... | Python | 6639d6c53951f8c1a8324fb24ef68f7a | c915b6b6e940e04b2b23f6c10c0211dd | 800 | PASSED |
# import sys
# inp = open('A.txt')
class reader():
def __init__(self, descr):
self.descr = descr
if descr == 'input':
self.next = self.next_input
else:
self.next = self.next_file
self.data = open(self.descr).readlines()
def next_input(self):
return input()
def next_file(self):
for i in self.da... | Python | 6639d6c53951f8c1a8324fb24ef68f7a | 1833d04c0ee5a3427a448091c869620a | 800 | PASSED |
n = int(input())
for i in range(n):
s = input()
if len(s) > 10:
print(s[0] + str(len(s)-2) + s[-1])
else:
print(s) | Python | 6639d6c53951f8c1a8324fb24ef68f7a | 67addc30e4a785bbdaa8b643ace15841 | 800 | PASSED |
n = int(input())
for word in range(0, n):
word = str(input())
if len(word) > 10:
store = len(word) - 2
print(word[0] + str(store) + word[-1])
else:
print(word)
| Python | 6639d6c53951f8c1a8324fb24ef68f7a | f6c4723f25d1b6967fc1cb4ccbf50b3d | 800 | PASSED |
n = int(input())
strings = []
for i in range(n):
i = str(input())
strings.append(i)
for item in strings:
if len(item) > 10:
ln = len(item)
nums = str(ln-2)
print (item[0]+nums+item[-1])
else:
print(item) | Python | 6639d6c53951f8c1a8324fb24ef68f7a | 5f597dbafa842f8034e05faa1611ac15 | 800 | PASSED |
for _ in range(eval(input())):
s= input()
if len(s)>10:
print (s[0]+str(len(s)-2)+s[-1])
else:
print (s) | Python | 6639d6c53951f8c1a8324fb24ef68f7a | 32eaa9d938a8d2acffd9777554376d17 | 800 | PASSED |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MAXN (1 << 10)
#define MAXK (1 << 20)
#define mod (long long)((long long)1e9 + 7)
using namespace std;
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tr... | C++ | 414000abf4345f08ede20798de29b9d4 | 64fef690150bdee84fbed56b0a8fa9c0 | 1,700 | PASSED |
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
ll k,dp[100010][2],o,l;
string s1,s2;
int main(){
cin>>s1>>s2;
l=s1.length();
scanf("%lld",&k);
if(s1==s2)dp[0][1]=1;
else dp[0][0]=1;
s1+=s1;
for(int i=0;i<l;i++){
if(s1.substr(i,l)==s2){
o++;
}
}
for(int i=1;i<=k;... | C++ | 414000abf4345f08ede20798de29b9d4 | 5984d7534b3a883a3f3958dd492f2b25 | 1,700 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
string st,ed;
int k;
long long dp[2][100010];
int main()
{
cin>>st>>ed>>k;
int n=st.size();
dp[!(st==ed)][0]=1;
if(n!=ed.size())
{
puts("0");
return 0;
}
st.resize(n*2);
for(int i=0;i<n;i++)
st[i+n]=st[i];
int win=0;
for(int i=0;i<n;i++)
... | C++ | 414000abf4345f08ede20798de29b9d4 | ab6832a10c692f5249505e2a1f66a24d | 1,700 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
const int mod=1000000007;
long long good[N],bad[N];
string a,b;
int main()
{
ios::sync_with_stdio(false);
int k,n,x=0;
char c;
cin>>a>>b>>k;
n=a.size();
if(a==b)
good[0]=1;
else
bad[0]=1;
for(int i=1;i<=n;i++)
{
if(a==b)
x++;
a=a.back(... | C++ | 414000abf4345f08ede20798de29b9d4 | ba2647f3cb71ce34e75e5441b624510d | 1,700 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int mod=1000000007;
const int MAX=100002;
char st1[MAX<<1],st2[MAX];
int n,m,a,b,c,k,z,x;
long long dp[MAX][3];
int main ( )
{
cin>>st1>>st2>>z;
n=strlen(st1);
dp[0][strcmp(st1,st2)!=0]=1;
for(int i=0;i<n;i++)
st1[i+n]=st1[i]; //环处理;
for(int i... | C++ | 414000abf4345f08ede20798de29b9d4 | ae02842a9e203d611ba8b700bd10b175 | 1,700 | PASSED |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include<cmath>
#include <cstring>
#include <queue>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
char s1[1100];
char s2[1100];
ll f[3][3];
int len1,len2,k;
int main(){
scanf("%s",s1);
scanf("%s",s2);
scanf("%d",&k);
len1=strlen... | C++ | 414000abf4345f08ede20798de29b9d4 | 92aa2201958e9cef7da5d56563e5ae5a | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod = 1e9 + 7;
const int maxn = 2e3 + 7;
const int maxm = 1e5 + 7;
int DP[maxm][2], n, k;
char s1[maxn], s2[maxn];
bool check(int st) {
return !strncmp(s1 + st, s2 + 1, n);
}
int main () {
scanf("%s %s", s1 + 1, s2 + 1);
n = strle... | C++ | 414000abf4345f08ede20798de29b9d4 | 2da39594687952dc93676261d04f7ef6 | 1,700 | PASSED |
#ifdef ONLINE_JUDGE
#include <bits/stdc++.h>
#else
#include <algorithm>
#include <bitset>
#include <list>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
... | C++ | 414000abf4345f08ede20798de29b9d4 | 07b2d9ba0e619d2ad44391ac5c2e6133 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
string x , y , tg , tg2;
int k , m , n , X , Y;
long long dp[100009][3];
void Input()
{
cin >> x >> y >> k;
}
void Solve()
{
tg = x + x;
m = tg.size();
n = y.size();
X = (x == y);
memset(dp , 0 , sizeof dp);
for(int... | C++ | 414000abf4345f08ede20798de29b9d4 | 2e0ed9d06dbc953a3d0618fea85ce310 | 1,700 | PASSED |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
typedef long long ll;
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_stat... | C++ | 414000abf4345f08ede20798de29b9d4 | 3691fec3b1e1056e1913242a9d7a2184 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define f(i,n) for(int i=0;i < n;i++)
int main() {
long long a, b, cont = 0, md = 10000000000;
vector <int> v;
cin >> a;
f(i,a){
cin >> b;
v.push_back(b);
}
sort(v.begin(),v.end());
reverse(v.begin(),v.end());
for(int i= 0;i<v.size();i++){
if((i+1) < v.s... | C++ | 5f89678ae1deb1d9eaafaab55a64197f | d76a9f5195560b82421dcb7be04e5933 | 1,100 | PASSED |
#include <bits/stdc++.h>
#define forr(i,a,b) for( long i=a ;i<=b ; ++i)
using namespace std;
const long dad=3e5;
const long long hero=1e10;
long n,a[dad],res;
long long ans=hero;
int main()
{
// cout << "Hello world!" << endl;
// freopen( "792A.inp" , "r" , stdin );
cin>>n;
forr(i,1,n) cin>>a[i];
s... | C++ | 5f89678ae1deb1d9eaafaab55a64197f | 4ffd58b73820d99372a6b4a74b4c30a8 | 1,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
vector <int> v;
int main()
{
int n;cin>>n;
long long ans,item,cnt=1;
for(int i=0;i<n;i++)
{
cin >> item;
v.push_back(item);
}
sort(v.begin(),v.end());
ans=abs(v[1]-v[0]);
for(int i=1;i<n-1;i++)
{int ck=abs(v[i+1]-v[i]);
... | C++ | 5f89678ae1deb1d9eaafaab55a64197f | 87305efe0b56fbc3fbbd2a4e499c94d8 | 1,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N = 200005;
long long arr[N];
int n;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%I64d", &arr[i]);
}
sort(arr, arr + n);
long long MIN = 0x7fffffff;
long long dis = 0, sum = 0;
for (int i = 0; i < n - 1; i++) {
dis = arr[i + 1] - a... | C++ | 5f89678ae1deb1d9eaafaab55a64197f | 77042a6e720cd9948dd34d4db7db49ca | 1,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a[200000]={0},M=2e9;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
sort(a,a+n);
map<int,int>b;
for(int i=0;i<n-1;i++){
M=min(M,abs(a[i]-a[i+1]));
b[abs(a[i]-a[i+1])]++;
}
printf("%d %... | C++ | 5f89678ae1deb1d9eaafaab55a64197f | 63f44d1ce148a810b0e19e91e257fa36 | 1,100 | PASSED |
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<map>
#include<stdio.h>
#include<set>
#include<stack>
#include<stdlib.h>
using namespace std;
string s;
int n;
int a[300043];
int main() {
// freopen("input.txt", "r", stdin);
scanf("%d", &n);
for (int i = 0;i < n;i++)
... | C++ | 5f89678ae1deb1d9eaafaab55a64197f | 08a7bc793917e1b66c63d2d1a1ac0d27 | 1,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define loop(x,n) for(int x=0;x<n;x++)
#define vi vector<int>
#define vii vector<vi>
#define viii vector<vii>
#define vs vector<string>
#define vss vector<vs>
#define vb vector<bool>
#define s(n) scanf("%d",&n)
#define pb push_back
#define ii pair<int,int>
#define ll long l... | C++ | 5f89678ae1deb1d9eaafaab55a64197f | 289f5e99bd9033b3ab610ab1b41b645f | 1,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int arr[200005];
int main()
{
int n,cnt=0,ans = 2 * 1e9;
cin >> n;
for (int i = 0; i < n; i++)
cin >> arr[i];
sort(arr, arr + n);
for (int i = 0; i < n - 1; i++)
if (abs(arr[i] - arr[i + 1]) < ans) ans = abs(arr[i] - arr[i + 1]);
for (int i = 0; i < n - 1; i++)
... | C++ | 5f89678ae1deb1d9eaafaab55a64197f | fc866aecf787f49c46e209811dc6a6ce | 1,100 | PASSED |
/*
Hey , this one is mine ..
make a new one for yourself
---->>AKASH KANDPAL
*/
using namespace std;
#include <bits/stdc++.h>
#include <iostream> // std::cout
#include <string> // std::string
#include <locale>
#include <ctype.h>
#include <string.h>
#define st string
#define ld lo... | C++ | 5f89678ae1deb1d9eaafaab55a64197f | 5633d5ab7b0ebe883235d974d06e74d1 | 1,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int a[212345];
int main()
{
ios_base::sync_with_stdio(false);
int n;
scanf("%d",&n);
long long res = 1e10;
for(long long i=0;i<n;i++){
scanf("%d",a+i);
}
sort(a,a+n);
for(long long i=0;i<n-1;i++){
res = min(res,(long long... | C++ | 5f89678ae1deb1d9eaafaab55a64197f | 3ecd8bf3dfe63858c4fad38d4643e7bb | 1,100 | PASSED |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CompLib.Collections;
using CompLib.Util;
public class Program
{
int N, M;
char[] S;
int[] X;
char[] C;
public void Solve()
{
var sc = new Scanner();
N = sc.NextInt();
M = sc.NextI... | C# | 68883ab115882de5cf77d0848b80b422 | 286ce2d88eb50505198e737cf59a61c1 | 1,600 | PASSED |
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{
static void Main(string[] args)
... | C# | 68883ab115882de5cf77d0848b80b422 | ff7cf7e8fda7d00f1aabee319ac23945 | 1,600 | PASSED |
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
string[] read = Console.ReadLine().Split(' ');
int n = int.Parse(read[0]);
int m = int.Parse(read[1]);
string inputString = Console.ReadLine();
var changeStrList = new ... | C# | 68883ab115882de5cf77d0848b80b422 | 1b1e9906db909dbbf4d952163212caab | 1,600 | PASSED |
using System;
using System.Collections;
class Program {
static void Main() {
var nm = Console.ReadLine().Split();
int n = int.Parse(nm[0])
, m = int.Parse(nm[1]);
// zero 0 and n+1 elements for identity of AND
var a = new BitArray(n+2);
var s = Cons... | C# | 68883ab115882de5cf77d0848b80b422 | 9f27dd6edca9734de238e25f64864910 | 1,600 | PASSED |
using System;
using System.Collections;
class Program {
static void Main() {
var nm = Console.ReadLine().Split();
int n = int.Parse(nm[0])
, m = int.Parse(nm[1]);
// zero 0 and n+1 elements for identity of AND
var a = new BitArray(n+2);
var s = Cons... | C# | 68883ab115882de5cf77d0848b80b422 | 5affcb3f5ced1750b8729f310dde9643 | 1,600 | PASSED |
using System;
using System.Collections;
class Program {
static void Main() {
var nm = Console.ReadLine().Split();
int n = int.Parse(nm[0])
, m = int.Parse(nm[1]);
// zero 0 and n+1 elements for identity of AND
var a = new BitArray(n+2);
var s = Cons... | C# | 68883ab115882de5cf77d0848b80b422 | 7b5c94357721e1d5720eae956ff84548 | 1,600 | PASSED |
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
var (
reader = bufio.NewReader(os.Stdin)
writer = bufio.NewWriter(os.Stdout)
scanner = bufio.NewScanner(os.Stdin)
)
//Wrong
func main() {
defer writer.Flush()
scanner.Split(bufio.ScanWords)
n, m := nextInt(), nextInt()
cntOp := 0
length := 0
s := ... | Go | 68883ab115882de5cf77d0848b80b422 | c5cf0adb20555640a2a8b5718e140172 | 1,600 | PASSED |
package main
import (
"os"
"bufio"
"fmt"
)
func main() {
reader := bufio.NewReader(os.Stdin)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
line, _ := reader.ReadString('\n')
var n, q int
fmt.Sscanf(line, "%d %d", &n, &q)
line, _ = reader.ReadString('\n')
s := make([]byte, n + 2)
p... | Go | 68883ab115882de5cf77d0848b80b422 | 0f66c18cc3d524b254a15711fb6456e3 | 1,600 | PASSED |
package main
import (
"os"
"bufio"
"fmt"
)
func main() {
reader := bufio.NewReader(os.Stdin)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
line, _ := reader.ReadString('\n')
var n, q int
fmt.Sscanf(line, "%d %d", &n, &q)
line, _ = reader.ReadString('\n')
s := make([]byte, n + 2)
p... | Go | 68883ab115882de5cf77d0848b80b422 | 3d0a032736d0d07f0781a4245541db68 | 1,600 | PASSED |
package main
import (
"bufio"
. "fmt"
"io"
"os"
)
// github.com/EndlessCheng/codeforces-go
func CF570C(_r io.Reader, _w io.Writer) {
in := bufio.NewReader(_r)
out := bufio.NewWriter(_w)
defer out.Flush()
var n, q, p, dot, seg int
var s, c []byte
Fscan(in, &n, &q, &s)
for i, b := range s {
if b == '.' {
... | Go | 68883ab115882de5cf77d0848b80b422 | 401af7cc6a359987f9c654ceb514b0c3 | 1,600 | PASSED |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.ObjectInputStream.GetField;
import java.math.BigInteger;
import java.security.KeyStore.Entry;
import java.util.ArrayList;
import java.ut... | Java | 724fa4b1d35b8765048857fa8f2f6802 | 2986b3d9ec2073bbf061c1688b6cdda0 | 1,400 | PASSED |
import java.io.*;
import java.util.*;
public class DoubleName {
public static final String taskname = "DoubleName";
public static BufferedReader inr;
public static PrintWriter out;
public static void main(String[] args) {
Locale.setDefault(Locale.US);
boolean online = System.getProperty("ONLINE_JUDGE") != n... | Java | 724fa4b1d35b8765048857fa8f2f6802 | b79652b5560d5cc5d119b62e3fb2b9fd | 1,400 | PASSED |
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class A {
public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String key = bf.readLine();
String word = bf.readLine();
... | Java | 724fa4b1d35b8765048857fa8f2f6802 | 31cd7a80fd583017929f743171901d0a | 1,400 | PASSED |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
/**
*
* @author pter9_000
*/
public class Ctask {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
// TODO co... | Java | 724fa4b1d35b8765048857fa8f2f6802 | 77e9902ca6533b3f227f5df585f5af6a | 1,400 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.