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

Fixed submission:
#D
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
nxt = 1
loop = []
tset = set()
final = -1
while 1:
    loop.append(nxt)
    tset.add(nxt)
    nxt = a[nxt-1]
    if nxt in tset:
        final = nxt #重複した町
        break
m = -1
for i in range(len(loop)):
    if loop[i]==final:
        m = i
        break
l = len(loop)
if k < m:
    print(loop[k])
else:
    print(loop[(k-m)%(l-m)+m])
# print(loop[(k+1)%l])

Buggy submission (verdict: Runtime Error):
#D
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
nxt = 1
loop = []
tset = set()
final = -1
while 1:
    loop.append(nxt)
    tset.add(nxt)
    nxt = a[nxt-1]
    if nxt in tset:
        final = nxt #重複した町
        break
m = -1
for i in range(len(loop)):
    if loop[i]==final:
        m = i
        break
l = len(a)
if k < m:
    print(loop[k])
else:
    print(loop[(k+1-m)%(l-m)])
# print(loop[(k+1)%l])

Buggy submission (verdict: Runtime Error):
#D
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
nxt = 1
loop = []
tset = set()
final = -1
while 1:
    loop.append(nxt)
    tset.add(nxt)
    nxt = a[nxt-1]
    if nxt in tset:
        final = nxt #重複した町
        break
m = -1
for i in range(n):
    if loop[i]==final:
        m = i
        break
l = len(a)
if k < m:
    print(loop[m])
else:
    print(loop[(k+1-m)%(l-m)])
# print(loop[(k+1)%l])
Problem p02814 (python)

Fixed submission:
import fractions #math.gcdは非対応なので解答にはfractions.gcdを使う
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
lcm = 1
for i in range(n):
    a[i]//=2
    lcm = lcm*a[i]//fractions.gcd(lcm,a[i])
flag = False
loopf = True
while loopf:
    tmp = a[0]%2
    for i in range(1,n):
        if a[i]%2!=tmp:
            flag = True
            loopf = False
            break
    if tmp==1 and loopf:
        loopf = False
    if tmp==0:
        for i in range(n):
            a[i]//=2
        
if flag:
    print(0)
else:
    tmp = m//lcm
    print((tmp+1)//2)

Buggy submission (verdict: Runtime Error):
import fractions
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
cnt = 0
lcm = 1
for i in range(n):
    a[i]//=2
    lcm = lcm*a[i]//fractions.gcd(lcm,a[i])
c = [0]*n
flag = False
for i in range(n):
    while a[i]%2==0:
        a[i]//=2
        c[i]+=1
    for j in range(i):
        if c[i]!=c[j]:
            flag = True
            break
	if flag:
      break
if flag:
    print(0)
else:
    tmp = m//lcm
    print((tmp+1)//2)

Buggy submission (verdict: Runtime Error):
import math
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
cnt = 0
lcm = 1
for i in range(n):
    a[i]//=2
    lcm = lcm*a[i]//math.gcd(lcm,a[i])
c = [0]*n
flag = False
for i in range(n):
    while a[i]%2==0:
        a[i]//=2
        c[i]+=1
    for j in range(i):
        if c[i]!=c[j]:
            flag = True
            break
if flag:
    print(0)
else:
    tmp = m//lcm
    print((tmp+1)//2)
Problem p02837 (python)

Fixed submission:
n = int(input())
a = [0]*n
x = [[] for i in range(n)]
y = [[] for i in range(n)]
for i in range(n):
    a[i] = int(input())
    for j in range(a[i]):
        tmp1,tmp2 = list(map(int,input().split()))
        x[i].append(tmp1-1)
        y[i].append(tmp2)

ans = 0
honest = [0]*n
for i in range(2**n): #bit全探索
    for j in range(n):
        if((i>>j)&1):
            honest[j] = 1
        else:
            honest[j] = 0
            
        f = True
        for k in range(n):
            for l in range(a[k]):
                if(honest[k]==1 and y[k][l]!=honest[x[k][l]]):
                    f = False
                    break
        if f:
            ans = max(ans,honest.count(1))

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [0]*n
x = [[] for i in range(n)]
y = [[] for i in range(n)]
for i in range(n):
    a[i] = int(input())
    for j in range(a[i]):
        tmp1,tmp2 = list(map(int,input().split()))
        x[i].append(tmp1-1)
        y[i].append(tmp2)

ans = 0
honest = [0]*n
cnt=0
for i in range(2**n): #bit全探索
    for j in range(n):
        if((i>>j)&1):
            honest[j] = 1
            cnt+=1
        else:
            honest[j] = 0
            
        f = True
        for k in range(n):
          	if honest[k]!=1:
                f = False
                break
            for l in range(a[k]):
                if( and y[k][l]!=honest[x[k][l]]):
                    f = False
                    break
        	if f:
            	ans = max(ans,cnt)
        cnt=0

print(ans)
Problem p02900 (python)

Fixed submission:
def gcd(a,b):
    if a<b:
        tmp = a
        a = b
        b = tmp
    while a!=b and b!= 0:
        c = a%b
        a = b
        b = c
    return a

a,b = list(map(int,input().split()))
g = gcd(a,b)
ans = 1
d = []
p = []
for i in range(1,int(g**0.5)+1): #因数リスト
    if g%i==0:
        if i!=1:
            d.append(i)
        if g//i!=1:
            d.append(g//i)
d = list(dict.fromkeys(d))
        
f = [True]*len(d)
for i in range(len(d)):
    for j in range(i):
        if d[i]>d[j] and d[i]%d[j]==0:
            f[i] = False
        if d[i]<d[j] and d[j]%d[i]==0:
            f[j] = False
print(f.count(True)+1)

Buggy submission (verdict: Runtime Error):
import math
a,b = list(map(int,input().split()))
g = math.gcd(a,b)
ans = 1
d = []
p = []
for i in range(1,int(g**0.5)+1): #因数リスト
    if g%i==0:
        if i!=1:
            d.append(i)
        if g//i!=1:
            d.append(g//i)
d = list(dict.fromkeys(d))
        
f = [True]*len(d)
for i in range(len(d)):
    for j in range(i):
        if d[i]>d[j] and d[i]%d[j]==0:
            f[i] = False
        if d[i]<d[j] and d[j]%d[i]==0:
            f[j] = False
print(f.count(True)+1)

Buggy submission (verdict: Runtime Error):
import math
a,b = list(map(int,input().split()))
g = math.gcd(a,b)
ans = 1
p = []
for i in range(2,g+1): #素数リスト
    k = True
    for j in p:
        if i%j==0:
            k = False
            break
    if k:
        p.append(i)
for i in p:
    if g%i == 0:
        ans += 1
print(ans)
Problem p03136 (python)

Fixed submission:
def judge(n,l):
    for i in range(n):
        s = 0
        for j in range(n):
            if(j!=i):
                s += l[j]
        if(s<=l[i]):
            print('No')
            return
    print('Yes')
    return

n = int(input())
l = list(map(int,input().split()))
judge(n,l)

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

def judge(n,l):
    for i in range(n):
        for j in range(j):
            s = 0
            if(j!=i):
                s += l[j]
            if(s>l[i]):
                print('No')
                return
    print('Yes')
    return
Problem p03160 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000) 

n = int(input())
h = list(map(int,input().split()))
dp_ = [-1]*n

def dp(i):
    if dp_[i]!=-1:
        return dp_[i]
    if i == 0:
        dp_[i] = 0
    elif i == 1:
        dp_[i] = abs(h[1]-h[0])
    else:
        dp_[i] = min(dp(i-2)+abs(h[i]-h[i-2]),dp(i-1)+abs(h[i]-h[i-1]))
    return dp_[i]

print(dp(n-1))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
dp_ = [-1]*n

def dp(i):
    if dp_[i]!=-1:
        return dp_[i]
    if i == 0:
        dp_[i] = 0
    elif i == 1:
        dp_[i] = abs(h[1]-h[0])
    else:
        dp_[i] = min(dp(i-2)+abs(h[i]-h[i-2]),dp(i-1)+abs(h[i]-h[i-1]))
    return dp_[i]

print(dp(n-1))
print(dp(n-1))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
dp_ = [-1]*n

def dp(i):
    if dp_[i]!=-1:
        return dp_[i]
    if i == 0:
        return 0
    elif i == 1:
        return abs(h[1]-h[0])
    else:
        return min(dp(i-2)+abs(h[i]-h[i-2]),dp(i-1)+abs(h[i]-h[i-1]))

print(dp(n-1))

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

def dp(i):
    if i == 0:
        return 0
    elif i == 1:
        return abs(h[1]-h[0])
    else:
        return min(dp(i-2)+abs(h[i]-h[i-2]),dp(i-1)+abs(h[i]-h[i-1]))

print(dp(n-1))
Problem p03161 (python)

Fixed submission:
#B
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))

dp = [float('inf')]*n
for i in range(n):
    if i == 0:
        dp[i] = 0
        continue    
    for j in range(1,k+1):
        if i-j>=0:
            dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
#B
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))

cost = [1000000]*n
for i in range(n):
    if i == 0:
        cost[i] = 0
        continue    
    for j in range(1:k+1):
        if i-j>=0:
            cost[i] = min(cost[i],cost[i-j]+abs(h[i]-h[i-j]))
print(cost[n-1])
Problem p03282 (python)

Fixed submission:
#ABC106C
s=input()
k=int(input())
cnt=0
while(s[cnt]=='1' and cnt!=len(s)-1):
    cnt+=1
if(k-1<cnt):
    print('1')
else:
    print(s[cnt])

Buggy submission (verdict: Runtime Error):
#ABC106C
s=input()
k=int(input())
cnt=0
while(s[cnt]=='1'):
    cnt+=1
if(k-1<=cnt):
    print('1')
else:
    print(s[cnt])
Problem p03288 (python)

Fixed submission:
r = int(input())
if r < 1200:
    print('ABC')
elif r < 2800:
    print('ARC')
else:
    print('AGC')

Buggy submission (verdict: Runtime Error):
if r < 1200:
    print('ABC')
elif r < 2800:
    print('ARC')
else:
    print('AGC')
Problem p03289 (python)

Fixed submission:
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1 and s[1:].replace('C','').islower():
    print('AC')
else:
    print('WA')

Buggy submission (verdict: Runtime Error):
s = input()
if s[0] == 'A' and s[2,-1].count('C') == 1 and s[1:].replace('C').islower():
    print('AC')
else:
    print('WA')
Problem p02681 (python)

Fixed submission:
s1=str(input())
s2=str(input())
if (len(s2)-len(s1)!=1):
  print('No')
Flag='Yes'
for val in range(len(s1)):
  if(s1[val]!=s2[val]):
    Flag='No'
print(Flag)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
k=k%n
al=list(map(int,input().split()))
pos=0
for val in range(len(al)):
   al[val]-=1
while(k!=0):
  i=pos
  pos=al[i]
  k-=1
print(pos+1)

Buggy submission (verdict: Runtime Error):
s1=str(input())
s2=str(input())
if (len(s2)-len(s1)!=1):
  print('No')
Flag='Yes'
for val in range(len(s1)):
  if(s1[val]=!s2[val]):
    Flag='No'
print(Flag)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()

if t[:-1]==s:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = [1,a[0]]
tp = a[0]-1
while True:  
  if a[tp] not in l: 
    l.append(a[tp])
    tp = a[tp] -1
  else:
    l.append(a[tp])
    break
    
last = l[-1]

loop = len(l[l.index(last):-1])
first = l.index(last)
if len(l)>k:
  print(l[k])
  exit()
k -=first
k %=loop
if k==0:
  k+=loop
print(l[k+first])
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
l = [1]

for i in range(n):
  l.append(a[l[i]-1])
p = l.index(l[n])
#print(p,l[n])
if k<=n:
  print(l[k])
else:
  x = (k-n+1)%(n-p)
  if x ==0:
    x += (n-p)
    print(l[x-1])
  else:
    print(l[x+p-1])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = [1]
for i in range(n):  
    l.append(a[l[i]])
    
p = l.index(l[-1])
if k<=n:
  print(l[k])
  exit()
  
x = (k-n+1)%(n-p)
if x==0:
  print(l[n-1])
else:
  print(l[x+p-1])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = [1]
for i in range(n):  
    l.append(a[l[i]])
    
p = l.index(l[-1])
if k<=n:
  print(l[k])
  exit()
  
x = (k-n+1)%(n-p)
if x==0:
  print(l[n-1])
else:
  print(l[x+p-1])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = [1]
for i in range(n):  
  l.append(a[l[i]-1])
loop = len(l[l[-1]:-1])
first = l.index(l[-1])
if len(l)>k:
  print(l[k])
  exit()
k -=first
k %=loop
if k==0:
  k+=loop
print(l[k+first])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = [1,a[0]]
tp = a[0]-1
while True:  
  if a[tp] not in l: 
    l.append(a[tp])
    tp = a[tp] -1
  else:
    l.append(a[tp])
    break
    
last = l[-1]
first = l.index(last)
loop = len(l)-first

if len(l)>k:
  print(l[k])
  exit()
k -=first
k %=loop
if k==0:
  k+=loop
print(l[k+first])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = [1,a[0]]
tp = a[0]-1
while True:  
  if a[tp] not in l: 
    l.append(a[tp])
    tp = a[tp] -1
  else:
    l.append(a[tp])
    break
    
last = l[-1]
first = l.index(last)
loop = len(l)-first

if len(l)>k:
  print(l[k])
  exit()
k -=first
k %=loop
if k==0:
  k+=loop
print(l[k+first])
print(l.index(last))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = [1,a[0]]
tp = a[0]-1
for i in range(10**18) 
  if a[tp] not in l: 
    l.append(a[tp])
    tp = a[tp] -1
  else:
    l.append(a[tp])
    break
    
last = l[-1]

loop = len(l[l.index(last):-1])
first = l.index(last)
if len(l)>k:
  print(l[k])
  exit()
k -=first
k %=loop
if k==0:
  k+=loop
print(l[k+first])
Problem p02718 (python)

Fixed submission:
n,m = map(int,input().split())
Ai = list(map(int,input().split()))

sum = 0

for i in Ai:
	sum += i

S = sorted(Ai,reverse=True)

if S[m-1] >= sum/(4*m):
  print("Yes")
else:
  print("No")

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

sum = 0
cnt = 0

for i in Ai:
	sum += i

sorted = Ai.sort(reverse=True)

if sorted[m-1] >= sum/(4*m):
  print("Yes")
else:
  print("No")

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

for i in numList:
	sum += i

for _ in numList:
  if _ > sum/(4*m):
    continue
  else:
    print("No")
    exit
    
print("Yes")

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

for i in numList:
	sum += i

if sum > 1/(4*m):
  print("Yes")
else:
  print("No")

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

y = 0
n = 0

for i in len(nunList):
  if  i > 1/(4*m):
    y +=1
  else:
    n +=1
    
if y > m:
  print("Yes")
else:
  print("No")

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

y = 0
n = 0

for i in len(nunList):
  if numList > 1/(4*m):
    y +=1
  else:
    n +=1
    
if y > m:
  print("Yes")
else:
  print("No")
Problem p02719 (python)

Fixed submission:
n,k = map(int,input().split())

d = n//k

n = n - d*k

if abs(n-k)>n:
  print(n)
else:
  print(abs(n-k))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
num = 0
while True:
	num = n-k
    if num < 0:
      print(abs(num))
Problem p02760 (python)

Fixed submission:
bingo = []
b = []

for i in range(3):
  tmp = list(map(int,input().split()))
  bingo.append(tmp)

n = int(input())

while True:
  try:
    b.append(int(input()))
  except EOFError:
    break

lis1 = [bingo[0][0],bingo[0][1],bingo[0][2]]
lis2 = [bingo[1][0],bingo[1][1],bingo[1][2]]
lis3 = [bingo[2][0],bingo[2][1],bingo[2][2]]

lis4 = [bingo[0][0],bingo[1][0],bingo[2][0]]
lis5 = [bingo[0][1],bingo[1][1],bingo[2][1]]
lis6 = [bingo[0][2],bingo[1][2],bingo[2][2]]

lis7 = [bingo[0][0],bingo[1][1],bingo[2][2]]
lis8 = [bingo[0][2],bingo[1][1],bingo[2][0]]

allList = [lis1,lis2,lis3,lis4,lis5,lis6,lis7,lis8]

for i in allList:
  cnt = 0
  for _ in range(3):
    if i[_] in b:
      cnt +=1
  if cnt ==3:
    print("Yes")
    exit()
print("No")

Buggy submission (verdict: Runtime Error):
bingo = []
b = []

for i in range(3):
  tmp = list(map(int,input().split()))
  bingo.append(tmp)

n = int(input())

while True:
  try:
    b.append(int(input()))
  except EOFError:
    break

lis1 = [bingo[0][0],bingo[0][1],bingo[0][2]]
lis2 = [bingo[1][0],bingo[1][1],bingo[1][2]]
lis3 = [bingo[2][0],bingo[2][1],bingo[2][2]]

lis4 = [bingo[0][0],bingo[1][0],bingo[2][0]]
lis5 = [bingo[0][1],bingo[1][1],bingo[2][1]]
lis6 = [bingo[0][2],bingo[1][2],bingo[2][2]]

lis7 = [bingo[0][0],bingo[1][1],bingo[2][2]]
lis8 = [bingo[0][2],bingo[1][1],bingo[2][0]]


print(allList)
for i in allList:
  cnt = 0
  for _ in range(3):
    if i[_] in b:
      cnt +=1
  if cnt ==3:
    print("Yes")
    exit()
print("No")
Problem p02761 (python)

Fixed submission:
n,m = map(int,input().split())
s = []
c = []
while True:
  try:
    tmp = list(map(int,input().split()))
    s.append(tmp[0])
    c.append(tmp[1])
  except EOFError:
    break
if n == 1 and all(i == 0 for i in c):
  print(0)
  exit()
for i in range(10**(n-1),10**n):
  cnt =0
  tmp = str(i)
  for _ in range(len(c)):
    if tmp[s[_]-1]==str(c[_]):
      cnt +=1
  if cnt == len(c):
    print(i)
    exit()
print("-1")

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
s = []
c = []
while True:
  try:
    tmp = list(map(int,input().split()))
    s.append(tmp[0])
    c.append(tmp[1])
  except EOFError:
    break
  
for i in range(10**(n-1)-1,10**n):
  cnt =0
  tmp = str(i)
  for _ in range(len(c)):
    if tmp[s[_]-1]==str(c[_]):
      cnt +=1
  if cnt == len(c):
    print(i)
    exit()
print("-1")
Problem p02911 (python)

Fixed submission:
n,k,q = map(int,input().split())
a = []
while True:
  try:
    a.append(int(input()))
  except:
    break

score = [k-q]*n

for i in range(q):
  score[a[i]-1] +=1

for i in score:
  if i>=1:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
import  numpy as np
n,k,q = map(int,input().split())
a = []
while True:
  try:
    a.append(int(input()))
  except:
    break

score = np.ones(n)*k

for i in range(q):
  score -=1
  score[a[i]-1] += 1

for i in score:
  if i>=1:
    print("Yes")
  else:
    print("No")
Problem p03386 (python)

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

if (b-a)<k*2:
  for i in range(a,b+1):
    print(i)
else:
  for i in range(a,a+k):
    print(i)
  for j in range(b-k+1,b+1):
    print(j)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
lis = [i for i in range(a,b+1)]
ans = []

for i in range(k):
  ans.append(lis[i])
  ans.append(lis[-i-1])


for i in sorted(set(ans)):
  print(i)
Problem p02681 (python)

Fixed submission:
S=input()

T=input()
if(S==T[:-1]):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def Teleport(i,P):
    if(i==K):
        return print(P)
    else:
        Teleport(i+1,T[P-1])



N,K=(int(x) for x in input().split())
T=list((int(x) for x in input().split()))

Teleport(1,T[0])
Problem p02687 (python)

Fixed submission:
S=str(input())
if S=="ABC":
  print("ARC")
elif S=="ARC":
  print("ABC")

Buggy submission (verdict: Runtime Error):
S=str(input())
if S=="ABC":
  print("ARC")
else if S=="ARC":
  print("ABC")
Problem p02681 (python)

Fixed submission:
s=input()
t=input()
f=1
if(len(s)==(len(t)-1)):
    for i in range(0,len(s)):
        if(s[i]!=t[i]):
            f=0
            break
    if(f==1):
        print("Yes")
        exit()
print("No")

Buggy submission (verdict: Runtime Error):
=input()
t=input()
for i in range(0,len(s)):
    if(s[i]!=t[i]):
        break
if(i==len(s)):
    if(len(s)==(len(t)-1)):
       print("Yes")
else:
    ("No")
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
 
if t[:len(t)-1] == s:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

if len(s) + 1 == len(t) and s in t:
    print("YES")
    else:
    print("NO")

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

if len(s) + 1 == len(t) and s in t:
    print("YES")
    else:
    print("NO")
Problem p02848 (python)

Fixed submission:
n=int(input())
s=input()
val=0
res=""
for i in range(len(s)):
  val=ord(s[i])
  val-=65
  val=(val+n)%26
  val+=65
  res+=chr(val)
print(res)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
for i in range(len(s)):
  val=ord(s[i])
  val-=65
  val=(val+n)%26
  val+=65
  s[i]=chr(val)
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
for i in range(len(s)):
  val=ord(s[i])
  val-=65
  val=(val+s[i])%26
  val+=65
  s[i]=chr(val)
print(s)
Problem p02681 (python)

Fixed submission:
# -*- coding: utf-8 -*-

list = []
for _ in range(2):
    list.append(input())

S = list[0]
T = list[1]

s = len(S)
t = len(T)


if t == s + 1 and S == T[: -1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

list = [input() for i in range(3)]

S = list[0]
T = list[1]

s = len(S)
t = len(T)


if t == s + 1 and S == T[: -1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

list = [input() for i in range(3)]

S = list[0]
T = list[1]

s = len(S)
t = len(T)


if t == s + 1 and S == T[: -1]:
    print('Yes')
else:
    print('No')
Problem p04043 (python)

Fixed submission:
syllables=[5,5,7]
check=list(map(int,input().split()))
check.sort()
syllables.sort()
if check==syllables:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
def Haiku(check,syllables):
    check.sort()
    syllables.sort()
    if check==syllables:
        return "YES"
    else:
        return "NO"
      
print(Haiku(check,syllables))
Problem p02700 (python)

Fixed submission:
ht, st, ha, sa = list(map(int, input().split(' ')))
bool_player = True  # Takashi
while (ht > 0 and ha > 0):
    if bool_player:
        ha -= st
        bool_player = False
    else:
        ht -= sa
        bool_player = True

if ht <= 0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
ht,st,ha,sa = list(map(int, input().split(' ')))
bool_player = True #Takashi
while (ht <= 0 || st <= 0):
  if bool_player:
    ha -= st
    bool_player = False
  else:
    ht -= sa
    bool_player = True

if ht <= 0:
  print('No')
else:
  print('Yes')
Problem p02681 (python)

Fixed submission:
S=input()
T=input()

a=1
if len(T)==len(S)+1:
    for i in range(len(S)):
        if S[i]==T[i]:
            a=1
            if a==0:
                break
        
        else:
            a=0
            print('No')
            break
else:
    print('No')
if a==1:
    print('Yes')

Buggy submission (verdict: Runtime Error):
import itertools
A, B, C, K = input().split()
import itertools

m=[1,0,-1]

c = list(itertools.combinations_with_replacement(m,int(K)));
sum=[]
for i in range(len(c)):
    if c[i].count(1)<=int(A) and c[i].count(0)<=int(B) and c[i].count(-1)<=int(C):
        sum.append(c[i].count(1)+c[i].count(-1))
print(max(sum))

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
 
a=1
if len(T)==len(S)+1:
    for i in range(len(S)):
        if S[i]==T[i]:
            a=1
            if a==0:
                break
        
        else:
            a=0
            print('No')
            break
else:
    print('No')
S=input()
T=input()

a=1
if len(T)==len(S)+1:
    for i in range(len(S)):
        if S[i]==T[i]:
            a=1
            if a==0:
                break
        
        else:
            a=0
            print('No')
            break
else:
    print('No')
if a==1:
  print('Yes')

Buggy submission (verdict: Runtime Error):
S=input()
T=input()

a=0
for i in range(len(S)):
    if len(T)==len(S)+1:
        if S[i]==T[i]:
            a=1
        else:
            print('No')
            sys.exit()
    else:
        print('No')
        sys.exit()
if a==1:
    print('Yes')
Problem p02694 (python)

Fixed submission:
x=int(input())

sum=0
y=100
for i in range(10000):
  y=int(y*1.01)
  if y<x:
    sum+=1
  else:
    sum=sum
print(sum+1)

Buggy submission (verdict: Runtime Error):
x=int(input())
import math

sum=0
y=100
for i in range(200000):
  y=math.floor(y*1.01)
  if y<=x:
    sum+=1
  else:
    sum=sum
print(sum+1)