akhauriyash/Code-Regression huggingface dataset:
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <cmath>         // sqrt
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;
typedef tuple<ll, ll, string> Tlls;

// Greatest Common Divisor (最大公約数)
ll gcd(ll a, ll b)
{
  // Eucledean algorithm
  while (a)
  {
    if (a < b)
    {
      std::swap(a, b);
    }
    a %= b;
  }
  return b;
}

// Least Common Multiple 最小公倍数
ll lcm(ll a, ll b)
{
  return a / gcd(a, b) * b;
}

// key: value of prime factor素因数分解
// value: number of prime factor
map<ll, ll> prime_factorization(ll n)
{
  map<ll, ll> prime_factors;
  for (ll i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      prime_factors[i]++;
      n /= i;
    }
  }
  if (n != 1)
    prime_factors[n] = 1;
  return prime_factors;
}

// 約数リスト約数の列挙
vector<ll> get_divisors(const ll n)
{
  vector<ll> divs;
  for (ll i = 1; i < (ll)sqrt((ld)n) + 1; i++)
  {
    if (n % i == 0)
    {
      divs.push_back(i);
      if (i != n / i)
      {
        divs.push_back(n / i);
      }
    }
  }

  // 必要に応じてソート
  // sort(divs.begin(), divs.end());

  return divs;
}

int main()
{

  ll X;
  cin >> X;
  ll x = 100;
  ll count = 0;
  while (1)
  {
    x *= 1.01;
    count++;
    if (x >= X)
    {
      cout << count << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 3724
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main(){
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    vector<pair<int,int>> v;
    int pre;
    int now = 0;
    rep(i, s.size()){
        if(i == 0){
            if(s[i] == '<'){
                pre = 1;
                now++;
                if(i == s.size()-1) v.push_back({pre,now});
            }else{
                pre = 0;
                now++;
                if(i == s.size()-1) v.push_back({pre,now});
            }
        }else{
            if(s[i] == '<'){
                bool push = 0;
                if(pre == 1){
                    now++;
                    if(i == s.size()-1) v.push_back({pre,now});
                }else{
                    push = 1;
                    v.push_back({pre,now});
                    pre = 1;
                    now = 1;
                    if(i == s.size()-1){
                        v.push_back({pre,now});
                    }
                }
            }else{
                if(pre == 0){
                    now++;
                    if(i == s.size()-1) v.push_back({pre,now});
                }else{
                    v.push_back({pre,now});
                    pre = 0;
                    now = 1;
                    if(i == s.size()-1){
                        v.push_back({pre,now});
                    }
                }
            }
        }
    }

    ll ans = 0;

    rep(i, v.size()){
        if(i == 0){
            rep(j,v[i].second+1){
                ans += j;
            }
            if(v[i].first == 1){
                if(v.size() != 1) ans -= min(v[i].second, v[i+1].second);
            }
        }else if(i == v.size()-1){
            rep(j,v[i].second+1){
                ans += j;
            }
        }else{
            rep(j,v[i].second+1){
                ans += j;
            }
            if(v[i].first == 1){
               ans -= min(v[i].second, v[i+1].second);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

struct artist{
    int cost;
    int val;

    void READ(){
        char name[33];
        scanf(" %s %d %d", name, &cost, &val);
    }
};

const int M = 111;
const int L = 1001;
const int INF = 10101010;

int dp[M][M][L];
int mx[L];

int main(){
    int lim,n,m,x;
    while(scanf(" %d %d %d %d", &lim, &n, &m, &x),lim){
        vector<artist> a(n),b(m);
        rep(i,n) a[i].READ();
        rep(i,m) b[i].READ();

        rep(i,M)rep(j,M)rep(k,L) dp[i][j][k] = -INF;
        dp[0][0][0] = 0;
        rep(i,m)rep(j,i+1)rep(k,L)if(dp[i][j][k]>=0){
            dp[i+1][j][k] = max(dp[i+1][j][k], dp[i][j][k]);

            int nk = k+b[i].cost;
            if(nk<L) dp[i+1][j+1][nk] = max(dp[i+1][j+1][nk], dp[i][j][k]+b[i].val);
        }

        rep(i,L) mx[i] = -INF;
        for(int i=x; i<=m; ++i)rep(j,L) mx[j] = max(mx[j], dp[m][i][j]);
        rep(i,L-1) mx[i+1] = max(mx[i+1],mx[i]);

        int ans = -INF;
        rep(i,n){
            int rem = lim-a[i].cost;
            if(rem<0) continue;
            ans = max(ans, a[i].val+mx[rem]);

            rep(j,n)if(i!=j){
                int rr = rem-a[j].cost;
                if(rr<0) continue;
                ans = max(ans, a[i].val+a[j].val+mx[rr]);
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}



Measured memory_bytes: 51352
#include<stdio.h>
int main(){
    double a,b,c,d,e,f,x,y;
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
        if(a<0){
            a=-a;
            b=-b;
            c=-c;
        }
        if(d<0){
            d=-d;
            e=-e;
            f=-f;
        }
        y=((c*d)-(a*f))/((b*d)-(a*e));
        x=((b*f)-(c*e))/((b*d)-(a*e));
        printf("%.3lf %.3lf\n",x,y);
    }
    return 0;
}

Measured memory_bytes: 2564
#include <bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define int long long

using namespace std;

const int N = 1e5 + 5;



signed main()
{/*
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);*/
    int k;
    cin >> k;
    int cur = 0, m = 0;
    for (int i = 1; i <= k + k; i++) {
        cur++;
        m = (m * 10 + 7) % k;
        if (m % k == 0) {
            cout << cur;
            return 0;
        }
    }
    cout << -1;
    return 0;
}


Measured memory_bytes: 3632
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
temp_list = []
temp_list.append(A1)
temp_list.append(A2)
temp_list.append(A3)

bingo_list = [[0 for i in range(3)] for j in range(3)]

N = int(input())
for _ in range(N):
    temp = int(input())
    if (temp in A1):
      bingo_list[0][A1.index(temp)] = 1
    if (temp in A2):
      bingo_list[1][A2.index(temp)] = 1
    if (temp in A3):
      bingo_list[2][A3.index(temp)] = 1

if sum(bingo_list[0]) == 3 or sum(bingo_list[1]) == 3 or sum(bingo_list[2]) == 3 or (bingo_list[0][0]+(bingo_list[1][0])+(bingo_list[2][0])) == 3 or (bingo_list[0][1]+(bingo_list[1][1])+(bingo_list[2][1])) == 3 or (bingo_list[0][2]+(bingo_list[1][2])+(bingo_list[2][2])) == 3:
    print("Yes")
elif (bingo_list[0][0]+(bingo_list[1][1])+(bingo_list[2][2])) == 3 or (bingo_list[0][2]+(bingo_list[1][1])+(bingo_list[2][0])) == 3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) (*find_by_order(i))
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
using cd = complex<double>;
const double pi = acos(-1);
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
// #define int ll
vector<ll> ft(1, 1LL);

/*======================================================================*/

void solve(){
    int n, x;
    cin >> x >> n;
    set<int> s;
    rep(i, 0, n){
        int a;
        cin >> a;
        s.insert(a);
    }
    int mi = 1e5, ans = x;
    if(s.size() == 0){cout << x; return;}
    rep(i, x-100, x+100){
        if(s.find(i) == s.end()){
            if(abs(x-i) < mi)mi = abs(x-i), ans = i;
        }
    }
    cout << ans << endl;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3656
def gcd(m,n):
    x=max(m,n)
    y=min(m,n)
    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z

a,b=map(int, input().split())
print(int(a*b/gcd(a,b)))

Measured memory_bytes: 3060
import copy

def solution():
    n, m = map(int, input().split())
    h = [int(s) for s in input().split()]
    roads = [[] for i in range(n)]

    for i in range(m):
        a, b = map(int, input().split())
        roads[a-1].append(b-1)
        roads[b-1].append(a-1)

    ans = 0
    for i, road in enumerate(roads):
        if len(road) == 0:
            ans += 1
        else:
            is_ok = True
            for r in road:
                if h[r] >= h[i]:
                    is_ok = False
            if is_ok:
                ans += 1

    print(ans)

solution()


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

int main()
{
  int n,k;
  cin >> n >> k;
  
  int a[n];
  rep(i,n) cin >> a[i];
  
  ll ans = 0;
  rep(i,n)
  {
    ans++;
    if(i+k > n-1)
      break;
    i += k-2;
  }
    
  cout << ans << endl;
}


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

int main() {
  
string a,b;
cin>>a>>b;
int as=a.size(),bs=b.size(),count=0;
for(int i=0;i<as;i++){
    if(a.at(i)==b.at(i)){
   count++;
    }

}

if(as+1==bs&&count==as){
    cout<<"Yes"<<endl;

}
else{
    cout<<"No"<<endl;
}
}



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

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  string s;
  cin >> n >> s;
  int r = 0, g = 0, b = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'R') r++;
    if (s[i] == 'G') g++;
    if (s[i] == 'B') b++;
  }
  ll ans = 1ll * r * g * b;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int k = 2 * j - i;
      if (j < k && k < n) {
        if (s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) {
          ans--;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <deque>
#include <assert.h>
#include <random>
#include <bitset>
#include <string>
#include <cstring>
#include <memory.h>

using ll = long long;

const int inf = 1e9;
const ll infll = 1e18;

using namespace std;

ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}

struct Solution {
	Solution() {
		ll a, b;
		cin >> a >> b;
		cout << a * b / gcd(a, b);
	}
};

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
	//cin >> t;
	for (; t; t--) {
		Solution s;
	}
	return 0;
}

Measured memory_bytes: 256
object Main extends App {
  var s = scala.io.StdIn.readLine()
  val tSeq = Seq("dreamer", "eraser", "dream", "erase")

  def judgeInclude(sInput: String): Boolean = {
    var sTemp = sInput
    while(true) {
      tSeq.find(t => sTemp.endsWith(t)) match {
        case Some(t) =>
          if(t == sTemp) {
            return true
          } else {
            sTemp = sTemp.dropRight(t.length)
          }
        case _ =>
          return false
      }
    }
    return false
  }
  
  if (judgeInclude(s)) {
    println("YES")
  } else {
    println("NO")
  }
}

Measured memory_bytes: 113656
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<list>
using namespace std;

#define MAX_N 500000
#define INF 1145141919

vector<int>G[MAX_N];
list<int> out;
bool V[MAX_N];
int N, M, b, c[MAX_N], d;
int indeg[MAX_N];
queue<int>Q;

void bfs(int s) {
	Q.push(s);
	V[s] = true;
	while (!Q.empty()) {
		int u = Q.front(); Q.pop();
		out.push_back(u);
		for (int i = 0; i < G[u].size(); i++) {
			int v = G[u][i];
			indeg[v]--;
			if (indeg[v] == 0 && V[v] == false) { V[v] = true; Q.push(v); }
		}
	}
}

void Tsort() {
	for (int i = 0; i < N; i++) {
		indeg[i] = 0;
	}
	for (int u = 0; u < N; u++) {
		for (int i = 0; i < G[u].size(); i++) {
			int v = G[u][i];
			indeg[v]++;
		}
	}
	for (int u = 0; u < N; u++) {
		if (indeg[u] == 0 && V[u] == false) {
			bfs(u);
		}
	}
	b = 0; d = 0;
	for (list<int>::iterator it = out.begin(); it != out.end(); it++) {
		cout << *it + 1 << endl;
		c[b] = *it;
		if (b >= 1) {
			for (int i = 0; i < G[c[b - 1]].size(); i++) {
				if (G[c[b - 1]][i] == c[b]) {
					goto F;
				}
				d = 1;
			F:;
			}
		}
		b++;
	}
	//cout << d << endl;
}

int main() {
	int s, t;
	for (int i = 0; i < MAX_N; i++) { G[i].clear(); }
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> s >> t; s--; t--;
		G[s].push_back(t);
	}
	Tsort();
	return 0;
}

Measured memory_bytes: 15296
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

//# include <ext/pb_ds/assoc_container.hpp>
//# include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 998244353;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 4040;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int a[N];

ll dp[N][N], ans;
//	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//	shuffle(permutation.begin(), permutation.end(), rng);



int main () {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i ++) {
		scanf("%d", a + i);
	}
	ll res = 0;
	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		dp[i][0]++;
		for (int j = m; j >= a[i]; --j) {
			dp[i][j] += dp[i-1][j-a[i]];
			dp[i][j] %= mod;
		}
		res += dp[i][m] * (n-i+1);
		res %= mod;
		for (int j = 0; j <= m; ++j) {
			(dp[i][j] += dp[i-1][j]) %= mod;
		}
		
	}

	printf("%lld", res);


	return Accepted;
}

// B...a

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int n;
lint z, w, x, y;
vector<lint> a;
lint memo[2][2005];
bool done[2][2005];

lint solve(bool turn, int k){
    if(k == n){
        return abs(x - y);
    }
    if(done[turn][k]){
        return memo[turn][k];
    }

    done[turn][k] = true;

    lint res = turn ? -LLINF : LLINF, prev;
    if(turn){
        REP(i, k, n){
            prev = x;
            x = a[i];
            res = max(res, solve(false, i + 1));
            x = prev;
        }
    }else{
        REP(i, k, n){
            prev = y;
            y = a[i];
            res = min(res, solve(true, i + 1));
            y = prev;
        }
    }

    return memo[turn][k] = res;
}

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

    cin >> n >> z >> w;
    x = z;
    y = w;

    a.resize(n);
    rep(i, n){
        cin >> a[i];
    }

    fill(done[0], done[2], false);

    lint ans = solve(true, 0);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;

int main() {
	int N, Q;
	string S;
	cin >> N >> Q >> S;
	vector<int> point(S.size() + 1);
	for (size_t i = 1; i < S.size(); i++)
	{
		point.at(i+1) = point.at(i);
		if (S.substr(i-1, 2) == "AC")point.at(i+1)++;
	}
	for (size_t i = 0; i < N+1; i++)
	{
		//cout << point.at(i) << endl;
	}
	int l, r,ans;
	for (size_t i = 0; i < Q; i++)
	{
		cin >> l >> r;
		l--;
		r--;
		ans = point.at(r + 1) - point.at(l);
		if (l != 0 && S.substr(l - 1, 2) == "AC")ans--;
		cout << ans << endl;
	}
}

Measured memory_bytes: 1408
import java.util.*
import kotlin.math.acos
import kotlin.math.cos
import kotlin.math.round
import kotlin.math.sin

fun main(args: Array<String>) {
    val (n, m) = readIntList()
    val a = List(n) { readString() }
    val b = List(m) { readString() }

    for (i in 0 until n) {
        if (i + m > n) continue
        for (j in 0 until n) {
            if (j + m > n) continue

            var match = true
            for (k in 0 until m) {
                for (l in 0 until m) {
                    if (a[i + k][j + l] != b[k][l]) match = false
                }
            }
            if (match) {
                println("Yes")
                return
            }
        }
    }

    println("No")
}

// read
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 38308
n=input()
num=list(map(int,input().split()))
sorted_num=sorted([num[i]-i for i in range(len(num))])
# bがこの数値だと、ぴったり重なる。
b=sorted_num[len(sorted_num)//2]
print(sum([abs(b-i) for i in sorted_num]))

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

int main(){
    int n;
    cin >> n;
    double dissum;
    double ans;
    int sumn = 1;
    for (int i = 1; i <= n; i++) {
        sumn *= i;
    }
    vector<vector<int> > pos(n, vector<int>(2));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 2; j++) {
            cin >> pos.at(i).at(j);
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            dissum += sqrt (pow (pos.at(i).at(0) - pos.at(j).at(0), 2) + pow (pos.at(i).at(1) - pos.at(j).at(1), 2));
        }
    }
    dissum = dissum * (sumn / n);
    ans = dissum / sumn;
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
int main()
{
    ll days,n,sum=0,p,i;
    cin>>days>>n;
    for(i=0;i<n;i++)
    {
        cin>>p;
        sum+=p;
    }
    if(sum>days)
    cout<<"-1";
    else cout<<days-sum;
    return 0;
}

Measured memory_bytes: 3620
//9文字の時 6~9のみはダメ
//11文字のとき 7~11
#include <iostream>
using namespace std;
int main(void) {
	string s;
	cin >> s;
	int checker = 0;
	for (int i = 0; i < (s.length() - 1) / 2; i++) {//強い回文チェック
		if (s[i] != s[s.length() - (1 + i)]) {
			checker = -1;
			break;
		}
	}
	string halfS = s.substr(0, (s.length() - 1) / 2);
	for (int i = 0; i < (halfS.length() /2) +1 ; i++) {
		if (halfS[i] != s[halfS.length() - (1 + i)]) {
			checker = -1;
			break;
		}
	}
	if (checker == 0) {
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;

	}
}

Measured memory_bytes: 256
s = input()
command_n = int(input())
for i in range(command_n):
    command, a, *b = [int(i) if i.isdigit() else i for i in input().split() ]
    
    if command == "print":
        b = b[0]
        print(s[a:b+1])
    if command == "reverse":
        b = b[0]
        s_ab = s[a:b+1]
        s = s.replace(s_ab, s_ab[::-1])
    if command == "replace":
        b, p = b[0], b[1]
        L_s = list(s)
        L_s[a:b+1] = p
        s = "".join(L_s)


Measured memory_bytes: 5636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<pair<string,pair<int,int> > > resipi;
vector<pair<string,int> >psi;

int main(){
  int n;
  while(cin>>n,n!=0){
    resipi.clear();
    psi.clear();
    ll cost=0;
    for(int i=0;i<n;i++){
      string str;int ne;cin>>str>>ne;
      psi.push_back(make_pair(str,ne));
    }
    int m;
    cin>>m;
    int ban=0,k=0;
    vector<string> sozai;
    for(int i=0;i<m;i++){
      string renkin;cin>>renkin;
      int snum;cin>>snum;
      for(int j=0;j<snum;j++){
	string s;
	cin>>s;
	sozai.push_back(s);
      }
      resipi.push_back(make_pair(renkin,make_pair(ban,ban+snum)));
      ban+=snum;
    }
    string product;
    cin>>product;
    int flag=0;
    int kane=0;
    for(int i=0;i<resipi.size();i++){
      kane=0;
      for(int j=resipi[i].second.first;j<resipi[i].second.second;j++){
	for(int l=0;l<psi.size();l++){
	  if(sozai[j]==psi[l].first)
	    kane+=psi[l].second;
	}
      }
      for(int j=0;j<psi.size();j++){
	if(resipi[i].first==psi[j].first && kane<psi[j].second){
	  psi[j].second=kane;
	  break;
	}
      }
    }
    for(int i=0;i<psi.size();i++)
      if(psi[i].first==product)
	cout<<psi[i].second<<endl;
  }
return 0;
}

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  sort(ALL(A));

  int P = 0, Q = 0;
  REP(i, N){
    if(A[i] >= 0) P++;
    else Q++;
  }

  if(P == 0){
    P++; Q--;
  }else if(Q == 0){
    P--; Q++;
  }

  vector<pair<int, int>> ans;
  FOR(i, Q, N-1){
    ans.emplace_back(A[0], A[i]);
    A[0] -= A[i];
  }
  FOR(i, 0, Q){
    ans.emplace_back(A[N-1], A[i]);
    A[N-1] -= A[i];
  }

  cout << A[N-1] << endl;
  REP(i, N-1){
    cout << ans[i].first << " " << ans[i].second << endl;
  }

  return 0;
}

Measured memory_bytes: 4336
import numpy as np

ryouri = np.array([0]*5)
amari = np.array([0]*5)

for i in range(5):
    ryouri[i] = int(input())
    if ryouri[i]%10 != 0:
        amari[i] = 10-ryouri[i]%10
    
amari[amari.argmax()] = 0
ryouri += amari

print(ryouri.sum())

Measured memory_bytes: 12508
#include <iostream>

using namespace std;

int main()
{
    int a, b;
    
    cin >> a >> b;
    if (a > b)
      cout << "a > b" << endl;
    else if (a < b)
      cout << "a < b" << endl;
    else
      cout << "a == b" << endl;
   
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;


int main(void){
  string s;
  int ans2=0,ans1=0,i;
  cin>>s;
  for(i=0;i<(int)s.size();i++){
    if(s[i]=='0')ans2++;
    else ans1++;
  }
  cout<<min(ans1,ans2)*2<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#define REP(i, a, b) for (auto i = (a); i < (b); ++i)
using namespace std;

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

	int n; cin >> n;
	string s; cin >> s;
	int cnt = 0;
	int i = 0;
	while (i < n) {
		int cur = i;
		++cnt;
		while (i < n && s[cur] == s[i]) ++i;
	}
	cout << cnt;
}

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

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int d,t,s;
    cin >> d >> t >> s;
    if(d<=t*s)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 3644
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin>>a>>b;
    if(a==b)cout<<"Draw"<<endl;
    else
    {
        
    if(a==1)cout<<"Alice"<<endl;
    else if(b==1)cout<<"Bob"<<endl;
    else cout<<(a>b?"Alice":"Bob");
    }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){

  int i,N,A[100],a,count=0,t=0;
  scanf("%d",&N);

  for(i=0;i<N;i++) scanf("%d",&A[i]);

  while(t!=N-1){
    for(i=N-1;i>=1+t;i--){
      if(A[i]<A[i-1]){
	a=A[i-1];
	A[i-1]=A[i];
	A[i]=a;
	count++;
      }
    }
    t++;
  }
  
  for(i=0;i<N;i++){
    printf("%d",A[i]);  
    if(i!=N-1) printf(" ");
  }
  printf("\n%d\n",count);
  
  return 0; 
}



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

int main(void){
  int a[4],b[4];
  int hit;
  int blow;
  cin >> a[0] >> a[1] >> a[2] >> a[3];
  cin >> b[0] >> b[1] >> b[2] >> b[3];
  while(!cin.eof()){
    hit = 0;
    blow = 0;
    for(int i=0;i<4;i++){
      if(a[i] == b[i]){
	hit++;
      }
    }
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
	if(i!=j and a[i] == b[j]){
	  blow++;
	}
      }
    }
    cout << hit << " " << blow << endl;
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    cin >> b[0] >> b[1] >> b[2] >> b[3];
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

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

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll x;
	cin >> x;
	ll ans = 8 - (x - 400) / 200;
	cout << ans << endl;
	return 0;
}


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

int main() {
	ll n,m;
	cin>>n>>m;
	vector<ll>ans(n+1,-1);
	ans[1]=0;
	vector<vector<ll>>v(n+1);
	for(int i=0;i<m;i++){
		ll a,b;
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	queue<ll>que;
	que.push(1);
	while(!que.empty()){
		ll x=que.front();
		que.pop();
		for(ll num:v[x]){
			if(ans[num]!=-1)continue;
			ans[num]=x;
			que.push(num);
		}
	}
	cout<<"Yes\n";
	for(int i=2;i<=n;i++)cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 12864
#include<stdio.h>
#define N 36
typedef struct {
  char mark;
  int value;
}DATA;

void stable(DATA *,DATA *,int);
void display(DATA *,int);

int main()
{
  DATA A[N],B[N],C[N],V;
  int n,i,j,minj,flag,count;
  char sp;
  scanf("%d%c",&n,&sp);
  for(i=0;i<n;i++){
    scanf("%c%d%c",&A[i].mark,&A[i].value,&sp);
    B[i] = A[i];
    C[i] = A[i];
  }

  flag = 1;
  j = 1;

  while(flag){
    flag = 0;
    for(i = n-1;i >= j;i--){
      if(B[i].value < B[i-1].value){
        flag = 1;
        V = B[i];
        B[i] = B[i-1];
        B[i-1] = V;
        count++;
      }
    }
    j++;
  }

  display(B,n);
  printf("Stable\n");

  for(i = 0;i < n;i++){
    minj = i;
    for(j = i;j < n;j++){
      if(C[j].value < C[minj].value) minj = j;
    }
    if(C[i].value != C[minj].value) count++;
    V = C[i];
    C[i]  = C[minj];
    C[minj] = V;
  }

  display(C,n);
  stable(C,A,n);

  return 0;
}

void display(DATA *A,int n){
  int i;
  for(i = 0;i < n;i++){
    printf("%c%d",A[i].mark,A[i].value);
    if(i == n-1) break;
    printf(" ");
  }printf("\n");
}

void stable(DATA *A,DATA *B,int n){
  int i,j,k,l,same = 0,flag = 0;
  for(i = 0;i < n;i++){
    for(l = i+1;l < n;l++){
      if(A[i].value == A[l].value){
        same = 1;
        for(j = 0;j < n;j++){
          if(A[i].value == B[j].value){
            for(k = j+1;k < n;k++){
              if(B[j].value == B[k].value){
                if(A[i].mark != B[j].mark || A[l].mark != B[k].mark){
                  flag = 1;
                }
              }
            }
          }
        }
      }
    }
  }
  if(same == 0 || flag == 0) printf("Stable\n");
  else printf("Not stable\n");
}



Measured memory_bytes: 2100
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.nextLine().toCharArray();

        Set<Character> list = new HashSet<Character>();
        for(Character c: array) {
            list.add(c);
        }

        for(char ch = 'a'; ch<='z'; ch++) {
            if(!list.contains(ch)) {
                System.out.println(ch);
                System.exit(0);
            }
        }
        System.out.println("None");
    }
}


Measured memory_bytes: 26372
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0L;i--)
#define prep(i,n) for(int64_t i=1;i <= (int64_t)(n);i++)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  fspcnt = 0;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  vector<int> a(3);
  rep(i,3) cin >> a.at(i);
  sort(a.begin(),a.end());
  cout << a.at(2)*10 + a.at(1) + a.at(0) << endl;
  
}

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

#define rep(i,n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar,val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

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

int main(void)
{
  char s[101] = {};
  int l, interval[26] = {}, ans = 101;
  clr(interval, -1);
  cin >> s;
  l = strlen(s);
  rep(i, 26){
    int t = -1;
    rep(j, l){
      if(s[j] == 'a' + i){
        chmax(interval[i], j - t - 1);
        t = j;
      }
    }
    chmax(interval[i], l - t - 1);
    if(interval[i] != -1) chmin(ans, interval[i]);
  }
  chmin(ans, l / 2);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> prl;
typedef vector<ll> vcl;
typedef map<ll,ll> mapl;
typedef unordered_map<ll,ll> umap;
#define pb push_back
#define all(v) v.begin(), v.end()
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repi(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 998244353;

int main() {
    // your code goes here
    ll n,a[200005],b[200005];
    cin >> n;
    rep(i,0,n-1){
    	cin >> a[i] >> b[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    if(n%2==1){
    	cout << b[(n-1)/2]-a[(n-1)/2]+1 << endl;
    } else {
    	cout << b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1]+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 6748
#include <stdio.h>

int main(void){
  int a,b,c,d;
  
  scanf("%d%d",&a,&b);

  if(a < b){
    c = a;
    a = b;
    b = c;
  }
  d = a % b;
  while(d != 0){
    a = b;
    b = d;
    d = a % b;
  }
		   
  printf("%d\n",b);

  return 0;
}






Measured memory_bytes: 2104
<?php
fscanf(STDIN, "%s", $x);
switch((int) substr($x, -1, 1)) {
  case 2:
  case 4:
  case 5:
  case 7:
  case 9:
    echo 'hon';
    break;
  case 0:
  case 1:
  case 6:
  case 8:
    echo 'pon';
    break;
  case 3:
    echo 'bon';
    break;
}


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 10005;

int n, a[N];
std::vector<int> E[N];
int dep[N], w[N];

void dfs(int u, int fa = 0) {
	for (int v : E[u]) {
		if (v != fa) {
			dep[v] = dep[u] + 1;
			dfs(v, u);
		}
	}
}

int main() {
	read(n);
	for (int i = 1, u, v; i < n; ++i) {
		read(u), read(v);
		E[u].push_back(v), E[v].push_back(u);
	}
	for (int i = 1; i <= n; ++i) {
		read(a[i]);
	}
	std::sort(a + 1, a + 1 + n);
	dfs(1);
	std::vector<std::pair<int, int>> id;
	for (int i = 1; i <= n; ++i) {
		id.push_back({-dep[i], i});
	}
	std::sort(id.begin(), id.end());
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		w[id[i].second] = a[i + 1];
		if (i < n - 1) {
			ans += a[i + 1];
		}
	}
	print(ans);
	for (int i = 1; i <= n; ++i) {
		print(w[i], " \n"[i == n]);
	}
}


Measured memory_bytes: 5160
using System;
class c
{
    static void Main()
    {
        var inp = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int dx = inp[2] - inp[0], dy = inp[3] - inp[1];
        Console.WriteLine("{0} {1} {2} {3}", inp[2] - dy, inp[3] + dx, inp[2] - dy - dx, inp[3] + dx - dy);
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long int ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef std::vector<ll> vll;
typedef std::vector<vi > vvi;
typedef std::vector<vll > vvll;
typedef std::pair<int,int> ii;
typedef std::pair< ll, ll > lp;
typedef std::vector<ii> vii;
typedef std::vector<vii > vvii;
 
#define pb push_back 
#define PB pop_back
#define pf push_front
#define PF pop_front
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define in1(a,n) F(i,1,n)cin>>a[i]
#define ff first
#define ss second
#define F(i,a,b) for (ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define rep(i,n) F(i,0,n-1)
#define clr clear
#define rz resize
#define sqr(a) ((a) * (a))
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define len(s) (s).length()

int main()
{
	crap;
	string n;
	cin>>n;
	for (char &i : n)
	{
		if (i=='1')
			i='9';
		else
			if (i=='9')
				i='1';
	}
	cout<<n<<"\n";
}

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

vector<Int> H(50, 1), P(50, 1);

Int solve(Int N, Int X){
    if(N == 0){
        if(X <= 0) return 0;
        else return 1;
    } else if(X <= 1+H[N-1]){
        return solve(N-1, X-1);
    } else {
        return P[N-1]+1+solve(N-1, X-H[N-1]-2);
    }
    
}

int main(){
    Int N, X; 
    cin >> N >> X;
    
    rep(i, N-1){
        H[i+1] = 2*H[i] + 3;
        P[i+1] = 2*P[i] + 1;
    }

    cout << solve(N, X) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 1000000000;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    ll N,M;cin >> N >> M;
    if(N == M){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
def primes(n):
    i = 2
    prime = []
    while i**2<= n:
        if n % i:
            i += 1
        else:
            n =n//i
            prime.append(i)
    if n > 1:
        prime.append(n)
    return prime
a,b=map(int,input().split())
pa=set(primes(a))
pb=set(primes(b))
inte=pa.intersection(pb)
print(len(inte)+1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
const string tr="abcdefghijklmnopqrstuvwxyz";
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}

int main(){
  int n;
  cin>>n;
  vi a(n);
  map<int,int> mp;
  rep(i,n){
    cin>>a[i];
    mp[a[i]]++;
  }
  bool ja=false;
  if(n%3!=0){
    rep(i,n){
    if(a[i]!=0) ja=true;
    }
  }
  if(ja){
    cout<<"No"<<endl;
    return 0;
  }
  vi ans;
    for(auto x : mp){
         rep(i, x.second / (n / 3)) ans.push_back(x.first);
    }
 
    if(ans.size() == 3 && (ans[0] ^ ans[1] ^ ans[2]) == 0) yn;
}

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

int main() {
  int n;
  cin >> n;
  if(n%10==7){
    cout << "Yes" << endl;
    return 0;
  }
  if(n/10%10==7){
    cout << "Yes" << endl;
    return 0;
  }
  if(n/10/10%10==7){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl; 
    
}



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

#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)

using namespace std;

using I = int;
using L = long;
using F = float;
using S = string;
using SS = stringstream;
using C = char;
using LL = long long;
using VI = vector<int>;
using VL = vector<long>;
using VF = vector<float>;
using VS = vector<string>;
using PLL = pair<long, long>;
using PLF = pair<long, float>;
using PLS = pair<long, string>;
using PSL = pair<string, long>;
using PSF = pair<string, float>;
using PSS = pair<string, string>;
using MLL = map<long, long>;
using MLF = map<long, float>;
using MLS = map<long, string>;
using MSL = map<string, long>;
using MSF = map<string, float>;
using MSS = map<string, string>;

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;

template <class T>
void PrintVector(vector<T> & v, unsigned n) {
  rep(i, 0, n - 1) {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main(int argc, char const *argv[]) {
  L n;
  VL v(kMax3, 0);
  cin >> n;
  rep(i, 0, n * (n - 1) / 2 - 1) {
    L a, b, c, d;
    cin >> a >> b >> c >> d;
    if (c > d) { v[a - 1] += 3; }
    else if (c < d) { v[b - 1] += 3; }
    else { ++v[a - 1]; ++v[b - 1]; }
  }
  VL count(kMax3, 0);
  rep(i, 0, n - 1) {
    ++count[v[i]];
  }
  per(i, 3 * n - 1, 0) {
    count[i] += count[i + 1];
  }
  rep(i, 0, n - 1) {
    cout << count[v[i] + 1] + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define rrep(i, a, b) for (int i = (a); i < (b); ++i)
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using tl = tuple<ll, ll, ll>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll r, g, b, n;
    cin>>r>>g>>b>>n;

    ll ans = 0;
    for (int i = 0; i * r <= n; ++i) {
        ll m = n - i * r;
        for (int j = 0; j * g <= m; ++j) {
            ll l = m - j * g;
            if (l % b == 0) ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3596