akhauriyash/Code-Regression huggingface dataset:
N,Q,K = map(int,input().split())
Answer_List = {}
for i in range(K):
    Correct = int(input())
    if Correct in Answer_List:
        Answer_List[Correct] = Answer_List[Correct] + 1
    else:
        Answer_List[Correct] = 1

Lose_Status = Q - K
if Lose_Status > 0:
    for j in range(N):
        print("Yes")
else:
    Standard = abs(Lose_Status) + 1
    for j in range(N):
        if j + 1 in Answer_List:
            if Answer_List[j + 1] >= Standard:
                print("Yes")
            else:
                print("No")
        else:
                print("No")
            
    

        
    

Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int gcd(int a, int b){
  //cout<<a<<" "<<b<<endl;
  if (a==0) return b;
  if (b==0) return a;
  if (b>a) swap(a,b);
  int r;
  while(b!=0){
    r = a - (a/b)*b;
    a = b;
    b = r;
  }
  return a;
}

int main(){
  int n;
  cin>>n;
  vector<int> a(n),L(n+1),R(n+1),skip(n);
  rep(i,n) cin>>a[i];

  L[1] = a[0];
  rep(i,n+1) if (i>1) L[i] = gcd(a[i-1],L[i-1]);
  R[n-1] = a[n-1];
  rep(i,n+1) if (i>1) R[n-i] = gcd(a[n-i],R[n-i+1]);

  L[0] = 0;
  R[n] = 0;
  rep(i,n) skip[i] = gcd(L[i],R[i+1]);
  cout << *max_element(all(skip)) << endl;
}



Measured memory_bytes: 1792
#include <string.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define REP1(i,n) for(int i=1;i<=(n);++i)

#define SORT(V) sort((V).begin(), (V).end())

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<pair<int, int> > VPII;
typedef long long LL;
typedef vector<long long> VL;
typedef pair<long long,long long> PLL;
typedef vector<pair<long long,long long> > VPLL;
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};

int N, M;
map<int, set<int> > G;

struct S {
  int p;
  int bit;
};

int bfs() {
  int total = 0;
  queue<struct S> q;
  q.push({1, 1});
  while (!q.empty()) {
    int p = q.front().p;
    int bit = q.front().bit;
    q.pop();
    if (bit == ((1 << N) - 1)) {
      ++total;
    } else {
      for (int n : G[p]) {
        if ((bit & (1 << (n - 1))) == 0) {
          q.push({n, bit | (1 << (n - 1))});
        }
      }
    }
  }
  return total;
}

int main() {
  cin >> N >> M;
  REP(i, M) {
    int a, b;
    cin >> a >> b;
    G[a].insert(b);
    G[b].insert(a);
  }
  int a = bfs();
  cout << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    string s;
    ll k;
    cin >> s >> k;

    int ult1 = 0;
    int dif;
    for ( int i = 0; i < (int) s.size(); i++ ) {
        if ( s[i] != '1' ) {
            dif = s[i] - '0';
            break;
        }
        ult1++;
    }

    cout << (k <= ult1 ? 1 : dif) << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
h = [int(i) for i in input().split()]

max = h[0]
flag = True
for i in range(1,n):
    if(max <= h[i]):
        max = h[i]
        continue
    elif (max - 1 > h[i] ):
        flag=False
        break

if flag :
    print("Yes")
else:
    print("No")



    


Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main(){
  int a,b,c,d,e;
  cin >>a>>b>>c>>d>>e ;
  if(a==0) cout << 1 << endl;
  else if(b==0) cout << 2 << endl;
  else if(c==0) cout << 3 << endl;
  else if(d==0) cout << 4 << endl;
  else  cout << 5 << endl;
  return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}

int h[123];

void solve() {
	int n; scanf("%d", &n);
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		int x; scanf("%d", &x);
		if (++h[x] == 1) ++ans;
	}
	printf("%d", ans);
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
string N;

cin>>N;

string ans{N.at(0)};
fx(N.size()-1){
	ans+='9';
}
ll ans2=stoll(ans.c_str());
ll ans3;
  if(ans==N){
    ans3=1;
    }else{
      ans3=0;
    }

while(ans2>0){
	ans3+=ans2%10;
	ans2/=10;
}
  
ce(ans3-1)

}

Measured memory_bytes: 256
//
//$$$$$$$$$$$$$$$$$$$$$$
//$$                  $$
//$$   gyoubu_oniwa   $$
//$$                  $$
//$$$$$$$$$$$$$$$$$$$$$$
//
#include<bits/stdc++.h>
using namespace std;
#define DBG(a) cout<<#a<<':'<<a<<endl;
#define PB push_back
#define EB emplace_back
#define btoe(v) (v).begin(),(v).end()
#define F first
#define S second
#define L length()
#define SZ size()
#define pow(a,b) (pow(a,b)+0.5)

typedef unsigned long long int ulli;
typedef long long int lli;
typedef long double ldbl;
#define f(i,a,b) for(int i=(a); i<(b); ++i)
#define fr(i,a,b) for(int i=(a); i>(b); --i)
#define fl(i,a,b) for(lli i=(a); i<(b); ++i)
#define flr(i,a,b) for(lli i=(a); i>(b); --i)
#define w(x) lli x; cin>>x; while(x--) 
#define inpn(n,v,T) T n; cin>>n; vector<T> v(n); fl(i,0,n) cin>>v[i];
#define inp(n,v,T) vector<T> v(n); fl(i,0,n) cin>>v[i];

typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<pii> vpii;typedef vector<vector<pii>> vvpii;typedef pair<lli,lli> plli;typedef vector<lli> vlli;typedef vector<vlli> vvlli;typedef vector<plli> vplli;typedef vector<vector<plli>> vvplli;typedef vector<bool> vb;typedef vector<string> vs;typedef vector<vector<string>> vvs;

#define unmp unordered_map

#define PRIME ((lli)(1e9+7ll))
#define PRIME2 (998244353ll)
const lli TEN_18 = 1e18;
const lli TEN_9 = 1e9;
const lli TEN_5 = 1e5;

inline void debugORfast(int a=1,int b=1){
    if(a){
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
        #endif
    }
    if(b){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
}}

template<typename T>
void print(const T &v, int begin=-1, int end=-1, int w=2)
{
	if(begin==-1) fl(i,0,v.SZ) cout<<setw(w)<<v[i]<<' ';
	else if(end==-1) fl(i,begin,v.SZ) cout<<setw(w)<<v[i]<<' ';
	else fl(i,begin,end) cout<<setw(w)<<v[i]<<' ';
	cout<<endl;
}

template<typename T>
void printr(const T &v, int begin=-1, int end=-1, int w=2)
{
	if(begin==-1) flr(i,v.SZ-1,-1) cout<<setw(w)<<v[i]<<' ';
	else if(end==-1) flr(i,begin,-1) cout<<setw(w)<<v[i]<<' ';
	else flr(i,begin,end) cout<<setw(w)<<v[i]<<' ';
    cout<<endl;
}

void pans(char v){
	switch(v){
		case 'y' : cout<<"yes"<<endl; break;
		case 'n' : cout<<"no"<<endl; break;
		case 't' : cout<<"True"<<endl; break;
		case 'f' : cout<<"False"<<endl; break;
		case 'Y' : cout<<"Yes"<<endl; break;
		case 'N' : cout<<"No"<<endl; break;
	}
}


lli tmp1,tmp2;

int main()
{
	debugORfast(0,1);
	const int DBGDO=100;
	//w(ttt)
	{
		lli x; cin>>x;
		inpn(n,p,lli);
		vi present(1000,0);
		f(i,0,n) present[p[i]]=1;
		int minv=10000, ans=10000;
		f(i,0,present.SZ){
			if(present[i]==0){
				if( abs(x-i)<minv ){
					ans = i;
					minv = abs(x-i);
				}
			}
		}
		cout<<ans<<endl;
	}

	return 0;
}


Measured memory_bytes: 3648
import java.util.*;

/**
 * Created by Seiya on 2016/10/16.
 */

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        long N = scanner.nextLong();
        long M = scanner.nextLong();

        long temp = Math.min(N, M / 2);

        if(temp == N){
            long a = M - 2 * N;
            temp += a / 4;
        }

        System.out.println(temp);

    } // mainMethod



} // MainClass


Measured memory_bytes: 23636
n = gets.to_i
as, bs, cs = 3.times.map { gets.split(' ').map(&:to_i) }
[as, bs, cs].each { |ary| ary.sort! }
ans = 0
bs.each do |b|
  ia = as.bsearch_index { |a| a >= b }
  ic = cs.bsearch_index { |c| c > b }
  next if ic.nil?
  ia = n if ia.nil?
  ans += ia * (n - ic)
end
puts ans

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

bool V[7];
bool A[7][7];
bool visited[7];
int dfs(int v)
{
  int a = 0;
  for (int j=0;j<7;j++)
  {
    if (A[v][j] && !visited[j] && (v != j))
    {
      visited[j] = true;
      a += dfs(j);
    }
  }
  return a + 1;
}

int main()
{
  int degree[7];
  int n;
  while (cin >> n)
  {
    for (int i=0;i<7;i++)
    {
      V[i] = false;
      degree[i] = 0;
      for (int j=0;j<7;j++) A[i][j] = false;
    }
    for (int i=0;i<n;i++)
    {
      int m, x, y;
      cin >> m;
      x = m / 10; y = m % 10;
      V[x] = V[y] = true;
      A[x][y] = A[y][x] = true;
      degree[x]++;
      degree[y]++;
    }
    int od = 0;
    for (int i=0;i<7;i++) if (degree[i]%2) od++;
    if (od > 2) cout << "No" << endl;
    else
    {
      int order = 0;
      int start = 0;
      for (int i=0;i<7;i++)
      {
        visited[i]=false;
        if (V[i]) { order++; start=i; }
      }
      visited[start] = true;
      if (order == dfs(start)) cout << "Yes" << endl;
      else cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)
#define pb push_back
#define int long long
typedef pair<int, int> P;
//typedef tuple<string, int, int> T;
const int MAX = 101000;
const int MOD = 1000000007;
int fact[MAX], finv[MAX], inv[MAX];

void Cinit() {
    fact[0] = fact[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i=2; i<MAX; i++) {
        fact[i] = fact[i-1]*i%MOD;
        inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}

int C(int n, int k) {
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

vector<P> factorize(int n) {
    vector<P> res;
    for (int i=2; i*i<=n; i++) {
        int cnt = 0;
        while (n%i==0) {
            cnt++;
            n /= i;
        }
        res.pb(P(i, cnt));
    }
    if (n!=1) res.pb(P(n, 1));
    return res;
}

int N, M;

signed main() {
    cin >> N >> M;
    Cinit();
    vector<P> fct = factorize(M);
    int ans = 1;
    rep(i, fct.size()) {
        int c = fct[i].second;
        ans *= C(N+c-1, c);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2816
#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 h,n;
  cin >>h>>n;
  int a[10001],b[10001];
  vector<int> dp(h+1,100010001);
  rep(i,n){
    cin>>a[i]>>b[i];
  }
  dp[0]=0;
  rep(i,n){
    rep(j,h+1){
      dp[min(j+a[i],h)]=min(dp[min(j+a[i],h)],dp[j]+b[i]);
    }
  }
  cout << dp[h]<<endl;
}

Measured memory_bytes: 3656
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int[][] x = new int[N][2];
        Arrays.setAll(x, i -> new int[]{i, in.i()});
        Arrays.sort(x, (y, z) -> y[1] - z[1]);
        int min = N + 1;
        int ans = 0;
        for (int i = 0; i < N; i++) {
            if (x[i][0] < min) {
                min = x[i][0];
                ans++;
            }
        }
        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 49616
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <list>
#include <cstdlib>
#include <iomanip>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <iterator>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <cmath>
#include <cstring>
#include <sstream>
#include <stack>
#include <random>

using namespace std;

#define vi vector<int> 
#define vvi vector<vi>
#define pi pair<int,int>
#define ll long long
#define pll pair<ll, ll>
#define vll vector<ll>
#define io ios::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define sz(a) int((a).size()) 
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define loop(i,b) for (int i = 0; i < b; ++i)
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define INF numeric_limits<int>::max()
#define LLINF numeric_limits<ll>::max()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define F first
#define S second
#define MOD 1000000007
#define cflout(x) cout << fixed << setprecision(8) << x << endl
#define setzero(x) memset(x, 0, sizeof(x))

#ifndef M_PI
    #define M_PI 3.14159265358979323846
#endif

random_device _random_device;
default_random_engine _generator(_random_device());
uniform_int_distribution<long long unsigned> _distribution(0, 0xFFFFFFFFFFFFFFFF);

inline long long unsigned get_random_number() {
    return _distribution(_generator);
}

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

inline ll nxt() {
	ll x;
	cin >> x;
	return x;
}

namespace aux {	
vector<string> split(const string& s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c)) {
		v.emplace_back(x);
    }
    return v;
}
}


unordered_set<ll> sheet;

int main() {
	io;
	int n = nxt();
	loop(i, n) {
		ll x = nxt();
		if (present(sheet, x)) sheet.erase(x);
		else sheet.insert(x);
	}
	cout << sheet.size() << endl;




	return 0;
}




Measured memory_bytes: 4388
main :: IO ()
main = do
  param <- reads2List :: IO [Int]
  let n = head param
  let a = param !! 1
  let b = last param
  print $ solve n a b

s2List :: Read a => String -> [a]
s2List = fmap read . words

reads2List :: Read a => IO [a]
reads2List = do
  s <- getLine
  return (s2List s)

solve :: Int -> Int -> Int -> Int
solve 1 a b = if a == b then 1 else 0
solve n a b | a > b = 0
            | otherwise = maxi - mini + 1 where 
              mini = b + (n - 1) * a
              maxi = a + (n - 1) * b


Measured memory_bytes: 508
package main

import (
	"fmt"
)

func max(n ...int) int {
	m := n[0]
	for _, v := range n[1:] {
		if v > m {
			m = v
		}
	}
	return m
}

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	fmt.Println(max(a+b, a-b, a*b))
}


Measured memory_bytes: 512
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<class T1, class T2> inline void chkmin(T1 &x, const T2 &y) {if (x > y) x = y;}
template<class T1, class T2> inline void chkmax(T1 &x, const T2 &y) {if (x < y) x = y;}
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define mp make_pair
#define pb push_back
#define read(FILENAME) freopen((string(FILENAME) + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((string(FILENAME) + ".out").c_str(), "w", stdout);
const int MAXN = 200228;

bool ach[MAXN];
bool ach1[MAXN];
bool ach2[MAXN];
bool ach3[MAXN];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//read("input");
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	a--, b--, c--, d--;
	string s;
	cin >> s;
	if (c > d) {
		for (int i = 0; i < n; i++) {
			if (i == a) {
				ach[i] = true;
			} else {
				if (s[i] == '.') {
					if (i && ach[i - 1]) {
						ach[i] = true;
					}
					if (i >= 2 && ach[i - 2]) {
						ach[i] = true;
					}
				} 
			}
		}
		for (int i = n - 1; i >= 0; i--) {
			if (i == c) {
				ach1[i] = true;
			} else {
				if (s[i] == '.') {
					if (ach1[i + 1]) {
						ach1[i] = true;
					}
					if (ach1[i + 2]) {
						ach1[i] = true;
					}
				} 
			}
		}
		for (int i = 0; i < n; i++) {
			if (i == b) {
				ach2[i] = true;
			} else {
				if (s[i] == '.') {
					if (i && ach2[i - 1]) {
						ach2[i] = true;
					}
					if (i >= 2 && ach2[i - 2]) {
						ach2[i] = true;
					}
				} 
			}
		}
		for (int i = n - 1; i >= 0; i--) {
			if (i == d) {
				ach3[i] = true;
			} else {
				if (s[i] == '.') {
					if (ach3[i + 1]) {
						ach3[i] = true;
					}
					if (ach3[i + 2]) {
						ach3[i] = true;
					}
				} 
			}
		}
		for (int i = 1; i < n - 1; i++) {
			if (ach2[i] && ach3[i]) {
				if (ach[i - 1] && ach1[i + 1]) {
					cout << "Yes\n";
					return 0;
				}
			}
		}
		cout << "No\n";
		return 0;
	}
	
	while (b < d) {
		if (s[b + 1] == '.') {
			b++;
		} else {
			if (s[b + 2] == '.') {
				b += 2;
			} else {
				cout << "No\n";
				return 0;
			}
		}	
	}
	b = a;
	d = c;
	while (b < d) {
		if (s[b + 1] == '.') {
			b++;
		} else {
			if (s[b + 2] == '.') {
				b += 2;
			} else {
				cout << "No\n";
				return 0;
			}
		}	
	}
	cout << "Yes\n";
	return 0;
}


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

using namespace std;

signed main() {
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  for(auto& i : h) cin >> i;

  vector<int> dp(N, 1e9);
  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]);
  for(int i=2;i<N;i++) for(int k=1; k<=min(K, i); k++) dp[i] = min(dp[i], dp[i-k] + abs(h[i] - h[i-k]));
  cout << dp[N-1] << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int MAX(int a,int b){return a<b?b:a;}
int main(){
  int a,b,c,d,n,m;
  scanf("%d",&m);
  while(m--){
    scanf("%d %d",&n,&b);
    for(c=d=0;--n;b=a){
      scanf("%d",&a);
      c=MIN(b-a,c);
      d=MAX(b-a,d);
    }
    printf("%d %d\n",-c,d);
  }
  return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int s = 0;
    rep(i, n) s ^= a[i];
    vector<int> ans(n);
    rep(i, n) ans[i] = s ^ a[i];
    rep(i, n) cout << ans[i] << endl;
}

Measured memory_bytes: 4844
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        ArrayList<Integer> a = new ArrayList<Integer>();
        a.add(scanner.nextInt());
        a.add(scanner.nextInt());
        a.add(scanner.nextInt());
        a.sort(null);
        System.out.println(a.get(0) + " " + a.get(1) + " " + a.get(2));
        scanner.close();
    }
}



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

int main(){
    int n;
    cin >> n;
    vector<int> w(n);
    rep(i,n) cin >> w[i];
    int s = 0, s1 = 0;
    rep(i,n) s += w[i];
    int ans = INT_MAX;
    rep(i,n){
        s1 += w[i];
        ans = min(ans,abs(s-2*s1));
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int W,H,N;
    cin>>W>>H>>N;
    int square[H][W];
    memset(square, 0, sizeof(square));
    for(int i=0; i<N; i++) {
        int x,y,a;
        cin>>x>>y>>a;
        switch(a) {
            case 1:
            for(int i=0; i<H; i++) {
                for(int j=0; j<x; j++) {
                    square[i][j]=1;
                }
            }
            break;
            case 2:
            for(int i=0; i<H; i++) {
                for(int j=x; j<W; j++) {
                    square[i][j]=1;
                }
            }
            break;
            case 3:
            for(int i=0; i<y; i++) {
                for(int j=0; j<W; j++) {
                    square[i][j]=1;
                }
            }
            break;
            case 4:
            for(int i=y; i<H; i++) {
                for(int j=0; j<W; j++) {
                    square[i][j]=1;
                }
            }
            break;
        }
    }
    int ans=0;
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            if(square[i][j]==0) ans++;
            // cout<<square[i][j];
        }
        // cout<<endl;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
# abc102_b.py
# https://atcoder.jp/contests/abc102/tasks/abc102_b

# B - Maximum Difference /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 長さ Nの整数列 A が与えられます。 A の（添字の）異なる 2要素の差の絶対値の最大値を求めてください。

# 制約
#     2≤N≤100
#     1≤Ai≤109
#     入力はすべて整数である。

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N
# A1 A2 ... AN

# 出力
# Aの（添字の）異なる 2要素の差の絶対値の最大値を出力せよ。

# 入力例 1
# 4
# 1 4 6 3

# 出力例 1
# 5

# A3−A1=6−1=5が、異なる 2要素の差の最大値です。

# 入力例 2
# 2
# 1000000000 1

# 出力例 2
# 999999999

# 入力例 3
# 5
# 1 1 1 1 1

# 出力例 3
# 0


def calculation(lines):
    N = int(lines[0])
    values = [value for value in map(int, lines[1].split(' '))]
    max_diff = 0
    for i in range(len(values)):
        for j in range(len(values)):
            diff = abs(values[i] - values[j])
            if max_diff < diff:
                max_diff = diff
    return [max_diff]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['4', '1 4 6 3']
        lines_export = [5]
    if pattern == 2:
        lines_input = ['2', '1000000000 1']
        lines_export = [999999999]
    if pattern == 3:
        lines_input = ['5', '1 1 1 1 1']
        lines_export = [0]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 9264
#include <iostream>
#include <string>
#include <sstream>
#include <list>
using namespace std;

int main(int argc, char** argv) {

    list<int> l;
    l.push_back(0);
    list<int>::iterator top=l.begin();
    
    string expr;
	getline(cin,expr);
	istringstream is(expr);
    int x,y;
    while(!is.eof()){
        string op;
		 is>>op;
        switch(op[0]){
            case '+':
                y=*top;
                top--;
                l.pop_back();
                x=*top;
                top--;
                l.pop_back();
                l.push_back(x+y);
                top++;
                break;
            case '-':
                y=*top;
                top--;
                l.pop_back();
                x=*top;
                top--;
                l.pop_back();
                l.push_back(x-y);
                top++;
                break;
            case '*':
                y=*top;
                top--;
                l.pop_back();
                x=*top;
                top--;
                l.pop_back();
                l.push_back(x*y);
                top++;
                break;
			default:
				istringstream is2(op);
				is2>>x;
				l.push_back(x);
				top++;
				break;
        }
    }
    cout<<*top<<endl;
    return 0;
}


Measured memory_bytes: 3168
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
using namespace std;
#define rep(i,n) for (int i=1;i<=n;i++)
#define repn(i,n1,n2) for (int i=n1;i<=n2;i++)
long long mod[100005],a[100005],add[100005];
int main()
{
	int n;
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d %d",&a[i],&mod[i]);
		a[i]%=mod[i];
	}
	long long ans=0;
	for (int i=n;i>0;i--){
		a[i]=(a[i]+add[i+1])%mod[i];
		if (a[i]!=0){
			ans+=mod[i]-a[i];
			add[i]=add[i+1]+mod[i]-a[i];
		}
		else{
			add[i]=add[i+1];
		}
	}
	cout<<ans;
}

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

class BigInt {
public:
	BigInt() {}

	BigInt(long long n) {
		a[0] = n;
		normalize();
	}

	BigInt &operator+=(const BigInt &r) {
		for (int i = 0; i < N; i++) {
			a[i] += r.a[i];
		}
		normalize();
		return *this;
	}

	BigInt operator+(BigInt r) {
		return r += *this;
	}

	BigInt &operator*=(const BigInt &r) {
		for (int i = N - 1; i >= 0; i--) {
			long long s = 0;
			for (int j = 0; j <= i; j++) {
				s += a[j] * r.a[i - j];
			}
			a[i] = s;
		}
		normalize();
		return *this;
	}

	BigInt operator*(BigInt r) {
		return r *= *this;
	}

	bool operator<(const BigInt &r) const {
		for (int i = N - 1; i >= 0; i--) {
			if (a[i] != r.a[i]) {
				return a[i] < r.a[i];
			}
		}
		return false;
	}

	bool operator<=(const BigInt &r) const {
		for (int i = N - 1; i >= 0; i--) {
			if (a[i] != r.a[i]) {
				return a[i] < r.a[i];
			}
		}
		return true;
	}

	bool operator==(const BigInt &r) const {
		for (int i = 0; i < N; i++) {
			if (a[i] != r.a[i]) return false;
		}
		return true;
	}

	bool operator>(const BigInt &r) const {
		return !(*this <= r);
	}

	bool operator>=(const BigInt &r) const {
		return !(*this < r);
	}

	string to_string() const {
		int i = N - 1;
		while (i > 0 && a[i] == 0) i--;
		string s = std::to_string(a[i--]);
		for (; i >= 0; i--) {
			string t = std::to_string(a[i]);
			s += string(L - t.length(), '0') + t;
		}
		return s;
	}

private:
	static const int N = 6;
	static const int L = 4;
	static const long long B = 10000;
	long long a[N] = {};

	void normalize() {
		long long carry = 0;
		for (int i = 0; i < N; i++) {
			a[i] += carry;
			carry = a[i] / B;
			a[i] %= B;
		}
	}
};

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

	vector<long long> a(n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
	}

	vector<bool> is_prime(101010, true);
	vector<long long> ps;
	map<long long, long long> rt;

	for (long long i = 2; i < 101010; i++) {
		if (is_prime[i]) {
			ps.push_back(i);
			rt[i * i] = i;
			for (int j = i * 2; j < 101010; j += i) {
				is_prime[j] = false;
			}
		}
	}

	map<BigInt, BigInt> inv;
	map<BigInt, int> cnt;

	for (int i = 0; i < n; i++) {
		BigInt p = 1, q = 1;
		for (int j = 0; ps[j] <= 2500; j++) {
			int c = 0;
			while (a[i] % ps[j] == 0) a[i] /= ps[j], c++;
			c %= 3;
			if (c > 0) {
				for (int i = 0; i < c; i++) p *= ps[j];
				for (int i = 0; i < 3 - c; i++) q *= ps[j];
			}
		}
		p *= a[i];
		if (a[i] != 1) {
			if (rt.count(a[i])) {
				q *= rt[a[i]];
			} else {
				q *= a[i];
				q *= a[i];
			}
		}
		inv[p] = q;
		inv[q] = p;
		cnt[p]++;
	}

	int ans = 0;
	for (auto &kv : inv) {
		auto &x = kv.first;
		auto &y = kv.second;

		if (x == y) {
			ans++;
		} else if (x < y) {
			ans += max(cnt[x], cnt[y]);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 48640
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+1
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

string S,T;
int dp[3001][3001];

int max(int a, int b, int c){ return max(a, max(b, c)); }

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

	cin >> S >> T;
    for(int i=0; i<=S.size(); i++) dp[i][T.size()] = 0;
    for(int j=0; j<=T.size(); j++) dp[S.size()][j] = 0;
    for(int i=S.size()-1; i>=0; i--){
        for(int j=T.size()-1; j>=0; j--){
            dp[i][j] = max(dp[i+1][j], dp[i][j+1], S[i]==T[j] ? dp[i+1][j+1]+1 : 0);
        }
    }

    int i = 0;
    int j = 0;
    while(dp[i][j] > 0){
        if(S[i] == T[j] && dp[i][j] == dp[i+1][j+1]+1){
            cout << S[i];
            i++; j++;
        }
        else if(dp[i][j] == dp[i+1][j]) i++;
        else j++;
    }
    cout << endl;

	return 0;
}

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

int main() {

  int N, M;
  cin >> N >> M;
  
  vector<pair<int,int>> v(M);
  for (int i = 0; i < M; i++) {
    cin >> v[i].first >> v[i].second;
  }

  vector<pair<int,int>> v2 = v;

  sort(v2.begin(),v2.end()); 

  map<pair<int,int>, int> mp;

  int current = v2[0].first;
  int count = 0;
  
  for (int i = 0; i < M; i++) {
    if (current == v2[i].first) {
      count++;
    } else {
      current = v2[i].first;
      count = 1;
    }
    mp[v2[i]] = count;
  }

  for (int i = 0; i < M; i++) {
    printf("%06d", v[i].first);
    printf("%06d", mp[v[i]]);
    printf("\n");
  }

  return 0;

}

Measured memory_bytes: 9344
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, ll> P;
typedef pair<int, pair<int, int> > PP;
const int MAX=2e5+10;

template <typename T,typename E>
struct SegmentTree{
	using F = function<T(T,T)>;
	using G = function<T(T,E)>;
	using H = function<E(E,E)>;
	int n,height;
	F f;
	G g;
	H h;
	T ti;
	E ei;
	vector<T> dat;
	vector<E> laz;
	  SegmentTree(F f,G g,H h,T ti,E ei):
	    f(f),g(g),h(h),ti(ti),ei(ei){}
  
	void init(int n_){
		n=1;height=0;
		while(n<n_) n<<=1,height++;
		dat.assign(2*n,ti);
		laz.assign(2*n,ei);
	}
	void build(const vector<T> &v){
		int n_=v.size();
		init(n_);
		for(int i=0;i<n_;i++) dat[n+i]=v[i];
		for(int i=n-1;i;i--)dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
	}
	inline T reflect(int k){
		return laz[k]==ei?dat[k]:g(dat[k],laz[k]);
	}
	inline void eval(int k){
		if(laz[k]==ei) return;
		laz[(k<<1)|0]=h(laz[(k<<1)|0],laz[k]);
		laz[(k<<1)|1]=h(laz[(k<<1)|1],laz[k]);
		dat[k]=reflect(k);
		laz[k]=ei;
	}
	inline void thrust(int k){
		for(int i=height;i;i--) eval(k>>i);
	}
	inline void recalc(int k){    
		while(k>>=1)dat[k]=f(reflect((k<<1)|0),reflect((k<<1)|1));
	}
	void update(int a,int b,E x){
		thrust(a+=n);
		thrust(b+=n-1);
		for(int l=a,r=b+1;l<r;l>>=1,r>>=1){
			if(l&1) laz[l]=h(laz[l],x),l++;
			if(r&1) --r,laz[r]=h(laz[r],x);
		}
		recalc(a);
		recalc(b);
	}
	void set_val(int a,T x){
		thrust(a+=n);
		dat[a]=x;laz[a]=ei;
		recalc(a);
	}
	T query(int a,int b){
		thrust(a+=n);
		thrust(b+=n-1);
		T vl=ti,vr=ti;
		for(int l=a,r=b+1;l<r;l>>=1,r>>=1) {
			if(l&1) vl=f(vl,reflect(l++));
			if(r&1) vr=f(reflect(--r),vr);
		}
		return f(vl,vr);
	}
};

int N,M;
vector<P> IV[MAX];
void input(){
    cin>>N>>M;
    rep(_,M){
        int l, r;
        ll a;
        cin>>l>>r>>a;
        IV[r].pb(mp(l,a));
    }
}

ll ans;
void solve(){
    auto f=[](ll a,ll b){return max(a,b);};
    auto g=[](ll a,ll b){return a+b;};
    ll ti=0;
    SegmentTree<ll,ll> seg(f,g,g,ti,ti);
    seg.init(N+1);
    rep1(k,N){
        ll x=seg.query(0,k);
        seg.set_val(k, x);
        rep(i,sz(IV[k])){
            P p=IV[k][i];
            int l=p.fi;
            ll a=p.se;
            seg.update(l,k+1,a);
        }
    }
    ans=seg.query(0,N+1);
}

void output(){
    cout<<ans;
}

int main(){
  input();
  solve();
  output();
}

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

int store[100007];
int N;

int main()
{
    cin >> N;
    for (int i = 0; i < N; i++) scanf("%d", &store[i]);

     bool flg = true;
     store[0]--;

     for (int i = 1; i < N - 1; i++) {
        if (store[i] - 1 >= store[i-1]) store[i]--;

        if (store[i] > store[i+1]) {flg = false; break;}
    }

    if (flg) puts("Yes\n");
    else puts("No\n");
}


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

long long memo[87];

long long fib (int n) {
    if (n == 0)
        return 2;
    else if (n == 1)
        return 1;
    if (memo[n] != 0)
        return memo[n];
    return memo[n] = fib(n - 1) + fib(n - 2);
}

int main() {
    int n;
    cin >> n;
    cout << fib(n) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <map>
using namespace std;

int main() {
  int M, D, ans;
  cin >> M >> D;
  ans=0;
  for (int m=1; m<=M; m++) {
    for (int d=1; d<=D; d++) {
      int d1=d%10, d10=(d-d1)/10;
      if (d1>=2 && d10>=2 && d1*d10==m) {
        ans=ans+1;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3584
A = input()
B = input()
if A == B:
    print('EQUAL')
elif len(A) > len(B):
    print('GREATER')
elif len(B) > len(A):
    print('LESS')
else:
    for i in range(len(A)):
        a = int(A[i])
        b = int(B[i])
        if a > b:
            print('GREATER')
            break
        elif b > a:
            print('LESS')
            break

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF 1e18
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define rep(i,N) for(int i=0;i<N;i++)

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

  string n;
  cin>>n;
  int N=n.size();
  vector<int>a(N);
  for(int i=0;i<N;i++)a[i]=n[i]-'0';
  reverse(rng(a));
  vector<vector<ll>>dp(N+1,vector<ll>(2,INF));
  dp[0][0]=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<2;j++){
      for(int k=0;k<=9;k++){
        if(j){
          if(k>=a[i]+1)dp[i+1][0]=min(dp[i+1][0],dp[i][j]+2*k-(a[i]+1));
          else dp[i+1][1]=min(dp[i+1][1],dp[i][j]+10-(a[i]+1-k));
        }
        else{
          if(k>=a[i])dp[i+1][0]=min(dp[i+1][0],dp[i][j]+2*k-a[i]);
          else dp[i+1][1]=min(dp[i+1][1],dp[i][j]+10-(a[i]-k));
        }
      }
    }
  }
  cout<<min(dp[N][0],dp[N][1]+1)<<endl;
  return 0;
}


Measured memory_bytes: 59804
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;
ll mod=1e9+7;

ll lcm(ll a,ll b){
    return a*b/__gcd(a,b);
}

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d ;
    a-=1;
    ll wow=lcm(d,c);
    ll yay=b/c-a/c+b/d-a/d-(b/(wow)-a/(wow));
    cout<<b-a-yay;
    
}

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

goukei=sum(a)

for i in range(len(b)):
    if b[i]>a[i]:
        a[i+1]=a[i+1]+a[i]-b[i]
        a[i]=0
        if a[i+1]<0:
            a[i+1]=0
    else:
        a[i]=a[i]-b[i]
print(goukei-sum(a))

Measured memory_bytes: 97644
// B - Power Socket
#include <stdio.h>

int main(void){
    int a, b, tap=0, sum=1;
    scanf("%d%d", &a, &b);
    if(a==b){
        printf("1\n");
        return 0;
    }else{
        while(sum<b){
            sum--;
            sum+=a;
            tap++;
        }
        printf("%d\n", tap);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9+10)
#define ll_MIN (ll)(-1e9*1e9-10)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
//using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX
 

void solve()
{
  string s;
  cin >> s;
  int tot = 0;
  loop(s)
    tot += (it-'0');
  if(tot%9==0)
      cout << "Yes";
    else
      cout << "No";
}


 
signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 3768
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
using namespace std;

int main()
{
    cin.tie(0);

    int n;
    cin >> n;

    vector<int> as(n);
    for (auto &a: as)
        cin >> a;

    map<int, int> mm;
    for (auto &a: as) {
        mm[a]++;
    }

    int ones = 0, twos = 0;
    for (auto &p : mm) {
        if (p.second >= 3) {
            p.second -= (p.second - 1) / 2 * 2;
        }

        if (p.second == 1) {
            ones++;
        } else if (p.second == 2) {
            twos++;
        } else {
            abort();
        }
    }

    int pairs = twos / 2;

    ones += pairs * 2;
    twos -= pairs * 2;

    cout << ones << endl;

    return 0;
}

Measured memory_bytes: 5376
from collections import defaultdict

c = 0
N, M = list(map(int, input().split()))

L = defaultdict(int)
for i in range(N):
	KA = list(map(int, input().split()))
	for j in range(KA[0]):
		L[KA[1 + j]] += 1

for i in range(1, M + 1):
	if L[i] == N:
		c += 1

print(c)

Measured memory_bytes: 3316
# coding: utf-8
# Your code here!
#word = input()
nums = []
nums = input().split(" ")
num1 = int(nums[0])
num2 = int(nums[1])

money = []
money=input().split(" ")
#print(money)

money2 = []
for i in range(num1):
    money2.append(int(money[i]))

money2=sorted(money2)
#print(sorted(money2))

    
total=0
for i in range(num2):
    total = (money2[i])+total
print(total)

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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); \
				cin.tie(0); \
				cout.tie(0)
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(_v)             _v.begin(), _v.end()
#define sz(_v)              (int) _v.size()
#define first(_obj)         (*_obj.begin())
#define last(_obj)          (*prev(_obj.end()))
#define FIND(_obj, _val)    (_obj.find(_val) != _obj.end())
#define RESET(_a, _v)       fill_n(_a,sizeof(_a)/sizeof(_a[0]),_v)
#define REP(_i, _n)         for (int _i = 0; _i < (int) _n; _i++)
#define FOR(_i, _a, _b)     for (int _i = (int) _a; _i <= (int) _b; _i++)
#define FORD(_i, _a, _b)    for (int _i = (int) _a; _i >= (int) _b; _i--)
#define FORIT(_it, _obj)    for (auto _it = _obj.begin(); _it != _obj.end(); _it++)

// DEBUG UTIL
template<typename TF>
void debug(ostream &out, TF const &f) {
    out << f << std::endl;
}
 
template<typename TF, typename ... TR>
void debug(ostream &out, TF const &f, TR const& ... rest) {
    out << f << " ";
    debug( out, rest... );
}
 
#define DEBUG(...) debug(cerr, "[", #__VA_ARGS__, "]:", __VA_ARGS__)

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pdd = pair<double,double>;
using vi = vector<int>;
using vii = vector<pii>;
using vll = vector<ll>;
using vs = vector<string>;

const int DR[] = {-1, 0, 1, 0, -1, 1, 1, -1}; // ccw
const int DC[] = {0, -1, 0, 1, -1, -1, 1, 1};
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = 1073741823;
const ll INFLL = 4e18;
const int MAX = 1e5;

int K, dist[MAX+5];

void read() {
	cin >> K;
}

void solve() {
	REP(i, MAX) dist[i] = INF;

	set<pii> sets;
	dist[1] = 1;
	sets.insert({1, 1});

	while (!sets.empty()) {
		int d = sets.begin()->fi;
		int now = sets.begin()->se;
		sets.erase(sets.begin());

		if (now == 0) break;
		if (d > dist[now]) continue;

		int nex = 10 * now % K;
		if (d + 0 < dist[nex]) {
			dist[nex] = d;
			sets.insert({d, nex});
		}

		nex = (now + 1) % K;
		if (d + 1 < dist[nex]) {
			dist[nex] = d + 1;
			sets.insert({d + 1, nex});
		}
	}

	assert(dist[0] < INF);
	cout << dist[0] << "\n";
}

int main() {
	FAST_IO;
	int TC = 1;
	FOR(tc, 1, TC) {
		read();
		solve();
	}
}

Measured memory_bytes: 2944
N,A,B,C,D,E=$<.read.split.map(&:to_i)

a = (N+A-1)/A
b = ((N-[A,B].min*(a-1))+B-1)/B
c = ((N-[A,B,C].min*(a+b-2))+C-1)/C
d = ((N-[A,B,C,D].min*(a+b+c-3))+D-1)/D
e = ((N-[A,B,C,D,E].min*(a+b+c+d-4))+E-1)/E
puts (a+b+c+d+e)
# puts [a,b,c,d,e]

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

#define ll long long int
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define sz(a) int((a).size())
#define mod 1000000007
#define inf LLONG_MAX
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
template <typename T>
inline T gcd(T a, T b) { while (b != 0) swap(b, a %= b); return a; }

template <typename T>
inline void seethis(vector<T>vect)
{
    for(T x:vect)
        cout<<x<<" ";
    cout<<"\n";
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
//LCM
int lcm(int a, int b) {  return a * (b / gcd(a, b)); }

//For sort by second
bool cmp(const pair<int,int> &a)
{ return a.first<a.second; }

//Tree
/* const int MAXN = 1e5 + 5;
vector<ll> adj[MAXN];*/

//ModPower
ll modpower(ll a,ll b,ll c)
{
    ll res=1;
    while(b)
    {
        if(b&1LL)
            res=(res*a)%c;
        a=(a*a)%c;
        b>>=1;
    }
    return res;
}

int main()
{
    FASTIO;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
    ll k;
     cin>>k;

     set<ll>se;

     ll num=7;
     ll i=1;
     while(se.find(num)==se.end())
     {
        if(num%k==0)
        {
            cout<<i<<"\n";
            return 0;
        }

        se.insert(num);
        num=(num*10+7)%k;
        i+=1;

     }

     cout<<"-1\n";

    
    return 0;
}

Measured memory_bytes: 50424