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.*; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) throws IOException{ //InputStream inputStream = new File("input.txt"); //OutputStream outputStream = new File("output.txt"); //Scanner in = new Scanner(new Fi...
Java
217a3a48b927213f4d5e0a19048e2a32
f019022c21d6aa16ba21a34d8134b80a
2,000
PASSED
import java.io.*; import java.math.*; import java.util.*; public class Program implements Runnable { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); Thread thread = new Thread(new Program(in, out))...
Java
217a3a48b927213f4d5e0a19048e2a32
ec51e6ac11ae1a84203b6f78bb566fc3
2,000
PASSED
import java.io.*; import java.util.*; import java.math.*; public class D implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer st; Random rnd; final int none = 2001; BigInteger[][] d; BigInteger[] pows; BigInteger getMax(BigInteger a, BigInteger b) { if(a == null) { return b; } e...
Java
217a3a48b927213f4d5e0a19048e2a32
083e6e77265993186536d5a15b7036c2
2,000
PASSED
import java.math.BigInteger; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); final int SIZE = 2001; int N = in.nextInt(); int[] sell = new int[SIZE]; int[] win = new in...
Java
217a3a48b927213f4d5e0a19048e2a32
06a4226d36463d399d0c880a22d45255
2,000
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.StringTokenizer; public class SellerBob { static int[] t; static int[] v; static BigInteger[][] dp; static BigInteger max(BigInteger a, BigInteger...
Java
217a3a48b927213f4d5e0a19048e2a32
5b52063f5b9d41fece461e10f4fe16e8
2,000
PASSED
#include <algorithm> #include <fstream> #include <iostream> #include <vector> #include <cstring> #include <string> #define x first #define y second using namespace std; int i,j,m,c,ok,q,w,maxi=-1,p,n1,n2,x,y,g,a,b,n,mod,k,ul,poz,pozy; int v[500][500],d[500][500]; char s[1000000],ss[10000]; vector <pair<int,int> > r; st...
C++
2fad1534434f042214dcd1f1dc75405a
94eeb33a65e05847dd704fc99011bf81
1,800
PASSED
// Separate what you do from who you are, that's what the guilt trap is all about! #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define ff first #define ss second typedef long long int ll; typedef vector< pair<int, int> > vii; typedef vector<int> vi; typedef vector<vi> vvi;...
C++
2fad1534434f042214dcd1f1dc75405a
6be5ffdc00fb4052675f81463e9aef48
1,800
PASSED
// Separate what you do from who you are, that's what the guilt trap is all about! #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define ff first #define ss second typedef long long int ll; typedef vector< pair<int, int> > vii; typedef vector<int> vi; typedef vector<vi> vvi;...
C++
2fad1534434f042214dcd1f1dc75405a
22cdc984983559b9478e053355a9bc0f
1,800
PASSED
// Separate what you do from who you are, that's what the guilt trap is all about! #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define ff first #define ss second typedef long long int ll; typedef vector< pair<int, int> > vii; typedef vector<int> vi; typedef vector<vi> vvi;...
C++
2fad1534434f042214dcd1f1dc75405a
e5e5d65c3a09f319a415d74ec203323a
1,800
PASSED
#include <bits/stdc++.h> #define pb push_back #define Each(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it) #define sqr(x) ((x) * (x)) #define Debug(x) { cerr << #x << " = "; cerr << (x) << endl; } typedef long long ll; typedef unsigned long long ull; const int N = 3e2 + 10; const int MOD = 1e9 + 7; ...
C++
2fad1534434f042214dcd1f1dc75405a
45bcfd4c265018ec7ac0f05736e87379
1,800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define ull unsigned long long int #define rep(i,a,b) for (ll i = a; i <= b; i++) #define ren(i,a,b) for(ll i=b;i>=a;i--) #define F first #define S second #define PB push_back #define DB pop_back #define MP make_pair #define MT make_tuple #define G(a,b)...
C++
2fad1534434f042214dcd1f1dc75405a
4adaada153068f424f2c2c6b8f522a24
1,800
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; namespace std { template <class Fun> class y_combinator_result { Fun fun_; public: template <class T> explicit y_combinator_result(T &&fun) : fun_(...
C++
2fad1534434f042214dcd1f1dc75405a
1796bbd692788adfbe95e11af1adec3d
1,800
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define mp make_pair #define pb(x) push_back(x) #define vi vector<int> #define vs vector<string> #define vll vector<long long> #define vc vector<char> #define vs vector...
C++
2fad1534434f042214dcd1f1dc75405a
d907725a924936b49310b24e0a248f73
1,800
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define mp make_pair #define pb(x) push_back(x) #define vi vector<int> #define vs vector<string> #define vll vector<long long> #define vc vector<char> #define vs vector...
C++
2fad1534434f042214dcd1f1dc75405a
35d590c846551a4f44e001505d198de4
1,800
PASSED
//\\..........torque.............\\// #include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) using namespace __gnu_pbds; #define ordered_set tree<int, null_type,less<int>, rb_tree_ta...
C++
2fad1534434f042214dcd1f1dc75405a
58bb8a3667d4f76e394ed2a69b29b301
1,800
PASSED
#include<bits/stdc++.h> #define ll long long #define pb push_back #define all(a) (a).begin(),(a).end() #define endl '\n' #define vi vector<int> #define len(s) s.length() #define rep(i,a,b) for(int i=a;i<b;i++) #define bs binary_search using namespace std; int main() ...
C++
ac047ceede246b40892c80dbd696e6b4
96265d33c2982f510d1b9f93f3c6d4af
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int #define mx 1000007 ll a[mx+3],n,i,j,prime[mx+7]; string s; map<ll,ll>mi; map<char,ll>mc; map<string,ll>ms; void seive() { ll x=sqrt(mx); for(int i=2;i<=mx;i+=2) prime[i]=2; for(int i=3;i<=mx;i+=2) prime[i]=i; for(int i=3;i<=x;i+=...
C++
ac047ceede246b40892c80dbd696e6b4
2cdcf4ba6bf1fd14b98094d206ad0eb9
1,200
PASSED
#include <bits/stdc++.h> using namespace std ; int q , n , m , x , el , w ; string s ; int main (){ cin >> s ; x = s.size() ; int h = 1 ; while ((x+h-1)/h > 20){ h++ ; } cout << h << " " << (x+h-1)/h << '\n' ; el = (h * ((x+h-1)/h)) - x ; for(int i = 1 ; i < h ; i++){ bool kk = 0 ; if(el > 0){ cout...
C++
ac047ceede246b40892c80dbd696e6b4
5f16edec52c2c497b7e6539b6f7d46d6
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long #define pb push_back int32_t main() { string s; cin >> s; int l = s.length(); //cout<<l<<endl; if(l<=20){ cout<<1<<" "<<l<<"\n"; cout << s; return 0; } int mn = 99999, row = 0, col = 0; for(int i ...
C++
ac047ceede246b40892c80dbd696e6b4
e23222785d493575f9df18106bcbdb27
1,200
PASSED
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; char s[105],ans[5][25]; int main(void){ scanf("%s",s); int len=strlen(s); if(len<=20){ printf("1 %d\n",len); printf("%s\n",s); }else if(len<=40){ int p=len/2,cnt=0,k=len%2; if(k) p++; e...
C++
ac047ceede246b40892c80dbd696e6b4
5afd91e6a04379fb3e61b6a7c72a909b
1,200
PASSED
#include <bits/stdc++.h> using namespace std; //#define getchar getchar_unlocked //#define putchar putchar_unlocked #define eb emplace_back #define lb lower_bound #define ub upper_bound #define mp make_pair #define ff first #define ss second typedef long long int ll; typedef long double ld; typedef short int sh; inl...
C++
ac047ceede246b40892c80dbd696e6b4
46bf8acad55ba6cc65758ce054239588
1,200
PASSED
#include<bits/stdc++.h> using namespace std; string a; int i,j,n,l,row,m,ind; int main() { cin >> a; row=1; n=a.size(); ind=0; if(n<=20) { cout <<row <<" " <<n <<endl; cout<<a <<endl; } else{ row++; m=n/row; while(m > 20 ) { row...
C++
ac047ceede246b40892c80dbd696e6b4
3ef46457b05ce14b678ee89d0904fb41
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); string txt; cin >> txt; int l = txt.length(); if (l < 21) cout << 1 << ' ' << l << "\n" << txt; else { int best = 10000, it; for (int i = 2; i < 6; ++i){ if ...
C++
ac047ceede246b40892c80dbd696e6b4
b35362745727c2bbaa53cb7e2b9d3d71
1,200
PASSED
#include<bits/stdc++.h> using namespace std; int main() { char s[105]; scanf("%s",s); int len=strlen(s); int col=len/20+(len%20!=0); int row=(len+col-1)/col; int res=col*row-len; int pos=0; printf("%d %d\n",col,row); for(int i=1;i<=col;i++) { for(int j=1;j<row;j++) ...
C++
ac047ceede246b40892c80dbd696e6b4
2682cf5cbc5d5d9ad5717d53af6126da
1,200
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <string> #include <string.h> #include <math.h> #include <functional> using namespace std; char arr[5][20]; int main() { string s; cin >> s; bool done = false; int length = s.length(); int difference = 0; int rows = 0; int columns ...
C++
ac047ceede246b40892c80dbd696e6b4
1bbac71d3136349c42edd3f0b48ac03d
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int n,a[101010]; main () { cin >>n; for (int i = 1; i <= n; i++) { a[i] = i; } int l,r; for (int i = 1; i <= n; i++) { cin >>l >>r; int raz = r - l + 1; if (l % 2 == 0) { if (raz % 2 == 0) { cout <<-(raz/2) <<endl; } else cout <<-(raz/2...
C++
7eae40835f6e9580b985d636d5730e2d
d0e6616ce496aa2017f9ecf3be6fcdf0
900
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,l,r; cin>>n; for(int i=1;i<=n;i++) { cin>>l>>r; if((l-1)%2==0&&r%2==0)cout<<r/2-(l-1)/2; else if((l-1)%2!=0&&r%2==0)cout<<r/2-((l-1)/2-(l-1)); else if((l-1)%2==0&&r%2!=0)cout<<((r-1)/2-r)-(l-1)/2; ...
C++
7eae40835f6e9580b985d636d5730e2d
47baead29fdbf1c748ab37a3e72f783a
900
PASSED
#include <bits/stdc++.h> using namespace std; long long t,l,r; int main() { //freopen("b1.inp","r",stdin); //freopen("b1.out","w",stdout); cin>>t; for(long long i=1;i<=t;i++) { cin>>l>>r; if(r%2==0&&(l-1)%2!=0)cout<<r/2-((l-2)/2-(l-1)); else if(r%2==0&&(l-1)%2==0)cout<<r/2-(l-...
C++
7eae40835f6e9580b985d636d5730e2d
dcd29ae1e3f68b6cdf2934bffbb1f8b6
900
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define fast ios_base::sync_with_stdio(false);cin.tie(NULL); #define pb push_back #define vbe v.begin(),v.end() #define mx *max_element #define mi *min_element #define itep vector < pair < long long , long long > > :: iterator it; #define ite vector < l...
C++
7eae40835f6e9580b985d636d5730e2d
4b978eed65e6c466d0a31cbe8ee343de
900
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define fast ios_base::sync_with_stdio(false);cin.tie(NULL); #define pb push_back #define vbe v.begin(),v.end() #define itep vector < pair < long long , long long > > :: iterator it; #define ite vector < long long > :: iterator it; #define fn for(ll i =...
C++
7eae40835f6e9580b985d636d5730e2d
674d71a295a38b10802ed6fc90d6947b
900
PASSED
#include <cstdio> #include <cstring> #include <iostream> using namespace std; int main(){ long long i,j,k,n,temp,sum,a,b,aa; cin>>n; for(i=1;i<=n;i++){ cin>>a>>b; sum=0; //如果第一个数是奇数 if(a%2==1){ //如果结尾的数是奇数 if(b%2==1){ sum=(b-a)/2-b; } else{ sum=(b-a+1)/2; } } //如果第一个数是偶数 else...
C++
7eae40835f6e9580b985d636d5730e2d
f74fab9b09b3e48b57ad1e4d54b07af3
900
PASSED
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<vector> #include<set> #include<map> #include<queue> #include<cmath> #define ll long long #define mod 1000000007 #define inf 0x3f3f3f3f using namespace std; int main() { ll l, r; int t; scanf("%d",&t); while(t --) { ...
C++
7eae40835f6e9580b985d636d5730e2d
242659f0d2ab5a205d92b5207eb1c501
900
PASSED
#include<iostream> #include<cstdio> int l,r,q;//头文件 int main() { scanf("%d",&q); for(int i=1;i<=q;i++) { int ans=0; scanf("%d%d",&l,&r); l--; if(l%2==0) l/=2; else l=-(l+1)/2; if(r%2==0) r/=2; else r=-(r+1)/2; printf("%d\n",r-l); } ret...
C++
7eae40835f6e9580b985d636d5730e2d
63d216f2107c05c57b7e1a68d8344ba2
900
PASSED
#include<bits/stdc++.h> #define For(i, j, k) for(int i = (j); i <= (k); i++) using namespace std; inline int getsum(int x) { if(x & 1) { return - (x / 2 + 1); } else { return x / 2; } } int main() { int _; cin >> _; while(_--) { int l, r; scanf("%d %d", &l, &r); cout << getsum(r) - getsum(l-1) << endl...
C++
7eae40835f6e9580b985d636d5730e2d
0a85044ce65ad7919497b55b8135827a
900
PASSED
#include<iostream> #include<cstdio> int l,r,q; int main() { scanf("%d",&q); for(int i=1;i<=q;i++) { int ans=0; scanf("%d%d",&l,&r); l--; if(l%2==0) l/=2; else l=-(l+1)/2; if(r%2==0) r/=2; else r=-(r+1)/2; printf("%d\n",r-l); } return 0...
C++
7eae40835f6e9580b985d636d5730e2d
4763b8fc2ed2f3fbbd7c3dec6cf75b0f
900
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 1<<22; int used[N]; int present[N]; int n, m; int msk; void bfs(int x){ queue<int> q; q.push(x); while(!q.empty()){ int c = q.front(); //cout << c << endl; int ccmp = msk - c; if(present[ccmp] && used[ccmp] == 0){ q.push(ccmp); used[ccmp] = 1; ...
C++
9a64ee19cf2d20978870c03311bf6cbf
38d3d4654fe010c1767e8932ec1f4231
2,500
PASSED
#include <bits/stdc++.h> // dp[i][j] mean we are in the subtree of i and at state j ( j==0 means i in array , else i not in array ) // We can see i & ~i == 0 ( ~i = ( i ^ (1<<i - 1) ) ) // 1 & 0 == 0 // 0 & 0 == 0 // 0 & 1 == 0 // we call k will be the number that i & k == 0 // at bit j == 0 in i we have two choices : ...
C++
9a64ee19cf2d20978870c03311bf6cbf
654bb22a9fcfe3a098cf634735fc68c3
2,500
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=1<<23; bool vis[maxn]; bool a[maxn]; int n,m; void dfs(int x) { if(vis[x]) return; vis[x]=true; for(int i=0;i<=n;i++) { if(x&(1<<i)) dfs(x^(1<<i)); } if(a[x]) dfs((1<<n)-1-x); } int main() { scanf("%d...
C++
9a64ee19cf2d20978870c03311bf6cbf
3ea42bf2397b081543ce439d22d21da2
2,500
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=1<<23; bool vis[maxn]; bool a[maxn]; int n,m; void dfs(int x) { if(vis[x]) return; vis[x]=true; for(int i=0;i<=n;i++) { if(x&(1<<i)) dfs(x^(1<<i)); } if(a[x]) dfs((1<<n)-1-x); } int main() { ios_base:...
C++
9a64ee19cf2d20978870c03311bf6cbf
7a4babebe7d04481ef9d6648e0a18d65
2,500
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=1<<23; int c[23]; int vis[maxn]; int a[maxn],cont[maxn]; int n,m; void dfs(int x) { if(vis[x]) return; vis[x]=1; if(a[x]) dfs(x^(c[n]-1)); for(int i=0;i<=n;i++) { if(x&c[i]) dfs(x^c[i]); } } int main...
C++
9a64ee19cf2d20978870c03311bf6cbf
5cb78605164df0631d1afa688cd4ede2
2,500
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=1<<23; int c[23]; int vis[maxn]; int a[maxn],cont[maxn]; int n,m; void dfs(int x) { if(vis[x]) return; vis[x]=1; if(a[x]) dfs(x^(c[n]-1)); for(int i=0;i<=n;i++) { if(x&c[i]) dfs(x^c[i]); } } int main...
C++
9a64ee19cf2d20978870c03311bf6cbf
85a305687c05df62cd7b9932df73e1f9
2,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef long long ll; typedef vector<int> vi; #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define rep(i,n) rep2(i,0,n) #define rep2(i,m,n) for(int i=m;i<(n);i++) #define ALL(c) (c).begin(...
C++
9a64ee19cf2d20978870c03311bf6cbf
16509423d70dde4c1652bb983e0a1418
2,500
PASSED
#include<iostream> #include<cstdio> #include<vector> #include<algorithm> #include<queue> #include<string> #include<cstring> #include<map> #include<cmath> #include<bitset> #include<set> #include<cstdlib> #include<complex> #include<list> #include<cassert> #include<iomanip> #include<limits> using namespace std; #define ...
C++
9a64ee19cf2d20978870c03311bf6cbf
c1b2011d642b2a1bb2d99ee7d0248274
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "/media/brayand/BrayanD/debugger.h" #else #define db(...) false #define dbg(...) false #endif const int MAXN = 5e6 + 100; bool ok[MAXN]; vector<bool> mk; int N, M; struct graph { int n; vector<vector<int>> adj; graph(int n) : n(n), a...
C++
9a64ee19cf2d20978870c03311bf6cbf
2e903c87f9e4c7b9b5acf119b51791f2
2,500
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e6 + 100; bool ok[MAXN]; vector<bool> mk; int N, M; int A[MAXN]; int B[MAXN]; int comp = 1; queue<int> Q; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> N >> M; int tam = (1<<N)*2+M; mk.resize(tam);...
C++
9a64ee19cf2d20978870c03311bf6cbf
87b7677322e630b7ddd4c9642e483c4d
2,500
PASSED
/* Aman Agarwal algo.java */ import java.util.*; import java.io.*; public class A1076 { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
c01fc2cb6efc7eef290be12015f8d920
0a4b9bde2fdc06f41c4fb164bf964ce0
1,200
PASSED
import java.io.*; import java.util.*; public class Educational_Codeforces_Round_54_A { public static void main(String[] args) { InputReader reader = new InputReader(System.in); int number = reader.nextInt(); String result = "", s = reader.next(); char[] arr = s.toCharArray(); boolean check = false; for ...
Java
c01fc2cb6efc7eef290be12015f8d920
28de88116a4d6e471405d13195bbd645
1,200
PASSED
/** * 8 * rkqggsab */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int length = Integer.parseInt(br.read...
Java
c01fc2cb6efc7eef290be12015f8d920
701108101873be916944bfeef9d68c34
1,200
PASSED
import java.io.IOException; import java.io.InputStream; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException { InputReader scan = new InputReader(); int n = scan.nextInt(); String in = scan.next(); boolean found = false; for (int i = 0; i < n-1; i++) { ...
Java
c01fc2cb6efc7eef290be12015f8d920
12d975abbb277190da08db2bc21e6eff
1,200
PASSED
import java.util.Scanner; public class MinimizingTheSreing { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn = new Scanner(System.in); int N = scn.nextInt(); String s = scn.next(); if (N == 1) { if (s.charAt(0) != 'a') { System.out.println("a"); } else { ...
Java
c01fc2cb6efc7eef290be12015f8d920
68722ed906a4212ed030ef1d8d5cb4d3
1,200
PASSED
import java.util.*; import java.lang.Math; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); boolean open = true; char[] arr = sc.nextLine().toCharArray(); for (int i=0; i...
Java
c01fc2cb6efc7eef290be12015f8d920
5a26aff6161834a0084359dc7aebe917
1,200
PASSED
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int t = in.nextInt(); in.nextLine(); String s = in.nextLine(); StringBuilder temp = new...
Java
c01fc2cb6efc7eef290be12015f8d920
f307899a8c25995bcd09c2c1ed7c1816
1,200
PASSED
import java.util.*; import java.io.*; public class a{ static Scanner sc=new Scanner(System.in); public static void main(String [] args){ int n=sc.nextInt(); String s=sc.next(); StringBuilder ss=new StringBuilder(""); boolean found=false; for(int i=0;i<n-1;i++){ ...
Java
c01fc2cb6efc7eef290be12015f8d920
368275f317ae54e1be78dc375c03978a
1,200
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); PrintWriter pw = new PrintWriter(Sy...
Java
c01fc2cb6efc7eef290be12015f8d920
81f200cc30c00464a973aa4e3349dddb
1,200
PASSED
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); String s = sc.next(); TreeSet set = new TreeSet(); for (int i = 0; i < s.length(); i++) { set.add(s.charAt(...
Java
c01fc2cb6efc7eef290be12015f8d920
5de4a73f6c329d5d1d44bbbca838dfc3
1,200
PASSED
#include <stdio.h> long long int six[14], three[19]; int main(){ int n, j; long long int num; six[0] = 1; int flag = 0; for(int i = 0; i < 13; i ++) six[i + 1] = six[i] * 6; three[0] = 1; for(int i = 0; i < 18; i ++) three[i + 1] = three[i] * 3; scanf("%d", &n); for(int i = 0; i < n; i ++){ scanf("%lld...
C
3ae468c425c7b156983414372fd35ab8
bca70dfef64b64459ee1c9479054a196
900
PASSED
main() { int t, n1, n2, n; scanf("%d", &t); while(t--) { n1 = n2 = 0; scanf("%d", &n); if(n == 1) printf("0\n"); else { while(n % 2 == 0) { n /= 2; ++n1; } while(n % 3 == 0) { n /= 3; ++n2; } if(n != 1) printf("-1\n"); else if(n1 > n2) printf("...
C
3ae468c425c7b156983414372fd35ab8
a2c6bc923dd2e2c2aa4a20dabc1657bd
900
PASSED
main() { int t, n1, n2, n; scanf("%d", &t); while(t--) { n1 = n2 = 0; scanf("%d", &n); if(n == 1) printf("0\n"); else { while(n % 2 == 0) { n /= 2; ++n1; } while(n % 3 == 0) { n /= 3; ...
C
3ae468c425c7b156983414372fd35ab8
f61f16c685d1e7fc36cec0d4b758d44c
900
PASSED
#include<stdio.h> int main() { int t; scanf("%d",&t); for(t=t;t>0;t--) { int n,count=0; scanf("%d",&n); for(n=n;n>1;) { if(n%6==0) { n=n/6; } else { n=n*2; if(n%6!=0) ...
C
3ae468c425c7b156983414372fd35ab8
3a2bcc52f0a2c4b3686c0d4372507748
900
PASSED
#include"stdio.h" #include"conio.h" int main() { int t,c,n; scanf("%d",&t); while(t--) { c=0; scanf("%d",&n); while(n!=1) { if(n%6==0) { c+=1; n=n/6; } else { if(...
C
3ae468c425c7b156983414372fd35ab8
a989c14fe78dd60516d6d9cc19628cfe
900
PASSED
#include<stdio.h> #include<math.h> #include<malloc.h> int main() { int rem,cases,k=2,z,count3=0,count2=0,num; //long double x,n; int *arr;int i; scanf("%d",&cases); arr=(int*)malloc(cases*sizeof(int)); for(i=0;i<cases;i++) { scanf("%d",&arr[i]); } for(i=0;i<cases;i++) { ...
C
3ae468c425c7b156983414372fd35ab8
10ab260613d3ca11ab0135bedffbf007
900
PASSED
#include <stdio.h> int main(){ int t,n,p,k=0,r=0,c=0; scanf("%d",&t); while(t>0) { c=0; r=0; k=0; scanf("%d",&n); if(n==1) { printf("%d\n",0); } else if (!(n%3==0)) { printf("%d\n",-1); } else...
C
3ae468c425c7b156983414372fd35ab8
ffdd66d71d213406a4170dbe01e28949
900
PASSED
let inputString = ""; let currentLine = 0; process.stdin.on("data", (inputStd) => { inputString += inputStd; }); process.stdin.on("end", function () { inputString = inputString .trim() .split("\n") .map((str) => str.trim()); main(); }); function readLine() { return inputString[currentLine++]; } func...
Javascript
3ae468c425c7b156983414372fd35ab8
c44e6cbe9d74c6a8ef936f1e8b184125
900
PASSED
//↓見なくていいよ!ここから-------------------------------------------------- var read = require('readline').createInterface({ input: process.stdin, output: process.stdout }); var obj; var inLine = []; read.on('line', function(input){inLine.push(input);}); read.on('close', function(){ obj = init(inLine); console.error("\n"...
Javascript
3ae468c425c7b156983414372fd35ab8
403da4c491034c9189c7525766923906
900
PASSED
process.stdin.resume(); process.stdin.setEncoding('utf-8'); let stdinInput = ''; process.stdin.on('data', input => { stdinInput += input; }); process.stdin.on('end', () => { main(stdinInput); }); function main(data) { data = data.split('\n'); const testCases = data[0] * 1; let i = 1; while (...
Javascript
3ae468c425c7b156983414372fd35ab8
d7f546994f66bb49ae63fa391193901e
900
PASSED
#include <bits/stdc++.h> #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long int #define pb push_back #define mp make_pair #define f(i,x,n) for(ll i=x;i<n;i++) #define fl(i,x,n) for(ll i=n;i>=x;i--) #define mod (ll)1e9+7 #define print(x) cout<<x<<endl #define vec vector<ll> #define pai pa...
C++
89be93cb82d9686ff099d156c309c146
334f9d4464a556cab6065bfd1e05a093
2,100
PASSED
////#pragma GCC optimzie(2) //#include<iostream> //#include<iomanip> //#include<cstring> //#include<string> //#include<vector> //#include<algorithm> //#include<numeric> //#include<chrono> //#include <ctime> //#include <ratio> //#include<cmath> //#include<queue> //#include<stack> //#include<map> //#include<set> //#inclu...
C++
89be93cb82d9686ff099d156c309c146
c4ed7e378ca40159ebe1617826cfd4b2
2,100
PASSED
#include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef pair<int,int>pii; const int MAXN =2e5+50; ll const MOD=1e9+7; int n,m; int arr[MAXN]; int vis[MAXN]; ll sum[MAXN]; vector<int>vec[MAXN]; int dp[3][MAXN]; void Dijkstra(int firs...
C++
89be93cb82d9686ff099d156c309c146
fa09daf708c1e7103daa98e836912cfc
2,100
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define M 1000000007 #define ff first #define ss second #define mp make_pair #define pb push_back #define io ios_base::sync_with_stdio(false)...
C++
89be93cb82d9686ff099d156c309c146
b884a78135e6049857771cff2901c170
2,100
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define M 1000000007 #define ff first #define ss second #define mp make_pair #define pb push_back #define io ios_base::sync_with_stdio(false)...
C++
89be93cb82d9686ff099d156c309c146
6b384fae7c38d39996ae51fbc1dc9a7b
2,100
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define M 1000000007 #define ff first #define ss second #define mp make_pair #define pb push_back #define io ios_base::sync_with_stdio(false)...
C++
89be93cb82d9686ff099d156c309c146
da87895cfc23a4c2bddaa819a1647bcf
2,100
PASSED
#define ll long long #include <bits/stdc++.h> using namespace std; vector<vector<int>> g; void bfs(int s,vector<int> &v){ v[s]=0; queue<int> q; q.push(s); while(!q.empty()){ int x=q.front(); q.pop(); for(auto it : g[x]){ if(v[it]==-1){ v[it]=v[x]+1; q.push(it); } } } return; } int main()...
C++
89be93cb82d9686ff099d156c309c146
6dc85d0c0079adbaecdc6a77f449fa11
2,100
PASSED
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; vector<vector<int>> g; void bfs(int s, vector<int> &d) { d[s] = 0; queue<int> q; q.push(s); while (!q.empty()) { int v = q.front(); q.pop(); for (auto to : g[v]) { if (d[to] == INF) { d[to] = d[v] + 1; q.push(to); } } } } ...
C++
89be93cb82d9686ff099d156c309c146
8d2006aafd784c108769d99d60538ce4
2,100
PASSED
/* ID: Aman Raj LANG: C++ TASK: nocows */ //#include<iostream> #include <stdio.h> //#include<iostream> #include<vector> #include<algorithm> using namespace std; #include<math.h> typedef long long ll; #include <bits/stdc++.h> #include <vector> #include <set> #include <map> #include <string> #include <cstdio> #include ...
C++
89be93cb82d9686ff099d156c309c146
82566c7fa3d4f68d90c4f9be3021b340
2,100
PASSED
/* ÉèxÊÇa->b,b->cµÄ½»µã¿ÉÒÔ½«Â·¾¶a->b->cת»¯Îªa->x->b->x->c ¿É¼ûx-bÕâ¶Î·¾¶Éϵı߱»ËãÁËÁ½´Î£¬Ö»ÒªÃ¶¾Ùµãx£¬Çó×îС´ð°¸¼´¿É */ #include<bits/stdc++.h> using namespace std; #define N 400005 int p[N],n,m,a,b,c; long long sum[N]; vector<int>G[N]; int cmp(int a,int b){return a>b;} int vis[N],da[N],db[N],dc[N]; void dfs(...
C++
89be93cb82d9686ff099d156c309c146
66f1c8ff68f46ac8934f81e55ed08ad7
2,100
PASSED
#include <bits/stdc++.h> #include <unordered_set> #include <unordered_map> using namespace std; typedef pair <int, int> intpair; #define longlongvector vector<long long> #define llvector vector<long long> typedef long long ll; #define pause system("pause") #define overtwo >> 1 #define intvector vector<int> #define fas...
C++
b1fd037d5ac6023ef3250fc487656db5
2befa83ba99fcd223c235e8aeb6080d7
1,500
PASSED
#include <bits/stdc++.h> #include <unordered_set> #include <unordered_map> using namespace std; typedef pair <int, int> intpair; #define longlongvector vector<long long> #define llvector vector<long long> typedef long long ll; #define pause system("pause") #define overtwo >> 1 #define intvector vector<int> #define fas...
C++
b1fd037d5ac6023ef3250fc487656db5
6329c67f8796ec8de636f55e1f549ae6
1,500
PASSED
#include <bits/stdc++.h> #include <unordered_set> #include <unordered_map> using namespace std; typedef pair <int, int> intpair; #define longlongvector vector<long long> #define llvector vector<long long> typedef long long ll; #define pause system("pause") #define overtwo >> 1 #define intvector vector<int> #define fas...
C++
b1fd037d5ac6023ef3250fc487656db5
049920ed2d12c0845f486e9cf0ee6c16
1,500
PASSED
/** * code generated by JHelper * More info: https://g...content-available-to-author-only...b.com/AlexeyDmitriev/JHelper * @author gainullin.ildar */ #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <map> #include <list> #include <time.h> #include <math.h> #inclu...
C++
b1fd037d5ac6023ef3250fc487656db5
a3dbe929bcc2f916665573db1756831a
1,500
PASSED
/****** trying to be better *****/ #include<bits/stdc++.h> #define mem(a,v) memset(a,v,sizeof a) #define ll long long #define ull unsigned long long #define max(a,b) (a>b?a:b) #define min(a,b) (a<b?a:b) #define max3(x,y,z) max(x,max(y,z)) #define min3(x,y,z) min(x,min(y,z)) #define f first #define s second #define fr(i...
C++
b1fd037d5ac6023ef3250fc487656db5
116eba6ca039d2c67eb08d9dabd05379
1,500
PASSED
#include<iostream> #include<vector> #include<algorithm> using namespace std; int n, s; vector<long long>bases, temp; long long total(int k) { long long answer = 0; for (int i = 0; i < n; ++i) { temp[i] = bases[i] + (i + 1) * (long long)k; } sort(temp.begin(), temp.end()); for (int i = 0; i < k; ++i) { answer ...
C++
b1fd037d5ac6023ef3250fc487656db5
aaed7d7ce64984853646f095ff52859c
1,500
PASSED
#include<iostream> using namespace std; #include<string> #include<cmath> #include<algorithm> #include<vector> #include<set> #include<queue> #include<map> #include<stack> #include<utility> #define pii pair<int,int> #define mp(x,y) make_pair(x,y) #define fr(i ,n) for (int i = 0; i < n; i++) #define pb(x) pushback(x)...
C++
b1fd037d5ac6023ef3250fc487656db5
6a21811a2d8a34452f60c70d16e9f97e
1,500
PASSED
#include <iostream> #include <vector> #include <cmath> #include <string> #include <algorithm> #include <set> #include <fstream> using namespace std; inline int mmin(int a, int b) { return (a > b) ? b : a; } inline int mmax(int a, int b) { return (a > b) ? a : b; } int k, n, t; long long s; vector<int> prices; long long...
C++
b1fd037d5ac6023ef3250fc487656db5
f6cd445a5a06fbaf252b4985d8fc413b
1,500
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <numeric> #include <iterator> #include <utility> using namespace std; bool is_can_buy (vector<long long> v, long long k, long long s, long long &res) { for (long long i = 0; i < v.size(); ++i) v[i] = v[i] + (i + 1) * k; sort (v.begin(), v.end())...
C++
b1fd037d5ac6023ef3250fc487656db5
ab2fcafb48b3b1e0f63daf5a454ea103
1,500
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <iterator> #include <stack> #include <utility> #include <queue> #include <map> #include <set> #include <cmath> #include <iomanip> #define print(i) cout << i << '\n' #define pb push_back #define eb emplace_back #define INF 10...
C++
b1fd037d5ac6023ef3250fc487656db5
066536ed6213592ba77fe0d93d88254a
1,500
PASSED
#include <cstdio> #include <cstdlib> #include <cstring> int n; char ad[100000][60]; int idx1[100000]; int nn; char ad2[100000][60]; char host[100000][30]; char path[100000][30]; int hs[100000]; int n3; int idx2[100000]; int ll[100000]; int k; int hs2[100000]; int k2; int ll2[100000]; char host1[100000][30]; char path1...
C++
9b35f7df9e21162858a8fac8ee2837a4
ebe8a536b55d308f064a72c86ae76b23
2,100
PASSED
#include<stdio.h> #include<iostream> #include<string.h> #include<string> #include<ctype.h> #include<math.h> #include<set> #include<map> #include<vector> #include<queue> #include<bitset> #include<algorithm> #include<time.h> using namespace std; void fre() { freopen("c://test//input.in", "r", ...
C++
9b35f7df9e21162858a8fac8ee2837a4
d99b759d3e6ab41ff78294d429072a94
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define ms(s, n) memset(s, n, sizeof(s)) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--) #define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++) #define sz(a) int((a).size()) ...
C++
9b35f7df9e21162858a8fac8ee2837a4
3d7c5ce83337b26e215717025427dd1b
2,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef unsigned int ui; typedef long double ld; typedef pair<ll, ll> ii; typedef pair<ii, ll> iii; const int MOD = 1e9 + 7; const ld E = 1e-10; #define null NULL #define y1 ybutnot1 #define ms(x) memset(x, 0, sizeof(x))...
C++
9b35f7df9e21162858a8fac8ee2837a4
a54d36ff15fbeb7132ed0757663702cf
2,100
PASSED
// TEMPLATE {{{ #include <bits/stdc++.h> using namespace std; #ifndef LOCAL #define OJ 1 #else #define OJ 0 #endif #define endl '\n' #define TIMESTAMP merr << "Execution time: " << (double)clock()/CLOCKS_PER_SEC << " s.\n" class C_ {}; template <typename T> C_& operator <<(C_& __m, const T& __s) { if (!OJ) cerr << "\E...
C++
9b35f7df9e21162858a8fac8ee2837a4
28e663b0b1b99a6891fac67d7b92f039
2,100
PASSED
#include "iostream" #include "cstdio" #include "map" #include "cstring" #include "algorithm" #include "vector" #include "cassert" #include "map" #include "string" using namespace std; #define rep(i,n) for(int i=0; i<n; ++i) #define maxn 100005 int n; map<string, int> mid, pid; std::vector<string> hostname; vector<int>...
C++
9b35f7df9e21162858a8fac8ee2837a4
6c7703127ee2ff246dab7e5c4cfd647f
2,100
PASSED
#include <bits/stdc++.h> #define INF 1000000007 #define MP make_pair #define FI first #define SE second #define PB push_back #define VI vector<int> const double EPS = 1e-7, PI = acos(-1.0); using namespace std; typedef long long LL; typedef pair <LL, LL> P; const int NUM = 100010; int n; char s[100]; map<string, set<st...
C++
9b35f7df9e21162858a8fac8ee2837a4
101b4ac4364d2c94ff50ec9ef91d394e
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define orta (bas + son >> 1) #define sag (k + k + 1) #define sol (k + k) #define endl '\n' #define foreach(i,x) for(type(x)i=x.begin();i!=x.end();i++) #define FOR(ii,aa,bb) for(int ii=aa;ii<=bb;ii++) #define ROF(ii,aa,bb) for(int ii=aa;ii>=bb;ii--) #...
C++
9b35f7df9e21162858a8fac8ee2837a4
edf1a77eb03edfb4b3a85b40dac515f7
2,100
PASSED
#include<cmath> #include<math.h> #include<ctype.h> #include<algorithm> #include<bitset> #include<cassert> #include<cctype> #include<cerrno> #include<cfloat> #include<ciso646> #include<climits> #include<clocale> #include<complex> #include<csetjmp> #include<csignal> #include<cstdarg> #include<cstddef> #include<cstdio> #i...
C++
9b35f7df9e21162858a8fac8ee2837a4
6707540d03257b021578752e631cf7aa
2,100
PASSED
#include <iostream> #include <stdlib.h> #include <stdio.h> #include <string> #include <string.h> #include <algorithm> #include <set> #include <stack> #include <map> #include <cmath> #include <vector> #include <queue> #include <functional> #include <time.h> #pragma warning (disable : 4996) using namespace std; #define...
C++
9b35f7df9e21162858a8fac8ee2837a4
fbb206c5697c69c9a629a50526b95a4a
2,100
PASSED
#include "bits/stdc++.h" using namespace std; #define all(x) x.begin(),x.end() #define pb push_back #define ff first #define ss second #define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define ar array typedef long long ll; typedef long double ld; ll mod=1e9+7; bool comp(ll a,ll b) { return a<b; } ll fpow(l...
C++
afb43928545743b497b1a9975768f8e5
c15a28ae1f24b74733a68dc3b2d18142
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int maxn = 3e5 + 5; const ll inf = 0x3f3f3f3f; const int mod = 1e9 + 7; #define all(x) x.begin(), x.end() int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int T; ...
C++
afb43928545743b497b1a9975768f8e5
1b9ef7dcd38ee27007f0914dc1fdf8b1
1,800
PASSED
#include <bits/stdc++.h> using namespace std; long long n,l,r; int main() { int t; scanf("%d",&t); while(t--) { scanf("%lld %lld %lld",&n,&l,&r); int cur=1; l--; r--; for(int i=1;i<=n;i++) { int sz=2*(n-i); if(l>=sz) { l-=sz; r-=sz; cur++; } else break; } int co=cur+1; for(...
C++
afb43928545743b497b1a9975768f8e5
970c2c94da80499b5f13662585ad130d
1,800
PASSED
#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <iostream> #include <vector> #include <algorithm> #include <map> #include <set> #include <queue> #include <cmath> #include <unordered_set> #include <unordered_map> #include <iomanip> using namespace s...
C++
afb43928545743b497b1a9975768f8e5
507e269e3d3b96bf724730d00a40c3d7
1,800
PASSED
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0;i < n;i++) #define ll long long using namespace std; //typedef vector<unsigned int>vec; //typedef vector<ll>vec; //typedef vector<vec> mat; typedef pair<int, int> P; typedef pair<ll,ll> LP; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0...
C++
afb43928545743b497b1a9975768f8e5
1670f684a5b842d08f0addf4a7c054e6
1,800
PASSED