akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		 try {
		 BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		
		 String ln;
		ln = buf.readLine();
		
       String[] strAry = ln.split(" ");
       int x = Integer.parseInt(strAry[0]);
       int y = Integer.parseInt(strAry[1]);
		
       System.out.println(x*y +" " + (y*2+x*2));
			} catch (IOException e) {
				// TODO ????????????????????? catch ????????????
				e.printStackTrace();
			}
    }
}

Measured memory_bytes: 24188
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

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

  ll n,m,s;
  std::cin>>n>>m>>s;

  const ll MAX=50*(n-1);
  
  chmin(s,MAX);

  using P=std::pair<ll,ll>;

  std::vector<std::vector<P>> graph((MAX+1)*n);

  rep(i,0,m){
    ll u,v,a,b;
    std::cin>>u>>v>>a>>b;
    u--;v--;
    rep(j,a,MAX+1){
      graph[j*n+u].emplace_back((j-a)*n+v,b);
      graph[j*n+v].emplace_back((j-a)*n+u,b);
    }
  }

  rep(i,0,n){
    ll c,d;
    std::cin>>c>>d;
    rep(j,0,MAX){
      graph[j*n+i].emplace_back(std::min(j+c,MAX)*n+i,d);
    }
  }

  std::priority_queue<P,std::vector<P>,std::greater<P>> que;
  constexpr ll INF=1e18;
  std::vector<ll> d((MAX+1)*n,INF);

  d[s*n]=0;
  que.emplace(0,s*n);

  while(!que.empty()){
    P now=que.top();que.pop();
    if(d[now.second]<now.first)continue;
    for(const auto& e:graph[now.second]){
      if(d[e.first]>d[now.second]+e.second){
        d[e.first]=d[now.second]+e.second;
        que.emplace(d[e.first],e.first);
      }
    }
  }

  rep(i,1,n){
    ll min=INF;
    rep(j,0,MAX+1)chmin(min,d[n*j+i]);
    std::cout<<min<<"\n";
  }

  return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


li n;
li a[55];
li b[55];

inline bool can(li x) {
    bitset<55> bs(x);
    vector<vector<li>> table(51, vector<li>(51, 0));
    rep(from, 51) {
        repp(dividor, 1, 51) {
            if (bs[dividor]) {
                table[from][from % dividor] = 1;
            }
        }
        table[from][from] = 1;
    }
    rep(k, 51) {
        rep(i, 51) {
            rep(j, 51) {
                if (table[i][k] > 0 && table[k][j] > 0) {
                    table[i][j] = 1;
                }
            }
        }
    }
    rin{
        if (table[a[i]][b[i]] == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    cin >> n;
    rin{
        cin >> a[i];
    }
    rin{
        cin >> b[i];
    }

    if (!can(bit(51) - 1)) {
        puts("-1");
        return 0;
    }

    li res = 0;
    for (li i = 50; i > 0; i--) {
        if (can(res + bit(i + 1) - 1) && !can(res + bit(i) - 1)) {
            //p2(i, res);
            res += bit(i);
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    ll ans[] = {0, 0};
    rep(c, 2)
    {
        int color = c;
        for (char s : S)
        {
            int s_i = s - '0';
            if (color != s_i)
                ans[c]++;
            color = 1 - color;
        }
    }
    cout << min(ans[0], ans[1]) << endl;

    return 0;
}


Measured memory_bytes: 512
/*||>>>> Praveen Ojha <<<<>>>> 20 July 2019 <<<<>>>> 17:36:57 <<<<||*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
//Read Problems Carefully & Check for corner cases N=0,1 ?
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

int32_t main(){__
	int n;
	cin>>n;
	vi a(n);
	vpii vv;
	for(int i=0;i<n;i++){
		cin>>a[i];
		vv.push_back({a[i],i});
	}
	sort(all(vv));
	for(int i=0;i<n;i++){
		int t=n-1;
		while(vv[t].S==i){
			t--;
		}
		cout<<vv[t].F<<"\n";
	}
return 0;
}

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

using namespace std;

int main(){ 
	int n;
	cin>>n;
	int a;
	int prima = 0;
	for(int i=1; i<=n;i++){
		cin>>a;
		int prime=1;
		if (a==1){
			prime=0;
		}
		for(int j=2; j<= sqrt(a); j++){
			if(a % j ==0){
			prime=0;
			}
		}
		if(prime==1){
		prima=prima+1;
		}
	}
	cout<<prima<<endl;
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
int main(){
  long H,W,K;cin>>H>>W>>K;
  vector<string>S(H);for(long i=0;i<H;i++)cin>>S[i];
  

  
  long ans=H+W;
  for(long r=0;r<(1<<H-1);r++){
    bitset<11>bit(r);
    vector<long>count(H,0);

    bool ok=1;
    long tmp=bit.count();
    for(long c=0;c<W;c++){//列
      vector<long>a(H,0);//この列での増分
  
      long id=0;
      //数える
      a[0]=(S[0][c]=='1');
      for(long i=0;i<H-1;i++){
        if(bit.test(i))id++;
        a[id]+=(S[i+1][c]=='1');
      }  
      
      
      //列の中ですでにKを超えたらダメ
      for(long x:a)ok*=(x<=K);
      if(!ok)break;
      
      bool ok2=1;
      for(long i=0;i<H;i++)ok2*=((count[i]+a[i])<=K);
      if(!ok2){
        tmp++;
        count=vector<long>(H,0);
      }
     
      for(long i=0;i<H;i++)count[i]+=a[i];
    
    }
    if(ok)ans=min(ans,tmp);
  }
  cout<<ans;
}

/*



*/

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <vector>

// double
struct P{
    P(){}
    P(double _r, double _i):r(_r), i(_i){}
    void real(const double& v){r = v;}
    void imag(const double& v){i = v;}
    double r, i;
};

double real(const P& p){return p.r;}
double imag(const P& p){return p.i;}
double norm(const P& p){double r = real(p), i = imag(p); return r * r + i * i;}
double dist(const P& p){return std::sqrt(norm(p));}

P operator+(const P& lhs, const P& rhs){
    return P(real(lhs)+real(rhs), imag(lhs)+imag(rhs));
}
P operator-(const P& lhs, const P& rhs){
    return P(real(lhs)-real(rhs), imag(lhs)-imag(rhs));
}
P operator-(const P& p){
    return P(-real(p), -imag(p));
}

double cross(const P& lhs, const P& rhs){
    return real(lhs)*imag(rhs) - imag(lhs)*real(rhs);
}

double dot(const P& lhs, const P& rhs){
    return real(lhs)*real(rhs) + imag(lhs)*imag(rhs);
}

const double EPS = 1e-9, D_THETA = 0.06, D_R = 0.06;

int N;
P ps[100];
std::vector<P> is;

void addIntersection(int i, int j){
    if(dist(ps[i]-ps[j]) > 2.0){return;}
    
    P m{(real(ps[j])-real(ps[i])) / 2, (imag(ps[j])-imag(ps[i])) / 2}, n{-imag(m), real(m)};
    {
        double d = dist(n);
        n.real(real(n) / d);
        n.imag(imag(n) / d);
    }

    double t = std::sqrt(1 - norm(m));
    for(int k=-1;k<=1;k+=2){
        P p{t * k * real(n), t * k * imag(n)};
        P q = ps[i] + m + p;
        // printf("%.6f, %.6f\n", real(q), imag(q));
        is.push_back(q);
    }
}

int count(P p){
    int res = 0;
    for(int i=0;i<N;i++){
        if(dist(ps[i]-p) < 1.0 + EPS){res++;}
    }
    return res;
}

int main(){
    while(scanf("%d", &N), N){
        is.clear();
        
        for(int i=0;i<N;i++){
            double x, y;
            scanf("%lf,%lf", &x, &y);

            ps[i].real(x);
            ps[i].imag(y);
        }

        for(int i=0;i<N;i++){
            for(int j=i+1;j<N;j++){
                addIntersection(i, j);
            }
        }
        
        int res = 1;
        for(auto i : is){
            res = std::max(res, count(i));
        }

        printf("%d\n", res);
    }
}

Measured memory_bytes: 1084
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    lint x;
    cin >> x;
    --x;
    lint q = x / 11;
    lint r = x - q*11;
    if (r >= 6) cout << q*2+2;
    else cout << q*2+1;
    cout << endl;
    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		try {
			while((line = in.readLine()) != null) {
				int m = Integer.valueOf(line.split(" ")[1]);
				int a = Integer.valueOf(line.split(" ")[2]);
				if(m == 0) break;
				List<Line> l = new ArrayList<Line>();
				
				for(int i = 0; i < m; i++) l.add(new Line(in.readLine().split(" ")));
				
				java.util.Collections.sort(l);
				for(Line ll : l) a = ll.transit(a);
				System.out.println(a);
			}
			in.close();
		}catch(IOException e) {
			e.printStackTrace();
		}
	}
}

class Line implements Comparable<Line> {
	int hight;
	int left;
	int right;

	public Line(String[] lines) {
		hight = Integer.valueOf(lines[0]);
		left = Integer.valueOf(lines[1]);
		right = Integer.valueOf(lines[2]);
	}

	public int transit(int now) {
		if(now == left) return right;
		else if(now == right) return left;
		return now;
	}

	@Override
	public int compareTo(Line o) {
		return o.hight - this.hight;
	}
}

Measured memory_bytes: 72284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define mp(a, b) make_pair(a, b)
const int maxn = 2e5 + 10;
const ll inf = 1e18 + 10;
ll ans = inf;
int n, tot;
int xmin = 1e9 + 10, xmax, ymin = 1e9 + 10, ymax;
int a[maxn][2];
pii val[maxn], b[maxn << 1];;
struct cmp
{
	bool operator() (const pii & i, const pii & j)
	{
		if(a[i.first][i.second] != a[j.first][j.second]) return a[i.first][i.second] < a[j.first][j.second];
		return i.first < j.first || (i.first == j.first && i.second < j.second);
	}
};
bool cmpb (const pii & i, const pii & j)
{
	return a[i.first][i.second] < a[j.first][j.second] || (a[i.first][i.second] == a[j.first][j.second] && i.second < j.second);
}
set<pii, cmp> s;
void solve()
{
	if(b[1].first != b[tot].first) s.insert(mp(b[1].first, 1)), s.insert(mp(b[tot].first, 0));
	for(int i = 2; i < tot; ++i)
		if(b[i].second == 0)
			s.insert(b[i]);
	while(true)
	{
		ans = min(ans, 1ll * (a[s.rbegin()->first][s.rbegin()->second] - a[s.begin()->first][s.begin()->second]) * (ymax - xmin));
		auto x = *s.begin();
		if(x.first == tot || x.second == 1)
			break;
		s.erase(x);
		x.second = 1;
		s.insert(x);
	}
	s.clear();
}
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d%d", &val[i].first, &val[i].second);
		if(val[i].first > val[i].second) swap(val[i].first, val[i].second);
		xmin = min(xmin, val[i].first);
		xmax = max(xmax, val[i].first);
		ymin = min(ymin, val[i].second);
		ymax = max(ymax, val[i].second);
	}
	ans = min(ans, 1ll * (xmax - xmin) * (ymax - ymin));
	sort(val + 1, val + n + 1);
	for(int i = 1; i <= n; ++i) a[i][0] = val[i].first, a[i][1] = val[i].second;
	for(int i = 1; i <= n; ++i) b[++tot] = mp(i, 0), b[++tot] = mp(i, 1);
	sort(b + 1, b + tot + 1, cmpb);
	solve();
	for(int i = 1; i <= n; ++i) s.insert(mp(i, 0));
	for(int i = 2; i < tot && b[i].second == 0; ++i)
	{
		if(b[i].first == b[tot].first) continue;
		s.erase(mp(i, 0));
		s.insert(mp(i, 1));
		ans = min(ans, 1ll * (a[s.rbegin()->first][s.rbegin()->second] - a[s.begin()->first][s.begin()->second]) * (ymax - a[b[i].first][0]));
		s.erase(mp(i, 1));
		s.insert(mp(i, 0));
	}
	printf("%lld\n", ans);
	return 0;
}
/*
7
10 4
11 28
24 22
8 6
4 28
8 22
11 11
*/

Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=998244353;
const ll inf=1e17;
const ll ms=(2e5)+5;


ll ar[ms];
ll ans[ms];

int main()
{
    idfc;
    int n;
    cin>>n;
    int i;
    ll a=0;

    for(i=1;i<=n;i++)cin>>ar[i];

    for(i=1;i<=n;i++)
    {
        if(i%2)a+=ar[i];
        else a-=ar[i];
    }
    ans[1]=a;
    for(i=2;i<=n;i++)
    {
        a=ar[i-1]-(ans[i-1]/2);
        ans[i]=a*2;
    }
    for(i=1;i<=n;i++)cout<<ans[i]<<" ";
    return 0;
}

Measured memory_bytes: 5220
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner sc = new Scanner(System.in);
		
		int a,b,sum;
		
		while (sc.hasNextInt()) {
			a = sc.nextInt();
			b = sc.nextInt();
			
			sum = a + b;
			
			System.out.println(Integer.toString(sum).length());
		}
	}
}

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

int main() {
  string s;
  cin >> s;
  
  for (int i = 0;i < s.size(); i++) {
    if (s.at(i) == ',') {
      s.at(i) = ' ';
    }
  }
  
  cout << s;
  
  return 0;
  }


Measured memory_bytes: 256
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
MOD = 10**9+7

def main():
    A, B = map(int, readline().split())
    ans = 0
    for i in range(A,B+1):
        s = str(i)
        if s[:2]==s[5:2:-1]:
            ans += 1
    print(ans)



if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
c = []
A = []
for i in range(3):
  c = input().split()
  c = [int(i) for i in c]
  A.append(c)
N = int(input())
a = 0
b = []
for i in range(N):
  a = int(input())
  b.append(a)
#print('A=', A)
#print('N=', N)
#print('b=', b)

A1 = A[0]
A2 = A[1]
A3 = A[2]
A4 = [A[0][0], A[1][0], A[2][0]]
A5 = [A[0][1], A[1][1], A[2][1]]
A6 = [A[0][2], A[1][2], A[2][2]]
A7 = [A[0][0], A[1][1], A[2][2]]
A8 = [A[0][2], A[1][1], A[2][0]]
#print('A1=', A1, 'A2=', A2, 'A3=', A3, 'A4=', A4, 'A5=', A5, 'A6=', A6, 'A7=', A7, 'A8=', A8)

A_ = [A1, A2, A3, A4, A5, A6, A7, A8]

count = 0

for i in range(8):
  if set(A_[i]) <= set(b):
    count += 1
    
if count > 0:
  print('Yes')
else:
  print('No')

#print('count=', count)





Measured memory_bytes: 3064
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let v = read_vec::<usize>();
    let (n, p) = (v[0], v[1]);
    let a = read_vec::<u64>();
    let mut count_even = 0;
    for i in 0..n {
        if a[i] % 2 == 0 {
            count_even += 1;
        }
    }
    let count_odd = n - count_even;
    let even_count = 2u64.pow(count_even as u32);
    let mut odd_count = 0u64;

    let comb = |n: u64, k: u64| -> u64 {
        let mut ret = 1u64;
        for i in 0..k {
            ret *= (n - i);
            ret /= i + 1;
        }
        ret
    };

    for i in 0..count_odd + 1 {
        if i % 2 == p {
            odd_count += comb(count_odd as u64, i as u64);
        }
    }
    println!("{:?}", even_count * odd_count);
}


Measured memory_bytes: 4352
{-#LANGUAGE FlexibleContexts#-}
import Control.Monad.State
import Control.Monad.Reader
import Control.Arrow
-- import Control.Comonad
import Data.Maybe
import Data.List
import Data.Bool
import Data.Fixed
import Data.Tuple
import qualified Data.Map.Strict as M
import qualified Data.Array.IO as IA
import qualified Data.Vector as V

getInt = read <$> getLine :: IO Integer
getInts = map read . words <$> getLine :: IO [Integer]

type Row = Integer
type Col = Integer
type Point = (Integer, Integer)

mmm = 1000000007
factorial 0 s = s
factorial n s = factorial (n - 1) (s * n)
fact' n = factorial n 1
fi = fromInteger

-- 
--
--

main = do
    time <- getInt
    a <- sort <$> replicateM (fi time) getInt
    putStrLn . show $ sum (init a) + (last a `div` 2)


Measured memory_bytes: 508
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int w, h, n;

void drop(VVI &a){
    REP(i,w){
        int end = 0;
        REP(j,h){
            if (a[i][j] > 0){
                a[i][end++] = a[i][j];
            }
        }
        while (end < h) a[i][end++] = 0;
    }
}

bool check(VVI a){
    bool zenkesi = 1;
    REP(i,w) REP(j,h) zenkesi &= (a[i][j] == 0);
    if (zenkesi) return 1;

    drop(a);

    VVI e(w, VI(h));
    REP(i,w) REP(j,h-n+1){
        if (a[i][j] == 0) continue;
        bool f = 1;
        REP(k,n){
            if (a[i][j] != a[i][j+k]) f = 0;
        }
        if (f){
            REP(k,n) e[i][j+k] = 1;
        }
    }
    REP(i,w-n+1) REP(j,h){
        if (a[i][j] == 0) continue;
        bool f = 1;
        REP(k,n){
            if (a[i][j] != a[i+k][j]) f = 0;
        }
        if (f){
            REP(k,n) e[i+k][j] = 1;
        }
    }

    bool no_move = 1;
    REP(i,w) REP(j,h){
        if (e[i][j]){
            no_move = 0;
            a[i][j] = 0;
        }
    }

    if (no_move) return 0;
    else return check(a);
}

int main() {
    cin >> h >> w >> n;
    VVI a(w, VI(h));
    REP(i,h){
        string s;
        cin >> s;
        REP(j,w){
            if (s[j] != '.') a[j][h-1-i] = s[j] - 'A' + 1;
        }
    }

    REP(i,w-1) REP(j,h){
        swap(a[i][j], a[i+1][j]);
        if (check(a)){
            cout << "YES" << endl;
            return 0;
        }
        swap(a[i][j], a[i+1][j]);
    }

    cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 3448
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
ll lcm(ll a,ll b)
{return a/gcd(a,b)*b;}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
ll INF=1e7;
//------------------------------------------------------------
ll N,ans;

void solve() {

  cin >>  N;

  vector<ll> a(N);
  vector<ll> V(INF);
  vector<bool> bl(INF);

  rep(i,0,N)
  {
    cin >> a[i];
    V[a[i]]++;
  }

  rep(i,1,INF)
  {
    bl[i] = (V[i] == 1);
  }

  rep(i,1,INF)
  {
    for(ll j=i*2; j<=INF; j+=i)
    {
      if(V[i]) bl[j]=false;
    }
  }

  rep(i,0,N)
  {
    if(bl[a[i]]) ans++;
  }

  print(ans);

  return;
}

Measured memory_bytes: 84256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;



int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall
	
	ini(n);
	ini(n1);
	vi morty;
	FOR(i,0,n1){
		ini(x);
		morty.push_back(x);
	}
	if(n1 == 1){
		out(n-1);
		return 0;
	}
	while(n>0){
		sort(all(morty),greater<int>());
		//for(auto x:morty){cout<<x<<" ";}cout<<"\n";
		if(morty[1] == 0)if(morty[0]!=0){out(morty[0]-1);return 0;}
		morty[0]--;morty[1]--;
		n-=2;
	}
	out(0);















	return 0;
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<ll, ll> P;

#define rep(a,n) for(int a = 0;a < n;a++)
#define repi(a,b,n) for(int a = b;a < n;a++)


const ll mod = 1000000007;


int main(void)
{
	ll h, w, k;
	cin >> h >> w >> k;
	vector<vector<ll>> grid(h, vector<ll>(w, 0));
	vector<vector<P>> st(h);
	rep(y, h) {
		string s;
		cin >> s;
		rep(x, w) {
			grid[y][x] = (s[x] == '#');
			if (grid[y][x]) st[y].emplace_back(y,x);
		}
	}
	vector<vector<ll>> ans(h, vector<ll>(w, 0));
	int count = 0;
	int start = 1e6;
	int end = -1;
	rep(y, h) {
		if(st[y].size() > 0){
			int left = 0;
			for (auto p : st[y]) {
				start = min(y, start);
				end = max(y, end);
				count++;
				while (left <= p.second) {
					ans[y][left] = count;
					left++;
				}
			}
			while (left < w) {
				ans[y][left] = count;
				left++;
			}
		}
	}
	for (int y = 0; y < start; y++) {
		rep(x, w) {
			ans[y][x] = ans[start][x];
		}
	}
	for (int y = end; y < h; y++) {
		rep(x, w) {
			ans[y][x] = ans[end][x];
		}
	}
	int valid = 0;
	rep(y, h) {
		if (st[y].size() > 0) {
			valid = y;
		}
		else {
			rep(x, w) {
				ans[y][x] = ans[valid][x];
			}
			valid = y;
		}
	}
	rep(y, h) {
		rep(x, w) cout << ans[y][x] << " ";
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 4608
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let n = read::<i64>();
  let m = read::<i64>();

  let mut students: Vec<Vec<i64>> = vec![];
  let mut cp: Vec<Vec<i64>> = vec![];
  let mut ans = vec![];

  for _ in 0..n {
    let x = read::<i64>();
    let y = read::<i64>();
    students.push(vec![x, y])
  }
  for _ in 0..m {
    let x = read::<i64>();
    let y = read::<i64>();
    cp.push(vec![x, y])
  }

  for i in students {
    let mut close_cp = 0;
    let mut min_dist = 1000000000000000;
    for (idx, j) in cp.iter().enumerate() {
      let dist = (i[0] - j[0]).abs() + (i[1] - j[1]).abs();
      if dist < min_dist {
        min_dist = dist;
        close_cp = idx + 1;
      }
    }

    ans.push(close_cp);
  }
  for i in ans {
    println!("{}", i);
  }
}



Measured memory_bytes: 4476
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,q=mp()
s=input()
ans=[0]*(n+1)
c=0
for i in range(1,n):
    if s[i-1]=="A" and s[i]=="C":
        c+=1
    ans[i+1]=c
for i in range(q):
    r,l=mp()
    print(ans[l]-ans[r])

Measured memory_bytes: 78932
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, k;
    cin >> n >> k;
    ll a[n], i;
    for(i = 0; i < n; i++) {
    	cin >> a[i];
    }
    ll sum = 0;
    sort(a, a + n);
    for(i = 0; i < k; i++) {
    	sum += a[i];
    }
    cout << sum << "\n";
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

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

	vector<int> x(m), y(m);
	for (int i = 0; i < m; i++) {
		cin >> x[i] >> y[i];
		x[i]--; y[i]--;
	}

	vector<bool> dp(n);
	dp[0] = true;
	vector<int> ballCnt(n, 1);
	for (int i = 0; i < m; i++) {
		if (dp[x[i]]) {
			dp[y[i]] = dp[x[i]];
		}

		ballCnt[x[i]]--;
		ballCnt[y[i]]++;

		if (ballCnt[x[i]] <= 0) {
			dp[x[i]] = false;
		}
	}

	int ans = count(begin(dp), end(dp), true);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
const int INF = 1e9;
typedef pair<int, int> P;



signed main()
{
    int N;
    cin >> N;
    int l, r;
    
    int ans = 0;
    REP(i,N) {
        cin >> l >> r;
        ans += r - l + 1;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
//const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -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 (a>b) { a=b; return 1; } return 0; }

struct P {
  int c, x, y;

  P() {}
  P(int c, int x, int y): c(c), x(x), y(y) {}

  bool operator < (const P &p) const {
    return c > p.c;
  }
};

int h, w;
int ch, cw, dh, dw;
char s[1010][1010];
int d[1010][1010];
bool visited[1010][1010];

int bfs() {
  rep(i, h) rep(j, w) d[i][j] = inf;
  d[ch][cw] = 0;
  priority_queue<P> pq;
  pq.push(P(0, ch, cw));
  
  while (pq.size()) {
    int rx = pq.top().x, ry = pq.top().y;
    pq.pop();
    if (visited[rx][ry]) continue;
    visited[rx][ry] = true;
    FOR(i, -2, 3) {
      FOR(j, -2, 3) {
        if (i == 0 && j == 0) continue;
        int nx = rx + i, ny = ry + j;
        if (0 <= nx && nx < h && 0 <= ny && ny < w && s[nx][ny] == '.') {
          if (abs(i) + abs(j) == 1) {
            if (chmin(d[nx][ny], d[rx][ry])) pq.push(P(d[nx][ny], nx, ny));
          }
          else {
            if (chmin(d[nx][ny], d[rx][ry] + 1)) pq.push(P(d[nx][ny], nx, ny));
          }
        }
      }
    }
  }
  if (d[dh][dw] == inf) d[dh][dw] = -1;
  return d[dh][dw];
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  cin >> h >> w >> ch >> cw >> dh >> dw;
  ch--, cw--, dh--, dw--;
  rep(i, h) rep(j, w) cin >> s[i][j];

  cout << bfs() << '\n';

  

  
  return 0;
}

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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

//--------------------------------------------

int main(){
  int k,s;

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

  int sum = 0;
  REP(i, k + 1) {
    REP (j, k + 1) {
      if (0 <= (s - (i + j)) && (s - (i + j)) <= k) sum += 1;
    }
  }

  printf("%d\n",sum);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

int main(){
    int n;
    std::cin >> n;

    std::vector<int> a(n), b(n), c(n - 1);
    for(int i = 0; i < n; ++i){
        std::cin >> a.at(i);
    }
    for(int i = 0; i < n; ++i){
        std::cin >> b.at(i);
    }
    for(int i = 0; i < n - 1; ++i){
        std::cin >> c.at(i);
    }

    int previous = -1, sum = 0;
    for(int i = 0; i < n; ++i){
        sum += b.at(a.at(i) - 1);
        if(a.at(i) == previous + 1){
            sum += c.at(previous - 1);
        }

        previous = a.at(i);
    }

    std::cout << sum << std::endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = in.nextInt();
		solve(a);
		in.close();
	}

	private static void solve(int[] a) {
		// 2*a1=x1+x2
		// 2*a2=x2+x3
		// 2*a3=x3+x4
		// 2*a4=x4+x5
		// 2*a5=x5+x1
		// a1-a2+a3-a4+a5=x1
		long x = 0;
		int f = 1;
		for (int i = 0; i < a.length; i++) {
			x = x + a[i] * f;
			f *= -1;
		}
		System.out.print(x);
		// x2=2*a1-x1
		for (int i = 0; i < a.length - 1; i++) {
			x = 2 * a[i] - x;
			System.out.print(" " + x);
		}
	}
}


Measured memory_bytes: 62880
#include<bits/stdc++.h>
#include<cstdio>
#define ll long long int
#define pb push_back
using namespace std;
int main()
{
    ll a,b,n,m,i,j,k;
    vector<ll>v[60];
   cin>>n>>m;
   for(i=0;i<m;i++)
   {
       cin>>a>>b;
       v[a].pb(b);
       v[b].pb(a);
   }
   for(i=1;i<=n;i++)
   {
       cout<<v[i].size()<<endl;
   }

    return 0;
}


Measured memory_bytes: 256
from math import floor, ceil
from statistics import mean
n = int(input())
a = list(map(int, input().split()))
mc = ceil(mean(a))
mf = floor(mean(a))
dc = sum([(i-mc)**2 for i in a])
df = sum([(i-mf)**2 for i in a])
print(min(dc, df))

Measured memory_bytes: 5636
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <cctype>

using namespace std;

typedef pair<int, int> P;

int memo[64][64][64][64];
bool ok[64][64][64][64];
char str[64][64];
int W, H;

int dy[2] = {0, 1};
int dx[2] = {1, 0};

vector<P> hole[26];

bool okx(int x)
{
	return (0 <= x && x < W);
}

bool oky(int y)
{
	return (0 <= y && y < H);
}

int getMax(int y1, int x1, int y2, int x2)
{
	if (y1 > y2 || x1 > x2) return (0);
	if (!okx(x1) || !okx(x2) || !oky(y1) || !oky(y2) || !ok[y1][x1][y2][x2]) return (-99999);
	
	if (memo[y1][x1][y2][x2] >= 0) return (memo[y1][x1][y2][x2]);
	
	int res = 0;
	res = max(res, max(getMax(y1 + 1, x1, y2, x2), getMax(y1, x1 + 1, y2, x2)));
	
	if (islower(str[y1][x1])){
		int l = str[y1][x1] - 'a';
		for (int i = 0; i < hole[l].size(); i++){
			int ny = hole[l][i].first, nx = hole[l][i].second;
			if (!ok[y1][x1][ny][nx] || y1 > ny || ny > y2 || x1 > nx || nx > x2) continue;
			for (int d1 = 0; d1 < 2; d1++){
				for (int d2 = 0; d2 < 2; d2++){
					res = max(res, getMax(y1 + dy[d1], x1 + dx[d1], ny - dy[d2], nx - dx[d2]) + getMax(ny, nx, y2, x2) + 1);
				}
			}
		}
	}
	
	return (memo[y1][x1][y2][x2] = res);
}

int main()
{
	while (scanf("%d %d", &H, &W) && W){
		memset(memo, -1, sizeof(memo));
		memset(ok, 0, sizeof(ok));
		
		for (int i = 0; i < 26; i++) hole[i].clear();
		
		for (int i = 0; i < H; i++){
			scanf("%s", str[i]);
			for (int j = 0; j < W; j++){
				if (isupper(str[i][j])) hole[str[i][j] - 'A'].push_back(P(i, j));
			}
		}
		
		queue<pair<P, P> > q;
		
		for (int i = 0; i < H; i++){
			for (int j = 0; j < W; j++){
				if (str[i][j] != '#'){
					ok[i][j][i][j] = 1;
					q.push(make_pair(P(i, j), P(i, j)));
				}
			}
		}
		
		while (q.size()){
			pair<P, P> x = q.front(); q.pop();
			
			if (x.second.first + 1 < H && str[x.second.first + 1][x.second.second] != '#'){
				if (!ok[x.first.first][x.first.second][x.second.first + 1][x.second.second]++){
					q.push(make_pair(x.first, P(x.second.first + 1, x.second.second)));
				}
			}
			if (x.second.second + 1 < W && str[x.second.first][x.second.second + 1] != '#'){
				if (!ok[x.first.first][x.first.second][x.second.first][x.second.second + 1]++){
					q.push(make_pair(x.first, P(x.second.first, x.second.second + 1)));
				}
			}
		}
		
		printf("%d\n", getMax(0, 0, H - 1, W - 1) < 0 ? -1 : getMax(0, 0, H - 1, W - 1));
	}
	
	return (0);
}

Measured memory_bytes: 83576
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;            //

int main(void)
{
    int A, B;
    cin >> A >> B;

    string ans;
    if (A % 3 == 0)
    {
        ans = "Possible";
    }
    else if (B % 3 == 0)
    {
        ans = "Possible";
    }
    else if ((A + B) % 3 == 0)
    {
        ans = "Possible";
    }
    else
    {
        ans = "Impossible";
    }
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define LL long long
using namespace std;
const LL mod=1e9+7;
LL n,top,num;
LL K,a[210],c[210],d[210];
pair<LL,LL> q[12010];
struct node{
	LL t[210],a;
	LL k;
}s[12010];
bool operator < (node a,node b)
{
	for(LL i=1;i<n;i++)
		if(a.t[i]<b.t[i]) return true;
		else if(a.t[i]>b.t[i]) return false;
	return false;
}
bool check(node a,node b)
{
    for(LL i=1;i<n;i++)
        if(a.t[i]!=b.t[i]) return false;
    return true;
}
LL qs(LL x,LL y)
{
	if(x==-1) return 0;
	LL ans=0;
	for(LL i=60;i>=0;i--)
		if(((x>>i)&1)==((y>>i)&1)) (ans+=(x>>i)&1);
		else {ans++;break;}
	return ans;
}
LL dp()
{
	sort(q+1,q+num+1);
	LL ans=0,l=0,r=-1;
	for(LL i=1;i<=num;i++)
	{
		if(q[i].fi>r) ans+=(r-l+1),l=q[i].fi;
		r=q[i].se;
	}
	ans+=r-l+1;
	return ans;
}
int main()
{
	scanf("%lld%lld",&n,&K);
    for(LL i=1;i<=n;i++) scanf("%lld",&a[i]);
    sort(a+1,a+n+1);    
    for(LL i=0;i<=60;i++)
    {
        for(LL j=1;j<=n;j++) c[j]=(a[j]&((1ll<<i)-1));   
        sort(c+1,c+n+1);c[0]=-1;
        LL sz=unique(c+1,c+n+1)-c-1;
        for(LL j=1;j<=sz;j++)
            if(a[1]>=c[j])
            {
                LL P=qs(c[j-1],c[j]);
                for(LL l=1;l<=n;l++) d[l]=((a[l]-c[j])>>i);  
                s[++top].a=d[1];s[top].k=i+P;
                for(LL l=1;l<n;l++) s[top].t[l]=d[l+1]-d[l];        
            }
    }
    sort(s+1,s+top+1);
    num=0;LL ans=0;
    for(LL i=1;i<=top;i++)
    {
        if(i!=1&&!check(s[i],s[i-1])) ans=(ans+dp())%mod,num=0;
        if(s[i].k<=K) q[++num]=make_pair(max(s[i].a-K+s[i].k,0LL),s[i].a);
    }
    ans=(ans+dp())%mod;
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 16640
def main():
    n = int(input())
    d = set([])


    for i in range(n):
        command, string = input().split()
        if (command == 'insert'):
            d.add(string)
        elif (command == 'find'):
            if string in d:
                print('yes')
            else:
                print('no')

if __name__ == "__main__":
    main()

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

int main(){
  int N;
  cin>>N;
  int p[5000];
  for(int i=0;i<N;i++){
    cin>>p[i];
  }
  int min_sum = 20000;
  for(int I=0;I<=p[0];I++){
    int q[5000];
    for(int i=0;i<N;i++){
      q[i]=p[i];
    }
    int sum=I;
    q[0] -=I;
    for(int i=0;i<=N-2;i++){
      if(q[i]<=0){
        continue;
      }
      sum +=q[i]*2;
      q[i+1] -=q[i];
    }
    if(q[N-1]>0){
      sum += q[N-1];
    }
    min_sum=min(min_sum, sum);
  }
  cout<<min_sum<<endl;
  return 0;
}


Measured memory_bytes: 3136
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

typedef long long ll;


int main(){
 ll N,W; cin >> N >> W;
  
  vector<ll> w(N,0); vector<ll> v(N,0);
  
  for(ll i = 0; i < N; i++){ cin >> w[i] >> v[i];}
  
  ll dp[110][100010];
  for(ll i = 0; i < 110; i++){
    for(ll j = 0; j < 100010; j++){ dp[i][j] = 0;}}
  
  for(ll i = 0; i < N; i++){
    for(ll sum_w = 0; sum_w <= W; sum_w++){
      dp[i+1][sum_w] = max(dp[i][sum_w],dp[i+1][sum_w]);
      if( sum_w >= w[i]){
        dp[i+1][sum_w] = max( dp[i+1][sum_w], dp[i][sum_w - w[i]] + v[i]);}
    }}
  
  cout << dp[N][W] << endl;
   return 0;}
        

Measured memory_bytes: 86144
#include <iostream>

int main() {
    int K, A, B;
    int product;

    std::cin >> K >> A >> B;
    for (int i = 0;; i++) {
        product = i * K;
        if (product > B) {
            std::cout << "NG" << std::endl;
            break;
        } else if (product >= A) {
            std::cout << "OK" << std::endl;
            break;
        }
    }
    return EXIT_SUCCESS;
}

Measured memory_bytes: 3168
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=310;
bool w[N];
int c[N],a[N][N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int main() {
    int n,m,ans=1<<30;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++) a[i][j]=gi();
    for(int t=1;t<=m;t++) {
	memset(c,0,sizeof(c));
	for(int i=1;i<=n;i++)
	    for(int j=1;j<=m;j++)
		if(!w[a[i][j]]) {++c[a[i][j]];break;}
	int p=0;
	for(int i=1;i<=m;i++)
	    if(c[i]>c[p]) p=i;
	ans=min(ans,c[p]),w[p]=1;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 640
n=int(input())
L=[]
for i in range(n):
    L.append(list(map(int,input().split())))
l=len(L)
a=0
for i in range(l):
    for j in range(i,l):
        a+=((L[i][0]-L[j][0])**2+(L[i][1]-L[j][1])**2)**0.5
print(a*2/n)

Measured memory_bytes: 3064
#include <stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int sum=a+b+c,max=a;
    if(max<b)max=b;
    if(max<c)max=c;
    if(sum%max==0&&sum/max==2)printf("Yes\n");
    else printf("No\n");
    return 0;
}

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

const int MOD = 1000000007;

class Combination {
public:
    vector<long long> fac, finv, inv;
    Combination(int MAX);
    long long operator()(int n, int k);
} nCk(2001001);

inline Combination::Combination(int MAX) {
    fac.resize(MAX);
    finv.resize(MAX);
    inv.resize(MAX);
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

inline long long Combination::operator()(int n, int k) {
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int x, y; cin >> x >> y;
    int n = (x + y) / 3; // 移動回数
    if((x + y) % 3) {
        cout << 0 << '\n';
        return 0;
    }
    int64_t ans = 0;
    for(int i = 0; i <= n; ++i) { // 2 : 1
        int j = n - i; // 1 : 2
        if(i * 2 + j != x || i + j * 2 != y) continue;
        ans += nCk(n, i);
        ans %= MOD;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 47104
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <cmath>
#include <string>

using namespace std;

int main(void){
    int A;
    cin >> A;
    double b = sqrt(A);
    int C = floor(b);
    cout << C*C << endl;
}


Measured memory_bytes: 256
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var s = nextstr().split("");
  var n = s.length;
  var mx = 0;
  var dp = Array(n+1);
  dp[0] = 0;
  for(var i = 0; i < n; i++){
    dp[i+1] = dp[i] + (s[i] === "1" ? 1 : -1);
    if(mx < dp[i+1])mx = dp[i+1];
  }
  for(var i = n; i--; i){
    dp[i] = Math.max(dp[i], dp[i+1]);
  }
  var mn = [0,0], p = [0,0];
  for(var j = 0, x=0; j < 2; j++,x=0)for(var i = 0; i < n; i++){
    if(s[i] === "?"){
      if(p[j]+dp[i+1]+2 <= mx+j)p[j] += 2, x++;
      else x--;
    }else if(s[i] === "1")x++; else x--;
    if(x < mn[j])mn[j] = x;
  }
  return Math.min(mx-mn[0], mx+1-mn[1]);
}

Measured memory_bytes: 55356
x = str(input())
y = str(input())

s = []
for i in x:
    s.append(i)
p = []
for i in y:
    p.append(i)

n = len(p)
flag = 0
for i in range(len(s)):
    if i+n > len(s):
        if s[i:]+s[0:(i+n)%len(s)] == p:
            print('Yes')
            flag = 1
            break
    else:
        if s[i:i+n] == p:
            print('Yes')
            flag = 1
            break

if flag == 0:
    print('No')

Measured memory_bytes: 7524