akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void) {
	int k, s;

	scanf("%d %d", &k, &s);

	int cnt = 0;
	for (int i = 0; i <= k; i++) {
		for (int j = 0; j <= k; j++) {
			if (0 <= s-i-j && s - i - j <= k) {
					cnt++;
			}
		}
	}
	printf("%d\n", cnt);

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int ans=0;
  for(int i=0; i<S.size()-1; i++){
    if(S.size()==0) break;
    if(S[i]=='0' && S[i+1]=='1'
      ||S[i]=='1' && S[i+1]=='0'){
      S.erase(S.begin()+i, S.begin()+i+2);
      i-=2;
      ans+=2;
    }
    if(i==-2) i++;
//        cout<<"i:"<<i<<" S:"<<S.size()<<endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long int
#define li long int
#define ull unsigned long long int
#define mci map<char,int>
#define db double
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define msi map<string,int>
#define pii pair<int,int>
#define mii map<int,int>
#define vs vector<string>
#define nl "\n"
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    int c=x,t=0,flag=0;
    while(c>=0)
    {
        if(2*c+4*t-y==0)
        {
            flag=1;
            break;
        }
        t++;
        c=x-t;
    }
    cout<<((flag==0)?"No":"Yes");
}

Measured memory_bytes: 3588
#include<iostream>
#include<stack>
#include<vector>
#include<utility>
#include<algorithm>
#define MP make_pair
using namespace std;
typedef pair<int, int> P;

/*
int start[100005];
int _end[100005];
vector<int> connect[100005];

int main() {
    int N, M, a, b, stock = 0, count = 0;
    stack<int> S;
    cin >> N >> M;
    for (int i = 0; i < N; i++) {
        start[i] = 0;
        _end[i] = 0;
    }
    for (int i = 0; i < M; i++) {
        cin >> a >> b;
        a--;
        b--;
        start[a]++;
        _end[b]++;
        connect[a].push_back(b);
    }
    for (int i = 0; i < N; i++) {
        if (_end[i] != 0 && stock != 0) {
            count++;
            stock = 0;
            while (!S.empty()) {
                int now = S.top();
                S.pop();
                for (int j = 0; j < connect[now].size(); j++) {
                    _end[connect[now][j]]--;
                }
            }
        }
        if (connect[i].size() > 0) {
            S.push(i);
        }
        if (start[i] != 0) {
            stock += start[i];
        }
    }
    cout << count << endl;
    return 0;
}
*/

P connect[100005];

int main() {
    int N, M, a, b, count = 0;
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> a >> b;
        connect[i] = MP(b, a);
    }
    sort(connect, connect + M);
    int pos = -1;
    for (int i = 0; i < M; i++) {
        if (pos <= connect[i].second) {
            count++;
            pos = connect[i].first;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h> 
using namespace std; 
int main(){ 
    int N, ans = 0;
    cin >> N; 
    vector<int> V(N), C(N), dif(N);
    for(int i = 0; i < N; i++) 
    {
          cin >> V.at(i);
    }
    for(int i = 0; i < N; i++) 
    {
          cin >> C.at(i);
          dif.at(i) = V.at(i) - C.at(i);
          if(dif.at(i) > 0) ans += dif.at(i);
          else continue;
    }
    cout << ans << endl;
    }

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<math.h>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;
typedef long long ll;

int main(){
   int n, q;
   cin >> n >> q;
   vector<int> ans(n+1);
   string s;
   cin >> s;
   rep(i,n-1){
      ans[i+1] = s[i] == 'A' && s[i+1] == 'C'? ans[i]+1: ans[i];
   }
   rep(i,q){
      int l, r;
      cin >> l >>  r;
      l--; r--;
      cout << ans[r] - ans[l] << endl;
   }
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int n;
  cin >> n;

  int h[n] = {};
  for(int i=0;i<n;i++){
    cin >> h[i];
  }
  
  for(int i=n-1;i>0;i--){
    if(h[i]-h[i-1]<-1){
      cout << "No" << endl;
      return 0;
    }
    else if(h[i]-h[i-1]==-1){
      h[i-1]--;
    }
  }
  cout << "Yes" << endl;
  return 0;
}



Measured memory_bytes: 4072
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String c1 = scan.next();
		String c2 = scan.next();
		String message = "NO";
		if((c1.charAt(0) == c2.charAt(2)) &&
				(c1.charAt(1) == c2.charAt(1)) &&
				(c1.charAt(2) == c2.charAt(0))) {
			message = "YES";
		} 
		System.out.println(message);
	}
}

Measured memory_bytes: 24916
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int a[3500];

bool check(int a,int p)
{

    return bool(a&(1<<p));
}
int on(int a,int p)
{

    return (a|(1<<p));
}

void seive()
{

 int mx=sqrt(100000);
 for(int i=3;i<=mx;i+=2)
 {
     if(!check(a[i/32],i%32))
     for(int j=i*i;j<=1e5;j+=i*2)
     {
         a[j/32]=on(a[j/32],j%32);



     }
 }









}





int ans[100010];

int main()
{

  seive();
  int n;
  cin>>n;


  for(int i=3;i<=1e5;i+=2)
  {

      int x=(i+1)/2;
      if(!(x&1) && x!=2)
        continue;
      if(!check(a[i/32],i%32) && !check(a[x/32],x%32))
      {
          ans[i]=1;

      }
  }
  for(int i=2;i<=1e5;i++)
  {

      int x=ans[i];
      int y=ans[i-1];
      x+=y;
      ans[i]=x;



  }

  while(n--)
  {
      int l,r;
      scanf("%d%d",&l,&r);
      printf("%d\n",ans[r]-ans[l-1]);

  }
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;

set<ll> checkIncrease(vll &P, ll K){
    ll N = P.size();
    ll s =0, t = 0;
    set<ll> res;
    while(s < N){
        while(t + 1 < N){
            if(P[t+1] > P[t]) t++;
            else break;
        }
        if(t - s >= K-1){
            for(ll i=s; i+K-1 <= t; i++ )
                res.insert(i);
        }
        s = t+1;
        t = s;
    }
    return res;
}

void solve(long long N, long long K, std::vector<long long> P){
    set<ll> R;
    REP(i, K - 1) R.insert(P[i]);
    ll cnt = 0;
    auto tmp = checkIncrease(P, K);
    REP(i, N - K){
        R.erase(P[i]);
        R.insert(P[i+K-1]);
        if(P[i] < *R.begin() && P[i + K] > *R.rbegin())
            continue;
        if(tmp.count(i)) continue;
        cnt ++;
    }
    if(!tmp.count(N-K)) cnt++;
    cout<<cnt + (tmp.empty()? 0: 1)<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> P(N-1-0+1);
    for(int i = 0 ; i < N-1-0+1 ; i++){
        scanf("%lld",&P[i]);
    }
    solve(N, K, std::move(P));
    return 0;
}


Measured memory_bytes: 11136
A, B = gets.chomp.split(" ")

DECK = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1].map(&:to_s)

if DECK.find_index(A) == DECK.find_index(B) then
  puts "Draw"
elsif DECK.find_index(A) > DECK.find_index(B) then
  puts "Alice"
else
  puts "Bob"
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S;
  cin >> S;

  if(S == "Sunny"){
    cout << "Cloudy" << endl;
  }
  else if(S == "Cloudy"){
    cout << "Rainy" << endl;
  }
  else{
    cout << "Sunny" << endl;
  }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long li;


class UnionFind {
    vector<int> parent;
    vector<int> rank;

public:
    UnionFind(int n){
        parent = vector<int>(n, -1); // parent[i] = -1 -> i is root.
        rank = vector<int>(n, 0);
    }

    int find(int n){
        vector<int> path;
        while(parent[n]!=-1){
            path.push_back(n);
            n = parent[n];
        }
        for(vector<int>::iterator it = path.begin(); it != path.end(); it++){
            parent[*it] = n;
            rank[*it] = 0;
        }
        return n;
    }

    void unify(int x, int y){
        int rx = find(x), ry = find(y);
        if(rx == ry) return;

        if(rank[rx] < rank[ry]){
            parent[rx] = ry;
        } else {
            parent[ry] = rx;
            if(rank[rx] == rank[ry]) rank[rx]++;
        }
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    li n, m;
    cin >> n >> m;
    UnionFind uf(n);
    for (int i = 0; i < m; ++i) {
        li a, b;
        cin >> a >> b;
        a--; b--;
        uf.unify(a, b);
    }

    map<li, li> cnt;
    for (int i = 0; i < n; ++i) {
        cnt[uf.find(i)]++;
    }

    li ans = 1;
    for (auto c : cnt) {
        ans = max(ans, c.second);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 17160
n=int(input())
A=list(map(int,input().split()))

m=max(A)

X=[0]*(m+1)

A.sort()

for i in range(n):
    for j in range(A[i],m+1,A[i]):
        X[j]+=1

ans=0

for i in range(n):
    if X[A[i]]==1:
        ans+=1
print(ans)

Measured memory_bytes: 116684
import bisect

N = int(input())
S = input()
Q = int(input())

# 現時点でどこに何があるか
cS = [""] * N
# ある文字の位置
char_idxs = [[]for _  in range(26)]

# i番目は文字s、を保存
for i,s in enumerate(S):
    cS[i] = s
    char_idxs[ord(s) - 97].append(i)

query = [tuple(map(str, input().split())) for _ in range(Q)]




for q,a,b in query:
    
    # q == 1の時、a番目の文字をbに置き換え
    if q == "1":
        # 現時点の文字と置き換え後が同じなら何もしない
        if cS[int(a) - 1] == b:
            continue
        else:
            #print("---", char_idxs[ord(cS[]) - 97], int(a)-1, bisect.bisect_right(char_idxs[ord(b) - 97], int(a)-1))
            # a番目の文字を書き換える

            
            idx = bisect.bisect_right(char_idxs[ord(cS[int(a)-1]) - 97], int(a)-1)
            # idxの左の値がa番目であれば、それを消す
            if char_idxs[ord(cS[int(a)-1]) - 97][idx-1] == int(a)-1:
                # delの方が早いか？
                char_idxs[ord(cS[int(a)-1]) - 97][idx-1:idx] = []
            
            # bの文字がa番目にあるよ、を保存
            bisect.insort_right(char_idxs[ord(b) - 97], int(a) - 1)

            # 置き換え
            cS[int(a) - 1] = b

    # q == 2の時、範囲の文字種の個数を調べる
    else:
        cnt = 0
        for i in range(26):
            # そもそもその文字が文字列全体になければ考えない
            if len(char_idxs[i]) == 0: continue
            # bisect_leftで a-1 を入れられる場所を探して、その時に右にある値がb-1以下であれば含まれる
            l = bisect.bisect_left(char_idxs[i], int(a)-1)
            #r = bisect.bisect_right(char_idxs[i], int(b)-1)

            # char_idxs[i][l]はa-1より右に文字種iが初めて出てくる位置なので、それがb-1を含む右側にあればOK
            if l < len(char_idxs[i]) and char_idxs[i][l] <= int(b)-1:
                cnt += 1

        print(cnt)




Measured memory_bytes: 32856
#! python3
# sorting_three_numbers.py

nums = [int(x) for x in input().split()]

sorted_nums = []
sorted_nums.append(nums[0])

if nums[1] <= sorted_nums[0]:
    sorted_nums.insert(0, nums[1])
else:
    sorted_nums.append(nums[1])

if nums[2] <= sorted_nums[0]:
    sorted_nums.insert(0, nums[2])
elif nums[2] > sorted_nums[-1]:
    sorted_nums.append(nums[2])
else:
    sorted_nums.insert(1, nums[2])

print(' '.join([str(x) for x in sorted_nums]))



Measured memory_bytes: 5608
#include <stdio.h>

int main(void){
    int n;
    char str[10];
    int k;
    char t;
    int i;

    scanf("%d",&n);
    scanf("%s",str);
    scanf("%d",&k);

    k--;

    t = str[k];
    
    for(i = 0;i < n;i++){
        if(str[i] != t){
            str[i] = '*';
        }
    }

    printf("%s",str);

    return 0;
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

int n,m;
int win[10]={0},los[10]={0},A[10][10]={0};

long long dfs(int x,int y){
    if(x==n){
        for(int i=0;i<n;++i){
            if(win[i]>n/2||los[i]>n/2){
                return 0;
            }
        }
        return 1;
    }
    if(y==n){
        return dfs(x+1,x+2);
    }
    if(A[x][y]==0){
        long long z=0,w=0;
        if(win[x]<n/2){
            win[x]++;
            los[y]++;
            z=dfs(x,y+1);
            win[x]--;
            los[y]--;
        }
        if(los[x]<n/2){
            los[x]++;
            win[y]++;
            w=dfs(x,y+1);
            los[x]--;
            win[y]--;
        }
        return z+w;
    }
    else{
        return dfs(x,y+1);
    }
}

int main(){
    while(true){
        cin>>n;
        if(n==0){
            return 0;
        }
        cin>>m;

        int x,y;
        for(int i=0;i<n;++i){
            for(int j=0;j<n;++j){
                A[i][j]=0;
            }
            win[i]=0;
            los[i]=0;
        }

        for(int i=0;i<m;++i){
            cin>>x>>y;
            win[x-1]++;
            los[y-1]++;
            A[x-1][y-1]++;
            A[y-1][x-1]--;
        }
        long long ans=dfs(0,1);
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3108
import java.util.*;

public class Main{
  public static void main(String[] args){
    int n,avg=0,max=0,min=0,num;
    Scanner sc = new Scanner(System.in);
    while((n = sc.nextInt()) != 0){
      avg=0;
      for(int i=0;i<n;i++){
        num = sc.nextInt();
        avg += num;
        if(i==0){
          max = num;
          min = num;
        }else{
          if(num > max)max=num;
          if(num < min)min=num;
        }
      }
      avg -= (min+max);
      avg /= (n-2);
      System.out.println(avg);
    }
    sc.close();
  }
}



Measured memory_bytes: 28448
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int A, B;
  cin >> A >> B;
  if(A >= 13 ){
    cout << B << endl;
  }else if(A >= 6){
    cout << B/2 << endl;
  }else{
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;

int main(){
  int n, ret=0;
  map<int, int>C;
  cin >> n;
  for(int i=0; i<n; i++){
    int tmp;
    cin >> tmp;
    C[tmp]++;
  }
  for(pair<int, int>p:C){
    if(p.first<=p.second)ret+=(p.second-p.first);
    else ret+=p.second;
  }
  cout << ret;
  return 0;
}

Measured memory_bytes: 4736
a, b, c, k = gets.split.map(&:to_i)
sum = 0
count = k
if count-(a+b)>0
  sum=a
  sum= sum+(count-(a+b))*(-1)
else
  if count-a>0
    sum=a
  elsif count-a==0
    sum=a
  else
    sum=k
  end
end
puts sum


Measured memory_bytes: 14408
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }

int main() {
    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    if(k%2)cout << -(a-b) << endl;
    else cout << a-b << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
//all possible//
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,c;
vector<long long> v;
cin>>a>>b>>c;
v.push_back(a);
v.push_back(b);
v.push_back(c);
sort(v.begin(),v.end());
cout<<v[0]+v[1];
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <math.h>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

#define rep(i, n) for(int i = 0; i < n; i++)

bool taro[300];
bool used[300];

int main(){
	int n;
	while(cin >> n && n){
		memset(taro, false, sizeof(taro));
		memset(used, false, sizeof(used));
		for(int i = 0;i < n; i++){
			int num;
			cin >> num;
			taro[num] = true;
		}
		
		int trest = n;
		int hrest = n;
		bool turn = true;
		int last = 0;
		while(trest && hrest){
			bool ok = false;
			if(turn){
				for(int i = last + 1; i <= 2 * n; i++){
					if(taro[i] && !used[i]){
						used[i] = true;
						trest--;
						last = i;
						ok = true;
						break;
					}
				}
			}else{
				for(int i = last + 1; i <= 2 * n; i++){
					if(!taro[i] && !used[i]){
						used[i] = true;
						hrest--;
						last = i;
						ok = true;
						break;
					}
				}
			}
			if(!ok) last = 0;
			turn = !turn;
		}
		cout << hrest << endl;
		cout << trest << endl;
	}
	return 0;
}

Measured memory_bytes: 0
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

bool isTrue(string in1, string in2)
{
	int a = in2.size();
	int b = in1.size();
	if (a-b != 1)
	{
		return false;
	}

	for (int i = 0; i < in1.length(); i++)
	{
		if (in1[i] != in2[i])
			return false;
	}
	return true;
}

int main()
{
	int a = 0;
	int b = 0;
	int c = 0;
	int k = 0;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> k;
	int output = 0;

	if (a >= k)
	{
		output = k;
	}
	else if (a + b >= k)
	{
		output = a;
	}
	else
	{
		int cPrime = k - a - b;
		output = a - cPrime;
	}
		
	cout << output << endl;
	return 0;
}

Measured memory_bytes: 3644
#include <iostream>
using namespace std;

int main(){
	int a,b;
	for(int i=1;i>=1;i++){
		cin>> a >> b;
		if((a==0)&&(b==0)){
		    break;
		}
		for(int i=0;i<a;i++){
			for(int j=0;j<b;j++){
			    if((i+j)%2==0){
				    cout << "#";
			    }else{
			        cout << ".";
				}
		    }
		    cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 1152
mod = 998244353
n = int(input())
d = list(map(int, input().split()))
if d[0] != 0:
    print(0)
    exit()
lis = [0] * n
for i in d:
    lis[i] += 1
if lis[0] != 1:
    print(0)
    exit()
ans = 1
for i in range(1, n):
    ans *= pow(lis[i-1], lis[i], mod)
    ans %= mod
print(ans)

Measured memory_bytes: 53300
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9, MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
	int x, y, ans = INF + 100000;
	cin >> x >> y;
	if (x <= y) {
		ans = min(ans, y - x);
	}
	if (-x <= y) {
		ans = min(ans, x + y + 1);
	}
	if (x <= -y) {
		ans = min(ans, (-y) - x + 1);
	}
	if (-x <= -y) {
		ans = min(ans, (-y) - (-x) + 2);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

if max(c) < 0:
    print(max(c))
    exit()

loop_list = []
visited = [False]*n
d = deque()
for start in range(n):
    if visited[start]:
        continue
    loop = [start]
    d.append(start)
    visited[start] = True
    while True:
        now = d.pop()
        next = p[now]
        d.append(next-1)
        if visited[next-1]:
            loop_list.append(loop)
            break
        else:
            visited[next-1] = True
            loop.append(next-1)
#print(loop_list)

ans = 0
for loop in loop_list:
    len_loop = len(loop)
    S = sum(c[v] for v in loop)
    for a in range(len_loop):
        dist_ab = 0
        cost_ab = -c[loop[a]]
        for b in range(a, a+len_loop):
            b %= len_loop
            cost_ab += c[loop[b]]
            max_cost = cost_ab + max(0, S)*((k-dist_ab)//len_loop)
            ans = max(ans, max_cost)
            dist_ab += 1
            if dist_ab > k:
                break
print(ans)








Measured memory_bytes: 75284
#include <bits/stdc++.h>
using namespace std;

//#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

signed main() {
    int n; cin >> n;
    set<string> s;
    rep(i,n) {
        string a; cin >> a;
        s.insert(a);
    }
    cout << s.size() << endl;
}

Measured memory_bytes: 19276
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;

const int MAX = 500001;
const int NIL = -1;
struct Node {
	int key;
	Node* parent, * left, * right;
};
struct Node T[MAX];
Node* head = NULL;

Node* getSuccessor(Node* x);
Node* Find(Node* x, int k);
Node* getMinimun(Node* x);
void deleteNode(int key);
void inParse(Node* u);
void preParse(Node* u);

int main(void)
{
	int n, key;
	char ss[10];
	cin >> n;
	memset(ss, 0, sizeof(ss));
	for (int i = 0; i < n; i++) {
		scanf("%s", ss);
		if (ss[0] == 'i') {
			cin >> key;
			Node* y = NULL, * x = head, * z = new(Node);
			z->key = key;
			z->left = z->parent = z->right = NULL;
			while (x != NULL) {
				y = x;
				if (z->key < x->key)
					x = x->left;
				else
					x = x->right;
			}
			z->parent = y;
			if (y == NULL)
				head = z;
			else if (z->key < y->key)
				y->left = z;
			else
				y->right = z;
		}
		else if (ss[0] == 'f') {
			cin >> key;
			if (Find(head, key))
				cout << "yes" << endl;
			else
				cout << "no" << endl;
		}
		else if (ss[0] == 'd') {
			cin >> key;
			deleteNode(key);
		}
		else {
			inParse(head);
			cout << endl;
			preParse(head);
			cout << endl;
		}
	}
	return 0;
}

Node* Find(Node* x, int k)
{
	while (x != NULL && k != x->key) {
		if (k < x->key)
			x = x->left;
		else
			x = x->right;
	}
	return x;
}

void deleteNode(int key)
{
	Node* z = Find(head, key), * y, * x;
	if (z->left == NULL || z->right == NULL)
		y = z;
	else
		y = getSuccessor(z);

	if (y->left != NULL)
		x = y->left;
	else
		x = y->right;

	if (x != NULL)
		x->parent = y->parent;

	if (y->parent == NULL)
		head = x;
	else if (y == y->parent->left)
		y->parent->left = x;
	else
		y->parent->right = x;

	if (y != z)
		z->key = y->key;
}

Node* getMinimun(Node* x)
{
	while (x->left != NULL)
		x = x->left;
	return x;
}

Node* getSuccessor(Node* x)
{
	if (x->right != NULL)
		return getMinimun(x->right);
	Node* y = x->parent;
	while (y != NULL && x == y->right) {
		x = y;
		y = y->parent;
	}
	return y;
}

void preParse(Node* u)
{
	if (u == NULL)
		return;
	cout << " " << u->key;
	preParse(u->left);
	preParse(u->right);
}

void inParse(Node* u)
{
	if (u == NULL)
		return;
	inParse(u->left);
	cout << " " << u->key;
	inParse(u->right);
}


Measured memory_bytes: 21904
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
# debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    N = II()
    a_list = LI()

    from operator import itemgetter

    import numpy as np
    A = np.array(a_list)
    arga = np.argsort(A)
    ind = np.array(list(range(N)))

    print(' '.join([str(a+1) for a in ind[arga]]))

solve()

Measured memory_bytes: 25452
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<long long,long long> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
 
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

//long long A,B;
bool ok(long long key,long long index){
    if(index > key) return true;
    else if(index <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    int N,K;cin >> N >> K;
    vector<int> retu(N);
    for(int i = 0;i<N;i++)cin >> retu.at(i);
    int ans = 0;
    N -= K;
    ans++;
    ans += N/(K-1);
    if(N%(K-1) != 0){
        ans++;
    }

    cout << ans << endl;

    // PLEASE GIVE ME THE "ACCEPTED" !
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll n,m; cin>>n>>m;
	vl v(m);
	rep(i,0,m)cin>>v[i];
	sort(all(v));
	vl a(m-1);
	rep(i,0,m-1){
		a[i]=v[i+1]-v[i];
	}
	sort(all(a));
	ll ans=0;
	rep(i,0,m-n){
		ans+=a[i];
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 4636
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();

		if(n == m) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define for1(i, a, b) for(i = a; i <= b; ++i)
#define for0(i, a, b) for(i = a; i < b; ++i)
#define forw1(i, a, b) for(i = a; i >= b; --i)
#define forw0(i, a, b) for(i = a - 1; i >= b; --i)
#define fora(v, a) for(auto v : a)
#define bp __builtin_popcount
#define bpll __builtin_popcountll

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int modd1 = 1e9 + 7, modd2 = 998244353, maxn = 1e5 + 10, K = 26, inf = 1e9, infll = 1e18;
const double pi = acos(-1);
int n, k, m, val[maxn];
vi gr[maxn];
priority_queue<ii> pq;

void solve(){
	int i, j, l, r;
	cin >> n;
	for1(i, 1, n - 1){
		int a, b; cin >> a >> b;
		gr[a].pb(b); gr[b].pb(a);
	}
	cin >> k;
	for1(i, 1, n){
		val[i] = -infll;
	}
	for1(i, 1, k){
		int u, p; cin >> u >> p;
		val[u] = p;
		pq.push(mp(p, u));
	}
	bool ok = 1;
	while(pq.size()){
		int p = pq.top().fi, v = pq.top().se; pq.pop();
		fora(x, gr[v]){
			if(val[x] != -infll){
				if(abs(val[x] - p) != 1){
					ok = 0; 
				}
				continue;
			}
			val[x] = p - 1;
			pq.push(mp(val[x], x));
		}
	}
	if(!ok){
		cout << "No\n"; return;
	}
	else{
		cout << "Yes\n";
		for1(i, 1, n){
			cout << val[i] << '\n';
		}
	}
}

signed main() {
    //freopen(".INP", "r", stdin);
    //freopen(".OUT", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
}


Measured memory_bytes: 12368
#include <iostream>
using namespace std;

void call(int n)
{
	int i = 1;
	do
	{
		int x = i;
		if(x % 3 == 0)
		{
			cout << " " << i;
		}
		else
		{
			do
			{
				if(x % 10 == 3)
				{
					cout << " " << i;
					break;
				}
				x /= 10;
			}while(x != 0);
		}
		
		++i;
	}while(i <= n);
	
	cout << endl;
}

int main()
{
	int N;
	cin >> N;
	call(N);

    return 0;
}



Measured memory_bytes: 3084
#include<bits/stdc++.h>
 #include<vector>
 using namespace std;

 int main() {
   int n;
   cin >> n;
   bool a = true;
     for (int i = 0; 4* i <= n ; i++) {
       if (a) {
         for (int j = 0; 7* j <= n; j++) {
           if (4* i + 7* j == n) {
             a = false;
             break;
           }
         }
      }
    }

    if (a) {
      cout << "No" << "\n";
    }else{
      cout << "Yes" << "\n";
    }
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  long cnt = 0;
  map<string,long> a;
  for(int i = 0; i < n; i++){
    string s; cin >> s;
    sort(s.begin(), s.end());
    //cout << s << endl;
    if(a.count(s)){
      cnt += a[s];
      a[s]++;
    }
    else
      a[s] = 1;
  }
  cout << cnt;
}
      

Measured memory_bytes: 11420
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<algorithm>
#include<deque>
#include<queue>
#include<set>
#include<map>
#include<functional>

using namespace std;
#define LL long long
#define ALF "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define LLBIG 1999999999999999999LL
#define INTBIG 1111111111
#define MOD 1000000007
#define PI pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>


LL A, B, C, N, ans = 0;//Aa*Bb*Cc=N

int main() {
	cin >> A >> B >> C >> N;
	int tmp = 0;
	while (tmp <= N) {
		int _tmp = 0;
		while (tmp + _tmp <= N) {
			if ((N - tmp - _tmp) % C == 0)ans++;
			_tmp += B;
		}
		tmp += A;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;

typedef long double lld;

#define REP(i,n) for(int i=0;i<n;i++)
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))

int N, M;
int k[20];
int s[20][20];
int p[20];

int main()
{
	cin >> N >> M;
	for (int i = 0; i < M; i++)
	{
		cin >> k[i];
		for (int j = 0; j < k[i]; j++)
		{
			cin >> s[i][j];
		}
	}
	for (int i = 0; i < M; i++)
	{
		cin >> p[i];
	}

	//bit
	int tmp = 1;
	REP(i, N)
	{
		tmp *= 2;
	}

	int ans = 0;

	for (int i = 0; i < tmp; i++)
	{
		int okLump = 0;
		bool lump[20] = {};
		int tmp3 = i;
		//ランプがついてたらtrueを入れる
		for (int m = 0; m < N; m++)
		{
//			cout << tmp3 % 2 << endl;

			if (tmp3 % 2 == 1)
			{
				lump[m] = true;
			}
			tmp3 /= 2;
		}

		//まず電球の状態を確定
		//次のループは全ての電球にたいしてスイッチの入り方を調べる

		for (int j = 0; j < M; j++)
		{
			int swch = 0;
			//さらにある一つの電球に対してスイッチがいくつはいってるか調べる
			//入ってる数 % 2 = p[j]なら点灯
			for (int l = 0; l < k[j]; l++)
			{
				
				if (lump[s[j][l] - 1] == true)
				{
					swch++;
				}
//				cout << s[j][l] - 1 << endl;
			}
//			cout << endl;
			if (swch % 2 == p[j])
			{
				okLump++;
			}
		}
		if (okLump == M)
		{
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
using namespace std;
using ll = long long;
int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
	//ll n, m, h, w;
	//cin >> x;
	string s;
	cin >> a;
	ll x[1000] = {};
	ll y[1000] = {};
	ll z[1000] = {};
	for (int i = 0; i < a; i++)
	{
		cin >> x[i];
		cin >> y[i];
		cin >> z[i];
	}

	for (ll i = 0; i <= 100; i++)
	{
		for (ll k = 0; k <= 100; k++)
		{
			c = 1;
			for (int h = 0; h < a; h++)
			{
				if ( z[h] > 0)
				{
					b = z[h] + abs(x[h] - k) + abs(y[h] - i);
					break;
				}
			}
			for (ll h = 0; h < a; h++)
			{
				//if (z[h] - abs(x[h] - k) - abs(y[h] - i) < 0 && z[h] > 0)
				if (b - abs(x[h] - k) - abs(y[h] - i) < 0 && z[h] > 0)
				{
					c = 0;
					break;
				}
				if (b - abs(x[h] - k) - abs(y[h] - i) < 0 && z[h] == 0)
				{

				}
				else if (b != z[h] + abs(x[h] - k) + abs(y[h] - i))
				{
					c = 0;
					break;
				}
				//				cout << z[h] - abs(x[h] - k) - abs(y[h] - i) << endl;
			}
			if (c == 1)
			{
				for (int h = 0; h < a; h++)
				{
					if (z[h] > 0)
					{
						cout << k << " " << i << " " << z[h] + abs(x[h] - k) + abs(y[h] - i) << endl;
						return 0;

					}
				}
			}
		}
	}


	//cout << sum << endl;
	//cout <<  endl;
	return 0;
}

//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}




//
//ll insuusyurui[1000] = {};
//ll insuukazu[1000] = {};
//ll memo[4000] = {};
//ll memo2[4000] = {};
//cin >> n;
//cin >> m;
//a = 2;
//// √n ≧ a ( n ≧ a * a ) の間ループ処理
//while (n >= a * a) {
//	// a で割り切れたら、a は素因数
//	// そして、割られる数を a で割る
//	// a で割り切れなかったら、 a を 1 増加させる
//	if (n % a == 0) {
//		printf("%lld * ", a);
//		insuukazu[c]++;
//		n /= a;
//	}
//	else {
//		a++;
//		//if (insuukazu[c] != 0)
//		{
//			c++;
//			//cout << c << endl;
//
//		}
//	}
//}
//printf("%lld\n", n);
//for (int i = 0; i < c; i++)
//{
//	//cout << insuukazu[i] << endl;
//}
//
//cout << "Yes" << endl;

Measured memory_bytes: 256
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;
 
#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  f              first                 
#define  s              second
#define  endl           "\n"
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";cout<<endl;
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<endl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;            
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  unordered_map<ll,ll>  um;
typedef  vector<pll>           vpll;
 
const ll   N     =  5e5+5;
const ll   mod   =  1e9+7;
const ll   INF   =  1e18;
const int  INFi  =  0x7f7f7f7f;

ll test = 1, n, m, f[N];

void solve(){
    cin>>n;
    deb1((1000-n%1000)%1000)
}

int main(){
    fastio;
    //cin>>test;
    for(int i = 1; i <= test; i++){
        solve();
    }
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

int main(){
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);

	ll n;cin >> n;
	REP(i, 10){
		REP(j, 10){
			if(i*j == n){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
S = list(input())
ans = 'No'
if (S[0] == S[1] and S[0] != S[2] and S[2] == S[3]) or (S[0] == S[2] and S[0] != S[1] and S[1] == S[3]) or (S[0] == S[3] and S[0] != S[1] and S[1] == S[2]):
    ans = 'Yes'
print(ans)

Measured memory_bytes: 9032
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t <decltype (b), decltype (e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FORR(i,b,e) for (common_type_t <decltype (b), decltype (e)> i = (e), i ## __begin = (b); i -- > i ## __begin;)
#define rep(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)
#define ALL(x) begin (x), end (x)
using namespace std;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  string s; cin >> s;
  auto n = s.length ();

  auto t0 = 0;
  auto t1 = 0;
  rep (i, n)
  {
    if (s [i] != i % 2 + '0') ++ t0;
    if (s [i] == i % 2 + '0') ++ t1;
  }
  auto ans = min (t0, t1);
  cout << ans << endl;
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

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

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if (int(X/n)):
    return Base_10_to_n(int(X/n), n)+[X%n]
  return [X%n]


#############
# Main Code #
#############

N = inputI()
P_dic = defaultdict(int)
for _ in range(N):
  k = inputS()
  P_dic[k] += 1
M = inputI()
M_dic = defaultdict(int)
for _ in range(M):
  k = inputS()
  M_dic[k] += 1

  
ans = 0
for k in P_dic:
  ans = max(ans,P_dic[k]-M_dic[k])
print(ans)

Measured memory_bytes: 38384
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, cap;
    cin >> n >> cap;
    vector<int> w(n), v(n);
    rep(i, n) cin >> w[i] >> v[i];

    vector<vector<int>> dp(n+1, vector<int>(1e5 + 1, INF));
    dp[0][0] = 0;
    rep(i, n){
        rep(j, 1e5){
            if(dp[i][j] == INF){
                continue;
            }
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
            if(j + v[i] > 1e5){
                continue;
            }
            dp[i+1][j+v[i]] = min(dp[i+1][j+v[i]], dp[i][j] + w[i]);
        }
    }

    int ans = 0;
    for(int i = 0; i <= 1e5; i++){
        if(dp[n][i] <= cap){
            ans = max(ans, i);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 80256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;

int main(){
    ll n;
    ll d[110];
    cin >> n;
    rep(i, n){
        cin >> d[i];
    }

    set<ll> seted;
    rep(i, n){
        seted.insert(d[i]);
    }

    cout << seted.size() << endl;
}
   

Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int a[] = new int[N];
    long m = 0;
    for (int i = 0; i < N; i++) {
      a[i] = sc.nextInt();
      m += a[i];
    }
    System.out.println(m - N);
  }
}

Measured memory_bytes: 26068
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;



int main() {

  int n, m, d;
  cin >> n >> m >> d;

  int num = 0;
  if(d==0) {
    num = n;
  }
  else {
    for(int i = 0; i < n; ++i) {
      if(i-d >= 0) num += 1;
      if(i+d <  n) num += 1;
    }
  }

  printf("%.10f\n", (double)(m-1)*num*pow(n, -2));

}


Measured memory_bytes: 384
#include<iostream>
#include<string>
using namespace std;

int main(){

  int n, len;
  string str;

  cin >> n;
  getline(cin, str);
  for(int i=0; i<n; i++){
    getline(cin, str);
    len = str.length() - 6;
    for(int j=0; j<len; j++){
      if(str[j] == 'H' && str[j+1] == 'o' &&
         str[j+2] == 's' && str[j+3] == 'h' &&
         str[j+4] == 'i' && str[j+5] == 'n' &&
         str[j+6] == 'o'){
        str[j+6] = 'a';
        j += 6;
      }
    }
    
    cout << str << endl;
  }

  return 0;

}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
ll n,m;
vector<ll> numCombi(){
    vector<vector<ll>> ret(n+1,vector<ll>(n*m+2,0));
    ret[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=n*m;j++){
            if(ret[i-1][j]!=0){
                ret[i][j+1]+=ret[i-1][j];
                ret[i][min(j+m,n*m)+1]-=ret[i-1][j];
            }
        }
        partial_sum(all(ret[i]),ret[i].begin());
        //for(auto j:ret[i])cout<<j<<", ";cout<<endl;
    }
    return ret[n];
}

ll factorial(int n){
    if(n==1)return 1;
    return n*factorial(n-1);
}

int main(){
    ll k;
    while(cin>>n>>m>>k,n){
        double ans=0;
        double total=pow(m,n);
        auto v=numCombi();
        int p=k+1;
        for(int i=n;i<p;i++){
            //cout<<i<<": "<<v[i]<<endl;
            ans+=v[i]/total;
        }
        for(int i=p;i<=n*m;i++){
            //cout<<i<<": "<<v[i]<<" * "<<i-p+1<<endl;
            ans+=v[i]/total*(i-p+1);
        }
        cout<<fixed<<setprecision(15)<<ans<<endl;
    }
}

Measured memory_bytes: 3436
import std.stdio;
import std.ascii;
import std.conv;
import std.string;
import std.algorithm;
import std.range;
import std.functional;
import std.math;
import core.bitop;
import std.numeric;

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void main()
{
    auto abc = aryread;
    abc.sort();
    (abc[2] * 10 + abc[1] + abc[0]).writeln;
}


Measured memory_bytes: 256