akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a,b) for(int i = a; i <b; i++)
#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
// const ll MOD=1000000007ll;
static const ll MOD=1e9 + 7;
static const int MAX=510000;
const int MAX_N = 5e5 + 10;


ll fact[MAX], fact_inv[MAX];

//繰り返し二乗法
ll power(ll a, ll b){
    ll res = 1;
    while(b > 0){
        if(b & 1) res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}

ll comb(ll n, ll r){
    return (fact[n] * fact_inv[r]) % MOD * fact_inv[n-r] % MOD;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}//mod mでの逆元aを計算

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}


int main(){
    fact[0] = 1;
    //階乗計算(O(n))
    for(int i = 0; i < MAX_N; i++) fact[i+1] = fact[i] * (i+1)%MOD;
    fact_inv[MAX_N] = power(fact[MAX_N], MOD - 2);
    //逆元計算(O(logp + n))
    for(int i = MAX_N - 1; i >= 0; i--) fact_inv[i] = fact_inv[i+1]%MOD*(i+1)%MOD;
    //あとはcomb(n,r)に値を突っ込めば良い
    int n, a, b; cin >> n >> a >> b;
    ll k = 1;
    rep(i, 1, a + 1){
        k *= n + 1 - i;
        k %= MOD;
    }
    k *= fact_inv[a];
    ll ans = modpow(2, n, MOD);
    //cout << ans << endl;
    ans -= k + 1;
    ans %= MOD;
    ans = (ans + MOD)%MOD;
    k = 1;
    //cout << ans << endl;
    rep(i, 1, b + 1){
        k *= n + 1 - i;
        k %= MOD;
    }
    k *= fact_inv[b];
    ans -= k;
    //cout << ans << endl;
    ans %= MOD;
    ans = (ans + MOD)%MOD;

    cout << ans << endl;
}

Measured memory_bytes: 8192
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n;
string s[300];

bool check(int a, int b) {
	int i, j;
	rep(i, n) {
		rep(j, n) {
			if (s[(i + a) % n][(j + b) % n] == s[(j + a) % n][(i + b) % n]) continue;
			return false;
		}
	}
	return true;
}

int Abs(int x) { if (x < 0) return -x; return x; }

signed main() {
	int i;
	
	cin >> n;
	rep(i, n) cin >> s[i];
	
	//a - bが同じなら、判定結果が同じ。
	int ans = 0;
	for (i = -(n - 1); i <= (n - 1); i++) {
		int a, b;
		if (i < 0) { a = 0; b = -i; }
		else { a = i; b = 0; }
		int cnt = n - Abs(i);
		if (check(a, b)) {
			ans += cnt;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);


int main(){
    IOS;
    ll n,m;cin>>n>>m;
    ll sum=0;
    ll a[m];f(i,0,m){cin>>a[i];sum+=a[i];}
    if(sum>n)cout<<-1;
    else cout<<n-sum;
    return 0;  
} 





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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

const int N = 1e5+34;

int a[N];

void solve() {
	int n; scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", a+i);
	}
	int ans = 0;
	int bad = 0;
	for (int i = 0; i < n; ++i) {
		if (a[i] == i+1) {
			++bad;
			continue;
		}
		if (!bad) continue;
		ans += (bad+1)/2;
		bad = 0;
	}
	if (bad) ans += (bad+1)/2;
	printf("%d", ans);
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 640
let rec f res (n, k) =
  if n <= 0 then res
  else if res > k then f (res + k) (n - 1, k)
  else f (res * 2) (n - 1, k)

let () =
  let n, k = Scanf.scanf "%d\n%d" (fun n k -> (n, k)) in
  f 1 (n, k) |> print_int


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

int main() {
  string S;
  cin >> S;
  int64_t K;
  cin >> K;
  int cnt = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] != '1') break;
    cnt++;
  }
  if (K <= cnt) cout << 1 << endl;
  else cout << S[cnt] << endl;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


li p[200200];
li sum[200200];

li n, k;

int main() {
    cin >> n >> k;
    rin{
        cin >> p[i];
    }
    sum[0] = 0;
    rep(i, n - 1) {
        sum[i + 1] = sum[i] + (p[i] > p[i + 1] ? 1 : 0);
    }

    li res = n - k + 1;

    li sorted_num = 0;
    rep(i, n - k + 1) {
        if (sum[i + k - 1] - sum[i] == 0) {
            sorted_num++;
        }
    }

    set<li> st;
    rep(i, k) {
        st.insert(p[i]);
    }

    rep(i, n - k) {
        //p3(i, *st.begin(), *st.rbegin());
        if (p[i] == *st.begin() &&
                p[i + k] > *st.rbegin() &&
                sum[i + k - 1] - sum[i] > 0) {
            res--;
        }
        st.erase(p[i]);
        st.insert(p[i + k]);
    }

    cout << res - max(sorted_num - 1, 0ll) << endl;

    return 0;
}

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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
    return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
    return a / gcd(a, b) * b;
}

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}

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

int main()
{
    double a, b, t;

    ci >> a >> b >> t;
    
    co << (int)((t + 0.5) / a) * b << en;
  
    return 0;
}


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, k; cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	while (k--) {
		bool flag = true;
		vector<int> c(n + 1, 0);
		for (int i = 0; i < n; i++) {
			if (a[i] != n) flag = false;
			int l = max(0, i - a[i]), r = min(i + a[i], n - 1);
			c[l]++; c[r + 1]--;
		}
		if (flag) break;
		int s = 0;
		for (int i = 0; i < n; i++) {
			s += c[i];
			a[i] = s;
		}
	}
	for (int i = 0; i < n; i++) cout << a[i] << " \n"[i == n - 1];
	return 0;
}


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

#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define w(x) int t; cin >> t; while(t--)
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define repd(i, b, a) for(int i = b; i >= a; i--)
#define mk(arr,n,type) type* arr = new type[n];
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define um unordered_map
#define us unordered_set
#define pqm priority_queue<int>
#define pqmi priority_queue<int, vi, greater<int>>
#define lb(v, val) lower_bound(v.begin(), v.end(), val) - v.begin();
#define ub(v, val) upper_bound(v.begin(), v.end(), val) - v.begin();
#define setbits(x) __builtin_popcountll(x)
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define out(flag) flag ? cout << "NO" << endl : cout << "YES" << endl;
#define MAX 100001
#define mod 998244353
#define inf 1e18
#define PI 3.1415926535

void IO() {
	fast;
}

int main() {

	IO();

	int n;
	cin >> n;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	vector<int> dp(n);
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < n; i++) {
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	cout << dp[n - 1] << endl;

	return 0;
}


Measured memory_bytes: 1024
#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 <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 <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int f(string s) {
  int length = s.size(); /* length >= 3 */
  int half_ = length / 2;

  for (int i = 0; i < half_; i++) {
    if (s.at(i) != s.at(length-1-i)) {
      return 0;
    }
  }
  return 1;
}

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

  int half_ = in.size() / 2;

  int ret = 1;
  ret *= f(in);
  ret *= f(in.substr(0, half_));
  ret *= f(in.substr(half_ + 1, half_));

  if (ret) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

int main() {
	long long n;
	cin >> n;
	vector<long long> a(n);
	for(int i=0;i<n;++i){
		cin >> a[i];
		a[i] -= (i+1);
	}
	sort(a.begin(), a.end());
	long long man;
	if(n%2==0){
		man = a[n/2-1];
	}else{
		man = a[n/2];
	}
	long long ans = 0;
	for(int i=0;i<n;++i) ans += abs(a[i]-man);
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main()
{
    char x ;
    int i ;  
       cin >> x;
         if (x=='-')
         {
             i--;
         }
         if (x=='+')
         {
             i++;
         }
    
       cin >> x;
         if (x=='-')
         {
             i--;
         }
         if (x=='+')
         {
             i++;
         }
    
  
       cin >> x;
         if (x=='-')
         {
             i--;
         }
         if (x=='+')
         {
             i++;
         }
    
      
       cin >> x;
         if (x=='-')
         {
             i--;
         }
         if (x=='+')
         {
             i++;
         }
 
  cout<<i;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(){
	int N,M,P;
	scanf("%d%d%d",&N,&M,&P);
	vector<int>v(M+1);
	for(int i=0;i<M;i++)scanf("%d",&v[i]);
	v[M]=P;
	M++;
	sort(v.begin(),v.end());
	auto it=lower_bound(v.begin(),v.end(),P);
	int idx=distance(v.begin(),it);
	int r=1<<29;
	for(int i=0;i<M;i++){
		//v[i]???v[i+1]???????????????????????¨??????
		r=min(r,min(
			(v[i]-v[idx]+N)%N+(v[i]-v[(i+1)%M]+N)%N,
			(v[idx]-v[(i+1)%M]+N)%N+(v[i]-v[(i+1)%M]+N)%N
		));
	}
	printf("%d\n",r*100);
}

Measured memory_bytes: 2780
import java.util.*;
import java.util.stream.*;

class Main {
  public static void main(String[] args) {
    var scanner = new Scanner(System.in);
    var N = scanner.nextInt();
    var K = scanner.nextInt();
    var candy = new int[N+1];
    candy[0] = 1;
    for(int i = 1; i <= K; i++) {
    	var d = scanner.nextInt();
	    	for(int j = 1; j <= d; j++) {
          	var x = scanner.nextInt();
          	candy[x]++;
        }
    }
    long target = Arrays.stream(candy).filter(t -> t==0).count();
	System.out.println(target);
  }
}


Measured memory_bytes: 46304
#include <bits/stdc++.h>
using namespace std;
int convert(int x, int n){
    int y=0, i=0, z;
    while(x > 0){
        z = x%n;
        y += z*pow(10, i);
        x = x/n;
        i++;
    }
    return i;
}
int main()
{
    int n,k;cin>>n>>k;
    cout<<convert(n,k)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int n;



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

	string ans = "111";
	for (int i = 0; i < 3; i++) {
		if (s.at(i) == '1') {
			ans[i] = '9';
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
main()
{
    int n,d;
    scanf("%d%d",&n,&d);
    int ans=n/(2*d+1);
    if(n%(2*d+1)!=0)ans++;
    printf( "%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <math.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
ll n,a[100005],bit[100005];
map<ll,ll>pre;
vector<ll>com;
void add(ll x,ll y){
    x++;
    while(x<=n+1){
        bit[x]++;
        x+=(x&-x);
    }
}
ll sum(ll x){
    ll res=0;
    x++;
    while(x>0){
        res+=bit[x];
        x-=(x&-x);
    }
    return res;
}
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        com.PB(a[i]);
    }
    sort(com.begin(),com.end());
    com.erase(unique(com.begin(),com.end()),com.end());
    for(int i=0;i<com.size();i++)pre[com[i]]=i;
    for(int i=0;i<n;i++)a[i]=pre[a[i]];
    ll l=-1,r=n;
    while(r-l>1){
        int m=(l+r)/2;
        ll s=0;
        P p[100005];
        for(int i=0;i<=n;i++)p[i].F=0;
        for(int i=0;i<n;i++){
            if(a[i]<=m)p[i+1].F++;
            else p[i+1].F--;
        }
        for(int i=0;i<=n+1;i++)bit[i]=0;
        for(int i=0;i<=n;i++)p[i].S=-i;
        for(int i=1;i<=n;i++)p[i].F+=p[i-1].F;
        sort(p,p+n+1);
        for(int i=0;i<=n;i++){
            s+=sum(-p[i].S);
            add(-p[i].S,1);
        }
        if(s>=n*(n+1)/4+1)r=m;
        else l=m;
    }
    cout<<com[r]<<endl;
}


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

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

    int x = A + B;
    if (A - B > x)
    {
        x = A - B;
    }
    if (A * B > x)
    {
        x = A * B;
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		// ダイスの目を格納する配列arrayの宣言
		int array[] = new int [6];

		// ダイスの目の要素を読み取りして格納
		for (int i = 0; i < 6; i++) {

			array[i] = sc.nextInt();

		}

		// 質問の数count
		int count = sc.nextInt();

		for (int i = 0; i < count; i++) {

			// 配列arrayをコンストラクタに引き渡す
			Dice dice = new Dice(array);

			int topnum = sc.nextInt();
			int frontnum = sc.nextInt();

			System.out.println(dice.rightnum(topnum, frontnum));

		}
	}
}

class Dice {

	private int num[];
	String diceroll = "NNNNWNNNWNNNENNNENNNWNNN";

	Dice (int arraynum[]) {

		int index = arraynum.length;

		// 配列numの要素数を取得
		num = new int [index];

		// 配列numに配列arrayの要素を格納
		for (int i = 0; i < index; i++) {

			num[i] = arraynum[i];
		}

	}

	public void roll(char order) {

				int copy;

				// Mainメソッドからの引数から分岐して、入れ替わった要素をsetNumメソッドに引き渡し
				switch (order) {

				case 'N' :
					copy = num[0];
					num[0] = num[1];
					num[1] = num[5];
					num[5] = num[4];
					num[4] = copy;

					setNum(num);
					break;

				case 'S' :
					copy = num[0];
					num[0] = num[4];
					num[4] = num[5];
					num[5] = num[1];
					num[1] = copy;

					setNum(num);
					break;

				case 'W' :
					copy = num[0];
					num[0] = num[2];
					num[2] = num[5];
					num[5] = num[3];
					num[3] = copy;

					setNum(num);
					break;

				case 'E' :
					copy = num[0];
					num[0] = num[3];
					num[3] = num[5];
					num[5] = num[2];
					num[2] = copy;

					setNum(num);
					break;
				}
	}

	// rollメソッドで入れ替わった要素をここで上書き
	public void setNum(int arraynum[]) {

		int indexnum = arraynum.length;

		for (int i = 0; i < indexnum; i++ ) {
			num[i] = arraynum[i];
		}

	}

	public int rightnum(int top, int front) {

		// 全ての面の組み合わせを出すdicerollでダイスを回転させる
		for (int i = 0; i < diceroll.length(); i++) {

			roll(diceroll.charAt(i));

			// 入力値の上面と前面とnumの数値が一致したらbreak
			if (top == num[0] && front == num[1]) {
				break;
			}
		}

		// 右面の数値を返す
		return num[2];

	}
}



Measured memory_bytes: 26112
import sys
import numpy as np
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def longest_common_subsequence(S, T):
    LS, LT = len(S), len(T)
    dp = np.zeros((LS + 1, LT + 1), np.int32)
    for n in range(1, LS + 1):
        dp[n, 1:] = dp[n - 1, :-1] + (S[n - 1] == T)  # 左上から
        np.maximum(dp[n], dp[n - 1], out=dp[n])  # 上から
        np.maximum.accumulate(dp[n], out=dp[n])  # 左から
    return dp
 
def reconstruct_LCS(S, T, dp):
    tmp = []
    i, j = len(S), len(T)
    while i > 0 and j > 0:
        if S[i - 1] == T[j - 1]:
            i, j = i - 1, j - 1
            tmp.append(S[i])
        elif dp[i, j] == dp[i - 1, j]:
            i -= 1
        else:
            j -= 1
    return ''.join(reversed(tmp))
 
S = np.array(list(readline().decode()), 'U1')[:-1]
T = np.array(list(readline().decode()), 'U1')[:-1]
 
dp = longest_common_subsequence(S, T)
 
print(reconstruct_LCS(S, T, dp))

Measured memory_bytes: 61964
#include <stdio.h>
#include <math.h>
#define PI 3.14159265358979323846264338

int main(){
    double a,b,h,m;

    scanf("%lf %lf %lf %lf", &a, &b, &h, &m);

    long double arg;
    long double c;

    arg = PI * ((h * 60 + m) / 2 - m * 6) / 180;
    c = sqrtl(a * a + b * b - 2 * a * b * cosl(arg));

    printf("%20.20Lf", c);
    }


Measured memory_bytes: 2568
#coding:utf-8
from collections import defaultdict
dd = defaultdict(int)
N,M = map(int, input().split())
ans = 0
ac = 0
for m in range(M):
    p, s = input().split()
    p = int(p)
    if dd[p] != -1:
        if (s=="WA"):
                dd[p]+=1
        else:
            ans += dd[p]
            ac += 1
            dd[p] = -1
print (ac,ans)

Measured memory_bytes: 15456
import math
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
a=0
b=0
c=sorted(p)
d=sorted(p)

for i in range(n):
    a+=(c.index(p[i]))*math.factorial(n-i-1)
    b+=(d.index(q[i]))*math.factorial(n-i-1)
    c.pop(c.index(p[i]))
    d.pop(d.index(q[i]))

print(int(math.fabs(a-b)))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(n) for(int i=0;i<(n);i++)
#define rep1(n) for(int i=1;i<=(n);i++)
#define all(n) n.begin(),n.end()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
using namespace std;
using ll=long long;
using pii=pair<int,int>;
#define pb push_back
ll dp[3005][3005];
const ll mod = 1000000007;
int main(){
    	int n;
    	string s;
    	cin>>n>>s;
    	dp[1][1] = 1;
    	s = "  " + s;
    	for(int i=2;i<=n;i++){
        if(s[i]=='<'){
            ll res = 0;
            for(int j=1;j<=i;j++){
              dp[i][j] += res;
              dp[i][j] %= mod;
              res += dp[i-1][j];
            }
        }
        else{
            ll res = 0;
            for(int j=i;j>=1;j--){
               res += dp[i-1][j];
               dp[i][j] += res;
               dp[i][j] %= mod;
            }
        }
    	}
    	ll ans = 0;
    	for(int i=1;i<=n;i++) ans += dp[n][i];
    	ans %= mod;
    	cout<<ans<<'\n';

}







Measured memory_bytes: 68992
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        scan.close();

        int mod = 2019;
        int n = s.length();
        String[] sArray = s.split("");
        int[] a = new int[n + 1];

        long curVal = 0;
        for (int i = 1; i <= n; i++) {
            curVal += Integer.parseInt(sArray[n - i]) * modPow(10, i, mod);
            curVal %= mod;
            a[i] = (int)curVal;
        }

        int[] amari = new int[2019];
        for (int i = 0; i <= n; i++) {
            amari[a[i]]++;
        }

        int ans = 0;
        for (int i = 0; i < 2019; i++) {
            if (amari[i] >= 2) {
                ans += amari[i] * (amari[i] - 1) / 2;
            }
        }

        System.out.println(ans);
    }

    private static long modPow(long a, long b, int mod) {
        if (b == 1) {
            return a;
        }

        if (b % 2 == 0) {
            return (long)Math.pow(modPow(a, b / 2, mod), 2) % mod;
        } else {
            return (long)Math.pow(modPow(a, b / 2, mod), 2) * a % mod;
        }
    }
}


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

int main() {
	char str[28];
	bool vis[5+'z'+'Z'];
	memset(vis, false, sizeof(vis));
	scanf("%s", str);
	int len = strlen(str);
	for(int i=0; i<len; i++) {
		if(vis[str[i]]) {
			puts("no");
			return 0;
		} else {
			vis[str[i]] = true;
		}
	}
	puts("yes"); 
}

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

int main(){
  string s,t;
  cin >> s >> t;
  int count=0;
  rep(i,s.size()){
    if(s[i]!= t[i])
      count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 3916
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>

using namespace std;

int main()
{   string n;
    int ans=0; 
    cin>>n;
    if(n[0]!='A')
    {
	  cout<<"WA";
	  return 0;
	}
	if(n[1]<'a')
	{
	  cout<<"WA";
	  return 0;
	}
	for(int i=2;i<n.size()-1;i++)
	{
	  if(n[i]=='C')
	  {
	    ans++;
	    if(ans>1)
	    {
		  cout<<"WA";
		  return 0;
		}
	  }
	  else if(n[i]>='a' && n[i]<='z')
	     continue;
      else 
      {
	    cout<<"WA";
	    return 0;
	  }
	}
	if(n[n.size()-1]<'a')
	{
	  cout<<"WA";
	  return 0;
	}
	if(ans==0)
	{
	  cout<<"WA";
	  return 0;
	}
	cout<<"AC";
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    H, W = map(int, readline().split())
    G = [0] * H
    for i in range(H):
        G[i] = readline().strip()
    dxdy4 = ((-1, 0), (0, -1), (0, 1), (1, 0))

    dist = [[-1] * W for _ in range(H)]
    dist[0][0] = 1
    queue = deque([(0, 0)])
    while queue:
        x, y = queue.popleft()
        if x == H - 1 and y == W - 1:
            break
        for dx, dy in dxdy4:
            nx, ny = x + dx, y + dy
            if 0 <= nx < H and 0 <= ny < W and G[nx][ny] == '.' and dist[nx][ny] == -1:
                queue.append((nx, ny))
                dist[nx][ny] = dist[x][y] + 1

    if dist[H - 1][W - 1] == -1:
        print(-1)
    else:
        blacks = sum(row.count('#') for row in G)
        print(H * W - dist[H - 1][W - 1] - blacks)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
struct edge { ll s, t, x; };
typedef pair<ll, ll> P;
typedef pair<ll,P> event;
const ll MAX = 510000;
const ll MOD = 1000000007;
#define INF (ll)10000000000000000


int main() {
  ll N,M;
  cin>>N>>M;
  vector<ll>A(N);
  rep(i,N){cin>>A[i];}
  sort(A.begin(),A.end());
  ll min=0ll,max=INF;
  while(max-min>1){
    ll mid=(max+min)/2ll;
    ll cnt=0ll;
    rep(i,N){
      ll g=(lower_bound(A.begin(),A.end(),mid-A[i])-A.begin());
      cnt+=(N-g);
    }
    if(cnt<M){max=mid;}
    else{min=mid;}
  }
  ll S[N+1];
  S[0]=0ll;
  rep(i,N){
    S[i+1]=S[i]+A[i];
  }
  ll ans=0ll;
  ll memo=0ll;
  rep(i,N){
    ll g=(upper_bound(A.begin(),A.end(),min-A[i])-A.begin());
    memo+=(N-g);
    ans+=A[i]*(N-g);
    ans+=(S[N]-S[g]);
  }
  ans+=min*(M-memo);
  cout<<ans;
}




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

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

int main(void) {
    int N;cin>>N;
    if (N % 2 == 0) cout << N << endl;
    else cout << lcm(2, N) << endl;
    return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;

	if (a < b)
		swap(a, b);
	if (a < c)
		swap(a, c);
	for (int i = 0; i < k; i++)
		a *= 2;
	cout << a + b + c << endl;

	return 0;
}

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

int main() {
    ll x, k, d;
    cin >> x >> k >> d;
    if (x < 0) x = - x;
    
    ll q = x/d;
    if (k <= q) {
        x -= d * k;
        cout << x << endl;
        return 0;
    }
    x -= q * d;
    if ((k-q)%2 == 0) {
        cout << x << endl;
    }
    else {
        cout << abs(x-d) << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
def CountFrequency_mod(my_list): 
  
    # Creating an empty dictionary  
    freq = {} 
    for item in my_list: 
        if (item in freq): 
            freq[item] += 1
        else: 
            freq[item] = 1
    
    freq_mod = freq
    freq_val = list(freq.values())
    all_sum=0
    
    for i in freq_val:
        all_sum+=i*(i-1)/2
        
    for i in freq:
        freq_mod[i] = all_sum - freq[i]*(freq[i]-1)/2 + (freq[i]-1)*(freq[i]-2)/2
    return freq_mod


N = int(input())

A = [int(i) for i in input().split()]

dic = CountFrequency_mod(A)

for i in A:
    print(int(dic[int(i)]))
    

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

void main() {
  auto a = readln.split.to!(int[]);
  auto A = a[0], B = a[1], C = a[2];
  foreach (i; 0.. B) {
    if (A * (i+1) % B == C) {
      writeln("YES");
      return;
    }
  }
  writeln("NO");
}


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


  
int main(){
  

  char b;
  cin>>b;
  
  if (b=='A'){
    cout<<'T'<<endl;
  }
  
  else if (b=='T'){
    cout<<'A'<<endl;
  }
  
  else if (b=='G'){
    cout<<'C'<<endl;
  }
  
  else if (b=='C'){
    cout<<'G'<<endl;
  }
  
  
  
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
int numz[16];
int n;
int ans;
vector<pair<int,int>> kotoba[16];

int main(){
    cin>>n;
    
    for(int i=1;i<=n;i++){
        cin>>numz[i];
        for(int j=1;j<=numz[i];j++){
            int l,r;
            cin>>l>>r;
            kotoba[i].push_back({l,r});
        }
    }
    
    for(int i=0;i<1<<n;i++){
        int cnt=0;
        int flag=false;
        for(int j=0;j<n;j++){
            if(i>>j &1 ==1){
                cnt++;
                for(int k=0;k<numz[j+1];k++){
                    auto p=kotoba[j+1][k];
                    int l=p.first,r=p.second;
                    if((i>>(l-1)&1) != r) {
                        flag=true;
                        break;
                    }
                }
            }
            if(flag==true) break;
        }
        if(flag==false) ans=max(ans,cnt);
    }
    cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 256
[n,k]=list(map(int,input().split()))
alist=list(map(int,input().split()))

#足跡
footprint=[0]*n

omoide=[]
now=0
counter=1
while True:
    if footprint[now]!=0:
        break
    footprint[now]=counter
    omoide.append(now)
    goto=alist[now]-1
    now=goto
    counter+=1

joso=footprint[now]-1
shuki=counter-footprint[now]

if k>joso:
    k-=joso
    k=k%shuki

    ans=omoide[joso+k]+1

else:
    ans=omoide[k]+1
    
print(ans)



Measured memory_bytes: 32296
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <utility>
#include <functional>
#include <map>
#include <string>
#include <set>
#include <math.h>

using namespace std;

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

  string s;
  cin >> s;

  string s0;
  string s1;

  int count0 = 0;
  for (int i = 0; i < s.size(); i++) {
    char cur = s[i];
    if (i % 2 == 0) {
      if (s[i] != '0') {
        count0++;
      }
    }
    else {
      if (s[i] != '1') {
        count0++;
      }
    }
  }

  int count1 = 0;
  for (int i = 0; i < s.size(); i++) {
    char cur = s[i];
    if (i % 2 == 0) {
      if (s[i] != '1') {
        count1++;
      }
    }
    else {
      if (s[i] != '0') {
        count1++;
      }
    }
  }

  cout << min(count0, count1) << endl;
}

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

int main() {
  int N, D; cin >> N >> D;
  int X[N][D];
  for (int i = 0; i < N; i++)
    for (int d = 0; d < D; d++)
      cin >> X[i][d];
  int count = 0;
  for (int i = 0; i < N-1; i++) {
    for (int j = i+1; j < N; j++) {
      double dist = 0;
      for (int d = 0; d < D; d++) {
      	dist += (X[i][d]-X[j][d])*(X[i][d]-X[j][d]);
      }
      dist = sqrt(dist);
      if (abs(dist - round(dist)) < 1e-4) count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ull unsigned long long int
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second 

#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)


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

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

    ll t; t=1;
    while(t--){
        ll n,m; cin>>n>>m;
        ll a[m];
        ll sum=0;
        rep(i,m){
            cin>>a[i];
            sum+=a[i];
        }
        if(n-sum<0) cout<<-1;
        else cout<<n-sum;
    }
    return 0;
}

Measured memory_bytes: 3720
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <list>
#include <bitset>
#include <numeric>
#include <utility>
#define INF 1e9
#define MOD 1000000007
#define ll long long
using namespace std;
typedef unsigned long long ull;
typedef pair<int, int> pr;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    ll a;
    vector<ll>p;
    map<ll,ll>mp;
    for(int i=0;i<n;i++){
        cin>>a;
        mp[-a]++;
    }
    ll ans=0;
    ll v=1;
    while(v<2e9+1){
        v*=2;
        p.push_back(v);
    }
    for(auto &itr:mp){
        if(itr.second==0){
            continue;
        }
        const auto a=itr.first;
        const auto x=*upper_bound(p.begin(), p.end(), -a);
        const auto res=-(x+a);
        if(res==a){
            ans+=itr.second/2;
            continue;
        }
        if(mp.count(res)==0){
            continue;
        }
        if(mp[res]==0){
            continue;
        }
        const auto add=min(mp[res],mp[a]);
        mp[res]-=add;
        ans+=add;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 12800
// Problem : B - Product Max
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORR(i,n) for(int i=n;i>=0;i--)
#define pb push_back
#define vint vector<int>
#define sint set<int>
#define mint map<int,int>
#define pint pair< int,int >
#define int long long int 
#define test int tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define SI(a,n) int a[n];FOR(i,n) cin>>a[i];
#define input(a,n) int n;cin>>n; SI(a,n)
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define precision(x) cout<<fixed<<setprecision(x);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element)!=container.end())
#define fint fast;test
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define ft first
#define se second
#define MOD 1000000007
using namespace std;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void solve(){
	int a,b,c,d;
	rd(a,b,c,d);
	int ans=b*d;
	ans=max({ans,b*c,a*c,a*d})	;
	pp(ans);
	return;	
}


int32_t main() {
    // fint{
    	fast;
    	solve();
    // }
    return 0;
}


Measured memory_bytes: 3644
#include<stdio.h>
#include<string.h>
int A[5000][5000];
int main(){
    int i,j,n,m;
    char s1[4001],s2[4001];
    int ans;

    while(scanf("%s%s",s1,s2)!=EOF){
	n=strlen(s1);
	m=strlen(s2);

	for(i=0;i<=n;i++){
	    for(j=0;j<=m;j++){
		A[i][j]=0;
	    }
	}

	ans=0;
	for(i=1;i<=n;i++){
	    for(j=1;j<=m;j++){
		if(s1[i-1]==s2[j-1]){
		    A[i][j]=A[i-1][j-1]+1;
		    if(A[i][j]>ans) ans=A[i][j];
		}
//		printf("%d",A[i][j]);
	    }
//	    printf("\n");
	}

	printf("%d\n",ans);
    }

    return 0;
}
	

Measured memory_bytes: 80416
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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 n,even[100001]={},odd[100001]={},evenmax=0,evensecondmax=0,oddmax=0,oddsecondmax=0,evenpos=0,oddpos=0,ans;

int main(){
    cin>>n;
    int v[n];
    rep(i,n){
        cin>>v[i];
        if(i%2==1){
            even[v[i]]++;
        }else{
            odd[v[i]]++;
        }
    }
    rep(i,100001){
        if(evenmax<even[i]){
            evensecondmax=evenmax;
            evenmax=even[i];
            evenpos=i;
        }else if(evensecondmax<even[i]){
            evensecondmax=even[i];
        }

        if(oddmax<odd[i]){
            oddsecondmax=oddmax;
            oddmax=odd[i];
            oddpos=i;
        }else if(oddsecondmax<odd[i]){
            oddsecondmax=odd[i];
        }

    }
    if(evenpos==oddpos){
        ans=max(evensecondmax+oddmax,evenmax+oddsecondmax);
    }else{
        ans=evenmax+oddmax;
    }
    out(n-ans);
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;

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 N;
ll h[100010];

// DP テーブル
ll dp[100010];
*/

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

	vector<int> x_(N), y_(N), h_(N);

	int si = -1;

	for (int i = 0; i < N; i++)
	{
		cin >> x_[i] >> y_[i] >> h_[i];

		if (h_[i] > 0) si = i;
	}
	
	int ans_x, ans_y, ans_h;

	for (int x = 0; x < 101; x++)
	{
		for (int y = 0; y < 101; y++)
		{
			int h = h_[si] + abs(x_[si] - x) + abs(y_[si] - y);

			bool ok = true;

			for (int n = 0; n < N; n++)
			{
				if (h_[n] > 0 && h - h_[n] != abs(x_[n] - x) + abs(y_[n] - y)) ok = false;

				if (h_[n] == 0 && h > abs(x_[n] - x) + abs(y_[n] - y)) ok = false;
			}

			if (ok) ans_x = x, ans_y = y, ans_h = h;
		}
	}
	cout << ans_x << " " << ans_y << " " << ans_h << endl;
}


Measured memory_bytes: 256
while True:
    num = int(input())
    if num == 0:
        break
    
    m = 0
    mp = None
    for _ in range(num):
        p, d1, d2  = [int(x) for x in input().split()]
        if d1 + d2 > m:
            m = d1 + d2
            mp = p
    print(mp,m)


Measured memory_bytes: 5624
n,d=map(int,input().split())
dis = [list(map(int,input().split())) for i in range(n)]

def is_square(n):
    res=n**0.5
    return res.is_integer()

cnt = 0
for i in range(n):
    for j in range(i+1,n):
        dist = 0
        for k in range(d):
            #i行目とj行目
            dist += (dis[i][k]-dis[j][k])**2
        if is_square(dist) == True: cnt+=1
print(cnt)

Measured memory_bytes: 38384
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#pragma region macro
#include <bits/stdc++.h>
typedef long long int64;
using namespace std;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const int64 INF = 1LL << 62;
const int inf = 1<<30;
const char bn = '\n';
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; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, const vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, pair<T,S> const&P){
    os << "(";
    os << P.first;
    os << " , ";
    os << P.second;
    os << ")";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
    os<<endl;
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, map<T,S> const&M){
    for(auto e:M){
        os<<e;
    }
    os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
#pragma endregion
//fixed<<setprecision(10)<<ans<<endl;



int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<int64> A(N);
    REP(i,N) cin >> A[i], A[i]-=(i+1);
    sort(ALL(A));

    int64 mid = A[N/2];
    int64 ans=0;
    for(auto a:A) ans += abs(a-mid);

    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  int a,b;
  cin >> a >> b;
  if(a<=9 && b<=9)cout << a*b << endl;
  else cout << -1 << endl;
  
  return 0;     
}


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

using namespace std;

int main()
{
   char str[5];cin>>str;
   sort(str,str+(strlen(str)));
      if(str[0]==str[1] && str[2]==str[3] && str[1]!=str[2])cout<<"Yes\n";
      else cout<<"No\n";
 
   return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

ll d[100010];
ll c[100010];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	rep(i,1,n+1)c[i]=1;
	d[1]=1;
	while(m--){
		int x,y;
		scanf("%d%d",&x,&y);
		c[y]++;
		if(d[x])d[y]=1;
		c[x]--;
		if(!c[x])d[x]=0;
		
	}
	ll ans=0;
	rep(i,1,n+1)ans+=d[i];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1664
package main

// Solution for https://atcoder.jp/contests/aising2020/tasks/aising2020_a

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var l, r, d int
	con.Scan(&l, &r, &d)
	con.Println(r/d - (l-1)/d)
	return nil
}


Measured memory_bytes: 1844
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
using namespace std;

int a, b, c;

int main(void) {
    cin >> a >> b >> c;
    if (a <= c&&c <= b) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);


  ll n, a, b;
  cin >> n >> a >> b;
  auto d = b - a;
  if(d & 1) {
    ll lf = a + (b - a) / 2;
    ll rg = n - b + 1 + (b - a) / 2;
    cout << min(lf, rg);
  } else {
    cout << d / 2;
  }
}

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

int A,B,K;
int main (){
    cin >> A >> B >> K;
    if ( B - A + 1 > 2 * K) {
        for(int i=0; i<K; i++){
            cout << A + i << endl;
        }
        for(int i=K-1; i>=0; i--){
            cout << B - i << endl;
        }
    } else {
        for(int i=A; i<B+1; i++){
            cout << i << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<stack>
#include<vector>
using namespace std;

int main(){
    int a,b,c;
    int x,y,z;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << " ";

    return 0;

}

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

typedef long long int ll;
#define pll pair <ll, ll>
#define pii pair <int, int>
#define f first
#define s second
#define pb push_back
#define vll vector <ll> 
#define mll map <ll ,ll> 
#define prtq  priority_queue <long long>
#define rep(a,b) for(i=a;i<b;i++) 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define inf 1e18
using namespace std;
#define Mod 1000000007
////////////////////////////////////////////////////////////////////

void fio()
{
#ifndef ONLINE_JUDGE
freopen("input1.txt", "r", stdin);
freopen("output1.txt", "w", stdout);
#else
#endif
}

void tim()
{
   #ifndef ONLINE_JUDGE
   cerr << "Time elapsed: " << clock() / 1000 << " ms" << endl;
   #endif
}

int sumofdigit(ll n){
  ll temp=n; int sum=0;
   while(temp){
      sum+=temp%10;
      temp/=10;
    }
    return sum;
}



int main()
{
  fio();  
   IOS; 
    
  int t=1;
// cin>>t;
  while(t--){
    ll n,s;
    cin>>n;
    vll h(n+1);
    int i;
    rep(1,n+1)cin>>h[i];

    vll dp(n+1,0);

    dp[1]=0; dp[0]=0;
    for(i=2;i<=n;i++){
      if(i==2)dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
     else dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i-2]-h[i]));
    }

    cout<<dp[n];


    
 }

   tim();
    return 0; 
 
}

// //
// 199
// 200
// 500
// 1000

// 112
// 120

Measured memory_bytes: 4760
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 
#define MAX_CHAR 256

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;
void swap(ll &a,ll &b){
    ll temp=a;
    a=b;
    b=temp;
}
ll gcd(ll a,ll b){
    while(b){
        a%=b;
        swap(a,b);
    }
    return a;
}

void solve(){
    ll N;
    cin>>N;
    string s;
    cin>>s;
    ll count=0;
    ll r=0;
    ll g=0;
    ll b=0;
    for(ll j=0;j<N;j++){
      for(ll k=1;k<=N;k++){
          if(j-2*k>=0){
              if(s[j]!=s[j-k]&&s[j-k]!=s[j-2*k]&&s[j]!=s[j-2*k]){
                count++;
              }
          }
      }  
      if(s[j]=='R'){
          r++;
      }
      if(s[j]=='G'){
          g++;
      }
      if(s[j]=='B'){
          b++;
      }
    }
    ll ans=(r*g*b)-count;
    out(ans);

}

int main(){
    solve();
    return 0;
}

Measured memory_bytes: 3628