akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
typedef pair<string, string> Ps;
typedef pair<ll, ll> Pi;

int main() {
    int n;
    string s;
    cin >> n >> s;

    map <Ps, Pi> mp;
    for (int i = 0; i < (1 << n); i++) {
        string s1="", s2="";
        for (int j = 0; j < n; j++) {
            if (i & (1 << j)) s1 += s[j];
            else s2 += s[j];
        }
        mp[Ps(s1, s2)].first++;
    }

    for (int i = 0; i < (1 << n); i++) {
        string s1="", s2="";
        for (int j = 0; j < n; j++) {
            if (i & (1 << j)) s1 += s[2*n-1-j];
            else s2 += s[2*n-1-j];
        }
        mp[Ps(s1, s2)].second++;
    }

    ll ans = 0LL;
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        ans += itr->second.first * itr->second.second;
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 57600
n = int(input())
a = list(map(int, input().split()))
count = {}
for i in a:
  if i in count:
    count[i] += 1
  else:
    count[i] = 1
edges = []
for i,j in count.items():
  if j >= 2:
    edges.append(i)
  if j >= 4:
    edges.append(i)

edges.sort(reverse=True)
if len(edges)<2:
  print(0)
else:
  print(edges[0]*edges[1])

Measured memory_bytes: 17936
#include <iostream>
using namespace std;
int main(void){
    int n,m;
    int i,j,k;
    int mat[100][100]={{}};
    int ve[100]={};
    cin>>n>>m;
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            cin>>mat[i][j];
        }
    }
    for(j=0;j<m;j++)
    cin>>ve[j];
    for(i=0;i<n;i++){
        int x=0;
    for(j=0;j<m;j++)
    x+=mat[i][j]*ve[j];
    cout<<x<<endl;
    }
    return 0;
     
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(box) box.begin(), box.end()

using namespace std;

using P = pair<int,int>;
using ll = long long;

const long long INF = LLONG_MAX/3;

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

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[b]+=siz[a];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=998244353;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

vector<int> solve(vector<int> a){
	vector<int> re;
	rep(i,a.size()-1){
		re.push_back(abs(a[i]-a[i+1]));
	}
	return re;
}
int cnt(int a){
	int re=0;
	while(a>0){
		re+=a/2;
		a/=2;
	}
	return re;
}
signed main(){
	int n;
	cin>>n;
	string t;
	cin>>t;
	vector<int> a(n);
	rep(i,n)a[i]=t[i]-'0';
	vector<int> b=solve(a);
	bool one=false;
	rep(i,n-1){
		if(b[i]==1)one=true;
	}
	if(!one){
		rep(i,n-1){
			b[i]/=2;
		}
	}
	int s=0;
	rep(i,n-1){
		if(cnt(n-2)>cnt(n-2-i)+cnt(i))s+=b[i]*2;
		else s+=b[i];
	}
	s%=2;
	if(!one)cout<<s*2<<endl;
	else cout<<s<<endl;
}

Measured memory_bytes: 27384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <climits>
#include <utility>
#include <numeric>
typedef long long ll;
using namespace std;

int main(void){
  int n, m, k, i, j;
  cin >> n >> k;
  m = n*(n+1)/2;
  
  vector<ll> a(n), s(m);

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

  ll tmp;
  int index = 0;
  for(i=0;i<n;i++){
    tmp = 0;
    for(j=i;j<n;j++){
      tmp += a[j];
      s[index] = tmp;
      index++;
    }
  }

  ll x = 0LL;
  int cnt;
  for(i=40;i>=0;i--){
    cnt = 0;
    tmp = x + (1LL<<i);
    for(j=0;j<m;j++){
      if(ll(tmp&s[j])==tmp) cnt++; 
    }
    if(cnt>=k) x = tmp;
  }

  cout << x << endl;

  return 0;
}


Measured memory_bytes: 7120
import * as fs from 'fs'
const inputs = fs.readFileSync('/dev/stdin', 'utf8').split(/\r?\n/)
const [x] = inputs.shift()!.split(' ').map(s => parseInt(s, 10))
const ok = new Array<boolean>(x).fill(false)

ok[0] = true
for (let i = 2; i <= x; i++) {
    if (!ok[i-1]) {
        for (let j = i*i; j <= x; j*=i) {
            ok[j-1] = true
        }
    }
}
console.log(x - ok.reverse().findIndex(o => o))

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N;
    Scd(N);

    vi a(N);
    vi b(N);

    Rep(i,N){
        Scd2(a[i],b[i]);
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    if( N%2 ){
        int l = a[N/2];
        int r = b[N/2];
        printf ("%d\n", r-l+1);
    }else{
        int l1 = a[N/2-1];
        int r1 = b[N/2-1];
        int l2 = a[N/2];
        int r2 = b[N/2];
        printf ("%d\n", r1+r2-l1-l2+1 );
    }

    return 0;
}



Measured memory_bytes: 4860
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N, K;
    cin >> N >> K;
    int ma = (N - 1) * (N - 2) / 2;
    if(K > ma) {
        cout << -1 << endl;
        return 0;
    }
    cout << N - 1 + (ma - K) << endl;
    for(int i = 2; i <= N; i++) {
        cout << 1 << " " << i << endl;
    }
    long long cnt = 0;
    for(int i = 2; i <= N; i++) {
        for(int j = i + 1; j <= N; j++) {
            if(cnt == (ma - K)) {
                return 0;
            }
            cout << i << " " << j << endl;
            cnt++;
        }
    }
    // cout << "ERROR" << endl;
    return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


YNL = {False: 'No', True: 'Yes'}
YNU = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
# sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


# show_flg = True
show_flg = False


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def gcd_n(a, n):
    ans = a[0]
    for i in range(1, n):
        ans = gcd(ans, a[i])
    return ans


def main():
    N, K = MI()
    A = LI()
    A = sorted(A)
    mx = max(A)

    ret = gcd_n(A, N)

    if mx < K:
        print('IMPOSSIBLE')
        return

    if K % ret == 0:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

    # A = set(A)
    # while True:
    #     c = len(A)
    #     for p in combinations(A, 2):
    #         A.add(abs(p[0] - p[1]))

    #     if c == len(A):
    #         break

    # print(A)

if __name__ == '__main__':
    main()


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

typedef long long ll;

int h[105];

int main() {
  int N; cin >> N;
  for ( int i = 1; i <= N; i++ ) cin >> h[i];
  int cnt = 0;

  int indexS,indexE;
  //  int count = 3;
  bool isZero = true;
  for ( int i = 1; i <= N; i++ ) {
    if ( h[i] != 0 ) isZero = false;
  }
  if( isZero) {
    cout << 0 << endl;
    return 0;
  }  
  while(1) {

    for ( int i = 0; i <= N; i++ ) {
      if( h[i] != 0) {
	indexS = i ;
	break;
      }
    }
    for ( int i = indexS; i <= N+1; i++ ) {
      if( h[i] == 0 ) {
	indexE = i-1;
	break;
      }
    }
    if ( indexS == indexE ) {
      h[indexS]--;
      cnt++;
    } else {
      cnt++;
      for ( int i = indexS; i <= indexE; i++ ) {
	h[i]--;
      }
    }
    //for ( int i = 1; i <= N; i++ ) cout << h[i] << " ";
    //cout << endl;
    bool f = true;
    for ( int i = 1; i <=N; i++ ) {
      if ( h[i] != 0 ) f = false;
    }
    if(f) break;
    //count--;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void) {
	double x[20], y[20], a, b, c, z, s = 0.0;
	int i, n;

	for (n = 0; scanf("%lf,%lf ", x+n, y+n) != EOF; n++);

	for (i = 1, --n; i < n; i++) {
		a = hypot(x[0] - x[i], y[0] - y[i]);
		b = hypot(x[i] - x[i+1], y[i] - y[i+1]);
		c = hypot(x[i+1] - x[0], y[i+1] - y[0]);
		z = (a + b + c) / 2.0;
		s += sqrt(z * (z-a) * (z-b) * (z-c));
	}
	printf("%.6lf\n", s);
	return 0;
}

Measured memory_bytes: 672
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;
const ll MOD = 1000000007;

ll dp[700][2010];
ll sum[700][2010];

int main(){
  int s;
  cin >> s;

  REP(j, 0, s) dp[0][j] = 0;
  REP(j, 0, s) sum[0][j] = 1;
  dp[0][0] = 1;
  REP(i, 1, 699){
    REP(j, 3, s){
      dp[i][j] = sum[i-1][j-3];
    }
    sum[i][0] = 0;
    REP(j, 1, s){
      sum[i][j] = sum[i][j-1] + dp[i][j];
      sum[i][j] %= MOD;
    }
  }

  ll ans = 0;
  REP(i, 1, 699){
    ans += dp[i][s];
    ans %= MOD;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 25572
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){

    int L, R; cin >> L >> R;

    int ans = 2019;
    if (R - L >= 2019){
        ans = 0;
    }else{

        for (int i = L; i <= R - 1; i++){
            for (int j = i + 1; j <= R; j++){
                int I = i % 2019;
                int J = j % 2019;
                if ((I * J) % 2019 < ans){
                    ans = (I * J) % 2019;
                }
            }
        }
        
    }
    cout << ans << endl;
    

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    ll a[n];
    rep(i, 0, n) cin >> a[i];
    ll sum[n + 1] = {};
    rep(i, 0, n) {
        sum[i + 1] = sum[i] + a[i];
    }
    map<ll, ll> mp;
    rep(i, 0, n + 1) {
        mp[sum[i]]++;
    }
    ll ans = 0;
    for (auto i : mp) {
        ans += i.second * (i.second - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 15872
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <cmath>
using namespace std;
using ll = long long;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b, c, ans = 0;

    cin >> a >> b >> c;

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

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
package main

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

func dfs(A []int, step, sum, target int) bool {
	if sum == target {
		return true
	} else if step == len(A) {
		return false
	}
	if dfs(A, step+1, sum+A[step], target) {
		return true
	}
	if dfs(A, step+1, sum, target) {
		return true
	}
	return false
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	A := make([]int, n)
	for i := range A {
		A[i] = nextInt(sc)
	}
	q := nextInt(sc)
	wtr := bufio.NewWriter(os.Stdout)
	for i := 0; i < q; i++ {
		m := nextInt(sc)
		if dfs(A, 0, 0, m) {
			fmt.Fprintln(wtr, "yes")
		} else {
			fmt.Fprintln(wtr, "no")
		}
	}
	wtr.Flush()
}
func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}



Measured memory_bytes: 1132
#include<stdio.h>
#define N -1
#define MAX 100001
 
struct Node{
  int p,l,r;
};
struct Node T[MAX]; 
 
void preorder(int);
void inorder(int);
void postorder(int);

main(){
  int parent;
  int n;
  int i;
  
scanf("%d",&n);
 
 for(i=0; i < n; i++){
   T[i].p = T[i].l = T[i].r = N;
 }
 
 for(i = 0; i < n; i++){
   scanf("%d",&parent);
   scanf("%d %d",&T[parent].l,&T[parent].r);
   T[T[parent].l].p = parent;
   T[T[parent].r].p = parent;
 }
 
 for(i =0; i<n; i++){
   if( T[i].p == N) break;
 }
 printf("Preorder\n");
 preorder(i);
 printf("\n");
 printf("Inorder\n");
 inorder(i);
 printf("\n");
 printf("Postorder\n");
 postorder(i);
 printf("\n");
 return 0;
}

void preorder(int i){
  printf(" %d",i);
  if(i != N){
    if(T[i].l != N) preorder(T[i].l);
    if(T[i].r != N) preorder(T[i].r);
  }
}

void inorder(int i){
  if(i != N){
    if(T[i].l != N){
      inorder(T[i].l);
    }
    printf(" %d",i);
    if(T[i].r != N){
      inorder(T[i].r);
    }
  }
}

void postorder(int i){
  if(i!=N){
    if(T[i].l != -1) postorder(T[i].l);
    if(T[i].r != -1) postorder(T[i].r);
  }
  printf(" %d",i);
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i, n) cin >> h.at(i);
  vector<bool> can(n, false);
  rep(i, n - 1) {
    if (h.at(i + 1) - h.at(i) <= 0) {
      can.at(i) = true;
    }
  }
  int res = 0;
  int cnt = 0;
  rep(i, n) {
    if (can.at(i)) {
      cnt++;
    } else {
      res = max(res, cnt);
      cnt = 0;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 640
n=int(input())

alphabet="abcdefghijklmnopqrstuvwxyz"
def get_keta(n):
    i=1
    check=26
    while True:
        if n<=check:
            return i
        check=check*26+26
        i+=1

def get_new_n(n, keta):
    new_n = n
    for i in range(1, keta):
        new_n -= 26 ** i
    return new_n

keta=get_keta(n)
n=get_new_n(n,keta)-1
ans=[]
for i in range(keta):
    ans.append(alphabet[n%26])
    n-=n%26
    n=n//26

print("".join(ans)[::-1])







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

const long long MOD = 1e9 + 7;

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

    int n;
    cin >> n;

    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];

    long long ans = 0, mul = a[0];
    for (int i = 1; i < n; i++){
        ans += (mul * a[i]) % MOD;
        ans %= MOD;
        mul += a[i];
        mul %= MOD;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 4772
#include <bits/stdc++.h>
 
using namespace std;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
using ll = long long;
/*
    g++ -std=c++11 test.cpp -o test.out && ./test.out
*/
int n, m;
void solve(){
    char a; cin >> a;
    if(isupper(a)){
        cout << 'A';
    } else {
        cout << 'a';
    }
}   
 
int main()
{    
    ios::sync_with_stdio(false);
    cin.tie(0);
 
    solve();
    
    return 0;
}

Measured memory_bytes: 3692
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	a := scanInts(n)

	s := map[int]int{}
	sum := 0
	for i := 0; i < n; i++ {
		s[a[i]]++
		sum += a[i]
	}
	q := scanInt()
	for i := 0; i < q; i++ {
		b, c := scanInt(), scanInt()
		sum += -b*s[b] + c*s[b]
		fmt.Fprintln(wr, sum)
		s[c] += s[b]
		s[b] = 0
	}
}


Measured memory_bytes: 9440
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    ll a;
    cin >> a;
    long double b;
    cin >> b;
    cout << ll(a * b) << endl;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    string s;
    cin >> s;
    cout << s.substr(0,4) << " " << s.substr(4,8) << endl;
}

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

int N;
int h[100010];
int dp[100010];

int main () {

    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d", &h[i]);
    }

    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    for (int i = 2; i <= N; i++) {
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout << dp[N-1] << endl;

    return 0;
}

Measured memory_bytes: 1024
//  Created by conan1024hao on 2019/11/26.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //------------------------------
    ll n;cin>>n;
    string s;cin>>s;
    ll dp1[300006];
    ll dp2[300006];
    memset(dp1,0,sizeof(dp1));
    memset(dp2,0,sizeof(dp2));
    for(ll i=0;i<n;i++){
        if(i)
        dp1[i]+=dp1[i-1];
        if(s[i]=='E'&&i<n-1)
            dp1[i+1]++;
    }
    for(ll i=n-1;i>=0;i--){
        if(i!=n-1)
            dp2[i]+=dp2[i+1];
        if(s[i]=='W'&&i)
            dp2[i-1]++;
    }
    ll ans=0;
    for(ll i=0;i<n;i++){
        chmax(ans,dp1[i]+dp2[i]);
    }
    cout<<n-ans-1<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------



Measured memory_bytes: 5396
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int main() {
  int N;
  cin >> N;

  int ans = 0;
  repp(i, 1, N) {
    int keta = 0;
    int temp = i;
    while (temp) {
      temp /= 10;
      keta++;
    }
    if (keta % 2 == 1) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
h = list(map(int,input().split()))
 
dp = [0]*N
dp[1] = abs(h[1]-h[0])
 
for i in range(2,N):
    dp[i] = min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2])
print(dp[N-1])

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

#define INF (INT_MAX/2-1)
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

int main(){
  int A,B,T;
  cin>>A>>B>>T;
  cout<<T/A*B;
  return 0;
}



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

int main() {
    int n;
    cin >> n;
    string s(n, 'a'), t = s;
    for(;;) {
        cout << s << '\n';
        int i = n;
        while(i--) {
            s[i]++;
            if(i && s[i] > t[i - 1] + 1)
                s[i] = 'a';
            else
                break;
        }
        if(!i)
            break;
        t[i] = max(t[i], s[i]);
        while(++i < n)
            t[i] = t[i - 1];
    }
    cout << flush;
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll n,l; cin>>n>>l;
    ll tmp=0;
    ll res=0;
    rep(i,n){
        ll x; cin>>x;
        
        if(tmp<=l) res++;
        tmp+=x;
    }
    if(tmp<=l) res++;
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <tuple>
#include <random>
#include <unordered_map>
#include <unordered_set>
using namespace std ;

int main() {
    int hp_a, hp_b, atk_a, atk_b ;
    cin >> hp_a >> atk_a >> hp_b >> atk_b ;
    for (int i=0;i<10000;++i) {
        if (i%2 == 0) {
            if(hp_b <= atk_a) {
                cout << "Yes" ;
                break ;
            }
            hp_b -= atk_a ;
        } else {
            if(hp_a <= atk_b) {
                cout << "No" ;
                break ;
            }
            hp_a -= atk_b ;
        }
    } 
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

const int N = 100000 + 10;
int a[N];
vector<int> g[N];

int rec(int curr)
{
  vector<int> v;
  each (next, g[curr]) {
    // cout << curr+1 << " -> " << next+1 << endl;
    v.push_back(rec(next) + 1);
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  int mx = -1;
  for (int i = 0; i < v.size(); ++i) {
    mx = max(mx, v[i] + i);
  }
  // cout << curr+1 << ": " ; each (i, v) cout << i+1 << ' '; cout << endl;
  return v.size() ? mx : 0;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    fill(g, g + N, vector<int>());
    for (int i = 1; i < n; ++i) {
      int a;
      cin >> a;
      // cout << make_pair(a - 1 + 1, i + 1) << endl;
      g[a - 1].push_back(i);
    }
    cout << rec(0) << endl;
    // cout << endl;
  }
  
  return 0;
}


Measured memory_bytes: 13568
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#define rep(i,n) for (long long i=0; i < (n); ++i)
#define rep2(i,n,m) for(long long i=n;i<=m;i++)
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
 int h,w ;
 cin >>h>> w;
 char A[h][w] ;
 rep(i,h){
   rep(j,w) cin>>A[i][j] ;
 }
 int ans=0 ;
 rep2(i,1,h-1){
   rep2(j,1,w-1){
     int p=1 ;
     if(A[i][j]=='#'){
      if(((A[i-1][j]=='.')&&(A[i+1][j]=='.'))&&
      ((A[i][j-1]=='.')&&(A[i][j+1]=='.'))) p=2 ;
     }
   if(p==2) ans=1 ;
   }
 }
 if(ans==0)
 cout <<"Yes"<< endl ;
 else 
 
 cout <<"No"<<endl ;
     return 0;
}

Measured memory_bytes: 256
def main():
    from collections import defaultdict
    n = int(input())
    u = [input() for i in range(n)]
    d = defaultdict(int)
    for ui in u:
        d[ui] = 1
    m = int(input())
    f = True
    for _ in range(m):
        n = input()
        if d[n]:
            if f:
                print("Opened by " + n)
                f ^= 1
            else:
                print("Closed by " + n)
                f ^= 1
        else:
            print("Unknown " + n)

if __name__ == "__main__":
    main()


Measured memory_bytes: 6004
import sys
import heapq
import math
def input(): return sys.stdin.readline().rstrip()
def main():
    n, k = map(int,input().split())
    A = list(map(int,input().split()))
    def is_good(mid, key):
        kk = 0
        for a in A:
            kk += -(-a//mid)-1
        if kk <= key:
            return True
        else:
            return False
    def bi_search(bad, good, key):
        while good - bad > 1:
            mid = (bad + good)//2
            if is_good(mid, key):
                good = mid
            else:
                bad = mid
        return good
    
    print(bi_search(0, 1000000000, k))
    
    
    


if __name__=='__main__':
    main()

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

int main() {
    long long n;
    cin >> n;
    long long a[n + 1];
    for(long long i = 1; i <= n; i++) {
        cin >> a[i];
    }
    long long gcd = a[1];
    for(long long i = 2; i <= n; i++) {
        gcd = __gcd(gcd, a[i]);
    }
    if(gcd != 1) {
        cout << "not coprime\n";
        return 0;
    }
    set<long long> Prime, ThisOne;
    for(long long i = 1; i <= n; i++) {
        ThisOne.clear();
        for(long long j = 2; j <= sqrt(a[i]); j++) {
            if(a[i] % j == 0) {
                if(Prime.count(j) && !ThisOne.count(j)) {
                    cout << "setwise coprime\n";
                    return 0;
                }
                Prime.insert(j);
                ThisOne.insert(j);
                a[i] /= j;
                j--;
            }
        }
        if(a[i] != 1) {
            if(Prime.count(a[i]) && !ThisOne.count(a[i])) {
                cout << "setwise coprime\n";
                return 0;
            }
            Prime.insert(a[i]);
            ThisOne.insert(a[i]);
        }
    }
    cout << "pairwise coprime\n";
}


Measured memory_bytes: 11500
#include<stdio.h>

int n,count;

int judge(int a,int b,int c){
  if((a<b&&b<c)||(c<b&&b<a)){
    return 1;
  }
  return 0;
}

int main(void){
  scanf("%d",&n);
  int array[n];
  for(int i=0;i<n;i++){
    scanf("%d",&array[i]);
  }
  count = 0;
  for(int i=0;i<(n-2);i++){
    count += judge(array[i],array[i+1],array[i+2]);
  }
  printf("%d",count);
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    int n,a[110][2];
    cin>>n;
    lol(j,2)lol(i,n)cin>>a[i][j];
    int maxi=0;
    lol(i,n){
	int cnt=0;
	lol(j,n){
	    if(j<=i)cnt+=a[j][0];
	    if(j>=i)cnt+=a[j][1];
	}
	maxi=max(maxi,cnt);
    }
    cout<<maxi<<endl;
    return 0;
}


Measured memory_bytes: 256
require 'prime'

n = gets.to_i
ary = Prime.prime_division(n)
div_ary = []
ary.each do |i|
  a = i.shift
  b = i.shift
  check_j = 0
  (1..b).each do |j|
    if b > check_j
      div_ary.push(a**j)
      b -= j
      check_j = j
    else
      break
    end
  end
end
print div_ary.uniq.count

Measured memory_bytes: 14460
#include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define vp vector<pair<ll,ll> >
#define se second
#define fi first
#define vi vector<ll>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define fab(i,a,b) for(ll i=a;i<=b;i++)
#define inp(n,a) for(ll i=0;i<n;i++){cin>>a[i];}
#define FASTER std::ios::sync_with_stdio(false)
#define DEBUG(x) cout<<#x<<" = "<<x<<endl
#define strToInt(x,z) istringstream y(x);y>>z  //(string,lleger)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b / __gcd(a,b);
#define mod 1000000007
#define pi 3.14159265
using namespace std;


const long long  MOD =1000000007;
ll digits(ll x)
{
	int d = 0;
	while(x >0)
	{
		x/=10;
		d++;
	}
	return d;
}

int main()
{
	FASTER;
	ll n;
	scanf("%lld",&n);
	//set<ll> divisors;
	ll ans = INT_MAX;
	for(ll i = 1 ; i*i <= n ; i++)
	{
		if(n%i == 0)
		{
			ll x = i;
			ll y = n/i;
			//DEBUG(x);DEBUG(y);
			ans = min(ans, max(digits(x),digits(y)));
		}
	} 

	cout << ans <<endl;
}

Measured memory_bytes: 256
N,K=[int(s) for s in input().split()]
ls=[-1 for _ in range(N+1)]
for _ in range(K):
  a,b=[int(s) for s in input().split()]
  if ls[a]==-1:
    ls[a]=b
  elif ls[a]==b:
    continue
  else:
    ls[0]=0
ans=0


if ls[0]==0:
  print(-1)
else:
  if N==1:
    ans=max([ls[1],0])    
  if N==2:
    for i in range(10,100):
      if ls[1]==0:
        ans=-1
      else:
        a=i//10
        b=i%10
        if (a==ls[1] or ls[1]==-1) and (b==ls[2] or ls[2]==-1):
          ans=i
          break
  if N==3:
    for i in range(100,1000):
      if ls[1]==0:
        ans=-1
      else:
        a=i//100
        b=(i//10)%10
        c=i%10
        if (a==ls[1] or ls[1]==-1) and (b==ls[2] or ls[2]==-1) and (c==ls[3] or ls[3]==-1):
          ans=i
          break
  print(ans)


Measured memory_bytes: 3192
a=int(input())
b=list(map(int,input().split()))
c=0
d=0
e=0
f=0
g=0
h=0
i=0
j=0
k=0
x=0
for z in range(a):
  if b[z]<=399:
    c=c+1
  if 400<=b[z]<799:
    d=d+1
  if 800<=b[z]<=1199:
    e=e+1
  if 1200<=b[z]<=1599:
    f=f+1
  if 1600<=b[z]<=1999:
    g=g+1
  if 2000<=b[z]<=2399:
    h=h+1
  if 2400<=b[z]<=2799:
    i=i+1
  if 2800<=b[z]<=3199:
    j=j+1
  if b[z]>=3200:
    k=k+1
if c!=0:
  x=x+1
if d!=0:
  x=x+1
if e!=0:
  x=x+1
if f!=0:
  x=x+1
if g!=0:
  x=x+1
if h!=0:
  x=x+1
if i!=0:
  x=x+1
if j!=0:
  x=x+1
if k+x>a:
  print(x,a)
elif (c+d+e+f+g+h+i+j)==0 and k!=0:
  print(1,k)
else:
  print(x,k+x)

Measured memory_bytes: 9304
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define maxn 100005
#define ld long double

ll fastpower (ll b , ll p){
    ll k= p%2 ? b : 1 ;
    return p==0 ? 1 : k*(fastpower(b*b,p/2));
}

ld dp[305][305][305];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	ll cnt[4]={0,0,0,0};
	ll x;
	for(int i=0;i<n;i++){
		cin>>x;
		cnt[x]++;
	}
	dp[0][0][0]=0;
	for(ll three=0;three<=n;three++){
		for(ll two=0;two<=n;two++){
			for(ll one=0;one<=n;one++){
				ll zero=n-two-three-one;
				if(zero<0 || zero==n) continue;
				ld value=1.0;
				if(three>0) value+=(1.0*three/n)*dp[three-1][two+1][one];
				if(two>0) value+=(1.0*two/n)*dp[three][two-1][one+1];
				if(one>0) value+=(1.0*one/n)*dp[three][two][one-1];
				//dp[three][two][one]=(value)/(1-1.0*zero/n);
				dp[three][two][one]=(value*n)/(1.0*(one+two+three));
			}
		}
	}
	ld ans=dp[cnt[3]][cnt[2]][cnt[1]];
	cout.precision(20);
	cout<<ans;
}

Measured memory_bytes: 216052
s = list(input())
n = len(s)
ans_1 = -1
ans_2 = -1
if n == 2:
  if s[0] == s[1]:
    ans_1 = 1
    ans_2 = 2
else:
  for i in range(n-2):
    if s[i] == s[i+1]:
      ans_1 = i+1
      ans_2 = i+2
      break
    elif s[i] == s[i+2]:
      ans_1 = i+1
      ans_2 = i+3
      break
print(ans_1,ans_2)

Measured memory_bytes: 49520
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,pii> pipii;
typedef long long ll;
typedef pair<ll,ll> pll;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=2e18;
const ll MOD=1e9+7;
struct edge{
    int to;
    int cost;
};

int main(){
    int N;
    string S;
    cin>>N>>S;
    S+=S[0];
    for(int i=0;i<2;++i){
        for(int j=0;j<2;++j){
            string A="";
            A+=(i==0?'S':'W');
            A+=(j==0?'S':'W');
            for(int k=1;k<=N;++k){
                if((S[k]=='o'&&A[k]=='S')
                ||(S[k]=='x'&&A[k]=='W')){
                    if(A[k-1]=='S') A+='S';
                    else A+='W';
                }else{
                    if(A[k-1]=='S') A+='W';
                    else A+='S';
                }
            }
            if(A[0]==A[N]&&A[1]==A[N+1]){
                for(int k=0;k<N;++k){
                    cout<<A[k];
                }
                cout<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<endl;
    return 0;
}



Measured memory_bytes: 3712
#include<stdio.h>
#include<string.h>
int main(){
  char s1[101],s2[101];
  int n,i,taro=0,hana=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){ 
    scanf("%s %s",s1,s2);
    if(strcmp(s1,s2)==0){ 
      taro++;
      hana++;
    }
    if(strcmp(s1,s2)>0){ 
      taro=taro+3;
    }
    if(strcmp(s1,s2)<0){ 
      hana=hana+3;
    }
  }
  printf("%d %d\n",taro,hana);
  return(0);
}

Measured memory_bytes: 1032
#include<vector>
#include<iostream>
using namespace std;
vector<int>v(1000, 1);
void func(int n)
{
	
	for (int i = 2; i*i <= n; i++)
	{
		if (n%i == 0)
		{
			v[i]++;
			n = n /i;
			i--;
		}
		
	}
	if (n != 1)
	{
		v[n]+=1;
	}
	
}
int main()
{
	int N;
	cin >> N;
	for (int i = 1; i <= N; i++)
	{
		func(i);
	}
	long long ans = 1;
	for (int i = 0; i < 1000; i++)
	{
		ans = (ans * v[i])%1000000007;
	}
	cout << ans << endl;
}














Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <queue>
#define MN 1000

int h,w;
char c[MN+5][MN+5];

struct point{
	int x,y;
	point(){
		
	}
	point(int x,int y){
		this->x = x;
		this->y = y;
	}
}s,t;

std::deque<point> q;
int dist[MN+5][MN+5];
bool vis[MN+5][MN+5];

void fun1(int d,int x,int y,int tp){
	if(x<1||x>h||y<1||y>w) return;
	if(c[x][y]=='#') return;
	d += tp;
	if(d<dist[x][y]){
		dist[x][y] = d;
		if(tp==0) q.push_front(point(x,y));
		if(tp==1) q.push_back(point(x,y)); 
	}
}

int main(){
	scanf("%d%d",&h,&w);
	scanf("%d%d%d%d",&s.x,&s.y,&t.x,&t.y);
	for(int i=1;i<=h;i++)
		scanf("%s",&c[i][1]);
	memset(dist,0x7f,sizeof(dist));
	dist[s.x][s.y] = 0;
	q.push_front(point(s.x,s.y));
	while(!q.empty()){
		point p = q.front(); q.pop_front();
		if(vis[p.x][p.y]) continue;
		vis[p.x][p.y] = true;
		fun1(dist[p.x][p.y],p.x-1,p.y,0);
		fun1(dist[p.x][p.y],p.x+1,p.y,0);
		fun1(dist[p.x][p.y],p.x,p.y-1,0);
		fun1(dist[p.x][p.y],p.x,p.y+1,0);
		for(int dx=-2;dx<=2;dx++){
			for(int dy=-2;dy<=2;dy++){
				fun1(dist[p.x][p.y],p.x+dx,p.y+dy,1);
			}
		}
	}
	printf("%d\n",dist[t.x][t.y]==0x7f7f7f7f?-1:dist[t.x][t.y]);
}


Measured memory_bytes: 9236
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string str, op, p;
    int32_t q, a, b;

    cin >> str >> q;

    for (int32_t i = 0; i < q; i++) {
        cin >> op >> a >> b;

        if (op == "print") {
            cout << str.substr(a, b - a + 1) << endl;
        } else if (op == "reverse") {
            reverse(str.begin() + a, str.begin() + b + 1);
        } else if (op == "replace") {
            cin >> p;
            str.replace(str.begin() + a, str.begin() + b + 1, p);
        }
    }

    return 0;
}

Measured memory_bytes: 3176
A = Array.new(N=gets.to_i) { gets.to_i }

nums = A.group_by { |x| x }
        .map { |k, v| [ k, v.size ] }
        .to_h

count = 0
nums.each do |k, v|
  count += 1 if v.odd?
end
puts count

Measured memory_bytes: 26876
import bisect

N = int(input())
A = list(map(int, input().split()))
A.sort()
B = list(map(int, input().split()))
C = list(map(int, input().split()))
C.sort()

ans = 0
for b in B:
    top = bisect.bisect_left(A, b)
    bottom = N - bisect.bisect_right(C, b)
    ans += top * bottom

print(ans)

Measured memory_bytes: 23232
n,m=map(int,input().split())
alist=list(map(int,input().split()))
soutokuhyou = sum(alist) / (4*m)
count = 0

for i in alist:
    if i >= soutokuhyou:
        count += 1

if count >= m:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
N, M = map(int, input().split())

R = [0 for _ in range(N+1)] # possibility to include the red ball
C = [1 for _ in range(N+1)] # number of balls
R[1] = 1


for i in range(M):
    x, y = map(int, input().split())
    if R[x] == 1:
        R[y] = 1
        if C[x] == 1:
            R[x] = 0
    C[x] -= 1
    C[y] += 1
#    print('R', R)
#    print('C', C)
print(R.count(1))

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

#define BUFF_SIZE 1024
char buffer[1024 * 1024];
int pos = 0;
int end = 0;

int mygetchar(){
  if(pos == end){
    end = read(0, buffer, sizeof(buffer));
    pos = 0;
  }
  return buffer[pos++];
}

int getInt(){
  int ret = 0, c;
  c = mygetchar();
  while(!isdigit(c)) c = mygetchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = mygetchar();
  }
  return ret;
}

#define mask (0x7F)
int cnt[mask];

int main(){
  int n, i;
  while(n = getInt()){
    const int n2 = n / 2;
    memset(cnt, 0, sizeof(cnt));

    for(i = 0; i < n; i++){
      int a = getInt();

      if(++cnt[a & mask] > n2){
	printf("%d\n", a);
	for(++i; i < n; i++)
	  getInt();
	goto end;
      }

    }

    puts("NO COLOR");

  end:;
  }
  return 0;
}

Measured memory_bytes: 1384
from collections import deque
from itertools import product

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

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]


def bfs(x, y):
    que = deque()
    res = 0
    dist = [[-1 for _ in range(W)] for _ in range(H)]

    que.append((x, y))
    dist[x][y] = 0
    while que:
        x, y = que.pop()
        res = max(res, dist[x][y])

        for i in range(4):
            nx, ny = x + dx[i], y + dy[i]

            if nx < 0 or nx >= H or ny < 0 or ny >= W:
                continue
            if Shw[nx][ny] == "#":
                continue

            if dist[nx][ny] == -1:
                dist[nx][ny] = dist[x][y] + 1
                que.appendleft((nx, ny))
    return res


ans = 0
for x, y in product(range(H), range(W)):
    if Shw[x][y] == "#":
        continue
    ans = max(ans, bfs(x, y))
print(ans)


Measured memory_bytes: 3316
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
 
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
 
int main(){
  int A, B, C, K;
  scanf("%d %d %d %d", &A, &B, &C, &K);
  int M = max(A, max(B, C));
  int T = M;
  rep(i, K) T *= 2;
  printf("%d\n", A+B+C-M+T);
  return 0;
}


Measured memory_bytes: 256
import sys

if sys.argv[-1] == 'ONLINE_JUDGE':
    import os
    def write_script(sp):
        if os.path.dirname(sp[1]):
            os.makedirs(os.path.dirname(sp[1]), exist_ok=True)
        with open(sp[1], 'w') as f_write:
            line = f.readline()
            while line:
                if line.startswith("'''"):
                    return
                if line.startswith("###nbacl"):
                    sp = line.split()
                    break
                f_write.write(line)
                line = f.readline()
        write_script(sp)


    with open(__file__) as f:
        line = f.readline()
        while line:
            if line.startswith('###nbacl'):
                sp = line.split()
                write_script(sp)
                break
            line = f.readline()

    import nbmodule
    nbmodule.cc.compile()
    exit(0)


from nbmodule import solve
import numpy as np
i4 = np.int32


def main():
    f = open(0)
    N, Q = [int(x) for x in f.readline().split()]
    ap = np.fromstring(f.read(), i4, sep=' ').reshape((-1, 2))
    a = ap[:N - 1] - 1
    a = np.concatenate((a, a[:, ::-1]))
    p = ap[N - 1:]
    val = solve(a, p, N)
    print(*val.tolist())


if __name__ == '__main__':
    main()

'''
###nbacl nbacl/graphs/adjacency_list.py
import numpy as np
from numba import njit
from collections import namedtuple

AdjacencyList = namedtuple('AdjacencyList', ['v', 'adj'])

@njit
def adjacency_list(n, a):
    """
    隣接リストの作成
    :param n: vertex の数
    :param a: 2d の ndarray, 各行は、[u, v] u: Edge の始点、v: Edge の終点
    :return: AdjacencyList
    """
    v = np.zeros(n + 1, np.int32)
    for i in range(a.shape[0]):
        v[a[i, 0] + 1] += 1
    for i in range(1, v.shape[0]):
        v[i] += v[i - 1]
    adj = np.empty(a.shape[0], np.int32)
    temp = np.zeros(n, np.int32)
    for i in range(a.shape[0]):
        from_ = a[i, 0]
        adj[v[from_] + temp[from_]] = a[i, 1]
        temp[from_] += 1
    return AdjacencyList(v, adj)


@njit
def at(gc, n):
    return gc.adj[gc.v[n]:gc.v[n + 1]]


@njit
def iter(gc, n):
    for i in range(gc.v[n], gc.v[n + 1]):
        yield gc.adj[i]        

###nbacl nbmodule.py
import numpy as np
import nbacl.graphs.adjacency_list as tree
from numba import njit
from numba.types import Array, int32
from numba.pycc import CC
i4 = np.int32
cc = CC('nbmodule')


@njit
def dfs(d, prev, tr, u, val):
    y = val[d]
    for x in tree.iter(tr, d):
        if x == prev:
            continue
        val[x] = y + u[x]
        dfs(x, d, tr, u, val)


@cc.export('solve', (Array(int32, 2, 'C'), Array(int32, 2, 'C'), int32))
def solve(a, p, N):
    tr = tree.adjacency_list(N, a)
    u = np.zeros(N, i4)
    val = np.zeros(N, i4)
    for i in range(p.shape[0]):
        u[p[i, 0] - 1] += p[i, 1]
    val[0] = u[0]
    dfs(int32(0), int32(-1), tr, u, val)
    return val

'''

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

int main() {
  int N, ans = 0;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < N - 2; i++) {
    for (int j = i + 1; j < N - 1; j++) {
      for (int k = j + 1; k < N; k++) {
        if (vec.at(i) == vec.at(j) || vec.at(j) == vec.at(k) || vec.at(i) == vec.at(k)) {
          continue;
        }
        else if (vec.at(i) + vec.at(j) > vec.at(k) && vec.at(j) + vec.at(k) > vec.at(i) && vec.at(k) + vec.at(i) > vec.at(j)) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}


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

int main() {

long long n,k;
cin >> n>>k ;
long long keta=0;
long long i=0.0;
while (n>=pow(k, i))
{
  i++;
}

keta=i;
cout << keta << endl;



}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

Measured memory_bytes: 256