akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second

using namespace std;

using ld = long double;
using ll = long long int;

const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

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

ll in(){long long int x; assert(scanf("%lld", &x) == 1); return x;}
ld fin(){double x; assert(scanf("%lf", &x) == 1); return x;}
char yuyushiki[1000010]; string stin(){assert(scanf("%s", yuyushiki) == 1); return yuyushiki;}

// head

struct Mod{
  unsigned n;
  Mod() : n(0){}
  Mod( ll x ){
    if( x < 0 ) n = x%MOD+MOD;
    else n = x%MOD;
  }
};
Mod operator + ( Mod a  , Mod b ){ return Mod( a.n + b.n ); }
Mod operator +=( Mod &a , Mod b ){ return a = a + b; }
Mod operator - ( Mod a ){ return Mod( MOD - a.n ); }
Mod operator - ( Mod a  , Mod b ){ return Mod( a.n + MOD - b.n ); }
Mod operator -=( Mod &a , Mod b ){ return a = a - b; }
Mod operator * ( Mod a  , Mod b ){ return Mod( (ll)a.n * b.n ); }
Mod operator *=( Mod &a , Mod b ){ return a = a * b; }
Mod modpow( Mod x , ll k ){
  Mod res = 1;
  while( k ){
    if( k & 1 ) res *= x;
    k /= 2;
    x *= x;
  }
  return res;
}
ll extgcd( ll a , ll b , ll &x , ll &y ){
  ll d = a;
  if( b != 0 ){
    d = extgcd( b , a % b , y , x );
    y -= a / b * x;
  } else {
    x = 1, y = 0;
  }
  return d;
}
Mod inv( Mod a ){ ll x, y; assert( extgcd( a.n , MOD , x , y ) == 1 ); return Mod( x ); }
Mod operator / ( Mod a  , Mod b ){ return Mod( (ll)a.n * inv(b).n ); }
Mod operator /=( Mod &a , Mod b ){ return a = a / b; }

Mod dp[4010][4010];

int main(){

  ll n = in();
  ll m = in();
  ll k = in();

  if(m == 0){
    puts("1");
    return 0;
  }

  ll keta = (n + m - 1) / (k - 1);

  dp[0][0] = 1;
  REP(i, keta){
    dp[i+1][0] = 1;
    REP(j, n){
      if(j < k - 1){
        dp[i+1][j+1] = dp[i+1][j] + dp[i][j+1];
      } else {
        dp[i+1][j+1] = dp[i+1][j] + dp[i][j+1] - dp[i][j-k+1];
      }
    }
  }

  Mod ans = 0;
  while(keta > 0 && n > 0){
    ans += dp[keta][n];
    n -= (k - 1);
    keta--;
  }

  cout << ans.n << endl;
  
  return 0;
}


Measured memory_bytes: 63872
#include <iostream>
#include <climits>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <vector>

#define ll long long
#define REP(i, n) for (int i=0;i<n;++i)
#define REP_1(i, n) for (int i=1;i<=n;++i)
#define REP_2(i, j, n, m) REP(i, n) REP(j, m)
#define REP_2_1(i, j, n, m) REP_1(i, n) REP_1(j, m)

#define JU_RAN(a,x,b) a<=x&&x<=b



using namespace std;

int v[15];
void solve(){
    int n;
    cin>>n;
    while (n--){
        REP_1(i,10)cin>>v[i];
        stack<int > a;
        stack<int > b;
        a.push(0);
        b.push(0);

        bool f=1;
        REP_1(i,10){
            if(a.top()>=b.top()){
                if(a.top()<v[i]){
                    a.push(v[i]);
                } else if(b.top()<v[i]){
                    b.push(v[i]);
                } else{
                    f=0;
                    break;
                }
            }
            else{
                if(b.top()<v[i]){
                    b.push(v[i]);
                } else if(a.top()<v[i]){
                    a.push(v[i]);
                } else{
                    f=0;
                    break;
                }
            }
        }

        if(f){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }

    }

}



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

#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    solve();



#ifdef LOCAL_DEFINE
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 3124
#include "iostream"
#include "cmath"
using namespace std;
int main()
{
	char b;
	cin >> b;
	if (b == 'A')
	{
		cout << 'T';
	}
	if (b == 'T')
	{
		cout << 'A';
	}
	if (b == 'C')
	{
		cout << 'G';
	}
	if (b == 'G')
	{
		cout << 'C';
	}
	cout << endl;
}

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

int main() {
  vector<int> a(3);
  for (int i = 0; i < 3; i++)
    cin >> a[i];
  sort(a.begin(), a.end());
  cout << a[0] + a[1] << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		int[] h = new int[n];
		for (int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}

		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (h[i] >= k) {
				ans++;
			}
		}

		pr.println(ans);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 50740
// Marcin Knapik
#include<bits/stdc++.h>

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> // order_of_key
// #include <ext/pb_ds/tree_policy.hpp> // find by order
// using namespace __gnu_pbds; 
// #define ordered_set tree< pair<int, int> , null_type,less<pair<int, int>>, rb_tree_tag,tree_order_statistics_node_update>  

// const ll MAX_LL = 0xFFFFFFFFFFFFFFFF;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define losuj(a, b) uniform_int_distribution<ull>(a, b)(rng)
#define losuj_real(a, b) uniform_real_distribution<long double>(a, b)(rng)

typedef long double             ld;
typedef long long               ll;
typedef unsigned long long      ull;
typedef pair<ll, ll>            pll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ii>              vii;
typedef vector<vi>              vvi;
typedef vector<vector<ii>>      vvii;
typedef vector< ll >            vll;
typedef vector< pll >           vpll;
 
#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define rall(c)                 (c).rbegin(), (c).rend()
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define f                       first
#define s                       second
 
template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}
 
template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> inline T russian(T a, T b, T mod) {ll res = 0; while(b){if(b&1) res = (res + a)%mod; a = (a+a)%mod; b>>=1;}return res;}
template <class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<typename T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }
  
const ll INF = 1e9 + 7;
const ll mod = 998244353;
const ll N = 1e6+7;
const ll T = 1<<20;
const ll BIG_INF = 1e18 + 7;

ll n, m, k, q;
	
ld dp[301][301][301];
int ile[4];

ld policz_dp(int a, int b, int c){
	if(a < 0 || b < 0 || c < 0)
		return 0;
	if(a == 0 && b == 0 && c == 0)
		return 0;
	if(dp[a][b][c] != -1)
		return dp[a][b][c];
	return dp[a][b][c] = (1.0 + policz_dp(a-1, b, c)*a/n + policz_dp(a+1, b-1, c)*b/n + policz_dp(a, b+1, c-1)*c/n)*n/(a+b+c);
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    memset(dp, -1, sizeof(dp));
    
    cin >> n;

    FOR(i, n){
    	int temp;
    	cin >> temp;
    	ile[temp]++;
    }

    cout << setprecision(10) << fixed << policz_dp(ile[1], ile[2], ile[3]) << '\n';
}

Measured memory_bytes: 426496
//karna padega 
#include<bits/stdc++.h>
using namespace std;	
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;	i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 1e7+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
bool pf[N+2];
int spf[N+10];
void pre(){
	for(int i =1;i<=N;i++)spf[i] = i;
	for(int i =2;i*i<=N;i++){
		if(pf[i]==0){
			for(int j =2*i ; j <=N;j+=i){
				pf[j] =1;
				spf[j] = i;
			}
		}
	}
}
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS;
	int T=1;
	// cin >> T;
	pre();
	while(T--){
		int n ;
		cin >> n;
		int ans =0;
		fn1{
			map<int,int>mp;
			int x = i;
			while(x>1){
				mp[spf[x]]++;
				x/=spf[x];
			}
			int k = 1ll;
			for(auto j : mp)k*=(1+j.se);
			ans+=i*k;
		}
		cout <<ans;
	
	}
	return 0;
}

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

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

odd = sum(a % 2 for a in arr)
four = sum(a % 4 == 0 for a in arr)
even = n - odd - four

if even:
    print("Yes" if four >= odd else "No")
else:
    print("Yes" if four >= odd - 1 else "No")


Measured memory_bytes: 15020
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<int(n);++i)
#define FOR(i,a,b) for(int i=int(a);i<=int(b);++i)
#define FORD(i,a,b) for(int i=int(a);i>=int(b);--i)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline int msbp(int x) {return 31-__builtin_clz(x);}
inline int msb(int x) {return 1 << msbp(x);}
typedef long long ll;
typedef pair<int, int> pii;
// const ll INF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = 0x3f3f3f3f;
// const int INF = INT_MAX;
// const int nINF = INT_MIN;
// const ll INF = LLONG_MAX;
// const ll nINF = LLONG_MIN;

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

const int N = 2e5+10, M = 1e9+7;

ll mod(ll x) {return (x % M + M) % M;}
int add(ll a, ll b) {return mod(mod(a)+mod(b));}
int mult(ll a, ll b) {return mod(mod(a)*mod(b));}

int n, k, a[N], ans = 1;
vector<int> pos, neg;

signed main() {
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(7);
    cin >> n >> k;
    REP(i, n) cin >> a[i];
    REP(i, n) {
    	if(a[i] > 0) {
    		pos.push_back(a[i]);
    	} else {
    		neg.push_back(a[i]);
    	}
    }
    if(pos.size()) {
		// we have a choice on number of positive numbers.
		if(k & 1) {
			// choose the biggest positive number first
			sort(pos.begin(), pos.end());
			ans = pos.back();
			pos.pop_back();
			--k;
		}
		vector<ll> all;
		sort(pos.begin(), pos.end(), greater<int>());
		sort(neg.begin(), neg.end());
		for(int i = 0; i+1 < pos.size(); i += 2) all.push_back((ll)pos[i]*pos[i+1]);
		for(int i = 0; i+1 < neg.size(); i += 2) all.push_back((ll)neg[i]*neg[i+1]);
		if((pos.size() & 1) && (neg.size() & 1)) all.push_back((ll)pos.back()*neg.back());
		sort(all.begin(), all.end(), greater<ll>());
		REP(i, k/2) {
			ans = mult(ans, all[i]);
		}
		cout << ans << endl;
    } else {
    	sort(neg.begin(), neg.end(), greater<int>());
    	if(k & 1) {
    		REP(i, k) ans = mult(ans, neg[i]);
    	} else {
    		FORD(i, neg.size()-1, neg.size()-k) ans = mult(ans, neg[i]);
    	}
    	cout << ans << endl;
    }

    return 0;
}

// Easy things to check:
// - LONG LONGS (WA)
// - const int N is correct (WA, RTE) CHECK IF IT SHOULD BE 2*N!!!!
// - .size()-k underflow (WA, RTE, TLE)
// - small n edge cases (WA)

// Rare mistakes made in the past:
// - division by 0 (WA)
// - negative arithmetic, ceiling division, modulo (WA)
// - setprecision (WA)
// - INF not big enough using ll (WA)
// - setting max to 0 instead of -INF/min to 0 instead of INF (WA)
// - outputting debug (WA)
// - allocating too much memory (locRTE, MLE)
// - stack size (locRTE)
// - round announcements (WA)
// - multiset::erase (WA)
// - forgetting to rename recursive call when copy/pasting recursive function (WA)
// - not clearing DS between test cases EVEN FOR INPUT (WA, RTE, TLE, MLE)


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

int facctorialMethod(int k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
int main(){
    int n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2<<endl;
}



Measured memory_bytes: 256
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

li = []
for _ in range(m):
    b, c = map(int, input().split())
    li.append([c, b])

li.sort(reverse=True)

p = 0
q = 0
while p < len(a) and q < len(li):
    if a[p] < li[q][0]:
        a[p] = li[q][0]
        li[q][1] -= 1
        if li[q][1] == 0:
            q += 1
    else:
        break

    p += 1
            
print(sum(a))


Measured memory_bytes: 26040
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <cstring>
using namespace std;

#define F(i,a,b) for(long long  i =a; i<b; i++)
#define rF(i,a,b) for(long long i=a-1; i>=b;i--)
#define endl "\n"
#define min1(x,y,z) min(x,min(y,z))
#define input_vector(v,n,type) vector<type> v;for(int i=0;i<n;i++){type x;cin>>x;v.push_back(x);}
#define IOS ios_base::sync_with_stdio(false);  cin.tie(NULL);  cout.tie(NULL);
#define int long long
#define inf (1LL<<61)
typedef pair<int,int> ii;
typedef vector<pair<int,int>> vii;
typedef vector<int> vi;


int n,k;
int dp[200005];
int h[200005] = {0};

int minCost(int i)
{
        if(i==n-1) return 0;
        if(dp[i]!=-1) return dp[i];

        int mCost = inf;
        for(int j = 1; j <= k && i+j<=n-1; j++)
        {
                mCost = min(mCost, abs(h[i+j]-h[i]) + minCost(i+j));
        } 
        return dp[i] = mCost;
}

int32_t main()
{
  IOS;

  cin>>n>>k;

  F(i,0,n)
  {
          int x;
          cin>>x;
          h[i] = x;
  }
        
  memset(dp, -1, sizeof dp);

  cout<<minCost(0)<<endl;

  

  

  



 
  
  

  






























  return 0;
}

Measured memory_bytes: 7296
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe


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

int n,l[100000]={},m=0,s=0,S=0;
cin >> n;
rep(i,n){
    cin >> l[i];
}
for (int i=0;i<n;i++){
    m = max(l[i],m);
}
rep(i,n){
    s += l[i];
}
S = s-m;
if(m<S){
    cout << "Yes" << endl;
}else{
    cout << "No" << endl;
}

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 640
import java.util.*;
import java.io.*;

public class Main {
	
	public String formation(String str){
		LinkedList<Character> list = new LinkedList<Character>();
		list.add(str.charAt(0));
		int now = 0;
		for(int i = 3; i < str.length(); i += 3){
			if( str.charAt(i-1) == '>' ){
				now++;
			} else {
				now--;
			}
			if( now >= list.size() ){
				list.addLast(str.charAt(i));
			} else if( now < 0 ){
				list.addFirst(str.charAt(i));
				now = 0;
			}
		}
		StringBuilder ans = new StringBuilder();
		for(Character x : list){
			ans.append(x);
		}
		return ans.toString();
	}
	public void solve() throws IOException{
		int n = nextInt();
		for(int i = 0; i < n; i++){
			String str = nextToken();
			writer.println(formation(str));
		}
		writer.flush();
	}
	public static void main (String args[]) throws IOException{
		new Main().run();
	}
	
	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;
	
	public void run() throws IOException{
		try{
			reader = new BufferedReader(new InputStreamReader(System.in));
			tokenizer = null;
			writer = new PrintWriter(System.out);
			solve();
			reader.close();
			writer.close();
		} catch (Exception e){
			e.printStackTrace();
			System.exit(1);
		}
	}
	public int nextInt() throws IOException{
		return Integer.parseInt(nextToken());
	}
	public String nextToken() throws IOException{
		while( tokenizer == null || !tokenizer.hasMoreTokens() ){
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
}

Measured memory_bytes: 10000
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
using namespace std;

int main(){
	int n,k;
	cin >> n >> k;
	vector<int> x(n,0);
	for(int i=0;i<n;i++){
		cin >> x[i];
	}
	
	int sum=0;
	for(int i=0;i<n;i++){
		sum+=min(x[i],abs(k-x[i]));
	}
	
	cout << 2*sum << endl;
	return 0;
}


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

#define FOR(i,N) for(int i=0;i<N;i++)
#define ROF(i,N) for(int i=N-1;i>=0;i--)
#define ROF1(i,a,b) for(int i=(b);i>=(a);i--)
#define FOR1(i,a,b) for(int i=(a);i<=(b);i++)
#define FORi(i,a,b,c) for(int i=(a);i<=(b);i+=(c))

#define read freopen("IN.txt","r",stdin)
#define write freopen("OT.txt","w",stdout)
#define fastread {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mem(a,b)          memset(a,b,sizeof(a))
#define EPS 1e-9
#define PI              acos(-1.0)
#define INF             2e16

#define ll              long long
#define ull             unsigned long long
#define ft              first
#define sd              second
#define bn              begin
#define en              end
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>
#define all(x) x.begin(), x.end()


#define dbg(args...) {cerr<<"-->";debugger::call(#args,args);cerr<<"\n";}
struct debugger {
    static void call(const char* it) {}
    template<typename T, typename ... aT>
    static void call(const char* it, T a, aT... rest) {
        string b;
        for (; *it&&*it != ','; ++it) if (*it != ' ')b += *it;
        cerr << b << "=" << a << " ";
        call(++it, rest...);
    }
};

int main()
{
#ifdef SunWalker
    //read;
   //write;
#endif

     int n;
     string s;
     cin>>n>>s;
     if(n>=3200)cout<<s<<"\n";
     else cout<<"red\n";


return 0;
}



Measured memory_bytes: 256
def resolve():
    N=int(input())
    def make_divisors(n):
        divisors = []
        for i in range(1, int(n**0.5)+1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i: # 平方数の場合n**0.5を1つだけにしてる
                    divisors.append(n//i)

        # divisors.sort() # ソートしたけりゃして
        return divisors
    l=make_divisors(N)
    ls=len(l)
    l1=l[-1]
    try:
        l2=l[-2]
    except:
        pass

    if len(l)%2==0:
        print(max(len(str(l1)),len(str(l2))))
    else:
        print(len(str(l1)))
        

resolve()

Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static final String EOL = System.getProperty("line.separator");
    public void exec() throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	PrintWriter out = new PrintWriter(System.out);
    	String[] s;
    	int n,x;
    	while(true) {
    		s = br.readLine().split(" ");
    		n = Integer.parseInt(s[0]);
            x = Integer.parseInt(s[1]);
            if(n == 0 && x == 0) 
            	break;
            int count = 0;
            for(int i=Math.max(x-n-(n-1),1); i<=Math.min(n-2,x/3-1); i++)
            	for (int j=Math.max(x-i-n,i+1); j<=Math.min(n-1,(x-i)/2); j++) {
            		int k = x - i - j;
            		if (j<k && k<=n) count++;
        		}
            out.println(count);
    	}
        out.flush();
    }
 
    public static void main(String[] args) throws IOException {
    	new Main().exec();
    }
}

Measured memory_bytes: 24372
package main

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

func main() {
	var ans, h int
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	k, _ := strconv.Atoi(sc.Text())
	for i := 0; i < n; i++ {
		sc.Scan()
		h, _ = strconv.Atoi(sc.Text())
		if h >= k {
			ans++
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 896
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val h = readLine()!!.split(' ').map { it.toInt() }

    var used = k
    var att = 0L
    h.sortedDescending().forEach {
        if (used > 0) used--
        else att += it
    }

    println(att)
}


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

using namespace std;

int main()
{
    long long X,K,D,ans,num;
    cin>>X>>K>>D;
    if(abs(X)==D)
    {
        if(K%2==0) ans=abs(X);
        else ans=0;
    }
    else 
    {
        num=abs(X/D);
        if(num<=K)
        {
            X=abs(X)-num*D;
            K=K-num;
            if(K%2==0)
            {
                ans=abs(X);
            }
            else
            {
                ans=abs(X-D);
            }
        }
        else
        {
            ans=abs(X)-K*D;

        }
    }   

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
N,M=map(int,input().split())
P_list=[int(p) for p in input().split()]
Tree=[i for i in range(N)]
def find(x):
  if x==Tree[x]:
    return x
  else:
    root=find(Tree[x])
    Tree[x]=root
    return root
def unite(x,y):
  s1=find(x)
  s2=find(y)
  if s1==s2:
    pass
  else:
    Tree[s1]=s2
for m in range(M):
  x,y=map(int,input().split())
  unite(x-1,y-1)
ans=0
for i in range(N):
  if find(P_list[i]-1)==find(i):
    ans+=1
print(ans)
    

Measured memory_bytes: 13940
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

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

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  vector<ll> a(3); rep(i, 3) cin >> a[i]; sort(a);

  if (a[0] == a[1] && a[1] == a[2]) outl(0);
  else if (a[0] == a[1]) outl(a[2] - a[1]);
  else if (a[1] == a[2]) {
    if ((a[1] - a[0]) % 2 == 0) outl((a[1] - a[0]) / 2);
    else outl(ceil(a[1] - a[0], 2) + 1);
  } else {
    ll ans = a[2] - a[1];
    a[1] = a[2];
    a[0] += ans;

    if ((a[1] - a[0]) % 2 == 0) outl(ans + (a[1] - a[0]) / 2);
    else outl(ans + ceil(a[1] - a[0], 2) + 1);
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>

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

using namespace std;

const int INF=1<<30;

int n,w,a[1000];

int sum[1001];

int dp[1000][1000];
int dfs(int i,int j){
	int s=sum[j]-sum[i];

	if(j==n) return max(s-w,0);

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

	int res=INF;
	// 改行
	if(i<j){
		res=min(res,dfs(j,j)+abs(s-w));
	}
	// 今の行に追加
	res=min(res,dfs(i,j+1));
	return dp[i][j]=res;
}

int main(){
	for(int cas=1;scanf("%d%d",&n,&w),n||w;cas++){
		rep(i,n) scanf("%d",a+i);
		rep(i,n) sum[i+1]=sum[i]+a[i];

		memset(dp,-1,sizeof dp);
		printf("Case %d: %d\n",cas,dfs(0,0));
	}

	return 0;
}

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

// Main Function
int main()
{
    int x,a,b,d1,d2,d;
    cin>>x>>a>>b;
    d1=x-a;
    if(d1<0) d1=d1*(-1);
    d2=x-b;
    if(d2<0) d2=d2*(-1);

    d=min(d1,d2);
    if(d==d1) printf("A\n");
    else printf("B\n");
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        int N = reader.nextInt();
        int[] B = new int[N-1];
        for (int i=0; i<N-1; i++) {
            B[i] = reader.nextInt();
        }
        int ans = 0;
        for (int i=0; i<N; i++) {
            if (i == 0) {
                ans += B[0];
            } else if (i == N-1) {
                ans += B[N-2];
            } else {
                ans += Math.min(B[i-1], B[i]);
            }
        }
        System.out.println(ans);
    }
    
    public static void solver() {
        // write logic
    }
    
    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var h = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();

            var result = 0;
            var sum = 0;
            for (int i = 0; i < n - 1; i++)
            {
                if (h[i] >= h[i + 1])
                {
                    sum++;
                    result = Math.Max(result, sum);
                }
                else
                {
                    sum = 0;
                }
            }
            Console.WriteLine(result);
        }
    }
}


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

int W,H,N,x,y,a,XL,XR,YL,YR;

int main(){
	cin>>W>>H>>N;
	XR=W;
	YR=H;
	for(int i=0;i!=N;++i){
		cin>>x>>y>>a;
		if(a==2)
			XR=min(XR,x);
		if(a==1)
			XL=max(XL,x);
		if(a==4)
			YR=min(YR,y);
		if(a==3)
			YL=max(YL,y);
	}
	
	if(YL>YR||XL>XR){
		cout<<0<<endl;
	}
	else{
		cout<<(XR-XL)*(YR-YL)<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

//GCD(最大公約数)
ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}

int main() {
    int n;
    cin >> n;
    ll ans = 0;
    rep(i, n) {
        ll x;
        cin >> x;
        ans = gcd(ans, x);
    }

    cout << ans << endl;
    
    return 0;
}


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

using namespace std;

int main(void) {
  
  long long A, V;
  cin >> A >> V;
  long long B, W;
  cin >> B >> W;
  long long T;
  cin >> T;

  bool caught = false;

  while(T > 0) {
    if (A < B) {
      A += V;
      B += W;
      if (A >= B) {
        caught = true;
        break;
      }
    } else if (A > B) {
      A -= V;
      B -= W;
      if (A <= B) {
        caught = true;
        break;
      }
    } else {
      caught = true;
      break;
    }
    T--;
  }
  if (caught) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

}


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

int main() {
    int x, y;
    cin >> x >> y;
    for (int i = 0; i < x+1; i++) {
        for (int ii = x; ii > -1; ii--){
            if (i+ii == x && i*2+ii*4 == y){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define MIN -10000000
#define MAX 10000000

int main()
{
  int n,k,c;cin>>n>>k>>c;
  string s;cin>>s;
  vector<bool> can(n);
  int i;
  rep(i,s.size())
  {
    if(s[i]=='o')can[i]=true;
    else can[i]=false;
  }
  //front,back
  vector<int> dp1(k+1,0);
  dp1[0]=MIN;
  int now=0;
  rep(i,n)
  {
    if(!can[i])continue;
    else if(now<k&&dp1[now]<i-c)
    {
      dp1[now+1]=i;
      now++;
    }
  }
  vector<int> dp2(k+1,n);
  dp2[k]=MAX;
  now=k;
  for(i=n-1;i>=0;i--)
  {
    if(!can[i])continue;
    else if(now>0&&dp2[now]>i+c)
    {
      dp2[now-1]=i;
      now--;
    }
  }
  rep(i,k)
  {
    if(dp1[i+1]==dp2[i])
    {
      cout<<dp2[i]+1<<endl;
    }
  }
}


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

int main()
{
    int n, x;
    while (cin >> n >> x) {
        if (n == 0 && x == 0)
            return 0;
        int cnt = 0;
        for (int i = 1; i <= n; ++i) {
            for (int j = i + 1; j <= n; ++j) {
                int k = x - i - j;
                if (j < k && k <= n)
                    ++cnt;
            }
        }
        cout << cnt << endl;
    }
}


Measured memory_bytes: 3080
#include <iostream>                                                                                      
using namespace std;                                                                                     
int main(){                                                                                              
  int w,h,x,y,r;                                                                                         
  cin >>w>>h>>x>>y>>r;                                                                                   
  if ((x-r<0) or (x+r>w) or (y-r<0) or (y+r>h))                                                          
    cout << "No" << endl;                                                                                
  else                                                                                                   
    cout << "Yes" << endl;                                                                               
}                                                                                                        
                                                                                                         
                         


Measured memory_bytes: 3096
#include <iostream>
#include <cstring>

using namespace std;

#define rep1(i,x) for(int i=1;i<=(x);++i)

#define MAX_N 100000

int a[MAX_N + 1];
int memo[MAX_N + 1];
int start[MAX_N + 1];

int main()
{
    int N, K;
    while (cin >> N >> K, N || K) {
        memset(a, 0, sizeof(a));
        memset(memo, 0, sizeof(memo));
        memset(start, 0, sizeof(start));

        bool f = false;

        rep1(i, K) {
            int tmp; cin >> tmp;
            if (tmp == 0) f = true;
            else a[tmp] = true;
        }

        rep1(i, N) {
            if (a[i]) {
                if (i - 1 >= 0 && a[i - 1]) {
                    start[i] = start[i - 1];
                    memo[start[i]]++;
                } else {
                    start[i] = i;
                    memo[start[i]]++;
                }
            }
        }

        int ma = 0;
        int now = -1;

        rep1(i, N) {
            if (a[i]) {
                if (now == start[i]) continue;
                if (ma < memo[start[i]]) {
                    ma = memo[start[i]];
                    now = start[i];
                }
            } else if (f) {
                int v;
                if (i + 1 <= N && a[i - 1] && a[i + 1]) {
                    v = memo[start[i - 1]] + memo[start[i + 1]] + 1;
                    if (ma < v) {
                        ma = v;
                        now = start[i + 1];
                    }
                } else if (a[i - 1]) {
                    v = memo[start[i - 1]] + 1;
                    if (ma < v) {
                        ma = v;
                        now = start[i - 1];
                    }
                } else if (i + 1 <= N && a[i + 1]) {
                    v = memo[start[i + 1]] + 1;
                    if (ma < v) {
                        ma = v;
                        now = start[i + 1];
                    }
                }
            }
        }

        cout << ma << endl;
    }
}

Measured memory_bytes: 2340
def blackjack(A1: int, A2: int, A3: int)->bool:
    return A1+A2+A3 < 22


if __name__ == "__main__":
    A1, A2, A3 = map(int, input().split())
    ans = blackjack(A1, A2, A3)
    print('win' if ans else 'bust')


Measured memory_bytes: 2940
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int N;
    cin >> N;
    vector<int> b(N-1);
    rep(i, N - 1) cin >> b[i];
    int sum = 0;
    rep(i, N) {
        if (i == 0) {
            sum += b[i];
            continue;
        }
        if (i == N - 1) {
            sum += b[N - 2];
            break;
        }
        sum += min(b[i],b[i - 1]);
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)    for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define rrep(i, n)   for(int i=(n-1); i>=0; --i)
#define all(v)       v.begin(), v.end()
#define rall(v)      v.rbegin(), v.rend()
#define int          long long
template<typename T>
using vv  = vector<vector<T>>;
using vi  = vector<int>;
using vvi = vector<vector<int>>;
using P   = pair<int, int>;
using ll  = long long;
constexpr ll INF = 1LL << 60;

signed main(){

    int n;
    cin >> n;
    map<string, int> ms;
    rep(i, n){
        string s;
        cin >> s;
        ms[s]++;
    }

    cout << "AC x " << ms["AC"] << endl;
    cout << "WA x " << ms["WA"] << endl;
    cout << "TLE x " << ms["TLE"] << endl;
    cout << "RE x " << ms["RE"] << endl;    

    return 0;
}



Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>

long long N;
const long long MAX_N = 100000000;
long long a[MAX_N];

using namespace std;

void solve() {
	sort(a, a+3*N);
	reverse(a, a+3*N);
	long long ans = 0;
	for (int i = 1; i <= N; i++) {
		ans += a[i * 2 -1];
	}
	cout << ans << endl;
}

int main()
{
	//入力
	cin >> N;
	for (int i = 0; i < 3*N; i++) {
		cin >> a[i];
	}
	solve();
    return 0;
}


Measured memory_bytes: 4352
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
using namespace std;

int main(){
	int g,k;
	cin >> g >> k;
	
	int g_cost;
	if(g<=1){
		g_cost=0;
	}else{
		g_cost=(g*(g-1))/2;
	}
	
	int k_cost;
	if(k<=1){
		k_cost=0;
	}else{
		k_cost=(k*(k-1))/2;
	}
	
	int ans=g_cost+k_cost;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(void){
    string s;
    cin>>s;
    for(int i=(s.length()-1)/2;i>-1;i--){
        if(s.substr(0,i)==s.substr(i,i)){
            cout<<i*2<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        TreeSet<Long> nums = new TreeSet<>();
        for (long i = 2; i <= Math.sqrt(n); i++) {
            if (n % i == 0) {
                nums.add(-i);
                nums.add(-n / i);
            }
        }
        int max = nums.size() + 1;
        int min = 0;
        HashSet<Long> used = new HashSet<>();
        for (long x : nums) {
            if (used.contains(-x)) {
                continue;
            }
            min++;
            for (long i = 2; i <= Math.sqrt(-x); i++) {
                if (-x % i == 0) {
                    used.add(i);
                    used.add(-x / i);
                }
            }
        }
        if (min == 0) {
            min++;
        }
        System.out.println(min + " " + max);
    }
}


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

a_list = list(map(int, input().split()))
dp_list = [0]*n
dp_list[0] = 1000
for i in range(1,n):
    dp_list[i] = dp_list[i-1]
    for j in range(i):
        v = int(dp_list[j]/a_list[j])
        w = dp_list[j] + (a_list[i] - a_list[j]) * v
        dp_list[i] = max(dp_list[i],w)

print(dp_list[n-1])

Measured memory_bytes: 9200
from collections import defaultdict
N,M,K=map(int,input().split())
MOD=998244353

def comb(a, b):
    if b > a - b:
        return comb(a, a - b)
    return fact[a] * ifact[b] * ifact[a-b]
  
# 階乗を前処理
fact = defaultdict(int)
fact[0] = 1
for i in range(1, N+1):
    fact[i] = fact[i-1] * i
    fact[i] %= MOD
# 階乗の逆元を前処理
ifact = defaultdict(int)
ifact[N] = pow(fact[N], MOD-2, MOD)
for i in reversed(range(1, N + 1)):
    ifact[i-1] = ifact[i] * i
    ifact[i-1] %= MOD
  
ans=0
col=M

for x in range(N-1,-1,-1):
  now=col*comb(N-1,x)%MOD
  if x<=K:
    ans = (ans+now)%MOD
  col =col*(M-1)%MOD

print(ans%MOD)
  


Measured memory_bytes: 65152
def judge(array):
    count = [[0 for i in range(8)] for i in range(8)]
    for i in range(8):
        x = 0
        for j in array[i]:
            if int(j) == 1:
                count[i][x] += 1
            x += 1

    a = 0
    p = []
    for i in range(8):
        for j in range(8):
            if count[i][j] != 0:
                p.append(a)
            a += 1

    if p[0]+1 != p[1]:
        if p[0] + 8*3 == p[3]:
            print('B')
        else:
            if p[0] + 8*2 + 1 == p[3]:
                print('F')
            else:
                print('D')
    else:
        if p[0]+1 == p[1] and p[1]+1 == p[2]:
            print('C')
        else:
            if p[0] + 8 == p[2] and p[1] + 8 == p[3]:
                print('A')
            else:
                if p[0]+8 == p[3]:
                    print('G')
                else:
                    print('E')
                    
while True:
    try:
        array = []
        for i in range(8):
            array.append(input())
        judge(array)
        input()
    except:
        break

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W, K;
  cin >> H >> W >> K;
  int cnt = 1;
  vector<vector<int>> grid(H, vector<int>(W, 0));
  for (int i = 0; i < H; i++) {
    string S;
    cin >> S;
    for (int j = 0; j < W; j++) {
      if (S[j] == '#') {
        grid[i][j] = cnt++;
      }
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 1; j < W; j++) {
      if (grid[i][j] == 0) {
        grid[i][j] = grid[i][j - 1];
      }
    }
    for (int j = W - 2; j >= 0; j--) {
      if (grid[i][j] == 0) {
        grid[i][j] = grid[i][j + 1];
      }
    }
  }
  for (int j = 0; j < W; j++) {
    for (int i = 1; i < H; i++) {
      if (grid[i][j] == 0) {
        grid[i][j] = grid[i - 1][j];
      }
    }
    for (int i = H - 2; i >= 0; i--) {
      if (grid[i][j] == 0) {
        grid[i][j] = grid[i + 1][j];
      }
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cout << grid[i][j] << (j != W - 1 ? ' ' : '\n');
    }
  }
  return 0;
}


Measured memory_bytes: 1152
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main (string[] args)
        {
            string S = Console.ReadLine ();
            int N = S.Length;

            for (int i = 0; i < N; i++)
            {
                if (S[i] != S[(N - 1) - i]) break;
                if (i <= (N - 1) / 2 - 1)
                {
                    if (S[i] != S[(N - 1) / 2 - 1 - i]) break;
                }

                if (i == N - 1)
                {
                    Console.Write ("Yes");
                    return;
                }
            }
            Console.Write ("No");

        }
    }

    class MyLibrary
    {
        public static int GCD (int a, int b)
        {
            if (a % b == 0) return b;
            return GCD (b, a % b);
        }
    }
}

Measured memory_bytes: 25876
#include <iostream>
#include <vector>
#include <cstring>
#include <cmath>
using namespace std;

typedef pair<int, int> P;

int m,n;
int dp[1002][1002];
vector<P> v(200);

int rec(int h, int r)
{
    if(dp[h][r] >= 0) 
        return dp[h][r];
    
    int ret = 0;
    for(int i = 0; i < m + n; i++) {
        if(v[i].first < h && v[i].second < r) {
            ret = max(ret, rec(v[i].first, v[i].second) + 1);
        }
    }
    
    return dp[h][r] = ret;
}

int main()
{
    while(cin >> n && n) {
        v.clear();
        int h,r;
        for(int i = 0; i < n; i++) {
            cin >> h >> r;
            v.push_back(P(h, r));
        }

        cin >> m;
        for(int i = 0; i < m; i++) {
            cin >> h >> r;
            v.push_back(P(h, r));
        }
        
        memset(dp, -1, sizeof(dp));
        cout << rec(1001, 1001) << endl;
    }
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N, Q; cin >> N >> Q;
    string S; cin >> S;
    vi l(Q), r(Q); REP(i, Q) cin >> l[i] >> r[i];
    vi ac(N+2);
    REP(i, N)
    {
        if(S[i] == 'A' && S[i+1] == 'C') ac[i+2] = 1;
    }
    REP(i, N+1) ac[i+1] += ac[i];
    REP(i, Q)
    {
        cout << ac[r[i]] - ac[l[i]] << endl;
    }
} 
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 2256