akhauriyash/Code-Regression huggingface dataset:
import queue

q=queue.Queue()
for i in range(1,10):
  q.put(i)

K=int(input())

for k in range(K):
  x=q.get()
  end_one=x%10
  if end_one !=0:
    q.put(10*x+end_one-1)
  q.put(10*x+end_one)
  if end_one !=9:
    q.put(10*x+end_one+1)
print(x)

Measured memory_bytes: 12480
#include<bits/stdc++.h>
using namespace std;
#define MAXN	5005
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int main() {
	int n, m, x, y;
	read(n), read(m), read(x), read(y);
	if (n % x == 0 && m % y == 0) {
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	int ans = 1840, tans = -1 - ans * (x * y - 1);
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++)
			if (i % x == 0 && j % y == 0) printf("%d ", tans);
			else printf("%d ", ans);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1536
#include <iostream>

using namespace std;

typedef long long ll;

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

    int ans = 0;
    for (int i = 0; i < 3; ++i)
    {
        if (s[i] == '1') ++ans;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
template <class T>
void chmin(T &a, T b) { a = min(a, b); }
template <class T>
void chmax(T &a, T b) { a = max(a, b); }
void debug() { cerr << "ok" << endl; }
template <class T>
void printv(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void readv(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    if (n % 2 > 0) {
        for (int i = 0; i < m; i++) {
            cout << i + 1 << " " << n - i << '\n';
        }
    } else {
        V<P> v;
        for (int i = 1; i <= n / 2 - 1; i++) {
            if (i >= n / 2 - i) break;
            v.eb(i, n / 2 - i);
        }
        for (int i = 1; i <= n / 2; i++) {
            if (i >= n / 2 - i + 1) break;
            int b = n / 2 - 1;
            v.eb(b + i, b + n / 2 - i + 1);
        }
        for (int i = 0; i < m; i++) {
            cout << v[i].fi << " " << v[i].se << '\n';
        }
    }
}

Measured memory_bytes: 5096
numbers = input()
numberVotes, numberItems = numbers.split(" ")

votes = input()
votes = votes.split(" ")
totalVotes = sum([int(x) for x in votes])
thrashold = (totalVotes/(4 * int(numberItems)))
filtered = list(filter(lambda item: int(item) >= thrashold, votes))
x = "No"
if len(filtered) >= int(numberItems):
  x = "Yes"
print(x)

Measured memory_bytes: 3060
// Last Change: 03/22/2019 20:47:45.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

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

  int cnt = 0;
  for (int i = 0; i < 3; ++i) {
    if (S[i] == 'o') {
      ++cnt;
    }
  }
  cout << 700 + 100 * cnt << endl;

  //NS::LoopUntilZeroInpput();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[105];
bool cmp(int x,int y)
{
	return x>y;
}
int k,l;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++)
		if(i%2==1)k+=a[i];
		else l+=a[i];
	cout<<k-l;
   return 0; 
}

Measured memory_bytes: 256
while True:
    h, w = map(int, input().split(' '))
    if h == 0 and w == 0:
        break
    for i in range(h):
        if i % 2 == 0:
            for j in range(w):
                if j % 2 == 0:
                    print('#', end = '')
                else:
                    print('.', end = '')
        else:
            for j in range(w):
                if j % 2 == 0:
                    print('.', end = '')
                else:
                    print('#', end = '')
        print()
    print()



Measured memory_bytes: 7000
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int a,b,c;
    cin>>a>>b>>c;
    if(c>=a&&c<=b){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; ++i)
#define rep(i, n) repl(i, 0, n)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define chmax(x,y) x = max(x, y)
#define chmin(x,y) x = min(x, y)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using G = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, -1, 0, 1};

int main()
{
    string str;
    cin >> str;
    if(str[str.size()-1] == 's') str += "es";
    else str += "s";
    cout << str << endl;
    return 0;
}


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

using namespace std;

int main(){
  string S, T;
  cin >> S >> T;
  int ans = 0;
  for (int i=0; i<S.size(); i++){
    if (S[i] != T[i]) ans++;
  }
  cout << ans << "\n";
  return 0;
}

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

int main(){
	int n,m;
	while(cin >> n, n){
		vector< vector<bool> > field(21,vector<bool>(21));
		for(int i=0;i<21;i++)
			for(int j=0;j<21;j++)
				field[i][j]=false;
		for(int i=0;i<n;i++){
			int x,y;
			cin >> x >> y;
			field[x][y]=true;
		}
		int result=0;
		int nx=10,ny=10;
		if(field[nx][ny]){
			result++;
			field[nx][ny]=false;
		}
		cin >> m;
		for(int i=0;i<m;i++){
			char d;
			int l;
			cin >> d >> l;
			for(int j=0;j<l;j++){
				switch(d){
				case 'N':
					ny++;
					if(field[nx][ny]){
						result++;
						field[nx][ny]=false;
					}
					break;
				case 'E':
					nx++;
					if(field[nx][ny]){
						result++;
						field[nx][ny]=false;
					}
					break;
				case 'S':
					ny--;
					if(field[nx][ny]){
						result++;
						field[nx][ny]=false;
					}
					break;
				case 'W':
					nx--;
					if(field[nx][ny]){
						result++;
						field[nx][ny]=false;
					}
					break;
				}
			}
		}
		if(result==n)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int main(){
  int d,i,j,k;
  cin >> d;
  double a[1000]={},b[1000]={};
  for(i=0;i<d;i++) cin >> a[i];
  for(i=0;i<d;i++) cin >> b[i];
  double o1=0,o2=0,o3=0,oe=0;
  for(i=0;i<d;i++){
    o1+=fabs(a[i]-b[i]);
    o2+=fabs(a[i]-b[i])*fabs(a[i]-b[i]);
    o3+=fabs(a[i]-b[i])*fabs(a[i]-b[i])*fabs(a[i]-b[i]);
    oe=max(oe,fabs(a[i]-b[i]));
  }
  printf("%.6f\n",o1);
  printf("%.6f\n",sqrt(o2));
  printf("%.6f\n",pow(o3,1.0/3.0));
  printf("%.6f\n",oe);
  return 0;
}



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

#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep = ""; for(const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << "\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

const int N = 3e3+5;
int dp[N][N];
int dir[N][N];

void solve(){
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();


    memset(dp, 0, sizeof dp);
    memset(dir, 0, sizeof dir);

    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j)
            if(s[i-1] == t[j-1]){
                dp[i][j] = dp[i-1][j-1]+1;
                dir[i][j] = 1;
            }
            else{
                if(dp[i-1][j] > dp[i][j-1]){
                    dir[i][j] = 2;
                    dp[i][j] = dp[i-1][j];
                }
                else{
                    dir[i][j] = 3;
                    dp[i][j] = dp[i][j-1];
                }
            }


    string res = "";
    int i = n, j = m;
    while(i > 0 && j > 0){
        if(dir[i][j] == 1){
            res += s[i-1];
            i--; j--;
        }
        else if(dir[i][j] == 2) i--;
        else j--;
    }
    reverse(All(res));
    cout << res << "\n";
}

int main()
{
    Fast;
    //louisfghbvc{
        solve();
    //}
    return 0;
}


Measured memory_bytes: 74204
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner Input = new Scanner(System.in);
        String S = Input.next();
        boolean F = false;
        int V = 0;
        int Max = 0;
        for (int I = 0; I < S.length(); I++) {
            if (S.charAt(I) == 'A' && !F) {
                F = true;
                V++;
            } else if (S.charAt(I) == 'Z' && Max <= V && F) {
                V++;
                Max = V;
            } else if(F){
                V++;
            }
        }
        System.out.println(Max);
    }
}


Measured memory_bytes: 27848
import java.util.Scanner;
class Main {

	public static void main(String[] args){
	
		Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if (b/a >= c) {
        	System.out.println(c);
        } else {
        	System.out.println(b/a);
        }
		
		
	}
}

Measured memory_bytes: 23124
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define all(x) (x).begin(), (x).end()
#define forn(i, n) for(int i = 0; i < n; ++i)
#define fore(i, a, b) for(int i = a; i < b; ++i)

#define endl '\n'

const int MOD = 1000000007;
const int MOD2 = 998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnta[1000001] = {};
    int cntc[1000001] = {};
    for (int i = 0; i < n; ++i) {
        cnta[i + 1] = cnta[i] + (s[i] == 'D');
        cntc[i + 1] = cntc[i] + (s[i] == 'C');
    }
    int q;
    cin >> q;
    while (q--) {
        int k;
        cin >> k;
        ll ans = 0;
        ll cur = 0;
        for (int i = 0; i < n; ++i) {
            if (s[i] == 'D') {
                // cout << "ADD " << min(n, i + k) << " " << i << " " << cntc[min(n, i + k)] - cntc[i] << endl;
                cur += cntc[min(n, i + k)] - cntc[i];
            } else if (s[i] == 'M') {
                ans += cur;
            } else if (s[i] == 'C') {
                // cout << "DEL " << i << " " << max(0, i - k + 1) << " " << cnta[i] - cnta[max(0, i - k + 1)] << endl;
                cur -= cnta[i] - cnta[max(0, i - k + 1)];
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 9116
#include <iostream>

using namespace std;

int main(){
    string a,b,c;
    int a_count = 0;
    int b_count = 0;
    int c_count = 0;
    char turn = 'a';
    cin >> a;
    cin >> b;
    cin >> c;
    while(true){
        if(turn == 'a'){
            if(a_count == a.length()){
                cout << 'A' << endl;
                break;
            }
            turn = a[a_count];
            a_count++;
        }else if(turn == 'b'){
            if(b_count == b.length()){
                cout << 'B' << endl;
                break;
            }
            turn = b[b_count];
            b_count++;
        }else{
            if(c_count == c.length()){
                cout << 'C' << endl;
                break;
            }
            turn = c[c_count];
            c_count++;
        }
    }

}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    long k = sc.nextLong();
    long a = n + 1;
    long ans = n % k;
    ans = Math.min(ans,Math.abs(ans - k));
    System.out.println(ans);
  }
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}

const ll MOD = 1e9 + 7;
struct mint {
  ll x;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint& operator+=(const mint a) {if ((x += a.x) >= MOD) x -= MOD;return *this;}
  mint& operator-=(const mint a) {if ((x += MOD-a.x) >= MOD) x -= MOD;return *this;}
  mint& operator*=(const mint a) {(x *= a.x) %= MOD;return *this;}
  mint operator+(const mint a) const {mint res(*this);return res+=a;}
  mint operator-(const mint a) const {mint res(*this);return res-=a;}
  mint operator*(const mint a) const {mint res(*this);return res*=a;}
  mint pow(ll b) const {
    mint res(1), a(*this);
    while (b) {
      if (b & 1) res *= a;
      a *= a;
      b >>= 1;
    }
    return res;
  }
  // for prime MOD
  mint inv() const {return pow(MOD-2);}
  mint& operator/=(const mint a) {return (*this) *= a.inv();}
  mint operator/(const mint a) const {mint res(*this);return res/=a;}
};
ostream& operator<<(ostream& os, const mint& a) {os << a.x; return os;}

const int MAX_N = 5005;
mint dp[MAX_N][MAX_N];

int main2() {
  REP(i, MAX_N) REP(j, MAX_N) dp[i][j] = 0;

  const int N = nextLong();
  string s; cin >> s;
  const int K = s.size();

  dp[0][0] = 1;
  REP(i, N) {
    REP(j, N+1) {
      dp[i+1][j+1] += mint(2) * dp[i][j];
      dp[i+1][max(0, j-1)] += dp[i][j];
    }
  }

  // if (N <= 5)
  //   REP(i, N+1) {
  //     REP(j, K+1) cout << dp[i][j] << " ";
  //     cout << endl;
  //   }

  mint ans = dp[N][K];
  ans /= mint(2).pow(K);
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 199384
#include<cstdio>
#include<cstring>
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch) {
	switch (ch) {
	case 'A':return 1;
	case 'C':return 2;
	case 'G':return 3;
	case 'T':return 4;
	default:return 0;
	}
}
long long getKey(char str[]) {
	long long sum = 0, p = 1, i;
	for (i = 0; i < strlen(str); i++) {
		sum += p*(getChar(str[i]));
		p *= 5;
	}
	return sum;
}
int h1(int key) { return key%M; }
int h2(int key) { return 1 + (key % (M - 1)); }
int find(char str[]) {
	long long key, i, h;
	key = getKey(str);
	for (i = 0;; i++) {
		h = (h1(key) + i*h2(key)) % M;
		if (strcmp(H[h], str) == 0)return 1;
		else if (strlen(H[h]) == 0)return 0;
	}
	return 0;
}
int insert(char str[]) {
	long long key, i, h;
	key = getKey(str);
	for (i = 0;; i++) {
		h = (h1(key) + i*h2(key)) % M;
		if (strcmp(H[h], str) == 0)return 1;
		else if (strlen(H[h]) == 0) {
			strcpy(H[h], str);
			return 0;
		}
	}
	return 0;
}
int main() {
	int i, n, h;
	char str[L], com[9];
	for (i = 0; i < M; i++)H[i][0] = '\0';
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s %s", com, str);
		if (com[0] == 'i') {
			insert(str);
		}
		else {
			if (find(str)) {
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 15344
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#define rep(i, n) for (int i = 0; i < n; i++)
#define pi 3.14159265358979323846
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

int main()
{

  int a,b; cin >> a >> b;
  if (a<=8 && b<=8){
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }

  return 0;
}


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

using namespace std;

int main() {
  #ifdef _OFFLINE_
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif

  int n, arr[100001];
  long long ans = 0;
  scanf("%d", &n);
  for(int i = 1; i <= n; ++i) scanf("%d", &arr[i]);
  int length = 0;
  for(int i = 1; i <= n; ++i) {
    if(arr[i] == i) ++length;
    else {
      if(length > 1) ans += length / 2 + length % 2;
      else if(length == 1) ans++;
      length = 0;
    }
  }
  if(length > 1) ans += length / 2 + length % 2;
  else if(length == 1) ans++;
  cout << ans;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define fi first
#define se second
#define pr(x) cerr<<#x<<"="<<(x)<<endl
#define pri(x,lo) {cerr<<#x<<"={";for (int ol=0;ol<=lo;ol++)cerr<<x[ol]<<",";cerr<<"}"<<endl;}
#define inf 100000000
#define N 100100
#define id(a,b) (a-1)*m+b
struct node{int to,next,f;}e[N];
char ch[N],a[210][210];
int g[N],he[N],ans,maxx,nm,n,m,i,j,S,T,dep[N],q[N],size=1;
void addedge(int o,int p,int q){e[++size].to=p,e[size].next=g[o];g[o]=size,e[size].f=q;}
void add(int o,int p,int q) {addedge(o,p,q),addedge(p,o,0);}
int bfs()
{
	int head=0,tail=0;
	for (i=0;i<=maxx;i++) dep[i]=0;
	dep[S]=1;q[++tail]=S;
	while (head!=tail)
	{
		int x=q[++head];
		for (int k=g[x];k;k=e[k].next)
		{
			int y=e[k].to;
			if (dep[y]==0&&e[k].f)
			{
				dep[y]=dep[x]+1;
				q[++tail]=y;
			}
		}
	}
	return dep[T]!=0;
}
int dfs(int x,int flow)
{
	if (x==T) return flow;
	int used=0,now=0;
	for (int k=he[x];k;k=e[k].next)
	{
		int y=e[k].to;
		if (dep[y]==dep[x]+1&&e[k].f)
		{	
			now=dfs(y,min(flow-used,e[k].f));
			used+=now;
			e[k].f-=now;
			e[k^1].f+=now;
			if (e[k].f) he[x]=k;
			if (used==flow) break;
		}
	}
	if (used==0) dep[x]=-1;
	return used;
}
void dinic()
{
	while (bfs())
	{
		for (i=0;i<=maxx;i++) he[i]=g[i];
		ans+=dfs(S,inf);
	}
}
int main()
{
	scanf("%d %d",&n,&m); 
	maxx=m+n+2*n*m;
	nm=n*m;
	for (i=1;i<=n;i++)
	{
		scanf("%s",ch);
		for (j=1;j<=m;j++)
		{
			a[i][j]=ch[j-1];
			if (a[i][j]=='S') a[i][j]='o',S=id(i,j)+nm;
			if (a[i][j]=='T') a[i][j]='o',T=id(i,j);
		}
	}
	for (i=1;i<=n;i++) for (j=1;j<=m;j++)if (a[i][j]=='o')
	{
		add(id(i,j),id(i,j)+nm,1);
		add(id(i,j)+nm,i+2*nm,inf);
		add(i+2*nm,id(i,j),inf);
		add(id(i,j)+nm,j+2*nm+n,inf);
		add(j+2*nm+n,id(i,j),inf);
	}
	dinic();
	if (ans>100000) printf("-1\n");else	printf("%d\n",ans);
}

Measured memory_bytes: 1792
/**
 * Contest : AtCoder Beginner Contest 157
 * Contest URL : https://atcoder.jp/contests/abc157
 * Problem : D - Friend Suggestions
 * Problem URL : https://atcoder.jp/contests/abc157/tasks/abc157_d
 */

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair < int, int >;

// This section is for Policy Based Data Structure, more precisely Ordered Set.
// All Functions of set works here, in addition we have order_of_key() and find_by_order() function. find_by_order() returns iterator
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<functional>
using namespace __gnu_pbds;

// 1. Custom Set
template < class T, class COMP >
using custom_set = tree < T, null_type, COMP, rb_tree_tag, tree_order_statistics_node_update >;

// 2. Ordered Set
template < class T >
using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

// 3. Ordered Multi Set
// For storing multiple occurance of same value we need to use pair. In pair first value is our key and second is useless count variable.
// order_of_key(make_pair(key, 0)) returns first occurance of a value, order_of_key(make_pair(key, INT_MAX)) returns last occurance.
template < class T >
using ordered_multiset = tree < pair < T, int >, null_type, less < pair < T, int > >, rb_tree_tag, tree_order_statistics_node_update >;

// 4. Ordered Map
template < class T, class U >
using ordered_map = tree < T, U, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
// Policy End


int main() {
	ios_base::sync_with_stdio (false);
	cin.tie (0); cout.tie (0);
	
	int n, m, k;
	cin >> n >> m >> k;
	
	int u, v;
	vector < vector < int > > g (n);
	vector < vector < int > > blocked (n);
	for (int i = 0; i < m; i++) {
		cin >> u >> v;
		u--; v--;
		g[u].push_back (v);
		g[v].push_back (u);
	}
	
	for (int i = 0; i < k; i++) {
		cin >> u >> v;
		u--; v--;
		blocked[u].push_back (v);
		blocked[v].push_back (u);
	}
	
	vector < bool > visited (n);
	vector < int > component (n);
	vector < int > sizes;
	std::function < void (int, int ) > dfs = [&] (int s, int c) {
		visited[s] = true;
		component[s] = c;
		sizes[c]++;
		for (int u : g[s]) {
			if (!visited[u]) {
				dfs (u, c);
			}
		}
	};
	int count = 0;
	for (int i = 0; i < n; i++) {
		if (!visited[i]) {
			sizes.push_back (0);
			dfs (i, count);
			count++;
		}
	}
	
	for (int i = 0; i < n; i++) {
		int cnt = 0;
		for (int v : blocked[i]) {
			if (component[i] == component[v]) {
				cnt++;
			}
		}
		cout << (sizes[component[i]] - cnt - g[i].size() - 1) << " ";
	}
	cout << "\n";
	
	return 0;
}



Measured memory_bytes: 13184
#include <cstdio>
#include <cstring>
int main()
{
	char a[]="AKIHABARA",t[51],can=true,c=0,i=0;
	scanf("%s",t);
	for(;i<=strlen(t);){
		//printf("%d %d\n",i,c);
		if(i==strlen(t)||c==strlen(a)) break;
		if(t[i]==a[c]){
			i++;c++;
		}
		else if(a[c]=='A') c++;
		else{
			can=false;
			break;
		}
	}
	printf((c>=strlen(a)-1&&can&&i==strlen(t))?"YES\n":"NO\n");
	return 0;
}

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

int main() {
   int K;
   string S;
   cin >> K >> S;
   if (K>=S.size()) cout << S << endl;
   else {
       for (int i=0; i<K; i++) {
           cout << S.at(i) ;
       }
       cout << "..." << endl;
   }
}

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

int main(){
    int n;
    cin >> n;
    string ans;

    int ichi = n % 10;
    if(ichi == 3){
        ans = "bon";
    }else if(ichi == 0 || ichi == 1 || ichi == 6 || ichi == 8){
        ans = "pon";
    }else{
        ans = "hon";
    }

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

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

int main() {
    int n;
    string s;
    cin >> s;
    n = s.size();
    vector<int> ans(n);
    rep(ri,2) {
        int cnt = 0;
        rep(i,n) {
            if (s[i] == 'R') cnt++;
            else {
                ans[i] += cnt/2;
                ans[i-1] += (cnt+1)/2;
                cnt = 0;
            }
        }
        reverse(ans.begin(), ans.end());
        reverse(s.begin(), s.end());
        rep(i,n) {
            if (s[i] == 'L') s[i] = 'R';
            else s[i] = 'L';
        }
    }
    rep(i,n) {
        printf("%d\n", ans[i]);
    }
    return 0;
}

Measured memory_bytes: 1024
// Problem : C - Sum of gcd of Tuples (Easy)
// Contest : AtCoder - AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;


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

    long k;
    cin >> k;
    long long s = 0;
    for (long i = 1; i <= k; i++) {
        for (long j = 1; j <= k; j++) {
            for (long h = 1; h <= k; h++) {
                s = s + gcd(gcd(i, j), h);                
            }
        }
    }   
    cout << s; 
    
    return 0;
}


Measured memory_bytes: 3596
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int K = sc.nextInt();
      	int S = sc.nextInt();
      	int count = 0;
      	for(int i = 0; i <= K; i++){
        	for(int j = 0; j <= K; j++){
            	int k = S - i - j;
              	if(k >= 0 && k <= K) count++;
            }
        }
      	System.out.println(count);
    }
}

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

typedef long long ll;
typedef int ii;
//typedef vector<ll> vi;

#define INF 1000000007

#define pi 3.141592654

#define T while(t--)
#define for2(i,a,b) for(i=a;i>=b;i--)
#define for3(i,a,b) for(i=a;i<=b;i=i+2)
#define for1(i,a,b) for(i=a;i<=b;i++)
#define pb push_back
#define mp make_pair

#include<sstream>

#define si set<ll>
#define se multiset<ll>

typedef long double ld;

typedef vector<ll> vi;

#define bb(arr,nn,xx) upper_bound(arr,arr+nn,xx)-arr
#define aa(arra,nna,xxa) lower_bound(arra,arra+nna,xxa)-arra

#define all(v) sort(v.begin(),v.end())
 
#define all1(v) sort(v.rbegin(),v.rend())

ii main()
{

    ios::sync_with_stdio(0);
    cin.tie(0);

    ll n,i; cin>>n; ll x,y; vector<ll> v,v1;
    
    for1(i,1,n)
    {
    
        cin>>x>>y;
        
        ll p=x+y;
        
        ll p1=y-x;

        v.pb(p);
        
        v1.pb(p1);
        
    }
      
    all(v);
    
    all(v1);
    
    ll q=abs(v[0]-v[n-1]);
    
    ll q1=abs(v1[0]-v1[n-1]);
    
    cout<<max(q,q1)<<"\n";
    
}

Measured memory_bytes: 6652
#include<iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	int A[101][101];
	for (int i = 1; i <= n; i++) {//初期化
		for (int j = 1; j <= n; j++) {
			A[i][j] = 0;
		}
	}

	int u, k, v;
	for (int i = 0; i < n; i++) {
		cin >> u;
		cin >> k;
		for (int j = 0; j < k; j++) {
			cin >> v;
			A[u][v] = 1;
		}
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (j != 1) {
				cout << " ";
			}
			cout << A[i][j];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define mod 1000000007
using namespace std;

double dp[3001][3001];

double solve(double arr[], int i, int h)
{
    if(h==0)
    {
        return 1;
    }
    if(i==0)
    {
        return 0;
    }
    if(dp[i][h] > -0.9)
    {
        return dp[i][h];
    }
    return dp[i][h] = arr[i]*solve(arr, i-1, h-1)+(1-arr[i])*solve(arr, i-1, h);
}

int main()
{
    int n;
    cin>>n;
    memset(dp, -1, sizeof dp);
    double arr[3001];
    for(int i=1; i<=n; i++)
    {
        cin>>arr[i];
    }
    cout<<fixed<<setprecision(10)<<solve(arr, n, (n+1)/2)<<endl;
    
    return 0;
}

Measured memory_bytes: 70784
import java.util.*;
import java.io.*;


public class Main{
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int value = scan.nextInt();
        int count = 1;

        while(count * 1000 < value){
            count++;
        }
        System.out.println((count * 1000) - value);
    }
}


Measured memory_bytes: 35640
import scala.io.StdIn._

object Main extends App {
  val Array(n, k) = readLine.trim.split(' ').map(_.toInt)
  val mod = 1000000007
  var sum = 1L
  for (_ ← 0 until n) {
    sum *= k
    sum %= mod
  }
  println(sum)
}



Measured memory_bytes: 44124
N,Y = map(int,input().split())
for a in range(N+1):
    for b in range(N+1):
        val = Y-10000*a-5000*b
        n = N-a-b
        if n>=0 and val >=0 and n*1000==val:
            print(a,b,N-a-b);exit()
print('-1 -1 -1')

Measured memory_bytes: 66564
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,a,b) for(ll i=(a)-1;i>=(b);i--)

int main() {
    ll N;
    cin >> N;
    vector<vector<ll>> graph(N);
    rep(i,0,N) {
        rep(j,0,N) {
            char c;
            cin >> c;
            if (c == '1') {
                graph[i].push_back(j);
            }
        }
    }
    ll ans = -1;
    rep(start,0,N) {
        vector<ll> number(N);
        deque<ll> queue;
        number[start] = 1;
        queue.push_back(start);
        bool fail = false;
        while (queue.size() > 0) {
            ll now = queue.front();
            queue.pop_front();
            for (ll next : graph[now]) {
                if (number[next] > 0) {
                    if (number[next] != number[now] - 1 && number[next] != number[now] + 1) {
                        fail = true;
                    }
                } else {
                    number[next] = number[now] + 1;
                    queue.push_back(next);
                }
            }
        }
        if (fail) {
            continue;
        }
        ll max_val = *max_element(number.begin(), number.end());
        ans = max(ans, max_val);
    }
    cout << ans << endl;
}



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

int main(){

    while(1){
        int h,w;
        cin >> w >> h;
        if(w==0)break;
        vector<string> m(h);
        for(int i=0;i<h;i++){
            cin >> m[i];
        }
        vector<vector<bool>> wf(h,vector<bool>(w,false));
        vector<vector<bool>> bf(h,vector<bool>(w,false));
        int dx[]={0,1,0,-1};
        int dy[]={1,0,-1,0};
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(m[i][j]=='W'){
                    queue<pair<int,int>> q;
                    wf[i][j]=true;
                    bf[i][j]=true;
                    q.push({i,j});
                    while(!q.empty()){
                        pair<int,int> t=q.front();
                        q.pop();
                        for(int k=0;k<4;k++){
                            int ny=t.first+dy[k];
                            int nx=t.second+dx[k];
                            if(0<=ny&&ny<h&&0<=nx&&nx<w){
                                if(!wf[ny][nx]&&m[ny][nx]=='.'){
                                    q.push({ny,nx});
                                    wf[ny][nx]=true;
                                }
                            }
                        }
                    }
                }else if(m[i][j]=='B'){
                    queue<pair<int,int>> q;
                    wf[i][j]=true;
                    bf[i][j]=true;
                    q.push({i,j});
                    while(!q.empty()){
                        pair<int,int> t=q.front();
                        q.pop();
                        for(int k=0;k<4;k++){
                            int ny=t.first+dy[k];
                            int nx=t.second+dx[k];
                            if(0<=ny&&ny<h&&0<=nx&&nx<w){
                                if(!bf[ny][nx]&&m[ny][nx]=='.'){
                                    q.push({ny,nx});
                                    bf[ny][nx]=true;
                                }
                            }
                        }
                    }
                }
            }
        }
        int bans=0,wans=0;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(!wf[i][j]&&bf[i][j]){
                    bans++;
                }else if(!bf[i][j]&&wf[i][j]){
                    wans++;
                }
            }
        }
        cout << bans << " " << wans << endl;
    }

    return 0;
}


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

int N;
vector<int> p, q;

int main() {
  cin >> N;
  vector<int> p(N), q(N);

  // ex) input: 132 ---> output: 021
  for (int i = 0; i < N; ++i) cin >> p[i], --p[i];
  for (int i = 0; i < N; ++i) cin >> q[i], --q[i];

  // 各順列が何番目かを求める
  map<vector<int>, int> ord;
  int iter = 0;

  // スタートとなる順列
  // ex) N=4 ---> [0, 1, 2, 3]
  vector<int> v(N);
  for (int i = 0; i < N; ++i) v[i] = i;

  // 順番に全てを数え上げる
  do {
    // 連想配列のキーに配列、バリューに辞書順で数えたときの番号
    // ex) ord[[0, 1, 2, 3]: 0]
    ord[v] = iter++;

    // next_permutation は、辞書順の最後まで到達したら false を返す
  } while (next_permutation(v.begin(), v.end()));

  // ord[[1, 3, 2]] - ord[[3, 1, 2]] のような感じ
  cout << abs(ord[p] - ord[q]) << endl;
}

Measured memory_bytes: 9900
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, x float64
	fmt.Scan(&a, &b, &x)

	var d float64
	if x/(a*a) < b/2 {
		d = a * b * b / (2 * x)
	} else {
		d = 2*b/a - 2*x/(a*a*a)
	}
	fmt.Println(math.Atan(d) / math.Pi * 180)
}


Measured memory_bytes: 512
#include <stdio.h>
int a[200010];
int max(int x,int y)
{
	return x>y?x:y;
}
int min(int x,int y)
{
	return x<y?x:y;
}
int main ()
{
	int i,j,n,maxf,minf;
	while(scanf("%d",&n)!=EOF)
	{
		for(i=0;i<n;i++)
			scanf("%d",&a[i]);
		maxf=-2000000000;
		minf=a[0];
		for(i=1;i<n;i++)
		{
			maxf=max(maxf,a[i]-minf);
			minf=min(minf,a[i]);
		}
		printf("%d\n",maxf);
	}
	return 0;
}


Measured memory_bytes: 2548
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m,i;
  cin>>n>>m;
  int s=0,a[m];
  for(i=0;i<m;i++)
  {
      cin>>a[i];
      s+=a[i];
  }
  if(n>=s)
    cout<<n-s<<endl;
  else
    cout<<-1<<endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define longinf 9223372036854775807LL
#define intinf 2147483647
#define inf 1000000007
#define lol long long
#define in(n,s) insert(n,s)//ノート参照
#define SYOU(x) setprecision(x)
#define abs(x,y) (max(x,y)-min(x,y))
#define mp make_pair
#define fi first
#define se second
using namespace std;
lol a,b,c,d,e=0,g,h;
int w[110];
int v[110];
lol ac[110][100010];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>a>>b;
  for(int n=1;n<=a;n++){
      cin >>w[n]>>v[n];
  }
  memset(ac,inf,sizeof(ac));
  ac[0][0]=0;
  for(int n=1;n<=a;n++){
      for(int m=0;m<=100000;m++){
	  if(m-v[n]>=0) ac[n][m]=min(ac[n-1][m],ac[n-1][m-v[n]]+w[n]);
	  else ac[n][m]=ac[n-1][m];
      }
  }
  int ans=100000;
  while(ac[a][ans]>b) ans--;
  cout <<ans<<'\n';
  return (0);
}


Measured memory_bytes: 86272
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	cin>>a;
	if(a.find("C")!=string::npos&&a.find("F")!=string::npos)
	{
		a=a.substr(a.find("C"));
		if(a.find("F")!=string::npos)
		{
			cout<<"Yes"<<endl;
			exit(0);
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()

def bisection(l,r,f,left=True,discrete=True):
    eps=1 if(discrete) else 10**-8
    if((not left)^f(r)): return r if(left) else r+1
    elif(left^f(l)): return l-1 if(left) else l
    while(r-l>eps):
        h=(l+r)//2 if(discrete) else (l+r)/2
        if((not left)^f(h)): l=h
        else: r=h
    return (l+r)/2 if(not discrete) else l if(left) else r

from collections import defaultdict
from bisect import bisect_left
def resolve():
    n=int(input())
    D=defaultdict(int)
    for a in map(int,input().split()):
        D[a]+=1

    D=list(D.values())
    D.sort()
    t=len(D)
    S=[0]*(t+1)
    for i in range(t):
        S[i+1]=S[i]+D[i]

    k=0
    def check(t):
        # t 以下のものの総和
        i=bisect_left(D,t)
        score=S[i]+t*(len(D)-i)
        return score>=k*t

    for k in range(1,n+1):
        print(bisection(0,n//k+1,check))
resolve()

Measured memory_bytes: 120092
using System;
using System.Collections;
using System.Collections.Generic;

class Program {
    static void Main (string[] args) {
        string[] strtemp1 = Console.ReadLine ().Split (' ');
        int N = int.Parse (strtemp1[0]);
        int K = int.Parse (strtemp1[1]);
        string[] strtemp2 = Console.ReadLine ().Split (' ');
        var prices = new int[N];
        for (int i = 0; i < N; i++) {
            prices[i] = int.Parse (strtemp2[i]);
        }
        QuickSortS2B (prices);
        int total = 0;
        for (int i = 0; i < K; i++) {
            total += prices[i];
        }
        Console.WriteLine (total);
    }

    static void QuickSortS2B (int[] a) {
        QuickSortS2B (a, 0, a.Length - 1);
    }

    static void QuickSortS2B (int[] a, int left, int right) {
        if (left < right) {
            int i = left;
            int j = right;
            int tmp;
            int pivot = med3 (a[i], a[i + (j - i) / 2], a[j]);
            while (true) {
                while (a[i] < pivot) i++;
                while (pivot < a[j]) j--;
                if (i >= j) break;
                tmp = a[i];
                a[i] = a[j];
                a[j] = tmp;
                i++;
                j--;
            }
            QuickSortS2B (a, left, i - 1);
            QuickSortS2B (a, j + 1, right);
        }
    }

    static int med3 (int x, int y, int z) {
        if (x < y) {
            if (y < z) {
                return y;
            } else if (z < x) {
                return x;
            } else {
                return z;
            }
        } else {
            if (z < y) {
                return y;
            } else if (x < z) {
                return x;
            } else {
                return z;
            }
        }
    }
}

//dotnet run --project test

Measured memory_bytes: 27872
#include <stdio.h>

int main(void) {
	char red[128];
	char green[128];
	char sita[128];
	while (scanf("%s", red) == 1 && red[0] != '-') {
		int r, g, s;
		char center;
		if (scanf("%s%s", green, sita) != 2) return 1;
		r = 0; g = 0; s = 0, center = '\0';
		/* saisyo ni zikkou suru meirei wa push_right */
		center = green[g++];
		while (red[r] != '\0' || green[g] != '\0' || center != '\0') {
			if (center == sita[s]) {
				if (sita[s] != '\0') s++;
				center = red[r];
				if (red[r] != '\0') r++;
			} else {
				if (center != '\0') putchar(center);
				center = green[g];
				if (green[g] != '\0') g++;
			}
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=(a),_ed=(b);i<=_ed;++i)
#define DREP(i,a,b) for(int i=(a),_ed=(b);i>=_ed;--i)
#define mp(x,y) make_pair((x),(y))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
inline int read(){
    register int x=0,f=1;register char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();}
    while(isdigit(ch)){x=x*10+(ch^'0');ch=getchar();}
    return f?x:-x;
}

int n,a[200005],b[2],candidate[2];

int main(){
	// freopen("in.in","r",stdin);
	n=read();
	REP(i,1,n)a[i]=read();
	int ans=0;
	REP(i,1,n+1){
		REP(k,0,1){
			int preb=b[k],prec=a[i-1]-b[k];
			if(!k)candidate[0]=max(preb,max(0,a[i]-prec)),candidate[1]=min(preb,max(0,a[i]-prec));
			else candidate[1]=min(candidate[1],max(preb,a[i]-prec));
		}
		b[0]=candidate[0],b[1]=candidate[1];
		if(b[0]>a[i])++ans,b[0]=b[1],b[1]=0;
	}
	printf("%d\n",ans);
	return 0;
}


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

int main(){
	long long N,Y;
	cin >> N >> Y;
	if(N*10000 < Y){
		cout << "-1 -1 -1\n";
		return 0;
	}
	long long x = 10000*N-Y;
	for (long long i = 0; i <= N; ++i)
	{
		if(x >= 5000*i &&(x-5000*i)%9000 == 0){
			long long z = N - i - (x-5000*i)/9000;
			if(z < 0) continue;
			cout << z << " " << i << " " << (x-5000*i)/9000 << endl;
			return 0;
		}
	}
	cout << "-1 -1 -1\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main(){
    vector<int> a(9);
    vector<bool> c(9);

    rep(i,9){
        cin >> a[i];
        c[i] = false;
    }

    int n;
    cin >> n;
    vector<int> b(n);

    rep(i,n){
        cin >> b[i];
    }

    rep(i,9){
        rep(j,n){

           if(a[i] == b[j]){
               c[i] = 1;
           }

        }
    }

    if(c[0] == true && c[3] == true && c[6] == true ||c[1] == true && c[4] == true && c[7] == true ||c[2] == true && c[5] == true && c[8] == true ||c[0] == true && c[1] == true && c[2] == true ||c[3] == true && c[4] == true && c[5] == true ||c[6] == true && c[7] == true && c[8] == true ||c[0] == true && c[4] == true && c[8] == true ||c[2] == true && c[4] == true && c[6] == true){
        dunk("Yes");
    }

    else{
        dunk("No");
    }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    D = list(map(int, input().split()))
    M = int(input())
    T = list(map(int, input().split()))

    D.sort()
    T.sort()

    ans = "YES"
    d = 0
    for t in T:
        found = False
        for i in range(d, N):
            if D[i] == t:
                found = True
                d = i + 1
                break
        if not found:
            ans = "NO"
            break
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 35404
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false)
#define ll long long
int a[400000], b[300000], dp[300000];

int main()
{
    IO;
    int j, n, m, k, m1, m2, a1, a2, l  = 1, t, cnt=0, mn, h=0, mod=1e8+7, i; int tc=0;
    //cin>>t;
    //while(t--){
        tc++;
        cin>>n>>k;
        for(i =1; i<=n; i++) cin>>a[i];

        for(i = 1; i<=k; i++){
                dp[i]=1;
            for(j = 1; j<= n; j++){
                if(i-a[j]>=0) dp[i]&=dp[i-a[j]];
            }
            dp[i]=1-dp[i];
        }
        dp[k] ? cout<<"First"<<endl : cout<<"Second"<<endl;
    //}
    return 0;
}


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

int main(){
  int N, M,L;
  
  cin >> N >> M >> L;
  
bool A =(N==M);
bool B =(L==M);
bool C =(N==L);  
  
bool D =  A && B && C;
bool E =  (!A) && (!B) && (!C);  
  if(D||E)
  {
    cout << "No" << endl;     

  }
  else
  {
   cout << "Yes" << endl; 
  }

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
long long a,b,c,d,lj;
int main()
{
	cin>>a>>b>>c;
	for(int i=1;i<=a;i++)
	{
		cin>>d;
		if(d<b||d>=c) lj++;
	}
	cout<<lj<<endl;
	return 0;
}

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

using namespace std;

long long ans, sum, x, n, k;
map<long long, long long> m;
vector<long long> a;

int main(){
	cin >> n >> k;
	for(int i = 0; i < n; ++i){
		cin >> x;
		m[x]++;
	}
	for(auto itr = m.begin(); itr != m.end(); itr++) a.push_back(itr->second);
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	for(int i = 0; i < k && i < a.size(); ++i) sum += a[i];
	ans = n - sum;
	cout << ans << endl;
}

Measured memory_bytes: 14964
# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
# define mp make_pair
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll lmax(ll a, ll b){if(a>= b) return a;return b;}
ll lmin(ll a, ll b){if(a>= b) return b;return a;}

int main() {
  int n; cin >> n;
  ll k; cin >> k;
  ll q; cin >> q;
  vector<ll> corr(n, 0);
  rep(i, q){
    int a; cin >> a; --a;
    ++corr[a];
  }

  rep(i, n){
    if(k - q + corr[i] > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


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

const int MOD = 1e9 + 7;

struct mint {
  long long x;
  mint(long long x = 0) :x((x%MOD + MOD) % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(MOD - 2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

struct Sieve {
  int n;
  vector<int> f, primes;

  Sieve(int n = 1) : n(n), f(n + 1) {
    f[0] = f[1] = -1;
    for (long long i = 2; i <= n; ++i) {
      if (f[i] != 0) continue;
      primes.push_back(i);
      f[i] = i;
      for (long long j = i * i; j <= n; j += i) {
        if (f[j] == 0) f[j] = i;
      }
    }
  }

  bool isPrime(int x) { return f[x] == x; }

  map<int, int> factor(int x) {
    map<int, int> mp;
    while (x != 1) {
      mp[f[x]]++;
      x /= f[x];
    }
    return mp;
  }
};

int main(){
  int N; cin >> N;
  vector<int> A(N); rep(i, N) cin >> A[i];

  Sieve sieve(1e6);
  map<int, int> mp;
  rep(i, N) {
    map<int, int> mpi = sieve.factor(A[i]);
    for (auto p : mpi) {
      int x = p.first;
      mp[x] = max(mp[x], mpi[x]);
    }
  }

  mint lcm = 1;
  for (auto p : mp) {
    int x = p.first;
    rep(i, mp[x]) lcm *= x;
  }

  mint ans = 0;
  rep(i, N) {
    ans += lcm / A[i];
  }

  cout << ans.x << endl;
}


Measured memory_bytes: 4988