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

using namespace std;

#define INF 1000000

int main(){
  int n, m;
  cin >> n >> m;
  
  vector<int> a(m);
  vector<int> c(m, 0);
  for(int i = 0; i < m; i++){
    int b;
    cin >> a[i] >> b;
    for(int j = 0; j < b; j++){
      int key;
      cin >> key;
      c[i] |= (1 << (key - 1));
    }
  }
  
  int cost[(1 << n)];
  for(int i = 0; i < (1 << n); i++) cost[i] = INF;
  
  cost[0] = 0;
  
  for(int i = 0; i < (1 << n); i++){
    for(int j = 0; j < m; j++){
      cost[i | c[j]] = min(cost[i | c[j]], cost[i] + a[j]);
    }
  }
  
  int cost_all = cost[(1 << n) - 1];
  cout << (cost_all == INF ? -1 : cost_all) << endl;
  
  return 0;
}

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

int f(vector<int> A)
{
	vector<int> R;
	rep(i,A.size())
	{
		R.push_back(i+1);
	}
	int res = 1;
	do {
		bool flag = true;
		rep(i,A.size())
		{
			//cout << A[i] << " " << R[i] << endl;
			if (A[i] != R[i])
			{
				flag = false;
				break;
			}
		}
		if (flag) return res;
		res++;
	} while (next_permutation(R.begin(), R.end()));
	return 0;
}

int main()
{
	int N;
	cin >> N;
	rep(i,N)
	{
		int p;
		cin >> p;
		P.push_back(p);
	}
	rep(i,N)
	{
		int q;
		cin >> q;
		Q.push_back(q);
	}
	//cout << f(P) << " " << f(Q) << endl;
	cout << abs(f(P) - f(Q)) << endl;
	return 0;
}

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define ll                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define endl                                      '\n'

inline void INP();
const int N = 403, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int arr[N], n, Q;
ll sum[N], dp[N][N];

ll getans(int s, int e)
{     
      if( s >= e ) return 0;
      ll &mafia = dp[s][e];
      if( mafia != -1 ) return mafia;

      ll ans = INF;
      
      for(ll i = s; i < e; i++)
      {
            ll a1 = getans(s,i), a2 = getans(i+1, e);
            ll sum1 = sum[i] - sum[s-1], sum2 = sum[e] - sum[i];
            ll res = a1 + a2 + sum1 + sum2;
            ans = min(ans, res);
      }

      return mafia = ans;
}
void solve()
{
      cin >> n;
      lop(i,1,n+1) cin >> arr[i];
      lop(i,1,n+1) sum[i] = sum[i-1] + arr[i];
      lop(i,0,n+1) lop(j,i,n+1) dp[i][j] = -1;
      cout << getans(1, n);
}


int32_t main()
{
      
      ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);
      int t = 1;
      //cin >> t;
      while(t--) solve();

}














// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //




      

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

#define memc(X) memset(X,0,sizeof(X))
#define ll long long
#define ic(i, a, b) for(int i=(a);i<(b);i++)
#define dc(i, a, b) for(int i=(a);i>(b);i--)

using namespace std;

int n;
int odd[100009];
int even[100009];
int arr[100009];

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    for (int i = 0; i < n; i += 2) {
        odd[arr[i]]++;
        even[arr[(i ^ 1)]]++;
    }
    int om = 0, em = 0, om2 = 0, em2 = 0;
    for (int i = 0; i < 100009; i++) {
        if (om < odd[i]) {
            om = odd[i];
            om2 = i;
        }
        if (em < even[i]) {
            em = even[i];
            em2 = i;
        }
    }
    if (om2 != em2) {
        cout << (n - om - em) << endl;
    }
    else {
        int ot = 0, et = 0;
        for (int i = 0; i < 100009; i++) {
            if (ot <= odd[i] && i != om2) {
                ot = odd[i];
            }
            if (et < even[i] && i != em2) {
                et = even[i];
            }
        }
        cout << min((n - om - et), (n - em - ot));
    }
    return 0;
}

Measured memory_bytes: 1408
S =input()
T =input()
convert_dict = {}

for i,s in enumerate(S):
    t = T[i]
    if s not in convert_dict:
        convert_dict[s]=t
    else:
        if convert_dict[s]==t:
            continue
        print("No")
        exit()

#duplicate check
if not len(convert_dict.keys()) == len(set(convert_dict.values())):
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3760
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define INF 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}

bool cmp(pii a, pii b){
    if(a.ft == b.ft) return a.sd < b.sd;
    return a.ft > b.ft;
}
void solve(){
    ll n, m, x;
    cin >> n >> m >> x;
    ll a[m];
    rep(i, m) cin >> a[i];
    ll aa = 0, bb = 0;
    for(ll i = x-1; i >= 0; i--){
        rep(j, m)
            if(i == a[j]) aa++;
    }
    for(ll i = x+1; i < n; i++){
        rep(j, m)
            if(i == a[j]) bb++;
    }
    cout << min(aa, bb);
}
main(){
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
c = {"1":"", "2":"k", "3":"s", "4":"t", "5":"n",
     "6":"h","7":"m", "8":"y", "9":"r", "0":"w"}
m = {"T":"a", "L":"i", "U":"u", "R":"e", "D":"o"}
s = input()
ans = ""
for i in range(0, len(s), 2):
  com = s[i:i+2]
  if com == "0U":ans += "nn"
  else:ans += c[com[0]] + m[com[1]]
print(ans)


Measured memory_bytes: 5568
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}

vector<int>v[maxn];
int dis[maxn][3];
int visited[maxn][3];

int32_t main(){
	fastio();
	int n,m;
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		int a,b;
		cin >> a >> b;
		v[a].push_back(b);
	}
	for(int i = 1; i <= n; i++){
		for(int j = 0; j < 3; j++){
			dis[i][j] = mod;
		}
	}
	int s,t;
	cin >> s >> t;
	dis[s][0] = 0;
	visited[s][0] = 1;
	queue<pair<int,int>>q;
	q.push({s,0});
	while(!q.empty()){
		pair<int,int> p = q.front();
		q.pop();
		int k = dis[p.first][p.second];
		for(auto i:v[p.first]){
			if(!visited[i][(k + 1) % 3]){
				visited[i][(k + 1) % 3] = 1;
				dis[i][(k+ 1) % 3] = k + 1;
				q.push({i, (k + 1) % 3});
			}
		}
	}

	if(visited[t][0]) cout << dis[t][0] / 3;
	else cout << "-1";
}

Measured memory_bytes: 13780
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
const int mod = 998244353;

int main() {
    string S, T, U;
    long long A, B;
    cin >> S >> T >> A >> B >> U;
    if (S == U) {
        A -= 1;
    }
    else if (T == U) {
        B -= 1;
    }
    cout << A << " " << B << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll MOD=1e9+7;

ll power(ll x, ll n){
	// cout<<x<<" "<<n<<endl;
	if(n==0)return 1;
	else {
		ll ans=1;
		if(n%2==1)ans*=x;
		ll c=power(x, n/2);
		ans=(ans*((c*c)%MOD))%MOD;
		return ans;
	}
}

int main(){
	ll n;
	cin>>n;
	ll ans=(power(10, n)-2*power(9, n)+power(8, n)+2*MOD)%MOD;
	// cout<<power(10, n)<<" "<<power(9, n)<<" "<<power(8, n)<<endl;
	cout<<ans;
}

Measured memory_bytes: 3624
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c,m[3];
    scanf("%d%d%d",&a,&b,&c);
    m[0]=a+b;
    m[1]=a+c;
    m[2]=b+c;
    sort(m,m+3);
    printf("%d",m[0]);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
typedef long long ll;
int main(void){
    ll n,a,b,l,r,ans=0;
    cin>>n>>a>>b>>l;
    for(int i=0;i<n-1;i++){
        cin>>r;
        ans+=min(a*(r-l),b);
        l=r;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

int main(){
  int r;
  cin >> r;
  cout << (int)pow(r, 2)*3 << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long lint;



int main(){
    int a,b;
    cin >> a >> b;
    
    REP(i, max(a,b)){
        cout << min(a,b);
    }
    cout <<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 55555;
bool prime[N];
vector<int> p;

int main(){
    fill(prime,prime+N,true);
    prime[0] = prime[1] = false;
    for(int i=2; i<N; ++i){
        if(prime[i])for(int j=2*i; j<N; j+=i) prime[j] = false;
    }
    rep(i,N)if(prime[i]) p.pb(i);

    int n;
    cin >>n;

    vector<int> v;
    for(int i:p){
        if(i%5==1){
            v.pb(i);
            if(v.size() == n) break;
        }
    }

    rep(i,n) cout << v[i] << " \n"[i==n-1];
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

template<typename T>
class lazy_segment_tree{
	int n;
	T fval;
	vector<T> dat, lazy;
	
public:
	
	lazy_segment_tree(){
		
	}
	
	lazy_segment_tree(int n_, T val){
		init(n_, val);
	}
	
	~lazy_segment_tree(){
		
	}
	
	void init(int n_, T val){
		fval = val;
		
		n = 1;
		
		while(n < n_) n *= 2;
		
		dat.resize(2 * n - 1);
		lazy.resize(2 * n - 1, fval);
	
		for(int i = 0; i < 2 * n - 1; i++) dat[i] = fval;
	}
	
	void eval(int k, int l, int r){
		
		if(lazy[k] != fval){
			dat[k] = dat[k] + lazy[k]/(r - l);
			
			if(r - l > 1) {
				lazy[2*k+1] = lazy[2*k+1] + lazy[k]/2;
				lazy[2*k+2] = lazy[2*k+2] + lazy[k]/2;
			}
			
			lazy[k] = 0;
		}
	}
	
	void update(int a, int b, T x, int k = 0, int l = 0, int r = -1){
		if(r < 0) r = n;
		eval(k, l, r);
		if(b <= l || r <= a) {return ;}
		if(a <= l && r <= b){
			lazy[k] = lazy[k] + (r - l) * x;
			eval(k, l, r);
		} else {
			update(a, b, x, 2*k+1, l, (l+r)/2);
			update(a, b, x, 2*k+2, (l+r)/2, r);
			dat[k] = min(dat[2*k+1], dat[2*k+2]);
		}
	}
	
	T query(int a, int b, int k = 0, int l = 0, int r = -1){
		if(r < 0) r = n;
		eval(k, l, r);
		if(r <= a || b <= l){
			return INF;
		}
		if(a <= l && r <= b){
			return dat[k];
		}else {
			T vl = query(a, b, k * 2 + 1, l, (l + r) / 2 );
			T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
			return min(vl, vr);
		}
	}
};

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	lazy_segment_tree<long long> lseg;
	
	int n, q;
	
	cin>>n>>q;
	
	lseg.init(n+10, 0);
	
	for(int i = 0; i < q; i++){
		int com, s, t, x;
		cin>>com>>s>>t;
		s++, t++;
		if(com){
			cout<<lseg.query(s,t+1)<<endl;
		} else {
			cin>>x;
			lseg.update(s, t+1, x);
		}
	}
	
	return 0;
}


Measured memory_bytes: 7064
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

ll f(ll x) {
	if (x % 2) return ((x + 1) / 2) % 2;
	return (((x + 1) / 2) % 2) ^ x;
}

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

	ll A, B;
	cin >> A >> B;
	if (A > 0) cout << (f(A - 1) ^ f(B)) << "\n";
	else cout << f(B) << "\n";
	
	return 0;
}

Measured memory_bytes: 256
symboldict = {'S':0, 'H':1, 'C':2, 'D':3} 
cardlist = [[0 for i in range(13)] for j in range(4)] 

total = int(input())
for i in range(total):
    sym, num = input().split()
    cardlist[symboldict[sym]][int(num) - 1] = 1
cnt = 0;
numdict = {num:sym for sym,num in symboldict.items()}
for j in range(len(cardlist)):
    for i in range(len(cardlist[j])):
        if cardlist[j][i] == 0:
            print(numdict[j], i + 1)

Measured memory_bytes: 5612
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  
  for(int i=0;i<k;i++){
    vector<int> nxt(n,0);
    for(int j=0;j<n;j++){
      int l = max(0,j-a[j]);
      int r = min(n-1,j+a[j]);
      nxt[l]++;
      if(r<n-1){
        nxt[r+1]--;
      }
    }
    for(int j=1;j<n;j++){
      nxt[j] += nxt[j-1];
    }
    
    if(a==nxt) break;
    else a = nxt;
  }
  for(int i=0;i<n;i++){
    cout << a[i] << (i==n-1 ? "\n" : " ");
  }
}


Measured memory_bytes: 4780
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}
ll sft[3] = {3, 5, 7};

ll N;

bool check(ll x) {
    set<ll> s;
    while(x > 0) {
        ll k = x % 10;
        s.insert(k);
        x /= 10;
    }
    if(s.size() == 3) return true;
    return false;
}

int dfs (ll  x) {
    ll res = 0;
    if(check(x)) res ++;
    rep(i, 3) {
       ll y = x * 10 + sft[i];
       if(y <= N) {
           res += dfs(y);
       }
    }
    return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  ll ans = dfs(0);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
//b.c B-Polygon
#include<stdio.h>

int main(void){
    int n;
    scanf("%d",&n);
    int l[n];
    for(int i=0;i<n;++i){
        scanf("%d",&l[i]);
    }

    int max = l[0];
    int sum = 0;
    for(int i=0;i<n;++i){
        if(max<l[i]){
            max = l[i];
        }
        sum += l[i];
    }
    if(max<(sum-max)){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;

vector<ll> inv,fact,invfact;
void mod_build(int n=101010){
    fact.resize(n+1);
    inv.resize(n+1);
    invfact.resize(n+1);
    fact[0]=inv[0]=invfact[0]=1;
    inv[1]=1;
    rep(i,n){
        fact[i+1]=fact[i]*(i+1)%mod;
        if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
        invfact[i+1]=invfact[i]*inv[i+1]%mod;
    }
}
ll perm(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}
ll powmod(ll n,ll k){
    k%=mod-1;
    if(k<0)k+=mod-1;
    ll ret=1;
    while(k){
        if(k&1)ret=ret*n%mod;
        n=n*n%mod;
        k>>=1;
    }
    return ret;
}
int main(){
    int m = 1e6+5;
    mod_build(m);
    vector<ll> sum(m);
    int n;
    cin>>n;
    ll a[n];
    rep(i,n){
        cin>>a[i];
        sum[a[i]]+=a[i];
        sum[a[i]]%=mod;
    }
    vector<int> prime, isprime(m,1);
  for(int i=2;i<m;++i){
    if(!isprime[i])continue;
    prime.push_back(i);
    for(int j=2*i;j<m;j+=i){
      isprime[j]=false;
      }
    }
  for(auto p:prime){
    int k=(m-1)/p;
    for(int i=k;i>0;--i){
      sum[i]+=sum[i*p];
      if(sum[i]>=mod)sum[i]-=mod;
      }
    }
  for(int i=1;i<m;++i)sum[i]=sum[i]*sum[i]%mod;
  for(auto p:prime){
    int k=(m-1)/p;
    for(int i=1;i<=k;++i){
      sum[i]-=sum[i*p];
      if(sum[i]<0)sum[i]+=mod;
      }
    }
    ll ans = 0;
    rep(i,m){
        ans += sum[i]*inv[i]%mod;
    }
    ans%=mod;
    rep(i,n)ans+=mod-a[i]%mod;
    ans%=mod;
    cout<<ans*inv[2]%mod<<endl;

    return 0;
}

Measured memory_bytes: 37628
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int x;
  cin >> x;

  cout << !x << endl;

  return 0;
}


Measured memory_bytes: 3628
n = int(input())
A = list(map(int, input().split()))
m = max(A) 
min = float("inf")
for i in range(n):
  if min > abs(A[i] - m/2) and A[i] != m: 
    min = abs(A[i] - m/2)
    r = A[i]
print(m,r)


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

int main() {
  int a, b;

  cin >> a >> b;

  if (a == 0 || b == 0 || (a < 0 && b > 0))
    cout << "Zero";
  else if ((a < 0 && b < 0 && (a - b) % 2 == 0))
    cout << "Negative";
  else
    cout << "Positive";

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

ll x;

void solve(){
    cin >> x;
    rep(a,1000){
        rep(b,1000){
            ll a_=a,b_=b;
            ll A=a_*a_*a_*a_*a_;
            ll B=b_*b_*b_*b_*b_;
            if(A-B==x) {
                cout << a_ << " " << b_ << endl;
                return;
            }
            if(A+B==x) {
                cout << a_ << " " << -b_ << endl;
                return;
            }
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

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

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

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

  reverse(str.begin(), str.end());
  for(int i=0;i<4;i++) reverse(divide[i].begin(), divide[i].end());

  bool can = true;
  bool can_tmp;
  int check = 0;
  while(check < str.size()){
    can_tmp = false;
	for(int i=0;i<4;i++){
	  if(str.substr(check, divide[i].size()) == divide[i]){
	    can_tmp = true;
		check += divide[i].size();
	  }
	}
	if(!can_tmp){
	  can = false;
	  break;
	}
  }
  if(can) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


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

int main() {
  int a,b;
  int wa;
  long long kekka;
  bool chk = false;
  cin >> a >> b;
  
  wa = stoi(to_string(a) + to_string(b));
  
  for(int i = 1; i < wa; i++){
    if(i*i == wa){
      chk = true;
    }
  }
  
  if(chk == true) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 256
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " <<"LINE:"<<__LINE__<<"  "<< #i <<":"<< i << std::endl

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<ll, ll>;

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

  ll n,a,b;
  std::cin>>n>>a>>b;

  if((b-a)%2==0)std::cout<<"Alice\n";
  else std::cout<<"Borys\n";

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
using ll = long long;
template<typename T>
using vec = vector<T>;
using P = pair<ll, ll>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[51][52];

ll n, ans = 0;

void calc(ll x){
	string s = to_string(x);
	int m = s.size();
	bool used[3] = {};
	REP(i, m){
		if(s[i] == '3')used[0]=true;
		if(s[i] == '5')used[1]=true;
		if(s[i] == '7')used[2]=true;
	}
	if(used[0] && used[1] && used[2])ans++;
	ll nx = x * 10 + 3;
	if(nx <= n)calc(nx);
	nx = x * 10 + 5;
	if(nx <= n)calc(nx);
	nx = x * 10 + 7;
	if(nx <= n)calc(nx);
}

signed main(){
	IOS;
	cin >> n;
	calc(0);
	dump(ans);
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
k = sum(b)-sum(a)
c,d = 0,0
for i in range(n):
  e = b[i]-a[i]
  if e<=0:
    d -= e
  else:
    c+= (e+1)//2
    d+= e%2 
print("Yes" if k>=c and k>=d else "No")

Measured memory_bytes: 10560
# include "iostream"
# include "cstdio"

using namespace std;

const int maxm=1e5+10;

int N;
bool Visit[maxm];

int main(){
	register int Now,Step;
	scanf("%d",&N);
	Visit[N]=1;
	Step=1;
	while(1){
		Now=(N&1)?(3*N+1):(N>>1);
		Step++;
		if(Visit[Now]){
			printf("%d",Step);
			break;
		}else{
			Visit[Now]=Step;
		}
		N=Now;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <time.h>
#define int long long int
#define pb push_back
#define mem(a, x) memset(a, x, sizeof a)
#define all(a) a.begin(), a.end()
#define scnarr(a, n) for (int i = 0; i < n; ++i) cin >> a[i]
#define vi vector<int>
#define si set<int>
#define pii pair <int, int>
#define sii set<pii>
#define vii vector<pii>
#define mii map <int, int>
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace chrono;
/*
	----------------------------------------------------------------------
	Things to remember : check for coners n = 1, pass references instead
*/
/* -------------------------------Solution Sarted--------------------------------------*/

//Constants
const int MOD = 1000000007; // 1e9 + 7
const int MAXN = 1000005; // 1e6 +5
const int INF = 100000000000005; // 1e15 +5

void solve(){
	int n;
	cin >> n;
	if(n < 3){
		cout << "0\n";
		return;
	}
	vi dp(n +1, 0);
	dp[0] = 1;
	for(int i = 3; i <= n; ++i){
		for(int j = 0; j + 3 <= i; ++j){
			dp[i] = (dp[i] + dp[j]) % MOD;
		}
	}

	cout << (dp[n] % MOD) << endl;
}

signed main()
{
	faster;
#ifndef ONLINE_JUDGE
	freopen("ip.txt", "r", stdin);
	freopen("op.txt", "w", stdout);
#endif
	// int t; cin >> t; while(t--)
		solve();
	return 0;
}


//Author : Ankit Raj
//Problem Link :

/*Snippets*/
/*
sieve - prime factorization using sieve and primes in range
zpower - pow with mod
plate - Initial template
bfs 
dfs
fenwik - BIT
binary_search
segment_tree
*/


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
const int MOD = 1000000007;
using namespace std;

int main(){
    int r,g,b;
	cin >> r >> g >> b;
    if((g*10+b)%4==0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

class UnionFind {
    vector<int> par;
    int n;

public:
    UnionFind(int n) : par(n, -1) {}

    int find(int x) {
        if (par[x] < 0) return x;
        return par[x] = find(par[x]);
    }

    bool unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }
};

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

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

    int a[m], b[m];
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }

    UnionFind uf(n);

    vector <ll> ans(m);
    vector <ll> sz(n, 1);

    ll sm = (ll)n * (ll)(n-1) / 2;
    for (int i = m-1; i >= 0; i--) {
        ans[i] = sm;
        int pa = uf.find(a[i]);
        int pb = uf.find(b[i]);
        if (pa == pb) continue;

        sm -= sz[pa] * sz[pb];
        int sum = sz[pa] + sz[pb];
        uf.unite(pa, pb);
        sz[uf.find(pa)] = sum;
    }

    for (ll ret : ans) {
        cout << ret << "\n";
    }

    return 0;
}

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

# わからなかったので､他の人の回答をパクりました｡
# リストの中身を金太郎飴みたいにその都度作って､
# 今まで作った飴と新しい飴が重複したときの番号を出力するやつは
# set()で作る｡

n = int(input())
a = set()
count = 0

a.add(n)

for i in range(2, 100000):

    if n % 2 == 0:
        n = n // 2
    else:
        n = 3 * n + 1

    if n in a:
        count = i
        break

    a.add(n)

print(count)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

int main() {
	int a,b;
	scanf("%d%d",&a,&b);
	if(a>b){
		printf("safe");
	} else{
		puts("unsafe") ;
	}
} 

Measured memory_bytes: 3692
using System;
using System.Linq;
using System.Collections.Generic;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string[] str=Console.ReadLine().Split(' ');
      int A=int.Parse(str[0]);
      int B=int.Parse(str[1]);
      int K=int.Parse(str[2]);
      List<int> intList = new List<int>();
      
     for(int i=1;i<=Math.Min(A,B);i++){
      if(((A%i)==0)&&((B%i)==0)){
        
        intList.Add(i);
 
      }
     }
         int[] arr=intList.ToArray();
      Array.Sort(arr);
      Array.Reverse(arr);
      Console.WriteLine(arr[K-1]);
    }
    
  }

}


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

int main(){
  vector<int> m(5);
  for(int i=0;i<5;i++)
    cin >> m.at(i);
  
  int k=10;
  
  for(int i=0;i<5;i++)
    k=min(k,(m.at(i)-1)%10);
  
  int l=0;
  
  for(int i=0;i<5;i++)
    l+=(m.at(i)-1)/10+1;
  
  cout << (l-1)*10+k+1 << endl;
}

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

int main() {
    long long n, a, min = 1000000, max = -1000000, sum = 0;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> a;
        if(a > max) max = a;
        if(a < min) min = a;
        sum += a;
    }
    cout << min << " " << max << " " << sum << "\n";
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll gcd(ll x, ll y) {
    // 最大公約数を求める
    if (y == 0)
        return x;
    gcd(y, x % y);
}

ll lcm(ll x, ll y) {
    // 最小公倍数を求める
    ll GCD = gcd(x, y);
    ll ans = x / GCD * y;
    return ans;
}

ll lcm(vector<ll> x) {
    // すべての vector の最小公倍数を求める
    ll ans = x[0];
    if (x.size() == 1) {
        return ans;
    }
    for (ll i = 1; i < x.size(); i++) {
        ans = lcm(ans, x[i]);
    }
    return ans;
}

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

    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    A--;
    auto lc = lcm(C, D);

    ll ans = (B - A) -
             ((B / C) + (B / D) - (A / C) - (A / D) - (B / (lc)) + (A / (lc)));

    std::cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<stdbool.h>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<set>
#include<string>
#include<stdlib.h>
typedef long long ll;
using namespace std;

//stringの使い方
int main(void) {
	int w, h, n;
	cin >> w >> h >> n;
	int xmax = w, xmin = 0, ymax = h, ymin = 0;
	int x, y, a;
	for (int i = 0;i < n;i++) {
		cin >> x >> y >> a;
		if (a == 1) {
			if (xmin <= x) {
				xmin = x;
			}
		}
		if (a == 2) {
			if (x <= xmax) {
				xmax = x;
			}
		}
		if (a == 3) {
			if (ymin <= y) {
				ymin = y;
			}
		}
		if (a == 4) {
			if (y <= ymax) {
				ymax = y;
			}
		}
	}
	if (xmax - xmin <= 0 || ymax - ymin <= 0)cout << 0 << endl;
	else cout << (xmax - xmin)*(ymax - ymin) << endl;
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	
	int ans=1;
	for(int i=0; ; i++){
		if(n >= ans*2){
			ans*=2;
		}else{
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
 
static const  int N =  100;
static const  int no =  -1;
 
int graph[N][N] = {{}};
int d[N] = {};
int n;
 
void bfs(int v){
  vector<int> V;
  V.push_back(v);
  int u;
    for(int i = 1;i <= n; i++){
      d[i] = no;
     
}
  d[v] = 0;
 
  while(!V.empty()){
    u = V.front();
    V.erase(V.begin());
 
    for(int i = 1;i <= n; i++){
      if(graph[u][i] == 0) continue;
      if(d[i] != no) continue;
      d[i] = d[u] +1;
      V.push_back(i);
    }
  }
}
 
 
int main(){
  int u,v,k;
  cin >> n ;
 
  for(int i = 0; i < n; i++){
    cin >> u >> k ;
    for(int j = 0; j < k ; j++){
      cin >> v;
      graph[u][v] = 1;
    }
  }
 
 
  bfs(1);
 
  for(int i = 1;i <= n; i++){
    cout << i << " " << d[i] << endl;
  }
 
  return 0;
}

Measured memory_bytes: 1252
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
int nmax=200000;
vvec g(nmax);



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    string s,t;
    cin>>s>>t;
    vec a(30);
    vec b(30);
    rep(i,s.size()){
        a[s[i]-'a']++;
    }
    rep(i,t.size()){
        b[t[i]-'a']++;
    }
    sort(all(a));
    sort(all(b));
    int ng=0;
    rep(i,30){
        if(a[i]!=b[i]) ng++;
    }
    if(ng==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main() {
 int n, x; cin >> n>>x;
  vector<int> l(n);
  for(int i = 0; i<n;i++) cin >> l[i];
  int ans = 1;
  int d = 0;
  for(int i = 0;i<n;i++){
    if(d+l[i]<=x){
      ans++;
      d = d+l[i];
    } else {
      d = d+l[i];
    }
  }
  cout << ans << endl;
}



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

int main() {
  ll a;
  string b;
  cin >> a >> b;
  int bb = (b[0]-'0') * 100 + (b[2]-'0') * 10 + (b[3]-'0');
  a *= bb;
  a /= 100;
  cout << a << endl;
}



Measured memory_bytes: 3620
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int c[3][3];
    for (int i=0; i<3; i++) {
        for (int j=0; j<3; j++) {
            cin >> c[i][j];
        }
    }

    int a[3],b[3];
    bool ans = false;
    for (int i=0; i<=100; i++) {
        int a[3],b[3];
        a[0] = i;
        for (int j=0; j<3; j++) b[j] = c[0][j] - a[0];
        a[1] = c[1][0] - b[0];
        a[2] = c[2][0] - b[0];

        bool f = true;
        for (int j=0; j<3; j++) {
            for (int k=0; k<3; k++) {
                if (c[j][k] != a[j] + b[k]) f = false;
            }
        }
        if (f) ans = true;
    }

    cout << (ans? "Yes" : "No") << endl;
}

/*
 * a1+b1 a1+b2 a1+b3
 * a2+b1 a2+b2 a2+b3
 * a3+b1 a3+b2 a3+b3
 */

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>

int main(){
	double x[4],y[4],a[3],b[3],c[3],cx[1000],cy[1000],rx,ry,r[1000];
	int i,n,j;
	
	scanf("%d",&n);
	for(j=0;j<n;j++){
	
	for(i=0;i<3;i++)scanf("%lf%lf",&x[i],&y[i]);
	a[0]=2*(x[1]-x[0]);
	b[0]=2*(y[1]-y[0]);
	c[0]=x[0]*x[0]-x[1]*x[1]+y[0]*y[0]-y[1]*y[1];
	a[1]=2*(x[2]-x[0]);
	b[1]=2*(y[2]-y[0]);
	c[1]=x[0]*x[0]-x[2]*x[2]+y[0]*y[0]-y[2]*y[2];
	
	cx[j]=(b[0]*c[1]-b[1]*c[0])/(a[0]*b[1]-a[1]*b[0]);
	cy[j]=(c[0]*a[1]-c[1]*a[0])/(a[0]*b[1]-a[1]*b[0]);
	
	rx=x[0]-cx[j];
	ry=y[0]-cy[j];
	r[j]=sqrt(rx*rx+ry*ry);
	
	}
	
	for(i=0;i<n;i++)printf("%.3f %.3f %.3f\n",cx[i],cy[i],r[i]);
	
	return 0;
}

Measured memory_bytes: 1104
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        int R=sc.nextInt();
        if(N<10){
            pl(100*(10-N)+R);

        }
        else{
            pl(R);
        }
    }
    public static void pl(Object o){
        System.out.println(o);
    }
    public static void p(Object o){
        System.out.println(o);
    }
}


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

int main(){
    int n,k;
    cin >> n >> k;
    int x[n];
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }
    int sum = 0;
    for(int i = 0 ;i < n; i++){
        sum += 2 * min(k-x[i],x[i]-0);
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 256
fn main(){
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).unwrap();
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).unwrap();
	let vec: Vec<&str> = s.trim().split(' ').collect();
	let mut a: Vec<i32> = Vec::new();
	for v in &vec {
		a.push(v.parse().unwrap());
	}
	a.sort();
	a.reverse();
	let mut alice = 0;
	let mut bob = 0;
	let mut ab = false;
	for i in &a {
		if !ab {
			alice += *i;
		} else {
			bob += *i;
		}
		ab = !ab;
	}
	println!("{}", alice - bob);
}


Measured memory_bytes: 4352
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=t.in(),r=t.in(),n=new Array(e),i=0;i<e;i++)n[i]=t.in();for(var o=0,s=0;s<=r;s++)for(var u=0;u<=r-s;u++){for(var c=r-s-u,a=[],f=0;f<Math.min(s,e);f++)a.push(n[f]);for(var l=e-1;l>Math.max(e-1-u,s-1,0);l--)a.push(n[l]);a.sort(function(t,e){return t-e});for(var p=0,d=0;d<a.length;d++)a[d]<0&&c>0?c--:p+=a[d];o=Math.max(o,p)}console.log(o)}}]);


Measured memory_bytes: 10616
#include "bits/stdc++.h"
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vp = vector<Pii>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

  int w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << setprecision(10) << (w * h) / 2.0 << " ";
  cout << (x * 2 == w && y * 2 == h ? 1 : 0) << endl;

}


Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#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 = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

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

int main(){
    string str;
    cin >> str;
    bool moved[4];
    REP(i, 4) moved[i] = false;

    REP(i, str.size()){
        if(str[i] == 'S') moved[0] = true;
        if(str[i] == 'N') moved[1] = true;
        if(str[i] == 'W') moved[2] = true;
        if(str[i] == 'E') moved[3] = true;
    }

    if(!(moved[0] ^ moved[1]) && !(moved[2] ^ moved[3])) cout << "Yes" << endl;
    else cout << "No" << endl;

}


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

bool is_left(char c){
	if(c=='q' || c=='a' || c=='z' || c=='w' || c=='s' || c=='x' || c=='e' || c=='d' || c=='c' || c=='r' ||
		c=='f' || c=='v' || c=='t' || c=='g' || c=='b') return true;
	else return false;
}

int main()
{
	string s;
	while(cin>>s){
		if(s=="#") return 0;
		bool left=is_left(s[0]);
		int ans=0;
		for(int i=1;i<s.size();i++){
			if(left && !is_left(s[i])) ans++;
			if(!left && is_left(s[i])) ans++;
			left=is_left(s[i]);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (int)(n); i++)
 
int main() {
    ll k,s;
    cin>>k>>s;
    ll cnt=0;
    rep(x,k+1){
        rep(y,k+1){
            ll z=s-(x+y);
            if (z>=0 and z<=k){
                cnt++;
            }
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
int n;
int a[3];
cin >> n;
for(int x=0;x<n;x++){
for(int i=0;i<3;i++)cin >> a[i];
sort(a,a+3);
if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])printf("YES\n");
else printf("NO\n");
}
return 0;
}

Measured memory_bytes: 1132
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>

#include <cfenv>
#include <cmath>
typedef long long int ll;

using namespace std;

int main()
{

    ll N;

    cin >> N;

    vector<ll> A(N);

    map<int, int> mp;


    ll sum=0;

    for (ll i = 1; i <= N; i++)
    {

        ll a;
        cin >> a;

        sum +=mp[i-a];

        mp[i+a]++;

    
    }

    

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 21900