akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
    public static void AutoFlushOff()
    {
	var sw =
	    new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
	Console.SetOut(sw);
    }

    public static void Flush()
    {
	Console.Out.Flush();
    }
}

class Program
{
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	var d = new Dictionary<Tuple<int,int>, int>();
	
	var v = new List<int>[n+1];
	for (int i = 1; i <= n; i++) v[i] = new List<int>();

	int[] o = new int[n+1];
	int m = 0;
	for (int i = 0; i < n-1; i++)
	{
	    var tmp = ReadIntArray();
	    int a = tmp[0], b = tmp[1];
	    d.Add(Tuple.Create(a, b), i);
	    d.Add(Tuple.Create(b, a), i);

	    v[a].Add(b);
	    v[b].Add(a);
	    
	    o[a]++;
	    o[b]++;
	    m = Math.Max(m, o[a]);
	    m = Math.Max(m, o[b]);
	}

	int k = m;
	int[] colors = new int[n-1];

	var q = new Queue<int>();
	q.Enqueue(1);

	while (q.Count > 0)
	{
	    int t = q.Dequeue();
	    bool[] used = new bool[k+1];

	    for (int i = 0; i < v[t].Count; i++)
	    {
		int u = v[t][i];
		int j = d[Tuple.Create(t, u)];
		int col = colors[j];
		if (col == 0)
		{
		    q.Enqueue(u);
		}
		else
		{
		    used[col] = true;
		}
	    }

	    int idx = 1;
	    for (int i = 0; i < v[t].Count; i++)
	    {
		int u = v[t][i];
		int j = d[Tuple.Create(t, u)];
		int col = colors[j];
		if (col == 0)
		{
		    while (used[idx]) idx++;
		    colors[j] = idx;
		    used[idx] = true;
		}
	    }	    
	}

	AutoFlushOff();
	WriteLine(k);
	for (int i = 0; i < n-1; i++)
	    WriteLine(colors[i]);
	Flush();
    }
}

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

int main( void )
{
    string s;
    cin >> s;
    
    int l = s.length();
    rep(i,l)
        if ( s[i] == ',' )
            s[i] = ' ';
    
    cout << s << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
int main(){
  int n,k;cin >> n >> k;
  int ans = 0;
  rep(i,n){
    int a;cin >> a;
    if(a>=k) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
const double pi = 3.141592653589793;
//素数判定 O(√N)
bool isPrime(int64_t x){
    if(x<=1){
        return false;
    }
    for(int i=2 ;i*i<=x ;i++){
        if(x%i==0){
            return false;
        }
    }
    return true;
}
int main(){
    int64_t n;
    cin>>n;
    /*
    if(n==1){
        cout<<0<<endl;
        return 0;
    }
    */
    /*
    if(isPrime(n)){
        cout<<1<<endl;
        return 0;
    }
    */
    map<int64_t,int> p;//素因数分解
    int64_t num=n;
    for(int64_t i=2;i*i<=n;i++){
        while(num%i==0){
            p[i]++;
            num /= i;
        }
    }
    if(num!=1){
        p[num]++;
    }
    int64_t sum=0;
    for(auto c:p){
        //cout<<c.first<<" "<<c.second<<endl;
        int e = c.second;
        int count=0;
        for(int i=1;i*i<n;i++){
            count += i;
            if(e<count){
                sum += i-1;
                //cout<<sum<<" ";
                break;
            }   
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(long long i=x;i<y;i++)
typedef long long ll;
using namespace std;
int main()
{
	ll N,ANS=0,tmp=0;
	string S;
	cin >> N >> S;
	for(int i=1;i<S.size()-1;i++){
		vector<int>vec1(26,0);
		vector<int>vec2(26,0);
		for(int j=0;j<i;j++){
			if(S[j]=='a')vec1[0]=1;
			if(S[j]=='b')vec1[1]=1;
			if(S[j]=='c')vec1[2]=1;
			if(S[j]=='d')vec1[3]=1;
			if(S[j]=='e')vec1[4]=1;
			if(S[j]=='f')vec1[5]=1;
			if(S[j]=='g')vec1[6]=1;
			if(S[j]=='h')vec1[7]=1;
			if(S[j]=='i')vec1[8]=1;
			if(S[j]=='j')vec1[9]=1;
			if(S[j]=='k')vec1[10]=1;
			if(S[j]=='l')vec1[11]=1;
			if(S[j]=='m')vec1[12]=1;
			if(S[j]=='n')vec1[13]=1;
			if(S[j]=='o')vec1[14]=1;
			if(S[j]=='p')vec1[15]=1;
			if(S[j]=='q')vec1[16]=1;
			if(S[j]=='r')vec1[17]=1;
			if(S[j]=='s')vec1[18]=1;
			if(S[j]=='t')vec1[19]=1;
			if(S[j]=='u')vec1[20]=1;
			if(S[j]=='v')vec1[21]=1;
			if(S[j]=='w')vec1[22]=1;
			if(S[j]=='x')vec1[23]=1;
			if(S[j]=='y')vec1[24]=1;
			if(S[j]=='z')vec1[25]=1;
		}
		for(int k=i;k<S.size();k++){
			if(S[k]=='a')vec2[0]=1;
			if(S[k]=='b')vec2[1]=1;
			if(S[k]=='c')vec2[2]=1;
			if(S[k]=='d')vec2[3]=1;
			if(S[k]=='e')vec2[4]=1;
			if(S[k]=='f')vec2[5]=1;
			if(S[k]=='g')vec2[6]=1;
			if(S[k]=='h')vec2[7]=1;
			if(S[k]=='i')vec2[8]=1;
			if(S[k]=='j')vec2[9]=1;
			if(S[k]=='k')vec2[10]=1;
			if(S[k]=='l')vec2[11]=1;
			if(S[k]=='m')vec2[12]=1;
			if(S[k]=='n')vec2[13]=1;
			if(S[k]=='o')vec2[14]=1;
			if(S[k]=='p')vec2[15]=1;
			if(S[k]=='q')vec2[16]=1;
			if(S[k]=='r')vec2[17]=1;
			if(S[k]=='s')vec2[18]=1;
			if(S[k]=='t')vec2[19]=1;
			if(S[k]=='u')vec2[20]=1;
			if(S[k]=='v')vec2[21]=1;
			if(S[k]=='w')vec2[22]=1;
			if(S[k]=='x')vec2[23]=1;
			if(S[k]=='y')vec2[24]=1;
			if(S[k]=='z')vec2[25]=1;
		}
		for(int l=0;l<vec1.size();l++){
			if(vec1[l]==vec2[l]&&vec1[l]==1)tmp++;
		}
		if(ANS<=tmp)ANS=tmp;

		tmp=0;
	}
	cout << ANS << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <numeric>
#include <limits>

const int INF = 1 << 30;
const int V = 10;
struct edge { int to, cost; };
std::vector<edge>v[100];
typedef std::pair<int, int>p;

int main() {
	int n, a[100000];
	std::cin >> n;
	for (int i = 0;i < n;i++) {
		std::cin >> a[i];
	}
	int ans = n, b = 0, c = 0, d = 0, flag = 0;
	for (int i = 0;i < n;i++) {
		if (a[i] % 2 == 1) {
			b += 1;
		}
		else if (a[i] % 2 == 0) {
			if (a[i] / 2 % 2 == 1) {
				c += 1;
			}
			else {
				d += 1;
			}
		}
	}
	if (c == 0) {
		if (d + 1 >= b) {
			std::cout << "Yes" << std::endl;
		}
		else {
			std::cout << "No" << std::endl;
		}
	}
	else {
		b += 1;
		if (d+1 >= b) {
			std::cout << "Yes" << std::endl;
		}
		else {
			std::cout << "No" << std::endl;
		}
	}
	return 0;
}

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

const ll MAXN = 200000;
const ll INF = 1001001001;

ll N, ans=0, tmp=0;
vector<ll> A;

signed main(){
    cin >> N;
    char S1[N][N], S2[N][N];
    for(int i=0;i<N;i++) {
        for(int j=0;j<N;j++) {
            cin >> S1[i][j];
        }
    }
    for(int i=0;i<N;i++) {
        for(int m=0;m<N;m++) {
            for(int n=0;n<N;n++) {
                S2[m][n] = S1[(m+i)%N][n];
            }
        }
        int flag=0;
        for(int m=0;m<N;m++) {
            for(int n=0;n<N;n++) {
                if(S2[m][n]!=S2[n][m]) flag=1;
                if(flag==0&&m==N-1&&n==N-1) ans += N;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
typedef pair<ll,ll> P;
#define N 2010
ll n;
ll Beta(string A,string B,ll b){
    reverse(A.begin(),A.end());
    reverse(B.begin(),B.end());
    
    ll x[N],y[N],bef;
    lol(i,n)x[i]=y[i]=0;
    
    bef=1e9;
    lol(i,2*n){
	ll I=i%n;
	if(A[I]=='1'&&B[I]=='0'){
	    x[I]=max(x[I],i-bef);
	}
	if(B[I]=='1')bef=i+b;
    }
    
    bef=-1e9;
    for(ll i=2*n;~i;i--){
	ll I=i%n;
	if(A[I]=='1'&&B[I]=='0'){
	    y[I]=max(y[I],bef-i);
	}
	if(B[I]=='1')bef=i;
    }
    
    vector<P> v;
    lol(i,n){
	if(x[i] or y[i])
	v.push_back(make_pair(x[i],y[i]));
    }
    sort(v.begin(),v.end(),greater<P>());
    
    ll res=1e9;
    ll maxi=0;
    lol(i,v.size()){
	res=min(res,v[i].first+maxi);
	maxi=max(maxi,v[i].second);
    }
    res=min(res,maxi);
    
    res=2*res+b;
    lol(i,n)res+=(A[i]!=B[i]);
    return res;
}
string Rshift(string x){
    string res="";
    res.push_back(x[x.size()-1]);
    res+=x.substr(0,x.size()-1);
    return res;
}
ll Alpha(string A,string B){
    ll ans=1e9;
    for(ll b=0;b<=n;b++){
	ans=min(ans,Beta(A,B,b));
	B=Rshift(B);
    }
    return ans;
}
bool Cand(string a,string b){
    bool zeroa=1,zerob=1;
    lol(i,n){
	if(a[i]!='0')zeroa=0;
	if(b[i]!='0')zerob=0;
    }
    if(zerob==1){
	if(zeroa)cout<<0<<endl;
	else cout<<-1<<endl;
	return 1;
    }
    return 0;
}
int main(){
    string a,b;cin>>a>>b;
    n=a.size();
    if(Cand(a,b))return 0;
    ll ans=Alpha(a,b);
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());
    ans=min(ans,Alpha(a,b));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>

using namespace std;

int main(){
	long k,i=0;
	string s;
	cin >> s;
	cin >> k;
	while(s[i] == '1'&&i < k)i++;
	if(i >= s.length() || i >= k)cout << s[0] << endl;
	else cout << s[i] << endl;
}

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

using namespace std;

int main(){
    string s;
    cin >> s;
    int zero = 0, one = 0;
    
    for(int i = 0; i < s.length(); i++){
        if(s[i] == '0')     zero++;
        else                one++;
    }
    
    cout << 2 * min(zero, one) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示

ll ans = 0 , s1 = 0 , s2 = 0;
void solve(long long N, std::vector<std::vector<long long>> A){
  for (int i = 0; i < N; i++) {
    ll Asum = A[0][i] + A[1][i];
    s2 -= A[1][i];
    ans = max(ans,Asum+s1+s2);
    s1 += A[0][i];
  }
  cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::vector<long long>> A(2, std::vector<long long>(N));
    for(int i = 0 ; i < 2 ; i++){
        for(int j = 0 ; j < N ; j++){
            scanf("%lld",&A[i][j]);
            s2 += (i == 1 ? A[i][j] : 0 );
        }
    }
    solve(N, std::move(A));
}


Measured memory_bytes: 256
H, W = map(int, input().split())
N = int(input()) #color num
a = list(map(int, input().split()))

color=[]
for i in range(N):
    for _ in range(a[i]):
       color.append(i+1)
#print(color)
answer=[]
for y in range(H):
    answer.append([None]*W)
cursol=0
for y in range(H):
    if y % 2 == 0:
        for x in range(W):
            answer[y][x]=color[cursol]
            cursol+=1
    if y % 2 == 1:
        for x in range(W-1, -1, -1):
            answer[y][x] = color[cursol]
            cursol += 1
#print(answer)
for y in range(H):
    print(' '.join(list(map(str,answer[y]))))


Measured memory_bytes: 40944
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

x = input()
s = 0
ans = len(x)
for i in range(len(x)):
    if x[i] == 'S':
        s += 1
    else:
        if s > 0 :
            s -= 1
            ans -= 2

print(ans)

Measured memory_bytes: 10084
// AOJ 2151: Brave Princess Revisited
// 2017.11.11 bal4u
// 2018.2.6

#include <stdio.h>
#include <string.h>

typedef struct { int t, n, m; } QUE;
QUE que[20001]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;
	
	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i]; que[i] = que[min]; que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
//	if (qsize == 0) return 0;
//	*n = que[0].n, *m = que[0].m;
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int t, int n, int m)
{
	int i, min;
	QUE qt;
	
	i = qsize++;
	que[i].t = t, que[i].n = n, que[i].m = m;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i]; que[i] = que[min]; que[min] = qt;
		i = min;
	}
}

int to[101][101], d[101][101], e[101][101], hi[101];
int node[101][101];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int dijkstra(int start, int goal, int l)
{
	int s, m, i, k, t, p, ans;

	memset(node, 0x33, sizeof(node));
	ans = 0x7fffff;
	qsize = 0;
	node[start][l] = 0; enq(0, start, l);

	while (qsize) {
		s = que[0].n, m = que[0].m, deq();
		p = node[s][m];

		if (s == goal) {
			if (p < ans) ans = p;
			if (ans == 0) break;
			continue;
		}

		for (i = 0; i < hi[s]; i++) {
			t = to[s][i];

			k = p + e[s][i];
			if (k < node[t][m]) node[t][m] = k, enq(node[t][m], t, m);

			k = m - d[s][i];
			if (d[s][i] <= m && p < node[t][k]) node[t][k] = p, enq(node[t][k], t, k);
		}
	}
	return ans;
}

int main()
{
	int n, m, l, k, a, b, _d, _e, i;

	while (n = in()) {
		m = in(), l = in();
		memset(hi, 0, n << 2);
		for (i = 0; i < m; i++) {
			a = in()-1, b = in()-1, _d = in(), _e = in();
			k = hi[a]++;
			to[a][k] = b, d[a][k] = _d, e[a][k] = _e;
			k = hi[b]++;
			to[b][k] = a, d[b][k] = _d, e[b][k] = _e;
		}
		printf("%d\n", dijkstra(0, n-1, l));
	}
	return 0;
}


Measured memory_bytes: 2108
import java.util.*;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        char[] s = scan.nextLine().toCharArray();
        if(s[0] == s[1] && s[1] == s [2] || s[1] == s [2] && s[2] == s [3]) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int ans=0;
    for(int i=0; i<s.size()/2; i++){
	if(s[i]!=s[s.size()-i-1])
	    ans++;
    }
    cout << ans << endl;
}



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

int main(void)
{
	int x,h;
	double tmp1,tmp2,tmp3;
	double ans;
	
	while(scanf("%d %d",&x,&h),x+h)
	{
		
		ans=(x*sqrt(4*h*h+x*x))+(x*x);
		printf("%.6f\n",ans);
	}
	return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define ll long long
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	/*ll t;cin>>t;
	while(t-->0)
    {}*/
    ll n,i=1;cin>>n;
    while(1)
    {
        if(1000*i>=n)
        {
            cout<<1000*i-n<<"\n";break;
        }
        else
        {
            i++;
        }
    }
}




Measured memory_bytes: 3600
#include <stdio.h>

int bubbleSort(int*, int);

int main()
{
	int arr[100];
	int temp, num = 0, re = 0;

	scanf(" %d", &num);

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


	re = bubbleSort(arr, num);
	
	for (int i = 0; i < num; i++)
	{
		printf("%d", arr[i]);
		if (i < num-1) printf(" ");
	}
	printf("\n");
	printf("%d\n",re);
	return 0;
}

int bubbleSort(int arr[], int num)
{
	int temp = 0;
	int cnt = 0;
	for (int i = 0; i < num; i++)
	{
		for (int j = num - 1; j >= i+1; j--)
		{
			if (arr[j] < arr[j-1])
			{
				temp = arr[j - 1];
				arr[j - 1] = arr[j];
				arr[j] = temp;
				cnt++;
			}
		}
	}
	return cnt;
}



Measured memory_bytes: 2080
#include <iostream>
using namespace std;
int main(void){
    int x[5];
    int k;
    
    for (int i = 0; i < 5; i++) {
        cin >> x[i];
    }
    cin >> k;
    
    int flag = 0;
    int tmp = 0;
    for (int i = 0; i < 5; i++) {
        for (int j = 1; j + i < 5; j++) {
            tmp = x[i] - x[i+j];
            if (tmp < 0) tmp = tmp * (-1);
            if (tmp > k) flag = 1;
        }
    }
    
    if (flag == 1) cout << ":(";
    else cout << "Yay!";
    
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main(void){
    long long a;
    string s;
    cin >> a >> s;
    s = s.substr(0, 1) + s.substr(2, 2);
    a *= (long long) stoi(s);
    cout << (a/100) << endl;

}


Measured memory_bytes: 3192
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define MAX 100
#define MOD 1000000007
#define pb push_back

/* add vars here */

ll N;
vector<int> data;

/* add your algorithm here */

int main() {
  cin >> N;

  string ans = "";
  while (N != 0) {
    if (N % (-2) != 0) {
      N--;
      ans = "1" + ans;
    } else {
      ans = "0" + ans;
    }

    N /= -2;
  }

  if (ans.empty()) ans = "0";
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define SIZE 5000001

int A[SIZE];

void maxheap(int H,int i){
  int l,r,largest;

  l = i*2;
  r = i*2+1;

  if (l <= H && A[l] > A[i]) largest = l;
  else largest = i;

  if(r <= H && A[r] > A[largest]) largest = r;

  if(largest != i){
    l = A[i];
    A[i] = A[largest];
    A[largest] = l;
    maxheap(H,largest);
  }
}

void build(int H){
  int i;
  for(i = H/2;i > 0;i--) maxheap(H,i);
}

int main(){
  int n,i;

  scanf("%d",&n);

  for(i = 1;i <= n;i++) scanf("%d",&A[i]);

  build(n);

  for(i = 1;i <= n;i++)printf(" %d",A[i]);

  printf("\n");

  return 0;
}



Measured memory_bytes: 3664
#include <bits/stdc++.h> 
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 100000000
using namespace std; 
ll sieve[MAX];
int main(){
  fast_io
  ll n;
  cin>>n;
  memset(sieve,0,sizeof(sieve));
  for(ll i = 2;i<=n;i++){
     sieve[i]++;
        for(ll j = i*2 ;j<=n;j+=i){
          sieve[j]++;
        }
  }
  ll sum = 0;
  for(ll i = 1;i<=n;i++){
    sum += i*(sieve[i] + 1);
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 784824
for i in range(20000):
  m,f,r = map(int,input().split())
  if m == f == r == -1:
    break
  else:
    if m == -1 or f == -1:
      print("F")
    elif m+f >= 80:
      print("A")
    elif 65<=(m+f)<80:
      print("B")
    elif 50<=(m+f)<65:
      print("C")
    elif 30<=(m+f)<50:
      if r>=50:
        print("C")
      else:
        print("D")
    elif (m+f)<30:
      print("F")


Measured memory_bytes: 5592
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<string>
//#include<queue>
//#include<cmath>
//#include<algorithm>
//#define debug1 cout<<"?"<<endl;
//#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
typedef long long ll;
const int maxn=1e2+9;
const double pi=acos(-1);
const int mod=998244353;
const int INF=0x3f3f3f3f;
const double ep=1e-7;
using namespace std;
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	int ans=b*10,ju=0;
	for(;ans<=b*10+9&&!ju;ans++)
	{
		if((floor)(ans*0.08)==a)
		{
			ju=1;break;
		}
	}
	if(ju)printf("%d\n",ans);
	else puts("-1");
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    int cnt = 0;
    int cost = (n - m) * 100 + m * 1900;
    int times = pow(2, m) + 0.5;
    cout << cost * times << endl;

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    int N,P;
    cin >> N >> P;
    int A[N];
    int o=0,e=0;
    rep(i,N){
        int a;
        cin >> a;
        A[i] = a%2;
        if(A[i]){
            o++;
        }else{
            e++;
        }
    }
    if(N==e){
        if(P) cout << 0 << endl;
        else cout << (long long)pow(2,N) << endl;
    }else{
        cout << (long long)pow(2,N-1) << endl;
    }

    return 0;
} 

Measured memory_bytes: 384
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
ll c[10][10];
int main(){
    int h,w;
    cin>>h>>w;
    
    rep(i,10){
        rep(j,10){
            cin>>c[i][j];
        }
    }
    int hw[h][w];
    rep(i,h){
        rep(j,w){
            cin>>hw[i][j];
        }
    }
    
    rep(k,10){
        rep(i,10){
            rep(j,10){
                if(c[i][j]>c[i][k]+c[k][j]){
                    c[i][j]=c[i][k]+c[k][j];
                }
            }
        }
    }
    ll ans=0;
    rep(i,h){
        rep(j,w){
            if(hw[i][j]>=0)ans+=c[hw[i][j]][1];
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int a,b,c,cnt;
main(){
    cin>>a>>b>>c;
    while(1){
        if(a%2+b%2+c%2!=0)break;
        if(a==b and b==c){
            cout<<-1<<endl;
            return 0;
        }
        int x=a,y=b,z=c;
        a=y/2+z/2,b=x/2+z/2,c=x/2+y/2;
        cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
import scala.io.StdIn
object Main extends App {
  val S = StdIn.readLine().toList.zipWithIndex
  val evenS = S.filter(n => n._2 % 2 == 0 && n._1 != 'L')
  val oddS  = S.filter(n => n._2 % 2 == 1 && n._1 != 'R')
  println(if (S.length == (evenS.length + oddS.length)) "Yes" else "No")
}


Measured memory_bytes: 27080
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int n,k;
    cin >> n >> k;
    if(n==k){
        cout << 1 << endl;
    }else if((n-k)%(k-1)==0){
        cout << (n-k)/(k-1)+1 << endl;
    }else{
        cout << (n-k)/(k-1)+2 << endl;
    }
}


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

int main(){ 
    int n,x,ans;
	cin >> n >> x;
	while (n!=0 || x!=0){
		for (int a=1;a<=n;a++){
			for (int b=a+1;b<=n;b++){
				for (int c=b+1;c<=n;c++){
					if (a+b+c==x){
						ans+=1;
					}
				}
			}
		}
		cout << ans << endl;
		cin >> n >> x;
		ans=0;
	} 
} 


Measured memory_bytes: 3104
#include <stdio.h>

int
main(void)
{
    int i, N, A[101], flag, tmp, count;;
    
    scanf("%d", &N);
    for(i = 0; i < N; ++i)
        scanf("%d", A + i);
    
    count = 0;
    flag = 1;
    while(flag) {
        flag = 0;
        for(i = N - 1; i > 0; --i) {
            if(A[i] < A[i-1]) {
                tmp = A[i];
                A[i] = A[i-1];
                A[i-1] = tmp;
                flag = 1;
                count++;
            }
        }
    }
    
    for(i = 0; i < N-1; ++i)
        printf("%d ", A[i]);
    printf("%d\n%d\n", A[N-1], count);
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin >> s;
    if(s=="Sunny") cout << "Cloudy" << endl;
    if(s=="Cloudy") cout << "Rainy" << endl;
    if(s=="Rainy") cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	ll x = a[0];
	for (int i = n - 1; i > 0; --i) {
		x += ((n - 1 - i) % 2 ? 1 : -1) * a[i];
	}
	x /= 2;
	vector<ll> answer(n);
	answer[1] = x;
	answer[0] = a[0] - x;
	for (int i = 2; i < n; ++i) {
		answer[i] = a[i - 1] - answer[i - 1];
	}
	
	for (int yx : answer) {
		cout << 2 * yx << ' ';
	}
	cout << '\n';
 	return 0;
}


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

int n,a,b,sum;

int main(){
    while(cin>>n>>a>>b) {
        sum = 0;
        for(int i=a; i<=n; i++){
            int s = 0, t = i;
            while(t>=10){
                s += t%10;
                t /= 10;
            }
            s += t;
            //cout<<" &i:"<<i<<" s:"<<s<<endl;

            if(s>=a && s<=b){
                sum += i;
            }
        }
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
 
int main(void){
    int a[10001], n, min, max;
    long long sum = 0;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        if(i==1){
            min = a[1];
            max = a[1];
        }
        else{
            if(a[i]<min){
                min = a[i];
            }
            if(a[i]>max){
                max = a[i];
            }
        }
        sum += a[i];
    }
 
cout << min << " " << max << " " << sum << endl;
}


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

int main() {
  int N;
  cin >> N;
  string newName;
  cin >> newName;
  int resultCnt = 0;
  for(int n = 0; n < N; ++n) {
    string oldName;
    cin >> oldName;
    bool wordLoopEnd = false;
    for(int istart = 0; (istart <= oldName.size() - newName.size()) && !wordLoopEnd; ++istart) {
      for(int dchr = 1; dchr < oldName.size() && !wordLoopEnd; ++dchr) {
        stringstream ss;
        for(int ichr = 0; ichr < newName.size(); ++ichr) {
          int index = istart + ichr * dchr;
          if(oldName.size() > index) {
            ss << oldName[index];
          } else {
            break;
          }
        }
        // cout << ss.str() << endl;
        if(ss.str() == newName) {
          ++resultCnt;
          wordLoopEnd = true;
          // cout << "OK!" << endl;
        }
      }
    }
  }
  cout << resultCnt << endl;
  return 0;
}

Measured memory_bytes: 1228
#include <stdio.h>

void trace(int A[],int N,int count){
  int i ;
  for (i = 0; i < N ; i++){
    if (i > 0) printf(" ");
    printf("%d" , A[i]);
  }
  printf("\n");
  printf("%d\n", count);
}

void selectsort(int A[],int N,int count){
  int i ,j,minj;
  int tmp,cou;

  for(i = 0 ; i < N; i++ ){
    minj = i;
    cou = 0;
    for(j = i; j < N; j++){
      if(A[j] < A[minj]){
        minj = j;//すでに探索終わってるところ以外の最小探索
        cou = 1;//交換成立の場合カウント１を代入し続ける(実際に交換するのは下で一回だけ)
      }
    }
    tmp = A[i];
    A[i] = A[minj];
    A[minj] = tmp;
    count = count + cou;
  }
  trace(A,N,count);
}


int main(){
  int N,i,count;
  int A[100];

  scanf("%d", &N);
  for(i = 0; i<N; i++)scanf("%d",&A[i] );

  count = 0;
  selectsort(A,N,count);

  return 0;
}


Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
#pragma region atcoder
/*#include <atcoder/scc>
using namespace atcoder;
//using mint = modint1000000007;
//These are for segment tree
/*int op(int a, int b){return max(a, b);}
int e(){return -1;}
bool f(int v){ return v < target;}
*/
#pragma endregion
#pragma region macros
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n - 1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#pragma endregion
#pragma region debug for var, v, vv
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cout << endl;int cnt = 0;for(const auto& v : vv){cout << cnt << "th : "; view(v); cnt++;} cout << endl;}
#pragma endregion

const ll mod = 1000000007;
const int inf = 1001001001;
const ll INF = 1001001001001001001;
const int MAX = 2000005;

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; }
ll modpow(ll a, ll p){ll ret = 1; while(p){if(p & 1){ret = ret * a % mod;} a = a * a % mod; p >>= 1;} return ret;}

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

/*-----------------------------------------------------------------------------------------------------*/
bool dp[82][82][8000];
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w; cin >> h >> w;
	vvi a(h, vi(w)), b(h, vi(w));
	rep(i,h) rep(j,w) cin >> a[i][j];
	rep(i,h) rep(j,w) cin >> b[i][j];
	dp[0][1][0] = dp[1][0][0] = true;
	for(int i = 1; i <= h; i++){
		for(int j = 1; j <= w; j++){
			int dif = abs(a[i - 1][j - 1] - b[i - 1][j - 1]);
			rep(k,7000){
				if(dp[i - 1][j][k] || dp[i][j - 1][k]){
					dp[i][j][k + dif] = true;
				}
				if(dp[i][j - 1][k] || dp[i - 1][j][k]){
					dp[i][j][abs(k - dif)] = true;
				}
			}
		}
	}
	rep(i, 8000){
		if(dp[h][w][i]){
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 52380
#include <bits/stdc++.h>
#define Debug(x) printf("x = %d\n", x);
#define Error_cor() puts("OK here")
#define For(i, a, b) for (int i = a; i <= b; i++)
#define Rep(i, a, b) for (int i = a; i >= b; i--)
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
	freopen(".in", "r", stdin);
	freopen(".out", "w", stdout);
#endif
using namespace std;
typedef long long ll;
namespace IO {
	inline ll read() {
		ll x = 0; char c; int f = 1;
		while (c < '0' || c > '9') {if (c == '-') f = -f; c = getchar();};
		while (c >= '0' && c <= '9') {x = (x << 1) + (x << 3) + (c ^ 48);c = getchar();};
		return x * f;
	}
	inline void write(ll x) {
		static char buf[15];
		static int len = -1;
		if (x < 0) {
			putchar('-'); x = -x;
		}
		do {
			buf[++len] = (x % 10) + 48; x /= 10;
		}while (x);
		while (len >= 0)
			putchar(buf[len--]);
	}
	inline void writeln(ll x){
		write(x);
		putchar('\n');
	}
	inline void writesp(ll x) {
		write(x);
		putchar(' ');
	}
	inline void spwrite(ll x){
		putchar(' ');
		write(x);
	}	
}
const int INF = 0x3f3f3f3f;
int main(void) {
	int a = IO::read();
	int b = IO::read();
	int c = IO::read();
	swap(a, b);
	swap(a, c);
	IO::writesp(a);
	IO::writesp(b);
	IO::writeln(c);
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
s = input()
t = input()
n = len(s)

ds = {}
dt = {}
for i in range(n):
    if s[i] not in ds:
        ds[s[i]] = t[i]
    elif ds[s[i]]!=t[i]:
        print("No")
        exit()
    if t[i] not in dt:
        dt[t[i]] = s[i]
    elif dt[t[i]]!=s[i]:
        print("No")
        exit()
print("Yes")


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

void OrderTime(){
    int A[5]={};
    int sum=0;
    for(int i=0;i<5;i++){
        cin >> A[i];
    }
    int min_surplus=10;
    for(int i=0;i<5;i++){
        min_surplus=min(min_surplus,(A[i]+9)%10); //余り
    }
    int cnt=0;
    for(int i=0;i<5;i++){
        if((A[i]+9)%10!=min_surplus||cnt>0){
            sum+=(A[i]+9)/10*10;
        }
        else{
            if(cnt==0){
                sum+=A[i];
                cnt++;
            }
        }
    }
    cout << sum << endl;
}

int main(){
    OrderTime();
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

internal static class CR
{
    public static string Get() { return Console.ReadLine(); }
    public static IEnumerable<string> GetTexts() { return Console.ReadLine().Split(' '); }
    public static int GetInteger() { return int.Parse(Console.ReadLine()); }
    public static IEnumerable<int> GetIntegers() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)); }
}

namespace AtCoder.C
{
    public class Program
    {
        public static int N { get; private set; }
        public static List<int> X { get; private set; }

        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            N = CR.GetInteger();
            X = CR.GetIntegers().ToList();

            var min = int.MaxValue;
            for (int p = 0; p <= 100; p++)
            {
                var cost = (int)X.Select(x => Math.Pow(x - p, 2)).Sum();
                min = min < cost ? min : cost;
            }

            return min;
        }
    }
}


Measured memory_bytes: 13524
import java.util.Scanner;

public class Main {
  public static void main(String args[]) {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();

    if (N % 2 == 1) {
      System.out.println("No");
      sc.close();
      return;
    }

    String S1 = S.substring(0, N / 2);
    String S2 = S.substring(N / 2);

    if (S1.equals(S2)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    sc.close();
  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

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

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

int main(void){
    const int N = (int)1e6;
    bool num[N];
    rep(i, N) num[i] = true;
    for(int i = 2; i * i < N; i ++) if(num[i]) for(int j = i; i * j < N; j ++) num[i * j] = false;

    for(int n; cin >> n;){
        int m = n; while(!num[-- m]); cout << m << " ";
        m = n; while(!num[++ m]); cout << m << endl;
    }

    return 0;
}

Measured memory_bytes: 2132
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


S = LS2()
r = 0
left,right = [],[]

Q = I()
for i in range(Q):
    A = LS()
    if A[0] == '1':
        r = 1-r
    else:
        f,c = A[1],A[2]
        if (r == 0 and f == '1') or (r == 1 and f == '2'):
            left.append(c)
        else:
            right.append(c)

if r == 0:
    left.reverse()
    print(''.join(left+S+right))
else:
    S.reverse()
    right.reverse()
    print(''.join(right+S+left))


Measured memory_bytes: 98816
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n,m = map(int,read().split())

if m >= n*2:
    ans = n
    m -= n*2
    n = 0
else:
    ans = m//2
    m = 0

#print(ans,n,m)
if m:
    ans += m//4

print(ans)


Measured memory_bytes: 9084
S=list(input())
Q=int(input())
Rev=True
front=[]
back=[]
for i in range(Q):
    a=input()
    if a=='1':
        Rev=not(Rev)
    else:
        b,c,x=a.split()
        if c == '1':
            if Rev:
                front.append(x)
            else:
                back.append(x)
        else:
            if Rev:
                back.append(x)
            else:
                front.append(x)
if Rev:
    front.reverse()
    front.extend(S)
    front.extend(back)
    print("".join(front))
else:
    back.reverse()
    S.reverse()
    back.extend(S)
    back.extend(front)
    print("".join(back))


Measured memory_bytes: 7688
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;
int main() {
    fast();
    // /ll t;
    // cin>>t;
    // while(t--)			
    // {
    
    // }
    ll n,d;
    cin>>n>>d;
    ll cnt=0;
    for(int i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        if(sqrt(x*x+y*y)<=d)
        cnt++;
    }
    cout<<cnt;
}

Measured memory_bytes: 3616
import io
import sys

MOD = 10 ** 9 + 7


def IN_S():
  return input()


def IN_I():
  return int(input())


def IN_L_I():
  return list(map(int, input().split()))


def IN_L_S():
  return list(map(str, input().split()))


def STR_SPLIT(s, n):
  for l in range(0, len(s), n):
    yield s[0 + l:n + l]


def T_IN():
  global test_str
  sys.stdin = io.StringIO(test_str[1:-1])


test_str = '''
4049
red
'''


def MAIN():
  # T_IN()
  A()


def A():
  a = IN_I()
  s = IN_S()
  if a < 3200:
    print('red')
  else:
    print(s)

  return None


def B():
  return None


def C():
  return None


MAIN()


Measured memory_bytes: 3064
# https://atcoder.jp/contests/abc138/tasks/abc138_d

import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline


class Graph:
    def __init__(self, n, dictated=False, edge=[]):
        self.n = n
        self.dictated = dictated
        self.conj = [set() for _ in range(self.n)]
        self.visit = set()
        self.parent = [-1]*self.n
        for x, y in edge:
            self.add_edge(x,y)

    def add_edge(self,x,y):
        self.conj[x].add(y)
        if self.dictated == False:
            self.conj[y].add(x)

    def dfs(self, info, start=0, goal=None, use_visit=False):
        """
        :param start: スタート地点
        :param goal: ゴール地点
        :param use_visit: 前回の探索結果を保持するかどうか
        :return: ゴール地点までの距離。存在しなければ -1
        """
        if use_visit == False:
            self.visit = set()
            self.parent = [-1]*self.n
        self.visit.add(start)
        next_set = [(start, 0)]

        while next_set:
            p, t = next_set.pop()
            for q in self.conj[p]:
                if self.parent[q] == p:
                    # 逆流した際の処理
                    continue
                if q in self.visit:
                    continue
                if q == goal:
                    # ゴール時の処理
                    # return t+1
                    continue
                # p から q への引継ぎ処理
                self.parent[q] = p
                info[q] += info[p]

                self.visit.add(q)
                next_set.append((q, t + 1))
        return info


######################################################################################################

N, Q = map(int, input().split())  # N:頂点数, Q: クエリの数
M = N-1

graph = Graph(N, dictated=False)

for _ in range(M):
    x, y = map(int, input().split())
    x -= 1                                    # デクリメントが不要な場合は消す
    y -= 1
    graph.add_edge(x,y)

info = [0] * N
for _ in range(Q):
    p, x = map(int, input().split())
    info[p - 1] += x

print(*graph.dfs(info, start=0))


Measured memory_bytes: 204324
class Heep
  def initialize
    @node = []
  end
  def insert(num) #upheap
    i = @node.size
    @node[i] = num
    p = (i+1)/2-1
    while i > 0 && @node[p] < @node[i]
      @node[i], @node[p] = @node[p], @node[i]
      i = p
      p = (i+1)/2-1
    end
  end
  def extract #downheap
    ret = @node[0]
    @node[0] = @node.pop()
    maxHeapify(0)
    return ret
  end
  def maxHeapify(i)
    h = @node.size
    largest = i
    l = 2 * i + 1
    largest = l if l < h && @node[l] > @node[largest]
    r = 2 * i + 2
    largest = r if r < h && @node[r] > @node[largest]
    if largest != i then
      @node[i], @node[largest] = @node[largest], @node[i]
      maxHeapify(largest)
    end
  end
end

heep = Heep.new()
loop do
  cmd, num = gets.split
  case cmd;
  when "insert";
    heep.insert(num.to_i)
  when "extract";
    puts heep.extract
  when "end";
    break
  end
end

Measured memory_bytes: 16660
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
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; }



int main() {
	
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	
	int n; cin >> n;
	
	vector<ll> a(n); rep(i,n) cin >> a[i];
	
	int q; cin >> q;
	
	vector<ll> b(q), c(q), s(q); rep(i,q) cin >> b[i] >> c[i];
	
	vector<int> table(100005);
	
	ll sum = 0;
	
	rep(i,n) {
		table[a[i]]++;
		sum += a[i];
	}
	
	//cout << "test" << sum << endl;
	
	rep(i,q){
		ll d = c[i] - b[i];
		
		d *= table[b[i]];
		
		sum += d;
		
		table[c[i]] += table[b[i]];
		table[b[i]] = 0;
		
		
		cout << sum << endl;
	}
	
	return 0;
}


Measured memory_bytes: 6892
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define all(s) s.begin(),s.end()
#define sz(s) (int)s.size()
#define clr(v, d) memset(v, d, sizeof(v))
#define fi first
#define se second
#define pp push_back
#define pb pop_back
#define pi 3.141592654
#define MOD 1000000007 
#define cons1 1e12
#define cons2 1e6
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pa;
typedef unsigned long long int ull;
typedef double long dl;
const int N = 1e5+9,oo=1e9;
int n,k;
int v[N], ans[N];
int sol(int i) {
	if (ans[i] == -1) {
		if (i == n - 1)
			ans[i] = 0;
		else {
			int x =1+ min(k, n - i - 1);
			int mx = oo;
			while (--x)
				mx = min(mx, abs(v[i] - v[i + x])+sol(i + x));
			
			ans[i] = mx;
		}

	}
	return ans[i];

}
void solve() {
	clr(ans, -1);
	cin >> n >> k;
	rep(i, 0, n)
		cin >> v[i];
	cout << sol(0) << endl;
	
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	int t = 1;
	//cin >> t;
	while (t--)
		solve();

#ifndef ONLINE_JUDGE
	- system("pause");
#endif

}

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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;
typedef vector<vector<int> > ivve;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define lb         lower_bound
#define up         upper_bound
#define setp       setprecision
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define spc(x)     cout<<fixed<<setp(x)

const   long long  inf = 1e18;
const   long long  cs =  200005;
const   long long  mod = 1000000007;
const   double     PI =  2 * acos(0.0);
void solve()
{
    ll t,n,m,a,b,c,d,e,i,j,k,x,y,z,cnt=0,cnt1=0;
    bool flag = false;
    
    cin>>a>>b>>c>>d;
    cout<<max({a*c,a*d,b*c,b*d})<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

    // freopen ("input.txt","r",stdin);
    // freopen ("output.txt","w",stdout);

    // int32_t tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
  string a;
  long long  sum=0,n;
    cin>>a;
  n=a.size();
  for(int i=0;i<n;i++)
  {
   sum=sum+( a[i]-'0');  
    
  }
  //cout<<sum<<endl;
if(sum%9==0)
  cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3724
n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]
x, y, h = list(filter(lambda x: x[2], p))[0]
for i in range(101):
  for j in range(101):
    H = h + abs(x-i) + abs(y-j)
    if all(max(H-abs(t[0]-i)-abs(t[1]-j), 0) == t[2] for t in p):
      print(i,j,H)

Measured memory_bytes: 3316
#include <stdio.h>
 
int main()
{
    char N[10];
    scanf("%s", N);
 
    int ans = 0;
    for (int i = 0; i < 4; ++i) {
        if (N[i] == '2') ++ans;
    }
 
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;

using ll = long long;
const int mod = 1e9 + 7;
int n;

struct Matrix{
    vector<vector<ll>> a;
    Matrix(){
        a.resize(n, vector<ll> (n));
    }

    Matrix operator* (const Matrix& other) const {
        Matrix product = Matrix();

        for(int i = 0; i < n; ++i) {
            for(int j = 0; j < n; ++j) {
                for(int k = 0; k < n; ++k) {
                    product.a[i][k] += a[i][j] * other.a[j][k];
                    product.a[i][k] %= mod;
                }
            }
        }

        return product;
    }
};


int main(){
    ll k;
    cin>>n>>k;

    vector<vector<ll>> edges(n, vector<ll> (n));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cin>>edges[i][j];
        }
    }

    Matrix answer = Matrix();
    for(int i = 0; i < n; i++){
        answer.a[i][i] = 1;
    }

    Matrix initial = Matrix();
    initial.a = edges;

    while(k > 0){
        if(k % 2 == 1){
            answer = answer * initial;
        }
        initial = initial * initial;
        k = k / 2;
    }

    ll noofways = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            noofways += answer.a[i][j];
            noofways %= mod;
        }
    }

    cout<<noofways;

    return 0;
}

Measured memory_bytes: 3632