akhauriyash/Code-Regression huggingface dataset:
type
  node=record
      y:longint;
      flow:longint;
      next:longint;
  end;
var
   first,dis,a,b,c,d:array[0..100000]of longint;
   q:array[0..1000000]of longint;
   e:array[0..20000]of node;
   i,j:longint;
   n,m:longint;
   x,y,z:longint;
   tot:longint;
   ans:longint;

procedure adde(x,y,z:longint);
begin
  e[tot].next:=first[x];
  e[tot].y:=y;
  e[tot].flow:=z;
  first[x]:=tot;
  inc(tot);
end;

procedure bfs(s:longint);
var i,now,head,tail:longint;
begin
  for i:=0 to n*2+1 do
  dis[i]:=-1;
  dis[s]:=0;
  head:=1;
  tail:=1;
  q[1]:=s;
  while head<=tail do
  begin
    now:=q[head];
    i:=first[now];
    while i<>-1 do
    begin
      y:=e[i].y;
      if (dis[y]<0)and(e[i].flow>0) then
      begin
        dis[y]:=dis[now]+1;
        inc(tail);
        q[tail]:=y;
      end;
      i:=e[i].next;
    end;
    inc(head);
  end;
end;

function dfs(x,mx:longint):longint;
var i,k:longint;
begin
  if x=n*2+1 then exit(mx);
  i:=first[x];
  while i<>-1 do
  begin
    y:=e[i].y;
    if (e[i].flow>0)and(dis[y]=dis[x]+1) then
    begin
      if e[i].flow>mx then k:=dfs(y,mx) else k:=dfs(y,e[i].flow);
      dec(e[i].flow,k);
      inc(e[i xor 1].flow,k);
      if k>0 then exit(k);
    end;
    i:=e[i].next;
  end;
  exit(0);
end;
begin
  read(n);
  for i:=0 to n*2+1 do
  first[i]:=-1;
  for i:=1 to n do
  begin
    read(a[i],b[i]);
    adde(0,i,1);
    adde(i,0,0);
  end;
  for i:=1 to n do
  begin
    read(c[i],d[i]);
    adde(n+i,n*2+1,1);
    adde(n*2+1,n+i,0);
  end;
  for i:=1 to n do
  for j:=1 to n do
  if (a[i]<c[j])and(b[i]<d[j]) then
  begin
    adde(i,n+j,1);
    adde(n+j,i,0);
  end;
  ans:=0;
  while true do
  begin
    bfs(0);
    if dis[2*n+1]<0 then break;
    repeat
      z:=dfs(0,maxint);
      inc(ans,z);
    until z>0;
  end;
  writeln(ans);
end.



Measured memory_bytes: 2176
#include<iostream>

using namespace std;
int memo[34000][5];

int main(){

   memo[0][0]=1;
   for(int i=1; i*i<=34000; i++){
      for(int j=i*i; j<=34000; j++){
         for(int k=1; k<=4; k++){
            memo[j][k]+=memo[j-i*i][k-1];
         }
      }
   }
   while(1){
      int n;
      cin>> n;
      if(!n) break;

      int r=0;
      for(int j=1; j<=4; j++){
         r+=memo[n][j];
      }

      cout<< r<< endl;

   }
   return 0;
}

Measured memory_bytes: 3608
import sys

input = sys.stdin.readline

def main():
    text = ""
    word = input().rstrip().lower()
    count = 0
    while True:
        s = input().rstrip()
        if s == "END_OF_TEXT":
            break
        s = s.lower().split()
        count += s.count(word)
    
    print(count)
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 5556
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define YN(a, b, c) ((c)? a : b)
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) (i64)(a / (f64)__gcd(a, b) * b) /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    i32 N;
    cin >> N;
    Vec<string> S(N);
    for (i32 i = 0; i < N; i++) cin >> S[i];
    Vec<i64> A(5, 0);
    for (i32 i = 0; i < N; i++) {
        switch (S[i][0]) {
        case 'M':
            A[0]++;
            break;
        case 'A':
            A[1]++;
            break;
        case 'R':
            A[2]++;
            break;
        case 'C':
            A[3]++;
            break;
        case 'H':
            A[4]++;
            break;
        }
    }
    i64 sum = 0;
    for (i32 i = 0; i < 3; i++) {
        for (i32 j = i + 1; j < 4; j++) {
            for (i32 k = j + 1; k < 5; k++) {
                sum += A[i] * A[j] * A[k];
            }
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 6372
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main {
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        int want = in.nextInt();
        int[] a = new int[n];
        for(int i = 0; i<n; i++){
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        int sum = 0;
        for(int i = 0; i<want; i++){
            sum+=a[i];
        }
        out.println(sum);
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

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

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public boolean hasNext() {
            String next = null;
            try {
                next = reader.readLine();
            } catch (Exception e) {
            }
            if (next == null) {
                return false;
            }
            tokenizer = new StringTokenizer(next);
            return true;
        }

        public BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
    }
}



Measured memory_bytes: 33360
n, d = map(int, input().split())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

ddd = d ** 2
ans = 0
for i in range(n):
    if x[i] ** 2 + y[i] ** 2 <= ddd:
        ans += 1

print(ans)


Measured memory_bytes: 73104
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

long long int lcm(long long int a, long long int b) {
  return (a / gcd(a, b)) * b;
}

long long int combination(long long int n, long long int r) {
  if ( r * 2 > n ) r = n - r;
  long long int dividend = 1;
  long long int divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}
long long int tmp(long long int n, long long int r) {
  return combination(n+r-1, r);
}


int main() {
  long long int N;
  vector<long long int> a_v;
  cin >> N;
  for (int i = 0; i < N; i++) {
    long long int a;
    cin >> a;
    a_v.push_back(a);
  }
  int flag = 0;
  long long int tmp = a_v[0];
  for (int i = 1; i < N; i++) {
    tmp ^= a_v[i];
  }
  
  if (tmp == 0) {
    cout << "Yes" <<  endl;
  }
  else {
    cout << "No" <<  endl;
  }  
  return 0;
}


Measured memory_bytes: 1400
#include <stdio.h>

int main(void){
	int i,j,m,n;
	int A[100][100],b[100],sum[100];
	
	scanf("%d %d",&n,&m);

	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%d",&A[i][j]);
		}
	}

	for(i=0;i<m;i++){
		scanf("%d",&b[i]);
	}

	for(i=0;i<n;i++){
		sum[i]=0;
		for(j=0;j<m;j++){
			sum[i]+=A[i][j]*b[j];
		}
		printf("%d\n",sum[i]);
	}

	return 0;
}

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

int search(int A[], int n, int key) {
    int left = 0, right = n, mid;
    while (left < right) {
        mid = (left + right) / 2;
        if (A[mid] == key) return mid;
        if (A[mid] > key) {
            right = mid;
        } else {
            left = mid + 1;
        }
    }
    return -1;
}

int main() {
    int n, q;
    cin >> n;
    int S[n];
    for (int i = 0; i < n; i++) cin >> S[i];
    cin >> q;
    int key, C = 0;
    for (int i = 0; i < q; i++) {
        cin >> key;
        if (search(S, n, key) != -1) C++;
    }
    cout << C << endl;

}


Measured memory_bytes: 3448
def dfs(i,sumnum,sums):
    global ans
    if i == 4:
        if sumnum == 7:
            print(sums + "=7")
            exit()
    else:
        dfs(i+1,sumnum + int(s[i]),sums + "+" + s[i])
        dfs(i+1,sumnum - int(s[i]),sums + "-" + s[i])
s = input()
dfs(1,int(s[0]),s[0])


Measured memory_bytes: 9028
#include <bits/stdc++.h>
#define int long long
#define lint long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int N;
    cin >> N;
    vector<int> H(N);
    cin >> H;
    REV(H);
    int mx = H[0];
    int ans = 0, cnt = 0;
    FOR(i,1,N) {
        if (H[i] >= mx) {
            cnt++;
        } else {
            cnt = 0;
        }
        CHMAX(ans,cnt);
        mx = H[i];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
import sys
N, K = map(int, input().split())
A = list(map(int, sys.stdin.readline().split()))
visited = [0] * N
visited[0] = 1
ikisaki = 0
c = 1
while c < N:
    ikisaki = A[ikisaki] - 1
    c += 1
    if visited[ikisaki]:
        loop = c - visited[ikisaki]
        c = N
    else:
        visited[ikisaki] = c

if K - (visited[ikisaki] - 1) >= 0:
    amari = (K - (visited[ikisaki] - 1)) % loop
else:
    amari = K - (visited[ikisaki] - 1)
new = [i - visited[ikisaki] for i in visited]
print(new.index(amari) + 1)

Measured memory_bytes: 32400
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();

    double[] v = new double[N];
    for (int i = 0; i < N; i++) {
      v[i] = sc.nextDouble();
    }
    Arrays.sort(v);

    double sum = 0;
    for (int i = N-1; i >=2 ; --i) {
      sum += v[i] / ((long)1 << N-i );
    }
    sum += (v[0]+v[1])/ ((long)1 << (N-1) );


    System.out.println(sum);


  }

}


Measured memory_bytes: 23252
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition) cout << "Yes" << '\n'; else{ cout << "No" << '\n'; }
#define YES(condition) if(condition) cout << "YES" << '\n'; else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition) cout << "yes" << '\n'; else{ cout << "no" << '\n'; }




int main() {
    ll n, t;
    cin >> n >> t;
    ll ans = INF;
    REP(i, n){
        ll a, b;
        cin >> a >> b;
        if(b <= t){
            ans = min(ans, a);
        }
    }
    if(ans != INF) cout << ans << endl;
    else cout << "TLE" << endl;
}


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

int search(int A[], int n, int key){
    int i = 0;
    A[n] = key;
    while(A[i]!=key){
        i++;
    }
    return i!=n;
}

int main(){
    int i,n,A[10000+1],q,key,sum=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>A[i];
    }
    cin>>q;
    for (i=0;i<q;i++){
        cin>>key;
        if(search(A,n,key)){
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second
 
int main(int argc, char **argv) {
	ll x, a, s;
	cin >> x;
	s = 0; a = x;
	REP(i, 8) {
		s += a % 10;
		a /= 10;
	}
	cout << (x % s == 0 ? "Yes" : "No") << endl;
	return 0;
}
 

Measured memory_bytes: 256
h, w = gets.chomp.split.map(&:to_i)
ary = []

h.times do
  str = gets.chomp
  if str.length != str.count('.')
    ary.push(str.split(''))
  end
end

ary_t = ary.transpose

# if ary.count == 1
#   ary_ans = []
#   ary_t.each_with_index do |str, i|
#     if str != ["."]
#       ary_ans.push(str)
#     end
#   end
# else
ary_ans_c = []
ary_t.each_with_index do |str, i|
  if str.count != str.count('.')
    ary_ans_c.push(str)
  end
end
ary_ans = ary_ans_c.transpose
# end


ary_ans.each do |str|
  puts str.join('')
end

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

int main() {
    int k, s;
    cin >> k >> s;
    int ans = 0;
    for (int x = 0; x <= k; x++) {
        for (int y = 0; y <= k; y++) {
            int z = s - x - y;
            if (z >= 0 && z <= k)
                ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int a,b,c,d;
cin >> a >> b >>  c >> d;

if(abs(a-c)<=d){
  cout<< "Yes" <<endl;
}else if(abs(a-b)<=d && abs(b-c)<=d){
  cout<< "Yes" <<endl;
}else{
  cout<< "No" << endl;
}
}


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

int main(){
  int N, M;
  cin >> N >> M;
  vector<long long> A(M);
  for(int i = 0; i < M; ++i) cin >> A[i];
  sort(A.begin(), A.end());
  int c[] = {(int)1e9,2,5,5,4,5,6,3,7,6};
  vector<string> dp(N+1,"?");
  dp[N] = "";
  for(int i = N; i >= 0; --i){
    for(int j = 0; j < M; ++j){
      if(dp[i] == "?") continue;
      if(i < c[A[j]]) continue;
      string t = dp[i] + string(1,'0'+A[j]);
      string s = dp[i-c[A[j]]];
      if(s == "?" or s.length() < t.length() or s < t)
        dp[i-c[A[j]]] = t;
    }
  }
  cout << dp[0] << endl;
}


Measured memory_bytes: 33024
#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;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
ll mod = 1e9+7;
using namespace std;

int main(){
	
	int H,W ;
	cin>>H>>W;
	char arr[H][W];
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin>>arr[i][j];
		}
	}
	ll dp[H][W];
	memset(dp, 0, sizeof(dp));
	dp[H-1][W-1]=1;
	for(int i=W-2;i>=0;i--) {
		if(arr[H-1][i]=='.'){
			dp[H-1][i]+=dp[H-1][i+1];
		}
	}
	for(int i=H-2;i>=0;i--) {
		if(arr[i][W-1]=='.'){
			dp[i][W-1]+=dp[i+1][W-1];
		}
	}
	for(int i=H-2;i>=0;i--){
		for(int j=W-2;j>=0;j--){
			if(arr[i][j]=='.'){
				dp[i][j]= (dp[i][j+1]%mod + dp[i+1][j]%mod )%mod;
			}
		}
	}
	ll ans= dp[0][0]%mod;
	cout<<ans<<endl;
	return 0;
	
}


Measured memory_bytes: 12304
#!/usr/bin/env python3
n = int(input())
x = []
y = []
k = 1
for c in bin(n + 1)[2 :][1 :]:
    x += [ k ]
    y += [ k ]
    k += 1
    if int(c):
        x = [ k ] + x
        y += [ k ]
        k += 1
print(len(x + y))
print(*(x + y))


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeSet;

import static java.util.Arrays.binarySearch;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    private static int mod = 998244353;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        double a = in.nextDouble();
        double b = in.nextDouble();
        double x = in.nextDouble();
        double l = 0, r = Math.PI / 2;
        for (int i = 0; i < 1000000; i++) {
            double m = (l + r) / 2;
            double v = get(a, b, m);
            if (v >= x) {
                r = m;
            } else {
                l = m;
            }
        }
        out.println(90 - l * 180 / Math.PI);
    }

    private double get(double a, double b, double m) {
        double c = b - a / Math.tan(m);
        if (c < 0) {
            return b * b * Math.tan(m) * a / 2;
        }
        return a * (c + b) * a / 2;
    }

}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

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

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

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

}


Measured memory_bytes: 23380
import java.util.Scanner;

public class Main {
	static class UnionFindTree {
	    private int[] parent;    //親ノード
	    private int[] rank;      //高さ or 次数
	    public UnionFindTree(int size) {
	        parent = new int[size];
	        rank = new int[size];
	        for (int i = 0; i < size; i++) {
	            makeSet(i);
	        }
	    }
	    public void makeSet(int x) {
	        parent[x] = x;
	        rank[x] = 0;
	    }
	    public void union(int x, int y) {
	        final int xRoot = find(x);
	        final int yRoot = find(y);
	        if (rank[xRoot] > rank[yRoot]) {
	            parent[yRoot] = xRoot;        //x の木に結合
	        }
	        else if(rank[xRoot] < rank[yRoot]) {
	            parent[xRoot] = yRoot;        //y の木に結合
	        }
	        else if (xRoot != yRoot) {        //同じ高さで根が違うとき
	            parent[yRoot] = xRoot;        //x の木に結合
	            rank[xRoot]++;                //x の木の高さを加算
	        }
	    }
	    public int find(int x) {
	        if (x != parent[x]) {    //根でないとき
	            parent[x] = find(parent[x]);    //直接、根に繋ぐ(経路圧縮)
	        }
	        return parent[x];
	    }
	    public boolean same(int x, int y) {
	        return find(x) == find(y);
	    }
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		UnionFindTree uf = new UnionFindTree(N);
		int M = sc.nextInt();
		for(int i = 0 ; i < M ; ++i){
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			uf.union(a, b);
		}
		int gs[] = new int[N];
		for(int i = 0 ; i < N ; ++i){
			int g = uf.find(i);
//			System.out.println(i+" "+g);
			gs[g]++;
		}
		int ret = 0;
		for(int g : gs){
			ret = Math.max(ret, g);
		}
		System.out.println(ret);
	}
}


Measured memory_bytes: 61136
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(A: int, B: int, C: int):
    if A == B:
        print(C)
    elif B == C:
        print(A)
    else:
        print(B)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
N,K=map(int,input().split())
D=list(map(int,input().split()))
def solve():
  for i in range(10*N+2):
    if i>=N:
      s=str(i)
      for j in range(len(s)):
        if int(s[j]) in D: break
      else:
        print(i)
        return 0

solve()

Measured memory_bytes: 2940
#include<iostream>
using namespace std;
#include <vector>
#define re(i,n) for(int i = 0; i < n; i++)

int main() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	
	while (b <= a) {
		b *= 2;
		k--;
	}

	while (c <= b) {
		c *= 2;
		k--;
	}

	if (k >= 0) cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll N,K;
vector<ll> A,B;
void input(){
    fast_io();
    cin >> N >> K;
    for (int i = 0; i < N; i++)
    {
        ll a,b; cin >> a >> b;
        A.push_back(a);
        B.push_back(b);
    }
}

int TLEsolve(){
    vector<map<ll,ll>> dp(N+1);
    dp[0][0] = 0;
    for (int i = 0; i < N; i++)
    {
        dp[i+1] = dp[i];
        for(auto [k,v]:dp[i]){
            if((k|A[i])<=K) dp[i+1][k|A[i]] = v + B[i];
        }
        dp[i].clear();
    }
    ll ans = 0;
    for(auto [k,v]:dp[N]){
        ans = max(ans,v);
    }
    cout << ans << endl;
    return 0;
}   

bool isOk(ll A, int bit){
    for (int b = 31; b >= bit; b--)
    {
        if((((K>>b)&1LL)==0LL) && (((A>>b)&1LL)==1LL)) return false;
    }
    if((((A>>bit)&1LL)==1LL) && bit) return false;
    return true;
}

int solve(){
    ll ans = 0LL;
    for (int bit = 31; bit >= 0; bit--)
    {
        if((((K>>bit)&1LL)==0LL) && bit) continue;
        ll ansbit = 0LL;
        for (int i = 0; i < N; i++)
        {
            if(isOk(A[i],bit)){
                ansbit += B[i];
            }
        }
        ans = max(ans,ansbit);
    }
    cout << ans << endl;
    return 0;    
}

int main()
{
    input();
    solve();
    return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll H, W;
    cin >> H >> W;
    vector<string> S(H);
    REP(i,0,H) cin >> S[i];
    REP(i,0,H) {
        PR(S[i]);
        PR(S[i]);
    }

    return 0;
}

/*



*/

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

int main (){
	while(1){
		int K, c[10000], sum = 0;
		cin>>K;
		if(0 == K) break;
		for(int i = 0; i < K *(K - 1) / 2; i++){
			cin>>c[i];
			sum += c[i];
		}
		sum = sum / (K - 1);
		cout<<sum<<endl;
	
	}
	return 0;
}



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

using namespace std;

#define endl "\n"
#define lln long long int
#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
	IOS;

	string s;
	cin >> s;
	int n = s.length();
	if(s[n-1] == 's') s.append("es");
	else s.push_back('s');
	cout << s << endl;
	return 0;    
}

Measured memory_bytes: 3660
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

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


int main(){
    int n; cin >> n;
    VI a(n);
    REP(i, n)  cin >> a[i];
    int q; cin >> q;
    REP(i, q){
        int k; cin >> k;
        cout << noboolalpha << binary_search(ALL(a), k) << "\n";
    }
    return 0;
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MD=1e9+7;
int quick_pow(int x,int y) {
	int ans=1;
	while(y) {
		if(y&1) ans=1LL*ans*x%MD;
		y>>=1;
		x=1LL*x*x%MD;
	}
	return ans;
}
void add(int &x,int y) {
	x+=y;
	if(x>=MD) x-=MD;
	if(x<0) x+=MD;
}
int main() {
	//freopen("in.txt","r",stdin);
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int ans=quick_pow(2,n),s=1;
	add(ans,-1);
	for(int i=1;i<=b;i++) {
		s=1LL*s*(n-i+1)%MD,s=1LL*s*quick_pow(i,MD-2)%MD;
		if(i==a) add(ans,-s);
		if(i==b) add(ans,-s);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 384
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

S = input()
boo = not('L' in S[::2] ) and not('R' in S[1::2])
print('Yes' if boo else 'No')

Measured memory_bytes: 12452
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<double, long long> pdl;

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007

ll power(ll a, ll b) {
	if (b == 0) return 1;
	ll pp = power(a, b/2);
	pp = (pp*pp) % mod;
	if(b%2 == 0) return pp;
	return (pp*a)%mod;
}

ll A[1<<20];int n;
ll front[1<<20];
ll back[1<<20];

int main() {
    //freopen("input.in","r",stdin);
  	//freopen("output.out","w",stdout);
	cin>>n;
	rep(i, 3*n) cin>>A[i+1];
	priority_queue<int, vector<int>, greater<int> > minpq;
	ll sum = 0;
	rep(i, n) {
		minpq.push(A[i+1]);
		sum += A[i+1];
	}

	ll ans = sum;

	front[n] = sum;
	for(int i = n+1;i <= 2*n;i++) {
		ll minm = minpq.top();
		if(A[i] <= minm) front[i] = front[i-1];
		else {
			minpq.pop();
			minpq.push(A[i]);
			sum += A[i]-minm;
			front[i] = sum;
		}
	}

	priority_queue<int, vector<int>, less<int> > maxpq;
	sum = 0;
	rep(i, n) {
		maxpq.push(A[3*n-i]);
		sum += A[3*n-i];
	}

	ans -= sum;

	back[2*n+1] = sum;
	for(int i = 2*n;i > n;i--) {
		ll maxm = maxpq.top();
		if(A[i] >= maxm) back[i] = back[i+1];
		else {
			maxpq.pop();
			maxpq.push(A[i]);
			sum += A[i]-maxm;
			back[i] = sum;
		}
	}

	for(int i = n;i <= 2*n;i++) {
		ans = max(ans, front[i]-back[i+1]);
	}

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


Measured memory_bytes: 8056
N, K = map(int, input().split())
n = []
for i in range(N):
  n.append(1)
for j in range(K):
  di = int(input())
  l = input().split()
  for k in range(di):
    if n[int(l[k])-1] == 1:
      n[int(l[k])-1] = 0
r = 0
for i in range(N):
  r += n[i]
print(r)

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

#define int long long

using namespace std;

int grid[505][505];
bool vis1[505][505], vis2[505][505], vis3[505][505];
int bad[32][32];
int one[32], tw[32], tr[32];
int n, c;

void setONE(int i, int j){
    if(vis1[i][j] || i >= n || i < 0 || j >= n || j < 0) return;
   // cout << i << ' ' << j << endl;
    vis1[i][j] = true;
    setONE(i-1, j+1);
    setONE(i+3, j);
    setONE(i+2, j+1);
    setONE(i+1, j+2);
    setONE(i, j+3);

    //printf("%lld %lld -> act col %lld : \n",i, j, grid[i][j]);
    for(int k = 0; k < c; k++){
        //printf("addind %lld to 1 for kolor %lld\n", bad[grid[i][j]][k], k);
        one[k]+=bad[grid[i][j]][k];
    }
}

void setTWO(int i, int j){
    if(vis2[i][j] || i >= n || i < 0 || j >= n || j < 0) return;
   // cout << i << ' ' << j << endl;
    vis2[i][j] = true;
    setTWO(i-1, j+1);
    setTWO(i+3, j);
    setTWO(i+2, j+1);
    setTWO(i+1, j+2);
    setTWO(i, j+3);

    //printf("%lld %lld -> act col %lld : \n",i, j, grid[i][j]);
    for(int k = 0; k < c; k++){
        //printf("addind %lld to 1 for kolor %lld\n", bad[grid[i][j]][k], k);
        tw[k]+=bad[grid[i][j]][k];
    }
}

void setTHR(int i, int j){
    if(vis3[i][j] || i >= n || i < 0 || j >= n || j < 0) return;
    //cout << i << ' ' << j << endl;
    vis3[i][j] = true;
    setTHR(i-1, j+1);
    setTHR(i+3, j);
    setTHR(i+2, j+1);
    setTHR(i+1, j+2);
    setTHR(i, j+3);

    //printf("%lld %lld -> act col %lld : \n",i, j, grid[i][j]);
    for(int k = 0; k < c; k++){
        //printf("addind %lld to 1 for kolor %lld\n", bad[grid[i][j]][k], k);
        tr[k]+=bad[grid[i][j]][k];
    }
}

signed main()
{
    cin >> n >> c;
    for(int i = 0; i < 32; i++){
        one[i] = tw[i] = tr[i] = 0;
    }
    for(int i = 0; i < c; i++){
        for(int j = 0; j  < c; j++){
            cin >> bad[i][j];
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            vis1[i][j] = vis2[i][j] = vis3[i][j] = false;
            cin >> grid[i][j];
            grid[i][j]--;
        }
    }

    setONE(0,0);
    setTWO(1,0); setTWO(0, 1);
    setTHR(2,0); setTHR(1, 1); setTHR(0, 2);

    for(int i = 0; i  < c; i++){
     //   printf("to make 1 in color %lld : %lld\n", i, one[i]);
      //  printf("to make 2 in color %lld : %lld\n", i, tw[i]);
      //  printf("to make 3 in color %lld : %lld\n", i, tr[i]);

    }

    int ans = 99999999999999;

    for(int i = 0; i  < c; i++){
        for(int j = 0; j < c; j++){
            if(i == j) continue;
            for(int k = 0; k < c; k++){
                if(i == k || j == k) continue;
                ans = min(ans, one[i]+tw[j]+tr[k]);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
using namespace std;
using VI  = vector<int>;
using PII = pair<int, int>;
using VP  = vector<PII>;
using VVP = vector<VP>;
VI color;
VVP g;
int n, cmax;
inline void DFS(int x, int w) {
    int temp(1), y, i;
    for (const PII& P : g[x]) {
        tie(y, i) = P;
        if (!color[i]) {
            temp += (temp == w);
            color[i] = temp;
            DFS(y, temp);
            ++temp;
        }
    }
}
int x, y;
int main() {
    DAU
    cin >> n;
    g = VVP(n + 1);
    for (int i = 1; i < n; ++i) {
        cin >> x >> y;
        g[x].emplace_back(y, i);
        g[y].emplace_back(x, i);
    }
    color = VI(n);
    DFS(1, n);
    for (int i = 1; i < n; ++i)
        cmax = max(cmax, color[i]);
    cout << cmax << '\n';
    for (int i = 1; i < n; ++i)
        cout << color[i] << '\n';
    PLEC
}


Measured memory_bytes: 9644
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	long long int a;
	long long int ans = 0;
	for (int i = 0;i < n;i++) {
		cin >> a;
		ans += a - 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <stack>
#include <vector>
#include <map>
#include <string>
#include <string.h>
#include <cstring>
#include <queue>
#include <algorithm>
#include <math.h>

using namespace std;

typedef long long ll;



int main()
{
	int N, h;
	vector<int> heights, mins;
	cin >> N;
	for (int i = 0; i < N; i++) 
	{
		cin >> h;
		heights.push_back(h);
	}
	mins.resize(N);
	mins[0] = 0;
	mins[1] = abs(heights[0] - heights[1]);

	for (int i = 2; i < N; i++) 
	{
		mins[i] = min(mins[i-2] + abs(heights[i] - heights[i-2]), mins[i-1] + abs(heights[i] - heights[i-1]));
	}
	cout << mins[N - 1];
}

Measured memory_bytes: 1144
use proconio::*;

fn run() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let m = 1000000usize;
    let mut cnt = vec![0; m + 1];
    for a in a.iter() {
        cnt[*a] += 1;
    }
    let mut prime = vec![true; m + 1];
    for i in (2usize..).take_while(|k| k.pow(2) <= m) {
        if prime[i] {
            let mut j = i * i;
            while let Some(p) = prime.get_mut(j) {
                *p = false;
                j += i;
            }
        }
    }
    prime.into_iter().enumerate().filter(|p| p.1).skip(2).for_each(|(p, _)| {
        for i in 1..=(m / p) {
            cnt[i * p] += cnt[i];
        }
    });
    let ans = a.into_iter().filter(|&a| cnt[a] == 1).count();
    println!("{}", ans);
}

fn main() {
    run();
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define free1 freopen("input.txt", "r", stdin)
#define free2 freopen("output.txt", "w", stdout)
#define mp make_pair
#define pb push_back
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

//template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m;}
long long mod=1000000007;

int main()
{
	
	string s;
	cin>>s;
	int t1,t2;
	string t="AC";
	int c=0;
	for(int i=0;i<s.length()-1;i++)
	{
		if(s[i+1]=='C'&&s[i]=='A'){
			cout<<"Yes";
			return 0;
		}
	}
			cout<<"No";
	return 0;
}

Measured memory_bytes: 256
a11, a12, a13 = map(int, input().split())
a21, a22, a23 = map(int, input().split())
a31, a32, a33 = map(int, input().split())
n = int(input())
b = list(int(input()) for i in range(n))

if a11 in b and a12 in b and a13 in b:
    print('Yes')
    exit()

if a21 in b and a22 in b and a23 in b:
    print('Yes')
    exit()

if a31 in b and a32 in b and a33 in b:
    print('Yes')
    exit()

if a11 in b and a21 in b and a31 in b:
    print('Yes')
    exit()

if a12 in b and a22 in b and a32 in b:
    print('Yes')
    exit()

if a13 in b and a23 in b and a33 in b:
    print('Yes')
    exit()

if a11 in b and a22 in b and a33 in b:
    print('Yes')
    exit()

if a31 in b and a22 in b and a13 in b:
    print('Yes')
    exit()

print('No')
exit()


Measured memory_bytes: 3064
main = do
    [l, r] <- map read . words <$> getLine
    print $ if r - l >= 2019 then 0 else sub3 l r

sub3 :: Int -> Int -> Int
sub3 l r = minimum $ map (\(x, y) -> x * y `mod` 2019) $ comb2 [l..r]

comb2 :: [Int] -> [(Int, Int)]
comb2 [] = []
comb2 (x:xs) = [(x, y) | y <- xs] ++ comb2 xs


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

long long npatty(long long N, long long X){
    if(N==0) return 1;
    long long len  = (1LL<<(N+1))-3;
    long long pnum = (1LL<<(N))-1;
    if(X==1) return 0; // "B"
    else if(X<=len+1){ // "B" + (L-1)
        return npatty(N-1, X-1);
    } 
    else if(X==len+2) { // "B" + (L-1) + "P"
        return pnum + 1;
    }
    else if(X<=2*(len+1)){ // "B" + (L-1) + "P" + (L-1)
        return pnum + 1 + npatty(N-1, X-len-2);
    } else {
        return pnum * 2 + 1;
    }
}

int main(){
    long long N, X; cin >> N >> X;
    cout << npatty(N, X) << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int a, b;
	cin >> a >> b;
	//make a chess board lol
	int n = 100;
	vector<string> s(n);
	rep(i, n){
		rep(j, n) s[i] += '.';
	} 
	int num = b - 1;
	int f = 1;
	for(int i = 0; i < n; i += 2){
		for(int j = 0; j < n; j += 2){
			if(!num){
				f = 0;
				break;
			}
			s[i][j] = '#';
			num--;
		}
		if(!f) break;
	}
	//do the white
	for(int i = n - 1; i >= (n - 40); i--){
		rep(j, n) s[i][j] = '#';
	}
	num = a - 1;
	f = 1;
	for(int i = n - 1; i >= (n - 40); i -= 2){
		for(int j = 0; j < n; j += 2){
			if(!num){
				f = 0;
				break;
			}
			s[i][j] = '.';
			num--;
		}
		if(!f) break;
	}
	cout << "100 100" << endl;
	rep(i, n) cout << s[i] << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let n = i.read::<usize>();
    let (t, a) = i.read2::<f64, f64>();
    let h = i.read_vec::<f64>(n);

    let mut idx = None;
    let mut d = std::f64::MAX;

    for i in 0..n {
        let ti = t - h[i] * 0.006;
        let di = (ti - a).abs();
        if di < d {
            d = di;
            idx = Some(i);
        }
    }
    writeln!(o, "{}", idx.unwrap() + 1).unwrap();
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_line().parse().ok().unwrap()
        }
        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }

        pub fn read_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            self.read_line()
                .split(' ')
                .take(n)
                .map(|x| x.parse().ok().unwrap())
                .collect()
        }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }
}


Measured memory_bytes: 4352