結果

問題 No.3002 テストケース
ユーザー antaanta
提出日時 2014-12-25 23:13:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 5,000 ms
コード長 23,768 bytes
コンパイル時間 1,505 ms
コンパイル使用メモリ 129,656 KB
実行使用メモリ 5,208 KB
最終ジャッジ日時 2023-09-03 17:56:48
合計ジャッジ時間 2,575 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 9 ms
5,208 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 6 ms
4,376 KB
testcase_20 AC 4 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <fstream>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii;
typedef long long ll; typedef vector<long long> vl; typedef pair<long long,long long> pll; typedef vector<pair<long long,long long> > vpll;
typedef vector<string> vs; typedef long double ld;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

struct Xor128 {
	unsigned x, y, z, w;
	Xor128(): x(123456789), y(362436069), z(521288629), w(88675123) { }
	unsigned operator()() {
		unsigned t = x ^ (x << 11);
		x = y; y = z; z = w;
		return w = w ^ (w >> 19) ^ (t ^ (t >> 8));
	}
	unsigned operator()(unsigned n) { return operator()() % n; }
};


struct SubstringHash {
	static const int NumMods = 3;
	static const unsigned Mods[NumMods];
	typedef unsigned long long ull;
	struct Hash {
		unsigned hs[NumMods];
		Hash() { for(int k = 0; k < NumMods; ++ k) hs[k] = 0; }
		bool operator==(const Hash &that) const {
			bool res = true;
			for(int k = 0; k < NumMods; ++ k)
				res &= hs[k] == that.hs[k];
			return res;
		}
	};
	static unsigned seeds[NumMods];
	std::vector<Hash> powh, preh;
	SubstringHash() { if(seeds[0] == 0) initSeeds(); }
	static void initSeeds() {
		Xor128 xor128;
		for(int k = 0; k < NumMods; ++ k) {
			unsigned x;
			do x = xor128(); while(x == 0 || x >= Mods[k]);
			seeds[k] = x;
		}
	}
	template<typename V>
	void init(const V &v, int n) {
		powh.resize(n+1); preh.resize(n+1);
		for(int k = 0; k < NumMods; ++ k) powh[0].hs[k] = 1;
		for(int i = 0; i < n; i ++) for(int k = 0; k < NumMods; ++ k)
			powh[i+1].hs[k] = (ull)powh[i].hs[k] * seeds[k] % Mods[k];
		preh[0] = Hash();
		for(int i = 0; i < n; i ++) for(int k = 0; k < NumMods; ++ k)
			preh[i+1].hs[k] = ((ull)preh[i].hs[k] * seeds[k] % Mods[k] + v[i]) % Mods[k];
	}
	Hash hash(int i, int j) const {
		Hash res;
		for(int k = 0; k < NumMods; ++ k) {
			unsigned x = preh[j].hs[k] + Mods[k] - (unsigned)((ull)preh[i].hs[k] * powh[j - i].hs[k] % Mods[k]);
			res.hs[k] = x >= Mods[k] ? x - Mods[k] : x;
		}
		return res;
	}
	Hash append(const Hash &h, const Hash &g, int glen) const {
		Hash res;
		for(int k = 0; k < NumMods; ++ k) {
			unsigned x = (unsigned)((ull)h.hs[k] * powh[glen].hs[k] % Mods[k]) + g.hs[k];
			res.hs[k] = x >= Mods[k] ? x - Mods[k] : x;
		}
		return res;
	}
};
const unsigned SubstringHash::Mods[SubstringHash::NumMods] = { 2147483647U, 2147483629U, 2147483587U };
unsigned SubstringHash::seeds[SubstringHash::NumMods];

#ifdef WIN32
extern "C" {
	void *__stdcall GetConsoleWindow(void);
	int __stdcall OpenClipboard(void *hWndNewOwner);
	int __stdcall EmptyClipboard(void);
	int __stdcall CloseClipboard(void);
	void *__stdcall SetClipboardData(unsigned int uFormat, void *hMem);
	void *__stdcall GlobalAlloc(unsigned int uFlags, size_t dwBytes);
	void *__stdcall GlobalLock(void *hMem);
	int __stdcall GlobalUnlock(void *hMem);
}
#endif
bool setClipboardText(const string &text) {
#ifdef WIN32
	size_t len = text.size();
	if(!OpenClipboard(GetConsoleWindow())) return false;
	EmptyClipboard();
	void *hGlobal = GlobalAlloc(0x0002, sizeof(char) * (len + 1));
	if(!hGlobal) { CloseClipboard(); return false; }
	char *buf = static_cast<char*>(GlobalLock(hGlobal));
	std::memcpy(buf, text.c_str(), sizeof(char) * len);
	buf[len] = 0;
	GlobalUnlock(hGlobal);
	SetClipboardData(1, hGlobal);
	CloseClipboard();
	return true;
#else
	return false;
#endif
}


string gethash(string s) {
	SubstringHash subh;
	subh.init(s, s.size());
	SubstringHash::Hash h = subh.hash(0, s.size());
	stringstream ss;
	ss << h.hs[0] << ":" << h.hs[1] << ":" << h.hs[2];
	return ss.str();
}


void prepare() {
	string path = "C:\\test\\sagyo\\testcases";
	char buf[100];
	stringstream ss;
	ss << "string hashes[20][100]={" << endl;
	rer(prob, 1, 20) {
		ss << "\t{";
		for(int i = 0; i <= 30; ++ i) {
			rep(zerow, 2) rep(inout, 2) {
				sprintf(buf, "%s\\testcase (%d)\\test_%s\\%0*d.txt",
					path.c_str(), prob, inout == 0 ? "in" : "out", zerow+1, i);
				fstream f(buf, ios_base::in);
				if(!f) continue;
				cerr << buf << endl;
				string line, file;
				while(getline(f, line))
					file += line + '\n';
				string h = gethash(file);
				ss << '"' << h << '"' << ", ";
			}
		}
		ss << "\"\"}," << endl;
	}
	ss << "};" << endl;
	cerr << "OK" << endl;
	setClipboardText(ss.str());
}

string hashes[20][100]={
	{"2133179089:1018618090:1867487746", "1987164879:1193449047:282359062", "1586341069:1932792977:1184436324", "314046932:1452885648:1583752981", "97657310:569216517:1426383266", "1654854489:1277446230:978082652", "2042295273:1807616498:265292323", "1584130943:484246323:792938184", "942177139:254870296:373425169", "1440119040:49772362:1501756018", "472925502:323610007:1108875372", "305206130:547150514:2136801651", "625279116:1563304844:213398934", "1658767675:1459526584:2008662727", "1934660731:288989578:1388343930", "1654854489:1277446230:978082652", "1862874916:1746683436:368367580", "1832956165:1289050534:879141164", "1050867498:1262186808:202589091", "316003525:1543925825:1025301225", "1050867498:1262186808:202589091", "316003525:1543925825:1025301225", ""},
	{"209233613:1082555398:788732167", "907664998:276675349:955170800", "139858442:1623361698:565790957", "907664998:276675349:955170800", "1672877672:1111531490:1003794947", "907664998:276675349:955170800", "914006685:1163127385:503243341", "694356099:488923668:1420260224", "1033587145:913656180:2074249349", "694356099:488923668:1420260224", "372263566:151739088:226774374", "907664998:276675349:955170800", "1494640646:1190097569:357070010", "694356099:488923668:1420260224", "1747973917:1381215540:960765638", "907664998:276675349:955170800", "1543732133:1219029471:178854149", "694356099:488923668:1420260224", "1305442546:394307575:196310882", "694356099:488923668:1420260224", "1305442546:394307575:196310882", "694356099:488923668:1420260224", ""},
	{"667532723:1598946916:1505962035", "209233613:1082555398:788732167", "139858442:1623361698:565790957", "353245516:1517029359:79914333", "209233613:1082555398:788732167", "1654854489:1277446230:978082652", "1571374864:1796490073:1325518141", "1654854489:1277446230:978082652", "475687351:571861304:1400757599", "1065639043:1584494860:431528071", "196847876:505621904:689755706", "1654854489:1277446230:978082652", "1111716799:1666068189:1631349697", "1654854489:1277446230:978082652", "2108904903:362444265:112149552", "1974019170:5890942:764275575", "692439645:215303995:1531542539", "320511403:1153175042:2061153207", "1688867178:995687963:1396680242", "86812338:485823155:1060493342", "1688867178:995687963:1396680242", "86812338:485823155:1060493342", "766428817:566932224:1109380313", "853137155:711269082:1543606924", "766428817:566932224:1109380313", "853137155:711269082:1543606924", "1829727212:385102125:317094828", "1614929023:1362643794:962755507", "1829727212:385102125:317094828", "1614929023:1362643794:962755507", "2007118588:1978269934:849737471", "1654854489:1277446230:978082652", "2007118588:1978269934:849737471", "1654854489:1277446230:978082652", "1805020424:127718454:222195168", "1654854489:1277446230:978082652", "1805020424:127718454:222195168", "1654854489:1277446230:978082652", "846855022:1717998149:108001192", "1654854489:1277446230:978082652", "846855022:1717998149:108001192", "1654854489:1277446230:978082652", "2134415992:547649759:1992383222", "1654854489:1277446230:978082652", "2134415992:547649759:1992383222", "1654854489:1277446230:978082652", "108779837:1673709862:1381923763", "719897576:1308748434:1112811315", "108779837:1673709862:1381923763", "719897576:1308748434:1112811315", "436415724:123128141:1143291190", "880965428:2063019906:493319282", "436415724:123128141:1143291190", "880965428:2063019906:493319282", "1660410883:1363718311:466403334", "2134097663:183409986:639621792", "1660410883:1363718311:466403334", "2134097663:183409986:639621792", "172688760:2044556362:933044900", "1626321110:1786587968:2004010575", "172688760:2044556362:933044900", "1626321110:1786587968:2004010575", ""},
	{"2080874564:259632991:1356769530", "48482507:2112455667:1327240377", "907021717:116922198:670755712", "1606458539:341421553:1720324677", "289360659:1653085203:1483216258", "1606458539:341421553:1720324677", "1643119343:1692761901:1317380837", "48482507:2112455667:1327240377", "1146269137:418821913:89984000", "48482507:2112455667:1327240377", "43383590:1166336128:1985972578", "48482507:2112455667:1327240377", "589528204:423618799:894556604", "1606458539:341421553:1720324677", "681548708:148487213:1506760306", "48482507:2112455667:1327240377", "1687753040:963613919:1650410569", "1606458539:341421553:1720324677", "1176442335:974466705:893642100", "48482507:2112455667:1327240377", "1176442335:974466705:893642100", "48482507:2112455667:1327240377", ""},
	{"2021611644:879816940:1357759400", "1440119040:49772362:1501756018", "534185660:1952547057:1066594867", "667532723:1598946916:1505962035", "1405208102:1473004475:1915878995", "981819930:1680864473:784526150", "71273556:590943609:923338586", "1505914970:119317489:1123045644", "1284434771:83245350:386440050", "460015428:1978399786:316483391", "1150406446:15405694:162164731", "1505914970:119317489:1123045644", "262879421:446738210:1469543154", "903603957:1315935639:1114633610", "28820796:940020278:1701131543", "932424535:2146796210:28845479", "641407869:1826090509:192276752", "745482057:1229456772:680835637", "842932400:809207285:584302085", "143771628:1805442052:1596371032", "842932400:809207285:584302085", "143771628:1805442052:1596371032", "1717894012:291685321:573099440", "1520024967:1918806024:118177864", "1717894012:291685321:573099440", "1520024967:1918806024:118177864", "276523911:1780087703:1536463871", "1849022755:1032095617:1463305215", "276523911:1780087703:1536463871", "1849022755:1032095617:1463305215", "1091797668:1875628497:114650724", "1820202177:201235046:401609759", "1091797668:1875628497:114650724", "1820202177:201235046:401609759", "1057119958:1375588974:1289356381", "1964214080:635709007:1840275512", "1057119958:1375588974:1289356381", "1964214080:635709007:1840275512", "1900718261:1650508607:1409987380", "1200468565:943135066:1291432859", "1900718261:1650508607:1409987380", "1200468565:943135066:1291432859", "1128517542:1581408806:513805274", "297980342:1709840565:999588930", "1128517542:1581408806:513805274", "297980342:1709840565:999588930", "420684197:644056485:56924003", "275029543:1152100525:410021793", "420684197:644056485:56924003", "275029543:1152100525:410021793", "1823034986:445798844:1726086054", "1377969657:1575372240:268543942", "1823034986:445798844:1726086054", "1377969657:1575372240:268543942", "2064958357:76252523:272216346", "2122335980:722187874:126589898", "2064958357:76252523:272216346", "2122335980:722187874:126589898", "1105884191:639224189:2122231783", "291096133:895145608:994185844", "1105884191:639224189:2122231783", "291096133:895145608:994185844", ""},
	{"1031100223:2027684640:1277575626", "1898418150:566163880:71502299", "1098998414:1752606400:652193201", "456102242:1796319432:1433386903", "1751999303:950886352:744432914", "1898418150:566163880:71502299", "1679475539:1750628918:1744584231", "370170509:1982569669:1647630703", "1880760545:1989247251:757152846", "238264033:2048248523:1761228825", "1382222578:1020692706:1339607741", "2140730005:712106900:741019225", "884611950:1213114731:1216864502", "892328201:247240303:655805675", "269642621:1658037856:2011759461", "184460335:1776856916:1633979766", "2103392985:768547251:68577852", "1276022369:743731121:815199485", "352898562:1408742072:423252304", "401150415:765718892:520061032", "352898562:1408742072:423252304", "401150415:765718892:520061032", ""},
	{"667532723:1598946916:1505962035", "2087546892:734204547:1524382550", "598157552:2139753216:1283020825", "1615757044:1217480519:1156387372", "1969761248:535317630:121403457", "2087546892:734204547:1524382550", "807995999:91353122:1936598140", "2087546892:734204547:1524382550", "2087338130:1531040218:675117595", "2087546892:734204547:1524382550", "1456807123:1276164927:528957534", "1615757044:1217480519:1156387372", "1248642268:1031965765:1996559295", "2087546892:734204547:1524382550", "532361152:37784951:1656196322", "2087546892:734204547:1524382550", "56976455:471931723:1377836114", "2087546892:734204547:1524382550", "1809355715:360234071:1809282207", "1615757044:1217480519:1156387372", "1809355715:360234071:1809282207", "1615757044:1217480519:1156387372", ""},
	{"48030233:1013294864:1826809598", "1615757044:1217480519:1156387372", "1942434419:1294338350:591934731", "2087546892:734204547:1524382550", "1262517329:903571337:269624279", "1127927077:1031279321:1091907668", "243182399:1297975001:1493946527", "596642019:1742781363:1381964682", "2044022548:65707938:240418478", "988650138:42032142:1808477278", "1979573265:2017997483:100317903", "594494879:98769777:1159851252", "534746490:667446576:1038078107", "594494879:98769777:1159851252", "1528340409:768082266:820974308", "594494879:98769777:1159851252", "73444810:1844031342:567164845", "594494879:98769777:1159851252", "1354280260:673710596:1274640319", "594494879:98769777:1159851252", "1354280260:673710596:1274640319", "594494879:98769777:1159851252", ""},
	{"872558093:1009162394:957976804", "1440119040:49772362:1501756018", "1204506067:1018083208:1143988323", "1440119040:49772362:1501756018", "889812594:834717888:1474135746", "667532723:1598946916:1505962035", "1773669592:1925495779:143893043", "209233613:1082555398:788732167", "2098973566:1529510625:293793469", "667532723:1598946916:1505962035", "80088841:773257705:973834348", "667532723:1598946916:1505962035", "1943760468:870619751:959343739", "209233613:1082555398:788732167", "1520014754:92331865:326717656", "1898418150:566163880:71502299", "497234838:1150170588:176072795", "209233613:1082555398:788732167", "1074897050:659242932:2086567878", "667532723:1598946916:1505962035", "1074897050:659242932:2086567878", "667532723:1598946916:1505962035", ""},
	{"757770058:1822795579:2110243933", "1168496118:1214698325:2006453410", "1021911156:107252631:486504379", "736299676:153623017:102074672", "1507242238:662357664:21096538", "119878666:1698236261:1098530418", "393711933:1931463407:678424210", "1676562782:333221442:25897764", "1509178948:792454455:759857754", "1618853965:1370805029:733959804", "782405881:1317585783:1329257866", "999473068:589431134:838796112", "1552876048:831155338:1607529568", "1831710822:602818560:471291818", "492922666:1307568434:1832681232", "1795327296:1797232044:2015644464", "161377446:824163142:1366803132", "1622105080:1504069393:1575854185", "623460141:837108121:850803532", "1635081423:1053155463:1219522723", "623460141:837108121:850803532", "1635081423:1053155463:1219522723", ""},
	{"1755595182:242938483:1272979313", "667532723:1598946916:1505962035", "972017374:1415396570:1748930069", "900291355:513222415:1008000964", "1678749698:634205171:1606688426", "1674834265:1202571667:445343191", "676155888:830138226:1256121201", "1898418150:566163880:71502299", "523436548:1172941935:840370306", "637028618:1522000550:1289456078", "1421494583:1756605165:1244179443", "523520820:1164472955:67296282", "393696797:550456408:457712127", "1992054786:208815533:700875116", "1965422061:1864813033:1471611820", "1367569219:845513569:1135086698", "1912211986:738882347:1884023983", "325068338:1995433171:45673846", "991650077:1700678750:1337774858", "1703776773:530044533:1275402010", "991650077:1700678750:1337774858", "1703776773:530044533:1275402010", ""},
	{"1323312701:525217416:667563525", "1440119040:49772362:1501756018", "907021717:116922198:670755712", "907517143:1498015993:2145213685", "441378621:1334664711:975930561", "1654854489:1277446230:978082652", "565996978:826943213:203105171", "1372710606:546807534:1315159979", "904580276:462405382:81418667", "632247325:1716883559:1892897171", "932673435:287248362:1747787063", "135920185:1476459346:1654581452", "1009371438:110774306:1620965742", "1094456675:1365514483:1033885766", "1704087451:1555575824:1695678831", "294639723:2039948024:405505506", "883350266:775980755:1639639829", "147084230:460671647:1703003678", "2040233806:1190967314:1575839429", "907517143:1498015993:2145213685", "2040233806:1190967314:1575839429", "907517143:1498015993:2145213685", ""},
	{"899970543:197021304:688444155", "48482507:2112455667:1327240377", "1964161222:1446039364:1788711222", "48482507:2112455667:1327240377", "2067550195:440093941:1725925647", "1606458539:341421553:1720324677", "1934748519:346984866:1817500804", "48482507:2112455667:1327240377", "67008767:2038720969:617760461", "48482507:2112455667:1327240377", "711330372:713464467:1050044414", "1606458539:341421553:1720324677", "679212287:1808492380:401047602", "48482507:2112455667:1327240377", "1247499526:1696330088:509946940", "1606458539:341421553:1720324677", "243194928:812710823:1571805643", "1606458539:341421553:1720324677", "665764428:2119572439:1351075024", "48482507:2112455667:1327240377", "665764428:2119572439:1351075024", "48482507:2112455667:1327240377", ""},
	{"907021717:116922198:670755712", "440719544:823370841:525925974", "107760646:513267437:556469351", "259900185:441666390:355199445", "1341017388:186678900:988702110", "1656477434:2139653205:1514073554", "1212467625:1551586361:603574532", "107784181:2100198767:720413311", "1785857325:242096387:20572768", "1167122043:1215528208:15930615", "1184163205:1929781726:1348026217", "2056841959:1475471869:294983041", "69309980:821633220:1482918078", "105771663:157806374:579995673", "949211759:1390547121:514958102", "934078567:990409236:1011490961", "525222938:1277284583:1842411601", "1160839011:814457875:1734287524", "661851727:408853159:1865619935", "1422882749:1207895314:59663506", "661851727:408853159:1865619935", "1422882749:1207895314:59663506", ""},
	{"1253404248:1887045882:986925022", "1440119040:49772362:1501756018", "756818006:781483303:1950072128", "1504861751:1749545086:1706471615", "470143173:1563312676:1170210333", "2085917228:1709284092:737148878", "75801385:1982703390:1457356348", "410605144:2126109481:587787022", "1388858775:1298047950:874264850", "678503444:2008843578:552793224", "1844328427:1484293100:1136315549", "1228225346:69203343:765708340", "1758582373:1502812728:321946618", "1426374375:1967010598:2086611277", "727737823:1459904905:1860650793", "1705535190:1029298978:1775675887", "325530793:1735450526:365744291", "1926509282:1338198474:582750874", "1851063105:533628099:885585015", "269316169:1814676473:706851733", "1851063105:533628099:885585015", "269316169:1814676473:706851733", ""},
	{"351394187:1727198679:1215974151", "1514755772:1025052623:569996974", "658568013:1745706499:1270491025", "2046613846:1360377974:2038628994", "2087254810:658599016:799583172", "808810544:2017619416:2139762219", "2045814089:55142758:1763288636", "476301115:1235546436:790797792", "820404668:311537754:254565343", "161062720:182405661:1812790609", "1603185434:1245144407:425153230", "1255382942:791162929:2102060619", "475144868:797163521:1091731090", "1907447415:1765295336:1904629918", "1240257947:729324663:604720777", "1526956602:527776006:1521116651", "542760482:1958545617:1933616014", "1207200882:907101037:693546443", "784763195:1228085011:1544885559", "464497487:2012748667:1202823225", "784763195:1228085011:1544885559", "464497487:2012748667:1202823225", ""},
	{"1418913241:1076004451:2090353801", "889493960:1663930733:2119501390", "294247483:1078348357:1846074848", "742169455:426743548:574202991", "1254767330:1881112707:1998271021", "836472927:491214188:494833205", "1093526051:1847426913:606664984", "351653482:1813485410:660916516", "1057162900:146483012:865378379", "605383340:977063165:272749959", "617377757:2042783288:1156018781", "163150820:203716730:139684142", "645637354:2094216157:48701104", "754297788:22886279:99673950", "1872872983:1492413241:511006893", "445902485:1276553932:862013410", "1380528719:1417455376:2129059874", "894396505:275279886:507759628", "622241456:1342420357:1082912474", "291693771:1372155419:1458795512", "622241456:1342420357:1082912474", "291693771:1372155419:1458795512", ""},
	{"1462855669:519460641:1618441525", "1455996531:1817071311:1641151456", "1840974636:1074955512:791293259", "1576708490:828262646:2122196266", "1773033992:704529184:1954030199", "993768890:1458292820:1320793475", "607768764:783578085:618000885", "1810786289:597646500:187329940", "220905988:86717680:350326098", "803857040:631137678:1952701376", "1534295348:197367373:339698197", "232061217:2002174823:269187970", "1927716272:756282473:1070159991", "247111840:29055255:527672089", "673507934:1467971376:1699190759", "79776428:351684562:928389400", "489920105:327242118:283931794", "1564889533:770085171:2012325556", "47412338:252645452:1095039600", "1256424019:621287493:1328796444", "47412338:252645452:1095039600", "1256424019:621287493:1328796444", ""},
	{"1038538197:123886731:1091905891", "2131379753:955349254:538261053", "1595718415:1583221587:786610694", "597762885:990169651:1783130982", "842138748:1036462189:459942237", "1076040029:1035175607:1051701933", "7281506:2135670813:1563468725", "187300466:1304836041:82909437", "876720410:153016118:633653201", "21557197:1624701599:1377390587", "1086011246:454676263:823631446", "1848138315:880121686:2119926265", "1898985218:108560775:812066299", "460658502:2133491012:1837656248", "1738627373:1831180013:1113965589", "34708219:650646723:235832352", "1651839062:1889956581:1136754419", "1606164346:1702414916:1661173924", "1980059330:407734919:679200654", "1563957493:1079045198:2146754092", "1980059330:407734919:679200654", "1563957493:1079045198:2146754092", ""},
	{"1286449958:1698098373:1235167476", "2127355008:1261228352:1260646277", "1821872495:231698855:361151902", "2127355008:1261228352:1260646277", "370991997:520702589:122546645", "1294497666:295641720:303090822", "329083177:1949203627:319312208", "1294497666:295641720:303090822", "2096038981:836778823:683855190", "2127355008:1261228352:1260646277", "1311343408:784383093:248044561", "2127355008:1261228352:1260646277", "472498394:1301927982:1311236870", "1294497666:295641720:303090822", "345470351:693487528:487110256", "2127355008:1261228352:1260646277", "211046115:1796415448:906691216", "1294497666:295641720:303090822", "959721434:522118484:873855327", "1294497666:295641720:303090822", "959721434:522118484:873855327", "1294497666:295641720:303090822", ""},
};


int main() {
//	prepare();
	string line, file;
	while(getline(cin, line))
		file += line + '\n';
	string h = gethash(file);
	vi ans;
	rer(prob, 1, 20) {
		bool found = false;
		for(string *p = hashes[prob-1]; !p->empty(); ++ p)
			found |= h == *p;
		if(found)
			ans.push_back(prob);
	}
	rep(i, ans.size()) {
		if(i != 0) cout << " ";
		cout << ans[i];
	}
	cout << endl;
	return 0;
}
0