s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s194568711 | p03992 | u849957366 | 1474772200 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 71 | if __name__ == "__main__":
print (S[:4].upper() + " " + S[4:].upper()) |
s396571313 | p03992 | u921249617 | 1474772039 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 355 | s = list(input())
K = int(input())
alphabet = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(s)):
if K >= 26 or s[i] >= alphabet[-K]:
K -= ord("z") - ord(s[i]) + 1
s[i] = "a"
if K > 0:
K %= 26
if (chr(ord(s[-1]) + K) <= "z"):
s[-1] = chr(ord(s[-1]) + K)
else:
s[-1] = chr(ord("a") + K)
print("".join(s)) |
s680955332 | p03992 | u794929569 | 1474771984 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3188 | 147 | s1 = input()
s2 = input()
s2 = s2.split(" ")
f = 0
for a,b in enumerate(s2):
if str(s2[int(b)-1]) == str(a+1):
f = f+1
print (int(f/2)) |
s488159452 | p03992 | u921249617 | 1474771972 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 610 | s = list(input())
K = int(input())
alphabet = "abcdefghijklmnopqrstuvwxyz"
# need = 0
# for i in range(len(s)):
# need += ord("z") - ord(s[i]) + 1
for i in range(len(s)):
if K >= 26 or s[i] >= alphabet[-K]:
K -= ord("z") - ord(s[i]) + 1
s[i] = "a"
if K > 0:
K %= 26
if (chr(ord(s[-1]) + K) <= "z"):
s[-1] = chr(ord(s[-1]) + K)
else:
s[-1] = chr(ord("a") + K)
# if K > 0:
# K %= 26
# if (ord(s[-1]) + K <= ord("z")):
# s[-1] = chr(ord(s[-1]) + K)
# else:
# s[-1] = chr(ord("a") + K - (ord("z" - ord(s[-1]))))
print("".join(s)) |
s864732183 | p03992 | u564917060 | 1474771694 | Python | Python (3.4.3) | py | Runtime Error | 33 | 3444 | 648 | from collections import deque
def next_char_ascii_num(c, k):
n = ord(c) + (k % 26)
if n <= 122:
return n
else:
return n % 123 + 97
s = input()
k = int(input())
d = deque()
l = len(s)
for x in s:
if k == 0:
d.append(ord(x))
else:
if k >= 25 and l != 1:
d.append(97)
k -= (26 - (ord(x) - 97))
else:
v =[next_char_ascii_num(x, y) for y in range(k + 1)]
min_index = v.index(min(v))
d.append(v[min_index])
k -= min_index
if k > 0:
d[-1] = next_char_ascii_num(chr(d[-1]), k)
print("".join([chr(x) for x in d]))
|
s324546116 | p03992 | u921249617 | 1474771648 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 458 | s = list(input())
K = int(input())
alphabet = "abcdefghijklmnopqrstuvwxyz"
# need = 0
# for i in range(len(s)):
# need += ord("z") - ord(s[i]) + 1
for i in range(len(s)):
if K >= 26 or s[i] >= alphabet[-K]:
K -= ord("z") - ord(s[i]) + 1
s[i] = "a"
if K > 0:
K %= 26
if (ord(s[-1]) + K <= ord("z")):
s[-1] = chr(ord(s[-1]) + K)
else:
s[-1] = chr(ord("a") + K - (ord("z" - ord(s[-1]))))
print("".join(s)) |
s846743011 | p03992 | u921249617 | 1474771567 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 458 | s = list(input())
K = int(input())
alphabet = "abcdefghijklmnopqrstuvwxyz"
# need = 0
# for i in range(len(s)):
# need += ord("z") - ord(s[i]) + 1
for i in range(len(s)):
if K >= 26 or s[i] >= alphabet[-K]:
K -= ord("z") - ord(s[i]) + 1
s[i] = "a"
if K > 0:
K %= 26
if (ord(s[-1] + K <= ord("z"))):
s[-1] = chr(ord(s[-1]) + K)
else:
s[-1] = chr(ord("a") + K - (ord("z" - ord(s[-1]))))
print("".join(s)) |
s138394021 | p03992 | u765568504 | 1474771246 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 248 | n = int(raw_input())
s = raw_input()
aa = s.split(" ")
aaa = []
for i in range(n):
aaa.append((i+1,int(aa[i])))
ctr = 0
for (a,b) in aaa:
if (b,a) in aaa:
# aaa.remove((a,b))
# aaa.remove((b,a))
ctr = ctr + 1
ctr = ctr / 2
print(str(ctr)) |
s729669704 | p03992 | u223058900 | 1474771035 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 161 | N = input();
a = raw_input().split();
a.insert(0, 0);
`
count = 0;
for i in range(1, N+1):
if (i == int(a[int(a[i])])):
count += 1;
print count / 2
|
s212059623 | p03992 | u765568504 | 1474771004 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 263 | n = int(raw_input())
s = raw_input()
aa = s.split(" ")
aaa = []
for i in range(n):
aaa.append((i+1,int(aa[i])))
ctr = 0
for (a,b) in aaa:
if a == b:
aaa.remove((a,b))
if (b,a) in aaa:
aaa.remove((a,b))
aaa.remove((b,a))
ctr = ctr + 1
print(str(ctr)) |
s883540883 | p03992 | u223058900 | 1474770952 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2568 | 168 | N = input();
a = raw_input().split();
a.insert(0, 0);
print a;
count = 0;
for i in range(1, N+1):
if (i == int(a[int(a[i])])):
count += 1;
print count / 2
|
s142102876 | p03992 | u765568504 | 1474770863 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 231 | n = int(raw_input())
s = raw_input()
aa = s.split(" ")
aaa = []
for i in range(n):
aaa.append((i+1,int(aa[i])))
ctr = 0
for (a,b) in aaa:
if (b,a) in aaa:
aaa.remove((a,b))
aaa.remove((b,a))
ctr = ctr + 1
print(str(ctr)) |
s692040896 | p03992 | u199479035 | 1474770860 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 213 | n = input()
s = list(input())
a = {}
for i in range(1,int(n)+1):
a[i] = int(s[2*i-2])
result = 0
for i in range(1,int(n)+1):
if a[a[i]] == i:
result = result+1
result = int(result/2)
print(result) |
s130286618 | p03992 | u765568504 | 1474770605 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 275 | n = int(raw_input())
print(str(n))
# a = raw_input()
# aa = a.split(" ")
# aaa = []
# for i in range(len(aa)):
# aaa.append((i+1,int(aa[i])))
# ctr = 0
# for (a,b) in aaa:
# if (b,a) in aaa:
# aaa.remove((a,b))
# aaa.remove((b,a))
# ctr = ctr + 1
# print(str(ctr)) |
s418106258 | p03992 | u476127533 | 1474770593 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 271 | N = int(raw_input())
a = map(int, raw_input().split(" "))
b = [-1]
a = b + a
#print a
count = 0
for i in range(1,N+1):
#print a.index(a[int(a[i])])
if i == a[a[i]] and a.index(a[a[i]]) == a[i]:
count +=1
a[i] = 0
a[(a[i])] = 0
print count |
s551371017 | p03992 | u765568504 | 1474770577 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2568 | 237 | n = int(raw_input())
a = raw_input()
aa = a.split(" ")
aaa = []
for i in range(len(aa)):
aaa.append((i+1,int(aa[i])))
ctr = 0
for (a,b) in aaa:
if (b,a) in aaa:
aaa.remove((a,b))
aaa.remove((b,a))
ctr = ctr + 1
print(str(ctr)) |
s343853064 | p03992 | u765568504 | 1474770542 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 261 | N = int(raw_input())
# a = raw_input()
# aa = a.split(" ")
# aaa = []
# for i in range(len(aa)):
# aaa.append((i+1,int(aa[i])))
# ctr = 0
# for (a,b) in aaa:
# if (b,a) in aaa:
# aaa.remove((a,b))
# aaa.remove((b,a))
# ctr = ctr + 1
# print(str(ctr)) |
s252748691 | p03992 | u765568504 | 1474770522 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 251 | N = int(raw_input())
a = raw_input()
aa = a.split(" ")
aaa = []
# for i in range(len(aa)):
# aaa.append((i+1,int(aa[i])))
ctr = 0
# for (a,b) in aaa:
# if (b,a) in aaa:
# aaa.remove((a,b))
# aaa.remove((b,a))
# ctr = ctr + 1
print(str(ctr)) |
s055664390 | p03992 | u765568504 | 1474770493 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2568 | 247 | N = int(raw_input())
a = raw_input()
aa = a.split(" ")
aaa = []
for i in range(len(aa)):
aaa.append((i+1,int(aa[i])))
ctr = 0
# for (a,b) in aaa:
# if (b,a) in aaa:
# aaa.remove((a,b))
# aaa.remove((b,a))
# ctr = ctr + 1
print(str(ctr)) |
s860602804 | p03992 | u849957366 | 1474770408 | Python | PyPy3 (2.4.0) | py | Runtime Error | 214 | 38640 | 83 | import sys
if __name__ == "__main__":
S = sys.argv[1]
print (S[:4] + " " + S[4:]) |
s723447582 | p03992 | u483182857 | 1474769973 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 259 | s=input()
list=[]
k=int(input())
for i in range(len(s)-1):
if (ord(s[i])+k)>122:
list.append('a')
k=k-(123-ord(s[i]))
else:
list.append(s[i])
list.append(chr(ord(s[len(s)])+k))
for i in range(len(s)):
print(list[i], end='') |
s325651729 | p03992 | u436484848 | 1474769031 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 308 | #C-Next Letter
str = input()
K = int(input())
tempK = K
result = ""
for i in range(len(str)):
changeNum = 122-ord(str[i])+1
if (changeNum <= tempK):
result += "a"
tempK -= changeNum
else:
result += str[i]
if (tempK != 0):
tempK %= 26
result = result[:-1] + chr(ord(str[-1]) + tempK)
print(result)
|
s716123869 | p03992 | u794929569 | 1474768950 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 153 | s1 = raw_input()
s2 = raw_input()
s2 = s2.split(" ")
f = 0
for a,b in enumerate(s2):
if str(s2[int(b)-1]) == str(a+1):
f = f+1
print str(f/2) |
s104952364 | p03992 | u794929569 | 1474768874 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3068 | 157 | s1 = raw_input()
s2 = raw_input()
s2 = s2.split(" ")
f = 0
print s2
for a,b in enumerate(s2):
if str(s2[int(b)-1]) == str(a+1):
f = f+1
print f/2 |
s231302424 | p03992 | u765568504 | 1474768773 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 237 | N = int(raw_input())
a = raw_input()
aa = a.split(" ")
aaa = []
for i in range(len(aa)):
aaa.append((i+1,int(aa[i])))
ctr = 0
for (a,b) in aaa:
if (b,a) in aaa:
aaa.remove((a,b))
aaa.remove((b,a))
ctr = ctr + 1
print(str(ctr)) |
s039300051 | p03992 | u765568504 | 1474768699 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2568 | 237 | N = int(raw_input())
a = raw_input()
aa = a.split(" ")
aaa = []
for i in range(len(aa)):
aaa.append((i+1,int(aa[i])))
ctr = 0
for (a,b) in aaa:
if (b,a) in aaa:
aaa.remove((a,b))
aaa.remove((b,a))
ctr = ctr + 1
print(str(ctr)) |
s606850175 | p03992 | u765568504 | 1474768467 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 211 | N = int(raw_input())
a = raw_input()
aa = a.split(" ")
aaa = []
for i in range(len(aa)):
aaa.append((i+1,int(aa[i])))
ctr = 0
for (a,b) in aaa:
if (b,a) in aaa:
ctr = ctr + 1
ctr = ctr / 2
print(str(ctr)) |
s346884725 | p03992 | u425812948 | 1474768397 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 475 | S = str(input())
K = int(input())
arr = [ord(S[i]) for i in range(len(S))]
count = K
for i in range(len(S)):
if i == len(S) - 1:
count %= 26
if ord('z') - arr[i] + 1 <= count:
arr[i] = ord('a')
count -= ord('z') - ord(S[i]) + 1
arr[i] += count
break
if ord('z') - arr[i] + 1 <= count:
arr[i] = ord('a')
count -= (ord('z') - ord(S[i]) + 1)
ans = ''
for c in arr:
ans += chr(c)
print(ans)
|
s031056942 | p03992 | u869081502 | 1474768250 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 70 | def add_space(s):
s=s[:4] + " " + s[4:]
return s
add_space(s) |
s796524669 | p03992 | u454377662 | 1474768202 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 121 | import sys
def solution(s):
return s[:4] + ' ' + s[4:]
if __name__ == '__main__':
print(solution(sys.argv[1]))
|
s083386569 | p03992 | u454377662 | 1474768110 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 121 | import sys
def solution(s):
return s[:4] + ' ' + s[4:]
if __name__ == '__main__':
print(solution(sys.argv[1]))
|
s399925648 | p03992 | u112686013 | 1474768109 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 278 | s = list(raw_input())
k = int(raw_input())
for i in range(len(s)):
numChanges = ord('z') - ord(s[i]) + 1
if s[i] != 'a' and numChanges <= k:
s[i] = 'a'
k -= numChanges
if i == len(s) - 1:
s[i] = chr(ord(s[i]) + (k % 26))
print ''.join(s)
|
s066098998 | p03992 | u765568504 | 1474768104 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 210 | N = int(raw_input())
a = raw_input()
aa = a.split(" ")
aaa = []
for i in range(len(aa)):
aaa.append((i+1,int(aa[i])))
ctr = 0
for (x,y) in aaa:
if (y,x) in aaa:
ctr = ctr + 1
ctr = ctr / 2
print(str(ctr)) |
s006701867 | p03992 | u765568504 | 1474767988 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 218 | N = int(raw_input())
a = raw_input()
aa = a.split(" ")
aaa = []
for i in range(len(aa)):
aaa.append((i+1,int(aa[i])))
ctr = 0
for (x,y) in aaa:
if (y,x) in aaa:
ctr = ctr + 1
aaa.remove( (y,x) )
print(str(ctr)) |
s902549748 | p03992 | u765568504 | 1474767871 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 237 | N = int(raw_input())
a = raw_input()
aa = a.split(" ")
aaa = []
for i in range(len(aa)):
aaa.append((i+1,int(aa[i])))
ctr = 0
for (x,y) in aaa:
if (y,x) in aaa:
ctr = ctr + 1
aaa.remove( (y,x) )
aaa.remove((x,y))
print(str(ctr)) |
s110738518 | p03992 | u765568504 | 1474767830 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 232 | N = int(raw_input())
a = raw_input()
aa = a.split(" ")
aaa = []
for i in range(len(aa)):
aaa.append((i+1,int(aa[i])))
ctr = 0
for (x,y) in aaa:
if (y,x) in aaa:
ctr = ctr + 1
aaa.remove( (y,x) )
aaa.remove((x,y))
print(aaa) |
s787517538 | p03992 | u592453979 | 1474767791 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 439 | def needed_to_flip(c):
return ord('z') - ord(c) + 1
s = list(raw_input())
K = int(raw_input())
#s = list('za')
#K = 4
for i, c in enumerate(s):
if c == 'a':
continue
needed = needed_to_flip(c)
#print "%s: needed: %d, has: %d" % (c, needed, K)
if K >= needed:
K -= needed
s[i] = 'a'
#print "flip: %s needed: %d, has: %d" % (s[i], needed,K)
if i == len(s) - 1:
s[i] = chr(ord(s[i]) + (K % 26))
print ''.join(s)
|
s805346160 | p03992 | u869081502 | 1474767726 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 35 | s=s[:4] + " " + s[4:]
return s
|
s746389374 | p03992 | u451151895 | 1474767706 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2580 | 39 | s = raw_input
print s[:4] + ' ' + s[4:] |
s083046385 | p03992 | u794929569 | 1474767587 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 370 | // string::substr
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str;
cin >> str;
// (quoting Alfred N. Whitehead)
string str2 = str.substr (0,4); // "think"
string str3 = str.substr (4); // get from "live" to the end
cout << str2 << ' ' << str3 << '\n';
return 0;
} |
s084907803 | p03992 | u869081502 | 1474767550 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 53 | if len(s)==12:
s=s[:4] + " " + s[4:]
print s
|
s641176413 | p03992 | u849957366 | 1474767453 | Python | PyPy3 (2.4.0) | py | Runtime Error | 210 | 38640 | 52 | if __name__ == "__main__":
S = S[0:4] + " " + S[4:] |
s290126953 | p03992 | u112686013 | 1474767447 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 328 | s = list(raw_input())
k = int(raw_input())
for i in range(len(s)):
numChanges = ord('z') - ord(s[i]) + 1
if s[i] != 'a' and numChanges <= k:
s[i] = chr(ord(s[i]) - 26 + numChanges)
k -= numChanges
elif i == len(s) - 1 and numChanges > k:
s[i] = chr(ord(s[i]) + k)
print ''.join(s)
|
s232076459 | p03992 | u794929569 | 1474767423 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 78 | import sys
a = sys.stdin.readlines()
b = a[:4]
c = a[4:]
print (b+" "+c+"\n") |
s601383430 | p03992 | u794929569 | 1474767335 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 68 | import sys
a = sys.argv[1]
b = a[:4]
c = a[4:]
print (b+" "+c+"\n") |
s958246001 | p03992 | u451151895 | 1474767229 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2696 | 65 | def cod(s):
return s[:4] + ' ' + s[4:]
k = sys.argv[1]
cod(k) |
s054008439 | p03992 | u794929569 | 1474767202 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 70 | import sys
a = (sys.argv)[1]
b = a[:4]
c = a[4:]
print (b+" "+c+"\n") |
s337879846 | p03992 | u451151895 | 1474767166 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 41 | s = sys.argv[1]
print s[:4] + ' ' + s[4:] |
s753559874 | p03992 | u794929569 | 1474767094 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 68 | import sys
a = sys.argv[1]
b = a[:4]
c = a[4:]
print (a+" "+b+"\n") |
s680233700 | p03992 | u451151895 | 1474767086 | Python | Python (2.7.6) | py | Runtime Error | 18 | 2580 | 25 | print s[:4] + ' ' + s[4:] |
s930167046 | p03992 | u544337787 | 1474767049 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 336 | moji = {a: b for a, b in zip("abcdefghijklmnopqrstuvwxyz", range(26))}
s = list(raw_input())
k = int(raw_input())
for i, e in enumerate(s):
if 26 - moji[e] <= k:
s[i] = "a"
k -= 26 - moji[e]
k = k % 26 if k >= 0 else 0
if k != 0:
s[-1] = "abcdefghijklmnopqrstuvwxyz"[(moji[s[-1]] + k) % 26]
print "".join(s)
|
s739483447 | p03992 | u617054847 | 1474767033 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2692 | 410 | s = raw_input()
k = int(raw_input())
opreq = [(ord('z') - ord(c) + 1) % 26 for c in s]
s_ = []
if len(s) > 1:
i = 0
while k > 0 and i < len(s) - 1:
if opreq[i] < k:
k = k - opreq[i]
s_.append('a')
else:
s_.append(s[i])
i += 1
# Last character
last_c = chr((k + ord(s[-1]) - ord('a')) % 26 + ord('a'))
s_.append(last_c)
print("".join(s_)) |
s674981253 | p03992 | u765568504 | 1474766775 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 50 | s = raw_input()
s2 = s[:4] + " " + s[4:]
print(s2) |
s222321416 | p03992 | u765568504 | 1474766753 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 42 | s = raw_input()
print(s[:4] + " " + s[4:]) |
s210424140 | p03992 | u451151895 | 1474766743 | Python | Python (2.7.6) | py | Runtime Error | 15 | 2568 | 88 | import sys
def codefestival(s):
return s[4:] + ' ' + s[4:]
codefestival(sys.argv[1]) |
s946690143 | p03992 | u765568504 | 1474766740 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 41 | s = raw_input()
print s[:4] + " " + s[4:] |
s764999689 | p03992 | u765568504 | 1474766700 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 41 | s = raw_input()
print s[:4] + " " + s[4:] |
s844119900 | p03992 | u765568504 | 1474766639 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 41 | s = raw_input()
print(s[:4] + ' ' +s[4:]) |
s584375551 | p03992 | u842303434 | 1474766459 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 145 | n = int(input())
l = list(map(int, input().split()))
cnt = 0
for i in range(n):
if i == l[l[i] - 1] - 1:
cnt+=1
cnt //= 2
print(cnt)
|
s324627917 | p03992 | u100054963 | 1474766381 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3188 | 236 | N = int(input())
like_rabbits_list = list(map(int, input().split()))
sum_of_pairs = 0
for i,rabbit in enumerate(like_rabbits_list):
if like_rabbits_list[rabbit - 1] == (i+1):
sum_of_pairs += 1
print (int(sum_of_pairs / 2)) |
s870941242 | p03992 | u451151895 | 1474766317 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 25 | print s[:4] + ' ' + s[4:] |
s826327416 | p03992 | u866788101 | 1474766199 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 84 | input = raw_input("please input:")
output=input[0:4]+" "+output[:-8]
println(output) |
s677489424 | p03992 | u842303434 | 1474766094 | Python | Python (3.4.3) | py | Runtime Error | 22 | 2940 | 56 | s = input()
s = s[:4] + ' ' + s[4:]
print(s) |
s856106758 | p03992 | u842303434 | 1474765912 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3068 | 43 | s = input()
s = s[:4] + ' ' s[4:]
print(s) |
s662736732 | p03992 | u117240323 | 1474765505 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3068 | 18 | print(s[:4],s[4:]) |
s767505156 | p03992 | u327848404 | 1474765487 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 45 | S = raw_input()
print S[0:4] + " " + s[4:12] |
s739967690 | p03992 | u199479035 | 1474765457 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 39 | s = input()
print(s[:4]+' '+s[4:]+'\n') |
s075867648 | p03992 | u451151895 | 1474765355 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2572 | 26 | return s[:4] + " " + s[4:] |
s185953553 | p03992 | u199479035 | 1474765313 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 34 | s = input()
print(s[:4]+' '+s[4:]) |
s471311588 | p03992 | u045939752 | 1474765285 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 43 | s = raw_input()
print s[0:4] + " " + s[4:]
|
s882128022 | p03992 | u422104747 | 1474765251 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 37 | s=input
ss=s[0:3]+" "+s[4:]
print(ss) |
s684885299 | p03993 | u626337957 | 1600922103 | Python | PyPy3 (7.3.0) | py | Runtime Error | 103 | 85580 | 169 | N = int(input())
nums = list(map(int, input().split()))
answer = 0
for i, num in enumerate(nums, start=1):
if i == nums[num] and i < num:
answer += 1
print(answer) |
s389129208 | p03993 | u744034042 | 1598735392 | Python | PyPy3 (7.3.0) | py | Runtime Error | 101 | 84700 | 269 | N = int(input())
A = list(map(lambda x:int(x)-1,input().split()))
ans = 0
paired = []
for i in range(n):
if i in paired:
continue
else:
if A[A[i]] == i:
ans += 1
paired.append(i)
paired.append(A[i])
print(ans) |
s456622262 | p03993 | u625549378 | 1597803351 | Python | Python (3.8.2) | py | Runtime Error | 78 | 20348 | 220 | N = int(input())
rabit = [ int(v) for v in input().split(" ") ]
skip = set()
num = 0
for i in range(N):
n = rabit[i]
if i in skip:
continue
if rabit[n-1] == i+1:
skip.append(n-1)
num += 1
print(num) |
s496794137 | p03993 | u201660334 | 1597378946 | Python | Python (3.8.2) | py | Runtime Error | 44 | 20612 | 135 | n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(a):
if a[a[i] - 1] == i + 1:
ans += 1
print(ans // 2) |
s030854617 | p03993 | u247211039 | 1594069902 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8792 | 245 | #N = int(input())
#a = list(map(int, input().split()))
ans=0
if N%2==0:
for i in range(N//2):
if a[a[i]-1]==i+1:
ans += 1
else:
for i in range(N//2 +1):
if a[a[i]-1]==i+1:
ans+=1
print(ans) |
s584263497 | p03993 | u247211039 | 1594069762 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8928 | 228 | N = int(input())
a = list(map(int, input().split()))
ans=0
if N%2==0:
for i in range(N//2):
if a[a[i]-1]==i+1:
ans += 1
else:
for i in range(N//2 +1):
if a[a[i]-1]==i+1:
ans+=1 |
s736426847 | p03993 | u247211039 | 1594069726 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8976 | 228 | N = int(input())
a = list(map(int, input().split()))
ans=0
if N%2==0:
for i in range(N//2):
if a[a[i]-1]==i+1:
ans += 1
else:
for i in range(N//2 +1):
if a[a[i]-1]==i+1:
ans+=1 |
s003213909 | p03993 | u089121621 | 1594068423 | Python | Python (3.8.2) | py | Runtime Error | 46 | 20676 | 192 | n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
l = l[0]
cnt = 0
for i in range(n):
if l[i]-1 > i:
if( l[l[i]-1]-1 == i):
cnt+=1
print(cnt) |
s368737521 | p03993 | u193927973 | 1593275921 | Python | Python (3.8.2) | py | Runtime Error | 46 | 20596 | 121 | N=int(input())
A=list(map(int, input().split()))
ans=0
for i in range(N):
if A[a[i-1]-1]==i+1:
ans+=1
print(ans//2) |
s801110105 | p03993 | u090406054 | 1593210911 | Python | Python (3.8.2) | py | Runtime Error | 58 | 20596 | 117 | n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
if a[a[i+1]+1]==i+1:
cnt+=1
print(cnt) |
s707785707 | p03993 | u274635633 | 1591086756 | Python | Python (3.4.3) | py | Runtime Error | 41 | 14008 | 108 | n=int(input())
a=[0]+list(map(int,input().split()))
ans=0
for i in n:
if a[a[i]]==i:
ans+=1
print(ans) |
s975588213 | p03993 | u227085629 | 1590673677 | Python | Python (3.4.3) | py | Runtime Error | 54 | 13880 | 118 | n = int(input())
a = list(map(int,input().split()))
c = 0
for i in range(n):
if i == a[a[i]]:
c += 1
print(c//2) |
s015303052 | p03993 | u633355062 | 1590099839 | Python | PyPy3 (2.4.0) | py | Runtime Error | 212 | 52316 | 425 | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int
nl = lambda: list(map(int, readline().split())) # input multiple int to list
n = ni()
l = nl()
ans = 0
for i, usa in enumerate(l):
if l[usa] - 1 == i:
ans += 1
print(ans // 2) |
s289413382 | p03993 | u663438907 | 1589323961 | Python | Python (3.4.3) | py | Runtime Error | 690 | 2007352 | 220 | import numpy as np
import collections
N = int(input())
a = list(map(int, input().split()))
l = np.zeros((N, N))
for i in range(N):
l[i][a[i]-1] += 1
lt = l.T
sum_l = l + lt
print(len(list(sum_l[sum_l == 2]))//2) |
s485126186 | p03993 | u652656291 | 1589299081 | Python | Python (3.4.3) | py | Runtime Error | 60 | 14008 | 138 | n = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(n):
b = A[i]
if i+1 == A[b]:
ans += 1
print(ans//2)
|
s842074132 | p03993 | u652656291 | 1589299052 | Python | Python (3.4.3) | py | Runtime Error | 57 | 14008 | 130 | n = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(n):
if i+1 == A[A[i]]:
ans += 1
print(ans//2)
|
s329683916 | p03993 | u711238850 | 1588942728 | Python | PyPy3 (2.4.0) | py | Runtime Error | 176 | 42864 | 128 | n = int(input())
a = tuple(map(lambda a:int(a)-1,input()))
ans = 0
for i in range(n):
if a[a[i]]==i:
ans+=1
print(ans//2) |
s425950122 | p03993 | u667024514 | 1588938471 | Python | Python (3.4.3) | py | Runtime Error | 59 | 14008 | 132 | n = int(input())
lis = list(map(int,input().split()))
ans = 0
for i in range(n):
if lis[lis[i]] == i+1:
ans += 1
print(ans//2) |
s479255685 | p03993 | u141410514 | 1587785534 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2112 | 253388 | 252 | n = int(input())
A = list(map(int,input().split()))
cnt = 0
B = [False for _ in range(n)]
for i,a in enumerate(A):
print(A[a-1],i)
print(B)
if A[a-1] == i+1 and B[i] == False:
cnt+=1
B[a-1] = True
B[i] = True
print(cnt)
|
s578229972 | p03993 | u148551245 | 1587242127 | Python | Python (3.4.3) | py | Runtime Error | 41 | 13880 | 180 | n = int(input())
a = list(map(int, input().split()))
like = {}
ans = 0
for i, r in enumerate(a):
like[i] = r
if like.get(r, default=0) == i:
ans += 1
print(ans)
|
s506493038 | p03993 | u148551245 | 1587241169 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 643 |
use std::io::stdin;
use std::collections::BTreeMap;
fn main() {
let mut buf = String::new();
stdin().read_line(&mut buf).ok();
let n: usize = buf.trim().parse().ok().unwrap();
let mut buf = String::new();
stdin().read_line(&mut buf).ok();
let a = buf.split_whitespace().map(|x| x.parse().ok().unwrap()).collect::<Vec<usize>>();
let mut like = BTreeMap::new();
let mut ans = 0usize;
for (i, t) in a.iter().enumerate() {
let handle = like.entry(i+1).or_insert(0);
*handle = *t;
if like.get(t) == Some(&(i+1)) {
ans += 1;
}
}
println!("{}", ans);
}
|
s300580413 | p03993 | u102242691 | 1584244629 | Python | Python (3.4.3) | py | Runtime Error | 19 | 4724 | 152 |
n = int(input())
a = list(map(int,input()))
ans = 0
for i in range(n):
j = a[i] -1
if a[j] == i + 1:
ans += 1
print(ans // 2)
|
s407345681 | p03993 | u667024514 | 1584013745 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 127 | n =int(input())
lis =list(map(int,input().split()))
ans =0
for i in range(n):
if lis[lis[i]-1]=i+1:
ans +=1
print(ans//2) |
s832397420 | p03993 | u767664985 | 1583898281 | Python | Python (3.4.3) | py | Runtime Error | 40 | 14008 | 170 | N = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(N):
j = a[i] - 1
if i < j and a[j] - 1 == i:
ans += 1
print(ans)
|
s996321900 | p03993 | u127499732 | 1581143320 | Python | Python (3.4.3) | py | Runtime Error | 56 | 14008 | 111 | n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
if a[a[i]]==i:
ans+=1
print(ans) |
s567796108 | p03993 | u209619667 | 1579120864 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14008 | 161 | p = int(input())
A = list(map(int,input().split()))
a = list(range(1,p+1))
count = 0
for j,i in zip(a,A):
if i == a[A.index(j)]:
count += 1
print(count//2) |
s664486289 | p03993 | u905582793 | 1577420081 | Python | Python (3.4.3) | py | Runtime Error | 61 | 13880 | 124 | n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
j = a[i]
if a[j] == i:
ans+=1
print(ans//2) |
s523186818 | p03993 | u386819480 | 1575866740 | Python | Python (3.4.3) | py | Runtime Error | 307 | 29736 | 802 | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32
from bisect import bisect_left, bisect_right
def solve(N: int, a: "List[int]"):
x = [[i+1, a[i]] for i in range(N)]
x = sorted(x, key=lambda x:x[1])
x1 = [i for i,j in x]
x2 = [j for i,j in x]
ans = 0
for i in range(N):
p = bisect_left(x2, x1[i])
if x1[i] == x2[p]:
if x2[i] == x1[p]:
ans += 1
print(ans//2)
return
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
N = int(next(tokens)) # type: int
a = [int(next(tokens)) for _ in range(N)] # type: "List[int]"
solve(N, a)
if __name__ == '__main__':
main()
|
s211726145 | p03993 | u936985471 | 1573482503 | Python | Python (3.4.3) | py | Runtime Error | 41 | 13880 | 113 | n=input()
a=list(map(int,input().split()))
ans=0
for i in range(n):
if a[a[i]-1]-1==i:
ans+=1
print(ans//2) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.