akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    ll x, y;
    cin >> x >> y;
    ll ans = 0, i = 1;
    while (x <= y) {
    	ans++;
    	x *= 2;
	}
	cout << ans;
}

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

using namespace std;

int v[55], n, c, ans;
int main()
{
    cin>>n;
    for (int i=1; i<=n; i++)
    {
        cin>>v[i];
    }

    for (int i=1; i<=n; i++)
    {
        cin>>c;
        if (v[i]>c)
            ans+=(v[i]-c);
    }
    cout<<ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<iomanip>
using namespace std;
int main(){
    int N,K;
    double ans;
    double number = 1;
    int i;
    cin >> N >> K;
    
    ans = 0;
    for(i=N;i>=1;i--){
        while( i * number < K){
            number *= 2;
        }
        ans += 1/number;
    }
    ans /= N;
    cout << setprecision(10) << ans << endl;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        long sum = 0;
        ArrayList<Integer> ali = new ArrayList<>();
        for(int a = scn.nextInt(); scn.hasNext(); sum += a) {
            a = scn.nextInt();
            ali.add(a);
        }
        Collections.sort(ali);
        System.out.println(
          ali.get(0) + " " + ali.get(ali.size() - 1) + " " + sum
        );
    }
}

Measured memory_bytes: 43724
#include<iostream>
using namespace std;
int main(void){
  int h,w,i,j;
  while(1){
    cin>>h>>w;
    if(h==0&&w==0)break;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	if(i==0||i==h-1||j==0||j==w-1){
	  cout<<"#";
	}else{
	  cout<<".";
	}
      }
      cout<<endl;
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
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; }
using Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
 int a;
  cin>>a;
 vector<string> p(a);
  rep(i,a){
    cin>>p[i];
  }
  vector<int> q(4);
  rep(j,a){
   if(p[j]=="AC"){
   q[0]++;
    }
   else if(p[j]=="WA"){
   q[1]++;
    }
   else if(p[j]=="TLE"){
   q[2]++;
    }
   else if(p[j]=="RE"){
   q[3]++;
    }
  }
  cout<<"AC x "<<q[0]<<endl;
  cout<<"WA x "<<q[1]<<endl;
  cout<<"TLE x "<<q[2]<<endl;
  cout<<"RE x "<<q[3];
}   

Measured memory_bytes: 6420
class Integer
  def divisors
    res = []
    1.upto((self**0.5)) do |i|
      if self % i == 0
        res.push i
        res.push self / i if i != self / i
      end
    end
    res.sort!
    block_given? ? res.each{|t| yield t } : res
  end
end

n, m = gets.to_s.split.map{|t| t.to_i }

m.divisors.reverse_each do |t|
  if m / t >= n
    puts t
    exit
  end
end

Measured memory_bytes: 1916
#include "bits/stdc++.h"
#define hhh cerr<<"hhh"<<endl
#define see(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const int maxn = 3e5+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;

inline int id(char c) {
    if(c=='R') return 0;
    if(c=='G') return 1;
    if(c=='B') return 2;
    return -1;
}

int cnt[3][maxn];
bool vis[3];
char s[maxn];

int main() {
    int n=read();
    scanf("%s", s+1);
    for(int i=1; i<=n; ++i) cnt[id(s[i])][i]=1;
    for(int c=0; c<3; ++c) {
        for(int i=n-1; i; --i) cnt[c][i]+=cnt[c][i+1];
    }
    ll ans=0;
    for(int i=1; i<=n-2; ++i) {
        for(int j=i+1; j<=n-1; ++j) if(s[i]!=s[j]) {
            memset(vis,0,sizeof(vis));
            vis[id(s[i])]=1; vis[id(s[j])]=1;
            int c;
            for(int i=0; i<3; ++i) if(!vis[i]) { c=i; break; }
            ans+=cnt[c][j+1];
            if(2*j-i<=n&&id(s[2*j-i])==c) ans--;
        }
    }
    cout<<ans<<endl;
}

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

typedef long long LL;
const int mod = 1000000007;
void reduce(int & x) { x += x >> 31 & mod; }
int n, X, Y, Z, ma, ch;
int f[41][2][1 << 17];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> X >> Y >> Z; ma = std::max({X, Y, Z});
	ch = 1 << X | 1 << (X + Y) | 1 << (X + Y + Z);
	f[0][0][0] = 1; const int U = 1 << X + Y + Z;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < 2; ++j)
			for (int k = 0; k < U; ++k)
				if (int t = f[i][j][k]) {
					for (int l = 1; l <= 10; ++l) {
						int nx = k | 1 << (k ? std::__lg(k) : 0) + l;
						bool can = (nx & ch) == ch;
						while (nx >= U) {
							nx >>= __builtin_ctz(nx); nx ^= 1;
							can |= (nx & ch) == ch;
						}
						reduce(f[i + 1][j | can][nx] += t - mod);
					}
				}
	int ans = 0;
	for (int k = 0; k < U; ++k) reduce(ans += f[n][1][k] - mod);
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 40192
def irekae(array2):
    return [array2[1],array2[0],array2[2]]

n=int(input())
l=[input().split() for i in range(n)]
"""
# print(l)
for i in range(len(l)):
    l[i].append(i+1)
    l[i][1]=int(l[i][1])
# print(l)
l.sort()
# print(l)
for i in range(len(l)):
    l[i]=irekae(l[i])
# print(l)
lsort=[]
while l!=[]:
    """
for i in range(len(l)):
    l[i].append(i+1)
    l[i][1]=int(l[i][1])
for i in range(len(l)):
    l[i]=irekae(l[i])
#print(l)
l.sort(reverse=True)
#print(l)
for i in range(len(l)):
    l[i]=irekae(l[i])
#print(l)

lx=sorted(l,key=lambda x: x[0])
#print(lx)
for i in range(len(lx)):
    print(lx[i][2])

Measured memory_bytes: 3064
def main():
    n = int(input())
    a = list(map(int, input().split()))
    m = int(input())
    b = list(map(int, input().split()))

    cnt = 0
    for y in b:
        for x in a:
           if y == x:
               cnt += 1
               break
    print(cnt) 

main()


Measured memory_bytes: 6548
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>


using namespace std;
typedef long long ll;
ll N;

int main(){

    ll X = 0;
    cin >> X;

    ll ans = 0;

    ll tmp = 0;
    while(X > tmp){
        if(tmp == X){
            cout << ans << endl;
            return 0;
        }
        tmp += ans;
        ans++;
    }

    cout << ans - 1 << endl;
    return 0;



}

Measured memory_bytes: 256
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
const int maxn=200003;
int main(){
  ll n,m;
  
  cin>>n>>m;
  if(n==1LL and m==1LL)cout<<1<<endl;
  else if(n==1LL or m==1LL)cout<<(n*m)-2LL<<endl;
  else cout<<n*m-(2LL*n+2LL*m)+4LL<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
#define repinv(i, st, n) for (int i = ((n)-1); i >= (st); --i)
#define debug(x) std::cout << #x << ": " << x << endl
typedef long long ll;
//INT_MAX, ULLONG_MAX, LLONG_MAX or numeric_limits<int>::min()

//------------------------------------------------------------------------//
int T;
const int maxn = 2e5+7;
int n;
ll c;
ll h[maxn];
ll dp[maxn];
ll dq[maxn], l, r;

inline ll m(int j) {return -2*h[j];}
inline ll b(int j) {return dp[j]+h[j]*h[j];}

bool is_cross_before(int newl, int dq1, int dq2)
{
  if ( (b(dq1)-b(newl)) * (m(dq1)-m(dq2)) <= (b(dq2)-b(dq1)) * (m(newl)-m(dq1)) ) return 1;
  //if(contact_pont(newl, dq1) <= contact_pont(dq1, dq2)) return 1;
  return 0;
}

ll f(int x, int id)
{
  return m(id)*x + b(id);
}

bool nxt_is_better(int x, int f1, int f2)
{
  //cout << f(x, f1) << " " << f(x, f2) << endl;
  return f(x, f1) >=  f(x, f2);
}

void solve()
{
  cin >> n >> c;
  rep(i, 1, n+1) cin >> h[i];

  l = 0, r = 0; //l is front, r is back+1
  //sz =
  dp[1] = 0;
  dq[r++] = 1;
  rep(i, 2, n+1)
  {
    //cout << "the deque" << endl;
    //rep(ii, l, r) cout << dq[ii]<< " \n"[ii == r-1];
    while(r-l > 1 && nxt_is_better(h[i], dq[l], dq[l+1])) //pop off useless of cur convex(=>) //type dq[l+1]=>dp[l+1]
    {
      l++;
    }
    int cur = dq[l];
    //cout << i << "th use " << cur << endl;
    dp[i] = dp[cur] + (h[i]-h[cur])*(h[i]-h[cur]) + c; //update dp
    dq[r++] = i; //add new line for i

    while(r-l > 2 && is_cross_before(dq[r-1], dq[r-2], dq[r-3])) //sz >= 3, cross off useless line
    {
      dq[r-2] = dq[r-1]; //mistake line
      r--;
    }

  }
  cout << dp[n] << endl;
  return;
}

/*
rep(j, 1, i)
{
  dp[i] = min(dp[j] + i*i-2*i*j+j*j + c); // c+i*i+ (dp[j] -2*i*j)
}
*/

signed main()
{
  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  T = 1;
  //cin >> T; //this
  while(T--) solve();
  return 0;
}


Measured memory_bytes: 4992
#include <vector>
#include <iostream>
#include <cstdlib>

int main()
{
    int N, K;
    std::cin >> N >> K;
    std::vector<int> okashi(N, 0); 
    
    for(int i = 0; i < K; i++) {
        int d;
        std::cin >> d;
        for(int j = 0; j < d; j++) {
            int A;
            std::cin >> A;
            okashi[A-1]++;
        }
    }
    
    int ninzuu = 0;
    for(int i = 0; i < N; i++) {
        if(okashi[i] == 0) {
            ninzuu++;
        }
    }
    std::cout << ninzuu << std::endl;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
const int mod = 1e9+7;
const int mx = INT_MAX;
const long double pi = 4*atan((long double)1);
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
#define file "orz"
int dp[200005][33], arr[200005];
int dp2[200005][33], arr2[200005];
signed main()
{
    //freopen(file".inp","r",stdin);
    //freopen(file".out","w",stdout);
//    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    	cin>>arr[i]; 
    for(int i=0;i<31;i+=2)
  	 	dp2[n-1][i]=dp[n-1][i]=i;
    for(int i=n-2;i>=0;i--)
    {
    	int tmp=arr[i];
    	for(int j=0;j<31;j+=2)
    	{
    		if(j>0)
    			tmp*=4;
    		int tmp2=arr[i+1];
    		int cnt=0;
    		while(tmp>tmp2)
    		{
    			cnt+=2;
    			tmp2*=4;
			}
//			cout<<"here";
			int temp=0, diff=0;
//			cout<<cnt<<endl;
			if(cnt>0)
			{
				temp=cnt;
				if(31<=temp)
				{
					diff=(temp-30)*(n-1-i);
					temp = 30;
				}
			}
//			cout<<"here";
//			cout<<temp<<" ";
			dp[i][j]=dp[i+1][temp]+j+diff;
//			cout<<"here"<<endl;
		}
//		cout<<"here";
	}
//	cout<<"here";
	for(int i=0;i<n;i++)
	{
		arr[i]*=2;
		arr2[n-i-1]=arr[i];
	}
	for(int i=n-2;i>=0;i--)
    {
    	int tmp=arr2[i];
    	for(int j=0;j<31;j+=2)
    	{
    		if(j>0)
    			tmp*=4;
    		int tmp2=arr2[i+1];
    		int cnt=0;
    		while(tmp>tmp2)
    		{
    			cnt+=2;
    			tmp2*=4;
			}
//			cout<<"here";
			int temp=0, diff=0;
//			cout<<cnt<<endl;
			if(cnt>0)
			{
				temp=cnt;
				if(31<=temp)
				{
					diff=(temp-30)*(n-1-i);
					temp = 30;
				}
			}
//			cout<<"here";
//			cout<<temp<<" ";
			dp2[i][j]=dp2[i+1][temp]+j+diff;
//			cout<<"here"<<endl;
		}
//		cout<<"here";
	}
	int ans = LLONG_MAX;	
	for(int i=0;i<n;i++)
		ans = min(ans,dp[i][0]+dp2[n-1-i][0]+i);
	cout<<ans;
}


Measured memory_bytes: 109888
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
	int n;
	cin >> n;
	map<pair<int,int>,bool> mp;
	vector<pair<int,int>> ans;
	if(n % 2 == 1){
		for(int i = 1;i <= n;i++){
			for(int j = 1;j <= n;j++){
				if(n - i != j && j != i && mp[P(i,j)] == false){
					ans.push_back(P(i,j));
					mp[P(i,j)] = true;
					mp[P(j,i)] = true;
				}
			}
		}
	}
	else{//n%2==0
		for(int i = 1;i <= n;i++){
			for(int j = 1;j <= n;j++){
				if(i + j != n + 1 && i != j && mp[P(i,j)] == false){
					ans.push_back(P(i,j));
					mp[P(i,j)] = true;
					mp[P(j,i)] = true;
				}
			}
		}
	}


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


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std ;
int main () {
  int N , M ;
  cin >> N ;
  vector<string> A(N) , B(M) ;
  for(int i = 0 ; i < N ; i++ ) cin >> A[i] ;
  cin >> M ;
  for(int i = 0 ; i < M ; i++ ) cin >> B[i] ;
  int ans = 0 ;
  for(int i = 0 ; i < N ; i++ ){
    int pre = 0 ;
    for(int j = 0 ; j < N ; j++ ){
      if(A[i]==A[j]){
        pre++ ;
      }
    }
    for(int j = 0 ; j < M ; j++ ){
      if(A[i]==B[j]){
        pre--;
      }
    }
    ans = max (ans,pre);
  }
  cout << ans << endl ;
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(X, N, P):
    cand = sorted(list(set(range(1000)) - set(P)))
    ans = (INF, 0)
    for n in cand:
        y = abs(X-n)
        ans = min(ans, (y, n))
    return ans[1]





def main():
    X, N = read_int_n()
    P = read_int_n()
    print(slv(X, N, P))


if __name__ == '__main__':
    main()


Measured memory_bytes: 78304
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a[9],b,tmp,c;
    for (b=0; b<10; b++) {
        scanf("%d",&a[b]);
    }
    for (c=1; c<10; c++) {
        for (b=0; b<10; b++) {
            if (a[b]<a[b+1]) {
                tmp=a[b];
                a[b]=a[b+1];
                a[b+1]=tmp;
            }
        }
    }
    for (b=0; b<3; b++) {
        printf("%d\n",a[b]);
    }
    return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#define FOR(i, n) for (int i = 1; i <= n; i++)
#define REP(i, n) for (int i = 0; i < n; i++)

using namespace std;

int n, m;
#define N 100010
int deg[N];
vector<int> adj[N];
int anc[N];
int main() {
#ifdef QWERTIER
  freopen("in.txt", "r", stdin);
#endif
  scanf("%d%d", &n, &m);
  FOR (i, n-1+m) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    deg[v]++;
  }
  queue<int> q;
  FOR (i, n) {
    if (deg[i] == 0) {
      q.push(i);
    }
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto v : adj[u]) {
      deg[v]--;
      if (deg[v] == 0) {
        q.push(v);
        anc[v] = u;
      }
    }
  }
  FOR (i, n) {
    printf("%d\n", anc[i]);
  }
  return 0;
}


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


int main(){
  
  string al  = "abcdefghijklmnopqrstuvwxyz";
  string ans = "";
  long long N, rem;
  cin >> N;
  
  while(N != 0){
    
    rem = (N - 1) % 26;
    ans += al.at(rem);
    N = (N - rem + 1) / 26;
  }
  
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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;}

int main() {
  int n;
  cin >> n;
  vector<string> v(n);
  map<string, int> mp;
  rep (i, n) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    auto itr = mp.find(s);
    if (itr != mp.end()) mp[s]++;
    else mp[s] = 1;
  }


  ll ans = 0;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    int tmp = itr->second;
    tmp--;
    while (tmp != 0) {
      ans += tmp;
      tmp--;
    }
  }
  P(ans);



  return 0;
}



Measured memory_bytes: 12032
n = int(input())
a_list = list(map(int, input().split()))

sum1 = a_list[0]

def func(sum1):
    cost = 0
    for i in a_list[1:]:
        # 前の合計値と次の合計値の積が負になれば良い
        if sum1 * (sum1 + i) < 0:
            sum1 += i
            continue
        else:
            if sum1 < 0:
                a_new = 1 - sum1
                cost += a_new - i
                sum1 += a_new
            else:
                a_new = -1 - sum1
                cost += i - a_new
                sum1 += a_new

    return cost

if a_list[0] > 0:
    # リストの最初が-1の場合のコストも考える
    answer = min(func(sum1), func(-1)+a_list[0]+1)
elif a_list[0] < 0:
    answer = min(func(sum1), func(1)-a_list[0]+1)
else:
    # リストの最初が0だったとき
    answer = min(func(1), func(-1)) + 1

print(answer)

Measured memory_bytes: 14468
/*input
12443
2141
*/
#include<bits/stdc++.h>
#define int long long
#define MOD 1000000007
#define MAX 100005
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define mii map<int,int>
#define vi vector<int>
#define ff first
#define ss second
#define T int t;cin>>t;while(t--)
using namespace std;

signed main(){
	int a;
	cin>>a;
	string s;
	cin>>s;
	cout<<(a>=3200?s:"red")<<"\n";
    return 0;
}


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

class uint_Trie {
	struct node {
		node *p, *l, *r;
		int cnt;
		node(node *p, node *l = nullptr, node *r = nullptr) : p(p), l(l), r(r), cnt(0) {}
	};
	node *root;
	int siz;
public:
	uint_Trie() : root(new node(nullptr)) {}
	int size() {
		return root->cnt;
	}
	void insert(unsigned val) {
		// if (find(val)) return; // multiset ???????¶????
		node *t = root;
		for (int i = 30; i >= 0; i--) {
			t->cnt++;
			if (val & (1 << i)) {
				if (t->r == nullptr) {
					t->r = new node(t);
				}
				t = t->r;
			}
			else {
				if (t->l == nullptr) {
					t->l = new node(t);
				}
				t = t->l;
			}
		}
		t->cnt++;
	}
	void erase(unsigned val) {
		node *t = root, *ne;
		for (int i = 30; i >= 0; i--) {
			t->cnt--;
			if (val & (1 << i)) {
				if (t->r == nullptr) return;
				t = t->r;
			}
			else {
				if (t->l == nullptr) return;
				t = t->l;
			}
		}
		t->cnt--;
		while (t != root && t->cnt == 0) {
			ne = t->p;
			(t == ne->l ? ne->l : ne->r) = nullptr;
			t = ne;
		}
	}
	bool find(unsigned val) {
		node *t = root;
		for (int i = 30; i >= 0; i--) {
			if (val & (1 << i)) {
				if (t->r == nullptr) return false;
				t = t->r;
			}
			else {
				if (t->l == nullptr) return false;
				t = t->l;
			}
		}
		return true;
	}
	unsigned max() {
		assert(root->cnt >= 1);
		node *t = root;
		unsigned res = 0;
		for (int i = 30; i >= 0; i--) {
			assert(t->l != nullptr || t->r != nullptr);
			if (t->r != nullptr) {
				res |= 1 << i;
				t = t->r;
			}
			else {
				t = t->l;
			}
		}
		return res;
	}
	unsigned min() {
		assert(root->cnt >= 1);
		node *t = root;
		unsigned res = 0;
		for (int i = 30; i >= 0; i--) {
			assert(t->l != nullptr || t->r != nullptr);
			if (t->l != nullptr) {
				t = t->l;
			}
			else {
				res |= 1 << i;
				t = t->r;
			}
		}
		return res;
	}
};

int main()
{
	cin.sync_with_stdio(false);
	uint_Trie ut;
	string com;
	int k;
	while (cin >> com, com != "end") {
		if (com == "insert") {
			cin >> k;
			ut.insert(k);
		}
		else {
			int res = ut.max();
			printf("%d\n", res);
			ut.erase(res);
		}
	}
	return 0;
}

Measured memory_bytes: 55732
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
using namespace std;

int main(){
  int S,W,ans=0;
  cin>>S>>W;
  
  if(S<=W) cout<<"unsafe"<<endl;
  else cout<<"safe"<<endl;
}

Measured memory_bytes: 3620
#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,bmi,bmi2,lzcnt")
#endif
#include <x86intrin.h>
#include <bits/stdc++.h>
using namespace std;

char readchar() {
  static char buf[1 << 15], *ptr = buf, *end = buf;
  if (ptr == end) ptr = buf, end = buf + fread(buf, 1, 1 << 15, stdin);
  return *ptr++;
}
void writechar(char c) {
  static char buf[1 << 15], *ptr = buf;
  if (ptr == end(buf) or c == 0) fwrite(buf, 1, ptr - buf, stdout), ptr = buf;
  *ptr++ = c;
}
__attribute__((destructor)) void destructor() { writechar(0); }
template <class Z = int> Z getint() {
  char c = readchar();
  bool neg = c == '-';
  Z res = neg ? 0 : c - '0';
  while (isdigit(c = readchar())) res = res * 10 + (c - '0');
  return neg ? -res : res;
}
template <class Z> void putint(Z a, char delim = '\n') {
  if (a < 0) writechar('-'), a = -a;
  int d[40], i = 0;
  do d[i++] = a % 10; while (a /= 10);
  while (i--) writechar('0' + d[i]);
  writechar(delim);
}

struct fenwick_set {
  int n, m;
  vector<uint64_t> dat;
  vector<int> tree;
  fenwick_set(int _n = 0) : n(_n), m(n / 64 + 1), dat(m), tree(m + 1) {}
  void set() {
    fill(begin(dat), end(dat), -1);
    for (int j = 1; j <= m; ++j) {
      tree[j] = _blsi_u64(j) * 64;
    }
  }
  void reset(int i) {
    dat[i / 64] &= ~(1uLL << i % 64);
    for (int j = i / 64 + 1; j <= m; j += _blsi_u64(j)) {
      --tree[j];
    }
  }
  int rank(int i) const {
    int res = _popcnt64(_bzhi_u64(dat[i / 64], i % 64));
    for (int j = i / 64; j; j = _blsr_u64(j)) {
      res += tree[j];
    }
    return res;
  }
};

template <class It, class F>
void bucket_sort(It first, It last, F to_key) {
  vector<int> head;
  for (auto it = first; it != last; ++it) {
    int k = to_key(*it);
    if (k >= (int)size(head)) head.resize(k + 1);
    ++head[k];
  }
  partial_sum(begin(head), end(head), begin(head));
  vector<typename It::value_type> buf(head.back());
  copy(first, last, rbegin(buf));
  for (const auto& e : buf) *(first + --head[to_key(e)]) = e;
}

int main() {
  int n = getint();
  int q = getint();
  vector<int> c(n);
  for (auto&& e : c) {
    e = getint() - 1;
  }
  struct query {
    int l, r, id;
  };
  vector<query> qs(q);
  for (int id = 0; id < q; ++id) {
    qs[id].l = getint() - 1;
    qs[id].r = getint();
    qs[id].id = id;
  }
  bucket_sort(begin(qs), end(qs), [&](auto&& e) { return n - e.l - 1; });
  vector<int> res(q), last(n, n);
  fenwick_set fs(n);
  fs.set();
  auto it = begin(qs);
  for (int i = n; i--; ) {
    if (last[c[i]] < n) {
      fs.reset(last[c[i]]);
    }
    last[c[i]] = i;
    while (it != end(qs) and it->l == i) {
      res[it->id] = fs.rank(it->r) - i;
      ++it;
    }
  }
  for (auto e : res) {
    putint(e);
  }
}


Measured memory_bytes: 18800
#include<stdio.h>
int main(){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a>b){
        if(c>d) printf("%d",b+d);
        else printf("%d",b+c);
    }
    else{
        if(c>d) printf("%d",a+d);
        else printf("%d",a+c);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}

int main(){
    ll n;cin>>n;
    vi v(n+1);
    rep(i,n+1)cin>>v[i];
    vi ma(n+1);
    ll cnt=1;
    rep(i,n+1){
        ma[i]=cnt-v[i];
        chmin(ma[i],inf);
        cnt=ma[i]*2;
        if(cnt<0)dame(-1);
    }
    ll node=v[n];
    ll ans=node;
    for(int i=n-1;i>=0;i--){
        chmin(node,ma[i]);
        node+=v[i];
        ans+=node;
    }
    out(ans);
}


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

typedef unsigned long long uLL;
typedef long long int LL;
typedef pair <int,int> pii;
typedef pair <int,pii> piii;
typedef pair <long long,long long> pll;
typedef pair <long long,pll> plll;
const int N = 1e5 + 5;
const int inf = 1e9;
const long long INF = 1e18;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const int MOD = 1000000007;

int n , k;
int a[ N ];
LL dp[ N ];

LL solve( int idx ) {
        if( idx > n ) return INF;
        if( idx == n ) return 0;
        if( dp[idx] != -1 ) return dp[idx];
        LL ret = INF;
        for( int i = 1; i <= k; i++ ) {
                ret = min( ret , solve( idx + i ) + abs( a[idx+i] - a[idx] ) );
        }
        return dp[idx] = ret;
}
int main( int argc , char const *argv[] ) {
        ios_base::sync_with_stdio( false ); cin.tie( NULL );
        cin >> n >> k;
        for( int i = 1; i <= n; i++ ) cin >> a[i];
        memset( dp , -1 , sizeof( dp ) );
        cout << solve( 1 ) << endl;
        return 0;
}













Measured memory_bytes: 6144
# 富士山八合目の山小屋から
# 今回は風が強すぎて山頂を目指せませんでしたがまた挑戦したいですね
# Aをやったけど余裕があったのでBも…
# https://atcoder.jp/contests/abc137/submissions/6891685

k, x = map(int, input().split())
i = x - k + 1
cnt = 1
while cnt < k*2:
    print(i, end=" ")
    cnt += 1
    i += 1

Measured memory_bytes: 3060
from collections import defaultdict
#from collections import deque

N, K=map(int, input().split())
A=list(map(int, input().split()))
#for i in range(N):
    #A[i]-=1
s=[0 for _ in range(N+1)]
for i in range(N):
    s[i+1]=(s[i]+A[i])%K
d=defaultdict(int)
ans=0
#q=deque()
for j in range(N+1):
    ans+=d[s[j]]
    d[s[j]]+=1
    #q.append(s[j])
    #if len(q)==K:
        #d[q[0]]-=1
        #q.popleft()
print(ans)

Measured memory_bytes: 63000
#include<stdio.h>

typedef struct { 
int a;
char c;
}Card;

Card A[100003],B[100003];
  
int partition(int,int);
void quickSort(int,int);

void merge(int,int,int);
void mergeSort(int,int);

int main(){
  int n,r,i,judge=0;

  scanf("%d",&n);

  for( i = 0 ; i < n ; i++ ){
    scanf("%s",&A[i].c);
    scanf("%d",&A[i].a);
    B[i] = A[i];
  }

  quickSort(0,n-1);
  mergeSort(0,n);

  for( i = 0 ; i < n ; i++ ){
    if( A[i].a != B[i].a || A[i].c != B[i].c ){
      judge = 1;
      break;
    }
  }

  if( judge == 1 ) printf("Not stable\n");
  else printf("Stable\n");

  for( i = 0 ; i < n ; i++ ){
    printf("%c %d\n",A[i].c,A[i].a);
  }
  
  return 0;
}


void quickSort(int p,int r){
  int q;
  if( p < r ){
    q = partition(p,r);
  quickSort(p,q-1);
  quickSort(q+1,r);
  }
}

int partition(int p,int r){
  int i,j,x;
  Card temp;
  x = A[r].a;
  i = p-1;
  for( j = p ; j < r ; j++ ){
    if( A[j].a <= x ){
      i = i + 1;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }
  temp = A[i+1];
  A[i+1] = A[r];
  A[r] = temp;
  return i+1;
}

void merge(int left,int mid,int right)
{
  int n1 = mid - left;
  int n2 = right - mid;
  Card L[n1+1],R[n2+1];
  int i,j,k;

  for( i = 0 ; i < n1 ; i++ )
    L[i] = B[left+i];
  for(i = 0 ; i < n2 ; i++ )
    R[i] = B[mid+i];
  L[n1].a = 1000000005;
  R[n2].a = 1000000005;
  i = 0;
  j = 0;
  for( k = left ; k < right ; k++ )
    {
      if(L[i].a <= R[j].a){
	B[k] = L[i];
	i = i + 1;
      }
      else
	{
	  B[k] = R[j];
	  j = j + 1;
	}
    }
}

void mergeSort(int left,int right)
{
  int mid;

  if( left+1 < right )
    {
      mid = (left+right)/2;
      mergeSort(left,mid);
      mergeSort(mid,right);
      merge(left,mid,right);
    }

}

Measured memory_bytes: 2948
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int a[100005];
int main() {
	int n;
	cin >> n;
	ll sum = 0;
	a[0] = 0;
	a[n + 1] = 0;
	for (int i = 1; i <=n; i++) {
		cin >> a[i];
		sum += abs(a[i] - a[i - 1]);
	}
	sum += abs(a[n + 1] - a[n]);
	ll ans;
	for (int i = 1; i <= n; i++) {
		ans = sum + abs(a[i - 1] - a[i + 1])-(abs(a[i+1]-a[i])+abs(a[i]-a[i-1]));
	
		cout << ans<< endl;
	}
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<fstream>
#include<algorithm>
#include<assert.h>
#include<stack>
#include<queue>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<random>
#include<string>
#include<numeric>
#include<list>
#include<unordered_set>
#include<ctime>
#include<sstream>
#include<vector>
#include<array>
#include <bitset>
#include<functional>
#include<string>
#pragma warning(disable:4996)
#include<iostream>
#include<string>
#include<cstring>
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include <iostream>
using namespace std;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>

#include <stdio.h>
#pragma warning(disable:4996)
int main()
{
	long long  n;
	cin >> n;
	long long base = 100;
	int cnt = 0;
	for(;base < n;cnt++)
	{
		base *= 1.01;
	}
	cout << cnt;
	return 0;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 1000001;

pi demap(int X) {
	int A = X % 1000;
	int B = X / 1000;
	return {B, A};
}

int mapTo(pi X) {
	return min(X.f, X.s) * 1000 + max(X.f, X.s);
}
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
	int N; cin >> N;
	
	vector<vi> graph(MX);
	
	int ind[MX]; F0R(i, MX) ind[i] = 0;
	
	F0R(i, N) {
		int lst; cin >> lst; lst--;
		F0R(j, N-2) {
			int cur; cin >> cur; cur--;
			
			int ear = mapTo({i, lst});
			int lat = mapTo({i, cur});
			graph[ear].pb(lat);
			ind[lat]++;
			lst = cur;
		}
		
	}
	
	vi tbr;
	F0R(i, MX) if (ind[i] == 0) tbr.pb(i);
	
	int proc = 0;
	
	int day = 0;
	
	while (sz(tbr) != 0) {
		day++;
		proc += sz(tbr);
		
		vi nxtTbr;
		
		F0R(x, sz(tbr)) {
			//if (demap(tbr[x]).f < 4 && demap(tbr[x]).s < 4) cout << "on day " << day << " processed " << demap(tbr[x]).f << " " << demap(tbr[x]).s << endl;
			int i = tbr[x];
			F0R(y, sz(graph[i])) {
				int nxt = graph[i][y];
				ind[nxt]--;
				if (ind[nxt] == 0) nxtTbr.pb(nxt);
			}
			
		}
		
		tbr = nxtTbr;
	}
	
	if (proc != MX) {
		cout<<-1;
	} else {
		cout<<day;
	}
	
	return 0;
}

Measured memory_bytes: 45432
n = int(input())
lst = list(enumerate(list(map(int, input().split()))))

sorted_lst = sorted(lst, key = lambda x: x[1])
left_next_index = list(range(-1, n - 1)) + [-1, -1]
right_next_index = list(range(1, n + 1)) + [n, n]

ans = 0
for i, p in sorted_lst:
    l2 = left_next_index[i]
    l1 = left_next_index[l2]
    r1 = right_next_index[i]
    r2 = right_next_index[r1]
    
    a = p * ((l2 - l1) * (r1 - i) + (r2 - r1) * (i - l2))
    ans += a
    
    left_next_index[r1] = l2
    right_next_index[l2] = r1
print(ans)

Measured memory_bytes: 25968
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b;
  	cin >> a >> b;
  if(a <= 8 && b <= 8)
    cout << "Yay!";
  else
    cout << ":(";
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9
#define f first
#define s second

typedef long long ll;

using namespace std;

int main()

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

    int H, L, h, l;

    cin >> H >> L >> h >> l;

    cout << (H*L)-(h*L+l*H-h*l);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////


int main() {
	ll N;
	cin >> N;
	vector<ll> c(13, 0);

	rep(i, N) {
		ll D;
		cin >> D;
		c[D]++;
	}

	ll ans = 0;

	rep(i, 1 << 12) {
		ll s = INF;

		vector<ll> t(24, 0);
		t[12] = 1;

		rep(j, 12) {
			ll x = c[j] / 2;
			ll y = (c[j] + 1) / 2;

			if ((i >> j) % 2 == 1) { t[12 + j] += x; t[12 - j] += y; }
			else { t[12 + j] += y; t[12 - j] += x; }
		}
		
		t[0] = c[12];

		rep(j, 24) {
			if (t[j] >= 2) { s = 0; }
			for (ll k = j + 1; k < 24; k++) {
				if (t[j] > 0 && t[k] > 0) {
					s = min(s, min(k - j, 24 - k + j));
				}
			}
		}

		ans = max(ans, s);
	}

	cout << ans;

	
	system("PAUSE");
}


Measured memory_bytes: 504
#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 ai, ao, bi, bo;
    cin >> ai >> ao >> bi >> bo;
    int a = 0;
    int b = 0;
    int ans = 0;
    rep(i, 101){
        if(ai == i) a = 1;
        if(bi == i) b = 1;
        if(ao == i) a = 0;
        if(bo == i) b = 0;
        if(a == 1 && b == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]

s = input()
n = len(s) - 1
total = 0
for i in range(2 ** n):
    indice = []
    sumup = 0
    for j in range(n):
        if (i >> j) & 1:
            indice.append(j)
    if indice == []:
        sumup += int(s)
    else:
        last_point = 0
        count = 0
        for i in indice:
            sumup += int(s[last_point:i+1])
            last_point = i+1
            count += 1
            if count == len(indice):
                sumup += int(s[last_point:])
    total += sumup

print(total)

# print(total)


Measured memory_bytes: 3064
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;
 
typedef tuple<ll,ll,ll> T;

int main(){
	int N,A,B;
	cin >> N >> A >> B;
	int ans=0;
	for(int i=0;i<N;i++){
		int n;
		cin >> n;
		if(n<A || B<=n)
			ans++;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    if(b-a==c-b)puts("YES");
    else puts("NO");
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define each(i, a) for(auto &i : a)
#define SORT(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

int main() {
    init();

    int n; cin >> n;
    map<string, int> m;
    FOR(i, 0, n) {
        string s; cin >> s;
        ++m[s];
    }
    cout << "AC x " << m["AC"] << "\n";
    cout << "WA x " << m["WA"] << "\n";
    cout << "TLE x " << m["TLE"] << "\n";
    cout << "RE x " << m["RE"] << "\n";

    return 0;
}

Measured memory_bytes: 3664
function Main(s) {
  var s = s.split("\n")[0].split(" ");
  var dif = parseInt(s[2], 10) - parseInt(s[1], 10);
  console.log(dif % 2 === 0 ? "Alice":"Borys");
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++){
		if(s.substr(i,1)=="?"){
			s.replace(i,1,"D");
		}
	}
	cout<<s<<endl;
}


Measured memory_bytes: 3764
using System.Collections.Generic;
using System.Linq;
using System;

public class P
{
    public int x { get; set; }
    public int y { get; set; }
}

public class Hello
{
    public static void Main()
    {
        var ps = new List<P>();
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        var ax = new int[n];
        var ay = new int[n];
        for (int i = 0; i < n; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var x = int.Parse(line[0]);
            var y = int.Parse(line[1]);
            ax[i] = x;
            ay[i] = y;
            ps.Add(new P { x = x, y = y });
        }
        Console.WriteLine(getAns(ax, ay, ps, n, k));
    }
    public static long getAns(int[] ax, int[] ay, List<P> ps, int n, int kk)
    {
        int p1; int p2; int p3; int p4;
        var retlist = new List<long>();
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                for (int k = 0; k < n; k++)
                    for (int L = 0; L < n; L++)
                    {
                        p1 = ax[i]; p2 = ax[j]; p3 = ay[k]; p4 = ay[L];
                        if ((p1 > p2) && (p3 > p4) && check(p1, p2, p3, p4, kk, ps))
                            retlist.Add((long)(p1 - p2) * (long)(p3 - p4));
                    }
        return retlist.Min();
    }
    public static bool check(int p1, int p2, int p3, int p4, int kk, List<P> ps)
    {
        var count = 0;
        foreach (var x in ps)
            if (x.x <= p1 && x.x >= p2 && x.y <= p3 && x.y >= p4) count++;
        return count >= kk;
    }
}

Measured memory_bytes: 29480
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;


string S;
string T;

int compare(int i) {
    // -1 : docchimo
    //  0 : T < S
    //  1 : S < T
    if (i >= S.length && i >= T.length) return -1;
    if (i >= T.length) return 0;
    if (i >= S.length) return 1;

    if (S[i] == '?' && T[i] == 'a') return compare(i+1);
    if (S[i] == '?' && T[i] == 'z') return compare(i+1);
    if (S[i] == '?' && T[i] > 'a' && T[i] < 'z') return -1;

    if (S[i] == T[i]) return compare(i+1);
    if (S[i] >  T[i]) return 0;
    if (S[i] <  T[i]) return 1;

    assert(0);
}

void main() {
    auto N = readln.chomp.to!int;
    string[] SS;
    foreach (i; 0..N) SS ~= readln.chomp;
    T = readln.chomp;

    int saisho = 1;
    int haba = 0;
    foreach (i; 0..N) {
        S = SS[i];
        int c = compare(0);
        if (c == -1) haba += 1;
        else if (c == 1) saisho += 1;
    }

    string[] ans;
    foreach (i; saisho..saisho+haba+1) ans ~= i.to!string;
    ans.join(" ").writeln;

}


Measured memory_bytes: 2556