akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;++i)
#define END(x) (*(x.end()-1))

using namespace std;
typedef long long ll;
typedef vector<vector<int>> Graph;

template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a*b/gcd(a,b);
}


template<typename T>
bool same(T x_b,T x_e,T y_b,T y_e){
    for(auto i = x_b, j = y_b; i != x_e && j != y_e;++i,++j){
        if(*i!=*j){
            return false;
        }
    }
    return true;
}

using Graph=vector<vector<int>>;//グラフ型
void dfs(const Graph &G,int v/*根*/,vector<bool> &seen){
    seen[v]=true;  //vを訪問済にする
    for(auto next_v:G[v]){ //訪問済にしたvとつながっている場所を順番に探す
        if(seen[next_v]) continue; //もし探索済みならスルー
        dfs(G,next_v,seen); //再帰的に探索
    }
}
 
void bfs(const Graph &G,queue<int> &que/*発見したが訪問はしていない*/,vector<int> &dist/*開始地点からの距離*/){
    while(!que.empty()){
        int v=que.front();//queのうち先頭のものからスタート
        que.pop();//先頭を削除
 
        for(int nv :G[v]){//vとつながっている点を列挙
            if(dist[nv]!=-1) continue;//発見済(=距離が格納されている)であればスルー
            dist[nv]=dist[v]+1;//vとつながっている点に距離の情報を追加
            que.push(nv);//vとつながっている点を発見済にする
        }
    }
}


int main(void){
    int n,m;
    ll a,ans=0;
    cin>>n>>m;
    rep(i,m){
        cin>>a;
        ans+=a;
    }
    if(ans>n)cout<<-1;
    else cout<<n-ans;
}
/*

*/


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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 2.01e14;
const double eps = 1e-7;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

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

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

void solve() {
    //const i64 mod = 1'000'000'007;

    i64 N;
    cin >> N;
    vector<long double> x(N),y(N);
    vector<char> d(N);
    rep(i,0,N) cin >> x[i] >> y[i] >> d[i];

    auto f=[&](long double t){
        long double xmin=inf64,xmax=-inf64,ymin=inf64,ymax=-inf64;
        rep(i,0,N){
            long double xx=x[i],yy=y[i];
            if(d[i]=='R') xx+=t;
            else if(d[i]=='L') xx-=t;
            else if(d[i]=='U') yy+=t;
            else yy-=t;
            chmin(xmin,xx);
            chmax(xmax,xx);
            chmin(ymin,yy);
            chmax(ymax,yy);
        }
        return (xmax-xmin)*(ymax-ymin);
    };

    long double lb=0,ub=4.1e8;
    rep(i,0,200){
        auto a=(lb+lb+ub)/3;
        auto b=(lb+ub+ub)/3;
        if(f(a)>f(b)){
            lb=a;
        }else{
            ub=b;
        }
    }

    long double ans=f(0);

    i64 t=i64(lb);
    rep(i,-3,4){
        auto s=t+0.5*i;
        if(s<0) continue;
        chmin(ans,f(s));
    }

    cout << ans << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 3456
#include <utility>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <iostream>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;
int main() {
    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    if (k <= a) {
        cout << k;
    }
    else if (k <= a + b) {
        cout << a;
    }
    else {
        cout << a + (-1)*(k - a - b);
    }
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main()
{
  char a;
  cin>>a;
  if(a=='A')
    cout<<'T';
  else
    if(a=='T')
      cout<<'A';
  else
    if(a=='G')
      cout<<'C';
  else
    cout<<'G';
  return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    a, b, c, d = map(int, readline().split())

    if abs(a - c) <= d or abs(a - b) <= d and abs(b - c) <= d:
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9080
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b,k;
	cin>>a>>b;
	if(a%b==0)
	{
		cout<<"-1";
		return 0;
	}
	k=2*a;
	while(k%b==0) k=k+a;
	cout<<k;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		if(a+b+c>=22) System.out.println("bust");
		else System.out.println("win");

	}

}


Measured memory_bytes: 26976
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;
const long long int INF = 99999999999999999;
struct ab {
	long long int a, b;
};

bool cmp(ab x,ab y){
	return x.a < y.a;
}

//union find木(グループわけができる)
int par[220000];
int unifind(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
	}
	return 0;
}
//木の根を求める
int unifind_root(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = unifind_root(par[x]);
	}
}
//同じグループか判定
bool unifind_same(int x, int y) {
	return unifind_root(x) == unifind_root(y);
}
//グループ併合
int unifind_unite(int x, int y) {
	x = unifind_root(x);
	y = unifind_root(y);
	if (x == y) {
		return 0;
	}
	par[x] = y;
}


int main() {
	complex<long double>cmpmp;
	const long long int mod = 1000000007;
	map<long long int, long long int>mp;
	//cout << fixed << setprecision(10);
	string str;
	long long int n, a,x[200005], res = 0, cou = 1, dp[55][55][2505] = {};
	ab task[200005];
	cin >> n>>a;
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	dp[0][0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k <= 2500; k++) {
				dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
				dp[i + 1][j][k] += dp[i][j][k];
			}
		}
	}
	for (int j = 1; j <= n; j++) {
		for (int k = 0; k <= 2500; k++) {
			if (k == j * a) {
				res += dp[n][j][k];
			}
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 60928
#include <bits/stdc++.h>
using namespace std;
int sum[200005];
map<int,int> mp;
int main()
{
    int ans=0;
    string s;
    cin >>s;
    mp[0]=1;
    int len=s.size(),x=0,cnt=1;
    for(int i=len-1;i>=0;i--)
    {
        x=((s[i]-'0')*cnt+x)%2019;
        ans+=mp[x];
        mp[x]++;
        cnt=cnt*10%2019;
    }
    cout <<ans<<endl;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
long long n,a,b,c,d;
int main()
{
	cin>>n>>a>>b>>c>>d;
	for(int i=1;i<=n;i++)
	{
		if(c*(n-i-1)-d*i<=b-a && d*(n-i-1)-c*i>=b-a)
		{
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define INF 1000000000
#define ldb long double
#define pb push_back
#define get(x) x=read()
#define gt(x) scanf("%d",&x)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define gc(a) scanf("%s",a+1)
#define rep(p,n,i) for(RE ll i=p;i<=n;++i)
#define go(x) for(ll i=lin[x],tn=ver[i];i;tn=ver[i=nex[i]])
#define fep(n,p,i) for(RE ll i=n;i>=p;--i)
#define pii pair<ll,ll>
#define mk make_pair
#define RE register
#define P 1000000007
#define mod 1000000007
#define S second 
#define F first
#define gf(x) scanf("%lf",&x)
#define pf(x) ((x)*(x))
#define ull unsigned long long
#define ui unsigned
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline ll read()
{
    register ll x=0,f=1;register char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
    return x*f;
}
const ll MAXN=2010;
ll n,ans;
ll f[MAXN][MAXN];
struct wy{ll x,id;}t[MAXN];
inline ll cmp(wy a,wy b){return a.x>b.x;}
signed main()
{
	//freopen("1.in","r",stdin);
	get(n);
	rep(1,n,i)t[i]=(wy){read(),i};
	sort(t+1,t+1+n,cmp);
	rep(1,n,i)
	{
		rep(0,i,j)
		{
			if(j<=i-1)f[i][j]=max(f[i][j],f[i-1][j]+abs(t[i].id-(n-(i-1-j)))*t[i].x);
			if(j>=1)f[i][j]=max(f[i][j],f[i-1][j-1]+abs(t[i].id-j)*t[i].x);
		}
	}
	rep(0,n,i)ans=max(ans,f[n][i]);
	putl(ans);
	return 0;
}


Measured memory_bytes: 26452
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

int main(){
    int K;cin>>K;
    int num_odd;
    int num_even;
    if(K%2==0){
        num_odd = K/2;
        num_even = K/2;
    }else{
        num_odd = K/2;
        num_even = K-num_odd;
    }
    cout<<num_odd*num_even<<endl;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = Integer.toString(n);
        String []resultArray = str.split("");
        
        int sum = 0;
        
        for (int i=0; i < resultArray.length; i++){
            int num=Integer.parseInt(resultArray[i]);
            sum += num;
        }
        
        if (n % sum == 0){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
        sc.close();
    }
}

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

int main(){
  ll A,B,K;
  cin >> A >> B >> K;
  if((A+B)<K) {A=0;B=0;}
  else if(A<K) {B=B+A-K;A=0;}
  else {A=A-K;}
  cout << A << " " << B << endl;
  
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int n;
	cin >> n;
	vector<pair<int, int> > vec(n);
	for (int i = 0; i < n; i++){
		cin >> vec[i].second >> vec[i].first;
	}
	sort(vec.begin(), vec.end());

	int time = 0;
	for (int i = 0; i < n; i++){
		time += vec[i].second;
		if (time > vec[i].first){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 1792
import java.util.HashSet;
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
 
		int n;
 
		Scanner sc = new Scanner(System.in);
 
		n = sc.nextInt();
 
		HashSet<Integer> hs = new HashSet<Integer>();
 
		boolean flag = false;
		String ans = "";
 
		for (int i = 1; i <= n; i++) {
 
			int tmp = sc.nextInt();
 
			if (hs.contains(tmp)) {
				flag = true;
				break;
			} else {
				hs.add(tmp);
			}
		}
 
		if (flag) {
			ans = "NO";
		} else {
			ans = "YES";
		}
 
		System.out.println(ans);
 
	}
 
}

Measured memory_bytes: 100640
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = int64_t;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }
int main() {
    int n;
    cin >> n;
    using P = array<ll, 3>;
    vector<P> v(n);
    for (int i = 0; i < n; ++i) {
        ll w, s, x;
        cin >> w >> s >> x;
        v[i] = {w, s, x};
    }
    sort(v.begin(), v.end(), [&](P a, P b){ return a[0]+a[1] < b[0]+b[1]; });
    vector<array<ll, 10002>> dp(2);
    fill(dp[0].begin(), dp[0].end(), -INF<ll>);
    dp[0][0] = 0;
    ll UPPER = 10001;
    for (int i = 0; i < n; ++i) {
        int now = i&1, nxt = now^1;
        fill(dp[nxt].begin(), dp[nxt].end(), -INF<ll>);
        for (int j = 0; j <= UPPER; ++j) {
            if(dp[now][j] == -INF<ll>) continue;
            chmax(dp[nxt][j], dp[now][j]);
            if(j <= v[i][1]) chmax(dp[nxt][min(UPPER, j+v[i][0])], dp[now][j]+v[i][2]);
        }
    }
    ll ans = 0;
    for (int i = 0; i <= UPPER; ++i) {
        chmax(ans, dp[n&1][i]);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main() {
	int r, g, d;
	cin >> r >> g >> d;
	if ((g * 10 + d) % 4 == 0) {
		cout << "YES" << endl;
		return 0;
	}
	else {
		cout << "NO" << endl;
		return 0;
	}
	return 0;
}

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

using namespace std;
using ll = long long;

template <typename T> T gcd(T a, T b) {
  if (a < b) return gcd(b, a);
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll A, B;
  cin >> A >> B;
  ll gcdn = gcd(A, B);
  ll gcdcopy = gcdn;
  int res = 1;
  for (ll i = 2; i * i <= gcdn; i++) {
    if (gcdcopy % i != 0) continue;
    res++;
    while (gcdcopy % i == 0) {
      gcdcopy /= i;
    }
  }
  if (gcdcopy > 1) {
    res++;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rept(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n,int m) {
	int digits = 0;
	while (n != 0) {
		n /= m;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}

//入力された文字列が回文か判断してboolを返す
bool is_kaibun(string s) {
	string s_r(s.rbegin(), s.rend());
	return (s == s_r);
}

void yes() {
	cout << "Yes" << endl;
}

void no() {
	cout << "No" << endl;
}

int main() {
	string s;
	cin >> s;
	int n = s.size();
	string front = s.substr(0, (n-1)/2), back = s.substr((n+1)/2);
	if (is_kaibun(s) &&is_kaibun(front) && is_kaibun(back))cout << "Yes" << endl;
	else cout << "No" << endl;

	system("pause");
	return 0;
}

Measured memory_bytes: 504
S = input()
ans = []
if len(S) % 2 == 0:
    k = 0
    for i in range(len(S)//2):
        if S[2*i] != '0':
            k += 1
        if S[2*i + 1] != '1':
            k += 1
    ans.append(k)
    l = 0
    for i in range(len(S)//2):
        if S[2*i] != '1':
            l += 1
        if S[2*i + 1] != '0':
            l += 1
    ans.append(l)
    print(min(ans))
elif len(S) > 1 and len(S) % 2 != 0:
    k = 0
    for i in range(len(S)//2):
        if S[2*i] != '0':
            k += 1
        if S[2*i + 1] != '1':
            k += 1
    if S[-1] != '0':
        k += 1
    ans.append(k)
    l = 0
    for i in range(len(S)//2):
        if S[2*i] != '1':
            l += 1
        if S[2*i + 1] != '0':
            l += 1
    if S[-1] != '1':
        l += 1
    ans.append(l)
    print(min(ans))
else:
    print(0)

Measured memory_bytes: 3316
#pragma optimize("O3")
#pragma GCC target ("sse4")

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

typedef long long int ll;
typedef pair<ll, ll> pii;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fo(i,a,b) for(ll i = a; i<=b;i+=1)
#define rf(i,a,b)  for(ll i=a;i>=b;i--)
#define vll vector<ll>
#define sz(a) ll(a.size())
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front 
#define MAXN 100010
#define N 100010
#define MOD 1000000007
#define mod 998244353
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define nl '\n'
#define MS(x,y) fill_n(*x, sizeof x / sizeof **x, y);
#define mem(x,y) memset(x,y,sizeof(x));
#define INF 1000000000000000000
#define IO                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);

template<int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
static_assert(D >= 1, "Vector dimension must be greater than zero!");
template<typename... Args>
	Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
	}
};
template<typename T>
struct Vec<1, T> : public vector<T> {
	Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {
	}
};

ll modpower(ll x, ll y,ll p)
{
    ll res = 1;     // Initialize result
    x = x % p;
    if (y==0)return 1;
    if(x==0)return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;  // Change x to x^2
    }
    return res;
}
ll power(ll x, ll y)
{
    ll res = 1;     // Initialize result
    x = x ;
    if (y==0)return 1;
    if(x==0)return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x);
        y = y>>1; // y = y/2
        x = (x*x);  // Change x to x^2
    }
    return res;
}
// int gcd(int a, int b) { if (a == 0)return b;return gcd(b % a, a);}

ll modinv(ll a,ll p){return modpower(a,p-2,p);}

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

long long safe_sqrt(long long n) {
    long long res = sqrt((long double) n);
    if (res*res == n) return res;
    const long double eps = 1e-8;
    if ((long double)(res+1)*(res+1) < n + eps) return res+1;
    if ((long double)res*res + eps > n) return res-1;
    return res;
}   
// (a+b-1)/b for ceil
void solve(){
    ll n;
    cin>>n;
    vll dp(n+1,0);
    fo(x,1,100){
        fo(y,1,100){
            fo(z,1,100){
                ll exx = x*x+y*y+z*z+x*y+y*z+x*z;
                if (exx<=n)
                {
                    dp[exx]++;
                }
            }
        }
    }
    fo(i,1,n){
        cout<<dp[i]<<nl;
    }
    return ;
}
int main()
{
    IO;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // #endif
    int T = 1;
    // cin >> T;
    f(c, 0, T){
        solve();
    }
    return 0;
}//multiset m make_pair make_tuple  tuple<int,int,int> continue resize insert count size else true isValid second first false erase double priority_queue 
//cout<<setprecision(12); push_back pop_back pop_front push_front  lower_bound upper_bound  reverse

Measured memory_bytes: 3668
N,K,Q = map(int,input().split())

d = {}
for i in range(N):
    d[i+1] = 0

for i in range(Q):
    a = int(input())
    d[a] += 1

for i in range(N):
    if K-(Q-d[i+1]) > 0:
        print('Yes')
    else:
        print('No')


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int V; // ????????° TODO:initialize
const int MAX_V = 100000; // ?????§???????????° TODO:initialize

vector<int> G[MAX_V]; // ??£??\???????????¨???
bool vis[MAX_V];
int timer, root;
int prenum[MAX_V]; // DFS????¨???????
int parent[MAX_V]; // DFS????????£????????\?????¨??????
int lowest[MAX_V]; // DFS??¨??????????????????i??\????????????min(prenum)

bool ap[MAX_V]; // ??¢??????????????????

void dfs(int u, int prev)
{
    prenum[u] = timer;
    lowest[u] = timer;
    ++timer;

    vis[u] = true;
    int child = 0;

    rep(i,G[u].size())
    {
        int v = G[u][i];
        if(!vis[v])
        {
            parent[v] = u;
            ++child;
            dfs(v,u);
            lowest[u] = min(lowest[u],lowest[v]);
        }
        else if(u!=prev)
        {
            lowest[u] = min(lowest[u], prenum[v]);
        }
    }

    if(u==root)
    {
        if(child>=2) ap[u]=true;
    }
    else
    {
        if(prev!=root && prenum[prev]<=lowest[u]) ap[prev]=true;
    }
}

void detect_ap(int _root)
{
    memset(vis,0,sizeof(vis));
    memset(ap,0,sizeof(ap));

    root = _root;
    timer = 1;
    dfs(root,-1);
}

int main()
{
    int v,e;
    scanf(" %d %d", &v ,&e);
    while(e--)
    {
        int s,t;
        scanf(" %d %d", &s, &t);
        G[s].pb(t);
        G[t].pb(s);
    }

    V=v;
    detect_ap(0);

    rep(i,v)if(ap[i]) printf("%d\n", i);
    return 0;
}

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

#define rep(i, a) for (int i = 0; i < (a); i++ )

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

ll ans = 0;

void dfs(vector<ll> &L, vector<ll> &A, int i) {
    if (A.size()==3) {
        //cout << A[0] << " " << A[1] << " " << A[2] << endl;
        ll a,b,c;
        a = L[A[0]];
        b = L[A[1]];
        c = L[A[2]];
        //cout << a << " " << b << " " << c << endl;
        if (a==b || b==c || c==a) return;
        ll sum = a+b+c;
        ll ma = max(a,max(b,c));
        sum -= ma;
        //cout << sum << " " << ma << endl;
        if (sum>ma) ans++;
    }
    else {
        for (int j=i; j<L.size(); j++) {
            A.push_back(j);
            dfs(L,A,j+1);
            A.pop_back();
        }
    }
}

int main(){
    int N;
    cin >> N;
    vector<ll> L(N);
    rep(i,N) {
        ll l;
        cin >> l;
        L[i] = l;
    }

    vector<ll> A;
    dfs(L,A,0);

    cout << ans << endl;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN 100
int n, ans;
int a[MAXN+5];
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) {
		if(a[i]==a[i+1]) {
			ans++;
			i++;
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 888
k, a, b = map(int, input().split())
if a >= b - 1 or 1 + k <= a:
    print(1 + k)
else:
    now = a
    k -= a - 1
    if k % 2 == 1:
        now += 1
        k -= 1
    now += (k // 2) * (b - a)
    print(now)
#copy code

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = 1e9;
const LL LLINF = 1e18;
#define TENS(n) int(1e##n + n)

// dp[i][k] : 手番が i =(0/1:先手/後手)で石が残り k 個のとき先手が勝つかどうか
bool dp[2][TENS(5)];
bool flag[TENS(5)];
int a[101];
int N;
int min_a = INTINF;

bool dfs(int turn, int k)
{
    if (flag[k])
        return dp[turn][k];

    flag[k] = true;

    if (k < min_a)
    { // kが減らせなくなったとき, turn が 1=後手 であれば先手の勝ち
        dp[turn][k] = (turn == 1);
        dp[1 - turn][k] = !dp[turn][k];
        return dp[turn][k];
    }

    if (turn == 0)
    { // 残り k の先手番において、先手が勝利するような a[i] の選び方がひとつでもあれば、先手は勝てる
        bool win = false;
        REP0(i, N)
        {
            if (0 <= k - a[i])
                win = win or dfs(1 - turn, k - a[i]);
        }
        dp[turn][k] = win;
        dp[1 - turn][k] = !dp[turn][k];
        return dp[turn][k];
    }
    else
    { // 残り k の後手番において、先手が負けるようなa[i]の選び方がひとつでもあれば、先手は負ける
        bool win = true;
        REP0(i, N)
        {
            if (0 <= k - a[i])
                win = win and dfs(1 - turn, k - a[i]);
        }
        dp[turn][k] = win;
        dp[1 - turn][k] = !dp[turn][k];
        return dp[turn][k];
    }
}

void solve()
{
    cin >> N;
    int K;
    cin >> K;

    REP0(i, N)
    {
        cin >> a[i];
        min_a = min(a[i], min_a);
    }

    cout << (dfs(0, K) ? "First" : "Second") << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}

Measured memory_bytes: 6784
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>

using namespace std;
int main()
{
	long double x,a=1,b=0;
	cin >> x;
	while(pow(a,5)+pow(a-1,5)<x){
		a++;
		if (pow(a,5)==x) {
			cout << a << " " << b << endl;
			return 0;
		}
	}
	a--;
	while(pow(a,5)-pow(b,5)!=x){
		a++;
		b=a-1;
		while (pow(a,5)-pow(b,5)<x) {
			b--;
		}
	}

	cout << a << " " << b << endl;
	return 0;
}


Measured memory_bytes: 3248
n = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

ans = 0
prev = -1
for i in range(n):
  if a_list[i] == prev + 1:
    ans += b_list[a_list[i] - 1] + c_list[prev - 1]
  else:
    ans += b_list[a_list[i] - 1]
  prev = a_list[i]
print(ans)

Measured memory_bytes: 38384
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();
        String[] s = new String[N];
        for(int i=0;i<N;i++) s[i]=sc.next();
        Arrays.sort(s);
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<N;i++){
            sb.append(s[i]);
        }
        System.out.println(sb.toString());
    }
}


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

int main(){
  int n, m, sum = 0;
  cin >> n >> m;
  vector<int> a(m);
  for (int i=0 ; i<m ; i++){
    cin >> a.at(i);
    sum += a.at(i);
  }
  
  if (sum <= n)
    cout << n - sum << endl;
  else
    cout << -1 << endl;
}

Measured memory_bytes: 3628
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict
INF = float("inf")

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, x = getlist()
	a = getlist()
	B = [[INF] * N for i in range(N)]
	for i in range(N):
		B[0][i] = a[i]
	for i in range(1, N):
		for j in range(N):
			B[i][j] = min(B[i - 1][j], a[(j - i) % N])
	ans = INF
	for i in range(N):
		v = sum(B[i]) + i * x
		ans = min(ans , v)
	print(ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 149596
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long int lli;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<pll> vop;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define REP(i,a,b) for( long long i=a;i<b;i++)
#define REPR(i,a,b) for(int i=a;i>=b;i--)
#define adb(a) for(auto ii:a) cout << ii << " "; cout << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define endl "\n"
#define mem(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define PI 3.14159265358979323846
const ll MAXN = 10000001;
const ll p = 1000000007;

struct LessSecond
{
    template<typename T, typename U>
    bool operator()(const std::pair<T, U> &x, const std::pair<T, U> &y) const
    {
        return x.second < y.second;
    }
};

ll power(ll a, ll b, ll m) { ll ans = 1; a = a % m; while (b) { if (b & 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans; }

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

ll modInverse(ll a, ll m) { ll g = __gcd(a, m); return power(a, m - 2, m); }


int main()
{

    fastIO;
    int test = 1;
    //cin >> test;
    while (test--)
    {
        ll n;
        cin >> n;
        ll a[n];
        REP(i, 0, n) cin >> a[i];
        sort(a, a + n, greater<ll>());
        int j = 1;
        ll ans = a[0];
        for (int i = 3; i <= n; i++)
        {
            ans += a[j];
            if (i % 2 == 0) j++;
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 5184
#include <bits/stdc++.h>
#define int long long
using namespace std;

int min(vector<int> v) {
	if(v.size() == 0) return 0;
	int dr = v[0];
	for(int i = 1; i < v.size(); ++i)
		dr = (dr > v[i] ? v[i] : dr);
	return dr;
}

int n, a, b, fp;

int pr(int a, int b) {
	if((b - a) % 2 == 0)
		return (b - a) / 2;
	return 1e18;
}

int mc(int a, int b) {
	if((b - a) % 2)
		return a + (b - a - 1) / 2;
	return 1e18;
}

int mj(int a, int b) {
	if((b - a) % 2)
		return n - b + 1 + (b - a - 1) / 2;
	return 1e18;
}

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> a >> b;
	fp = min({pr(a, b), mc(a, b), mj(a, b)});
	cout << fp << endl;
	return 0;
}


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

int main() {
  int a[33] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}, k;
  scanf("%d", &k);
  printf("%d", a[k-1]);
  return 0;
}

Measured memory_bytes: 128
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
pub fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        x.abs()
    } else {
        gcd(y, x % y)
    }
}

fn solve() {
    input! {
        n: usize,
        q: usize,
        s: chars,
        query: [(usize, usize); q],
    }
    let mut cum = vec![0; n+1];
    for i in 1..n {
        if s[i-1]=='A' && s[i]=='C' {
            cum[i+1] = cum[i] + 1;
        } else{
            cum[i+1] = cum[i];
        }
    }
    for i in 0..q {
        let l : usize = query[i].0 - 1;
        let r : usize = query[i].1 - 1;
        let mut ans = cum[r+1] - cum[l];
        if l!=0 && (s[l-1]=='A' && s[l]=='C') {
            ans -= 1;
        }
        println!("{}", ans);
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 11132
S = input()

import sys


for op1 in ["+","-"]:
    for op2 in ["+","-"]:
        for op3 in ["+","-"]:

            sm=int(S[0])

            if op1=="+":
                sm+=int(S[1])
            else:
                sm-=int(S[1])

            if op2=="+":
                sm+=int(S[2])
            else:
                sm-=int(S[2])

            if op3=="+":
                sm+=int(S[3])
            else:
                sm-=int(S[3])

            if sm == 7:
                result=S[0]+op1+S[1]+op2+S[2]+op3+S[3]+"=7"
                print(result)
                sys.exit()

Measured memory_bytes: 3188
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int,int>> a(n);
    rep(i,n){
        int m;
        cin >> m;
        a[i] = make_pair(m,i+1);
    }
    sort(a.begin(),a.end());
    rep(i,n){
        cout << a[i].second << " ";
    }

    return 0;
}

Measured memory_bytes: 3980
def solve(string):
    n, k, *a = map(int, string.split())
    if k == 0:
        x = 0
    else:
        l = len("{:b}".format(k))
        base = [2**(l - i - 1) for i in range(l)]
        count = [0] * l
        for _a in a:
            tmp = "{:b}".format(_a)
            for i, _f in enumerate(tmp[::-1]):
                if i >= l:
                    break
                if _f == "1":
                    count[l - i - 1] += 1
        x = 0
        for _c, _b in zip(count, base):
            if _c < n / 2 and x + _b <= k:
                x += _b
    return str(sum([x ^ _a for _a in a]))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};



#define pb push_back
#define F first
#define S second
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define gap ' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///

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


 return 0;


}


///Thanking you by Roxy






Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007  //998244353
#include<string.h>
#define inf 1000000000000000000
#define maxn 200006
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
#define endl '\n'
#define mapint_iterator map<int,int> :: iterator
#define mapll_iterator map<ll,ll> :: iterator
#define setint_iterator set<int> :: iterator
#define setll_iterator set<ll> :: iterator
#define setpint_iterator set<pint> :: iterator
#define setpll_iterator set<pll> :: iterator
#define trace(x) cout<<#x<<": "<<x<<" "<<endl
#define trace2(x,y) cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x,y,z) cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a,b,c,d) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define cout1(a) cout<<a<<endl
#define cout2(a,b) cout<<a<<' '<<b<<endl
#define cout3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define cout4(a,b,c,d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl
#define vcout(v,i) cout<<v[i].fi<<" "<<v[i].se<<endl
typedef priority_queue<ll,vector<ll>,greater<ll> > pqset;
typedef priority_queue<pint,vector<pint>,greater<pint> > pqset_ll;
#define pb push_back
#define fi first
#define se second
#include<ext/pb_ds/assoc_container.hpp>
ll dxk[]={0,0,1,-1,1,1,-1,-1};
ll dyk[]={1,-1,0,0,1,-1,1,-1};
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update> os_pair;
#define acc (ios::sync_with_stdio(false),cin.tie(0))
#define rep(i,n) for(ll i=0;i<n;i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define per1(i,n) for(ll i=n;i>0;i--)
#define repeat(i,start,n) for(ll i=start;i<n;i++)
#define print(a,n) for(ll i=0;i<n;i++){ cout<<a[i]<<" ";}
ll ll_max(ll a,ll b,ll c){return max(a,max(b,c));}
int int_max(int a,int b,int c){return max(a,max(b,c));}
ll ll_min(ll a,ll b,ll c){return min(a,min(b,c));}
int int_min(int a,int b,int c){return min(a,min(b,c));}
ll max(int a,ll b){ return max((ll)a,b);}
ll min(int a,ll b){ return min((ll)a,b);} 
ll min(ll a,int b){ return min(a,(ll)b);}
ll max(ll a,int b){ return max(a,(ll)b);}
ll dx[]={0,0,1,-1};
ll dy[]={1,-1,0,0};
//ifstream cin("b_read_on.txt"); ofstream cout("output3.txt");
//Chronology: Binary Search,Greedy,dp,dfs and similar
//Use (<<) for multiplication
//Use (>>) for division
// In dp, first try top-down,then bottom-up
//ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout<<fixed;cerr.tie(NULL);cout.precision(10);
// find_by_order -> value at index
// order_of_key -> index of value
void solve(int countu){
	int t;
	cin>>t;
	while(t>0){
		if(t%10==7){
			cout<<"Yes"<<endl;
			return;
		}
		t/=10;
	}
	cout<<"No"<<endl;
}
int main(){
    int t=1;
	//cin>>t;
	int countu=1;
    while(t--){
    	solve(countu);
    	countu++;
    }
    
}

Measured memory_bytes: 3592
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
	ll n, m, ans = 0;
	cin >> n >> m;

	if (n >= 2 && m >= 2) {
		ans = (n - 2)*(m - 2);
	}
	else if (n == 1 && m == 1) {
		ans = 1;
	}
	else {
		if (n == 1) {
			ans = m - 2;
		}
		else {
			ans = n - 2;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds; 
using namespace std;
#define int long long
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define mii map<int,int>
#define mp make_pair
#define pb push_back
#define rep(i,b) for(ll (i)=0;i<(b);i++)
#define all(c) (c).begin(), (c).end()
#define F first
#define S second
#define CLR(p) memset(p, 0, sizeof(p))
#define SET(p) memset(p, -1, sizeof(p))
#define DEBUG true
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
//typedef long long int ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, 
tree_order_statistics_node_update> new_data_set; 
const int MAX=1e6+5;
#define MOD 1000000007
/*std::cout << std::fixed;
std::cout << std::setprecision(6);*/
//(a%mod-b%mod+mod)%mod



/************************************


 
*************************************/

vector<vector<ll>>v;
ll T=0;
ll cnt1=0,cnt0=0;
vector<ll>dep;
bool visited[MAX];
vector<ll>par;
vector<ll>tin,tout;
vector<ll>col;

int countDivisibles(int A, int B, int M) 
{ 
    
    if (A % M == 0) 
        return (B / M) - (A / M) + 1; 
  
    // A is not divisible by M 
    return (B / M) - (A / M); 
} 







signed main(){
    int t=1;
    // cin>>t;
    while(t--){
        int a,b,n;
        cin>>a>>b>>n;
        if(n<b){
            int ans = (a*n)/b;
            cout<<ans<<endl;
        }
        else{
            int a1 = n/b;
            int a2 = n%b;
            int n1 = n-a2-1;
            int s1 = (a*n)/b;
            s1-=(a*a1);
            int s2 = (a*n1)/b;
            s2-=(a*(a1-1));
            cout<<max(s1,s2)<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long
#define N (1<<17)

using namespace std;

int n, w, h[2][N], s;
ll d[N], ans;

int main(){

	cin >> n >> w;

	for(int i=0; i<n; i++){
		cin >> h[0][i] >> h[1][i];
		s += h[1][i];
	}

	for(int i=1; i<=s; i++) d[i] = w+1;

	for(int i=0; i<n; i++){
		for(int j=s; j>=h[1][i]; j--){
			d[j] = min(d[j], d[j-h[1][i]]+h[0][i]);
		}
	}

	for(int i=0; i<=s; i++) if(d[i]<=w) ans = i;

	cout << ans << endl;

}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }

char S[1000];

bool kai(int s, int d)
{
	int len = (d - s) + 1;
	for (int i = 0; i < len / 2; i++)
	{
		if (S[s + i] != S[s + len - 1 - i])
		{
			return false;
		}
	}
	return true;
}

signed main()
{
	cin >> S;
	int len = strlen(S);
	YesNo(kai(0, len - 1) && kai(0, ((len - 1) / 2) - 1) && kai((len + 3) / 2 - 1, len - 1));
}




Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read


def main():
    N, M, Q, *LRPQ = map(int, read().split())
    LR = LRPQ[: 2 * M]
    PQ = LRPQ[2 * M :]
    
    A = [[0] * (N + 1) for _ in range(N + 1)]
    for l, r in zip(LR[::2], LR[1::2]):
        A[l][r] += 1

    for i in range(N):
        for j in range(N):
            A[i + 1][j + 1] += A[i][j + 1] + A[i + 1][j] - A[i][j]

    ans = [0] * Q
    for i, (p, q) in enumerate(zip(PQ[::2], PQ[1::2])):
        ans[i] = A[q][q] - A[q][p - 1] - A[p - 1][q] + A[p - 1][p - 1]

    print('\n'.join(map(str, ans)))
    return


if __name__ == '__main__':
    main()


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

using namespace std;

main() {
#ifdef HOME
    //freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, x;
    cin >> n;
    vector < int > a;
    for (int i = 1; i <= 2 * n; ++i) {
        cin >> x;
        a.push_back(x);
    }
    sort(a.begin(), a.end());
    int ans = 0;
    for (int i = 0; i < (int)a.size(); i += 2) ans += a[i];
    cout << ans << '\n';
    return 0;
}


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

int main(void){
    int W,H,N;
    cin >> W >> H >> N;
    int ax=0; int ay=0; int bx=W; int by=H;
    for(int i=0; i<N; i++){
        int x,y,a;
        cin >> x >> y >> a;
        switch(a){
            case 1:
                ax=max(ax,x);
                break;
            case 2:
                bx=min(bx,x);
                break;
            case 3:
                ay=max(ay,y);
                break;
            case 4:
                by=min(by,y);
                break;
            defalut: // Not reached
                break;
        }

    }
    cout << max(0, bx-ax) * max(0, by-ay) << endl;
    return 0;
} 

Measured memory_bytes: 384
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    cout<<(in()+1)/2<<endl;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int32 N, M, K;
vector<int64> A, B;
string s;

int main(void){
	cin >> N >> M;
	cout << N+(M/2) << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <string.h>
#include <stdio.h>
using namespace std;
using std::cout;
#include <algorithm>
#include <map>
int main(){
long long n,m=0;
cin>>n;
map<string,int>freq;
string x[n];
for(int i=0;i<n;i++)
                    {
cin>>x[i];
sort(x[i].begin(),x[i].end());
                    }
                   for(int i=0;i<n;i++)
                    {
freq[x[i]]++;
m+=(freq[x[i]]-1);

                    }

                     cout<<m<<endl;
return 0;
            }

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    int ans = 1e9;
    sort(all(h));
    for(int i = 0; (i+k-1)<n; ++i) {
        int temp = abs(h[i+k-1] - h[i]);
        ans = min(ans, temp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3784