akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void)
{
	int N;
	int row[210];
	int total = 0;
	int odd = 1;
	
	scanf("%d", &N);
	
	for(int i=0; i<N; i++)
	{
		scanf("%d", &row[i]);
	}
	
	while(odd)
	{
		for(int i=0; i<N; i++)
		{
			if(row[i] % 2 != 0)
			{
				odd = 0;
				break;
			}
		}
		
		if(odd == 1)
		{
			for(int i=0; i<N; i++)
			{
				row[i] = row[i] / 2;
			}
			total += 1;
		}
	}
	
	printf("\n");
	
	printf("%d\n", total);

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
using namespace std;
int main(void) {
	int n;
	cin >> n;
	int x = 0;
	for (int i = 1; i <= n; i++) {
		x = i;
		if (x % 3 == 0) {
			cout << " " << i;
			continue;
		}
		if (x % 10 == 3) {
			cout << " " << i;
			continue;
		}
		x /= 10;
		while (x) {
			if (x % 10 == 3) {
				cout << " " << i;
				break;
			}
			x /= 10;
		}
	}
	cout << endl;
}


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

int main(){
  cout << fixed <<setprecision(12);

  double r; 
  cin>>r;

  double PI = acos(-1); 
  double area = r * r * PI;
  double cir = (r + r) * PI;
  cout<<area<<" "<<cir<<endl;

  return 0;
}


Measured memory_bytes: 3292
#include<iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <functional>
#include "math.h"
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  int c = std::max(a+b, a-b);
  c = std::max(c, a*b);
  std::cout << c;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	int a[51]={0};
	int b[51];
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		b[i]=a[i];
	}
	sort(a,a+n);
	int sum=0;
	for(int i=0;i<n;i++){
		if(a[i]!=b[i]){
			sum++;
		}
	}
	if(sum>2){
		printf("NO");
	}else{
		printf("YES");
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define endl '\n'
#ifndef CODE_JAM
#undef CASE_INFO
#endif
#else
#pragma GCC optimize "trapv"
#endif
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define rep(n) for(int i = 0; i < n; i++)
#define repj(n) for(int j = 0; j < n; j++)
#define all(p) p.begin(), p.end()
#define count_1(p) __builtin_popcountll(p)
#define count_0(p) __builtin_ctzll(p)
using namespace std;
template<class X=int>inline X mid(X s,X e){return (s+(e-s)/2);}
template<class X=int>inline X len(X s,X e){return (e-s+1);}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int oo = 987654321;
const ll OO = 1e18;

class Timer {
public:
	clock_t start;
	Timer() {start = clock();}
	~Timer() {cerr << (double)(clock() - start)/CLOCKS_PER_SEC << "\n";}
};

void solve() {
	int n;
	string s;
	cin >> n >> s;
	int w = 0, ans = 0;
	for(char &i : s) w += i == 'W';
	cerr << w << endl;
	for(int i = n - 1; i > n - w - 1; i--) {
		ans += s[i] == 'R';
	}
	cout << ans << endl;
}

signed main() {
	Timer ti;
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	int T = 1;
	#ifdef TEST_CASES
	cin >> T;
	#endif
	for(int t = 1; t <= T; t++) {
		#ifdef CASE_INFO
		cout << "Case #" << t << ": ";
		#endif
		solve();
	}
	return 0;
}


Measured memory_bytes: 3932
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PL = pair<long long, long long>;
const int INF = 1001001007;
const int MOD = 1000000007;
template <typename T>
void printvec(vector<T> &ar){
    for(T i: ar) cout << i << " ";
    cout << endl;
}

int main(){
    string s; cin >> s;
    int n = s.size();
    int cnt = n - 2;
    while (s.substr(0,cnt / 2) != s.substr(cnt / 2,cnt / 2)) cnt -= 2;
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n; i>0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define FORR(i, m, n) for(int i=m; i>=n; i--)
#define INF 1999999999
#define ll long long
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;

#ifdef INPUT
stringstream input(R"(
2
12 5
1000 2000
)");
#define cin input
#endif

int main()
{
	double n, t, a;
	cin >> n >> t >> a;
	vector<double> h(n);
	REP(i,n)
		cin >> h[i];
	
	vector<double> th(n);
	REP(i,n)
		th[i]=t-h[i]*0.006;
	
	double min=INF;
	double ans;
	REP(i,n)
	{
		if(abs(th[i]-a)<min)
		{
			min=abs(th[i]-a);
			ans=i+1;
		}
	}
	cout << ans << endl;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    
    
    if(abs(a-c)<=d)
    {
        cout<<"Yes"<<endl;
        return 0;
        
    }
    else if(abs(a-b)<=d&&abs(b-c)<=d)
    {
        cout<<"Yes"<<endl;
        return 0;
        
    }
    
    cout<<"No";
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std ;
int main(){
    int a,b,c ;
    cin>>a>>b>>c ;
    if(a*c<=b){
   cout<<c<<endl;
    }
    else{
        c=0;
        while(b>=a){
        b=b-a;
        c++;
        }
        cout<<c<<endl;
    }
    return 0 ;
}

Measured memory_bytes: 256
/*****And nothing else matters!******/

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

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define setbits(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define sp(x) fixed << setprecision(10) << x
#define nitro ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cerr<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = 998244353;
const int N = 2e5 + 10;

vpi seg(N);
vl dp(N), pref(N);

int main()
{
    nitro;
    int n, k;
    cin >> n >> k;
    f(i,0,k)
        cin >> seg[i].F >> seg[i].S;

    dp[1] = 1;
    for(int i = 1; i <= n; i++)
    {
        if(i > 2)
            dp[i] = (dp[i] + dp[i-1]) % mod;
        dp[i] = (dp[i] + pref[i]) % mod;
        for(int j = 0; j < k; j++)
        {
            if(i + seg[j].F <= n)
                pref[i + seg[j].F] = (pref[i + seg[j].F] + dp[i]) % mod;
            if(i + seg[j].S + 1 <= n)
                pref[i + seg[j].S + 1] = (pref[i + seg[j].S + 1] - dp[i]) % mod;

        }
    }
    cout << (dp[n] + mod) % mod;
}


Measured memory_bytes: 7852
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N, K,t,l; cin >> N >> K;
	VLL a(N), b(N),c(0);
	vector <pair<ll, ll>>pairs(N);
	for (ll i = 0;i < N;i++) {
		cin >> t >> l;
		pairs[i] = make_pair(t, l);
	}
	sort(pairs.begin(),pairs.end());
	ll lim = 0;
	for (ll i = 0;;i++) {
		lim += pairs[i].second;
		if (lim >= K) {
			cout << pairs[i].first << endl;
			break;
		}
	}
}

Measured memory_bytes: 3328
#include<iostream>
using namespace std;
bool cross(double x1,double y1,double x2,double y2,
	double x3,double y3,double x4,double y4){
		double f1,f2;
		f1=(x2-x1)*(y1-y3)+(y2-y1)*(x3-x1);
		f2=(x2-x1)*(y1-y4)+(y2-y1)*(x4-x1);
		if(f1*f2<=0){
			return true;
		}else{
			return false;
		}
}
int main(void){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		double xg,yg;
		xg=(x1+x2+x3)/3.0;
		yg=(y1+y2+y3)/3.0;
		bool flag;
		if(cross(x1,y1,x2,y2,xp,yp,xg,yg)){
			flag=false;
		}else if(cross(x2,y2,x3,y3,xp,yp,xg,yg)){
			flag=false;
		}else if(cross(x3,y3,x1,y1,xp,yp,xg,yg)){
			flag=false;
		}else{
			flag=true;
		}
		if(flag){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw	 "\n"
#define mod 1000000007

ll w,e;
int main(void)
{
	CIN;
	ll tc,l,k=0,sum=0,x=0,y,z=0,m=1,n=0,ans=0,cnt=0;
	cin>>n;
	cout<<(n/100*5>=n%100?'1':'0');
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define drep(i,cc,n) for(int i=(cc);i<=(n);++i)
#define rep(i,n) drep(i,0,(n)-1)
#define drrep(i,cc,n) for(int i=(cc);i>=(n);--i)
#define rrep(i,n) drrep(i,0,(n)-1)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,v.size())if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define arrprint(v,n) rep(i,n)if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define matprint(v,n,m) rep(i,n){rep(j,m){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
using ll = long long;
using P = pair<int,int>;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

int main(){
    int ans,n,x,t;
    cin >> n >> x >> t;
    ans = (n+x-1)/x;
    ans *= t;

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <deque>
using namespace std;
const int N = 3000;
string s, t;
int dp[3001][3001];
inline int strlen(string x) {
	return x.size();
}
main() {
  cin >> s >> t;
  for(int i = 1; i <= (int)strlen(s); i++) {
    for(int j = 1; j <= (int)strlen(t); j++) {
      dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
      if(s[i - 1] == t[j - 1]) {
        dp[i][j] = dp[i - 1][j - 1] + 1;
      }
    }
  }

  deque < char > ans;
  int n = strlen(s), m = strlen(t);
  while(n && m) {
    if(dp[n][m] == dp[n - 1][m]) n--;
    else if(dp[n][m] == dp[n][m - 1]) m--;
    else if(dp[n][m] == dp[n - 1][m - 1] + 1) {
      ans.push_front(s[n - 1]); n--; m--;
    }

  }

  for(int i = 0; i < ans.size(); i++) {
    printf("%c", ans[i]);
  }
}

Measured memory_bytes: 35456
# coding: utf-8

N = gets.to_i
S = gets.chomp

a = S.split(/(?<=\.)(?=\#)|(?<=\#)(?=\.)/).map(&:size)

if S[0] == '.'
  a.unshift(0)
end
if S[-1] == '#'
  a.push(0)
end

→ = a.select.each_with_index {|_, i| i.even? }.inject([0]) do |memo, item|
  memo << memo.last + item
end
← = a.reverse.select.each_with_index {|_, i| i.even? }.inject([0]) do |memo, item|
  memo << memo.last + item
end
ans = →.zip(←.reverse).map do |ltr, rtl|
  ltr + rtl
end.min

puts ans


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

int main(){
	int n;
	cin >> n;
	for(int p=0; p < n; p++){
		int score = 0, out = 0, run[5];
		string event;
		fill(run, run+5, 0);

		while(1){
			cin >> event;
			if(event == "HIT"){
				run[0] = 1;
				for(int i=3; 0 <= i; i--){
					if(run[i] == 1) swap(run[i], run[i+1]);
				}
				if(run[4] == 1){
					score++;
					run[4] = 0;
				}
			}
			if(event == "HOMERUN"){
				run[0] = 1;
				for(int i=0; i < 4; i++){
					if(run[i] == 1){
						score++;
						run[i] = 0;
					}
				}
			}
			if(event == "OUT") out++;
			if(out == 3) break;
		}
		cout << score << endl;
	}
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cis(s);
    string ans = (s.substr(0, s.length()/2) == s.substr(s.length()/2+1, s.length()/2))
            ?"Yes"
            :"No";
    co(ans);
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<cstdlib> 
#include<string>
#include<math.h>
#include<bitset>
#include<algorithm>
#include<vector>
#include<set>
#include<stack>
#include<queue>
using namespace std;


int main(){

	string s;

	cin>>s;

	char t=s[0];
	unsigned long long ans=0;
	for(unsigned long long i=1;i<s.size();i++){
		if(s[i]!=s[i-1])ans++;
	}

	cout << ans << endl;

	//while(1);

}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;

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

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n;
    cin >> n;
    P a[10];
    vector<int> v;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i].F >> a[i].S;
        v.pb(i);
    }

    double c = 0;
    int cc = 0;
    do {
        double s = 0;
        for(int i = 0; i < n - 1; ++i) {
            double x, y;
            x = a[v[i]].F - a[v[i + 1]].F;
            y = a[v[i]].S - a[v[i + 1]].S;
            s += sqrt(x * x + y * y);

        }
        c += s;
        ++cc;
    } while(next_permutation(all(v)));
    printf("%.10lf\n", c / cc);
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const int fx[4]={1,-1,0,0},fy[4]={0,0,1,-1};
struct node
{
	int x,y;
};
int n,m,ans=0;
int d[25][25];
char p[25][25];
bool vis[25][25];
queue<node> q;
int main()
{
	memset(p,0x3f,sizeof(p));
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)
	for(int j=0;j<m;j++)
	cin>>p[i][j];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(p[i][j]=='#') continue;
			memset(d,0,sizeof(d));
			memset(vis,0,sizeof(vis));
			q.push((node){i,j});
			vis[i][j]=1;
			while(!q.empty())
			{
				node no=q.front();
				q.pop();
				for(int k=0;k<4;k++)
				{
					int nx=no.x+fx[k],ny=no.y+fy[k];
					if(nx<n&&ny<m&&nx>=0&&ny>=0&&p[nx][ny]=='.'&&!vis[nx][ny])
					{
						vis[nx][ny]=1;
						d[nx][ny]=d[no.x][no.y]+1;
						ans=max(d[nx][ny],ans);
						q.push((node){nx,ny});
					}
				}
			}
		}
	}
	cout<<ans;
	return 0;
}

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

int main(){
    ll n;
    string s;
    cin >> n;
    if(n<=9){cout << n << endl; return 0;}
    s = to_string(n);
    bool flg = true;
    for(int i = 1; i < s.size(); i++){
        if(s[i] != '9'){flg = false;}
    }
    int ans = 0;
    if(flg){
        ans = (int)(s[0]-'0')+9*(s.size()-1);
    }else{
        ans = ((int)(s[0]-'0')-1)+9*(s.size()-1);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
s = [list(map(int,input().split())) for _ in range(m)]
p = list(map(int,input().split()))
ans = 0
for i in range(2**n):
    lights = [0]*m
    onoff = [0]*n
    for j in range(n):
        if (i >> j) &  1:
            onoff[j] = 1
    for k in range(m):
        cnt = 0
        for l in s[k][1:]:
            if onoff[l-1] == 1:
                cnt += 1
        if cnt % 2 == p[k]:
            lights[k] = 1
    if all(g == 1 for g in lights):
        ans += 1
print(ans)

    
        




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

using namespace std;

int a[111][111];
int b[111][111];
int64_t c[111][111];

int main() {
	int n, m, l;
	cin >> n >> m >> l;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < m; ++i) {
		for (int j = 0; j < l; ++j) {
			cin >> b[i][j];
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < l; ++j) {
			for (int k = 0; k < m; ++k) {
				c[i][j] += a[i][k]*b[k][j];
			}
		}
	}
	for (int i = 0; i < n; ++i) {
		cout << c[i][0];
		for (int j = 1; j < l; ++j) {
			cout << ' ' << c[i][j];
		}
		cout << '\n';
	}
}


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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<double> point;
#define F first
#define S second

int dp[6005][2];

int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("b.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n, t;
	cin >> n >> t;
	vector<pair<int, int>> a(n);
	for (auto &i : a) cin >> i.F >> i.S;

	for (auto x : a)
		for (int i = t-1; i >= 0; --i)
		{
			dp[i+x.F][0] = max(dp[i+x.F][0], dp[i][0] + x.S);
			dp[i+x.F][1] = max(dp[i+x.F][1], dp[i][1] + x.S);
			dp[i][1] = max(dp[i][1], dp[i][0] + x.S);
		}

	int ans = 0;
	for (int i = t-1; i >= 0; --i)
		ans = max(ans, dp[i][1]);

	cout << ans << "\n";

	return 0;
}


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ll Mod = 1000000007LL;
const int N = 5e3 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

vector<int> G[N];
ll mul(ll a, ll b){
	return (a*b) % Mod;
}
ll bin_pow(ll b, ll p){
	ll res = 1;
	for(ll pw = b, j = 1; j <= p; j <<= 1, pw = mul(pw, pw))
		if(p & j)
			res = mul(res, pw);
	return res;
}

ll dp[N][N], ps[N][N];

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll iv2 = bin_pow(2, Mod - 2);
	for(int i = 1; i < N; i++) dp[1][i] = bin_pow(2, i);
	for(int i = 2; i < N; i++){
		ps[i-1][0] = 0;
		for(int j = 1; j < N; j++) ps[i - 1][j] = (ps[i-1][j-1] + mul(dp[i-1][j], mul(j, bin_pow(iv2, j)))) % Mod; 
		for(int j = 1; j < N; j++){
			dp[i][j] = dp[i - 1][j] * (j + 1);
			dp[i][j] %= Mod;
			if(j > 1){
				dp[i][j] += ps[i - 1][j - 1] * bin_pow(2, j - 1);
				dp[i][j] %= Mod;
			}
		}
	}
	ll n, m;
	cin >> n >> m;
	cout << dp[n][m] << '\n';
	return 0;
}


Measured memory_bytes: 395868
def mismatch(S, T, n):
    count = 0
    for i in range(n):
        if S[i] != T[i]:
            count += 1
    return count

S = input()
n = len(S)
T1 = ""
T2 = ""
for i in range(n):
    if i % 2 == 0:
        T1 += "0"
        T2 += "1"
    else:
        T1 += "1"
        T2 += "0"
print(min(mismatch(S, T1, n), mismatch(S, T2, n)))

Measured memory_bytes: 3316
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn criterion(i: i64, a: i64, b: i64) -> bool {
    if i < a {
        return true;
    }
    let mut result1;
    let mut result2;
    let mut result3 = true;

    if i > b {
        if a < i - b {
            result1 = ternary_search(0, a - 1, 1, i + 1) < a * b;
            result2 = ternary_search(a + 1, i - b, 1, i + 1) < a * b;
            result3 = ternary_search(b + 1, i, 1, i + 1) < a * b;
        } else if a == i - b {
            result1 = ternary_search(0, a - 1, 1, i + 1) < a * b;
            result2 = ternary_search(a + 1, i, 1, i + 1) < a * b;
        } else {
            result1 = ternary_search(0, i - b - 1, 1, i + 1) < a * b;
            result2 = ternary_search(i - b + 1, a - 1, 1, i + 1) < a * b;
            result3 = ternary_search(a + 1, i, 1, i + 1) < a * b;
        }
    } else {
        result1 = ternary_search(0, a - 1, 1, i) < a * b;
        result2 = ternary_search(0, i - a + 1, a + 1, i - a + 1) < a * b;
    }
    // debug!(i, a, b, ternary_search(0, i - 1, 1, i), result);
    result1 && result2 && result3
}

fn main() {
    let n = read::<usize>();
    let mut pairs = vec![];
    for _ in 0..n {
        let v = read_vec::<i64>();
        pairs.push(v);
    }
    for v in pairs {
        let a = min(v[0], v[1]);
        let b = max(v[0], v[1]);
        if a == b {
            println!("{}", (a - 1) * 2);
            continue;
        }
        let ans = binary_search(0, 2 * max(a, b), a, b, criterion);
        // debug!(ans);
        println!("{}", ans);
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn eval(a: i64, b: i64, i: i64) -> i64 {
    (a + i) * (b - i)
}

fn binary_search<F>(lb: i64, ub: i64, a: i64, b: i64, criterion: F) -> i64
where
    F: Fn(i64, i64, i64) -> bool,
{
    let mut lb = lb;
    let mut ub = ub;
    while ub - lb > 1 {
        let mid = (ub + lb) / 2;
        if criterion(mid, a, b) {
            lb = mid;
        } else {
            ub = mid;
        }
    }
    lb
}

fn ternary_search(lb: i64, ub: i64, a: i64, b: i64) -> i64 {
    let mut lb = lb;
    let mut ub = ub;
    while ub - lb > 2 {
        let mid1 = (ub + lb * 2) / 3;
        let mid2 = (ub * 2 + lb) / 3;
        if eval(a, b, mid1) < eval(a, b, mid2) {
            lb = mid1;
        } else {
            ub = mid2;
        }
    }
    max(
        max(eval(a, b, lb), eval(a, b, (lb + ub) / 2)),
        eval(a, b, ub),
    )
}


Measured memory_bytes: 4352
N=int(input())
a=list(map(int,input().split()))

ans=2*10**9+10
s=sum(a)
now=0
snuke=0
for i in range(N-1):
    snuke+=a[i]
    now=s-2*snuke

    ans=min(abs(now),ans)

print(ans)

Measured memory_bytes: 30540
#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <complex>
#include <fstream>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

//#define _DEBUG_ 3
void run() {
	int n; cin >> n;
	int x = n * 800;
	int y = 200 * (n / 15);
	cout << x - y << endl;
}

int main() {
#ifdef _DEBUG_
	using std::chrono::system_clock;
	using std::chrono::duration_cast;
	system_clock::time_point  start, end;
	std::ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
	for (int i = 0; i < _DEBUG_; i++) {
		cout << "-------------------------- (cnt:" << i << ")" << endl;
		start = system_clock::now();
		run();
		end = system_clock::now();
		int elapsed = duration_cast<std::chrono::milliseconds>(end - start).count();
		cout << "-------------------------- (time:" << elapsed << "ms)" << endl << endl;
}
#else
	run();
#endif
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];

  long long sum = 0;
  for (int i = 0; i < n; i++)
    sum += a[i];
  long long num = sum / ((n + 1) * n / 2);
  if (sum % ((n + 1) * n / 2) != 0) {
    cout << "NO" << endl;
    return 0;
  }
  long long m = 0;
  for (int i = 0; i < n; i++) {
    int next = (i + 1 + n) % n;
    if ((-a[next] + a[i] + num) < 0 || (-a[next] + a[i] + num) % n != 0) {
      cout << "NO" << endl;
      return 0;
    }
    m += (-a[next] + a[i] + num) / n;
  }
  if (m == num) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


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

typedef long long ll;
ll arr[2000005] ;
ll MOD = 1e9 + 7;

int big_mod(ll base, ll power, ll mod)
{
  if(power == 0)  return 1;
  else if(power % 2 == 1) {
    ll p1 = base % mod;
    ll p2 = (big_mod(base, power-1, mod) ) % mod;
    return (p1 * p2) % mod;
  }
  else if(power % 2 == 0) {
    ll p1 = (big_mod(base, power/2, mod) ) % mod;
    return (p1 * p1) % mod;
  }
}

struct Point{
  ll L;
  ll R;
  ll hit;
};

//This is a custom Compare function for Priority Queue. Return statements are reversed.
struct customComp_priorityQueue {
  bool operator()(Point const& x, Point const& y) {
    if(x.L != y.L)  return (x.L > y.L);
    else  return  (x.R < y.R);
  }
};

int main()
{
  ll n, sum = 0;
  cin>>n;
  arr[n];

  for(int i = 0; i < n; i++)  cin>>arr[i];

  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      sum += arr[i] * arr[j];
    }
  }
  cout<<sum<<endl;
}


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

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    map<string, int> ccc;
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        ccc[s]++;
    }

    for (string s: {"AC", "WA", "TLE", "RE"}) {
        cout << s << " x " << ccc[s] << '\n';
    }
    return 0;
}


Measured memory_bytes: 3676
class Node:
    def __init__(self):
        self.key = -1
        self.p = -1
        self.l = -1
        self.r = -1

def insert(k):
    y = -1
    x = root[0]
    z = len(T)
    T.append(Node())
    T[z].key = k
    while x != -1:
        y = x
        if T[z].key < T[x].key: x = T[x].l
        else: x = T[x].r
    T[z].p = y
    if y == -1: root[0] = z
    elif T[z].key < T[y].key: T[y].l = z
    else: T[y].r = z

def inorder(u):
    if u == -1: return
    inorder(T[u].l)
    print(" {}".format(T[u].key),end="")
    inorder(T[u].r)

def preorder(u):
    if u == -1: return
    print(" {}".format(T[u].key),end="")
    preorder(T[u].l)
    preorder(T[u].r)

m = int(input())
T = []
root = [-1]
for _ in range(m):
    comm = input().split()
    if comm[0] == "insert":
        insert(int(comm[1]))
    else:
        inorder(root[0])
        print("")
        preorder(root[0])
        print("")


Measured memory_bytes: 124888
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ll longlongint
using namespace std;
int main(){
     SPEED;
     int a,b,c,x;
     cin>>a>>b>>c>>x;
     int count=0;
     rep(i,a+1){
         rep(j,b+1){
             rep(k,c+1){
                 int sum=500*i+100*j+50*k;
                 if(sum==x)count++;
             }
         }
     }
     cout<<count;
     ed;
     return 0;
}


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

//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-9

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define ps(ch) printf("%s",ch)
#define Afridi 0
#define NL printf("\n")
#define debug(x) printf("wow  %d !!\n",x)
#define Max 300005
#define INF 100000000
#define mod 1000000007
#define un(x) x.erase( unique( x.begin() , x.end() ) , x.end() )

#define FI freopen("in.txt","r",stdin)

#define D(x) cout << #x << " = " << (x) << endl
#define DD(x,y) cout << #x << " = " << x << "   " << #y << " = " << y << endl

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;


LL bigmod(LL b,LL p,LL m)
{
    if(p == 0)return 1;
    LL my = bigmod(b,p/2,m);
    my*=my;my%=m;
    if(p & 1)my*=b,my%=m;
    return my;
}
int setb(int n,int pos){return n=n | (1 << pos);}
int resb(int n,int pos){return n=n & ~(1 << pos);}
bool checkb(int n,int pos){return (bool)(n & (1 << pos));}

LL n,ara[1000005];
unordered_map <LL,LL> mp,taken;
vector <LL> v,lol;
int main()
{
	//FI;
	LL i;
    sl(n);
    rep(i,n)sl(ara[i]);
    sort(ara+1,ara+n+1);
	rep(i,n)
	{
		LL my = ara[i];
		if( mp.find(my) == mp.end() )
		{
			mp[my] = 0;
			v.pb(my);
		}
		mp[my]++;
	}
	sort(v.begin(),v.end());
	LL ret = 0;
	Rep(i,sz(v))
	{
		LL my = v[i];
		LL c = mp[my];
		if( c >= 2 )lol.pb(my);
	}
	if( sz(lol) )
	{
		Rep(i,sz(lol))
		{
			LL my = lol[i];
			LL c = mp[my];
			if( c >= 4 )ret = max( ret , my * my );
		}
	}
	if( sz(lol) > 1 )
	{
		Rep(i,sz(lol)-1)
		{
			ret = max( ret , lol[i] * lol[i+1] );
		}
	}
	pl(ret); NL;
	return 0;
}


Measured memory_bytes: 5916
# C - Rectangle Cutting
W,H,x,y = map(int,input().split())
S = W*H

# H,W の中心と x,y の距離
distx = abs(W/2 - x)
disty = abs(H/2 - y)

if distx == disty == 0:
    ans = (S/2,1)
else:
    ans = (S/2,0)
print(*ans)

Measured memory_bytes: 9160
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD = 1e9 + 7;

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

    int t;
    string s;
    while (cin >> t >> s, t)
    {
        int n = s.length();
        bool reject = false;
        int sum = -INF;
        vector<int> res;
        for (int i = 0; i < (1 << (n-1)); i++)
        {
            int stmp = 0, tmp = 0;
            bool update=false;
            vector<int> v;
            for (int j = 0; j < n; j++)
            {
                update=true;
                tmp *= 10;
                tmp += (s[j] - '0');
                if ((i >> j) & 1)
                {
                    stmp += tmp;
                    v.push_back(tmp);
                    tmp = 0;
                    update = false;
                }
            }
            if (update)
            {
                stmp += tmp;
                v.push_back(tmp);
            }
            if (stmp < sum || t < stmp){
                continue;
            }
            if (stmp == sum)
            {
                reject = true;
            }
            else
            {
                reject = false;
                res = v;
                sum = stmp;
            }
        }
        if (sum == -INF)
        {
            cout << "error" << endl;
        }
        else if (reject)
        {
            cout << "rejected" << endl;
        }
        else
        {
            cout << sum;
            for (int i = 0; i < (int)res.size(); i++)
                cout << " " << res[i];
            cout << endl;
        }
    }
}



Measured memory_bytes: 3196
import java.util.Scanner;
public class Main {
	void scanX(){
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		System.out.println(x*x*x);
	}
	public static void main(String args[]){
		Main m1 = new Main();
		m1.scanX();
	}

}

Measured memory_bytes: 26120
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int N, A, B;
ll v[50];

ll C(ll n, ll r){
	ll ret = 1;
	rep(i, r){
		ret *= n-i;
		ret /= (ll)i+1;
	}
	return ret;
}

signed main(){
	cin >> N >> A >> B;
	rep(i, N) cin >> v[i];
	sort(v, v+N);
	reverse(v, v+N);

	ll ave = 0;
	rep(i, A) ave += v[i];

	ll ans = 0;
	for(int i=A; i<=B; i++){
		ll sum = 0;
		rep(j, i) sum += v[j];
		if(ave*i == sum*A){
			int cnt = 0;
			int idx = i-1;
			rep(j, N){
				if(v[j] == v[i-1]){
					idx = min(idx, j);
					cnt++;
				}
			}
			ans += C(cnt, i-idx);
		}
	}
	cout << fixed << setprecision(16) << (double)ave/A << endl;
	cout << ans << endl;
}

Measured memory_bytes: 3764
#include<cstdio>
int n, i, j;
char s[100005];
bool a[4][100005];
int main(){
  scanf("%d %s", &n, s);
  a[1][0] = a[2][1] = a[3][0] = a[3][1] = true;
  for(i = 1; i < n; i++) for(j = 0; j < 4; j++)
    a[j][i+1] = a[j][i]^a[j][i-1]^s[i] == 'o';
  for(j = 0; j < 4; j++){
    if(a[j][n] == a[j][0] && a[j][n-1] == a[j][0]^a[j][1]^s[0] == 'o'){
      for(i = 0; i < n; i++) printf("%c", a[j][i] ? 'S' : 'W');
      return 0;
    }
  }
  printf("-1");
}


Measured memory_bytes: 768
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

vector<int> keta(int n) {
  vector<int> res;
  while (n > 0) {
    res.push_back(n % 10);
    n /= 10;
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  auto vn = keta(n);
  int lndn = vn.size();
  int nn = (n - vn.back() * pow(10, lndn - 1)) / 10;
  for (int i = 1; i <= n; i++) {
    auto v = keta(i);
    int l = v.back();
    int h = v[0];
    if (h == 0)
      continue;
    if (h == l)
      ans++;
    if (lndn == 1)
      continue;
    for (int j = 2; j < lndn; j++) {
      ans += pow(10, j - 2);
    }
    if (h > vn.back())
      continue;
    if (h == vn.back()) {
      if (l > vn[0]) {
        ans += nn;
      } else {
        ans += nn + 1;
      }
    } else {
      ans += pow(10, lndn - 2);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< double, int > P;
const ll inf = numeric_limits< ll >::max()/3;
const double infd = numeric_limits< double >::max()/2;

struct circle{
  ll x;ll y;ll r;
};

vector< circle > C;
vector< vector< double > > G;

double res[1100];
priority_queue< P, vector<P>, greater<P> > que;

double dist(ll xa, ll ya,
	    ll xb, ll yb){
  return sqrt((xa-xb)*(xa-xb)
	      + (ya-yb)*(ya-yb));
}

int main(void){
  ll xs,ys;
  ll xt,yt;
  cin >> xs >> ys >> xt >> yt;
  int n;
  cin >> n;
  for(int i = 0;i < n;++i){
    ll x,y,r;
    cin >> x >> y >> r;
    circle cir = {x,y,r};
    C.push_back(cir);
  }
  circle cs = {xs,ys,0};
  circle ct = {xt,yt,0};
  C.push_back(cs);
  C.push_back(ct);
  n += 2;
  G.resize(n);
  for(int i = 0;i < n;++i)
    G[i].resize(n);
  for(int i = 0;i < n;++i){
    for(int j = i+1;j < n;++j){
      double d = max(0.0,
		     dist(C[i].x, C[i].y,
			  C[j].x, C[j].y)
		     - C[i].r - C[j].r);
      G[i][j] = d;
      G[j][i] = d;
    }
  }

  fill(res,res + 1100, infd);
  que.push(P(0, n-2));
  while(!que.empty()){
    double now_c = que.top().first;
    int now_n = que.top().second;
    que.pop();
    if(now_c < res[now_n]){
      res[now_n] = now_c;
      if(now_n == n-1){
	break;
      }
      for(int i = 0;i < n;++i){
	if(i != now_n &&
	   now_c + G[now_n][i] < res[i]){
	  que.push(P(now_c + G[now_n][i],
		     i));
	}
      }
    }
  }
  cout << setprecision(15) << res[n-1] << endl;
  return 0;
}


Measured memory_bytes: 16496
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;

int main(){
    vector<int> a(5);
    int ans=0;
    int min_residue=9;
    bool all_zero = true;
    for(int i=0; i<5; i++){
        cin >> a[i];
        if(a[i]%10<=min_residue && a[i]%10!=0){
            min_residue = a[i]%10;
            all_zero = false;
        }
    }
    for(int i=0; i<5; i++){
        ans += (a[i]/10)*10;
        if(a[i]%10!=0){
            ans += 10;
        }
    }
    if(all_zero==false){
        ans += min_residue - 10;
    }
    cout << ans << endl;
}

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

int N,a;
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

bool dfs(int v){
  used[v]=true;
  for(int i=0;i<(int)G[v].size();i++){
    int u=G[v][i],w=match[u];
    if( w<0 || (!used[w]&&dfs(w)) ){
      match[u]=v;
      match[v]=u;
      return true;
    }
  }
  return false;
}
 
int bipartite_matching(){
  int res=0;
  memset(match,-1,sizeof(match));
  for(int v=0;v<N;v++){
    if(match[v]<0){
      memset(used,false,sizeof(used));
      if(dfs(v))res++;
    }
  }
  return res;
}
 
int main(){
  scanf("%d",&N);
  N--;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      scanf("%d",&a);
      if(a==1)G[j].push_back(N+i);
    }
  }

  for(int i=0;i<N;i++)sort(G[i].begin(),G[i].end());
  int f=bipartite_matching();
  printf( f==N?"yes\n":"no\n");
  for(int i=0;i<N&&f==N;i++){
    match[ match[i] ]=-1;
    match[i]=-1;
    memset(used,false,sizeof(used));
    dfs(i);
    G[i].clear();
    G[i].push_back( match[i] );
    printf("%d\n",match[i]-N+1);
  }
  return 0;
}

Measured memory_bytes: 3356
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int ans=0;
  cin >> s;
  if(s[0]=='+'){
    ans++;
  }else{
    ans=ans-1;
  }
  if(s[1]=='+'){
    ans++;
  }else{
    ans=ans-1;
  }
  if(s[2]=='+'){
    ans++;
  }else{
    ans=ans-1;
  }
  if(s[3]=='+'){
    ans++;
  }else{
    ans=ans-1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
def trial_division(n,b):
    a = []
    if n%2==0 and b%2==0:
        a.append(2)
    while n % 2 == 0:
        n /= 2
    f = 3
    while f*f <= n:
        if n % f == 0: 
            if b%f == 0:
                a.append(f)
            n /= f
        else:
            f += 2   
    if n != 1 and b%n==0: 
        a.append(n)
    return a
A,B = (lambda x: (min(x),max(x)))(list(map(int,input().split())))
print(len(set(trial_division(A,B)))+1)

Measured memory_bytes: 3064
d = dict()


def lucas(i: int):
    if i == 0:
        return 2
    if i == 1:
        return 1
    if i in d:
        return d[i]
    val = lucas(i - 1) + lucas(i - 2)
    d[i] = val
    return val


print(lucas(int(input())))


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    string s, cmd, p;
    int q, a, b;
    cin >> s >> q;
    for (int i = 0; i < q; ++i) {
        cin >> cmd >> a >> b;
        if (cmd == "print") {
            cout << s.substr(a, b - a + 1) << endl;
        }
        if (cmd == "reverse") {
            reverse(s.begin() + a, s.begin() + b+1);
        }
        if (cmd == "replace") {
            cin >> p;
            s.replace(a, b - a + 1, p);
        }
    }
    return 0;
}



Measured memory_bytes: 3216
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            YESOrNO(int.Parse(Join(ReadSplitInt())) % 4 == 0);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e)
        {
            if (e) Println("YES");
            else Println("NO");
        }

        static void YesOrNo(bool e)
        {
            if (e) Println("Yes");
            else Println("No");
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 11348
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<numeric>
#define INF 1e+8
#define EPS 1e-9
#define PB push_back
#define fi first
#define se second
#define reps(i,j,k) for(int i = j; i < k; i++)
#define rep(i,j) reps(i,0,j)
using namespace std;
const int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
typedef long long ll;
typedef pair<int,int> Pii;
int D[128][128];
int main(){
	int n;
	scanf("%d",&n);
	rep(i,128)rep(j,128)D[i][j] = INF;
	rep(i,n){
		int index;
		scanf("%d",&index);
		int sub;
		scanf("%d",&sub);
		rep(j,sub){
			int tmp;
			scanf("%d",&tmp);
			D[index][tmp] = 1;
		}
	}
	rep(k,101){
		rep(i,101){
			rep(j,101){
				D[i][j] = min(D[i][j],D[i][k]+D[k][j]);
			}
		}
	}
	int m;
	scanf("%d",&m);
	rep(i,m){
		int a,b,cost;
		scanf("%d%d%d",&a,&b,&cost);
		if(D[a][b]+1 <= cost )printf("%d\n",D[a][b]+1);
		else puts("NA");
	}
	return 0;
}

Measured memory_bytes: 1264