Harryxun/stf_run huggingface dataset:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy
from functools import reduce

def main():
    n = int(input())
    lists = []
    ans = [0]*4
    for i in range(n):
        s = input()
        if not s in lists:
            lists.append(s)


        if s == "AC":
            ans[0] += 1
        elif s == "WA" :
            ans[1] += 1
        elif s == "TLE":
            ans[2] += 1
        else:
            ans[3] += 1
    

    for i in range(ans):
        if i == 0:
            print("AC x", ans[i])
        elif i == 1 :
            print("WA x", ans[i])
        elif i == 2:
            print("TLE x", ans[i])
        else:
            print("RE x", ans[i])


if __name__ == "__main__":
    main()

### FIXED CODE ###

import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy
from functools import reduce

def main():
    n = int(input())
    lists = []
    ans = [0]*4
    for i in range(n):
        s = input()
        if not s in lists:
            lists.append(s)


        if s == "AC":
            ans[0] += 1
        elif s == "WA" :
            ans[1] += 1
        elif s == "TLE":
            ans[2] += 1
        else:
            ans[3] += 1
    

    for i in range(len(ans)):
        if i == 0:
            print("AC x", ans[i])
        elif i == 1 :
            print("WA x", ans[i])
        elif i == 2:
            print("TLE x", ans[i])
        else:
            print("RE x", ans[i])


if __name__ == "__main__":
    main()
# -*- coding: utf-8 -*-
import sys
import collections

def main():
	N, Q = map(int, input().split(" "))
	S = input()
	S = list(S)
	
	skill = []
	for _ in range(Q):
		t, d = input().split(" ")
		skill.append((t, d))
	
	gorlm_num = [1] * len(S)
	
	for i, val in enumerate(skill):
		t, d = val
		#print(gorlm_num)
		for j, vol in enumerate(S):
			if t == vol:
				tt = gorlm_num[j]
				gorlm_num[j] = 0
				if d == "R" and j != len(S)-1:
					gorlm_num[j+1] += tt
				if d == "L" and j != 0:
					if j != 0:
					gorlm_num[j-1] += tt
						
	ans = 0
	for i in gorlm_num:
		ans = ans + i
		
	print(ans)
	
if __name__ == "__main__":
	main()
	

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
	
def main():
	N, Q = map(int, input().split())
	S = "_" + input() + "_"
	
	TD = []
	for _ in range(Q):
		tmp = input().split(" ")
		t = tmp[0]
		d = tmp[1]
		TD.append((t, d))
		
	TD.reverse()
	gake_L = 0
	gake_R = N - 1 + 2
	
	for i, val in enumerate(TD):
		t, d = val
		
		if d == "R":
			if t == S[gake_R-1]:
				gake_R -= 1
			if t == S[gake_L]:
				gake_L -= 1
		
		if d == "L":
			if t == S[gake_R]:
				gake_R += 1
			if t == S[gake_L+1]:
				gake_L += 1
	
	print(max(0, gake_R-gake_L-1))
	
	
if __name__ == "__main__":
	main()
import sys
input = sys.stdin.readline
from collections import Counter
def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a = [i - 1 for i in a]
    ac = Counter(a)
    kaiten = [0] * n
    count = 0
    koko = 0
    kaitenkikan = 0
    while k > 0:
        koko = a[koko]
        count += 1
        k -= 1
        if kaiten[koko] > 0:
            kaitenkikan = abs(count - kaiten[koko])
            break
        else:
            kaiten[koko] = count
    k_remain = k % kaitenkikan
    if k_remain < 0:
        k_remain += kaitenkikan

    while k_remain > 0:
        koko = a[koko]
        k_remain -= 1

    print(koko + 1)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    n, k = map(int, input().split())
    a = [0]
    ta = list(map(int, input().split()))
    a += ta
    kaiten = [0] * (n + 1)
    count = 0
    koko = 1
    kaitenkikan = 0
    while k > 0:
        koko = a[koko]
        count += 1
        k -= 1
        if kaiten[koko] > 0:
            kaitenkikan = abs(count - kaiten[koko])
            break
        else:
            kaiten[koko] = count
    if k == 0:
        print(koko)
        sys.exit()
    k_remain = k % kaitenkikan
    if k_remain < 0:
        k_remain += kaitenkikan

    while k_remain > 0:
        koko = a[koko]
        k_remain -= 1

    print(koko)

if __name__ == '__main__':
    main()
T = list(input())
ex=None
for i in range(len(T)):
  if T[i] == "?":
    if ex == "P":
      T[i] = "D"
    else:
      if T[i+1] == "D":
        T[i] = "P"
      else:
        T[i] = "D"
  ex = T[i]
print("".join(T))


### FIXED CODE ###

T = list(input())
ex=None
for i in range(len(T)):
  if T[i] == "?":
    if ex == "P" or ex == None:
      T[i] = "D"
    else:
      if len(T)-1 == i:
        T[i] = "D"
      elif T[i+1] == "D" or T[i+1] == "?":
        T[i] = "P"
      else:
        T[i] = "D"
  ex = T[i]
print("".join(T))
import numpy as np
n = int(input())
print(int(int(n * (n - 1)) / 2))


### FIXED CODE ###

s = list(input())
t = list(input())
p = []

for i in range(0,3):
    p.append(s[i] == t[i])
    
print(p.count(True))
import sys
input=sys.stdin.buffer.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
N,R = map(int,input().split())
if N >= 10:
    print(R)
else:
    print(R+100*(10-K))
    



### FIXED CODE ###

import sys
input=sys.stdin.buffer.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
N,R = map(int,input().split())
if N >= 10:
    print(R)
else:
    print(R+100*(10-N))
import numpy as np
from itertools import product
H, W, K = map(int, input().split())
G = np.array([list(map(int, list(input()))) for _ in range(H)])

ans = float("inf")

for pattern in product([0, 1], repeat = H - 1):
    div = [0] + [i for i, p in enumerate(pattern, 1) if p == 1] + [20]
    rows = []
    for i in range(len(div) - 1):
        rows.append(np.count_nonzero(G[div[i]: div[i + 1]], axis=0)) # 列方向

    tmp_ans = 0
    cnt = [0] * len(rows)
    w = 0
    flag = False

    while w < W:
        for r in range(len(rows)):
            cnt[r] += rows[r][w]
        if np.any(np.array(cnt) > K):
            if w == 0:
                flag = True
                break
            cnt = [0] * len(rows)
            tmp_ans += 1
            w -= 1
        w += 1
    
    if not flag:
        tmp_ans += pattern.count(1)
        ans = min(ans, tmp_ans)

print(ans)

### FIXED CODE ###

from itertools import product
H, W, K = map(int, input().split())
G = [list(map(int, list(input()))) for _ in range(H)]

ans = float("inf")

for pattern in product([0, 1], repeat = H - 1):
    div = [0] + [i for i, p in enumerate(pattern, 1) if p == 1] + [H]
    rows = []
    for i in range(len(div) - 1):
        row = []
        for j in range(W):
            tmp = 0
            for k in range(div[i], div[i + 1]):
                tmp += G[k][j]
            row.append(tmp)
        rows.append(row)
        
    flag = True
    for row in rows:
        if [r for r in row if r > K]:
            flag = False
            break
    if not flag:
        continue

    tmp_ans = 0
    cnt = [0] * len(rows)
    w = 0

    while w < W:
        for r in range(len(rows)):
            cnt[r] += rows[r][w]
        if [c for c in cnt if c > K]:
            cnt = [0] * len(rows)
            tmp_ans += 1
            w -= 1
        w += 1
    
    tmp_ans += pattern.count(1)
    ans = min(ans, tmp_ans)

print(ans)
N=int(input())
P=[int(input()) for i in range(N)]

if P[0] > P[N-1] and P[N-1] < P[2] and P[3] < P[0]:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

N=int(input())
p=list(map(int,input().split()))

sort_p=sorted(p)
cnt=0

#i,jにpとソートしたpを代入して比較
for i,j in zip(p,sort_p):
  if i != j:
    cnt += 1

if cnt <= 2:
  print("YES")
else:
  print("NO")
K, X = [int(n) for n in input().split()]
print(" ".join([n for n in range(X-(K-1), X+(K-1)]))

### FIXED CODE ###

K, X = [int(n) for n in input().split()]
print(" ".join([str(n) for n in range(X-(K-1), X+(K))]))
a,b = int(input())
average = (a + b) / 2
if (a + b) % 2 == 0:
  print(ans)
else:
  print(ans + 1)

### FIXED CODE ###

a,b = map(int,input().split())
average = int((a + b) / 2)
if (a + b) % 2 == 0:
  print(average)
else:
  print(average + 1)
N = int(input())
var = [str(input()) for i in range(N)]
judges = ['AC', 'WA', 'TLE', 'RE']
for j in judges:
    print('{} x {}'.format(j, (np.array(var) == j).sum()))

### FIXED CODE ###

import numpy as np

N = int(input())
var = [str(input()) for i in range(N)]

judges = ['AC', 'WA', 'TLE', 'RE']
for j in judges:
    print('{} x {}'.format(j, (np.array(var) == j).sum()))
import numpy as np

N = input()

str_list = list(input().split())

P = np.prod(str_list)

if P > 10 ** 18:
	print(-1)
else:
	print(P)

### FIXED CODE ###

n = int(input())
A = input().split()
A.sort()

s = 1
for i in range(n):
	s*= int(A[i])
	if s > 10**18:
		print(-1)
		exit()

print(s)
if A==5 and B==5 and C==7:
    print('YES')
elif A==5 and B==7 and C==5:
    print('YES')
elif A==7 and B==5 and C==5:
    print('YES')
else:print('NO')

### FIXED CODE ###

a = list(map(int,input().split()))
a.sort()
if a[0] == a[1] == 5 and a[2] == 7:
    print("YES")
else:
    print("NO")
A, B, T = map(int, input().split())
return ((T+0.5)//A * B)

### FIXED CODE ###

A, B, T = map(int, input().split())
print(int(T+0.5)//A * B)
int(input())=n
int(input())=m
if n==m:
  print('yes')
else:
  print('no')


### FIXED CODE ###

a=input()
b=a.split()
if int(b[0])==int(b[1]):
  print('Yes')
else:
  print('No')
L,R = map(int,input().split())

#区間の両端を除いた数=2017より長ければ2019の倍数が含まれているので0が解

ans = 2019 ** 2

for i in range(L,R):
  for j in range(L + 1,R):
    mod = (i * j) % 2019 
    if mod < ans:
      ans = mod
    elif mod == 0:
      ans = 0
      break
print(ans)



### FIXED CODE ###

L = list(map(int, input().split()))

N = L[0]
A = L[1]
B = L[2]


train = N * A

if train < B:
	print(train)
	
else:print(B)
def kouyaku(m,n):
    mn = min(m,n)
    risuto = []
    for i in range(2,mn+1):
        if m%i==0 and n%i==0:
            risuto.append(i)
    return max(risuto)

n = int(input())
a = [int(i) for i in input().split()]
mn1 = min(a)
a.remove(mn1)
mn2 = min(a)
ko = kouyaku(mn2,mn1)
if ko > 1:
    print(ko)
else:
    print(1)

### FIXED CODE ###

import fractions

n = int(input())
a = [int(i) for i in input().split()]

for i in range(1,n):
    if i==1:
        ko = fractions.gcd(a[1],a[0])
    else:
        ko = fractions.gcd(ko,a[i])
print(ko)
n=int(input())
k=n-999
if n<=999:print('ABC'+str(n).fill(3))
else:print('ABD'+ str(k).zfill(3))

### FIXED CODE ###

n=int(input())
if n<=999:print('ABC')
else:print('ABD')
l, r = map(int,input().split())
if not l//2019 == r//2019:
    print(0)
else:
    l %= 2019
    r %= 2019
    ans = 10**10
    for i in range(l,r):
        for j in range(i+1,r+1):
            if ans > (i*j)%2019:
                ans = (i*j)%2019

print(ans)


### FIXED CODE ###

l, r = map(int,input().split())
if not l//2019 == r//2019:
    print(0)
else:
    l = l%2019
    r = r%2019
    ans = 10**10
    for i in range(l,r):
        for j in range(i+1,r+1):
            if ans > (i*j)%2019:
                ans = (i*j)%2019
    print(ans)
S = input()
if S[-1] == s
	print(S + 'es')
else:
 	print(S + 's')

### FIXED CODE ###

S = input()
if S[-1] == 's':
	print(S + 'es')
else:
 	print(S + 's')
A, B, C, K = map(int, input().split())
result = 0
p

if A >= K:
    print(A)
elif (A + B) >= K:
    print(A)
else:
    for i in range(K):
        print(i)
        if A > (i + 1):
            result += 1
            continue
        elif A == (i + 1):
            result += 1
            continue

        if B > (i + 1 - A):
            continue
        elif B == (i + 1 - A):
            continue

        if C > (i + 1 - A - B):
            result -= 1
            continue
        elif C == (i + 1 - A - B):
            result -= 1
            break
        else:
            break
    print(result)

### FIXED CODE ###

A, B, C, K = map(int, input().split())
if A >= K:
    print(K)
elif (A + B) >= K:
    print(A)
elif (A + B + C) > K:
    print(A - (K - A - B))
elif (A + B + C) == K:
    print(A - C)
def available(start, end, S, step=None):
    if step is not None:    #   追い越し処理
        S = S[:step] + "#" + S[step+1:]
    for i in range(start-1, end-2):
        if S[i] == "#" and S[i+1] == "#":
            return False
    return True, S
    
def overtake(start, end, S):
    fixed_end = min(end, len(S)-1)
    for i in range(start, fixed_end-1):
        if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
            step = i
            return True, step
    return False, None

N, A, B, C, D = map(int, input().split())
S = input()

if D > C:   #   追い越しが不要な時
    judge1, S = available(A, C, S)
    judge2, S = available(B, D, S)
    if judge1 and judge2:
        print("Yes")
    else:
        print("No")
else:   #   追い越しが必要な時
    overtakable, step = overtake(B, D, S)
    if overtakable:   #   追い越しが可能な時
        judge1, S = available(B, D, S)
        judge2, S = available(A, C, S, step=step)
        if judge1 and judge2:
            print("Yes")
        else:
            print("No")
    else:   #   追い越しができない時
        print("No")
        

### FIXED CODE ###

def available(start, end, S, step=None):
    if step is not None:    #   追い越し処理
        S = S[:step] + "#" + S[step+1:]
    for i in range(start, end):
        if S[i] == "#" and S[i+1] == "#":
            return False, S
    return True, S
    
def overtake(start, end, S):
    for i in range(start, end+1):
        if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
            step = i
            return True, step
    return False, None

N, A, B, C, D = map(int, input().split())
S = "." + input() + "."

if D > C:   #   追い越しが不要な時
    judge1, S = available(A, C, S)
    judge2, S = available(B, D, S)
    if judge1 and judge2:
        print("Yes")
    else:
        print("No")
else:   #   追い越しが必要な時
    overtakable, step = overtake(B, D, S)
    if overtakable:   #   追い越しが可能な時
        judge1, S = available(B, D, S)
        judge2, S = available(A, C, S, step=step)
        if judge1 and judge2:
            print("Yes")
        else:
            print("No")
    else:   #   追い越しができない時
        print("No")
import sys
def input():
    return sys.stdin.readline()[:-1]

pass_list = list(map(lambda x: str(x).zfill(3), range(1000)))
res = 0

for p in pass_list:
    
    ptr = 0
    one = False
    two = False
    three = False
    
    for i in range(len(s)):
        if(s[i] == p[0]):
            ptr = i
            one = True
            break
    
    for i in range(ptr+1, len(s)):
        if(s[i] == p[1]):
            ptr = i
            two = True
            break
    
    for i in range(ptr+1, len(s)):
        if(s[i] == p[2]):
            ptr = i
            three = True
            break
    
    if(one and two and three): res += 1

print(res)

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]

n = int(input())
s = input()
pass_list = list(map(lambda x: str(x).zfill(3), range(1000)))
res = 0

for p in pass_list:
    
    ptr = 0
    one = False
    two = False
    three = False
    
    for i in range(len(s)):
        if(s[i] == p[0]):
            ptr = i
            one = True
            break
    
    for i in range(ptr+1, len(s)):
        if(s[i] == p[1]):
            ptr = i
            two = True
            break
    
    for i in range(ptr+1, len(s)):
        if(s[i] == p[2]):
            ptr = i
            three = True
            break
    
    if(one and two and three): res += 1

print(res)
s = input()
n = 0
ans = 0
mods = [0]*p
mods[0] = 1
for i, j in enumerate(reversed(s)):
  n += int(j)*pow(10, i, 2019)
  n %= 2019
  mods[n] += 1
for i in mods:
  ans += i*(i-1)//2
print(ans)

### FIXED CODE ###

s = input()
p = 2019
n = 0
ans = 0
mods = [0]*p
mods[0] = 1
for i, j in enumerate(reversed(s)):
  n += int(j)*pow(10, i, p)
  n %= p
  mods[n] += 1
for i in mods:
  ans += i*(i-1)//2
print(ans)
# -*- coding: utf-8 -*-
import collections

N = int(raw_input())
li = list(map(int, input().split()))

for i in range(N):
    sl.append("".join(sorted(li[i])))

sl.sort()

c = collections.Counter(sl)

print(N - (len(c)-1))

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(raw_input())
cnt = 0
dic = {}

for _ in xrange(N):
	rs = ''.join(sorted(raw_input()))
	
	if rs in dic:
		cnt += dic[rs]
		dic[rs] += 1
	else:
		dic[rs] = 1
print cnt
N, K = int(input().split())
H = []
H = int(input().split())
list.sort(H, reverse = True)
ANS = 0
for i in range(K, N):
    ANS += H[i]
print(ANS)

### FIXED CODE ###

N, K = map(int, input().split())
H =  list(map(int, input().split()))
list.sort(H, reverse = True)
ANS = 0
for i in range(K, N):
    ANS += H[i]
print(ANS)
import math
from itertools import combinations

def main():
    k = int(input())
    res = 0
    memo = [[0 for _ in range(k+1)] for _ in range(k+1)]
    for i ian range(1, k+1):
        for j in range(i, k+1):
            tmp = math.gcd(i,j)
            memo[i][j] = tmp
            memo[j][i] = tmp

    for i in range(1, k+1):
        res += i 

    for c in combinations(range(1,k+1),2):
        ab = memo[c[0], c[1]]
        res += ab * 6

    for c in combinations(range(1,k+1), 3):
        ab = memo[c[0], c[1]]
        abc = memo[ab, c[2]]
        res += abc * 6
    print(res)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import numpy as np
from itertools import combinations

def main():
    k = int(input())
    res = 0
    memo = np.zeros((k+1, k+1), int)
    for i in range(1, k+1):
        for j in range(i, k+1):
            tmp = np.gcd(i,j)
            memo[i][j] = tmp
            memo[j][i] = tmp

    for i in range(1, k+1):
        res += i 

    for c in combinations(range(1,k+1),2):
        ab = memo[c[0], c[1]]
        res += ab * 6

    for c in combinations(range(1,k+1), 3):
        ab = memo[c[0], c[1]]
        abc = memo[ab, c[2]]
        res += abc * 6
    print(res)


if __name__ == '__main__':
    main()
n = int(input())
t = list(map(int,input().split()))
m = int(input())
p = []

s = sum(t)

for i in range(m):
    p.append(input().split())

if n<=m:
    for i in range(m):
        print(s-t[i]+int(p[i][1]))
else:
    for i in range(n):
        print(s-t[i]+int(p[i][1]))
    for i in range(n-m):
        print(s)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
m=int(input())
s=sum(a)
for i in range(m):
    p,x=map(int,input().split())
    print(s+x-a[p-1])
N = []
L=[input() for i in range(N)]

print("AC" + " x "+ str(L.count("AC")))
print("WA" + " x "+ str(L.count("WA")))
print("TLE" + " x "+ str(L.count("TLE")))
print("RE" + " x "+ str(L.count("RE")))

### FIXED CODE ###

N = int(input())
L=[input() for i in range(N)]

print("AC" + " x "+ str(L.count("AC")))
print("WA" + " x "+ str(L.count("WA")))
print("TLE" + " x "+ str(L.count("TLE")))
print("RE" + " x "+ str(L.count("RE")))
import math

A, B, K = list(map(int, input().split(" ")))

d = math.gcd(A, B)

def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass

ass = list(set(divisor(d)))
#print(ass)
out = ass[-K]
print(out)

### FIXED CODE ###

from fractions import gcd

A, B, K = list(map(int, input().split(" ")))

d = gcd(A, B)

def divisor(n):
    #for i in range(1,int(n**0.5)+1):
    ass = [i for i in range(1, n+1) if n % i == 0]
    return ass

ass = divisor(d)
#print(ass)
out = ass[-K]
print(out)
K = int(input())
S = str(input()).lower()

if 0 < K < 101 and 0 < len(S) < 101:
    if len(S) =< K:
        print(S)
    else:
        print(S[:K] + "...") 
else:
    print("Try again with K and length of S between 1 and 100 ")

### FIXED CODE ###

K = int(input())
S = str(input()).lower()

if 0 < K < 101 and 0 < len(S) < 101:
    if len(S) <= K:
        print(S)
    else:
        print(S[:K] + "...") 
else:
    print("Try again with K and length of S between 1 and 100 ")
import math

s = input().split()
n = s[0]
k = s[1]

proba = 0

for i in range(1, k):
  n_coin = int(math.log(k/i,2)) + 1
  print(i, n_coin)
  proba += float(1)/n*((0.5)**n_coin)

if n >= k:
	proba += float(n-k+1)/n
print(proba)

### FIXED CODE ###

N, K = list(map(int, input().split()))
 
ans = 0
for i in range(1, N+1):
    p = 1
    x = i
    while x < K:
        p *= 0.5
        x *= 2
    
    ans += p/N
 
print(ans)
from itertools import combinations
N, M = map(int, input().split())
link = [[0 for i in range(N)] for j in range(N)]
for m in range(M):
    x, y = map(int, input().split())
    link[x-1][y-1] = 1
    link[y-1][x-1] = 1

for i in range(N,1,-1): # N, N-1, N-2, ... 2
    for comb in combinations(range(N),i):
        for c in combinations(comb, 2): # 議員の集合に対して考えられるペアを列挙
            if (link[c[0]][c[1]] == 0): # 一つでも知り合いでない組があればNG
                break
        else: # 派閥が作れた段階でプログラムを終了
            print (i)
            exit()
print (1)

### FIXED CODE ###

d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]

ans = 100*11
for i in range(2**d):
    sum = 0
    cnt = 0
    a = []
    for j in range(d):
        if (i >> j) & 1 == 1:
            sum += (j+1)*100*pc[j][0] + pc[j][1]
            cnt += pc[j][0]
            a.append(j)
    if sum < g:
        for j in range(d):
            if d-j-1 not in a:
                for k in range(pc[d-j-1][0]):
                    if sum >= g:
                        break
                    sum += (d-j)*100
                    cnt += 1
    ans = min(ans, cnt)
print(ans)
def makePath(x):
    for y in G[x]:
        if hist[y]==0:
            A.append(y)
            hist[y] = 1
            makePath(y)
            return
    return
N,M = map(int,input().split())
G = {i:[] for i in range(1,N+1)}
for _ in range(M):
    a,b = map(int,input().split())
    G[a].append(b)
    G[b].append(a)
A = [1]
hist = [0 for _ in range(N+1)]
hist[1] = 1
makePath(1)
B = A[:]
A = []
makePath(1)
A = A[::-1]
A += B
print(len(A))
print(*A)

### FIXED CODE ###

from collections import deque
def makePath():
    que = deque([1])
    while que:
        x = que.pop()
        for y in G[x]:
            if hist[y]==0:
                que.append(y)
                A.append(y)
                hist[y]=1
                break
N,M = map(int,input().split())
G = {i:[] for i in range(1,N+1)}
for _ in range(M):
    a,b = map(int,input().split())
    G[a].append(b)
    G[b].append(a)
A = [1]
hist = [0 for _ in range(N+1)]
hist[1] = 1
makePath()
B = A[:]
A = []
makePath()
A = A[::-1]
A += B
print(len(A))
print(*A)
A, B, K = input().split()

A = int(A)
B = int(B)
K = int(K)

while K >= 1 && A >= 1 && B >= 1:
	if A % 2 == 0:
		B += A / 2
		A = A / 2
	else:
		A -= 1
		B += A / 2
		A = A / 2
	if B % 2 == 0:
		A += B / 2
		B = B /2
	else:
		B -= 1
		A += B / 2
		B = B /2		
	K -= 1
print(A + " " + B)


### FIXED CODE ###

A, B, K = input().split()

A = int(A)
B = int(B)
K = int(K)

for i in range(K):
	if i % 2 == 0:
		A //= 2
		B += A 
	else:
		B //= 2
		A += B 
print(str(A) + " " + str(B))