akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

struct modint{
    using i64=int_fast64_t;
    i64 a;
    const i64 MOD=1000000007;
    modint(i64 a_=0){
        a=a_%MOD;
        if(a<0) a+=MOD;
    }
    modint inv()const{
        i64 n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y(n);
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    bool operator!=(const modint& x){
        return a!=x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y;
        y.a=a+x.a;
        if(y.a>MOD) y.a-=MOD;
        return y;
    }
    modint operator-(const modint& x){
        modint y;
        y.a=a-x.a;
        if(y.a<0) y.a+=MOD;
        return y;
    }
    modint operator*(const modint& x){
        modint y;
        y.a=(a*x.a)%MOD;
        return y;
    }
    modint operator/(const modint& x){
        modint y;
        y.a=(a*x.inv().a)%MOD;
        return y;
    }
    modint& operator+=(const modint& x){
        a+=x.a;
        if(a>=MOD) a-=MOD;
        return *this;
    }
    modint& operator-=(const modint& x){
        a-=x.a;
        if(a<0) a+=MOD;
        return *this;
    }
    modint& operator*=(const modint& x){
        (a*=x.a)%=MOD;
        return *this;
    }
    modint& operator/=(const modint& x){
        (a*=x.inv().a)%=MOD;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    int_fast64_t a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
modint pwr(int_fast64_t a,int_fast64_t b){
    modint _;
    int_fast64_t n=1,A=a,MOD=_.MOD;
    while(b){
        if(b&1) (n*=A)%=MOD;
        (A*=A)%=MOD;
        b>>=1;
    }
    _.a=n;
    return _;
}

class EIrohaAndHaiku {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n,x,y,z,d;
        in>>n>>x>>y>>z;
        d=max({x,y,z})+1;
        int t=(1<<(x+y+z-1))+(1<<(y+z-1))+(1<<(z-1)),m=(1<<(x+y+z)),r=m-1;
        t^=r;
        vector<vector<modint>> dp(n+1,vector<modint>(m));
        dp[0][0]=1;
        fr(i,n) fr(j,m) Fr(k,10){
            if((j|t)==r) dp[i][j]=0;
            dp[i+1][((j<<k)+(1<<(k-1)))&r]+=dp[i][j];
        }
        modint ans=pwr(10,n);
        fr(j,m) if((j|t)!=r) ans-=dp[n][j];
        out<<ans<<endl;
    }
};

int main() {
    EIrohaAndHaiku solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int n;
int arr[30];
int main() {
    cin>>n;
    for (int i=0;i<n;i++) {
        cin>>arr[i];
    }
    int cnt = 0;
    for (int i=1;i<n-1;i++) {
        int l = arr[i-1], r = arr[i+1], c = arr[i];
        if (c>l&&c>r||c<l&&c<r) continue;
        cnt++;
    }
    cout<<cnt;
}

Measured memory_bytes: 256
// 1_6_C
#include <iostream>
using namespace std;

int main(){
  int house[4][3][10] = {};
  int n, b, f, r, v;
  cin >> n;

  for(int i = 0; i < n; i++){
    cin >> b >> f >> r >> v;
    house[b-1][f-1][r-1] += v;
  }

  for(int i = 0; i < 4; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 10; k++){
        cout << " " << house[i][j][k];
      }
      cout << endl;
    }
    if(i != 3) cout << "####################" << endl;
  }
  return 0;
}

Measured memory_bytes: 3092
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func scanText() string {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Scan()
	return sc.Text()
}

func reverse(s string) (result string) {
	for _, v := range s {
		result = string(v) + result
	}
	return
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	N := 2019
	s := scanText()
	m := make([]int, N)
	total := 0
	ten := 1
	for i := 0; i < len(s); i++ {
		n, _ := strconv.Atoi(s[len(s)-1-i : len(s)-i])
		total += (n * ten) % N
		ten = (ten * 10) % N
		m[total%N]++
	}
	sum := m[0]
	for _, v := range m {
		sum += v * (v - 1) / 2
	}
	fmt.Println(sum)
}


Measured memory_bytes: 2420
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pairs;

#define MOD 998244353


ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}



int main(){
    ll n,m;
    cin>>n>>m;
    ll count = 0;
    for(ll i = 1; i<=n-1; i++){
        count += n-i;
    }
    for(ll j = 1; j<=m-1; j++){
        count += m-j;
    }
    cout<<count<<endl;
    return 0;
}



Measured memory_bytes: 256
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
while True:
    count = 0
    br = list(str(a))
    for r in br:
        if int(r) in ar:
            count += 1
    if count == 0:
        print(a)
        break
    else:
        a += 1

Measured memory_bytes: 3060
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b = MAP()
c = a + b
c = c/2
d = int(c)
if c-d == 0:
    print(d)
else:
    print("IMPOSSIBLE")



Measured memory_bytes: 5700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2e5+5;
const ll MOD=1e9 + 7;

int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    ll n;
    cin>>n;

    string s;
    cin>>s;

    bool arr[n][10][10];
    memset(arr,false,sizeof(arr));
    arr[n-2][s[n-2]-'0'][s[n-1]-'0']=1;
    for(ll i=n-3;i>=0;i--){
        for(ll j=0;j<10;j++)for(ll k=0;k<10;k++)arr[i][j][k]=arr[i+1][j][k];
        for(ll j=i+1;j<n;j++)arr[i][s[i]-'0'][s[j]-'0']=1;
    }

    bool chk[10][10][10];
    memset(chk,0,sizeof(chk));

    for(ll i=0;i<n-2;i++){
        for(ll j=0;j<10;j++){
            for(ll k=0;k<10;k++)
                if(arr[i+1][j][k])
                    chk[s[i]-'0'][j][k]=1;
        }
    }

    ll ans=0;
    for(ll i=0;i<10;i++)for(ll j=0;j<10;j++)for(ll k=0;k<10;k++)ans+=chk[i][j][k];
    cout<<ans;

}


Measured memory_bytes: 3200
#include "bits/stdc++.h"
using namespace std;


#include "bits/stdc++.h"
using namespace std;
int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ichi;
    ichi = max({ a,b,c });
    int nokori = a + b + c - ichi;
    for (int i = 1; i <= k; i++) {
        ichi *= 2;
    }
    cout << nokori + ichi << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
// #define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'

void solve1(int n, int m) {
    int l = m, r = m + 1;
    rep (_, m) {
        cout << l << " " << r << endl;
        l--; r++;
    }
}

void solve2(int n, int m) {
    int l = m, r = m + 1;
    set<int> st;
    rep (_, m) {
        if (st.count(r - l) or st.count(l - r + n)) r++;
        if (r - l == l - r + n) r++;
        cout << l << " " << r << endl;
        st.insert(r - l);
        st.insert(l - r + n);
        l--; r++;
    }
}

signed main() {
    fio();

    int n, m;
    cin >> n >> m;
    if (n % 2 == 1) {
        solve1(n, m);
    }
    else {
        solve2(n, m);
    }
}

Measured memory_bytes: 10008
#include"bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
	int N;
	string s;
	cin >> N >> s;
	int count = 0;
	rep(i, N) {
		if (s.at(i) == 'R') count++;
	}
	cout << (count > s.size() / 2 ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,c,i,j,k,n,m,x,y,ans = 0;
	ll		w = 0;
	ll		b = 0;
	string	s;

	cin >> s;
	n = s.size();
	for(i=0;i<n;i++) {
		if (s[i]=='W') w++;
	}
	b = w+1;

	for(i=0;i<w;i++) {
		if (s[i]=='B') {
			ans += w - i;
		}
	}
	for(;i<n;i++) {
		if (s[i]=='W') {
			ans += i - w;
		}
	}


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


Measured memory_bytes: 640
#include <stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int x=1;
	while((x+1)*(x+2)/2<=n)x++;
	int rest=n-x*(x+1)/2;
	for(int i=x;i>=1;i--)printf("%d\n",i+(rest-->0));
}

Measured memory_bytes: 128
N,K = map(int,input().split())
A = list(map(int,input().split()))
F = list(map(int,input().split()))
A.sort()
F.sort(reverse=True)

ng = -1
ok = 10**18
while ok - ng > 1:
    mid = (ok + ng) // 2
    c = 0
    for i in range(N):
        c += max(0,A[i]-mid//F[i])
    if c <= K:
        ok = mid
    else:
        ng = mid
print(ok)


Measured memory_bytes: 119500
from bisect import bisect_left

dp = [-1]
n = int(input())
a = (int(input()) for _ in range(n))
for ai in a:
    if dp[-1] < ai:
        dp.append(ai)
    else:
        dp[bisect_left(dp, ai)] = ai
        
print(len(dp) - 1)


Measured memory_bytes: 9684
#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
#include <string>
#include <string.h>
#include <limits>
#include <utility>
#include <vector>
#include <algorithm>
#include <functional>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <chrono>

using namespace std;

namespace
{

}

#if 1
int main()
{
	std::string s;
	std::string t;

	std::vector<int> ss;
	ss.resize(26);
	std::vector<int> ts;
	ts.resize(26);

	cin >> s;
	cin >> t;

	for (int i = 0; i < s.size(); i++)
	{
		ss[s[i] - 'a']++;
		ts[t[i] - 'a']++;
	}

	std::sort(ss.begin(), ss.end());
	std::sort(ts.begin(), ts.end());

	bool isOk = true;
	for (int i = 0; i < 26; i++)
	{
		if (ss[i] != ts[i])
		{
			isOk = false;
			break;
		}
	}

	if (isOk)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}
#endif


Measured memory_bytes: 776
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<char>> C(H,vector<char>(W));

  for(int i=0;i<H;++i)
    for(int j=0;j<W;++j) cin >> C.at(i).at(j);

  for(int i=0;i<2*H;++i){
    for(int j=0;j<W;++j){
      cout << C.at(i/2).at(j);
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



template<class T> struct Edge {
    int from, to;
    T cost;
    Edge(int f, int t, T c) : from(f), to(t), cost(c) {}
    friend bool operator < (const Edge &e1, const Edge &e2) {return e1.cost < e2.cost;}
    friend bool operator > (const Edge &e1, const Edge &e2) {return e1.cost > e2.cost;}
    friend ostream& operator << (ostream& s, const Edge<T>& E) {
        return s << E.from << "->" << E.to << '(' << E.cost << ')';
    }
};

const int MAX_V = 1000;
template<class T> struct Graph {
    int V;
    vector<Edge<T> > list[MAX_V];
    
    Graph(int n = 0) : V(n) {}
    void init(int n = 0) {V = n; for (int i = 0; i < MAX_V; ++i) list[i].clear();}
    inline vector<Edge<T> >& operator [] (int i) {return list[i];}
    
    void direct(int f, int t, T c) {
        list[f].push_back(Edge<T>(f,t,c));
    }
    
    friend ostream& operator << (ostream& s, const Graph<T>& G) {
        for (int i = 0; i < G.V; ++i) {s << i << " : " << G.list[i];}
        return s;
    }
};

Graph<int> G;


int n, m, a, b, c;


int dp[MAX_V];
int rec(int v) {
    if (v == n-1) return 0;
    if (dp[v] != -1) return dp[v];
    
    int res = -1;
    for (int i = 0; i < G[v].size(); ++i) {
        int to = G[v][i].to;
        int tmp = G[v][i].cost + rec(to);
        chmax(res, tmp);
    }
    return dp[v] = res;
}

int main() {
    while (cin >> n >> m) {
        G.init(n);
        for (int i = 0; i < m; ++i) {
            cin >> a >> b >> c;
            G.direct(a, b, c);
        }
        memset(dp, -1, sizeof(dp));
        cout << rec(0) << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1232
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{ 
 
 
    static long mod=1000000007;
    static int dx[]={1,-1,0,0};
    static int dy[]={0,0,1,-1};
    // static int dx[]={1,-1,0,0,1,1,-1,-1};
    // static int dy[]={0,0,1,-1,1,-1,1,-1};
    // PriorityQueue<Integer> que = new PriorityQueue<Integer>(); 
    //HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
        // ArrayList<Integer> lis = new ArrayList<Integer>();
    // ArrayList<Integer> map[]=new ArrayList[26];
    static HashMap<Integer,Long> map = new HashMap<Integer,Long>();

    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // long n=sc.nextLong();
        // char c[][] = new char[h][w];
        // long a[] = new long [n];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {a[i]=sc.nextInt();}
        int n=sc.nextInt();
        int m=sc.nextInt();
        long ans=0;
        if(n==1||m==1){
            ans=max(n,m)-2;
            if(ans<0)ans=1;
        }
        else if(n>2 && m>2){
            ans=(long)(n-2)*(m-2);
        }

        
        out.println(ans);
        out.flush();
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
     
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}

class XY {
    int x,y,d;
    XY(int x, int y, int d) {
        this.x=x;
        this.y=y;
        this.d=d;
    } 
}
 
class P implements Comparable<P>{
    int x,y;
    P(int x, int y) {
        this.x=x;
        this.y=y;
    } 
      
    public int compareTo(P p){
        return -x + p.x;//des
    } 
}
 
class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M = 1e9 + 7;

ll n,a;
ll rpta,suma=0;
//string ws="aji";

vector<ll> nros;
int main() {
	// your code goes here
	cin >> n;
    
    while(n){
        cin >> a;
        nros.push_back(a);     
        n--;
    }
    vector<ll> sumas_acum(nros.size()+1);
    for(int i=1; i< (int)sumas_acum.size();i++){
        sumas_acum[i]=sumas_acum[i-1]+nros[i-1];
       // cout << sumas_acum[i]<<" ";
    }

    for(int i=0 ; i<(int)nros.size()-1;i++){
            suma=0;     
        /*for(int j=i+1; j<nros.size(); j++){
            
            suma = (suma%M   + nros[j]%M)%M;
        }*/
        suma = (sumas_acum[nros.size()]-sumas_acum[i+1])%M;
        suma= (suma *nros[i]%M)%M;
        rpta=(rpta%M+suma)%M;
    }
  
    cout <<  rpta<< endl;
  
 
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll mod = 10e9+7;

#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prtd(n, var)  cout << fixed << setprecision(n) << var << endl
#define prt2(var1, var2) cout << var1 << " " << var2 << endl

//----------------------------------------------------------------
class Graph{

public:
  vector<vector<int>> tree;
  vector<int> check;
  vector<int> todo;
  int ans;
  Graph(int n){
    tree.resize(n);
    initCheck(n);
    rep(i,n){
      todo.push_back(i);
    }
    ans = 0;
  }
  ~Graph(){}

  void addpath(int m){
    int a, b, c;
    rep(i,m){
      cin >> a >> b >> c;
      a--;b--;
      tree[a].push_back(b);
      tree[b].push_back(a);
    }
  }

  void initCheck(int n){
    check.assign(n, false);
  }

  void dfs(int v){
    check[v] = true;
    //todo.erase(lower_bound(all(todo), v));
    for(auto next_v : tree[v]){
      if(check[next_v]) continue;
      dfs(next_v);
    }
  }
};

int main(void) {
  int n, m;
  cin >> n >> m;

  Graph g(n);

  g.addpath(m);

  rep(j,n){
    if(g.check[j]){
      continue;
    } else {
      g.ans++;
      g.dfs(j);
    }

  }

  prt(g.ans);

}


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

int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i=0; i<N; ++i) cin >> A[i];

    long long res = 0;
    int cur = 0;
    while(cur < N) {
        long long sum = 0;
        while(cur < N && A[cur] != 0) {
            sum += A[cur];
            ++cur;
        }
        res += sum / 2;
        while(cur < N && A[cur] == 0) ++cur; 
    }
    cout << res << endl;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
	string s[3];
	for(int i=0;i < 3;i ++)
	{
		cin >> s[i];
	}

	bool flag = true;

	for(int i=0;i < 2;i ++)
	{
		if(s[i][s[i].length()-1] != s[i+1][0])
		{
			flag = false;
		}
	}
	if(flag)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {

    int n = 0;
    String[] input = null;
    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      n = Integer.parseInt(br.readLine());
      input = br.readLine().split("\\s");
    } catch (IOException e) {
      e.printStackTrace();
      System.exit(1);
    }

    int sum = 0;
    for (int i = 0; i < input.length; i++) {
      boolean b = true;
      for (int j = 0; j < i; j++) {
        if (Integer.parseInt(input[i]) < Integer.parseInt(input[j])) {
          b = false;
          break;
        }
      }
      if (b) {
        sum++;
      }
    }

    System.out.print(sum);
  }
}


Measured memory_bytes: 21332
#include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;
int main(){
    double x1,y1,x2,y2,d;
    cin>>x1>>y1>>x2>>y2;
    d=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
    printf("%f\n",sqrt(d));
    return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <math.h>

int main(){

  int N, K;
  scanf("%d %d",&N, &K);
  int h[N+5];
  for (int i=0; i<N; i++){
    scanf("%d",&h[i]);
  }
  int ans =0;
  for (int i=0; i<N; i++){
    if (h[i]>=K){
      ans++;
    }
  }
  printf("%d\n",ans);
  return 0;
}

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

int dp[1009], dp2[1009], mod = 1000000007;
string S, T;

int main() {
    cin >> S >> T;
    for (int i = 0; i < T.size(); i++) {
        int r = 0; if (i == 0) r = 1;
        for (int j = 0; j < S.size(); j++) {
            if (S[j] == T[i]) dp2[j] = r;
            r += dp[j]; r %= mod;
        }
        for (int j = 0; j < S.size(); j++) { dp[j] = dp2[j]; dp2[j] = 0; }
    }
    int ans = 0;
    for (int i = 0; i < S.size(); i++) { ans += dp[i]; ans %= mod; }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3208
def binary_search(c1, c2):
    m = (c1 + c2 + 1) // 2
    if abs(c1 - c2) <= 1:
        return m
    else:
        if dp[m] < a:
            c1 = m
        else:
            c2 = m
        return binary_search(c1, c2)

n = int(input())
dp = [-1 for _ in range(n)]
for _ in range(n):
    a = int(input())
    m = binary_search(n - 1, -1)
    dp[m] = a
ans = 0
for i in dp:
    if i == -1:
        break
    else:
        ans += 1
print(ans)

Measured memory_bytes: 7052
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod=1e9+7;
int main()
{
    FASTINOUT;
    int x,k,ng=0;
    cin>>x>>k;
    ll y[x];
    for (int i=0; i<x; i++)
    {
        cin>>y[i];
        if (y[i]<0)
            ng++;
    }
    sort(y,y+x);
    ll ans=1;
    if (x==k)
    {
        for (int i=0; i<x; i++)
        {
            ans=((ans*y[i])%mod+mod)%mod;
        }
        cout<<ans;
        return 0;
    }
    if (ng==x)
    {
        if (k&1)
        {
            reverse(y,y+x);
            for (int i=0; i<k; i++)
            {
                ans=((ans*y[i])%mod+mod)%mod;
            }
        }
        else
        {
            for (int i=0; i<k; i++)
            {
                ans=((ans*y[i])%mod+mod)%mod;
            }
        }
        cout<<ans;
        return 0;
    }
    vector<ll>pos,neg;
    for (int i=0; i<x; i++)
    {
        if (y[i]>=0)
            pos.push_back(y[i]);
        else
            neg.push_back(y[i]);
    }
    sort(neg.begin(),neg.end());
    sort(pos.begin(),pos.end());
    reverse(neg.begin(),neg.end());
    int p=pos.size(),n=neg.size();
    if (k&1)
        ans=pos[--p],k--;
    while (k>1&&(n>1||p>1))
    {
        ll mp=0,mn=0;
        if (p>1)
            mp=pos[p-1]*pos[p-2];
        if (n>1)
            mn=neg[n-1]*neg[n-2];
        if (mp>mn)
        {
            p-=2;
            mp=mp%mod;
            ans=(ans*mp)%mod;
        }
        else
        {
            n-=2;
            mn=mn%mod;
            ans=(ans*mn)%mod;
        }
        k-=2;
    }
    while (k--)
    {
        if (p)
            ans=ans*pos[--p]%mod;
        else
            ans=((ans*neg[--n])%mod+mod)%mod;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 7016
N=int(input())
p=list(map(float,input().split()))

DP=[0 for i in range(N+1)]
DP[0]=10**12
for i in range(N):
    #DP[0]=1
    for j in range(N+1):
        if DP[N-j]>0:
            DP[N-j+1]+=DP[N-j]*p[i]
            DP[N-j]*=(1-p[i])
    #print(DP)
print(sum(DP[N//2+1:])/(10**12))

Measured memory_bytes: 42348
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;

#define MAX_N 2000

// int N = 999999;
int N;
int main() {
    cin >> N;
    int ans = (N - 1) / 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	long long a,i,b;
	cin >> a;
	for(i=1;i<10;i++)
	{
		if(a%i == 0)
		{
			if((a/i > 0) and (a/i <10))
			{
				cout << "Yes" << endl;
				break;
			}
		}
		if(i == 9)
		{
			cout << "No" << endl;
		}
	}
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
using namespace std;
int const MAX = 100003;

int a[MAX];
int k[MAX];

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int kind = 1;
	k[1] = 1;
	int ev = 0;
	for (int i = 1; i < n; i++) {
		if (a[i - 1] != a[i]) {
			if (k[kind] % 2 == 0) {
				ev++;
			}
			kind++;
		}
		k[kind]++;
	}
	if (k[kind] % 2 == 0) { ev++; }
	if (ev % 2 == 0) {
		cout << kind << endl;
	}
	else { cout << kind - 1 << endl; }
}

Measured memory_bytes: 1024
#include"bits/stdc++.h"
    using namespace std;
    using ll = long long ;
    ///PBDS Starting.......

    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

    ///PBDS_SET
    ///Index of Value - .order_of_key()
    ///Value at Index - .find_by_order()
    ///typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds_set;
    ///typedef tree<int, null_type, lessorequal<int>, rb_tree_tag,tree_order_statistics_node_update> pbds_multiset;

    /// PBDS closing......
    #define int long long
    #define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20)
    #define endl '\n'
    ///............Author..................................................................
    ///........... :: .....................................................................
    ///...........(  NOBODY  )................................................................
    ///........... Bangabandhu Sheikh Mujibur Rahman Science and Technlogy University,Gopalganj
    ///........... ( N~76 ) ...................................................................
    ///........... No Copyright .....You can copy and paste my code without any permission.....
    /// !!!!!!!!!!!!!!!........................................................................
    #define pb push_back
    #define esp 0.000000001
    #define pi acos(-1)
    #define N 1000009
    #define ff first
    #define ss second
    #define all(x) x.begin(),x.end()
    /// Code Loading Please wait.............
    /// returning to N~76.
    /// Loading Finished.....................

    int32_t main()
    {
        FAST_IO;
        int n;
        cin>>n;
        double ans=(double)2*pi*n;
        cout<<ans<<endl;
        return 0;
    }



Measured memory_bytes: 3800
using System;

public class Hello
{
    static int[] dx = new int[] { 0, 1, 0, -1 };
    static int[] dy = new int[] { 1, 0, -1, 0 };
    static bool OK = false;
    static int n = 0;
    public static void Main()
    {
        while (true)
        {
            n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            OK = false;
            var map = new int[n, n];
            for (int i = 0; i < n; i++)
            {
                string[] line = Console.ReadLine().Trim().Split(' ');
                for (int j = 0; j < n; j++) map[i, j] = int.Parse(line[j]);
            }
            var used = new bool[n, n];
            goDfs(map, used, 0, n * n, 0, 0);
            Console.WriteLine(OK ? "YES" : "NO");
        }
    }
    public static void goDfs(int[,] map, bool[,] used, int rest, int rest2, int x, int y)
    {
        if (rest2 == 0) { OK = true; return; }
        if (rest == 0)
        {
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++)
                    if (map[i, j] < 0 && !used[i, j])
                    {
                        used[i, j] = true;
                        goDfs(map, used, -map[i, j], rest2 - 1, i, j);
                        used[i, j] = false;
                        return;
                    }
        }
        else
            for (int i = 0; i < 4; i++)
            {
                var nx = x + dx[i];
                var ny = y + dy[i];
                if (nx >= 0 && nx < n && ny >= 0 && ny < n && map[nx, ny] > 0 && !used[nx, ny] && rest - map[nx, ny] >= 0)
                {
                    used[nx, ny] = true;
                    goDfs(map, used, rest - map[nx, ny], rest2 - 1, nx, ny);
                    used[nx, ny] = false;
                }
            }
    }
}




Measured memory_bytes: 8924
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <queue>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <cmath>
#include <iomanip>
#include <functional>
using namespace std;
#define sL(i) i << 1
#define sR(i) i << 1 | 1
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>, int> ppi;
typedef pair<ll, ll> pl;
const int MOD = 1e9 + 7;
const int INF = 2e9 + 5;
const int maxn = 100010;

ll n, m, s, t;
vector<pl> adjYen[maxn], adjSnuuk[maxn];
ll distYen[maxn], distSnuuk[maxn];
ll ans[maxn];

void shortest(int src, ll dist[], vector<pl> adj[]){
    for (int i = 1; i <= n; i++) {
        dist[i] = 1e16;
    }
    bool vis[maxn] = {0};
    dist[src] = 0;
    priority_queue<pl, vector<pl>, greater<pl>> q;
    q.push({0, src});
    while (!q.empty()) {
        int u = q.top().second;
        q.pop();
        if (vis[u]) continue;
        vis[u] = true;
        for (pl v : adj[u]) {
            if (dist[u] + v.second < dist[v.first]) {
                dist[v.first] = dist[u] + v.second;
                q.push({dist[v.first], v.first});
            }
        }
    }
}

int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m >> s >> t;
    for (int i = 0; i < m; i++) {
        int a, b, yen, snuuk;
        cin >> a >> b >> yen >> snuuk;
        adjYen[a].emplace_back(b, yen);
        adjYen[b].emplace_back(a, yen);
        adjSnuuk[a].emplace_back(b, snuuk);
        adjSnuuk[b].emplace_back(a, snuuk);
    }
    shortest(s, distYen, adjYen);
    shortest(t, distSnuuk, adjSnuuk);
    ll cur = 1e16;
    for (int i = n - 1; i >= 0; i--) {
        cur = min(cur, distYen[i + 1] + distSnuuk[i + 1]);
        ans[i] = 1e15 - cur;
    }
    for (int i = 0; i < n; i++) {
        cout << ans[i] << "\n";
    }
}

Measured memory_bytes: 19272
n = int(input())
a, b = map(int,input().split())
p = list(map(int,input().split()))
x, y, z = 0, 0, 0
for i in p:
    if i <= a:
        x += 1
    elif i <= b:
        y += 1
    else:
        z += 1
print(min(x,y,z)) 

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using ll = long long;
using namespace std;

int n, k = 2;
int arr[100100], dp[100100];
bool vis[100100];

int func( int pos ) {
  if (pos == n) return 0;
  if (vis[pos]) return dp[pos];
  vis[pos] = 1;
  int res = INT_MAX;
  for (int i = 1; i <= k; ++i) {
    if (pos + i > n) break;
    res = min(res, func(pos + i) + abs(arr[pos] - arr[pos + i]));
  }
  return dp[pos] = res;
}

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

  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> arr[i];
  cout << func(1) << endl;
  return 0;
}


Measured memory_bytes: 5888
#include <iostream>
#include <string>

using namespace std;

int main() {
    int a, b;
    int ans = 0;
    string s;

    cin >> a >> b;

    for (int i = a; i <= b; i++) {
        s = std::to_string(i);
        if (s[0] == s[4] && s[1] == s[3]) {
            ans++;
        }        
    }

    cout << ans << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<ll> Vec;
typedef vector<Vec> DVec;
typedef priority_queue<P, vector<P>, greater<P>> PQ;

#define fi             first
#define se             second
#define pb             push_back
#define INF            LLONG_MAX/3
#define MOD            1000000007
#define bcnt           __builtin_popcount
#define all(x)         (x).begin(),(x).end()
#define uni(x)         x.erase(unique(all(x)),x.end())
#define ub(x,y)        (upper_bound(all(x),y)-x.begin())
#define lb(x,y)        (lower_bound(all(x),y)-x.begin())
#define ssort(x)       sort(all(x),mycmp)
#define rep(i,n)       repl(i,0,n-1)
#define mkp(x,y)       make_pair(x,y)
#define mmax(x,y)      (x>y?x:y)
#define mmin(x,y)      (x<y?x:y)
#define maxch(x,y)     x=mmax(x,y)
#define minch(x,y)     x=mmin(x,y)
#define exist(x,y)     (find(all(x),y)!=x.end())
#define each(itr,v)    for(auto itr:v)
#define repl(i,a,b)    for(ll i=(ll)(a);i<=(ll)(b);i++)
#define dvec(n1,n2,i)  DVec(n1,Vec(n2,i))
#define MAXN 105

ll N;
vector<P> A,B;
vector<bool> f;
ll ans;
bool mycmp(P a, P b){
  return a.fi < b.fi;
}

int main(){
  cin.sync_with_stdio(false);
  cin >> N;
  A.resize(N);B.resize(N);f.resize(N);
  rep(i,N)cin >> A[i].fi >> A[i].se;
  rep(i,N)cin >> B[i].fi >> B[i].se;

  ssort(A);
  ssort(B);

  rep(i,N){
    ll maxx = 0;
    ll t = 1000;
    rep(j,N){
      if(A[j].fi > B[i].fi)break;
      if(f[j] == 0 && A[j].se < B[i].se && A[j].se >= maxx){
        maxx = A[j].se;
        t=j;
      }
    }

    if(t != 1000){
      f[t] = 1;
      ans++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
w_l = list(map(int, input().split()))


ans = 100 * n + 1
for i in range(len(w_l)):
    s1 = 0
    s2 = 0
    for j in range(i):
        s1 += w_l[j]
    for j in range(i, len(w_l)):
        s2 += w_l[j]

    tmp = s2 - s1 if s2 - s1 > 0 else s1 - s2
    if tmp < ans:
        ans = tmp
    else:
        break

print(ans)


Measured memory_bytes: 3060
#include <stdio.h>
#define N 100000

void swapper(int *m, int *n) {

    int buf = 0;

    buf = *m;
    *m = *n;
    *n = buf;

}

int main(void) {

    int i = 0, j = 0;
    int x[N], y[N];

    for (i = 0; i < N; i++) {
        x[i] = 0;
        y[i] = 0;
    }

    scanf("%d%d", &x[0], &y[0]);
    i = 1;
    while ((x[i - 1] != 0) || (y[i - 1] != 0)) {
        scanf("%d%d", &x[i], &y[i]);
        i++;
    }
    j = i;

    for (i = 0; i < j - 1; i++) {
        if (x[i] > y[i]) {
            swapper(&x[i], &y[i]);
        }
        printf("%d %d\n", x[i], y[i]);
    }

    return 0;

}

Measured memory_bytes: 1380
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>
#include <unordered_map>
#include <cstring>
#include <iostream>
#include <numeric>
#include <sstream>
#include <set>
#include <tuple>
#include <iomanip>

using namespace std;
#define MAX 1LL << 60

typedef long long ll;

#define rep(i, s, e) for(ll i = s; i < e; i++)
#define repR(i, s, e) for(ll i = s; i > e; i--)
#define reft0(i, j) setfill('0') << setw(i) << j

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

typedef struct {
    bool bakudan;
    int num;
}masu;
int main(){
    ll H, W;
    masu S[60][60] = { 0 };
    cin >> H >> W;
    rep(i, 0, H){
        rep(ii, 0, W){
            char temp;
            cin >> temp;
            if (temp == '#'){
                S[i][ii].bakudan = true;
            }
        }
    }
    rep(i, 0, H){
        rep(ii, 0, W){
            if (S[i][ii].bakudan == true){
                S[i + 1][ii].num++;
                S[i][ii + 1].num++;
                S[i + 1][ii + 1].num++;
                if (i != 0){
                    S[i - 1][ii].num++;
                    S[i - 1][ii + 1].num++;
                }
                if (ii != 0){
                    S[i][ii - 1].num++;
                    S[i + 1][ii - 1].num++;
                }
                if (i != 0 && ii != 0){
                    S[i - 1][ii - 1].num++;
                }
            }
        }
    }
    rep(i, 0, H){
        rep(ii, 0, W){
            if (S[i][ii].bakudan == true){
                cout << '#';
            }
            else{
                cout << S[i][ii].num;
            }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,(e))
#define irp(i,s,e) for(int i=(s);i>(e);--i)
#define irpz(i,s) irp(i,(s),-1)
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T> T in(){T x;cin>>x;return x;}
// long long a = in<long long>();
template<class T> vector<T> inarr(int s,int e, T init=0){
	vector<T> v;T x;
	for(int i=0;i<s;++i)v.push_back(init);
	for(int i=s;i<e;++i){x=in<T>();v.push_back(x);}
	return v;
}
int N;
vi A;

bool solve(){
	sort(all(A));
	// bool ans = false;
	vi X(N);
	rp(i,1,N){
		X[i] = A[i] - A[i-1];
	}
	rp(i,1,N){
		// ote(X[i]);
		if(X[i] == 0){
			return false;
		}
	}
	return true;
	// return ans;
}

int main(){
	cin>>N;
	A = inarr<int>(0,N);
	cout<< (solve()?"YES":"NO") <<endl;
	// printf("%f\n",solve());
}


Measured memory_bytes: 1908
#include<iostream>
#include<string>

using namespace std;

int main(void)
{
	string s;
	cin >> s;
	int ans=0;

	for(int i='a';i<='z';i++)
	{
		bool flag=false;
		for(int j=1;j<=s.size();j++)
		{
			if(s[j-1]==char(i))
				flag=true;
		}
		if(flag==false)
		{
			ans=i;
			break;
		}
	}
	if(ans==0)
		cout << "None" << endl;
	else
		cout << char(ans) << endl;
}

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

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int ans = 0, cnt = 0;
  while (0 < c) {
    c -= a;
    cnt++;
    ans++;
    if (cnt == 7) c -= b, cnt = 0;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3112
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			char[] chs = sc.next().toCharArray();
			
			int[] counts = new int[26];
			for(int i = 0; i < chs.length; i++) {
				counts[chs[i] - 'A']++;
			}
			
			for(final int c : counts) {
				if(c == 1) {
					System.out.println("No");
					return;
				}else if(c == chs.length) {
					System.out.println("No");
					return;
				}
			}
			
			System.out.println("Yes");
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 23124
n,k = map(int,input().split())
P = 10**9+7

ans = 1
nCl = 1
n1Cl = 1
for l in range(1,min(k+1,n)):
    nCl = nCl*(n+1-l)*pow(l,P-2,P)%P
    n1Cl = n1Cl*(n-l)*pow(l,P-2,P)%P
    ans = (ans+nCl*n1Cl)%P

print(ans)


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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> vec(N);
  for(int i = 0; i < M; i++){
    int a, b;
    cin >> a >> b;
    vec.at(a-1) += 1;
    vec.at(b-1) += 1;
  }
  for(int j = 0; j < N; j++){
    cout << vec.at(j) << endl;
  }
}



Measured memory_bytes: 256
#include <functional>
#include <list>
#include <string>
#include <vector>
#include <climits>
#include <cstring>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <set>
#include <deque>
#include <stack>
#include <cassert>
using namespace std;
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define ALL(x) (x).begin(),(x).end()
#define CASET2 int ___T, case_n = 1; scanf("%d ", &___T); while ((___T > 0 ? printf("Case #%d:\n", case_n++) : 0), ___T-- > 0)
#define CASET1 int ___T, case_n = 1; scanf("%d ", &___T); while ((___T > 0 ? printf("Case #%d: ", case_n++) : 0), ___T-- > 0)
#define CASET int ___T; scanf("%d ", &___T); while (___T-- > 0)
#define SZ(X) ((int)(X).size())
#define LEN(X) strlen(X)
#define REP(i,n) for(int i=0;i<int(n);i++)
#define REP1(i,a,b) for(int i=(a);i<=int(b);i++)
#define PER1(i,a,b) for(int i=(a);i>=(b);i--)
#define REPL(i,x) for(int i=0;x[i];i++)
#define PER(i,n) for(int i=(n)-1;i>=0;i--)
#define RI1(x) scanf("%d",&x)
#define RI2(x,y) RI1(x), RI1(y)
#define RI3(x,y...) RI1(x), RI2(y)
#define RI4(x,y...) RI1(x), RI3(y)
#define RI5(x,y...) RI1(x), RI4(y)
#define RI6(x,y...) RI1(x), RI5(y)
#define GET_MACRO(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
#define RI(argv...) GET_MACRO(argv, RI6, RI5, RI4, RI3, RI2, RI1)(argv)
#define DRI(argv...) int argv;RI(argv)
#define WRI(argv...) while (RI(argv) != EOF)
#define DWRI(x...) int x; WRI(x)
#define RS(x) scanf("%s",x)
#define MP make_pair
#define PB push_back
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define X first
#define Y second
#define V(x) vector<x >

typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;
const int INF = 1000000000;

void print(int i) { printf("%d", i); }
template<class T> void PI(T i) { print(i); puts(""); }
template<class T> void PIS(T i) { print(i); printf(" "); }

template<class T>
void PV(T const &v, int N) {
    REP(i, N) {
        print(v[i]);
        printf("%c", i == N-1 ? '\n' : ' ');
    }
}

template<class T> void PV(T const &v) { PV(v, SZ(v)); }

template<class T, class S> bool has_bit(T mask, S i) { return (mask >> i) & 1; }
long long shift(int i) { return 1ll << i; }

template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
int popcount(int x) { return __builtin_popcount(x); } 
int popcount(long long x) { return __builtin_popcountll(x); } 

#include <unordered_set>
#include <unordered_map>
#define EB emplace_back
#define RL(x) scanf("%lld", &(x))
#define PL(x) printf("%lld\n", x)
#define DRL(x) LL x; RL(x)

int main() {
    DRI(N, L);
    VI A(N);
    int j = -1;
    REP(i, N) {
        RI(A[i]);
        if (i > 0 && A[i] + A[i-1] >= L) {
            j = i;
        }
    }
    if (j < 0) {
        puts("Impossible");
    } else {
        puts("Possible");
        REP1(i, 1, j-1) {
            PI(i);
        }
        PER1(i, N-1, j+1) {
            PI(i);
        }
        PI(j);
    }
    return 0;
}


Measured memory_bytes: 1152
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int s = 1;
		for(int i = 0; i < 5; i++){
			if(sc.nextInt() != 0){
				s++;
			}else{
				i += 5;
			}
		}
		System.out.println(s);
	}
}

Measured memory_bytes: 35756