akhauriyash/Code-Regression huggingface dataset:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()

MOD = 10 ** 9 + 7
N, M = inm()
X = inl()
Y = inl()
assert len(X) == N
assert len(Y) == M


def solve():
    xsum = [0] * N
    xsum[N - 1] = (X[N - 1] - X[N - 2]) % MOD
    for k in range(2, N):
        xsum[N - k] = xsum[N - k + 1] + k * (X[N - k] - X[N - k - 1])
        xsum[N - k] %= MOD

    ysum = [0] * M
    ysum[M - 1] = (Y[M - 1] - Y[M - 2]) % MOD
    for k in range(2, M + 1):
        ysum[M - k] = ysum[M - k + 1] + k * (Y[M - k] - Y[M - k - 1])
        ysum[M - k] %= MOD

    return sum(xsum[1:]) % MOD * (sum(ysum[1:]) % MOD) % MOD


print(solve())


Measured memory_bytes: 76516
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var wab = ReadIntArray();
            var w = wab[0];
            var a = wab[1];
            var b = wab[2];
            var l = Math.Min(a, b);
            var r = Math.Max(a, b);
            Console.WriteLine($"{Math.Max(0, r - (w + l))}");
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
    }
}


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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

    int N, M;
    cin >> N >> M;

    vvi adj(N);

    for (int i = 0, u, v; i < M; i++) {
        cin >> u >> v;
        adj[u-1].push_back(v-1);
        adj[v-1].push_back(u-1);
    }

    int two = 0, four = 0, six_plus = 0;
    vi fours;

    for (int i = 0; i < N; i++) {
        int v = adj[i].size();
        if (v&1) {
            cout << "No\n";
            return 0;
        }

        if (v == 2) two++;
        else if (v == 4) { four++; fours.push_back(i); }
        else six_plus++;
    }

    if (six_plus > 0 || four > 2) { cout << "Yes\n"; return 0; }
    if (four < 2) { cout << "No\n"; return 0; }

    int root = fours.front(), paths = 0;
    for (int nbr : adj[root]) {
        int prv = root, loc = nbr;
        while (adj[loc].size() != 4) {
            int nxt = adj[loc][0] + adj[loc][1] - prv;
            prv = loc;
            loc = nxt;
        }
        if (loc == fours.back()) paths++;
    }

    cout << (paths == 2 ? "Yes\n" : "No\n");

    return 0;
}



Measured memory_bytes: 5760
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main()
{
	/*int l, r, d;
	cin >> l >> r >> d;
	cout << r / d - (l - 1) / d;*/


	int n;
	cin >> n;
	int a;
	int ans = 0;
	rep(i, n){
		cin >> a;
		if (i % 2 == 0 && a % 2 == 1)ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;
#define upd_min(miner, updater) if (miner > updater) miner = updater;

void ansYes(bool flag) {
    if (flag) cout << "Yes" << endl; else cout << "No" << endl;
}

void ansYES(bool flag) {
    if (flag) cout << "YES" << endl; else cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

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

struct datas {
    Int max;
    Int size;
};

class ContainChecker {
protected:
    Int minx, miny, maxx, maxy;
public:
    ContainChecker(Int minx, Int miny, Int maxx, Int maxy) : minx(minx), miny(miny), maxx(maxx), maxy(maxy) {};

    bool in(Int x, Int y) {
        return (minx <= x && miny <= y && x <= maxx && y <= maxy);
    }
};

int main(void) {
    Int n , time;
    cin >> n >> time;
    Int bt;
    cin >> bt;
    Int at;
    Int ans = 0;
    REP(n -1 ,i){
        cin >> at;
        if (bt + time < at) {
            ans += time;
        }else{
            ans += at - bt; // 怪しい
        }
        bt = at;
    }
    ans += time;
    cout << ans << endl;

}




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

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

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

#define rep(i,c) for(int i = 0; i < (int)c; ++i)
using llint = long long int ;
using namespace std;

int main(){
    int N,K;
    llint H[210000]={0};
    cin>>N>>K;
    rep(i,N) cin>>H[i];

    sort(H,H+N,greater<llint>());
    llint ans=0;
    for (int i = K; i < N; i++)
    {
        ans=ans+H[i];
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 1920
#include<stdio.h>

int main(){
  int x, y, n;

  scanf("%d %d", &x, &y);
  
  if(x < y) {
    n = x;
    x = y;
    y = n;
  }
  
  while(x % y != 0){
    n = x % y;
    x = y;
    y = n;
  }

  printf("%d\n", y);

  return 0;
}


Measured memory_bytes: 2144
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cstdio>
#include <string>
using namespace std;
#define loop(i,n) for(int i = 0; i < (n); i++)
#define loops(i,f,n) for(int i = (f); i < (n); i++)
#define VEC vector<int>
#define INF INT_MAX
#define debug(a) cout<<a
// vector<VEC> v (n, VEC(n))

int main()
{
	int n, W;
	cin >> n >> W;
	VEC w(n), v(n);
	loop(i, n)cin >> v[i] >> w[i];
	int dp[101][10001];
	loop(i, 101)loop(j, 10001)dp[i][j] = -1;
	dp[0][0] = 0;
	loop(i, n)
	{
		loop(j, W + 1)
		{
			if (dp[i][j] >= 0)dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
			if (j + w[i] <= W)dp[i + 1][j + w[i]] = max(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
		}
	}
	int ans = -1;
	loop(j, W + 1)ans = max(ans, dp[n][j]);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 7140
using System;

class ABC_123_A
{
    static void Main(string[] args)
    {
        int a = int.Parse(Console.ReadLine());
        int b = int.Parse(Console.ReadLine());
        int c = int.Parse(Console.ReadLine());
        int d = int.Parse(Console.ReadLine());
        int e = int.Parse(Console.ReadLine());
        int k = int.Parse(Console.ReadLine());

        bool result = true;

        if (b - a > k) result = false;
        if (c - a > k) result = false;
        if (d - a > k) result = false;
        if (e - a > k) result = false;
        if (c - b > k) result = false;
        if (d - b > k) result = false;
        if (e - b > k) result = false;
        if (d - c > k) result = false;
        if (e - c > k) result = false;
        if (e - d > k) result = false;

        if (result)
        {
            Console.WriteLine("Yay!");
        }
        else
        {
            Console.WriteLine(":(");
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   string s;
           cin>>s;
           Yes(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I');
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 400005;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
  	COMinit();
    ll n, k;
    cin>>n>>k;
    if(n<k){
        cout<<COM(2*n-1, n)<<endl;
        return 0;
    }
    ll Sum=0;
    rep(i, k+1){
        Sum+=COM(n, i)*COM(n-1, n-i-1);
        Sum%=MOD;
        
    }
	cout<<Sum<<endl;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s;
ll cnt[26];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s;
	FOR(i, s.size()) {
		cnt[s[i]-'a']++;
	}
	ll n = s.size();
	ll ans = n * (n-1) / 2 + 1;
	FOR(i, 26) {
		ans -= cnt[i] * (cnt[i]-1) / 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 720
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

bool check(int a, int b) {
	return a > b;
}

int main() {
	int n;
	cin >> n;
	int x;
	int cnt = 0;
	rep(i, n) {
		cin >> x;
		cnt += x % 2;
	}
	YES(cnt % 2 == 0);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

	int n = sc.nextInt();
	int m = sc.nextInt();

	int[][] st = new int[n][2];
	for (int i = 0; i < st.length; i++) {
		st[i][0] = sc.nextInt();
		st[i][1] = sc.nextInt();
	}

	int[][] ch = new int[m][2];
	for (int i = 0; i < ch.length; i++) {
		ch[i][0] = sc.nextInt();
		ch[i][1] = sc.nextInt();
	}

	for (int i = 0; i < st.length; i++) {
		int min = -1;
		int dis = 400_000_000;
		for (int j = 0; j < ch.length; j++) {
			int tmp = Math.abs(st[i][0] - ch[j][0]) + Math.abs(st[i][1] - ch[j][1]);
			if (dis > tmp) {
				min = j;
				dis = tmp;
			}
		}
		System.out.println(min + 1);
	}


	sc.close();
	}

}


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    map<int, int> mk;
    for(int i = 0; i < n; i++) {
        if(s[i] == 'R') {
            mk[i] = 1;
            cnt++;
        }
    }
    int ans = 0;
    for(int i = 0; i < cnt; i++) {
        if(!mk[i]) ans++;
    }
    cout << ans << "\n";


    return 0;
}


Measured memory_bytes: 12996
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int bucket[] = new int[10];
		for(int i = 0; i < 6; i ++) {
			bucket[sc.nextInt()] ++;
		}
		boolean possible = true;
		for(int i = 0; i < bucket.length; i ++) {
			if(bucket[i] >= 3) {
				possible = false;
				break;
			}
		}
		System.out.println(possible ? "YES" : "NO");
	}
}

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

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= b * 200; i++){
        if (int(i * 0.08) == a and int(i * 0.1) == b){
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}

Measured memory_bytes: 256
#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 reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

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

Measured memory_bytes: 256
R, G, B, N = map(int, input().split())
ans = 0
for i in range(N//R+1):
    for j in range(N//G+1):
        n = N - R*i - G*j
        if n < 0:
          break
        if n % B == 0:
            ans += 1
print(ans)

Measured memory_bytes: 2940
import sys
input = sys.stdin.readline
import math
def print_ans(N,H):
    """Test Case
    >>> print_ans(5, "10 4 8 7 3")
    2
    >>> print_ans(7, "4 4 5 6 6 5 5")
    3
    >>> print_ans(4, "1 2 3 4")
    0
    """
    h_arr = list(map(int,H.split()))
    ans = 0
    ofs = 0
    for i in range(N):
        if ofs == i:
            tmp = h_arr[i]
            tmp_ans = 0
            for k in range(i + 1, N):
                ofs += 1
                if tmp >= h_arr[k]:
                    tmp_ans += 1
                    tmp = h_arr[k]
                else:
                    break
            ans = max(ans,tmp_ans)
    print(ans)
            


if __name__ == '__main__':
    N = int(input().rstrip())
    H = input().rstrip()
    print_ans(N,H)

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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define N             (int)(1e6+5)
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,ans; string str;

mii m;
int solve(){
    cin>>n;
    rep(i,0,n-1){
        int t; cin>>t;
        m[t]++;
        if(m[t]>=2){
            cout<<"NO";
            return 0;
        }
    }
        cout<<"YES";
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
int dgts2(int n){return (n?dgts2(n>>1)+1:0);}
int dgts(int n, int k){return (n?dgts(n/k,k)+1:0);}
inline int v2(int n){return __builtin_ctzll(n);}
 
const int maxn=5005;
//i_am_noob
string str;
 
signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> str;
	if(str=="AAA"||str=="BBB") print1("No");
	else print1("Yes");
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        String[] str_arr = str.split(" ");

	    Stack stack = new Stack(200);

	    int a;
	    int b;
	    for (String s : str_arr) {
            try {
                switch (s) {
                    case "+":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a + b);
                        break;
                    case "-":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a - b);
                        break;
                    case "*":
                        b = stack.pop();
                        a = stack.pop();
                        stack.push(a * b);
                        break;
                    default:
                        stack.push(Integer.parseInt(s));
                }
            } catch (Exception e) {
                System.out.println("error");
            }
	    }

        try {
            System.out.println(stack.pop());
        } catch (Exception e) {}

	}
}

class Stack
{
    public int top = 0;
    public int S[];

    public Stack(int n) {
        this.S = new int[n];
    }

    public void push(int x) throws Exception
    {
        if (this.isFull()) {
            throw new Exception();
        }
        this.S[++top] = x;
    }

    public int pop() throws Exception
    {
        if (this.isEmpty()) {
            throw new Exception();
        }
        this.top--;
        return S[this.top + 1];
    }

    private boolean isFull()
    {
        return this.top >= this.S.length - 1;
    }

    private boolean isEmpty()
    {
        return this.top == 0;
    }
}


Measured memory_bytes: 26232
n = gets.to_i
ans = []
t = Array.new(10**6,0)



(1..100).to_a.repeated_permutation(3) do |xyz|
  x = xyz[0]
  y = xyz[1]
  z = xyz[2]
  i = x**2 + y**2 + z**2 + x*y + y*z + x*z  
  j = t[i-1]
  h = j + 1
  t[i-1] = h
end

(1..n).each do |m|
  puts t[m-1]
end


        

Measured memory_bytes: 21956
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef pair<int, double> P;
typedef pair<double, int> S;
const LL MOD = 1000000007LL;
int x[1010];
int y[1010];
int r[1010];
double d[1010];
vector<P> G[1010];
int main() {
	int xs, ys, xt, yt;
	cin >> xs >> ys >> xt >> yt;
	int N;
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> x[i] >> y[i] >> r[i];
	x[0] = xs;
	y[0] = ys;
	r[0] = 0;
	x[N + 1] = xt;
	y[N + 1] = yt;
	r[N + 1] = 0;
	for (int i = 0; i <= N + 1; i++) {
		for (int j = i + 1; j <= N + 1; j++) {
			double d = sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
			G[i].emplace_back(j, max(d - (r[i] + r[j]), 0.0));
			G[j].emplace_back(i, max(d - (r[i] + r[j]), 0.0));
		}
	}
	for (int i = 0; i <= N + 1; i++) d[i] = 1e15;
	d[0] = 0;
	priority_queue<S, vector<S>, greater<P>> Q;
	Q.push(S(0, 0));
	while (!Q.empty()) {
		S s = Q.top(); Q.pop();
		if (d[s.second] < s.first) continue;
		for (auto e : G[s.second]) {
			double cost = s.first + e.second;
			if (d[e.first] > cost) {
				d[e.first] = cost;
				Q.push(S(cost, e.first));
			}
		}
	}
	printf("%.15lf\n", d[N + 1]);
}

Measured memory_bytes: 22676
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h> /*限界*/

#define rep(i, n) for(int  i = 0; i < (n); i++)
#define max(a,b) ((a>b)?a:b)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)

//abc 160 A

int main(void)
{
  char s[6];
  scanf("%s", &s);
  if (s[2] == s[3] && s[4] == s[5]) {
    printf("Yes\n" );
  }else printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
	long int w,a,b;
	scanf("%ld %ld %ld",&w,&a,&b);
	int s;
	if(a<b){
		if (a + w < b){
			s = b - (a + w);
			printf("%ld\n",s);
			}
		if (a + w >= b){
			printf("0\n");
			}
	}
	else{
		if (b + w < a){
			s = a - (b + w);
			printf("%ld\n",s);
			}
		if (b + w >= a){
			printf("0\n");
			}
		}
	return 0;
	}

Measured memory_bytes: 128
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int h, w; readV(h, w);
  int n; readV(n);
  int[] a; readA(n, a);

  auto b = new int[](h*w), j = 0;
  foreach (int i, ai; a) {
    b[j..j+ai][] = i+1;
    j += ai;
  }

  auto putLine(R)(R r)
  {
    foreach (i, ri; r.enumerate) {
      write(ri);
      if (i < w-1) write(" ");
    }
    writeln;
  }

  foreach (i; 0..h)
    if (i%2 == 0) putLine(b[i*w..(i+1)*w]);
    else          putLine(b[i*w..(i+1)*w].retro);
}


Measured memory_bytes: 380
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my ($a, $b, $c) = split / /, <STDIN>);
my $ans = 0;
if ($a + $b >= $c) {
  $ans = $b + $c;
} elsif ($b < $c) {
  $ans = $a + $b * 2 + 1;
}
say $ans;

Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int N, K, A[200000];

bool isOk(int length) {
    int k = K;
    REP(i, N) {
        k -= (A[i] + length - 1) / length;
        k += 1;
    }
    return k >= 0;
}

int main() {
    cin >> N >> K;
    REP(i, N) cin >> A[i];

    int ok = 1e9, ng = 0;
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        if (isOk(mid)) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 4324
#include <stdio.h>
int main(void){
  	char str[100] = {0};
  	int n, k;
  	scanf("%d", &n);getchar();
  	fgets(str, 100, stdin);
  	scanf("%d", &k);getchar();
  	for(int i = 0; i < n; i++){
    	if(str[i] != str[k - 1]){
        	str[i] = '*';
        }
    }
  	printf("%s", str);
	return 0;
}

Measured memory_bytes: 128
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (n  : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  ds <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    x = snd . foldr step (0, 0) $ ds :: Int
    step d (s, t) = (d + s, d * s + t)
  print x

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 508
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
double EPS=1e-10;
double EQ(double a,double b){
    return abs(a-b)<EPS;
}
void fast_stream(){
  std::ios_base::sync_with_stdio(0);
}
template<class T>
string IntToString(T num){
  string res;stringstream ss;ss<<num;
  return ss.str();
}
ll StringToInt(string &str){
  ll res;
  for(int i=0;i<(int)str.size();i++)
    res=(res*10+str[i]-'0');
  return res;
}
const int dy[]={-1,0,0,1};
const int dx[]={0,-1,1,0};
int W,H;
char field[101][101];
int moveTime[101][101];
int sy,sx,ey,ex;
int d[101][101][1<<5];
int maki=0;
typedef pair<int,pair<int,pii> > Sit;
const int INF=1<<30;
int dijkstra(){
  for(int i=0;i<101;i++)
    for(int j=0;j<101;j++)
      for(int k=0;k<(1<<5);k++)
	d[i][j][k]=INF;
  priority_queue<Sit,vector<Sit>,greater<Sit> > pq;
  pq.push(make_pair(0,make_pair(0,pii(sy,sx))));
  d[sy][sx][0]=0;
  while(pq.size()){
    Sit sit=pq.top();pq.pop();
    int cy=sit.second.second.first;
    int cx=sit.second.second.second;
    int ccost=sit.first;
    int cmask=sit.second.first;
    for(int i=0;i<4;i++){
      int ny=cy+dy[i];
      int nx=cx+dx[i];
      if(ny>=0&&nx>=0&&ny<H&&nx<W&&field[ny][nx]!='#'){
	int nmask=cmask;
	if(field[ny][nx]<maki){
	  nmask|=(1<<field[ny][nx]);
	}
	int ncost=ccost+moveTime[cy][cx];
	if(ncost<d[ny][nx][nmask]){
	  d[ny][nx][nmask]=ncost;
	  pq.push(make_pair(ncost,make_pair(nmask,pii(ny,nx))));
	}
      }
    }
  }
  return d[ey][ex][(1<<maki)-1];
}
int main(){
  cin>>W>>H;
  for(int i=0;i<H;i++)
    for(int j=0;j<W;j++)
      moveTime[i][j]=1;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>field[i][j];
      if(field[i][j]=='#'){
	for(int k=0;k<H;k++){
	  for(int l=0;l<W;l++){
	    int s=max(abs(k-i),abs(l-j));
	    moveTime[k][l]=max(moveTime[k][l],4-s);
	  }
	}
      }
      else if(field[i][j]=='M'){
	field[i][j]=maki;
	maki++;
      }
      else if(field[i][j]=='S'){
	sy=i;
	sx=j;
	field[i][j]='.';
      }
      else if(field[i][j]=='G'){
	ey=i;
	ex=j;
	field[i][j]='.';
      }
    }
  }
  // for(int i=0;i<H;i++){
  //   for(int j=0;j<W;j++){
  //     cout<<moveTime[i][j]<<" ";
  //   }
  //   cout<<endl;
  // }
  cout<<dijkstra()<<endl;
  
  return 0;
}

Measured memory_bytes: 2640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

const double eps=1e-10;
double add(double a,double b){
    if(abs(a+b)<eps*(abs(a)+abs(b)))return 0;
    return a+b;
}

typedef pair<double,double> P;
P operator+(const P& x,const P& y){
    return {add(x.first,y.first),add(x.second,y.second)};
}

P operator-(const P& x,const P& y){
    return {add(x.first,-y.first),add(x.second,-y.second)};

}

P operator*(const P& x,const double& y){
    return {x.first*y,x.second*y};
}
double dot(P x,P y){
    return add(x.first*y.first,x.second*y.second);


}

double det(P x,P y){
    return add(x.first*y.second,-x.second*y.first);
}

bool onseg(P p1,P p2,P q){
    return det(p1-q,p2-q)==0 &&dot(p1-q,p2-q)<=0; 
}

P intersection(P p1,P p2,P q1,P q2){
    return p1+(p2-p1)*(det(q2-q1,q1-p1)/det(q2-q1,p2-p1));
}

bool cross(P p1,P p2,P q1,P q2){
    if(det(p1-p2,q1-q2)==0)return onseg(p1,p2,q1)||onseg(p1,p2,q2)||onseg(q1,q2,p1)||onseg(q1,q2,p2);
    P ret=intersection(p1,p2,q1,q2);
    return onseg(p1,p2,ret)&&onseg(q1,q2,ret);
}

double dist(P p1,P p2,P q){
    if(dot(q-p1,p2-p1)<=0)return sqrt(dot(q-p1,q-p1));
    if(dot(q-p2,p1-p2)<=0)return sqrt(dot(q-p2,q-p2));
    P d=p1-p2;
    P ret=q+P{d.second,-d.first};
    P h=intersection(p1, p2, q, ret);
    return sqrt(dot(q-h,q-h));
}

int main(){
    int n;
    while(cin>>n,n!=0){
        P s,t;
        cin>>s.first>>s.second>>t.first>>t.second;
        double ans=1000;
        rep(i,n){
            P a[4];
            double h;
            cin>>a[0].first>>a[0].second>>a[2].first>>a[2].second>>h;
            a[1]={a[0].first,a[2].second};
            a[3]={a[2].first,a[0].second};
            if(a[0].first<s.first&&s.first<a[2].first&&a[0].first<t.first&&t.first<a[2].first&&a[0].second<s.second&&s.second<a[2].second&&a[0].second<t.second&&t.second<a[2].second)ans=0;
            rep(i,4)if(cross(s,t,a[i],a[(i+1)%4]))ans=0;
            rep(i,4){
                double d=dist(s,t,a[i]);
                if(d<h)ans=min(ans,d);
                else ans=min(ans,(h*h+d*d)/2/h);
            }
            rep(i,4){
                double d=min(dist(a[i],a[(i+1)%4],s),dist(a[i],a[(i+1)%4],s));
                if(d<h)ans=min(ans,d);
                else ans=min(ans,(h*h+d*d)/2/h);
            }
        }
        cout<<fixed<<setprecision(6)<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3240
N, M = [int(i) for i in input().split()]
XS = [int(i) for i in input().split()]

if M <= N:
  print(0)
else:
  xs = sorted(XS)
  ds = list(map(lambda a,b: b-a, xs, xs[1:]))
  print(sum(sorted(ds)[:M-N]))


Measured memory_bytes: 13840
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    ll n;
    cin >> n;
    ll ans = n*(n-1)/2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef pair<ut,ut> prs;
const int SIZE=2*1e5;
const LL p=7+1e9;
LL N;
VI edges[SIZE];
inline void IN(ut &x){cin >> x;}
inline void INA(ut n,ut x[]){REP(i,n) cin >> x[i];}
inline void INE(ut m,VI edges[]){
	ut a,b;
	REP(i,m){
		cin >> a >> b;
		edges[a].PB(b);
		edges[b].PB(a);
	}
}
inline void INEC(ut m,Vpr edges[]){
	ut a,b,c;
	REP(i,m){
		cin >> a >> b >> c;
		edges[a].PB(pr(c,b));
		edges[b].PB(pr(c,a));
	}
}
bool solve(){
	LL N,M;
	cin >> N >> M;
	INE(M,edges);
	FOR(i,1,N+1){
		if((LL)(edges[i].size())%2) return false;
	}
	return true;
}
int main(){
	if(solve()) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 8448
#include <stdio.h>

int isPrime(int);

int main(){
  int N,i,x,res = 0;
  scanf("%d",&N);
  for(i = 0 ; i < N ; i++){
    scanf("%d",&x);
    if(isPrime(x)){
      ++res;
    }
  }
  printf("%d\n",res);
  return 0;
}

int isPrime(int x){
  int i;
  if(x < 2){ return 0; }
  for(i = 2 ; i*i <= x ; i++){
    if(x % i == 0){ return 0; }
  }
  return 1;
}

Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	ll i,n,k;string s;cin>>n>>k>>s;
	for(i=0;i<n;i++) if(i+1==k) cout<<(char)(s[i]+32);else cout<<s[i];cout<<endl;
}


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

int main(){
  
    int a;
    cin >> a;
  
  if( a < 1200 ){
      
      cout << "ABC" << endl;
      
    }
  
  else if( 1200 <= a && a < 2800 ){
    
      cout << "ARC" << endl;
    
  }
  
  else if( 2800 <= a ){
    
      cout << "AGC" << endl;
    
  }
  
}


Measured memory_bytes: 256
/**
*    author:  Taichicchi
*    created: 10.09.2020 20:15:20
**/

#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

int main() {
    int A, B, C;
    cin >> A >> B >> C;

    int cnt = B / A;

    int ans;

    if(cnt > C){
        ans = C;
    }else{
        ans = cnt;
    }

    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 3640
n=int(input())
l=list(map(int,input().split()))

c=0
for i in range(0,n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i]==l[j] or l[j]==l[k] or l[k]==l[i]:
                continue
               
            if abs(l[j]-l[k])<l[i] and l[i]<l[j]+l[k]:
                c+=1
print(c)        

Measured memory_bytes: 9196
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

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

    long long dp[100010] ;    
    bool broken[100010];
   for(int i=0;i<m;i++){
       broken[a[i]] = true;
   }

    dp[0] = 1 ;
    if(broken[1]==true){
        dp[1] = 0 ;
    }else{
        dp[1] = 1 ;
    }

    for(int i=2;i<=n;++i){
      if(broken[i]==true){
          dp[i] = 0 ;
          continue ;
      }else{
          dp[i] = dp[i-1] + dp[i-2] ;
           dp[i] %= 1000000007;
      }
    }

    cout << dp[n] << endl ;

	return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
const int N=3009,mod=998244353;
int n,s,a[N],dp[N][N];
int f(int  i,int x){
	if(x and i==n)return 0;
	if(x<0)return 0;
	if(x==0)return 1+n-i;
	if(dp[i][x]!=-1)return dp[i][x];
	int res=f(i+1,x-a[i]);
	if(x==s)res=res*(i+1)%mod;
	res=(res+f(i+1,x))%mod;
	return dp[i][x]=res;
}
int32_t main(){
	if(fopen("input.txt", "r"))
	freopen("input.txt", "r", stdin),
	freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0),cin.tie(0);
	memset(dp,-1,sizeof dp);
	cin >> n >> s;
	for(int i=0;i<n;i++)
		cin >> a[i];
	cout << f(0,s);
}

Measured memory_bytes: 71168
#include<bits/stdc++.h>
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define ll long long
#define pb push_back
#define mb make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod = 1e9+7;
int dp[10123][105][2];
string s;
int d;
int ways(int i,int sum,int flag){
	if(i==s.length()){
		if(sum==0)
			return 1;
		return 0 ;

	}
	if(dp[i][sum][flag]!=-1)
		return dp[i][sum][flag];
	int lim = 9;
	if(flag==0)
		lim = s[i]-'0';
	int ans = 0;
	for(int j = 0 ; j<=lim;j++){
		if(j==lim and flag==0)
			ans+=ways(i+1,(sum+j)%d,0);
		else
			ans+=ways(i+1,(sum+j)%d,1);
		ans%=mod;
	}
	return dp[i][sum][flag]=ans;
}
int main(){
	IOS;
	cin >> s;
	cin >> d;
	memset(dp,-1,sizeof(dp));
	int ans = ways(0,0,0);
	cout << (ans-1+mod)%mod << endl;


	return 0;
}




Measured memory_bytes: 9472
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//227
	vi arr(3);
	for(int &i:arr)cin>>i;
	cout<<min(min(abs(arr[0]-arr[1])+abs(arr[1]-arr[2]), abs(arr[0]-arr[1])+abs(arr[0]-arr[2])),abs(arr[2]-arr[1])+abs(arr[2]-arr[0]));
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

#define mod 1000000007;

using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pr;

ll n;

int main()
{
	cin >> n;
	vector<ll> v(n);

	ll pos,dir=1,d=0;
     pos = n / 2;

	for (int i = 0; i < n; i++) {
		ll a; cin >> a;

		if (n % 2 == 0) {
			if (i % 2 == 1)dir = -1, d++;
			else dir = 1;
		}
		else {
			if (i % 2 == 0)dir = -1;
			else dir = 1,d++;
		}
		v[pos + (d*dir)] = a;
	}
	
	for (int i = 0; i < n; i++) {
		cout << v[i];
		if (i != n - 1)cout << " ";
	}
	cout << endl;
	return 0;
}

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

using namespace std;

int main() {
    vector<int> A(1000001);

    cin >> A[1];
    for(int i = 2; i < 1000001; i++) {
        int temp;
        temp = A[i-1];

        if(temp%2 == 0){
            A[i] = temp/2;
        }else{
            A[i] = temp*3+1;
        }

        //cout << A[i] << endl;
        for(int j = 1; j < i; j++) {
            if(A[j] == A[i]){
                cout << i << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;
	int c=a*b;
	if (c%2==0) cout<<"Even";
	else cout<<"Odd"<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;
namespace helloWorld{
    class main{
        static void Main(){
            int x = 0;
            int y = 0;
            x = int.Parse(Console.ReadLine());
            for(int i = 0; i < 3;i++){
                if(i == 0){
                    y = x;
                }else{
                    y = y * x;
                }
            }
            Console.WriteLine(y);
        }
    }
}

Measured memory_bytes: 9156
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 17
#define MAXM 200005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll n,k,a[MAXN][MAXN];
ll res[MAXM],dp[MAXM];
ll solve(ll mask)
{
    if(mask==0) return mask;
    if(dp[mask]!=-1) return dp[mask];
    ll ans=0;
    ll sup=mask;
    do
    {
        if(sup) ans=max(ans,solve(mask^sup)+res[sup]);
        sup=(sup-1)&mask;
    }while(sup!=mask);
    return dp[mask]=ans;
}
int main()
{
    scanf("%lld",&n);
    for(ll i=0;i<n;i++)
        for(ll j=0;j<n;j++)
            scanf("%lld",&a[i][j]);
    for(ll mask=0;mask<(1<<n);mask++)
    {
        for(ll i=0;i<n;i++)
            for(ll j=i+1;j<n;j++)
                if((mask&(1<<i))&&(mask&(1<<j))) res[mask]+=a[i][j];
    }
    memset(dp,-1,sizeof(dp));
    printf("%lld\n",solve((1<<n)-1));
    return 0;
}



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

class Program {
    static void Main(string[] args) {
        long A, B;
        Input(out A, out B);
        if(A > B) {
            Console.WriteLine(A * B / Gcd(A, B));
        } else if(B > A) {
            Console.WriteLine(A * B / Gcd(B, A));
        } else {
            Console.WriteLine(A);
        }
    }
    static long Gcd(long a, long b) {
        if(a % b == 0) {
            return b;
        } else {
            return Gcd(b, a % b);
        }
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void InputArray<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
}

Measured memory_bytes: 13140
mod=1000000007
# from https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2019/0106_educational_dp_2

def dot(a,b):
    ret=[[0]*n for i in range(n)]
    for i in range(n):
        for j in range(n):
            ret[i][j]=sum(a[i][k]*b[k][j] for k in range(n))%mod
    return ret

#n=int(input())
n,k=map(int,input().split())
dp=[list(map(int,input().split())) for i in range(n)]
ans=[[0]*n for i in range(n)]
for i in range(n):
    ans[i][i]=1

while k:
    k,i=divmod(k,2)
    if i:
        ans=dot(ans,dp)
    dp=dot(dp,dp)
print(sum(sum(a)%mod for a in ans)%mod)

Measured memory_bytes: 73436
#include <bits/stdc++.h>
  using namespace std;
 
int main(){
  string S,T;
  cin >> S;
  cin >> T;
  int count = 0;
  for(int i=0;i<3;i++){
    if(S.at(i)==T.at(i)){
      count++;
    }
  }
  cout << count ;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }

void main() {
  auto I = readln.split.to!(long[]);
  auto N = I[0];
  auto M = I[1];
  long[long] decimals;

  foreach(i; 0..M) {
    I = readln.split.to!(long[]);
    auto key = N - I[0];

    if (key in decimals && I[1] != decimals[key]) {
      writeln(-1);
      return;
    }

    if (N != 1 && key == N-1 && I[1] == 0) {
      writeln(-1);
      return;
    }

    decimals[key] = I[1];
  }

  ulong solve() {
    long ans;
    long keta = 1;

    foreach(i; 0..N) {
      if (i in decimals) {
        ans += keta * decimals[i];
      } else {
        ans += keta * (i == N-1 && N > 1 ? 1 : 0);
      }

      keta *= 10;
    }

    return ans;
  }

  solve().writeln;
}


Measured memory_bytes: 256