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

using namespace std;

using ll = long long;

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

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

    vector<int> cnt(m);
    for (int i = 0, k; i < n; ++i) {
        cin >> k;
        for (int j = 0, a; j < k; ++j) {
            cin >> a;
            ++cnt[a - 1];
        }
    }

    int res = 0;
    for (int i = 0; i < m; ++i)
        if (cnt[i] == n) ++res;
    cout << res << endl;

    return 0;
}


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

int main() {
  string s;
  ll k;
  cin >> s >> k;
  rep(i,min((ll)s.size(),k)) {
    if (s[i]!='1') {
      cout << s[i] << endl;
      return 0;
    }
  }
  cout << '1' << endl;
  return 0;

}

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

int main(){
  int N; cin >> N;
  int amari = N%10;
  if(amari == 2 || amari == 4 || amari == 5 || amari == 7 || amari == 9){
    cout << "hon";
  }
  else if(amari == 3){
    cout << "bon";
  }
  else{
    cout << "pon";
  }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int n,a[1000010];
long long suma,sumb,ans;
inline int read()
{
	int x=0,f=1;
	char c=getchar();
	while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f; 
}
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
	}
	int j=0;
	for(int i=1;i<=n;i++)
	{
		while((suma^a[j+1])==(sumb+a[j+1])&&j<n)
		{
			suma^=a[++j];
			sumb+=a[j];
		}
		ans+=j-i+1;
		suma^=a[i];
		sumb-=a[i];
	}
	cout<<ans;
} 

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

int bit_count(int s,int N){
    int count =0;
    for(int i=0;i!=N;++i){
        if(s&(1<<i)){
           
            ++count;
        }
    }
    return count;
}

int main(){

    int N,M;
    scanf("%d",&N); //スウィッチの数
    scanf("%d",&M); //電球
    
    int bulb[M];
    for(int i=0;i!=M;++i){
        bulb[i]=0;
    }
    int k;
    int s;
    
    for(int i=0;i!=M;++i){
        scanf("%d",&k);
        for(int j=0;j!=k;++j){
            scanf("%d",&s);
            //bitset<10> b(bulb[i]);
            //cout<<b<<endl;
            bulb[i]=bulb[i]|(1<<(s-1));
            //b=bulb[i];
            //cout<<b<<endl;
        }
    }
    
    int count=0;
    int p[M];
    for(int i=0;i!=M;++i){
        scanf("%d",&p[i]);
    }
    
    for(int sw=0;sw!=(1<<N);++sw){
        bool flag=true;
        for(int i=0;i!=M;++i){
            //bitset<10> b1=sw;
            //cout<<b1<<endl;
            int tmp=sw&bulb[i];
            //b1=tmp;
            //cout<<b1<<endl;
            //cout<<"bit_count:"<<bit_count(tmp, N)<<endl;
            if(bit_count(tmp,N)%2!=p[i]){
                flag=false;
            }
            
           // cout<<boolalpha<<flag<<endl;
        }
        //cout<<"==============="<<endl;
        if(flag){
            ++count;
        }
    }
    printf("%d\n",count);
     
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
using vb = vector<bool>;
using vb2 = vector<vector<bool>>;
using vc = vector<char>;
using vc2 = vector<vector<char>>;
using vs = vector<string>;
using si = set<int>;
using vs2 = vector<vector<string>>;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
const long double PI = acos(-1.0);

#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define sz(x) (int)(x).size()
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
 
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SORT(v) sort(ALL(v));
#define RSORT(v) sort(RALL(v));
#define IN(type,a) type a;cin >> a;
#define VIN(type,a,n) vector<type> a(n);cin >> a;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
#define ENDL cout << endl;
#define DB(s,x) cout << (s) << " : " << x << endl;
 
#define HOGE COUT("HOGE")
 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}
 
template<typename T> bool chmax(T& a, const T& b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T& a, const T& b){if(a>b){a=b;return true;}return false;}
template<typename T> T gcd(T a,T b){if(b==0){return a;}else{return gcd(b, a%b);}}



const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
int main() {
    IN(int, n);
    VIN(int, a, n);
    int ans = 0;
    for (int i = 0; i < n; i += 2) {
        if (a[i]%2==1) {
            ans++;
        }
    }
    COUT(ans);
}


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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

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

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;


vll p, t;

ll rec(ll n, ll x){
  if(x==t[n]) return p[n];
  
  ll ans=0;
  x--;
  
  if(x>0){
    ll l=min(x,t[n-1]);
    ans+=rec(n-1,l);
    x-=l;
  }
  
  if(x>0){
    ans++;
    x--;
  }
  
  if(x>0){
    ll l=min(x,t[n-1]);
    ans+=rec(n-1,l);
    x-=l;
  }
  
  return ans;
}


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,x; cin>>n>>x;
  p.resize(n+1), t.resize(n+1);
  p[0]=t[0]=1;
  reps(i,n){
    p[i]=p[i-1]*2+1;
    t[i]=t[i-1]*2+3;
  }
  
  cout<<rec(n,x)<<endl;
  
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif
#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;
const int MOD=1e9+7;
const int INF=1<<29;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m=MOD){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
void solve(){
  int n,sum=0,mean;
  cin>>n;
  vector<int> v(n);
  for(auto& it:v){
	   cin>>it;
	   it*=n;
	   sum+=it; 
	 }
	 mean=sum/n;
	 int ans=0;
	 for(int i=1;i<n;i++){
		  if(abs(v[i]-mean)<abs(v[ans]-mean))ans=i; 
		}
   cout<<ans<<endl;
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
    IOS;
    solve();
    #ifdef LOCAL_DEFINE
    cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
    #endif
}


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

using namespace std;

// point
#define x first
#define y second
using pt = pair<int, int>;

const int N = 300300;
const int inf = 1e9;

int w, h, n;
pt a[N];
int t[N << 2];
int ad[N << 2];

void push(int v) {
   if (ad[v]) {
      t[v << 1] += ad[v];
      ad[v << 1] += ad[v];
      t[v << 1 | 1] += ad[v];
      ad[v << 1 | 1] += ad[v];
      ad[v] = 0;
   }
}

void build(int v, int l, int r) {
   t[v] = h - a[l].x;
   ad[v] = 0;
   if (l < r) {
      int md = (l + r) >> 1;
      build(v << 1, l, md);
      build(v << 1 | 1, md + 1, r);
   }
}

void add(int v, int l, int r, int L, int R, int val) {
   if (L <= l && r <= R) {
      t[v] += val;
      ad[v] += val;
      return;
   }
   push(v);
   int md = (l + r) >> 1;
   if (L <= md) {
      add(v << 1, l, md, L, R, val);
   }
   if (md < R) {
      add(v << 1 | 1, md + 1, r, L, R, val);
   }
   t[v] = max(t[v << 1], t[v << 1 | 1]);
}

int ans;
int ups[N];
int downs[N];

void solve() {
   sort(a + 1, a + n + 1);
   build(1, 0, n);
   int md = h >> 1; // cut line
   int uc = 0;
   int dc = 0;
   for (int i = 1; i <= n; ++i) {
      ans = max(ans, t[1] + a[i].x);
      if (a[i].y > md) {
         // modify ups
         add(1, 0, n, ups[uc], i - 1, a[i].y - h);
         for (; uc && a[ups[uc]].y > a[i].y; --uc) {
            add(1, 0, n, ups[uc - 1], ups[uc] - 1, a[i].y - a[ups[uc]].y);
         }
         ups[++uc] = i;
      } else {
         // modify downs
         add(1, 0, n, downs[dc], i - 1, -a[i].y);
         for (; dc && a[downs[dc]].y < a[i].y; --dc) {
            add(1, 0, n, downs[dc - 1], downs[dc] - 1, a[downs[dc]].y - a[i].y);
         }
         downs[++dc] = i;
      }
   }
   ans = max(ans, w + t[1]);
}

int main() {
   ios_base::sync_with_stdio(false);
   cin >> w >> h >> n;
   for (int i = 1; i <= n; ++i) {
      cin >> a[i].x >> a[i].y;
   }
   solve();
   for (int i = 1; i <= n; ++i) {
      swap(a[i].x, a[i].y);
   }
   swap(w, h);
   solve();
   cout << ans * 2 << "\n";
}



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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n = input_int()
    s_list = [input() for i in range(n)]

    import collections
    counter = collections.Counter(s_list)

    for s in ["AC", "WA", "TLE", "RE"]:
        print(s + " x " + str(counter.get(s, 0)))

if __name__ == "__main__":
    main()


Measured memory_bytes: 16532
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
vector<string>in;
int n,m;
bool func(int a,int b,int c,int d,char e){
	loop(i,a,c+1)loop(j,b,d+1)if(in[i][j]!=e&&in[i][j]!='*')return 0;
	return 1;
}
bool f(){
	loop(k,'A','Z'+1){
		int x1=inf,x2=-1,y1=inf,y2=-1;
		bool h=false;
		rep(i,n)rep(j,m)if(in[i][j]==k){
			x1=min(x1,i);
			y1=min(y1,j);
			x2=max(x2,i);
			y2=max(y2,j);
			h=true;
		}
		if(h&&func(x1,y1,x2,y2,k)){
			loop(i,x1,x2+1)loop(j,y1,y2+1)in[i][j]='*';
			return 1;
		}
	}
	return 0;
}
int main(){
	int z;
	cin>>z;
	while(z--){
		cin>>n>>m;
		in=vector<string>(n);
		rep(i,n)cin>>in[i];
		while(f());
		bool h=true;
		rep(i,n)rep(j,m)if(in[i][j]!='.'&&in[i][j]!='*')h=false;
		if(h)cout<<"SAFE"<<endl;
		else cout<<"SUSPICIOUS"<<endl;
	}
}

Measured memory_bytes: 1216
# include <iostream>
using namespace std;
int main(void)
{
	int n,a[100],ans = 0;
	scanf("%d",&n);
	for(int i = 0;i < n;i++) scanf("%d",&a[i]);
	for(int i = 0;i < n-1;i++)
	{
		int index = i;
		for(int j = i+1;j < n;j++) if(a[j] < a[index]) index = j;
		if(index != i)
		{
			ans++;
			swap(a[i],a[index]); 
		}
	}
	for(int i = 0;i < n;i++) printf("%d%c",a[i],(i == n-1)?'\n':' ');
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3220
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<float.h>
using namespace std;


int main() {
    int a, b;
    cin >> a>>b;
    if ((a + b) % 2 == 0) {
        cout << (a + b) / 2 << endl;
    }
    else cout << (a + b) / 2 + 1 << endl;
  
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
    ios::sync_with_stdio(false);
    ll x, k, d, temp;
    cin>>x>>k>>d;
    if(x<0)
        x = -x;
    temp = x/d;
    if(temp>=k)
        cout<<x-k*d;
    else if((k-temp)&1)
        cout<<(temp+1)*d-x;
    else
        cout<<x-temp*d;
    return 0;
}


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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}


int main(){

    int Q;
    cin >> Q;
    while(Q--){
        ll A, B;
        cin >> A >> B;
        ll C = A * B;
        ll ub = 1000000001;
        ll lb = 0;
        while(ub - lb > 1){
            ll mid = (ub + lb) / 2;
            if(mid * mid <= C){
                lb = mid;
            }
            else{
                ub = mid;
            }
        }

        ll S = lb;

        if(A == B){
            cout << 2*S - 2 << endl;
        }
        else if(S * S == C){
            cout<< 2*S - 3 << endl;
        }
        else{
            if(C / S - (C % S == 0) == S){
                cout << 2 * S - 2 << endl;
            }
            else{
                cout << 2 * S - 1 << endl;
            }
        }
    }
    

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <queue>
#include <map>

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define F first
#define S second

#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 rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

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

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

constexpr ll MOD = 1000000007LL;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

template<typename T = ll> class UnionFind {
public:
	UnionFind( T n ) { rep( i, n ) { par[i] = i; siz[i] = 1; } }
	T find( T x ) { if ( x == par[x] ) return ( x ); else return( par[x] = find( par[x] ) ); }
	void unite( T x, T y ) { T xx = find( x ); T yy = find( y ); if ( xx == yy ) return;
		if ( siz[xx] <= siz[yy] ) swap( xx, yy ); par[yy] = xx; siz[xx] += siz[yy]; }
private:
	vector<T> par, siz;
};

template<typename T = ll> T power( T a, T b, T m = MOD ) {
	T res = 1;
	while ( b > 0 ) { if ( b & 1 ) res = res * a % m;
		a = a * a % m; b >>= 1; }
	return ( res );
}

/*
constexpr ll MAX = 500010;
ll fact[MAX];
ll inv[MAX];
ll inv_fact[MAX];

template<typename T> void initComb( T n, T m = MOD )
{
	fact[0] = fact[1] = inv_fact[0] = inv_fact[1] = 1;
	inv[1] = 1;
	for ( int i = 2; i < n; i++ ) {
		fact[i] = ( fact[i - 1] * i ) % m;
		inv[i] = m - inv[m % i] * ( m / i ) % m;
		inv_fact[i] = inv_fact[i - 1] * inv[i] % m;
	}
}

template<typename T> T comb( T n, T r, T m = MOD )
{
	if ( n < r ) return ( 0 );
	if ( n < 0 || r < 0 ) return ( 0 );
	return ( fact[n] * ( inv_fact[r] * inv_fact[n - r] % m ) % m );
}
*/

void replace( string &s, string t, string r ) {
	string::size_type p = 0;
	while ( ( p = s.find( t, p ) ) != string::npos ) {
		s.replace( p, t.length(), r );
		p += r.length();
	}
}


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

	priority_queue<string, vector<string>, greater<string>> q;
	map<string, int> m;

	int N = s.size();
	rep( i, N )
	{
		for ( int j = 1; j <= K; j++ )
		{
			m[s.substr( i, j )] = 1;
		}
	}

	arep( it, m )
	{
		q.emplace( it.F );
	}

	rep( i, K - 1 )
	{
		q.pop();
	}

	cout << q.top() << endl;

	return ( 0 );
}


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

const double EPS = 1e-8;
const double INF = 1e12;

//point
typedef complex<double> P;
namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
double cross(const P& a, const P& b) {
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}
// line
struct L : public vector<P> {
	L(const P& a, const P& b) {
		push_back(a); push_back(b);
	}
};

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;								  // a--c--b on line
}

bool intersectLL(const L &l, const L &m) {
  return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS || // non-parallel
         abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // same line
}
bool intersectLS(const L &l, const L &s) {
  return cross(l[1]-l[0], s[0]-l[0])*       // s[0] is left of l
         cross(l[1]-l[0], s[1]-l[0]) < EPS; // s[1] is right of l
}
bool intersectLP(const L &l, const P &p) {
  return abs(cross(l[1]-p, l[0]-p)) < EPS;
}
bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}
bool intersectSP(const L &s, const P &p) {
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}

P projection(const L &l, const P &p) {
	double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
	return l[0] + t*(l[0]-l[1]);
}
P reflection(const L &l, const P &p) {
	return p + (double)2 * (projection(l, p) - p);
}
double distanceLP(const L &l, const P &p) {
	return abs(p - projection(l, p));
}
double distanceLL(const L &l, const L &m) {
	return intersectLL(l, m) ? 0 : distanceLP(l, m[0]);
}
double distanceLS(const L &l, const L &s) {
	if (intersectLS(l, s)) return 0;
	return min(distanceLP(l, s[0]), distanceLP(l, s[1]));
}
double distanceSP(const L &s, const P &p) {
	const P r = projection(s, p);
	if (intersectSP(s, r)) return abs(r - p);
	return min(abs(s[0] - p), abs(s[1] - p));
}
double distanceSS(const L &s, const L &t) {
	if (intersectSS(s, t)) return 0;
		return min({distanceSP(s, t[0]), distanceSP(s, t[1]), distanceSP(t, s[0]), distanceSP(t, s[1])});
}
P crosspoint(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}

int main() {
	double x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	L li(P{x1, y1}, P{x2, y2});
	int q;
	cin >> q;
	for(int i=0; i<q; ++i) {
		double x, y;
		cin >> x >> y;
		P p(x, y);
		P ans = reflection(li, p);
		cout << fixed << setprecision(15) << ans.real() + 0 << " " << ans.imag() + 0 << endl;
	}
	
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, int> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)

int a[55][55]{};
int h,w;

void dfs(int i, int j){
    a[i][j] = 0;
    for(int di = -1;di<=1;++di){
        for(int dj = -1; dj <= 1; ++dj){
            int ni = i+di, nj = j+dj;
            if(ni<0 || ni>=h)continue;
            if(nj<0 || nj>=w)continue;
            if(a[ni][nj]==0)continue;
            dfs(ni,nj);
        }
    }
}

int main() {
    while(1){
        cin >> w >> h;
        if(h==0 && w==0)break;
        REP(i,h)REP(j,w)cin >> a[i][j];
        int ans = 0;
        REP(i,h)REP(j,w)if(a[i][j]){
            dfs(i,j);
            ans++;
        }
        cout << ans << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3260
# coding: utf-8
# Your code here!

line = list(input())
mid = [ line[i] for i in range(2,len(line)-1)]
line2 = [ line[i] for i in range(len(line))]
if "C" in line2 and "A" in line2 :
    line2.remove("A")
    line2.remove("C")


#print(line)
#print(mid)

if line[0] == "A" and mid.count("C") == 1 and ''.join(line2).islower() :
    print("AC")
else:
    print("WA")



#S の先頭の文字は大文字の A である。
#S の先頭から 3 文字目と末尾から 2 文字目の間（両端含む）に大文字の C がちょうど 1 個含まれる。
#以上の A, C を除く S のすべての文字は小文字である。


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x,y,s,ans;
    while(cin >> x >> y >> s,x){
        ans=0;
        for (int i=1;i<s;++i){
            for (int j=1;j<s;++j){
                if (i*(100+x)/100+j*(100+x)/100==s){
                    ans=max(ans,i*(100+y)/100+j*(100+y)/100);
                }
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3136
#include "bits/stdc++.h"
using namespace std;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define nl cout<<"\n"
#define endl "\n"
#define ll long long
#define ld long double
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define f first
#define s second

inline ll max(ll a,ll b) {return ((a>b)?a:b);}
inline ll min(ll a,ll b) {return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b) {if(b==0) return a; a%=b;return gcd(b,a);}
ll power(ll x, ll y){if(y == 0) return 1; ll a = power(x,y/2);if (y % 2 == 0) return a * a; else return x * a * a; }
ll powermod(ll x, ll ex , ll md) {ll ans = 1ll;while (ex > 0) {if (ex & 1ll) ans = (ans * x) % md; ex >>= 1ll;x = (x * x) % md;}return ans;}

const ll inf = 1e18 + 9;
const ll mod = 1e9 + 7;
const ld PI = acos(-1);
const ld eps = 1e-9;

const ll N = 1e6 + 1;

void solve(){
    ll n;
    cin >> n;
    ll a[n];
    ll s= 0 ;
    map<ll ,ll >cnt;
    rep(i , n) {
        cin >> a[i];
        cnt[a[i]]++;
        s += a[i];
    }
    ll q;
    cin >> q;
    while(q--){
        ll a , b;
        cin >> a >> b;
        s = s - (a - b)*cnt[a];
        cnt[b] += cnt[a];
        cnt[a] = 0;

        cout << s << endl;
    }
}
int main(){
    IOS;
    cout << fixed << setprecision(20);
    ll NTC=1;
    // cin>>NTC;
    ll PTC=0;
    while(PTC++<NTC){
        // cout<<"Case #"<<PTC<<":"<<' ';
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 10432
#include <stdio.h>

int n;
char s[300010];
int memo[300010];

int main()
{
    scanf("%d",&n);
    scanf("%s",&s);

    int tmp=0;
    for(int i=0;i<n;i++)
    {
        memo[i]+=tmp;
        if(s[i]=='E') tmp++;
    }
    tmp=0;
    for(int i=n-1;i>=0;i--)
    {
        memo[i]+=tmp;
        if(s[i]=='W') tmp++;
    }
    int max=0;
    for(int i=0;i<n;i++)if(max<memo[i]) max=memo[i];
    printf("%d\n",n-max-1);
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FRE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int long long
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
#define endl "\n"
const int oo = INT_MAX;
const int MOD = 1e9 + 7;
const int sz = 1e5 + 5;
int power(int a, int b, int m){
    int ret = 1;
    while(b){
        if(b & 1) ret = (ret * a) % m;
        b /= 2;
        a = (a * a) % m;
    }
    return ret;
}

int32_t main() {
    IOS;
    
    int tc = 1;
    //cin >> tc;
    while(tc--) {
        int n; cin >> n;
        if(n < 2) {
            return 0 * printf("0\n");
        }
        int ans = 0;
        ans = power(10, n, MOD);
        ans %= MOD;
        ans -= 2 * power(9, n, MOD);
        ans += MOD * 3;
        ans %= MOD;
        ans += power(8, n, MOD);
        ans %= MOD;
        cout << ans % MOD << endl;
    }
}

Measured memory_bytes: 3636
use std::io::{self, Read};
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = io::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 lowest_zeros(x: usize) -> usize {
    let mut low = x ^ (x - 1);
    let mut i = 0usize;
    while low > 0 {
        low >>= 1;
        i += 1;
    }
    i
}

fn main() {
    let n: usize = read();
    for i in 0..(n - 1) {
        for j in i + 1..n {
            print!("{}", lowest_zeros(i ^ j));
            if j < n - 1 {
                print!(" ");
            } else {
                println!("");
            }
        }
    }
}


Measured memory_bytes: 4604
# ans

c = [list(map(int, input().split())) for _ in range(3)]

for i in range(2):
  for j in range(2):
    if c[i][j] - c[i][j+1] == c[i+1][j] - c[i+1][j+1]:
      pass
    else:
      print('No')
      exit()
      
print('Yes')

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String num = br.readLine();
		int k = Integer.parseInt(num);
		if(k/10 ==9 || k%10 == 9) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define FOR(i, s, n) for(int i = s; i <= (int)n; ++i)
#define per(i, n) for(int i = n; i > 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define MP make_pair
#define PB push_back
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define int long long
using namespace std;
static const int INF = 1ll<<60;
int feld[15][10005];
int temp[15][10005];
int wide_white[10005];
int wide_black[10005];
int white;
int h,w;
int ans=-INF;
int v;
vector<int> tera;

void cal(int bit){
    int res=0;
    white=0;
    for(int x=0;x<=w;++x){
        wide_black[x]=0;
        wide_white[x]=0;
    }
    for(int y=1;y<=h;++y)for(int x=1;x<=w;++x)temp[y][x]=feld[y][x];
    for(int i=0;i<=h;++i){
        int b=1<<i;
        if(b&bit){
            tera.PB(i);
        }
    }
    for(int i=0;i<tera.size();++i){
        int t=tera[i];
        for(int x=1;x<=w;++x){
            temp[t][x]=!temp[t][x];
        }
    }

    /*for(int y=1;y<=h;++y){
        for(int x=1;x<=w;++x)cout<<temp[y][x];
        cout<<endl;
    }
    cout<<endl;*/
    for(int y=1;y<=h;++y){
        for(int x=1;x<=w;++x){
            if(temp[y][x]==0)white++;
        }
    }
    for(int x=1;x<=w;++x){
        for(int y=1;y<=h;++y){
            if(temp[y][x]==0)wide_black[x]++;
            else wide_white[x]++;
        }
    }
    res=white;
    for(int x=1;x<=w;++x){
        //cout<<wide_white[x]<<" "<<white<<" "<<wide_black[x]<<endl;
        res+=max(wide_white[x]-wide_black[x],0ll);
    }
    //cout<<"["<<res<<"]"<<endl;
    ans=max(ans,res);
}

signed main(){
    while(1){
        cin>>h>>w;
        if(h==0&&w==0)break;
        for(int y=1;y<=h;++y)for(int x=1;x<=w;++x)cin>>feld[y][x];
        cal(0);
        for(int i=0;i<=pow(2,h+1);++i){
            v=i;
            //cout<<i<<endl;
            tera.clear();
            cal(i);
        }
        cout<<ans<<endl;
        ans=0;
    }
}

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

namespace ProgrammingContest_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long ans = Solve(n);
            Console.WriteLine(ans);
        }

        private static long Solve(int n)
        {
            var dic = new Dictionary<int, int>();

            for (int i = 2; i <= n; i++)
            {
                int value = i;

                for (int j = 2; j <= i; j++)
                {
                    while (value % j == 0)
                    {
                        if (!dic.ContainsKey(j))
                        {
                            dic.Add(j, 0);
                        }

                        dic[j]++;
                        value /= j;
                    }
                }
            }

            long ans = 1;
            const long Mod = 1000000000 + 7;

            foreach (var num in dic.Values)
            {
                ans = (ans * (num + 1)) % Mod;
            }

            return ans;
        }
    }
}


Measured memory_bytes: 2904
using System;
using System.Linq;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            // ITP1_7_B
            while (true) {
                var input = Console.ReadLine().Split(' ');
                if (input.Length != 2) break;
                
                if (!ITP1_7_B(input)) break;
            }
        }

        static bool ITP1_7_B(string[] input)
        {
            var n = int.Parse(input[0]);
            var x = int.Parse(input[1]);
            if (n == 0 && x == 0) return false;

            var count = 0;
            for (var i = 1; i <= n - 2; ++i) {
                for (var j = i + 1; j <= n - 1; ++j) {
                    for (var k = j + 1; k <= n; ++k) {
                        if (i + j + k == x) {
                            count++;
                        }
                    }
                }
            }

            Console.WriteLine(count);
            return true;
        }
    }
}



Measured memory_bytes: 15952
var
	a:array[0..100010] of int64;
	i,j,n,v,w,c,max:longint;
begin
	readln(n,v);
	fillchar(a,sizeof(a),0);
	for i:=1 to n do
	begin
		read(c,w);
		for j:=v downto c do
			if w+a[j-c]>a[j] then a[j]:=w+a[j-c];
	end;
	writeln(a[v]);
end.

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int,int> 
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
//int 2×10の9乗
//vector<vector<int>> a(n, vector<int>(m));
  //rep(i,n) rep(j,m) cin >> a[i][j]; 
//cout << fixed << setprecision(10);
//int gcd(int x, int y){
  //if(y==0) return x;
  //return gcd(y, x%y);
//}
//sort小さい順(昇順)
//g++ code.cpp   ./a.out 
int main(){
  int n;
  cin >> n;
  vector<char> s(n);
  int ans=0;
  rep(i,n){
    cin >> s[i];
    if(s[i]!=s[i-1]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
	int a, b, c;
	cin >> a >> b >> c;
	if(a <= b && a <= c){
		cout << a << " ";
		if(b <= c){
			cout << b << " " << c << endl;
		}else{
			cout << c << " " << b << endl;
		}
	}else if(b <= c && b <= a){
		cout << b << " ";
		if(a <= c){
			cout << a << " " << c << endl;
		}else{
			cout << c << " " << a << endl;
		}
	}else{
		cout << c << " ";
		if(a <= b){
			cout << a << " " << b << endl;
		}else{
			cout << b << " " << a << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3080
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	var ans int
	var tmp int
	for i:=n; i>0; i--{
		if n%i == 0{
			tmp = n/i-1
		} else {
			tmp = n/i
		}

		ans += tmp
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    friend std::istream &operator>>(std::istream &in, mint &o) {
        ll a;
        in >> a;
        o = a;
        return in;
    }

    friend std::ostream &operator<<(std::ostream &out, const mint &o) {
        out << o.x;
        return out;
    }

};

struct combination {
    vector<mint> fact, ifact;

    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }

    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
} combination(1000000);

int main() {

    ll s;
    cin >> s;

    mint ans = 0;
    for (ll len = 1; len <= s; len++) {
        ll tail = len * 3;
        ll rem = s - tail;
        if (rem < 0) continue;
        mint now = combination(len + rem - 1, rem);
        ans += now;

    }
    cout << ans << endl;

}


Measured memory_bytes: 18640
r, g, b, n = gets.split.map(&:to_i)
rgs = Array.new(n + 1, 0)
(0..(n / r)).each do |rxc|
  rbc = r * rxc
  (0..((n - rbc) / g)).each do |gxc|
    gbc = g * gxc
    rgs[rbc + gbc] += 1
  end
end
res = (0..(n / b)).sum do |bxc|
  rgs[n - b * bxc]
end
p res

Measured memory_bytes: 14300
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
    int h,w;
    string s;
    cin >> h >> w;
    for(int i = 0;i < h + 2;i++)
    {
        if(i == 0 || i == h + 1)
        {
            for(int j = 0;j < w + 2;j++)
            {
                cout << '#';
            }
            cout << '\n';
        }
        else
        {
            cin >> s;
            cout << '#' << s << '#' << endl;
        }
    }
    return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm(a, b) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

vector<int> Div(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);

            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int a, b, m;
    cin >> a >> b >> m;
    vector< int > v, vv;
    for( int i = 0; i < a; ++i ) {
        int x;
        cin >> x;
        v.pb(x);

    }
    for( int i = 0; i < b; ++i ) {
        int x;
        cin >> x;
        vv.pb(x);

    }
    vector< int > t;
    for( int i = 0; i < m; ++i ) {
        int x, y, c;
        cin >> x >> y >> c;
        t.pb(v[x - 1] + vv[y - 1] - c);

    }
    sort(all(v));
    sort(all(vv));
    t.pb(v[0] + vv[0]);
    sort(all(t));
    cout << t[0] << endl;


    return 0;
}


Measured memory_bytes: 1784
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)      for(int i=0;i<n;i++)
#define repn(i,n)     for(int i=1;i<=n;i++)
#define rrep(i,n)     for(int i=n-1;i>=0;i--)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
const int N = 1e9;

int main()
{
    _SAD()
    int n;
    cin>>n;
    int cnt=0;
    while(n--)
    {
        int a;
        cin>>a;
        if(a%2==1)
        {
            cnt++;
        }
    }
    if(cnt%2==0)
    {
        cout<<"YES"<<nl;
    }
    else
    {
        cout<<"NO"<<nl;
    }
    return 0;
}


Measured memory_bytes: 256
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    A, B = LI()
    if B % A == 0:
        print(A+B)
    else:
        print(B-A)

main()


Measured memory_bytes: 7752
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)1e5
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	int n,k,i,j;cin>>n>>k;vi v(n+1);for(i=1;i<=n;i++) cin>>v[i];
	vi d(k+1,0);vi p(k+1,1);
	for(i=1;i<=n;i++){
		for(j=0;j<=k;j++){
			if(j-v[i]<=0) d[j]=p[j];
			else d[j]=(p[j]-p[j-v[i]-1]+mod)%mod;
		}p[0]=d[0];for(j=1;j<=k;j++) p[j]=(p[j-1]+d[j])%mod;
	}cout<<d[k]<<endl;
}


Measured memory_bytes: 1792
// https://atcoder.jp/contests/abc053/tasks/abc053_b
"use strict"
function Main(input) {
  const s = input;
  let aIndex = -1;
  let zIndex = -1;
  for(let i =0; i < s.length; i++) {
    if (s[i] === 'A' && aIndex === -1) {
      aIndex = i;
    }
    if (s[i] === 'Z') {
      zIndex = i;
    }
  }

  console.log(zIndex - aIndex + 1);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7756
odd = ["R","U","D"]
even = ["L","U","D"]
s = input()
for i in range(len(s)):
  if i%2 == 0:
    if s[i] not in odd:
      print("No")
      exit()
  elif i%2 == 1:
    if s[i] not in even:
      print("No")
      exit()
print("Yes")
         

Measured memory_bytes: 38384
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

const double eps = 1e-9;
const double inf = 9999999.0;

const double pi = acos(-1.0);
struct point
{
	double x, y;
	point() {}
	point(double x, double y) : x(x), y(y) {}
};

point operator + (const point& p1, const point& p2) { return point(p1.x + p2.x, p1.y + p2.y); }
point operator - (const point& p1, const point& p2) { return point(p1.x - p2.x, p1.y - p2.y); }
point operator * (const point& p1, double d) { return point(p1.x * d, p1.y * d); }
point operator / (const point& p1, double d) { return point(p1.x / d, p1.y / d); }

double sqr(double x) { return x * x; }
double dist(point p1, point p2) { return sqrt(sqr(p1.x - p2.x) + sqr(p1.y - p2.y)); }
double dot(point p1, point p2) { return p1.x * p2.x + p1.y * p2.y; }
double det(point p1, point p2) { return p1.x * p2.y - p1.y * p2.x; }
int dcmp(double x) { return fabs(x) <= eps ? 0 : (x > 0 ? 1 : -1); }

point rot(point p) { return point(-p.y, p.x); }
point mid(point p, point q) { return (p + q) / 2.0; }
point inter(point p, point v, point q, point w)
{
	point u = p - q;
	double t = det(w, u) / det(v, w);
	return p + v * t;
}

double calc(double t, double v0, double v1, double a)
{
	double x = (v1 - v0 + a * t) / (2 * a);
	double vm = v0 + a * x;
	return (v0 + vm) * x / 2.0 + (vm + v1) * (t - x) / 2.0; 
}

double find(double v1, double v2, double L, double a)
{
	double l = fabs(v1 - v2) / a, r = inf;
	for (int i = 1; i <= 100; i ++)
	{
		double mid = (l + r) / 2.0;
		if (calc(mid, v1, v2, a) <= L) l = mid;
		else r = mid;
	}
	return l;
}

int n;
double amax;

point a[100001], b[100001];
double theta[100001], r[100001], l[100001];
double vr[100001];
double len[100001], rad[100001];
double ans = 0.0;

int main( )
{
	scanf("%d", &n);
	scanf("%lf", &amax);
	for (int i = 1; i <= n; i ++)
	{
		scanf("%lf %lf %lf %lf", &a[i].x, &a[i].y, &b[i].x, &b[i].y);
		len[i] = dist(a[i], b[i]);
	}
	for (int i = 1; i < n; i ++)
	{
		point tmpx = b[i], tmpy = a[i + 1];
		point p = mid(tmpx, tmpy), rev = rot(tmpy - tmpx);
		
		point o = inter(p, rev, b[i], rot(a[i] - b[i]));
		rad[i] = dist(b[i], o);
		tmpx = b[i] - a[i];
		tmpy = b[i + 1] - a[i + 1];
		theta[i] = atan2(tmpy.y, tmpy.x) - atan2(tmpx.y, tmpx.x);
		if (dcmp(theta[i]) < 0) theta[i] += 2 * pi;
		if (dcmp(det(b[i] - a[i], a[i + 1] - a[i])) < 0) theta[i] = 2.0 * pi - theta[i];
		double vmax = sqrt(amax * rad[i]);
		r[i] = vmax, l[i + 1] = vmax;
	}
	l[1] = 0, r[n] = 0;
	for (int i = n - 1; i >= 1; i --)
		r[i] = min(r[i], sqrt(2.0 * len[i + 1] * amax + sqr(r[i + 1])));
	for (int i = 2; i <= n; i ++)
		l[i] = sqrt(2.0 * len[i] * amax + sqr(r[i]));
	double now = 0.0; 
	for (int i = 1; i <= n; i ++)
	{
		ans += find(now, r[i], len[i], amax);
		now = min(sqrt(sqr(now) + 2.0 * len[i] * amax), r[i]);
		if (i != n) ans += theta[i] * rad[i] / now;
	}
	printf("%.9f\n", ans);
	return 0;
}
// a = sqr(v) / r;
// r[i] maxv enter the seg
// l[i] 

Measured memory_bytes: 6468
#define _CRT_SECURE_NO_WARNINGS
////#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)

int main() {
	int stone,n,a;
	fscanf(stdin, "%d", &a);
	while (a--) {
		fscanf(stdin, "%d%d", &stone, &n);
		if (stone <= n) P(d, stone);
		else if (!(stone%n))P(d, n);
		else P(d,stone%n);
	}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<algorithm>
#include<cmath>
#define rep(i, n) for(i=1; i<=n; i++)
using namespace std;
int sod(int a)
{
    int sum = 0;
    while(a>0){
        sum += a%10;
        a = a/10;
    }
    return sum;
}
int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int i, count = 0;
    //int sum = 0;
    rep(i, n){
      if(sod(i)>=a && sod(i)<=b) count += i;  
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3676