akhauriyash/Code-Regression huggingface dataset:
#pragma region macro
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

namespace std {
template <typename A, typename B>
string to_string(pair<A, B> p);

string to_string(const string& s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for(int i = 0; i < static_cast<int>(v.size()); i++) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for(size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto& x : v) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
};  // namespace std
#pragma endregion

void solve() {
    i64 n, p;
    std::string S;
    std::cin >> n >> p;
    std::cin >> S;
    std::reverse(S.begin(), S.end());
    std::vector<i64> modp(n);
    if(p != 2 and p != 5) {
        i64 tmp = 1;
        rep(i, n) {
            modp[i] = ((S[i] - '0') * tmp % p + p) % p;
            tmp *= 10;
            tmp %= p;
        }
        // std::cout << std::to_string(modp) << std::endl;
        std::vector<long long> s(n + 1, 0);
        std::map<long long, long long> nums;
        for(int i = 0; i < n; ++i) s[i + 1] = ((s[i] + modp[i]) % p + p) % p;
        // std::cout << std::to_string(s) << std::endl;
        for(int i = 0; i < n + 1; ++i) nums[((s[i] % p) + p) % p]++;
        // std::cout << std::to_string(nums) << std::endl;

        long long res = 0;
        for(auto it : nums) {
            long long num = it.second;  // it.first が it.second 個あ る
            res += num * (num - 1) / 2;
        }
        std::cout << res << std::endl;
    } else {
        rep(i, n) {
            modp[i] = ((S[i] - '0') % p + p) % p;
        }
        i64 res = n * (n + 1) / 2;
        rep(i, n) {
            if(modp[i] != 0) {
                res -= n - i;
            }
        }
        std::cout << res << std::endl;
    }
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 4100
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m, r;

int main() {
	cin >> n >> m;
	
	r = 0;
	for(ll i = n; i*i <= m; i++){
		if(m%i == 0){
			r = m/i;
			break;
		}
	}
	if(r == 0){
		for(ll i = n-1; i >= 1; i--){
			if(m%i == 0 && m/i >= n){
				r = i;
				break;
			}
		}
	}
	cout << r;
	return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;
use std::collections::VecDeque;

fn main() {
    input!{
      n: usize,
      m: usize,
      xys: [(usize, usize); m],
    }

    let mut edges = vec![vec![]; n];
    let mut h = vec![0; n];
    for &(x, y) in xys.iter() {
        edges[x-1].push(y-1);
        h[y-1] += 1;
    }

    let mut st = VecDeque::new();
    for i in 0..edges.len() {
        if h[i] == 0 {
            st.push_back(i);
        }
    }

    let mut nodes = vec![];
    while let Some(i) = st.pop_front() {
        nodes.push(i);
        for &t in edges[i].iter() {
            h[t] -= 1;
            if h[t] == 0 {
                st.push_back(t);
            }
        }
    }
    let mut dp = vec![0; n];

    for &i in nodes.iter() {
        for &t in edges[i].iter() {
            dp[t] = max(dp[t], dp[i]+1);
        }
    }
    println!("{}", dp.iter().max().unwrap());
}


Measured memory_bytes: 14588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
 
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    
    ll n,a,b;
    cin>>n>>a>>b;
    if(a+b-1 > n || a*b<n){
        cout << -1 << endl;
        return 0;
    }
    while(n){
        int mi=min(a,n-(b-1));
        for(int i=n-mi+1;i<=n;i++)
        cout<<i<<' ';
        n-=mi;
        b--;
    }
}

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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;

typedef long long ll;

int main(){

    string s;
    cin >> s;

    int size = s.size();

    int ans = 0;

    rep(i, size){
        for(int j = 1; j <= size - i; j++){
            string tmps = s.substr(i, j);

            //cerr << tmps << endl;

            bool acgt = true;

            rep(k, tmps.size()){
                if(tmps[k] == 'A' || tmps[k] == 'C' || tmps[k] == 'G' || tmps[k] == 'T'){
                }else{
                    acgt = false;
                }
            }

            if(acgt){
                //cerr << tmps << endl;
                ans = max(ans, (int)tmps.size());
            }
        }
    }


    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n), b(n);
	for(int i = 0; i < n; ++i){ cin >> a[i] >> b[i]; }
	if(a == b){
		cout << 0 << endl;
		return 0;
	}
	ll minval = 1000000000;
	for(int i = 0; i < n; ++i){
		if(a[i] > b[i]){ minval = min(minval, b[i]); }
	}
	const ll answer = accumulate(b.begin(), b.end(), 0ll) - minval;
	cout << answer << endl;
	return 0;
}



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

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

int main() {
	int n, a, b, z=0;
	cin >> n >> a >> b;
	REP(i, 1, 10001){
      int x=i, y=0;
      while(x){
        y=x%10+y;
        x=x/10;
      }
      if((a<=y) && (y<=b) && i<=n) z=z+i;
    }
  	cout << z << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <climits>
#include <cstring>
#include <utility>
#include <cmath>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define F first
#define S second 
#define pb push_back
#define all(x) x.begin(),x.end()
#define endl "\n"


void print() { cout << endl; }

template <typename T, typename... Types>
void print(T arg, Types... args) {
    cout << arg << " ";
    print(args...);
}

typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef vector < int > vi;

const int mod = 1e9 + 7;
const int N = 2e5 + 7;


ll gcdExtended(ll a, ll b, ll *x, ll *y){
    if (a == 0){
        *x = 0, *y = 1;
        return b;
    }
    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);
    *x = y1 - (b/a) * x1;
    *y = x1;
    return gcd;
}

ll modInv(ll a, ll m){
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}
 
 
ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
 
ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
 
bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}

int arr[105];

int main()
{
    IOS;
    int n, m, sum = 0;
    double threshold;
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        sum += arr[i];
    }
    threshold = (sum*1.0d / (4.0d * m));
    sort(arr, arr+n, greater<int>());
    for (int i = 0; i < m; i++)
    {
        // cout << arr[i] << " " << threshold << "\n";
        if (arr[i] < threshold)
        {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 256
import math
n =int(input())
maxp = 1
for i in range(2,int(n ** 0.5) +1):
    if n % i == 0:
        maxp = i
ans = max(int(math.log10(maxp)) + 1, int(math.log10(n // maxp )) + 1)
print(ans)

Measured memory_bytes: 3060
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b = b[::-1]

ua = [0 for i in range(n)]
fa = [False for i in range(n)]
ub = [0 for i in range(n)]
fb = [False for i in range(n)]


bm = 0
for i in range(n):
    if a[i] > bm:
        ua[i] = a[i]
        fa[i] = True
        bm = a[i]
    else:
        ua[i] = bm

bm = 0
for i in range(n):
    if b[i] > bm:
        ub[i] = b[i]
        fb[i] = True
        bm = b[i]
    else:
        ub[i] = bm
ub = ub[::-1]
fb = fb[::-1]
ans = 1
m = 10**9+7

for i in range(n):
    if fa[i] and fb[i]:
        if not ua[i] == ub[i]:
            ans = 0
            break
    elif fa[i] or fb[i]:
        if ua[i] > ub[i]:
            if not fb[i]:
                ans = 0
                break
        elif ua[i] == ub[i]:
            ans = ans
        else:
            if not fa[i]:
                ans = 0
                break
    else:
        ans *= min(ua[i],ub[i])
        ans %= m
    # print(ans)

print(ans)

# print(ua)
# print(fa)
# print(ub)
# print(fb)











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

using ll = long long;
using P = pair<int, int>;

int main()
{
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i += 2)
    {
        int divisor = 0;
        for (int j = 1; j <= i; j++)
        {
            if (i % j == 0)
                divisor++;
        }
        if (divisor == 8)
            ans++;
        }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;

    int i=0;
    while(true){
        c -= b;
        if(c<=0){
            printf("Yes\n");
            return 0;
        }

         a -= d;
        if(a<=0){
            printf("No\n");
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3560
A,B=map(int,input().split())
S=input()

check=1

for i in range(A):
    if S[i]=="-":
        check=0

if S[A]!="-":
    check=0

for i in range(A+1,A+B+1):
    if S[i]=="-":
        check=0


if check==1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,K;cin>>A>>B>>C>>K;
  int m=max({A,B,C});
  for(int i=0; i<K; i++){
    m*=2;
  }
  cout<<min({A,B,C}) +(A+B+C-min({A,B,C})-max({A,B,C}))+m <<endl;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

map<int, int> cnt;

void solve(){
	int n;
	scanf("%d", &n);
	REP(i, 0, n){
		int a;
		scanf("%d", &a);
		cnt[a]++;
	}
	scanf("%d", &n);
	REP(i, 0, n){
		int a;
		scanf("%d", &a);
		if (cnt.find(a) == cnt.end() || cnt[a] == 0){
			printf("NO\n");
			return;
		}
		cnt[a]--;
	}
	printf("YES\n");
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

using namespace std;

int n, a[200000], xr;

int main()
{
  cin >> n;
  for(int i = 0; i<n; i++)
	cin >> a[i];
  for(int i = 0; i<n; i++)
	xr^=a[i];
  for(int i = 0; i<n; i++)
    cout << (xr^a[i]) << " ";
  cout << endl;
}

Measured memory_bytes: 4244
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<string>
#include<algorithm>
#include<math.h>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<list>
#include<set>
#include<map>
#include<bitset>
#include<iterator>
#include <stack>
#define ll long long
typedef long double ld;
#define all(v) ((v).begin()),((v).end())
#define vec2(n,m) vector<vector<ll>>vv(n + 10, vector<ll>(m + 10, 0));
#define p_q1   priority_queue<int,vector<int>,greater<int>>pq1;
#define format(n) fixed<<setprecision(n)
#define ll_min LLONG_MIN;
#define ll_max LLONG_MIN;
#define endl "\n"
#define F first 
#define S second
#define mkpr(x,y)  make_pair(x,y)
using namespace std;
void weza()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
int main()
{
	weza();
	ll t, n, m, c,a,d,b;
    cin >> n;
    map<string, int>mp;
    string s;
    for (int i = 0; i < n; i++)
    {
        cin >> s;
        mp[s]++;
    }
    cout << mp.size() << endl;
}


Measured memory_bytes: 18852
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll const N=1e3;
ll INF=0x3f3f3f3f;
int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    if(a>b)
    {
        swap(a,b);
    }
    if(b>c)
    {
        swap(b,c);
    }
    if( (a==b&&b!=c) ||(a!=b&&b==c) || (a==c&&b!=a) )
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
    return 0;
}


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

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	
	int n, k;
	long long res = 0;

	cin >> n >> k;
	for (int b = k + 1; b <= n; ++b) {
		for (int i = k; i <= n; i += b) {
			int j = min(n, i - k + b - 1);
			res += max(0, j - i + 1);
		}
	}

	cout << res - ((k == 0) ? n : 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=1000005;
#define M 1000000007
#define double long double
#define BINF 1000000000000001
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 15000001
const int LG = 22;

int C[4005][4005]; 

void binomialCoeff(int n, int k){ 
  
    int i, j; 
    for (i = 0; i <= n; i++) { 
        for (j = 0; j <= min(i, k); j++) { 
            if (j == 0 || j == i) 
                C[i][j] = 1; 
            else
                C[i][j] = (C[i - 1][j - 1] + C[i - 1][j])%M; 
        } 
    } 
}


#undef int 
int main() { 
#define int long long int 
 
ios_base::sync_with_stdio(false); 
cin.tie(0); 
cout.tie(0); 

	int n,k;
	binomialCoeff(4002,4002);
	cin >> n >> k;

	cout << n - k + 1 << endl;
	int B = k;
	int R = n - k;

	if(R == 0){
		for(int i = 2; i <= k; i++)
			cout << 0 << endl;
		return 0;
	}

	
	for(int i = 2; i <= k; i++){
		int ans = 0;
		int x = C[B - 1][i - 1];
		int y = C[R - 1][i - 2] + C[R - 1][i - 1] * 2 + C[R - 1][i];
		ans = (x * y) % M;
		cout << ans << endl;

	}
	

	
	

	
return 0;
}


Measured memory_bytes: 123776
#include<iostream>
#include <algorithm>
#include<string>
#include<math.h>
#include <functional>
using namespace std;

int main(void) {
	int N;
	int C[500], S[500], F[500] = { 0 };
	int t=0;
	cin >> N;
	for (int i = 0; i < N-1;i++) {
		cin >> C[i] >> S[i] >> F[i];
	}
	for (int i=0;i<N;i++) {
		t = 0;
		for (int j = i;j < N-1;j++) {
			if (t < S[j])
				t = S[j];
			else if (t%F[j] == 0)
				;
			else
				t = t + F[j] - t%F[j];
			t += C[j];

		}
		cout << t << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
using u8t = std::uint64_t;
using i8t = std::int64_t;
#define F(I,N) for(i8t I=0,I##_N=N;I<I##_N;I++)
#define FR(I,N) for(i8t I=N;I--;)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(_i,N){R(_x)V.push_back(_x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL1(line)
#define RM(V,L,C) std::vector<char> V;F(_i,L){RL(_l)F(_j,C)V.push_back(_l[_j]);}
#define P(X) std::cout<<(X)<<std::endl;
int main() {
  RL(str);
  if(str=="ABC")
    {P("ARC");}
  else
    {P("ABC");}
  return 0;
}


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

#define fi first
#define se second
#define endl '\n'
#define lc (rt<<1)
#define rc (rt<<1|1)
#define mp make_pair
#define pb push_back
#define lowbit(a) (a&(-a))
#define sz(x) (int)(x).size()
#define all(x) x.begin(),x.end()
#define mst(a,v) memset(a,v,sizeof(a))
#define debug(x) cout<<#x": "<<x<<'\n';
#define IOS {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

const int N=1000010;
const int mod=1e9+7;
const ld PI=acos(-1.0);
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;

template<typename T>inline void gmax(T &A,T B) {(A<B)&&(A=B);}
template<typename T>inline void gmin(T &A,T B) {(A>B)&&(A=B);}

template <class T>
inline bool re(T &ret)
{
    char c;
    int sgn;
    if(c=getchar(),c==EOF) return 0;
    while(c!='-'&&(c<'0'||c>'9')) c=getchar();
    sgn=(c=='-')?-1:1;
    ret=(c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
    ret*=sgn;
    return 1;
}



int main()
{
#ifdef local
    //freopen("in.txt", "r", stdin);
#endif
    IOS;
    int a,b;
    cin>>a>>b;
    if(b%a==0) cout<<a+b;
    else cout<<b-a;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
const long double PI=(acos(-1));
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  int n;
  cin>>n;
  int ans=0;
  for(int i=1;i<=n;i+=2){
    int count=0;
    for(int j=1;j<=i;j++){
      if(i%j==0){
        count++;
      }
    }
    if(count==8){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;
 
void Main() {
  int x;
  R x;
  cout << "ABC" << x << endl;
}
 
int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int d[] = new int[N];
        int health = 0;
        for (int i = 0; i < N; i++) {
            d[i] = scanner.nextInt();
        }

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                if (i != j) health += d[i] * d[j];
            }
        }

        System.out.println(health / 2);
    }
}

Measured memory_bytes: 21844
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
#define T int t = 0; cin >> t; while(t--)
#define b_e(a) a.begin(), a.end()
typedef long long ll;
typedef  long double lld;
const ll mod = 1e9 + 7;
const ll mx = 1e5 + 1;

void input(){
    int n; cin >> n;
    map<int, int>m;
    string flag("YES");
    f(i, n){
        int x  =0;
        cin >> x;
        if(m[x])flag = "NO";
        ++m[x];
    }
    cout << flag << endl;
}
int main(){
    input();
    return 0;
}

Measured memory_bytes: 9600
#include<stdio.h>

int main(void){
    unsigned long long n;
    scanf("%llu",&n);
    long long tmp,i = 1;
    while(i * i <= n){
        if(!(n % i))tmp = i;
        i++;
    }
    printf("%lld",(tmp - 1) + ((n / tmp) - 1));
    return 0;
}

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

using namespace std;

int a[200005],f[200005];
int n;
long long k;
bool ok(long long x)
{
    long long sum=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]*1LL*f[n-i+1]>x)
            sum+=a[i]-x/f[n-i+1];
    }
    return sum<=k;
}

int main()
{
    long long l,r,mid;
    scanf("%d%lld",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=n;i++)
        scanf("%d",&f[i]);
    sort(a+1,a+1+n);
    sort(f+1,f+1+n);
    l=0;
    r=1000000;
    r=r*r;
    while(l!=r)
    {
        mid=(l+r)/2;
        if(ok(mid))
            r=mid;
        else
            l=mid+1;
    }
    printf("%lld\n",l);
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(){
  int N;
  unsigned long long int ans=0;
  scanf("%d",&N);
  for(int i=1;i<=N;i++){
    if(i%3!=0 && i%5!=0){
      ans += i;
    }
  }
  printf("%lld",ans);
  return 0;
}

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

using namespace std;

const int N=2e3+10;

int n,k,m,a[N],b[N];


bool check(int dist){
        for(int en=1;en<=n;en++){
                for(int i=1;i<=n;i++) {
                        if (a[i]<a[en]-dist) b[i]=0;
                        else if (a[i]>a[en]) b[i]=2;
                        else b[i]=1;
                }
   //             cout<<dist<<" "<<en<<'\n';
     //           for(int i=1;i<=n;i++) cout<<b[i]<<" ";
       //         cout<<'\n';
                int usable=0;
                for(int jen=1;jen<=n;jen++) if (b[jen]!=0){
                        int jst=jen;
                        while (jen<=n&&b[jen]!=0) jen++;

                        int out=0;
                        for(int L=jst,R=jst;L<=jen-k-out;){
                                while (R<L+k+out&&b[R]!=1) R++;
                                if (R<L+k+out){
                                        usable++;
                                        out++;
                                        R++;
                                }else L++;
                        }
                }
         //       cout<<usable<<'\n';
                if (usable>=m) return 1;
        }
        return 0;
}
int main(){

        cin>>n>>k>>m;
        for(int i=1;i<=n;i++) cin>>a[i];
        int L=0,R=1e9+10;
        while (L<=R){
                int mid=(L+R)/2;
                if (!check(mid)) L=mid+1;
                else R=mid-1;
        }
        cout<<L;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a,b,c,t,n,k,ct=0,r;
    string s;
    vector<ll>v;
    set<ll>st;
    map<ll,ll>mp;
    cin>>s;
    if(s=="ABC") cout<<"ARC"<<endl;
    if(s=="ARC") cout<<"ABC"<<endl;
}




Measured memory_bytes: 3596
#include<stdio.h>

int main()

{

	int a,b,c;

	scanf("%d %d %d", &a,&b,&c);

	if (a < b)
		if (b < c){ printf("Yes\n"); }
		else{ printf("No\n"); }

	else{ printf("No\n"); }

	return 0;

}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;
  cout << max((A+B),max((A-B),(A*B)));
  
}

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

int N;
int A[200010];

int cnt[200010];

int comb(int n, int r)
{
	int i;
	int p = 1;
	for (i = 1; i <= r; i++)
	{
		p = p * (n - i + 1) / i;
	}
	return p;
}

signed main()
{
	cin >> N;
	REP(i, N)
	{
		cin >> A[i];
		cnt[A[i]]++;
	}

	int c = 0;
	for (int i = 0; i <= N; i++)
	{
		c += comb(cnt[i], 2);
	}

	for (int i = 0; i < N; i++)
	{
		int ans = c - (cnt[A[i]] - 1);
		cout << ans << endl;
	}
}




Measured memory_bytes: 4736
//#include <bits/stdc++.h>
//
//#define MAXN 100010
//#define ll long long
//#define mod 1000000007
//
//using namespace std;
//
//int n, m, k, len;
//int ans, tot;
//
//int a[MAXN];
//
//string s;
//
//void change() {
//	if ()
//}
//
//int main(){
//	int t;
//	scanf("%d", &n);
//	a[1] = 1;
//	len = 1;
//	for (int i = 2; i <= n; i++) {
//		change();
//	}
//	for (int i = 1; i <= len; i++) {
//		cout << a[i];
//	}
//	cout << endl;
//	return 0;
//}

#include <bits/stdc++.h>

#define MAXN 100010

using namespace std;

int siz;
int k;

int a[MAXN];

int main() {
	scanf("%d", &k);
	siz = 1, a[1] = 1;
	for(int i = 2; i <= k; ++i) {
		for(int j = siz; j >= 1; --j) {
			if ((j > 1 && a[j] < a[j - 1] + 1 && a[j] < 9) || (j == 1 && a[j] < 9)) {
				++a[j];
				for(int k = j + 1; k <= siz; ++k) {
					a[k] = max(0, a[k - 1] - 1);
				}
				goto ENd;
			}
		}
		++siz;
		a[1] = 1;
		for(int j = 2; j <= siz; ++j) {
			a[j] = 0;
		}
		ENd:;
	}
	for(int i = 1; i <= siz; ++i) {
		printf("%d", a[i]);
	}
	return 0;
}


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

const int INF = 1 << 30;

int main() {
    int N; cin >> N;
    vector<vector<int>> G(N);
    for(int i = 0; i < N - 1; ++i) {
        int a, b; cin >> a >> b;
        a--, b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }

    int K; cin >> K;
    vector<int> P(N, -1);
    int v, p;
    for(int i = 0; i < K; ++i) {
        cin >> v >> p; v--;
        P[v] = p;
    }

    vector<int> parity(N);

    auto pfs = [&](auto &&pfs, int cur, int pre, int p) -> bool {
        parity[cur] = p;
        if(P[cur] != -1 and P[cur] % 2 != parity[cur]) return false;
        bool res = true;
        for(auto &to : G[cur]) {
            if(to == pre) continue;
            res &= pfs(pfs, to, cur, 1 - p);
        }
        return res;
    };

    if(!pfs(pfs, v, v, P[v] % 2)) return cout << "No" << '\n', 0;

    vector<pair<int, int>> rng(N);

    auto dfs = [&](auto &&dfs, int cur, int pre) -> pair<int, int> {
        int l = -INF, r = INF;
        for(auto &to : G[cur]) {
            if(to == pre) continue;
            int tl, tr; tie(tl, tr) = dfs(dfs, to, cur);
            tl--, tr++;
            l = max(l, tl), r = min(r, tr);
        }
        if(P[cur] != -1) l = max(l, P[cur]), r = min(r, P[cur]);
        while(abs(l) % 2 != parity[cur]) l++;
        while(abs(r) % 2 != parity[cur]) r--;
        return rng[cur] = {l, r};
    };

    dfs(dfs, v, v);
    for(int i = 0; i < N; ++i) {
        if(rng[i].first > rng[i].second) return cout << "No" << '\n', 0;
    }

    auto efs = [&](auto &&efs, int cur, int pre, int n) -> void {
        P[cur] = n;
        assert(rng[cur].first <= n and n <= rng[cur].second);
        for(auto &to : G[cur]) {
            if(to == pre) continue;
            int l, r; tie(l, r) = rng[to];
            if(l <= n + 1 and n + 1 <= r) efs(efs, to, cur, n + 1);
            else efs(efs, to, cur, n - 1);
        }
    };
    efs(efs, v, v, P[v]);

    cout << "Yes" << '\n';
    for(int i = 0; i < N; ++i) {
        cout << P[i] << '\n';
    }
    return 0;
}


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

int main() {
  int x1,y1,x2,y2;
  cin >>  x1 >> y1 >> x2 >>y2;
  int x = x2 - x1;
  int y = y2 - y1;

  cout << x2-y << " " << y2+x << " " << x1-y << " " << y1+x << endl;
  return 0;

}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){
  int n;
  cin >> n;
  vector<pair<ll int, ll int> > vp;
  REP(i, n){
    ll int a, b;
    cin >> a >> b;
    vp.pb(mp(-b, -a));
  }

  sort(All(vp));

  ll int nowtime = (-1 * vp[0].first) - (-1 * vp[0].second);
  // cout << nowtime << endl;
  bool flag = false;
  if(nowtime < 0) flag = true;
  FOR(i, 1, n){
    nowtime = min(-1 * vp[i].first, nowtime);
    nowtime -= (-1 * vp[i].second);
    // cout << nowtime << endl;
    if(nowtime < 0) flag = true;
  }
  cout << (flag ? "No" : "Yes") << endl;

}

Measured memory_bytes: 5616
infoNum = input().split()
W = int(infoNum[0])
H = int(infoNum[1])
x = int(infoNum[2])
y = int(infoNum[3])
r = int(infoNum[4])

if ((x + r) <= W) and ((y + r) <= H) and ((x - r) >= 0) and ((y - r) >= 0):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5596
package main

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

var sc = bufio.NewScanner(os.Stdin)
func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	
	k,x := scanInt(),scanInt()
	var begin,end int

	if -1000001 < x-k+1 {
		begin = x-k+1
	} else {
		begin = -1000000
	}

	if 1000001 > x+k {
		end = x+k
	} else {
		end = 1000000
	}

	for i := begin; i < end; i++ {
		fmt.Print(i)
		if i == end {
			fmt.Println()
		} else {
			fmt.Print(" ")
		}
	}
}


Measured memory_bytes: 640
#include<stdio.h>

int main(){
    int n,x,count=1,now=0;
    scanf("%d %d",&n,&x);
    int l[n];
    for(int i=0;i<n;i++){
        scanf("%d",&l[i]);
    }
    for(int i=0;i<n;i++){
        now=now+l[i];
        if(now>x)break;
        count++;
    }
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int,int>;
using pq = priority_queue<int>;
typedef long long ll;
typedef long double ld;
#define pi 3.14159265358979

int  main()
{
	int a,b,h;
	cin >> a >> b >> h;
	cout << (a + b) * h / 2 << endl;
	return 0;
}


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

typedef long long ll;


int main()
{
  ll x,y;
  cin >> x >> y;
  ll flag = 1;
  ll x1 = x;
  ll count = 1;
  while(flag){
    x1 = x1*2;
    if(x1 <= y) count++;
    if(x1 > y) flag = 0;
  }
  cout << count << endl;
  return 0;

}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
# pragma GCC target("avx2")
# pragma GCC optimize("O3")
# pragma GCC optimize("unroll-loops")
# define int long long

using namespace std;

const int N = 3e5 + 7;
const int mod = 1e7;

int dp[N][3], a[N], b[N], c[N];

int32_t main() {
    speed;
    int n;
    cin >> n;
    for ( int i = 1; i <= n; i++ ) {
        cin >> a[i] >> b[i] >> c[i];
        dp[i][0] = dp[i][1] = dp[i][2] = 1e12;
    }
    dp[0][0] = dp[0][1] = dp[0][2] = 0;
    for ( int i = 1; i <= n; i++ ) {
        dp[i][0] = max( dp[i - 1][1], dp[i - 1][2] ) + a[i];
        dp[i][1] = max( dp[i - 1][0], dp[i - 1][2] ) + b[i];
        dp[i][2] = max( dp[i - 1][0], dp[i - 1][1] ) + c[i];
    }
    cout << max( { dp[n][0], dp[n][1], dp[n][2] } );
}


Measured memory_bytes: 8332
#include <stdio.h>
void main(){
    int n;
    scanf("%d",&n);
    long  a[n];
    for(int i = 0; i < n; i++){
        scanf("%ld",&a[i]);
    }
    long max = a[0];
    long min = a[0];
    for(int j = 1; j < n; j++){
        if(max < a[j]){
            max = a[j];
        }
        if(min > a[j]){
            min = a[j];
        }
    }
    long ans = (max - min);
    printf("%ld\n",ans);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T, typename ...Ts>
vector<T> fusion(vector<T> bs,Ts... ts){
  auto append=[&](auto vs){for(auto v:vs) bs.emplace_back(v);};
  initializer_list<Int>{(void(append(ts)),0)...};
  return bs;
}


template<typename V>
V compress(V v){
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  return v;
}
template<typename T>
map<T, Int> dict(const vector<T> &v){
  map<T, Int> res;
  for(Int i=0;i<(Int)v.size();i++)
    res[v[i]]=i;
  return res;
}
map<char, Int> dict(const string &v){
  return dict(vector<char>(v.begin(),v.end()));
}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> xs(n),ys(n);
  for(Int i=0;i<n;i++) cin>>xs[i]>>ys[i];

  auto as=compress(fusion(xs,ys));
  auto dc=dict(as);
  if(as.size()==1) drop(0);

  Int ans=(as.back()-as.front())*(as.back()-as.front());

  // togathered
  {
    Int m=dc.size();
    vector< vector<Int> > G(m);
    for(Int i=0;i<n;i++){
      G[dc[xs[i]]].emplace_back(i);
      G[dc[ys[i]]].emplace_back(i);
    }

    Int cnt=0;
    vector<Int> app(n,0);
    for(Int l=0,r=0;l<m;l++){
      while(cnt<n&&r<m){
        for(Int i:G[r]){
          if(app[i]==0) cnt++;
          app[i]++;
        }
        r++;
      }
      if(cnt<n) break;

      chmin(ans,(as.back()-as.front())*(as[r-1]-as[l]));

      for(Int i:G[l]){
        app[i]--;
        if(app[i]==0) cnt--;
      }
    }
  }

  // separated
  {
    Int p=as.back(),q=as.front();
    for(Int i=0;i<n;i++){
      chmin(p,max(xs[i],ys[i]));
      chmax(q,min(xs[i],ys[i]));
    }
    chmin(ans,(as.back()-p)*(q-as.front()));
  }

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


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int64_t> A(N + 1);
  for (int i = 0; i < N + 1; i++) {
    cin >> A[i];
  }
  if (N != 0 && A[0] != 0) {
    cout << -1 << '\n';
    return 0;
  }
  if (N == 0) {
    if (A[0] == 1) {
      cout << 1 << '\n';
    } else {
      cout << -1 << '\n';
    }
    return 0;
  }
  vector<pair<int64_t, int64_t>> X(N + 1);
  X[N] = make_pair(A[N], A[N]);
  for (int i = N - 1; i > -1; i--) {
    int64_t a = X[i + 1].first / 2 + (X[i + 1].first % 2) + A[i];
    int64_t b = X[i + 1].second + A[i];
    X[i] = make_pair(a, b);
  }
  int64_t res = 1;
  vector<pair<int64_t, int64_t>> Y(N + 1);
  Y[0] = make_pair(1, 1);
  for (int i = 1; i < N + 1; i++) {
    int64_t a = Y[i - 1].first;
    int64_t b = 2 * Y[i - 1].second;
    if ((a <= X[i].first && X[i].first <= b) ||
        (a <= X[i].second && X[i].second <= b)) {
      Y[i] = make_pair(max(a, X[i].first) - A[i], min(b, X[i].second) - A[i]);
      res += Y[i].second + A[i];
    } else {
      cout << -1 << '\n';
      return 0;
    }
  }
  cout << res << '\n';
  return 0;
}


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

int main()
{
    int m,k;
    scanf("%d%d",&m,&k);
    int v=(1<<m)-1;

    if(m==1 && k==1 || k>v)
    {
        puts("-1");return 0;

    }
    if(m==1 && k==0)
    {
        printf("0 0 1 1\n");return 0;
    }
    for(int i=0; i<=v; i++)
        if(i!=k)
            printf("%d ",i);
    printf("%d ",k);
    for(int i=v; i>=0; i--)
        if(i!=k)
            printf("%d ",i);
    printf("%d ",k);
    return 0;
}


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


int main(){
    
    int n;
    cin>>n;
    vector<long long> r(n);
    vector<long long> a(n+1);

    for(int i=0;i<n;i++){
        cin>>r[i];
        a[r[i]]++;
    }
    long long ans=0;
    for(int i=1;i<=n;i++){
        if(a[i]<2)continue;
        else{
            ans+= ((a[i]-1))*(a[i])/2;
        }
    }
    for(int i=0;i<n;i++){
       
        if(a[r[i]]<2){
            cout<<ans<<endl;
        }
        else if(a[r[i]]==2){
            cout<<ans-1<<endl;
            //cout<<t<<endl;
        }else{
            long long anss= ans- (a[r[i]]-1)*a[r[i]]/2+(a[r[i]]-1)*(a[r[i]]-2)/2;
            cout<<anss<<endl;
        }
        
    }


    return 0;
}

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

char field[7][7];
int main(){
	int h,w,k;
	cin >> h >> w >> k;
	rep(i,h){
		rep(j,w){
			cin >> field[i][j];
		}
	}
	ll ans = 0;
	rep(biti, 1<<h){
		rep(bitj, 1<<w){
			int count = 0;
			rep(i,h){
				rep(j,w){
					if(biti & (1 << i) || bitj & (1 << j)) continue;
					if(field[i][j] == '#') count++;
				}
			}
			if(count == k) ans++;
		}
	}
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3632
#include<stdio.h>
int main(){
  int n,i,j,d[10][10],a,c=1;
  while(scanf("%d",&n),n){
    a=1;
    for(i=0;i<2*n;i++){
      if(i%2){
	for(j=0;j<n;j++){//printf(" %d %d\n",j,i-j);
	  if(i-j<0)continue;
	  if(n<=i-j)continue;
	  d[j][i-j]=a++;
	}
      }
      else{
	for(j=n-1;j>-1;j--){//printf("%d %d\n",j,i-j);
	  if(i-j<0)continue;
	  if(n<=i-j)continue;
	  d[j][i-j]=a++;
	}
      }
      if(n*n<a)break;
    }
    printf("Case %d:\n",c++);
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	printf("%3d",d[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}

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

int main()
{
    string w;
    int a;
    int judge = 0;
    int n[26] = {};
    cin >> w;
    for (int i = 0; i < w.length(); i++)
    {
        a = w[i];
        n[a - 'a']++;
    }

    for (int i = 0; i < 26; i++)
    {
        if (n[i] % 2 != 0)
        {
            judge += 1;
        }
    }

    if (judge == 0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

/* -- template -- */

int main() {
    int A, B; cin >> A >> B;
    cout << A * B << endl;
}


Measured memory_bytes: 3620
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  set<int> a = {1, 2, 3};
  int x, y;
  cin >> x >> y;
  a.erase(x);
  a.erase(y);
  cout << *begin(a) << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	int a, b, t;

	while(scanf("%d%d%d", &a, &b, &t)==3)
	{
		int ans=(t/a)*b;

		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 128
s_dict = dict()
n = int(input())
for _ in range(n):
    s = input()
    if not s in s_dict:
        s_dict[s] = 1
    else:
        s_dict[s] += 1
n = int(input())
for _ in range(n):
    s = input()
    if s in s_dict:
        s_dict[s] -= 1
print(max(max(s_dict.values()), 0))

Measured memory_bytes: 62396
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()
    print(S[::2])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316