akhauriyash/Code-Regression huggingface dataset:
#include <set>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 200005
#define M 800005
#define inf 0x3f3f3f3f
int tar[M], nex[M], cap[M], fir[N], cnt = 1;
int n, m, dis[N], now[N], use[N][2];
vector<int>A[N];
set<int>S[N];
queue<int>Q;
void add(int a, int b, int c)
{
	++cnt;
	tar[cnt] = b;
	cap[cnt] = c;
	nex[cnt] = fir[a];
	fir[a] = cnt;
}
void Add(int a, int b)
{
	add(a, b, 1);
	add(b, a, 0);
}
int aug(int s, int b, int e, int g, int augco)
{
	if (s == e)
		return augco;
	int augc = augco;
	for (int &i = now[s]; i; i = nex[i])
	{
		int v = tar[i];
		if (cap[i])
		{
			if (dis[v] == dis[s] + 1)
			{
				int delta = aug(v, b, e, g, min(augc, cap[i]));
				cap[i] -= delta;
				cap[i ^ 1] += delta;
				augc -= delta;
				if (!augc)
					return augco;
			}
		}
	}
	return augco - augc;
}
bool Bfs(int s, int t)
{
	memset(dis, 0x3f, sizeof(dis));
	dis[s] = 0;
	queue<int>que;
	que.push(s);
	while (!que.empty())
	{
		int x = que.front();
		now[x] = fir[x];
		que.pop();
		for (int i = fir[x]; i; i = nex[i])
		{
			int v = tar[i];
			if (!cap[i])
				continue;
			if (dis[x] + 1 < dis[v])
			{
				dis[v] = dis[x] + 1;
				que.push(v);
			}
		}
	}
	return dis[t] != inf;
}
int sap(int b, int e, int g)
{
	int flow = 0;
	while (Bfs(b, e))
		flow += aug(b, b, e, g, inf);
	return flow;
}
int main()
{
	scanf("%d", &n);
	for (int i = 1; i < n; i++)
	{
		int t;
		scanf("%d", &t);
		for (int j = 1; j <= t; j++)
		{
			int x;
			scanf("%d", &x);
			S[x].insert(i);
			A[i].push_back(x);
			if (x != 1)
				Add(i, n + x);
		}
	}
	for (int i = 1; i <= n; i++)
	{
		Add(2 * n + 1, i);
		Add(n + i, 2 * n + 2);
	}
	int ans = sap(2 * n + 1, 2 * n + 2, 2 * n + 2);
	if (ans < n - 1)
	{
		puts("-1");
		return 0;
	}
	for (int i = 1; i < n; i++)
	{
		for (int j = fir[i]; j; j = nex[j])
		{
			int v = tar[j];
			if (v > n && !cap[j])
				use[i][0] = v - n;
		}
	}
	Q.push(1);
	while (!Q.empty())
	{
		int x = Q.front();
		m++;
		Q.pop();
		set<int>::iterator it = S[x].begin();
		for (; it != S[x].end(); it++)
		{
			if (!use[*it][1])
			{
				use[*it][1] = x;
				Q.push(use[*it][0]);
			}
		}
	}
	if (m < n)
	{
		puts("1");
		return 0;
	}
	for (int i = 1; i < n; i++)
		printf("%d %d\n", use[i][0], use[i][1]);
}
//

Measured memory_bytes: 42380
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> h(n);
    for(int i=0; i<n; i++){
        cin >> h[i];
    }
    vector<bool> good(n,true);
    for(int i=0; i<m; i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        // a is not larger case
        if(h[a] <= h[b]) good[a] = false;
        // b is not larger case
        if(h[b] <= h[a]) good[b] = false;
    }
    int ans=0;
    for(int i=0; i<n; i++){
        if(good[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3708
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>

using namespace std;

#define INF 1000000007
#define LINF 1000000000000000007

typedef long long i64;
typedef pair<i64,i64> P;


int n, a[202020];

int main(){
	cin >> n;
	i64 ans = 0, ans2 = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(ans < a[i]){
			ans2 = ans;
			ans = a[i];
		}
		else if(ans2 < a[i]){
			ans2 = a[i];
		}
	}
	
	for(int i = 0; i < n; i++){
		if(a[i] == ans){
			cout << ans2 << endl;
		}
		else cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 2432
let scan_words ()  = Scanf.scanf "%d %d\n" (fun x y -> x, y)

let () = 
  let n, m = scan_words () in
  let ar = Array.make n 0 in
  let rec f i =
    if i = m then () 
    else
      (let a, b = scan_words () in 
       ar.(a-1) <- ar.(a-1) + 1; ar.(b-1) <- ar.(b-1) + 1; f (i + 1))
  in 
  f 0; Array.iter (Printf.printf "%d\n") ar

Measured memory_bytes: 384
#include<cstdio>
using namespace std;
int main(){
    int n,h[20],cnt=0,f;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    cnt=1;
    for(int i=1;i<n;i++){
        f=1;
        for(int j=0;j<i;j++){
            if(h[j]>h[i]){
                f=0;
            }
        }
        if(f){
            cnt++;
        }
    }
    printf("%d\n",cnt);
}

Measured memory_bytes: 128
#include <iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {
	string S;
	cin >> S;
	string kekka="Good";
	rep(i, 3) {
		if (S.at(i) == S.at(i + 1)) {
			kekka="Bad";
		}
	}
	cout << kekka << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MAXN = 55;
const int MAXM = 5e5 + 5;
const int MOD = 998244353;
const int INF = 0x3f3f3f3f;


int main(){
    int n;
    scanf("%d", &n);
    if(n <= 99){
        printf("%d\n", min(9,n));
    }else if(n <= 10000){
        printf("%d\n", 9 + min(999, n) - 100 + 1 + (n==10000));
    }else if(n <= 100000){
        printf("%d\n", 9 + 999 - 100 + 1 + min(99999, n) - 10000 + 1);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define gt(n) scanf("%d", &n)
#define gtll(n) scanf("%ld", &n)
#define out(n) printf("%d", n)
#define outll(n) printf("%ld", n)
#define loop(n) for(int i=0; i<n; i++)
#define MAXX 1001
#define mem(x, y) memset(x, y, sizeof(x))
#define loop1(n) for(int i=1; i<=n; i++)
#define ll long long
#define pb push_back
#define pi acos(-1)
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
//(only in c)char[33];itoa(n,buffer,base);printf("%s",buffer);
#define dec_to_bin(n) std::string binary = std::bitset<64>(n).to_string();
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int main()
{
fast;
double n,m;
cin>>n>>m;
//int p=ceil(log(m));
double sum=0.00;

for(int i=1;i<=(min(m,n));i++){
        double tmp=m/(double(i));
        //cout<<tmp<<endl;
       int p;
       p=ceil(log2(tmp));
      // cout<<log2(tmp)<<endl;
//cout<<p<<endl;
sum+=(1.0/n)*pow(.5,p);
}
//sum*=(1.0/n);
double r=(n-m);
if(r<=0)r=0;
sum+=(1.0/n)*r;
//cout<<sum<<setprecision(7)<<endl;
printf("%.12f\n",sum);

return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {
    long[][] c = new long[51][51];

    void solve(Scanner sc, PrintWriter pw) {
        int N = sc.nextInt();
        int K = sc.nextInt();
        long S = sc.nextLong();
        long T = sc.nextLong();
        if ((S & T) != S) {
          pw.println("0");
          return;
        }
        long[] data = new long[N];
        for (int i = 0; i < N; i++) {
            data[i] = sc.nextLong();
        }
        for (int i = 0; i <= N; i++) {
            c[i][0] = 1;
            for (int j = 1; j <= i; j++) {
                c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
            }
        }
        long[] sum = new long[(N + 1)];
        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= Math.min(i, K); j++) {
                sum[i] += c[i][j];
            }
        }
        long result = 0;
        List<Long> nums = new ArrayList<>();
        for (long mask = 0; mask < (1L << 18); mask++) {
            if (((T ^ S) & mask) != mask) {
                continue;
            }
            boolean isAdd = (Long.bitCount(mask) % 2) == 0;
            nums.clear();
            for (int i = 0; i < N; i++) {
                if ((data[i] & S) != S) {
                    continue;
                }
                if ((data[i] | T) != T) {
                    continue;
                }
                nums.add(data[i] & mask);
            }
            Collections.sort(nums);
            int begin = 0;
            int nextBegin;
            while (begin < nums.size()) {
                nextBegin = begin + 1;
                while (nextBegin< nums.size() && nums.get(nextBegin).equals(nums.get(nextBegin - 1))) {
                    nextBegin++;
                }
                result += (isAdd ? 1L : -1L) * (sum[nextBegin - begin]);
                begin = nextBegin;
            }
        }
        pw.println(String.format("%d", result));
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        new Main().solve(sc, pw);
        pw.flush();
        pw.close();
        sc.close();
    }
}


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

int main(){
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++) cin>>h[i];
    int ans=0,cnt=0;
    for(int i=0;i<n;i++){
        if(cnt<h[i]) ans+=h[i]-cnt;
        cnt=h[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3604
n=int(input())
s=input()
t=0
for i in range(10):
  for a in range(n):
    if s[a]==str(i):
      for j in range(10):
        for b in range(a+1,n)[::-1]:
          if s[b]==str(j):
            t+=len(set(list(s[a+1:b])))
            break
      break
print(t)

Measured memory_bytes: 70260
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <unordered_map>

#define rep(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef unordered_map<string, ll> u_map;

// input
void input() {}
template <class Head, class... Tail>
void input(Head &&a, Tail &&... b)
{
    cin >> a;
    input(forward<Tail>(b)...);
}

template <class V>
void input(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &i) { input(i); });
}

// output
template <class V>
void output(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &x) { cout << x << " "; });
    cout << endl;
}

// math functions
ll mpow(ll a, ll n, ll p)
{
    ll x = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            x = a * x % p;
        }
        a = a * a % p;
        n >>= 1;
    }

    return x;
}

ll mfact(ll n, ll p)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
    {
        res = res * i % p;
    }
    return res;
}

ll mcomb(ll n, ll r, ll p)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0 || r < 0)
    {
        return 0;
    }

    ll a = mfact(n, p);
    ll b = mfact(n - r, p);
    ll c = mfact(r, p);
    return (((a * mpow(b, p - 2, p)) % p) * mpow(c, p - 2, p)) % p;
}

ll gcd(ll a, ll b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b, a % b) : a;
}

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

int main()
{
    char a;
    input(a);

    cout << (char)(a + 1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

class UnionFind
{
public:
    vector<int> par;
    vector<int> sz;

    UnionFind(int N){
        par = vector<int>(N);
        REP(i, N) par[i] = i;
        sz = vector<int>(N, 1);
    }

    int find(int x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;

        if(sz[x] < sz[y]) swap(x, y);

        par[y] = x;
        sz[x] += sz[y];
    }

    bool is_union(int x, int y){
        x = find(x);
        y = find(y);
        return x == y;
    }

    int union_size(int x){
        return sz[find(x)];
    }

};


signed main(){

    int N, M; cin >> N >> M;
    vec K(N);
    mat L(N);

    mat ls(M);

    REP(i, N){
        cin >> K[i];
        L[i] = vec(K[i]);
        cin >> L[i];
        REP(j, K[i]) ls[L[i][j] - 1].pb(i);
    }

    UnionFind UF(N);
    REP(i, M){
        if(SZ(ls[i])){
            for(int p: ls[i]) UF.unite(p, ls[i][0]);
        }
    }
    Ans(UF.union_size(0) == N, "YES", "NO");

    return 0;
}


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

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int k = std.nextInt();
        int q = std.nextInt();
        int[] as = new int[q];
        for (int i = 0; i < q; i++) {
            as[i] = std.nextInt() - 1;
        }

        int[] cp = new int[n];
        for (int i = 0; i < q; i++) {
            int c = as[i];
            cp[c]++;
        }

        int[] dp = new int[n];
        Arrays.fill(dp, k);

        long[] sum = new long[n];
        long all = Arrays.stream(cp).sum();
        for (int i = 0; i < n; i++) {
            sum[i] = all - cp[i];
        }

        for (int i = 0; i < n; i++) {
            if (k > sum[i]) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
}


Measured memory_bytes: 68544
import numpy as np
N,B,C = map(int,input().split())
B = np.array(list(map(int,input().split())))
A = [np.array(list(map(int,input().split()))) for _ in range(N)]
ans = 0
for i in range(N):
    tmp = sum(A[i]*B)+C
    if tmp>0:
        ans += 1
print(ans)

Measured memory_bytes: 12496
N, X = map(int, input().split())
lenburger = [1]
lenputty = [1]
for i in range(N):
    lenburger.append(lenburger[i]*2+3)
    lenputty.append(lenputty[i]*2+1)
def burger(level, X):
    if level == 0:
        return 1
    elif X == 1:
        return 0
    elif X <= 1 + lenburger[level-1]:
        return burger(level-1, X-1)

    elif X == 2 + lenburger[level-1]:
        return 1 + lenputty[level-1]

    elif X <= 2 + lenburger[level-1]*2:
        return 1 + lenputty[level-1] + burger(level-1, X-2-lenburger[level-1])

    else:
        return lenputty[level]
print(burger(N, X))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 1e6 + 7;
const int mod = 1e9 + 7;
int a[maxn];

int main(){
	memset(a,0,sizeof(a));
	string s;
	cin >> s;
	int len = s.size();
	for(int i = 1;i <= len;i++) a[i] = s[len-i] - '0';
	ll ans = 0;
	for(int i = 1;a[i]||i <= len;i++){
		a[i+1] += a[i] / 10;
		a[i] %= 10;
		if(a[i] < 5) ans += a[i];
		else if(a[i] > 5){
			ans += 10 - a[i];
			a[i+1]++;
		}
		else{
			if(a[i+1]>=5) {ans += 5;a[i+1]++;}
			else ans += 5;
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 5380
s = int(input())
mod = 10**9 + 7

# dp[i]: 最後に切った場所がi
dp = [0]*(s + 1)
dp[0] = 1

for i in range(3, s+1):
    for j in range(0, (i-3)+1):
        dp[i] += dp[j]
        dp[i] %= mod

print(dp[s])

Measured memory_bytes: 64940
M,*a=10**9+7;*I=r=j=x=1;n,*z=`dd`.split.map &:to_i;(0..n).map{|i|a[k=z[i]]&&x=a[k]+n-i;a[k]=i};(0..n).map{|i|p ((r=r*(n+1-i)*I[i]%M)-j)%M;j=j*(x-i)*I[i]%M;I<<(M-M/(i+2))*I[M%(i+2)-1]%M}

Measured memory_bytes: 17496
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;
using P=pair<int,int>;
using Graph=vector<vector<int>>;
using ll=long long;

vector<pair<int,int>> soinsuu(int n){
    vector<pair<int,int>> ret;
    for(int i=2;i*i<=n;i++){
        if(n%i !=0) continue;
        int ex=0;
        while(n%i ==0){
            ex++;
            n /= i; //n変更することで、それ以降の約数で割り切れることはない
        }
        ret.push_back(make_pair(i,ex));
    }
    //nが素数だった場合
    if(n!=1) ret.push_back(make_pair(n,1));
    return ret;
}

signed main(){ 
    int n;
    cin>>n;
    map<int,int> ma;
    int a[n];
    for(int i=0;i<n;i++){
        int ai; cin>>ai;
        ma[ai]+=1;
        a[i]=ai;
    }

    sort(a,a+n);

    vector<int> ord(1000001,0);
    int res=0;

    for(int i=0;i<n;i++){
        if(ma[a[i]]==1){
            int key=a[i];
            int pl=a[i];
            if(ord[key]==0){
                res++;
                while(key<=1000000){
                    ord[key]=1;
                    key+=pl;
                }
            }
        }else{
            if(ord[a[i]]==0){
                int key=a[i];
                int pl=a[i];
                while(key<=1000000){
                    ord[key]=1;
                    key+=pl;
                }
            }
        }
    }

    cout<<res<<endl;
}  

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

int main() {
  char c;
  cin >> c;
  
   if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
     cout << "vowel" << endl;
   }
  else {
    cout << "consonant" << endl;
  }
      
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define Mod 1000000007
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
#define INF (ll)(1e17+5)
#define NN (ll)(1e6+5)
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {    
       ll n,m,i,sum=0,f=0;
       cin>>n>>m;
       vector <ll> v(n);
       for(i=0;i<n;i++)
       {
           cin>>v[i];
           sum+=v[i];
       }
       sort(v.begin(),v.end());
       dd lim=(dd)sum/(4*(dd)m);
       for(i=n-1;i>=0;i--)
       {
           if(v[i]>=lim)
           {
               m--;
               if(m==0)
               {
                   f=1;
                   break;
               }
           }
           else
            break;
       }
       //cout<<sum<<" "<<lim<<" ";
       (f?cout<<"Yes\n":cout<<"No\n");
   }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

const int MAX = 50;

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

    vector<vector<long long> > dp(n+1, vector<long long>(MAX * n + 1, 0));
    dp[0][0] = 1;
    for(int i=0; i<n; ++i){
        int x;
        cin >> x;
        for(int j=i; j>=0; --j){
            for(int k=0; k<=MAX*i; ++k){
                dp[j+1][k+x] += dp[j][k];
            }
        }
    }

    long long ans = 0;
    for(int i=1; i<=n; ++i)
        ans += dp[i][i*a];
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
#include <bitset>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1e9 + 7;

int main() {
    ll a, b, x;
    cin >> a >> b >> x;
    ll ans = x % mod;
    if (x >= a){
        ll t = (x - a + 1 + a - b - 1) / (a - b);
        t %= mod;
        ans = (x + t * (b % mod)) % mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3076
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define S_MAX 1000
#define N_MAX 2000
#define M_MAX 100000
#define INF 2000000000
#define MOD 1000000007
#define SMAP(a, b) ((a)!=(b))&&((a)^=((b)^=((a)^= (b))))

typedef unsigned long long ull;
typedef   signed long long dll;

typedef struct {
	int a;
	int b;
	int c;
} moneydata;

int n, m;
int h, w;
int i, j;
int k;

ull a[N_MAX];
ull dp[N_MAX][N_MAX]; // dp[i][j] := a[i] kara a[i + 2j + b] madede JOIkun ga IOIchan wo ryonareru MAX

ull max(ull a, ull b){
	return (a > b) ? a : b;
}

ull min(ull a, ull b){
	return (a < b) ? a : b;
}

void solve(){
	const int nbool = (n & 1) ^ 1;
	int rangelen;
	ull result = 0;

	printf("%llu\n", result);

	return;
}

int main (void) {
	scanf("%d%d", &n, &m);
	// for (i = 0; i < n; i++) scanf("%llu", &a[i]);

	printf("%d\n", (n + m) % 24);
	
	// solve();
	
	return 0;
}




Measured memory_bytes: 128
import sys
def input(): return sys.stdin.readline().strip()

def f(a, n): # (1\xor 2\xor ...\xor a) のnビット目の値
    if a == 0: return 0
    if n == 0 and (a % 4 == 0 or a % 4 == 3): return 0
    if n == 0 and (a % 4 == 1 or a % 4 == 2): return 1
    idx = a // (2 ** n)
    if idx % 2 == 0: return 0
    return (a - idx * 2**n + 1) % 2

def g(a, b, n): # (a\xor a+1\xor...\xor b)のnビット目の値
    if a == 0: return f(b, n)
    return (f(b, n) + f(a-1, n)) % 2


def main():
    A, B = map(int, input().split())
    ans = 0
    for i in range(41):
        ans += g(A, B, i) * 2**i
        #print("i={}, 1-{}->{}, 1-{}->{} --> g={}".format(i, B, f(B, i), A-1, f(A-1, i), g(A, B, i)))
    print(ans)


if __name__ == "__main__":
    main()


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

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define data asd09123jdf02i3h

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 1e6+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 1e9+7;

int n,a[maxn],f[maxn],s[maxn],pre[maxn],t[maxn];

int main() {
    read(n);for(int i=1;i<=n;i++) read(a[i]);
    for(int i=1;i<=n;i++) pre[i]=t[a[i]],t[a[i]]=i;
    f[0]=s[0]=1;
    for(int i=1;i<=n;i++) {
        if(!pre[i]||pre[i]==i-1) {s[i]=s[i-1];continue;}
        f[i]=s[pre[i]],s[i]=(f[i]+s[i-1])%mod;
    }
    // for(int i=1;i<=n;i++) printf("%d %d\n",i,f[i]);
    write(s[n]);
    return 0;
}


Measured memory_bytes: 17408
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <climits>
#include <list>
#include <queue>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  int N;cin>>N;
  string ans;
  if(N <= 999) {
    ans = "ABC";
  } else {
    ans = "ABD";
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<queue>
#include<unordered_map>
#include<map>
#define P pair<string,int>
#define p pair<char,char>
using namespace std;

int main()
{
	map<p, char>M;
	M[p('b', 'g')] = 'r';
	M[p('g', 'b')] = 'r';
	M[p('b', 'r')] = 'g';
	M[p('r', 'b')] = 'g';
	M[p('r', 'g')] = 'b';
	M[p('g', 'r')] = 'b';
	string a;
    l:;
	while (cin >> a, a != "0") {
		unordered_map<string, int>U;
		queue<P>Q;
		Q.push(P(a, 1));
		while (Q.size()) {
			P c = Q.front(); Q.pop();
			bool d = true;
			for (int e = 1; e < c.first.length(); e++)if (c.first[e - 1] != c.first[e])d = false;
			if (d) { cout << c.second - 1 << endl; goto l; }
			for (int e = 1; e < c.first.length(); e++) {
				if (c.first[e - 1] != c.first[e]) {
					string copy = c.first;
					copy[e - 1] = copy[e] = M[p(c.first[e - 1], c.first[e])];
					if (U[copy] == 0) { U[copy] = c.second + 1; Q.push(P(copy,U[copy])); }
				}
			}
		}
		puts("NA");
	}
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), greater<int>());
  int l = a[0];
  int min_i = 0, min_v = 0, min_diff = a[0];
  for (int i = 1; i < n; i++) {
    int d;
    if (l % 2 == 1) {
      d = min(abs(l / 2 - a[i]), abs(l / 2 + 1 - a[i]));
    } else {
      d = abs(l / 2 - a[i]);
    }
    if (min_diff > d) {
      min_diff = d;
      min_i = i;
      min_v = a[i];
    }
  }
  cout << l << " " << min_v << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int num;
  cin >> num;
  for(int i=0;i<3;i++){
    if(num%10==7){
      cout << "Yes" << endl;
      return 0;
    }
    num/=10;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
for i in range(k):
    h.append(0)

dp = [float('inf')] * (n + k)
dp[0] = 0

for i in range(n):
    for j in range(1, k + 1):
        dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]))

print(dp[n-1])


Measured memory_bytes: 85120
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[5],b,c,k;
int main()
{
	cin>>a[1]>>a[2]>>a[3]>>k;
	while(k--)
	{
		sort(a+1,a+1+3);
		a[3]*=2;
	}
	cout<<a[1]+a[2]+a[3]<<endl;
	return 0;
} 

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
a = [list(input())[: -1] for _ in range(N)]
b = [list(input())[: -1] for _ in range(M)]
for i in range(N - M + 1):
  for j in range(N - M + 1):
    for y in range(M):
      for x in range(M):
        if a[i + y][j + x] != b[y][x]: break
      else: continue
      break
    else:
      print("Yes")
      exit(0)
print("No")

Measured memory_bytes: 63476
///cREATED bY BERNARB.01
#include<bits/stdc++.h>
using namespace std;

int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    if(a[0]==a[1]&&a[1]!=a[2]) cout << "Yes\n";
    else if(a[1]==a[2]&&a[0]!=a[1]) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int N; 
  cin >> N;
  vector<int> A(N);
  int m1 = 0, m2 = 0;
  int num_max = 0;
  rep(i,N) {
    cin >> A[i];
    m1 = max(m1, A[i]);
  }
  rep(i,N) {
    if (A[i] != m1) m2 = max(m2, A[i]);
    if (A[i] == m1) ++num_max;
  }
  rep(i,N) {
    if (A[i] == m1 && num_max == 1) cout << m2 << endl;
    else cout << m1 << endl;
  }
  return 0;
}

Measured memory_bytes: 3616
R, G, B, N = gets.strip.split(/ /).collect(&:to_i)

$cache = []
def countGB(n)
	if count = $cache[n]
		return count
	end
	x = 0
	count = 0
	while x <= n
		if (n - x) % B == 0
			count += 1
		end
		x += G
	end
	
	$cache[n] = count
end

x = 0
count = 0
while x <= N
	count += countGB(N - x)
	x += R
end

puts count



Measured memory_bytes: 1788
# -*- coding: utf-8 -*-

import itertools

N, M = map(int, input().split())

# 入力値の頂点ペア(辺)を格納する配列
a = [0] * M
b = [0] * M

# 頂点ペアが隣接しているかどうかを格納する配列
graph = [[False for i in range(N)] for j in range(N)]

# 入力値の頂点ペア(辺)を格納していくループ
for i in range(M):
    a[i], b[i] = map(int, input().split())
    # 添字に合わせて入力値から1減らしておく
    a[i] -= 1
    b[i] -= 1
    # 入力値の内容に合わせて、隣接していることを記録
    graph[a[i]][b[i]] = True
    graph[b[i]][a[i]] = True

# 頂点をつなぐ全組み合わせ(順列)
# Nが少なければこれでいけるんだね…
perm_list = list(itertools.permutations(range(N)))

cnt = 0
for i in range(len(perm_list)):
    # 今回は出発点が1(添字0)と決まっているので、それ以外はbreak
    if perm_list[i][0] != 0:
        break
    for j in range(len(perm_list[i])-1):
        # 各辺が存在(各頂点ペアが隣接)しているか確認していく
        if graph[perm_list[i][j]][perm_list[i][j+1]] == False:
            break
        # 全て存在すれば条件を満たすのでカウント+1
        if j == len(perm_list[i])-2:
            cnt += 1
print(cnt)

Measured memory_bytes: 8052
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AGC029_A solver = new AGC029_A();
        solver.solve(1, in, out);
        out.close();
    }

    static class AGC029_A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            char[] str = in.next().toCharArray();
            long ans = 0;
            long wCost = 0;
            long wCount = 0;
            long wIdeal = 0;
            for (int i = 0; i < str.length; i++) {
                if (str[i] == 'W') {
                    wCost += (i + 1);
                    wCount++;
                    wIdeal += wCount;
                }
            }


            out.print(wCost - wIdeal);
        }

    }
}



Measured memory_bytes: 27832
n, q = map(int, input().split())
s = input()
c = [0 for _ in range(n)]

for i in range(1, n):
    if s[i - 1 : i + 1] == "AC":
        c[i] += 1
    c[i] += c[i - 1]

for _ in range(q):
    l, r = map(int, input().split())
    print(c[r - 1] - c[l - 1])


Measured memory_bytes: 7772
#include <bits/stdc++.h>
using namespace std;
int main() {
  int H, W;
  cin >> H >> W;
  while (H != 0 || W != 0) {
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if ((i + j) % 2 == 0) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
    cin >> H >> W;
  }
  return 0;
}



Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,ans=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    if(i%2==0&&a%2==1){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <string>
#include <sstream>

using namespace std;

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;

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

    int N, M, C;
    cin >> N >> M >> C;
    int B[M];
    for (int i = 0; i < M; ++i) {
        cin >> B[i];
    }
    int A[N][M];
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M; ++j) {
            cin >> A[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        int calc = C;
        for (int j = 0; j < M; ++j) {
            calc += A[i][j] * B[j];
        }
        if (calc > 0) {
            ++ans;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
from operator import itemgetter
input = sys.stdin.buffer.readline

N, K = map(int, input().split())
tds = [tuple(map(int, input().split())) for _ in range(N)]

tds.sort(key = itemgetter(1), reverse = True)

ate = {t:False for t, _ in tds}
variety = 0
deliciousness = 0
will_be_replaced = []
for t, d in tds[:K]:
    if ate[t] == False:
        ate[t] = True
        variety += 1
    else:
        will_be_replaced.append((t, d))
    deliciousness += d

max_point = deliciousness + variety ** 2

i = K
while will_be_replaced:
    t, d = will_be_replaced.pop()
    while i < N:
        if ate[tds[i][0]]:
            i += 1
        else:
            ate[tds[i][0]] = True
            deliciousness -= d
            deliciousness += tds[i][1]
            variety += 1
            point = deliciousness + variety ** 2
            max_point = max(max_point, point)
            break

print(max_point)
    

Measured memory_bytes: 25804
def cmd(n,r,mod=10**9+7):
    fac = [0] * (n+1)
    finv = [0] * (n+1)
    inv = [0]*(n+1)

    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    
    for i in range(2, n+1):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] % mod

    if n < r: return 0
    if n < 0 or r < 0: return 0
    return (fac[n]*(finv[r]*finv[n-r]%mod)%mod)

x,y  = map(int, input().split())

if (x+y) % 3 != 0:
    print(0)
    exit()

i = (x+y)//3
j = x-i

print(cmd(i,j))

Measured memory_bytes: 82164
import java.util.*;

public class Main {
	static final long MOD = 1000000007;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		long ans = ((pow(2, n) -1) - comb(n, a) - comb(n, b) + 3*MOD) % MOD; 
		
		System.out.println(ans);
		sc.close();
	}
	
	static long pow(long a, long b) {
		long ans = 1;
		while(b>0) {
			if((b&1)!=0)
				ans = (ans * a)%MOD;
			b>>=1;
			a = (a*a)%MOD;
		}
		return ans;
	}
	
	static long rev(long a) {
		return pow(a, MOD-2);
	}

	static long comb(long a, long b) {
		long ans = 1;
		for(long i=0; i<b; i++) {
			ans = (ans * (a-i)) % MOD;
			ans = (ans * rev(i+1)) % MOD;
		}
		
		return ans;
	}
}


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

int main() {
  // 入力
  int N, A, B;
  cin >> N >> A >> B;
  int t[N];
  for (int i = 0; i < N; i++) cin >> t[i];

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (t[i] < A || B <= t[i]) ans++;
  }

  // 解答
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main(){
  
  int n, tmp, m=0;
  
  cin>> n;
  
  for(int i=0;i<n;i++){
	cin>> tmp;
    m=m|tmp;
  }
  
  for(int i=0;i<=64;i++){
    if (m & (1<<i)){
      cout<< i <<endl;
      return 0;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
import sys


def main():
    N = int(input())
    A = list(map(int, input().split()))
    res = 1

    if (0 in A):
        print("0")
        sys.exit()

    for a in A:
        res = res * a
        if res > pow(10, 18):
            print("-1")
            sys.exit()
    print(res)


if __name__ == "__main__":
    main()

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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;

  int P[M], Y[M];
  vector<int> pref_cities[N];
  for (int i = 0; i < M; i++) {
    cin >> P[i] >> Y[i];
    pref_cities[P[i]-1].push_back(Y[i]);
  }


  for (int i = 0; i < N; i++) {
    sort(pref_cities[i].begin(), pref_cities[i].end());
  }

  for (int i = 0; i < M; i++) {
    vector<int>::iterator it = lower_bound(pref_cities[P[i]-1].begin(), pref_cities[P[i]-1].end(), Y[i]);
    printf("%06d%06d\n", P[i], it - pref_cities[P[i]-1].begin() + 1);

  }
  return 0;
}

Measured memory_bytes: 7808
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	int N;
	int col[100001]={};
	cin>>N;
	set<int> tes; 
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		col[a]++;
		tes.insert(a);
	}
	if(tes.size()==1){
		//猫の発言を取り出す
		int one=*tes.begin();
		if(one==N-1 || (1<=one && one<=N/2)){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
	else if(tes.size()==2){
		//猫の発言を取り出す
		int one=*tes.begin();
		int two=one+1;
		if(col[two]<=(N-two) || 2*(N-two)<col[two]){
			cout<<"No"<<endl;
		}
		else{
			cout<<"Yes"<<endl;
		}
	}
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 5376
#include<set>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j;
  int m;
  while(cin>>m&&m){
    int a[200],b[200];
    for(i=0;i<m;i++)
      cin>>a[i]>>b[i];
    int n;
    cin>>n;
    set<pair<int,int> > c;
    for(i=0;i<n;i++){
      int p,q;
      cin>>p>>q;
      c.insert(make_pair(p,q));
    }
    set<pair<int,int> >::iterator it;
    for(it=c.begin();it!=c.end();it++){
      for(j=1;j<m;j++){
	if(c.count(make_pair(a[j]+(*it).first-a[0],b[j]+(*it).second-b[0]))==0)
	  break;
      }
      if(j==m)
	break;
    }
    cout<<(*it).first-a[0]<<" "<<(*it).second-b[0]<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC057_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int answer;

            answer = (a + b) % 24;

            Console.WriteLine(answer);

        }
    }
}


Measured memory_bytes: 11092
//#include "/usr/local/bits"
#include <bits/stdc++.h>
using namespace std;    
#define ll long long
#define pb push_back
#define mp make_pair
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds; 
  
//#define ordered_set tree<pair<int,int>, null_type,less< pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update> 
//find_by_order(k) - k is the kth element of the set
//order_of_key(k) - Number of elements striclty samller than k
void build(ll segt[],ll arr[],ll l,ll r,ll ind)
{
    if(l==r)
    {
        segt[ind]=arr[l];
        return;
    }
    ll mid=l+(r-l)/2;
    build(segt,arr,l,mid,2*ind+1);
    build(segt,arr,mid+1,r,2*ind+2);
    segt[ind]=min(segt[2*ind+1],segt[2*ind+2]);
}
//llim-lower limit of array,rlim-upper limit of array
//l,r- range of query
ll sum(ll segt[],ll llim,ll rlim,ll l,ll r,ll ind)
{
    //cout<<llim<<" "<<rlim<<endl;
    if(l<=llim && rlim<=r)
    {
        //cout<<"here "<<segt[ind]<<" "<<ind<<endl;
        return segt[ind];
    }
    if(r<llim || rlim<l)
    {
        return 1e18;
    }
    ll mid=llim+(rlim-llim)/2;
    return min(sum(segt,llim,mid,l,r,2*ind+1),sum(segt,mid+1,rlim,l,r,2*ind+2));
}
void update(ll segt[],ll llim,ll rlim,ll diff,ll upind,ll ind)
{
    if(upind<llim || upind>rlim)
        return;
    segt[ind]=min(segt[ind],diff);
    if(llim==rlim)
    {
        segt[ind]=diff;
        return;
    }
    if(llim!=rlim)
    {
        ll mid=llim+(rlim-llim)/2;
        update(segt,llim,mid,diff,upind,2*ind+1);
        update(segt,mid+1,rlim,diff,upind,2*ind+2); 
    }
}
ll modularExponentiation(ll x,ll n,ll M=1000000007)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return modularExponentiation((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*modularExponentiation((x*x)%M,(n-1)/2,M))%M;
 
}
ll modInverse(ll A,ll M=1000000007)
{
    return modularExponentiation(A,M-2,M);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
        cout<<"Yes"<<endl;      
    else
        cout<<"No"<<endl;
}






















Measured memory_bytes: 256
N = int(input())
B = [int(i) for i in input().split()]
a_sum = 0
for i in range(N):
    if i == 0:
        a_sum += B[0]
    elif 1 <= i < N - 1:
        a_sum += min(B[i-1], B[i])
    else:
        a_sum += B[i-1]

print(a_sum)


Measured memory_bytes: 3060
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Cs = list(input())
from collections import deque
Q = deque()
for i, c in enumerate(Cs):
    if c=='R':
        Q.append(i)

ans = 0
for i in range(N):
    c = Cs[i]
    if c=='W':
        if not Q:
            break
        r = Q.pop()
        if r>i:
            ans += 1
        else:
            break
print(ans)

Measured memory_bytes: 82520
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int n,k;
    cin >> n >> k;
    set<int> s;
    for (int i=0; i<k; i++) {
        int d;
        cin >> d;
        for (int j=0; j<d; j++) {
            int a;
            cin >> a;
            s.insert(a);
        }
    }

    cout << n - s.size() << endl;
}

Measured memory_bytes: 3164
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x, long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }
        public static long keta(long x)
        {
            var z = 1;
            while (x > 0)
            {
                x /= 10;
                z++;
            }
            return z;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var n = Read();
            var s = new long[n];
            for (int i = 0; i < n; i++)
            {
                s[i] = Read();
            }
            Array.Sort(s);
            long memo = 0;
            for (int i = 0; i < n; i++)
            {
                if (s[i] % 10 != 0)
                {
                    memo = s[i];
                    break;
                }
            }
            if (s.Sum() % 10 != 0) WriteLine(s.Sum());
            else
            {
                if (memo != 0) WriteLine(s.Sum() - memo);
                else WriteLine(0);
            }

            Console.Out.Flush();
        }
    }
}



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

int main()
{
  int64_t n, m;
  cin >> n >> m;
  
  if (n == 1 && m == 1) cout << 1;
  else if (n == 1) cout << m - 2;
  else if (m == 1) cout << n - 2;
  else cout << (n - 2) * (m - 2);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

vector< vs32 > g;
vs32 pre;
vector< bool > reached;

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

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

    g.resize(n);
    pre.resize(n);
    reached.resize(n, false);

    rep (i, m)
    {
        int a, b;
        cin >> a >> b;
        --a, --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    queue<int> q;
    q.push(0);
    vs32 d(n, 1e9);
    d[0] = 0;
    while (!q.empty())
    {
        int u = q.front(); q.pop();
        reached[u] = true;
        for (auto v : g[u])
        {
            if (!reached[v] && d[v] == 1e9)
            {
                d[v] = d[u] + 1;
                pre[v] = u;
                q.push(v);
            }
        }
    }

    cout << "Yes\n";
    rep (i, n - 1)
    {
        cout << pre[i + 1] + 1 << "\n";
    }

    return 0;
}



Measured memory_bytes: 10720
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    cout<<(1000-n%1000)%1000;
}

Measured memory_bytes: 3656