akhauriyash/Code-Regression huggingface dataset:
n = int(input())

a = list(map(int, input().split()))
X = a.pop(0)
a = set(a)
b = list(map(int, input().split()))
Y = b.pop(0)
b = set(b)
c = list(map(int, input().split()))
Z = c.pop(0)
c = set(c)

a_bar = {x for x in range(1, n+1) if x not in a}

ans = (a_bar & c) | (b & c)
print(len(ans))



Measured memory_bytes: 5624
import collections

S1 = collections.deque()
s_a = 0

S2 = collections.deque()

for i, j in enumerate(input()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            diff = i - left_edge
            s_a += diff
            new_puddle_a = diff
            while True:
                if S2:
                    if S2[-1][0] > left_edge:
                        new_puddle_a += S2[-1][1]
                        S2.pop()
                    else:
                        break
                else:
                    break
            new_puddle = (left_edge, new_puddle_a)
            S2.append(new_puddle)
        else:
            pass


print(s_a)

num_of_puddles = len(S2)
puddles = str(num_of_puddles)

for i in range(num_of_puddles):
    puddle = S2.popleft()
    puddles += ' {0}'.format(str(puddle[1]))
else:
    print(puddles)

Measured memory_bytes: 8264
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>

template <class T>
inline void read(T &x) {
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

int k, ans;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main() {
    read(k);
    for (int i = 1; i <= k; ++i) {
        for (int j = 1; j <= k; ++j) {
            for (int l = 1; l <= k; ++l) {
                ans += gcd(i, gcd(j, l));
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 3764
N = int(input())
F = []
P = []
for i in range(N):
	F.append(list(map(int, input().split())))
for i in range(N):
	P.append(list(map(int, input().split())))

res = -1e20
for i in range(2**10):
	bs = format(i, "#012b")[2:]
	
	if bs == "0000000000": continue
	cnt = 0
	
	for j in range(N):
		tmp = 0
		for k in range(10):
			if F[j][k] == 1 and bs[k] == '1':
				tmp+=1
		cnt += P[j][tmp]
	
	res = max(cnt, res)
print(res)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in);) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			
			if( y < x*2 || x*4 < y) {
				System.out.println("No");
			}else if(y % 2 != 0) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			


		}catch(Exception e) {
			e.printStackTrace();

		}

	}
}


Measured memory_bytes: 35768
import numpy as np

N = int(input())

S = list(map(int,input().split()))
T = list(map(int,input().split()))
U = np.array(list(map(int,input().split())),dtype = np.uint64)
V = np.array(list(map(int,input().split())),dtype = np.uint64)

ans = np.zeros((N,N),dtype = np.uint64)

for n in range(64):
  u = (U>>n)&1
  v = (V>>n)&1
  su = [int(S[i]*2+u[i]) for i in range(N)]
  tv = [int(T[i]*2+v[i]) for i in range(N)]
  suzerozero = []
  suoneone = []
  tvzerozero = []
  tvoneone = []
  for i in range(N):
    if su[i] == 0:
      suzerozero.append(i)
    if su[i] == 3:
      suoneone.append(i)
  for i in range(N):
    if tv[i] == 0:
      tvzerozero.append(i)
    if tv[i] == 3:
      tvoneone.append(i)
  
  b = np.zeros((N,N),dtype = np.uint64)
  ###行のAND=1とOR=0を埋める###
  for i in range(N):
    if su[i] == 1:
      b[i] = np.ones(N,int)
  ###列のAND=1とOR=0を埋める###
  for i in range(N):
    if tv[i] == 1:
      b[:,i] = np.ones(N,int)
  ###行と列の値が一致するところを埋める###  
  b |= np.dot(np.array([u]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([v]).T,np.ones((1,N),dtype = np.uint64)).T
  ###行のOR=1を満たしていく### 
  if 1 not in tv and 3 not in tv:
    m = len(tvzerozero)
    now = 0
    for i in suoneone:
      b[i][tvzerozero[now%m]] += 1
      now += 1
  ###列のOR=1を満たしていく### 
  if 1 not in su and 3 not in su:
    m = len(suzerozero)
    now = 0
    for i in tvoneone:
      b[suzerozero[now%m]][i] += 1
      now += 1
  ans += b<<n

def end():
  print(-1)
  exit()
for i in range(N):
  if S[i] == 0:
    now = ans[i][0]
    for j in range(1,N):
      now &= ans[i][j]
  if S[i] == 1:
    now = ans[i][0]
    for j in range(1,N):
      now |= ans[i][j]
  if now != U[i]:
    end()
for i in range(N):
  if T[i] == 0:
    now = ans[0][i]
    for j in range(1,N):
      now &= ans[j][i]
  if T[i] == 1:
    now = ans[0][i]
    for j in range(1,N):
      now |= ans[j][i]
  if now != V[i]:
    end()

for item in ans:
  print(*list(item))


Measured memory_bytes: 37348
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>
#include<set>
#include<stdio.h>
#include<string.h>

#define ll long long 
#define ull unsigned long long
#define ld long double
#define all(vec) (vec).begin(),(vec).end()
#define allr(vec) (vec).rbegin(),(vec).rend()
#define viewVec(vec) for(auto i:(vec))cout << i << " ";cout << endl
using namespace std;

ll  a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;
ll ans = 0, sum = 0, mn = 1e18, mx = 0, cnt = 0;
const ll M = 1000000007;

map<string, int>mp;
vector<string>vec;
vector<int>vec2;
//vector<int>res;
//                                                   gcd/lcm--f***ing--long long


ll gcd(ll a, ll b) { if (b == 0)return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a*b) / gcd(a, b); }


/*(constructive)*/

int freq[10] = {};
bool valid(int n)
{
	string s = to_string(n);
	bool flag = true;
	for (int i = 0; i < s.size(); i++)
	{
		if (freq[s[i] - '0'] >= 1)return false;
	}
	return true;
}

int main()
{
	cin >> n >> k;
	for (int i = 0; i < k; i++)
	{
		cin >> x;
		freq[x]++;
	}
	while (true)
	{
		if (valid(n))break;
		n++;
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn main() {
    let n: u32 = read();

    let mut d: Vec<u32> = (1..n+1).map(|_| read()).collect();

    d.sort();

    let mut count = 0;
    let mut previous = 0;
    for n in d {
        if n > previous {
            previous = n;
            count += 1;
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

int n, m;
int x, y;

int a[110][110];

char buf[110];
void in(){
	read(n, m);
	for(int i=1; i<=n; ++i){
		scanf("%s", buf+1);
		for(int j=1; j<=m; ++j){
			a[i][j]=a[i-1][j]+a[i][j-1]-a[i-1][j-1];
			if(buf[j] == 'o'){
				++a[i][j];
			} else if(buf[j] == 'E'){
				x=i; y=j;
			}
		}
	}
}

int dp[102][102][102][102];

int rect(int L1, int R1, int D1, int U1, int L2, int R2, int D2, int U2){
	int L=max(L1, L2);
	int R=min(R1, R2);
	int D=max(D1, D2);
	int U=min(U1, U2);
	if(L>R || D>U) return 0;
	if(0) printf("%d %d %d %d\n", L, R, D, U);
	return a[R][U]-a[L-1][U]-a[R][D-1]+a[L-1][D-1];
}

int main()
{
	in();
	for(int w=1; w<=n; ++w){
		for(int h=1; h<=m; ++h){
			for(int l=1; l+w-1<=n; ++l){
				int r=l+w-1;
				if(x<l || r<x) continue;
				for(int d=1; d+h-1<=m; ++d){
					int u=d+h-1;
					if(y<d || u<y) continue;
					int me=dp[l][r][d][u];
					auto f = [&](int A, int B, int C, int D){
						int I=l+A;
						int J=r+B;
						int K=d+C;
						int L=u+D;
						int nv = rect(1+(r-x), n-(x-l), 1+(u-y), m-(y-d),
							(A||B)?(A?I:J):(I),
							(A||B)?(A?I:J):(J),
							(C||D)?(C?K:L):(K),
							(C||D)?(C?K:L):(L)
						);
						int& T=dp[I][J][K][L];
						if(T < me+nv){
							if(0) printf("upd from %d-%d, %d-%d to df %d %d %d %d : %d+%d = %d\n",
								l,r,d,u, A,B,C,D, me, nv, me+nv);
						}
						T=max(T, me+nv);
					};
					if(1 < l) f(-1, 0, 0, 0);
					if(r < n) f(0, 1, 0, 0);
					if(1 < d) f(0, 0, -1, 0);
					if(u < m) f(0, 0, 0, 1);
				}
			}
		}
	}
	printf("%d\n", dp[1][n][1][m]);
	return 0;
}


Measured memory_bytes: 235776
#include <stdio.h>

int main(void)
{
	int n, a, b, c, w;
	int i;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d%d%d", &a, &b, &c);
		if (a < b) {
			w = a; a = b; b = w;
		}
		if (a < c) {
			w = a; a = c; c = w;
		}
		if (a * a == b * b + c * c)
			puts("YES");
		else
			puts("NO");
	}
	return 0;	
}

Measured memory_bytes: 580
#include <iostream>
using namespace std;
int main(){
  int n,q,m,i,j,k,b;
  cin >> n >> q;
  while(n!=0){
    int l[51][101]={{}};
    int d[101]={};
    for(i=0;i<n;i++){
      cin >> m;
      for(j=0;j<m;j++){
	cin >> b;
	l[i][b]=1;
      }
    }
    for(i=0;i<n;i++){
      for(j=0;j<101;j++){
	d[j]+=l[i][j];
      }
    }
    int da,ma=0;;
    for(i=0;i<101;i++){
      if(ma<d[i]) {
	ma=d[i];
	da=i;
      }
    }
    if(ma>=q) cout << da << endl;
    else cout << 0 << endl;
    cin >> n >> q;
  }
  return 0;
}

Measured memory_bytes: 1188
#include "bits/stdc++.h"
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const long long mod = 1e9 + 7;

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;
}

ll powMod(ll n, ll k, ll m) {
	if (k == 0) {
		return 1;
	} else if (k % 2 == 1) {
		return powMod(n, k - 1, m) * n % m;
	} else {
		ll t = powMod(n, k / 2, m);
		return t * t % m;
	}
}

int main() {
	ll n, r;
	cin >> n >> r;
	
	ll ans=r;
	
	if (n < 10) {
		ans=r+(100*(10-n));
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

int main ()
{
    int n, m, s, dp[50][3001];
    while (1)
    {
        cin>>n>>m>>s;
        if (!n) break;
        n*=n;
        m=min(m, s);
        memset(dp, 0, sizeof(dp));
        dp[0][0]=1;
        for (int i=1; i<=n; i++)
        {
            for (int j=1; j<=s; j++)
            {
                if (j>=i) dp[i][j]=dp[i-1][j-i]+dp[i][j-i];
                if (j>m) dp[i][j]-=dp[i-1][j-m-1];
                dp[i][j]%=100000;
                if (dp[i][j]<0) dp[i][j]+=100000;
            }
        }
        cout<<dp[n][s]<<'\n';
    }
    return 0;
}



Measured memory_bytes: 3704
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    bool c=0;
    int l;
    getline(cin,a);
    l=a.length();
    for(int i=0;i<l;i++)
    {
        if(a[i]=='C')c=true;
        if(a[i]=='F'&&c)puts("Yes"),exit(0);
    }
    puts("No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<string,int> mp;
int main()
{
	int n;
	string s;
	cin>>n;
	while(n--)
	{
		cin>>s;
		mp[s]++;
	}
	cout<<mp.size()<<endl;
}

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

int mul(int a,int b)
{
  
  if(a<=9&&b<=9)
  {
    return (a*b);
  }
  else{
    return -1;
  }
}
  int main()
  {
    int a,b;
    cin>>a>>b;
    int ans=mul(a,b);
    cout<<ans<<endl;
    return 0;
  }
    
    

Measured memory_bytes: 256
sx,sy,tx,ty = map(int, input().split())

first = "U"*(ty-sy) + "R"*(tx-sx)
second = "D"*(ty-sy) + "L"*(tx-sx)
third = "L" + "U"*(ty-sy+1) + "R"*(tx-sx+1) + "D"
fourth = "R" + "D"*(ty-sy+1) + "L"*(tx-sx+1) + "U"

print(first+second+third+fourth)

Measured memory_bytes: 9152
data=input()
if data[0]==data[1] and data[2]==data[3] and data[0]!=data[2]:
  print("Yes")
elif data[0]==data[2] and data[1]==data[3] and data[0]!=data[1]:
  print("Yes")
elif data[0]==data[3] and data[1]==data[2] and data[0]!=data[1]:
  print("Yes")
else:
  print("No")

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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n, ans = 0;
    cin >> n;
    vector<ll> pa, na;
    for(int i = 0; i < n; i++){
        ll x;
        cin >> x;
        if(x >= 0){
            pa.push_back(x);
        }else{
            na.push_back(x);
        }
    }
    if(pa.size() == 0){
        sort(rbegin(na), rend(na));
        ll t = na[0];
        ll m = na[0];
        for(int i = 1; i < n; i++){
            m -= na[i];
        }
        cout << m << endl;
        for(int i = 1; i < n; i++){
            cout << t << " " << na[i] << endl;
            t -= na[i];
        }
    }else{
        sort(begin(pa), end(pa));
        sort(begin(na), end(na));
        ll m = 0, t = 0;
        int p = 0;
        if(na.size() > 0){
            m = na[0];
            t = na[0];
            na[0] = 0;
            p = 0;
        }else{
            m = pa[0];
            t = pa[0];
            p = 1;
        }
        for(int i = p; i < pa.size() - 1; i++){
            m -= pa[i];
        }
        if(pa.size() > 0){
            m = pa.back() - m;
        }
        for(int i = 1; i < na.size(); i++){
            m -= na[i];
        }
        cout << m << endl;
        for(int i = p; i < pa.size() - 1; i++){
            cout << t << " " << pa[i] << endl;
            t -= pa[i];
        }
        cout << pa.back() << " " << t << endl;
        t = pa.back() - t;
        for(int i = 1; i < na.size(); i++){
            cout << t << " " << na[i] << endl;
            t -= na[i];
        }
    }
    return 0;
}


Measured memory_bytes: 2804
// https://atcoder.jp/contests/abc080/tasks/abc080_b
#include <bits/stdc++.h>
using namespace std;

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

int main() {
  string N;
  cin >> N;

  int sum = 0;
  for (char c : N) sum += c - '0';

  (stoi(N) % sum == 0) ? cout << "Yes" : cout << "No";
  return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
#define inf (1e9)
#define eps (1e-9)

template<class S, class T> inline
ostream& operator<<(ostream&os, pair<S,T> p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template<class S, class T, class U> inline
ostream& operator<<(ostream&os, tuple<S,T,U> t) {
  return os << '('
    << get<0>(t) << ", "
    << get<1>(t) << ", "
    << get<2>(t) << ')';
}

template<class T> inline
ostream& operator<<(ostream&os, vector<T> v) {
  if (v.size() == 0) { return os << "(empty)"; }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

template<class T> inline
istream& operator>>(istream&is, vector<T>&v) {
  rep (i, v.size()) is >> v[i];
  return is;
}

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

typedef vector<int> vi;
typedef vector<vi> vvi;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout.setf(ios::fixed);
  cout.precision(10);
  random_device dev;
  mt19937 rand(dev());

  loop {

  int h, w; cin >> h >> w;
  if (not h and not w) break;

  vvi f(h, vi(w, 0));
  rep (i, h) {
    rep (j, w) {
      char c; cin >> c;
      f[i][j] =
        c == '#' ? 1
        : c == '@' ? 2 : 3;
    }
  }

  int ans = 0;
  rep (i, h) {
    rep (j, w) {
      if (f[i][j] == 0) continue;
      ++ans;
      int finding = f[i][j];
      stack<pair<int,int>> s;
      s.push({ i, j });
      while (not s.empty()) {
        auto p = s.top(); s.pop();
        int u = p.first;
        int v = p.second;
        if (u < 0 or u >= h or v < 0 or v >= w) continue;
        if (f[u][v] != finding) continue;
        f[u][v] = 0;
        rep (k, 4) s.push({ u + dx[k], v + dy[k] });
      }
    }
  }

  cout << ans << endl;

  }

  return 0;
}

Measured memory_bytes: 1428
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int a,b,c; cin>>a>>b>>c;
    int hoge=a*100+b*10+c;
    if(hoge%4)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}

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

int k, q;
int a[5000];

long sub(int n, long x, long m) {
  vector<long> d(k);
  for (int i = 0; i < k; ++i) d[i] = a[i] % m;
  
  --n;
  long sum = x;
  long t = n / k;
  long zero = 0;
  for (int i = 0; i < k; ++i) {
    sum += t * d[i];
    zero += t * (d[i] == 0);
  }
  for (int i = 0; i < n % k; ++i) {
    sum += d[i];
    zero += d[i] == 0;
  }
  long gr = sum / m - x / m;
  return n - zero - gr;
}

int main() {
  cin >> k >> q;
  for (int i = 0; i < k; ++i) cin >> a[i];
  for (int j = 0; j < q; ++j) {
    long n, x, m;
    cin >> n >> x >> m;
    cout << sub(n, x, m) << endl;
  }
}

Measured memory_bytes: 384
n = int(input())
str_list = [''] * n
ans = 0

for i in range(n):
  text = list(input())
  text.sort()
  str_list[i] = ''.join(text)

str_list.sort()

current_str = str_list[0]
count = 0

for i in range(1, n):
  if current_str == str_list[i]:
    count += 1
  else:
    if count > 0:
      for j in range(1, count+1):
        ans += j
    count = 0
    current_str = str_list[i]

if count > 0:
  for j in range(1, count+1):
    ans += j
  
# print(n, str_list)
print(ans)

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

int main(){
    int a,b;
    cin>>a>>b;
    if(a==1&&b==2||a==2&&b==1)
    cout<<3<<endl;
    if(a==2&&b==3||a==3&&b==2)
    cout<<1<<endl;
    if(a==3&&b==1||a==1&&b==3)
    cout<<2<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        String S = sc.next();
        String T = sc.next();
        String[] s = S.split("");
        String[] t = T.split("");
        int count = 0;
        for(int i=0; i<s.length; i++) {
            if(s[i].equals(t[i])) continue;
            else count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 66728
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

int main()
{
    int H1, M1, H2, M2;
    cin >> H1 >> M1 >> H2 >> M2;
    int K;
    cin >> K;

    int strt = H1*60+M1;
    int end = H2*60+M2;

    if (strt>end) end += 60*24;

    int awake = end - strt;
    int study = awake - K;
    cout << study << endl;
    return 0;
}

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

int A[200];

int main(){
  int N, M;
  cin >> N >> M;
  rep(i, N) cin >> A[i];

  sort(A, A+N);
  reverse(A, A+N);

  // とりあえず投票総数を計算
  int sums = 0;
  rep(i, N) sums += A[i];

  // 選べない商品の投票数の境目
  // 整数型で宣言するとダメ
  double thres = (double) sums / (4 * M);

  // もし選べる商品がM個以上あればOK
  if (A[M-1] >= thres) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3544
#include <stdio.h>
#define INF 100000

int n;
int machi[20][20];

int kotsuhi(int start, int goal) {
  int d[20], f[20];
  int i, min, p;
  for(i = 0; i < 20; i++) {
    d[i] = INF;
    f[i] = 0;
  }
  d[start-1] = 0;
  while(1) {
    min = INF;
    for(i = 0; i < n; i++) {
      if(d[i] < min && f[i] == 0) {
        min = d[i];
        p = i;
      }
    }
    if(min == INF) break;
    f[p] = 1;
    for(i = 0; i < n; i++) {
      if(d[p] + machi[p][i] < d[i]) {
        d[i] = d[p] + machi[p][i];
      }
    }
  }
  return d[goal-1];
}

int main() {
  int i, j, m, a1, b1, c1, d1, x1, x2, y1, y2;

  for(i = 0; i < 20; i++) {
    for(j = 0; j < 20; j++) {
      machi[i][j] = INF;
    }
  }

  scanf("%d", &n);
  scanf("%d", &m);
  for(i = 0; i < m; i++) {
    scanf("%d,%d,%d,%d", &a1, &b1, &c1, &d1);
    a1 -= 1;
    b1 -= 1;
    machi[a1][b1] = c1;
    machi[b1][a1] = d1;
  }
  scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);

  printf("%d\n", y1 - y2 - kotsuhi(x1, x2) - kotsuhi(x2, x1));
  return 0;
}

Measured memory_bytes: 0
#pragma warning(disable:4996)
#include<stdio.h>
#define N_ 100010
int H, HP, n;
int Q2[N_], h = 1, t, C;
long long R, SS, Q[N_];
void ins(long long a, int b){
	while (t >= h && (Q[t] >= a || Q2[t] <= b)){
		if (b < Q2[t]) b = Q2[t];
		t--;
	}
	if (b > a) b = a;
	Q[++t] = a;
	Q2[t] = b;
}
long long Gap(int x){
	return Q[x] - SS;
}
int main()
{
	int i, a, b, top = 0;
	long long tp;
	scanf("%d%d", &n, &HP);
	H = HP;
	for (i = 1; i < n; i++){
		scanf("%d%d", &a, &b);
		ins(HP - H + SS, b);
		while (1){
			if (H > a){
				break;
			}
			if (Gap(h) < Q2[h]){
				Q2[h] = Q[h] - SS;
				continue;
			}
			if (h < t && Q2[h] <= Q2[h+1]){
				h++;
				continue;
			}
			if (Gap(h) <= a - H || a - H >= Q2[h]){
				tp = Gap(h);
				if (tp > a - H) tp = a - H;
				C = tp / Q2[h];
				H += Q2[h] * C;
				SS += Q2[h] * C;
				R += C;
				continue;
			}
			H += Q2[h];
			SS += Q2[h];
			R++;
		}
		H -= a;
	}
	printf("%lld\n", R);
}

Measured memory_bytes: 1504
import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		String line;
		while ((line = reader.readLine()) != null) {
			if (line.isEmpty()) {
				break;
			}
			StringTokenizer tokenizer = new StringTokenizer(line, ",");
			double[] x = new double[4];
			double[] y = new double[4];
			for (int i = 0; i < 4; i++) {
				x[i] = java.lang.Double.parseDouble(tokenizer.nextToken());
				y[i] = java.lang.Double.parseDouble(tokenizer.nextToken());
			}
			Point2D.Double a = new Point2D.Double(x[0], y[0]);
			Point2D.Double b = new Point2D.Double(x[1], y[1]);
			Point2D.Double c = new Point2D.Double(x[2], y[2]);
			Point2D.Double d = new Point2D.Double(x[3], y[3]);

			if (isTrue(a, b, c, d) || isTrue(a, b, d, c) || isTrue(a, d, c, b)
					|| isTrue(d, b, c, a)) {
				System.out.println("NO");
			} else {
				System.out.println("YES");
			}
		}
	}

	public static boolean isTrue(Point2D.Double a, Point2D.Double b,
			Point2D.Double c, Point2D.Double d) {
		Path2D.Double sank = new Path2D.Double();
		sank.moveTo(a.getX(), a.getY());
		sank.lineTo(b.getX(), b.getY());
		sank.lineTo(c.getX(), c.getY());
		if (sank.contains(d))
			return true;
		else
			return false;
	}
}

Measured memory_bytes: 15112
#include<stdio.h>
int bubbleSort(int A[],int N){
    int j,i,x=0;
    unsigned short flag=1;
    // flag=
    while(flag){
        flag=0;
        for(j=N-1;j>0;j--){
            if(A[j]<A[j-1]){
                i=A[j-1];
                A[j-1]=A[j];
                A[j]=i;
                flag=1;
                x++;
            }
        }
    }
    return x;
}
int main(void){
    int i,N,x;
    scanf("%d\n",&N);
    int a[N];
    for(i=0;i<N;i++){
        scanf("%d",&a[i]);
    }
    x=bubbleSort(a,N);
    for(i=0;i<N;i++){
        printf("%d",a[i]);
        if(i==N-1)break;
        printf(" ");
    }
    printf("\n%d\n",x);
    return 0;
}


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

#define inRange(x,a,b) (a <= x && x <= b)

int main(){
    int x, y;
    cin >> x >> y;
    int lx = 0, rx = 0, ly = 0, ry = 0, col = 0, turn = 0;
    while(!inRange(x,lx,rx) || !inRange(y,ly,ry)){
        col = (col+1)%3;
        if(turn == 0)   rx += ry-ly+1;   
        if(turn == 1)   ry += rx-lx+1;
        if(turn == 2)   lx -= ry-ly+1;
        if(turn == 3)   ly -= rx-lx+1;
        turn = (turn+1)%4;
    }
    cout << col+1 << endl;
    return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <numeric>
#include <string>

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl

using namespace std;
using i64 = long long;
int LARGE_NUM = 10010;

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

    vector<int> A(N), B(N);

    int maxA = 0;
    int minB = LARGE_NUM;
    int minB_ix = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i] >> B[i];
        maxA = max(maxA, A[i]);
        if (minB > B[i])
        {
            minB = B[i];
            minB_ix = i;
        }
    }

    vector<int> DP(H + maxA + 10, 0);
    for (int h = 1; h <= H + maxA; h++)
    {
        if (h <= A[minB_ix])
        {
            DP[h] = minB;
            continue;
        }
        int min_DP = 1 << 30;
        for (int i = 0; i < N; i++)
        {
            if (h < A[i])
                continue;
            min_DP = min(min_DP, DP[h - A[i]] + B[i]);
        }
        DP[h] = min_DP;
    }
    for (int h = 1; h <= H + maxA; h++)
    {
        if (h <= A[minB_ix])
        {
            continue;
        }
        int min_DP = min(DP[h], DP[h + 1]);
        for (int i = 0; i < N; i++)
        {
            if (h < A[i])
                continue;
            min_DP = min(min_DP, DP[h - A[i]] + B[i]);
        }
        DP[h] = min_DP;
    }

    /*
    for (auto &&item : DP)
    {
        cout << item << " ";
    }
    cout << endl;
    */

    int miminum = DP[H];
    for (int i = H + 1; i < H + maxA; i++)
    {
        miminum = min(miminum, DP[i]);
    }

    cout << miminum << endl;

    return 0;
}

Measured memory_bytes: 256
// By Mohit Gupta
#include <bits/stdc++.h>
using namespace std;
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for ll)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define pb push_back
#define fi first
#define se second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
#pragma GCC optimize ("-O2")
const int LIM = 1e5+5, MOD = 998244353;
int n,m,k,x,y;


int dp[3005][3005];
string s,t;
string ans;

void solve(int n,int m){
    if(n==0 || m==0) return;
    if(t[m]==s[n]){
        // cout<<s[n];
        ans.push_back(s[n]);
        solve(n-1,m-1);
    }
    else if(dp[n-1][m]>dp[n][m-1]){
        solve(n-1,m);
    }
    else{
        solve(n,m-1);
    }
}

int32_t main()
{
	IOS;
    cin>>s>>t;
    n=s.size();
    m=t.size();
    s=" "+s;
    t=" "+t;
    forn(i,3005) dp[0][i]=dp[i][0]=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
            if(t[j]==s[i]) dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
        }
    }
    //do backtracking to solve the problem
    // cout<<dp[n][m]<<ln;
    solve(n,m);
    reverse(ans.begin(),ans.end());
    cout<<ans<<ln;
}


Measured memory_bytes: 35584
#include<bits/stdc++.h>
#define MAX 1e9
using namespace std;

typedef long long ll;

int
main(void){
  int a, b, c;
  cin >> a >> b >> c;
  if(a + b + c >= 22){
    cout << "bust" << endl;
  }else{
    cout << "win" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n,c,k = map(int, input().split())
t = list(int(input()) for i in range(n))
t.sort()
ans =0

from collections import deque
queue = deque()

INF = float('inf')
t.append(INF)

for i in range(n):

    queue.append(t[i])
    limit = queue[0]+k

    if limit < t[i+1] or len(queue)>=c:
        for i in range(min(len(queue), c)):
            queue.popleft()
        ans += 1

while queue:
    for i in range(min(len(queue), c)):
        queue.popleft()
    ans += 1

print(ans)



Measured memory_bytes: 7396
import java.util.Scanner;

public class Main
{

  public static void main(String[] args)
  {
    try (Scanner sc = new Scanner(System.in))
    {
      while (sc.hasNext())
      {
        final int A = sc.nextInt();
        final int B = sc.nextInt();
        final int C = sc.nextInt();
        final int D = sc.nextInt();
        final int E = sc.nextInt();

        System.out.println(solver(A, B, C, D, E));
      }
    }
  }

  private static int solver(int a, int b, int c, int d, int e)
  {
    int ans = 0;

    if (a < 0)
    {
      ans += (0 - a) * c + d;
      a = 0;
    }

    ans += (b - a) * e;

    return ans;
  }

}



Measured memory_bytes: 26240
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include "math.h"
using namespace std;
int main()
{
	vector<long long> a;
	long long n;
	cin >> n;

	for (long long i = 0; i < n; i++) {
		long long kari;
		cin >> kari;
		a.push_back(kari);
	}

	//long long sum = accumulate(a.begin(), a.end(), 0);
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
	}

	long long sumima = 0, minimam = 1000000000000000000LL;
	for (long long i = 0; i < n - 1; i++) {
		sumima += a[i];
		if (abs(sum - 2 * sumima) < minimam) {
			minimam = abs(sum - 2 * sumima);
		};
	}

	cout << minimam<<endl;
	return 0;

}


Measured memory_bytes: 2420
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		char op[] = sc.next().toCharArray();
		int b = sc.nextInt();
		if(op[0]=='+'){
			System.out.print(a+b);
		}else if(op[0]=='-'){
			System.out.print(a-b);
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main() {
    ll n,a,b;
    cin >> n >> a >> b;
    vl x(n);
    rep(i,n) cin >> x[i];
    vl dis(n-1);
    rep(i,n-1) dis[i] = x[i+1] - x[i];
    ll ans = (ll)x[n-1] - x[0];
    ans *= a;
    //call(ans);
    rep(i,n-1){
        if(dis[i] * a > b){
            ans +=  -dis[i] * a + b;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

N, Q = map(int, input().split())
QE = [list(map(int, input().split())) for _ in range(Q)]

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0]*(n)
        self.size = [1]*(n)

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def get_size(self, x):
        x = self.find(x)
        return self.size[x]


uni = UnionFind(N)
for qe in QE:
    com, x, y = qe
    if com==0:
        uni.union(x, y)
    elif com==1:
        if uni.same_check(x, y):
            print(1)
        else:
            print(0)
    else:
        print('miss')




Measured memory_bytes: 25288
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }

};


int main(){
  int n; cin >> n;
  vi p(n);
  rep(i,n){
    cin >> p[i];
    p[i]--;
  }
  vi q(n);
  rep(i,n) q[p[i]] = i;

  int cnt = 1;
  int res = 0;
  rep(i,n-1) {
    if(q[i] < q[i+1]) cnt++;
    else{
      chmax(res, cnt);
      cnt = 1;
    }
  }
  chmax(res,cnt);

  cout << n-res << endl;
  
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <list>
#include <cmath>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <vector>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
// const ll MOD = 1000000009;

#define M 1000000007

int main() {
    ll h;
    cin >> h;
    ll ans = 0;
    ll j = 1;
    for (; h > 0; h /= 2) {
        //cacerr << h <<endl;
        ans += j;
        j *= 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
myinput = input()
myinput_H = input()
mylist = list(map(int, myinput.split(" ")))
N = mylist[0]
K = mylist[1]
list_H = list(map(int, myinput_H.split(" ")))
if N - K <= 0:
    print(0)
else:
    x = N - K
    list_H.sort()
    l = list_H[0:x]
    sum = sum(l)
    print(sum)

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

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

using namespace std;

int main(){
	string s,t; cin>>s>>t;
	int ans=0;
	rep(i,s.length()) if(s[i]!=t[i]) ans++;
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 3852
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int n, m;
  cin >> n >> m;
  if (n == m)
  {
    cout << "Yes" << "\n";
  }
  else
  {
    cout << "No" << "\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	string s; cin>>s;
  ll n = s.size();
  ll cnt[26]; CLR(cnt);
  rep(i,n) cnt[s[i]-'a']++;
  ll ans = n*(n-1)/2;
  rep(i,26) ans -= cnt[i]*(cnt[i]-1)/2;
  cout << ans + 1 << endl;

  return 0;
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

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

template <typename T>
ostream& operator<<(ostream& os, vector<T> v)
{
  os << "(";
  each (i, v)
    os << i << ",";
  os << ")";
  return os;
}

int main(int argc, char* argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s, t;
  while (cin >> s >> t) {
    map<char, char> m1;
    map<char, char> m2;
    bool f = true;
    for (int i = 0; i < s.size(); ++i) {
      unless (m1.count(s[i])) {
        m1[s[i]] = t[i];
      }
      f = f && (m1[s[i]] == t[i]);
      unless (m2.count(t[i])) {
        m2[t[i]] = s[i];
      }
      f = f && (m2[t[i]] == s[i]);
    }
    cout << (f ? "Yes" : "No") << endl;
  }

  return 0;
}


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

using namespace std;
#define int long long
#define inf 999999999999999999
#define N 666666
int arr[N];
int n;
signed main(){
	string s1,s2;cin>>s1>>s2;int f=1;
	for(int i=0;i<s1.size();i++){
		if(s1[i]!=s2[i]) f=0;
	}
	if(f) cout<<"Yes";else cout<<"No";
	return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
struct node{
	int c;
	int next;
}e[2000005];
int head[200005];
int dis[200005];
int n,m;
int tot;
void add(int x,int y){
	e[tot].c=y;
	e[tot].next=head[x];
	head[x]=tot;
	tot++;
}
bool dfs(int x){
	queue<int> q;
	q.push(x);
	dis[x] = 0;
	while(q.size()){
		int u=q.front();
		q.pop();
		for(int i=head[u];~i;i=e[i].next){
			int c=e[i].c;
			if(dis[c]==-1){
				dis[c]=u;
				q.push(c);
			}
		}
	}
	for(int i=2;i<=n;i++){
		if(dis[i]==-1) return false;
	}
	return true;
}
int main(){
	memset(head,-1,sizeof(head));
	memset(dis,-1,sizeof(dis));
	tot=0;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int x,y;
		cin>>x>>y;
		add(x,y);
		add(y,x);
	}
	if(!dfs(1)){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
		for(int i=2;i<=n;i++){
			cout<<dis[i]<<endl;
		}
	}
return 0;
}

Measured memory_bytes: 8364
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x)  x.begin(),x.end()
#define vi vector<int>
#define vll vector<ll>
#define print(x) for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<'\n';
#define debug(a,b,c) cout << a << " " << b << " " << c << endl;
#define in(x,n) for(int e=0;e<n;e++){int y;cin>>y;x.pb(y);}
#define inl(x,n) for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}
#define lower(sl)  transform(sl.begin(), sl.end(), sl.begin(), ::tolower); 
#define endl "\n";
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
 

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//code here
    ll n, d; cin >> n >> d;
	ll res = 0;
	while(n--){
		ll x, y; cin >>x>>y;
		if((x*x+y*y) <= (d*d)){
			res++;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
int N;
long long ans=0;
long long m=(int)1e9+7;
main()
{
    cin>>N;
    long long s=0;
    for(int i=0;i<N;++i){
        long long a;
        cin>>a;
        ans=(ans+a*s)%m;
        s=(s+a)%m;
    }
    cout<<ans<<endl;
}

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

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> donuts(n);

  for (int i = 0; i < n; i++) {
    cin >> donuts.at(i);
  }
  int total = accumulate(donuts.begin(), donuts.end(), 0);
  int min_donut = *min_element(donuts.begin(), donuts.end());
  cout << n + (x - total) / min_donut << endl;
}


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


vector<bool> seen;

int dfs(const vector<vector<int>> &g, int s) {
    seen[s] = true;

    int cnt = 1;
    for(auto x : g[s]) {
        if(seen[x] == false) {
            cnt += dfs(g, x);
        }
    }
    return cnt;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n,m;
    cin >> n >> m;
    vector<vector<int>> graph(n);

    rep(i,m) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    seen.assign(n, false);

    int v;
    int ans = 0;
    rep(i,n) {
        if(seen[i] == true) continue;
        v = dfs(graph, i);
        ans = max(ans, v);
    }
    cout << ans << endl;
}


Measured memory_bytes: 23400
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
// const ll INF = 1000000000000000000LL;

int main() {
	int a,b,c;
	cin >> a >> b >> c;
	if(a<c&&c<b||b<c&&c<a)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int

struct Union{
  vector<ll> par;
  Union(ll a){
  par=vector<ll>(a,-1);
  }
  ll find(ll a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(ll a,ll b){
    return (find(a)==find(b));
  }
  ll size(ll a){
    return -par[find(a)];
  }
  void unite(ll a,ll b){
    ll c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
ll euclidean_gcd(ll a, ll b) {
  if(a < b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
ll euclidean_lcm(ll a, ll b) {
  return a/euclidean_gcd(a,b)*b;
}

ll binary(ll bina){
    ll ans = 0;
    for (ll i = 0; bina>0 ; i++)
    {
        ans += bina%2;
        bina = bina/2;
    }
    return ans;
}
void revStr(char* str){
	int size = strlen(str);
	int i,j;
	char tmp = {0};
	
	for(i = 0, j = size - 1; i < size / 2; i++, j--){
		tmp = str[i];
		str[i] = str[j];
		str[j] = tmp;
	}
	return;	
}
int main(void){
  ll n;
  cin >> n;
  ll a[n],b[13];
  rep(i,13){
    b[i]=0;
  }
  rep(i,n){
    cin >> a[i];
    b[a[i]/400]++;
  }
  ll ans=0;
  rep(i,8){
    if(b[i]>0)ans++;
  }
  cout << max((ll)1,ans) << " ";
  ans=ans+b[8]+b[9]+b[10]+b[11]+b[12];
  cout << ans;
}

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

int main(){
    int n, i, j;
    cin >> n;
    int a[n+1];
    int b[n+1];

    for(i = 1; i <= n; i++){
        cin >> a[i];
    }
    int t = 0;
    for(i = n; i > 0; i--){
        int c = 0;
        for(j = i * 2; j <= n; j+=i){
            c += b[j];
        }
        b[i] = (c + a[i]) % 2;
        if(b[i] == 1) t++;
    }
    cout << t << endl;
    for(i = 1; i <= n; i++){
        if(b[i] == 1){
            cout << i << " ";
        }
    }
    cout << endl;


}

Measured memory_bytes: 2432
S = input()
ans = 0
if S == 'SUN':
    ans = 7
if S == 'MON':
    ans = 6
if S == 'TUE':
    ans = 5
if S == 'WED':
    ans = 4
if S == 'THU':
    ans = 3
if S == 'FRI':
    ans = 2
if S == 'SAT':
    ans = 1

print(ans)

Measured memory_bytes: 3060
#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)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N;
    cin >> N;
    int ans = 0;
    for(int i = 1; i <= N; i+=2){
        set<int> st;
        for(int j = 1; j * j <= N; j++){
            if(i % j == 0){
                st.insert(j);
                st.insert(i / j);
            }
        }
        if(st.size() == 8){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256