akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.math.*;
import java.util.*;


public class Main {

	public static void main(String[] args) throws Exception {
		new Main().solve();
	}
	void solve() throws Exception {
		FastScanner in = new FastScanner(System.in);

		int N = in.nextInt();
		long[] a = new long[N * 3];
		for (int i = 0; i < N * 3; i++) {
			a[i] = in.nextLong();
		}
		Arrays.sort(a);
		long sum = 0;
		for (int i = 0; i < N; i++) {
			sum += a[3 * N - 2 - i * 2];
			//System.out.println(i + "," + N + "," + (N - 2 - i * 2));
		}
		System.out.println(sum);


	}

	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	class FastScanner {

		private InputStream _stream;
		private byte[] _buf = new byte[1024];
		private int _curChar;
		private int _numChars;
		private StringBuilder _sb = new StringBuilder();

		FastScanner(InputStream stream) {
			this._stream = stream;
		}

		public int read() {
			if (_numChars == -1) throw new InputMismatchException();
			if (_curChar >= _numChars) {
				_curChar = 0;
				try {
					_numChars = _stream.read(_buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (_numChars <= 0) return -1;
			}
			return _buf[_curChar++];
		}

		public String next() {
			int c = read();
			while (isWhitespace(c)) {
				c = read();
			}
			_sb.setLength(0);
			do {
				_sb.appendCodePoint(c);
				c = read();
			} while (!isWhitespace(c));
			return _sb.toString();
		}

		public int nextInt() {
			return (int) nextLong();
		}
		public long nextLong() {
			int c = read();
			while (isWhitespace(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9') throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isWhitespace(c));
			return res * sgn;
		}

		public boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//


Measured memory_bytes: 28752
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//以下回答
int main(){
    ll A,B,C,X;
    cin>>A>>B>>C>>X;
    ll ans=0;
    rep(i,A+1){
        rep(j,B+1){
            rep(k,C+1){
                if(i*500+j*100+k*50==X){
                    ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.io.PrintWriter
import kotlin.math.PI
import kotlin.math.atan

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (a, b, x) = nextDoubleList()
    val ans = if (a * a * b > x * 2) {
        atan(a * b * b / (2 * x))
    } else {
        atan(2 * b / a - 2 * x / (a * a * a))
    } * 180 / PI
    println(ans)
}

Measured memory_bytes: 36416
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define maxn 110 
#define ll long long
using namespace std;
int tot,n,d[maxn],la[maxn],son[maxn];
struct edge{int v,ne;}e[maxn<<1];
struct node{int x;ll y;}ans;
inline bool operator <(node a,node b){return a.x<b.x||a.x==b.x&&a.y<b.y;}
void add(int u,int v){
	e[tot].v=v,e[tot].ne=la[u],la[u]=tot++;
}
vector<int>nd[maxn];
void init(){
	tot=0;ans=(node){(int)1e9,(ll)1e18};
	memset(la,-1,sizeof(la));
	scanf("%d",&n);
	for(int i=1;i<n;++i){
		int u,v;scanf("%d%d",&u,&v);
		add(u,v),add(v,u);
	}
}
inline void dfs(int u,int fa){
	son[u]=0;
	for(int i=la[u];~i;i=e[i].ne){
		int v=e[i].v;if(v==fa)continue;
		d[v]=d[u]+1;dfs(v,u);++son[u];
	}
}
inline node solve(int x,int y){
	d[x]=d[y]=1;dfs(x,y),dfs(y,x);
	int ans1=0;ll ans2,s=1;
	for(int i=1;i<=n;++i)nd[i].clear();
	for(int i=1;i<=n;++i){
		ans1=max(ans1,d[i]);
		nd[d[i]].push_back(i);
	}
	ans2=nd[ans1].size();
	for(int i=ans1-1;i;--i){
		int mx=0;
		for(int j=0;j<nd[i].size();++j)mx=max(mx,son[nd[i][j]]);
		for(int j=0;j<nd[i].size();++j)ans2+=(mx-son[nd[i][j]])*s;
		s=s*mx;
	}
	return (node){ans1,ans2};
}
void solve(){
	for(int u=1;u<=n;++u){
		ans=min(ans,solve(u,u));
		for(int i=la[u];~i;i=e[i].ne){
			int v=e[i].v;
			if(v>u)ans=min(ans,solve(u,v));
		}
	}
	printf("%d %lld\n",ans.x,ans.y);
}
int main(){
	init();
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define  all(v)            v.begin(), v.end()
#define  sz(x)             (int)x.size()
#define  debug(x)          cout << #x << ':' << x << endl;
#define  rep(i,n)          for(int i = 0; i <  n ; i++)
#define  reps(i,n)         for(int i = 1; i <= n ; i++)
#define  make_unique(v)    sort(all(v));v.erase(unique(all(v)), v.end());
#define  REMOVE(v,a)       v.erase(remove(v.begin(),v.end(), a), v.end());
#define  pb                push_back
#define  mp                make_pair
#define  endl              '\n'
#define  fi                first
#define  se                second
#define  ajs(a)            (a<0)?(-1*a):a

using namespace std;
typedef long long          ll;
typedef vector<long long>  vll;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;
const ll MOD = 1e9+7;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = { -1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = { -1, 0, 1, 1, 1, 0, -1, -1};
bool cmp(int X, int Y) {return X > Y;}

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll lcm(ll a, ll b) {return (a / gcd(a, b)) * b;}
ll modpow(ll a, ll b, ll m=MOD){a %= m; ll res = 1; while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){if(b<0){return 0;}ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}

const int N = 1e7+2;
vi adj[N];
ll dv[N];


int main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n;cin>>n;
for(ll i = 1 ; i<=n ; i++){
	for(ll j = i ; j<=n ; j+=i){
		dv[j]++;
		}
	}
ll sum = 0;
for(ll i = 1 ; i<=n ; i++){
	sum+=(i*dv[i]);
	}
cout<<sum;

}


Measured memory_bytes: 316044
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


class UnionFindWeighted:
    # Reference: https://note.nkmk.me/python-union-find/
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        self.weight = [0] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            root = self.find(self.parents[x])
            self.weight[x] += self.weight[self.parents[x]]
            self.parents[x] = root
            return root

    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)

        if rx == ry:
            return

        if self.parents[rx] > self.parents[ry]:
            x, y, rx, ry, w = y, x, ry, rx, -w

        self.parents[rx] += self.parents[ry]
        self.parents[ry] = rx
        self.weight[ry] = self.weight[x] - self.weight[y] - w

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def diff(self, x, y):
        return self.weight[x] - self.weight[y]


def main():
    N, M, *LRD = map(int, read().split())

    uf = UnionFindWeighted(N)
    for l, r, d in zip(*[iter(LRD)] * 3):
        l -= 1
        r -= 1
        if uf.same(l, r) and uf.diff(l, r) != d:
            print('No')
            return
        else:
            uf.union(l, r, d)

    print('Yes')
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 148728
#include <stdio.h>
#include <iostream>


int main (){
	int n;
	scanf("%d",&n);
	if(n<1200){
		printf("ABC");
		return 0;
	}
	if(n<2800){
		printf("ARC");
		return 0;
	}
	printf("AGC");
	return 0;
}

Measured memory_bytes: 256
def main():
    N,K = map(int, input().split())
    A = list(map(int,input().split()))
    P=[0]*N
    for i in range(N):
        P[i]=(A[i]+1)/2
    max=0
    check=0
            
    #for j in range(K):
    #    check +=P[j]
    check = sum(P[0:K])
    max=check
    #print(check)
    for i in range(K,N):
        check = check+P[i]-P[i-K]
        #print(i)
        #print(check)
        if check > max:
            max=check
    print(max)
main()    

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

#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define MOD 1000000007

const int MAX_M = 100000;


int main(){
  ll x;
  //string s;
  cin >> x;
  //bool ok = false;
  
  //vector<ll> a(n);
  //queue<ll> q;
  //map<string,ll> d{};
  
  ll ans = 0;
  ll money = 100;
  while(money < x){
    money = money + money/100;
    //cout << money << endl;
    ans++;
  }
  
  cout << ans << endl;
}

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

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

  int sum = 1;
  int flag = 0;

  while (sum < b){
    sum--;
    sum += a;
    flag++;
  }

  cout << flag;
}


Measured memory_bytes: 3584
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int r, g, b;
  cin >> r >> g >> b;
  cout << ((g * 2 + b) % 4 == 0 ? "YES" : "NO") << endl;
}


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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

#define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline void chmax(T& a,T const& b){a=max(a,b);}
template<class T> inline void chmin(T& a,T const& b){a=min(a,b);}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60; 
const int MAX_N = 200005;

using sz = ll;

long long max_rectangle(const std::vector<sz> &h) {
  // ヒストグラム中の最大長方形
  int n = h.size();
  std::stack<sz> s;
  std::vector<sz> L(n), R(n);
  for (int i = 0; i < n; i++) {
    while (s.size() && h[s.top()] >= h[i]) s.pop();
    L[i] = s.size() ? (s.top() + 1) : 0;
    s.push(i);
  }
  while (s.size()) s.pop();
  for (int i = n - 1; i >= 0; i--) {
    while (s.size() && h[s.top()] >= h[i]) s.pop();
    R[i] = s.size() ? s.top() : n;
    s.push(i);
  }
  long long res = 0;
  for (int i = 0; i < n; i++) {
    // caughtion + 1
    res = std::max(res, (long long)h[i] * (R[i] - L[i] + 1LL));
  }
  return res;
}

string s[2003];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h,w; cin >> h >> w;
  rep(i,h) cin >> s[i];
  vvi a(h,vi(w-1));
  rep(i,h) rep(j,w-1) a[i][j] = (s[i][j+1]=='#')^(s[i][j]=='#');
  vector<vector<sz>> hist(h,vector<sz>(w-1,1));
  REP(i,1,h) rep(j,w-1){
    if(a[i][j]==a[i-1][j]) hist[i][j] = hist[i-1][j] + 1;
  }
  ll ans = max(h,w);
  rep(i,h) chmax(ans,max_rectangle(hist[i]));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 51584
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

int main() {
	int N, M;
	cin >> N >> M;

	
	vector<int> a(N);
	if (0 < M) {
		for (int i = 0; i < M; i++) {
			cin >> a[i];
		}
	}

	vector<long long> c(N+1);
	c[0] = 1;
	int now = 0;
	if (a[0] == 1) {
		c[1] = 0;
		now++;
	}
	else {
		c[1] = 1;
	}
	if (N == 1) {
		cout << 1 << endl;
		return 0;
	}

	for (int i = 2; i <= N; i++) {
		if (a[now] == i) {
			c[i] = 0;
			now++;
		}
		else {
			c[i] = c[i - 1] + c[i - 2];
			c[i] = c[i] % 1000000007;
		}
		
	}

	cout << c[N] << endl;

	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9 + 7, A = 1e5 + 2;
int n, k;
vector<int> v[A];
int add(int x, int y) {
    return ((x + y) % mod + mod) % mod;
}
int mul(int x, int y) {
    return (1LL * x * y) % mod;
}
int DFS(int node, int par) {
    int ret = 1, avail = add(k, -add(1, (par != node)));
    for (auto to : v[node]) {
        if (to == par) continue;
        ret = mul(ret, mul(avail--, DFS(to, node)));
    }
    return ret;
}
int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin >> n >> k;
    for (int i = 1; i < n; i++) {
        int x, y;
        cin >> x >> y;
        v[x].pb(y), v[y].pb(x);
    }
    cout << mul(DFS(1, 1), k);
    return 0;
}


Measured memory_bytes: 11648
#include<bits/stdc++.h>
using namespace std;
const int MOD=1000000007;
int main(){
  string S;cin>>S;long N=S.length();
  vector<long>p(N+1);long x=1;for(long i=0;i<N;i++){p[i]=x;x=x*3%MOD;}
  vector<long>Al(N),Bl(N),Cl(N),Dl(N),Ar(N),Br(N),Cr(N),Dr(N);
  for(long i=0;i<N;i++){
    Al[i]=(i>0?Al[i-1]:0);Bl[i]=(i>0?Bl[i-1]:0);
    Cl[i]=(i>0?Cl[i-1]:0);Dl[i]=(i>0?Dl[i-1]:0);
    if(S[i]=='A')Al[i]++;
    if(S[i]=='B')Bl[i]++;
    if(S[i]=='C')Cl[i]++;
    if(S[i]=='?')Dl[i]++;
  }
  for(long i=N-1;i>=0;i--){
    Ar[i]=(i<N-1?Ar[i+1]:0);Br[i]=(i<N-1?Br[i+1]:0);
    Cr[i]=(i<N-1?Cr[i+1]:0);Dr[i]=(i<N-1?Dr[i+1]:0);
    if(S[i]=='A')Ar[i]++;
    if(S[i]=='B')Br[i]++;
    if(S[i]=='C')Cr[i]++;
    if(S[i]=='?')Dr[i]++;
  }
  long ans=0;
  for(long i=0;i<N;i++){
    if(S[i]=='B'){
      ans=(ans+Al[i]*Cr[i]*p[Dl[i]+Dr[i]])%MOD;
      ans=(ans+Dl[i]*Cr[i]*p[Dl[i]-1+Dr[i]])%MOD;
      ans=(ans+Al[i]*Dr[i]*p[Dl[i]+Dr[i]-1])%MOD;
      ans=(ans+Dl[i]*Dr[i]*p[Dl[i]+Dr[i]-2])%MOD;     
    }
    if(S[i]=='?'){
      ans=(ans+Al[i]*Cr[i]*p[Dl[i]+Dr[i]-2])%MOD;
      ans=(ans+(Dl[i]-1)*Cr[i]*p[Dl[i]+Dr[i]-3])%MOD;
      ans=(ans+Al[i]*(Dr[i]-1)*p[Dl[i]+Dr[i]-3])%MOD;
      ans=(ans+(Dl[i]-1)*(Dr[i]-1)*p[Dl[i]+Dr[i]-4])%MOD;     
    }
  }
  cout<<ans;
}

Measured memory_bytes: 7552
import collections
dic = collections.defaultdict(int)
n = int(input())
a = [int(i) for i in input().split()]
q = int(input())
sm = 0
for i in range(n):
    dic[a[i]] += 1
    sm += a[i]
queries = []
for i in range(q):
    queries.append([int(j) for j in input().split()])

for i in range(q):
    b = queries[i][0]
    c = queries[i][1]
    sm += dic[b] * (c-b)
    dic[c] += dic[b]
    dic[b] = 0
    print(sm)


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

int main(){
  ll n; cin>>n;
  // map<string, int> {{"AC": 0}, {"WA": 0}, {"TLE": 0}, {"RE": 0}};
  map<string, int> bucket;
  bucket["AC"] = 0;
  bucket["WA"] = 0;
  bucket["TLE"] = 0;
  bucket["RE"] = 0;

  rep(i, n) {
    string res; cin>> res;
    bucket[res] ++;
  }

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

  string s;

}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;
using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline bool isprime(i32 n) { if (n < 2) return 0; for (i32 i = 2; i * i <= n; i++) if (n % i == 0) return 0; return 1; }
inline vi32 plist(i32 n) { vi32 f(n, 1); f[0] = f[1] = 0; repi(i, 2, n) for (int j = i * 2; j < n; j += i) f[j] = 0; return f; }
inline void ioinit() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); }
template<class T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<class T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<class T> inline bool amax(T &x, T y) { if (x >= y) return 0; x = y; return 1; }
template<class T> inline bool amin(T &x, T y) { if (x <= y) return 0; x = y; return 1; }
template<class T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<class T> vector<T> make_v(int n, T v) { return vector<T>(n, v); }
template<class... Ts> auto make_v(int n, Ts... ts) { return vector<decltype(make_v(ts...))>(n, make_v(ts...)); }

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

int main() {
  ioinit();
  int h, w;
  cin >> h >> w;
  vstr a(h);
  rep(i, h) cin >> a[i];
  using P = pair<int, int>;
  queue<P> q;
  auto board = make_v(h, w, (int) 1e9);
  rep(i, h) rep(j, w) if (a[i][j] == '#') {
    q.emplace(i, j);
    board[i][j] = 0;
  }
  while (!q.empty()) {
    int i, j;
    tie(i, j) = q.front(), q.pop();
    rep(k, 4) {
      int fx = i + dx[k], fy = j + dy[k];
      if (fx < 0 || fx >= h || fy < 0 || fy >= w) continue;
      if (board[fx][fy] <= board[i][j] + 1) continue;
      board[fx][fy] = board[i][j] + 1;
      q.emplace(fx, fy);
    }
  }
  int ans = 0;
  rep(i, h) rep(j, w) amax(ans, board[i][j]);
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 13456
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=(1ull<<63)-1,mod=1e18;
const int inf=(1ull<<31)-1;
string a,b;
int n;

int main()
{
	//freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(15);
	cin>>n>>a>>b;
	for (int i=0;i<n;i++)
		cout<<a[i]<<b[i];
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    ll n,k;
    cin >> n >> k;
    ll ans = n/k;
    ans = ans*ans*ans;
    if(k%2==0){
        ll hoge = 0;
        rep(i,n+1){
            if(i%k==k/2)hoge++;
        }
        ans += hoge*hoge*hoge;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import math
p = int(input())
counta = 0

def mygcd(a_,b_,c_):
    return math.gcd(math.gcd(a_, b_),c_)

for i in range(1,p+1):
    for j in range(1,p+1):
        for k in range(1,p+1):
            counta += mygcd(i,j,k)
print(counta)

Measured memory_bytes: 68236
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// How to use 「map」
/*
  - 宣言
    map<{key_type}, {value_type}> salary;
  - 要素の挿入
    salary["Alice"] = 1000;
  - 要素の取得 O(logn)
    salary.at("Alice");
  - 要素の削除
    salary.erase("Alice");
  - キー検索
    salary.find("Alice"); -> true
    salary.find("Bob");   -> false
  - イテレーション
    for(auto& [key, value] : salary) {...}
 */
// -------------------------------------


// How to use 「lower_bound」, 「upper_bound」
/*
  vector<int> a = {1, 2, 3, 4, 5};
  auto iter1 = lower_bound(all(a), 3);  <- 第二引数「以上」の最小イテレータが返る
  auto iter2 = upper_bound(all(a), 3);  <- 第二引数「より大きい」最小のイテレータが返る
 */
// -------------------------------------


// How to use 「struct sort」
/*
  struct Person {
    string name;
    int age;

    Person(string _name, int _age) {
      name = _name;
      age = _age;
    }

    bool operator<(const Person &another) const {
      return age < another.age;
    }
  };

  vector<Person> people;
  people.pb(Person("Alice", 20));
  people.pb(Person("Bob", 19));
  people.pb(Person("John", 40));
  people.pb(Person("Chris", 30));
  sort(all(people));
 */
 // -------------------------------------

// -------------------------------------------------------------------------------------



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

  int ans = 0;
  while (n > 0) {
    n /= k;
    ans++;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
n = int(input())
f = []
p = []
s = [0 for i in range(10)]
for i in range(n):
    f.append(list(int(i) for i in input().split()))
for i in range(n):
    p.append(list(int(i) for i in input().split()))

def count(x):
    cunt = 0
    for i in range(len(openlist)):
        if f[x][9-i] == openlist[len(openlist)-i-1]==1:
            cunt +=1
        #print('cunt = {}'.format(cunt))
    return cunt
max1 = -10000000000000
for i in range(1,1024):
    sum = 0
    open = format(i,'b')
    openlist = [int(j) for j in open]
    #print(openlist)
    for k in range(n):
        sum += p[k][count(k)]
    max1 = max(max1,sum)
print(max1)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define ALL(x)x.begin(),x.end()
int main() {
	long long X;
	scanf("%lld", &X);
	if (X & 1) puts("0");
	else {
		X /= 2;
		long long r = 0;
		for (long long k = 5; k <= X; k *= 5) r += X / k;
		printf("%lld\n", r);
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353,INF=1e18;



int main() {
    int N,M,X;
    cin>>N>>M>>X;
    vector<int> C(N);
    vector<vector<int>> A(N,vector<int>(M));
    rep(i,N){
        cin>>C.at(i);
        rep(j,M){
            cin>>A.at(i).at(j);
        }
    }
    int ans=1e9;
    for (int tmp = 0; tmp < (1 << 12); tmp++){
        bitset<12> s(tmp);
        int money=0;
        vector<int> rikai(M,0);
        rep(i,N){
            if(s.test(i)){
                money+=C.at(i);
                rep(j,M){
                    rikai.at(j)+=A.at(i).at(j);
                }
            }
        }
        bool ok=true;
        rep(i,M){
            if(rikai.at(i)<X){ok=false;}
        }
        if(ok){ans=min(ans,money);}
    }
    if(ans>=1e9){ans=-1;}
    cout<<ans<<endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int h1,m1,h2,m2,k;
int main(){
	scanf("%d%d%d%d%d",&h1,&m1,&h2,&m2,&k);
	int t=(h2-h1)*60+m2-m1;
	printf("%d\n",t-k);
}

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

typedef long long ll;
typedef pair<ll, ll> pll;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(make_pair(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
const int mod = 1000000007;

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

    ll cnt = 0, h;
    for(ll i = 0; i < n; i++) {
        cin >> h;
        if(h >= k) {
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3624
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
        }
        int res = 0;
        int next = 1;
        for(int i=0; i<n; i++) {
            if(a[i] == next) {
                next++;
            } else {
                res++;
            }
        }
        if(next == 1) {
            System.out.println(-1);
        } else {
            System.out.println(res);
        }
    }
}


Measured memory_bytes: 70424
n,m=map(int,input().split())
a=list(map(int,input().split()))
d=[]
for i in range(n):
    d.append(abs(m-a[i]))
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
ans=d[0]
for i in range(n):
    ans=gcd(ans,d[i])
print(ans)


Measured memory_bytes: 15020
#include<iostream>
#include<vector>

struct fast_input{
  #if local
    static constexpr int input_max = 1e2;
  #else
    static constexpr int input_max = 1e7;
  #endif
  char buf[input_max];
  char* in;
  fast_input(){fread(buf,1,input_max,stdin);in=buf;}
  constexpr inline bool isdigit(char* ptr)const noexcept{
    return '0' <= *ptr and *ptr <= '9';
  }
  constexpr inline uint32_t operator()(){
    while(!isdigit(in))in++;
    uint32_t num{};
    while(isdigit(in)){
      num *= 10;
      num += *in-'0';
      in++;
    }
    return num;
  }
}in;

#include<atcoder/dsu>
using atcoder::dsu;

int main(){

  int n{in()},q{in()};
  dsu uni(n);
  while(q--){
    int t{in()};
    if(t)printf("%d\n",(int)uni.same(in(),in()));
    else uni.merge(in(),in());
  }

}

Measured memory_bytes: 6228
n = int(input())
h = list(map(int, input().split()))
ans = 0
temp = 0
for i in range(1, n):
  if h[i] <= h[i - 1]:
    temp += 1
  else:
    if ans < temp:
      ans = temp
    temp = 0
if ans < temp:
  ans = temp
print(ans)

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

int main() {
  int N,k,a=1;
  cin >> N>>k;
  for(int i=0;i<N;i++){
    if (a<k){
      a*=2;
      continue;
    }
    else
      a+=k;
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
N = int(input())
a = [0] + list(map(int,input().split()))

inde = 0
absmax = 0
for i in range(1,N+1,1):
    if absmax <= abs(a[i]):
        inde = i
        absmax = abs(a[i])

ans = []
for i in range(1,N+1,1):
    ans.append([inde,i])

if a[inde]>0:
    for i in range(1,N,1):
        ans.append([i,i+1])
else:
    for i in range(N,1,-1):
        ans.append([i,i-1])

print(len(ans))
for i in range(len(ans)):
    print(ans[i][0],ans[i][1])



Measured memory_bytes: 62392
N, M = map(int, input().split())
A = [int(a) for a in input().split()]
X = []
for _ in range(M):
    b, c = map(int, input().split())
    X.append((b, c))

A = sorted(A)
X = sorted(X, key = lambda x: -x[1])

B = []
for x in X:
    B += [x[1]] * x[0]
    if len(B) >= N:
        break
B += [0] * (N-len(B))
print(sum([max(A[i], B[i]) for i in range(N)]))


Measured memory_bytes: 82456
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ld,ld>;
//--GLOBAL---------------------------------
const int MAXX=1010;
const int MAXY=1010;
bool map2d[MAXX][MAXY];
int depth[MAXX][MAXY];
int dx[4]={1,0,0,-1};
int dy[4]={0,1,-1,0};
ll H,W,K;
ll ans=INF;
void bfs(ll sx, ll sy) {
    deque<P> dq; //探索予定地 必要ならpairにしてどこから来たのか記録
    rep(i,MAXX) rep(j,MAXY) depth[i][j]=-1;
    dq.emplace_back(sx,sy); // 始点を探索予定地に
    depth[sx][sy]=0; // 始点の深さを0に
    while(!dq.empty()) {
        ll vx = dq.front().first;// vは行く元
        ll vy = dq.front().second;// vは行く元
        dq.pop_front();
        mini(ans,min({vx-0,H-1-vx,vy,W-1-vy}));
        if(depth[vx][vy]>=K) continue;
        rep(i,4){
            ll x=vx+dx[i]; ll y=vy+dy[i];
            if(x<0 or x>=MAXX or y<0 or y>=MAXY) continue;
            if(map2d[x][y]==0) continue;
            if(depth[x][y]!=-1) continue;
            depth[x][y]=depth[vx][vy]+1;
            dq.emplace_back(x,y);
        }
    }
}
//--MAIN-----------------------------------
void Main() {
    cin>>H>>W>>K;
    ll sx,sy;
    rep(i,H){
        rep(j,W){
            char c; cin>>c;
            if(c=='S') {sx=i;sy=j;}
            if(c!='#') map2d[i][j]=true;
        }
    }
    bfs(sx,sy);
    cout<< (ans+K-1)/K +1 <<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


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

int main() {

    string S,T;
    cin >> S >> T;
    
    if (S[0] != T[0] && S[1] != T[1] && S[2] != T[2]) {
        cout << 0 << endl;
    }
    
    if (S[0] == T[0] && S[1] != T[1] && S[2] != T[2]) {
        cout << 1 << endl;
    }
    
    if (S[0] != T[0] && S[1] == T[1] && S[2] != T[2]) {
        cout << 1 << endl;
    }
    
    if (S[0] != T[0] && S[1] != T[1] && S[2] == T[2]) {
        cout << 1 << endl;
    }
    
    if (S[0] == T[0] && S[1] == T[1] && S[2] != T[2]) {
        cout << 2 << endl;
    }
    
    if (S[0] == T[0] && S[1] != T[1] && S[2] == T[2]) {
        cout << 2 << endl;
    }
    
    if (S[0] != T[0] && S[1] == T[1] && S[2] == T[2]) {
        cout << 2 << endl;
    }
    
    if (S[0] == T[0] && S[1] == T[1] && S[2] == T[2]) {
        cout << 3 << endl;
    }
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    vector<vector<char>>c(h,vector<char>(w));
    rep(i,h){
        rep(j,w){
            if((i+1)<=b&&(j+1)<=a)c[i][j]='0';
            else if((i+1)>b&&(j+1)>a)c[i][j]='0';
            else c[i][j]='1';
        }
    }
    rep(i,h){
        rep(j,w){
            cout<<c[i][j];
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 2176
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define INF 1000000000000000000LL
vector<int>pat[5555];
bool flag[5555];
ll dat[5555];
vector<ll>dfs(int node)
{
	flag[node] = true;
	vector<ll>dp;
	dp.push_back(0);
	dp.push_back(0);
	ll pos = 1;
	for (int i = 0; i < pat[node].size(); i++)
	{
		int v = pat[node][i];
		if (flag[v])continue;
		vector<ll>z = dfs(v);
		vector<ll>ns;
		ns.resize(z.size() + dp.size() - 1);
		fill(ns.begin(), ns.end(), INF);
		ll miniadd = INF;
		for (int j = 1; j < dp.size(); j++)
		{
			for (int k = 1; k < z.size(); k++)
			{
				ns[j + k - 1] = min(ns[j + k - 1], dp[j] + z[k]);
				if (z[k] < 0)
				{
					ns[j + k] = min(ns[j + k], dp[j]);
					miniadd = min(miniadd, (ll)k);
				}
			}
			if (z[0] < 100000)ns[j + z[0]] = min(ns[j + z[0]], dp[j]);
		}
		pos = min(pos + z[0] - 1, pos + miniadd);
		dp = ns;
	}
	for (int i = 1; i < dp.size(); i++)dp[i] += dat[node];
	dp[0] = INF;
	if (dat[node] > 0)dp[0] = pos;
	//printf("%d:   %d\n", node + 1, pos);
	//for (int i = 0; i < dp.size(); i++)printf("%lld ", dp[i]); printf("\n");
	return dp;
}
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < num; i++)scanf("%lld", &dat[i]);
	for (int i = 0; i < num - 1; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		za--, zb--;
		pat[za].push_back(zb);
		pat[zb].push_back(za);
	}
	vector<ll>v = dfs(0);
	int mini = 10000000000;
	for (int i = 1; i < v.size(); i++)if (v[i] < 0)mini = min(mini, i);
	if (v[0] < mini)mini = v[0];
	printf("%d\n", mini - 1);
}

Measured memory_bytes: 1536
n = int(input())
h = list(map(int, input().split()))

step_max = 0
r_step = 0
for i in reversed(range(n-1)):
    if h[i] >= h[i+1]:
        r_step += 1
    else:
        r_step = 0

    if r_step > step_max:
        step_max = r_step

print(step_max)


Measured memory_bytes: 14252
#include <iostream>
#include <cstdlib>
#include <list>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
 
int main(void)
{
    string S;
    string T;
    cin >> S >> T;

    for (int i = 0; i < S.size(); ++i)
    {
        if (S[i] != T[i]) 
        {
            cout << "No"; return 0;
        }
    }

    cout << "Yes";
    return 0;
}


Measured memory_bytes: 3004
#include<cstdio>
const int MAXN = 3 * (1E5);
int a[MAXN + 5];
inline int min(int a, int b) {
	return a<b?a:b;
}
int main() {
	int N, A, B;
	scanf("%d%d%d", &N, &A, &B);
	if( A + B > N+1 || 1ll * A * B < 1ll * N ) {
		printf("%d\n", -1);
		return 0;
	}
	for(int i=1;;i++) {
		int lim = min(i*B, N);
		for(int j=lim;j>(i-1)*B;j--)
			a[lim - j + (i-1)*B + 1] = j;
		if( lim == N ) break;
	}
	if( B == N ) {
		for(int i=1;i<N;i++)
			printf("%d ", a[i]);
		printf("%d ", a[N]);
		return 0;
	}
	for(int i=(N-1)/B+1;i>=1;i--) {
		int lim = min(i*B, N);
		if( N-(i-1)*B + (i-1) >= A ) {
			int cnt = A - (N - lim + (i-1));
			for(int j=1;j<=(i-1)*B;j++)
				printf("%d ", a[j]);
			for(int j=(i-1)*B+1;j<=lim-cnt;j++)
				printf("%d ", a[j]);
			for(int j=lim;j>=lim-cnt+1;j--)
				printf("%d ", a[j]);
			for(int j=lim+1;j<=N;j++)
				printf("%d ", j);
			break;
		}
	}
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,a[N],b[N];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		b[i]=a[i];
	}
	if(n==1){printf("%d\n",a[1]);return 0;}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		if(b[i]!=a[n])printf("%d\n",a[n]);
		else printf("%d\n",a[n-1]);
	}
	return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll MOD=1e9+7;
const ll MOD2=1e9+9;
const ll N=2e5+5;
const ld pi=3.14159265359;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(a) (ll)a.size()

ll a;
string s;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);	
	cin>>a>>s;
	cout<<(a>=3200?s:"red");
	return 0;
}




Measured memory_bytes: 256
import math
N, D = list(map(int,input().split()))
x = []
count = 0
for i in range(N):
    x.append(list(map(int,input().split())))
#print(x)
for i in range(N):
    for j in range(i+1,N,1):
        s = 0
        for k in range(D):
            s += (x[j][k] - x[i][k])**2
        #print(s)
        if math.sqrt(s) == int(math.sqrt(s)):
            count += 1
print(count)

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

int main(){
    int N;cin >> N;
    vector<long long> vx(N),vy(N),vh(N);
    int si = -1;
    for(int i = 0; i < N;i++){
        cin >> vx[i] >> vy[i] >> vh[i];
        if(vh[i] > 0)si = i;
    }
    long long resx = -1, resy = -1, resh = -1;
    for(long long x = 0; x <= 100; ++x){
        for(long long y = 0; y <= 100; ++y){
            long long h = vh[si] + abs(x - vx[si]) + abs(y - vy[si]);
            bool ok = true;
            for(int i = 0; i < N;i++){
                if(vh[i] > 0 && h - vh[i] != abs(x - vx[i]) + abs(y - vy[i]))
                    ok = false;
                if(vh[i] == 0 && h > abs(x - vx[i]) + abs(y - vy[i]))
                    ok = false;
            }
            if(ok)resx = x,resy = y,resh = h;
        }
    }
    cout << resx << " " << resy << " " << resh << endl;
}


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

int main(){
    int a, b, c, n;

    cin >> a >> b >> c;
    n = 0;

    for (int i = a; i <= b; i++ ){
        if (c % i == 0) n = n + 1;
        else n = n;
    }

    cout << n << endl;
}


Measured memory_bytes: 3120
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())

    if n % 2 != 0:
        print(0)
        exit()

    L = n // 2
    res = 0
    while L:
        res += L // 5
        L //= 5
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9004
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int64_t n;
  cin >> n;
  int64_t ans=0;
  for(int i=1;i<n;i++){
    ans+=i;
  }
  cout << ans;
}

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

int main() {
  int k;
  cin >> k;
  int a, b;
  if(k%2==0) {
    a = k/2;
    b = k/2;
  } else {
    a = k/2;
    b = a+1;
  }
  
  cout << a*b << endl;
  
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define for0(n) for(i=0; i<(n); i++)
#define forn1 for(i=1; i<=n; i++)


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll _,i,j,n,a,b,e,k,u,t,x=1,m,y,q,f=1,c=0,d=0,l,p,z,o,r,g,bb;
//    string ss,s;
////    cin>>_;
//    while(_--)
//    {
//        c
//
//    }
    cin>>n;
    ll aa[n+1];
    memset(aa,0,sizeof(aa));
    for(i=0;i<n-1;i++)
    {
        cin>>x;
        aa[x]++;
    }
    forn1
        cout<<aa[i]<<endl;
}


Measured memory_bytes: 5228
import java.util.*

fun main(args: Array<String>) {
    val N = readLine()!!.toInt()

    val a = readLine()!!.split(" ").map{it.toInt()}

    var f = 0
    val s = TreeSet<Int>()

    for (b in a) {
        val c = b / 400

        if (c >= 8) {
            f++
        } else {
            s.add(c)
        }
    }

    println("${Math.max(s.size, 1)} ${s.size + f}")
}


Measured memory_bytes: 37872
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n);++i)
using namespace std;
using ll = long long; 
using P = pair<int,int>;
ll mod = 1000000007;
template <class _T> inline bool chmax (_T& a,_T b){if(a<b){a=b;return true;}return false;}
template <class _T> inline bool chmin (_T& a,_T b){if(a>b){a=b;return true;}return false;}
const int inf = 2147483647;
const long long INF = 1LL << 60;
const int MAX_N = 11000;
const int MAX_W = 10100;


int main(void){
    int n;cin >> n;
    ll ans = 0;
    for(int i=1;i<=n;i++){
        for(int j=1;i*j<=n;j++){
            if(i*j>=n) continue;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i,l,r) for(int i = (int)l;i<(int)r;i++)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline ll mod(ll n, ll m){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}


int32_t main(){
  fastio;
  string s;
  cin>>s;
  int n=s.size();
  for(int i=0;i<n;i++)cout<<'x';
    cout<<endl;
  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b;

  scanf("%d %d", &a, &b);

  if(a<b){
    printf("a < b\n");
  }else if(a==b){
    printf("a == b\n");
  }else if(a>b){
    printf("a > b\n");
  }
  return 0;
}

Measured memory_bytes: 580
import bisect,collections,copy,heapq,itertools,math,string
import sys
def I():
    #1 line 1 int
     return int(sys.stdin.readline().rstrip())
def LI():
    #1 line n int
     return list(map(int,sys.stdin.readline().rstrip().split()))
def S():
    #1 line 1 string
     return sys.stdin.readline().rstrip()
def LS():
    #1 line n strings
     return list(sys.stdin.readline().rstrip().split())

a,b,=LI()

if (a*b)%2==0:
    print("Even")
else:
    print("Odd")

Measured memory_bytes: 9972
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;

int main() {
	int N;
	cin >> N;
	vector<int> input;
	vector<PII> data;
	vector<int> pos(N+1, 0);
	for(int i=0; i<N; i++) {
		int p;
		cin >> p;
		input.push_back(p);
		data.push_back(PII(p, i));
		pos[p] = i+1;
	}
	sort(data.begin(), data.end());
	
	vector<int> width(N+1, 0), left(N+1, 0), right(N+1, 0);
	pos[0] = 0;
	stack<PII> sta;
	sta.push(PII(0,0));
	input.push_back(0);
	for(int i=0; i<=N; i++) {
		int k = input[i];
		while(sta.top().first > k) {
			PII prev = sta.top();
			width[prev.first] = i - prev.second;
			left[prev.first] = pos[prev.first] - prev.second;
			right[prev.first] = i - pos[prev.first];
			sta.pop();
		}
		sta.push(PII(k, pos[sta.top().first]+1));
	}/*
	for(int i=0; i<=N; i++) {
		//cout << width[i] << endl;
		cout << left[i] << " " << right[i] << endl;
	}*/
	
	LL ans = 0;
	for(int i=1; i<=N; i++) {
		ans += (LL)i * ((LL)left[i]+1) * ((LL) right[i]+1);
		
	}
	cout << ans << endl;
	
	
	return 0;
}



Measured memory_bytes: 10604
import java.util.Scanner;

public class Main {
	private static Scanner sc;
	
	public static void main(String[] args) {
		sc =  new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
//		String s = sc.next();

		//input
		if(30<=n) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
	}
}


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

using namespace std;
#define INF 1000000001

int main()
{
    int N;
    int A;
    set<int> int_set;
    cin >> N;
    for(int i = 0; i < N;i++){
        cin >> A;
        auto itr_A = int_set.find(A);
        if(itr_A != int_set.end()) {
            cout << "NO" << "\n";
            break;
        }
        if(i== N-1){
            cout << "YES" << "\n";
        }
        int_set.insert(A);
    }
}



Measured memory_bytes: 9600
package main

import "fmt"

func main() {
	var A, B, C, X, cnt int
	fmt.Scan(&A, &B, &C, &X)

	for a := range make([]int, A+1) {
		for b := range make([]int, B+1) {
			for c := range make([]int, C+1) {
				if 500*a+100*b+50*c == X {
					cnt++
				}
			}
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 1664