akhauriyash/Code-Regression huggingface dataset:
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int q;
int c;
int a;
int n;
int main(){
	cin>>q;
	for(int i = 0;i <q;i++){
		int cnt= 0;
		cin>>c>>a>>n;
		while(1){
			if(c==0){
				break;
			}
			if(c-1>=0&&a-1>=0&&n-1>=0){
				cnt++;
				c--;
				a--;
				n--;
				continue;
			}
			if(c-2>=0&&a-1>=0){
				cnt++;
				c-=2;
				a--;
				continue;
			}
			if(c-3>=0){
				cnt++;
				c-=3;
				continue;
			}
			break;
		}
		cout <<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
using namespace std;
#define MOD (1000000007LL)
typedef long long ll;

int main() {
	ll n, k;
	ll _size = 0;
	scanf("%lld %lld", &n, &k);
	while (n) {
		ll re = n % k;
		_size += 1;
		n /= k;
	}
	printf("%lld", _size);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
 int N;
  int L;
  cin >>N>>L;
  vector<string> vec(N);
  rep(i,N) {
cin >>vec.at(i);
  }
  sort(all(vec));
  rep(i,N) {
cout<<vec.at(i);
  }
  
  
}
  


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#define INF 1 << 28
using namespace std;

typedef pair<int,int> P;

int main ()
{
    int n;
    while (cin >> n, n) {
        string str1, str2;
        vector<P> time;
        while (n--) {
            cin >> str1 >> str2;
            for (int i = 0; i < str1.size(); i++) {
                if (str1[i] == ':') {
                    str1[i] = str2[i] = ' ';
                }
            }

            stringstream ss1, ss2;
            ss1 << str1;
            ss2 << str2;

            int t1, t2, t3;
            ss1 >> t1 >> t2 >> t3;
            int s = t1 * 60 * 60 + t2 * 60 + t3;
            ss2 >> t1 >> t2 >> t3;
            int e = t1 * 60 * 60 + t2 * 60 + t3;

            time.push_back(P(s,1));
            time.push_back(P(e,-1));
        }

        sort(time.begin(), time.end());

        int res = 0, MAX = 0;
        for (int i = 0; i < time.size(); i++) {
            res += time[i].second;
            MAX = max(MAX, res);
        }

        cout << MAX << endl;
    }

    return 0;
}

Measured memory_bytes: 1480
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

closest_dist = 1000000
ans = 0
for i, h in enumerate(H):
    if abs(A - T + h * 0.006) < closest_dist:
        ans = i
        closest_dist = abs(A - T + h * 0.006)
        
print(ans + 1)

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

using namespace std;
#define ll long long int
vector<ll> adj[10];
vector<ll> ans;
void solve(int cnt, int n, ll s, ll x){
    if(cnt==n){
        ans.push_back(s);
        return;
    }
    for(auto v:adj[x]){
        s*=10;
        s+=v;
        solve(cnt+1,n,s,v);
        s-=v;
        s/=10;
    }
}
int main()
{
    int k;
    cin >> k;
    for(ll i=0;i<=9;i++){
        if(i-1>=0)
        adj[i].push_back(i-1);
        adj[i].push_back(i);
        if(i+1<=9)
        adj[i].push_back(i+1);
    }
    for(int i=1;i<=9;i++) ans.push_back(i);
    for(int i=2;i<=10;i++){
        for(int j=1;j<=9;j++)
            solve(1,i,j,j);
    }
    //for(auto w:ans) cout << w << endl;
    cout << ans[k-1] << endl;
}


Measured memory_bytes: 2420
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	vector<int>V(3);
	rep(i, 3) {
		cin >> V[i];
	}
	sort(V);
	cout << V[0] * V[1] / 2 << endl;
}

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

#define F first 
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<pair<LL, int> > HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;

int na, nb, nc, k;
LL x[N], y[N], z[N], t[N];

bool cmp(LL a, LL b)
{
	return a > b;
}

void merge(LL a[], int n, LL b[], int m)
{
	HEAP heap;
	for (int i = 0; i < m; i ++ ) heap.push({a[0] + b[i], 0});
	
	n = min(k, n * m);
	for (int i = 0; i < n; i ++ )
	{
		LL v = heap.top().F;
		int j = heap.top().S;
		heap.pop();
		
		t[i] = v;
		if (j + 1 < na) heap.push({v - a[j] + a[j + 1], j + 1});
	}
	na = n;
	memcpy(a, t, sizeof t);
}

int main()
{
	cin >> na >> nb >> nc >> k;
	for (int i = 0; i < na; i ++ ) cin >> x[i];
	for (int i = 0; i < nb; i ++ ) cin >> y[i];
	for (int i = 0; i < nc; i ++ ) cin >> z[i];
	
	sort(x, x + na, cmp);
	
	merge(x, na, y, nb);
	merge(x, na, z, nc);
	
	for (int i = 0; i < k; i ++ ) cout << x[i] << endl;
    return 0;
}

Measured memory_bytes: 4468
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <complex>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n;
P p[100000];
P x[100000];
P y[100000];

struct Edge{
  int s,t;
  Edge():s(0),t(0){}
  Edge(int s,int t):s(s),t(t){}
  bool operator < (const Edge& rhs) const;
};

ll len(Edge x){ // x \in E
  P p1 = p[x.s];
  P p2 = p[x.t];
  P v = P(p1.first-p2.first, p1.second-p2.second);
  return min(abs(v.first),abs(v.second));
}

bool Edge::operator < (const Edge& rhs) const{
  const Edge& lhs = *this;
  return len(lhs)<len(rhs);
}

vector<Edge> E;

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

ll kruskal(){
  UnionFind UF(n);
  ll ret = 0;
  for(Edge e:E){
    if(!UF.findSet(e.s,e.t)){
      ret+=len(e);
      UF.unionSet(e.s,e.t);
    }
  }
  return ret;
}

int main(){
  cin>>n;
  for(int i=0;i<n;++i){
    int a,b;
    cin>>a>>b;
    p[i]=P(a,b);
    x[i]=P(a,i);
    y[i]=P(b,i);
  }
  sort(x,x+n);
  sort(y,y+n);

  for(int i=0;i<n-1;++i){
    E.push_back(Edge(x[i].second, x[i+1].second));
    E.push_back(Edge(y[i].second, y[i+1].second));
  }

  sort(E.begin(), E.end());
  cout << kruskal() << endl;
  return 0;
}


Measured memory_bytes: 4724
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long k = sc.nextLong();
        if (k <= a) {
            System.out.println(k);
        } else if (k <= a + b) {
            System.out.println(a);
        } else {
            System.out.println(a - (k - a - b));
        }
    }

}


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

int dp[17][17];
int map[17][17];
int y,x;

long long int check(int i,int j)
{
  if(j>=x||j<0)
    return 0;
  if(i>=y)
    return 1;

  if(map[i][j]==1)
    return 0;

  if(dp[i][j]!=-1)
    return dp[i][j];

  long long int sum=0; 
  if(i>=y-1)
    sum=1;
  else if(map[i][j]==2)
    sum=check(i+2,j);
  else
    {
      if(j-1>=0 && map[i+1][j-1]==0)
	sum+=check(i+1,j-1);
      sum+=check(i+1,j);
      if(j+1<x && map[i+1][j+1]==0)
	sum+=check(i+1,j+1);
    }
    

  // cout<<i<<" "<<j<<" " <<sum<<endl;
  dp[i][j]=sum;
  return sum;
}

int main()
{
  for(;cin>>x>>y,x;)
    {
      memset(dp,-1,sizeof(dp));
      memset(map,0,sizeof(map));
      for(int i=0;i<y;i++)
	for(int j=0;j<x;j++)
	  {
	    cin>>map[i][j];
	  }
      long long int ans=0;
      for(int i=0;i<x;i++)
	ans+=check(0,i);
      cout<<ans<<endl;
    }
}

Measured memory_bytes: 1156
n = int(input())
a = list(map(int, input().split()))

d = [abs(a[0])]
for i in range(n-1):
    d.append(abs(a[i+1] - a[i]))

d.append(abs(a[-1]))

s = sum(d)

for i in range(n):
    if i == 0:
        t = s - d[i] - d[i+1] + abs(a[i+1])
    elif i == n-1:
        t = s - d[i] - d[i+1] + abs(-a[i-1])
    else:
        t = s - d[i] - d[i+1] + abs(a[i+1] - a[i-1])
    print(t)

Measured memory_bytes: 20572
#include<bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < (int)(n); i++)
#define sum(a) accumulate(a.begin(),a.end(),0LL)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

int main(){
    ll n; cin >> n;
    vector<ll> a(n); rep(i,n) cin >> a[i];

    vector<ll> dp(n,0);
    for(long long i = 1; i < n; i++){
        if(a[i-1] + dp[i-1] > a[i]){
            dp[i] += dp[i-1] + (a[i-1] - a[i]);
        }
    }

    //for(auto x:dp) cout << x << " "; cout << endl;

    put(sum(dp));
}

Measured memory_bytes: 6424
import itertools
N, K = map(int, raw_input().split())
d = map(int, raw_input().split())
d = set(d)
ok = set(range(10)) - d
ok = sorted(list(ok))
ok = [str(i) for i in ok]
i = 1
while True:
    for ele in itertools.product(ok, repeat=i):
        if int("".join(list(ele))) >= N:
            print "".join(list(ele))
            exit()
    i += 1


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
typedef vector<ll> vl ;
typedef vector<int> vi ;
     
#define mp make_pair
#define pb push_back
#define rd(t,n) for (int i = 0; i < n; i++)cin>>t[i]
#define wr(t,n) for (int i = 0; i < n; i++)cout<<t[i]<<" "
#define bug cout<<"*"
#define mod 1000000007  //10 puis 9 +7
int w[100000];ll val[100];
ll t[100][100000];
ll dp(int n,ll wg)
{
	if(n==0 || wg==0)return 0;
	if(t[n-1][wg-1]!=-1)return t[n-1][wg-1];
	if(w[n-1]>wg)return dp(n-1,wg);
	return t[n-1][wg-1]=max(dp(n-1,wg),val[n-1]+dp(n-1,wg-w[n-1]));
}
int main() 
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*int q;cin>>q;
	while (q--)
	{
		int n;
	}*/	
	int n,wg;cin>>n>>wg;
	for (int i = 0; i < n; i++)
	{
		cin>>w[i]>>val[i];
	}
	
	memset(t,-1,sizeof(t));
	cout<<dp(n,wg);

	
	
}


Measured memory_bytes: 78336
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  int ans=1000000000;
  for(int i=0;i<26;i++){
    char ch=i+'a';
    vector<int> v;
    for(int j=0;j<s.size();j++){
      if(s[j]==ch)v.push_back(j);
    }
    if(v.size()==0)continue;
    int sum=v[0];
    for(int j=0;j<v.size()-1;j++){
      sum=max(sum,v[j+1]-v[j]-1);
    }
    int u=s.size()-1-v[v.size()-1];
    sum=max(sum,u);
    ans=min(ans,sum);
  }
  cout<<ans<<endl;
}

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

const int inf=1<<25;
int N,M,H,K;

struct node{int to,cost,hour,num;};
vector<node> graph[110];

void add_edge(int from,int to,int cost,int hour,int num){
	node in;
	in.to=to,in.cost=cost,in.hour=hour,in.num=num;
	graph[from].push_back(in);
}

void add_both_edge(int from,int to,int cost,int hour,int num){
	add_edge(from,to,cost,hour,num);
	add_edge(to,from,cost,hour,num);
}

int s,t;

// 2^8 *(500*24)*log(100*24)
// 250 * 500 * 25 = 31250000

typedef tuple<int,int,int> state;

int dijkstra(int mask){
	int dist[100][25];
	rep(i,N)rep(j,H+1) dist[i][j]=inf;
	dist[s][0]=0;
	priority_queue<state,vector<state>,greater<state>> q;
	state init(0,s,0);
	q.push(init);
	while(!q.empty()){
		int c,v,t;
		tie(c,v,t)=q.top();q.pop();
		for(auto &e:graph[v]){
			int nc=c;
			if(~mask&(1<<e.num)) nc+=e.cost;
			int nv=e.to;
			int nt=t+e.hour;
			if(nt>H) continue;
			if(dist[nv][nt]>nc){
				dist[nv][nt]=nc;
				q.push(make_tuple(nc,nv,nt));
			}
		}
	}
	int res=inf;
	rep(i,H+1) res=min(res,dist[t][i]);
	return res;
}

int main(void){
	while(cin >> N >> M >> H >> K,N){
		rep(i,110) graph[i].clear();
		rep(i,M){
			int a,b,c,h,r;
			cin >> a >> b >> c >> h >> r;
			a--,b--,r--;
			add_both_edge(a,b,c,h,r);
		}
		cin >> s >> t;
		s--,t--;

		int P;
		cin >> P;
		int dp[1<<8];
		rep(i,1<<K) dp[i]=inf;
		dp[0]=0;
		rep(i,P){
			int l,d;
			cin >> l >> d;
			int mask=0;
			rep(j,l){
				int k;
				cin >> k;
				k--;
				mask|=(1<<k);
			}
			dp[mask]=min(dp[mask],d);
		}
		rep(i,1<<K)rep(j,1<<K) dp[i|j]=min(dp[i|j],dp[i]+dp[j]);

		int ans=inf;
		rep(i,1<<K) ans=min(ans,dp[i]+dijkstra(i));
		if(ans==inf)
			cout << -1 << endl;
		else
			cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1392
n,k = map(int,input().split())
a = list(map(int,input().split()))
sal = [0] * (n*(n+1)//2)
l = 0
for i in range(n):
  for j in range(i,n):
    sal[l] = sum(a[i:j+1])
    l += 1
ans = 0
for i in range(41)[::-1]:
    cnt = 0
    temp = ans + 2**i
    for j in sal:
        if temp&j == temp:
            cnt += 1
    if cnt >= k:
        ans = temp
print(ans)


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

using namespace std;

#define LL long long
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    LL ans;
    int i,n,x,y,a[200002];
    priority_queue<pair<int,int>>pq;
    cin >> n;
    for(i=1;i<=n;i++)cin >> a[i];
    sort(a+1,a+n+1);
    ans=a[n],i=n-2;
    pq.emplace(a[n-1],a[n]);
    pq.emplace(a[n-1],a[n]);
    while(i > 0)
    {
        x=pq.top().first;
        y=pq.top().second;
        pq.pop();
        ans+=x;
        pq.emplace(a[i],x);
        pq.emplace(a[i--],y);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 6076
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n;
    cin>>n;
    ll sum=0;
    for(int i=1;;i++)
    {
        sum+=i;
        if(sum>=n)
        {
            cout<<i<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9+7;
const int INF = 1e9;
const int MAX = 1e6;

int main() {
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];
    // if ((n-1) % (k-1) == 0) cout << (n-1) / (k-1) << endl;
    // else cout << (n-1) / (k-1) + 1 << endl;
    cout << ceil((double)(n-1)/(k-1)) << endl;
}

Measured memory_bytes: 3796
N, H = map(int,input().split())
S = []
for i in range(N):
	S.append(list(map(int, input().split())))
tS = list(zip(*S))
A = tS[0]
B = tS[1]
maxA = max(A)
usB = [k for k in B if k > maxA]
BBB = sorted(usB, reverse = True)
cnt = 0
for b in BBB:
	H -= b
	cnt += 1
	if H <= 0:
		break
if H <= 0:
	print(cnt)
else:
	print(cnt + (H - 1)//maxA + 1)

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

using namespace std;

int main() {
    int n, m, l, r;
    cin >> n >> m >> l >> r;
    for (int i = 0; i < m - 1; ++i) {
        int l_, r_;
        cin >> l_ >> r_;
        l = max(l, l_);
        r = min(r, r_);
    }
    if (r - l + 1 < 0) {
        cout << 0 << endl;
    } else {
        cout << r - l + 1 << endl;
    }
}

Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
int main()
{
    char S1[100]="Sunny",S3[100]="Rainy",S2[100]="Cloudy",str[100];
    gets(str);
    if (strcmp(S1,str)==0)
    {
        printf("Cloudy");
    }
    else if (strcmp(S2,str)==0)
    {
        printf("Rainy");
    }
    else if (strcmp(S3,str)==0)
    {
        printf("Sunny");
    }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define f(i,a,b) for(long long i=a;i<b;i++)
#define Find find_by_order
#define Order order_of_key
#define F first
#define S second
#define pb(i) push_back(i)
#define mp(x,y) make_pair(x,y)
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
using namespace std;

int main(){
	string s;cin>>s;
	if(s=="SAT") cout<<"1\n";
	else if(s=="SUN") cout<<"7\n";
	else if(s=="MON") cout<<"6\n";
	else if(s=="TUE") cout<<"5\n";
	else if(s=="WED") cout<<"4\n";
	else if(s=="THU") cout<<"3\n";
	else if(s=="FRI") cout<<"2\n";
	return 0;
}

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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b)a=b;};
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b)a=b;};

signed solve(){
  const Int n=9;
  vector<Int> as(n),bs(n);
  for(Int i=0;i<n;i++) cin>>as[i];
  for(Int i=0;i<n;i++) cin>>bs[i];
  sort(as.begin(),as.end());
  Int num=0,cnt=0;
  do{
    Int x=0,y=0;
    for(Int i=0;i<n;i++){
      if(as[i]<bs[i]) x+=as[i]+bs[i];
      if(as[i]>bs[i]) y+=as[i]+bs[i];
    }
    if(x<y) num++;
    cnt++;
  }while(next_permutation(as.begin(),as.end()));

  double A=(double)num/cnt;
  double B=1.0-A;
  cout<<fixed<<setprecision(5);
  cout<<A<<" "<<B<<endl;
  return 0;
}

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

  Int T;
  cin>>T;
  while(T--) solve();  
  return 0;
}



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

// Begin Header {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

#define all(x) x.begin(), x.end()
#define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (intmax_t i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (intmax_t i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

constexpr size_t    operator""_zu(unsigned long long value) { return value; };
constexpr intmax_t  operator""_jd(unsigned long long value) { return value; };
constexpr uintmax_t operator""_ju(unsigned long long value) { return value; };

constexpr int INF = 0x3f3f3f3f;
constexpr intmax_t LINF = 0x3f3f3f3f3f3f3f3f_jd;

template <class T, class Compare = less<>>
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template <class T, class Compare = greater<>>
using MinHeap = priority_queue<T, vector<T>, Compare>;

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

template <class T>
inline istream& operator>>(istream &is, vector<T> &vec) {
    for (auto &e: vec) {
        is >> e;
    }
    return is;
}

inline void output() { cout << "\n"; }
template <class Head, class... Tail>
inline void output(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) {
        cout << " ";
    }
    output(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e: vec) {
        os << e << delim[&e == &vec.back()];
    }
    return os;
}

template <class T>
inline vector<T> makeVector(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeVector(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeVector<T>(initValue, args...))>(sz, makeVector<T>(initValue, args...));
}

template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}

    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

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

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

template <class T>
inline T diff(const T &a, const T &b) noexcept {
    return a < b ? b - a : a - b;
}
// End Header }}}

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

    var(size_t, N, L);

    vector<string> s(N);
    input(s);

    sort(all(s));

    for (const auto e: s) {
        cout << e;
    }

    output();

    return 0;
}


Measured memory_bytes: 256
h, w = gets.split.map(&:to_i)
maze = []
dot_cnt = 0 
h.times{
  a = gets.chomp.split(//)
  dot_cnt += a.count(".")
  maze << a
}

que = [[0, 0, 1]]
sum = 0

while que.count > 0
  y, x, c = que.shift
  if y < 0 || y >= h || x < 0 || x >= w || maze[y][x] != "."
    next
  end
  maze[y][x] = 1
  if y == h-1 && x == w-1
    sum += c
    break
  end
  
  que << [y-1, x, c+1]
  que << [y+1, x, c+1]
  que << [y, x-1, c+1]
  que << [y, x+1, c+1]

end
if sum != 0
  puts (dot_cnt - sum)
else
  puts -1
end

Measured memory_bytes: 14536
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N;
  cin>>N;
  for(ll i=1;i<10;i++) {
if(N%i==0&&N/i<10) {
cout<<"Yes"<<endl;
  return 0;
}
  }
  
  cout<<"No"<<endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<long double, long double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main(){
    int n, m; cin >> n >> m;
    if (n % m == 0) cout << n / m  << endl;
    else cout << n / m + 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define inf 0x7f7f7f7f7f7f7f7f 
#define maxn 300010
#define ri register int
#define il inline
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define db(x) cout << x << endl;
const int mod = 10e8+7;
const int eps = 1e-6;
using namespace std;
int a[maxn],b[maxn];
char s[maxn];
int c[maxn],si[maxn];
signed main()
{
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	int x=n%10;
	if(x==3)
		cout << "bon";
	else if(x==0 ||x==1||x==6||x==8)
		cout << "pon";
	else
		cout << "hon";
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define SZ(x) ((int)(x).size())
#define fastin ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const int inf=0x3f3f3f3f;
int n,m,x,c[20],a[20][20],ans=inf;
int v[20];
void dfs(int now,int sumc){
	if(now==n+1){
		int flag=1;
		rep(i,1,m){
			if(v[i]<x){
				flag=0;break;
			}
		}
		if(flag){
			ans=min(ans,sumc);
		}
		return ;
	}
	dfs(now+1,sumc);
	rep(i,1,m)	v[i]+=a[now][i];
	dfs(now+1,sumc+c[now]);
	rep(i,1,m)	v[i]-=a[now][i];
}
int main(){
	scanf("%d%d%d",&n,&m,&x);
	rep(i,1,n){
		scanf("%d",&c[i]);
		rep(j,1,m)	scanf("%d",&a[i][j]);
	}
	dfs(1,0);
	if(ans==inf)	ans=-1;
	printf("%d\n",ans);
	return 0;
}

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

int main(){
  string S,T;
  cin >> S >> T;
  for(int i=0;i<S.size();i++){
    if(S.at(i)!=T.at(i)){
      cout << "No" << endl;
      return 0;
    }
  }
  
  
  cout << "Yes" << endl;
}
  

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

int main()
{
	string s;
	cin >> s;
	int n = s.length();
	for(int i=0; i+1<n; ++i){
		if(s[i]=='A' && s[i+1]=='C'){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
module Main (main) where

import qualified Data.ByteString.Char8     as C8
import           Data.Maybe

main :: IO ()
main = do
  [a,b] <- readInts
  print . showAnswer $ solve (a,b)

type Input  = (Int, Int)
type Output = Int

solve :: Input -> Output
solve (a,b) = ceiling x
  where
    x = fromIntegral (a+b) / 2

showAnswer :: Output -> Answer
showAnswer = Number

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

data Answer
  = YesNo Bool
  | YESNO Bool
  | AB Bool
  | Number Int
  | Compare Ordering

instance Show Answer where
  show (YesNo b)   = if b then "Yes" else "No"
  show (YESNO b)   = if b then "YES" else "NO"
  show (AB b)      = if b then "A"   else "B"
  show (Number i)  = show i
  show (Compare o)
    | o == EQ = "="
    | o == LT = "<"
    | o == GT = ">"

Measured memory_bytes: 380
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

void solve();

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

void solve(){
    ll n;cin>>n;
    string ans;
    rep(i,40){
        if(n>>i&1){
            ans+='1';
            n-=(i%2?-1:1)*(1<<i);
        }else{
            ans+='0';
        }
        if(!n)break;
    }
    reverse(all(ans));
    cout<<ans<<endl;
}

Measured memory_bytes: 256
def tree_walk_1(start, parent=None):
    for i, t in adj[start]:
        if i != parent:
            P[i] = (start, t)
            C[start].append((i, t))
            tree_walk_1(i, start)

def tree_walk_2(start):
    global time
    notVisited[start] = False
    for c, t1 in C[start]:
        if notVisited[c]:
            time += 2 * t1
            tree_walk_2(c)
    p, t2 = P[start]
    if notVisited[p]:
        time += t2
        tree_walk_2(p)

from sys import stdin
f_i = stdin

while True:
    N = int(f_i.readline())
    if N == 0:
        break
    
    adj = [[] for i in range(N)]
    for i in range(N - 1):
        a, b, t = map(int, f_i.readline().split())
        a -= 1
        b -= 1
        adj[a].append((b, t))
        adj[b].append((a, t))
    
    # leaf cutting
    lf = []
    for i, a in enumerate(adj[1:], start=1):
        if len(a) == 1:
            lf.append(i)
    for l in lf:
        i, t = adj[l].pop()
        adj[i].remove((l, t))
    
    # root candidate
    rc = [i for i, a in enumerate(adj[1:], start=1) if len(a) == 1]
    if not rc:
        print(0)
        continue
    
    time_rec = []
    for r in rc:
        P = [None] * N
        P[r] = (r, 0)
        C = [[] for i in range(N)]
        tree_walk_1(r) #making a tree
        
        time = 0
        notVisited = [True] * N
        tree_walk_2(0)
        time_rec.append(time)
    
    print(min(time_rec))


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define maxs(a,b) a=max(a,b)
#define mins(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    int h,w;cin>>h>>w;
    vvi a(h+1,vi(w)),b(h+1,vi(w));
    rep(i,h)rep(j,w)cin>>a[i][j];
    rep(i,h)rep(j,w){
        cin>>b[i][j];
        a[i][j]=abs(b[i][j]-a[i][j]);
    }

    // vc<vc<bitset<80*(h+w)*2>>> dp(h+1,vc<bitset<80*(h+w)*2>>(w+1));
    vc<vc<bitset<80*160*2>>> dp(h+1,vc<bitset<80*160*2>>(w+1));
    dp[0][0][80*(h+w)+a[0][0]]=1;
    dp[0][0][80*(h+w)-a[0][0]]=1;

    rep(i,h)rep(j,w){
        dp[i+1][j] = dp[i+1][j]|(dp[i][j]<<a[i+1][j])|(dp[i][j]>>a[i+1][j]);
        dp[i][j+1] = dp[i][j+1]|(dp[i][j]<<a[i][j+1])|(dp[i][j]>>a[i][j+1]);
    }


    rep(i,80*(h+w)){
        if(dp[h-1][w-1][80*(h+w)-i] || dp[h-1][w-1][80*(h+w)+i]){
            cout<<i<<"\n";
            return 0;
        }
    }

    return 0;

}

Measured memory_bytes: 21248
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static void exec(MyScanner in, PrintWriter out) {
		int N = in.nextInt();
		int odd = 0;
		for (int i = 0; i < N; i += 1) {
			int a = in.nextInt();
			if (a % 2 == 1) {
				odd += 1;
				if (odd == 2) {
					odd = 0;
				}
			}
		}
		out.println(odd == 0 ? "YES" : "NO");
	}

	public static void main(String[] args) {
		PrintWriter w = new PrintWriter(System.out);
		exec(new MyScanner(System.in), w);
		w.flush();
	}

	static class MyScanner {
		static final int BUFFER_SIZE = 1024;
		private final InputStream in;
		private final byte[] buffer = new byte[BUFFER_SIZE];
		private int point;
		private int readLength;
		MyScanner(InputStream in) {
			this.in = in;
		}
		private int readByte() {
			if (point < readLength) {
				int result = buffer[point];
				point += 1;
				return result;
			}
			try {
				readLength = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (readLength == -1) {
				return -1;
			}
			point = 1;
			return buffer[0];
		}
		static boolean isPrintableCharExceptSpace(int c) {
			return 33 <= c && c <= 126;
		}
		String next() {
			StringBuilder b = new StringBuilder();
			int c = readByte();
			while (!(c == -1 || isPrintableCharExceptSpace(c))) {
				c = readByte();
			}
			if (c == -1) {
				throw new NoSuchElementException();
			}
			do {
				b.appendCodePoint(c);
				c = readByte();
			} while (c != -1 && isPrintableCharExceptSpace(c));
			return b.toString();
		}
		long nextLong() {
			int c = readByte();
			while (!(c == -1 || isPrintableCharExceptSpace(c))) {
				c = readByte();
			}
			if (c == -1) {
				throw new NoSuchElementException();
			}
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long result = 0L;
			do {
				if (!('0' <= c && c <= '9')) {
					throw new InputMismatchException();
				}
				result = result * 10L + (c - '0');
				c = readByte();
			} while (c != -1 && isPrintableCharExceptSpace(c));
			return minus ? -result : result;
		}
		int nextInt() {
			long n = nextLong();
			if (Integer.MIN_VALUE <= n && n <= Integer.MAX_VALUE) {
				return (int) n;
			}
			throw new InputMismatchException();
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

}


Measured memory_bytes: 25428
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            string s = Console.ReadLine();

            string ans = "";

            for(int i = 0; i < s.Length; i++) {
                ans += "x";
            }

            Console.WriteLine(ans);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main(void){
 
    int N;
    
    cin >> N;
    
    long long H[N];
    
    for(int i = 0; i < N; i++) cin >> H[i];
    
    long long min = H[N-1];

    string ans = "Yes";
    
    for(int i = N-2; i >= 0; i--){
        
        if( H[i] < min + 1){
            
        }else if (H[i] == min + 1){
            H[i]--;
        }else{
            ans = "No";
            break;
        }
        
        if(min > H[i])min = H[i];
        

    }
    
    cout << ans << endl;    
    
    
}

Measured memory_bytes: 1024
max_n=10**5
mod=10**9+7

frac=[1]
for i in range(1,max_n+1):
  frac.append((frac[-1]*i)%mod)

inv=[1,1]
inv_frac=[1,1]
for i in range(2,max_n):
  inv.append((mod-inv[mod%i]*(mod//i))%mod)
  inv_frac.append((inv_frac[-1]*inv[-1])%mod)
  
def perm(m,n):
  if m<n:
    return 0
  if m==1:
    return 1
  return (frac[m]*inv_frac[m-n])%mod

def comb(m,n):
  if m<n:
    return 0
  if m==1:
    return 1
  return (frac[m]*inv_frac[n]*inv_frac[m-n])%mod  

n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
s=0
for i in range(n-k+1):
  s=(s+(a[n-i-1]-a[i])*comb(n-i-1,k-1))%mod
print(s)

Measured memory_bytes: 94544
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;
//printf("%.10f\n", n);

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}
ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}
ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}
bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) { // 素数ではない
			return false;
		}
	}
	// 素数である
	return true;
}

ll test[502][502];
signed main() {
	ll n, m, a, b, ans = 0; cin >> n >> m >> a >> b;
	ll ka = a * b - 2;
	for (int h = 1; h <= n; h++) {
		for (int i = 1; i <= m; i++) {
			if (h % a == 0 && i % b == 0) { 
				test[h][i] = 0 - (mod - 7); ans -= mod - 7;
			}
			else if ((h - 1) % a == 0 && (i - 1) % b == 0) {
				test[h][i] = mod - 8 - ka; ans += mod - 8 - ka;
			}
			else { test[h][i] = 1; ans += 1; }
		}
	}
	if (ans > 0) {
		cout << "Yes\n";
		for (int h = 1; h <= n; h++) {
			cout << test[h][1];
			for (int i = 2; i <= m; i++) {
				cout << ' ' << test[h][i];
			}
			cout << endl;
		}
	}
	else {
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 5600
#include <bits/stdc++.h>
   
using namespace std;
#define pb push_back
#define int long long


int32_t main()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    
    int ans=(n*(n-1))/2;
    int ans2=(m*(m-1))/2;
    
    ans=ans+ans2;
    cout<<ans;
     

       
        
        
    
   
    
    
   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};

int main(){
  ll q,h,s,d,n;
  cin>>q>>h>>s>>d>>n;
  ll ans;
  if(n%2==0){
    ans=min(q*8,min(h*4,min(s*2,d)))*(n/2);
  }
  if(n%2==1){
    ans=min(q*8,min(h*4,min(s*2,d)))*(n/2)+min(q*4,min(h*2,s));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

#define ALL(v) (v).begin(),(v).end()

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int a ;
  string s ;
  
  cin >>a ;
  cin >>s ;
  
  if(a >=3200){
    cout << s <<endl ;
  }
  else if(a <= 3200){
    cout <<"red"<<endl ;
  }
  
    return 0 ;
}
/*
　　　　　　　　　　　　　　　　　　 　 　 　 　 　 ＿
.　　 　 ﾆ|ﾆ　　　　　　　　　　　　　　 ,． ´　　　　　 　｀ 　.　　　　　　　　　　　　　十 仝
　　　　 c!､　　　　　　　　　　　 　 ／　　 . : : ;ｲ: : : : . .　　 ヽ　　　　　　　　　　　 丁 口
　　　　ｰ|┐ヽ　　　　　　　　　　, ′　..: .:./ :/ |.:.:.:.:ﾄ､: : : : . . :.　　　　　　　　 　 　 ｰ‐ｧ
　　　　 ﾉ､|　　　 　 　 　 　 　 _｣　 | |　.:`ト､|　|.:.:.斗匕ﾊ: : : : ::.-　.　　 　 　 　 　 　 （_
　　　　ｰ┼　　　　　　　 ,， ´. .:{　.:|ム==ミ､|　ゝ､斗==ミ､} : |: :}: : :.｀ヽ　　　　　 　 ー┐ll
　　　　ヽ.__　　　　 　 ／ . : .: .,.:! . :|〃笊ﾊヾ　　 〃笊ﾊヾ| :ﾉ /｀ヽ: . }: .＼ 　 　 　 ＿_|
. 　 　 ｰ┼_　　　　 ./ 乂__ ／ ‘.{ 小 乂cｿ　　　　 乂cｿﾉjｲノ!　　_У . : : :i　　　　ー‐ｧ
　 　 　 /|　し 　 　 {:. :. : .､｀二フ{{ﾊ　ハﾊヽ 　 '　 　ハﾊヽんﾉ＜´__ . : : : ﾉ　　　 　 ｀ヽ
.　　 　 ﾆ|ﾆ　　　　 乂: : : : .｀フ ゝ圦　　 　 、　 　 , 　 　 /　＜´ . : : : :／
　　　　 c!､　　　　　　 ｀¨¨¨´　　　 ｀ゝ、　　　 　 　 　 . ｲ　　　｀¨¨¨¨´
　　　 　 |　　　　　 　 　 　 　 　 　 　 　 ＞　.,　_　. ィ´
　　　　　し　　　　　　　　　　　　　 　 　 _r圦　　　 仄ヽ
　　　　 ┼　　　　　　　　　　　　　　 　 /　/ ﾊ 　 /　ﾊ　〉
.　　　　丿こ　　　　　　　　　　　,． ＜´｀Ｖ＼､ヽ/／ノj/ ｀＞　、
　　　　　l7　　　　 　 　 　 γ´　　　　 ＼　　「三ヨ　　／　　 　 ｀ヽ
　　　 　 o　　　　　　　 　 / ヽ 　 　 　 　 ＼　〉=〈　／　　　 　 /　 ﾊ
　　　　　　　　 　 　 　 　 ′　　　　　　　　　/ﾆﾆﾊ　　　 　 　 　 　 ∧
　　　　　　　　　　　　 　 {　　ヽi　　　　　 　 ｉﾆﾆニi　　　　　　{　　　 ﾊ
　　　 　 　 　 　 　 　 　 ﾊ　　 ,′　 　 　 　 |ﾆﾆニ|　　　　　　'. 　,.r=圦
　 　 　 　 __,r─--､　　ﾑﾆﾆﾆ{　　　　 　 　 |ﾆﾆニ|　　　 　 　 }彡'¨´ ∧ ,r─‐-､_
.　 　 　 / / |　{一　＼ムﾉ 　八　　 　 　 　 |ＸニＸ|　　　　　　八　　___／　 / ,ｲ } }､
　　 　 人 ゝゝ　}7l777l777l777l777l777l777l777l777l777l777l777l777l7／／ﾉ ﾉﾉﾉ 
*/

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

//

#define RESIDUE(u,v) (capacity[u][v] - flow[u][v])
#define RCOST(u,v) (cost[u][v] + h[u] - h[v])
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

#define N 200000

int p[N],pind[N];

int main(){
  int n,idx=0,cont=1;
  cin >> n;
  REP(i,n){
    cin>>p[i];
    pind[p[i]-1] = i;
  }
  vector<int> v;
  while(idx<n){
    v.push_back(idx);
    if(idx == n-1) break;
    while(idx<n-1){
      if(pind[idx] > pind[idx+1])
	break;
      idx++;
    }
    idx++;
  }
  REP(i,v.size()-1)
    cont = max(cont,v[i+1]-v[i]);
  cont = max(cont,n-v[v.size()-1]);
  cout<<n-cont<<endl;
  return 0;
}


Measured memory_bytes: 2936
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// get a integer
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		// get a string
		String s = sc.next();
		
		Main.qualif(a, b, c, s);
	}
	
	static void qualif(int N, int A, int B, String str) {
		int number = 0;
		int numberB = 0;
		int threshold = A + B;
		StringBuilder s = new StringBuilder(str);
		
		for (int i = 0; i < N; i++) {
			if (s.charAt(i) == 'a' && number < threshold){
				number++;
				//System.out.println("num = " + number);
				System.out.print("Yes");
			}
			else if (s.charAt(i) == 'b' && number < threshold && numberB < B) {
				number++;
				numberB++;
				System.out.print("Yes");
			}
			else
				System.out.print("No");

                       if (i != N-1)
				System.out.print("\n");
		}
	}

}

Measured memory_bytes: 24964
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

//ACL

#include <atcoder/all>
using namespace atcoder;

//ACL END

#define int long long

#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

using namespace std;

using P = std::pair<int, int>;
using ll = long long;
using ld = double;

using bint = boost::multiprecision::cpp_int;


template<typename T, typename U>
std::istream& operator>>(std::istream& in, std::pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}

const int MOD = 998244353;

// https://twitter.com/vane11ope ←フォローしましょう
// (ノ)>◡<(ヾ)ﾓﾁﾓﾁ
signed main(signed argc, char* argv[]) {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    int t;
    cin>>t;
    rep(_,t){
        int n,m,a,b;
        cin>>n>>m>>a>>b;
        cout<<floor_sum(n,m,a,b)<<endl;
    }
}


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

int main()
{
    string S;
    cin >> S;
    int l=S.size();
    if(S.at(l-1)=='s')
    {
        cout << S << "es" << endl;
    }
    else
    {
        cout << S << "s" << endl;
    }
    
}

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

using namespace std;

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

    int N;
    string S;
    cin >> N >> S;
    int count = 1;
    for (int i = 1; i < N; ++i) {
        if (S[i - 1] != S[i]) ++count;
    }
    cout << count << '\n';
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<pii>>;
using mat = vector<vector<int>>;
const int MOD = 1e9 + 7;

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

    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    for (int i = 0; i < N; ++i)
        cin >> H[i];
    sort(H.begin(), H.end(), greater<int>());

    ll ans = 0;
    for (int i = K; i < N; ++i)
        ans += H[i];

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int A[100];
    for(int i = 0; i<n; i++){
        cin >> A[i];
        
    }
    for(int j = n-1; j >=0; j--){
        if(j!= n-1){
            cout << " ";
        }
        cout << A[j];
        
    }
    cout << endl;
    return 0;
}


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

int main(){
  ll x;
  cin >> x;
  vector<ll> A(1000000);
  A[0] = 0;
  ll i = 1;
  while(1){
    A[i] = A[i-1] + i;
    if(A[i] >= x){
      break;
    }
    ++i;
  }
  cout << i << endl;
  return 0;
}


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

using namespace std;

const int maxN = 1 << 15;

typedef long long ll;

int N;
vector<ll> v;
ll dfs(int n, ll sum, int lid) {
	if (sum > N) return 0;
	if (sum == N) return 1;
	if (n >= 4) return 0;

	ll res = 0;
	for (int i = lid; i < v.size(); ++i) {
		res += dfs(n+1, sum+v[i], i);
	}
	return res;
}
int main() {
	while ( cin >> N, N ) {
		v.clear();
		for (int i = 1; i*i <= N; ++i) {
			v.push_back(i*i);
		}
		cout << dfs(0, 0, 0) << endl;
	}
}

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

int main(){

    ll n; cin >> n;

    vector<P> l = prime_factorize(n);
    
    ll ans = 0;
    rep(i, l.size()){
        ll e = l[i].second;
        ll cnt_sum = 0;
        ll cnt = 0;
        while(e>=cnt_sum){
            cnt_sum += cnt;
            cnt++;
        }
        ans += cnt-2;
    }
    cout << ans << endl;

    return 0;
}

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

const int N = 100010;
int a[N];

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 1; i < N; i++) {
		a[i] = a[i / 10] + i % 10;
	}
	int ans = 100000000;
	for (int i = 1; i < n; i++)
		ans = min(ans, a[i] + a[n - i]);
	cout << ans << endl;
	return 0;
}


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

int main() {
  int a;
  int b;
  cin >> a;
  cin >> b;
  if ((a / 2 != (a + 1) / 2) && (b / 2 != (b + 1) / 2)){
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }  
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    long double p[n];
    for(int i = 0;i < n;i++)
    {
        long double x;
        cin >> x;
        p[i] = (1.0 + x) / 2.0;
    }
    long double ans = 0,temp;
    for(int i = 0;i < k;i++)
    {
        ans += p[i];
    }
    temp = ans;
    for(int i = k;i < n;i++)
    {
        temp = temp - p[i - k] + p[i];
        if(ans < temp)
        {
            ans = temp;
        }
    }
    cout << fixed << setprecision(20) << ans << "\n";

    return 0;
}

Measured memory_bytes: 3328