akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
   static void Main(){
     var N = int.Parse(Console.ReadLine());
     var aho = Console.ReadLine().Split();
     var A = new long[N];
     var b = new long[N+1];
    
      for (int i = 0;i<N;i++){
        A[i]= long.Parse(aho[i]);
      }
      var count = new long[N + 1];
      foreach (var a in A)
      {
          count[a]++;
      }
      // iが書かれたボールから2個を取り出す方法の数
      var c = new long[N + 1];
      for (int i = 0; i < N+1; i++)
      {
          c[i] = count[i] * (count[i] - 1) / 2;
      }

      // ボールを除かないときの方法の数
      var sum = c.Sum();

      // aを除くときの方法の数を求める
      foreach (var a in A)
      {
          //if (count[a] == 0) continue;
          var newCount = count[a] - 1;
          var ans = sum - c[a] + (newCount * (newCount - 1) / 2);
          Console.WriteLine(ans);
      }
   } 
}

Measured memory_bytes: 39244
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n==1){
    cout<<1<<endl;
    return 0;
  }
  int count=0;
  for(int i=6;i>=0;i--){
    if(pow(2,i)<=n){
      cout<<pow(2,i)<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 4212
#include<stdio.h>
int main()
{
    int N,i,a,A[100];
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    a=1;
    for(i=0;i<N;i++){
        if(A[i]%2==0){
          if(A[i]%3==0||A[i]%5==0)
           a=1;
        else{
            a=0;
            break;
        }
    }
    }
    if(a==0)
       printf("DENIED\n");
     else
       printf("APPROVED\n");
      return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
int main(){ 
string s;
int a;
cin>>s;
if(s=="SUN")
a=7;
else if(s=="MON")
a=6;
else if(s=="TUE")
a=5;
else if(s=="WED")
a=4;
else if(s=="THU")
a=3;
else if(s=="FRI")
a=2;
else if(s=="SAT")
a=1;
cout<<a<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;
int main() {
	int n,k;
	cin >> n >> k;
	vector<int> p(n);
	for(int &i:p) {
		cin >> i;
	}
	sort(p.begin(),p.end());
	ll sum = 0;
	assert(k <= n);
	for(int i=0;i<k;i++) {
		sum+=p[i];
	}
	cout<<sum;
}


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

#define D

#ifdef D
int main(void)
{
	string s;
	string p;
	cin >> s;
	cin >> p;
	for (size_t i = 0; i < p.size(); i++)
	{
		if (i != 0)
			s = s.substr(1) + s[0];

		size_t num = s.find(p);
		if (num != string::npos) {
			cout << "Yes" << endl;
			return 0;
		}

	}
	cout << "No" << endl;
	return 0;

}
#endif

Measured memory_bytes: 3208
N, K, Q = map(int, input().split())
*A, = map(int, input().split())

ans = 10**18
for i in range(N):
    pv = A[i]
    res = []; tmp = []
    for a in A:
        if pv <= a:
            tmp.append(a)
        else:
            if len(tmp) >= K:
                tmp.sort()
                res.extend(tmp[:len(tmp)-K+1])
            tmp = []
    if len(tmp) >= K:
        tmp.sort()
        res.extend(tmp[:len(tmp)-K+1])
    if Q <= len(res):
        res.sort()
        ans = min(ans, res[Q-1]-res[0])
print(ans)

Measured memory_bytes: 3316
#include <iostream>
#include <complex>
#include <cstdio>
#include <utility>
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;
#define X real()
#define Y imag()

double dot(P a, P b){
  return a.X * b.X + a.Y * b.Y;
}
double cross(P a, P b){
  return a.X * b.Y - a.Y * b.X;
}

L angle_bisector(P a, P b, P c){
  //角abcをの二等分線
  //a, b or b, cが一致するとゼロ徐算が発生しREになる
  P p = b + (a-b)/abs(a-b) + (c-b)/abs(c-b);
  return L(b,p);
}

P intersection(L a, L b){
  //直線aと直線bの交点
  return a.first + cross(b.second-b.first,a.first-b.first)/(-cross(b.second-b.first,a.second-b.first)+cross(b.second-b.first,a.first-b.first))*(a.second-a.first);
}

double p_to_s_dist(P a, L s){
  /*
  if(dot(s.second-s.first,a-s.first) >= 0 && dot(s.first-s.second,a-s.second) >= 0){
    return abs(cross(s.first-s.second,a-s.second))/abs(s.first-s.second);
  }
  return min(abs(a-s.first), abs(a-s.second));
  */
  return abs(cross(s.first-s.second,a-s.second))/abs(s.first-s.second);
}

int main(){
  P p[3];
  double x, y;
  for(int i = 0; i < 3; ++i){
    cin >> x >> y;
    p[i] = P(x,y);
  }
  L bisectors[3];
  for(int i = 0; i < 3; ++i){
    bisectors[i] = angle_bisector(p[(i+2)%3],p[i],p[(i+1)%3]);
    //cout << bisectors[i].first << " " << bisectors[i].second << endl;
  }
  P inner_center = intersection(bisectors[0],bisectors[1]);
  double ans = 0.0;
  for(int i = 0; i < 3; ++i){
    P a = p[i], b = inner_center;
    L l = L(p[i],p[(i+1)%3]);
    //cout << l.first << " " << l.second << endl;;
    //cout << bisectors[(i+1)%3].first << " " << bisectors[(i+1)%3].second << endl;
    //cout << "i = " << i << endl;
    for(int j = 0; j < 10000; ++j){
      //cout << "a, b = " << a << " " << b << endl;
      P m = (a+b)/2.0;
      double d1 = p_to_s_dist(m,l)*2;
      P k = intersection(bisectors[(i+1)%3], L(m,m+p[(i+1)%3]-p[i]));
      //cout << "m = " << m << " k =  " << k << endl;
      double d2 = abs(k-m);
      if(d1 < d2){
	a = m;
      }else{
	b = m;
      }
    }
    ans = max(ans,p_to_s_dist((a+b)/2.0,l));
  }
  printf("%.12f\n",ans);
  return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch SkillUp | diff SkillUp.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address SkillUp.cpp && ./a.out

/*
 
 5/10/2020
 
 5:07-
 
 */

const int MAX_N=20+1;
LL X,A[MAX_N][MAX_N],C[MAX_N];
int N,M;

const LL Inf=1e17;
void solve() {
  LL res=Inf;
  REP(mask,1<<N) {
    vector<LL> xs(M);
    LL cost=0;
    REP(i,N)if((mask>>i)&1) {
      REP(j,M) xs[j]+=A[i][j];
      cost+=C[i];
    }
    
    bool ok=true;
    REP(j,M) ok&=xs[j]>=X;
    if(ok) SMIN(res,cost);
  }
  
  if(res==Inf) res=-1;
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>M>>X;
  REP(i,N) {
    cin>>C[i];
    REP(j,M) cin>>A[i][j];
  }
  solve();
  
  return 0;
}


Measured memory_bytes: 3704
import scala.io.Source.stdin

object Main {
  val w = List(1,2,4,8,16,32,64,128,256,512)
  def main(args:Array[String]) =
    stdin.getLines.map(_.toInt).foreach { i => println(w.filter(y=>(y & i)>0).mkString(" ")) }
}

Measured memory_bytes: 43652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 100000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
vector<int> ans[1000];
int main(){
	cin >> N;
	int l = 1,r = 10000;
	while(r-l>1){
		int mid = (l+r)/2;
		if(mid*(mid+1)<=2*N)l=mid;
		else r = mid;
	}
	if(l*(l+1)==2*N){
		printf("Yes\n");
		printf("%d\n",l+1);
		int cnt = 0;
		for(int i=0;i<l+1;i++){
			for(int j=i+1;j<l+1;j++){
				ans[i].pb(cnt);
				ans[j].pb(cnt);
				cnt++;
			}
		}
		for(int i=0;i<l+1;i++){
			printf("%d ",l);
			for(int j=0;j<l;j++){
				printf("%d",ans[i][j]+1);
				if(j<l-1)printf(" ");
			}
			printf("\n");
		}
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 2304
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int N,A,B;
  cin>>N>>A>>B;
  cout<<min(A,B)<<" "<<max(0,A+B-N);
return 0;}

Measured memory_bytes: 3576
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
constexpr int R=5e5+69, INF=2e9+6969;

int qq;
int t[R];
double E[R];

int main()
{
	int n,k;
	scanf("%d%d", &n, &k);
	E[0]=0;
	for(int i=1;i<=n;++i)
	{
		int x;
		scanf("%d", &x);
		E[i] = (double)(x+1)/2;
		//  E[i] += E[i-1];
	}
	double sum = 0.0,ans = 0.0;
	for(int i=1;i<=k;++i) sum += E[i];
	ans = sum;
	for(int i=k+1;i<=n;++i)
	{
		sum -= E[i-k];
		sum += E[i];
		ans = max(ans,sum);
	}
	printf("%.2lf\n", ans);
	return 0;
}


Measured memory_bytes: 5232
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    ll N,M;
    cin >> N >> M;

    vec<ll> A(M);
    rep(i,M) cin >> A[i];
    ll ans = N;
    rep(i,M){
        ans-= A[i];
        if(ans < 0) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
}


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

void solve(long long N, long long M){
    ll max_val = max(M/2, N);
    ll ans;
    if(max_val == N) ans = M/2;
    else ans = N + (M/2-N)/2;
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


Measured memory_bytes: 3696
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define what_is(x) cerr << #x << " = " << x << endl;
ll p2[1009];
int main()
{
    fastIO
    string s;
    cin>>s;
    if (s[s.size()-1]=='s')
        cout<<s+"es";
    else
        cout<<s+'s';
}


Measured memory_bytes: 3652
/*
 * 2502.cc: VOCAL ANDROID
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 393;
const int MAX_M = 393;
const int MAX_W = 393;

/* typedef */

typedef vector<int> vi;

/* global variables */

vi cs, ps, ans;
int wis[MAX_M + 1], dp[2][MAX_W + 1];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++) {
    int si, li, pi;
    cin >> si >> li >> pi;
    for (int j = si; j <= li; j++)
      cs.push_back(j), ps.push_back(pi);
  }
  n = cs.size();
  
  int m, maxw = 0;
  cin >> m;

  for (int i = 0; i < m; i++) {
    cin >> wis[i];
    if (maxw < wis[i]) maxw = wis[i];
  }

  memset(dp[0], -1, sizeof(dp[0]));
  dp[0][0] = 0;
  int cur = 0, nxt = 1;

  for (int i = 0; i < n; i++) {
    memcpy(dp[nxt], dp[cur], sizeof(dp[0]));

    int &ci = cs[i], c = ci;
    int &pi = ps[i], p = pi;

    while (c <= maxw) {
      int max_j = maxw - c;
      for (int j = 0; j <= max_j; j++)
        if (dp[cur][j] >= 0) {
          int d = dp[cur][j] + p;
          if (dp[nxt][j + c] < d) dp[nxt][j + c] = d;
        }
      c += ci;
      p += pi;
    }
    cur ^= 1; nxt ^= 1;
  }

  bool ok = true;
  
  for (int i = 0; i < m; i++)
    if (dp[cur][wis[i]] <= 0) {
      ok = false;
      break;
    }

  if (ok)
    for (int i = 0; i < m; i++) printf("%d\n", dp[cur][wis[i]]);
  else
    puts("-1");

  return 0;
}

Measured memory_bytes: 2676
function main()
	N=parse(Int,readline())
	A=Int[]
	B=Int[]
	for i=1:N
		x,y=map(x->parse(Int,x),split(readline()))
		push!(A,x)
		push!(B,y)
	end
	ans=0
	for i=N:-1:1
		x=A[i]+ans
		y=B[i]
		ans+=mod(-x,y)
	end
	println(ans)
end
main()


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

#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll H, n;
    cin >> H >> n;
    ll sum = 0;
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        sum += x;
    }
    if(sum >= H) cout << "Yes";
    else cout << "No";
    
    
    return 0;
}

Measured memory_bytes: 256
(let* ((n (read))
       (arr (make-array (1+ n) :initial-element 0 :element-type 'fixnum)))
  (loop :for k :from 1 :upto n :do(setf (aref arr (read)) k))
  (loop :for k :from 1 :upto n :do(princ (aref arr k)) :do(if (not (= k n)) (princ " "))))

Measured memory_bytes: 58340
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;


struct union_find{
  vector<int> par,r;

   // union_find(int n) : par(n),r(n){init(n)};

  void init(int n){
  	par.resize(n);
  	r.resize(n);
    for(int i = 0; i < n; i++) par[i] = i;
    for(int i = 0; i < n; i++) r[i] = 0;
  }

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

  void unite(int x,int y){
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(r[x] < r[y]){
      par[x] = y;
    }else{
      par[y] = x;
      if(r[x] == r[y]) r[x]++;
    }
  }

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


int main()
{
	int n,m;
	cin >> n >> m;
	vector<int> k(n);
	vector<vector<int> > l(n);
	for(int i = 0; i < n; i++){
		cin >> k[i];
		l[i].resize(k[i]);
		for(int j = 0; j < k[i]; j++){
			cin >> l[i][j];
			l[i][j]--;
		}
	}

	vector<pair<int,int> > edge;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < k[i]; j++){
			edge.push_back(pair<int,int>(i,l[i][j]+n));
		}
	}

	union_find uf;
	uf.init(n+m);
	for(int i = 0; i < edge.size(); i++){
		if(!uf.same(edge[i].first,edge[i].second)) uf.unite(edge[i].first,edge[i].second);
	}
	bool ans = true;
	for(int i = 1; i < n; i++){
		if(!uf.same(0,i)) ans = false;
	}
	cout << (ans?"YES":"NO") << endl;
	
	return 0;
}

Measured memory_bytes: 8564
from math import factorial
from itertools import permutations
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

pi = 0
qi = 0
for i, l in enumerate(list(permutations(list(range(1, n+1))))):
    l = list(l)
    if p == l:
        pi = i
    if q == l:
        qi = i
print(abs(qi - pi))


Measured memory_bytes: 8052
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> lines = new List<string>();
            string readLine;

            do
            {
                readLine = Console.ReadLine();
                if (readLine != null)
                {
                    lines.Add(readLine);
                }
            }
            while (readLine != null);


            foreach (string line in lines)
            {
                List<string> inputs = new List<string>();

                foreach (string input in line.Split(' '))
                {
                    string r;

                    switch (input)
                    {
                        case "+":
                            r = (decimal.Parse(inputs[1]) + decimal.Parse(inputs[0])).ToString();
                            inputs.RemoveAt(0);
                            inputs.RemoveAt(0);
                            inputs.Insert(0, r);
                            break;
                        case "-":
                            r = (decimal.Parse(inputs[1]) - decimal.Parse(inputs[0])).ToString();
                            inputs.RemoveAt(0);
                            inputs.RemoveAt(0);
                            inputs.Insert(0, r);
                            break;
                        case "*":
                            r = (decimal.Parse(inputs[1]) * decimal.Parse(inputs[0])).ToString();
                            inputs.RemoveAt(0);
                            inputs.RemoveAt(0);
                            inputs.Insert(0, r);
                            break;
                        case "/":
                            r = (decimal.Parse(inputs[1]) / decimal.Parse(inputs[0])).ToString();
                            inputs.RemoveAt(0);
                            inputs.RemoveAt(0);
                            inputs.Insert(0, r);
                            break;
                        default:
                            inputs.Insert(0, input);
                            break;
                    }
                    


                }
                Console.WriteLine("{0:F6}", decimal.Parse(inputs[0]));

            }

        }

    }
}

Measured memory_bytes: 6528
#pragma GCC optimize("Ofast")
  
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <tuple>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <cassert>
#include <numeric>
#include <cmath>
#include <bitset>
#include <random>
#include <regex>

using namespace std;
  
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(14)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
constexpr int dy[] = {0,1,0,-1,1,-1,-1,1};
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class A, class B> inline A updiv(const A a,const B b){ return (a + b - 1) / b; }
template <class A, class B> inline A gcd(const A a,const B b){ return b ? gcd(b,a % b) : a; }
template <class A, class B> inline A lcm(const A a,const B b){ return a / gcd(a,b) * b; }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A,class B> using umap = unordered_map<A,B>;


signed main(void){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    int res = 0;
    reps(i,n){
        if(i % 3 && i % 5){
            res += i;
        }
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 3652
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def YesNo(x): return 'Yes' if x else 'No'
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from collections import defaultdict

def main():
    N = II()
    xy = []
    for _ in range(N):
        xy.append(LI())
    xy2g = defaultdict(int)
    g2xy = defaultdict(set)
    for x, y in xy:
        y = -y
        gx = xy2g[x]
        gy = xy2g[y]
        if gx != 0 and gy != 0:  # merge
            if gx == gy:
                continue
            if len(g2xy[gx]) < len(g2xy[gy]):
                gx, gy = gy, gx
            for xy in g2xy[gy]:
                xy2g[xy] = gx
            g2xy[gx] |= g2xy[gy]
            g2xy[gy].clear()
        else:
            g = gx or gy or x
            xy2g[x] = xy2g[y] = g
            g2xy[g] |= {x, y}
    ans = -N
    for xys in g2xy.values():
        m, p = 0, 0
        for xy in xys:
            if xy < 0:
                m += 1
            else:
                p += 1
        ans += m * p
    return ans

print(main())

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

int dp[110][10100];
int N;
int W;
int val[110];
int wei[110];

int main(void){

    cin>>N>>W;
    
    for(int i=0;i<N;i++) cin>>val[i]>>wei[i];
    
    for(int w=0;w<=N;w++) dp[0][w] = 0;
    
    for(int i=0;i<N;i++){
        for(int w=0;w<=W;w++){
            if(w>=wei[i])
                dp[i+1][w] = max(dp[i][w] , dp[i][w-wei[i]] + val[i]);
            else 
                dp[i+1][w] = dp[i][w];
        }
    }
    
    cout<<dp[N][W]<<"\n";
    
}



Measured memory_bytes: 7040
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
int yakusu(int n)
{
    int cnt=0;
    for(int i=1;i<=n;i++){
        if(n%i==0){
            cnt++;
        }
    }
    return cnt;
}
int main()
{
    int n,ans=0;
    cin>>n;
    for(int i=1;i<=n;i++){        
        if(yakusu(i)==8&&i%2!=0)
        ans++;        
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
  int n = 3;
  std::vector< int > va(n, 0);
  for (int i = 0; i < n; i++) {
    std::cin >> va[i];
  }
  std::sort(va.begin(), va.end());

  int ans = 0;
  for (int i = 1; i < n; i++) {
    ans += va[i] - va[i-1];
  }

  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;

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

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

ll n,m,num,sum,a,b,c,d,e,f,g,h,i,j,k,w,ok,ng,l,ans,q;
ll x[500005],y[500005],r[500005];
char s[500005],t[500005];
bool flag,dame;

int main(){
    cin >> a >> b >> k;
	c = min(a,b);
	for(i=c;i>=1;i--){
		if(a % i == 0 && b % i == 0){
			ans++;
			if(ans == k){
				p(i);
				return 0;
			}
		}
	}

	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back


using namespace std;

void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {std::cout << x;}
void __print(unsigned x) {std::cout << x;}
void __print(unsigned long x) {std::cout << x;}
void __print(unsigned long long x) {std::cout << x;}
void __print(float x) {std::cout << x;}
void __print(double x) {std::cout << x;}
void __print(long double x) {std::cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
template <typename T> inline void inp(T &any) {cin >> any;} template <typename T, typename... U>inline void inp(T &a, U &...b) {cin >> a; inp(b...);}
#define rin(args...) ll args; inp(args);
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#define matdeb(mat,row,col) cout << #mat << "::" << endl; printmat(mat,row,col); printpartition;
#define debugv(v,n) cout << #v << ":" << endl; printv(v,0,n-1); printpartition;
#else
#define debug(x...)
#define matdeb(mat,row,col)
#define debugv(v,n)
#endif

const int maxm = 1000000000 + 7;

double startTime;
double getCurrentTime() {
	return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


//----------->CODE BEGINS --------------->


int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n;
	cin>>n;

	int a,b;

	ll ans = 0;

	while(n--)
	{
		cin>>a>>b;

		ans += (b-a)+1;
	}
    
    cout<<ans<<endl;

}


Measured memory_bytes: 3592
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )

readInt :: IO Int
readInt = fst . fromJust . C.readInt <$> C.getLine

main :: IO ()
main = do
  n <- readInt
  print . f $ n

f :: Int -> Int
f n = head . filter (<= n) $ [2^i | i<-[6,5 .. 0]]

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  if (a > b && a > c) {
    if (a == b + c) cout << "Yes" << endl;
    else cout << "No" << endl;
  } else if (b > a && b > c) {
    if (b == a + c) cout << "Yes" << endl;
    else cout << "No" << endl;
  } else {
    if (c == a + b) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	a := getInt()
	b := getInt()

	n := 1
	ans := 0
	for n < b {
		n += (a - 1)
		ans++
	}

	fmt.Println(ans)
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>

inline int input() { int x; scanf("%d", &x); return x; }

const int maxn = 55;
int x[maxn], y[maxn];
int fa[maxn];

inline int find(int u) {
	if(fa[u] == u) return u;
	return fa[u] = find(fa[u]);
}

int calc(int p, int q, int n) {
	for(int i = 1; i <= n; i ++)
		fa[i] = i;
	for(int i = 1; i <= n; i ++)
		for(int j = 1; j <= n; j ++)
			if(x[j] - x[i] == p and y[j] - y[i] == q)
				fa[find(i)] = find(j);
	int res = 0;
	for(int i = 1; i <= n; i ++)
		if(fa[i] == i)
			res ++;
	return res;
}

int main() {
	int n = input();
	for(int i = 1; i <= n; i ++) {
		x[i] = input();
		y[i] = input();
	}
	int ans = 1000000000;
	for(int i = 1; i <= n; i ++)
		for(int j = 1; j <= n; j ++)
			ans = std::min(ans, calc(x[j] - x[i], y[j] - y[i], n));
	printf("%d\n", ans);
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void){
    int i,x,y;
    
    for(i=0;i<3000;i++){
        scanf("%d %d",&x,&y);
        if(x==0 && y==0){
            break;
        }else if(x<=y){
        printf("%d %d\n",x,y);
        }else{
        printf("%d %d\n",y,x);
        }
    }
    return 0;
}


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

using namespace std;

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define pb emplace_back
#define ll long long

const int INF = 2e9 + 1;
const ll INFLL = 1e18 + 1;
const int mod = 1e9 + 7;

ll lol(ll n) {
    return n * (n + 1) / 2;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    set<pair<int, int>> s;
    ll sum = 0;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        s.insert({min(a, b), n - max(a, b)});
        sum += n - max(a, b);
    }
    ll ans = 0;
    for (int l = 0; l < n; l++) {
        while (s.size() && s.begin()->fi < l) {
            sum -= s.begin()->se;
            s.erase(s.begin());
        }
        ans += -sum + lol(n - l);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 12920
#include<bits/stdc++.h>
using namespace std;
int a[200010],b[200010];
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            b[i]=a[i];
        }
        sort(b,b+n);
        int l=b[(n-1)/2],m=b[n/2];
        for(int i=0;i<n;i++)
        {
            if(a[i]<=l)
                printf("%d\n",m);
            else
                printf("%d\n",l);
        }
    }
    return 0;
}


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

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


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

int main()
{
	int a, b, x;
	cin >> a >> b;
	if ((a + b) % 3 == 0 || a  % 3 == 0 || b% 3 == 0)
	{
		cout << "Possible";
	}
	else  
	{cout << "Impossible";}
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#define N 100000
int Partition(int * ,int ,int );
int A[N];
 int Partition(int *A, int p,int r){
  int x,i,h,j;
 
  x = A[r];
  i = p - 1;
  for(j = p ; j <= r - 1; j++){
    if(A[j] <= x){
      i = i + 1;
    h = A[i];
    A[i] = A[j];
    A[j] = h;
    }
  }
  h = A[i + 1];
  A[i + 1] = A[r];
  A[r] = h;
 
  return i + 1;
}
main(){
 
  int i,n,z;
 
  scanf("%d",&n);
 
  for(i = 0 ; i < n ; i++ ){
    scanf("%d",&A[i]);
  }
 
   z = Partition(A,0,n-1);
 
  for(i = 0 ; i < n ; i++ ){
    if(i != 0) printf(" ");
    if(i == z) printf("[%d]",A[i]);
    else printf("%d",A[i]);
  }
 
  printf("\n");
 
  return 0;
   
}
 

Measured memory_bytes: 992
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> ii;
#define inf 1e9
#define F first
#define S second
#define dbg(x) cout<<#x<<" value : "<<x<<"\n";
#define rep(i,j,k) for(int i = (j); i <= (k); i++)
#define rep__(i,j,k) for(int i = (j); i < (k); i++)
#define per(i,j,k) for(int i = (j); i >= (k); i--)
#define per__(i,j,k) for(int i = (j); i > (k); i--)
#define mst(a,b) memset(a,b,sizeof(a))
#define sf(n) scanf("%d",&n)
#define stf(n,m) scanf("%d%d",&n,&m)
#define pf(n) printf("%d\n",n)
#define slf(n) scanf("%lld",&n)
#define plf(n) printf("%lld\n",n)
priority_queue<int,vector<int>,less<int> > q;
const int N=1e3+10;
const int mod=1e9+7;
int T,n,m,a,b;
void solve(){
	if(b==1){
		printf("%d\n",0);
	}
	else{
		int num=1;
		int sum=a;
		while(sum<b){
			sum+=a-1;
			num++;
		}
		printf("%d\n",num);
	}
	return ;
}
int main()
{
	stf(a,b);
	solve();
	return 0;
} 

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

using namespace std;
typedef long long LL;

const int mod = 1e9+7;
const int maxn = 3005;
int dp[maxn][maxn][2],n,m;
void add(int &u,int v) {
	u+=v;u>=mod?u-=mod:0;
}
int main()
{
	#ifdef Amberframe
		freopen("agc013d.in","r",stdin);
		freopen("agc013d.out","w",stdout);
	#endif
	scanf("%d %d",&n,&m);dp[0][0][1]=1;
	for (int i=1;i<=n;i++) dp[0][i][0]=1;
	for (int i=1;i<=m;i++)
	for (int j=0;j<=n;j++)
	for (int k=0;k<=1;k++)
	if (int w=dp[i-1][j][k]) {
		if (j>1) add(dp[i][j-1][k],w);
		if (j==1) add(dp[i][j-1][1],w);
		if (j<n) add(dp[i][j+1][k],w);
		if (j<n) add(dp[i][j][k],w);
		if (j>1) add(dp[i][j][k],w);
		if (j==1) add(dp[i][j][1],w);
	}
	int ans=0;
	for (int j=0;j<=n;j++)
		add(ans,dp[m][j][1]);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 70656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		String S = sc.next();
		String T = sc.next();

		for(int i=0; i<N; i++) {
			System.out.print(S.charAt(i));
			System.out.print(T.charAt(i));
			
		}
	}

}

Measured memory_bytes: 35412
h, w, k = map(int, input().split())
s = [input() for i in range(h)]

cnt = 0
ans = [[-1]*w for i in range(h)]

for i in range(h):
    cnt += 1
    ans[i][0] = cnt
    ichigo_cnt = 0

    for j in range(w):
        ans[i][j] = cnt
        if s[i][j] == "#":
            if ichigo_cnt != 0:
                cnt += 1
                ans[i][j] = cnt
            ichigo_cnt += 1

    if ichigo_cnt == 0:
        for j in range(w):
            ans[i][j] = -1
        cnt -= 1

for i in range(0,h-1)[::-1]:
    for j in range(w):
        if ans[i][j] == -1:
            ans[i][j] = ans[i+1][j]

for i in range(1,h):
    for j in range(w):
        if ans[i][j] == -1:
            ans[i][j] = ans[i-1][j]

for i in ans:
    print(*i)


Measured memory_bytes: 47892
N = int(input())
W = list(map(int,input().split()))
INF = 10**4+1

for i in range(N-1):
    W[i+1] += W[i]

diff = INF
for i in range(N):
    diff = min(diff,abs(W[i]-(W[N-1]-W[i])))

print(diff)


Measured memory_bytes: 3060
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
	ans := 0
	for i := 1; i <= n; i++ {
		if len(strconv.Itoa(i))%2 == 1 {
			ans++
		}
	}

	fmt.Println(ans)

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9;
const ll MOD = 1000000007;
struct edge {
  ll back;
  ll now;
  ll dis;
};
edge RetEd(ll a, ll b, ll c) {
  edge E;
  E.back = a;
  E.now = b;
  E.dis = c;
  return E;
}
int main() {
  int N;
  cin >> N;
  vector<vector<P>> A(N);
  REP(i, N - 1) {
    int a, b, c;
    cin >> a >> b >> c, a--, b--;
    A[a].push_back(P(b, c));
    A[b].push_back(P(a, c));
  }
  vector<int> Ans(N, -1);
  REP(i, N) {
    if (Ans[i] != -1) continue;
    queue<edge> que;
    que.push(RetEd(-1, i, 0));
    while (!que.empty()) {
      edge e = que.front();
      que.pop();
      Ans[e.now] = e.dis % 2;
      for (auto s : A[e.now]) {
        if (s.first == e.back) continue;
        que.push(RetEd(e.now, s.first, s.second + e.dis));
      }
    }
  }
  REP(i, N) {
    cout << Ans[i];
    if (i != N - 1) {
      cout << " ";
    }
    cout << endl;
  }
}

Measured memory_bytes: 11172
S=[list(map(int, input().split())) for i in range(3)]

if S[1][0]-S[0][0]==S[1][1]-S[0][1]==S[1][2]-S[0][2] and S[2][0]-S[1][0]==S[2][1]-S[1][1]==S[2][2]-S[1][2]:
    print("Yes")
else: print("No")


Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

int main() {
	char S[3];
	scanf("%s",&S);
	if (strcmp(S, "AAA") == 0 || strcmp(S, "BBB") == 0) {
		printf("No");
	}
	else {
		printf("Yes");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

int main()
{
	int a, b, c, count = 0, tmp;
	int s1, s2, s3;
	std::cin >> a >> b >> c;
	
	if(a < b)
	{
		tmp = b;
		b = a;
		a = tmp;
	}
	if(a < c)
	{
		tmp = c;
		c = a;
		a =tmp;
	}
	if(b < c)
	{
		tmp = c;
		c = b;
		b = tmp;
	}

	while(1)
	{
		if(a == b &&  a == c)
		{
			break;
		
		}else{
			s1 = a - b;
			s2 = a - c;
			
			if(s1 == s2)
			{
				b = b + 1;
				c = c + 1;
				count++;
			}else if(b < a && c < a){
				b = b + 1;
				c = c + 1;
				count++;
			}else if (a == b){
				s3 = a - c;
				if(s3 % 2  == 0)
				{
					c = c + 2;
					count++;
				}else{
					b++;
					a++;
					count++;
				}
			}
		}
	}
	std::cout << count << std::endl;
	return 0;
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin
sys.setrecursionlimit(100001)
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

s = ns()
t = ns()
c = 0
for i in range(3):
        if s[i] == t[i]:
                c += 1

print(c)

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

int main(){
  int N;
  cin >> N;
  int MinHigh[N],high[N];
  for(int i=0; i<N ;i++) cin >> high[i];
  MinHigh[0] = 0;
  MinHigh[1] = abs(high[1]-high[0]);
  for(int i=2; i<N ;i++){
  	MinHigh[i] = min(MinHigh[i-1]+abs(high[i]-high[i-1]),MinHigh[i-2]+abs(high[i]-high[i-2]));
  }
  cout << MinHigh[N-1] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
using ull = unsigned long long;

int main() {
  ull N;
  cin >> N;

  if(N % 2 == 1) {
    cout << 0 << endl;
    return 0;
  } else {
    if(N < 10) {
      cout << 0 << endl;
      return 0;
    }

    ull n = N;
    ull count = n / 10;
    n /= 10;
    while(n) {
      n /= 5;
      count += n;
    }
    cout << count << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int MAX(int a,int b){return a<b?b:a;}
int main(){
  int n,d[100010],s[100010],r=0,c,a,m,i,ss[100010]={};
  
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++)scanf("%1d",&d[i]);
  a=1;
  c=0;
  for(i=0;i<n;i++){
    if(d[i]-a){
      s[r++]=c;
      c=1;
    }
    else c++;
    a=d[i];
  }
  s[r++]=c;
  if(d[n-1]==0)s[r++]=0;
  //for(i=0;i<r;i++)printf("%d",s[i]);printf("\n");
  for(i=0;i<r;i++)ss[i+1]+=s[i]+ss[i];
  //for(i=0;i<r;i++)printf("%d ",ss[i]);printf("\n");
  for(i=a=0;i+m+m<=r;i+=2)a=MAX(ss[i+m*2+1]-ss[i],a);
  //printf("%d\n",r);
  if(m+m+1>r)a=n;
  printf("%d\n",a);
  return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>

int main()
{
	int a,r,s=0;
	scanf("%d",&a);
	int b=a;

	while(a>0){
		r=a%10;
		s=s+r;
		a=a/10;


	}
	if(b%s==0){
		printf("Yes\n");
	}
	else{
		printf("No");
	}

	


	return 0;
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`


				`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n := nextInt()

	t := 0
	x := 0
	y := 0
	ans := "Yes"
	for i := 0; i < n; i++ {
		nt := nextInt()
		nx := nextInt()
		ny := nextInt()
		d := absInt(nx-x) + absInt(ny-y)
		if d <= nt-t && (d-(nt-t))%2 == 0 {
			x = nx
			y = ny
			t = nt
		} else {
			ans = "No"
			break
		}
	}

	//	fmt.Fprintln(out, "[DEBUG]]", a)
	fmt.Fprintln(out, ans)
}

//------------------------------------------------------------------------------

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}


Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> pii;

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define repm(i, a, b) for(int i = (a); i >= (b); i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える




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

    ll n = s.size();

    //割ったあまりがいくつあるか？をまとめておく
    map<int, ll> mod_map;
    mod_map[0]++;


    ll sum = 0;
    ll base = 1;
    rep(i, n){
        //「右から」i桁目をll_s_iにもってくる
        //char => ll に変換している
        char char_s_i = s[n-1-i];
        ll  ll_s_i = char_s_i - '0';

        //300000000000とか
        ll ll_s_i_keta = ll_s_i * base;
        ll_s_i_keta %= 2019; 

        //sum += ll_s_i * base;
        sum += ll_s_i_keta;

        sum %= 2019;

        int r = sum;
        mod_map[r]++;

        base *= 10;
        base %= 2019;
    }

    ll cnt = 0;
    rep(i, 2019){
        ll m = mod_map[i];
        cnt += m*(m-1)/2;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 3756
using System;
using System.Collections.Generic;
using System.Linq;

public static class Program
{
    public static void Main(string[] args)
    {
        var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        Console.Write(vals[0] <= vals[1] ? "unsafe" : "safe");
    }
}

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

int main()
{
    int n;
    double count=0.0;
    cin>>n;

    for(int i=1;i<=n;i++)
    {
        if(i%2!=0)
            count++;
    }

    cout<<fixed<<setprecision(6)<<count/n<<endl;

    return 0;
}


Measured memory_bytes: 256