akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int g[2010][2010], c[2010][2010], h[2010][2010], w[2010][2010];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m, q;
	cin >> n >> m >> q;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < m; j++) {
			g[i][j] = s[j] - '0';
			c[i + 1][j + 1] = g[i][j];
		}
	}

	for (int i = 0; i < n - 1; i++) {
		for (int j = 0; j < m; j++) {
			h[i + 1][j + 1] = (g[i][j] && g[i + 1][j]);
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m - 1; j++) {
			w[i + 1][j + 1] = (g[i][j] && g[i][j + 1]);
		}
	}

	for (int i = 0; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			c[i][j] += c[i][j - 1];
			h[i][j] += h[i][j - 1];
			w[i][j] += w[i][j - 1];
		}
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			c[i][j] += c[i - 1][j];
			h[i][j] += h[i - 1][j];
			w[i][j] += w[i - 1][j];
		}
	}

	for (int i = 0; i < q; i++) {
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		x1--;
		y1--;
		x2--;
		y2--;
		int ans = c[x2 + 1][y2 + 1] - c[x2 + 1][y1] - c[x1][y2 + 1] + c[x1][y1];
		ans -= h[x2][y2 + 1] - h[x2][y1] - h[x1][y2 + 1] + h[x1][y1];
		ans -= w[x2 + 1][y2] - w[x2 + 1][y1] - w[x1][y2] + w[x1][y1];
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 64896
#include <bits/stdc++.h>
using namespace std;
#define N 140000
#define mod 1000000007
#define pp pair<ll,ll>
typedef long long int ll;
typedef long double ld;
#define MP make_pair

#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++)     
void fastIO(void);

void decimal(int);
ll modmulti(ll, ll, ll);
ll modadd(ll, ll, ll);
ll modpower(ll, ll, ll);
ll gcd(ll, ll );
ll modinv(ll, ll);




int main()
{
 ll a,b;
 cin>>a>>b;
 ll n = b-a+1;
 for(ll i=n;i<a+b;i++){
    if(i>=-1000000 && i<=1000000)
      cout<<i<<" ";
 }
 cout<<endl;
}























void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}

void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b, ll m){
   return ((a%m)*(b%m))%m;
}
ll modadd(ll a, ll b, ll m){
   return ((a%m)+(b%m))%m;
}
ll modpower(ll a, ll n, ll m){
   if(n==0)
      return 1;
   ll result = 1;
   while(n>0){
      if(n%2==1)
         result = modmulti(result,a,m);
      a = modmulti(a,a,m);
      n = n/2;
   }
   return result;
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a, ll m){
   return modpower(a,m-2,m);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>

using namespace std;

typedef long long i64;
typedef vector<i64> vx;
typedef vector<vx> vvx;

i64 numways_makeave(const vx &cards, i64 ave) {
    int n=cards.size();
    i64 x=ave;
    vx y(n);
    int i;
    for (i=0; i<n; i++) {
        y[i] = cards[i] - ave;
        if (cards[i] > x)
            x = cards[i];
    }

    vvx dp(2, vx(2*n*x+1));
    int j, t;
    dp[0][n*x] = 1;
    for (j=1; j<=n; j++)
        for (t=0; t<=2*n*x; t++)
            if (t-y[j-1]>=0 && t-y[j-1]<=2*n*x) {
                dp[j&1][t] = dp[j&1^1][t] + dp[j&1^1][t-y[j-1]];
            } else {
                dp[j&1][t] = dp[j&1^1][t];
            }

    return dp[n&1][n*x] - 1LL;
}

int main(void) {
    int n;
    i64 a;
    cin >> n >> a;

    vx x(n);
    int i;
    for (i=0; i<n; i++) {
        scanf("%lld", &x[i]);
    }

    cout << numways_makeave(x, a) << endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.next().split("");
		int count = 0;
		for (int i = 1; i< s.length; i++)
			if (!s[i].equals(s[i - 1]))
				count++;
		System.out.println(count);
	}
}

Measured memory_bytes: 32236
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

ll a[100010];
ll b[100010];
int main(){
    int n, t;
    cin >> n >> t;
    rep(i, n) cin >> a[i];

    rrep(i, n) b[i] = max(a[i], b[i+1]);

    ll mx = 0;
    rep(i, n) mx = max(mx, b[i] - a[i]);

    int cnt = 0;
    rep(i, n) if (b[i] - a[i] == mx) cnt++;
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb push_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=998244353;
const ll inf=1e17;
const ll ms=(1e5)+5;


set<pair<int,int>> ar[ms];
string ans[ms];


string go(int n)
{
    string s=to_string(n);
    while(s.length()<6)
    {
        s="0"+s;
    }
    return s;
}


int main()
{
    idfc;

    int n,m;
    cin>>n>>m;

    int a,b;
    int i;
    for(i=1;i<=m;i++)
    {
        cin>>a>>b;
        ar[a].insert({b,i});
    }

    string x,y;
    int c;
    for(i=1;i<=n;i++)
    {
        x=go(i);
        c=1;
        for(auto it:ar[i])
        {
            y=go(c);
            ans[it.second]=x+y;
            c++;
        }
    }
    for(i=1;i<=m;i++)cout<<ans[i]<<"\n";

    return 0;
}

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

int main() {
  int n, j, x;
  cin >> n;

  for (int j = 1; j <= n; j++) {
    int x = j;
    if (x % 3 == 0) {
      cout << " " << j;
    }
    else if (x % 10 == 3 || x / 10 % 10 == 3 || x / 100 % 10  == 3 || x / 1000 % 10 == 3) {
      cout << " " << j;
    }
  }
  cout << endl;
}


Measured memory_bytes: 3132
#include<iostream>
#include<string.h>
#include<ctype.h>
#include<string>
#include<math.h>
#define pi 3.141592653589
#include<iomanip>
using namespace std;



int main(){
     
    string str1,str2,str3;
    char turn='a';
    int a=0,b=0,c=0;
    
    cin>>str1>>str2>>str3;
    while(1){
        if(turn == 'a'){
                if(a<str1.size()){
                    turn=str1[a];
                    a++;
                }
                else {
                    cout<<"A"<<endl;
                    break;
                }
        }
        else if(turn == 'b'){
                if(b<str2.size()){
                    turn=str2[b];
                    b++;
                }
                else {
                    cout<<"B"<<endl;
                    break;
                }
        }
        else{
                if(c<str3.size()){
                    turn=str3[c];
                    c++;
                }
                else {
                    cout<<"C"<<endl;
                    break;
                }
        }
    }
     
    return 0;
}
 

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

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

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int botbit(unsigned long long x){
    return x?__builtin_ctzll(x):64;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}


vint gray(int N,int D){
    int k=topbit(D);
    vint ret(1<<N);
    for(int i=0;i<1<<N;i++)ret[i]=i^(i>>1);

    if(k!=N-1){
        for(int i=0;i<1<<N;i++){
            int x=0,y=0;
            if((ret[i]>>N-1)&1){
                ret[i]^=1<<N-1;
                x=1;
            }
            if((ret[i]>>k)&1){
                ret[i]^=1<<k;
                y=1;
            }
            swap(x,y);
            ret[i]|=x<<N-1;
            ret[i]|=y<<k;
        }
    }
    return ret;
}

vint solve(int N,int D){
    if(popcount(D)==1){
        return gray(N,D);
    }

    int t=topbit(D);
    D^=1<<t;
    int s=topbit(D);
    D^=1<<s;
    vint ret=gray(N-1,1<<s);
    vint tmp=solve(N-1,D);

    ret.insert(ret.end(),all(tmp));
    for(int i=1<<N-1;i<1<<N;i++){
        ret[i]^=ret[(1<<N-1)-1];
    }
    for(int i=0;i<1<<N;i++){
        int b=ret[i]&((1<<t)-1);
        int u=ret[i]-b;
        ret[i]=u*2+b;
    }
    for(int i=1<<N-1;i<1<<N;i++)ret[i]^=1<<t;
    return ret;
}

signed main(){
    int N,A,B;
    cin>>N>>A>>B;

    int D=A^B;
    if(parity(D)==0){
        cout<<"NO"<<endl;
        return 0;
    }

    vint v=solve(N,D);
    for(int i=0;i<1<<N;i++)v[i]^=A;
    cout<<"YES"<<endl;
    rep(i,v.size()){
        if(i)cout<<" ";
        cout<<v[i];
    }
    cout<<endl;
    return 0;
}

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

#define pout(n)  printf ("%d\n", n)
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define BIT(bit,a,n) for (int bit = a;bit < (1<<n);bit++) // {0, 1, ..., n-1} の部分集合の全探索 // n番目のフラグが立っている状態は (1<<n)
const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };
#define MAX_N (int)2e5+20
typedef long long ll;
using namespace std;

int n,d,x;
int cnt = 1,ans =0;
int main(){
    scanf("%d%d%d",&n,&d,&x);
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    
    rep(i,0,n){
        cnt = 1;
        while((a[i]*cnt)+1 <= d){
            cnt++;
        }
        ans += cnt;
    }
    pout(ans+x);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int a[100000],b[100000],c[100000];
    long long n,s=0,p=0,q=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        cin>>c[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    sort(c,c+n);
    for(int i=0;i<n;i++){
        for(int j=p;j<n;j++){
            if(a[j]>=b[i]){
                p=j;
                j=n;
            }else if(j==n-1){
                p=n;
            }
        }
        for(int j=q;j<n;j++){
            if(c[j]>b[i]){
                q=j;
                j=n;
            }else if(j==n-1){
                q=n;
            }
        }
        s+=p*(n-q);
        
    }
    cout<<s<<endl;
}


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

int main()
{
	int n, k;
	cin >> n >> k;
	int a[k + 1];
	vector<int> dp(n);
	for (int i = 0; i < n; i++)
	{
		if (i < k)
		{
			if (i == 0)
			{
				cin >> a[0];
				dp[0] = 0;
			}
			else if (i == 1)
			{
				cin >> a[1];
				dp[1] = abs(a[1] - a[0]);
			}
			else
			{
				cin >> a[i];
				int aaa = INT_MAX;
				for (int j = 0; j < i; j++)
				{
					aaa = min( dp[j]+abs(a[i] - a[j]), aaa);
					// a[j]=a[j+1];
				}
				dp[i] = aaa;
			}
			// cout<<dp[i]<<" ";
			// cerr<<dp[i]<<" ";
		}
		else
		{	
			int temp;
			cin >> temp;
			int aaa = INT_MAX;
			for (int j = k; j >= 1; j--)
			{
				aaa = min(dp[i - j] + abs(a[k - j] - temp),aaa);
			}
			dp[i]=aaa;
			for(int j=0;j<k-1;j++){a[j]=a[j+1];}
			a[k-1]=temp;
			// cerr<<dp[i]<<" ";
		}
	}
	// cout<<endl;
	cout << dp[n - 1] << endl;
}


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

using namespace std;
int n;
typedef long long ll;
ll a[100001];
ll b[100001];
ll c[100001];
ll memo1[100001];
ll memo2[100001];
int main() {
  cin >> n;

  for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n; i++) cin >> b[i];
  for(int i = 0; i < n; i++) cin >> c[i];
  sort(a,a+n);
  sort(b,b+n);
  sort(c,c+n);


  if(a[0] >= b[n-1] || b[0] >= c[n-1]) {
    cout <<"0"<<endl;
    return 0;
  }

  ll ans = 0;
  int j = 0;
  for(int i = 0; i < n; i++) {
    while(j < n &&b[j] <= a[i]) j++;
    memo1[i] = n - j;
    //   cout <<"memo1[i] = "<< memo1[i] << endl;
  }

  int k = 0;
  for(int j = 0; j < n; j++) {
    while(k < n && c[k] <= b[j]) k++;
    memo2[j] = n - k;
    //   cout <<"memo2[i] = "<<memo2[j]<<endl;
  }

  for(int k = 1; k < n; k++) {
    memo2[k] = memo2[k] + memo2[k-1];
  }

  for(int i = 0; i < n; i++) {
    if(memo1[i] == n) ans += memo2[n-1];
    else ans += memo2[n-1] - memo2[n-memo1[i]-1];
    //   cout << ans << endl;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 4096
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;

int main() {

	int n, m;

	cin >> n >> m;

	if (n == m) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
rb = [['#'] * (w + 2)]
a = rb + [list('#' + input() + '#') for _ in range(h)] + rb
p = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1) if a[i][j] == '#']
d = (-1, 0), (1, 0), (0, -1), (0, 1)
r = -1
while p:
    r += 1
    s = []
    for i, j in p:
        for di, dj in d:
            di += i
            dj += j
            if a[di][dj] == '.':
                a[di][dj] = '#'
                s.append((di, dj))
    p = s
print(r)


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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;


int main() {
    int a, b, c;
    cin >> a >> b >> c;

    int ans = 0;
    ans += int(a == b);
    ans += int(b == c);
    ans += int(c == a);

    if (ans != 1) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<cstring>
#define P pair<int,int>//cost to
using namespace std;

vector<P>rinsetu[10000];
int mincost[10000];
signed main() {
	int a; cin >> a;
	for (int b = 0; b < a; b++) {
		int c, d; cin >> c >> d;
		for (int e = 0; e < d; e++) {
			int f, g; scanf("%d%d", &f, &g);
			rinsetu[c].push_back(P(g,f));
		}
	}
	fill(mincost, mincost + a, 1 << 29);
	mincost[0] = 0;
	priority_queue<P, vector<P>, greater<P>>Q;
	Q.push(P(0,0));
	while (Q.size()) {
		P t = Q.top(); Q.pop();
		if (t.first > mincost[t.second])continue;
		for (P i : rinsetu[t.second]) {
			if (mincost[i.second] > t.first + i.first) {
				mincost[i.second] = t.first + i.first;
				Q.push(P(t.first + i.first,i.second));
			}
		}
	}
	for (int i = 0; i < a; i++) {
		cout << i << " " << mincost[i] << endl;
	}
}

Measured memory_bytes: 8032
#include <stdio.h>

const long long mod = 1000000007;
long long inv[8080] = { 0,1 }, fact[8080] = { 1,1 }, ifact[8080] = { 1,1 };
long long count[4040][4040];

int main()
{
	for (int i = 2; i < 8080; i++){
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
		fact[i] = fact[i - 1] * i % mod;
		ifact[i] = ifact[i - 1] * inv[i] % mod;
	}

	long long ans = 0;

	int N; scanf ("%d", &N);
	int A[200200], B[200200];
	const int c = 2010;
	for (int i = 0; i < N; i++){
		scanf ("%d %d", &A[i], &B[i]);
		count[c - A[i]][c - B[i]]++;
		ans = (ans + mod - fact[(A[i] + B[i]) * 2] * ifact[A[i] * 2] % mod * ifact[B[i] * 2] % mod) % mod;
	}

	for (int i = 1; i <= c * 2; i++) for (int j = 1; j <= c * 2; j++){
		count[i][j] = (count[i][j] + count[i - 1][j] + count[i][j - 1]) % mod;
	}

	for (int i = 0; i < N; i++) ans = (ans + count[c + A[i]][c + B[i]]) % mod;
	ans = ans * inv[2] % mod;

	printf ("%lld\n", ans);

	return 0;
}

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

int main() {
  char c; cin >> c;
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
    cout << "vowel" << endl;
  }
  else cout << "consonant" << endl;
  return 0;
}

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int a = sc.NextInt();
        int b = sc.NextInt();

        Console.WriteLine((a + b + 1) / 2);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <map>
using namespace std;

#define ll long long
#define ull unsigned long long
#define pb push_back
#define ii pair<int,int>
#define fre freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	//fre
	map<string,int> week;
	week["SUN"]=7;
	week["TUE"]=5;
	week["WED"]=4;
	week["THU"]=3;
	week["FRI"]=2;
	week["SAT"]=1;
	week["MON"]=6;
	string s;
	cin>>s;
	cout<<week[s];
}


Measured memory_bytes: 256
def main():
    n = int(input())
    s = input()
    c = 0
    for i in range(len(s)-2):
        if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
            c += 1
    
    print(c)

if __name__ == "__main__":
    main()

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

#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define tup tuple<int,int,int>
#define fi first
#define se second
typedef long long ll;
const int inf = 100100100;

using namespace std;

int main(){

    int n,w,h;
    while(cin >> n >> w >> h,w){
        int p[110] = {};
        int s[110] = {};
        rep(i,n) cin >> p[i] >> s[i];
        pii G[10100] = {};
        int now=1;
        G[0]=make_pair(w,h);
        for(int i=0;i<n;i++){
            int d = p[i];
            int e = s[i];
            int t=e%(G[d-1].fi+G[d-1].se);
            if(t<G[d-1].fi){
                G[now]=make_pair(min(t,G[d-1].fi-t),G[d-1].se);
                G[now+1]=make_pair(max(t,G[d-1].fi-t),G[d-1].se);
            }else{
                t-=G[d-1].fi;
                G[now]=make_pair(G[d-1].fi,min(t,G[d-1].se-t));
                G[now+1]=make_pair(G[d-1].fi,max(t,G[d-1].se-t));
            }
            G[d-1]=make_pair(-1,-1);
            now++;
            for(int j=0;j<now;j++){
                if(G[j].fi==-1){
                    for(int k=j;k<now;k++)G[k]=G[k+1];
                    break;
                }
            }

        }
        for(int i=0;i<now;i++)s[i]=G[i].fi*G[i].se;
        sort(s,s+now);
        rep(i,now-1) cout << s[i] << " ";
        cout << s[now-1] << endl;
    }
    return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define printclock cerr << "Time : " << 1000 * (ld)clock() / (ld)CLOCKS_PER_SEC << "ms\n";
#define deb2(x, y) cout << #x << ": " << x << " | " << #y << ": " << y << endl
#define deb1(x) cout << #x << ": " << x << endl
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define prec(n) fixed << setprecision(n)
#define all(a) a.begin(), a.end()
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define pii pair<int, int>
#define vii vector<int>
#define ld long double
#define int long long
#define MOD LLONG_MAX
#define mp make_pair
#define pb push_back
#define endl "\n";
inline void get(vector<int> &arr, int n)
{
    int a;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        arr.push_back(a);
    }
}
inline void print(vector<int> &arr, int n)
{
    for (int i = 0; i < n; i++)
        cout << arr[i] << " ";
    cout << endl;
}
/*----------------------------------TEMPLATE------------------------------------*/
int32_t main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    fast;
    /*----------------------------PEEPEEPOOPOO-------------------------------------*/
    int t;
    //cin >> t;
    t= 1;
    while (t--)
    {
        int n;
        cin >> n;
        vii v;
        rep(i,0,n)
        {
            int a,b;
            cin >> a >> b;
            if(a==b) v.pb(i);
        }
        bool exist = false;
        rep(i,0,v.size())
        {
            if(i>0 && i < v.size()-1)
            {
                if(abs(v[i]-v[i-1])==1 && abs(v[i+1]-v[i])==1) 
                {
                    exist = true;
                    break;
                }
            }
        }
        if(exist) cout << "Yes" << endl
        else cout << "No" << endl;
    }
    return 0;
}
/*--------------------------------PEEPEEPOOPOO-------------------------------------*/

Measured memory_bytes: 3640
N = int(input())
D = {}
for i in range(N) :
    index = int(input())
    if index not in D :
        D[index] = 1
    else :
        D[index] += 1
ans = 0
for i in D :
    if D[i] % 2 != 0 :
        ans += 1
print(ans)


Measured memory_bytes: 15076
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    int answer = 0;
    
    REP(i,n){
        int tmp;
        cin >> tmp;
        while(tmp%2 == 0){
            tmp /= 2;
            answer++;
        }
    }
    cout << answer << endl;

    return 0;
}

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

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

    const auto top_bottom = [](int x) {
        struct {
            int top, bottom;
        } ret;
        ret.bottom = x % 10;
        ret.top = x;
        while (ret.top >= 10)
            ret.top /= 10;
        return ret;
    };

    int T[10][10] = {};
    for (int a = 1; a <= n; ++a) {
        auto X = top_bottom(a);
        T[X.top][X.bottom]++;
    }

    int c = 0;
    for (int t = 1; t <= 9; ++t) {
        for (int b = 1; b <= 9; ++b) {
            c += T[t][b] * T[b][t];
        }
    }
    cout << c;
    return 0;
}


Measured memory_bytes: 256
card = Array.new(3){gets.split.map(&:to_i)}
n = gets.to_i
ans = "No"
n.times do
  b = gets.to_i
  3.times do |i|
    3.times do |j|
      if card[i][j] == b
        card[i][j] = -1
      end
    end
  end
end

#横
card.each do |row|
  ans = "Yes" if row.all?{|a| a<0}
end

#縦
card.transpose.each do |column|
  ans = "Yes" if column.all?{|a| a<0}
end
#斜め1
ans = "Yes" if card[0][0]<0 && card[1][1]<0 && card[2][2]<0

#斜め2
ans = "Yes" if card[0][2]<0 && card[1][1]<0 && card[2][0]<0

puts ans


Measured memory_bytes: 14300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;
/*
ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) a=a*a%MOD;
		else res=res*a%MOD;
		b>>=1;
	}
	res=res*a%mod;
	return res;
}
*/


int main()
{
	//IOS;
	int n;
	cin>>n;
	bool f=0;
	while(n--){
		string s;
		cin>>s;
		if(s[0]=='Y') f=1;
	}
	if(f) cout<<"Four\n";
	else cout<<"Three\n";

	return 0;
}


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

int main(){
	long double h,m,hour,minute;
  long double t;
  long double ans;
  cin >> h >> m >> hour >> minute;
  t = abs(minute / 60 - (hour + minute / 60) / 12) * 360;
  ans = h * h + m * m - (2 * h * m * cos(3.14159265359 * t / 180));
  cout << fixed << setprecision(20) << sqrt(ans) << endl;

return 0;
}

Measured memory_bytes: 4168
#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<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000000000;
const int mod = 1000000007;
int test[12345678], res[12345678];
signed main() {
	vector<char> v; map<int, int> cost;
	double n, m, a, b, c, x, ans = 0; string s, t; double cnt;
	double pi = 3.14159265358979323846264338327950;
	cin >> n >> m >> a >> b; a *= 30; a += b / 2; b *= 6;
	double A = min(abs(a - b), 360 - abs(a - b));
	//cout << a << ' ' << b << endl;
	//cout << A << ' ' << cos((double)A / 180.0 * pi) << endl;
	cnt = (double)(n * n + m * m) - (double)((double)(2 * n * m) * cos(A / 180.0 * pi));
	printf("%.15f\n", sqrt(cnt));
	return 0;
}

Measured memory_bytes: 4184
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int sum = 0;
    int max = 0;
    for(int i = 0; i<N; i++){
      int tmp = sc.nextInt();
      sum += tmp;
      max = Math.max(tmp,max);
    }
    if(max<(sum - max)){
      System.out.print("Yes");
    }else{
      System.out.print("No");
    }
  }
}

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

int selectionSort(int a[], int n){
    int count = 0;
    for(int i = 0; i < n - 1; i++){
        int minj = i;
        for(int j = i + 1; j < n; j++) if(a[j] < a[minj]) minj = j;
        if (i != minj){
            swap(a[i], a[minj]);
            count++;
        }
    }
    return count;
}

void showArray(int a[], int n){
    for(int i = 0; i < n; i++){
        if(i) cout << " ";
        cout << a[i];
    }
    cout << endl;
}

int main(void){
    int n;
    cin >> n;

    int arr[100];
    for (int i = 0; i < n; i++) cin >> arr[i];

    int count = selectionSort(arr, n);
    showArray(arr, n);
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3084
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = ReadLine().Split(' ');
            string s = x[1][0].ToString();
            WriteLine("A" + s + "C");
        }

        static int InputNum()
        {
            return int.Parse(ReadLine());
        }
        static List<int> InputNumList()
        {
            return ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }
}



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

int main() {
	int n, m;
	cin >> n >> m;
	int s[50] = {};
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		s[a - 1]++;
		s[b - 1]++;
	}
	for (int i = 0; i < n; i++) {
		cout << s[i] << endl;
	}
	return 0;
}


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

a = list(map(int, input().split()))

memo = {}

ans = 0

for i in range(n):
    diff = i - a[i]
    memo.setdefault(diff, 0)
    ans += memo[diff]
    sum = a[i] + i
    memo.setdefault(sum, 0)
    memo[sum] += 1

print(ans)

Measured memory_bytes: 61492
#!/usr/bin/env python3

def solve():
    N = int(input())
    A = list(map(int, input().split()))
    for a in A:
        if a == 0:
            return 0
    ans = 1
    for a in A:
        ans *= a
        if ans > 10**18:
            return -1
    return ans

def main():
    print(solve())

main()

        


Measured memory_bytes: 21632
#include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<string>
using namespace std;
int main() {
string S;
cin >> S;
if (S[0] == '9'||S[1] == '9')
  cout<<"Yes"<<endl;
else
  cout<<"No"<<endl;
  
}

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

int main() {
  
  int A = 0;
  int B = 0;
  int C = 0;
  cin>>A;
  cin>>B;
  cin>>C;
  if(A==B && B==C && A==C){
    cout<<"No"<<endl;
  }else if(A==B && A!=C){
  cout<<"Yes"<<endl;
  }else if(A==C && A!=B){
    cout<<"Yes"<<endl;
  }else if(B==C && A!=B){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

}

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

int main() {
    int i, n, ans=0;
    cin >> n;
    vector<int> d(n);

    for(i=0; i<n; i++) {
        cin >> d[i];
    }
    sort(d.begin(), d.end());

    for(i=0; i<n; i++) {
        if (i%2) ans -= d[i];
        else ans+=d[i];
    }

    cout << abs(ans) << endl;
}

Measured memory_bytes: 3596
N,M=map(int,input().split())
P=list(map(int,input().split()))
  
root=list(range(1,N+1))

def find(x):
  if root[x-1]==x:
    return x
  else:
    root[x-1]=find(root[x-1])
    return root[x-1]

for _ in range(M):
  x,y=map(int,input().split())
  x=find(x)
  y=find(y)
  if x!=y:
    root[max(x,y)-1]=min(x,y)
  
ans=0
for i in range(1,N+1):
  if find(i)==find(P[i-1]):
    ans+=1
  
print(ans)

Measured memory_bytes: 14008
import sys

n, m, *a = map(int, sys.stdin.read().split())

def main():
    a.sort(reverse=True)
    s = sum(a)
    ans = 'Yes' if  a[m-1] * 4 * m >= s else 'No'
    print(ans)

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vec> mat;
ll gcd(ll a,ll b){
  if(!b) return a;
  return gcd(b,a%b);
}
int main(){
    ll n,m,A[200001],ans=1;
    cin>>n>>m;
    rep(i,n) cin>>A[i];
    rep(i,n) A[i]/=2;
    rep(i,n){
        ans=A[i]/gcd(ans,A[i])*ans;
        if(ans>m){
            cout<<0;
            return 0;
        }
    }
    int z=1;
    rep(i,n) if((ans/A[i])%2==0){
        cout<<0;
        return 0;
    }
    cout<<(m+ans)/(ans*2);
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int n, flg;
int main() {
	while (cin >> n) {
		flg = 0;
		for (int i = 1; n > 0; i *= 2) {
			if (n & 1) {
				if (flg > 0)
					cout << ' ';
				cout << i;
				flg = 1;
			}
			n = n >> 1;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3084
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace codeTester.contest190629
{
    class ProblemC
    {
        static int num = 0;
        static List<long> values = new List<long>();
        static long answer = 0;

        public static void Main(string[] args)
        {
            Input();
            Logic();
            Output();
        }

        static void Input()
        {
            num = int.Parse(Console.ReadLine());
            values = ReadSpaceSeparatedValues();
        }

        public static List<long> ReadSpaceSeparatedValues()
        {
            List<long> values = new List<long>();
            string[] inputs = Console.ReadLine().Split(' ');
            foreach (string input in inputs)
            {
                values.Add(long.Parse(input));
            }

            return values;
        }

        static void Logic()
        {
            List<long> sortedValies = values.OrderBy(value => value).ToList();
            answer = sortedValies[(num / 2)] - sortedValies[(num / 2) - 1];
        }

        static void Output()
        {
            Console.WriteLine(answer.ToString());
        }
    }
}


Measured memory_bytes: 24416
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#include <map>
#include <cstdlib>
using namespace std;

typedef pair<int, int> P;

const int MAX_M = 1000;
int M;
P g[MAX_M];
map<string, int> id;
map<int, string> id2;

int getCost(int s, int e) {
  return abs(g[e].first - g[s].first) + abs(g[e].second - g[s].second);
}

int getDir(int s, int e) {
  int x = g[e].first - g[s].first;
  int y = g[e].second - g[s].second;
  if(x > 0) return 0;
  if(y > 0) return 1;
  if(x < 0) return 2;
  if(y < 0) return 3;
  return -1;
}

struct Edge {
  int to, cost, dir;
  Edge(int from, int to) {
    this->to = to;
    cost = getCost(from, to);
    dir = getDir(from, to);
  }
};

vector<Edge> e[MAX_M];

struct S {
  int p, dir, cost, cnt;
  bool operator < (const S &s) const {
    if(cost != s.cost) return cost > s.cost;
    if(cnt != s.cnt) return cnt > s.cnt;
    if(p != s.p) return p > s.p;
    if(dir != s.dir) return dir > s.dir;
  }
};

int solve(int start, int goal) {
  priority_queue<S> que;
  S s;
  bool vis[MAX_M][4];
  fill(vis[0], vis[M], false);
  s.p = start;
  s.dir = -1;
  s.cost = 0;
  s.cnt = 1;
  que.push(s);
  while(!que.empty()) {
    s = que.top();
    que.pop();
    if(s.p == goal) return s.cnt;
    for(int i = 0; i < e[s.p].size(); ++i) {
      Edge &v = e[s.p][i];
      int dir =(v.dir - s.dir + 4) % 4;
      if(s.dir != -1 && (dir == 3 || dir == 2)) continue;
      if(vis[v.to][v.dir]) continue;
      vis[v.to][v.dir] = true;
      S t;
      t.p = v.to;
      t.dir = v.dir;
      t.cost = s.cost + v.cost;
      t.cnt = s.cnt + 1;
      que.push(t);
    }
  }
  return -1;
}

int main() {
  int n;
  while(cin >> M >> n && (M || n)) {
    id.clear();
    id2.clear();
    for(int i = 0; i < M; ++i) e[i].clear();

    for(int i = 0; i < M; ++i) {
      string name;
      cin >> name >> g[i].first >> g[i].second;
      id[name] = i;
      id2[i] = name;
    }

    string s, t;
    for(int i = 0; i < n; ++i) {
      cin >> s >> t;
      e[id[s]].push_back(Edge(id[s], id[t]));
      e[id[t]].push_back(Edge(id[t], id[s]));
    }

    cin >> s >> t;
    int ans = solve(id[s], id[t]);
    if(ans == -1) cout << "impossible" << endl;
    else cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>

#define MAX 999999

int ind(int x, int y, int W) { return y * W + x; }

std::vector<int> makeHorizontals(int no) {
    std::vector<int> h;

    int bit = 1;
    while (no) {
        if (no & 1) {
            h.push_back(bit);
        }
        bit++;
        no >>= 1;
    }

    return h;
}

int countVerticals(char *data, int H, int W, int K, const std::vector<int> &horizontals) {
    // possible optimization: add maximum allowed breaks

    int previousLine = 0;

    std::vector<int> counts(horizontals.size(), 0);
    std::vector<int> countsCurrent(horizontals.size(), 0);

    int verticalsCount = 0;

    for (int x = 0; x < W; x++) {
        auto delim = horizontals.begin();
        int segment = 0;
        for (int y = 0; y < H; y++) {
            if (y >= *delim) {
                segment++;
                delim++;
            }
            countsCurrent[segment] += data[ind(x, y, W)];
        }
        bool breakNeeded = false;
        for (int i = 0; i < counts.size(); i++) {
            if (counts[i] + countsCurrent[i] > K) {
                breakNeeded = true;
                break;
            }
        }
        if (breakNeeded) {
            // are we single-column already?
            if (x == previousLine) {
                return MAX;
            }
            for (int i = 0; i < counts.size(); i++) {
                counts[i] = countsCurrent[i];
                countsCurrent[i] = 0;
            }
            previousLine = x;
            verticalsCount++;

        } else {
            for (int i = 0; i < counts.size(); i++) {
                counts[i] += countsCurrent[i];
                countsCurrent[i] = 0;
            }
        }
    }
    return verticalsCount;
}

int main(int argc, char **argv) {
    int H, K, W;
    std::cin >> H >> W >> K;


    auto data = new char[H * W];

    for (int y = 0; y < H; y++) {
        std::string s;
        std::cin >> s;
        int x = 0;
        for (auto c : s) {
            data[ind(x, y, W)] = (c == '0') ? 0 : 1;
            x++;
        }
    }

    // With one dimension fixed, the search can be done greedily. So fix the smaller side (1 <= H <= 10).

    int numIndicesHorizontals = 1 << (H - 1);

    int min = MAX;
    for (int h = 0; h < numIndicesHorizontals; h++) {
        auto hors = makeHorizontals(h);
        // add sentinel because we test against it
        int countH = hors.size();
        hors.push_back(MAX);
        int countV = countVerticals(data, H, W, K, hors);
        min = std::min(min, countH + countV);
    }

    std::cout << min << std::endl;

    return 0;
}


Measured memory_bytes: 256
from math import gcd

############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
n = inp()
s = 0
for i in range(1,n + 1):
    for j in range(1,n + 1):
        b = gcd(i,j)
        for k in range(1, n + 1):
            s += gcd(b,k)
print(s)
#print('No')
#print()


Measured memory_bytes: 67728
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

 int n;
 cin>>n;

    int x , y;
    int flag = 0;

    for(x = 1 ; x<=sqrt(n) ; x++)
    {
      if(n%x == 0)
      {
        y = n/x;
        if(x<=9 && y<=9)
        {
          flag++;
          break;
        }
      }
    }

    if(flag == 0)
      cout<<"No\n";

    else
      cout<<"Yes\n";
 

 
  return 0;
} 



Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

res = 0
cnt = 1
prev = A[0]
for idx in range(1, N):
    if A[idx] == prev:
        cnt += 1
    else:
        cnt = 1
    if cnt > 1:
        cnt = 0
        res += 1
    prev = A[idx]

print(res)


Measured memory_bytes: 3064
public class Main {
    public static void main(String args[]) {
        java.util.Scanner sc = new java.util.Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();

        if ((B - A) % 2 == 0) {
            System.out.println("Alice");
        } else {
            System.out.println("Borys");
        }
    }
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}


int main() {
    int N; cin >> N;
    vector<ll> A(N); REP(i, N) cin >> A[i];

    map<ll, ll> tmp;
    for(int i = 0; i < N; ++i) {
        tmp[A[i]]++;
    }

    ll a = 0;
    ll b = 0;
    sort(all(A));
    for(int i = N - 1; i >= 0; --i) {
        if(tmp[A[i]] >= 2) {
            if(a == 0) {
                a = A[i];
                if(tmp[A[i]] >= 4) {
                    b = A[i];
                    break;
                }
            }

            if(a != 0 && a != A[i] && b == 0) {
                b = A[i];
                break;
            }
        }
    }

    ll c = a * b;
    cout << c << endl;
}

Measured memory_bytes: 7296
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.max
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val a = readInteger()
    val s = br.readLine()!!
    val ans = if (a >= 3200) s else "red"
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 34140
def calcDiv(n):
    d_list = []
    for i in range(1, int(n**(1/2))+1):
        if n%i == 0:
            d_list.append(i)
            d_list.append(int(n/i))
    return d_list


def isPrime(n):
    for i in range(2, int(n**(1/2))+1):
        if n % i == 0:
            return False
    return True


if __name__ == "__main__":    
    a, b = map(int, input().split())
    a_list = calcDiv(a)
    b_list = calcDiv(b)
    d_list = set(a_list) & set(b_list)
    cnt = 0
    for d in d_list:
        if isPrime(d):
            cnt += 1
    print(cnt)


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int w;
    cin >> w;
    int h;
    cin >> h;
    int n;
    cin >> n;
    int x[n], y[n], a[n];
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> a[i];
    bool s[w][h];
    for (int i = 0; i < w; i++) {
        for (int j = 0; j < h; j++) {
            s[i][j] = true;
        }
    }
    for (int i = 0; i < n; i++) {
        if (a[i] == 1) {
            for (int j = 0; j < x[i]; j++) {
                for (int k = 0; k < h; k++) {
                    s[j][k] = false;
                }
            }
        } else if (a[i] == 2) {
            for (int j = x[i]; j < w; j++) {
                for (int k = 0; k < h; k++) {
                    s[j][k] = false;
                }
            }
        } else if (a[i] == 3) {
            for (int k = 0; k < y[i]; k++) {
                for (int j = 0; j < w; j++) {
                    s[j][k] = false;
                }
            }
        } else {
            for (int k = y[i]; k < h; k++) {
                for (int j = 0; j < w; j++) {
                    s[j][k] = false;
                }
            }
        }
    }
    int res = 0;
    for (int i = 0; i < w; i++) {
        for (int j = 0; j < h; j++) {
            if (s[i][j]) res++;
        }
    }
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};


long long N, M;
int main() {
    while (cin >> N >> M) {
        vector<int> A(M), B(M);
        for (int i = 0; i < M; ++i) {
            cin >> A[i] >> B[i], --A[i], --B[i];
        }
        UnionFind uf(N);
        long long cur = N * (N-1) / 2;
        vector<long long> res;
        for (int i = 0; i < M; ++i) {
            res.push_back(cur);
            
            int a = A[M-1-i], b = B[M-1-i];
            if (uf.issame(a, b)) continue;
            
            long long sa = uf.size(a), sb = uf.size(b);
            cur -= sa * sb;
            uf.merge(a, b);
        }
        
        reverse(res.begin(), res.end());
        for (int i = 0; i < res.size(); ++i) cout << res[i] <<endl;
    }
}














Measured memory_bytes: 3444
#include <utility>
#include <stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define YES(b) std::cout<< (b ? "YES" : "NO")
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m, k, l, sum;
	cin >> n >> m >> k >> l;
	
	if (n > m) {
		sum = m * k;
		sum += (n - m)*l;
	}
	else {
		sum = n * k;
	}
	cout << sum;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int N;
	cin >> N;
	string s1;
	string s2;
	cin >> s1;
	cin >> s2;
	int prev = -1;
	int res = 1;
	int MOD = 1000000007;
	for (int i = 0; i < N; i++) {
		if (s1[i] == s2[i]) {
			if (prev == -1) {
				res = (res * 3) % MOD;
			}
			else if (prev == 0) {
				res = (res * 2) % MOD;
			}
			else {
				
			}
			prev = 0;
		}
		else {
			if (prev == -1) {
				res = (res * 6) % MOD;
			}
			else if (prev == 0) {
				res = (res * 2) % MOD;
			}
			else {
				res = (res * 3) % MOD;
			}
			prev = 1;
			i++;
		}
	}
	cout << res << 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, M;
  cin >> N >> M;
  vector<bool> is_AC(N, false);
  int AC_count = 0;
  int penalty_count = 0;
  vector<int> teisyutu_suu(N, 0);
  rep(i, M)
  {
    int p;
    string S;
    cin >> p >> S;
    if (S == "AC")
    {
      if (!is_AC[p - 1])
      {
        AC_count++;
        penalty_count += teisyutu_suu[p - 1];
      }

      is_AC[p - 1] = true;
    }
    teisyutu_suu[p - 1]++;
  }
  cout << AC_count << " " << penalty_count << endl;
  return 0;
}

Measured memory_bytes: 640