akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;++i){
    cin >> a[i];
  }
  int ans=1000000000;
  for(int i=0;i<n;++i){
    int num=0;
    while(a[i]%2==0){
      num++;
      a[i]=a[i]/2;
    }
    ans=min(ans,num);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<string>
using namespace std;

bool order(int a,int b){
	return a>b;
}	

int main(){
	vector<int> w;
	for(int x=0;x<5;++x){
		int j;scanf("%d",&j);
		w.push_back(j);
	}
	sort(w.begin(),w.end(),order);
	for(int x=0;x<4;++x){
		cout<<w[x]<<" ";
	}
	cout<<w[4]<<endl;
	return 0;
}	

Measured memory_bytes: 1232
#include<stdio.h>

int main(void){
  int n , m , k;
  scanf("%d %d %d",&n ,&m ,&k);

  long long a , b;
  long long atas[200010] = {0} , btas[200010] = {0};
  for(int i = 0;i < n;i ++){
    scanf("%lld",&a);
    atas[i+1] = atas[i] + a;
  }

  for(int i = 0;i < m;i ++){
    scanf("%lld",&b);
    btas[i+1] = btas[i] + b;
  }

  int bmax = m;
  int ans = 0 , count;
  for(int i = 0;i <= n;i ++){
    for(int j = bmax;j >= 0;j --){
      if(k >= atas[i] + btas[j]){
        count = i + j;
        bmax = j;
        j = -1;
        if(ans < count){
          ans = count;
        }
      }
    }
  }

  printf("%lld\n",ans);

  return 0;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
#ifdef DEMETRIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define SZ(x) ((int)(x).size())
#define mset(a,v) memset(a,v,sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(a))
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b){
	while(b){
		ll c=a%b;
		a=b;b=c;
	}
	return a;
}

int n,q;
vector<int> x;

void check(){
	assert(SZ(set<int>(x.begin(),x.end()))==n);
	ll s=0;
	for(int a:x)s+=a;
	for(int a:x)assert(gcd(a,s-a)>1);
}

void add(int k){
	assert(k<=30000);
	if(q)putchar(' ');
	printf("%d",k);x.pb(k);
	q++;
	if(q==n){
		puts("");
		check();
		exit(0);
	}
}

int main(){
	scanf("%d",&n);
	if(n==3){puts("2 5 63");return 0;}
	add(3);add(9);
	for(int k=2;k<=30000;k+=2){
		if(n%2&&k==30000)break;
		if(q+1==n&&k%3==2){k+=2;continue;}
		add(k);
	}
	for(int k=15;;k+=6)add(k);
	return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<string.h>
int main(){
  char s[100001];
  scanf("%s",s);
  int len=strlen(s),i,count=0;
  for(i=1;i<len;i++)
    if(s[i]!=s[i-1])
      count++;
  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define int long long int
#define MOD 1000000007
#define mkp make_pair
#define maxN 100005
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
using namespace std;
const int infi=1e9+7;
void printVector(vector<int> v){
    for(int i=0;i<(int)v.size();i++)
        cout<<v[i]<<" ";
    out endl;
}

void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
cout<<endl;
}
 set<pair<int,int>> primeset;
 vi prime_number;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
           primeset.insert(mkp(p,1));
}
ll modExp(ll base, ll power) {
    if (power == 0) {
        return 1;
    } else {
        ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
        if (power % 2 == 1) cur = cur * base;
        cur = cur % MOD;
        return cur;
    }
}
bool visited[105];
double solve(double a,double tax){
    int start=0;
    int end=100;
    int ans=0-1;
    while(start<end && start!=end){
        double  mid=start+end;
        mid=ceil(mid/2);
        debug3(start,mid,floor(mid*tax));
        if(floor(mid*tax)==a){
            ans=mid;
            return ans;
        }
        else if(floor(mid*tax)>a) end=mid-1;
        else start=mid+1;
    }
    return ans;
}

int32_t main()
{
fastio;
int t=1;
//in t;
while(t--){
string s;in s;
int q;in q;
bool rev=0;
vector<char> v[2];
while(q--){
    int a;in a;
    if(a==1){
        rev=!rev;
    }
    else{
        int b;in b;char c;in c;
        --b;
        v[rev^b].pb(c);
    }
}
string t;
for(int i=v[0].size()-1;i>=0;i--)
    t+=v[0][i];
t+=s;
for(int i=0;i<v[1].size();i++){
    t+=v[1][i];
}
if(rev) reverse(t.begin(),t.end());
cout<<t<<endl;
}
#ifndef ONLINE_JUDGE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 1448
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;
ll p[200010], q[200010], r[200010],s[200010];
ll parent[200010];

ll root(int x){
    if(x == parent[x]){
        return x;
    }else{
        return parent[x] = root(parent[x]);
    }
}

void unite(ll a, ll b){
    a = root(a);
    b = root(b);
    if(a == b){
        return;
    }
    parent[a] = b;
}

void same(ll a, ll b){
    if(root(a) == root(b)){
        print("Yes");
    }else{
        print("No");
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K,L;
    cin >> N >> K >> L;
    rep(i,0,K){
        cin >> p[i] >> q[i];
        p[i]--; q[i]--;
    }
    rep(i,0,L){
        cin >> r[i] >> s[i];
        r[i]--; s[i]--;
    }
    ll cnt_k[200010] = {};
    ll root_k[200010] = {};
    rep(i,0,N){
        parent[i] = i;
    }
    rep(i,0,K){
        unite(p[i], q[i]);
    }
    rep(i,0,N){
        root_k[i] = root(i);
    }

    ll cnt_l[200010] = {};
    ll root_l[200010] = {};
    rep(i,0,N){
        parent[i] = i;
    }
    rep(i,0,L){
        unite(r[i], s[i]);
    }
    rep(i,0,N){
        root_l[i] = root(i);
    }

    vector<lpair> res;
    rep(i,0,N){
        res.push_back(make_pair(root_k[i], root_l[i]));
    }
    map<lpair, ll> mp;
    rep(i,0,N){
        mp[res[i]]++;
    }
    rep(i,0,N){
        if(i != 0) cout << " ";
        cout << mp[res[i]];
    }
    cout << endl;


}


Measured memory_bytes: 25068
N, K, C = map(int, input().split())
S = input()

def get_positions():
    res = []
    i = 0
    while i < N and len(res) < K:
        if S[i] == "o":
            res.append(i)
            i = i + C + 1
        else:
            i += 1
    return res

l = get_positions()
S = S[::-1]
r = get_positions()
for i in range(K):
    r[i] = N - 1 - r[i]
S = S[::-1]

lastl = [-1] * (N + 1)
for i in range(K):
    lastl[l[i] + 1] = i
for i in range(N):
    if lastl[i + 1] == -1:
        lastl[i + 1] = lastl[i]

lastr = [-1] * (N + 1)
for i in range(K):
    lastr[r[i]] = i
for i in range(N-1, -1, -1):
    if lastr[i] == -1:
        lastr[i] = lastr[i + 1]

for i in range(N):
    if S[i] == "x":
        continue
    li = lastl[i]
    ri = lastr[i + 1]
    cnt = 0
    if li != -1:
        cnt += (li + 1)
    if ri != -1:
        cnt += (ri + 1)
    if li != -1 and ri != -1 and r[ri] - l[li] <= C:
        cnt -= 1

    if cnt >= K:
        continue
    print(i + 1)

Measured memory_bytes: 36568
#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> ;
const int INF = 1e9;
const int MOD = 1000000007;

int main(){
    int n,t;
    cin >> n >> t;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int cnt = 0; //カウント
    int mn = 0; //累積min
    int m = 0; //最大値
    rep(i,n){
        if(i==0) mn = a[0];
        else{
            if(m == a[i] - mn) cnt ++;
            else if(m < a[i] - mn) cnt = 1,m = a[i] - mn;
            mn = min(mn,a[i]);
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#define mt make_tuple
#define ll long long
#define ld long double
#define eb emplace_back
#define fi first
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define scanVec(vec) for(int i = 0; i < SZ(vec) ; i++){ cin >> vec[i];}
#define printVec(vec) for(int i = 0; i < SZ(vec) ; i++){ cout<<vec[i]<<" ";}
#define mod(a,b) ((a%b +b)%b)
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
//#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define lastEle(vec) vec[vec.size()-1] 
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) 
#define ll long long 
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
//#define PI 3.1415926535897932384626
 
using namespace std;
 //using namespace __gnu_pbds;
 //template <typename T>
 //using ordered_set =
    //tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
 
/*
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
 */
//----------------------------------------------------------------------------------------------------------------------
 
void swap(int & a, int & b){
    auto temp = a;
    a = b;
    b = temp;
}
 
const ll MOD = 1e9 + 7;
 
ll inf = 1LL*1e17;
 
void no(){
    cout <<"NO" << endl;
   //exit(0);
}
 
void yes(){
    cout <<"YES" << endl; //exit(0);
}
 
const ll md = 998244353;


void sl(){
	string s,t;
	int ss,tt;
	cin >> s >> t >> ss >> tt;
	string u;
	cin >> u;
	if(u == s) ss--;
	else tt--;
	cout << ss << " " << tt << endl;
}
 
 
int main(){
	//freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int ts = 0;
    if(ts == 1) cin >> ts;
    else ts = 1;
    while(ts--) sl(); 
    return 0;
} 


Measured memory_bytes: 256
macro_rules! scan {
    ()=>{
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line
        }
    };
    (;;$n:expr)=>{
        {
            (0..$n).map(|_| scan!()).collect()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
}

fn main() {
    let (h, _) = scan!(i64, i64);
    let image: Vec<String> = scan!(;;h);
    for line in image.iter() {
        println!("{}", line);
        println!("{}", line)
    }
}


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

int main(){
  int N;
  cin >> N;
  int d[N];
  int res = 0;
  for(int i = 0; i < N; i++){
    cin >> d[i];
    res++;
  }
  sort(d, d + N);
  for(int i = 0; i < N - 1; i++){
    if(d[i] == d[i + 1]){
      res--;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
int n;   
int f[130];  
int a[130];  
string st;   
int main()
{
    cin>>n;  
    memset(f,127,sizeof(f));  
    for(int i=1;i<=n;i++)
    {
        cin>>st;  
        memset(a,0,sizeof(a)); 
        for(int j=0;j<st.size();j++)
        a[st[j]]++;  
        for(int j=97;j<=122;j++)
        f[j]=min(a[j],f[j]);
    }
    for(int i=97;i<=122;i++) 
    {
        for(int j=1;j<=f[i];j++)  
        cout<<char(i);  
    }
    return 0;
}

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

typedef pair<int,int> P;
typedef long long ll;

const int INF = 100000000;
const double PI=3.14159265358979323846;

int main () {
    ll N;
    cin >> N ;
    ll A[N];
    rep(i,N) {
        cin >> A[i];
    }
    vector<ll> B(N,0);
    if (N%2==1) {
        B[0]=1;
        for (int i=2;i<=N-1;i+=2){
            B[i]=2;
        }
    }
    if (N%2==0) {
        for (int i=1;i<=N-1;i+=2){
            B[i]=2;
        }
    }

    rep(i,N) {
        B[A[i]]--;
    }
    ll tmp = 0;
    rep(i,N) {
        tmp = min(tmp, B[i]);
    }
    if (tmp<0) {
        cout << 0 << endl;
    }
    else {
        ll ans = 1;
        ll tmp = (pow(10,9)+7);
        rep(i,N/2) {
            ans *= 2;
            ans %= tmp;
        }
        cout << ans << endl;
    }

}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

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

		int N = scan.nextInt();
		String S = scan.next();

		int x = 0;
		int max = 0;
		for (char s : S.toCharArray()) {
			switch (s) {
			case 'I':
				x++;
				if (max < x) {
					max = x;
				}
				break;
			case 'D':
				x--;
			}
		}
		System.out.println(max);
	}

}


Measured memory_bytes: 21332
#include<iostream>
 
using namespace std;
void a(string s[11]){
	return ;
}
int main(){
	string s[4];
	a(s);
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            cout<<i<<"x"<<j<<"="<<i*j<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1120
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

sys.setrecursionlimit(10 ** 6)

n, m, q = na()
abcd = nan(q)

ans = 0
def dfs(s):
    if len(s) == n + 1:
        res = 0
        for i in range(q):
            a, b, c, d = abcd[i]
            if s[b] - s[a] == c:
                res += d
        return res
    res = 0
    for i in range(s[-1], m + 1):
        news = s[:]
        news.append(i)
        res = max(res, dfs(news))
    return res

print(dfs([1]))

Measured memory_bytes: 9204
import numpy as np

def palace():
    
    N = int(input())
    T, A = np.array(input().split(), dtype="int")[:2]
    H = [int(i) for i in input().split()]
    
    min_dif = 10000
    place = 0
    for i in range(N):
        temp = T - H[i] *0.006
        dif = abs(A-temp)
        
        #誤差の最小値(→候補地も更新)
        if min_dif >= dif:
            min_dif = dif
            place = i+1
    
    print(place)
    
    
palace()

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

using namespace std;


int main()
{
    int N;
    int h[100];
    cin >> N;
    for(int i = 0; i < N; i++) cin >> h[i];

    int ans = h[0];
    for(int i = 1; i < N; i++)
    {
        if(h[i] - h[i-1] > 0)
        {
            ans += h[i] - h[i-1];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

const int MAX = 10000000;
int min_factor[MAX+1];
vector<int>prime;
void make_prime() {
    for (int i=2; i<=MAX; i+=2) min_factor[i] = 2;
    for (int i=3; i<=MAX; i+=3) if (!min_factor[i]) min_factor[i] = 3;
    for (int i=5, d=2; i*i<=MAX; ) {
	if (!min_factor[i]) {
	    min_factor[i] = i;
	    for (int j=i*i; j<=MAX; j+=i)
		if (!min_factor[j]) min_factor[j] = i;
	}
	i += d; d = 6 - d;
    }
    for (int i=2; i<=MAX; i++) {
	if (min_factor[i]==0) min_factor[i] = i;
	if (min_factor[i]==i) prime.push_back(i);
    }
}
bool is_prime(LL n) {
    if (n<=MAX) return min_factor[n] == n;
    for (int i=0; (LL)prime[i]*prime[i]<=n; i++)
	if (n%prime[i]==0) return false;
    return true;
}



struct Matching2 { // for bipartite graph
    vector<int>matchM, matchW, use;
    int ans;
    bool dfs(const VI G[], int v) {
	if (use[v]) return false;
	use[v] = true;
	for (int i=0; i<(int)G[v].size(); i++) {
	    int u = G[v][i];
	    if (matchW[u] == -1 || dfs(G, matchW[u])) {
		matchM[v] = u;
		matchW[u] = v;
		return true;
	    }
	}
	return false;
    }
    Matching2(const VI G[], int sizeM, int sizeW): matchM(sizeM, -1), matchW(sizeW, -1), ans(0) {
	use = vector<int>(sizeM, 0);
	for (int i=0; i<sizeM; i++) {
	    fill(use.begin(), use.end(), 0);
	    if (dfs(G, i)) ans++;
	}
    }
};

int N;
int X[111];
VI G[211];

void MAIN() {
    make_prime();
    scanf("%d", &N);
    REP (i, N) scanf("%d", X+i);

    VI S;
    REP (i, N) {
	if (i == 0 || X[i-1] + 1 < X[i]) {
	    S.push_back(X[i]);
	}
	if (i == N-1 || X[i] + 1 < X[i+1]) {
	    S.push_back(X[i]+1);
	}
    }
    VI E, O;
    EACH (e, S) {
	if (*e & 1) O.push_back(*e);
	else E.push_back(*e);
    }

    REP (i, O.size()) REP (j, E.size()) if (abs(O[i] - E[j]) > 2 && is_prime(abs(O[i] - E[j]))) {
	G[i].push_back(j);
    }
    Matching2 M(G, O.size(), E.size());

    int ans;
    if ((O.size() ^ M.ans) & 1) {
	ans = E.size() + O.size() - M.ans + 1;
    } else {
	ans = E.size() + O.size() - M.ans;
    }

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

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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

class Dice {
	int num[6];
public:
	void set(int n, int s) {
		num[s] = n;
	}

	void move(char c) {
		if (c == 'E') {
			swap(num[0], num[3]);
			swap(num[3], num[5]);
			swap(num[5], num[2]);
		}
		else if (c == 'N') {
			swap(num[0], num[1]);
			swap(num[1], num[5]);
			swap(num[5], num[4]);
		}
		else if (c == 'S') {
			swap(num[0], num[4]);
			swap(num[4], num[5]);
			swap(num[5], num[1]);
		}
		else if (c == 'W') {
			swap(num[0], num[2]);
			swap(num[2], num[5]);
			swap(num[5], num[3]);
		}
	}

	int up() {
		return num[0];
	}
};

int main() {
	Dice d;
	int n;
	for (int i = 0; i < 6; i++) {
		scanf("%d", &n);
		d.set(n, i);
	}
	getchar();
	char c;
	while (scanf("%c", &c), c != '\n') {
		d.move(c);
	}
	printf("%d\n", d.up());
}

Measured memory_bytes: 1028
import java.util.*;

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    
	int max = a;
    if(max < b) max = b;
    if(max < c) max = c;
    
    System.out.println(a+b+c-max);
  }
}

Measured memory_bytes: 21844
/*
ID: alec3
LANG: C++14
PROG: pprime
CLASSIFICATION: brute force
*/

#include <bits/stdc++.h>
#define check(x) cout<<(#x)<<": "<<x<<" ";
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);


typedef long long ll;
typedef unsigned long long ull;

using namespace std;

bool isPrime(int n){
    bool prime = true;
    if (n == 1) return false;
    if (n == 2) return true;
    if (n % 2 == 0) return false;

    for (int i = 3; i < sqrt(n) + 1; i+= 2){
        if (n % i == 0){
            prime = false;
            break;
        }
    }
    return prime;
}

int main() {

	//ifstream fin("pprime.in");
	//ofstream fout("pprime.out");
    io;
    int n;
    cin >> n;

    int vals[n + 1] = {0};

    for (int x = 1; x <= n; x ++){
        for (int y = 1; y <= n; y++){
            for (int z = 1; z <= n; z++){
                if ((x * x + y*y + z*z + x * y + y * z + z *x) > n) break;
                else vals[(x * x + y*y + z*z + x * y + y * z + z *x)] ++;
            }
        }
    }

    for (int i = 1; i <= n; i++){
        cout << vals[i] << endl;
    }



    return 0;

}


Measured memory_bytes: 3636
W,H,N = map(int,input().split())

XW = [1] * W
YW = [1] * H

for i in range(N):
  x,y,a = map(int,input().split())
  if a == 1:
    XW[:x] = [0]*x
  elif a == 2:
    XW[x:] = [0]*(W-x)
  elif a == 3:
    YW[:y] = [0]*y
  elif a == 4:
    YW[y:] = [0]*(H-y)
print(sum(XW)*sum(YW))
    



Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define FASTIO
#define endl "\n" // Since endl forces a buffer flush which slows down large I/O operations.
#define ff first
#define ss second
#define pb push_back
#define input(c, n)             \
	for (int i = 0; i < (n); i++) \
		cin >> (c)[i];
#define exit_message(s) return 0 * printf(s)
#define show(c)           \
	for (auto i : (c))      \
		cout << i << " "; \
	cout << "\n";
#define display(c, n)           \
	for (int i = 0; i < (n); i++) \
		cout << (c)[i] << " ";    \
	cout << "\n";
#define forl(i, a, n) for (int (i) = (a); (i) < (n); (i)++)
#define dugbe(k) cout << "-\t> " << #k << " = " << k << "\n";

/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/

using namespace std;
typedef long long ll;
typedef pair<int, int> pr;
typedef pair<ll, ll> prll;
typedef vector<int> vi;
typedef vector<ll> vill;
typedef vector<pr> vpr;
ifstream in("input.txt");
const ll mod = 1e9 + 7;

ll mod_pow(ll a, ll b)
{
	if (b == 0)
		return 1LL;

	ll res = mod_pow(a, b >> 1);
	res = (res * res) % mod;
	if (b & 1LL)
		res = (res * a) % mod;

	return res;
}

const int N = 1e5 + 5;
const int SZ = 2100000;

int n;
vi g[N];
int dp[N][2];
int vis[N];

int solve(int s, int c)
{
	// cerr << "solve entered, s : " << s << " c : " << c << "\n";

	if (vis[s] == 1)
		return 1;

	// cerr << "still in solve, s : " << s << " c : " << c << "\n";

	vis[s] = 1;

	int &memo = dp[s][c];
	if (memo != -1)
		return memo;

	memo = 1;
	for (auto e: g[s])
	{
		if (!vis[e])
		{
			int temp = 0;
			temp += solve(e, 0);
			vis[e] = 0;
			if (!c)
				temp += solve(e, 1), temp %= mod;
			vis[e] = 0;

			memo = ((ll)memo * temp) % mod;
		}
	}
	// cerr << "still in solve, s : " << s << " c : " << c << "\n";
	// cerr << "Returning memo : " << memo << "\n";
	return memo;
}

int32_t main()
{
#ifdef FASTIO
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);
#endif
	// freopen("in.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	memset(dp, -1, sizeof dp);

	cin >> n;
	forl(i, 0, n - 1)
	{
		int x, y;
		cin >> x >> y;
		g[x].pb(y);
		g[y].pb(x);
	}
	g[0].pb(1);

	int ans = solve(0, 0);
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 15232
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int N;
    cin >> N;
    vector<int> A(N+1);
    rep(i, N+1) cin >> A[i];
    vector<int> B(N);
    rep(i, N) cin >> B[i];
    ll total = accumulate(A.begin(), A.end(), 0L);
    rep(i, N) {
        int temp = min(A[i], B[i]);
        A[i] -= temp; B[i] -= temp;
        A[i+1] -= min(A[i+1], B[i]);
    }
    ll remain = accumulate(A.begin(), A.end(), 0L);
    cout << total - remain << '\n';
    return 0;
}

Measured memory_bytes: 4040
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,m;
  while(cin>>n>>m,n){
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    int ans=0;
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	if(a[i]+a[j]>m) continue;
	ans=max(ans,a[i]+a[j]);
      }
    }
    if(ans) cout<<ans<<endl;
    else cout<<"NONE"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
void Calc(){
	int N = rei();
	bool OK = true;
	for(int i=0;i<N;i++){
		long X = rel();
		OK &= X % 2 == 0;
	}
	if(OK){
		cout << "second" << endl;
	}
	else{
		cout << "first" << endl;
	}
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>

#include <random>
#define all(x) (x).begin(), (x).end()


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

#define debug(x) cout << #x " = " << (x) << endl

using ll = long long;
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#define solvsh
//#define multi
#ifdef solvsh

const int MAXN = 2e5 + 100;


ll gcd(ll x, ll y){
    return y ? gcd(y, x % y) : x;
}

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    ll answr = 0;
    ll cnt_r = 0;
    ll cnt_g = 0;
    ll cnt_b = 0;
    for (int i = 0; i < n; ++i){
        if (s[i] == 'R')
            cnt_r++;
        else if (s[i] == 'B')
            cnt_b++;
        else
            cnt_g++;
    }

    answr = cnt_b * cnt_g * cnt_r;
    for (int i = 0; i < n; ++ i){

        for (int j = 0; i - j >=0 && j + i < n; ++j){
            if (s[i - j] != s[i + j] && s[i - j] != s[i] && s[i] != s[j + i]){
                --answr;
            }
        }

    }

    cout << answr;
}

#else

#endif

void multisolve() {
    int t;
    cin >> t;

    int i = 1;
    while (t--) {
        cout << "Case #" << (i++)  << ":} ";
        solve();
        cout << endl;
    }
}


#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);


#ifdef multi
    multisolve();
#else
    solve();
//    gen();
#endif

}

Measured memory_bytes: 3672
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]

right_points = [0 for _ in range(N)]

for Ai in A:
    right_points[Ai-1] += 1

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


Measured memory_bytes: 8636
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = 998244353;
const long long INF_LL = 1e18+11; const int INF_int = 1e9+11;
#define ll long long
#define mp std::make_pair
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto x:a) cout << x << " ";cout << endl;
int main(){
    int a,b;
    cin >> a >> b;
    if(b<=4*a && b>=2*a && b%2==0){
        cout << "Yes" << endl;
    }   
    else cout << "No" << endl;
}

Measured memory_bytes: 3628
class Dice:
	
	def __init__(self, faces):
		self.faces = faces
		self.t = faces[0]
		self.s = faces[1]
		self.e = faces[2]
		self.w = faces[3]
		self.n = faces[4]
		self.b = faces[5]

	def roll(self, drct):
		t_ = self.t
		s_ = self.s
		e_ = self.e
		w_ = self.w
		n_ = self.n
		b_ = self.b
		if drct == 'S':
			self.t = n_
			self.s = t_
			self.n = b_
			self.b = s_
		elif drct == 'N':
			self.t = s_
			self.s = b_
			self.n = t_
			self.b = n_
		elif drct == 'E':
			self.t = w_
			self.e = t_
			self.w = b_
			self.b = e_
		elif drct == 'W':
			self.t = e_
			self.e = b_
			self.w = t_
			self.b = w_
		else:
			return
	
	def rotate_right(self):
		s_ = self.s
		w_ = self.w
		n_ = self.n
		e_ = self.e
		self.s = e_
		self.w = s_
		self.n = w_
		self.e = n_

	def set_top(self, face):
		if self.t == face:
			return
		elif self.s == face:
			self.roll('N')
		elif self.e == face:
			self.roll('W')
		elif self.w == face:
			self.roll('E')
		elif self.n == face:
			self.roll('S')
		else:
			self.roll('N')
			self.roll('N')
			
	def get_right_face(self, f):
		if self.s == f:
			return self.e
		elif self.e == f:
			return self.n
		elif self.w == f:
			return self.s
		else:
			return self.w
	
	def is_identical(self, other):		
		directions = 'NWWEESEES'
		for direction in directions:
			for i in range(4):
				if self.is_matchall(other): return True
				self.rotate_right()		
			self.roll(direction)
		return False
	
	def is_identical_(self, other):
		
		if self.is_matchall(other):return True
		self.roll('S')
		if self.is_matchall(other):return True
		self.roll('N')
		self.roll('E')
		if self.is_matchall(other):return True
		self.roll('W')
		self.roll('W')
		if self.is_matchall(other):return True
		self.roll('E')
		self.roll('N')
		if self.is_matchall(other):return True
		self.roll('N')
		if self.is_matchall(other):return True
		self.roll('S')
		self.roll('S')
		self.roll('E')
		self.roll('E')
		if self.is_matchall(other):return True
		return False


	def is_matchall(self, other):
		if self.t != other.t: return False
		if self.s != other.s: return False
		if self.e != other.e: return False
		if self.w != other.w: return False
		if self.n != other.n: return False
		if self.b != other.b: return False
		return True
		
faces1 = list(map(int, input().split()))
faces2 = list(map(int, input().split()))
dice1 = Dice(faces1)
dice2 = Dice(faces2)

if dice1.is_identical(dice2):
	print('Yes')
else:
	print('No')



Measured memory_bytes: 5628
N = int(input())

S = [input() for i in range(N)]

res = [0, 0, 0, 0]
for i in S:
    if i == 'AC':
        res[0] += 1
    elif i == 'WA':
        res[1] += 1
    elif i == 'TLE':
        res[2] += 1
    elif i == 'RE':
        res[3] += 1

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


Measured memory_bytes: 16328
#define LOCAL
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e15)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-8)    //0.0000001 the value
#define PI (acos((ld)-1.0))
#define MAXN (100006)
#define ll long double 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < (ll)ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll((x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <char, pi> spi;
typedef pair <pi, pi> dpi;
// inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
// string to_string(char c) {string s(1,c);return s;}string to_string(bool b){return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}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;}void degug_out() { cerr << endl; }template <typename Head, typename... Tail>void degug_out(Head H, Tail... T) {cerr << " " << to_string(H);degug_out(T...);}inline ll gcd(ll a,ll b){if(a>b)swap(a,b);if(a==0)return b;return gcd(b%a,a);}
#ifdef LOCAL
#define degug(...) cerr << "[" << #__VA_ARGS__ << "]:", degug_out(__VA_ARGS__)
#else
#define degug(...) 42
#define cerr if(0)cout
#endif
ll n; spi A[MAXN];
ll tstar(ll x){
	ll mxx=-LLINF,mix=LLINF,may=-LLINF,miy=LLINF;
	FOR(ii,0,n){ int i=ii;
		ll movex=0,movey=0;
		if(A[i].f=='L'){
			movex-=x;
		}else if(A[i].f=='R'){
			movex+=x;
		}else if(A[i].f=='D'){
			movey-=x;
		}else if(A[i].f=='U'){
			movey+=x;
		}else assert(0);
		mxx=max(mxx,movex+A[i].s.f);
		mix=min(mix,movex+A[i].s.f);
		may=max(may,movey+A[i].s.s);
		miy=min(miy,movey+A[i].s.s);
	}
	return (mxx-mix)*(may-miy);
}
int main()
{
	FAST
	cin>>n;
	FOR(i,0,n){
		cin>>A[(int)i].s.f>>A[(int)i].s.s>>A[(int)i].f;
	}
	ll st=0,en=1e12;
	for(ll i=0;i<=200;++i){
		ll lmid=st+(en-st)/(ld)3;
		ll umid=en-(en-st)/(ld)3;
		if(tstar(lmid)>tstar(umid))st=lmid;
		else en=umid;
	}
	cout<<fixed<<setprecision(15)<<tstar((st+en)/(ld)2)<<'\n';
}


Measured memory_bytes: 4992
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

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

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

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

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

int main(void){  
  int n,m,a,b,c,t,h,p,q,r;
  while(cin >> n >> m,n){
    int cost[100][100]={0};
    int time[100][100]={0};
    REP(i,n){
    cin >> a >> b >> c >> t;
    cost[a-1][b-1] = cost[b-1][a-1] = c;
    time[a-1][b-1] = time[b-1][a-1] = t;
  }
  REP(i,m)
    REP(j,m){
      if(!cost[i][j]&&i!=j) cost[i][j] = 1000000000;
      if(!time[i][j]&&i!=j) time[i][j] = 1000000000;
    }
  REP(k,m)
    REP(i,m)
      REP(j,m){
        cost[i][j] = min(cost[i][j],cost[i][k] + cost[k][j]);
        time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
      }
  cin >> h;
  REP(i,h){
    cin >> p >> q >> r;
    if(r==0) cout << cost[p-1][q-1] << endl;
    else cout << time[p-1][q-1] << endl;
  }
  }
  return 0;
}

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

S = input().strip()
T = input().strip()
#-----

check_ST_dic={}
check_TS_dic={}

for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s not in check_ST_dic:
        check_ST_dic[s] = t
    elif check_ST_dic[s] != t:
        print("No")
        break

    if t not in check_TS_dic:
        check_TS_dic[t] = s
    elif check_TS_dic[t] != s:
        print("No")
        break
    
else:
    print("Yes")


Measured memory_bytes: 3632
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll x;
	scan(x);
	ll ans=(x/11+(x%11!=0))*2;
	if(x%11>=1&&x%11<=6) ans--;
	prin(ans);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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 ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



int main(){

    int n,m;
    cin >> n;
    ll d[200005] = {},t[200005] = {};

    rep(i,0,n)cin >> d[i];
    cin >> m;
    rep(i,0,m)cin >> t[i];

    sort(d,d+n);
    sort(t,t+m);

    int dd = 0,tt = 0;

    while(tt < m && dd < n){
        if(d[dd] == t[tt]){
            dd++;
            tt++;
        }else if(d[dd] < t[tt]){
            dd++;
        }else{
            NO;
            ret 0;
        }

        if(dd >= n && tt < m){
            NO;
            ret 0;
        }
    }
    YES;
	return  0;
}

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

const int _mx = 2e6;
int arr[_mx+5];

int main() {
    // freopen("in.txt", "r", stdin);

    int n, x = 0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> arr[i];
    for (int i = 0; i < n; i++) {
        for (int j = n-1; j > i; j--) {
            if (arr[j] < arr[j-1]) swap(arr[j], arr[j-1]), x++;
        }
    }
    cout << arr[0];
    for (int i = 1; i < n; i++) cout << " " << arr[i];
    cout << endl << x << endl;

    return 0;
}



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

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 1050000000;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int A[300][300];

struct edge{ int to, cost;};
typedef pair<LL, int> P;

int V;
vector<edge> G[300];
LL d[300];

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P> > que;
    REP(i, 300){ d[i] = INFL; }
    d[s] = 0;
    que.push(P(0LL, s));

    while(!que.empty()){
        P p = que.top(); que.pop();
        int v = p.second;
        if(d[v] < p.first){ continue; }
        REP(i, G[v].size()){
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main(){
    int N;
    cin >> N;
    vector<pair<int, PII> > vec;
    REP(i, N){
        REP(j, N){
            int tmp;
            cin >> tmp;
            A[i][j] = tmp;
            if(i < j){
                vec.PB(MP(tmp, MP(i,j)));
            }
        }
    }

    sort(ALL(vec));
    REP(i, vec.size()){
        int now_cos = vec[i].first;
        int s = vec[i].second.first;
        int t = vec[i].second.second;
        dijkstra(s);
        if(d[t] < now_cos){
            cout << -1 << endl;
            return 0;
        }else if(d[t] > now_cos){
            edge e1,e2;
            e1.to = t;
            e1.cost = now_cos;
            G[s].PB(e1);
            e2.to = s;
            e2.cost = now_cos;
            G[t].PB(e2);
        }
    }

    LL ans = 0;
    REP(i, N){
        REP(j, G[i].size()){
            ans += G[i][j].cost;
        }
    }

    cout << ans / 2 << endl;
}


Measured memory_bytes: 1276
#include <cstdio>


int main(){
	int n;
	scanf("%d", &n);
	short a[n+1];
	int c[10001];
	for(int i = 0; i < 10001; i++){
		c[i] = 0;
	}
	for(int i = 1; i <= n; i++){
		scanf("%hd", &a[i]);
	}
	
	for(int i = 1; i <= n; i++){
		c[a[i]]++;
	}

	for(int i = 1; i < 10001; i++){
		c[i] = c[i] + c[i-1];
	}

	short b[n+1];

	for(int i = n; i > 0; i--){
		b[c[a[i]]] = a[i];
		c[a[i]]--;
	}
	
	
	for(int i = 1; i <= n; i++){
		if(i > 1){
			printf(" ");
		}
		printf("%d", b[i]);
	}
	printf("\n");
	
	return 0;
}

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

const int MAX_N = 2e5 + 3;
int B[MAX_N];

int main()
{
    int N, K;
    cin >> N >> K;
    for(int i = 0; i < N; ++i) {
        int tmp; cin >> tmp; ++B[tmp];
    }
    int cnt = 0,
        res = 0;
    priority_queue<int, vector<int>, greater<int>> que;
    for(int i = 0; i <=N; ++i) {
        if(B[i] > 0) { que.push(B[i]); ++cnt; }
    }
    cnt -= K;
    for(int i = 0; i < cnt; ++i) {
        res += que.top(); que.pop();
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  string s;
  cin >> s;
  ll w;
  cin >> w;
  string ans;
  for (ll i = 0; i < sz(s);i+=w){
    ans += s[i];
  }
  print(ans);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int judge(int ,int ,int );
int judge(int a,int b,int c)
{
    int num=a*100+b*10+c;
    if(num%4==0)
    {
        return 1;
    }
    return 0;
}
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    printf((judge(a,b,c)==1)?"YES\n":"NO\n");
    return 0;
}


Measured memory_bytes: 128
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int H, W, h, w;
	
	cin >> H >> W >> h >> w;

	cout << (H-h) * (W - w) << endl;
	

	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> PA;
typedef priority_queue<int> PQ;
typedef vector<int> VE;
#define int long long
#define INF 1000000009
#define mod 1000000007
#define pb push_back
#define MAXN 100005

int n, a[MAXN], b[3], c;
string s, t;

signed main()
{
    cin >> s >> t;
    for(int i = 0; i < s.size(); i++){
        string d;
        for(int j = i; j - i < s.size(); j++){
            if(j < s.size()){
                d += s[j];
            }
            else{
                d += s[j - s.size()];
            }
        }
        if(d == t){
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");



    return 0;
}



Measured memory_bytes: 256