akhauriyash/Code-Regression huggingface dataset:
import std.stdio;
import std.array;
import std.string;
import std.container;
import std.ascii;
import std.random;
import std.algorithm;
import std.conv;
import std.range;
import std.math;
import std.format;
import std.typecons;
import std.numeric;
import std.datetime;

/*
  ??????????????????, ?????§??¨?????¨, ??¨?????????, ????????????????????????????????????
*/

/**
  src???????????°??????G, dst???King's Graph??§??????Gemb
*/
int n, m, u, v, c;
edge[][] g;

void main() {
  n = readln.chomp.to!int;
  g = new edge[][](n, 0);
  for (int i = 0; i < n-1; ++i) {
    auto l = readln.chomp.split.map!(to!int).array;
    g[l[0]] ~= edge(l[0], l[1], l[2]);
    g[l[1]] ~= edge(l[1], l[0], l[2]);
  }

  edge e = treeDiameter(g);
  writeln(e.cost);
}

/***************************************************************************/
// c++???pair??£??????
struct pair {
  int first, second;
}

struct edge {
  int u, v, cost;
}

class queue(T) {
  T[] p;

  this() {}
  this(T p) {
    this.p ~= p;
  }
  ~this() {}

  void push(T x) {
    p ~= x;
  }

  void pop() {
    assert(p.length > 0);
    p.popFront();
  }

  T front() {
    assert(p.length > 0);
    return p[0];
  }

  bool empty() {
    if (p.length == 0) return true;
    else return false;
  }
}

// pair(??´???, ??´??????????????????)
edge treeDiameter(edge[][] graph) {
  int s;
  pair d1, d2; // pair(distance, vertex)
  bool[] used = new bool[](n);

  d1 = dfs(graph, used, pair(0, s));
  used[] = false;
  d2 = dfs(graph, used, pair(0, d1.second));

  if (d1.second > d2.second) swap(d1.second, d2.second);

  return edge(d1.second, d2.second, d2.first);
}

// ?????????????????????????????????????????????????????????????????????????????¨???????????§????????¢?????????
pair dfs(edge[][] graph, bool[] used, pair p) {
  used[p.second] = true;

  pair ret = p;

  foreach(nv; graph[p.second]) {
    if (!used[nv.v]) {
      pair tmp = dfs(graph, used, pair(p.first + nv.cost, nv.v));
      if (ret.first < tmp.first) {
        ret = tmp;
      }
    }
  }

  return ret;
}


/***************************************************************************/

Measured memory_bytes: 30848
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    long long int ans = 0;
    ll tmp;
    ll n, d, a;
	cin >> n >> d >> a;
	priority_queue<pair <ll, ll > > mons; // x, h
	priority_queue<pair <ll, ll > > bomb; // ひだりはし、与ダメージ
	ll x, h;
	REP(i, n){
		cin >> x >> h;
		mons.push(make_pair(x,h));
	}
	ll nowa = 0;
	pair< ll, ll> nm;
	ll thro;
	REP(i, n){
		nm = mons.top();
		mons.pop();
		while(!bomb.empty() && nm.first < bomb.top().first ){
			nowa -= bomb.top().second;
			bomb.pop();
		}
		if(nm.second > nowa){
			thro = (nm.second - nowa + a - 1) / a;
			bomb.push(make_pair(nm.first - 2 * d, a * thro));
			nowa += a * thro;
			ans += thro;
			//cout << nm.first << " " << thro << endl;
		}  
	}
    cout << ans << endl;
}

Measured memory_bytes: 7788
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  double n,d;
  cin>>n>>d;
  vvl x(n,vl (d));
  rep(i,n){
    rep(j,d)cin>>x[i][j];
  }
  ll count=0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      double ans=0;
      for(int k=0;k<d;k++){
        ans+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      ans=sqrt(ans);
      ll ansll=ans;
      //cout<<ans<<" "<<ansll<<endl;
      if(ansll==ans)count++;
    }
  }
  cout<<count<<endl;
}

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

using namespace std;
double a[4000], dp[4000][4000];
int vis[4000][4000];
int j;
double rec(int n,int h)
{
	
	if(n==0 && 2*h >=j)
	return 1;
	
	else if(n==0)
	return 0;
	
	
	else
{

    if(vis[n][h]==-1)
    {

    vis[n][h]=1;	
	return dp[n][h]= a[n-1]*rec(n-1,h+1) +(1-a[n-1])*rec(n-1,h);
	
}
	else
	return dp[n][h];
	
	
}
	
	
	
	
}



int main()
{
	int t;
   t=1;
	while(t--)
	{
	
	cin>>j;
	memset(vis,-1,sizeof(vis));
	int i;
	
	for(i=0;i<j;i++)
	cin>>a[i];
	
	
//	cout<<"ddddddddd";
	
	double ans=rec(j,0);
	
	
	printf("%.10lf\n",ans);
	
	
	
	
	}



}


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

int cnt = 0;

void merge(int A[], int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
  int L[n1+1];
  int R[n2+1];
  for (int i = 0; i < n1; i++) {
    L[i] = A[left + i];
  }
  for (int i = 0; i < n2; i++) {
    R[i] = A[mid + i];
  }
  L[n1]=numeric_limits<int>::max();
  R[n2]=numeric_limits<int>::max();
  int i = 0, j = 0;
  for (int k = left; k < right;k++) {
    cnt++;
    if (L[i] <= R[j]) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[], int left, int right) {
  if (left+1 < right) {
    int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main() {
  int n;
  scanf("%d", &n);
  int S[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &S[i]);
  }
  mergeSort(S, 0, n);
  for (int i = 0; i < n; i++) {
    if (i) printf(" ");
    printf("%d", S[i]);
  }
  printf("\n");
  printf("%d\n", cnt);
  return 0;
}



Measured memory_bytes: 7116
<?php
function trade($dif,$a,$b){
    $na=sizeof($a);
    $nb=sizeof($b);

    $flag=-1;
    $val_a=INF;
    $val_b=INF;

    for($i=0;$i<$na;$i++){
        for($j=0;$j<$nb;$j++){
            if(($a[$i]-$b[$j])*2==$dif){
                $flag=1;
                if($val_a+$val_b > $a[$i]+$b[$j]){
                    $val_a=$a[$i];
                    $val_b=$b[$j];
                }
            }
        }
    }
    if($flag==1)
        echo $val_a." ".$val_b."\n";
    else
        echo "-1"."\n";
}

///

while(1){
    $n=0;
    $m=0;
    fscanf(STDIN,"%d %d\n",$n,$m);
    if($n==0 && $m==0){
        break;
    }

    $sum_a=0;
    $sum_b=0;

    $a=array();
    $b=array();
    for($i=0;$i<$n;$i++){
        fscanf(STDIN,"%d\n",$a[$i]);
        $sum_a+= $a[$i];
    }
    
    for($i=0;$i<$m;$i++){
        fscanf(STDIN,"%d\n",$b[$i]);    
        $sum_b+= $b[$i];
    }
    
    trade($sum_a - $sum_b,$a,$b);
}
?>

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

typedef long long ll;
typedef unsigned long long ull;

template<unsigned long long SIZE> class unionFind{
    protected:
        long long uni[SIZE];
        long long diff_weight[SIZE];
    public:
        unionFind(){
            for(int i=0;i<SIZE;i++){
                uni[i]=-1;
                diff_weight[i]=0;
            }
        }
        unsigned long long root(unsigned long long a){
            if(a>=SIZE) throw std::range_error("与えられたインデックスが木の範囲外です");
            if(uni[a]<0) return a;
            else{
                unsigned long long r=root(uni[a]);
                diff_weight[a]+=diff_weight[uni[a]];
                return uni[a]=r;
            }
        }
        long long weight(unsigned long long a){
            root(a);
            return diff_weight[a];
        }
        long long diff(unsigned long long a, unsigned long long b){
            if(isSame(a,b)) return weight(b)-weight(a);
            else return INT64_MAX;
        }
        unsigned long long count(unsigned long long a){
            return -uni[root(a)];
        }
        bool merge(unsigned long long a, unsigned long long b, long long w=1){
            w+=weight(a);  w-=weight(b);
            a=root(a);  b=root(b);
            if(a==b) return false;
            if(uni[a]>uni[b]){
                swap(a, b);
                w=(-w);
            }
            uni[a]+=uni[b];
            uni[b]=a;
            diff_weight[b]=w;
            return true;
        }
        bool isSame(unsigned long long a,unsigned long long b){
            return root(a)==root(b);
        }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    ll n, m;
    cin >> n >> m;
    
    stack<pair<int,int>> edge;

    for(int i=0;i<m;i++){
        int a, b;
        cin >> a >> b;
        edge.push({a, b});
    }

    stack<ll> ans;
    ll inc = n*(n-1)/2;
    unionFind<100001> uf;
    while(!edge.empty()){
        ans.push(inc);
        pair<int,int> e = edge.top();
        edge.pop();
        ll conn = uf.count(e.first)*uf.count(e.second);
        if(uf.merge(e.first, e.second)) inc -= conn;
    }
    assert(uf.count(1)==n);

    while(!ans.empty()){
        cout << ans.top() << endl;
        ans.pop();
    }
    
    return 0;
}

Measured memory_bytes: 3712
#include <algorithm>
#include <climits>
#include <cmath>
#include<set>
#include <unordered_map>
#include <deque>
#include <iostream>
#include <string>
#include <vector>
//#define dbg
#define p std::pair
#define vec std::vector
#define umap std::unordered_map
#define mp std::make_pair
#define all(cont) (cont).begin(), (cont).end()
#define ll long long
#define pi (acos(-1))
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);

int main()
{
    int n, k;
    cin >> n >> k;
    umap<int,int> m;
    int tmp;
    rep(i, n)
    {

        cin >> tmp;
	if(m.find(tmp)!=m.end()){
		++m.at(tmp);
	}else{
		m.insert(mp(tmp,1));
	}
    }vec<p<int,int>> v;
    for(const auto c:m){
v.push_back(move(c));
    }
    sort(all(v),[](p<int,int> l,p<int,int>r){return l.second>r.second;});
#ifdef dbg
    rep(i,v.size()){
	    cout<<'v'<<v[i].first<<' '<<v[i].second<<endl;
    }
#endif
    ll ans=0;
    if(v.size()<=k){
	    cout<<0<<endl;return 0;
    }
    while(v.size()!=k){
	    ans+=v[v.size()-1].second;
	    v.pop_back();
	    //v.shrink_to_fit();
    }
    cout<<ans<<endl;
    return 0;
}

ll extgcd(ll a, ll b, ll& x, ll& y)
{
    if (b == 0) {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) {
        is_prime[i] = true;
    }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++) {
        if (is_prime[i]) {
            for (unsigned ll j = 2 * i; j <= N; j += i) {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}


Measured memory_bytes: 14472
#include <bits/stdc++.h>
using namespace std;
int m, n;
const int N = 200;
int ai[N], c;
int main()
{
    cin >> m >> n;
    if (n == 1)
    {
        int a;
        cin >> a;
        if (a == 1) cout << 1 << endl << 1 << endl << 1 << endl;
        else cout << a << endl << 2 << endl << a - 1 << " " << 1 << endl;
        return 0;
    }
    for (int i = 1; i <= n; ++ i)
        cin >> ai[i], c += ai[i] & 1;
    if (c > 2)
    {
        cout << "Impossible\n";
        return 0;
    }
    int A = 1, B = 2;
    for (int i = 3; i <= n; ++ i)
        if (ai[i] & 1)
        {
            A = i;
            for (int j = i + 1; j <= n; ++ j)
                if (ai[j] & 1)
                {
                    B = j;
                    goto GG;
                }
            goto GG;
        }
    GG:
    cout << ai[A] << " ";
    for (int i = 1; i <= n; ++ i) if (i != A && i != B) cout << ai[i] << " ";
    cout << ai[B] << endl;
    if (ai[A] == 1) cout << n - 1 << endl;
    else  cout << n << endl << ai[A] - 1 << " ";
    for (int i = 1; i <= n; ++ i) if (i != A && i != B) cout << ai[i] << " ";
    cout << ai[B] + 1 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<iomanip>
 
#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)
 
int main(){
	int a[4], b[4];
	while(1){
		int hit = 0, blow = 0;
		for(int i = 0; i < 4; i++){
			if(!(cin >> a[i])){
				return 0;
			}
		}
		for(int i = 0; i < 4; i++){
			if(!(cin >> b[i])){
				return 0;
			}
		}

		for(int i = 0; i < 4; i++){
			if(a[i] == b[i]){
				hit++;
			}
			for(int j = 0; j < 4; j++){
				if(a[i] == b[j]){
					blow++;
				}
			}
		}
		blow -= hit;

		cout << hit << ' ' << blow << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

LL n;

inline int alpha(LL n) {
    int ans = 0;
    for (LL i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            LL n0 = n;
            while (n0 % i == 0) {
                n0 /= i;
            }
            if ((n0 - 1) % i == 0) {
                ++ans;
            }
        }
    }
    ++ans; // n
    return ans;
}

inline int beta(LL n) {
    int ans = 0;
    for (LL i = 2; i * i <= n - 1; ++i) {
        if ((n - 1) % i == 0) {
            ++ans;
            if (i * i != n - 1) {
                ++ans;
            }
        }
    }
    if (n != 2) {
        ++ans; // n - 1
    }
    return ans;
}

inline void work() {
    cin >> n;
    cout << alpha(n) + beta(n) << "\n";
}

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    work();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N ;
  int a=int(N/1000);
  int b=int(N/100)-a*10;
  int c=int(N/10)-a*100-b*10;
  int d=N-a*1000-b*100-c*10;
  if (((a==b) && (b==c)) || ((b==c) && (c==d)) ){
   cout << "Yes" ;
  }
  else{
    cout << "No";
  }
}

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

#define pb push_back
#define mk make_pair
#define lob lower_bound
#define upb upper_bound
#define fst first
#define scd second

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

namespace Fread{
	const int MAXN=1<<20;
	char buf[MAXN],*S,*T;
	inline char getchar(){
		if(S==T){
			T=(S=buf)+fread(buf,1,MAXN,stdin);
			if(S==T)return EOF;
		}
		return *S++;
	}
}
#ifdef ONLINE_JUDGE
	#define getchar Fread::getchar
#endif
inline int read(){
	int f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
inline ll readll(){
	ll f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
/*  ------  by:duyi  ------  */ // dysyn1314
const int MAXN=50,MOD=1e9+7;
inline int mod1(int x){return x<MOD?x:x-MOD;}
inline void add(int &x,int y){x=mod1(x+y);}
int n,dp[MAXN+5][MAXN+5],c[MAXN+5][MAXN+5];
int main() {
	c[0][0]=1;
	for(int i=1;i<=MAXN;++i){
		c[i][0]=1;
		for(int j=1;j<=i;++j)c[i][j]=mod1(c[i-1][j]+c[i-1][j-1]);
	}
	n=read();
	//dp[0][0]=1;
	dp[1][0]=dp[1][1]=n;
	for(int i=1;i<n;++i){
		for(int j=0;j<=i;++j)if(dp[i][j]){
			for(int k=max(j,1);i+k<=n;++k){
				if((j&1)^(k&1))continue;
				for(int x=0;x<=k;++x){
					add(dp[i+k][abs(x-(k-j)/2)],(ll)dp[i][j]*c[n-i][k]%MOD*c[k][x]%MOD);
				}
			}
		}
	}
	cout<<dp[n][0]<<endl;
	return 0;
}

Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,
        mut a:[usize;n],
    }
    a.reverse();
    println!("{}", lis(&a));
}
pub trait BinarySearch<T> {
    fn lower_bound_by<F: Fn(&T) -> bool>(&self, f: F) -> usize;
    fn lower_bound(&self, x: &T) -> usize;
    fn upper_bound(&self, x: &T) -> usize;
}
impl<T: Ord> BinarySearch<T> for [T] {
    fn lower_bound_by<F: Fn(&T) -> bool>(&self, f: F) -> usize {
        let mut ng = -1;
        let mut ok = self.len() as i64;
        while (ok as i32 - ng as i32).abs() > 1 {
            let mid = (ok + ng) / 2;
            if f(&self[mid as usize]) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        ok as usize
    }
    fn lower_bound(&self, x: &T) -> usize {
        self.lower_bound_by(|y| y >= x)
    }
    fn upper_bound(&self, x: &T) -> usize {
        self.lower_bound_by(|y| y > x)
    }
}
#[derive(PartialEq, Eq, Clone, Debug)]
enum Inf<T> {
    Val(T),
    Inf,
}
impl<T: Ord> Inf<T> {
    #[allow(dead_code)]
    fn val(self) -> Option<T> {
        match self {
            Inf::Val(v) => Some(v),
            _ => None,
        }
    }
}
impl<T: PartialOrd> PartialOrd for Inf<T> {
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        match (self, other) {
            (&Inf::Inf, &Inf::Inf) => Some(Ordering::Equal),
            (&Inf::Inf, &Inf::Val(_)) => Some(Ordering::Greater),
            (&Inf::Val(_), &Inf::Inf) => Some(Ordering::Less),
            (&Inf::Val(ref a), &Inf::Val(ref b)) => a.partial_cmp(b),
        }
    }
}
impl<T: Ord> Ord for Inf<T> {
    fn cmp(&self, other: &Self) -> Ordering {
        match (self, other) {
            (&Inf::Inf, &Inf::Inf) => Ordering::Equal,
            (&Inf::Inf, &Inf::Val(_)) => Ordering::Greater,
            (&Inf::Val(_), &Inf::Inf) => Ordering::Less,
            (&Inf::Val(ref a), &Inf::Val(ref b)) => a.cmp(b),
        }
    }
}
/// Calculate length of Longest Increasing Subsequence. O(N log N)
pub fn lis<T: Ord>(seq: &[T]) -> usize {
    let mut dp: Vec<Inf<&T>> = vec![Inf::Inf; seq.len() + 1];
    for x in seq.iter() {
        let i = dp.upper_bound(&Inf::Val(x));
        dp[i] = Inf::Val(x);
    }
    dp.lower_bound(&Inf::Inf)
}


Measured memory_bytes: 4540
n, m = map(int, input().split())
s = []
N = [0 for i in range(n)]
for i in range(m):
    a,b = map(int, input().split())
    s.append([a,b])
    N[a-1] += 1
    N[b-1] += 1
for j in range(n):
    print(N[j])

Measured memory_bytes: 9100
// Last Change: 12/29/2018 23:21:03.
//
// XとYの先頭に空白を入れることで、探索するべき要素のindexを0~m-1ではなく
// 1~mにしている。これにより、一番最初のcの更新において、i=j=0におけるc[i-1][j-1]
//すなわちc[-1][-1]にアクセスしてしまうことを防いでいる。
//
//***********************************************************************
//下から順番に計算していく方法
//
//***********************************************************************

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define MAXLENGTH 1001

int LCS(string, string);

int LCS(string X, string Y) {
  static int c[MAXLENGTH][MAXLENGTH];
  for (int i = 0; i < MAXLENGTH; i++) {
    c[i][0] = c[0][i] = 0;
  }
  int m, n, maxL;
  m = X.size();
  n = Y.size();
  maxL = 0;
  X = ' ' + X;
  Y = ' ' + Y;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      if (X[i] == Y[j]) {
        c[i][j] = c[i - 1][j - 1] + 1;
      } else {
        c[i][j] = max(c[i - 1][j], c[i][j - 1]);
      }
      maxL = max(maxL, c[i][j]);
    }
  }
  return maxL;
}

int main() {
  int q;
  cin >> q;
  string X, Y;
  for (int i = 0; i < q; i++) {
    cin >> X >> Y;
    cout << LCS(X, Y) << endl;
  }
}



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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	for(int n,m;cin>>n>>m && n|m;){
		vi xs(m),ys(m);
		rep(i,m) cin>>xs[i]>>ys[i],xs[i]--,ys[i]--;

		vi cs(n,1),ps(n); ps[0]=1;
		rep(i,m){
			int x=xs[i],y=ys[i];
			cs[y]++;
			if(ps[x]==1) ps[y]=1;
			cs[x]--;
			if(cs[x]==0) ps[x]=0;
		}
		cout<<count(all(ps),1)<<endl;
	}
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(void){
int a,b;
 
scanf("%d",&a);

if(a<105)
printf("0\n");
else if(105<=a&&a<135)
printf("1\n");
else if(135<=a&&a<165)
printf("2\n");
else if(165<=a&&a<189)
printf("3\n");
else if(189<=a&&a<195)
printf("4\n");
else if(195<=a)
printf("5\n");

return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int s,a=0;
set<int> st;
int n;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		st.insert(s);
		
	}
	a=st.size();
	if(a==n) cout<<"YES";
	else cout<<"NO"; 
	
	
	return 0;
}

Measured memory_bytes: 9600
/*      ex3_4
        Tarara  */
#include <stdio.h>

int canFactorize(int number);

int main(void)
{
    int number; //整数
    scanf("%d", &number);
    if (canFactorize(number))
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

// 九九で表現できることを判定する関数
// numberが九九で表現できるならば1、そうでないなら0を返す
int canFactorize(int number)
{
    for (int i = 1; i < 10; ++i)
    {
        if (number % i == 0 && number / i < 10)
            return 1;
    }
    return 0;
}

Measured memory_bytes: 128
object Main extends App {
    val in = io.Source.stdin.getLines.map(_.trim.split(" ").map(_.toInt))
    val n = in.next.head
    val t = (0 to n-1).toArray
    val d = in.toSeq
    lazy val es = (for (i <- (0 to n-2); j <- (i+1 to n-1) if d(i)(j) != -1) yield (i, j, d(i)(j))).sortBy(_._3)
    var cost = 0

    def find(m: Int): Int = if(t(m) == m) m else {t(m) = find(t(m)); t(m)}
 
    def unite(x: Int, y: Int) = {
        val _x = find(x)
        val _y = find(y)
        if(_x != _y) t(_x) = _y
    }
 
    es.foreach(e => if (find(e._1) != find(e._2)) {unite(e._1, e._2); cost += e._3})
    println(cost)
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;

LL scoring(int D, vector<vector<LL>> s, vector<int> schedule, vector<LL> c) {
    vector<int> last(26, 0);
    LL score = 0;
    FOR(i, 1, D + 1) {
        LL satisfaction = s[i][schedule[i]];
        last[schedule[i]] = i;
        REP(k, 26) {
            satisfaction -= (i - last[k])*c[k];
        }
        score += satisfaction;
    }
    return score;
}

int main() {
    int D;
    cin >> D;
    vector<LL> c(26);
    vector<vector<LL>> s(D + 1, vector<LL>(26, 0));
    REP(i, 26) {
        cin >> c[i];
    }
    FOR(i, 1, D + 1) {
        REP(j, 26) {
            cin >> s[i][j];
        }
    }
    vector<int> schedule(D + 1, 0);
    FOR(i, 1, D + 1) {
        cin >> schedule[i];
        schedule[i]--;
    }
    vector<int> last(26, 0);

    LL score = 0;
    FOR(i, 1, D + 1) {
        LL score = scoring(i, s, schedule, c);
        cout << score << endl;
    }
    return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;
ll const MOD = 1000000007;




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

int X;
cin >> X;

vi Z = {};


for(int p = 2;p <= 9;p++) {
    for(int b = 1; pow(b,p) <= 1000;b++) {
            Z.push_back(pow(b,p));
    }
}

int ans = 1;

rep(i,Z.size()) {
    if(Z[i] <= X) ans = max(ans,Z[i]);
}

cout << ans << endl;



return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define MOD 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 200009
#define M 1e6+9
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
#define int long long
using namespace std;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};  
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}
ll lcm(ll a, ll b) { return (a*b)/ gcd(a,b);}

// ll n,k,a,b,c,d,x,y,z,m,l;
// ll ans;
// vecl arr(N);
// ll dp[509][509];
// ll pre[N];



void test_case() {
	
   
   int n , m;
   cin>>n >>m;

   if(n==m) {
       yes;
   } else {
       no;
   }

   


    



}


signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(20);

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);


    int t = 1;
    // cin >> t;
    while(t--)
    {   
        test_case();
    }
}

Measured memory_bytes: 3584
N = int(input())
S = input()

from collections import defaultdict
wc = defaultdict(int)
ec = defaultdict(int)

if S[0] == 'W':
    wc[0] = 1
for i in range(1, N):
    wc[i] = wc[i-1]
    if S[i] == 'W':
        wc[i] += 1

if S[N-1] == 'E':
    ec[N-1] = 1
for i in range(N-2, -1, -1):
    ec[i] = ec[i+1]
    if S[i] == 'E':
        ec[i] += 1

min_ = N
for i in range(1, N-1):
    v = wc[i-1] + ec[i+1]
    if v < min_:
        min_ = v
v0 = ec[1]
if v0 < min_:
    min_ = v0
vn = wc[N-1]
if vn < min_:
    min_ = vn
print(min_)


Measured memory_bytes: 65116
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n<=111)cout<<111<<endl;
	else if(n>111&&n<=222)cout<<222<<endl;
	else if(n>222&&n<=333)cout<<333<<endl;
	else if(n>333&&n<=444)cout<<444<<endl;
	else if(n>444&&n<=555)cout<<555<<endl;
	else if(n>555&&n<=666)cout<<666<<endl;
	else if(n>666&&n<=777)cout<<777<<endl;
	else if(n>777&&n<=888)cout<<888<<endl;
	else if(n>888&&n<=999)cout<<999<<endl;
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;
ll mod = 1e9+7;

int main(){
 ll n,m,kk;
 cin>>n>>m>>kk;
 vector<vector<ll> > dp(32, vector<ll>(n,0) );
 dp[0][0]++;
 for(ll i=0;i<m;i++){
  ll tmp;
  cin>>tmp;
  //tmp--;
  dp[0][tmp%n]++;
 }
 for(ll i=1;i<32;i++){
  for(ll j=0;j<n;j++){
   for(ll k=0;k<n;k++){
    dp[i][(j+k)%n] += (dp[i-1][j]*dp[i-1][k])%mod;
    dp[i][(j+k)%n] %= mod;
   }
  }
 }

 vector<ll> ans(n,0);
 ans[0] = 1;
 
 for(ll i=0;i<32;i++){
  if( (kk>>i)&1 ){
   vector<ll> tmp(n,0);
   for(ll j=0;j<n;j++){
    for(ll k=0;k<n;k++){
     tmp[(j+k)%n] += (ans[j]*dp[i][k])%mod;
     tmp[(j+k)%n] %= mod;
    }
   }
   ans = tmp;
  }
 }

 for(auto i:ans)cout<<i<<endl;


    return 0;
}



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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
	int n;
	cin >> n;
	if(n==0)
		puts("1");
	else if(n==1)
		puts("2");
	else if(n==2)
		puts("1");
	else
		puts("0");
	return 0;
}

Measured memory_bytes: 1112
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define int long long
#define st first
#define nd second
#define rd third
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define RE(i, n) FOR(i, 1, n)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, n) for(int i = 0;i <(n); ++i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
template<typename TH> void _dbg(const char* sdbg, TH h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t) {
  while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
#define next ____next
#define prev ____prev
#define left ____left
#define hash ____hash
typedef long long ll;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<pair<int, int> > VPII;
typedef vector<pair<ll, ll> > VPLL;

template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
template<class T1, class T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class A, class B, class C> struct Triple { A first; B second; C third;
  bool operator<(const Triple& t) const { if (st != t.st) return st < t.st; if (nd != t.nd) return nd < t.nd; return rd < t.rd; } };
template<class T> void ResizeVec(T&, vector<int>) {}
template<class T> void ResizeVec(vector<T>& vec, vector<int> sz) {
  vec.resize(sz[0]); sz.erase(sz.begin()); if (sz.empty()) { return; }
  for (T& v : vec) { ResizeVec(v, sz); }
}
typedef Triple<int, int, int> TIII;
template<class A, class B, class C>
ostream& operator<< (ostream &out, Triple<A, B, C> t) { return out << "(" << t.st << ", " << t.nd << ", " << t.rd << ")"; }
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }

    
int32_t main() {

  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cerr << fixed << setprecision(10);
  cin.tie(0);
  //double beg_clock = 1.0 * clock() / CLOCKS_PER_SEC;
  
  string s;
  cin>>s;
  if (s.find("AC") != string::npos) {
    cout<<"Yes\n";
  } else {
    cout<<"No\n";
  }
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  return 0;
}


Measured memory_bytes: 256
import itertools

N=int(input())
L=list(map(int, input().split()))

if N>2:
	
	NC=list(itertools.combinations([i for i in range(0,N)],3))
	memo=[]
	memo_=[]
	ans=0
	
	for nc in NC:
		a=L[nc[0]]
		b=L[nc[1]]
		c=L[nc[2]]
		if a!=b and b!=c and c!=a and a+b>c and a+c>b and b+c>a:
			memo.append([L[nc[0]],L[nc[1]],L[nc[2]]])
	
	print(len(memo))

else:
	print(0)

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	ll n, a, b;
	cin >> n >> a >> b;

	vector<int> h;
	ll ma = 0;
	for(int i=0; i<n; i++){
		ll t;
		cin >> t;
		h.pb(t);
		ma = max(ma, t);
	}
	sort(h.begin(), h.end(), greater<int>());

	int l = 1;
	int r = ma/b+1;
	int m;
	while(l <= r){
		m = (l + r)/2;
		ll cnt = 0;
		for(int j=0; j<n; j++){
			ll h2 = h[j] - m*b;
			if(h2 > 0){
				cnt += (h2 + (a-b-1)) / (a - b);
			}
		}
		if(cnt > m){
			l = m+1;
		}else if(cnt < m){
			r = m-1;

			cnt = 0;
			m = m - 1;
			for(int j=0; j<n; j++){
				ll h2 = h[j] - m*b;
				if(h2 > 0){
					cnt += (h2 + (a-b-1)) / (a - b);
				}
			}
			if(cnt > m){
				m = m + 1;
				break;
			}
		}else{
			cnt = 0;
			m = m - 1;
			for(int j=0; j<n; j++){
				ll h2 = h[j] - m*b;
				if(h2 > 0){
					cnt += (h2 + (a-b-1)) / (a - b);
				}
			}
			if(cnt > m){
				m = m + 1;
				break;
			}

			r = m-1;
		}
	}
	cout << m << endl;

	return 0;
}


Measured memory_bytes: 892
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>
#include <string>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <ctime> 
using namespace std;

#define pb push_back
#define All(a) a.begin(), a.end()
#define met(a, b) memset(a, b, sizeof(a))
#define rep1(i, l, r) for(int i = l; i <= r; ++i)
#define rep2(i, l, r) for(int i = l; i < r; ++i) 
#define per(i, r, l) for(int i = r; i >= l; --i)
typedef long long ll;
typedef double db;
typedef long double ldb;
const int NIL = -1;
const int oo = 0x3f3f3f3f;
const ll INF = 2e18;
const db eps = 1e-8;
const db PI = acos(-1.0);
const int maxn = 1e5 + 7; 

char s[maxn];
int cnt = 1;

inline int read(void)
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9')	{ if(ch == '-') f = -1; ch = getchar(); } 
	while(ch >= '0' && ch <= '9') {	x = (x << 1) + (x << 3) + ch - '0';	ch = getchar();	}
	return x * f;
}

inline void write(int x)
{
	if(x < 0) { putchar('-'); x = -x; }
    if(x >= 10) write(x/10); 
	putchar(x%10+'0'); 
}

void build(int x, int idx)
{
	if(idx == 0) return;
	while(s[idx] == '0')
	{
		printf("%d %d\n", x, ++cnt);
		idx--;
	}
	printf("%d %d\n", x, ++cnt);
	build(cnt, idx-1);
}

int main(void)
{
	s[0] = '0';
	scanf("%s", s+1);
	int n = strlen(s) - 1;
	if(s[1] != '1' || s[n-1] != '1')
	{
		printf("-1");
		return 0;
	}
	rep1(i, 0, n/2)
	{
		if(s[i] != s[n-i])
		{
			printf("-1");
			return 0;
		}
	}
	build(1, n-1);
	
	return 0;
} 

Measured memory_bytes: 1536
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		solveA(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		int[] x = nextInts();
		boolean[] flg = new boolean[6];
		Arrays.fill(flg,true);
		for(int i=0;i<5;i++) {
			flg[x[i]]=false;
		}
		for(int i=1;i<6;i++) {
			if(flg[i]) {
				pw.println(i);
				return;
			}
		}
	}
	public static void solveB(String[] args) throws Exception{

	}
	public static void solveC(String[] args) throws Exception{

	}
	public static void solveD(String[] args) throws Exception{

	}
	public static void solveE(String[] args) throws Exception{

	}

	public static TreeMap<Long, Long> primeFactorize(long N) {
		TreeMap<Long, Long> map = new TreeMap<>();
		for (long i = 2; i * i <= N; i++) {
			long k = 0;
			while (N % i == 0) {
				k++;
				N /= i;
			}
			map.put(i, k);
		}
		map.put(N, 1L);
		return map;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 25456
#include<iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int h, w;
    cin >> h >> w;
    int cnt = 0;
    while (n--) {
        int a, b;
        cin >> a >> b;
        if (a >= h && b >= w) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

using namespace std;


int main()
{
    char a;
    cin >> a;
    if ((int)a < 97)
        cout << 'A' << endl;
    else
    {
        cout << 'a' << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3624
// failed to generate code

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

int a[100010];

long long sm[100011];

long long dp[101][100010];

int main(){
    ios::sync_with_stdio(false);

    int N, K;
    cin >> N >> K;
    for(int i = 0 ; i < N ; i++) cin >> a[i];

    dp[0][0] = 1;

    for(int i = 0 ; i < N ; i++){
        memset(sm, 0, sizeof(sm));
        for(int j = 0 ; j < 100010 ; j++)
            sm[j+1] += sm[j] + dp[i][j];

        auto f = [&](int a, int b){
            a = max(0, a);
            return sm[b] - sm[a];
        };

        for(int j = 0 ; j < 100010 ; j++){
            dp[i+1][j] += f(j - a[i], j + 1);
            dp[i+1][j] %= 1000000007;
//            for(int k = 0 ; k <= a[i] ; k++){
//                if( j >= k ) dp[i+1][j] += dp[i][j - k];
//            }
        }
    }
    cout << dp[N][K] << endl;
}


Measured memory_bytes: 79360
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define SORT(v, n) sort(v, v+n)
#define VREV(v,n) reverse(v,v+n)
#define REV(v,n) reverse(v,v+n)
#define vi vector<int>
#define pf push_front
#define pb push_back

template<class T, size_t N> size_t countof(const T (&array)[N]) { return N; }
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<"\n";}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}

void mprint(auto *matrix,auto N){
	REP(i,N) cout<<matrix<<(i!=N-1?' ':'\n');
	return;
}

const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

#define P pair<int,int>
#define Pll pair<ll,ll>
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

inline int in(){int x; cin>>x; return x;}

struct UnionFind{
	vector<int> par; //データiが属する親の番号
	vector<int> sizes; //根ノードiの木に含まれるデータの数

	// 最初は全てのデータiがグループiに存在するものとして初期化
	UnionFind(int n):par(n),sizes(n, 1){
		REP(i,n) par[i] = i;
	}

	// 根を張り替えながら再帰的に根ノードを探す
	int find(int x){
		if(x==par[x]) return x;
		return par[x]=find(par[x]);
	}

	// 2つのデータx, yが属する木をマージする
	void unite(int x, int y) {
		// データの根ノードを得る
		x = find(x);
		y = find(y);

		// 既に同じ木に属しているならマージしない
		if (x == y) return;

		// xの木がyの木より大きくなるようにする
		if (sizes[x] < sizes[y]) swap(x, y);

		// xがyの親になるように連結する
		par[y] = x;
		sizes[x] += sizes[y];
		sizes[y] = 0;  // sizes[y]は無意味な値となるため
	}

	// 2つのデータx, yが属する木が同じならtrueを返す
	bool same(int x, int y) {
		return find(x) == find(y);
	}

	// データxが含まれる木の大きさを返す
	int size(int x) {
		return sizes[find(x)];
	}
};
int gcd(int n,int m){
	if(m>n) return gcd(m,n);
	if(m==0) return n;
	else return gcd(m,n%m); 
}

int main(void){
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	print(a-1+(a<=b));
}


Measured memory_bytes: 256
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

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

#define io ios_base::sync_with_stdio(false)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
#define mod 1000000007
#define pii pair<int, int>
#define PI 2*acos(0.0)
#define forn(i, n) for(int i = 0; i < n; i++)


int main()
{
    io;
    int n;
    cin>>n;
    ll inp[n];
    bool z = 0;
    forn(i, n)
    {
        cin>>inp[i];
        if(!inp[i])
            z = 1;
    }
    if(z)
        return cout<< "0", 0;
    ll ans = 1;
    forn(i, n)
    {
        if(inp[i] <= (ll)1e18/ans)
            ans *= inp[i];
        else
        {
            ans = -1;
            break;
        }
    }
    cout<< ans;
    return 0;
}


Measured memory_bytes: 4452
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <functional>

using namespace std; using ll=long long; using ld=long double; using P=pair<ll,ll>; const int INF=1e9; const ll LINF=1e18;
template<typename T> void caut(T a, T b, T c){cout<<"("<<a<<","<<b<<","<<c<<") ";}
template<typename T> void caut(T a, T b){cout<<"("<<a<<","<<b<<") ";}
template<typename T> void caut(T a){cout<<"("<<a<<") ";}

int main(){
  int n; cin>>n;
  int an=n+1;
  an-=2;
  if (n%2==0) an--;
  cout<<an/2<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid
/// ye tec khaphan ke yadam bemone : age jayi didi soale masir hamiltoni mikhad rasasho bokon yal oilery;https://mobomovie1.top/series/%D8%AF%D8%A7%D9%86%D9%84%D9%88%D8%AF-%D8%B3%D8%B1%DB%8C%D8%A7%D9%84-%D9%81%D8%B1%DB%8C%D9%86%D8%AC-fringe-2008-2013-%D8%A8%D8%A7-%D8%B2%D9%8A%D8%B1%D9%86%D9%88%D9%8A%D8%B3-%D9%81%D8%A7%D8%B1/
/// age ye ja mikhasti to dp az ozv i k ta entekhab koni bejash ye log bezan (nominal) hamoon 2**k va o 1 ent kon
const int N=302;
ll dp[N][N][N];
ll par[N][N][2];
int32_t main(){
    string s;
    cin >> s;
    ll k;
    cin >> k;
    ll n=s.size();
    for (int i=0;i<n;i++){
        for (int j=0;j<N;j++){
            dp[i][i+1][j]=1;
        }
    }
    for (int i=0;i<n;i++){
        for (int j=i+2;j<=n;j++){
            for (int l=i;l<j;l++){
                if (s[l]==s[j-1]){
                    par[i][j][1]=l;
                    break;
                }

            }
            for (int l=j-1;l>=i;l--){
                if (s[l]==s[i]){
                    par[i][j][0]=l;
                    break;
                }
            }
        }
    }
    for (int i=n-1;i>-1;i--){
        for (int j=i+2;j<=n;j++){
            for (int l=0;l<=k;l++){
                dp[i][j][l]=max(dp[i+1][j][l],dp[i][j-1][l]);
                if (l>0){
                    dp[i][j][l]=max(dp[i][j][l],2+dp[i+1][j-1][l-1]);
                }
                ll p=par[i][j][0];
                if (p!=i){
                    dp[i][j][l]=max(dp[i][j][l],2+dp[i+1][p][l]);
                }
                p=par[i][j][1];
                if (p!=j-1){
                    dp[i][j][l]=max(dp[i][j][l],2+dp[p+1][j-1][l]);
                }
                //cout << i << " " << j << " " << l << " " << dp[i][j][l]  << endl;


            }

        }
    }
    //cout << 3 << endl;
    cout << dp[0][n][k] << endl;
}


Measured memory_bytes: 215296
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

prev = -2
ans = 0
for a in A:
    if a == prev+1:
        ans += C[prev-1]
    ans += B[a-1]
    prev = a
print(ans)

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

int main(){
  int X;
  cin >> X;
  
  int A, B;
  
  for(int i = -120; i < 120; i++){
    for(int j = -120; j < 120; j++){
      if(i*i*i*i*i - j*j*j*j*j == X){
        A = i;
        B = j;
      }
    }
  }
  
  cout << A << " " << B << endl;
  
  return 0;
  
}

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

using namespace std;

#define REP(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;

int sumDigits(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    int sum_result = 0;
    for (int i = 1; i < N + 1; i++) {
        int x = sumDigits(i);
        if (A <= x && x <= B) {
            sum_result += i;
        }
    }
    cout << sum_result << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
void search(char *p, char *t)
{
  int i;
  int M = strlen(p);
  int N = strlen(t);
  
  for (i = 0; i <= N - M; i++)
    {
      int j;
  
      for (j = 0; j < M; j++)
	if (t[i+j] != p[j])
	  break;
 
      if (j == M)  
	printf("%d\n", i);
    }
}
  
int main()
{
  char t[1001];
  char p[1001];
  scanf("%s%s",t,p);
  search(p,t);
  return 0;
}

Measured memory_bytes: 548
import sys

input = sys.stdin.readline


def main():
    X, Y = list(map(int, input().split(" ")))

    if Y % 2 == 1:
        print("No")
        exit(0)

    if (Y - 2 * X) / 2 >= 0 and (4 * X - Y) / 2 >= 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 61692
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const int vx[]={1,0,-1,0}, vy[]={0,1,0,-1};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

ll s = 0, a[100010], d[100010];

int main(){
	ll n; cin >> n;
	REP(i,0,n) cin >> a[i], s += a[i];
	if(s % (n * (n + 1) / 2)){cout << "NO" << endl; return 0;}
	
	ll k = s / (n * (n + 1) / 2);
	REP(i,0,n) d[i] = a[i] - a[(i + 1) % n];
	
	ll c = 0;
	REP(i,0,n){
		d[i] += k;
		if(d[i] % n or d[i] < 0){cout << "NO" << endl; return 0;}
		c += d[i] / n;
	}
	
	cout << (c == k ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 1792