Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03471 (python)

Fixed submission:
n,y=map(int,input().split())
a=0
for i in range(n+1):
    for j in range(n-i+1):
        k=n-(i+j)
        if 10000*i + 5000*j + 1000*k == y:
            a+=1
        else:
            pass
        if a == 1:
            print(i,j,k)
            break
        else:
            pass
    if a >= 1:
        break
if a ==0:
    print(-1, -1, -1)
else:
    pass

Buggy submission (verdict: Runtime Error):
n,y=map(int,input().split())
a=0
for i in range(n+1):
    for j in range(n-i+1):
        k=n-(i+j)
        if 10000*i + 5000*j + 1000*k == y:
            a+=1
        else:
            pass
        if a == 1:
            print(i,j,k)
            break
        else:
            pass
    if a >= 1:
        break
if a ==0:
    print(-1, -1, -1)
else:
    pass
n,y=map(int,input().split())
a=0
for i in range(n+1):
    for j in range(n-i+1):
        k=n-(i+j)
        if 10000*i + 5000*j + 1000*k == y:
            a+=1
        else:
            pass
        if a == 1:
            print(i,j,k)
            break
        else:
            pass
    if a >= 1:
        break
if a ==0:
    print(-1, -1, -1)
else:
    pass
Problem p03639 (python)

Fixed submission:
from math import ceil
n=int(input())
ans4=0
ans2=0
ans0=0
a=list(map(int,input().split()))
for i in range(n):
  if a[i]%4==0:
    ans4+=1
  elif a[i]%2==0:
    ans2+=1
  else:
    ans0+=1
if ans2>0:
  if ans0<=ans4:
    print('Yes')
  else:
    print('No')
else:
  if ceil((ans0+ans4)/2)>=ans0:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
from math import ceil
n=int(input())
ans4=0
ans2=0
ans0=0
a=list(map(int,input().split()))
for i in range(n):
  if a[i]%4==0:
    ans4+=1
  elif a[i]%2==0:
    ans2+=1
  else:
    ans0+=1
if ans2>0:
  if ans0<=ans4:
    print('Yes')
  else:
    print('No')
else:
  if ceil((ans0+ans4)/2)>=:ans0
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
ans4=0
ans2=0
a=input().split()
for i in range(n):
  if a[i]%4==0:
    ans4+=1
  elif a[i]%2==0:
    ans2+=1
  else:
    pass
if (n-ans2)//2+1<=ans4:
  print('Yes')
else:
  print('No')
Problem p03640 (python)

Fixed submission:
height, wide = map(int, input().split())
n = int(input())
anslist = []

a = list(map(int, input().split()))
for i, j in enumerate(a):
    for l in range(j):
        anslist.append(i+1)
for k in range(height):
    t = anslist[k*wide:(k+1)*wide]
    if k % 2 == 1:
        t.reverse()
    print(' '.join(map(str, t)))

Buggy submission (verdict: Runtime Error):
height, wide = map(int, input().split())
n = int(input())
anstr = ''
a = list(map(int, input().split()))
for i in range(n):
    for j in range(a[i]):
        anstr += str(i)
for k in range(n/wide):
    if k % 2 == 0:
        print(anstr[k:k+wide])
    else:
        print(anstr[k:k+wide:-1])
Problem p02756 (python)

Fixed submission:
from collections import deque

S = input()
Q = int(input())
S = deque(S)

cnt_reverse = 0

for q in range(Q):
  _ = input()
  if _[0] == '1':
    cnt_reverse += 1
  else:
    _T, _F, _C = _.split()
    ## リバース回数が奇数偶数のいずれかをチェック
    if _F == '1':
      if cnt_reverse % 2 == 0:
        S.appendleft(_C)
      else:
        S.append(_C)
    else:
      if cnt_reverse % 2 == 0:
        S.append(_C)
      else:
        S.appendleft(_C)

S = list(S)
# reverseの部分を対応
if cnt_reverse % 2 == 1:
  S.reverse()

print(''.join(S))

Buggy submission (verdict: Runtime Error):
from collections import deque
 
S = input()
Q = int(input())
S = deque(S)
 
flg_reverse = False
 
for q in range(Q):
  _ = input()
  if _[0] == '1':
    flg_reverse = flg_reverse ^ True
  else:
    _T, _F, _C = _.split()
    ## リバース回数が奇数偶数のいずれかをチェック
    if _F == '1':
      if cnt_reverse % 2 == 0:
        S.appendleft(_C)
      else:
        S.append(_C)
    else:
      if cnt_reverse % 2 == 0:
        S.append(_C)
      else:
        S.appendleft(_C)
 
S = list(S)
# reverseの部分を対応
if flg_reverse:
  S.reverse()
 
print(''.join(S))
Problem p02761 (python)

Fixed submission:
N,M = map(int, input().split())

_list = [-1]*(N+1)

for m in range(M):
  s,c = map(int, input().split())
  # 条件を満たさない
  if _list[s] != -1 and _list[s] != c:
    print(-1)
    exit()
  else:
    _list[s] = c
  
ans = ''
for idx, _ in enumerate(_list[1:]):
  if _ == -1:
    # 1桁目は1、そうでなかったら０にする
    if idx != 0:
      ans += '0'
    else:
      ans += '1'
  else:
    ans += str(_)

# 1桁目が0なのはNG
if N > 1 and ans[0] == '0':
  print(-1)
elif M == 0:
  if N == 1:
    print(0)
  elif N == 2:
    print(10)
  elif N == 3:
    print(100)
else:
  print(int(ans))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())

_list = [-1]*(N+1)

for m in range(M):
  s,c = map(int, input().split())
  
  # 条件を満たさない
  if _list[s] != -1 and _list[s] != c:
    print(-1)
    exit()
  
  else:
    _list[s] = c
  
ans = ''
for idx, _ in ennumerate(_list[1:]):
  if _ == -1:
    # 1桁目は1、そうでなかったら０にする
    if idx != 0:
      ans += '0'
    else:
      ans += '1'
  else:
    ans += str(_)

# 1桁目が0なのはNG
if N > 1 and ans[0] == '0':
  print(-1)
  exit()
else:
  print(int(ans))
Problem p02888 (python)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
L.sort()
from bisect import bisect_left
ans = 0

for a in range(0, N-2):
  for b in range(a+1, N-1):
    t = L[a] + L[b]
    idx = bisect_left(L,t)
    ans += max(0, idx-b-1)

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))

if len(set(L)) > 3:
  L = list(set(L))

ans = 0
for a in range(0, N-2):
  for b in range(a+1, N-1):
    for c in range(b+1, N):
      if L[a] < (L[b]+L[c]):
        if L[b] < (L[a]+L[c]):
          if L[c] < (L[a]+L[b]):
            ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(set(list(map(int, input().split()))))

ans = 0
for a in range(0, N-2):
  for b in range(a+1, N-1):
    for c in range(b+1, N):
      if L[a] < (L[b]+L[c]):
        if L[b] < (L[a]+L[c]):
          if L[c] < (L[a]+L[b]):
            ans += 1

print(ans)
Problem p03076 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

list_inp = [a,b,c,d,e]
min_last = 100
for index, inp in enumerate(list_inp):
  tmp = int(str(inp)[-1])
  if tmp == 0:
    continue
  
  if tmp <= min_last:
    min_last = tmp
    min_last_index = index

# 全部の料理がちょうど１０分単位だった場合
if min_last == 100:
  min_last_index = 0

# 切り上げ
def ceil(src,range):
  if str(src)[-1] == '0':
    return src
  else:
    return ((int)(src / range) + 1 ) * range

ans = 0
for index,value in enumerate(list_inp):
  if index == min_last_index:
    continue
  else:
    ans += ceil(value, 10)


print(ans + list_inp[min_last_index])

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

list_inp = [a,b,c,d,e]
min_last = 100
for index, inp in enumerate(list_inp):
  tmp = int(str(inp)[-1])
  if tmp == 0:
    continue
  
  if tmp <= min_last:
    min_last = tmp
    min_last_index = index

# 全部の料理がちょうど１０分単位だった場合
if min_last == 100:
  min_last = 0

# 切り上げ
def ceil(src,range):
  if str(src)[-1] == '0':
    return src
  else:
    return ((int)(src / range) + 1 ) * range

ans = 0
for index,value in enumerate(list_inp):
  if index == min_last_index:
    continue
  else:
    ans += ceil(value, 10)


print(ans + list_inp[min_last_index])

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

list_inp = [a,b,c,d,e]
min_last = 9
for index, inp in enumerate(list_inp):
  tmp = int(str(inp)[-1])
  if tmp == 0:
    continue
  
  if tmp <= min_last:
    min_last = index


    
# 切り上げ
def ceil(src, range):
    return ((int)(src / range) + 1 ) * range

ans = 0
for index,value in enumerate(list_inp):
  if index == min_last:
    continue
  else:
    ans += ceil(value, 10)


print(ans + list_inp[min_last])
Problem p03087 (python)

Fixed submission:
import sys
 
stdin = sys.stdin

N,Q = map(int,input().split())
S = input()
se = [list(map(int, stdin.readline().split())) for i in range(Q)]

list_out = [0] * N
cnt = 0
f = 0

# AC文字列のAの位置をリストに収めた
for i in range(len(S)):
  if S[i] == 'A':
    f = 1
    list_out[i] = list_out[i-1]    
  elif S[i] == 'C':
    if f == 1:
      cnt += 1
      f = 0
      list_out[i] = cnt
    else:
      list_out[i] = list_out[i-1]
  else:
    f = 0
    list_out[i] = list_out[i-1]    


# 指定した文字列範囲を含む要素数を表示
for i in se:
  print(list_out[i[1]-1] - list_out[i[0]-1])

Buggy submission (verdict: Runtime Error):
import sys
 
stdin = sys.stdin

N,Q = map(int,input().split())
S = input()
se = [list(map(int, stdin.readline().split())) for i in range(Q)]

list_out = [0]
cnt = 0
f = 0

# AC文字列のAの位置をリストに収めた
for i in S:
  if i == 'A':
    f = 1
    list_out.append(list_out[-1])    
  elif i == 'C':
    if f == 1:
      cnt += 1
      list_out.append(cnt)
  else:
    list_out.append(list_out[-1])


# 指定した文字列範囲を含む要素数を表示
for i in se:
  print(list_out[i[1]] - list_out[i[0]])
Problem p03103 (python)

Fixed submission:
N,M = map(int,input().split())

dct_a_tmp = {}
dct_b = {}
for n in range(N):
  a,b = map(int, input().split())
  dct_a_tmp[n] = a
  dct_b[n] = b

# 安い順にkeyをソート
list_a = sorted(dct_a_tmp.items(), key=lambda x: x[1])


# 安い順に買っていく
'''
1.不足本数を計算
2.不足本数と購入できる本数を比較する
a.全部購入していいようなら通常購入
b.ダメなら、購入していい本数だけ購入
'''
cnt_buied = 0
cost = 0
inf = 10 ** 18


for i in range(inf):
  want_buy = M - cnt_buied 
  
  if dct_b[list_a[i][0]] <= want_buy:
    cost += list_a[i][1] * dct_b[list_a[i][0]]
    cnt_buied += dct_b[list_a[i][0]] 
  else:
    cost += list_a[i][1] * want_buy
    cnt_buied += want_buy
    
  if cnt_buied >= M:
    break

print(cost)

Buggy submission (verdict: Runtime Error):
import sys
 
stdin = sys.stdin

N,Q = map(int,input().split())
S = input()

check_point = []
inf = 10 ** 18

# AC文字列のAの位置をリストに収めた
for i in range(inf):
  out = S.find('AC')
  if out < 0:
    break
  else:
    S = S[out+2:]
    check_point.extend([(out + len(check_point) * 2)])
  

# 指定した文字列範囲を含む要素数を表示
for i in range(Q):
  start, end  = map(int, stdin.readline().split())
  print(len([i for i in check_point if (start - 1 <= i) and (i + 1 < end)]))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())

dct_a_tmp = {}
dct_b = {}
for n in range(N):
  a,b = map(int, input().split())
  dct_a_tmp[n] = a
  dct_b[n] = b

# 安い順にkeyをソート
list_a = sorted(dct_a_tmp.items(), key=lambda x: x[1])


# 安い順に買っていく
'''
1.不足本数を計算
2.不足本数と購入できる本数を比較する
a.全部購入していいようなら通常購入
b.ダメなら、購入していい本数だけ購入
'''
cnt_buied = 0
cost = 0
inf = 10 ** 18


for i in range(inf):
  want_buy = M - cnt_buied 
  
  if dct_b[list_a[i][0]] <= want_buy:
    cost += list_a[i][1] * dct_b[list_a[i][0]]
    cnt_buied += dct_b[list_a[i][0]] 
  else:
    cost += list_a[i][1] * want_buy
    
  if cnt_buied >= M:
    break

print(cost)
Problem p03106 (python)

Fixed submission:
inp = list(map(int, input().split()))

A = inp[0]
B = inp[1]
K = inp[2]

# 約数を求める
yakusuu_a = []
yakusuu_b = []

for i in range(1,A+1):
    if A % i == 0:
        yakusuu_a.append(i)

for i in range(1,B+1):
    if B % i == 0:
        yakusuu_b.append(i)

c = []
for i in yakusuu_a:
  if i in yakusuu_b:
    c.append(i)

c.sort(reverse=True)
if len(c) == 0:
  print(1)
else:
  print(c[K-1])

Buggy submission (verdict: Runtime Error):
inp = list(map(int, input().split()))

A = inp[0]
B = inp[1]
K = inp[2]

# 約数を求める
yakusuu_a = []
yakusuu_b = []

for i in range(1,A):
    if A % i == 0:
        yakusuu_a.append(i)

for i in range(1,B):
    if B % i == 0:
        yakusuu_b.append(i)

c = []
for i in yakusuu_a:
  if i in yakusuu_b:
    c.append(i)

c.sort()
if len(c) == 0:
  print(1)
else:
  print(c[K-1])

Buggy submission (verdict: Runtime Error):
inp = list(map(int, input().split()))

A = inp[0]
B = inp[1]
K = inp[2]

# 約数を求める
yakusuu_a = []
yakusuu_b = []

for i in range(1,A):
    if A % i == 0:
        yakusuu_a.append(i)

for i in range(1,B):
    if B % i == 0:
        yakusuu_b.append(i)

c = []
for i in yakusuu_a:
  for j in yakusuu_b:
    if i == j:
      c.append(i)

c.sort()
print(c[K-1])
Problem p03163 (python)

Fixed submission:
N,W = map(int, input().split())

import numpy as np
dp = np.zeros(W+1, dtype=int)

for n in range(N):
  w,v = map(int, input().split())
  dp[w:] = np.maximum(dp[:-w]+v, dp[w:])

print(dp[-1])

Buggy submission (verdict: Runtime Error):
N,W = map(int, input().split())

import numpy as np
dp = np.zeros(W+1, dtype=int)

for n in range(N):
  w,v = map(int, input().split())
  dp[w:] = np.maximum(dp[:-w]+v, dp[w:])

print(dp[-1])
Problem p03240 (python)

Fixed submission:
N = int( input())
X = [ list( map( int, input().split())) for _ in range(N)]
for j in range(N):
    if X[j][2] != 0:
        k = j
        break
A = X[j]


for cx in range(101):
  for cy in range(101):
    H = A[2] + abs(A[0] - cx) + abs(A[1] - cy)
    flag = True
    for i in range(N):
      if max(H - abs(X[i][0]-cx) - abs(X[i][1] - cy), 0) != X[i][2]:
        flag = False
        break
    if flag:
      print(cx,cy,H)
      break
  if flag:
    break

Buggy submission (verdict: Runtime Error):
N = int(input())

list_inp = [list(map(int,input().split())) for _ in range(N)]
list_inp.sort(key=lambda x: x[2], reverse=True)
max_list_inp = list_inp[-1]


for x in range(101):
  for y in range(101):
    flg = True
    max_h = max_list_inp[2] + abs(max_list_inp[0] - x) + abs(max_list_inp[1] - y)
    
    # 全サンプルで、結果が一致することを確認する。
    for i in list_inp:
      h = max(max_h - abs(i[0] - x) - abs(i[1] - y), 0)
      if h != i[2]:
        flg = False
        break
    
    if flg:
      ans_x, ans_y,ans_h = x,y,max_h
      break
    
  if flg:
    break
    
    
print(ans_x, ans_y,ans_h)

Buggy submission (verdict: Runtime Error):
N = int(input())

list_inp = [list(map(int,input().split())) for _ in range(N)]
list_inp.sort(key=lambda x: x[2], reverse=True)
max_list_inp = list_inp[-1]


for x in range(101):
  for y in range(101):
    flg = True
    max_h = max_list_inp[2] + abs(max_list_inp[0] - x) + abs(max_list_inp[1] - y)
    
    # 全サンプルで、結果が一致することを確認する。
    for i in list_inp:
      h = max(max_h - abs(i[0] - x) - abs(i[1] - y), 0)
      if h != i[2]:
        flg = False
        break
    
    if flg:
      ans_x, ans_y,ans_h = x,y,max_h
    
    
print(ans_x, ans_y,ans_h)
Problem p03309 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = [A[i] - (i+1) for i in range(N)]

B.sort()

print(sum([abs(x - B[N//2]) for x in B]))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = [A[i] - (i+1) for i in range(N)]

B.sort()

print(sum(abs(x - B[2//N]) for x in B))
Problem p03545 (python)

Fixed submission:
ABCD = input()

A = int(ABCD[0])
B = int(ABCD[1])
C = int(ABCD[2])
D = int(ABCD[3])


def get_op(num):
  if num == -1:
    _ = '-'
  else:
    _ = '+'

  return _
  

for x in [-1,1]:
  for y in [-1,1]:
    for z in [-1,1]:
      _ = A+x*B+y*C+z*D
      if _ == 7:
        op1 = get_op(x)
        op2 = get_op(y)
        op3 = get_op(z)        
        ans = str(A)+op1+str(B)+op2+str(C)+op3+str(D)+'=7'

print(ans)

Buggy submission (verdict: Runtime Error):
ABCD = input()

A = int(ABCD[0])
B = int(ABCD[1])
C = int(ABCD[2])
D = int(ABCD[3])


for x in range(2):
  if x == 0:
    _ = A+B
    op1 = '+'
  else:
    _ = A-B
    op1 = '-'
  for y in range(2):
    if y == 0:
      _ += C
      op2 = '+'
    else:
      _ -= C
      op2 = '-'      
    for z in range(2):
      if z == 0:
        _ += D
        op3 = '+'
      else:
        _ -= D
        op3 = '-'      
      if _ == 7:
        ans = str(A)+op1+str(B)+op2+str(C)+op3+str(D)+'=7'

print(ans)
Problem p02886 (python)

Fixed submission:
import copy

def j(n):
    if n:print("yes")
    else:print("no")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)

n = ip()
a = iprow()
s = 0
for i in range(n-1):
    for k in range(i+1,n):
        s+=a[i]*a[k]
print(s)

Buggy submission (verdict: Runtime Error):
import copy

def j(n):
    if n:print("yes")
    else:print("no")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)

n = ip()
a = iprow()
s = 0
for i in range(n-1):
    for k in range(i+1,n):
        s+=a[i]*a[j]
print(s)
Problem p02936 (python)

Fixed submission:
import copy
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)

n ,m = ips()
tree = [[] for i in range(n+1)]
for i in range(n-1):
    x,y = ips()
    tree[x].append(y)
    tree[y].append(x)
total = [0 for i in range(n+1)]
for i in range(m):
    x,adder = ips()
    total[x]+=adder
base = copy.copy(total)
q = [1]
pos = 0
cs = set([1])
while len(q) > pos:
    #print("adding up",pos,q)
    i = q[pos]
    value = total[i]
    cs.add(i)
    if len(tree[i]):
        for k in tree[i]:
            if k not in cs:
                q.append(k)
                total[k]+=value
    pos+=1
for i in range(1,n):
    print(total[i],end=" ")
print(total[n])

Buggy submission (verdict: Runtime Error):
import math
import fractions
import copy
import numpy as np
import heapq
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
"""
#decomment when needed
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
"""

def addbottom(total,tree,k,value,base):
    #print("current layer",k)
    #print(k,value)
    total[k]+=value
    #print(total)
    if len(tree[k]):
        for i in tree[k]:
            #print(k,i)
            total = addbottom(total, tree, i, value,base)
    return total


n ,m = ips()
tree = [[] for i in range(n+1)]
for i in range(n-1):
    x,y = ips()
    tree[x].append(y)
total = [0 for i in range(n+1)]
for i in range(m):
    x,adder = ips()
    total[x]+=adder
base = copy.copy(total)
for i in range(1,n):
    #print("adding up",i,base[i])
    value = base[i]
    if len(tree[i]):
        for k in tree[i]:
            total = addbottom(total,tree,k,value,base)
for i in range(1,n):
    print(total[i],end=" ")
print(total[n])
Problem p02993 (python)

Fixed submission:
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("Bad")
    elif q == 0:print("Good")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

#n = ip()                                     #入力整数1つ
#n,x,b= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(m)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#a.pop(0)は10^5あるときTLEしやすい!注意!抜くなら逆ソート!
if a[0] == a[1] or a[1] == a[2] or a[2] == a[3]:
    j(1)
j(0)

Buggy submission (verdict: Runtime Error):
作成したプログラムには欠陥がある。今回の課題ではない1度ずつ探索を行いその中でも最もスコアが高かった時の角度を最後の出力しているが、自分が想定した角度とは違う角度が最大となっている例として画像2-2では自分は最適な角度が0度であると考えているのに対して、出力では最適な角度は----と自分が想定している角度ではなかった。このようになった理由として考えられるのはキティの特徴の考え方の一つであると思われる黄色の目と鼻の位置が元からある場所よりも近いのがあったからと考えられる。また画像2-2や2-3であった複数のキティを検出だが検出することはできたものの最終出力では複数の赤枠の出力ができなかった。2ー3のファイルでは画像を回転させるごとにキティを探索することができたが(60、180、300)このプログラムでは最もテンプレートに近い時のキティである
Problem p02996 (python)

Fixed submission:
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

#n,m = ips()
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(m)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#a.pop(0)は10^5あるときTLEしやすい!注意!抜くなら逆ソート!
a = []
for i in range(n):
    b = iprow()
    a.append([b[1],b[0]])
a.sort()
sumtime = 0
for i in range(n):
    sumtime += a[i][1]
    if sumtime > a[i][0]:
        j(0)
j(1)

Buggy submission (verdict: Runtime Error):
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

#n,m = ips()
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(m)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#a.pop(0)は10^5あるときTLEしやすい!注意!抜くなら逆ソート!
a = []
for i in range(n):
    b = iprow()
    a.append([b[1],b[0]])
a.sort()
sumtime = 0
for i in range(n):
    sumtime += a[i][1]
    if sumtime > a[i][0]:
        j(0)
j(1)