akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

class Main
{
   public static void main(String[] args) throws IOException
   {
      BufferedReader br=
       new BufferedReader(new InputStreamReader(System.in));

      String str1 =br.readLine();
      String str2[] =str1.split(" ");
      int a = Integer.parseInt(str2[0]);
      int b = Integer.parseInt(str2[1]);
      int c = a*b;
      int d = 2*(a+b);
      System.out.println(c+" "+d);
   }
}

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

int main(){
    int n;
    cin >> n;
    vector<int> prime = {2};
    set<int> ps = {2};
    for (int i = 3; i <= n;){
        int cnt = 0;
        for (int j = 3; j <= i;){
            if (i%j == 0) cnt ++;
            if (cnt > 1) break;
            j += 2;
        }
        // printf("i: %d\n", i);
        if (cnt == 1){
            prime.push_back(i);
            ps.insert(i);
        }
        i += 2;
    }
    if (n%2 == 0 && n > 2) n++;
    while (true){
        bool flag = 1;
        for (auto p:prime){
            if (n%p == 0){
                flag = 0;
                break;
            }
        }
        if (ps.count(n) == 1) flag = 1;
        if (flag == 1){
            cout << n << endl;
            break;
        }
        n += 2;
    }
    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll p=1000000007ll;
const int N=100005;
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
int a[N];char s[N];
int main(){
	int n,i,j,k;
	scanf("%s",s+1);
	n=strlen(s+1);
	for(i=1,j=1;i<=n;i=j){
		while(j<=n&&s[i]==s[j])++j;
		if(s[i]=='L'){
			for(k=i;k<j;++k){
				if((k^i)&1)++a[i-1];else ++a[i];
			}
		}else{
			for(k=i;k<j;++k){
				if((k^j)&1)++a[j-1];else ++a[j];
			}
		}
	}
	for(i=1;i<=n;++i)printf("%d ",a[i]);
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
string a;
int t,choose,f;
char c;
int main() 
{
    cin >> a;
    scanf("%d",&t);
    int ans = 1;
    while(t --) {
        scanf("%d",&choose);
        if(choose == 1) {
            ans ++;
        } else {
            scanf("%d",&f);
            getchar();
            scanf("%c",&c);
            if(ans % 2 == 1) {
                if(f == 1) {
                    a.insert(a.begin(),c);
                } else {
                    a.insert(a.end(),c);
                }
            } else {
                if(f != 1) {
                    a.insert(a.begin(),c);
                } else {
                    a.insert(a.end(),c);
                }
            }
        }
    }
    int len=a.length();
	if(ans % 2 == 1)
        for(int i = 0; i < len; i ++) {
            printf("%c",a[i]);
        }
    else {
        reverse(a.begin(),a.end());
        for(int i = 0; i < len; i ++) {
            printf("%c",a[i]);
        }
    }
    return 0;
}

Measured memory_bytes: 900
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var alphabet = "abcdefghijklmnopqrstuvwxyz";
            var d = new int[26];
            for(var i = 0; i < 26; i++){
                d[i] = int.MaxValue;
            }

            var n = int.Parse(Console.ReadLine());
            for(var i = 0; i < n; i++){
                var s = Console.ReadLine().ToCharArray();
                for(var j = 0; j < 26; j++){
                    var k = s.Count(t => t == alphabet.ElementAt(j));
                    d[j] = Math.Min(d[j], k);
                }
            }
            
            var ans = new StringBuilder();
            for(var i = 0; i < 26; i++){
                ans.Append(new string(alphabet[i], d[i]));
            }

            Console.WriteLine(ans.ToString());
        }
    }
}


Measured memory_bytes: 15316
#include<bits/stdc++.h>
#define llong long long
#define mkpr make_pair
#define x first
#define y second
#define iter iterator
#define riter reversed_iterator
#define y1 Lorem_ipsum_
#define tm dolor_sit_amet_
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int mxN = 1e5;
const llong INF = 1e18;
int n;
llong a[mxN+3],b[mxN+3],c[mxN+3];

int main()
{
	scanf("%d",&n); for(int i=0; i<=n; i++) scanf("%lld",&a[i]);
	bool ok = true; llong ans = 0ll;
	b[0] = 1ll; if(n==0&&a[0]!=1) {puts("-1"); return 0;}
	for(int i=1; i<=n; i++)
	{
		b[i] = (b[i-1]-a[i-1])*2ll;
		if(b[i]<max(1ll,a[i])) {puts("-1"); return 0;}
		b[i] = min(b[i],INF);
	}
	for(int i=n; i>=0; i--)
	{
		c[i] = a[i]+c[i+1];
		c[i] = min(c[i],b[i]);
		ans += c[i];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 6064
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define ANS 1000000007

int N;

void dfs(vector<vector<int> >& V, vector<vector<long long int> >& dp, int par, int P = -1) {
	for (unsigned int i = 0; i < V[par].size(); i++) {
		if (V[par][i] == P)continue;
		dfs(V, dp, V[par][i], par);
	}
	if (V[par].size() == 1 && P != -1) {
		dp[par][0] = 1;
		dp[par][1] = 1;
	}
	else {
		for (unsigned int i = 0; i < V[par].size(); i++) {
			if (V[par][i] == P)continue;
			dp[par][0] *= (dp[V[par][i]][0] + dp[V[par][i]][1]) % ANS;
			dp[par][1] *= dp[V[par][i]][0] % ANS;
			dp[par][0] %= ANS;
			dp[par][1] %= ANS;
		}
	}
}

int main() {
	cin >> N;
	vector<vector<int> > V(N, vector<int>());//子の番号
	for (int i = 0; i < N-1; i++) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		//if (x > y) { swap(x, y); }
		V[x].push_back(y);
		V[y].push_back(x);
	}
	vector<vector<long long int> > dp(N, vector<long long int> (2, 1));//1:クロ
	dfs(V, dp, 0);
	cout << (dp[0][0] + dp[0][1]) % ANS << endl;
	
}

Measured memory_bytes: 16768
S = input()
if S=='SUN':
  print(7)
elif S=='MON':
  print(6)
elif S=='TUE':
  print(5)
elif S=='WED':
  print(4)
elif S=='THU':
  print(3)
elif S=='FRI':
  print(2)
else:
  print(1)

Measured memory_bytes: 38512
h, w, n = map(int, input().split())
a_b = [list(map(int, input().split())) for i in range(n)]

mass_dict = {}

def count_blackmass(y, x):
    # 黒マスの座標を引数として受け取る
    # その黒マスを含んでいる3*3のマスのカウントを1増やす
    # xが列yが行
    global mass_dict
    for i in range(3):
        tmpy = y - i # 黒マスを含んでいる3*3の左上の頂点のy座標
        for j in range(3):
            tmpx = x - j # 黒マスを含んでいる3*3の左上の頂点のx座標
            if 0 < tmpy and 0 < tmpx and tmpx + 2 <= w and tmpy + 2 <= h: #適切な範囲
                if  (tmpx, tmpy) in mass_dict:
                    mass_dict[(tmpx, tmpy)] += 1
                else:
                    mass_dict[(tmpx, tmpy)] = 1


count = [0 for i in range(10)]
for i, j in a_b: # O(N)
    # iが行,jが列を表している
    count_blackmass(i, j)

for val in mass_dict.values():
    count[val] += 1

count[0] = (w - 2) * (h - 2) - sum(count[1:])
for i in range(10):
    print(count[i])


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

int main(void)
{
    int D;
    cin >>D;
    if(D == 25) printf("Christmas\n");
    else if(D==24) printf("Christmas Eve\n");
    else if(D==23) printf("Christmas Eve Eve\n");
    else printf("Christmas Eve Eve Eve\n");
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

from collections import defaultdict

def DD(arg): return defaultdict(arg)

def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

H,W = list(map(int,input().split()))
data = [list(map(int, input().split())) for _ in range(H)]

class BIT:
  def __init__(self, logn):
    self.n = 1<<logn
    self.data = [0]*(self.n+1)
    self.el = [0]*(self.n+1)
  def sum(self, i):
    s = 0
    while i > 0:
      s += self.data[i]
      i -= i & -i
    return s
  def add(self, i, x):
    # assert i > 0
    self.el[i] += x
    while i <= self.n:
      self.data[i] += x
      i += i & -i
  def get(self, i, j=None):
    if j is None:
      return self.el[i]
    return self.sum(j) - self.sum(i)
  def bisect(self, x):
    w = i = 0
    k = self.n
    while k:
      if i+k <= self.n and w + self.data[i+k] < x:
        w += self.data[i+k]
        i += k
      k >>= 1
    return i+1

dic = DD(int)
for i in range(W):
  dic[i+1] = i+1

members = DD(int)
for i in range(W):
  members[i+1] = 1

B = BIT(int_log(W,2)+1)
for i in range(W):
  B.add(i+1,1)

def calc_prev_valid(x):
  s = B.sum(x-1)
  if s == 0:
    return 0
  else:
    return B.bisect(s)

count_score = DD(int)
count_score[0] = W
score = 0

for i in range(H):
  a,b = data[i]
  now = b

  while now >= a:
    if B.el[now]:
      count_score[now-dic[now]] -= members[now]
      if not B.el[b+1]:
        dic[b+1] = dic[now]
        B.add(b+1,1)
      if b+1 < W+1:
        count_score[(b+1)-dic[b+1]] += members[now]
      B.add(now,-1)
      members[b+1] += members[now]
      members[now] = 0
    now = calc_prev_valid(now)

  while True:
    if count_score[score]:
      print(score+i+1)
      break
    else:
      score += 1
    if score == W:
      for _ in range(H-i):
        print(-1)
      exit()
#  if i == 1500:
#    exit()

Measured memory_bytes: 172924
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

ll f(ll i, ll l, const vector<ll>& lnum, const vector<ll>& pnum)
{
    if (l == 0) {
        return 1;
    }

    if (i == 1) {
        return 0;
    } else if (2 <= i && i <= lnum[l-1] + 1) {
        return f(i - 1, l - 1, lnum, pnum);
    } else if (i == lnum[l-1] + 2) {
        return pnum[l-1] + 1;
    } else if (lnum[l-1] + 3 <= i && i <= 2*lnum[l-1] + 3) {
        return pnum[l-1] + 1 + f(i - lnum[l-1] - 2, l - 1, lnum, pnum);
    } else {
        return 2*pnum[l-1] + 1;
    }
}

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

    vector<ll> lnum(N+1);
    lnum[0] = 1;
    for (int i = 0; i < N; ++i) {
        lnum[i+1] = 2*lnum[i] + 3;
    }

    vector<ll> pnum(N+1);
    pnum[0] = 1;
    for (int i = 0; i < N; ++i) {
        pnum[i+1] = 2*pnum[i] + 1;
    }

    ll ans = f(X, N, lnum, pnum);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
import math
x,y = map(int,input().split())
mod = pow(10,9)+7
if (2*x-y)% 3 != 0 or (2*y-x)% 3 != 0 or ((2 * y - x) / 3 < 0) or ((2 * x - y) / 3 < 0):
	print(0)
else:
	n = int((2 * y - x) / 3)
	m = int((2 * x - y) / 3)
	P = [1]*(n + m + 1)
	for i in range(1, n+m+1):
		P[i] = P[i-1]*i
		P[i] %= mod
	print((P[n+m]*pow(P[n],mod-2,mod)*pow(P[m],mod-2,mod)) % mod)

Measured memory_bytes: 29428
// 6/14 リアルタイム参加
#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>;
using Graph = vector<vector<int>>;

int main() {
    int X, N;
    cin >> X >> N;
    vector<int> p(N);
    rep(i, N) cin >> p[i];

    map<int, int> mp;
    rep(i, N) {
        mp[p[i]]++;
    }

    int delta = 0;
    int res;

    while (true) {
        if (mp[X - delta] == 0) {
            res = X - delta;
            break;
        }
        else if (mp[X + delta] == 0) {
            res = X + delta;
            break;
        }
        delta++;
    }

    cout << res << endl;
}

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

int a,b,mul,sum,dif,ans;

int main(){
	cin>>a>>b;
	mul=a*b;
	sum=a+b;
	dif=a-b;
	ans=(mul>sum?mul:sum);
	ans=(ans>dif?ans:dif);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	int m;
	cin>>m;
	REP(i, m) {
		string s;
		cin>>s;
		set<string> p;
		FOR(j, 1, s.size()) {
			string f = s.substr(0, j);
			string b = s.substr(0 + j, s.size() - j);
			if(p.count(f + b) == 0) {
				p.insert(f + b);
			}
			if(p.count(b + f) == 0) {
				p.insert(b + f);
			}
			reverse(ALL(f));
			if(p.count(f + b) == 0) {
				p.insert(f + b);
			}
			if(p.count(b + f) == 0) {
				p.insert(b + f);
			}
			reverse(ALL(b));
			if(p.count(f + b) == 0) {
				p.insert(f + b);
			}
			if(p.count(b + f) == 0) {
				p.insert(b + f);
			}
			reverse(ALL(f));
			if(p.count(f + b) == 0) {
				p.insert(f + b);
			}
			if(p.count(b + f) == 0) {
				p.insert(b + f);
			}
		}
		cout<<p.size()<<endl;
	}
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < int(n); i++)
#define rep1(i,n) for (int i = 1; i <= int(n); i++)
#define repR(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep1R(i,n) for (int i = int(n); i >= 1; i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define cauto const auto
#ifdef LOCAL
#define dump(...) cerr << "[" << __LINE__ << ":" << __FUNCTION__ << "] ", _dmp_(#__VA_ARGS__, __VA_ARGS__)
void _dmp_(const char*) { cerr << endl; }
template <class T, class... U>
void _dmp_(const char *s, T const& x, U const& ...y) { const char *o = "({[", *e = "]})"; for (int i = 0; *s != '\0'; cerr << *s++) { if (count(o,o+3,*s)) i++; if (count(e,e+3,*s)) i--; if (!i && *s == ',') break; } cerr << " = " << x; if (*s == ',') cerr << ", ", s++; _dmp_(s, y...); }
#else
#define dump(...)
#endif
using ll = long long;
#define int ll
template <class T> using pque_max = priority_queue<T>;
template <class T> using pque_min = priority_queue<T, vector<T>, greater<T> >;
#define CONAINER_OUTPUT os << "{"; for (auto const& x : v) os << " " << x; return os << " }";
template <class T> ostream& operator<<(ostream& os, vector<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, deque<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, set<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, multiset<T> const& v) { CONAINER_OUTPUT }
template <class T, class U> ostream& operator<<(ostream& os, map<T,U> const& v) { CONAINER_OUTPUT }
#undef CONAINER_OUTPUT
template <class T> istream& operator>>(istream& is, vector<T>& v) { for (auto& x : v) is >> x; return is; }
template <class T, class S> ostream& operator<<(ostream& os, pair<T,S> const& p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class T, class S> istream& operator>>(istream& is, pair<T,S>& p) { return is >> p.first >> p.second; }
struct _Init_ { _Init_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } _init_;

template <class T> void quit(T const& x) { cout << x << endl; exit(0); }
template <class T> bool chmin(T& x, T const& y) { if (x > y) { x = y; return true; } return false; }
template <class T> bool chmax(T& x, T const& y) { if (x < y) { x = y; return true; } return false; }
template <class It> auto sumof(It b, It e) { return accumulate(b,e,typename iterator_traits<It>::value_type{}); }
#define YesNo(c) ((c) ? "Yes" : "No")
////////////////////////////////
const double pi = acos(-1);

int32_t main() {
    int n,L; cin >> n >> L;
    vector<int> t(2*n);
    rep (i,n) cin >> t[i], t[n+i] = L+t[i];
        
    double x = 0, y = 0;
    rep (i,n) for (int j = i+1; j < i+n; j++) {
        double k = n-(j-i+1);
        x += cos(2*pi/L*(t[i]+t[j])/2)*k;
        y += sin(2*pi/L*(t[i]+t[j])/2)*k;    
    }
    x /= n*(n-1)*(n-2)/6;
    y /= n*(n-1)*(n-2)/6;
    cout << x << " " << y << "\n";
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N=in();
	auto A=vecin<ll>(N);

	ll L = *max_element(ALL(A));
	ll R,minD=1LL<<60;
	if(!(L%2)){
		ll H = L/2;
		REP(i,N){
			ll D = (A[i]-H)*(A[i]-H);
			if(A[i]!=L && minD>D){
				minD = D;
				R = A[i];
			}
		}
		out(L,R);
	}
	else{
		ll H = L;
		REP(i,N){
			ll D = (2LL*A[i]-H)*(2LL*A[i]-H);
			if(A[i]!=L && minD>D){
				minD = D;
				R = A[i];
			}
		}
		out(L,R);
	}
	
	return 0;
}


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

int main()
{
	long long x,y,s=0;
	cin>>x>>y;
	long long a=x;
	
	while(a<=y){
		a*=2;
		s++;
	}
	
	cout<<s<<endl;
	return 0;
}

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

#define boost ios_base::sync_with_stdio(false), cin.tie(NULL);

using namespace std;
const int N = 1e6 + 41;
const int mod = 1e9 + 7;
const long long INF = 1e16;
const int inf = 1e9;

map <long long, bool> mp;

long long h[5005][5005];

bool ok = 0;

int main () {
	// boost;
	int n;
	string s;
	cin >> n >> s;
	for (int i = 0 ; i < n ; ++ i) {
		h[i][i] = (s[i] - 'a' + 1);
		for (int j = i + 1 ; j < n ; ++ j) {
			h[i][j] = (h[i][j - 1] * 31 + (s[j] - 'a' + 1)) % mod;
		}
	}
	int l = 1, r = n - 1, ans = 0;
	while (l <= r) {
		int len = (l + r) / 2;
		mp.clear();
		ok = 0;
		for (int i = 0 ; i + len - 1 < n ; ++ i) {
			if (mp[h[i][i + len - 1]]) {
				ok = 1;
				break;
			}
			if (i - len + 1 >= 0)
				mp[h[i - len + 1][i]] = 1;
		}
		if (ok) {
			ans = len, l = len + 1;
		}
		else {
			r = len - 1;
		}
	}/*
	for (int len = n - 1 ; len >= 1 ; -- len) {
		mp.clear();
		for (int i = 0 ; i + len - 1 < n ; ++ i) {
			if (mp[h[i][i + len - 1]]) cout << len, exit(0);
			if (i - len + 1 >= 0)
				mp[h[i - len + 1][i]] = 1;
		}
	}*/
	cout << ans;
}

Measured memory_bytes: 195200
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
using ld = long double;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
const long double pi = (acos(-1));
#define pb push_back
#define vs vector<string>

//最大最小の入れ替え
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (ll i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (ll i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる

//ここから
int main(){
    ll N,M;
    cin>>N>>M;
    vvl vec(M);
    rep(i,M){
        ll k;
        cin>>k;
        rep(j,k){
            ll a;
            cin>>a;
            vec[i].pb(a-1);
        }
    }
    vl p(M);
    ll count=0;
    rep(i,M)cin>>p[i];
    for (int bit = 0; bit < (1<<N); ++bit) {
        rep(i,M){
            bool end=false;
            ll a=vec[i].size();
            ll check=0;
            rep(j,a){
                if(bit&(1<<vec[i][j])){
                    check++;
                }
            }
            if(check%2!=p[i]) break;
            if(i==M-1) count++;
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int x, y;
  int foo;
  while(1){
    cin >> x >> y;
    if(x == 0 && y == 0)break;
    if(x > y){
      foo = x;
      x = y;
      y = foo;
    }
    cout << x << " " << y << "\n";
  }
}

Measured memory_bytes: 1156
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")  //デバッグ時にoptimized-outされて邪魔だった
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

bool issame(vi a, vi b) {
  bool f = false;
  rep(i, a.size()) {
    if(a[i] != b[i]) {
      return false;
    }
  }
  return true;
}

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  int N; cin >> N;
  vi P(N), Q(N);
  rep(i, N) cin >> P[i];
  rep(i, N) cin >> Q[i];
  
  vi cur(N);
  rep(i, N) cur[i] = i+1;
  vi org = cur;
  
  ll ct = 0;
  ll p1 = 0;
  ll q1 = 0;
  while(true) {
    if(issame(cur, P)) {
      p1 = ct;
    }
    if(issame(cur, Q)) {
      q1 = ct;
    }
    
    next_permutation(all(cur));
    if(issame(org, cur)) break;
    ct++;
  }
  
  fin(abs(q1 - p1));
}

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

int main(void)
{
	int h1,m1, h2,m2, d;
	scanf("%d%d%d%d%d",&h1,&m1,&h2,&m2,&d);
	
	h2-=h1; m2-=m1;
	int x = h2*60 + m2;
	
	printf("%d",x - d);
	return 0;
}

Measured memory_bytes: 3824
// AOJ 2608: Minus One
// 2017.11.30 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX 300000
typedef struct { int t, node; } QUE;
QUE que[MAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
//	if (qsize == 0) return 0;
//	*n = que[0].node, *t = que[0].t, *c = que[0].c;
	que[0] = que[--qsize];
	min_heapify(0);
//	return 1;
}

void enq(int n, int t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].node = n, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		i = min;
	}
}

typedef struct { int *to; } TBL;
TBL tbl[100001]; int len[100001];
int x[300000], y[300000];
int smin[100001], tmin[100001];
int scnt[100001], tcnt[100001];

void dijkstra(int *node, int start)
{
	int i, s, e, d;

	qsize = 0;
	node[start] = 0;
	enq(start, 0);
	while (qsize) {
		s = que[0].node; deq();
		for (i = 0; i < len[s]; i++) {
			e = tbl[s].to[i];
			d = node[s] + 1;
			if (d < node[e]) node[e] = d, enq(e, d);
		}
	}
}

char buf[40], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int n, m, s, t, i;
	long long ans;

	fgets(p=buf, 40, stdin);
	n = getint(), p++, m = getint(), p++, s = getint()-1, p++, t = getint()-1;
	for (i = 0; i < m; i++) {
		fgets(p=buf, 20, stdin);
		x[i] = getint()-1, p++, y[i] = getint()-1;
		len[x[i]]++, len[y[i]]++;
	}
	for (i = 0; i < n; i++) tbl[i].to = calloc(len[i], sizeof(int));
	memset(len, 0, sizeof(len));
	for (i = 0; i < m; i++) {
		tbl[x[i]].to[len[x[i]]++] = y[i];
		tbl[y[i]].to[len[y[i]]++] = x[i];
	}

	memset(smin, 0x33, sizeof(smin));
	dijkstra(smin, s);
	memset(tmin, 0x33, sizeof(tmin));
	dijkstra(tmin, t);

	for (i = 0; i < n; i++) {
		if (smin[i] < n) scnt[smin[i]]++;
		if (tmin[i] < n) tcnt[tmin[i]]++;
	}

	ans = 0, s = smin[t]-1;
	for (i = 0; i < s; i++) ans += (long long)scnt[i] * tcnt[s-1-i];
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 9648
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

ll X, Y;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> X >> Y;

  ll ans = 0;
  while (X <= Y) {
    X *= 2;
    ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){
    cin >> a.at(i);
    a.at(i)--;
  }
  vector<int> dist(n,-1);
  dist.at(0)=0;
  int cur = 0;
  while(true){
    int next = a.at(cur);
    if(dist.at(next)!=-1){
      break;
    }else{
      dist.at(next)=dist.at(cur)+1;
      cur = next;
    }
  }
  cout << dist.at(1) << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(ll i=0;i<N;++i)
typedef long long int ll;
ll INF = 1LL<<60;
int MOD = 1e9 + 7;

int main(){
    int n; cin >> n;
    double ans;
    rep(i,n){
        double x; cin >> x;
        ans += 1/x;
    }
    ans = 1/ans;
    cout << fixed;
    cout << setprecision(5) << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

using namespace std;
using ll = long long;

const int N = 5005;
int n, k, p[N], c[N];
int vis[N];
vector<int> vs;
ll ans = -1e17;

void calc(int start) {
    if (vs.empty()) return;
    // for (int i : vs) {
    //     cout << i + 1 << " ";
    // }
    // cout << endl;
    auto nv = vs;
    ll round = 0;
    for (auto v : nv) {
        vs.push_back(v);
        round += c[v];
    }
    vector<ll> sum;
    sum.push_back(0);
    for (int i = 0; i < vs.size(); i++) {
        sum.push_back(sum.back() + c[vs[i]]);
    }
    for (int i = 0; i < vs.size(); i++) {
        for (int j = i+1; j < vs.size(); j++) {
            ll cur = sum[j] - sum[i];
            int rest = k - (j-i);
            if (rest < 0) {
                continue;
            }
            if (round > 0) {
                cur += round * (rest / nv.size());
            }
            if (cur > ans) {
                ans = cur;
            }
        }
    }
}

void dfs(int cur) {
    if (vis[cur]) {
        calc(cur);
        vs.clear();
        return;
    }
    vis[cur] = 1;
    vs.push_back(cur);
    dfs(p[cur]);
}

int main() {
    ios::sync_with_stdio(false);
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) {
        cin >> p[i];
    }
    for (int i = 1; i <= n; ++i) {
        cin >> c[i];
    }

    for (int i = 1; i <= n; ++i) {
        dfs(i);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define f first
#define s second 
#define mp make_pair
#define inf 1<<30
using namespace std;

vector<pair<int,pair<int,int> > > v[101];

int main()
{
  int N,M,L,a,b,c,d;
  int dp[101][101];

  while(1){
    cin>>N>>M>>L;
    if(N+M+L==0)break;
    for(int i=0;i<101;i++){
      for(int j=0;j<101;j++){
	dp[i][j]=inf;
      }
      v[i].clear();
    }
    for(int i=0;i<M;i++){
      cin>>a>>b>>c>>d;
      a--;b--;
      v[a].push_back(mp(b,mp(c,d)));
      v[b].push_back(mp(a,mp(c,d)));
    }

    int ans=inf;
    dp[0][L]=0;
    priority_queue<pair<int,pair<int,int> > > pq;
    pq.push(mp(0,mp(0,L)));
    while(!pq.empty()){
      pair<int,pair<int,int> > u=pq.top();
      pq.pop();
      int now=u.s.f,money=u.s.s,cost=(-1)*u.f;
      if(dp[now][money]<cost)continue;
      if(now==N-1){
	ans=cost;
	break;
      }
      
      for(int i=0;i<v[now].size();i++){
	int next=v[now][i].f,dis=v[now][i].s.f,e=v[now][i].s.s;
	int c=money-dis;
	if(0<=c){
	  if(cost<dp[next][c]){
	    dp[next][c]=cost;
	    pq.push(mp(cost*(-1),mp(next,c)));
	  }
	}
	if(cost+e<dp[next][money]){
	  dp[next][money]=cost+e;
	  pq.push(mp((cost+e)*(-1),mp(next,money)));
	}
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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


int main(){
    cin >> N;
    vector<vector<int>> S(26, vector<int>(N, 0));
    string buf;
    for(int i = 0; i< N; i++){
        cin >> buf;
        for(char s : buf){
            S.at(s -'a').at(i)++;
        }
    }

    for(int i = 0; i<26; i++){
        sort(S.at(i).begin(), S.at(i).end());
        if(S.at(i).at(0)!= 0){
            cout << string(S.at(i).at(0), 'a' + i);
        }
    }
    cout << endl;
    // for (vector<int> ve : S)
    // {
    //     for (int aaa : ve)
    //     {
    //         cout << aaa;
    //     }
    //     cout << endl;
    // }
}

Measured memory_bytes: 256
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    m, d = map(int, readline().rstrip().split())
    if d < 10:
        print(0)
        return

    cnt = 0
    for k in range(1, m + 1):
        for i in range(10, d + 1):
            d1, d10 = int(str(i)[1]), int(str(i)[0])
            if d1 * d10 == k and d1 > 1 and d10 > 1:
                cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9492
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord
import qualified Data.Sequence as Seq
import qualified Data.IntSet as IS
import qualified Data.Set as S

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

mdl :: Num a => a
mdl = 10^9 + 7

main :: IO ()
main = do
    [n,a,b] <- r' :: IO [Int]
    let al = powMod 2 n - 1 `mod` mdl
    let na = choose n a `mod` mdl
    let nb = choose n b `mod` mdl
    print $ positivize $ (al - na - nb) `mod` mdl


powMod = powModAux 1
powModAux :: Int -> Int -> Int -> Int
powModAux ac cur 0 = ac
powModAux ac cur n
    | even n = powModAux ac (cur^2 `mod` mdl) (div n 2)
    | odd n  = powModAux (ac*cur `mod` mdl) (cur^2 `mod` mdl) (div n 2)



positivize x = if x < 0 then x + mdl else x


choose :: Int -> Int -> Int
choose n i = (prod' $ U.generate i (+ (n-i+1)) ) * (prodInv' $ U.generate i succ)

prod' :: U.Vector Int -> Int
prod' = U.foldl' (\ac x -> ac * x `mod` mdl) 1

prodInv' :: U.Vector Int -> Int
prodInv' = U.foldl' (\ac x -> ac * (modInv x) `mod` mdl) 1



modInv :: Int -> Int
modInv a =
    let (x,_,1) = eEA a mdl
    in  positivize x

eEA :: Int -> Int -> (Int, Int, Int)
eEA a 0 = (1, 0, a)
eEA a b =
    let (q, r) = a `quotRem` b
        (s, t, g) = eEA b r
    in  (t, s-q*t, g)



Measured memory_bytes: 1020
var
	N,i:Longint;
	ans,T:int64;
	A,B:Array[1..100000]of int64;
begin
	read(N);
	for i:=1 to N do read(A[i],B[i]);
	for i:=N downto 1 do begin
		T:=(-ans-A[i])mod B[i];
		if T<0 then inc(T,B[i]);
		inc(ans,T);
	end;
	writeln(ans);
end.


Measured memory_bytes: 1664
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}

#define deb(x) cout << '>' << #x << ':' << x << endl;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define END '\n'
#define inf 9e18
#define ff first
#define ss second
#define pb push_back

vvi adj;
vb vis;
int cnt = 0;
void dfs(int v){
    ++cnt;
    vis[v] = true;
    for (auto u: adj[v]){
      if (!vis[u]){
        //My work goes here
        dfs(u);
      }
    }
}


void solve(){
    int n, m;
    cin >> n >> m;
    adj.resize(n + 1);
    vis.resize(n + 1, false);
    while(m--) {
        int a, b;
        cin >> a >> b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    int ans = INT_MIN;
    for (int i = 1; i <= n; ++i) {
        if (!vis[i]) cnt = 0, dfs(i), ans = max(ans, cnt);
    }
    cout << ans;
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 20324
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rfor(i,a,b) for(ll (i) = (a); (i) > (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(a) cout << (a) << endl;
#define all(x) (x).begin(),(x).end()

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    for (ll d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}

int main()
{
    int n,v;
    cin >> n;
    vector<pair<int, int>> add(1e5 + 2, make_pair(0, 0)),even(1e5 + 2, make_pair(0, 0));
    rep0(i, n){
        cin >> v;
        if(i%2 == 0)even[v] = make_pair(even[v].first + 1, v);
        else add[v] = make_pair(add[v].first + 1, v);
    }
    
    sort(all(even),greater<>());
    sort(all(add),greater<>());
    
    if(even[0].second != add[0].second)pf(n - even[0].first - add[0].first)
    else{
        if(even[0].first < add[0].first)pf(n - even[1].first - add[0].first)
        else if(even[0].first > add[0].first)pf(n - even[0].first - add[1].first)
        else pf(n - even[0].first - max(even[1].first, add[1].first))
    }
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<set>
#include<vector>
using namespace std;

int solve(){
  int n, k; cin >> n >> k;
  int ans = 1;
  while(n>=k){
    n/=k;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

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


Measured memory_bytes: 256
N,M=map(int,input().split())
dp=[1]*(N+1)
for i in range(M):
    dp[int(input())]=0
for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=(dp[i-1]+dp[i-2])
print(dp[-1]%1000000007)  

Measured memory_bytes: 460020
import java.util.*;

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

        String str = sc.next();

        long count = 0;
        long ans = 0;

//        str = str.replace("BC", "D");

        char c[] = str.toCharArray();

        for (int i=0; i<c.length; i++){
            if (c[i]=='A'){
                count++;
            }
            else if (i+1<c.length && c[i]=='B' && c[i+1]=='C'){
                ans += count;
                i++;
            }
            else {
                count=0;
            }
        }

        System.out.println(ans);

//        while(str.contains("ABC")){
//            str = str.replaceFirst("ABC", "BCA");
//            count++;
//        }
//        System.out.println(count);
    }
}

Measured memory_bytes: 28664
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int mod=1e9+7;
const int inf = (1<<30);
string toBin(ll a);
void printMat(int arr[], int n);
void printMat(vector<int> arr, int n);
void printMat(vector<vector<int> > arr, int n, int m);
void printMat(vector<int> arr[], int n);
//void printMat(int arr[][], int n, int m);

void solve(){
	char c;
	cin>>c;
	if(c>=65 && c<=90){
		cout<<"A"<<endl;
	}else{
		cout<<"a"<<endl;
	}
}

int main()
{
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}
string toBin(ll a){
	string s="";
	while(a>0){
		if(a&1){
			s="1"+s;
		}else{
			s="0"+s;
		}
		a>>=1;
	}
	return s;
}
void printMat(int arr[], int n){
	for(int i=0;i<n;i++){
		cout<<arr[i]<<" ";
	}cout<<endl;
}
void printMat(vector<int> arr, int n){
	for(int i=0;i<n;i++){
		cout<<arr[i]<<" ";
	}cout<<endl;
}
void printMat(vector<int> arr[], int row, int col){
	for(int i=0;i<row;i++){
		for(int j=0;j<col;j++){
			cout<<arr[i][j]<<" ";
		}cout<<endl;
	}cout<<endl;
}
void printMat(vector<vector<int> > arr, int row, int col){
	for(int i=0;i<row;i++){
		for(int j=0;j<col;j++){
			cout<<arr[i][j]<<" ";
		}cout<<endl;
	}cout<<endl;
}

Measured memory_bytes: 3588
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX)
#define EPS (1.0e-8)
#define LINF (LONG_MAX)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    ll N, T; cin >> N >> T;
    vl A(N); REP(i, N) cin >> A[i];

    vl lo(N, LINF); // minimun in [0,i]
    lo[0] = A[0];
    FOR(i, 1, N) {
        lo[i] = min(lo[i-1], A[i]);
    }

    ll difHi = 0;
    ll cnt = 0;
    REP(i,N) {
        int dif = A[i] - lo[i];
        if (dif > difHi) {
            difHi = dif;
            cnt = 1;
        } else if (dif == difHi) {
            cnt++;
        }
    }

    ll ans = cnt;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 19


int N;
int POW[SIZE];


int main(){

	POW[0] = 1;
	for (int i = 1; i < SIZE; i++){

		POW[i] = POW[i-1]*2;
	}

	scanf("%d",&N);

	printf("0:\n");
	int index = 1;

	for(int state = 1; state < POW[N]; state++){
		printf("%d:",index++);
		for(int loop = 0; loop < N; loop++){
			if(state & (1 << loop)){
				printf(" %d",loop);
			}
		}
		printf("\n");
	}

	return 0;
}



Measured memory_bytes: 3188
while True:
    H, W = map(int, input().split())
    if not(H or W):
        break
    for j in range(W):
        print('#', end='')
    print()
    for i in range(H-2):
        print('#', end='')
        for j in range(W-2):
            print('.', end='')
        print('#')
    for j in range(W):
        print('#', end='')
    print('\n')

Measured memory_bytes: 8972
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
bool fin(vector<string>a,string b){
	for(int i=0;i<a.size();i++)if(a[i]==b)return true;
	return false;
}
int main(){
	int m;
	cin>>m;
	for(int i=0;i<m;i++){
		string s;
		vector<string>anss(0);
		cin>>s;
		for(int i=0;i<s.size();i++){
			string t1,t2,t3,t4,t5,t6,t7,t8,a,b;
			a=s.substr(0,i);
			b=s.substr(i,s.size()-i);
			t1=a+b;
			t5=b+a;
			reverse(a.begin(),a.end());
			t2=a+b;
			t6=b+a;
			reverse(b.begin(),b.end());
			t3=a+b;
			t7=b+a;
			reverse(a.begin(),a.end());
			t4=a+b;
			t8=b+a;
			if(fin(anss,t1)==false)anss.push_back(t1);
			if(fin(anss,t2)==false)anss.push_back(t2);
			if(fin(anss,t3)==false)anss.push_back(t3);
			if(fin(anss,t4)==false)anss.push_back(t4);
			if(fin(anss,t5)==false)anss.push_back(t5);
			if(fin(anss,t6)==false)anss.push_back(t6);
			if(fin(anss,t7)==false)anss.push_back(t7);
			if(fin(anss,t8)==false)anss.push_back(t8);
		}
		cout<<anss.size()<<endl;
	}
	return 0;
}

Measured memory_bytes: 1284
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

def main():
    H,W=mis()
    if H==1 or W==1:
        print(1)
        return
    od = math.ceil(W/2)
    ev = W//2
    ans = (od+ev) * (H//2)
    if H&1:
        ans += od
    print(ans)



main()







Measured memory_bytes: 5556
H,W=map(int,input().split())
grid=[None]*H
for i in range(H):
  grid[i]=input()

ans=0
from collections import deque
for i in range(H):
  for j in range(W):
    q=deque()
    q.append([i,j,0])
    seen=[[False for j in range(W)] for i in range(H)]
    while q:
      node=q.popleft()
      y=node[0]
      x=node[1]
      dist=node[2]
      if grid[y][x]=="#":
        continue
      if seen[y][x]:
        continue
      seen[y][x]=True
      if dist>ans:
        ans=dist
      cases=((0,1),(0,-1),(1,0),(-1,0))
      for c in cases:
        if 0<=y+c[0]<H and 0<=x+c[1]<W:
          q.append([y+c[0],x+c[1],dist+1])
      
print(ans)    

Measured memory_bytes: 3316
object Main extends App {
	val Array(n, x) = scala.io.StdIn.readLine.split(" ").map(_.toInt)
	val a = new Array[Int](n)
	for(i <- 0 until n){
		a(i) = scala.io.StdIn.readInt
	}

	val tp = a.sum
	println(n + (x - tp)/a.min)
}


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

int main() {
  int n; std::cin >> n;
  std::vector<int> d(n);
  for (int i = 0; i < n; ++i) std::cin >> d[i];
  int sum = 0;
  for (int i = 0; i < n; ++i)
    for (int j = i+1; j < n; ++j)
      sum += d[i]*d[j];
  
  std::cout << sum << std::endl;
  
  return 0;
}

Measured memory_bytes: 3508
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long const mod = 1000000007;
long long mod_pow(long long a, long long b){
    long long res = 1;
    a %= mod;
    while(b > 0){
        if(b%2 == 1) res = (res * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return res;
}

long long mod_inv(long long a){
    return mod_pow(a, mod-2);
}

long long mod_comb(long long a, long long b){
    if(b < 0 || a < b)return 0;
    if(b > a/2)return mod_comb(a, a-b);
    long long res = 1;
    for(long long i = 0; i < b; i++){
        res = (res * ((a-i)%mod)) % mod;
        res = (res * mod_inv(b-i)) % mod;
    }
    return res;
}

int main(void){
    int n, a, b;
    cin >> n >> a >> b;
    long long ans = mod_pow(2, n) - 1;
    ans += mod - mod_comb(n, a);
    ans += mod - mod_comb(n, b);
    cout << ans % mod << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int x = sc.nextInt();
    int a = sc.nextInt();
    
    if (x < a) {
      System.out.println(0);
    } else if (x >= a) {
      System.out.println(10);
    }
  }
}

Measured memory_bytes: 23124