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

Fixed submission:
a,b=map(str,input().split())
print(b+a)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(b+a)
Problem p02830 (python)

Fixed submission:
N=input()
S,T=input().split()
print(*[s+t for s,t in zip(S,T)],sep="")

Buggy submission (verdict: Runtime Error):
N=input()
S,T=input().split
print(*[s+t for s,t in zip(S,T)],sep="")
Problem p02909 (python)

Fixed submission:
weather=["Sunny","Cloudy","Rainy"]
S=input()
print(weather[weather.index(S)-2])

Buggy submission (verdict: Runtime Error):
weather=["Sunny","Cloudy","Rainy"]
s=input()
print(weather[weather.index[s]-2])

Buggy submission (verdict: Runtime Error):
weather=["Sunny","Cloudy","Rainy"]
s=input()
print(weather[weather.index[s]-2])

Buggy submission (verdict: Runtime Error):
weather=["Sunny","Cloudy","Rainy"]
s=input()
pritn(weather[weather.index[s]-2])
Problem p02999 (python)

Fixed submission:
x,a=map(int,input().split())
print("10" if a<=x  else "0")

Buggy submission (verdict: Runtime Error):
x,a=int(input().split())
print("10" if a<=x  else "0")
Problem p03109 (python)

Fixed submission:
s=input()
print("Heisei" if s<="2019/04/30" else "TBD")

Buggy submission (verdict: Runtime Error):
s=int(input())
print("Heisei" if s<="2019/04/30" else "TBD")

Buggy submission (verdict: Runtime Error):
s=int(input())
print("Heisei" if s<"2019/04/30" else "TBD")
Problem p03145 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(a*b//2)

Buggy submission (verdict: Runtime Error):
a,b,c=int(input().split())
print(a*b/2)

Buggy submission (verdict: Runtime Error):
a,b,c=int(input().split())
print(a*b//2)
Problem p03377 (python)

Fixed submission:
a,b,x=map(int,input().split())
print("YES" if a<=x and x<=a+b else "NO" )

Buggy submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
print("YES" a<=x and x<=a+b else "NO" )

Buggy submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
print("YES" a<=x or x<=a+b else "NO" )
Problem p03455 (python)

Fixed submission:
a,b=map(int, input().split())
print("Even" if a*b%2==0 else "Odd")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print("Even",if a*b%2=21 else "Odd" )
Problem p03543 (python)

Fixed submission:
a,b,c,d=input()
print("Yes" if a==b==c or b==c==d else "No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=input()
print("Yes" a==b==c or b==c==d else "No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=input()
print("Yes" a==b==c else b==c==d "No")
Problem p03609 (python)

Fixed submission:
a,b=map(int,input().split())
print("0" if a-b<0 else a-b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print("0" else a-b<0 else a-b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(a-b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(abt(a-b))
Problem p03643 (python)

Fixed submission:
print("ABC"+input())

Buggy submission (verdict: Runtime Error):
n=int(input())
print("ABC"+n)
Problem p03737 (python)

Fixed submission:
a,b,c=input().split()
print((a[0]+b[0]+c[0]).upper())

Buggy submission (verdict: Runtime Error):
;
Problem p03759 (python)

Fixed submission:
a,b,c=map(int,input().split())
print("YES" if b-a==c-b else "NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print("YES" b-a==c-a else "NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print("YES" b-a=c-a else "NO")
Problem p03860 (python)

Fixed submission:
print("A"+input()[8]+"C")

Buggy submission (verdict: Runtime Error):
orint("A"+input()[8]+"C")
Problem p04012 (python)

Fixed submission:
s=input()
print("Yes" if all([s.count(i)%2==0 for i in set(s)]) else "No")

Buggy submission (verdict: Runtime Error):
s=input()
print("Yes" if all([s.count(i)%2==0 for i in set(s)] else "No")

Buggy submission (verdict: Runtime Error):
s=input()
print("Yes" if all([s.count(i)%2==0] for i in set(s)] else "No")
Problem p03240 (python)

Fixed submission:
n=int(input())
xyh=[]

ansx,ansy,ansh = -1,-1,-1
nonzero=-1

for i in range(n):
    xyh.append(list(map(int,input().split())))
    if xyh[i][2] != 0:      
        nonzero=i

for px in range(101):
    for py in range(101):
        nh = xyh[nonzero][2] + abs(xyh[nonzero][0]-px) + abs(xyh[nonzero][1]-py)
        ok = True

        for nn in range(n):
            if (xyh[nn][2] > 0 and nh != xyh[nn][2] + abs(xyh[nn][0]-px) + abs(xyh[nn][1]-py)): 
                ok=False
            if (xyh[nn][2] == 0 and nh >  abs(xyh[nn][0]-px) + abs(xyh[nn][1]-py)):
                ok=False
        if ok:
            ansx,ansy,ansh = px,py,nh
        
    
print(ansx,ansy,ansh)

Buggy submission (verdict: Runtime Error):
n=int(input())
xyh=[]

ansx,ansy,ansh = -1,-1,-1
nonzero=-1

for i in range(n):
    l = list(map(int,input().split()))
    if l[2] != 0:
        xyh.append(l)
        nonzero=i

for px in range(101):
    for py in range(101):
        nh = xyh[nonzero][2] + abs(xyh[nonzero][0]-px) + abs(xyh[nonzero][1]-py)
        ok = True

        for nn in range(n):
            if (xyh[nn][2] > 0 and nh != xyh[nn][2] + abs(xyh[nn][0]-px) + abs(xyh[nn][1]-py)): 
                ok=False
            if (xyh[nn][2] == 0 and nh >  abs(xyh[nn][0]-px) + abs(xyh[nn][1]-py)):
                ok=False
        if ok:
            ansx,ansy,ansh = px,py,nh
        
       

print(ansx,ansy,ansh)
Problem p03309 (python)

Fixed submission:
import statistics
import math

n=int(input())
a=list(map(int,input().split()))
b=[a[i]-(i+1) for i in range(n)]
midb=statistics.median(sorted(b))
ans=0

for bb in b:
    ans+=math.fabs(bb-midb)
print(int(ans))

Buggy submission (verdict: Runtime Error):
import math

n=int(input())
a=list(map(int,input().split()))
b=[a[i]-(i+1) for i in range(n)]
sumb2=0
sum2=0
for bb in b:
    sumb2 += (bb**2)

for bb in b:
    sum2+=bb*2
bb=[math.ceil(sum2/(2*n)), math.floor(sum2/(2*n))]
ans=math.inf

for bbb in bb:
    sumans=0
    for aa in b:
        sumans+=(math.fabs(aa-bbb))
    ans=min(ans,sumans)

print(int(ans))
Problem p03324 (python)

Fixed submission:
d,n=map(int,input().split())
if n==100:
    n+=1
print(n*100**d)

Buggy submission (verdict: Runtime Error):
d,n=map(int,input().split)
print(100*d*n)
Problem p03353 (python)

Fixed submission:
import heapq

s=input()
k=int(input())
n=len(s)
ans=set()

for i in range(n+1):
    j=1
    while j<=k and i+j<=n:
        ans.add(s[i:i+j])
        j+=1


ansh=[]
for ss in ans:
    heapq.heappush(ansh,ss)
for _ in range(k-1):
    heapq.heappop(ansh)
print(ansh[0])

Buggy submission (verdict: Runtime Error):
import heapq

s=input()
k=int(input())
n=len(s)
ans=set()

for i in range(n):
    for j in range(1,n+1):
        ans.add(s[i:j])

ans.remove('')

ansh=[]
for ss in ans:
    heapq.heappush(ansh,ss)
    

for _ in range(k-1):
    heapq.heappop(ansh)
print(ansh[0])
Problem p03359 (python)

Fixed submission:
a,b=map(int,input().split())

ans=a
if b<a:
    ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1


primeN = [2]
for i in range(2,10000):
    for j in range(len(primeN)):
        if i % primeN[j] == 0:
            break
        else:
            if j == len(primeN) - 1:
                primeN.append(i)
n=int(input())
ans=[]

for i  in primeN:
    if i%5==1:
      ans.append(i)
    if len(ans)==n:
        for x in ans:
            print(x,end=" ")
        exit()
Problem p03362 (python)

Fixed submission:
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1


primeN = [2]
for i in range(2,10000):
    for j in range(len(primeN)):
        if i % primeN[j] == 0:
            break
        else:
            if j == len(primeN) - 1:
                primeN.append(i)
n=int(input())
ans=[]

for i  in primeN:
    if i%5==1:
      ans.append(i)
    if len(ans)==n:
        for x in ans:
            print(x,end=" ")
        exit()

Buggy submission (verdict: Runtime Error):
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1


primeN = [2]
for i in range(2,1000):
    for j in range(len(primeN)):
        if i % primeN[j] == 0:
            break
        else:
            if j == len(primeN) - 1:
                primeN.append(i)
n=int(input())


for i in range(len(primeN)):
    if is_prime(sum(primeN[i:i+n+1])):
        for x in range(n):
            print(primeN[i+x])
        exit()
Problem p03497 (python)

Fixed submission:
import heapq

n,k=map(int,raw_input().split())
a=map(int,raw_input().split())



d={}
for i in a:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
l=d.values()
div=max(0,len(l)-k)
if div==0:
    print 0
    exit()


heapq.heapify(l)

ans=0
while div>0:
    ans+=heapq.heappop(l)
    div-=1
print ans

Buggy submission (verdict: Runtime Error):
n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
aa=len(set(a))

div=max(0,int(aa)-k)
res = [(a.count(e),e) for e in aa if a.count(e) > 0]
resl=sorted(res,key=lambda x:x[0],reverse=True)
ans=0
while div>0:
    ans+=resl[-1][0]
    resl.pop()
    div=div-1

print ans
Problem p03501 (python)

Fixed submission:
N,A,B=map(int,input().split())
print(min(N*A,B))

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input())
print(min(N*A,B))

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input())
print(min(N*A,B))
Problem p03601 (python)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
A, B = 100 * A, 100 * B
W = set()
S = set()

for i in range(F // A+1):
    for j in range(F // B+1):
        w = A * i + B * j
        if w <= F:
            W.add(w)

for i in range(F // C+1):
    for j in range(F // D+1):
        s = C * i + D * j
        if s <= F:
            S.add(s)

max_rat = -24
for w in W:
    for s in S:
        if w + s <= F and s <= w / 100 * E and s+w!=0:
            rat = s / (s + w)
            if rat > max_rat:
                x, y, max_rat = w, s, rat

print(x + y, y)

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())
A, B = 100 * A, 100 * B
W = set()
S = set()

for i in range(F // A+1):
    for j in range(F // B+1):
        w = A * i + B * j
        if w <= F:
            W.add(w)

for i in range(F // C+1):
    for j in range(F // D+1):
        s = C * i + D * j
        if s <= F:
            S.add(s)

S.remove(0)
W.remove(0)
max_rat = -24
for w in W:
    for s in S:
        if w + s <= F and s <= w / 100 * E:
            rat = s / (s + w)
            if rat > max_rat:
                x, y, max_rat = w, s, rat

print(x + y, y)
Problem p03633 (python)

Fixed submission:
import functools

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return functools.reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)



n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
print(lcm_list(t))

Buggy submission (verdict: Runtime Error):
import math
import functools
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return functools.reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)



n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
print(lcm_list(t))
Problem p03665 (python)

Fixed submission:
n,p=map(int,input().split())
a=list(map(lambda x: x%2, map(int,input().split())))
e=a.count(0)

ans=2**(n-1)
if p==1 and e==n:
    ans=0
if p==0 and e==n:
    ans=2**n
print(ans)

Buggy submission (verdict: Runtime Error):
n,p=map(int,input().split())
a=list(map(int,input().split()))
print(2**(N-1))
Problem p04016 (python)

Fixed submission:
from math import floor
from math import sqrt

def f(bb,nn):
    if(nn<bb): return nn
    else: return f(bb,floor(nn/bb))+(nn%bb)
        

n=int(input())
s=int(input())

if n==s:
    print(n+1)
    exit()
elif n<s:
    print(-1)
    exit()

for i in range(2,int(sqrt(n))+2):
    if s==f(i,n):
        print(i)
        exit()

for i in reversed(range(1,int(sqrt(n))+2)):
    if (n-s)%i == 0:
        tmpb=(n-s)//i+1
        if tmpb >= sqrt(n) and f(tmpb,n)==s: 
            print(tmpb)
            exit()
print(-1)

Buggy submission (verdict: Runtime Error):
from math import floor
from math import sqrt

def f(bb,nn):
    if(nn<bb): return nn
    else: return f(bb,floor(nn/bb))+(nn%bb)
        

n=int(input())
s=int(input())

if n==s:
    print(n+1)
    exit()
elif n<s:
    print(-1)
    exit()

for i in range(2,int(sqrt(n))):
    if s==f(i,n):
        print(i)
        exit()

ans=10**12
for i in range(1,int(sqrt(n))):
    tmpb=(n-s)/i+1
    if f(tmpb,n)==s: 
        tmpb=min(ans,tmpb)

if ans>=10**12:
    print(-1)
else:
    print(ans)
Problem p03455 (python)

Fixed submission:
a,b = map(int,input().split())
a*=b
if a%2==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())
a*=b
if a%2:
  print("Even")
else:
  print("Odd")
Problem p03657 (python)

Fixed submission:
a,b=map(int,input().split())
if (a%3==0) or (b%3==0) or ((a+b)%3==0):
  print("Possible")
else:
  print("Impossible")

Buggy submission (verdict: Runtime Error):
a,b=int(input().split())
if (a%3==0) || (b%3==0) || ((a+b)%3==0):
  print("Possible")
else:
  print("Impossible")
Problem p02705 (python)

Fixed submission:
import math

r=float(input())
z=r*float(2)*math.pi

print(z)

Buggy submission (verdict: Runtime Error):
import math

R=input()
Z=R*2*math.pi
print(Z)

Buggy submission (verdict: Runtime Error):
import math
R=map(int,input())
Z=2*R*math.pi
print(Z)
Problem p02789 (python)

Fixed submission:
n = 0
m = 0
ac = input()
n = ac.split()[0]
m = ac.split()[1]

if n == m:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = input().split()
  2 b = a[0]
  3 c = a[1]
  4 if b == c:
  5     print("yes")
  6 else:
  7     print("no")

Buggy submission (verdict: Runtime Error):
if N = M
    print(yes)
else:
    print(no)
Problem p03795 (python)

Fixed submission:
i = int(input())
d = i * 800
b = i // 15

if 0 <= b:
    c = d - (200 * b)
    print(c)
else:
    print(c)

Buggy submission (verdict: Runtime Error):
i = int(input())
d = i * 800
b = i // 15

if 0 < b:
    c = d - (200 * b)
    print(c)
else:
    print(c)
Problem p03860 (python)

Fixed submission:
print('A' + input().split()[1][0] + 'C')

Buggy submission (verdict: Runtime Error):
print(f"A{input().split()[1][0]}C")
Problem p03943 (python)

Fixed submission:
i = [int(s) for s in input().split()]
m = max(i)
i.remove(m)
a = i[0] + i[1]

if a == m:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = input().split()
b = a
b = [int(x) for x in b]

a.remove(c)
if e == b:
    print("Yes")
else:
    print("No")
Problem p02694 (python)

Fixed submission:
#
#at coder beginner contest165 1%
#
import math

input1 = input()
Ns = int(input1)

wallet=100
i=0

while wallet < Ns:
    wallet=math.floor(wallet*1.01)
    i=i+1

print(i)

Buggy submission (verdict: Runtime Error):
input1 = input()
kbai= int(input1)
 
input2=input().split(" ")
maxs= int(input2[0])
mins= int(input2[1])
flg=0
ans=0
 
while ans < maxs:
  ans=ans+kbai
  if ans >= mins and ans <= maxs:
    flg=1
 
if flg ==1:
  print("OK")
else:
  print("NG")

Buggy submission (verdict: Runtime Error):
input1 = input()
Ns = int(input1)

wallet=100
i=0

while wallet < Ns:
	wallet=wallet*1.03
    i=i+1

print(i)
Problem p02921 (python)

Fixed submission:
s=input()
t=input()
count=0
for i in range(3):
    if s[i]==t[i]:
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
count=0
for i in range(3):
    if s(i)==t(i):
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
count=0
for i in range(3):
    if s(i)==t(i):
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
count=0
for i in range(3):
    if s(i)=t(i):
      count+=1
print(count)
Problem p02903 (python)

Fixed submission:
n,m,a,b=[int(i) for i in input().split()]
l=[[0 for i in range(m)] for j in range(n)]

for i in range(n):
    for j in range(m):
        if i<b:
            if j<a:
                l[i][j] = 0
            else:
                l[i][j] = 1
        else:
            if j<a:
                l[i][j] = 1
            else:
                l[i][j] = 0
for i in range(n):
    print("".join(str(e) for e in l[i]))

Buggy submission (verdict: Runtime Error):
n,m,a,b=[int(i) for i in input().split()]
l=[[0 for i in range(m)] for j in range(n)]
t1=[0 for i in range(n)]
t2=[0 for i in range(m)]

for i in range(n):
    for j in range(m):
        if t1[i]!=a and t2[j]!=b:
            t1[i]+=1
            t2[i]+=1
            l[i][j] = 0
        else:l[i][j]=1

countmin = 1000000000000
for i in range(n):
    countmin = min(countmin,l[i].count(0),l[i].count(1))
if countmin<a:
    print(-1)
    exit()
countmin = 1000000000000
for j in range(m):
    a1,a2=0,0
    for i in range(n):
        if l[i][j] == 0:a1+=1
        else:a2+=1
    countmin = min(countmin,a1,a2)
if countmin<b:
    print(-1)
    exit()
for i in range(n):
    for j in range(m):
        print(l[i][j],end="")
    print()
Problem p02921 (python)

Fixed submission:
s=input()
t=input()
print(sum(1 for i in range(len(s)) if s[i] == t[i]))

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
print(sum(1 for i in range(len(s)) if s[i] == t[i] else 0))

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
print(sum(1 for i in range(len(s)) if s[i] == l[i]))
Problem p02922 (python)

Fixed submission:
import math 
a,b=[int(i) for i in input().split()]
curr = 1
tot = 0
while curr<b:
  curr += (a-1)
  tot += 1
print(tot)

Buggy submission (verdict: Runtime Error):
import math
a,b=[int(i) for i in input().split()]
if a>=b:
	print(1)
else:
	b-=a
    print(1+math.ceil(b/(a-1)))
Problem p02923 (python)

Fixed submission:
def givel(): 
    n=int(input()) 
    l=[int(i) for i in input().split()] 
    curr = 0 
    i = 0 
    while i<len(l): 
        temp = i+1 
        ans = 0 
        while temp<len(l) and l[temp]<=l[temp-1]: 
            temp+=1 
            ans+=1 
        i=temp 
        curr = max(curr,ans) 
    return curr
print(givel())

Buggy submission (verdict: Runtime Error):
def givel(): 
    n=int(input()) 
    l=[int(i) for i in input().split()] 
    curr = 0 
    i = 0 
    while i<len(l): 
    	temp = i+1 
	    ans = 0 
		while temp<len(l) and l[temp]<=l[temp-1]: 
        	temp+=1 
	        ans+=1 
			i=temp 
		curr = max(curr,ans) 
    return curr
givel()

Buggy submission (verdict: Runtime Error):
def givel(): 
	n=int(input()) 
    l=[int(i) for i in input().split()] 
    curr = 0 
    i = 0 
    while i<len(l): 
    	temp = i+1 
	    ans = 0 
		while temp<len(l) and l[temp]<=l[temp-1]: 
        	temp+=1 
	        ans+=1 
			i=temp 
		curr = max(curr,ans) 
    return curr
givel()

Buggy submission (verdict: Runtime Error):
n=int(input()def givel(): 
     n=int(input()) 
     l=[int(i) for i in input().split()] 
     curr = 0 
     i = 0 
     while i<len(l): 
         temp = i+1 
         ans = 0 
         while temp<len(l) and l[temp]<=l[temp-1]: 
             temp+=1 
             ans+=1 
         i=temp 
         curr = max(curr,ans) 
     return curr
Problem p03160 (python)

Fixed submission:
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

M = mod = 10**9 +7
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]
def li4():return [float(i) for i in input().rstrip('\n').split(' ')]








n = val()
l = li() + [2,2]

if n == 1:
    print(0)
    exit()
elif n == 2:
    print(abs(l[0] - l[1]))
    exit()
ans = [float('inf')]*(n + 2)
ans[0] = 0
for i in range(n):
    ans[i + 1] = min(ans[i + 1],ans[i] + abs(l[i] - l[i+1]))
    ans[i + 2] = min(ans[i + 2],ans[i] + abs(l[i] - l[i+2]))
print(ans[n-1])

Buggy submission (verdict: Runtime Error):

from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
#from functools import reduce,cmp_to_key,lru_cache
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
import sys
# input = sys.stdin.readline



M = mod = 10**9 + 7 
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)
 
def li():return [int(i) for i in input().rstrip().split()]
def st():return str(input().rstrip())[2:-1]
def val():return int(input().rstrip())
def li2():return [str(i)[2:-1] for i in input().rstrip().split()]
def li3():return [int(i) for i in st()]
 



# sys.setrecursionlimit(10 ** 5 + 10)

g = 0
d = {}
def dp(i, par = -1, black = 0):
    global g
    ans = 1
    if (i, par, black) in d:return d[(i, par, black)]
    nokids = 1
    if black:
        for j in g[i]:
            if j != par:
                nokids = 0
                ans = ans * dp(j, i, 0) % mod
    else:
        for j in g[i]:
            if j != par:
                nokids = 0
                ans = ( ans * (dp(j, i, 0) + dp(j, i, 1)) ) % mod

    if nokids:ans = 1
    d[(i, par, black)] = ans
    return ans



n = val()
g = defaultdict(set)

l = []
for _ in range(n - 1):
    a, b = li()
    g[a].add(b)
    g[b].add(a)


root = 1    
ans = dp(root, -1, 0) + dp(root, -1, 1)

print(ans % mod)