akhauriyash/Code-Regression huggingface dataset:
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, K;
    cin >> N >> K;
    if (K > (N-1) * (N-2) / 2) {
        cout << -1 << endl;
        return 0;
    }

    vector<P> ans;
    for (int i = 1; i <= N-1; i++) ans.push_back({i, N});
    int k = (N-1) * (N-2) / 2;

    bool finish = false;
    for (int i = N - 2; i >= 1; i--) {
        for (int j = N - 1; j > i; j--) {
            if (k == K) {
                finish = true;
                break;
            }

            ans.push_back({i, j});
            k--;
        }

        if (finish) break;
    }

    cout << ans.size() << endl;
    for (P p : ans) {
        cout << p.first << " " << p.second << endl;
    }

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char str;
  cin >> str;
  if(str == 'a' || str == 'i' || str == 'u' || str == 'e' || str == 'o'){
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#define LL long long
#define il inline
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define fast_oi ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define CL(a,b) memset(a, b, sizeof(a))
using namespace std;
const int N = 1e5 + 7, MAXN = 1e6 + 7, INF = 0x3f3f3f3f;
LL fpow(LL a, LL b, LL p){LL ans = 1LL; while(b){if(b & 1) ans = ans * a % p; b >>= 1; a = a * a % p;} return ans % p;}
template <class T>
inline void read(T &ret){
    char c;ret = 0;
    while ((c = getchar()) < '0' || c > '9');
    while (c >= '0' && c <= '9'){
        ret = ret * 10 + (c - '0'), c = getchar();
    }
}
int n;
int a[N];
int main(){
    read(n);
    bool allzero = 1;
    for(int i = 1; i <= n; i ++){
        read(a[i]); allzero &= a[i] == 0;
    }
    if(allzero) { puts("Yes"); return 0;}
    if(n % 3) {puts("No");return 0;}
    sort(a + 1, a + n + 1);
    bool ok = 1;
    for(int i = 0; i <= 2; i ++){
        bool same = 1;
        for(int j = 2; j <= n / 3; j ++)
            same &= a[j + n / 3 * i] == a[j - 1 + n / 3  * i];
        if(!same) {ok = false;break;}
    }
    if((a[1] ^ a[1 + n / 3] ^ a[1 + 2 * n / 3]) == 0 && ok) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int a,b,n,x,y,z,i=0,ans=0,c=0;
    string s;
    cin >> n;
    if(n%2==0)
    {
        cout << n/2 << endl;
    }
    else
    {
        cout << n/2+1 << endl;   
    }
    return 0;
}


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

int main() {
  int64_t n;
  cin>>n;
  if(n==0){cout<<2<<endl;}
  else if(n==1){cout<<1<<endl;}
  else{int64_t x=2,y=1,z;
      for(int i=0;i<n-1;i++){
      z=x+y;
      x=y;y=z;}
      cout<<z<<endl;}
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int a, b, sum;
	int n;

	while (scanf("%d %d", &a, &b) != EOF){
		sum = a + b;
		n = 0;
		
		while (sum){
			sum = sum / 10;
			n++;
		}
		printf("%d\n", n);
	}
	return 0;
}

Measured memory_bytes: 600
n=int(input())
ans=""
l=["z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
ans=""
while n>0:
    ans=l[(n%26)]+ans
    if n%26==0:
        n-=1
    n//=26
print(ans)









Measured memory_bytes: 9180
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String line = reader.readLine();
			String[] str = line.split(" ", -1);
			int n = Integer.parseInt(str[0]);
			int x = Integer.parseInt(str[1]);
			if(n == 0 && x == 0){
				break;
			}
			int count = 0;
			int a = 1;
			int b = 2;
			int c = 3;
			while(true){
				c = x - (a + b);
				if(c > n){
					b++;
				}else{
					if(b >= c){
						a++;
						if(a == n - 1){
							break;
						}else{
							b = a + 1;
						}
					}else{
					count++;
					b++;
					}
				}
			}
			System.out.println(count);
		}
	}
}

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

using namespace std;
const int U = 100004;
typedef long long int ll;
typedef pair<ll,ll> PLL;
ll n,hp,d,h,maxhp,damage,ans;
deque<PLL> izumi;
int main(){
	scanf("%lld%lld",&n,&hp);
	maxhp = hp;
	for(int i = 0;i < n-1;i++){
		scanf("%lld%lld",&d,&h);
		while(!izumi.empty() && izumi.back().first < h){
			izumi.pop_back();
		}
		izumi.push_back(PLL(h,damage));
		damage += d;
		while(hp <= damage){
			ll tmphp = hp;
			while(!izumi.empty() &&
			tmphp + izumi.front().first - izumi.front().second > maxhp){
				hp = max(hp,izumi.front().second + maxhp);
				izumi.pop_front();
			}
			if(!izumi.empty()){
				hp = max(hp,tmphp + izumi.front().first);
				int tmp = max(0ll,min((damage-hp)/izumi.front().first,
				(izumi.front().second + maxhp - hp ) / izumi.front().first));
				ans += tmp;
				hp += tmp * izumi.front().first;
			}
			ans++;
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1212
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L

#define long long long int

using std::vector;
using std::map;
using std::set;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

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

    string s;
    cin >> s;
    int w;
    cin >> w;
    for (int i = 0; i < s.size(); i += w) {
        cout << s[i];        
    }

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,N) for(ll i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll x;

int main(){
    cin >> x;
    ll cnt = 1;
    ll sum = 0;
    while(1){
        sum += cnt;
        if(sum >= x){
            cout << cnt << endl;
            return 0;
        }
        cnt++;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<long long , long long>
#define pb push_back
#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;}
const ll mod = 1e9 + 7;
const ld pi = 3.14159265358979;
 
int run_test(){
      int n; string s;
      cin >> n >> s;
      int count = 0;
      for(int i=0; i<n; i++){
            if(s[i] == 'R'){
                  count++;
            }
      }
      int ans = 0;
      for(int i=0; i<count; i++){
            if(s[i] != 'R'){
                  ans++;
            }
      }
      cout << ans;
      return 0;
}
 
int main(){
    FAST;
    ll t;
    t = 1;
 
    while(t--){
        run_test();
    }
}

Measured memory_bytes: 3724
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
class Range {
    using T = long long;
    class Iterator {
        T val, step, diff;
    public:
        Iterator(T v, T s, T d): val(v), step(s), diff(d) {}
        T operator*() { return val + diff; }
        bool operator!=(const Iterator &itr) { return step > 0 ? val < itr.val : val > itr.val; }
        Iterator operator++() { val += step; return *this; }
    };
    Iterator _begin, _end;
public:
    Range(T b, T e, T s, T d): _begin(b, s, d), _end(e, s, d) {
        if (s < 0) { _begin = Iterator(e - 1, s, d); _end = Iterator(b - 1, s, d); }
    }
    Range(T b, T e, T s): Range(b, e, s, 0) {}
    Range(T b, T e): Range(b, e, 1, 0) {}
    Range(T e): Range(0, e, 1, 0) {}
    Iterator begin() { return _begin; }
    Iterator end() { return _end; }
};
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b;
    cin, a, b;
    print(max({2 * a - 1, 2 * b - 1, a + b}));
    return 0;
}


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

int main(){
	
	int i = 0, j = 0;
	string a, b, c;
	
	cin >> a;
	cin >> b;
	
	c = a + a + a ;
	
	while(i < a.size()){
		
		if(b[0] == c[i]){
			
			for(j = 0; j < b.size(); ++j){
				
				if(b[j] != c[i+j]){
					
					break;
				}
				
				if(j + 1 == b.size()){
					
					cout << "Yes" << endl;
					return 0;
				}
			}
		}
		
		++i;
	}
	
	cout << "No" << endl;
	
	return 0;
}

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

int main(){
  string b;
  cin >> b ;
  if (b== "A"){
    cout << "T" << endl;
  }
  else if (b== "T"){
    cout << "A" << endl;
  }
  else if (b== "C"){
    cout << "G" << endl;
  }
  else if (b== "G"){
    cout << "C" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    int64_t n;
    cin >> n;

    int64_t x = 0;
    vector<int64_t> xx(n);
    for (auto i : irange(0L, n)) {
        int64_t aa;
        cin >> aa;

        x ^= aa;
        xx[i] = x;
    }

    constexpr auto M = 1000000007;

    auto last_x = xx.back();
    cerr << last_x << endl;
    if (last_x > 0) {
        int64_t count = 0;
        int64_t count0 = 0;
        for (auto x : xx) {
            if (x == 0) {
                count0 += count;
                count0 %= M;
            } else if (x == last_x) {
                count += count0 + 1;
                count %= M;
            }
        }
        cout << count0 + 1 << endl;
    } else {
        unordered_map<int64_t, int64_t> count0;
        unordered_map<int64_t, int64_t> count;
        unordered_map<int64_t, int64_t> last_num0;
        int64_t num0 = 0;
        for (auto i : irange(0L, n)) {
            auto x = xx[i];
            if (x == 0) {
                ++num0;
            } else {
                count0[x] += (count[x] * ((num0 - last_num0[x]) % M)) % M;
                count[x] += count0[x] + 1;
                count[x] %= M;
                last_num0[x] = num0;
            }
        }

        int64_t ans = 0;
        for (auto kv : count) {
            ans += kv.second;
            ans %= M;
        }

        int64_t p0 = 1;
        for (auto i : irange(0L, num0 - 1)) {
            p0 *= 2;
            p0 %= M;
        }

        cerr << ans << endl;
        cerr << p0 << endl;
        cout << (ans + p0) % M << endl;
    }
}

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  ll ans = ((n + 999)/1000)*1000 - n;

  cout << ans << endl;
    
  return 0;
}


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

int main() { // sum[l,r) mod M= 0 <=> sum[1,l) mod M = sum[1,r) mod M を利用して数え上げる。
  int N,M;
  cin >> N >> M;

  unordered_map<int, int64_t> map;
  int sum_modM= 0;
  map[sum_modM]= 1;
  int buf;
  for(int i=0; i<N; i++){
    cin >> buf;
    sum_modM= (sum_modM+ buf)% M;
    if(map.count(sum_modM)) map.at(sum_modM)++;
    else                    map[sum_modM]= 1;
  }
  
  int64_t ans= 0;
  for(auto e:map){
    auto key= e.first;
    ans+= map.at(key)*(map.at(key) -1)/2;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e12 
#define mo 1000000007
ll dp[101][100001];
ll a[101];
ll n,k;
ll solve()
{
	for(ll j=0;j<=a[1];j++)
	{
		dp[1][j] = (j<=a[1])?1:0;
	}
	for(ll i=2;i<=n;i++)
	{
		for(ll j=0;j<=k;j++)
		{
			if(j==0)
			{
				dp[i][j] = dp[i-1][j];
			}
			else dp[i][j] = (1000000007+dp[i][j-1] + dp[i-1][j] -(((j-1-a[i])>=0)?dp[i-1][j-1-a[i]]:0))%1000000007;
		}
	}
	return dp[n][k];
}
int main()
{
	
	cin>>n>>k;
	for(ll p=1;p<=n;p++)
	{
		cin>>a[p];
	}
	memset(dp,0,sizeof(dp));
	cout<<solve();
	
}

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

int main() {
	int R, G, B, N;
	long ans = 0;
	cin >> R >> G >> B >> N;
	for (int i = 0; i <= N; ++i) {
		for (int j = 0; j <= N; ++j) {
			if (R * i + G * j > N) continue;
			if (R * i + G * j == N || (N - R * i - G * j) % B == 0) ++ans;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
import sys

def solve(N, ls_ct):
    # Uncomment the following if you want to check the input.
    # print('N =', N)
    #print('ls_ct =', ls_ct)
    y = 0
    for i in ls_ct:
        y += abs((i[0]-i[1]))+1
    print(y)

def readQuestion():
    ws = sys.stdin.readline().strip().split()
    N = int(ws[0])
    ls_ct = [list(map(int, sys.stdin.readline().strip().split())) for j in range(N)]
    return (N, ls_ct)

def main():
    solve(*readQuestion())

# Uncomment before submission
main()

Measured memory_bytes: 3188
gets.to_i.times do
  arr, str, h1, h2 = gets.split.map(&:to_i), "YES", 0, 0
  
  arr.each do |elm|
    if h1 < elm
      h1 = elm
    elsif h2 < elm
      h2 = elm
    else
      str = "NO"
      break
    end
  end
  
  puts str
end

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


int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  int cnt = 0;
  rep(i, n-2){
    for(int j = i+1;j < n-1;j++){
      for(int k = j+1;k < n;k++){
        if(a[i] == a[j] ||a[j] == a[k] 
           || a[i] == a[k]){
          continue;
        }
        if(a[i] > a[k] - a[j] 
           && a[k] < a[i] + a[j]){
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3512
/*input
14
1 2 2 3 3 3 4 4 4 4 1 2 3 4
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int n;
int a[maxn];
int main(){
	IOS;
	cin>>n;
	REP(i,n) cin>>a[i];
	a[n]=-1;
	int pt=0;
	int ans=0;
	for(int i=0;i<=n;i++){
		if(a[pt]!=a[i]){
			ans+=(i-pt)/2;
			pt=i;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
/* kadai4_2
   nabe9393 */

#include<stdio.h>
#include<math.h>

int main(void){
  double short_hand, long_hand, hour, minute, angle, answer;
  scanf("%lf %lf %lf %lf", &short_hand, &long_hand, &hour, &minute);
  angle = M_PI * (hour * 30.0 + minute / 2.0 - minute * 6.0) / 180.0 ;
  answer = sqrt( pow(long_hand, 2) + pow(short_hand, 2) - 2 * long_hand * short_hand * cos(angle));
  printf("%.10lf\n", answer);
  return 0;
}

Measured memory_bytes: 2544
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll N, M;
vector<ll> task[100010];
priority_queue<ll> que;

signed main(){
    cin >> N >> M;
    ll A, B;
    REP(i, N){
        cin >> A >> B;
        task[A].push_back(B);
    }
    ll ans = 0;
    REP(i, M + 1){
        for(ll a : task[i]) que.push(a);
        if(que.empty()) continue;
        ans += que.top();
        que.pop();
    }
    PRINT(ans);
}

Measured memory_bytes: 8984
import math
n = int(input())
xy = [list(map(int,input().split()))for _ in range(n)]
perm=[0]*n
res = []
used = [0] *n
def dfs(depth):
    if depth == n:
        res.append([perm[i] for i in range(n)])
        return
    for i in range(n):
        if used[i]:continue
        used[i] = 1
        perm[depth] = i
        dfs(depth+1)
        used[i] = 0
dfs(0)
ans = 0
for p in res:
    for i in range(len(p)-1):
        x1,y1 = xy[p[i]][0],xy[p[i]][1]
        x2,y2 = xy[p[i+1]][0],xy[p[i+1]][1]
        dist = math.sqrt((x1-x2)**2+(y1-y2)**2)
        ans +=dist
P = [1]
for i in range(n):
    P.append(P[-1]*(i+1))
    
ans/=P[n]
print(ans)

Measured memory_bytes: 9076
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
#define MAXN 1000000
#define ll long long 
using namespace std;

priority_queue<ll, vector<ll>, greater<ll> > front;
priority_queue<ll> back; 
ll a[MAXN], l[MAXN], r[MAXN];//前l[i]包括l[i]本身N项和的最大值 
int main() {
	ll n, sumf = 0, sumb = 0, ans = -1e18;
	scanf("%lld", &n);
	for(int i = 1; i <= 3*n; i++) {
		scanf("%lld", &a[i]);		
		if(i <= n) sumf += a[i], front.push(a[i]);
		if(i > 2*n) sumb += a[i], back.push(a[i]);
	}
	l[n] = sumf, r[2*n] = sumb;
	for(int i = n+1; i <= 2*n; i++) {
		if(a[i] > front.top()) {
			sumf = sumf - front.top() + a[i];
			front.pop();
			front.push(a[i]);
		}
		l[i] = sumf;
	} 
	
	for(int i = 2*n-1; i >= n; i--) {	
		if(a[i+1] < back.top()) {
			sumb = sumb - back.top() + a[i+1];
			back.pop();
			back.push(a[i+1]);
		}
		r[i] = sumb;
	}
	for(int i = n; i <= 2*n; i++) 
		ans = max(ans, l[i]-r[i]);
	
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 8820
program DDCC_Finals
  implicit none
  integer :: x, y, m = 0
  read(*,*) x, y
  x = min(x,4)
  y = min(y,4)
  m = (4-x+4-y)*100000
  if (x == 1 .and. y == 1) m = 1000000
  write(*,'(i0)') m
end program DDCC_Finals

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll  long long
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD=1000000000000000000;
const long double PI=3.14159265358979;
const ll MAX=100;

ll fac[MAX];
ll faci[MAX];

ll modpow(ll x,ll y){
  long long ans=1;
  while(y>0){
    if(y&1){
      ans*=x%MOD;
    }
    x*=x%MOD;
    x%=MOD;
    ans%=MOD;
    y>>=1;
  }
  return ans;
}

void modCf(){
  fac[0]=1;
  faci[0]=1;
  for(int i=1;i<MAX;i++){
    fac[i]=fac[i-1]*i%MOD;
    faci[i]=modpow(fac[i],MOD-2);
  }
  return;
}

ll modC( ll x,ll y){
  ll ans=1;
  for(int i=0;i<y;i++){
    ans*=(x-i);
    ans/=(i+1);
  }
  return ans;
}


int main() {
  modCf();
  ll N,P;
  cin>>N>>P;
  ll all=modpow(2,N),cnt=0;
  //cout<<all<<endl;
  rep(i,N){
    ll a;
    cin>>a;
    if(a%2){
      cnt++;
    }
  }
  ll ans=0,c=N-cnt;
  c=modpow(2,c);
  //cout<<c;
  for(int i=1;i<=cnt;i+=2){
    ans+=modC(cnt,i)*c;
    //cout<<fac[3]<<endl;
  }
  if(P==1){
    cout<<ans;
  }
  else{
    cout<<all-ans;
  }
}



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

int main() {
    long long mod = 1000000007;
    int h, w;
    cin>>h>>w;
    vector<string> m(h,"");
    for(int i = 0; i< h ; i++ ){
        cin>>m[i];
    }
    long long dp[h][w] = {0};
    int p = 1;
    for(int j = 0 ; j < w ; j++){
        if(m[0][j] == '#')p=0;
        dp[0][j] = p;
    }
    
    p = dp[0][0];
    for(int i = 1 ; i < h ; i++){
        if(m[i][0] == '#')p = 0;
        dp[i][0] = p;
    }
    
    
    for(int i = 1; i < h ; i++){
        for(int j = 1; j < w; j++){
            if(m[i][j] == '#')dp[i][j] = 0;
            else{
                dp[i][j] = (dp[i-1][j]  +  dp[i][j-1]) % mod;
            }
        }
    }
    cout<<dp[h-1][w-1];
	// your code goes here
	return 0;
}


Measured memory_bytes: 9088
#include<cstdio>

int k;
int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
  scanf("%d", &k);
  printf("%d\n", a[k-1]);
}


Measured memory_bytes: 128
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "l    ", long, "r");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    auto a = aryread();
    long ans = a[0];
    foreach (e; a)
    {
        ans = gcd(ans, e);
    }
    ans.writeln();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 6084
n = int(input())
a = [int(input()) for i in range(n)]

res = sum(a)
if res%10 !=0:
    print(res)
    exit()

b = sorted(list(filter(lambda x:x%10!=0, a)))
if len(b) == 0:
    print(0)
    exit()
print(res-b[0])


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int N, M;
bool path[8][8];
bool visit[8];

int dfs(int point)
{
  visit[point] = true;
  bool all_visit = true;
  REP(i, N)
  {
    if (!visit[i])
      all_visit = false;
  }
  if (all_visit)
    return 1;
  int res = 0;
  REP(i, N)
  {
    if (path[point][i] && !visit[i])
    {
      res += dfs(i);
      visit[i] = false;
    }
  }
  return res;
}

int main()
{
  cin >> N >> M;
  vector<int> a(M), b(M);
  REP(i, M)
  {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
  }
  REP(i, 8)
  REP(j, 8)
  path[i][j] = false;
  REP(i, 8)
  visit[i] = false;
  REP(i, M)
  {
    path[a[i]][b[i]] = true;
    path[b[i]][a[i]] = true;
  }
  cout << dfs(0) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define what_is(x) cerr<<#x <<" is "<<x<<endl;
#define ll long long 
#define gcd(a,b) __gcd(a,b)
#define pi 2*acos(0.0)
#define endl "\n"
//use emplace_back() instead of push_back()
const ll mod=1e9+7;
template<typename T>
void print(T t)
{
    for(const auto& e:t)cout<<e<<" ";
    cout<<endl;
}
ll power(ll x, ll y, ll p) 
{ 
    int res = 1;
    x = x % p;
    while (y > 0) 
    {
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
} 
vector<int>g[1000001];
int vis[1000001];    
int in[100001];
int low[100001];
int timer=0;
vector<pair<int,int> >v;
int f;
void dfs(int n,int p)
{
    vis[n]=1;
    low[n]=in[n]=timer++;    
    if(timer!=1)v.push_back({p,n});
    for(auto ch:g[n])
    {
        if(ch==p)continue;
        if(vis[ch])
        {
            low[n]=min(low[n],in[ch]);
            if(in[n]>in[ch])v.push_back({n,ch});
        }
        else
        {
            dfs(ch,n);
            if(in[n]<low[ch]){f=1;return;}            
            low[n]=min(low[n],low[ch]);
        }
    }    
}
ll josephus(ll n) 
{
    ll p = 1; 
    while (p <= n) 
        p *= 2; 
    return (2 * n) - p + 1; 
}

bool isprime(ll n)
{
    if(n==1)return false;
    for(ll i=2;i*i<=n;i++)
    if(n%i==0)return false;
    return true;
}
vector<ll>aa;
void printallpf(ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            while(n%i==0)
            {
                aa.push_back(i);
                if(i!=n/i)
                if(isprime(n/i))aa.push_back(n/i),n=i;
                n=n/i;
            }
            
        }
    }    
}
void primeFactors(int n)  
{
       while (n % 2 == 0)  
    {  
        cout << 2 << " ";  
        n = n/2;  
    }  
  for (int i = 3; i <= sqrt(n); i = i + 2)  
    {    
        while (n % i == 0)  
        {  
            cout << i << " ";  
            n = n/i;  
        }  
    }
    if (n > 2)  
        cout << n << " ";  
}  
int dsu[100001];
void dsuunion(int u,int v)
{
	dsu[v]+=dsu[u];
	dsu[u]=v;
}
ll find(int a)
{
	if(dsu[a]<0)return a;
	else
	return dsu[a]=find(dsu[a]);
}
ll nod(ll x)
{
	ll cnt=0;
	while(x)
	{
		x=x>>1;
		cnt++;
	}
	return cnt;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll a[n];
    map<ll,ll>m;
    for(ll i=0;i<n;i++)
    {
		cin>>a[i];
		m[a[i]+i]++;
	}
	ll cnt=0;
	for(ll i=1;i<n;i++)
	{
		if(m[i-a[i]])cnt+=m[i-a[i]];
	}
	cout<<cnt<<endl;
    return 0;
}


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

int main(){
    int n , k ;
    cin >> n >> k ;
    map<int,int> m ;
    for(int i=0;i<n;i++){
        int x ;
        cin >> x ;
        m[x]++;
    }
    vector<int> v ;
    for(auto &p : m){
        v.push_back(p.second);
    }
    sort(v.rbegin(),v.rend());
    int ans = 0 ;
    int cnt = 1 ;
    for(int i=0;i<v.size();i++){
        if ( cnt > k ){
            ans += v[i] ;
        }
        cnt++;
    }
    cout << ans << endl;
    return 0 ;
}


Measured memory_bytes: 10748
package main

import "fmt"

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	var s string
	fmt.Scan(&s)
	q := make([]bool, n)
	qt, qb := 0, 0
	for i, v := range s {
		if v == 'a' && qt < a+b {
			qt++
			q[i] = true
		} else if v == 'b' && qt < a+b && qb < b {
			qb++
			qt++
			q[i] = true
		}
	}
	for i := range q {
		if q[i] {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>

int timestamp = 0;

struct Vertex {
	int id;
	int enter;
	int departure;
	std::vector<int> edge_to;
	Vertex() : enter(-1), departure(-1) {}
};
bool comp_v (const Vertex& u, const Vertex& v) { return u.departure > v.departure; }

void DFS_rec(Vertex* vertices, int s)
{
	vertices[s].enter = timestamp;
	timestamp++;
	for (int i=0; i<vertices[s].edge_to.size(); i++) {
		int t = vertices[s].edge_to[i];
		if (vertices[t].enter == -1) DFS_rec(vertices, t);
	}
	vertices[s].departure = timestamp;
	timestamp++;
}

void DFS(Vertex* vertices, int m)
{
	for (int i=0; i<m; i++) {
		if (vertices[i].enter == -1) DFS_rec(vertices, i);
	}
}

int main()
{
	int m, n;
	std::cin >> m >> n;
	
	Vertex* vertices = new Vertex[m];
	for (int i=0; i<m; i++) vertices[i].id = i+1;
	for (int i=0; i<n; i++) {
		int s, t;
		std::cin >> s >> t;
		vertices[s-1].edge_to.push_back(t-1);
	}
	
	DFS(vertices, m);
	
	std::sort(vertices, vertices + m, comp_v);
	
	for (int i=0; i<m; i++) {
		std::cout << vertices[i].id << std::endl;
	}
	//for (int i=0; i<m; i++) {
	//	std::cout << vertices[i].id <<  " : enter = " << vertices[i].enter << ", depart = " << vertices[i].departure << std::endl;
	//}
	
	delete[] vertices;
	
	return 0;
}
	



Measured memory_bytes: 3132
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#define Debug 0
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

//最大公約数
template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//最小公倍数
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fold(int N, int M, int d, int c, vector<vector<long long>> &field, int origin_x, int origin_y) {
    if (d == 1) {
        for (int x = origin_x + c; x < origin_x + c + c; x++) {
            for (int y = origin_y; y < origin_y + M; y++) {
                field[x][y] += field[origin_x + c - (x - origin_x - c + 1)][y];
            }
        }
    } else {
        for (int y = origin_y + c; y < origin_y + c + c; y++) {
            for (int x = origin_x; x < origin_x + N; x++) {
                field[x][y] += field[x][origin_y + c - (y - origin_y - c + 1)];
            }
        }
    }
}

vector<long long> solve(int N, int M, int T, int P) {
    //field[x][y] := 折り紙の左からx番目,　下からy番目のマス目(0-indexed)
    vector<vector<long long>> field(1000, vector<long long>(1000));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            field[i][j] = 1;
        }
    }

    int origin_x = 0;
    int origin_y = 0;
    for (int i = 0; i < T; i++) {
        int d, c; cin >> d >> c;
        fold(N, M, d, c, field, origin_x, origin_y);
        if (d == 1) {
            origin_x += c;
        } else {
            origin_y += c;
        }
    }
    vector<long long> ret;
    for (int i = 0; i < P; i++) {
        int x, y; cin >> x >> y;
        ret.push_back(field[origin_x + x][origin_y + y]);
    }
    if (Debug) {
        for (int y = M-1; y >= 0; y--) {
            for (int x = 0; x < N; x++) {
                cout << field[x][y] << " ";
            }
            cout << endl;
        }
    }
    return ret;
}

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

    vector<vector<long long>> ans;
    while (1) {
        int N, M, T, P; cin >> N >> M >> T >> P;
        if (!N && !M && !T && !P) break;
        ans.push_back(solve(N, M, T, P));
    }
    for (auto i: ans) {
        for (auto j: i) {
            cout << j << endl;
        }
    }
}




Measured memory_bytes: 10664
D=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for i in range(D)]
T=[int(input())-1 for i in range(D)]
X=[0]*26
Y=[0]*26
M=int(input())
d,q=0,0
P=0
for i in range(D):
  P+=S[i][T[i]]
  for j in range(26):
    X[j]+=C[j]
  X[T[i]]=0
  for j in range(26):
    Y[j]+=X[j]
for i in range(M):
  d,q=map(int,input().split())
  d,q=d-1,q-1
  P-=S[d][T[d]]
  P+=S[d][q]
  for j in range(26):
    X[j]=0
  Y[T[d]],Y[q]=0,0
  for j in range(D):
    if j==d:
      Z=q
    else:
      Z=T[j]
    X[T[d]]+=C[T[d]]
    X[q]+=C[q]
    X[Z]=0
    Y[T[d]]+=X[T[d]]
    Y[q]+=X[q]
  T[d]=q
  print(P-sum(Y))

Measured memory_bytes: 69448
// https://abc097.contest.atcoder.jp/tasks/arc097_b
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<int> par; // 1..n

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

bool samegroup(int x, int y) { return root(x) == root(y); }

void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y)
        par[x] = y;
}

int main(int argc, char** argv) {
    int n, m;
    cin >> n >> m;

    vector<int> p(n);
    par.resize(n);

    rep(i, n) { par[i] = i; }
    rep(i, n) {
        int t;
        cin >> t;
        p[t - 1] = i;
    }

    rep(i, m) {
        int x, y;
        cin >> x >> y;
        unite(x - 1, y - 1);
    }

    int ans = 0;
    rep(i, n) {
        if (root(p[i]) == root(i))
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull A=9999973,B=950527;

int H,W;
char T[1005][1005];
ull t[1005][1005];
ull t2[1005][1005];
int h,w;
char U[1005][1005];


int main(){
  scanf("%d %d",&H,&W);
  for(int i=0;i<H;i++)scanf("%s",T[i]);
  scanf("%d %d",&h,&w);
  for(int i=0;i<h;i++)scanf("%s",U[i]);

  ull target=0;
  for(int i=0;i<h;i++){
    ull key=0;
    for(int j=0;j<w;j++){
      key=key*B+U[i][j];
    }
    target=target*A+key;
  }

  ull C=1;
  for(int i=0;i<w;i++)C*=B;

  for(int i=0;i<H;i++){
    ull key=0;
    for(int j=0;j<W;j++){
      key=key*B+T[i][j];
      if(j-w>=0)key-=T[i][j-w]*C;
      t[i][j]=key;
      t2[i][j]=t[i][j];
    }
  }

  C=1;
  for(int i=0;i<h;i++)C*=A;

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(i)t[i][j]+=t[i-1][j]*A;
      if(i-h>=0)t[i][j]-=t2[i-h][j]*C;
      if(t[i][j]==target){
        if(i-h+1>=0&&j-w+1>=0)
          printf("%d %d\n",i-h+1,j-w+1);
      }
    }
  }


  return 0;
}

Measured memory_bytes: 20832
n=int(input())
list=[int(i) for i in input().split()]
k=1
list.sort()
x=list[0]
while k<n:
  y=x*list[k]
  x=y
  if y<=1000000000000000000:
    k=k+1
  else:
    k=n+1
    y=-1
print(y)

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

int main(void) {
    string s;
    int redcnt = 0;
    int bluecnt = 0;
    cin >> s;

    for(int i=0;i<s.size();i++) {
        if(s[i] == '0')redcnt++;
        else bluecnt++;
    }

    cout << min(redcnt,bluecnt) *2 << endl;
    return 0;
}


Measured memory_bytes: 512
#include<cstdio>
int gcb(int x, int y){
	if(x%y==0) return y;
	else return gcb(y, x%y);
}
int main(){
	int x,y;
	scanf("%d%d", &x, &y);
	printf("%d\n", ((x>=y)?gcb(x,y):gcb(y,x)));
	return 0;
}


Measured memory_bytes: 2676
#include<cstdio>
#include<queue>

int n, a[300005];
std::priority_queue<int> max_q, min_q;
long long max_s[300005], min_s[300005], ans = -9e18;

long long max(long long x, long long y) {
	return x > y ? x : y;
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n + n + n; i++) scanf("%d", &a[i]);
	long long sum = 0;
	for (int i = 1; i <= n; i++) {
		min_q.push(-a[i]);
		max_s[i] = sum += a[i];
	}
	for (int i = n + 1; i <= n + n; i++) {
		min_q.push(-a[i]);
		sum += a[i];
		max_s[i] = sum += min_q.top();
		min_q.pop();
	}
	sum = 0;
	for (int i = n + n + n; i > n + n; i--) {
		max_q.push(a[i]);
		min_s[i] = sum += a[i];
	}
	for (int i = n + n; i > n; i--) {
		max_q.push(a[i]);
		sum += a[i];
		min_s[i] = sum -= max_q.top();
		max_q.pop();
	}
	for (int i = n; i <= n + n; i++) ans = max(ans, max_s[i] - min_s[i + 1]);
	printf("%lld\n", ans);
}

Measured memory_bytes: 5624
N = int(input())
h = list(map(int, input().split()))

curr = -1
s = 0
ss = [0 for i in range(N)]
for i in range(N-1):
    if h[i] >= h[i+1]:
        ss[i+1] = ss[i] + 1
    else:
        ss[i+1] = 0

print(max(ss))

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define ALL(v) v.begin(), v.end()
const int INF = 1e9;
const int MAX = 510000;
const int MOD = 1000000007;
using namespace std;
typedef long long ll;

/*DP使ったほうがよくない？？WOWWOW*/

int main(){
  int K, N; cin>>K>>N;
  int A[N];
  cin>>A[0];
  int ans=A[0];
  for(int i=1; i<N; i++){
    cin>>A[i];
    ans=max(ans, A[i]-A[i-1]);
  }
  ans=max(ans, A[0]-A[N-1]+K);
  cout<<K-ans<<endl;  
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
# A

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
# input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

a = input()

if ord(a) > 90:
    print('a')
else:
    print('A')



Measured memory_bytes: 65176
#include<stdio.h>
#include<math.h>

int main(void){
int n,d,ans=0;
  scanf("%d%d",&n,&d);
  double x[n][d],sum=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
scanf("%lf",&x[i][j]);
    }
  }
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      for(int k=0;k<d;k++){
        sum+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      sum=sqrt(sum);
      //printf("%lf\n",sum);
      if(sum-floor(sum)==0)
        ans++;
      sum=0;
    }
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
ABC = [[int(x) for x in readline().split()] for _ in range(N)]

dp = [[0] * 3 for _ in range(10 ** 5 + 10)]

for i in range(N):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + ABC[i][k])

ans = max(dp[N])
print(ans)


Measured memory_bytes: 44084
N=int(input())
X=[int(s) for s in input().split()]

sum=0
Ans=0
count=0
Xmax=sorted(X)[N-1]
Xmax2=sorted(X)[N-2]

for i in range(2*Xmax):
    sum=0
    for j in range(N):
        sum+=(X[j]-i)**2
    count+=1
    if count==1:
        Ans=sum
    Ans=min(Ans,sum)
    

print(Ans)

Measured memory_bytes: 38640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  bool flag=true;
  while(1)
  {
	  if(flag)
	  {
		  c-=b;
		  if(c<=0)
		  {goto end;}
	   }
	   else
	   {
		   a-=d;
		   if(a<=0)
		   goto end;
	   }
	   flag=!flag;
   }
   end:;
   if(flag)
   cout<<"Yes";
   else
   cout<<"No";
   return 0;
}
      


Measured memory_bytes: 3576
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt();
    while(a>0||c>0) {
    	c-=b;
    	if(c<=0) {
    		System.out.println("Yes");
    		break;
    	}
    	a-=d;
    	if(a<=0) {
    		System.out.println("No");
    		break;
    	}
    }
    
  }
}


Measured memory_bytes: 35812
#include <bits/stdc++.h>
using namespace std;
pair<int,int> arr[100005];
map<int,int> m[2],comp;
bool vis[100005];
int sa[100005];
void dfs(int idx)
{
	vis[idx]=1;
	if (!vis[comp[arr[idx].second]])
	dfs(comp[arr[idx].second]);
}
int main()
{
	int n;
	scanf("%d",&n);
	bool b=1,occ=0;
	for (int i=0;i<n;i++)
	{
		scanf("%d",&arr[i].second);
		occ|=m[0][arr[i].second];
		m[0][arr[i].second]=1;
		comp[arr[i].second];
		sa[i]=arr[i].second;
	}
	for (int i=0;i<n;i++)
	{
		scanf("%d",&arr[i].first);
		occ|=m[1][arr[i].first];
		m[1][arr[i].first]=1;
	}
	sort(arr,arr+n);
	sort(sa,sa+n);
	for (int i=0;i<n;i++)
	b&=(sa[i]<=arr[i].first);
	if (!b)
	{
		printf("No");
		return 0;
	}
	if (occ)
	{
		printf("Yes");
		return 0;
	}
	int cur=0;
	for (auto &p:comp)
	p.second=cur++;
	dfs(0);
	for (int i=0;i<n;i++)
	{
		if (!vis[i])
		{
			printf("Yes");
			return 0;
		}
	}
	bool ok=0;
	for (int i=0;i<n-1;i++)
	ok|=(sa[i+1]<=arr[i].first);
	printf(ok? "Yes":"No");
}

Measured memory_bytes: 16312
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
using namespace std;


/*
 * mode0なら最小値、mode1なら最大値を返す。
 */
int getval(int mode, int* rep, int begin, int end) {
	
	int result;

	result = rep[begin];

	for (int i = begin + 1; i < end; i++) {
		if (mode == 0 && result > rep[i]) {
			result = rep[i];
		}
		if (mode == 1 && result < rep[i]) {
			result = rep[i];
		}
	}
	return result;
}

int main() {

	int size;
	int a[1000];
	int ans[1000];

	cin >> size;

	for (int i = 0; i < size; i++)cin >> a[i];

	int querySize;
	cin >> querySize;

	int method;
	int b, e;

	for (int i = 0; i < querySize; i++) {
		cin >> method >> b >> e;
		ans[i] = getval(method, a, b, e);
	}

	for (int i = 0; i < querySize; i++) {
		printf("%d\n", ans[i]);
	}


//	system("pause");
	return 0;
}


Measured memory_bytes: 3216
//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//入力マクロここまで

fn main() {
    input! {
        _n: usize,
        m: usize,
        lr: [(u64,u64);m],
    }

    let mut min_gate = lr[0].0;
    let mut max_gate = lr[0].1;
    for i in 1..m {
        if lr[i].0 > min_gate {
            min_gate = lr[i].0;
        }
        if lr[i].1 < max_gate {
            max_gate = lr[i].1;
        }
    }

    let ans = if max_gate >= min_gate {
        max_gate + 1 - min_gate
    } else {
        0
    };

    println!("{}", ans);
}


Measured memory_bytes: 6396
/*
		Author : Kaustubh Gangwar
		||S||A||M||R||A||T||
*/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ld long double
#define pb push_back
#define gcd __gcd
#define mp make_pair
#define vii vector<int>
#define vll vector<long long>
#define all(x) x.begin(),x.end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
typedef long long  ll;
typedef pair<int,int> pii;

ll bpow(ll a, ll b) {
	a=a;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

int main()
{	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	ll test=1;
	//cin>>test;
	while(test--)
	{ f(i,1,6)
		{
			int a;
			cin>>a;
			if(a==0)
			cout<<i;
		}
		
		
	}
return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M = 1e9+7;
ll Mult(ll x,ll y){
	if(x == 0 || y == 0)return 0;
	ll res =0;
	if(y&1)res +=x;
	ll r = Mult(x,y/2)%M;
	res += (r*2)%M;
	return res%M;
}
int main(){
	//freopen("test.in","r",stdin);
	int n;
	cin>>n;
	ll s=0;
	ll res=0;
	ll x;
	for(int i=0;i<n;i++){
		cin>>x;
		res += Mult(x,s)%M;
		res %=M;
		s+=x;
	}
	cout<<res%M<<endl;
    return 0;
}


Measured memory_bytes: 3548
def main():
    #残っている色の個数が偶数になるように行動
    N = int(input())
    A = list()
    for _ in range(N):
        if int(input()) % 2 == 1:
            break
    else:
        print('second')
        return
    print('first')
    return
    

    
main()

Measured memory_bytes: 69720
import sys
input = sys.stdin.readline
INF = 10**10
MOD = 10**9 + 7
sys.setrecursionlimit(100000000)
from functools import lru_cache
from itertools import permutations
from math import factorial


def main():
    n,a = map(int,input().split())
    x = list(map(int,input().split()))
    dp = [[[0] * (n * a + 1) for _ in range(n + 1)] for _ in range(n + 1)]

    for i in range(n + 1):
        dp[i][0][0] = 1

    for i in range(n):
        num = x[i]
        for j in range(1,n + 1):
            for s in range(n * a + 1):
                if s - num >= 0:
                    dp[i + 1][j][s] = dp[i][j][s] + dp[i][j - 1][s - num]
                else:
                    dp[i + 1][j][s] = dp[i][j][s]
    
    ans = 0
    for i in range(1,n + 1):
        ans += dp[-1][i][i * a]
    print(ans)
    

if __name__=='__main__':
    main() 

Measured memory_bytes: 91740