-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.csv
We can't make this file beautiful and searchable because it's too large.
38913 lines (33810 loc) · 849 KB
/
data.csv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
9282280,"
#!/usr/bin/env python
from collections import Counter
def collapse(graph):
if len(graph) == 1:
return None
else:
node_degrees, edge_degrees = Counter(), Counter()
for i, p in enumerate(graph):
node_degrees[i+1] += 1
node_degrees[p] += 1
for i, p in enumerate(graph):
edge_degrees[(i+1, p)] += node_degrees[i+1] + node_degrees[p]
flags = set()
unions = []
for edge in edge_degrees.most_common()[::-1]:
x, y = edge[0]
if x not in flags and y not in flags:
unions.append((x, y))
flags.add(x)
flags.add(y)
for x, y in unions:
for i, p in enumerate(graph):
if p == x:
graph[i] = y
for x, y in unions:
graph[x-1] = -1
graph = [n for n in graph if n >= 0]
for x, y in unions:
for i, p in enumerate(graph):
if p > x:
graph[i] -= 1
return graph
def solve(graph):
i = 0
while graph is not None:
i += 1
graph = collapse(graph)
return i
def main():
t = int(raw_input())
for _ in range(t):
k = int(raw_input())
graph = [int(i) for i in raw_input().split()]
print solve(graph)
if __name__ == ""__main__"":
main()
",PYTH
10396567,"
/* ****vestovia
*/
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define sc(x) scanf(""%d"",&x)
#define sc2(x,y) scanf(""%d%d"",&x,&y)
#define sc3(x,y,z) scanf(""%d%d%d"",&x,&y,&z)
#define sc4(x,y,z,u) scanf(""%d%d%d%d"",&x,&y,&z,&u)
#define scll(x) scanf(""%lld"",&x)
#define scll2(x,y) scanf(""%lld%lld"",&x,&y)
#define scll3(x,y,z) scanf(""%lld%lld%lld"",&x,&y,&z)
#define pr(x) printf(""%d\n"",x)
#define prll(x) printf(""%lld\n"",x)
int main()
{
int i,j,k,s,p,n,t;
sc(t);
ll l,e,o,m;
while(t--)
{
sc(n);
scll2(e,o);
l=(n*(n+1))/2;
m=0;
j=n;
p=-1;s=0;
while(e<=l&&m>=o)
{
if(e==l||m==o)
{
for(i=0;i<n;i++)
{
if(i!=p)
printf(""0 "");
else
printf(""1 "");
}
printf(""\n"");
s=1;
break;
}
p++;
l-=j;
m+=j;
j-=2;
}
if(s!=1)
printf(""-1\n"");
}
return 0;
}
",C++
5243124,"
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Agostinho Junior
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
AndTuples solver = new AndTuples();
int testCount = Integer.parseInt(in.next());
for (int i = 1; i <= testCount; i++)
solver.solve(i, in, out);
out.close();
}
}
class AndTuples {
OutputWriter out;
InputReader in;
long N;
int K;
long[][] memo = new long[63][10];
final long MOD = (long)1e9 + 9;
public void solve(int testNumber, InputReader in, OutputWriter out) {
this.in = in; this.out = out;
K = in.readInt();
N = in.readLong();
for (long[] a: memo) Arrays.fill(a, -1);
out.println(dfs(0, 0));
}
private long dfs(int highest, int last) {
if (last < 0 || last % 2 > 0) {
return 0;
}
if (highest == 10) {
return last == 0 ? 1 : 0;
}
if (memo[highest][last] == -1) {
long res = 0;
for (int k = 0; k <= K; k++) {
int take = (N & (1L << highest)) == 0 ? 0 : 1;
res += dfs(highest + 1, k + (last >> 1) - take);
if (res > MOD) {
res -= MOD;
}
}
memo[highest][last] = res;
}
return memo[highest][last];
}
}
class OutputWriter {
private PrintWriter output;
public OutputWriter(OutputStream out) {
output = new PrintWriter(out);
}
public void println(Object o) {
output.println(o);
}
public void close() {
output.close();
}
}
class InputReader {
private BufferedReader input;
private StringTokenizer line = new StringTokenizer("""");
public InputReader(InputStream in) {
input = new BufferedReader(new InputStreamReader(in));
}
public void fill() {
try {
if(!line.hasMoreTokens()) line = new StringTokenizer(input.readLine());
} catch(IOException io) { io.printStackTrace(); System.exit(0);}
}
public String next() {
fill();
return line.nextToken();
}
public int readInt() {
fill();
return Integer.parseInt(line.nextToken());
}
public long readLong() {
fill();
return Long.parseLong(line.nextToken());
}
}
",JAVA
7265453,"
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <cctype>
#include <cassert>
#include <complex>
using namespace std;
#define ull unsigned long long
#define lld long long int
#define pii pair<int,int>
#define F(i,a,n) for(int i=(a);i<(n);++i)
#define REP(i,a,n) for(i=(a);i<(n);++i)
#define FD(i,a,n) for(int i=(a);i>=(n);--i)
#define FE(it,x) for(it=x.begin();it!=x.end();++it)
#define V(x) vector<x>
#define S(x) scanf(""%d"",&x)
#define Sl(x) scanf(""%llu"",&x)
#define M(x,i) memset(x,i,sizeof(x))
#define debug(i,sz,x) F(i,0,sz){cout<<x[i]<<"" "";}cout<<endl
#define MAX(a,b) ((a)>(b)?(a):(b))
lld ABS(lld a) { if ( a < 0 ) return (-a); return a; }
#define vi vector<int>
#define mp make_pair
#define fr first
#define se second
#define pb push_back
#define maxn 300010
#define inf 1000000000
#define mod 1000000007
map < lld, lld > map1;
lld fact[maxn], ifact[maxn];
lld powmod(lld a, lld b) {
if(b==0) return 1;
lld tres=powmod(a, b/2);
tres=tres*tres%mod;
if(b&1) return tres*a%mod;
return tres;
}
void init() {
fact[0]=1;
for(int i=1;i<maxn;i++) fact[i]=fact[i-1]*i;
ifact[maxn-1]=powmod(fact[maxn-1], mod-2);
for(int i=maxn-2;i>=0;i--) {
ifact[i]=powmod(fact[i], mod-2);
}
}
int main() {
init();
int t; S(t);
while(t-->0) {
int n; S(n);
for(int i=0;i<n;i++) {
lld a; Sl(a); map1[a]++;
}
if(map1[1]==n) {
if(n%2==1) printf(""1\n"");
else printf(""0\n"");
map1.clear();
}
else {
int num=n-map1[1], num1=map1[1]; lld totalways=fact[n];
map< lld, lld >::iterator it; lld ways=1;
for(it=map1.begin(); it!=map1.end();it++) {
lld a=it->first; if(a==1) { totalways=totalways*ifact[it->second]%mod; continue; }
ways = ways*ifact[it->second]%mod;
totalways = totalways*ifact[it->second]%mod;
}
lld res1=0;
for(int i=1;i<=num1;i+=2) {
int rem=num1-i; if(rem==0) { res1+=ways*fact[num]%mod; res1%=mod; continue; }
/*lld ways1=fact[num+rem-1]; ways1=ways1*ways%mod*ifact[rem-1]%mod;
lld ways2=fact[num+rem]; ways2=ways2*ways%mod*ifact[rem]%mod;
ways2 = ways2-ways1+mod; ways2%=mod; res1+=ways2; res1%=mod;*/
res1 = res1 + fact[num+rem-1]*num%mod*ifact[rem]%mod; res1%=mod;
}
lld result = totalways - res1; result=result+mod; result%=mod;
printf(""%lld\n"", result);
map1.clear();
}
}
return 0;
}
",C++
7202509,"
#include <bits/stdc++.h>
using namespace std;
const int HASH_MAXN=100001;
const int X=129;
const int MOD1=1000000009;
const int MOD2=1000000021;
int P1[HASH_MAXN];
int P2[HASH_MAXN];
struct Hash
{
int len, val0, val1;
Hash()
{
//
}
Hash(int val):
len(1),
val0(val),
val1(val)
{
//
}
Hash operator+ (const Hash& other) const
{
Hash ret;
ret.len=len+other.len;
ret.val0=(other.val0+1LL*P1[other.len]*val0)%MOD1;
ret.val1=(other.val1+1LL*P2[other.len]*val1)%MOD2;
return ret;
}
Hash operator- (const Hash& other) const
{
Hash ret;
ret.len=len-other.len;
ret.val0=val0-1LL*P1[len-other.len]*other.val0%MOD1;
if(ret.val0<0)
ret.val0+=MOD1;
ret.val1=val1-1LL*P2[len-other.len]*other.val1%MOD2;
if(ret.val1<0)
ret.val1+=MOD2;
return ret;
}
bool operator< (const Hash& other) const
{
if(len!=other.len)
return len<other.len;
if(val0!=other.val0)
return val0<other.val0;
return val1<other.val1;
}
bool operator== (const Hash& other) const
{
return len==other.len && val0==other.val0 && val1==other.val1;
}
bool operator!= (const Hash& other) const
{
return !(*this==other);
}
};
Hash make_hash(int v)
{
Hash ret;
ret.val0=ret.val1=v;
ret.len=1;
return ret;
}
void init_hash()
{
P1[0]=1;
for(int i=1; i<HASH_MAXN; i++)
P1[i]=1LL*P1[i-1]*X%MOD1;
P2[0]=1;
for(int i=1; i<HASH_MAXN; i++)
P2[i]=1LL*P2[i-1]*X%MOD2;
}
static int _hash_initialized=(init_hash(), 0);
int N, Q;
char S[100003];
Hash L[100003], R[100003];
void answer(bool b)
{
if(b)
printf(""Yes\n"");
else
printf(""No\n"");
}
Hash getLR(int a, int b)
{
return L[b]-L[a-1];
}
Hash getRL(int a, int b)
{
return R[a]-R[b+1];
}
int main()
{
scanf(""%s"", S+1);
N=strlen(S+1);
for(int i=1; i<=N; i++)
L[i]=L[i-1]+make_hash(S[i]);
for(int i=N; i>=1; i--)
R[i]=R[i+1]+make_hash(S[i]);
scanf(""%d"", &Q);
int a, b, c, d;
while(Q--)
{
scanf(""%d%d%d%d"", &a, &b, &c, &d);
int l=d-c+1;
if(b<c || d<a)
answer((L[c+l/2-1]-L[c-1])==(R[d-l/2+1]-R[d+1]));
else if(c<=a && b<=d)
{
int a0=a-c;
int a1=l/2-a0;
Hash x=L[c+a0-1]-L[c-1];
x=x+(R[b-a1+1]-R[b+1]);
int a2=d-b;
int a3=l/2-a2;
Hash y=R[d-a2+1]-R[d+1];
y=y+(L[a+a3-1]-L[a-1]);
answer(x==y);
}
else if(c<=a && a<=d && d<=b)
{
Hash x, y;
int e=c+l/2-1;
int f=d-l/2+1;
if(a<=f)
{
int a0=f-a;
int a1=d-a;
y=getLR(b-a1, b-a0);
}
else
y=getLR(b-(d-a)+1, b)+getRL(f, a-1);
if(a<=f)
x=getLR(c, a-1)+getRL(b-(e-a), b);
else
x=getLR(c, e);
answer(x==y);
}
else if(a<=c && c<=b && b<=d)
{
Hash x, y;
int e=c+l/2-1;
int f=d-l/2+1;
if(b>=e)
{
int a0=b-e;
int a1=b-c;
x=getLR(a+a0, a+a1);
}
else
{
int a0=e-b;
int a1=b-c;
x=getRL(a, a+a0)+getLR(b+1, e);
}
if(b>=f)
y=getRL(b+1, d)+getLR(a, a+b-f);
else
y=getRL(f, d);
answer(x==y);
}
}
return 0;
}
",C++
3923622,"
#include <bits/stdc++.h>
using namespace std;
#define debug(arr,sz) for(int i = sz-1; i >= 0 ; --i) cerr << arr[i] << "" ""; cerr << endl;
typedef long long LL;
LL A[100],sum[100],N,Num,ans;
LL power(LL a,LL b){
LL res = (b == 0) ? 1 : power(a,b/2);
res *= res, res *= (b & 1) ? a : 1;
return res;
}
LL func(LL st,LL id,LL strict,LL val,bool isValid){
if (id == 0) return 0LL;
if (st != 0) isValid = true;
if (isValid and st == val){
LL res;
if (strict) res = (sum[id-1]+1LL);
else res = power(10LL,id-1);
//cerr << st << "" "" << id << "" "" << strict << "" returning "" << res << endl;
return res;
}
LL Mem = 0;
LL mx = (strict) ? A[id-1] : 9;
LL new_st = (val == 1) ? 2 : 1;
if (strict == 0){
Mem += func(0,id-1,0,val,isValid);
LL ct = mx - (val != 0);
Mem += (ct)*func(new_st,id-1,0,val,isValid);
if (val != 0)
Mem += func(val,id-1,0,val,isValid);
} else {
if (mx > 0){
Mem += func(0,id-1,0,val,isValid);
LL ct = 0,nw;
for(int i = 1; i < mx; ++i)
if (i != val) ++ct, nw = i;
if (ct != 0)
Mem += ct*(func(nw,id-1,0,val,isValid));
if (val != 0 and val < mx)
Mem += func(val,id-1,0,val,isValid);
}
Mem += func(mx,id-1,1,val,isValid);
}
//cerr << st << "" "" << id << "" "" << strict << "" returning "" << Mem << endl;
return Mem;
}
LL Brute(LL num,LL id){
LL ct = 0;
for(LL i = 1; i <= num; ++i){
LL k = i;
while(k > 0)
if (k%10 == id){
++ct; break;
} else k /= 10;
}
return ct;
}
void solve(){
cin >> Num;
int sz = 1;
ans = 0;
for(LL i = Num; i > 0; i /= 10, ++sz)
A[sz] = i%10;
sum[1] = A[1];
LL pro = 10LL;
for(int i = 2; i < sz; ++i, pro *= 10LL)
sum[i] = A[i]*pro + sum[i-1];
//debug(sum,sz);
--sz;
LL x = 0, y = Num*10LL;
for(LL i = 0; i < 10; ++i){
ans = 0;
for(LL j = 0; j < A[sz]; ++j)
ans += func(j,sz,0,i,false);
ans += func(A[sz],sz,1,i,false);
x += ans;
//cerr << ""For "" << i << "" "" << ans << endl;
//LL chk = Brute(Num,i);
//if (chk != ans)
// cerr << ""Error for value "" << i << "" "",
// cerr << ""Expected "" << chk << "" Found "" << ans << endl;
//cerr << ans << "" AT "" << i << endl;
}
LL g = __gcd(x,y);
x /= g, y /= g;
cout << x << ""/"" << y << endl;
}
int main()
{
int t; cin >> t;
while(t--) solve();
return 0;
}
",C++
7265003,"
#include <bits/stdc++.h>
#define INF 1000000000
#define MOD 1000000007
#define MAXN 1000005
#define ins insert
#define pb push_back
#define mp make_pair
#define sz size
#define rep(i, n) for(int i = 0; i < n; ++i)
#define sd(n) scanf(""%d"",&n)
#define sll(n) scanf(""%I64d"",&n)
#define pdn(n) printf(""%d\n"",n)
#define plln(n) printf(""%I64d\n"",n)
#define pd(n) printf(""%d "",n)
#define nl() printf(""\n"")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef vector<vi> vii;
typedef pair<ll, ll> pii;
int t, k, cc; string s;
bool isbal() {
stack<char> st;
for(int i = 0; i < s.sz(); ++i) {
if(s[i] == '(')
st.push(s[i]);
else
st.pop();
if(st.empty())
++cc;
}
if(st.empty())
return true;
return false;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> t;
while(t--) {
cin >> s;
cin >> k;
cc = 0;
if(!isbal()) {
if(k == 1)
cout << s << '\n';
else
cout << -1 << '\n';
}
else {
if(cc == 1) {
if(k > 2)
cout << -1 << '\n';
else if(k == 1) {
bool rem = false;
for(int i = 0; i < s.sz(); ++i) {
if(s[i] == ')' && (rem == false))
rem = true;
else
cout << s[i];
}
cout << '\n';
}
else {
for(int i = 1; i < s.sz(); ++i)
cout << s[i];
cout << '\n';
}
}
else {
int l = 0;
rep(i, s.sz()) {
if(s[i] == ')')
++l;
}
int r = l;
if(k > (l+r))
cout << -1 << '\n';
else {
if(k <= l) {
int tl = 0;
for(int i = 0; i < s.sz(); ++i) {
if(s[i] == ')') {
++tl;
if(tl == k) {
continue;
}
}
cout << s[i];
}
cout << '\n';
}
else {
int tr = 0;
k -= l;
//cout << ""k: "" << k << endl;
int xx = s.sz();
--xx; string ans;
for(int i = xx; i >= 0; --i) {
if(s[i] == '(') {
++tr;
if(tr == k) {
continue;
}
}
ans += s[i];
}
reverse(ans.begin(), ans.end());
cout << ans;
cout << '\n';
}
}
}
}
}
return 0;
}
/*
()()
()( 2
()) 3
(() 1
)() 4
((()))
((())
(()))
(())
(()
*/
",C++
3472052,"
package codechef;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class challenge1 {
int count=0,a,mark;
String logical,status,newstatus;
BufferedReader rd=new BufferedReader(new InputStreamReader(System.in));
public int testCases() throws IOException
{
System.out.println(""enter the testcases"");
int testcases=rd.read();
return testcases;
}
public String statuscheck(String logical,int a,int no)
{
if(logical.equals(""<"") )
{
if(a<no)
{
newstatus=""yes"";
}
else
{
newstatus=""no"";
}
}
if(logical.equals("">""))
{
if(a>no)
{
newstatus=""yes"";
}
else
{
newstatus=""no"";
}
}
if(logical.equals(""="") )
{
if(a==no)
{
newstatus=""yes"";
}
else
{
newstatus=""no"";
}
}
return newstatus;
}
public void computeValue() throws IOException
{
String line=rd.readLine();
int testcase=Integer.parseInt(line);
for (int i=0;i<testcase;i++)
{
String line2=rd.readLine();
int hintno=Integer.parseInt(line2);
for(int j=0;j<hintno;j++)
{
String conseline=rd.readLine();
String st[]=conseline.split("" "");
logical=st[0];
String no=st[1];
mark=Integer.parseInt(no);
String status=st[2];
a=100;
String stat= statuscheck(logical,a,mark);
if(stat.equals(status))
{
count=0;
}
else
{
count++;
}
}
System.out.println(count);
}
}
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
challenge1 ch=new challenge1();
ch.computeValue();
}
}
",JAVA
9254797,"
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <iostream>
#include <string>
#include <algorithm>
#define MAXISLAND 1000
#define INF 99999999
using namespace std;
template<typename T>
T getNum(){
T res=0;
char c;
while(1){
//c=getchar();
c = getchar_unlocked();
if(c==' ' || c=='\n') continue;
else break;
}
res=c-'0';
while(1){
//c=getchar();
c = getchar_unlocked();
if(c>='0' && c<='9') res=10*res+c-'0';
else break;
}
return res;
}
string getString()
{
string i = """";
while(1)
{
char t = getchar_unlocked();
if(t == '\n' || t == ' '){
break;
}
i += t;
}
return i;
}
struct Point_t {
int x, y, batas, typePoint;
//typePoint 1: point rect
// 2: terminal
string namePoint;
};
struct Point_tComparer
{
bool operator()(Point_t const &e1, Point_t const &e2)
{
return e1.namePoint < e2.namePoint;
}
};
struct Line_t {Point_t A, B;};
struct RestrictedArea_t {Line_t line1, line2, line3, line4;};
struct Graph_t {double weight; string nameDestination; vector<Point_t> listPointSelected;};
struct Graph_tComparer {
bool operator()(Graph_t const &e1, Graph_t const &e2)
{
return e1.weight < e2.weight;
}
};
map< string, vector<Graph_t> > G;
set<Point_t,Point_tComparer> listPoint[MAXISLAND+2];
int nIsland;
double resultDist, weight[MAXISLAND+2];
Point_t getPoint(string name)
{
for (int i = 0; i < nIsland; ++i)
{
Point_t pointTemp;
pointTemp.namePoint = name;
set<Point_t>::iterator it;
it = listPoint[i].find(pointTemp);
if(it->namePoint == name){
//cout << ""yang dicari "" << name << "" , ketemunya "" << listPoint[i][idx].namePoint << endl;
return *it;
}
}
//return *listPoint[0].begin();
}
int getIdxIslandPoint(string name)
{
for (int i = 0; i < nIsland; ++i)
{
Point_t pointTemp;
pointTemp.namePoint = name;
set<Point_t>::iterator it;
it = listPoint[i].find(pointTemp);
if(it->namePoint == name){
//cout << ""yang dicari "" << name << "" , ketemunya "" << listPoint[i][idx].namePoint << endl;
return i;
}
}
//return 0;
}
void dijkstra(string s, string t, vector<Point_t> &listLocalPointSelected)
{
map<string, double> tentative;
map<string, double> weightOriginal;