akhauriyash/Code-Regression huggingface dataset:
//
//  main.cpp
//  C - Tax Increase
//
//  Created by Hashizo on 2020/03/07.
//  Copyright © 2020 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>
#include <cmath>

using namespace std;
 
#undef LONG_MAX
#undef LONG_MIN
 
#define LONG_MAX    9223372036854775807
#define LONG_MIN    (-LONG_MAX  -1)
 
#define ll long long
 
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
 
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())


int main(int argc, const char * argv[]) {

	double a,b;
	cin >> a >> b;

	ll aMin,aMax,bMin,bMax;
	
	aMin = ceil(a / 0.08);
	aMax = (a+0.99) / 0.08;
	
	bMin = b / 0.1;
	bMax = (b+0.99) / 0.1;

	if (aMin <= bMin && aMax >= bMin) {
		cout << bMin << endl;
	}
	else if (aMin <= bMax && aMax >= bMax) {
		cout << aMin << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, T;
double dist[9][9];
double X[9], Y[9];
int vis[9];
int perm[9];
double sum;

int main()
{
	int i, j;
	scanf("%d", &N);
	for (i = 1; i <= N; ++i) {
		scanf("%lf%lf", &X[i], &Y[i]);
	}
	for (i = 1; i <= N; ++i) {
		for (j = 1; j <= N; ++j) {
			double dx = X[i] - X[j];
			double dy = Y[i] - Y[j];
			dist[i][j] = sqrt(dx * dx + dy * dy);
		}
	}
	ll product = 1ll;
	for (ll num = 1ll; num <= N - 1; ++num) {
		product *= num;
	}
	double sum = 0.0;
	for (i = 1; i <= N; ++i) {
		for (j = 1; j <= N; ++j) {
			if (i == j) continue;
			sum += dist[i][j];
		}
	}
	printf("%.7lf", sum / (double)N);
	
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
ll INF = 1LL << 60;

int main() {
  //
  ll n, k, q;
  cin >> n >> k >> q;
  vl cnt(n, 0);
  rep(i, q) {
    ll a;
    cin >> a;
    a--;
    cnt[a]++;
  }
  rep(i, n) {
    if (k - q + cnt[i] > 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    map<int,int> mii;
    rep(i,n){
        int x;
        cin >> x;
        mii[x]++;
    }
    ll ans = 0;
    for(auto u:mii){
        if(u.first != u.second){
            if(u.first < u.second) ans += u.second - u.first;
            else ans += u.second;
        }
    }
    cout << ans << endl;
    return 0;
}

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


void solve(){
	string S; cin >> S;
	ll dp[100005][13];
	int n = S.size();
	rep(i,100005){
      rep(j,13){
        dp[i][j] = 0;
      }
    }
	dp[0][0] = 1;

	rep(i,n){
		int s;
		if(S[i]=='?') s = -1;
		else s = S[i] - '0';

		rep(j,10){
			if(s!=-1 && s!=j) continue;
			rep(k,13){
				dp[i+1][(k*10+j)%13] += dp[i][k];
			}
		}

		rep(j,13) dp[i+1][j] %= MOD;
	}
	cout << dp[n][5] << endl;
}


signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 10704
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF 2e9
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

int main()
{
	long long int n, k,ans;
	cin >> n >> k;

	long long int div;
	ans = n;
	if (ans > k) {
		div = (n - n % k) / k;
		ans = n - div*k;
	}
	if (ans < abs(ans - k))
	{
		cout << ans << endl;
		return 0;
	}
	else cout << abs(ans - k) << endl;
	return 0;
}


Measured memory_bytes: 3548
#include<stdio.h>
int main(void)
{
    int a,b,x;

    scanf("%d %d %d",&a,&b,&x);
    if(x>a+b){
        printf("NO\n");
        return 0;
    }
    if(a>x){
        printf("NO\n");
        return 0;
    }
    printf("YES\n");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n; cin >> n;
  vi a(n); rep(i,n) cin >> a[i];
  int minus = 0, zero = 0;
  rep(i,n){
    if(a[i] < 0) minus++;
    if(a[i] == 0) zero++;
  }
  ll ans = 0;
  int mn = INF;
  rep(i,n){
    ans += abs(a[i]);
    chmin(mn,abs(a[i]));
  }
  if(zero == 0 && minus % 2 == 1) ans -= mn*2;
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3720
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N;
ll M;
ll arr[100005];
ll ans = 0;
ll diff[100005];

int main() {
	scanf("%lld %lld", &N, &M);
	for(int i = 0; i < M; i++) {
		scanf("%lld", &arr[i]);
	}
	sort(arr, arr + M);
	for(int i = 1; i < M; i++) {
		diff[i] = arr[i] - arr[i - 1];
		ans += diff[i];
	}
	sort(diff, diff + M);
	reverse(diff, diff + M);
	// for(int i = 0; i < M - 1; i++) {
	// 	cout << diff[i] << " ";
	// }
	for(int i = 0; i < min(N, M) - 1; i++) {
		ans -=diff[i];
	}
	printf("%lld\n", ans);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int a,b;

int main(){
	cin>>a>>b;
	cout<<max({a+b,a-b,a*b})<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string a;int b;
int main()
{
    cin>>a;
    for(b=2;b<a.size();b++)
    {
        if(a[b]==a[b-1]&&a[b]==a[b-2])
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,a,b;
  a=0;
  b=0;
  cin>>n;
  int v[n],c[n];
  for(int i=0;i<n;i++){
    cin>>v[i];}
  for(int i=0;i<n;i++){
    cin>>c[i];}
  for(int i=0;i<n;i++){
    if(v[i]>c[i]){
      a+=v[i];
      b+=c[i];}
  }
  cout<<a-b<<endl;
}


Measured memory_bytes: 256
local n=io.read("n")
local a={}
for i=1,n do
    a[i]=io.read("n")-i
end
table.sort(a)

if n%2==1 then
    local median=a[n//2+1]
    local sadness=0
    for i=1,n do
        sadness=sadness+math.abs(a[i]-median)
    end
    print(sadness)
else
    local median1=a[n//2]
    local sadness1=0
    local median2=a[n//2+1]
    local sadness2=0
    for i=1,n do
        sadness1=sadness1+math.abs(a[i]-median1)
        sadness2=sadness2+math.abs(a[i]-median2)
    end
    print(math.min(sadness1,sadness2))
end

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

int N;
vector<int> P(10, 0), Q(10, 0);
int Pnum, Qnum;
int Pcount = 1, Qcount = 1; 
vector<int> perm(10, 0), used(10, false);

bool isP(vector<int> &A){
    rep(i, N){
        if(A[i] != P[i]){
            return false;
        }
    }
    return true;
}
bool isQ(vector<int> &A){
    rep(i, N){
        if(A[i] != Q[i]){
            return false;
        }
    }
    return true;
}

void check(vector<int> &A){
    if(isP(A)){
        Pnum = Pcount;
    }
    if(isQ(A)){
        Qnum = Qcount;
    }
    Pcount++;
    Qcount++;
}

void dfs(int pos, int n){
    if(pos == n){
        check(perm);
        return;
    }
    rep(i, n){
        if(!used[i]){
            perm[pos] = i+1;
            used[i] = true;
            dfs(pos+1, n);
            used[i] = false;
        }
    }
}

int main() {
    cin >> N;
    rep(i, N) cin >> P[i];
    rep(i, N) cin >> Q[i];
    dfs(0, N);
    cout << abs(Pnum - Qnum);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

const int N = 5002; 
const ll mod = 1000000007; 


int n; 
ll dp[N][N], f[N], tmp[N], siz[N];
vector <int> G[N];  

void dfs(int u, int pre) {
  siz[u] = 1; dp[u][1] = 1; 
  for(auto v : G[u]) {
    if(v == pre) continue ; 
    dfs(v, u); 
    for(int i = 0; i <= siz[u] + siz[v]; i++) tmp[i] = 0;  
    for(int i = 1; i <= siz[u]; i++) {
      for(int j = 0; j <= siz[v]; j++) {
        tmp[i + j] += dp[u][i] * dp[v][j] % mod; 
        tmp[i + j] %= mod; 
      }
    }
    for(int i = 1; i <= siz[u] + siz[v]; i++) dp[u][i] = tmp[i];  
    siz[u] += siz[v]; 
  }
  for(int i = 2; i <= siz[u]; i += 2) {
    dp[u][0] = (dp[u][0] + dp[u][i] * f[i] % mod) % mod; 
  }
  dp[u][0] = mod - dp[u][0]; 
}

int main() {
  scanf("%d", &n); 
  for(int i = 1; i < n; i++) {
    int u, v; scanf("%d %d", &u, &v); 
    G[u].pb(v), G[v].pb(u); 
  }
  f[0] = 1; f[1] = 0; 
  for(int i = 2; i <= n; i += 2) 
    f[i] = 1ll * f[i - 2] * (i - 1) % mod;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
  dfs(1, 0); 
  printf("%lld\n", mod - dp[1][0]); 
  return 0; 
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int n;
    cin >> n;
    vector<bool> used(n+1);
    int sum=0;
    rep(i,1,n+1){
        sum+=i;
        used[i]=true;
        if(sum<n) continue;
        if(sum==n){
            rep(j,1,i+1){
                if(used[j]) cout << j << endl;
            }
            return;
        }
        if(sum>n){
            used[sum-n]=false;
            rep(j,1,i+1){
                if(used[j]) cout << j << endl;
            }
            return;
        }
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

int main() {
    int n;
    cin >> n;
    int ans = 0;
    if (n == 0 || n == 2) ans = 1;
    if (n == 1) ans = 2;
    cout << ans << endl; 
    return 0;
}


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

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

int keta(int n){
	int sum=1;
	while(n>9){
		sum++;
		n/=10;
	}
	return sum;
}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
  cin >> a >> b;
  (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) ?
    cout << "Possible" << endl : cout << "Impossible" << endl;
}

Measured memory_bytes: 256
import math
a,b,c=map(int,input().split())
S=(a*b*math.sin(math.radians(c)))/2
x=a**2+b**2-2*a*b*math.cos(math.radians(c))
L=a+b+math.sqrt(x)
h=b*math.sin(math.radians(c))
print('{:.8f}'.format(S))
print('{:.8f}'.format(L))
print('{:.8f}'.format(h))



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

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

int main()
{
    char inp[10] = {'\0'};
    scanf("%s", inp);

    inp[3] = inp[0];
    bool ok = false;
    for (int i = 1; i < 4; i++)
        if (inp[i] != inp[i - 1])
            ok = true;

    if (ok)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#define N 2005][2005
int n, m, Q, s, a[N], b[N], c[N], d[N];
int main() {
	int i, j, p, q, x, y;
	scanf("%d%d%d", &n, &m ,&Q);
	for(i=1; i<=n; i++) for(j=1; j<=m; j++) scanf("%1d", &a[i][j]);
	for(i=1; i<=n; i++) for(j=1; j<=m; j++) b[i][j] = b[i-1][j] + b[i][j-1] - b[i-1][j-1] + a[i][j];
	for(i=1; i<=n; i++) for(j=1; j<m; j++)  c[i][j] = c[i-1][j] + c[i][j-1] - c[i-1][j-1] + (a[i][j]&&a[i][j+1]);
	for(i=1; i<n; i++)  for(j=1; j<=m; j++) d[i][j] = d[i-1][j] + d[i][j-1] - d[i-1][j-1] + (a[i][j]&&a[i+1][j]);
	while(Q--) {
		scanf("%d%d%d%d", &p, &q ,&x, &y);
		p--, q--, s = b[x][y] - b[x][q] - b[p][y] + b[p][q];
			 y--, s-= c[x][y] - c[x][q] - c[p][y] + c[p][q];
		x--, y++, s-= d[x][y] - d[x][q] - d[p][y] + d[p][q];
		printf("%d\n", s);
	}
	return 0;
}

Measured memory_bytes: 64512
#include<bits/stdc++.h>
#define randome_generate srand(std::chrono::high_resolution_clock::now().time_since_epoch().count())
using namespace std;
#define flush fflush(stdout);
//Red:1 Blue:2
int n;
int f[101];
char buf[10];
int color[200];
string s;
vector<int> testpack;
void ask(int i){
	if(f[i]!=-1)
		return;
	printf("?");
	for(int j=i;j<=i+n-1;j++)
		printf(" %d",j);
	printf("\n");
	flush;
	scanf("%s",buf);
	s=buf;
	if(s=="Red")
		f[i]=1;
	else
		f[i]=2;
}
int test(){
	printf("?");
	for(int j=0;j<testpack.size();j++)
		printf(" %d",testpack[j]);
	printf("\n");
	flush;
	scanf("%s",buf);
	s=buf;
	if(s=="Red")
		return 1;
	else
		return 2;
}
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		f[i]=-1;
	ask(1);
	f[n+1]=3-f[1];
	int l=1,r=n+1,mid,res;
	while(l+1<r){
		mid=(l+r)/2;
		ask(mid);
		if(f[mid]==f[1])
			l=mid;
		else
			r=mid;
	}
	color[l]=f[1];
	color[l+n]=3-f[1];
	ask(l);
	if(color[l]!=f[1]){
		exit(69);
	}
	vector<int> a,b;
	a.clear();
	for(int i=l+1;i<l+n;i++)
		a.push_back(i);
	for(int i=1;i<l;i++)
		b.push_back(i);
	for(int i=l+n+1;i<=n*2;i++)
		b.push_back(i);
	for(int i=0;i<a.size();i++){
		testpack.clear();
		testpack.push_back(a[i]);
		for(int j=0;j<b.size();j++)
			testpack.push_back(b[j]);
		sort(testpack.begin(),testpack.end());
		color[a[i]]=test();
	}
	for(int i=0;i<b.size();i++){
		testpack.clear();
		testpack.push_back(b[i]);
		for(int j=0;j<a.size();j++)
			testpack.push_back(a[j]);
		sort(testpack.begin(),testpack.end());
		color[b[i]]=test();
	}
	printf("! ");
	for(int i=1;i<=2*n;i++){
		if(color[i]==1)
			printf("R");
		else
			printf("B");
	}
	flush;
	return 0;
}


Measured memory_bytes: 724
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    Sourav Verma IPG_2013  ABV_IIITMG Task @ Codeforces 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/    

#include<bits/stdc++.h>

#define ll                    long long int
#define loop(i,a,b)           for(int i=(int)a;i<(int)b;++i)
#define rloop(i,a,b)          for(int i=(int)a;i<=(int)b;++i)
#define loopr(i,a,b)          for(int i=(int)a;i>=(int)b;--i)
#define count_1(n)            __builtin_popcountll(n)
#define pb                    push_back
#define mset(a,b,c)           loop(i,0,b) a[i]=c
#define F                     first
#define S                     second
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1000000007
#define MAX                   1e9
#define MIN                   -1e9
#define itoc(c)               ((char)(((int)'0')+c))
#define vi                    vector<int>
#define vvi                   vector<vi>
#define pll                   pair<ll,ll>
#define pii                   pair<int,int>
#define all(p)                p.begin(),p.end()
#define mid(s,e)              (s+(e-s)/2)
#define mini                  INT_MIN
#define sv()                  int t; scanf("%d",&t); while(t--)
using namespace std;
ll extgcd(ll a,ll b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extgcd(b,a%b,y,x);y-=a/b*x;return g;}}
ll lcm(int x, int y) { return x * 1ll * y / (int)__gcd(x, y); }
ll hcf(ll a, ll b) {if(b>a) return (hcf(b, a)); if(a%b==0) return b; return (hcf(b, a%b));} 
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}

int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(0);
    int n,l;cin>>n>>l; string s[111];
    loop(i,0,n){
        cin>>s[i];
    }
    sort(s,s+n); string ans="";
    loop(i,0,n){
        ans+=s[i];
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

int main(){
	int n, a; cin >> n >> a;
	
	
	while(n >= 500) n -= 500;
	
	if(n <= a) cout << "Yes" << endl;
	else cout <<"No" << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;


public class Main {

	Scanner sc;
	
	double nd(){
		return sc.nextDouble();
	}
	
	void io(){
		sc=new Scanner (System.in);
		
		int[][] num=new int[4][2];
		for(int[] e:num)Arrays.fill(e,0);
		int side=0;
		
		while(sc.hasNext()){
			double eye=nd();
			if(eye>=1.1) ++num[0][side];
			else if(eye>=0.6) ++num[1][side];
			else if(eye>=0.2) ++num[2][side];
			else ++num[3][side];
			side^=1;
		}
		for(int i=0;i<4;++i)System.out.println(num[i][0]+" "+num[i][1]);
		
		sc.close();
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().io();
	}
}

Measured memory_bytes: 20740
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int L = input[0] + input[1];
            int R = input[2] + input[3];

            if (L > R)
            {
                Console.WriteLine("Left");
            }
            else if (L == R)
            {
                Console.WriteLine("Balanced");
            }
            else
            {
                Console.WriteLine("Right");
            }
        }
    }
}

Measured memory_bytes: 13140
import java.util.*;
import java.io.*;
import java.math.*;
class Main{
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	public static void main(String sp[])throws IOException{
		FastReader sc = new FastReader();
		String s1 = " "+sc.next();
		String s2 = " "+sc.next();
		int n = s1.length();
		int m = s2.length();
		int dp[][] = new int[n+2][m+2];
		for(int i=1;i<n;i++){
			for(int j=1;j<m;j++){
				if(s1.charAt(i)==s2.charAt(j))
					dp[i][j] = dp[i-1][j-1]+1;
				else{
					dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);
				}
			}
		}
	
		
		StringBuilder sb = new StringBuilder();
		int x = n-1;
		int y = m-1;
		while(x>0 && y>0){
			if(dp[x][y-1]==dp[x][y]){
				y-=1;
				//System.out.println("a");
			}else if(dp[x-1][y]==dp[x][y]){
				x-=1;
				//System.out.println("b");
			}else if(dp[x-1][y-1]+1==dp[x][y]){
				sb.append(s1.charAt(x));
				//System.out.println("c");
				y-=1;
				x-=1;
			}
		}
		String fg = sb.reverse().toString();
		System.out.println(fg);
		
	}
	
	public static class pair{
		int count;
		StringBuilder sb = new StringBuilder();
	}
	public static int gentype(int min, int max){
		return new Random().nextInt((max - min) + 1) + min;
	}	
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer sz;


		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (sz == null || !sz.hasMoreTokens()) {
				try {
					sz = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return sz.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}

}


Measured memory_bytes: 80848
#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int main() {
	string s;
	cin >> s;
	int ans = 700;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'o') {
			ans += 100;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import math

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

n = int(input())
ma = int(math.sqrt(10**5))
lis = get_sieve_of_eratosthenes(ma)
l_b = [False]*(10**5+1)
for item1 in lis:
    for item2 in lis:
        if item2 < item1:
            continue
        if item1*item2*3 > 10**5:
            break
        i = 0
        while(item1*item2*(3+i) <= 10**5):
            l_b[item1*item2*(3+i)] = True
            i += 1
for item in lis:
    if item**3 < 10**5:
        l_b[item**3] = False
l_count = [0]*(10**5+1)

for i in range(1,10**5+1):
    if l_b[i]:
        l_count[i] = l_count[i-1] + 1
    else:
        l_count[i] = l_count[i-1]

for _ in range(n):
    num = int(input())
    print(l_count[num])


Measured memory_bytes: 9316
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>

const long INF = (1l << 30);
const long LINF = (1l << 60);

long n, d;

long x[10][10];
long ans;

bool if_square(long a){
    for(int i = 0; i < 10000; i++){
        if(a == i*i){
            return true;
        }
    }
    return false;
}

long dist(long a, long b){
    long ret = 0;
    for(int i = 0; i < d; i++){
        ret += (x[a][i] - x[b][i])*(x[a][i] - x[b][i]);
    }
    return ret;
}

int main(){
    scanf("%ld%ld", &n, &d);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < d; j++){
            scanf("%ld", &x[i][j]);
        }
    }
    for(long i = 0; i < n; i++){
        for(long j = i+1; j < n; j++){
            if(if_square(dist(i, j))){
                ans++;
            }
        }
    }
    printf("%ld\n", ans);
}


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

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
#define SP << " " <<
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007

template <class T> T comb(T n, T r)
{
    if (n < 0 || n < r || r < 0)
        return 0;

    r = min(r, n - r);
    if (r == 0)
        return 1;

    vector<T> numer(r);
    vector<T> denom(r);

    iota(all(numer), n - r + 1);
    iota(all(denom), 1);

    for (T i = 1; i < r; i++) {
        T divisor = denom[i];
        if (divisor > 1) {
            T offset = (n - r) % (i + 1);
            for (T j = i; j < r; j += i + 1) {
                numer[j - offset] /= divisor;
                denom[j] /= divisor;
            }
        }
    }
    
    T p = 1;
    for(T i = 0; i < r; i++) {
        // p *= numer[i];
        p = p * numer[i] % MOD;
    }

    return p;
}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    ll N, K; cin >>N>>K;

    ll ans;

    for (ll i = 1; i <= K; i++) {
        ans = comb(N-K+1, i) * comb(K-1, i-1) % MOD;
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
const int maxn=1e5+7;
const ll modn=1000000007;
const int inf=2e9+7;
const double PI = acos(-1.0);
const double eps=1e-8;
inline int lowbit(int x){return x&-x;}
inline ll lowbit(ll x) {return x&-x;}
inline int CountOneBinary(ll num){int ans=0;while(num){if(num&1) ans+=1;num>>=1;}return ans;}
inline void read(int &x){char c;x=0;for(c=getchar();c>'9'||c<'0';c=getchar());for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';}
inline void read(ll &x){char c;x=0;for(c=getchar();c>'9'||c<'0';c=getchar());for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';}
inline ll qpow(ll x,ll y){ll ans=1;while(y){if(y&1) ans=ans*x%modn;x=x*x%modn;y>>=1;}return ans;}
inline double qpow(double x,ll y){double ans=1;while(y){if(y&1) ans=ans*x;x=x*x;y>>=1;}return ans;}
int cnt[26];
multiset<int> pos[26];
map<int,int> mp[26];
char s[maxn];
int main()
{
    while(scanf("%s",s+1)!=EOF)
    {
        memset(cnt,0,sizeof(cnt));
        for(int i=0;i<26;i++) mp[i].clear(),pos[i].clear();
        bool gt=0;
        for(int i=1;s[i];i++)
        {
            int ts=s[i]-'a';
            cnt[ts]++;
            int tmp=i-2*cnt[ts];
            if(pos[ts].lower_bound(tmp)==pos[ts].end()) pos[ts].insert(tmp),mp[ts][tmp]=i;
            else
            {
                auto iter=pos[ts].lower_bound(tmp);
                printf("%d %d\n",mp[ts][*iter],i);
                gt=1;
                break;
            }
        }
        if(!gt) puts("-1 -1");
    }
}


Measured memory_bytes: 9728
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

#include "bits/stdc++.h"
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	bool flag_odd_minus = false;
	long long int sum_num = 0;

	REP(i, N) {
		cin >> A[i];
		if (A[i] < 0) {
			flag_odd_minus = !flag_odd_minus;
			A[i] = -A[i];
		}
	}

	sort(A.begin(), A.end());

	REP(i, N) {
		sum_num += A[i];
	}

	if (flag_odd_minus) {
		sum_num -= 2 * (long long int)(A[0]);
	}

	cout << sum_num << endl;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main ()
{
  int x,check1,check2,check3;
  cin >> x;
  check1= x/100;
  check2= x/10 - check1*10;
  check3= x - check1*100 -check2*10;
  cout << check1 + check2 + check3 <<endl;
}

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

using namespace std;

string s;

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	cin >> s;
	if (s[0] != s[1] || s[0] != s[2] || s[1] != s[2])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int isprime(int x){ 
 int i;
 if(x==1) return 0;
 if(x==2) return 1;
 if(x<2||x%2==0)
 	return 0;
 for(i=2;i*i<=x;i++){
 	if(x%i==0) return 0;
 }
 return 1;
 }
 int main(void){
 int i,n,num,count=0;
 	scanf("%d",&n);
 	for(i=0;i<n;i++){
 		scanf("%d",&num);
 		if(isprime(num)) count++;
 	}
 printf("%d\n",count);
 return 0;
 } 


Measured memory_bytes: 2140
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



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

using namespace std;
int a,b,c,d;
int k1,k2;
string s;

int main(){
  cin >> s;
  s[3] = '8';
  cout << s << endl;
  
  return 0;
}



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

using namespace std;
using ll=long long;
#define rep(i, a, n) for (int i = (n); i < (a); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  string a,b,c;
  cin>>a>>b>>c;
  //cout<<"a:"<<a<<" b:"<<b<<" c:"<<c<<endl;
  int turn=0,turn_a=0,turn_b=0,turn_c=0;
  while(1){
    //cout<<"turn"<<turn;
    //turna
    if(turn==0){
      //cout<<"turn_a"<<turn_a<<endl;
      if(a[turn_a]=='b')turn=1;
      else if(a[turn_a]=='c')turn=2;
      turn_a++;
      if(turn_a>a.size()){
        //cout<<"A"<<turn_a<<endl;
        cout<<"A"<<endl;
        break;
      }
    //turnb
    }else if(turn==1){
      //cout<<"turn_b"<<turn_b<<endl;
      if(b[turn_b]=='a')turn=0;
      else if(b[turn_b]=='c')turn=2;
      turn_b++;
      if(turn_b>b.size()){
        //cout<<"B"<<turn_b<<endl;
        cout<<"B"<<endl;
        break;
      }
    //turnc
    }else if(turn==2){
      //cout<<"turn_c"<<turn_c<<endl;
      if(c[turn_c]=='a')turn=0;
      else if(c[turn_c]=='b')turn=1;
      turn_c++;
      if(turn_c>c.size()){
        //cout<<"C"<<turn_c<<endl;
        cout<<"C"<<endl;
        break;
      }
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for(int i = 0; i < n; ++i)  cin >> a[i];
    for(int i = 0; i < n; ++i)  cin >> b[i];
    for(int i = 0; i < n; ++i)  cin >> c[i];
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    vector<int> bc(n);
    for(int i = 0; i < n; ++i)  bc[i] = c.end() - upper_bound(c.begin(), c.end(), b[i]);
    vector<ll> S(n + 1, 0);
    for(int i = 0; i < n; ++i)  S[i + 1] = S[i] + bc[i];
    ll ans = 0;
    for(int i = 0; i < n; ++i){
        int pos = upper_bound(b.begin(), b.end(), a[i]) - b.begin();
        ans += S[n] - S[pos];
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int DP[400][400][400];
vector<pair<int,int> > X[400];
int main()
{
	int N,M;
	cin>>N>>M;
	for(int i=0;i<M;i++)
	{
		int x,y,z;
		cin>>x>>y>>z;
		X[y].push_back(make_pair(x,z));
	}
	DP[0][0][0]=1;
	for(int r=1;r<=N;r++)
		for(int g=0;g<r;g++)
			for(int b=0;b<r;b++)
			{
				DP[r][g][b]=(DP[r][g][b]+DP[r-1][g][b])%mod;
				if(r>1)
				{
					DP[r][r-1][b]=(DP[r][r-1][b]+DP[g][r-1][b])%mod;
					DP[r][b][r-1]=(DP[r][b][r-1]+DP[g][b][r-1])%mod;
				}
				DP[b][r][g]=(DP[b][r][g]+DP[b][r-1][g])%mod;
				if(r>1)
				{
					DP[b][r][r-1]=(DP[b][r][r-1]+DP[b][g][r-1])%mod;
					DP[r-1][r][b]=(DP[r-1][r][b]+DP[r-1][g][b])%mod;//2 3 0 in 3 ? 0
				}
				DP[b][g][r]=(DP[b][g][r]+DP[b][g][r-1])%mod;
				if(r>1)
				{
					DP[b][r-1][r]=(DP[b][r-1][r]+DP[b][r-1][g])%mod;
					DP[r-1][b][r]=(DP[r-1][b][r]+DP[r-1][b][g])%mod;
				}
				for(int i=0;i<X[r].size();i++)
				{
					int Total=0;
					if(r>=X[r][i].first)
						Total++;
					if(g>=X[r][i].first)
						Total++;
					if(b>=X[r][i].first)
						Total++;
					if(Total!=X[r][i].second)
					{
						DP[r][g][b]=DP[b][r][g]=DP[b][g][r]=0;
						DP[r][b][g]=DP[g][r][b]=DP[g][b][r]=0;
						break;
					}
				}
			}
	int Ans=0;
	for(int r=0;r<N;r++)
		for(int g=0;g<N;g++)
		{
			Ans=(Ans+DP[N][r][g])%mod;
			Ans=(Ans+DP[r][N][g])%mod;
			Ans=(Ans+DP[r][g][N])%mod;
		}
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 188160
#include<bits/stdc++.h>
using namespace std;
const int maxn=2004;
int a[maxn][maxn][4];
char t[maxn][maxn];
int main()
{
    int n,m;scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        scanf("%s",t[i]+1);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(t[i][j]=='#')
                a[i][j][0]=0;
            else
                a[i][j][0]=a[i][j-1][0]+1;
        }
        for(int j=m;j>=1;j--)
        {
            if(t[i][j]=='#')
                a[i][j][1]=0;
            else
                a[i][j][1]=a[i][j+1][1]+1;
        }
    }
    for(int j=1;j<=m;j++)
    {
        for(int i=1;i<=n;i++)
        {
            if(t[i][j]=='#')
                a[i][j][2]=0;
            else
                a[i][j][2]=a[i-1][j][2]+1;
        }
        for(int i=n;i>=1;i--)
        {
            if(t[i][j]=='#')
                a[i][j][3]=0;
            else
                a[i][j][3]=a[i+1][j][3]+1;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            ans=max(ans,a[i][j][0]+a[i][j][1]+a[i][j][2]+a[i][j][3]-3);
    cout<<ans<<endl;
}


Measured memory_bytes: 66816
#include <stdio.h>
#include <math.h>

int main(void)
{
  int n,i,j,k,count=0;
  
  scanf("%d",&n);
  
  for(i = 1; i <= n;i+=2){
    double sqr = sqrt(i);
    k=0;
	for(j = 1; j <= sqr; j++)
		if(!(i%j))
			k++;
    if(k == 4){
      count ++;
    }
  }
  printf("%d\n",count);

  return(0);
}

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

typedef long long ll;

int main () {
    set<string> s;
    int n; cin >> n;
    for(int i=0; i<n; i++) {
	string e; cin >> e;
	s.insert(e);
    }
    cout << (s.size()==3?"Three":"Four") << endl;
    return 0;
}


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

int main() {
  string S; 
  cin >> S;
  int Z = 0;
  for (int i = 0; i<S.size(); i++) {
    if (S.at(i) == '1') {
      Z++;
    }
  }
  cout << Z << endl;
}    
  


  




Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

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


signed main(void) {
    int i,j;
    int n,m;
    while(cin >> n >> m, n){
        vi a(n);
        rep(i,n)cin >> a[i];
        int ans = 0;
        rep(i,n)loop(j,i+1,n){
            if(a[i]+a[j] <= m)ans = max(ans, a[i]+a[j]);
        }
        if(ans)cout << ans << endl;
        else cout << "NONE" << endl;
    }
}



Measured memory_bytes: 3136
#include<stdio.h>
#include<algorithm>
#include<iostream>

using namespace std;

int main ()
{
    int n,a,b;
    while (scanf ("%d%d%d",&n,&a,&b)!=EOF)
    {
        if ( (b-a) % 2) printf ("Borys\n");
        else printf ("Alice\n");
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
 
class Main{
 
    public static void main(String[] args)throws IOException{
    final BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int[][] card=new int[4][];
    for(int i=0;i<4;i++) card[i]=new int[13];
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
        card[i][j]=0;
        }
    }
     
     
    String str=br.readLine();
    int n=Integer.parseInt(str);
    for(int i=0;i<n;i++){
        String[] st=br.readLine().split(" ");
        String mark=st[0];
        int num=Integer.parseInt(st[1]);
        if(mark.equals("S")) card[0][num-1]++;
        else if(mark.equals("H")) card[1][num-1]++;
        else if(mark.equals("C")) card[2][num-1]++; 
        else if(mark.equals("D")) card[3][num-1]++;
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
        if(card[i][j]==0){
            if(i==0) System.out.println("S " + (j+1));
            else if(i==1) System.out.println("H " + (j+1));
            else if(i==2) System.out.println("C " + (j+1));
            else if(i==3) System.out.println("D " + (j+1));
        }
        }
    }
    }
}
    

Measured memory_bytes: 24236
n = int(input())

ans = [0] * (n+1)
for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            tmp = i*i + j*j + k*k + i*j + j*k + i*k
            if tmp <= n:
                ans[tmp] += 1

for i in range(1, n+1):
    print(ans[i])


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

struct HeavyLightDecomposition {
  int root;
  vector<vector<int>> g;
  vector<int> sz, par, in, out, head;
  HeavyLightDecomposition(int n = 1, int _root = 0)
      : root(_root), g(n), sz(n), par(n), in(n), out(n),
        head(n) {}
  HeavyLightDecomposition(const vector<vector<int>> &_g,
                          const int _root = 0)
      : root(_root), g(_g), sz(_g.size()), par(_g.size()),
        in(_g.size()), out(_g.size()), head(_g.size()) {
    build();
  }
  void add(int a, int b) {
    g[a].push_back(b);
    g[b].push_back(a);
  }
  void build() {
    dfs_sz(root, -1);
    int t = 0;
    dfs_hld(root, -1, t);
  }
  void dfs_sz(int now, int bf) {
    par[now] = bf;
    sz[now] = 1;
    if(g[now].size() && g[now][0] == bf)
      swap(g[now][0], g[now].back());
    for(auto &to : g[now]) {
      if(to == bf) continue;
      dfs_sz(to, now);
      sz[now] += sz[to];
      if(sz[g[now][0]] < sz[to]) swap(g[now][0], to);
    }
  }
  void dfs_hld(int now, int bf, int &t) {
    in[now] = t++;
    for(auto &to : g[now]) {
      if(to == bf) continue;
      head[to] = (g[now][0] == to ? head[now] : to);
      dfs_hld(to, now, t);
    }
    out[now] = t;
  }
  int lca(int x, int y) {
    for(;; y = par[head[y]]) {
      if(in[x] > in[y]) swap(x, y);
      if(head[x] == head[y]) return x;
    }
  }
};

int n, q;
HeavyLightDecomposition hld;

int main() {
  cin >> n;
  hld = HeavyLightDecomposition(n);
  for(int i = 0; i < n; ++i) {
    int k;
    cin >> k;
    for(int j = 0; j < k; ++j) {
      int p;
      cin >> p;
      hld.add(i, p);
    }
  }
  hld.build();
  cin >> q;
  for(int i = 0; i < q; ++i) {
    int x, y;
    cin >> x >> y;
    cout << hld.lca(x, y) << endl;
  }
  return 0;
}



Measured memory_bytes: 15136
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class Main {
	static Scanner sc = new Scanner(System.in);
	
	public static void main (String [] args){
//		String [][] boad = new String[4][4];
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
//		int d = Integer.parseInt(sc.next());
		int count = 0;
		if(b/a>c){
			count = c;
		}else{
			count = b/a;
		}
		
	System.out.println(count);
	System.out.flush();
	sc.close();
	}
}

Measured memory_bytes: 23124
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    A = LI()

    minus = 0
    for a in A:
        if a < 0:
            minus += 1

    if minus % 2 == 0:
        ans = sum(map(lambda x: abs(x), A))
    else:
        ans = 0
        mn = INF
        for a in A:
            ans += abs(a)
            mn = min(mn, abs(a))
        ans -= 2 * mn

    print(ans)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 20176
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<set<int>> child(N);
    vector<set<int>> par(N);
    for (int i = 0; i < N+M-1; ++i) {
        int A, B;
        cin >> A >> B;
        --A; --B;
        child[A].insert(B);
        par[B].insert(A);
    }
    
    vector<int> parn(N);
    queue<int> root;
    for (int n = 0; n < N; ++n) {
        if (par[n].empty()) {
            parn[n] = -1;
            root.push(n);
            break;
        }
    }
    while (!root.empty()) {
        int tmp = root.front(); root.pop();
        for (int c: child[tmp]) {
            par[c].erase(tmp);
            if (par[c].empty()) {
                parn[c] = tmp;
                root.push(c);
            }
        }
    }
    for (int n = 0; n < N; ++n) {
        cout << parn[n] + 1 << endl;
    }
    
    return 0;
}


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

int main(){
    ll n,m,x;
    cin >> n >> m >> x;
    vector<ll> a(m);
    
    ll L=0,R=0;
    rep(i,m){
        cin >> a[i];
        if(a[i]<x)L++;
        else R++;
    }
    cout << min(L,R) << endl;
}

Measured memory_bytes: 256
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(n):
    a.append(a[i] + A[i])
for i in range(m):
    b.append(b[i] + B[i])

ans, j = 0, m
for i in range(n + 1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Measured memory_bytes: 47332