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

Fixed submission:
s = str(input())
hon = [2,4,5,7,9]
pon = [0,1,6,8]


if int(s[-1]) in hon:
    print("hon")
elif int(s[-1]) in pon:
    print("pon")
else:
    print("bon")

Buggy submission (verdict: Runtime Error):

room,path = map(int,input().split())
dic = {}
ans_dic = {}
g = [1]
g_m = []

def re(li,i):
    if li[0] == i:
        return li[1]
    else:
        return li[0]

def pile_del(g):
    t = []
    for key,i in dic.items():
        if i[0] in g and  i[1] in g:
            t.append(key)
    for i in t:
        dic.pop(i)
    return 0

def main(ans_dic,dic,k):
    dele = []
    for key,j in dic.items():
        if k in j :
            ans_dic[re(j,k)] = j
            dele.append(key)
            g.append(re(j,k))
            g_m.append(re(j,k))
    for i in dele:
        dic.pop(i)
    pile_del(g_m)

for i in range(path):
    dic[i+1] = list(map(int,input().split()))

for key,i in dic.items():
    if 1 in i :
        if i[0] == 1:
            g.append(re(i,i[0]))
            # g_m.append(re(i,i[0]))
            ans_dic[i[1]] = i
        else:
            g.append(re(i,i[1]))
            # g_m.append(re(i,i[1]))
            ans_dic[i[0]] = i

pile_del(g)

li_c = len(dic)

if li_c != 0:
    for k in g:
        main(ans_dic,dic,k)

while li_c != len(dic) and li_c != 0:
    li_c = len(dic)
    for k in g:
        main(ans_dic,dic,k)



if len(ans_dic) == room-1:
    print("Yes")
    for i in range(room-1):
        print(re(ans_dic[i+2],i+2))
else:
    print("No")
# print(ans_dic)

Buggy submission (verdict: Runtime Error):



a = int(input())
b = int(input())
h = int(input())
m = int(input())
ans = 0

m_r = m/5

h_r = h + m/60

reg = (h_r - m_r)/12*360
ans = math.sqrt(a**2 + b**2 -2*a*b*math.cos(math.radians(reg)))

print(ans)
Problem p02677 (python)

Fixed submission:
import math
a,b,h,m = map(int,input().split())

ans = 0

m_r = m/5
# print(m_r)
h_r = h + m/60
# print(h_r)
# print((h_r - m_r)/12*360)
reg = (h_r - m_r)/12*360
ans = math.sqrt(a**2 + b**2 -2*a*b*math.cos(math.radians(reg)))

print(ans)

Buggy submission (verdict: Runtime Error):

import math

a = int(input())
b = int(input())
h = int(input())
m = int(input())
ans = 0

m_r = m/5
# print(m_r)
h_r = h + m/60
# print(h_r)
# print((h_r - m_r)/12*360)
reg = (h_r - m_r)/12*360
ans = math.sqrt(a**2 + b**2 -2*a*b*math.cos(math.radians(reg)))

print(ans)
Problem p02683 (python)

Fixed submission:
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = -1
for i in range(1 << N):
    total = [0]*(M+1)
    for j in range(N):  
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            total = [x + y for (x, y) in zip(total, items[j])]
    # print(total)
    if all( k >= X for k in total[1:]) == True:
        if ans == -1:
            ans = total[0]
        else:
            ans = min(ans,total[0]) 
print(ans)

Buggy submission (verdict: Runtime Error):
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = -1
for i in range(1 << N):
    total = [0]*(M+1)
    for j in range(N):  
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            h = [x + y for (x, y) in zip(total, items[j])]
    # print(total)
    if all( k >= X for k in h[1:]) == True:
        if ans == -1:
            ans = h[0]
        else:
            ans = min(ans,total[0]) 
print(ans)

Buggy submission (verdict: Runtime Error):
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = []
for i in range(2 ** N):
    total = [0 for _ in range(M)]
    for j in range(N):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            total = [x + y for (x, y) in zip(total, items[j])]
    if all( k >= X for k in total) == True:
       ans.append(total[0])
    # print(total)
if len(total) == 0:
    print(-1)
else:
    print(min(ans))
Problem p02696 (python)

Fixed submission:
from sys import stdin
input = stdin.readline
 
a,b,n = map(int,input().split())
maxpoint = 0
 
if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
else:
    k = int(n/b)*b -1
    maxpoint =  int((a * k) / b)  - a * int(k/b) 
    if b == 1:
        maxpoint = 0
 
print(maxpoint)

Buggy submission (verdict: Runtime Error):

from sys import stdin
input = stdin.readline

a,b,n = map(int,input().split())
maxpoint = 0

if b > n :
    for i in range(n+1):
        tmp = int((a * i) / b)  - a * int(i/b) 
        maxpoint = max(tmp,maxpoint)
       
        
else:
    for i in reversed(range(n+1)):
        c += 1
        tmp = int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i % (b-1) == 0 :
                maxpoint = max(tmp,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        maxpoint = max(tmp,maxpoint)

print(maxpoint)

Buggy submission (verdict: Runtime Error):

from sys import stdin
input = stdin.readline

a,b,n = map(int,input().split())
maxpoint = 0

if b > n :
    for i in range(n+1):
        tmp = int((a * i) / b)  - a * int(i/b) 
        maxpoint = max(tmp,maxpoint)
        print(0)
        
else:
    for i in reversed(range(n+1)):
        c += 1
        tmp = int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i % (b-1) == 0 :
                maxpoint = max(tmp,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        maxpoint = max(tmp,maxpoint)

print(maxpoint)

Buggy submission (verdict: Runtime Error):

from sys import stdin
input = stdin.readline

a,b,n = map(int,input().split())

maxpoint = 0

for i in reversed(range(n+1)):
    tmp = int((a * i) / b)  - a * int(i/b) 
    if i % (b-1) == 0 and b > 1:
        print(tmp) 
        exit()
    maxpoint = max(tmp,maxpoint)

print(maxpoint)

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

a,b,n = map(int,input().split())

maxpoint = 0

for i in reversed(range(n+1)):
    if i % (b-1) == 0:
        tmp = int((a * i) / b)  - a * int(i/b) 
        maxpoint = max(tmp,maxpoint)
        print(maxpoint)
        exit()
    tmp = int((a * i) / b)  - a * int(i/b) 
    maxpoint = max(tmp,maxpoint)

print(maxpoint)
Problem p03160 (python)

Fixed submission:

n = int(input())
li = list(map(int,input().split()))

# dp = [[-1 for i in range(1100)] for j in range(1100)]
ans = [0]*n
ans[0] = 0
# def solve(a,b,dp,li):
#     if dp[a][b] !=-1 :
#         return dp[a][b]
#     else:
#         dp[a][b] = abs(li[a]-li[b])
#         return dp[a][b]

for i in range(2,n+1):
    if i == 2:
        ans[i-1]= abs(li[1]-li[0])
    else:
        ans[i-1] = min(abs(li[i-1]-li[i-2])+ans[i-2],abs(li[i-1]-li[i-3])+ans[i-3])

print(ans[-1])

Buggy submission (verdict: Runtime Error):

n = int(input())
li = list(map(int,input().split()))

dp = [[-1 for i in range(1100)] for j in range(1100)]
ans = [100000]*n
ans[0] = 0
def solve(a,b,dp,li):
    # print(f"{a,b}")
    if dp[a][b] !=-1 :
        # print(f"結果{dp[a][b]}")
        return dp[a][b]
    else:
        dp[a][b] = abs(li[a]-li[b])
        # print(f"結果{a,b,dp[a][b]}")
        return dp[a][b]

for i in range(2,n+1):
    # print(i)
    if i == 2:
        dp[1][0] = abs(li[1]-li[0])
        ans[i-1] = dp[1][0]
    else:
        # print(solve(i-1,i-2,dp,li)+ans[i-2],solve(i-1,i-3,dp,li)+ans[i-3])
        # print(solve(i-1,i-2,dp,li),solve(i-1,i-3,dp,li))
        # print(ans[i-2],ans[i-3])
        # print(li[i-1],li[i-3])
        ans[i-1] = min(solve(i-1,i-2,dp,li)+ans[i-2],solve(i-1,i-3,dp,li)+ans[i-3])

print(ans[-1])
# print(dp)

Buggy submission (verdict: Runtime Error):

n = int(input())
li = list(map(int,input().split()))

dp = [[-1 for i in range(1000)] for j in range(1000)]
ans = [100000]*n
ans[0] = 0
def solve(a,b,dp,li):
    # print(f"{a,b}")
    if dp[a][b] !=-1 :
        # print(f"結果{dp[a][b]}")
        return dp[a][b]
    else:
        dp[a][b] = abs(li[a]-li[b])
        # print(f"結果{a,b,dp[a][b]}")
        return dp[a][b]

for i in range(2,n+1):
    # print(i)
    if i == 2:
        dp[1][0] = abs(li[1]-li[0])
        ans[i-1] = dp[1][0]
    else:
        # print(solve(i-1,i-2,dp,li)+ans[i-2],solve(i-1,i-3,dp,li)+ans[i-3])
        # print(solve(i-1,i-2,dp,li),solve(i-1,i-3,dp,li))
        # print(ans[i-2],ans[i-3])
        # print(li[i-1],li[i-3])
        ans[i-1] = min(solve(i-1,i-2,dp,li)+ans[i-2],solve(i-1,i-3,dp,li)+ans[i-3])

print(ans[-1])
# print(dp)
Problem p02548 (python)

Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())

count = 0
for i in range(1, N+1):
    count += (N - 1) // i
print(count)

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

N, K = map(int, input().split())

L = [list(map(int, input().split())) for _ in range(K)]

S = []

for left, right in L:
    S.extend(range(left, right+1))

S = sorted(list(set(S)))

n_list = [0] * N
n_list[0] = 1

for idx, value in enumerate(n_list):
    if value == 0:
        continue
    if S[0] + idx >= N:
        break
    for s in S:
        next_idx = s + idx
        if next_idx >= N:
            break
        n_list[next_idx] += value

print(n_list[-1] % 998244353)
Problem p02628 (python)

Fixed submission:
import sys
input = sys.stdin.readline

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

p = sorted(p)
print(sum(p[:K]))

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

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

p = sorted(p)
print(sum(p:[K]))
Problem p03448 (python)

Fixed submission:
A, B, C, X = [int(input()) for i in range(4)]
print(sum(500 * a + 100 * b + 50 * c == X for a in range(A+1) for b in range(B + 1) for c in range(C + 1)))

Buggy submission (verdict: Runtime Error):
A, B, C, X [int(inpit()) for i in range(4)]
print(sum(500 * a + 100 *b + 50 *c == X) for a in range(A+1) for b in range(B + 1) for c in range(C + 1)))
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 = input().split(' ')

if a * b % 2 = 0:
    print('Even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = input.split(' ')

if a * b % 0:
    print('Even')
else:
    print('Odd')
Problem p03612 (python)

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

i = 0
count = 0

if p_list[-1] == N:
    temp = p_list[-1]
    p_list[-1] = p_list[-2]
    p_list[-2] = temp
    count = count + 1

while i < N:
    if p_list[i] == i + 1:
        temp = p_list[i+1]
        p_list[i+1] = p_list[i]
        p_list[i] = temp
        count = count + 1
        i = i + 1
    i = i + 1

print(count)

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

i = 0
count = 0
while i < N:
    if p_list[i] == i + 1:
        temp = p_list[i+1]
        p_list[i+1] = p_list[i]
        p_list[i] = temp
        count = count + 1
        i = i + 1
    i = i + 1

print(count)
Problem p03635 (python)

Fixed submission:
n ,m = [int(i) for i in input().split()]
print((n - 1) * (m - 1))

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

two_count = 0
two_sum = 0
four_count = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        two_count += 1
        if i % 4 == 0:
            four_count += 1

if two_count == N:
    result = 'Yes'
elif two_count * 2 + 1 >= N:
    if (N - two_count) == 1:
        if four_count >= 1:
            result = 'Yes'
    else:
        if (N - two_count) - 1<= four_count:
            result = 'Yes'


print(result)

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

two_count = 0
two_sum = 0
four_count = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        two_count += 1
        if i % 4 == 0:
            four_count += 1

if two_count * 2 + 1 >= N:
    if (N - two_count) == 1:
        if four_count == 1:
            result = 'Yes'
    else:
        if (N - two_count) - 1<= four_count:
            result = 'Yes'

print(result)

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

two_count = 0
two_sum = 0
four_count = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        two_count += 1
        if i % 4 == 0:
            four_count += 1

if two_count * 2 + 1 >= N:
    if (N - two_count) - 1<= four_count:
        result = 'Yes'

print(result)
Problem p03730 (python)

Fixed submission:
A, B, C = map(int, input().split())

flag = False

for i in range(B + 1):
    if A * i % B == C:
        flag = True
        break

print('YES' if flag else 'NO')

Buggy submission (verdict: Runtime Error):
import os
input = os.stdin.readline
A, B, C = map(int, input().split())

flag = False

for i in range(B + 1):
    if A * i %B == c:
        flag = True
        break

print('YES' if flag else 'NO')
Problem p02582 (python)

Fixed submission:
def solve():
    s = input()
    ans = 0
    hoge = [0]
    for i in s:
        if i == "R":
            ans += 1
            hoge.append(ans)
        else:
            ans = 0
    print(max(hoge))
    return 0

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    s = input()
    ans = 0
    hoge = []
    for i in s:
        if i == "R":
            ans += 1
            hoge.append(ans)
    print(min(hoge))
    return 0

if __name__ == "__main__":
    solve()
Problem p02606 (python)

Fixed submission:
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    l, r, d = map(int, input().split())
    ans = 0
    for i in range(l, r+1):
        if i % d == 0:
            ans += 1
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <cmath>
using namespace std;
 
int main() {
	int n;
	cin >> n;
	for (int i = 1; i < n + 1; i++) {
		int cnt = 0;
		for (int x = 1; x < 100; x++) {
			for (int y = 1; y < sqrt(i - x); y++) {
				int rema = i - pow(x, 2) - pow(y, 2) - x * y;
				if (rema > 3) {
					for (int z = 1; z < rema; z++) {
						if (pow(z, 2) + (x + y) * z == rema) {
							cnt++;
							break;
						}
					}
				}
				else {
					break;
				}
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

Buggy submission (verdict: Runtime Error):
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    l, r, d = map(int, input().split())
    ans = 0
    for i in range(l, r+1):
        if i % d == 0:
            ans += 1
    priht(ans)
    return 0

if __name__ == "__main__":
    solve()
Problem p03200 (python)

Fixed submission:
# -*- coding:utf-8 -*-
S = list(input())

cnt_b = 0 
ans = 0

for i in range(len(S)):
    if S[i] == "B":
        cnt_b += 1
    if S[i] == "W":
        ans += cnt_b
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
S = list(input())

loop_idx = 0
loop_len = -(-len(S)//2)
cnt = 0

if len(S) == 1:
    pass
else:
    while loop_idx < loop_len:
        while True:
            if S[0] == "W":
                S.pop(0)
            else:
                break
        while True:
            if S[-1] == "B":
                S.pop(-1)
            else:
                break
        for i in range(len(S)-1,0,-1):
            if S[i]=="W" and S[i-1] == "B":
                cnt += 1
                S[i],S[i-1] = "B","W"
        loop_idx += 1
        #print(S)
print(cnt)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
print(A*B)
Problem p02621 (python)

Fixed submission:
nb = int(input())
print(str(nb + nb**2 + nb**3))

Buggy submission (verdict: Runtime Error):
data = [int(k) for k in input().split()]

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

Abooks = [int(k) for k in input().split()]
Bbooks = [int(k) for k in input().split()]


time = 0
nbOfBooks = 0

while (time + Bbooks[0]) <= K or (time + Abooks[0])  <= K:
	
		
	if Abooks[0] >= Bbooks[0]:
		
		time += Bbooks[0]
		
		if len(Bbooks) == 1:
			Bbooks[0] = 10**9+1
		else:

			Bbooks.pop()
		
		nbOfBooks += 1

	else:
		
		time += Abooks[0]
		
		if len(Abooks) == 1:
			Abooks[0] = 10**9+1
		
		else:

			Abooks.pop()
		nbOfBooks += 1 


print(nbOfBooks)
Problem p02675 (python)

Fixed submission:
nb = input()
number = len(nb)-1

if int(nb[number]) in [2, 4, 5, 7, 9]:
  print("hon")
elif int(nb[number]) in [0, 1, 6, 8]:
  print('pon')
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
nb = int(input())
number = len(nb)-1

if nb[number] in [2, 4, 5, 7, 9]:
  print("hon")
elif nb[number] in [0, 1, 6, 8]:
  print('pon')
else:
  print('bon')
Problem p04043 (python)

Fixed submission:
data = input().split()

seven = 0
five = 0

for i in range(len(data)):
	if int(data[i]) == 7:
		seven += 1
	elif int(data[i]) == 5:
		five +=1

if seven == 1 and five == 2:
	print('YES')
else:
	print('NO')

Buggy submission (verdict: Runtime Error):
data = input().split()

seven = 0
five = 0

for i in range(data):
	if int(i) == 7:
		seven += 1
	elif int(i) == 5:
		five +=1

if seven == 1 and five == 2:
	print('YES')
else:
	print('NO')
Problem p03377 (python)

Fixed submission:
A, B, X = map(int, input().split())
if A<=X and X<=A+B:
	print("YES")
else :
	print("NO")

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
X=int(input())
if A<=X and X<=A+B:
	print("YES")
else :
	print("NO")
Problem p02684 (python)

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

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

visitset = set()
visitcount = dict()
n_point = dict()

x = 1
count = 0
while(x not in visitset):
  visitset.add(x)
  visitcount[x] = count
  n_point[count] = x
  x = A[x-1]
  count += 1


period = count - visitcount[x]

if (K < visitcount[x]):
  print(n_point[K])
else:
  y = (K-visitcount[x]) % period
  print(n_point[visitcount[x] + y])

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

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

visitcount = dict()
n_point = list()

x = 1
count = 0
while(x not in set(visitcount)):
  visitcount[x] = count
  n_point.append(x)
  x = A[x-1]
  count += 1
  
period = count - visitcount[x]

if (K < visitcount[x]):
  print(n_point[K])
else:
  y = (K-visitcount[x]) % period
  print(n_point[visitcount[x] + y])
Problem p02755 (python)

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

x = -1
for i in range(10100):
  if (int(i*0.08) == A) and (int(i*0.1) == B):
    x = i
    break
  
print(x)

Buggy submission (verdict: Runtime Error):
A, B = list(map(int, input()))

x = -1
for i in range(10100):
  if (int(i*0.08) == A) and (int(i*0.1) == B):
    x = i
    break
  
print(x)

Buggy submission (verdict: Runtime Error):
A, B = list(map(int, input()))

x = -1
for i in range(10100)
  if (int(i*0.08) == A) and (int(i*0.1) == B):
    x = i
    break
  
print(x)

Buggy submission (verdict: Runtime Error):
A, B = list(map(int, input()))

x = -1
for i in range(100):
  if (int(i*1.08) == A) and (int(i*1.1) == B):
    x = i
    break
  
print(x)
Problem p02903 (python)

Fixed submission:
H, W, A, B = map(int, input().split())
x = '1' * (W-A)
y = '0' * (W-A)
x = x.rjust(W, "0")
y = y.rjust(W, "1")

for i in range(B):
  print(x)
for i in range(H-B):
  print(y)

Buggy submission (verdict: Runtime Error):
H, W, a, b = map(int, input().split())
x = '1' * (W-A)
y = '0' * (W-A)
x.rjust(W, "0")
y.rjust(W, "1")

for i in range(B):
  print(x)
for i in range(H-B):
  print(y)
Problem p02909 (python)

Fixed submission:
weatherlist = ["Sunny", "Cloudy", "Rainy"]
 
weather = input().rstrip()
weathernum = weatherlist.index(weather)
 
tomorrownum = (weathernum +1) % 3

print(weatherlist[tomorrownum])

Buggy submission (verdict: Runtime Error):
N , M = map(int, input().rstrip().split())
 
pricelist = list(map(int, input().split()))
#moneylist = input().rstrip().split()
#pricelist.append(price)
 
for i in range(M):
  pricelist.sort()
  pricelist[N-1] = pricelist[N-1] // 2

print(sum(pricelist))

Buggy submission (verdict: Runtime Error):
weatherlist = ["Sunny", "Cloudy", "Rainy"]
 
weather = input().rstrip()
weathernum = weatherlist.index(weather)
 
tomorrownum = weathernum % 3
 
print(weatherlist[tomorrownum + 1])
Problem p02910 (python)

Fixed submission:
moji = input().rstrip()
mojilist = list(moji)
evenset = set()
oddset = set()

for i in range(len(mojilist)):
  if i % 2 == 0:
    oddset.add(mojilist[i])
  else:
    evenset.add(mojilist[i])

if ((oddset <= {"R","U","D"}) and (evenset <= {"L","U","D"})):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
strlist = input().rstrip().split("")
evenset = set()
oddset = set()
 
for i in range(len(strlist)):
  if i % 2 == 0:
    oddset.add(strlist[i])
  else:
    evenset.add(strlist[i])
 
if (oddset <= {"R", "U", "D"} and evenset <= {"L", "U", "D"}):
  print("Yes")
 
else:
  print("No")

Buggy submission (verdict: Runtime Error):
strlist = input().rstrip().split("")
evenset = set()
oddset = set()
 
for i in range(len(strlist)):
  if i % 2 == 0:
    evenset.add(strlist[i])
  else:
    oddset.add(strlist[i])
 
if (oddset <= {"R", "U", "D"} and evenset <= {"L", "U", "D"}):
  print("Yes")
 
else:
  print("No")

Buggy submission (verdict: Runtime Error):
strlist = input().rstrip().split("")
evenset = set()
oddset = set()

for i in range(len(strlist)):
  if i % 2 == 0:
    evenset.add(setlist[i])
  else:
    oddset.add(setlist[i])

if (oddset <= {"R", "U", "D"} and evenset <= {"L", "U", "D"}):
  print("Yes")

else:
  print("No")
Problem p02911 (python)

Fixed submission:
N,K,Q = map(int,input().split())
judgepoint = Q - K

anslist = [0 for i in range(N)]
 
for i in range(Q):
  Aperson = int(input())
  anslist[Aperson -1] += 1

for i in range(N):
  if anslist[i] <= judgepoint:
    print("No")
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N, K, Q =　map(int, input().split(" "))
 
pointlist = [K for i in range(N)]
 
for i in range(Q):
  Aperson = int(input())
  for j in range(N):
    if j+1 != Aperson:
      pointlist[j] -= 1

for i in range(N):
  if pointlist[i] <= 0:
    print("No")
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N, K, Q =　map(int, input().rstrip().split(" "))

pointlist = [K for i in range(N)]

for i in range(Q):
  Aperson = int(input())
  for j in range(N):
    if j+1 != Aperson:
      pointlist[j] -= 1

for i in range(N):
  if pointlist[i] <= 0:
    print("No")
  else:
    print("Yes")
Problem p03261 (python)

Fixed submission:
N = int(input())

shiritori_set = set()

shiritori = input()
head = shiritori[len(shiritori) -1]

ans = "Yes"
shiritori_set.add(shiritori)
for i in range(N-1):
  shiritori = input()
  if shiritori[0] == head and shiritori not in shiritori_set:
    head = shiritori[len(shiritori)-1]
    shiritori_set.add(shiritori)
  else:
    ans = "No"
    break

print(ans)

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

shiritori_set = set()

shiritori = input()
head = shiritori[len(shiritori) -1]

ans = "Yes"

for i in range(N-1):
  shiritori = input()
  if (shirotori[0] == head and shiritori in shiritori_set):
    head = shiritori[len(shiritori)-1]
    shiritori_set.add(shiritori)
    continue
  else:
    ans = "No"
    break

print(ans)
Problem p02554 (python)

Fixed submission:
N=int(input())
MOD=10**9+7
if N==1:
    z=0
else:
    z = 10**N - (9**N *2) + 8**N
    z %= MOD
print(z)

Buggy submission (verdict: Runtime Error):
def func(a):
    if (a==1):
        return 0
    else:
        return func(a-1)+a
N=int(input())

S=10**9+7
if N==1:
    z=0
elif N==2:
    z=2
else:
    z=((10**(N-2) *N*2) - (10**(N-3) * ((6+func(N-2))))) %S
print(z)

Buggy submission (verdict: Runtime Error):
def func(a):
    if (a==0):
        return 6
    else:
        return func(a-1)+2
N=int(input())

S=10**9+7
if N==1:
    z=0
elif N==2:
    z=2
else:
    z=((10**(N-2) *N*2) - (10**(N-3) * (func(N-3)))) %S
print(z)