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

Fixed submission:
def kosu(kitei, aaa, tuika):
    global now_ret
    ret = 0
    n=len(kitei)
    ret2=0
    kitei.append(aaa)
    n+=1
    for i in range(n):
        if kitei[i]:
            ret2 += 1
            x = 0
            while (2**(x+1)) <= kitei[i]:
                x += 1
            for y in range(i+1, n, 1):
                if kitei[y] & (2 ** x):
                    kitei[y] ^= kitei[i]
    
    if now_ret==ret2:
        return 1
    else:
        if tuika==1:
            now_ret+=1
        return 0
 
 
def solve(n, alist, s):
    kitei=[0]
    answer=0
    for i in range(n):
        teban=s[n-i-1]
        now=alist[n-i-1]
        if teban=='0':
            if kosu(kitei, now, 1)>0:
                pass
            else:
                kitei.append(now)
        else:
            if kosu(kitei, now, 0)>0:
                pass
            else:
                answer=1
        #print(kitei)
    return answer
 
t=int(input())
for i in range(t):
    now_ret=0
    n=int(input())
    alist = list(map(int, input().split()))
    s=input()
    print(solve(n, alist, s))

Buggy submission (verdict: Runtime Error):
import math

def kosu(kitei, k):
    n=len(kitei)
    lim = [0]*n
    for i in range(1, n):
        lim[i] = lim[i-1]|kitei[i-1]
    dp = [0]*(2**17)
    tmp = dp[:]
    dp[k] = 1
    for i in range(len(kitei))[::-1]:
        for j in range(lim[i]+1):
            tmp[j] = (dp[j^kitei[i]] + dp[j]) % (10**9+7)
        dp, tmp = tmp, dp
    return dp[0]
    
def solve(n, alist, s):
    kitei=[0]
    answer=0
    for i in range(n):
        teban=s[n-i-1]
        now=alist[n-i-1]
        if teban=='0':
            if kosu(kitei, now)>0:
                pass
            else:
                kitei.append(now)
        else:
            if kosu(kitei, now)>0:
                pass
            else:
                answer=1
    return answer

t=int(input())
for i in range(t):
    n=int(input())
    alist = list(map(int, input().split()))
    s=input()
    print(solve(n, alist, s))
Problem p02838 (python)

Fixed submission:
import math

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

keta=math.floor(math.log(max(alist[-1],1), 2))+1
zeros=[0]*keta
ones=[0]*keta

for al in alist:
    kaz2=bin(al)[2:]
    kaz2=(keta-len(kaz2))*'0'+kaz2
    for i in range(keta):
        if kaz2[i]=='1':
            ones[i]+=1
        else:
            zeros[i]+=1

answer=0
for i in range(keta):
    tas=ones[-i-1]*zeros[-i-1]
    tas*=((2**i)%(10**9+7))
    answer+=tas%(10**9+7)

print(answer%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math

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

keta=math.floor(math.log2(alist[-1]))+1
#print(math.log2(alist[-1]), keta)
zeros=[0]*keta
ones=[0]*keta

for al in alist:
    kaz2=bin(al)[2:]
    kaz2=(keta-len(kaz2))*'0'+kaz2
    #print(kaz2)
    for i in range(keta):
        if kaz2[i]=='1':
            ones[i]+=1
        else:
            zeros[i]+=1

#print(ones)
#print(zeros)
answer=0
for i in range(keta):
    tas=ones[-i-1]*zeros[-i-1]
    tas*=((2**i)%(10**9+7))
    answer+=tas%(10**9+7)

print(answer%(10**9+7))
Problem p02900 (python)

Fixed submission:
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import math

a, b = map(int, input().split())
c=gcd(a, b)
d=prime_factorize(c)
count=0
before=0
for i in range(len(d)):
    if d[i]!=before:
        count+=1
    before=d[i]

print(count+1)

Buggy submission (verdict: Runtime Error):
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import math

a, b = map(int, input().split())
c=math.gcd(a, b)
d=prime_factorize(c)
count=0
before=0
for i in range(len(d)):
    if d[i]!=before:
        count+=1
    before=d[i]

print(count+1)
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6) 

def survey(now, mlist, clist):
    for ml in mlist[now]:
        if clist[ml[0]]==2:
            clist[ml[0]]=(clist[now]+ml[1])%2
            _, _=survey(ml[0], mlist, clist)
    return mlist, clist

n=int(input())
mlist=[]
clist=[]
for i in range(n):
    mlist.append([])
    clist.append(2)

for i in range(n-1):
    u, v, m = map(int, input().split())
    u-=1
    v-=1
    mlist[u].append([v, m%2])
    mlist[v].append([u, m%2])

clist[0]=0
now=0
mlist, clist = survey(now, mlist, clist)
for cl in clist:
    print(cl)

Buggy submission (verdict: Runtime Error):
def survey(now, mlist, clist):
    for ml in mlist[now]:
        if clist[ml[0]]==2:
            clist[ml[0]]=(clist[now]+ml[1])%2
            _, _=survey(ml[0], mlist, clist)
    return mlist, clist

n=int(input())
mlist=[]
clist=[]
for i in range(n):
    mlist.append([])
    clist.append(2)

for i in range(n-1):
    u, v, m = map(int, input().split())
    u-=1
    v-=1
    mlist[u].append([v, m%2])
    mlist[v].append([u, m%2])

#print(mlist)
clist[0]=0
now=0
mlist, clist = survey(now, mlist, clist)
for cl in clist:
    print(cl)
Problem p03047 (python)

Fixed submission:
line=input().split(" ")
n=int(line[0])
k=int(line[1])
print(n-k+1)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

n=int(input())

#normal, start_b, end_a, both

kosu=0
tokushu=[0,0,0,0]

for i in range(n):
    line=input()
    switch=0
    for l in range(len(line)):
        if switch==1:
            if line[l]=='B':
                kosu+=1
            else:
                switch=0
        if line[l]=='A':
            switch=1

    if line[0]=='B':
        if line[-1]=='A':
            tokushu[3]+=1
        else:
            tokushu[1]+=1
    else:
        if line[-1]=='A':
            tokushu[2]+=1
        else:
            tokushu[0]+=1

#print(kosu)
#print(tokushu)
kosu=0
tokushu=[1,1,2,3]
"""
if tokushu[3]>=1:
    mazu=tokushu[3]-1

else:
    mazu=0
"""
if tokushu[3]>=1:
    if tokushu[1]==0 and tokushu[2]==0:
        mazu=tokushu[3]-1
    else:
        mazu=tokushu[3]-1
        sukunai=min(tokushu[1],tokushu[2])
        mazu+=(sukunai+1)
else:
    mazu=min(tokushu[1], tokushu[2])

print(kosu+mazu)
Problem p03074 (python)

Fixed submission:
import math

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

list2=[]
renzoku=0

if s[0]=='0':
    list2.append(0)

for x in range(n-1):
    renzoku+=1
    if int(s[x])!=int(s[x+1]):
        list2.append(renzoku)
        renzoku=0

list2.append(renzoku+1)
if len(list2)%2==0:
    list2.append(0)

#print(list2)

kaisu=math.ceil(len(list2)/2)-k
max=0
if kaisu<=0:
    max=len(s)

for y in range(kaisu):
    #print(list2[y*2:y*2+(2*k+1)])
    if y==0:
        gokei=sum(list2[y*2:y*2+(2*k+1)])
    else:
        gokei-=(list2[y*2-2]+list2[y*2-1])
        gokei+=(list2[y*2+k*2-1]+list2[y*2+k*2])
    if gokei>max:
        max=gokei
print(max)

Buggy submission (verdict: Runtime Error):
import math

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

list2=[]
renzoku=0

if s[0]=='0':
    list2.append(0)

for x in range(n-1):
    renzoku+=1
    if int(s[x])!=int(s[x+1]):
        list2.append(renzoku)
        renzoku=0

list2.append(renzoku+1)

#print(list2)

kaisu=math.ceil(len(list2)/2)-k
max=0
if kaisu==0:
    gokei=len(s)

for y in range(kaisu):
    #print(list2[y*2:y*2+(2*k+1)])
    gokei=sum(list2[y*2:y*2+(2*k+1)])
    if gokei>max:
        max=gokei
print(gokei)
Problem p03078 (python)

Fixed submission:
x, y, z, k = map(int, input().split())
alist = list(map(int, input().split()))
blist = list(map(int, input().split()))
clist = list(map(int, input().split()))

bclist=[]

for i in range(y):
    now=blist[i]
    for j in range(z):
        bclist.append(now+clist[j])

bclist=sorted(bclist)
bclist2=bclist[-k:]
#print(bclist2)

ng=len(bclist2)
abclist=[]

for i in range(ng):
    now=bclist2[i]
    for j in range(x):
        abclist.append(now+alist[j])

abclist=sorted(abclist)
for i in range(k):
    print(abclist[-1-i])

Buggy submission (verdict: Runtime Error):
list=input().split(" ")
x=int(list[0])
y=int(list[1])
z=int(list[2])
k=int(list[3])

kari=input().split(" ")
alist=[]
for ax in range(x):
    alist.append(int(kari[ax]))
alist=sorted(alist)

kari=input().split(" ")
blist=[]
for by in range(y):
    blist.append(int(kari[by]))
blist=sorted(blist)

kari=input().split(" ")
clist=[]
for cz in range(z):
    clist.append(int(kari[cz]))
clist=sorted(clist)

nowx=0
nowy=0
nowz=0


ngo=[]

for a in range(min(x,10)):
    for b in range(min(y,10)):
        for c in range(min(z,10)):
            ngo.append(alist[x-a-1]+blist[y-b-1]+clist[z-c-1])
            
            
for a in range(max(x-10,0)):
    for b in range(min(y,10)):
        for c in range(min(z,10)):
            ngo.append(alist[x-a-1+max(x-10)]+blist[y-b-1]+clist[z-c-1])

for a in range(min(x, 10)):
    for b in range(max(y-10,0)):
        for c in range(min(z,10)):
            ngo.append(alist[x-a-1]+blist[y-b-1+max(y-10)]+clist[z-c-1])

for a in range(min(x, 10)):
    for b in range(min(y,10)):
        for c in range(max(z-10, 0)):
            ngo.append(alist[x-a-1]+blist[y-b-1]+clist[z-c-1+max(z-10)])

ngo=sorted(ngo, reverse=True)

for d in range(k):
    print(ngo[d])
Problem p02684 (python)

Fixed submission:
from copy import copy, deepcopy
from collections import Counter
from math import sqrt, floor, factorial
from itertools import permutations, combinations, combinations_with_replacement
from operator import mul
from functools import reduce
import bisect

MOD = 10**9 + 7
INF = float('inf')

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

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

A = [A[i]-1 for i in range(len(A))]

mem = [0]*N
mem2 = [0]*N

idx = 0
count1 = 0
while True:
    mem[idx] += 1
    if mem[idx] == 2:
        break
    count1 += 1
    idx = A[idx]


idx2 = idx
count2 = 0

count2 += 1
idx2 = A[idx2]

while True:
    if idx2 == idx:
        break
    count2 += 1
    idx2 = A[idx2]

tmp = count1 - count2

if tmp >= K:
    ans = 0
    for _ in range(K):
        ans = A[ans]
else:
    e = (K - tmp) % count2 + tmp
    ans = 0
    for _ in range(e):
        ans = A[ans]

print(ans+1)

Buggy submission (verdict: Runtime Error):
from copy import copy, deepcopy
from collections import Counter
from math import sqrt, floor, factorial
from itertools import permutations, combinations, combinations_with_replacement
from operator import mul
from functools import reduce
import bisect

MOD = 10**9 + 7
INF = float('inf')

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

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

A = [A[i]-1 for i in range(len(A))]

mem = [0]*N
mem2 = [0]*N

idx = 0
count1 = 0
while True:
    mem[idx] += 1
    if mem[idx] == 2:
        break
    count1 += 1
    idx = A[idx]


idx2 = idx
count2 = 0

count2 += 1
idx2 = A[idx2]

while True:
    if idx2 == idx:
        break
    count2 += 1
    idx2 = A[idx2]

tmp = count1 - count2

if tmp >= K:
    for _ in range(K):
        idx = A[idx]
else:
    e = (K - tmp) % count2 + tmp
    ans = 0
    for _ in range(e):
        ans = A[ans]

print(ans+1)
Problem p02687 (python)

Fixed submission:
N = input()

if N == "ABC":
    print("ARC")
else:
    print("ABC")

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

if N ='ABC':
    print("ARC")
else:
    print("ABC")
Problem p02714 (python)

Fixed submission:
N = int(input())
S = list(input())

r, g, b = 0, 0, 0
ans = 0
for i in range(N):
    if S[i] == 'R':
        r += 1
    elif S[i] == 'G':
        g += 1
    else:
        b += 1

ans += r*g*b

for i in range(N):
    for j in range(i+1, N):
        if 2*j-i < N:
            if (S[i] != S[j]) and (S[j] != S[2*j-i]) and (S[i] != S[2*j-i]):
                ans -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
ans = 0


def main():
    for i in range(N):
        first_s = S[i]
        for j in range(i+1, N):
            if S[j] != first_s:
                second_s = S[j]
                for k in range(j+1, N):
                    if (S[k] != first_s) and (S[k] != second_s):
                        if k == 2*j-i:
                            continue
                        ans += 1
    print(ans)


if __name__ == '__main__':
    main()
Problem p02743 (python)

Fixed submission:
import math


a, b, c = list(map(int, input().split()))
sa, sb, sc = math.sqrt(a), math.sqrt(b), math.sqrt(c)
d = c-a-b

if (c-a-b > 0) and ((c-a-b)**2 > 4*a*b):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math


a, b, c = list(map(int, input().split()))
sa, sb, sc = math.sqrt(a), math.sqrt(b), math.sqrt(c)
d = c-a-b
if len(str*d) > ８:
    if (sa + sb < sc):
        print("Yes")
    else:
        print("No")

else:
    if (c-a-b)**2 > 4*a*b:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
import math


a, b, c = list(map(int, input().split()))
sa, sb, sc = math.sqrt(a), math.sqrt(b), math.sqrt(c)
if len(c - a - b) > ８:
    if (sa + sb < sc):
        print("Yes")
    else:
        print("No")

else:
    if (c-a-b)**2 > 4*a*b:
        print("Yes")
    else:
        print("No")
Problem p02882 (python)

Fixed submission:
from math import atan, atan2, degrees

a, b, x = list(map(int, input().split()))

th = atan2(a, b)

if a**2*b == x:
    print(0)
else:
    tmp1 = atan(a**3 / (2 * (a**2 * b - x)))
    tmp2 = atan(2 * x / (a * b**2))

    if tmp1 <= th:
        print(90 - degrees(tmp2))
    else:
        print(90 - degrees(tmp1))

Buggy submission (verdict: Runtime Error):
from math import atan, atan2, degrees

a, b, x = list(map(int, input().split()))

th = atan2(a, b)

tmp1 = atan(a**3 / (2 * (a**2 * b - x)))
tmp2 = atan(2 * x / (a * b**2))

if tmp1 <= th:
    print(90 - degrees(tmp2))
else:
    print(90 - degrees(tmp1))

Buggy submission (verdict: Runtime Error):
from math import *

a, b, x = list(map(int, input().split()))

th = atan2(a, b)

tmp1 = atan(a**3 / (2 * (a**2 * b - x)))
tmp2 = atan(2 * x / (a * b**2))

if tmp1 <= th:
    print(90 - degrees(tmp2))
else:
    print(90 - degrees(tmp1))

Buggy submission (verdict: Runtime Error):
from math import *

a, b, x = list(map(int, input().split()))

th = atan2(a, b)

tmp1 = atan(a**3 / (2 * (a**2 * b - x)))
tmp2 = atan(2 * x / (a * b**2))

if tmp1 <= th:
    print(90 - degrees(tmp2))
else:
    print(90 - degrees(tmp1))
Problem p03946 (python)

Fixed submission:
n, t = map(int, input().split())
l = [int(i)for i in input().split()]

if t <= 1 or all(a >= b for a, b in zip(l, l[1:])):
    print(0)
else:
    mini = float("inf")
    maxp = 0
    maxc = 0
    for n in l:
        if n - mini > maxp:
            maxp = n - mini
            maxc = 1
        elif n - mini == maxp:
            maxp = n - mini
            maxc += 1
        mini = min(mini, n)
    print(maxc)

Buggy submission (verdict: Runtime Error):
n, t = map(int, input().split())
l = [int(i)for i in input().split()]

if t <= 1 or all(b >= a for a, b in zip(l, l[1:])):
    print(0)
else:
    mini = float("inf")
    maxp = 0
    maxc = 0
    for n in l:
        if n - mini > maxp:
            maxp = n - mini
            maxc = 1
        elif n - mini == maxp:
            maxp = n - mini
            maxc += 1
        mini = min(mini, n)
print(maxc)
Problem p03657 (python)

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

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

if (a + b) % 3 == 0:
  print(Possible)
else:
  print(Impossible)
Problem p02646 (python)

Fixed submission:
a_index, a_v = map(int, input().split())
b_index, b_v = map(int, input().split())
t = int(input())
 
d = abs(b_index - a_index)
d_v = a_v - b_v
 
if d == 0 :
  print("YES")
elif d_v > 0 and d / d_v <= t :
  print("YES")
else :
  print("NO")

Buggy submission (verdict: Runtime Error):
a_index, a_v = list(map(int, input().split()))
b_index, b_v = list(map(int, input().split()))
t = int(input().split())
 
d = abs(b_index - a_index)
d_v = abs(b_v - a_v)
 
if d == 0 :
  print("YES")
elif d_v != 0 and d / d_v <= t :
  print("YES")
else :
  print("NO")

Buggy submission (verdict: Runtime Error):
a_index, a_v = map(int, input().split())
b_index, b_v = map(int, input().split())
t = int(input().split())

d = abs(b_index - a_index)
d_v = abs(b_v - a_v)

if d == 0 :
  print("YES")
elif d_v != 0 and d / d_v <= t :
  print("YES")
else :
  print("NO")

Buggy submission (verdict: Runtime Error):
a_index, a_v = map(int, input().split())
b_index, b_v = map(int, input().split())
t = map(int, input().split())
 
d = abs(b_index - a_index)
d_v = abs(b_v - a_v)
 
if d == 0 :
  print("YES")
elif d_v != 0 and d / d_v <= t :
  print("YES")
else :
  print("NO")

Buggy submission (verdict: Runtime Error):
a_index, a_v = map(int, input().split())
b_index, b_v = map(int, input().split())
t = input()
 
d = abs(b_index - a_index)
d_v = abs(b_v - a_v)
 
if d == 0 :
  print("YES")
elif d_v != 0 and d / d_v <= t :
  print("YES")
else :
  print("NO")

Buggy submission (verdict: Runtime Error):
a_index, a_v = map(float, input().split())
b_index, b_v = map(float, input().split())
t = input()
 
d = abs(b_index - a_index)
d_v = abs(b_v - a_v)

if (d == 0) :
  print("YES")
elif (d_v != 0 and d / d_v <= t) :
  print("YES")
else :
  print("NO")

Buggy submission (verdict: Runtime Error):
a_index, a_v = map(int, input().split())
b_index, b_v = map(int, input().split())
t = input()
 
d = abs(b_index - a_index)
d_v = abs(b_v - a_v)

if (d == 0) :
  print("YES")
elif (d_v != 0 and d / d_v <= t) :
  print("YES")
else :
  print("NO")

Buggy submission (verdict: Runtime Error):
a_index, a_v = map(int, input().split())
b_index, b_v = map(int, input().split())
t = input()
 
d = abs(b_index - a_index)
d_v = abs(b_v - a_v)
t_at = d / a_v
 
if (t_at < t) :
  print("YES")
else :
  print("NO")

Buggy submission (verdict: Runtime Error):
a_index, a_v = map(int, input().split())
b_index, b_v = map(int, input().split())
t = input()
 
d = abs(b_index - a_index)
d_v = abs(w - v)
t_at = d / a_v
 
if (t_at < t) :
  print("YES")
else :
  print("NO")

Buggy submission (verdict: Runtime Error):
[a_index, a_v] = map(int, input().split())
[b_index, b_v] = map(int, input().split())
t = input()

d = abs(b_index - a_index)
d_v = abs(w - v)
t_at = d / a_v

if (t_at < t) :
  print("YES")
else :
  print("NO")
Problem p02681 (python)

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

if S==T[:len(T)-1]:
  print('Yes')
else:
  print('No')

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

if S==T[:len(T)-1]:
  print('Yes')
else:
  print('No')
Problem p02780 (python)

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

p = [(n+1)/2 for n in p]
import numpy as np
s = np.cumsum(p)

e=s[K-1]
max_e=e
for i in range(1,N-K):
  e=s[i+K]-s[i]
  max_e = max(max_e, e)
    
print(max_e)

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

#p = [(n+1)/2 for n in p]
import numpy as np
s = np.cumsum(p)

e=s[K-1]
max_e=(K+e)/2
for i in range(1,N-K):
  e=s[i+K]-s[i]
  e=(K+smax)/2
  max_e = max(max_e, e)
    
print(max_e)

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

#p = [(n+1)/2 for n in p]
import numpy as np
s = np.cumsum(p)

e=s[K-1]
max_e=(K+e)/2
if N==1:
  print(max_e)
else:
for i in range(0,N-K-1):
    e=s[i+K]-s[i]
    #print(e)
    e=(K+e)/2
    #print(e)
    max_e = max(max_e, e)

  print(max_e)

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

p = [(N+1)/2 for n in p]
import numpy as np
s = np.cumsum(p)

max_e=0
for i in range(N-K+1):
  e=s[i+K]-s[i]
  max_e = max(max_e, e)
    
print(max_e)
Problem p02786 (python)

Fixed submission:
H = int(input())

if H==1:
  print(1)
else:
  
  if H%2==1:
    H = H-1

  from math import log2
  deep = int(log2(H))+1
  ans = 0
  for d in range(0,deep):
    ans += 2**d

  print(ans)

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

if H%2==1:
  H = H-1

from math import log2
deep = int(log2(H))+1
ans = 0
for d in range(0,deep):
  ans += 2**d

print(ans)

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

if H%2==1:
  H = H-1

from math import log2
deep = int(log2(H))+1
ans = 0
for d in range(0,deep):
  ans += 2**d

print(ans)
Problem p03284 (python)

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

amari = n % k

if amari == 0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
import numpy as np


n,m = input().split()

n = int(n)
m = int(m)

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

ans = 0

sumlist = list(np.cumsum(a))
for i in range(n):
    # print(sumlist)
    # for j in range(len(sumlist)):
    #     if sumlist[j] % m == 0:
    #         ans += 1
    tmp = [x for x in sumlist if x % m == 0]
    ans += len(tmp)

    sumlist = list(map(lambda x:x - sumlist[0],sumlist))
    sumlist.pop(0)
print(ans)
Problem p02700 (python)

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


while A > 0 and C > 0:
    C -= B
    if C <= 0:
        print("Yes")
        exit()
    A -= D
    if A <= 0:
        print("No")
        exit()

Buggy submission (verdict: Runtime Error):
while A > 0 and C > 0:
    C -= B
    if C <= 0:
        print("Yes")
        exit()
    A -= D
    if A <= 0:
        print("No")
        exit()
Problem p02714 (python)

Fixed submission:
N = int(input())
S = input()
#N, M = map(int, input().split())
#A = list(map(lambda x: int(x)*(-1), input().split()))
#A = [int(input()) for i in range(N)]
#C = [list(map(int, input().split())) for i in range()]
R  =[]
G  =[]
B  =[]
for i, s in enumerate(S):
    if s == 'R':
        R.append(i)
    elif s == 'G':
        G.append(i)
    else:
        B.append(i)
answer = len(R)*len(G)*len(B)
hiku = 0

for i in range((N-1)//2):
    for j in range(N-i-i-2):
        if S[j] != S[j+i+1] and S[j+i+1] != S[j+i+i+2] and S[j] != S[j+i+i+2]:
            hiku += 1


answer -= hiku
print(answer)

Buggy submission (verdict: Runtime Error):
#from operator import itemgetter
#from collections import Counter
#import heapq
N = int(input())
S = input()
#N, M = map(int, input().split())
#A = list(map(lambda x: int(x)*(-1), input().split()))
#A = [int(input()) for i in range(N)]
#C = [list(map(int, input().split())) for i in range()]
R  =[]
G  =[]
B  =[]

START_TIME = time.time()
for i, s in enumerate(S):
    if s == 'R':
        R.append(i)
    elif s == 'G':
        G.append(i)
    else:
        B.append(i)
answer = len(R)*len(G)*len(B)
hiku = 0
for r in R:
    for g in G:
        for b in B:
            if b > max(r,g)+abs(r-g):
                break
            if abs(r-g) == abs(g-b) or abs(r-b) == abs(b-g) or abs(b-r) == abs(r-g):
                hiku += 1
answer -= hiku
print(answer)
Problem p02717 (python)

Fixed submission:
X, Y, Z = map(int, input().split())
print(Z, X, Y)

Buggy submission (verdict: Runtime Error):
X , Y ,Z = int(input())
print(Z, X, Y)