akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <cstring>
#include <cstdio>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define F first
#define S second
int n,m,ans;
vector<int>g[705];
bool e[705][705];
bool vis[705];
int o[705],x,y,z;
void dfs(int v,int d){
    vis[v]=true;
    o[v]=d;
    if(d==1)x++;
    else y++;
    for(int i=0;i<g[v].size();i++){
        int u=g[v][i];
        if(!vis[u]){
            dfs(u,d*-1);
        }else if(o[u]==d)z=-1;
    }
}
vector<P>s;
bool dp[705][705];
int main(void){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int s,t;
        cin>>s>>t;
        e[--s][--t]=true;
        e[t][s]=true;
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(!e[i][j]&&i!=j)g[i].push_back(j);
        }
    }
    for(int i=0;i<n;i++){
        if(!vis[i]){
            x=0;
            y=0;
            z=1;
            dfs(i,1);
            if(z==-1){
                cout<<-1<<endl;
                return 0;
            }
            s.push_back(P(x,y));
        }
    }
    int k=s.size();
    dp[0][0]=true;
    for(int i=0;i<k;i++){
        for(int j=0;j<n;j++){
            if(dp[i][j]){
                dp[i+1][j+s[i].F]=true;
                dp[i+1][j+s[i].S]=true;
            }
        }
    }
    ans=m;
    for(int i=0;i<=n;i++){
        if(dp[k][i])ans=min(ans,i*(i-1)/2+(n-i)*(n-i-1)/2);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
int main(){
lint n,k; cin>>n>>k;llint a,b;
  if(k%2==0){
    a=n/k;b=(2*n/k)-a;cout<<((a*a*a)+b*b*b)<<endl;
  }else{
  a=n/k;cout<<a*a*a<<endl;
  }

}


Measured memory_bytes: 384
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Scanner;

public class Main {

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

		int year = 2004;
		int month;
		int day;

		while ((month = (scan.nextInt())) != 0) {
			day = scan.nextInt();

			GregorianCalendar calendar = new GregorianCalendar(year, month - 1, day);
			System.out.println(getWeek(calendar));

		}
	}

	private static String getWeek(GregorianCalendar calendar) {
		String week = null;
		if (calendar.get(Calendar.DAY_OF_WEEK) == 1) {
			week = "Sunday";
		} else if (calendar.get(Calendar.DAY_OF_WEEK) == 2) {
			week = "Monday";
		} else if (calendar.get(Calendar.DAY_OF_WEEK) == 3) {
			week = "Tuesday";
		} else if (calendar.get(Calendar.DAY_OF_WEEK) == 4) {
			week = "Wednesday";
		} else if (calendar.get(Calendar.DAY_OF_WEEK) == 5) {
			week = "Thursday";
		} else if (calendar.get(Calendar.DAY_OF_WEEK) == 6) {
			week = "Friday";
		} else if (calendar.get(Calendar.DAY_OF_WEEK) == 7) {
			week = "Saturday";
		}
		return week;

	}
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int A = Integer.parseInt(sc.next());
		sc.close();
		String ans = "No";
		for(int i = 0;i <= A;i++) {
			if((N - i)%500 == 0) {
				ans = "Yes";
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>

int solve(std::vector<std::vector<long long int> > &G, std::vector<long long int> &counter, std::vector<long long int> &counted, long long int index, long long int carryover);

int main(){
  long long int N, Q;
  scanf("%lld%lld", &N, &Q);
  
  std::vector<std::vector<long long int> > G(N);
  long long int tmp1, tmp2;
  for(int i = 0; i < N-1; i++){
    scanf("%lld%lld", &tmp1, &tmp2);
    G[tmp1-1].push_back(tmp2-1);
    G[tmp2-1].push_back(tmp1-1);
  }
  
  std::vector<long long int> counter, counted;
  for(int i = 0; i < N; i++){
    counter.push_back(0);
    counted.push_back(0);
  }
  
  for(int i = 0; i < Q; i++){
    scanf("%lld%lld", &tmp1, &tmp2);
    counter[tmp1-1] += tmp2;
  }
  
  solve(G, counter, counted, 0, 0);
  
  for(int i = 0; i < N; i++){
    std::cout << counter[i] << " ";
  }
  std::cerr << std::endl;
  
  return 0;
}

int solve(std::vector<std::vector<long long int> > &G, std::vector<long long int> &counter, std::vector<long long int> &counted, long long int index, long long int carryover){
  
  // update the given point
  counter[index] += carryover;
  counted[index] = 1;
  
  // update the child nodes
  long long int n = G[index].size();
  for(long long int i = 0; i < n; i++){
    if(counted[G[index][i]] == 0){
      solve(G, counter, counted, G[index][i], counter[index]);
    }
  }
  
  return 0;
}


Measured memory_bytes: 32356
#pragma GCC optimize "-O3"
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<int,int>
#define twoll pair<ll,ll>
#define four pair<two,two>
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define y1 y1922
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
#define nn 1000003
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define vi vector<int>
#define vll vector<ll>
#define vtwo vector<two>
#define ALL(container) (container).begin(), (container).end()
#define sz(container) (int)(container.size())
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mid(a,b) (a+b>>1)
#define minN 0
#define maxN 10000000
#define na(x) ((x)<P?(x):(x)-P)
#define ab(a) (-(a)<(a)?(a):-(a))
#define FAST std::ios::sync_with_stdio(false)
#define xRand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rnd rng
#define IT iterator
typedef
tree<
  int,// aq pair<int,int> shegidzlia
  null_type,
  less/*_equal*/<int>,// aqac
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;
// '_equal' mashin ginda roca multiset gchirdeba
template<class key, class value,class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
ordered_map<int, int> my_map;
inline int rin(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
inline int bin(){
	int x=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x;
}
int n,A[200003],B[200003],l,r,L,R,ans;
bool check(int x){
	L = 1, R = 2*n-1; 
  for(int i=1;i<=n*2-1;i++)
    B[i] = (A[i]>=x);
  for(int i=2*n-1;i>n;i--)
    if(B[i]==B[i-1])
    	R = i-1;
  for(int i=1;i<n;i++)
    if(B[i]==B[i+1])
    	L = i+1;
  if((n-L)<(R-n)){
  	return B[L] == 1;
  } else {
  	return B[R] == 1;
  }
}
int main(){FAST;xRand;
cin>>n;
for(int i=1;i<=n*2-1;i++) cin>>A[i];
int l = 1, r = 2*n-1;
while(l<=r){
	int mid = (l+r)/2;
	if(check(mid)) l = mid + 1,ans = mid;
	else r = mid - 1;
}
cout<<ans<<endl;
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/



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

int main()
{
  int n, book;
  
  while (scanf("%d", &n), n){
    int sum = 0;
    for (int i = 0; i < 9; i++){
      scanf("%d", &book);
      sum += book;
    }
    printf("%d\n", n - sum);
  }

  return (0);
}

Measured memory_bytes: 1188
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{max, min};
use std::collections::*;
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, $var:ident $($r:tt)*) => {
        let $var = parse_val!($it, usize);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

#[cfg(debug_assertions)]
macro_rules! debug {
    ($( $args:expr ),*) => { eprintln!( $( $args ),* ); }
}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($( $args:expr ),*) => {
        ()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n, m, v, p, a: [usize; n]);
    let mut a: Vec<_> = a;
    a.sort();
    a.reverse();
    let thres = a[p - 1];
    let f = |i: usize| {
        let t = a[i] + m;
        if t < thres {
            return false;
        }
        if let Some(res) = (v + i + 1).checked_sub(n + p) {
            let mut res = m * res;
            for j in ((p - 1)..i).rev() {
                let r = t - a[j];
                if r >= res {
                    return true;
                }
                res -= r;
            }
            return false;
        } else {
            true
        }
    };

    let mut l = p - 1;
    let mut r = n;
    while r - l > 1 {
        let m = (l + r) / 2;
        if f(m) {
            l = m;
        } else {
            r = m;
        }
    }
    println!("{}", l + 1);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 4220
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
#include <iomanip>
#include <stdio.h>
#include <bitset>

typedef long long ll;

constexpr long long INFLL = 1e18;

using namespace std;

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

    int ac = 0;
    int tle = 0;
    int wa = 0;
    int re = 0;
    while (n > 0)
    {
        cin >> s;
        if (s == "AC")
        {
            ac++;
        }
        else if (s == "WA")
        {
            wa++;
        }
        else if (s == "TLE")
        {
            tle++;
        }
        else
        {
            re++;
        }
        n--;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;

    return 0;
}

Measured memory_bytes: 3212
#include<bits/stdc++.h>
#define ll long long
const int maxn = int(1e5) + 7;
using namespace std;
ll inf=1e9+7;
ll a[maxn<<4];
ll sum[20];
int main()
{
    ll h,w,n;
    scanf("%lld%lld%lld",&h,&w,&n);
    ll x,y;
    int k=0;
    ll zo=(h-2)*(w-2);
    for(ll i=1;i<=n;i++)
    {
        //cin>>x>>y;
        scanf("%lld%lld",&x,&y);
        for(ll i=0;i<=2;i++)
        for(ll j=0;j<=2;j++)
        {
            if(x-i>=1&&x-i<=h-2&&y-j>=1&&y-j<=w-2)
            {

                a[k++]=inf*(x-i)+(y-j);
            }
        }
    }
    sort(a,a+k);
    ll t=1;
    for(int i=0;i<k;i++)
    {
        if(a[i]==a[i+1])t++;
        else
        {
            sum[t]++;t=1;zo--;
        }
    }
    cout<<zo<<endl;
    for(int i=1;i<=9;i++)
    {
        cout<<sum[i]<<endl;
    }
}


Measured memory_bytes: 8448
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	S, T := sc.Next(), sc.Next()

	mn := ""

	for i := len(S) - len(T); i >= 0; i-- {
		count := 0
		for j := 0; j < len(T); j++ {
			if S[i+j] == T[j] || S[i+j] == '?' {
				count++
			}
		}
		if count == len(T) {
			ans := make([]byte, len(S))
			for p := 0; p < len(S); p++ {
				if i <= p && p < i+len(T) {
					ans[p] = T[p-i]
				} else {
					if S[p] == '?' {
						ans[p] = 'a'
					} else {
						ans[p] = S[p]
					}
				}
			}
			if mn == "" || mn > string(ans) {
				mn = string(ans)
			}
		}
	}
	if mn == "" {
		fmt.Println("UNRESTORABLE")
	} else {
		fmt.Println(mn)
	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

int main()
{
	int n;cin>>n;
    int x = 1;
    for(int i = 0; i < n; i++){
        int a;cin>>a;
        if(a%2==0) x*=2;
    }
    cout << (int)pow(3, n) - x << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
 
int main(){
  string s;
  cin >>s;
  ll a=0,b=0;
  
  for(int i=0; i<s.size(); i++){
    if(s[i] == 'B')a++;
    else b += a;
  }
  
  cout << b;
  
  
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  int i,k,s;
  k=1;
  s=0;
  for(i=0;i<n;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  for(i=n-1;i>=0;i--){
    s+=a.at(i)*k;
    k=-k;
  }
  
  cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("atcoder-problems/tenka1_2019_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, K;
  string S;
  cin >> N >> S >> K;

  rep(i, N) {
    if (S[i] != S[K - 1]) S[i] = '*';
  }

  cout << S << endl;
}

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

ll mi[2005];

int main(){
	ll n,x; cin >> n >> x;
	vector<ll> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
		mi[i]=a[i];
	}
	ll ans=1e18;
	for(int i=0;i<n;i++){
		ll sum=0;
		for(int j=0;j<n;j++){
			sum+=mi[j];
		}
		ans=min(ans,sum+x*i);
		for(int j=0;j<n;j++){
			mi[j]=min(mi[j],a[(j+n-i-1)%n]);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	int tmpr = 0;
	int tmpl = 0;
	rep(i, n) {
		if (s[i] == '(') tmpr++;
		else {
			if (tmpr > 0) tmpr--;
		}
	}
	reverse(all(s));
	rep(i, n) {
		if (s[i] == ')') tmpl++;
		else {
			if (tmpl > 0) tmpl--;
		}
	}
	reverse(all(s));
	string res1 = "";
	while (tmpl--) res1 += '(';
	string res2 = "";
	while (tmpr--) res2 += ')';
	cout << res1 + s + res2 << endl;
	return 0;
}


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

int main(){
  int n,cou=0;
  string str;
  cin >> n;
  while(n>cou){
    int cou_out=0,ans=0,ining=0;
    while(cou_out < 3){
      cin >> str;
      if(str == "HIT"){
	ining++;
	if(ining == 4){
	  ans++;
	  ining--;
	}
      }
      else if(str == "OUT"){
	cou_out++;
      }
      else if(str == "HOMERUN"){
	ans += ining+1;
	ining = 0;
      }
    }
    cou++;
    cout << ans << endl;
  }
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define cin fin
#define cout fout
#endif
using namespace std;
ifstream fin("in.txt");
ofstream fout("out.txt");
int n,m;
const double pi=acos(-1);
int a[200005];
int main(){
	cin>>n;
	for(int i=1;i<n;i++){
		cin>>m;
		a[m]++;
	}
	for(int i=1;i<=n;i++){
		cout<<a[i]<<endl;
	}
}

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



int main() {
    int h,k;
    cin >> h >> k;
    rep(i,k) {
        int a;
        cin >> a;
        h-=a;
    }
    if(h<=0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var A, B int
	fmt.Scanf("%d %d", &A, &B)
	ans := 0
	for i := 0; i < 10; i++ {
		for j := 0; j < 10; j++ {
			for k := 0; k < 10; k++ {
				x := i * 10000 + j * 1000 + k * 100 + j * 10 + i
				if A <= x && x <= B {
					ans++
				}
			}
		}
	}
	fmt.Printf("%d\n", ans)
	return
}


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

typedef long long int ll;

int main()
{
   ll n; cin >> n;
   ll big = n / 500;
   ll small = (n % 500) / 5;
  
  
  ll ans = big * 1000LL + small * 5LL;
  
  cout << ans;
  
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1010;
int n,m;
int f[N][N];
int w[N],v[N];
int c[N];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>w[i];
    for(int i=1;i<=n;i++) cin>>v[i];
    for(int i=1;i<=n;i++){
        c[i]=w[i]-v[i];
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(c[i]>0) ans+=c[i]; 
    }
    cout<<ans<<endl;
    //system("pause");
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
const int N=100100;
int n,k,q,a;
int b[N];
int main()
{
    scanf("%d%d%d",&n,&k,&q);
    for(int i=1;i<=q;i++)
    {
        scanf("%d",&a);
        b[a]++;
    }
    for(int i=1;i<=n;i++)
    {
        if(k-q+b[i]>0)
            puts("Yes");
        else
            puts("No");
    }
    return 0;
}


Measured memory_bytes: 896
#Coins
def ABC_87_B():
    A=int(input())
    B=int(input())
    C=int(input())
    X=int(input())
    count=0

    for i in range(A+1):
        for j in range(B+1):
            for k in range(C+1):
                s=i*500+j*100+k*50
                if s == X:
                    count+=1

    print(count)


if __name__ == '__main__':

    ABC_87_B()

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

int main() {
  int N;
  cin >> N;
  vector<int64_t> f(N);
  for (int i=0; i<N; i++) {
    f.at(i)=0;
  }
  for (int j=1; j<101; j++) {
    for (int k=1; k<101; k++) {
      for (int l=1; l<101; l++) {
        if (j*j+k*k+l*l+j*k+k*l+l*j<=N) {
          f.at(j*j+k*k+l*l+j*k+k*l+l*j-1)=f.at(j*j+k*k+l*l+j*k+k*l+l*j-1)+1;
        }
      }
    }
  }
  for (int n=0; n<N; n++) {
    cout << f.at(n) << endl;
  }
}


Measured memory_bytes: 3612
// This is the start of  template//
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long int
#define double long long double
#define vll vector<int>
#define pb push_back
#define pll pair<int,int>
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
void input(){
#ifndef ONLINE_JUDGE 
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout); 
#endif
}
#define INF LONG_LONG_MAX
#define mod 1000000007
#define array(a,n) vll a(n); rep(i,0,n) cin>>a[i];
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define cases int t; cin>>t; while(t--)
#define printall(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<endl;

int32_t main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  input();
  string s;
  cin>>s;
  int sum =0;
  rep(i,0,s.size())
  {
    sum += s[i]-'0';
  }
  if(sum%9)
    cout<<"No";
  else
    cout<<"Yes";
  return 0;
}



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

#define FOR(i, a, b) for (int i = a; i < (b); ++i)

int main(void) {
    const int MOD = 1e9 + 7;
    int n;
    long long ans = 1;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    FOR(i, 1, n + 1) {
        ans *= i;
        ans %= MOD;
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
#define db double
#define N 3010
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
const db PI=acos(-1.0);
db x,y,num[N]; int n,l;
void add(db ang,int cnt){x+=cos(ang)*cnt,y+=sin(ang)*cnt;}
int main()
{
	n=read(),l=read(); for(int i=1;i<=n;i++)	num[i]=(db)read()/l*2*PI;
	for(int i=1;i<=n;i++)	for(int j=i+1;j<=n;j++)
	{
		db p1=(num[i]+num[j])*0.5; db p2=p1+PI;
		add(p1,n+i-j-1); add(p2,j-i-1);
	}
	db tot=1.0*n*(n-1)*(n-2)/6;
	x/=tot,y/=tot;
	printf("%.12lf %.12lf\n",x,y);
	return 0;
}


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

vector<bool> visited(100005);
vector <int> route[100005];

void dfs(int v){
    visited[v]=1;
    for(int i:route[v]){
        if (visited[i]==1) continue;
        dfs(i);
    }
}

void testcase(){
    int n,m;
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        route[a].push_back(b);
        route[b].push_back(a);
    }
    int c=0;
    for(int i=0;i<n;i++){
        if(visited[i]==1) continue;
        dfs(i);
        c++;
    }
    cout << c-1;

}


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int q=1;
   // cin >> q;
    while(q--){
    testcase();
    }
    return 0;
}


Measured memory_bytes: 9596
n=int(input())
c=[0]*4
for i in range(n):
    s=str(input())
    if s=="AC":
        c[0]+=1
    elif s=="WA":
        c[1]+=1
    elif s=="TLE":
        c[2]+=1
    elif s=="RE":
        c[3]+=1

print("AC x "+str(c[0]))
print("WA x "+str(c[1]))
print("TLE x "+str(c[2]))
print("RE x "+str(c[3]))


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

typedef long long ll;
ll i, z, a[2][3];
int main()
{
	for (i = 0; i < 3; i++) {
		scanf ("%lld", &a[0][i]);
		if (a[0][i] % 2) {
			cout << 0;
			return 0;
		}
	}
	for (i = 1; i <= 35; i++) {
		z = (i + 1) % 2;
		a[i % 2][0] = (a[z][1] + a[z][2]) / 2;
		a[i % 2][1] = (a[z][0] + a[z][2]) / 2;
		a[i % 2][2] = (a[z][0] + a[z][1]) / 2;
		if (a[i % 2][0] % 2 || a[i % 2][1] % 2 || a[i % 2][2] % 2) break;
	}
	if (i <= 35) cout << i;
	else cout << -1;
    return 0;
}


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

int main() {
    int l, r, d, cnt = 0;
    cin >> l >> r >> d;
    for (int i = l; i <= r; i++)
    {
        if (i % d == 0) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

int main()
{
	int k, n;
	cin >> k >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a.at(i);

	int lsum = 0, lmax = 0, diff;
	for (int i = 0; i < n; i++) {
		if (i < n - 1)
			diff = a.at(i+1) - a.at(i);
		else
			diff = a.at(0)+k - a.at(n-1);
		lmax = max(lmax, diff);
		lsum += diff;
	}
	lsum -= lmax;
	cout << lsum << endl;

	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<cmath>
#include<string>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define deb(x) cerr<<#x<<" "<<x<<"\n"
#define debi cerr<<"hey sparky\n"
#define x first
#define y second
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define eps (double)1e-9
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pdbs;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
//void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
// look for  all edge cases
//search for a pattern

//const int nax = 1e5 + 2;
 




signed main() {    
    ios::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
    
    int n;
    cin >> n;
    
    string s;
    cin >> s;
    
    int cnt =0;
    for(int i =0 ; i < n; i++){
		if(s[i] == 'W'){
			cnt += 1;
		}
	}
    
    int ans = min(cnt , n- cnt);
    
    int val =0;
    //debug(cnt);
    for(int i = n - 1 ; cnt > 0 ; i--){
		if(s[i] == 'R'){
			val += 1;
		}
		cnt -= 1;
	}
    
    ans = min(ans , val);
    cout<<ans;
	 
    return 0;
}


Measured memory_bytes: 3776
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <iostream>
#include <deque>
#include <functional>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <string>
#include <vector>
#include <vector>

using namespace std;

#define int long long

#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

#define debug(x) cerr << #x << ": " << x << endl;

const int MOD = 1e9 + 7;

signed main(void)
{
  int num;

  int n; cin >> n;
  vector<vector<int>> c(n);
  for (int i = 0; i < n; ++i) {
    string s; cin >> s;
    c[i] = vector<int>(26);
    for (auto it = s.cbegin(); it != s.cend(); ++it) {
      ++c[i][(*it) - 'a'];
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 26; ++j) {
      c[0][j] = min(c[0][j], c[i][j]);
    }
  }

  string t = "";
  for (int i = 0; i < 26; ++i) {
    if (c[0][i] == 0) continue;
    for (int j = 0; j < c[0][i]; ++j) {
      t += i + 'a';
    }
  }
  
  cout << t << endl;
  
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int r = sc.NextInt();

        double answer = r * 2 * 3.141592;

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

//Write From this Line

const int mod = 1e9+7;
int main()
{
	int n ;
	cin >> n ;
	int a[n] , b[n];
	rep(i,n) cin >> a[i] >> b[i] ;
	vector<int> A(n);
	ll ans = 0 ;
	rep(i,n){
		A[i] = a[i] + b[i] ;
		ans -= b[i] ;
	}
	SORT(A);
	rSORT(A);
	rep(i,n){
		if(i%2 == 1) continue; 
		else {
			ans += A[i] ;
		}
	}
	cout << ans << endl;

	//全部一回青木くんに食わせる。
}


Measured memory_bytes: 1408
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

def main():
    s = IS()
    if len(s) == len(set(s)): print('yes')
    else: print('no')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

#define INF 10000000000LL

int f(string s, int c) {
	if (s.sz <= 2) {
		return 1 - c;
	}

	// 0
	if (c == 0) {
		int ret = 1;
		rep(i, 1, s.sz - 1) {
			if (s[i - 1] != s[i + 1]) {
				string s1;
				rep(j, 0, s.sz) {
					if (j == i)continue;
					s1 += s[j];
				}
				ret &= f(s1, 1 - c);
			}
		}
		return ret;
	}
	// 1
	else {
		int ret = 0;
		rep(i, 1, s.sz - 1) {
			if (s[i - 1] != s[i + 1]) {
				string s1;
				rep(j, 0, s.sz) {
					if (j == i)continue;
					s1 += s[j];
				}
				ret |= f(s1, 1 - c);
			}
		}
		return ret;
	}
}

unsigned int xor128(void) {
	static unsigned int x = 123456789;
	static unsigned int y = 362436069;
	static unsigned int z = 521288629;
	static unsigned int w = 88675123;
	unsigned int t;

	t = x ^ (x << 11);
	x = y; y = z; z = w;
	return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}


int f1(string s) {
	ll a = 0;
	ll b;
	if (s[0] == s[s.sz - 1]) {
		if (s.sz % 2 == 0) {
			b = 0;
			cout << "First" << endl;
		}
		else {
			b = 1;
			cout << "Second" << endl;
		}
	}
	else{
		if (s.sz % 2 == 1) {
			b = 0;
			cout << "First" << endl;
		}
		else {
			b = 1;
			cout << "Second" << endl;
		}
	}
	if(a==b){
		return 1;
	}
	else{
		return 0;
	}
}

int main(){
	string s;
	cin>>s;
	string ss = "abcdefghijklmnopqrstuvwxyz";
	rep(i,0,1){
		ll d = xor128()%10+2;
		string s2;
		rep(i,0,d){
			s2 += ss[xor128()%26];
		}
		if(f1(s)==1){
			//cout << "fail" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);
template<typename T>
inline void read(T& x)
{
	x=0;char c=getchar();
	while(!isdigit(c)) c=getchar();
	while(isdigit(c)) x=x*10+c-'0',c=getchar();
}
std::mt19937 rnd(time(NULL));
int main()
{
	int n,k,s;
	read(n),read(k),read(s);
	for(int i=1;i<=k;++i) printf("%d ",s);
	for(int i=k+1;i<=n;++i)
	{
		int tp;
		while(tp<=0||tp<s) tp=rnd();
		printf("%d ",tp%100000000);
	}
	puts(" ");
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	int n;
	cin >> n;
	while(n > 0){
		if(n%10 == 7){
			cout << "Yes" << endl;
			return 0;
		}else{
			n /= 10;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3564
import itertools
N,A,B,C=map(int,input().split())
l = [int(input()) for _ in range(N)]
ans = 10**9
lis = itertools.product([0,1,2,3],repeat=N)
for i in lis:
    At=0; Bt=0; Ct=0
    Al=0; Bl=0; Cl=0
    cnt=0
    for j in range(N):
        if i[j]==1:
            At+=1
            Al+=l[j]
        if i[j]==2:
            Bt+=1
            Bl+=l[j]
        if i[j]==3:
            Ct+=1
            Cl+=l[j]
    if At*Bt*Ct==0:
        continue
    ans = min(ans,abs(Al-A)+abs(Bl-B)+abs(Cl-C)+(At+Bt+Ct-3)*10)
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
int main() {
	int n, a, min = 1e9, cnt;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		cnt = 0;
		while (a % 2 == 0) {
			a /= 2;
			cnt++;
		}
		if (cnt < min) min = cnt;
	}
	printf("%d\n", min);
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[15];
int n;
inline long long dfs(int x,long long sum,int last)
{
	long long ml=0;
	for(int i=last;i<=x;i++)
		ml=ml*10+s[i]-'0';
	if(x>=n)
		return sum+ml;
	return dfs(x+1,sum+ml,x+1)+dfs(x+1,sum,last);
}
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	printf("%lld\n",dfs(1,0,1));
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	char a,b,ans='A';
	while(scanf(" %c,%c",&a,&b)!=EOF)
	{
		if(a==ans) ans=b;
		else if(b==ans) ans=a;
	}
	printf("%c\n",ans);
  return 0;
}

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

int main(void){
    int n;
    cin>>n;
    double sum=0;
    int maxi=0;
    vector<int> data(n);
    for (int i=0; i<n; i++) {
        cin>>data.at(i);
        sum += data.at(i);
        maxi = max(maxi,data.at(i));
    }
    
    if(sum/2>maxi){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
constexpr auto MOD = 1000000007;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;

string s;
long long n, k;

long long mod(const long long &a){
  if (a >= 0)return a % 1000000007;
  return 1000000007 - (-a) % 1000000007;
}
int mod(const int &a){
  if (a >= 0)return a % 1000000007;
  return 1000000007 - (-a) % 1000000007;
}long long modpow(long long a, long long b)
{ //mod(a^b)を求める
  if (!b)
  {
    return 1;
  }
  if (b < 0)
  {
    long long ret = 1;
    b = mod(-b);
    ret = modpow(a, MOD - 1 - b);
    return ret;
  }
  long long ret = 1;
  vector<long long> mem(100); //a^(2^k)をメモる
  mem[0] = a;
  for (int i = 1; i < 100; i++)
  {
    mem[i] = mod(mem[i - 1] * mem[i - 1]);
  }
  int now = 0;
  while (b)
  {
    if (b & 1)
    {
      ret = mod(ret * mem[now]);
    }
    b >>= 1;
    now++;
  }
  return ret;
}
long long fact(long long a)
{
  long long ret = 1;
  for (int i = 1; i <= a; i++)
  {
    ret = mod(ret * i);
  }
  return ret;
}

ll fc[100010];
ll rfc[100010];

void fun(){
  fc[0] = 1;
  rfc[n] = modpow(fact(n), -1);
  for (int i = 0; i < n; i++)
  {
    fc[i + 1] = mod(fc[i] * (i + 1));
  }
  for (int i = 0; i < n; i++)
  {
    rfc[n-i-1] = mod(rfc[n-i] * (n-i));
  }
}

int main()
{
  cin >> n >> k;
  VLL a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  fun();
  ll ans = 0;
  for (int i = 1; i <= n - k + 1; i++)
  {
    ans += mod((a[n  - i] - a[i-1]) * mod(mod(fc[n - i] * rfc[n - i - k + 1]) * rfc[k - 1]));
  }
  cout << mod(ans) << endl;
}


Measured memory_bytes: 2560
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map(String::toLong)

    if (aList.all { it == 0L }) {
        println("Yes")
        return
    }
    if (n % 3 != 0) {
        println("No")
        return
    }

    val aGroup = aList.groupBy { it }
    if (aGroup.size == 2 && aGroup[0]!!.size == n / 3) {
        println("Yes")
        return
    }
    if (aGroup.size == 3) {
        val (k1, k2, k3) = aGroup.keys.toList()
        if ((k1 xor k2 xor k3) == 0L
                && aGroup[k1]!!.size == aGroup[k2]!!.size
                && aGroup[k1]!!.size == aGroup[k3]!!.size) {
            println("Yes")
            return
        }
    }
    println("No")
}

Measured memory_bytes: 60080
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    N,=pin()
    AB=[tupin() for _ in range(N)]
    AB.sort(key=lambda x:x[1])
    #print(AB)
    time=0
    for i in range(N):
        time+=AB[i][0]
        if time>AB[i][1]:
            print("No")
            return
    print("Yes")
        
#%%submit!
resolve()


Measured memory_bytes: 79728
#include <stdio.h>
int main(){
int n;
scanf("%d",&n);
printf("%d:",n);
while(n%2==0){
n/=2;
printf(" 2");
}
for(int i=3;i*i<=n;i++){
while(n%i==0){
n/=i;
printf(" %d",i);
}
}
if(n!=1)printf(" %d",n);
printf("\n");
}

Measured memory_bytes: 2760
// Practice AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    let mut vs = vec![0; 60];
    for _ in 0..n {
        let p = get!();
        for i in 0..60 {
            vs[i] += (p >> i) & 1;
        }
    }
    let mut ans = 0;
    const MOD: i64 = 1e9 as i64 + 7;
    let mut p = 1;
    for ones in vs {
        let zeros = n - ones;
        ans += (zeros * ones % MOD) * p % MOD;
        ans %= MOD;
        p *= 2;
        p %= MOD;
    }
    println!("{}", ans);
}

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

int main() {
  //ifstream cin("in.txt");
  int n;
  while (cin >> n) {
    if (n == 0) break;
    vector<double> S(n);
    for (int i = 0; i < n; i++) cin >> S[i];
    double m = accumulate(S.begin(), S.end(), 0);
    double sd = 0;
    for (int i = 0; i < n; i++) sd += (n * S[i] - m) * (n * S[i] - m);
    cout << fixed << setprecision(8) << sqrt(sd / n) / n << endl;
  }
  return 0;
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

signed
main() {
		ll x;
		cin >> x;
		ll ans = 2 * (x / (5+6));
		ll remain = x % (5+6);
		if(1<= remain && remain <= 6) ans++;
		else if(6 < remain) ans += 2;

		cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
#include<complex>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

const int MAXN = 1010;
int w[MAXN];
bool done[MAXN];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, mini = 100000;
    cin >> n;
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
        cin >> w[i];
        mp[w[i]] = 0;
        mini = min(mini, w[i]);
    }
    {
        int k = 0;
        for (auto& p : mp) p.second = k++;
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (done[i]) continue;
        int cnt = 0, now = i, mi = 100000, sum = 0;
        while (1) {
            if (done[now]) break;
            cnt++;
            done[now] = true;
            mi = min(mi, w[now]);
            sum += w[now];
            now = mp[w[now]];
        }
        int tmp = sum+(cnt-2)*mi;
        tmp = min(tmp, sum+mi+mini*(cnt+1));
        ans += tmp;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n,a[N],b[N],c[N],d[N],u,v,w;
int main () {
    scanf("%d",&n);
    for(int i=1;i<=n;i+=1) scanf("%d",a+i);
    for(int i=1;i<=n;i+=1) {
        if(a[i]%4==0) b[++u]=i;
        else if(a[i]%2==0) c[++v]=i;
        else d[++w]=i;
    }
    if(w==0) puts("Yes");
    else {
        if(v==0) {
            if(u+1<w) puts("No");
            else puts("Yes");
        }
        else {
            if(u<w) puts("No");
            else puts("Yes");
        }
    }
    return 0;
}


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

int main(){
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  if(b-a<=k && c-a<=k && d-a<=k && e-a<=k && c-b<=k && d-b<=k && e-b<=k && d-c<=k &&
  e-c<=k && e-d<=k){
    cout << "Yay!" << endl;
  }
  else{
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    ll N, M;
    cin >> N >> M;
    vector<ll>dp(1 << N, INF);
    dp[0] = 0;
    rep(i, M){
        ll a, b;
        cin >> a >> b;
        ll flg = 0;
        rep(j, b){
            ll c;
            cin >> c;
            flg += (1 << (c - 1));
        }
        rep(from, 1 << N){
            ll to = from | flg;
            chmin(dp[to], dp[from] + a);
        }
    }
    if(dp[(1 << N) - 1] == INF)cout << -1 << endl;
    else cout << dp[(1 << N) - 1] << endl;

    return 0;
}


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

using namespace std;
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007
#define INF (1<<28)
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define floot10 cout<<fixed<<setprecision(10);
#define int long long
int a[600000];

signed main(){
	int ans[100][100]={};
	int n,d,k,v;
	cin>>n;
	lp(i,n){
		cin>>d>>k;
		lp(j,k){
			cin>>v;
			ans[d-1][v-1]=1;
		}
	}
	lp(i,n){
		lp(j,n){
			if(j!=0)cout<<" ";
			cout<<ans[i][j];
		}
		cout<<endl;
	}
	return 0;
}



Measured memory_bytes: 3176
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

int main(){
	int n,m,x[100000],ans = 0,p[100000] = {},cnt[100000] = {};
	map<int,int> mp;
	cin >> n >> m;
	for(int i = 0;i < n;i++) {
		cin >> x[i];
		mp[x[i]]++;
		cnt[x[i] % m]++;
	}
	for(auto it = mp.begin();it != mp.end();it++){
		p[it->first % m] += it->second / 2;
	}
	ans += cnt[0] / 2;
	for(int i = 1;i < (m + 1) / 2;i++){
		int pa = min(cnt[i],cnt[m - i]);
		cnt[i] -= pa;
		cnt[m - i] -= pa;
		ans += pa + min(cnt[i] / 2,p[i]) + min(cnt[m - i] / 2,p[m - i]);
	}
	if(m % 2 == 0) ans += cnt[m / 2] / 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6144
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()

using namespace std;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<vector<string>> T(4);
  REP(i, N) {
    string S;
    cin >> S;
    if (S.front() == 'B' && S.back() == 'A') {
      T[2].push_back(S);
    } else if (S.back() == 'A') {
      T[0].push_back(S);
    } else if (S.front() == 'B') {
      T[1].push_back(S);
    } else {
      T[3].push_back(S);
    }
  }
  string s;
  if (T[0].size() > 0) {
    s += T[0].back(); T[0].pop_back();
  }
  while (T[2].size() > 0) {
    s += T[2].back(); T[2].pop_back();
  }
  if (T[1].size() > 0) {
    s += T[1].back(); T[1].pop_back();
  }
  while (T[0].size() > 0 && T[1].size() > 0) {
    s += T[0].back(); T[0].pop_back();
    s += T[1].back(); T[1].pop_back();
  }
  for (int i = 0; i < 4; i++) {
    while (T[i].size() > 0) {
      s += T[i].back(); T[i].pop_back();
    }
  }
  int ans = 0;
  REP(i, s.size() - 1) {
    if (s[i] == 'A' && s[i+1] == 'B') ans++;
  }
  cout << ans << '\n';
}


Measured memory_bytes: 896
// Karm Karta ja, Phal Ki Chinta na Kar:)
#include <bits/stdc++.h>
using namespace std;
#include<stdio.h>
typedef long long int ll;
int main()
{
    ll a,b;
    cin>>a>>b;
    if(a>=1&&a<=9&&b>=1&&b<=9)
    {
        cout<<a*b;
    }
    else
    {
        cout<<-1;
    }
}



Measured memory_bytes: 256