akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var str = IO.GetIntList();
            var X = str[0];
            var Y = str[1];
            var Z = str[2];
            var K = str[3];

            var A = IO.GetLongList().OrderByDescending(a => a).ToArray();
            var B = IO.GetLongList().OrderByDescending(a => a).ToArray();
            var C = IO.GetLongList().OrderByDescending(a => a).ToArray();

            long[] AB = new long[X * Y];
            for(int i = 0; i < X; i++)
            {
                for(int j = 0; j < Y; j++)
                {
                    AB[i * Y + j] = (A[i] + B[j]);
                }
            }
            Array.Sort(AB);
            Array.Reverse(AB);
            var k = Math.Min(AB.Length, K);

            long[] ABC = new long[k*Z];
            for(int i = 0; i < k; i++)
            {
                for (int j = 0; j < Z; j++)
                {
                    ABC[i * Z + j] = AB[i] + C[j];
                }
            }
            Array.Sort(ABC);
            Array.Reverse(ABC);
            for(int i = 0; i < K; i++)
            {
                Console.WriteLine(ABC[i]);
            }

            //Console.WriteLine(ans);
        }
    }


    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 45280
#include <iostream>
using namespace std;
int main(){
  int x,a,b;
  cin>>x>>a>>b;
  int c=b-a;
  if(c<=0){
    cout<<"delicious";
  }else if(c<=x){
    cout<<"safe";
  }else{
    cout<<"dangerous";
  }
  return 0;
}
    

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

int main() {
    int n,ans=0;
    cin>>n;
    map<string,int> mp;
    string s;
    rep(i,n)  {
        cin>>s;
        mp[s]++;
    }
    int m;
    cin>>m;
    rep(i,m) {
        cin>>s;
        mp[s]--;
    }
    for (auto v : mp) {
        int res=v.second;
        ans=max(ans,res);
    }
    ans=max(ans,0);
    cout<<ans<<endl;
}


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

int p[10001],r[10001];

void init() {
  for(int i=0; i<10001; i++) {
    p[i]=i;
    r[i]=0;
  }
}
int find(int x) {
  if(p[x]==x) return x;
  else return p[x]=find(p[x]);
}
void unite(int x, int y) {
  x=find(x);
  y=find(y);
  if(x==y) return;
  if(r[x]<r[y]) p[x]=y;
  else {
    p[y]=x;
    if(r[x]==r[y]) r[x]++;
  }
}

bool same(int x, int y) {
  return find(x)==find(y);
}
  
int main() {
  init();
  map<string,int> a,m;
  int n;
  cin >> n;
  string s[n];
  for(int i=0; i<n; i++) {
    int x;
    cin >> s[i] >> x;
    m[s[i]]=i;
    a[s[i]]=x;
  }
  int k;
  cin >> k;
  for(int i=0; i<k; i++) {
    string s,t;
    cin >> s >> t;
    unite(m[s],m[t]);
  }
  int d[n],c[n];
  fill(d,d+n,1000000007);
  memset(c,0,sizeof(c));
  for(int i=0; i<n; i++) {
    d[find(i)]=min(d[find(i)],a[s[i]]);
    c[find(i)]++;
  }
  int ans=0;
  for(int i=0; i<n; i++) {
    if(d[i]!=1000000007) ans+=d[i]*c[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

class UnionFind{
private:
  vector<int> par, rank;
public:
  UnionFind(int n){
	par.assign(n, 0);
	rank.assign(n, 0);
	for(int i=0;i<n;++i)
	  par[i] = i;
  }

  //find root of x
  int find(int x){
	if(par[x] == x)
	  return x;
	return (par[x] = find(par[x]));
  }

  void unite(int x, int y){
	x = find(x);
	y = find(y);
	if(x == y) return;

	if(rank[x] < rank[y])
	  par[x] = y;
	else{
	  par[y] = x;
	  if(rank[x] == rank[y])
		++rank[x];
	}
  }

  bool same(int x, int y){
	return find(x) == find(y);
  }
};

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

  int N, M;
  while(cin>>N>>M,N){
	vector<PII> t(M), e(M);
	REP(i,M){
	  cin >> t[i].first >> e[i].first >> e[i].second;
	  t[i].second = i;
	}
	SORT(t);

	vector<bool> infected(N+1, false);
	infected[1] = true;
	REP(i,M){
	  int idx = t[i].second;
	  infected[e[idx].second] = infected[e[idx].second]
		||infected[e[idx].first];
	}
	cout << count(ALL(infected), true) << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 1460
n,k = map(int,input().split())
d = [0] * k
a = [0] * k
for i in range(k):
    d[i] = int(input())
    a[i] = list(map(int,input().split()))
su = [1] * n
for i in range(k):
    for j in range(d[i]):
        if su[a[i][j]-1] == 1:
            su[a[i][j]-1] = 0
print(sum (su))

Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;

const int Max = 110;
int a[2][Max];
int sum1[Max], sum2[Max];

int main(){
    int n;
    cin >> n;
    for (int i = 0; i < 2; i++){
        for (int j = 0; j < n; j++){
            cin >> a[i][j];
        }
    }
    sum1[0] = a[0][0];
    sum2[0] = a[1][0];
    for (int i = 1; i < n; i++){
        sum1[i] = sum1[i - 1] + a[0][i];
        sum2[i] = sum2[i - 1] + a[1][i];
    }

    int ans = 0;
    for (int i = 0; i < n; i++){
        ans = max(ans, sum1[i] + sum2[n - 1] - sum2[i - 1]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
int main() {
char c;
cin>>c;
if (c == 'a' or c == 'i' or c == 'u' or c == 'e' or c == 'o') cout << "vowel" << endl;
else
    cout << "consonant" << endl;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int r = 1;
  int cover = k;
  while(cover < n) {
    r++;
    cover += k-1;
  }
  printf("%d\n", r);
}


Measured memory_bytes: 256
#   AtCoder abc146_a

#   入力
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: 8940
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
using ll = long long;

constexpr int N = 400009;
int n, q, tt = 0;
vector<vector<int>> g(N);
vector<pair<int, int>> seg(N);
vector<int> cnt(N, 0), mp(N + 10), ans(N);

void dfs(int v, int p) {

    ++tt;
    seg[v].fi = tt;
    mp[tt] = v;
    for(int u : g[v]) {
        if(u != p) {
            dfs(u, v);
        }
    }
    ++tt;
    seg[v].se = tt;
    
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n >> q;
    for(int i = 1; i <= n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(1, 0);
    while(q--) {
        int p, x;
        cin >> p >> x;
        cnt[seg[p].fi] += x;
        cnt[seg[p].se] -= x;
    }
    int sum = 0;
    for(int i = 1; i < N; ++i) {
        sum += cnt[i];
        ans[mp[i]] = sum;
    }
    for(int i = 1; i <= n; ++i) {
        cout << ans[i] << ' ';
    }
    cout << '\n';
}


Measured memory_bytes: 35200
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  int a, b, c, d; cin >> a >> b >> c >> d;
  auto ans = std::min(a, b);
  ans += std::min(c, d);

  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

using namespace std;

int main() {
    int K;
    long long ans = 0;
    vector<int> temp(3);
    cin >> K;
    for (int i = 1; i<K+1; i++){
        for (int y = 1; y<K+1; y++){
            for (int z = 1; z<K+1; z++){
                ans+=__gcd(i, __gcd(y,z));
            }
        }
    }
    cout << ans << endl;
}

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

template<typename t>inline t min_(t a,t b){return a<=b?a:b;}
template<typename t>inline t max_(t a,t b){return a>=b?a:b;}
template<typename t>inline void chkmin(t&a,t b){if(a>b)a=b;}
template<typename t>inline void chkmax(t&a,t b){if(a<b)a=b;}

const int maxn=1e5+10;
int n,a,l,r;
char s[100];

int main(){
	scanf("%d",&n);
	printf("0\n");fflush(stdout);
	scanf("%s",s);
	if(s[0]=='V')
		return 0;
	if(s[0]=='M')
		a=1;
	else
		a=0;
	l=1;r=n-1;
	while(l<r){
		int mid=l+r>>1,res;
		printf("%d\n",mid);fflush(stdout);
		scanf("%s",s);
		if(s[0]=='V')
			return 0;
		if(s[0]=='M')
			res=1;
		else
			res=0;
		if((res==a)==((mid-l+1)%2==0))
			a=res,l=mid+1;
		else
			r=mid-1;
	}
	printf("%d\n",l);fflush(stdout);
	scanf("%s",s);
	return 0;
}


Measured memory_bytes: 852
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 1e5;
int N;
ll X, B[Nmax], L[Nmax], U[Nmax];

int main(){
    cin >> N >> X;
    for(int i=0; i<N; i++) cin >> B[i] >> L[i] >> U[i];

    ll behind = 0;
    for(int i=0; i<N; i++) behind += -L[i]*B[i];

    vector<pair<ll, int> > gain;
    for(int i=0; i<N; i++){
        gain.push_back({U[i]*(X-B[i])+L[i]*B[i], i});
    }
    sort(gain.begin(), gain.end());
    reverse(gain.begin(), gain.end());

    vector<ll> gain_cum(N);
    int n_top = 0;
    for(int i=0; i<N; i++){
        ll x = gain[i].first;
        int j = gain[i].second;
        gain_cum[i] = x + (i>0?gain_cum[i-1]:0);
    }
    // cout << behind << endl;
    if(behind==0){
        cout << 0 << endl;
        return 0;
    }

    ll lb=0, ub=N*X;
    while(ub-lb>1){
        ll x = (lb+ub)/2;
        ll q = x/X;
        ll r = x-q*X;
        ll sum = 0;
        for(int i=0; i<N; i++){
            int j=gain[i].second;
            ll sum_q = 0;
            if(q==0){
                sum_q += 0;
            } else if(i < q){
                sum_q += gain_cum[q] - gain[i].first;
            } else {
                sum_q += gain_cum[q-1];
            }
            ll sum_r = 0;
            if(r<=B[j]){
                sum_r += r*L[j];
            } else {
                sum_r += B[j]*L[j]+(r-B[j])*U[j];
            }
            sum = max(sum_q+sum_r, sum);
            // cout << x << " " << i << " " << q << " " << r << " " << sum_q << " " << sum_r << endl;
        }
        if(sum+behind>=0){
            ub = x;
        } else {
            lb = x;
        }
    }

    cout << ub << endl;
    return 0;
}

Measured memory_bytes: 4976
#include<bits/stdc++.h>
const double PI=3.14159265358979323846;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
int main(void){
    int n;cin>>n;
    vector<pair<int, int>> p(n);
    rep1(i,n){
        int num;cin>>num;
        p[i-1]=make_pair(num,i);
    }
    sort(p.begin(), p.end());
    for(auto itr=p.begin();itr!=p.end();++itr){
        cosp(itr->second);
    }
    cout<<"\n";

}



Measured memory_bytes: 1536
import string
import sys

input_str = ""

for i in sys.stdin:
    input_str += i

for i in range(26):
    char = string.ascii_lowercase[i]
    CHAR = string.ascii_uppercase[i]
    cnt = input_str.count(char) + input_str.count(CHAR)
    print("{0} : {1}".format(char, cnt))

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

int main(){
    int n, i, j, k;
    long int sum = 0;
    int c[5] = {};
    string s;
    cin >> n;
    for(i=0; i<n; i++){
        cin >> s;
        switch(s[0]){
            case 'M':
                c[0]++;
                break;
            case 'A':
                c[1]++;
                break;
            case 'R':
                c[2]++;
                break;
            case 'C':
                c[3]++;
                break;
            case 'H':
                c[4]++;
                break;
        }
    }
    for(i=0; i<5; i++){
        for(j=i+1; j<5; j++){
            for(k=j+1; k<5; k++){
                sum += (long int)c[i]*c[j]*c[k];
            }
        }
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int X;
  ci(X);
  int a = 0;
  repi(i, 1, 1000){
    repi(j, 2, 1000){
      if(pow(i, j) <= X){
        int c = pow(i, j);
        a = max(a, c);
      }
    }
  }
  co(a);
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    ll N;
    cin >> N;
    vector<ll> a(N);
    REP(i, N) cin >> a[i];
    ll S = 0;
    REP(i, N) S += a[i];

    if(N%2){
    	if(S%2){
    		cout << "First" << endl;
    	}else{
    		cout << "Second" << endl;
    	}
    }else{
    	ll u = a[0];
    	REP(i, N){
    		chmin(u, a[i]);
    	}
    	if(u%2){
    		cout << "First" << endl;
    	}else{
    		if(S%2){
    			 cout << "First" << endl;
	    	}else{
	    		cout << "Second" << endl;
	    	}
    	}
    }
    return 0;
}


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

typedef long long ll;
const int mod = 1e9 + 7;
const int INF = 1e9;

void solve() {
    int k, x, y;
    cin >> k >> x >> y;
 
    if (k % 2 == 0 && (x + y) % 2 != 0) {
        cout << -1 << endl;
        return;
    }
 
    bool xneg = false, yneg = false;
    if (x < 0) {
        xneg = true;
        x = -x;
    }
    if (y < 0) {
        yneg = true;
        y = -y;
    }
 
    vector<pair<int, int> > ans{{x, y}};
    while (x >= k) {
        x -= k;
        ans.emplace_back(x, y);
    }
    while (y >= k) {
        y -= k;
        ans.emplace_back(x, y);
    }
    if (ans.size() > 1 && x + y < k) {
        ans.pop_back();
        tie(x, y) = ans.back();
    }
 
    if (x + y != k) {
        bool iyneg = false;
        if ((x + y) % 2 == 1) {
            y -= k;
            ans.emplace_back(x, y);
            if (y < 0) {
                iyneg = true;
                y = -y;
            }
        }
 
        int nx, ny;
        ny = -(k - (x + y) / 2);
        nx = k + ny;
        if (x < y) swap(nx, ny);
 
        if (iyneg) ny = -ny;
        ans.emplace_back(nx, ny);
    }
 
    reverse(ans.begin(), ans.end());
    cout << ans.size() << endl;
    for (auto p : ans) {
        cout << p.first * (xneg ? -1 : 1) << " " << p.second * (yneg ? -1 : 1) << endl;
    }
}
 
int main() {
    solve();
    return 0;
}


Measured memory_bytes: 3952
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する


int main() {
    ll dp[51][10001] = {};
    int zero = 5000;
    dp[0][zero] = 1;

    int n;
    int a;
    cin >> n >> a;
    vector<int> v(n);

    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        v[i] = tmp - a;
    }

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

    cout << dp[n][zero] - 1 << endl;

//    for (int i = 0; i <= n; i++) {
//        for (int j = zero - 5; j <= zero + 5; j++) {
//            cout << dp[i][j] << " ";
//        }
//        cout << endl;
//    }

    return 0;
}


Measured memory_bytes: 4224
while True:
  N,Q = map(int,input().split())
  if N+Q==0:
    break
  date = [0 for i in range(1000)]
  for i in range(N):
    M = list(map(int,input().split()))
    for i in M[1:]:
      date[i]+=1
  a = max(date)
  if a>=N:
    for i in range(1000):
      if N==date[i]:
        print(i)
        break
  elif N>a>=Q:
    for i in range(1000):
      if a==date[i]:
        print(i)
        break
  else:
    print(0)


Measured memory_bytes: 5636
#include<bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
#define eps 1e-8
#define pb push_back
#define endl '\n'
using namespace std;
const ll maxn = 2e6 + 5;
ll num[maxn],t,n,m,k,ans;
ll r[maxn],b[maxn],g[maxn];
char str[maxn];
int main()
{
    cin >> n >> (str + 1);
    for(int i = 1; i <= n; i++){
        if(str[i] == 'R')
            r[i] = r[i - 1] + 1;
        else r[i] = r[i - 1];
        if(str[i] == 'B')
            b[i] = b[i - 1] + 1;
        else b[i] = b[i - 1];
        if(str[i] == 'G')
            g[i] = g[i - 1] + 1;
        else g[i] = g[i - 1];
    }
    for(int i = 3; i <= n; i++){
        for(int j = i - 1; j >= 2; j--){
            if(str[j] != str[i]){
                ll t = 0,idx = j - i + j;
                if(idx >= 1 && str[idx] != str[i] && str[idx] != str[j])
                    t--;
                if((str[i] == 'R' && str[j] == 'B') || (str[i] == 'B' && str[j] == 'R'))
                    ans += t + g[j - 1];
                if((str[i] == 'R' && str[j] == 'G') || (str[i] == 'G' && str[j] == 'R'))
                    ans += t + b[j - 1];
                if((str[i] == 'G' && str[j] == 'B') || (str[i] == 'B' && str[j] == 'G'))
                    ans += t + r[j - 1];
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3740
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
	int n,k;
	int i;
	int d;
	int j;
	int a[100]={0};
	int temp;
	int ans=0;
	
	scanf("%d %d",&n,&k);
	for(i=0;i<k;i++){
		scanf("%d",&d);
		for(j=0;j<d;j++){
			scanf("%d",&temp);
			a[temp-1]++;
		}
	}
	for(i=0;i<n;i++){
		if(a[i]==0){
			ans++;
		}
	}
	printf("%d",ans);

	return 0;
}


Measured memory_bytes: 1736
#include<stdio.h>
#include<algorithm>

using namespace std;

int main() {
	int n, x, l, count = 1, ball = 0;
	scanf("%d%d",&n,&x);
	for(int i = 0; i < n; ++i){
	  scanf("%d", &l);
	  ball += l;
	  if(ball <= x){
	    ++count;
		}else{
		  break;
		}
	}
	printf("%d",count);
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head=0, tail=0, n;

void enqueue(P x){
  Q[tail]=x;
  if(tail+1==LEN)tail=0;
  else tail=tail+1; 
}

P dequeue(void){
  P x;
  x=Q[head];
  if(head+1==LEN)head=0;
  else head=head+1;
  return x;
}

int main(){
  int time=0, c;
  int i, j;
  P p;
  scanf("%d %d",&n,&j);

  for(i=1;i<=n;i++){
    scanf("%s %d",Q[i].name, &Q[i].t);
  }
  head = 1;
  tail =n+1;

  while(head != tail){
    p = dequeue();
    if(j<p.t)c=j;
    else c=p.t;
    p.t=p.t-c;
    time=time+c;
    if(p.t>0)enqueue(p);
    else{
      printf("%s %d\n",p.name,time);
    }
  }

  return 0;
}

Measured memory_bytes: 10756
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <iomanip>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;
int main()
    {
            int a,b,c,x,y;
            cin>>a>>b>>c>>x>>y;
            ll sum=1e9,total;
            for(int i=0;i<150000;i++){
                total=i*2*c+a*max(0,x-i)+b*max(0,y-i);
                if(total<sum)
                sum=total;
            }
            cout<<sum<<endl;
            return 0;
    }

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

//#define DEBUG
#ifdef DEBUG
#define debug_printf printf
#else
#define debug_printf 1 ? 0 : printf
#endif

typedef long long int ll;
typedef vector<ll> Vl;
typedef vector<int> Vi;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pl;

#define FST first
#define SND second

const int MAX_N = 100000;                  // 10^5
// const int MAX_N = 100000;                  // 10^5
// const int MAX_N = 1000000000;              // 10^9
// const ll  MAX_N = 1000000000000000000;     // 10^18
// const int BASE  = 1000000000 + 7;          // 10^9 + 7
// const int INFI  = 1000000000 + 7;          // 10^9 + 7
// const ll INFL  = 1000000000000000000 + 7; // 10^18 + 7

int N;
ll A[MAX_N + 1], B[MAX_N + 1];

class union_find {
private:
  static const int max_n = MAX_N;
  int par[max_n];
public:
  void init(int n) {
    for (int x = 0; x < n; x++) par[x] = x;
  }
  int find(int x) {
    return (par[x] == x)? x: par[x] = find(par[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x != y) par[y] = x;
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
};

bool check() {
  map<ll, int> mp;
  for (int i = 0; i <= N; i++) mp[A[i]]++;

  for (int i = 0; i <= N; i++) {
    if (mp[B[i]] == 0) return false;
    mp[B[i]]--;
  }

  return true;
}

int calc() {
  A[N] = B[N] = 0;
  for (int i = 0; i < N; i++) {
    A[N] ^= A[i]; B[N] ^= B[i];
  }

  if(!check()) return -1;

  map<ll, int> mp;
  int id = 0;
  for (int i = 0; i <= N; i++) {
    if (A[i] != B[i]) {
      if (mp.count(A[i]) == 0) mp[A[i]] = id++;
      if (mp.count(B[i]) == 0) mp[B[i]] = id++;
    }
  }

#ifdef DEBUG
  for (auto kv : mp) {
    cout << kv.first << " : " << kv.second << endl;
  }
#endif

  union_find uft;
  uft.init(id);
  for (int i = 0; i <= N; i++) {
    if (A[i] != B[i]) uft.unite(mp[A[i]], mp[B[i]]);
  }

  int e = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] != B[i]) e++;
  }

  int c = 0;
  for (int i = 0; i < id; i++) {
    if (uft.find(i) == i) c++;
  }

#ifdef DEBUG
  cout << e << ", " << c << endl;
#endif

  return (mp.count(A[N]) == 0)? e + c: e + c - 1;
}

void solve() {
  cout << calc() << endl;
}

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) cin >> B[i];

  solve();

  return 0;
}


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

int W_sum(vector<int> W , int N){
	int sum = 0 ;
  	for ( int i = 0 ; i < N ; i++){
    	sum += W.at(i);
    }
  	return sum;
}

int main() {

  int N;
  cin >> N;
  
  vector<int> W(N);
  for ( int i = 0 ; i < N ; i++){
  	cin >> W.at(i);
  }
  
  int sumAll = W_sum(W,N);
  int minSum = sumAll;
  vector<int> W_divide(N-1);
  	for ( int t = 0 ; t < N-1 ; t++ ){
    	W_divide.at(t) = abs( W_sum(W,t+1) - ( sumAll - W_sum(W,t+1) ) );
    	if( W_divide.at(t) < minSum )
          minSum = W_divide.at(t);
    }
  
  cout << minSum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 510000
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < n; ++i)
#define all(x) x.begin(), x.end()
int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, ans = 0;
    cin >> n;
    vector<ll> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(all(a));
    rep(i, 1, n)
        ans += a[n - 1 - (i / 2)];
    cout << ans << endl;
}


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

using namespace std;

#define int long long 
#define INF 21000000000



signed main(){
		string ans = "Yes";
		string s;
		cin >> s;
		for(int i=0;i<s.length();i++){
				if(i%2 == 0 && s[i] == 'L'){
						ans = "No";
						break;
				}
				if(i%2 == 1 && s[i] == 'R'){
						ans = "No";
						break;
				}
		}
		cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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; }

vector<ll> v;

void enum_div(ll n)//nの約数を列挙
{
	for(ll i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			v.push_back(i);
			if(i!=1 && i*i!=n)
			{
				v.push_back(n/i);
			}
		}
	}
}


int main() {
  ll N;
  scanf("%lld", &N);

  enum_div(N);
  int ans = pow(10,9);

  FOR(i,0,SZ(v)-1){
    ll a = v[i];
    ll b = N/v[i];
    int counta = 0, countb = 0;
    while(a>0){
      a /= 10;
      ++counta;
    }
    while(b>0){
      b /= 10;
      ++countb;
    }
    int min_count = max(counta,countb);
    chmin(ans,min_count);


  }

  cout << ans << endl;
  

}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		int ans;

		if (a == b) {
			if (c == a) {
				ans = 1;
			} else {
				ans = 2;
			}
		} else {
			if (b == c || c == a) {
				ans = 2;
			} else {
				ans = 3;
			}
		}

		System.out.println(ans);
		sc.close();
	}

}


Measured memory_bytes: 23764
N, M = map(int, input().split())
lr = [tuple(map(int, input().split())) for _ in range(M)]

s = [0] * (N + 1)
for i in range(M):
    l, r = lr[i]
    s[l - 1] += 1
    if r != N + 2:
        s[r] -= 1

ruiseki = [0] * (N + 2)
for i in range(N + 1):
    ruiseki[i + 1] += ruiseki[i] + s[i]

#max_ = max(ruiseki)
print(ruiseki.count(M))

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int md = 998244353;

void add(int &a, int b) {
    a += b;
    if (a >= md) a -= md;
}

void sub(int &a, int b) {
    a -= b;
    if (a < 0) a += md;
}

int mul(int a, int b) {
    return ((ll)a * b) % md;
}

int power(int a, ll b) {
    int res = 1;
    while (b > 0) {
        if (b & 1) res = mul(res, a);
        a = mul(a, a);
        b >>= 1;
    }
    return res;
}

int inv(int a) {
    return power(a, md - 2);
}

const int N = 1e6 + 7;

int cnt[N];
int sum[N], pr[N], num[N];
int meb[N];

int rofl[N];

void init() {
    meb[1] = 1;
    for (int i = 1; i < N; ++i) {
        for (int j = 2 * i; j < N; j += i) {
            meb[j] -= meb[i];
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    init();
    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        ++cnt[a[i]];
    }
    for (int i = 1; i < N; ++i) {
        for (int j = i; j < N; j += i) {
            num[i] += cnt[j];
            int sm = mul(j, cnt[j]);
            int np = (((ll)cnt[j] * (cnt[j] - 1)) / 2) % md;
            add(pr[i], mul(sm, sum[i]));
            add(pr[i], mul(np, mul(j, j)));
            add(sum[i], sm);
        }
    }

    for (int i = 1; i < N; ++i) {
        for (int j = i; j < N; j += i) {
            if (meb[j / i] == 1) {
                add(rofl[i], pr[j]);
            } else if (meb[j / i] == -1) {
                sub(rofl[i], pr[j]);
            }
        }
    }
    int res = 0;
    for (int i = 1; i < N; ++i) {
        add(res, mul(rofl[i], inv(i)));
    }
    cout << res << '\n';
}

Measured memory_bytes: 24448
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int  main(){
 int a,b;
 cin >> a >> b;
for(int i=(b-a+1);i<=(b+a-1);i++){
  cout << i << " ";
}
cout << 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 rep2(i, s, n) for (int i = s; i < (int)(n); i++)

int main() {
  int64_t n,m;
  cin >> n >> m;
  vector<pair<int64_t,int64_t>> a(n);
  rep(i,n)
    cin >> a[i].first >> a[i].second;
  
  sort(a.begin(),a.end());
  int64_t count = 0;
  int64_t money = 0;
  
  rep(i,n){
    count += a[i].second;
    money += a[i].first*a[i].second;
    if(count > m){
      int64_t k=count-m;
      money -= a[i].first*k;
      break;
    }
  }
  
  cout << money << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define drep2(j,n) for(int j = (n)-1; j >= 0; --j)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define srep2(j,s,t) for (int j = s; j < t; ++j)
#define srep3(k,s,t) for (int k = s; j < t; ++k)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int a,b,c,d,e,k;
  int minp = 9999;
  int maxp = -9999;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  cin >> k;
  minp = min(minp,a);
  minp = min(minp,b);
  minp = min(minp,c);
  minp = min(minp,d);
  minp = min(minp,e);
  maxp = max(maxp,a);
  maxp = max(maxp,b);
  maxp = max(maxp,c);
  maxp = max(maxp,d);
  maxp = max(maxp,e);
  if(maxp - minp <= k) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
	string S;
	cin >> S;
	long long int K;
	cin >> K;
	string S2 = S + S;
	long long int ans = 0, cnt = 0;
	for(int i = 1; i < S.size(); i++){
		if(S2[i - 1] == S2[i]){
			S2[i] = '.';
			ans += 1;
		}
	}
	for(int i = S.size(); i < S2.size(); i++){
		if(S2[i - 1] == S2[i]){
			S2[i] = '.';
			cnt += 1;
		}
	}
	if(S2[S.size() - 1] == S2[S.size() * 2 - 1]){
		cout << ans + cnt * (K - 1) << endl;
	}else{
		long long int num = (ans + cnt) * (K / 2);
		if(K % 2 == 1){
			num += ans;
		}
		cout << num << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {

  val Array(n, m, x, y) = StdIn.readLine().split(" ").map(_.toInt)

  val xm = StdIn.readLine().split(" ").map(_.toInt).sorted.max
  val ymin = StdIn.readLine().split(" ").map(_.toInt).sorted.min

  println(if ((x + 1 to y).exists(k => xm < k && k <= ymin && xm < ymin)) "No War" else "War")
  
}

Measured memory_bytes: 27456
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    int x=a[0],y=a[1];
    vector<int> v;
    for(int i=1;i*i<=x;i++){
        if(x%i==0){
            v.pb(i);
            v.pb(x/i);
        }
    }
    for(int i=1;i*i<=y;i++){
        if(y%i==0){
            v.pb(i);
            v.pb(y/i);
        }
    }
    sort(be(v));
    bool maki;
    for(int i=v.size()-1;i>=0;i--){
        maki=false;
        for(int j=0;j<n;j++){
            if(a[j]%v[i]){
                if(maki){
                    j=n;
                }
                else{
                    maki=true;
                }
            }
            if(j==n-1){
                printf("%d\n", v[i]);
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 640
import bisect, collections, copy, heapq, itertools, math, numpy, string
import sys
from bisect import bisect_left, bisect_right, insort
from collections import deque
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def MS(): return map(str, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
# N = I()
# A = [LI() for _ in range(N)]

N = S()
if N.isupper():
    print('A')
else:
    print('a')

Measured memory_bytes: 27216
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int q;
    int l[100010], r[100010];
    cin >> q;
    imfor(i, q) {
        cin >> l[i] >> r[i];
    }
    bool f[100010];
    fill(f, f + 100000, true);
    f[0] = false;
    f[1] = false;
    for (int i = 2; i <= 100000; i++) {
        if (f[i] == true) {
            for (int j = 2 * i; j <= 100000; j += i) {
                f[j] = false;
            }
        }
    }
    int c[100010];
    fill(c, c + 100000, 0);
    c[1] = 0;
    for (int i = 3; i <= 100000; i += 2) {
        if (f[i] && f[(i + 1) / 2]) {
            c[i] = c[i - 2] + 1;
        }
        else {
            c[i] = c[i - 2];
        }
    }
    imfor(i, q) {
        if (l[i] != 1) {
            cout << c[r[i]] - c[l[i] - 2] << endl;
        }
        else {
            cout << c[r[i]] << endl;
        }
    }
}

Measured memory_bytes: 1920
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>

#define maxn 505

using namespace std;

inline int getint()
{
	int num=0,flag=1;char c;
	while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;
	while(c>='0'&&c<='9')num=num*10+c-48,c=getchar();
	return num*flag;
}

int n;
int p[maxn],f[maxn],a[maxn*maxn];
inline bool cmp(int x,int y){return p[x]<p[y];}

int main()
{
	while(~scanf("%d",&n))
	{
		for(int i=1;i<=n;i++)p[i]=getint(),f[i]=i;
		sort(f+1,f+n+1,cmp);
		int now=1,flag=0;
		for(int i=1;i<=n;i++)
		{
			a[p[f[i]]]=f[i];
			for(int j=1;j<f[i];j++)
			{
				while(a[now])now++;
				a[now]=f[i];
			}
			if(now>p[f[i]]){puts("No");flag=1;break;}
		}
		if(flag)continue;
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n-f[i];j++)
			{
				while(a[now])now++;
				if(now<p[f[i]]){puts("No");flag=1;break;}
				a[now]=f[i];
			}
			if(flag)break;
		}
		if(!flag)
		{
			puts("Yes");
			for(int i=1;i<=n*n;i++)printf("%d%c",a[i],i==n*n?10:32);
		}
	}
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std ;
int main()
{

	int n ;
	cin >> n ;
	int answer = 0 ;
	for(int i =0;i<n;i++)
	{
		int num ;
		cin >> num ;
		while(num%2==0)
		{
			num/=2 ;
			answer++;
		}
	}
	cout<<answer<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>

using namespace std;
const int maxn = 1e5 + 7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
typedef long long ll;

string s;
string a, b;
int main(){
	cin >> s;
	int n = s.length();
	a = s.substr(0, (n - 1) / 2);
	b = s.substr((n + 3) / 2 - 1, (n - 1) / 2);
	bool ok = 1;
	for(int i = 0; i < n / 2; i++){
		if(s[i] != s[n - i - 1]) ok = 0;
	}
	n = a.length();
	for(int i = 0; i < n / 2; i++){
		if(a[i] != a[n - i - 1]) ok = 0;
		if(b[i] != b[n - i - 1]) ok = 0;
	}
	if(ok) cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	int N, K, d;
	cin >> N >> K;
	vector<int> vec(N);

	rep (i, K)
	{
		cin >> d;
		rep(j, d)
		{
			int temp;
			cin >> temp;
			vec[temp - 1] = 1;
		}
	}

	int ans = 0;
	rep(i, sz(vec))
	{
		if(vec[i] == 0)
			ans++;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3652
from collections import defaultdict
import numpy as np

d0 = defaultdict(set)
d1 = defaultdict(set)
s = input()
t = input()

# s->t, t->sで異なるマッピングがなければ良い
for i, s_ in enumerate(s):
    d0[s_].add(t[i])
for i, t_ in enumerate(t):
    d1[t_].add(s[i])

result = []
for key in d0:
    result.append(len(d0[key]))
for key in d1:
    result.append(len(d1[key]))
if np.max(result) >= 2:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 13120
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
template<class T>istream&operator >>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<class T>inline void OUT(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void OUT(T t,Ts... ts){cout<<t<<" ";OUT(ts...);}
template<typename T=int>vector<T>mv(size_t a){return vector<T>(a);}
template<typename T=int,typename... Ts>auto mv(size_t a,Ts... ts){return vector<decltype(mv<T>(ts...))>(a,mv<T>(ts...));}
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type FILL(T&t,const V&v){t=v;}
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type FILL(T&t,const V&v){for(auto &e:t)FILL(e,v);}
constexpr long long INF = 1e18;

signed main(){
	int N,M;
	cin>>N>>M;
	vector<vector<int>>g(N);
	map<pair<int,int>,int>mp;
	auto p = [](int a,int b)->pair<int,int>{return {min(a,b),max(a,b)};};
	REP(i,M){
		int a,b;cin>>a>>b;a--;b--;
		g[a].push_back(b);g[b].push_back(a);
		mp[p(a,b)]=0;
	}
	if(M&1){OUT(-1);return 0;}
	vector<int>used(N);
	vector<pair<int,int>>ans;
	auto dfs = [&](auto&&f,int now,int par)->void{
		used[now]=1;
		int cnt = 0;
		for(auto e:g[now]){
			if(used[e])continue;
			f(f,e,now);
		}
		for(auto e:g[now])if(mp[p(now,e)]==0)++cnt;
		for(auto e:g[now]){
			if(mp[p(now,e)]==0){
				if(cnt%2&&e==par)continue;
				mp[p(now,e)]=1;
				ans.push_back({now,e});
			}
		}
	};
	dfs(dfs,0,-1);
	for(auto e:ans)OUT(1+e.first,1+e.second);
}	


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

int main() {
	int n; cin>>n;
	vector<int> c(n,0), s=c, f=c;
	for (int i=0; i<n-1; i++)
		cin>>c[i]>>s[i]>>f[i];
	for (int i=0; i<n; i++) {
		int t=0;
		for (int j=i; j<n-1; j++)
			t=max(s[j],(t+f[j]-1)/f[j]*f[j])+c[j];
		cout<<t<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   vector<int> a(3,0);
   cin >> a[0] >> a[1] >> a[2];
   cout << (*max_element(a.begin(),a.end()) - *min_element(a.begin(),a.end()))<< endl;
   return 0;
}


Measured memory_bytes: 256