akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int n;
	while(cin >> n , n){
		int d[7] = {0};
		rep(i,n){
			int age;
			cin >> age;
			if(age>60)age = 60;
			d[age/10]++;
		}
		rep(i,7){
			cout << d[i] << endl;
		}
	}
}

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

int main(){
    int thp, tap, ahp, aap;
    cin >> thp >> tap >> ahp >> aap;

    while(thp > 0 && ahp > 0){
        ahp -= tap;
        if(ahp <= 0){
            cout << "Yes" << endl;
        }else{
            thp -= aap;
            if(thp <= 0){
                cout << "No" << endl;
            }
        }
    }
}

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

using namespace std;

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

    char a, b, c;

    cin >> a >> b >> c;

    if(a == '7' or b == '7' or c == '7') cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


Measured memory_bytes: 3652
a,b,c,d = map(int, input().split())
if c%b == 0:
    t = c//b 
else:
    t = c//b +1
if a%d == 0:
    u = a//d
else:
    u = a//d +1
if t > u:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 9160
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int t[555][555];
bool used[555][555];
int pos[1100000][2];
int n,m;

void check(int x,int y,int a){
	if(x<0 || x>=n || y<0 || y>=n)return;
	if(t[x][y]<=a)return;
	t[x][y]=a;
	if(!used[x][y])a++;
	check(x+1,y,a);
	check(x-1,y,a);
	check(x,y+1,a);
	check(x,y-1,a);
}

int main(){
	int i,j,k;
	int a,b,c;
	cin>>n;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			t[i][j]=min({i,j,n-i-1,n-j-1});
		}
	}
	LL s=0;
	for(i=0;i<n*n;i++){
		cin>>a;
		a--;
		int x=a/n,y=a%n;
		s+=t[x][y];
		used[x][y]=true;
		a=t[x][y];
		t[x][y]=1e9;
		check(x,y,a);
	}
	cout<<s<<endl;
}

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

//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) {if (b < a) { a = b; return true; } return false; }

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

    //作る時はparentsを-1で初期化する
    //こうすることで全部ばらばらになる
    UnionFind(int n){
        parents = vector<int>(n, -1);
    }

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

    //自分のいるグループの大きさを調べる
    int size(int A){
        return -parents[root(A)];
    }

    //AとBをくっつける
    bool connect(int A, int B){
        //AとBを直接ではなく親同士をくっつける
        A=root(A);
        B=root(B);
        if(A==B){
            return false;
        }

        //大きい方（A)に小さい方（B)をくっつけたい
        if(size(A)<size(B)) swap(A, B);

        parents[A] += parents[B];
        parents[B] = A;

        return true;
    }
};

int main(){
    int N, K, L; cin >> N >> K >> L;
    UnionFind roads(N), rails(N);

    for(int i=0; i<K; i++){
        int p, q; cin >> p >> q;
        p--; q--;
        roads.connect(p, q);
    }

    for(int i=0; i<L; i++){
        int p, q; cin >> p >> q;
        p--; q--;
        rails.connect(p, q);
    }

    map<pair<int,int>, int> mp;
    for(int i=0; i<N; i++) mp[{roads.root(i), rails.root(i)}]++;

    for(int i=0; i<N; i++){
        if(i) cout << " ";
        cout << mp[{roads.root(i), rails.root(i)}];
    }
    cout << endl;
}

Measured memory_bytes: 13568
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)

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

ll sum_of_1_to_n(ll n)
{
	return n*(n+1)/2;
}

ll sum_of_m_to_n(ll m, ll n)
{
	if (m > n) return sum_of_m_to_n(n, m);
	return sum_of_1_to_n(n) - sum_of_1_to_n(m-1);
}

int main(void)
{
	int n;
	while (cin >> n, n) {
		int cnt = 0;
		REP(i, 1, n)
			REP(j, i+1, n)
				if (sum_of_m_to_n(i, j) == n) 
					cnt++;
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){
    
    int N;cin>>N;
    vector<ll> A(N);
    ll mini=-INF;
    int minip=-1;
    for(int i=0;i<N;i++){
        cin>>A[i];
        if(mini<A[i]){
            mini=A[i];
            minip=i;
        }
    }
    if(mini<=0){
        cout<<mini<<endl;
        cout<<N-1<<endl;
        for(int i=N;i>minip+1;i--){
            cout<<i<<endl;
        }
        for(int i=1;i<minip+1;i++){
            cout<<1<<endl;
        }
    }else{
        ll maxi=0;
        int s=-1,t=-1;
        for(int i=0;i<N;i++){
            if(A[i]<=0) continue;
            for(int j=i;j<N;j+=2){
                if(A[j]<=0) continue;
                ll sum=0;
                for(int k=i;k<=j;k+=2){
                    if(A[k]>0){
                        sum+=A[k];
                    }
                }
                if(sum>maxi){
                    maxi=sum;
                    s=i;
                    t=j;
                }
            }
        }
        
        vector<int> B;
        
        for(int i=s;i<=t;i+=2){
            if(A[i]<0) B.push_back(i+1);
        }
        
        cout<<maxi<<endl;
        cout<<N-1-(t-s)/2<<endl;
        
        for(int i=B.size()-1;i>=0;i--){
            cout<<B[i]<<endl;
        }
        
        for(int i=N;i>t+1;i--){
            cout<<i-2*B.size()<<endl;
        }
        for(int i=1;i<s+1;i++){
            cout<<1<<endl;
        }
        for(int i=0;i<(t-s)/2-B.size();i++){
            cout<<2<<endl;
        }
    }
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[3005][3005];
ll a[3005],pre[3005];
ll mini(ll x, ll y)
{
    if(x>=y)return y;
    return x;
}
int main(void) {
	// your code goes here
	int n,k,i;
    multiset<ll> s;
    scanf("%d",&n);
    ll ans =  0;
    ll x,y;
    for(i=1; i<=n;i++)
    {
       scanf("%lld",&a[i]);
       pre[i] = pre[i-1] + a[i];
    }
    int j;
    for(i=1; i<n;i++)
    dp[i][i+1] = a[i] + a[i+1];
    int  len ;

    ll hi  =  1000000007;
    for(len = 3; len <=n; len++)
    {
        for(i=1;i<=n;i++)
        {
            j = i+len-1;
            dp[i][j] = hi * hi;
            for(k=i+1; k<=j;k++)
            {
               dp[i][j] = mini(dp[i][j], dp[i][k-1] +  dp[k][j] + pre[j]-pre[i-1]); 
            }
         //   printf("%d to %d is %lld\n",i,j,dp[i][j]);
              }
    }
    printf("%lld\n",dp[1][n]);
	return 0;
}



Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
 
#define int         long long
#define pb          push_back
#define mp          make_pair
#define scan(a, n)  for(int i = 0; i < n;i++)cin >> a[i];
#define print(a, n) for(int i = 0; i < n;i++)cout << a[i] <<' ';cout<<endl;
#define w(x)        int x; cin>>x; while(x--)
#define endl 		'\n'
#define Sort(v) 	sort(v.begin(), v.end())
// Tushar Goyal

void solve() 
{
	int i, j, k, q ,n, m, ans = 0, cnt = 0, sum = 0,input;
	cin>>n;
	vector<int> h(n);
	scan(h,n);
	if(n==1)
	{
		cout<<0<<endl;
		return;
	}
	vector<int> dp(n,0);
	dp[0] = 0;
	dp[1] = abs(h[1]-h[0]);

	for(int i = 2 ; i<n ; i++)
	{
		dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]),dp[i-2] + abs(h[i] - h[i-2]) );
	}
	// print(h,n);
	// print(dp,n);

	cout<<dp[n-1]<<endl;
}
 
int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    w(T)
    {
	    solve();
    }
    return 0;
}

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

#define inf 1e9+1
vector<long long >v;
vector<long long>w;
vector<vector<long long >>dp;

long long minwt(long long n,long long val){

        if(dp[n][val]!=-1){
            return dp[n][val];
        }
        long long mn = minwt(n-1,val);
        if(val>=v[n]){
            long long b = minwt(n-1,val-v[n])+w[n];
            mn = min(mn,b);
        }
        return mn;
}
void solve(){
    int n,wt;cin>>n>>wt;
    v.resize(n);
    w.resize(n);
    int mxval = n*1000;
    dp.resize(2,vector<long long>(mxval+1,-1));

    for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
    }
    for(int i=0;i<=mxval;i++){
        dp[0][i]=inf;
    }

    dp[0][0]=0;
    dp[0][v[0]]=w[0];
    for(int i=1;i<n;i++){
        for(int j=0;j<=mxval;j++){
            dp[i&1][j]= dp[(i-1)&1][j];
            if(j>=v[i]){

                dp[i&1][j]= min(dp[i&1][j],dp[(i-1)&1][j-v[i]]+w[i]);
            }

        }
        //cout<<i<<"\n";
    }

    long long ans = 0;
    int idx=1;
    if(n&1){
        idx =0;
    }
    for(int i=mxval;i>=0;i--){
        if(dp[idx][i]<=wt){
            ans = i;
            break;
        }
    }
    cout<<ans<<"\n";
}

int main(){

    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


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

using namespace std;

int main()
{
    int x[5];
    for(int i=0;i<5;i++) cin >> x[i];
    for(int i=0;i<5;i++){
        if(x[i]==0){
            cout << i+1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
//int a[200005];
vector<pair<int,int> >v[200];
int main()
{
    fastread;
    ll a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22)
    cout<<"bust";
    else 
    cout<<"win";
	return 0;	 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <iomanip>
#include <queue>
#include <map>
#include <set>
 
using namespace std;

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

int N, K, M, T;

int main() {
    cin >> N >> K;
    string s = to_string(N);
    set<int> st;
    for (int i = 0; i < K; i++) {
        int d;
        cin >> d;
        st.insert(d);
    }
    int m = N;
    while (1) {
        string t = to_string(m);
        bool flag = true;
        for (char c : t) {
            if (st.find(c - '0') != st.end()) {
                flag = false;
                break;
            }
        }
        if (flag) {
            break;
        } else {
            m++;
        }
    }
    cout << m << endl;
    
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
int n,m;
const int N=1e5+4;
int f[N];
int32_t main()
{
	n=in();m=in();
	for(int i=1;i<=m;i++){int x=in();int y=in();f[y]++;f[x]++;}
	bool ok=1;
	for(int i=1;i<=n;i++)ok&=(f[i]%2==0);
	
	if(!ok){puts("NO");return 0;}
	puts("YES");
}


Measured memory_bytes: 4444
# ABC104B

s = input()
count = 0
if s[0] == 'A' and s[2:-1].count('C') == 1:
    for i in range(len(s)):
        if s[i].isupper():
            count += 1
if count == 2:
    print('AC')
else:
    print('WA')


Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;

int main()
{
  int n;
  cin >> n;
  int l[n];
  int ab;
  int count = 0;
  for(int i =0; i<n ;++i){
    cin >> l[i];
  }
  sort(l, l+n);

  for(int i = 0; i<n ;++i){
    for(int j = i+1; j<n ;++j){
      ab = l[i]+l[j];
      for(int k = j+1; k<n ;++k){
        if(l[k] < ab) count++;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
def main():

    N = int(input())
    A = list(map(int, input().split()))
    even = [v for v in A if v % 2 == 0]
    if all((v % 3 == 0) or (v % 5 == 0) for v in even):
        return "APPROVED"
    return "DENIED"

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 61708
S = input()
S_list = list(S)
for i in range(len(S)):
  if i%2 == 0:
    if S_list[i] == 'L':
      print('No')
      exit()
  else:
    if S_list[i] == 'R':
      print('No')
      exit()
print('Yes')

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

// この問題での最大の素数
const int MP = 999983;

// is_p[i] := i が素数のとき true
bool is_p[MP+1] = {false,false};
// cnt_p[i] := i 以下の素数の数
int cnt_p[MP+1];

// エラトステネスのふるい
void sieve(){
	for(int i = 2 ; i <= MP ; i++ )
		is_p[i] = true;
	for(int i = 2 ; i*i <= MP ; i++ ){
		if( is_p[i] ){
			for(int j = i+i ; j <= MP ; j += i ){
				is_p[j] = false;
			}
		}
	}
	// 任意の i 以下の素数の個数を求める(i <= MP)
	int cnt = 0;
	for(int i = 0 ; i <= MP ; i++ ){
		if( is_p[i] ){
			cnt++;
		}
		cnt_p[i] = cnt;
	}
}

// [a,b] の素数の個数を返す.
int get_x(int a, int b){
	a = max(1,a);
	b = min(b,MP);
	return cnt_p[b] - cnt_p[a-1];
}

int main(){
	sieve();
	int n;
	while( cin >> n , n ){
		int ans = 0;
		for(int i=0 ; i < n ; i++ ){
			int p, m;
			cin >> p >> m;
			// x := [p-m,p+m] の素数の個数
			int x = get_x(p-m,p+m);
			ans += x-1;
		}
		cout << ans << endl;
	}
}

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

using LL = long long;

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

    int A, B;
    cin >> A >> B;

    int coin = 0;
    if (A >= B) {
        coin += A;
        A = A - 1;
    } else {
        coin += B;
        B = B - 1;
    }

    if (A >= B) {
        coin += A;
    } else {
        coin += B;
    }

    cout << coin << '\n';

    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using ll = long long;
typedef std::pair<int,int> P;
//#include <boost/multiprecision/cpp_int.hpp>
//using bint = boost::multiprecision::cpp_int;


int main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    SORTR(h);
    ll ans = 0;
    FOR(i,k,n) ans += h[i];
    cout << ans;
}


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

int main(){
  int N,T;
  cin >> N >> T;
  int mincost=10000;
  for(int i=0;i<N;i++){
    int A,B;
    cin >> A >> B;
    if(B<=T){
      mincost=min(mincost,A);
    }
  }
  if(mincost==10000){
    cout << "TLE" << endl;
  }
  else{
    cout << mincost << endl;
  }
}

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

vector<vector<long long>> Factrization(long long X);
    //////////////////////////////////////////
    //    因数分解する関数
    //    in   : 整数
    //    out  : 2次元のvector 
    //    ver  : 1.0
    //    概要 : 正の整数での使用のみを想定
    //    include: <vector>, <cmath>
    //////////////////////////////////////////


int main(){
    vector<pair<long long, long long>> fact;
    long long X, n;

    std::cin >> X;

    while(1){
        n = Factrization(X).size();
        if(n == 1){
            break;
        }else{
            X++;
        }
        
    }
    
    std::cout << X;


}

vector<vector<long long>> Factrization(long long X){
    vector<vector<long long>> factors = {};
    long long n_loop, a, b;

    n_loop = (long long)floor(sqrt((float)X));
    for(long long i =1; i <= n_loop; i++){
        if(X%i == 0){
            a = i;
            b = X/i;
            factors.push_back({a, b});
        }
    }
    return factors;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(n);
    vvi data(n, vi(10, 0));
    rep(i, n) {
        rep(j, 10) {
            cin >> data[i][j];
        }
    }

    vvi funami(n, vi(11));
    rep(i, n) {
        rep(j, 11) {
            cin >> funami[i][j];
        }
    }

    int ans = -INF;
    Rep(i, 1 << 10) {
        vi hoge(10);
        int yui = i;
        rep(j, 10) {
            hoge[j] = yui % 2;
            yui /= 2;
        }
        int score = 0;
        rep(j, n) {
            int tmp = 0;
            rep(k, 10) {
                if (data[j][k] == hoge[k] && hoge[k]) tmp++;
            }
            score += funami[j][tmp];
        }
        ans = max(ans, score);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
line = input()
n = int(line)

fullcards = {
    'S':set(range(1,14)),
    'H':set(range(1,14)),
    'C':set(range(1,14)),
    'D':set(range(1,14))
    }

cards = {
    'S':set({}),
    'H':set({}),
    'C':set({}),
    'D':set({})
    }

for i in range(n):
    line = input()
    suit, rank = line.split()
    rank = int(rank)
    cards[suit].add(rank)

for s in ['S', 'H', 'C', 'D']:
    for r in fullcards[s] - cards[s]:
        print('%s %d' % (s, r) )

Measured memory_bytes: 7744
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int a,b;
    cin>>a>>b;
    if(a>b){
        cout<<a-b;
    }else{
        cout<<0;
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

int digit(int A, int B) {
    int ans1 = 0, ans2 = 0;
    while(A > 0) {ans1++; A /= 10;}
    while(B > 0) {ans2++; B /= 10;}
    return max(ans1, ans2);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int ans = INF;
    for(int i = 1; i * i <= N; i++) {
        if (N % i == 0)
            ans = min(ans, digit(i, N / i));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public void cubic() {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
  //      System.out.println(a*b);
        System.out.println(a*b+" "+(a*2+b*2));
    }
    
    public static void main(String[] args){
    new Main().cubic();
    }
}

Measured memory_bytes: 17160
N = int(input())
l = [ list(map(int,input().split())) for _ in range(N)]
k = 0
for i in range(N):
    if l[i][0] == l[i][1]:
        k += 1
    else:
        k = 0
    if k == 3:
        print('Yes')
        exit()
print('No')


Measured memory_bytes: 9108
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = [inpl() for _ in range(n)]
a = [x == y for x,y in a]
res = False
for i in range(n-2):
    if sum(a[i:i+3]) == 3:
        res = True
print('Yes' if res else 'No')

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

int main() {
  int a, b, c;
  std::cin >> a >> b >> c;

  int n = 0;
  for (;a<=b;a++)
    if (c % a == 0)
      n++;

  std::cout << n << std::endl;
  return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template <typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template <typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}



const int max_n_com = 51;
ve<vl> combination(max_n_com,vl(max_n_com,-1));
ll comb(int a, int b){
    
    if(combination[a][b] > 0) return combination[a][b];
    else if(a < b) return 0;
    else if(a == 0 || b == 0 || a == b) return combination[a][b] = 1;
    else return combination[a][b] = comb(a-1,b-1) + comb(a-1,b);
    
    
}




int main()
{
    int N,A,B;
    cin >> N >> A >> B;
    vl v(N);
    in(N,v);
    sort(all(v));
    reverse(all(v));
    
    
    ll a = 0;
    map<ll,int> V;
    rep(i,A) a += v[i],V[v[i]]++;
    ld ave = (ld)(a) / (ld)(A);

    outset(10);
    cout << ave << endl;
    

    if(V.size() == 1){
        
        ll ans = 0;
        int aa = V[v[A-1]];
        reps(i,A,N){
            if(v[A-1] == v[i]) V[v[i]]++;
            else break;
        }
        reps(i,A,B+1){
            ans += comb(V[v[A-1]],i);
            //cout << V[v[A-1]] csp i << endl;
        }
        
        cout << ans << endl;
        
        
        
    }else{
        int aa = V[v[A-1]];
        reps(i,A,N){
            if(v[A-1] == v[i]) V[v[i]]++;
            else break;
        }
        
        cout << comb(V[v[A-1]], aa) << endl;
        //cout << V[v[A-1]] csp aa << endl;
    }
    
    
    
    
    

    return 0;
}


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




//----------------------------MACROS-------------------------------------------------
#define pb insert//                                                                 |
#define eb emplace_back//                                                           |
#define ff first//                                                                  |
#define ss second//                                                                 |
typedef long long int ll;//                                                         |
typedef long double ld;//                                                           |
#define all(a) a.begin(), a.end()//                                                 |
#define show(x) cerr << #x << " is " << x << "\n"//                                 |
#define show2(x, y) cerr << #x << " " << #y << " " << x << " " << y << "\n"//       |
typedef vector<ll> vl;//                                                            |
typedef vector<vl> vvl;//                                                           |
typedef pair<ll, ll> pp;//                                                          |
typedef vector<pp> vp;//                                                            |
typedef map<pp, ll> ipi;//                                                          |
typedef map<pp, char> ipc;//                                                        |
typedef map<ll, ll> ii;//                                                           |
typedef set<ll> sl;//                                                               |
typedef multiset<ll> msl;//                                                         |
typedef map<char, ll> ci;//                                                         |
typedef set<pair<ll, ll>> sp;//                                                     |
const ll mod = 1e9 + 7;//                                                           |
const ll N = 2e6 + 1;//                                                             |
//----------------------------------------------------------------------------------




//main func
void solve()
{
       
    ll a,b;cin>>a>>b;
    vl cnt(a+1,0);
    ii m;
    for(int i=0;i<b;i++){
        ll k;cin>>k;
        m[k]=1;
    }
    
    cnt[0]=1;
    if(!m[1])
    cnt[1]=1;
    for(int i=2;i<=a;i++){
        if(!m[i])
        cnt[i]=(cnt[i-1]+cnt[i-2])%mod;
        //show2(cnt[i],i);
    }
    cout<<cnt[a]<<"\n";
}




int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    
    ll t;
    t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    
	return 0;
}


Measured memory_bytes: 10252
n = gets.to_i
t = Array.new(n)
a = Array.new(n)
x = 1
y = 1
n.times{|i|
    t[i], a[i] = gets.split.map(&:to_i)
    tmp1x = ((x - 1) / t[i] + 1) * t[i]
    tmp1y = tmp1x / t[i] * a[i]
    tmp2y = ((y - 1) / a[i] + 1) * a[i]
    tmp2x = tmp2y / a[i] * t[i]
    f1 = tmp1y >= y
    f2 = tmp2x >= x
    if f1
        x = tmp1x
        y = tmp1y
    else
        x = tmp2x
        y = tmp2y
    end
    }
p x + y

Measured memory_bytes: 1788
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    s = input()
    t = input()

    sn = ''
    c_n = {}
    for i in s:
        if i not in c_n:
            c_n[i] = len(c_n)
        sn += str(c_n[i])
    
    tn = ''
    c_n = {}
    for i in t:
        if i not in c_n:
            c_n[i] = len(c_n)
        tn += str(c_n[i])


    if sn == tn:
        print('Yes')
    else:
        print('No')


solve()


Measured memory_bytes: 4144
using System;
using System.Linq;

namespace _174b
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] input = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long number = 0;
            for(int i = 0; i < input[0]; i++)
            {
                long[] point = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
                var distance = Math.Sqrt(Math.Pow((double)point[0], 2) + Math.Pow((double)point[1], 2));
                if(distance <= input[1])
                {
                    number++;
                }
            }
            Console.WriteLine(number);
            
        }
    }
}


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

using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL << 60;
ll dp[100010][3];

int main(){

  int n;cin>>n;
  int a[100010][3];
  rep(i,0,n){
    rep(j,0,3){
      cin>>a[i][j];
    }
  }

  rep(i,0,n){
    rep(j,0,3){
      rep(k,0,3){
        if(j==k)continue;
        chmax(dp[i+1][k],dp[i][j]+a[i][k]);
      }
    }
  }

  ll ans=0;
  rep(j,0,3)chmax(ans,dp[n][j]);

  out(ans);

  return 0;
}


Measured memory_bytes: 3712
//    https://youtu.be/mRHBP3xwgn4

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

typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
typedef pair<long long, long long> pll;
const long long inf = 2000000000000000000LL;	// 2e18
#define pi                  acos(-1.0)
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define shesh               "\n"
#define ff                  first
#define ss                  second
#define pb                  push_back
#define bp                  pop_back
#define pf                  push_front
#define fp                  pop_front
#define ub                  upper_bound
#define lb                  lower_bound
#define all(x)              x.begin(), x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"
#define mest(a,b)           memset(a,b,sizeof(a))

int main(){
    fast;
    ll t,n,m,i,j,k;
    ld temp,flag,ans;
    cin>>n;
    ll a[n];
    for(i=0,temp=1;i<n;i++){
        cin>>a[i];
        temp*=a[i];
    }
    for(i=0,ans=0;i<n;i++){
        ans+=(temp/a[i]);
    }
    cout<<fixed<<setprecision(10)<<(ld)((ld)temp/(ld)ans);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

int main()
{
  int A[3][3];
  for (int i=0; i<3; i++) {
    for (int j=0; j<3; j++) std::cin >> A[i][j];
  }
  bool marked[3][3];
  for (int i=0; i<3; i++) {
    for (int j=0; j<3; j++) marked[i][j] = false;
  }
  int N;
  std::cin >> N;
  for (int k=0; k<N; k++) {
    int n;
    std::cin >> n;
    for (int i=0; i<3*3; i++) {
    	if (A[i/3][i%3] == n) { marked[i/3][i%3] = true; break; }
    }
  }
  bool bingo = false;
  for (int i=0; i<3; i++) {
    if (marked[i][0] && marked[i][1] && marked[i][2]) {
      bingo = true; break;
    }
  }
  for (int j=0; j<3; j++) {
    if (marked[0][j] && marked[1][j] && marked[2][j]) {
      bingo = true; break;
    }
  }
  if (marked[0][0] && marked[1][1] && marked[2][2]) bingo = true;
  if (marked[0][2] && marked[1][1] && marked[2][0]) bingo = true;
  if (bingo) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
const int maxn=100 + 2e3;
const long long mod = 1e9 + 7;

typedef pair<int,int> II;

int n, m, a[maxn], b[maxn];
long long dp[maxn][maxn];

int main()
{

//	freopen("abc.inp","r",stdin);freopen("abc.out","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();

	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	for (int i = 1; i <= m; ++i) {
		cin >> b[i];
	}
	for (int i = 0; i <= max(n, m); ++i) dp[0][i] = dp[i][0] = 1;
  for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j) {
			dp[i][j] = ((dp[i-1][j] + dp[i][j-1]) % mod - dp[i-1][j-1] + mod) % mod;
      if (a[i] == b[j]) {
        dp[i][j] += (dp[i-1][j-1]);
        dp[i][j] %= mod;
      }

		}
  }

	cout<<dp[n][m];


   return 0;
}


Measured memory_bytes: 36400
from collections import deque


def putid(nodes, edges, group_id, start):
    q = deque([start])

    while q:
        cp = q.popleft()
        if not nodes[cp]:
            nodes[cp] = group_id
            if edges[cp]:
                for edge in edges[cp]:
                    q.append(edge)


def main():
    N, M = map(int, input().split())
    edges = [[] for _ in range(N)]
    nodes = [0] * N

    for _ in range(M):
        x, y, z = map(int, input().split())
        edges[x - 1].append(y - 1)
        edges[y - 1].append(x - 1)

    ans = 0

    for i in range(N):
        if not nodes[i]:
            ans += 1
            putid(nodes, edges, ans, i)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 70048
import java.util.*;
import java.lang.*;

/**
 * FindingAWord
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String target = sc.next();
        int ans = 0;

        out_of_loop: while (true) {
            String str = sc.next();

            if (str.equals("END_OF_TEXT")) {
                break out_of_loop;
            }

            if (target.equalsIgnoreCase(str)) {
                ans++;
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 26000
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <time.h>
#include <stdio.h>
#include <vector>
#define int long long
using namespace std;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int mypow(int x, int y) {
	if (y == 0)return 1;
	if (y % 2)return mypow(x, y - 1)*x;
	else return mypow(x, y / 2)*mypow(x, y / 2);
}
int Max(int x, int y) {
	if (x > y)return x;
	else return y;
}
int Min(int x, int y) {
	if (x < y)return x;
	else return y;
}
int kai(int x) {
	int cnt=1;
	if (x == 0)return 1;
	cnt = kai(x - 1);
	return x * cnt;
}
inline void shoki()
{
	srand((unsigned int)time(NULL));
}
int prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
void prime_factor(int n){
	int cnt = 1;
	map<int, int>res;
	int m = n;
	for (int i = 2; i<= n; i++) {
		if(prime(i)){
			while (m%i == 0) {
				++res[i];
				m /= i;
			}
		}
	}
	cout << n <<":"<< endl;
	for (int i = 2; i<= n; i++) {
		if (res[i]) {
			cout << i << " " << res[i] << endl;
		}
	}
	cout << endl;
}
/*Library End!*/
int n, k, a[100005],G,ma;
signed main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		ma = Max(ma, a[i]);
	}
	G = a[0];
	for (int i = 1; i < n; i++) {
		G = gcd(a[i], G);
	}
	if (ma < k)cout << "IMPOSSIBLE" << endl;
	else if ((ma - k) % G == 0)cout << "POSSIBLE" << endl;
	else cout << "IMPOSSIBLE" << endl;
end:;
	system("PAUSE");
	return 0;
}



Measured memory_bytes: 1272
#include<bits/stdc++.h>
using namespace std;
#define foo(i,n) for(int i=0;i<n;i++)
int main(){
    char a[3][10],b[3];
    cin>>a[0]>>a[1]>>a[2];
    foo(i,3) b[i]=toupper(a[i][0]);
    cout<<b[0]<<b[1]<<b[2];

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
 
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;
}
constexpr int mod = 1e9+7;
constexpr long long inf = 3e18;

int H,W,M;
int x[300005],y[300005];
int h[300005],w[300005];
signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	cin>>H>>W>>M;
	rep(i,M){
		cin>>x[i]>>y[i];x[i]--;y[i]--;
		h[x[i]]++;w[y[i]]++;
	}
	int mxh=0,mxw=0;
	rep(i,H)chmax(mxh,h[i]);
	rep(i,W)chmax(mxw,w[i]);
	vector<int>xx,yy;
	rep(i,H)if(mxh==h[i])xx.push_back(i);
	rep(i,W)if(mxw==w[i])yy.push_back(i);
	int cnth=len(xx),cntw=len(yy);
	int cnt=0;
	rep(i,M){
		if(upper_bound(all(xx),x[i])-lower_bound(all(xx),x[i])&&upper_bound(all(yy),y[i])-lower_bound(all(yy),y[i]))cnt++;
	}
	cout<<mxh+mxw-(cnth*cntw==cnt)<<endl;
}

Measured memory_bytes: 20972
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int main()
{
	IO_OP;
	
	double w, h, x, y;
	cin >> w >> h >> x >> y;
	double a = w * h / 2;
	cout << fixed << setprecision(10) << a << " ";
	if(abs(x-w/2) < 1e-9 && abs(y-h/2) < 1e-9) cout << 1 << endl;
	else cout << 0 << endl;
	
}



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

class Program
{
    static void Main(string[] args)
    {
        long n = long.Parse(System.Console.ReadLine().Trim());
        long[][] xy = new long[n][]; 

        for(int i = 0; i < n; i++)
        {
            xy[i] = Array.ConvertAll(System.Console.ReadLine().Trim().Split(' '), long.Parse);
        }

        //全ての偶奇が同一でない場合はNG
        long parity = Math.Abs(xy[0][0] + xy[0][1]) % 2;
        for (int i = 1; i < xy.Length; i++)
        {
            if(Math.Abs(xy[i][0] + xy[i][1]) % 2 != parity)
            {

                System.Console.WriteLine("{0}",-1);
                return;
            }
        }

        //最も遠い地点の距離
        long farP = 0;
        for (int i = 0; i < xy.Length; i++)
        {
            farP = Math.Max(farP, Math.Abs(xy[i][0]) + Math.Abs(xy[i][1]));
        }

        //最長のアーム
        long d1 = (long)Math.Pow(2, (long)(Math.Log(farP - 1, 2)));

        //アームコレクション
        List<long> d = new List<long>();
        for(long i = d1;i > 0;i /= 2)
        {
            d.Add(i);
        }
        if (parity == 0) { d.Add(1); }//偶数の場合は腕を追加


        System.Console.WriteLine("{0}", d.Count);
        System.Console.WriteLine("{0}", string.Join(" ", Array.ConvertAll(d.ToArray(), i => i.ToString())));

        long x ,y;
        long distL, distR, distU, distD;
        string rlt = string.Empty;



        //出力のパターンを表示
        for (int i = 0; i < xy.Length; i++)
        {

            x = 0; y = 0;
            distL = 0; distR = 0; distU = 0; distD = 0;
            rlt = string.Empty;
  
            for (int j = 0; j < d.Count; j++)
            {
                distR = (long)Math.Pow(Math.Abs(xy[i][0] - (x + d[j])),2) + (long)Math.Pow(Math.Abs(xy[i][1] - y), 2);
                distL = (long)Math.Pow(Math.Abs(xy[i][0] - (x - d[j])), 2) + (long)Math.Pow(Math.Abs(xy[i][1] - y), 2);
                distU = (long)Math.Pow(Math.Abs(xy[i][0] - x ), 2) + (long)Math.Pow(Math.Abs(xy[i][1] - (y + d[j])), 2);
                distD = (long)Math.Pow(Math.Abs(xy[i][0] - x ), 2) + (long)Math.Pow(Math.Abs(xy[i][1] - (y - d[j])), 2);

                if (distR <= distL && distR <= distU && distR <= distD)
                {
                    rlt += "R";
                    x += d[j];
                    continue;
                }
                if (distL <= distR && distL <= distU && distL <= distD)
                {
                    rlt += "L";
                    x -= d[j];
                    continue;
                }
                if (distU <= distR && distU <= distL && distU <= distD)
                {
                    rlt += "U";
                    y += d[j];
                    continue;
                }
                if (distD <= distR && distD <= distL && distD <= distU)
                {
                    rlt += "D";
                    y -= d[j];
                    continue;
                }
            }

            System.Console.WriteLine("{0}", rlt);
        }

    }
}


Measured memory_bytes: 15428
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    char a;
    cin>>a;
    if(a>='A'&&a<='Z') cout<<'A'<<endl;
    else cout<<'a'<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

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

using namespace std;

int main(){
	string  s;
	int k,len;
	cin >> k;
	cin >> s;
	len = s.size();
	if(len <= k) cout << s << '\n';
	else{
		for(int i=0; i<k; i++) cout << s[i];
		cout << "...\n";
	}
	return 0;
}

Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define R(_x, _y) (0 <= _x && _x <= M - 1 && 0 <= _y && _y <= N - 1)
#define A(a) (!(R(x + dx[a], y + dy[a]) && b[y + dy[a]][x + dx[a]]))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
ll table[2019], t2[2019];
int main() {
	int f;
	string s, t;
	cin >> s >> t;
	for (int i = s.size() - t.size(); i >= 0; i--) {
		f = 1;
		rep(i2, 0, t.size()) {
			if (s[i + i2] != '?' && s[i + i2] != t[i2]) {
				f = 0;
				break;
			}
		}
		if (f) {
			rep(i2, 0, t.size()) {
				s[i + i2] = t[i2];
			}
			break;
		}
	}
	if (f) {
		rep(i, 0, s.size()) {
			if (s[i] == '?')s[i] = 'a';
		}
		puts(s.c_str());
	}
	else puts("UNRESTORABLE");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<long> >dp(m+1,vector<long>(1<<n,1<<30));
    for(int i=0;i<m;i++){
        dp[i][0] = 0;
    }
    vector<pair<long,long> >key(m);
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        key[i].second = a;
        key[i].first = 0;
        for(int j=0;j<b;j++){
            int c;
            cin >> c;
            key[i].first += 1<<(c-1);
        }
    }
    
    for(int i=0;i<m;i++){
        for(int j=0;j<(1<<n);j++){
            int jj= j | key[i].first;
            dp[i+1][jj] = min(min(dp[i+1][jj],dp[i][jj]),dp[i][j] + key[i].second);
            dp[i+1][j] = min(dp[i+1][j],dp[i][j]);

        }
    }
    int ans = 1<<30;
    for(int i=1;i<=m;i++){
        ans = min((long)ans,dp[i][(1<<n)-1]);
    }
    if(ans==1<<30)cout<<-1<<endl;
    else cout<<ans<<endl;
    

}

Measured memory_bytes: 35448
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] w = new int[n];
        for(int i = 0; i < n; i++) w[i] = scan.nextInt();
        int out = 10000;
        for(int i = 0; i < n; i++){
            int s1 = 0;
            int s2 = 0;
            for(int j = 0; j < n; j++){
                if(j <= i) s1 += w[j];
                else s2 += w[j];
            }
            if(out > Math.abs(s1 - s2)) out = Math.abs(s1 - s2);
        }
        System.out.println(out);
        scan.close();
    }
}


Measured memory_bytes: 27208
until ((n = gets.chomp.to_i) == 0)
    numbers = gets.chomp.split.map(&:to_i)
    mean = numbers.inject(:+) / n.to_f
    squares = numbers.map{|n| n ** 2}
    variance = 0.0
    numbers.each{|n| variance += (n - mean) ** 2}
    sd = Math.sqrt(variance / n)
    printf("%.5f\n", sd)
end

Measured memory_bytes: 8832
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	run()
}

func run() {
	setSpace()
	n, k := readN(), readN()
	hs := make([]int, n)
	for i := 0; i < n; i++ {
		hs[i] = readN()
	}
	dp := make([]int, n)
	dp[0] = 0
	dp[1] = abs(hs[0] - hs[1])

	for i := 2; i < n; i++ {
		costMin := 0
		for j := 1; j <= min(k, i); j++ {
			cost := dp[i-j] + abs(hs[i-j]-hs[i])
			if j == 1 {
				costMin = cost
			} else {
				costMin = min(costMin, cost)
			}
		}
		dp[i] = costMin
	}
	fmt.Println(dp[n-1])
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

// ------以下、ユーティリティ------

var sc = bufio.NewScanner(os.Stdin)

func setSpace() {
	sc.Split(bufio.ScanWords)
}

func read() string {
	sc.Scan()
	return sc.Text()
}

func readN() int {
	n, err := strconv.Atoi(read())
	if err != nil {
		panic(err)
	}
	return n
}


Measured memory_bytes: 2816
import java.util.*

fun main(args: Array<String>) {
	val sc = Scanner(System.`in`)
	val x = sc.nextInt()
	val y = sc.nextInt()
	var cnt = Int.MAX_VALUE

	for (i in 1..4) {
		cnt = Math.min(cnt, solve(i, x, y))
	}

	println(cnt)
}

fun solve(i: Int, x0: Int, y0: Int): Int {
	var cnt = 0
	var x = x0
	var y = y0

	if (i % 2 == 0) {
		x *= -1
		cnt++
	}

	if (i <= 2) {
		y *= -1
		cnt++
	}

	if (y - x >= 0) {
		return cnt + y - x
	}
	return Int.MAX_VALUE
}


Measured memory_bytes: 31268