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

Fixed submission:
import math
o, b = map(int, input().split())
def pi(a):
    s= 0
    a+=1
    p = math.log2(a)
    p = int(p)
    qq=1
    q = 2
    ans =0
    t = 0
    t = a//2
    ans += t%2

    for i in range(1,p+1):
        qq = q

        q*=2
        t = a%(q)
        ans += qq*(max(0,t-qq)%2)
    return ans
print((pi(b)^pi(o))^o)

Buggy submission (verdict: Runtime Error):
import math
o, b = map(int, input().split())
def pi(a):
    s= 0
    a+=1
    p = math.log2(a)
    p = int(p)
    b_q =1
    q = 2
    ans =0
    ans += (t//2)%2

    for i in range(1,p+1):
        b_q = q

        q*=2
        t = a%(q)
        ans += b_q*(max(0,t-b_1)%2)
    return ans
print((pi(b)^pi(o))^o)

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
def pi(a):
    s= 0
    a+=1
    n = int(math.log2(a))
    b_q=1
    q = 2
    ans =0
    ans += (t//2)%2

    for i in range(1,n+1):
        b_q = q

        q*=2
        t = a%(q)
        ans += b_q*(max(0,t-b_q)%2)
    return ans
print((pi(b)^pi(a))^a)
Problem p03137 (python)

Fixed submission:
n,k = map(int,input().split())
x=list(map(int,input().split()))
y=[]
x.sort()
for i in range(1,k):
    y.append(x[i]-x[i-1])
y.sort()
if n>k-1:
    print(0)
else:
    for k in range(n-1):
        y.pop()
    print(sum(y))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
x=list(map(int,input().split()))
y=[]
x.sort()
for i in range(1,k):
    y.append(x[i]-x[i-1])
y.sort()
for k in range(n-1):
    y.pop()
print(sum(y))
Problem p03252 (python)

Fixed submission:
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not (k.index(a[i])==l.index(b[i]) and ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i]))):
            np*=0
if np == nq:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):

def get_input(inp):
    li = inp.split("\n")

    def inner():
        return li.pop(0)
    return inner

INPUT = """azzel
apple
"""
input = get_input(INPUT)

#######################################################
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not (k.index(a[i])==l.index(b[i]) and ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i])):
            np*=0
if np == nq:
    print("Yes")
else:
    print("No")
Problem p03286 (python)

Fixed submission:
a=int(input());s=''
while a!=0:s+=str(a%2);a=-(a//2)
print(int(s[::-1]) if s != '' else 0)

Buggy submission (verdict: Runtime Error):
a=int(input());s=''
while a!=0:s+=str(a%2);a=-(a//2)
print(int(s[::-1]))
Problem p03326 (python)

Fixed submission:
n,m=map(int,input().split())
x = [tuple(map(int, input().split())) for _ in range(n)]
from itertools import *
res = 0
for a in product([-1, 1], [-1, 1], [-1, 1]):
    ts = (sum(i*j for i,j in zip(a,t)) for t in x)
    s = sum(sorted(ts,reverse=True)[:m])
    res = max(res, s)
print(res)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x = [list(map(int, input().split())) for _ in range(n)]
from itertools import *
res = 0
for a in product([-1, 1], [-1, 1], [-1, 1]):
    ts =[]
    for t in x:
        ta = 0
        for i,j in zip(a,t):
            ta+=i*j
        ts.append(t)
    s = sum(sorted(ts,reverse=True)[:m])
    res = max(res, s)
print(res)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x = [list(map(int, input().split())) for _ in range(n)]
from itertools import *
res = 0
for a in product([-1, 1], [-1, 1], [-1, 1]):
    ts =[]
    for t in x:
        t = 0
        for i,j in zip(a,t):
            t+=i*j
        ts.append(t)
    s = sum(sorted(ts,reverse=True)[:m])
    res = max(res, s)
print(res)
Problem p03631 (python)

Fixed submission:
a = input()
b =a[::-1]
if a!=b:print("No")
else:print("Yes")

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
if a > c:
    a,b,c,d = c,d,a,b
if b < c:print(0)
elif b >= c and b < d:print(b-c)
else : print(d-c)
Problem p03634 (python)

Fixed submission:
N = int(input())
tree = [[] for _ in range(N)]

for i in range(N-1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    tree[a].append((b, c))
    tree[b].append((a, c))

Q, K = map(int, input().split())
K -= 1

depth = [0 for _ in range(N)]

def dfs(v, p = -1, d = 0):
    St = []
    St.append([v, p, d])
    # 空のシーケンスは偽になる
    while St:
        cur = St.pop()
        depth[cur[0]] = cur[2]
        for i, j in tree[cur[0]]:
            if i == cur[1]:
                continue
            St.append([i, cur[0], cur[2] + j])

dfs(K)

for i in range(Q):
    x, y = map(int, input().split())
    x -= 1; y -= 1
    print (depth[x] + depth[y])

Buggy submission (verdict: Runtime Error):

N = int(input())
tree = [[] for _ in range(N)]

for i in range(N-1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    tree[a].append((b, c))
    tree[b].append((a, c))

Q, K = map(int, input().split())
K -= 1

depth = [0 for _ in range(N)]

def dfs(v, p = -1, d = 0):
    depth[v] = d
    for i, j in tree[v]:
        if i == p:
            continue
        dfs(i, v, d + j)

dfs(K)

for i in range(Q):
    x, y = map(int,input().split())
    x -= 1; y -= 1
    print (depth[x] + depth[y])
Problem p03723 (python)

Fixed submission:
def lma():return list(map(int, input().split()))#x or y
a = lma()
f = 1
c =0
while f:
    if a[0]%2==1 or a[1]%2==1 or a[2]%2 ==1:break
    if (a[0] == a[1] and a[0] == a[2]) :
        c=-1
        break
    a[0],a[1],a[2] = (a[1]+a[2])/2,(a[0]+a[2])/2,(a[1]+a[0])/2
    c+=1
print(c)

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

s = (9-len(a))*'0'+a
ans = 0
for i in range(9):
    if s[i] == '0' and ans==0:
        continue
    ans+=(b//((10**(8-i))*10))*(10**(8-i))
    c = (b%((10**(8-i))*10))+1
    #print(0,c)
    if 2*(10**(8-i))>= c > 10**(8-i):
        ans+=c-10**(8-i)
    elif c>=2*10**((8-i)):
        ans+=10**(8-i)
    #print(ans)
print(ans)

Buggy submission (verdict: Runtime Error):
a = lma()
f = 1
c =0
while f:
    if (a[0] == a[1] and a[0] == a[2]) :
        c=-1
        break
    if a[0]%2==1 or a[1]%2==1 or a[2]%2 ==1:break
    a[0],a[1],a[2] = (a[1]+a[2])/2,(a[0]+a[2])/2,(a[1]+a[0])/2
    c+=1
print(c)
Problem p03724 (python)

Fixed submission:
N,M=map(int,input().split())
import collections
e =[]
for i in range(M):
    ta,tb =map(int,input().split())
    e.extend([ta,tb])
c = collections.Counter(e)
#print(c)
ans = "YES"
for i in c:
    if c[i]%2 != 0:
        ans = "NO"
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
import collections
e =[]
for i in range(N):
    ta,tb =map(int,input().split())
    e.extend([ta,tb])
c = collections.Counter(e)
#print(c)
ans = "YES"
for i in c:
    if c[i]%2 != 0:
        ans = "NO"
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
import collections
e =[]
for i in range(N):
    ta,tb =map(int,input().split())
    e.extend([ta,tb])
c = collections.Counter(e)
print(c)
ans = "YES"
for i in c:
    if c[i]%2 != 0:
        ans = "NO"
print(ans)
Problem p03767 (python)

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

print(sum(A[n:3*n:2]))

Buggy submission (verdict: Runtime Error):
a =int(input())
x =list(map(int, input().split()))
x.sort()
s=0
for i in reversed(range(0,a//3,1):
  s+=x[i+1]
print(s)

Buggy submission (verdict: Runtime Error):
a =int(input())
x =list(map(int, input().split()))
x.sort()
s=0
for i in reversed(range(1,(a+1)//3,1):
  s+=x[i]
print(s)

Buggy submission (verdict: Runtime Error):
a =int(input())
x =list(map(int, input().split()))
x.sort()
s=0
for I in reversed(range(1,a//3,1):
  s+=x[i]
print(s)
Problem p03774 (python)

Fixed submission:
n,m=map(int,input().split())
p=[list(map(int,input().split()))for _ in range(n)]
s=[list(map(int,'0'*m))for _ in range(n)]
for j in range(m):
  c,d=map(int,input().split())
  for i in range(n):
    s[i][j]=abs(p[i][0]-c)+abs(p[i][1]-d)
else:
  for i in range(n):print(1+s[i].index(min(s[i])))

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
x = []
z = []
m =19999999999999
s  = 1
for i in range(a):
    ta , tb = map(int, input().split()) 
    x.append([ta,tb])
for i in range(a):
    ta , tb = map(int, input().split())
    z.append([ta,tb])
for ta , tb in x:
    s = 0
    m =19999999999999
    for n,(s,y) in enumerate(z):
        print(n,s,y)
        # print(m , abs(s-ta)+abs(y-tb))
        if m >= abs(s-ta)+abs(y-tb):
            m = abs(s-ta)+abs(y-tb)
            s = n
    print(s+1)

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
x = []
m =19999999999999
for i in range(a):
    ta , tb = map(int, input().split()) 
    x.append([ta,tb])
for i in range(b):
    ta , tb = map(int, input().split()) 
    for x,y in x:
        m = min(m,abs(x-ta)+abs(y-tb))
    print(m)
Problem p03775 (python)

Fixed submission:
import math
b = input()
a =int(b)
m = len(b)
for i in reversed(range(1,int(math.sqrt(a))+1)):
    if a/i == int(a/i):
        m = max(len(str(a//i)),len(str(i)))
        break
print(m)

Buggy submission (verdict: Runtime Error):
b = input()
a =int(b)
m = len(b)
for i in reversed(range(1,int(math.sqrt(a))+1)):
    if a/i == int(a/i):
        m = max(len(str(a//i)),len(str(i)))
        break
print(m)
Problem p03805 (python)

Fixed submission:
#########
#thiking Face
from itertools import permutations

n,m=map(int,input().split())
path=set()
for _ in range(m):
    u,v=map(int,input().split())
    path|={(u-1,v-1),(v-1,u-1)}

print(sum(all((u,v) in path for u,v in zip(p,p[1:]))
          for p in permutations(range(n)) if p[0]==0))

Buggy submission (verdict: Runtime Error):
from itertools import permutations

n,m=map(int,input().split())
path=set()
for _ in range(m):
    u,v=map(int,input().split())
    path|={(u-1,v-1),(v-1,u-1)}
s = 0
for i in permutations(range(n)):
    s+=(all((h,j) in path for h,j in zip(i[1:],i))) if i[0] ==0
print(s)

Buggy submission (verdict: Runtime Error):

#########
#thiking Face
from itertools import permutations

n,m=map(int,input().split())
path=set()
for _ in range(m):
    u,v=map(int,input().split())
    path|={(u-1,v-1),(v-1,u-1)}

print(sum(all((u,v) in es for u,v in zip(p,p[1:]))
          for p in permutations(range(n)) if p[0]==0))

Buggy submission (verdict: Runtime Error):
###########

#########
#thiking Face
from itertools import permutations

n,m=map(int,input().split())
path=set()
for _ in range(m):
    u,v=map(int,input().split())
    path|={(u-1,v-1),(v-1,u-1)}

print(sum(all((u,v) in es for u,v in zip([0]+p,p))
          for p in permutations(range(1,n))))
Problem p03839 (python)

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

sa = [0]
sb = [0]
for i in range(N):
    sa.append(sa[-1] + a[i])
    sb.append(sb[-1] + max(0, a[i]))

ans = 0
for i in range(N - K + 1):
    a = sa[i + K] - sa[i]
    b = sb[i + K] - sb[i]
    ans = max(ans, sb[N] - b + max(a, 0))
print(ans)

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

sa = [0]
sb = [0]
for i in range(N):
    sa.append(sa[-1] + a[i])
    sb.append(sb[-1] + max(0, a[i]))

ans = 0
for i in range(N - K + 1):
	a = sa[i + K] - sa[i]
	b = sb[i + K] - sb[i]
    ans = max(ans, sb[N] - b + max(a, 0))

print(ans)
Problem p02835 (python)

Fixed submission:
print(['bust','win'][sum(map(int,input().split()))<22])

Buggy submission (verdict: Runtime Error):
print(['bust','win'][sum(map(int,input.split()))<22])
Problem p02989 (python)

Fixed submission:
N = int(input())
D = sorted(list(map(int, input().split())))
print(D[N // 2] - D[(N // 2) - 1])

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split())).sort()
print(D[N // 2] - D[(N // 2) - 1])
Problem p02990 (python)

Fixed submission:
# https://atcoder.jp/contests/abc132/tasks/abc132_d
# K個を区別なくi個のグループに分ける通りの数？
# 制約はたかだか2000
# 赤の壁のパターンを考えるとか？[WIP]
# mod取りながらcombination


MOD = 10**9 + 7


def combination_mod(n, r, mod):
    if r > n:
        return 0  # このような通りの数は無いため便宜上こう定義する
    r = min(r, n - r)
    nf = rf = 1
    for i in range(r):
        nf = nf * (n - i) % mod
        rf = rf * (i + 1) % mod
    return nf * pow(rf, mod - 2, mod) % mod


C = [[1], [1, 1]]
'''
1
1, 1
1, 2, 1
1, 3, 3, 1
# '''
# for i in range(2, 2002):
#     tmp = [1]
#     for j in range(1, i):
#         tmp.append((C[i - 1][j - 1] + C[i - 1][j]) % MOD)
#     tmp.append(1)
#     C.append(tmp)


N, K = list(map(int, input().split()))
left1 = N - K + 1
left2 = K - 1
for i in range(1, K + 1):
    ans = combination_mod(left1, i, MOD) * combination_mod(left2, i - 1, MOD)
    # print(ans)
    print(ans % MOD)

# for i in range(1, K + 1):
#     ans = C[left1][i] * C[left2][i - 1]
#     # print(ans)
#     print(ans % MOD)

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc132/tasks/abc132_d
# K個を区別なくi個のグループに分ける通りの数？
# 制約はたかだか2000
# 赤の壁のパターンを考えるとか？[WIP]
# mod取りながらcombination


MOD = 10**9 + 7


def combination_mod(n, r, mod):
    r = min(r, n - r)
    nf = rf = 1
    for i in range(r):
        nf = nf * (n - i) % mod
        rf = rf * (i + 1) % mod
    return nf * pow(rf, mod - 2, mod) % mod


C = [[1], [1, 1]]
'''
1
1, 1
1, 2, 1
1, 3, 3, 1
'''
for i in range(2, 2002):
    tmp = [1]
    for j in range(1, i):
        tmp.append((C[i - 1][j - 1] + C[i - 1][j]) % MOD)
    tmp.append(1)
    C.append(tmp)


N, K = list(map(int, input().split()))
left1 = N - K + 1
left2 = K - 1
# for i in range(1, K + 1):
#     ans = combination_mod(left1, i, MOD) * combination_mod(left2, i - 1, MOD)
#     # print(ans)
#     print(ans % MOD)

for i in range(1, K + 1):
    ans = C[left1][i] * C[left2][i - 1]
    # print(ans)
    print(ans % MOD)

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc132/tasks/abc132_d
# K個を区別なくi個のグループに分ける通りの数？
# 制約はたかだか2000
# 赤の壁のパターンを考えるとか？[WIP]
# mod取りながらcombination


MOD = 10**9 + 7


def combination_mod(n, r, mod):
    r = min(r, n - r)
    nf = rf = 1
    for i in range(r):
        nf = nf * (n - i) % mod
        rf = rf * (i + 1) % mod
    return nf * pow(rf, mod - 2, mod) % mod


C = [[1], [1, 1]]
'''
1
1, 1
1, 2, 1
1, 3, 3, 1
'''
for i in range(2, 2001):
    tmp = [1]
    for j in range(1, i):
        tmp.append((C[i - 1][j - 1] + C[i - 1][j]) % MOD)
    tmp.append(1)
    C.append(tmp)


N, K = list(map(int, input().split()))
left1 = N - K + 1
left2 = K - 1
# for i in range(1, K + 1):
#     ans = combination_mod(left1, i, MOD) * combination_mod(left2, i - 1, MOD)
#     # print(ans)
#     print(ans % MOD)

for i in range(1, K + 1):
    ans = C[left1][i] * C[left2][i - 1]
    # print(ans)
    print(ans % MOD)
Problem p03286 (python)

Fixed submission:
# https://atcoder.jp/contests/abc105/tasks/abc105_c
# -2進数
# 前に考えたときはわからなかったけど、数式イジイジしたら解けた


N = int(input())

if N == 0:
    print(0)
    exit()

ans = ''
while N != 0:
    if N & 1:  # 奇数ならbitが立つのは共通する性質
        ans += '1'
        N /= -2
        if N > 0:
            N += 1
        N = int(N)
    else:
        ans += '0'
        N //= -2


print(ans[::-1])

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc105/tasks/abc105_c
# -2進数
# 前に考えたときはわからなかったけど、数式イジイジしたら解けた


N = int(input())

if N == 0:
    print(0)
	exit()
ans = ''
while N != 0:
    if N & 1:  # 奇数ならbitが立つのは共通する性質
        ans += '1'
        N /= -2
        if N > 0:
            N += 1
        N = int(N)
    else:
        ans += '0'
        N //= -2


print(ans[::-1])
Problem p03326 (python)

Fixed submission:
# https://atcoder.jp/contests/abc100/tasks/abc100_d

# もし正の数だけだったら簡単→それぞれの合計値でソートすれば良い
# Nはたかだか1000→N^2でも間に合う

# 突っ込んだときに良くなるものを貪欲に選べばよいのでは？
# だめだ。-3 1 1 1 1とかのときに1が選ばれなくなる
# 正負の仮定を8パターン列挙しておいて、それぞれに貪欲にやる←行けそう

import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


N, M = read_ints()
XYZ = read_tuple(N)


def iter_p_adic(p, length):
    '''
    連続して増加するp進数をリストとして返す。lengthはリストの長さ
    return
    ----------
    所望のp進数リストを次々返してくれるiterator
    '''
    from itertools import product
    tmp = [range(p)] * length
    return product(*tmp)


def sort_and_ret_score(p):
    a = [-1, 1]
    XYZ.sort(reverse=True, key=lambda x: (
        a[p[0]] * x[0] + a[p[1]] * x[1] + a[p[2]] * x[2]))  # すべて正だとして仮定した場合の最大値
    tmp = 0
    for x, y, z in XYZ[:M]:
        tmp += a[p[0]] * x + a[p[1]] * y + a[p[2]] * z
    return tmp


ans = 0
for p in iter_p_adic(2, 3):
    ans = max(ans, sort_and_ret_score(p))


print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from math import gcd

# https://atcoder.jp/contests/abc100/tasks/abc100_d
# 定式化 M個のidxの集合idsに対して、
# max(|sum_ids (x_i)| +|sum_ids (y_i)| + |sum_ids (z_i)|) という問題
# 各項について正負を仮定すると、どのケーキを取ればいいのか優先度が決まる(ソート)
# bit全探索とソートの合わせ技
N, M = read_ints()
XYZ = read_tuple(N)

ans = -1 * 10**13 - 100
for is_mina_x, is_mina_y, is_mina_z in product(range(2), repeat=3):
    is_mina_x = -1 if is_mina_x else 1
    is_mina_y = -1 if is_mina_y else 1
    is_mina_z = -1 if is_mina_z else 1

    XYZ.sort(key=lambda x: is_mina_x *
             x[0] + is_mina_y * x[1] + is_mina_z * x[2], reverse=True)
    x_sum = 0
    y_sum = 0
    z_sum = 0
    for x, y, z in XYZ[:M]:
        x_sum += x
        y_sum += y
        z_sum += z
    ans = max(ans, abs(x_sum) + abs(y_sum) + abs(z_sum))

print(ans)
Problem p03724 (python)

Fixed submission:
# https://atcoder.jp/contests/agc014/tasks/agc014_b
# 条件を満たすものが存在するかの判別問題

# クエリをグラフにして考えてみる
# a-bを結ぶすべての経路は木上のa-b間の経路を必ず通る
# つまりa-b間の経路の数が偶数である必要がある。すべてのノードに対してエッジが偶数個つながっているかを確認すればよい

import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


N, M = read_ints()

n_edges = [0] * N
for _ in ra(M):
    a, b = read_ints()
    n_edges[a - 1] += 1
    n_edges[b - 1] += 1

for n in n_edges:
    if n & 1:
        print('NO')
        exit()
print('YES')

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/agc014/tasks/agc014_b
# 条件を満たすものが存在するかの判別問題

# クエリをグラフにして考えてみる
# a-bを結ぶすべての経路は木上のa-b間の経路を必ず通る
# つまりa-b間の経路の数が偶数である必要がある。すべてのノードに対してエッジが偶数個つながっているかを確認すればよい

import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from math import gcd


def lcm(a, b):
    # 最小公倍数
    g = gcd(a, b)
    return a * b // g


N, M = read_ints()

n_edges = [0] * N
for _ in ra(M):
    a, b = read_ints()
    n_edges[a - 1] += 1
    n_edges[b - 1] += 1

for n in n_edges:
    if n & 1:
        print('NO')
        exit()
print('YES')
Problem p02547 (python)

Fixed submission:
N = int(input())
D = [list(map(int,input().split())) for i in range(N)]  

ans = "No"

for i in range(N-2):
    if D[i][0] == D[i][1]:
        if D[i+1][0] == D[i+1][1]:
            if D[i+2][0] == D[i+2][1]:
                ans = "Yes"
                break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
and = D = [list(map(int,input().split())) for i in range(N)]  

ans = "No"

for i in range(N-2):
    if D[i][0] == D[i][1]:
        if D[i+1][0] == D[i+1][1]:
            if D[i+2][0] == D[i+2][1]:
                ans = "Yes"
                break
print(ans)
Problem p02688 (python)

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

list_A = [0]*N
ans = 0
d = []
A = []

for i in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))

list_A = [0]*N

for i in range(len(A)):
    for j in A[i]:
        list_A[j-1] += 1
        
for i in range(N):
    if list_A[i] == 0:
        ans += 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
tmp_A = [0]*N
ans = 0

for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for j in range(d):
        tmp_A[A[j]-1] += 1
        
for i in range(N):
    tmp_A[i] == 0:
        ans += 1
        
print(ans)
Problem p02707 (python)

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

ans = [0]*N

for i in range(N-1):
    ans[A[i]-1] += 1

for i in range(N):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
// C/C++ キーワード定義ファイル 関数
// cpp_kw3_functions.kwd
//
//  Created on: 2015/06/13
//      Author: KeitetsuWorks
// CASE=True

#define
#elif
#else
#endif
#error
#if
#ifdef
#ifndef
#include
#line
#pragma
#undef
abort
abs
acos
asctime
asin
assert
atan
atan2
atexit
atof
atoi
atol
bsearch
calloc
ceil
clearerr
clock
cos
cosh
ctime
difftime
div
errno
exit
exp
fabs
fclose
feof
ferror
fflush
fgetc
fgetpos
fgets
floor
fmod
fopen
fprintf
fputc
fputs
fread
free
freopen
frexp
fscanf
fseek
fsetpos
ftell
fwrite
getc
getchar
getenv
gets
gmtime
isalnum
isalpha
iscntrl
isdigit
isgraph
islower
isprint
ispunct
isspace
isupper
isxdigit
labs
ldexp
ldiv
localeconv
localtime
log
log10
longjmp
malloc
mblen
mbstowcs
mbtowc
memchr
memcmp
memcpy
memmove
memset
mktime
modf
perror
pow
printf
putc
putchar
puts
qsort
raise
rand
realloc
remove
rename
rewind
scanf
setbuf
setjmp
setlocale
setvbuf
signal
sin
sinh
sprintf
sqrt
srand
sscanf
strcat
strchr
strcmp
strcoll
strcpy
strcspn
strerror
strftime
strlen
strncat
strncmp
strncpy
strpbrk
strrchr
strspn
strstr
strtod
strtok
strtol
strtoul
strxfrm
system
tan
tanh
time
tmpfile
tmpnam
tolower
toupper
ungetc
va_arg
va_end
va_start
vfprintf
vprintf
vsprintf
wcstombs
wctomb