submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s810001581
p00105
Accepted
s={} j=[] while 1: try: n,k=map(str,raw_input().split()) if s.has_key(n): s[n].append(int(k)) else: s[n]=[int(k)] j.append(n) except: break j.sort() for i in j: print i s[i].sort() print ' '.join(map(str,s[i]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s612489829
p00105
Accepted
import sys dic = {} for s in sys.stdin: arr = s.split() if arr[0] in dic: a = dic[arr[0]] dic[arr[0]] = a + [int(arr[1])] else: dic[arr[0]] = [int(arr[1])] for i in sorted(dic): print(i) a = sorted(dic[i]) for j in range(len(a)): if j != len(a)-1: prin...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s569304267
p00105
Accepted
import sys def line():return sys.stdin.readline().strip() I = {} while True: try: a,b = line().split() b = int(b) if a in I: I[a].append(b) else: I[a] = [b] except: break for k in sorted(I): print(k) print(" ".join(map(str,sorted(I[k]))))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s863980537
p00105
Accepted
def main(): book_index = {} while True: try: word, page = input().split(' ') page = int(page) page_list = book_index.get(word) if page_list: page_list.append(page) else: book_index[word] = [page] except E...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s410191443
p00105
Accepted
book_index = {} while True: try: word, page = input().split(' ') page = int(page) page_list = book_index.get(word) if page_list: page_list.append(page) else: book_index[word] = [page] except Exception: break for k in sorted(book_index.keys...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s251403114
p00105
Accepted
import sys d = {} for i in sys.stdin.readlines(): s, n = i.split() if s in d: d[s].append(int(n)) else: d[s] = [int(n)] d = sorted(d.items()) for i in d: print(i[0]) print(*sorted(i[1]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s335571811
p00105
Accepted
import sys dictionary = {} for i in sys.stdin.readlines(): word, page = i.split() if word in dictionary: dictionary[word].append(int(page)) else: dictionary[word] = [int(page)] dictionary = sorted(dictionary.items()) #??????????????????????????? for i in dictionary: print(i[0]) #?????? print(*sorted(i[1]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s906039806
p00105
Accepted
dic = {} while True: try: word, pgn = input().split() if word in dic.keys(): dic[word].append(int(pgn)) else: dic[word] = [int(pgn)] except: break for k, v in sorted(dic.items()): print(k) print(' '.join(map(str, sorted(v))))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s768442110
p00105
Accepted
Date_lis = [] W_lis = [] while True: try: s,n = map(str,input().split()) if s in W_lis: Date_lis[W_lis.index(s)][1].append(int(n)) else: Date_lis.append([s,[int(n)]]) W_lis.append(s) except : Date_lis = sorted(Date_lis) for i ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s811011720
p00105
Accepted
c={} while 1: try: a,b=input().split() if a in c.keys():c[a].append(int(b)) else: c[a]=[int(b)] except: for i,j in sorted(c.items()): print(i) print(' '.join(map(str,sorted(j)))) break
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s951421794
p00105
Accepted
c={} while 1: try: a,b=input().split() if a in c:c[a].append(int(b)) else: c[a]=[int(b)] except: for i,j in sorted(c.items()): print(i) print(*sorted(j)) break
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s836474998
p00105
Accepted
data = [] while True: try: data.append(input()) except EOFError: break d = {} for i in range(len(data)): i,n = data[i].split() if i in d: d[i].append(n) else: d[i] = [n] d = sorted(d.items(), key = lambda x:x[0]) for i in range(len(d)): i,n = d[i] n = map(int...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s801474886
p00105
Accepted
# -*- coding: utf-8 -*- import sys import os from collections import defaultdict d = defaultdict(list) for s in sys.stdin: lst = s.split() word = lst[0] page = int(lst[1]) d[word].append(page) keys = list(d.keys()) keys.sort() for key in keys: print(key) pages = d[key] pages.sort() p...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s914188878
p00105
Accepted
index = {} while True: try: word,page = input().split() page = int(page) index[word].append(page) except KeyError: index[word] = [page] except EOFError: break for (key,value) in sorted(index.items()): print(key) value = list(map(str,sorted(value))) print(" ".join(value))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s168774459
p00105
Accepted
import sys a={} for i in sys.stdin: b,c=i.split() a.setdefault(b, []).append(c) for a,b in sorted(a.items(), key=lambda x: x[0]): print(a) print(*sorted(map(int,b)))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s638689428
p00105
Accepted
d = {} while True: try: word, page = input().split() page = int(page) except: break d[word] = [page] if word not in d else d[word] + [page] for word, pages in sorted(d.items()): print(word) print(*sorted(pages))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s747876311
p00105
Accepted
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0105&lang=jp """ import sys def compile_index(dict, word, page): if word in dict: temp = dict[word] temp.append(page) temp.sort() dict[word] = temp else: temp = [page] dict[word...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s068031042
p00105
Accepted
# Aizu Problem 0105: Book Index # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") index = {} for line in sys.stdin: word, page = line.split() if word not in index: index[word] = [] index[word].append(int(page)) f...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s132309217
p00105
Accepted
import sys dic = {} while True: try: a,b = map(str,input().split()) page = int(b) if a not in dic: dic[a] = [page] else: dic[a].append(page) except EOFError: names = sorted(dic.keys()) for i in range(len(names)): print(names[i]) pages = sorted(dic[names[i]]) for j in range(len(pages)): ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s246953384
p00105
Accepted
import sys #from me.io import dup_file_stdin #@dup_file_stdin def solve(): index = dict() for line in sys.stdin: word,page = line.split(' ') pages = index.get(word,list()) pages.append(int(page)) index[word] = pages keys = list(index.keys()) keys.sort() for key in ke...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s509060538
p00105
Accepted
import sys l = [] for input in sys.stdin: l.append(input.split()) l = sorted(l) for i in range(0,len(l)-1): for j in range(i+1,len(l)): if(l[i][0] == l[j][0]): l[i].append(l[j][1]) res = [] for i in range(0,len(l)): if(l[i][0] == l[i-1][0]): continue res.append(l[i]) for i i...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s666266486
p00105
Accepted
d = {} while True: try: data = input().split() except: break word = data[0] number = int(data[1]) if word in d: d[word].append(number) else: d[word] = [number] for k, v in sorted(d.items(), key=lambda x: x[0]): print(k) print(*sorted(v))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s990460140
p00105
Accepted
import sys dictionary = {} for line in sys.stdin: line = line[:-1] word, page = line.split(" ") page = int(page) if word in dictionary: dictionary[word].append(page) else: dictionary[word] = [page] keys = list(dictionary) keys.sort() output = [] for key in keys: output.app...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s897484972
p00105
Accepted
import sys d={} for e in sys.stdin: k,v=e.split() d.setdefault(k,[]) d[k]+=[int(v)] for k in sorted(d): print(k) print(*sorted(d[k]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s785319497
p00105
Accepted
import sys d={} for e in sys.stdin: k,v=e.split() if k in d:d[k]+=[int(v)] else:d[k]=[int(v)] for k in sorted(d): print(k) print(*sorted(d[k]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s878667486
p00105
Accepted
import sys d={} for e in sys.stdin: k,v=e.split() if k not in d:d[k]=[] d[k]+=[int(v)] for k in sorted(d): print(k) print(*sorted(d[k]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s649300110
p00105
Accepted
import sys d={} for e in sys.stdin: k,v=e.split() d.setdefault(k,[]).append(int(v)) for k in sorted(d): print(k) print(*sorted(d[k]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s287991717
p00105
Accepted
def get_input(): while True: try: yield ''.join(input()) except EOFError: break N = list(get_input()) N.sort() N1,N2 = N[0].split() word = N1 pnum = [] pnum.append(int(N2)) for l in range(1, len(N)): N1,N2 = N[l].split() if word != N1: print(word) ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s805908267
p00105
Accepted
dic = {} while True: try: s, i = input().split() if s in dic: dic[s].append(int(i)) else: dic[s] = [int(i)] except EOFError: break for k, v in sorted(dic.items()): print(k) print(*sorted(v))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s047904746
p00105
Accepted
import sys l=[i.split() for i in sys.stdin] d={} for i in l: if i[0] not in d: d[i[0]]=[i[1]] else: d[i[0]].append(i[1]) for i in sorted(d.keys()): print(i) d[i]=list(map(int,d[i])) print(" ".join(map(str,sorted(d[i]))))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s172409937
p00105
Accepted
# AOJ 0105 Book Index # Python3 2018.6.17 bal4u from collections import defaultdict index = defaultdict(list) while True: try: w, p = list(input().split()) except EOFError: break index[w].append(p) index = dict(sorted(index.items())) for x in index: print(x) print(*sorted(map(int, index[x])))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s851861838
p00105
Accepted
import sys dictionary = dict() for line in sys.stdin.readlines(): line = line.strip() word, num = line.split() if not dictionary.has_key(word): dictionary[word] = list() dictionary[word].append(int(num)) for key in sorted(dictionary.keys()): print key print " ".join(map(str, sorted(di...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s058447462
p00105
Accepted
import sys R = lambda:map(int,raw_input().split()) d = {} while 1: try: s,p = raw_input().split() p = int(p) if not d.has_key(s): d[s] = set() d[s].add(p) except EOFError: break #print d for k in sorted(d.iterkeys()): print k print " ".jo...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s837061457
p00105
Accepted
hoge = {} ; teki=[] while True: try: a,b = raw_input().split() if a not in hoge: hoge[a] = [int(b)] elif a in hoge: hoge[a].append(int(b)) except EOFError: for j in sorted(hoge): print j ans = len(hoge[j]) aaa =sorted(hoge[j]) for i in range(ans): print aaa[i], ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s375098080
p00105
Accepted
from collections import defaultdict dic=defaultdict(list) while True: try: word,page=raw_input().split() dic[word].append(int(page)) except EOFError: break; for word in sorted(dic): print word dic[word].sort() for i in range(len(dic[word])-1): print dic[word][i], ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s653570324
p00105
Accepted
from collections import defaultdict dic=defaultdict(list) while True: try: w,p=raw_input().split() dic[w].append(int(p)) except EOFError: for w in sorted(dic): print w dic[w].sort() print " ".join(map(str,dic[w])) break
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s910732289
p00105
Accepted
idx = {} while True: try: data = raw_input().split(); if data[0] in idx: idx[data[0]].append(int(data[1])) else: idx[data[0]] = [int(data[1])] except (EOFError): break for word in sorted(list(idx)): print word for page in sorted(idx[word]): ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s694126491
p00105
Accepted
import sys,collections dic=collections.defaultdict(list) for line in sys.stdin.readlines(): w,p=line.strip().split() dic[w].append(p) for w in sorted(dic): print w print " ".join(sorted(dic[w],key=int))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s081980281
p00105
Accepted
import collections d = collections.defaultdict(list) while 1: try: w, p = raw_input().split() d[w].append(int(p)) except EOFError: break for w in sorted(d): print w print ' '.join(map(str, sorted(d[w])))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s227382416
p00105
Accepted
import sys index = {} for line in sys.stdin: word, page_num = tuple(line.rstrip('\n').split(' ')) if word in index: index[word].append(int(page_num)) else: index[word] = [int(page_num)] for k in sorted(index.keys()): print k pages = index[k] pages.sort() print ' '.join(ma...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s815413949
p00105
Accepted
from collections import defaultdict dic=defaultdict(list) while True: try: w,p=raw_input().split() dic[w].append(int(p)) except EOFError: for w in sorted(dic): print w dic[w].sort() print " ".join(map(str,dic[w])) break
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s257858538
p00105
Accepted
import sys ans = {} for x in sys.stdin.readlines(): word, page = x.rstrip().split() ans.setdefault(word,[]) ans[word].append(page) for k in sorted(ans.keys()): print k print " ".join(sorted(ans[k], cmp=lambda a,b: int(a)-int(b)))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s464335644
p00105
Accepted
#!/usr/bin/env python from __future__ import division, print_function from sys import stdin, exit from collections import defaultdict def main(): index = defaultdict(list) for line in stdin: word, page = line.split() index[word].append(int(page)) for word in sorted(index): print(...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s828437153
p00105
Accepted
index = {} while True: try: w, p = map(str, raw_input().split()) index.setdefault(w,[]).append(int(p)) except: break for k,v in sorted(index.items()): print k print " ".join(map(str, sorted(v)))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s738288271
p00105
Accepted
dic = {} while True: try: word, page = raw_input().split() if word in dic.keys(): dic[word].append(int(page)) dic[word].sort() else: dic[word] = [int(page)] except: dic = sorted(dic.items(), key=lambda x: x[0]) for d in dic: print d[0] print " ".join(map(str, d[1])) break
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s069448047
p00105
Accepted
dic = {} while True: try: key,num = input().split() dic.setdefault(key,[]).append(int(num)) except: break dic = sorted(dic.items()) for tup in dic: print(tup[0]) tup[1].sort() for i in tup[1]: if i != tup[1][-1]: print(i,end=" ") else: ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s229439011
p00105
Accepted
book = [] while True : try : A = list(input().split()) except EOFError : break new_word = "ON" for i in range(len(book)) : if A[0] in book[i] : book[i].append(A[1]) new_word = "OFF" if new_word == "ON" : book.append([A[0], A[1]]) book...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s428972133
p00105
Accepted
D = {} for line in open(0).readlines(): w, p = line.split() D.setdefault(w, []).append(int(p)) for k, v in sorted(D.items()): print(k) print(*sorted(v))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s564022202
p00105
Accepted
dic = {} while(1): try: key,word = (x for x in input().split()) dic.setdefault(key, []) dic[key].append(word) except: break for k in sorted(dic.keys()): print(k) arr = sorted(dic[k],key=int) for i in range(0,len(arr)): if i != 0: print(" ",end=""...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s608531833
p00105
Accepted
d = dict() while True: try: w, n = input().split() except: break n = int(n) if d.get(w): d[w].append(n) else: d[w] = [] d[w].append(n) for k in sorted(d.keys()): print(k) print( *sorted(d[k]) )
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s713310450
p00105
Accepted
book = {} while 1: try: s, n = input().split() book.setdefault(s, []).append(int(n)) except: break book = dict(sorted(book.items())) for k, v in book.items(): print(k) v.sort() print(*v)
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s750920041
p00105
Accepted
# coding=utf-8 ### ### for python program ### import sys import math # math class class mymath: ### pi pi = 3.14159265358979323846264338 ### Prime Number def pnum_eratosthenes(self, n): ptable = [0 for i in range(n+1)] plist = [] for i in range(2, n+1): if ptable...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s871707608
p00105
Accepted
w=[] while True: try: s,n=input().split() except: break ch=True for i in range(len(w)): if w[i][0]==s: w[i].append(int(n)) ch=False break if ch: w.append([s,int(n)]) w.sort() for i in range(len(w)): print(w[i][0]) p=sorted(w...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s128615709
p00105
Accepted
dic = {} while True: try: s, i = input().split() if s in dic:dic[s].append(int(i)) else:dic[s] = [int(i)] except:break for k, v in sorted(dic.items()): print(k) print(*sorted(v))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s922452947
p00105
Accepted
if __name__ == '__main__': dic = {} while True: try: s,n = input().split() dic.setdefault(s,[]).append(int(n)) except EOFError: break # print(dic) tmp = sorted(list(dic)) for word in tmp: print(word) print(*sorted(dic[word]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s762700027
p00105
Accepted
index={} while True: try: word,page=input().split(" ") page=int(page) tmp=index.get(word,[]) tmp.append(page) index[word]=tmp except EOFError: break index=sorted(index.items()) for object in index: print(object[0]) print(" ".join([str(i) for i in sorted...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s268920855
p00105
Accepted
key_list=[] page_list=[] while 1: try: key,page=map(str,input().split()) if key in key_list: page_list[key_list.index(key)].append(int(page)) else: key_list.append(key) page_list.append([int(page)]) except:break key_list_sort=key_list[:] key_list_sort....
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s679002376
p00105
Accepted
dic = {} while 1: try: word, page = map(str, input().split()) page = int(page) if word in dic: dic[word].append(page) else: dic[word] = [page] except: break for d in sorted(dic): print(d) print(' '.join(map(str, sorted(dic[d]))))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s157297857
p00105
Accepted
d = {} while True: try: w, p = input().split() if w in d: d[w].append(int(p)) else: d[w] = [int(p)] except: break for k in sorted(d.items(), key=lambda x: x[0]): print(k[0]) print(*sorted(k[1]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s504773585
p00105
Accepted
result = {} while True: try: n = input() except: break word, number = n.split() if word in result: result[word].append(number) else: result[word] = [number] for k, v in sorted(result.items()): val = sorted(list(map(int, v))) print(k + '\n' + ' '.join(map(str, val)))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s759696854
p00105
Accepted
book = {} while True: a = b = 0 try: a, b = input().split() b = int(b) if a in book: book[a].append(b) else: book[a] = [b] except: break for i, m in sorted(book.items(), key = lambda x: x[0]): print(i) print(" ".join(str(j) for j in sor...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s652902455
p00105
Accepted
book = {} while True: try: w, n = input().split() w = str(w).lower() n = int(n) if (w not in book.keys()): book[w] = [n] else: book[w] += [n] except EOFError: break W = [] for w, nlist in book.items(): nlist.sort() W.appen...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s206656574
p00105
Accepted
dic = {} while(True): try: key, page = input().split() page = int(page) except: break try: dic[key].append(page) except: dic[key] = [page] a = list(dic.keys()) a.sort() for b in a: print(b) print(" ".join(str(e) for e in sorted(dic[b])))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s391538847
p00105
Runtime Error
d={} for s in sys.stdin: w,p=s.split() if not w in d: d[w]=[] d[w].append(int(p)) for w in sorted(d.keys()): print w,"\n"," ".join(map(str,sorted(d[w])))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s028932088
p00105
Runtime Error
d={} for s in sys.stdin: w,p=s.split() if not w in d: d[w]=[] d[w].append(int(p)) for w in sorted(d.keys()): print w,"\n" print " ".join(map(str,sorted(d[w])))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s472946762
p00105
Runtime Error
d={} for s in sys.stdin: w,p=s.split() if w in d: d[w].append(int(p)) else: d[w]=int(p) for w in sorted(d.keys()): print w,"\n" print " ".join(map(str,sorted(d[w])))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s577986019
p00105
Runtime Error
book_index = {} while True: try: word, page = input().split(' ') page = int(page) page_list = book_index.get(word) if page_list: page_list.append(page) else: book_index[word] = [page] except Exception: ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s384837652
p00105
Runtime Error
dic = {} while True: try: word, pgn = input().split() except ValueError: break if word in dic.keys(): dic[word].append(int(pgn)) else: dic[word] = [int(pgn)] for k, v in dic.items(): print(k) print(' '.join(map(str, sorted(v))))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s370172250
p00105
Runtime Error
dic = {} while True: try: word, pgn = input().split() if word in dic.keys(): dic[word].append(int(pgn)) else: dic[word] = [int(pgn)] except: for k, v in dic.items(): print(k) print(' '.join(map(str, sorted(v)))) break
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s425090652
p00105
Runtime Error
dic = {} while True: try: word, pgn = input().split() if word in dic.keys(): dic[word].append(int(pgn)) else: dic[word] = [int(pgn)] except: break for k, v in dic.items(): print(k) print(' '.join(map(str, sorted(v))))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s214109296
p00105
Runtime Error
import sys a={} for i in sys.stdin: b,c=i.split() a.setdefault(b, []).append(c) if c=='18':break for a,b in sorted(a.items(), key=lambda x: x[0]): print(a) print(*b.sort())
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s646194241
p00105
Runtime Error
import sys dic = {} while True: try: a,b = map(str,input(),split()) page = int(b) if a not in dic: dic[a] = [page] else: dic[a].append(page) except EOFError: sorted(dic.keys()) names = list(dic.keys()) for i in range(len(names)): print(names[i]) for j in range(len(dic[i])): if j ==...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s520461083
p00105
Runtime Error
index = {} while True: try: w, p = map(str, raw_input().split()) index.setdefault(w,[]).append(int(p)) index.sort() for i in index: index[i].sort() print i print " ".join(map(int, index[i]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s755408271
p00105
WA: Presentation Error
dict = {} while True: try: a,b = map(str,raw_input().split()) except EOFError: break if a in dict: dict[a].append(int(b)) else: dict[a] = [int(b)] for var in dict: dict[var].sort() dic = list(dict.keys()) dic.sort() for var in dic: print var for i in xrange(len(dict[var])): print dict[var][i], ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s240119230
p00105
WA: Presentation Error
def get_input(): while True: try: yield ''.join(input()) except EOFError: break N = list(get_input()) N.sort() N1,N2 = N[0].split() word = N1 pnum = [] pnum.append(int(N2)) for l in range(1, len(N)): N1,N2 = N[l].split() if word != N1: print(word) ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s263800158
p00105
WA: Presentation Error
import sys ans = {} while True: try: t = raw_input().split() if t[0] not in ans.keys(): ans[t[0]] = [int(t[1])] else: hoge = ans.keys().index(t[0]) ans.values()[hoge].append(int(t[1])) except EOFError: break for k,v in sorted(ans.items()): print k for i in sorted(v): sys.s...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s039923103
p00106
Wrong Answer
while True: n = int(input()) if n==0: break if n % 200 == 0: a = n / 200 else : a = n / 200 + 1 a = (380 * (a - a % 5)) * 0.8 + 380 * (a % 5) if n % 300 == 0: b = n / 300 else : b = n / 300 + 1 b = (550 * (b - b % 4)) * 0.85 + 550 * (b % 4) if ...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s462132949
p00106
Wrong Answer
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0106&lang=jp """ import sys def solve2(amount): """ ???????¨???????????????¨?????????????????§??? """ packages = [(0, 0), (2, 380), (3, 550), (5, 850), (10, 1520), (12, 1870), (15, 2244)] # 1?¢??????????(100g??????)??...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s594332799
p00106
Wrong Answer
def dis(price, n, c, rate): d = (n / c) * c return price * (n - d) + price * d * rate def gram(a, b, c): return 200 * a + 300 * b + 500 * c def calc(a, b, c): return dis(380, a, 5, 0.8) + dis(550, b, 4, 0.85) + dis(850, c, 3, 0.88) while True: f = input() if f == 0: break ans = [] a, b, c = 1, 1,...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s043457765
p00106
Wrong Answer
def dis(price, n, c, rate): d = (n / c) * c return price * (n - d) + price * d * rate def gram(a, b, c): return 200 * a + 300 * b + 500 * c def calc(a, b, c): return dis(380, a, 5, 0.8) + dis(550, b, 4, 0.85) + dis(850, c, 3, 0.88) ans = [] for a in range(25): for b in range(17): for c in range(10): ...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s414973183
p00106
Wrong Answer
def ceil(n, m): return n / m + 2 if n % m != 0 else n / m + 1 def gram(l): return 200 * l[0] + 300 * l[1] + 500 * l[2] def price(l): def c(n, m, p, r): d = (n / m) * m return ((n - d) + d * r) * p return int(c(l[0], 5, 380, 0.80) + c(l[1], 4, 550, 0.85) + c(l[2], 3, 850, 0.88)) t = [] for amount in ...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s878380687
p00106
Wrong Answer
w=[200,300,500,1000,1200,1500] p=[380,550,850,1520,1870,2244] s=[0]*5001 for i in xrange(100,5001,100): s[i]=min([p[j]+s[i-w[j] if i-w[j]>=0 else 0] for j in xrange(6)]) while True: n=input() if n==0: break print s[n]
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s110068158
p00106
Wrong Answer
w=[200,300,500,1000,1200,1500] p=[380,550,850,1520,1870,2244] dp=[2<<20]*5001 dp[0]=0 for k in xrange(6): for i in xrange(0,5000-w[k],100): dp[i+w[k]] = min(dp[i+w[k]] , dp[i]+p[k]) while True: n=input() if n==0: break print dp[n]
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s025002821
p00106
Wrong Answer
#!/usr/bin/env python from __future__ import division, print_function from sys import stdin, exit def main(readline=stdin.readline): table = (0, 0, 330, 550, 760, 850, 1100, 1230, 1400, 1610, 1520, 1950, 1870, 2070, 2250, 2370, 2620, 2720, 2920, 3100, 3040, 3470, 3390, 3590, 3740, 3890, ...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s507153710
p00106
Wrong Answer
#!/usr/bin/env python from __future__ import division, print_function from sys import stdin, exit def main(readline=stdin.readline): table = (0, 0, 380, 550, 760, 850, 1100, 1230, 1400, 1610, 1520, 1950, 1870, 2070, 2250, 2370, 2620, 2720, 2920, 3100, 3040, 3470, 3390, 3590, 3740, 3890, ...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s091531007
p00106
Wrong Answer
r = 5001 wc = [[1500,2244],[1000,1520],[1200,1870],[500,850],[300,550],[200,380]] dp = [0]*r for w,c in wc: i = 1 while w * i < 5001: if dp[w * i] == 0: dp[w * i] = c * i i += 1 for i in range(5001 - w): if dp[i] > 0 and dp[i + w] == 0: dp[i + w] = dp[i] + c while 1: n = input() if n == 0: break prin...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s668933712
p00106
Wrong Answer
r = 5001 wc = [[1500,2244],[1000,1520],[1200,1870],[500,850],[300,550],[200,380]] dp = [0]*r for w,c in wc: dp[w] = c for i in range(r - w): if dp[i] > 0 and dp[i + w] == 0: dp[i + w] = dp[i] + c while 1: n = input() if n == 0: break print dp[n]
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s850612402
p00106
Wrong Answer
r = 5001 wc = [[1500,2244],[1000,1520],[1200,1870],[500,850],[300,550],[200,380]] dp = [0]*r for w,c in wc: dp[w] = c for i in range(r - w + 1): if dp[i] > 0 and dp[i + w] == 0: dp[i + w] = dp[i] + c while 1: n = input() if n == 0: break print dp[n]
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s096220068
p00106
Wrong Answer
r = 51 wc = [[15,2244],[10,1520],[12,1870],[5,850],[3,550],[2,380]] dp = [0]*r for w,c in wc: dp[w] = c for i in range(2,r - w): if dp[i] > 0 and dp[i + w] == 0: dp[i + w] = dp[i] + c while 1: n = input() if n == 0: break print dp[n/100]
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s654775489
p00106
Wrong Answer
r = 51 wc = [[15,2244],[12,1870],[10,1520],[5,850],[3,550],[2,380]] dp = [0]*r for w,c in wc: dp[w] = c for i in range(r - w): if dp[i] > 0 and dp[i + w] == 0: dp[i + w] = dp[i] + c while 1: n = input() if n == 0: break print dp[n/100]
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s024152421
p00106
Time Limit Exceeded
def sensation(): global total for k in keys: if (total + k) < g: splash.append(k) total += k sensation() del splash[-1] total -= k elif (total + k) == g: splash.append(k) ridiculous_thing() del splash...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s650271434
p00106
Time Limit Exceeded
while True: amount = int(input()) decide = [0,0,0,0,0,0] unit = [200,300,500,1000,1200,1500] m_unit = [320,550,850,1520,1870,2244] n = amount res = 0 if n == 0: break while n != 0: for i in [5,4,3,2,1,0]: if n >= unit[i]: decide[i] += 1 n -= unit[i] if n < 200: for j in [5,4,3,2,1,0]: ...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s929955033
p00106
Accepted
cost = {15:2244,12:1870,10:1520,5:850,3:550,2:380} mincost = [10000]*51 for j in cost: mincost[j] = cost[j] for i in range(4,51): for j in cost: if mincost[i-j] < 10000 and mincost[i] > mincost[i-j] + cost[j]: mincost[i] = mincost[i-j] + cost[j] while True: n = int(raw_input()) i...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s288494372
p00106
Accepted
def f(w1): x=[] a1=w1/500 for i1 in range(a1+1): w2=w1-i1*500 a2=w2/300 for i2 in range(a2+1): w3=w2-i2*300 if w3%200==0: x.append([w3/200,i2,i1]) return x def g(x): m=1e9 A=[380,550,850] B=[.2,.15,.12] C=[5,4,3] for e in x: a=0 for i in [0,1,2]: b=e[i]/C[i]*C[i]...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s612574774
p00106
Accepted
def f(w1): m=1e9 for i1 in range(w1/500+1): w2=w1-i1*500 for i2 in range(w2/300+1): w3=w2-i2*300 if w3%200==0: m=min(m,g([w3/200,i2,i1])) return m def g(x): A=[380,550,850] B=[.2,.15,.12] C=[5,4,3] return sum([A[i]*(x[i]-x[i]/C[i]*C[i]*B[i]) for i in [0,1,2]]) while 1: w=input() ...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s264448200
p00106
Accepted
def f(w1): m=1e9 for i1 in range(w1/5+1): w2=w1-i1*5 for i2 in range(w2/3+1): w3=w2-i2*3 if w3%2==0: m=min(m,g([w3/2,i2,i1])) return m def g(x): A=[380,550,850] B=[.2,.15,.12] C=[5,4,3] return sum([A[i]*(x[i]-x[i]/C[i]*C[i]*B[i]) for i in [0,1,2]]) while 1: w=input() if w==0: bre...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s593970668
p00106
Accepted
P=[99999,99999,380,550,760,850,1100,1230,1400,1610,1520,1950,1870,2070,2250,2244] for i in range(16,51): P.append(min(P[i-2]+380,P[i-3]+550,P[i-5]+850,P[i-10]+1520,P[i-12]+1870,P[i-15]+2244)) while(1): q=int(raw_input()) if q==0: break else: print P[q/100]
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s652324323
p00106
Accepted
while True: N = int(input()) if not N: break ans = float('inf') for c200 in range(N//200+1): for c300 in range(N//300+1): for c500 in range(N//500+1): if 200 * c200 + c300 * 300 + c500 * 500 == N: ans = min(ans, 1520*(c200//5)+380*(c200%5)+1870*(c3...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s149139400
p00106
Accepted
while True: n = int(input()) if n == 0: break c = 10000 for i in range(n//500+1): n1 = n - 500*i c1 = (850*3*0.88)*(i//3)+850*(i%3) for j in range(n1//300+1): n2 = n1 - 300*j if n2 % 200 == 0: k = n2 // 200 c2 = c1 + (550*4*0.85)*(j//4)+550*(j%4)+(380*5*0.8)*(k//5)+3...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
s404136920
p00106
Accepted
while True: n = int(input()) if n == 0: break cheapest = float('inf') for bagsA in range(n // 200 + 1): for bagsB in range(n // 300 + 1): for bagsC in range(n // 500 + 1): if 200 * bagsA + 300 * bagsB + 500 * bagsC == n: price = 1520 * (bagsA // 5) + 380 * (bagsA % 5) + 1870 * (bagsB // 4) + 550 * (...
500 2200 0
850 3390
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...