Problem:


Score : 100 points

Problem Statement

You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear twice in S.

Constraints

The length of S is 4.

S consists of uppercase English letters.

Input

Input is given from Standard Input in the following format:

S

Output

If S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.

Sample Input 1

ASSA

Sample Output 1

Yes

S consists of A and S which both appear twice in S.

Sample Input 2

STOP

Sample Output 2

No

Sample Input 3

FFEE

Sample Output 3

Yes

Sample Input 4

FREE

Sample Output 4

No



Sample input:
ASSA


Sample output:
Yes

Submission status: Runtime Error

Solution code:
s = input()
ans = Felse
if s[0] == s[1] and s[2] == s[3] :
  ans = True
if s[0] == s[2] and s[1] == s[3] :
  ans = True
if s[0] == s[3] and s[0] == s[2] :
  ans = True
if ans :
  print('Yse')
else:
  print('No')

Submission status: Runtime Error

Solution code:

S=input()
hantei=False
if(len(set(S))==2):
    if(SS[0]==SS[1] and SS[0]!=SS[2]):
        hantei=True
    else:
        hantei=False
else:
    hantei=False
SS=sorted(S)

if(hantei==True):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s=input()
ans=False
if s[0]==s[1]:
    if s[0]!=s[2] and a[2]==s[3]:
        ans=True
elif s[0]==s[2]:
    if s[0]!=s[1] and s[1]==s[3]:
        ans=True
elif s[0]==s[3]:
    if s[0]!=s[1] and s[1]==s[2]:
        ans=True
if ans:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
if len(set(input()))==2:
  print('Yes')
else
  print('No')

Submission status: Runtime Error

Solution code:
if len(set(list(input())))==2:
  print('Yes')
else
  print('No')

Submission status: Runtime Error

Solution code:
if set(list(input()))==2:
  print('Yes')
else
  print('No')

Submission status: Runtime Error

Solution code:
s = input()
count_dic = {}
for a in s:
  if not a in count_dic:
    count_dic[a] = 1
  else:
    count_dic[a] += 1

  for v in count_dic.values():
    if v != 2:
      return False
  return True

Submission status: Runtime Error

Solution code:
if set(S) !== 2:
  print(No)

Submission status: Runtime Error

Solution code:
li = list(input())

flag = 'No'
for i in range(1,4):
    if li[0]==li[i]:
        del li[i],li[0]
        if li[0] == li[1]:
            flag = 'Yes'
            break

print(flag)

Submission status: Runtime Error

Solution code:
x = int(input())
z = list(map(int,input().split()))
i = 1
num = 0
while i+1 < x:
    if z[i-1] < z[i] < z[i+1]:
        num += 1
    elif z[i+1] < z[i] < z[i-1]:
        num += 1
    i += 1
print(num)

Submission status: Runtime Error

Solution code:
v = [n for n in input()];s = [n for n in input()];r = (s[0] == s[1] and s[2] == s[3]) or (s[0] == s[2] and s[1] == s[3]) or (s[0] == s[3] and s[1] == s[2]);print("Yes" if r else "No")

Submission status: Runtime Error

Solution code:
v = [int(n) for n in input()];s = [n for n in input()];r = (s[0] == s[1] and s[2] == s[3]) or (s[0] == s[2] and s[1] == s[3]) or (s[0] == s[3] and s[1] == s[2]);print("Yes" if r else "No")

Submission status: Runtime Error

Solution code:
input()
s=map(int,input().split(' '))
s=list(s)
s=sorted(s)
n=len(s)
print(s[int(n/2)]-s[int(n/2-1)])

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-

def cmb(n, r):
    if n == 0 or r == 0:
        return 1
    a = b = 1
    for i in range(1, r + 1):
        a *= i
    for i in range(n-r+1,n+1):
        b *= i
    return b//a

N = list(map(int,input().split()))
M = 10**9 + 7
red = N[0]-N[1]
for i in range(1,N[1]+1):
    x = cmb(red + 1, i) * cmb(N[1] - 1,i-1)
    print(x%M)

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-

def cmb(n, r):
    if n == 0 or r == 0:
        return 1
    a = b = 1
    for i in range(1, r + 1):
        print(r,i)
        a *= i
    for i in range(n-r+1,n+1):
        b *= i
    return b//a

N = list(map(int,input().split()))
M = 10**9 + 7
red = N[0]-N[1]
for i in range(1,N[1]+1):
    x = cmb(red + 1, i) * cmb(N[1] - 1,i-1)
    print(x%M)

Submission status: Runtime Error

Solution code:
from collections import*
n, m, *t = map(int, open(0).read().split())       
*w, s, t = [a-1for a in t]         
e = [[]for _ in range(n)]        
for u, v in zip(w[::2], w[1::2]):      
    e[u].append(v)

INF = 10**10
f = [[INF]*3for _ in range(n)]        
f[s][0] = 0        
q = deque([(s, 0)])           
while q:
    vi, j = q.popleft()         
    if vi == t and j == 0:
        print(f[vi][0]//3)
        break
    for ui in e[vi]:           
        if f[ui][(j+1)%3] < INF: continue           
        f[ui][(j+1)%3] = f[vi][j] + 1
        q.append((ui, (j+1)%3))
else:
    print(-1)

Submission status: Runtime Error

Solution code:
s = list(input())
s.sort()
if len(len(s))!=4:
  print("No")
elif s[0]==s[1] and s[2]==s[3]:
  	print("Yes")
else:
  	print("No")

Submission status: Runtime Error

Solution code:
sti = input()
up = False
down = False
for i in sti:
	if i == i.upper:
		up = True
    else:
		down = True
if up and down:
	print("Yes")
else:
  	print("No")

Submission status: Runtime Error

Solution code:
# coding: utf-8
from math import factorial
N, K = map(int, input().split())
mod = 10**9 + 7
def combination(n, r):
    if n >= r:
        return int(factorial(n) // (factorial(r) * factorial(n - r)))
    else:
        return 0

for i in range(1, K+1):
    print(combination(N-K+1, i) * combination(K-1, i-1)%mod)

Submission status: Runtime Error

Solution code:
import math
N, K = map(int, input().split(" "))
mod = 10**9 + 7
#p = (N-K+1)!*(K-1)!
p = math.factorial(N-K+1) * math.factorial(K-1)

for j in range(K):
    i = j+1
    #q=i!*(N-K+1+i)!*(K-i)!*(i-1)!
    q = math.factorial(i) * math.factorial(N-K+1-i) * math.factorial(K-i) * math.factorial(i-1)
    a=int((p/q)%mod)
    print(a)

Submission status: Runtime Error

Solution code:
    input_line = list(str(input('Put any literal: ')))
    for i in range(len(input_line)):
        for j in range(i+1,len(input_line)):
            if input_line[i] == input_line[j]:
                print('Yes')
                return
    print('No')

Submission status: Runtime Error

Solution code:
N=input()
d=list(map(int, input().strip().split()))
ans=0

for i in range(int(max(d)+1)):
    ABC=0
    ARC=0
    for j in range(int(N)):

        if d[j]<i:
            ABC+=1
        else:
            ARC+=1

    if ARC==ABC:
        ans+=1

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
P= [int(x) for x in input().split]

answer=0
for i in range(1,N-1):
  a,b,c=P[i-1:i+2]
  if b != max(a,b,c) and b!= min(a,b,c):
    answer+=1

print(answer)

Submission status: Runtime Error

Solution code:
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
// #include <boost/foreach.hpp>
// #include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
//#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};
struct edge{int to,cost;};
//typedef pair<int,int> P;

const long long MOD=1000000007LL;
bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)||islower(c));}
template<typename T> 
void print(vector<T> v){
    for(int i=0;i<v.size();i++){
        if(i)cout<<" ";
        cout<<v[i];
    }
    cout<<endl;
}

template<typename T>
void printendl(vector<T> v){
    for(auto date:v)cout<<date<<endl;
}

template<typename T>
void printvv(vector<vector<T>> v){
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v[i].size();j++){
            if(j)cout<<" ";
            cout<<v[i][j];
        }
        cout<<endl;
    }
}
int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    else return gcd(b,a%b);
}

struct Edge{
    int to;
    double cost;
};

signed main (){
    string s;cin>>s;
    sort(all(s));
    if(s[0]==s[1] and s[2]==s[3])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}
/*

*/

Submission status: Runtime Error

Solution code:
n = int(input().rstrip())
p = [int(x) for x in input().rstrip().split()]

count = 0
for i in range(1, n - 1):
    if (p[i] > p[i - 1] and p[i] < p[i + 1]) or \
        (p[i] < p[i - 1] and p[i] > p[i + 1]):
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
s = input()
listS = list(s)
sortS = listS.sort()

if listS[0] == listS[1] and listS[2] == listS[3]:
  if listS[0] != listS[2]
  	print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
#coding:utf-8
from math import factorial

N, K = map(int, input().split())
# subli = []


def P(n,r):
    return factorial(n) // factorial(n-r)

def C(n,r):
    return P(n,r) // factorial(r)


for i in range(1, K+1):
    '''
    n = N - K + i
    ans = math.factorial(n) // (math.factorial(N-K) * math.factorial(i))
    '''
    ans = C(N-K+1, i) * C(K-1, i-1)
    print(ans % (10**9 + 7))

Submission status: Runtime Error

Solution code:
s = int(input())
list = [int(n) for n in input().split()]

s_l = sorted(list)
print(s_l[s//2] - s_l[s//2 - 1])

Submission status: Runtime Error

Solution code:
import math
def c(x,y):
  if x < y or y < 0:
    return 0
  elif x == 0 or y == 0:
    return 1
  else:
    s = math.factorial(n)
    t = math.factorial(n-k)
    u = math.factorial(k)
    return s//(t*u)


n,k = map(int,input().split())

for i in range(1,k+1):
  sol = c(n-k+1,i)*c(k-1,i-1)
  m = 10**9 +7
  ans = sol%m
  print(ans)

Submission status: Runtime Error

Solution code:
import math
def c(x,y):
  if x < y or y < 0:
    return 0
  elif x == 0 or y == 0:
    return 1
  else:
    s = math.factorial(n)
    t = math.factorial(n-k)
    u = math.factorial(k)
    return s//(t*u)

n,k = map(int,input().split())
m = 10**9 +7

for i in range(1,k+1):
  sol = c(n-k+1,i)*c(k-1,i-1)
  ans = sol%m
  print(ans)

Submission status: Runtime Error

Solution code:
s = input()
t = set(s)
if len(t) != 2:
  print('No')
else:
  for char in t:
    ans = arr([(s.count(char) == 2) for char in t])
  if ans:
    print('Yes')
  else:
    print('No')

Submission status: Runtime Error

Solution code:
import random
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
A = random.choices(letters, k=4)
B = "".join(A)
print(B)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(100000)

N,K = map(int, input().split())
MOD = 10**9+7
A = N - K + 1

nCr = {}
def cmb(n, r):
    if n < r:
        return 0
    if r == 0 or r == n:
        return 1
    if r == 1:
        return n
    if (n,r) in nCr:
        return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

for i in range(K):
    print(cmb(K-1, i) * cmb(A, i+1) % MOD)

Submission status: Runtime Error

Solution code:
S = int(input())
print(S)

Submission status: Runtime Error

Solution code:
if (a[0] == a[1] and a[0] != a[2] and a[2] == a[3]) or (a[0] == a[2] and a[0] != a[3] and a[1] == a[3]) or (a[0] == a[3] and a[0] != a[1] and a[1] == a[2]):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
input_datainput()

a=input_data[0]
b=input_data[1]
c=input_data[2]
d=input_data[3]

if a==b :
    if c==d and a!=c :
            output="yes"
    
else :
        if a==c and b==d :
            output="yes"
    
        elif a==d and b==c :
            output="yes"
        
        else :
            output="no"
        
print(output)

Submission status: Runtime Error

Solution code:
S = list(input())
S.sort()
if (S[0] == S[1]) and (S[2] == S[3]):
  print(Yes)
else:
  print(No)

Submission status: Runtime Error

Solution code:
n=int(input())
data=input().split()

count=0
for i in range(1,n-1):
  if int(data[i])>int(data[i-1]) and int(data[i])<=int(data[i+1]):
    count=+1
  elif int(data[i])<int(data[i-1]) and int(data[i])>=int(data[i+1]):
    count+=1

print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
d = list(map(int,input().split()))
dunder = 0
count = 0
for i in range(max(d)):
    dunder = sum (x<i for x in d)
    if 2*dunder == len(d):
        count += 1
    elif 2*dunder > len(d):
        break
print(count)

Submission status: Runtime Error

Solution code:
data=input().split()
if data[0]==data[1] and data[2]==data[3]:
  print("Yes")
elif data[0]==data[2] and data[1]==data[3]:
  print("Yes")
elif data[0]==data[3] and data[1]==data[2]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
s=input()
s.sort()
print(s)

Submission status: Runtime Error

Solution code:
a, b, c, d = input()

string_set = set(a, b, c, d)

print("YES" if len(string_set) == 2 and not a ^ b ^ c ^ d else "NO")

Submission status: Runtime Error

Solution code:
s = int(input())
list = [int(n) for n in input().split()]

sum = 0

for i in range(1, s - 1):
    if (list[i] - list[i - 1]) * (list[i + 1] - list[i]) > 0:
        sum += 1

print(sum)

Submission status: Runtime Error

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]

NM=list(map(int,input().split()))
N=NM[0]
M=NM[1]
graph=[[] for j in range(N)]
 
for i in range(M):
  edge=list(map(int,input().split()))
  graph[edge[0]-1].append(edge[1]-1)
  
ST=list(map(int,input().split()))
S=ST[0]-1
T=ST[1]-1
 
 
 
first=[]
second=[]
third=[]
able=[S]
 
step=0
 
while True:
  first=[]
  second=[]
  third=[]
  judge = 0
  for i in range(len(able)):
    for j in range(len(graph[able[i]])):
      if not (graph[able[i]][j] in first):
        first.append(graph[able[i]][j])
  for i in range(len(first)):
    for j in range(len(graph[first[i]])):
      if not (graph[first[i]][j] in second):
        second.append(graph[first[i]][j])
  for i in range(len(second)):
    for j in range(len(graph[second[i]])):
      if not (graph[second[i]][j] in third):
        third.append(graph[second[i]][j])
  for i in range(len(third)):
      if not third[i] in able:
        able.append(third[i])
        judge = 1
  if judge == 0:
    print(-1)
    break
  step+=1
  if T in able:
    print(step)
    break

Submission status: Runtime Error

Solution code:
x = input()
 
def Combination(x):
  if x[0] == x[1]　and x[2] == x[3]:
      return "Yes"
  elif x[0] == x[2]　and x[1] == x[3]:
      return "Yes"
  elif x[0] == x[3] and x[1] == x[2]:
      return "Yes"
  else:
    return "No"
print(Combination(x))

Submission status: Runtime Error

Solution code:
x = input()

def Combination(x):
  if x[0] = x[1]:
    if x[2] = x[3]:
      return "Yes"
  elif x[0] = x[2]:
    if x[1] = x[3]:
      return "Yes"
  elif x[0] = x[3]:
    if x[1] = x[2]:
      return "Yes"
  else:
    return "No"
print(Combination(x))

Submission status: Runtime Error

Solution code:
num_input = int(input())
input_arr = [int(x) for x in input().split()]

max_input = max(input_arr)
count = 0
second_arr =[]
first_arr = []
sorted_arr = sorted(input_arr)
ans = sorted_arr[int(num_input/2)] - sorted_arr[int(num_input/2)-1]
print(ans)

Submission status: Runtime Error

Solution code:
input_ = input()

input_str = set(input_)

input_str_arr = [s for s in input_str]

if len(set(input_str_arr))==2:
    consunt()
else:
    print("No")
    

def consunt():
    if input_.count(input_str_arr[0]) and input_.count(input_str_arr[1]):
      print("Yes")
    else:
      print("No")

Submission status: Runtime Error

Solution code:
input_ = input()

input_str = set(input_)

input_str_arr = [s for s in input_str]

if input_.count(input_str_arr[0]) and input_.count(input_str_arr[1]):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
input_ = input()

input_str = set(input_)

input_str_arr = [s for s in input_str]

if input_.count(inpute_str_arr[0]) and input_.count(inpute_str_arr[0]):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a = list(input())
if len(set(a)) == 2:
  count = 0
  for r in set(a):
    if r.count(a) == 2:
      count += 1
  if count == 2:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Submission status: Runtime Error

Solution code:
S=input()

from collections import Counter

c=Counter([S[0],S[1],S[2],S[3]])

if len(list(c.keys()))==2:
    flag=True
    for key in c.keys():
        if c[key]!=2:
            flag=False:
            break

    if flag:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!

N, M = map(int,input().split())
hen = [list(map(int,input().split())) for i in range(M)]
S, T = map(int,input().split())
hen2 = []
for i in range(N):
    a = []
    for j in hen:
        if j[0]==i+1:
            a.append(j[1])
    hen2.append(a)

queue = [[S,0]]
check = []
dist = [0]

while True:
    if queue == []:
        print(-1)
        break
    Now = queue.pop(0)
    ndist = dist.pop(0)
    if Now == [T,0]:
        print(int(ndist/3))
        break
    
    check.append(Now)
    for i in hen2[Now[0]-1]:
        if [i,(Now[1]+1)%3] not in check:
            queue.append([i,(Now[1]+1)%3])
            dist.append(ndist+1)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
    string s;
    cin>>s;
    int k[27]={};
    rep(i,4){
        k[s[i]-'A']++;
    }
    rep(i,27){
        if(s[i]!=2||s[i]!=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;

    return 0;
}

Submission status: Runtime Error

Solution code:
a = input()
a = a.replace(c[0], "")
a = a.replace(c[0], "")
if len(a) == 0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s = input()
d = {}
for e in s:
  if e in d:
    d[e] += 1
  else:
    d[e] = 1

if len(d) == 2 and set(d.values()) = {2}:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
def ok(s: str): str:
    char_count = {}
    for c of s:
      if c not in char_count:
        char_count[c] = 0
      if c in char_count.keys():
        chars[c] += 1
    
    yes = all([count == 2 for count in char_count.values()])
    if yes:
      return 'Yes'
    else:
      return 'No'

Submission status: Runtime Error

Solution code:
moji = list(map(int, input().split()))

if moji[1]==moji[2] and moji[2]!= moji[3] and moji[3]==moji[0]:
    print('Yes')
elif moji[0]==moji[1] and moji[1]!= moji[2] and moji[2]==moji[3]:
    print('Yes')
elif moji[2]==moji[3] and moji[3]!= moji[0] and moji[0]==moji[1]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a = [x for x in input().split()]
if a[0] == a[1]:
    if a[0] != a[2] and a[2] == a[3]:
        print("Yes")
    else:
        print("No")
else:
    if a[0] == a[2] and a[1] == a[3]:
        print("Yes")
    elif a[0] == a[3] and a[1] == a[2]:
        print("Yes")
    else:
        print("No")

Submission status: Runtime Error

Solution code:
if S[0] == S[1] and S[2] == S[3] and S[0] == S[2]:
    print("No")
elif S[0] == S[1] and S[2] == S[3]:
  print("Yes")
elif S[0] == S[2] and S[1] == S[3]:
  print("Yes")
elif S[0] == S[3] and S[2] == S[1]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
S = input()
if S[0] == S[1] and S[2] ==S[3]:
  print("Yes")
elif S[0] == S[2] and S[1] ==S[3]:
  print("Yes")
elif S[0] == S[3] and S[2] ==S[1]:
  print("Yes")
else:
  prnt("No")

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())

def conbi(arg1, arg2):
    k=1
    l=1
    if arg2>arg1/2:
        arg2=arg1-arg2
    for i in range(arg2):
        k=k*(arg1-i)
        l=l*(i+1)
    if arg1==0:
        return 1
    else:
        return k/l
        
for o in range(1,m+1):
    print(int((conbi(n-m+1,o)%(1000000007))*(conbi(m-1,o-1)%(1000000007))))

Submission status: Runtime Error

Solution code:
haaa

Submission status: Runtime Error

Solution code:
N, K = [int(x) for x in input().split(' ')]
m = 10**9 + 7
import math
def combination(n, r):
  return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
  
n = min(K, N-K+1)
for k in range(1, n+1):
  print(combination(N-K+1, k) * combination(K-1, k-1) % m)

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;


int main()
{
    string s; cin >> s;
    sort(s.begin(), s.end());
    if(s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Submission status: Runtime Error

Solution code:
S = input()

A = S[0]
ans = 'No'

if A == S[1]:
    B = S[2]
    if B == S[4]:
        ans = 'Yes'
else:
    B = S[1]
    if A == S[2] and B == S[3]:
        ans = 'Yes'
    if B == S[2] and A == S[3]:
        ans = 'Yes'

print(ans)

Submission status: Runtime Error

Solution code:
S = list(input())
S = sorted(S)

if S[0] == S[1] and S[2] == S[3] and if S[1] != S[3]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
S = input()

from collections import defaultdict

dic = defaultdict(int)

for s in S:
    dic[s] += 1
    
if len(dic) == 2:
    for k, v in dic:
        if v == 2:
            continue
        else:
            print("No")
            exit()
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s = input()
s.sort()
cnt = 1
ans = 1
for i in range(1, 4):
  if s[i - 1] != s[i]:
    if cnt < 2:
      ans = 0
      break
    cnt = 1
  if not ans:
    break
if cnt > 2:
  ans = 0
if not ans:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
while True:
    letters = list(input())
    x = 1
    for letter in letters:
        if letters.count(letter) == 2:
            x *= 1
        else:
            x *= 0
    print(["No","Yes"][x])

Submission status: Runtime Error

Solution code:
while True:
    letters = list(input("input"))
    x = 1
    for letter in letters:
        if letters.count(letter) == 2:
            x *= 1
        else:
            x *= 0
    print(["No","Yes"][x])

Submission status: Runtime Error

Solution code:
letters = list(input())
true_false = 1
for letter in letters:
  if letters.count(letter) == 2:
    true_false　*= 1
  else:
    true_false *= 0
print(["No","Yes"][true_false])

Submission status: Runtime Error

Solution code:
letters = list(input())
a = letters[0]
if letters.count(a) == 2:
  if letters[1] == a:
    if letters[2] == letters[3]:
      print("Yes")
    else print("No")
  else:
    b = letters[1]
    if letters.count(b) == 2:
      print("Yes")
    else:
      print("No")
else:
  print("No")

Submission status: Runtime Error

Solution code:
letters = list(S)
a = letters[0]
if letters.count(a) == 2:
  if letters[1] == a:
    if letters[2] == letters[3]:
      print("Yes")
    else print("No")
  else:
    b = letters[1]
    if letters.count(b) == 2:
      print("Yes")
    else:
      print("No")
else:
  print("No")

Submission status: Runtime Error

Solution code:
return "Yes"

Submission status: Runtime Error

Solution code:
S = list(input())
return "Yes"

Submission status: Runtime Error

Solution code:
letters = list(S)
a = letters[0]
if letters.count(a) == 2:
  if letters[1] == a:
    if letters[2] == letters[3]:
      return "Yes"
    else return "No"
  else:
    b = letters[1]
    if letters.count(b) == 2:
      return "Yes"
    else:
      return "No"
else:
  return "No"

Submission status: Runtime Error

Solution code:
letters = list(S)
a = letters[0]
if letters.count(a) == 2:
  if letters[1] == a:
    if letters[2] == letters[3]:
      return "Yes"
    else return "No"
  else:
    b = letters[1]
    if letters.count(b) == 2:
      return "Yes"
    else:
      return "No"

Submission status: Runtime Error

Solution code:
S = input()
letters = list(S)
a = letters[0]
if letters.count(a) == 2:
  if letters[1] == a:
    if letters[2] == letters[3]:
      return "Yes"
    else return "No"
  else:
    b = letters[1]
    if letters.count(b) == 2:
      return "Yes"
    else:
      return "No"

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())

MOD = 10**9 +7

fact = [1]
for i in range(1,N):
    fact.append(fact[-1]*i)


def cmb(n,k):
    return (fact[n]//(fact[k]*fact[n-k]))%MOD

def f(x,y):
    if(x<0):return 0
    if(y<0):return 0
    if(x<y):return 0
    return cmb(x-1,y-1)


for i in range(1,K+1):

    print ((f(K,i))*(f(N-K,i-1)+2*f(N-K,i)+f(N-K,i+1))%MOD)

Submission status: Runtime Error

Solution code:
N = int(input())
p = list(map(int, input().split()))
count = 0


for i in range(0,N-2):
    if p[i] < p[i+1] and p[i+1] < p[i+2]:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
from scipy.special import comb, factorial

n, k = tuple(map(int, input().split(' ')))
for i in range(1, k+1):
  s = comb(k-1, i-1, exact=True) * (factorial(n-k+1, exact=True) / (factorial(n-k-i+1, exact=True) * factorial(i, exact=True)))
  print(int(s) % (10 ** 9 + 7))

Submission status: Runtime Error

Solution code:
from scipy.special import comb, factorial

try:
  n, k = tuple(map(int, input().split(' ')))
  for i in range(1, k+1):
    print(comb(k-1, i-1, exact=True) * (factorial(n-k+1, exact=True) // (factorial(n-k-i+1, exact=True) * factorial(i, exact=True))) % (10 ** 9 + 7))
except Exception as e:
  print(e)

Submission status: Runtime Error

Solution code:
input_str = input()
items = set(list(input_str)
return 'Yes' if len(items) == 2 and len(list(input_str.replace(list(items)[0], ''))) == 2 else 'No'

Submission status: Runtime Error

Solution code:
from math import factorial

def count_pattern(n, r):
    if r == 0:
        return 1
    else:
        a = factorial(n) // factorial(r) // factorial(n - r)
    return int(a)

n, k = map(int, input().split())

for i in range(k):
    pick_count = i + 1

    blue_pattern =  count_pattern(k - 1, pick_count - 1)
    red_pattern = count_pattern(n - k + 1 , pick_count)
    total_pattern = blue_pattern * red_pattern
    print (int(total_pattern % (10 ** 9 + 7)))

Submission status: Runtime Error

Solution code:
from math import factorial
n,k = map(int, input().split())
mod = 10**9+7
def comb(n,r):
    return factorial(n) // (factorial(r) * factorial(n - r))
# a = comb(n, r)
for i in range(1,k+1):
    if n -k + 1 >= i :
        a = comb(n-k+1,i)
        b = comb(k-1,i-1)
        print((a*b)%mod)
    else:
        print(0)

Submission status: Runtime Error

Solution code:
s=list(input())
s1=s[0]
sf=s.count(s1)
for i in range(sf):
  s.remove(s1)
if s[0]==s[1]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
s=list(map(int,input().split()))
s1=s[0]
sf=s.count(s1)
for i in range(sf):
  s.remove(s1)
if s[0]==s[1]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import math

def nCr(n,r):
    f = math.factorial
    return int(f(n) / f(r) / f(n-r))

def nHk(n, k):
    f = math.factorial
    return int(f(n + k - 1) // f(k) // f(n - 1))

N, K = map(int, input().split())
MOD = 10 ** 9 + 7

for i in range(1, K + 1):
#   print('i: ' + str(i))
    # 青玉をi個のグループに並べる並べ方
    blue = 1
#    if i == 1:
#        blue = 1
#    else:
#        blue = nCr(K - 1, i - 1)
#    print('blue: ' + str(blue))
    # 青い玉に合わせた赤い玉の並べ方
    if (N - K) < (i - 1):
        red = 0
#        print('red0: ' + str(red))
    elif i == 1:
        red = (N - K) + 1
#        print('red1: ' + str(red))
    else:
        red = nCr(K - 1, i - 1) * nHk(i + 1, N - K - (i - 1))
#        print('nCr: ' + str(nCr(K - 1, i - 1)))
#        print('nHk: ' + str(nHk(i + 1, N - K - (i - 1))))
#        print('red2: ' + str(red))

    # 解は青の並べ方と赤の並べ方の組み合わせ
    ans = blue * red % MOD
#    print(ans)
    print('ans: ' + str(ans))

Submission status: Runtime Error

Solution code:

N,K = map(int,input().split(' '))
MOD = 10**9 + 7

n = N-K+1
print(n)
for i in range(2,K+1):
	n = (n * (N-K+2-i) * (K-i+1) // (i * (i-1)))
	print(n % MOD)

Submission status: Runtime Error

Solution code:
from sys import stdin
from math import factorial

if __name__ == '__main__':

    N, K = [int(x) for x in stdin.readline().rstrip().split()]

    tmp = 1000000007
    r = 0
    while True:
        r += 1
        n = N - K + 1

        if n - r < 0:
            break

        ret = factorial(n) // factorial(r) // factorial(n - r)
        ret2 = factorial(K-1) // factorial(r-1) // factorial((K - 1) - (r - 1))

        print((ret * ret2) % tmp)

Submission status: Runtime Error

Solution code:
#coding:utf-8
N = int(input())
D = list(map(int,input().split()))
D = sorted(D)
idx = len(D) // 2
print(D[idx] - D[idx-1])

Submission status: Runtime Error

Solution code:
import math
n,k=map(int,input().split()) 
lst=list()

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1, k+1):
    if n-k>i:
        lst.append(combinations_count(n-k+1, i) * combinations_count(k-i+(i-1), i-1))  
    elif n-k==i:
        lst.append(combinations_count(K-1,i-1))
    else:
        lst.append(int(0))

for i in range(k):
    print(lst[i]%(10**9+7))