akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <queue>
using namespace std;
int main(){
	int N, K; 
	cin >> N >> K; 
	vector<int> E[2010] = {}; 
	int A[2010] = {}; int B[2010] = {}; 
	for(int i = 0; i < N-1; i++){
		cin >> A[i] >> B[i]; 
		A[i] --; B[i] --; 
		E[A[i]].push_back(B[i]); 
		E[B[i]].push_back(A[i]); 
	}
	int D[2010] = {}; 
	int ans = 114514; 
	if(K % 2 == 0){
	for(int c = 0; c < N; c++){
		fill(D, D+2005, -1); 
		queue<int> que; 
		que.push(c); D[c] = 0; 
		while(que.size()){
			int p = que.front(); que.pop(); 
			for(int i = 0; i < E[p].size(); i++){
				if(D[E[p].at(i)] == -1){
					D[E[p].at(i)] = D[p] + 1; 
					que.push(E[p].at(i)); 
				}
			}
		}
		int ok = 0;
		for(int j = 0; j < N; j++){
			if(D[j] <= K/2) ok ++; 
		}
		ans = min(ans, N - ok); 
	}
	cout << ans << endl; 
	}
	if(K % 2 == 1){
	for(int c = 0; c < N-1; c++){
		fill(D, D+2005, -1); 
		queue<int> que; 
		que.push(A[c]); que.push(B[c]); 
		D[A[c]] = 0; D[B[c]] = 0; 
		while(que.size()){
			int p = que.front(); que.pop(); 
			for(int i = 0; i < E[p].size(); i++){
				if(D[E[p].at(i)] == -1){
					D[E[p].at(i)] = D[p] + 1; 
					que.push(E[p].at(i)); 
				}
			}
		}
		int ok = 0;
		for(int j = 0; j < N; j++){
			if(D[j] <= K/2) ok ++; 
		}
		ans = min(ans, N - ok); 
	}
	cout << ans << endl; 
	}	
}

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 1e18 * 4;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };


int main() {
	/*
	int n, i, j;
	cin >> n;
	vl a(n + 1);
	ll sum = 0;
	for (i = 1; i <= n; i++) {
		cin >> a[i];
		if (i >= n / 2 + 1) {
			a[i] = max(0LL, a[i]);
		}
		sum += a[i];
	}
	DEBUG_VEC(a);
	for (i = n / 2; i > 0; i--) {
		if (a[i] < 0) {
			ll get = 0;
			for (j = 1; i*j <= n; j++) {
				get -= a[i*j];
			}
			if (get >= 0) {
				for (j = 1; i*j <= n; j++) {
					a[i*j] = 0;
				}
				sum += get;
			}
		}
	}
	
	cout << sum << endl;
	*/

	ll n, z, w;
	cin >> n >> z >> w;
	vl a(n);
	int i, j;
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	if (n == 1) {
		cout << abs(w - a[0]) << endl;
		return 0;
	}
	if (n == 2) {
		cout << max(abs(a[0] - a[1]), abs(a[1] - w)) << endl;
		return 0;
	}
	vll dp(n, vl(2));
	dp[n - 2][0] = dp[n - 2][1] = abs(a[n - 2] - a[n - 1]);
	dp[n - 3][0] = min(dp[n - 2][1], abs(a[n - 3] - a[n - 1]));
	dp[n - 3][1] = max(dp[n - 2][0], abs(a[n - 3] - a[n - 1]));
	for (i = n - 4; i >= 0; i--) {
		dp[i][1] = max(dp[i + 1][0], max(dp[i + 1][1], abs(a[i] - a[n - 1])));
		dp[i][0] = min(dp[i + 1][0], min(dp[i + 1][1], abs(a[i] - a[n - 1])));
	}
	ll ans = abs(w - a[n - 1]);
	for (i = n - 2; i >= 0; i--) {
		ans = max(ans, dp[i][0]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 11000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;


int main(){
  bool flag=true;
  string s;
  cin>>s;
  for(int i=0;i<(int)s.size();i++){
    if(i%2==1){
      if(s[i]!='L' && s[i]!='U' && s[i]!='D') flag=false;
    }else{
      if(s[i]!='R' && s[i]!='U' && s[i]!='D') flag=false;
    }
  }

  if(flag) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
h, w, d = map(int, input().split())

coordinates = {}
for i in range(h):
    row = list(map(int, input().split()))
    for j in range(w):
        coordinates[row[j]] = (i, j)

costs = [0] * (h * w + 1)
for i in range(d + 1, h * w + 1):
    x1, y1 = coordinates[i]
    x2, y2 = coordinates[i - d]
    costs[i] = abs(x1 - x2) + abs(y1 - y2) + costs[i - d]

q = int(input())
for _ in range(q):
    l, r = map(int, input().split())
    print(costs[r] - costs[l])


Measured memory_bytes: 66540
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int a,b;
    cin>>a>>b;
    int ans=0;
    for(int i=1;i<=(b-a);i++){
        ans+=i;
    }
    cout<<ans-b<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


int K;


void solve(){
	int q = K/50;
	int r = K%50;
	cout << 50 << endl;
	rep(i, 0, 50){
		cout << 49+q-r+(i < r ? 51 : 0);
		if(i != 49) cout << ' ';
	}
	cout << endl;
}


signed main(){
	cin >> K;

	solve();

	return 0;
}

Measured memory_bytes: 256
n = input()
a = [raw_input() for i in range(n)]
j=0
for i in range(1,14):
  for j in range(n):
    if a[j] == 'S %s' % i:
      break
    elif j==n-1:
      print 'S %s' % i
for i in range(1,14):
  for j in range(n):
    if a[j] == 'H %s' % i:
      break
    elif j==n-1:
      print 'H %s' % i
for i in range(1,14):
  for j in range(n):
    if a[j] == 'C %s' % i:
      break
    elif j==n-1:
      print 'C %s' % i
for i in range(1,14):
  for j in range(n):
    if a[j] == 'D %s' % i:
      break
    elif j==n-1:
      print 'D %s' % i

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

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

	int a, b, x;
	cin >> a >> b >> x;
	int ans = 0;
	if(b * 2 <= a) {
		ans = (x + 499) / 500 * b;
	} else {
		ans = x / 1000 * a;
		if(x % 1000 > 500) {
			ans += a;
		} else if(x % 1000 > 0) {
			ans += min(a, b);
		}
	}
	cout << ans << endl;
	return 0;
}



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

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
int n , a[maxn];
int cnt[2];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    cin >> n;for(int i = 1 ; i <= n ; ++i){
        cin >> a[i];cnt[a[i] & 1]++;
    }
    if(cnt[1] % 2)puts("NO");
    else puts("YES");
}


Measured memory_bytes: 640
package main

import "fmt"

func main()  {
	var H, W, N int
	_, _ = fmt.Scan(&H, &W)
	_, _ = fmt.Scan(&N)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		_, _ = fmt.Scan(&A[i])
	}
	G := make([][]int, H)
	k := 0
	for i := 0; i < H; i++ {
		G[i] = make([]int, W)
		if i % 2 == 0 {
			for j := 0; j < W; j++ {
				if A[k] == 0 {
					k++
				}
				G[i][j] = k + 1
				A[k]--
			}
		} else {
			for j := W-1; j >= 0; j-- {
				if A[k] == 0 {
					k++
				}
				G[i][j] = k + 1
				A[k]--
			}
		}
	}
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if j == W-1 {
				fmt.Printf("%d\n", G[i][j])
			} else {
				fmt.Printf("%d ", G[i][j])
			}
		}
	}
}


Measured memory_bytes: 1280
/*
 * 2298.cc: Starting Line
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200;
const int MAX_L = 10000;

/* typedef */

/* global variables */

bool crts[MAX_L + 1];

/* subroutines */

/* main */

int main() {
  int n, k, t, u, v, l;
  cin >> n >> k >> t >> u >> v >> l;

  for (int i = 0; i < n; i++) {
    int cr;
    cin >> cr;
    crts[cr] = true;
  }

  int cn = 0;
  double vtl = (double)t * v;
  double ans = 0.0, r0 = 0.0, r1 = 0.0;

  for (int i = 1; i <= l; i++) {
    if (r0 < r1 && r1 <= i) {
      ans += (r1 - r0) / v;
      r0 = r1;
      if (cn > 0) {
	cn--;
	r1 = min(r1 + vtl, (double)l);
      }
    }

    if (crts[i]) {
      if (r0 == r1) {
	ans += ((double)i - r1) / u;
	r0 = i, r1 = min((double)i + vtl, (double)l);
      }
      else if (++cn > k) {
	cn--;
	ans += ((double)i - r0) / v;
	r0 = i, r1 = min((double)i + vtl, (double)l);
      }
    }
  }

  ans += (l - r1) / u;
  
  printf("%.9lf\n", ans);
  return 0;
}

Measured memory_bytes: 1200
A = []
for i in range(5):
    A.append(int(input()))

b = 0
d = 0
C = []
for i in range(5):
    if A[i]%10 != 0:
        C.append(10-(A[i]%10))
        if b < 10-(A[i]%10):
            b = 10-(A[i]%10)
            d = i

ans = sum(A)+sum(C)-b



print(ans)

Measured memory_bytes: 3064
use std::io::Read;
use std::collections::HashSet;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let k: usize = iterator.next().unwrap().parse().unwrap();
    let d: HashSet<char> =
        (0..k).map(|_| iterator.next().unwrap().chars().next().unwrap()).collect();

    let mut a = n;
    loop {
        if a.to_string().chars().all(|c| !d.contains(&c)) {
            return a.to_string();
        }
        a += 1;
    }
}


Measured memory_bytes: 2164
fn main() {
    proconio::input! {
    a:usize,
    b:usize,
    c:[String;a],
  }
    let d = (0..b+2).map(|_| '#').collect::<String>();
    println!("{}",d);
    for i in 0..a {
        println!("#{}#",c[i])
    }
    println!("{}",d)
}

Measured memory_bytes: 2200
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}

void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main(){
  string S;
  cin>>S;
  ll N=S.size();
  ll dp[100010][13];
  
  rep(i,N+10){
    rep(j,13){
      dp[i][j]=0;
    }
  }
  
  rep1(i,N){
    if(i==1){
      if(S[i-1]=='?'){
        rep(j,10){
          dp[i][j]++;
        }
      }
      else{
        int j=S[i-1]-'0';
        dp[i][j]++;
      }
    }
    else if(S[i-1]=='?'){
      rep(j,10){
        rep(k,13){
          int l=(k*10+j)%13;
          dp[i][l]+=dp[i-1][k];
          dp[i][l]%=mod;
        }
      }
    }
    else{
      int j=S[i-1]-'0';
      rep(k,13){
        int l=(k*10+j)%13;
        dp[i][l]+=dp[i-1][k];
        dp[i][l]%=mod;
      }
    }
  }
  
  ll ans=dp[N][5];
  cout<<ans<<endl;
}

          
  

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

int main() {
  int N;
  cin >> N;
  if((N/1000==N%1000/100 && N/1000==N%100/10) || (N%1000/100==N%100/10 && N%100/10==N%10))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  string s1, s2, s3; cin >> s1 >> s2 >> s3;
  cout << s1[0] << s2[1] << s3[2] << endl; 
  return 0;
}

Measured memory_bytes: 3072
#include <iostream>
using namespace std;
int main(void){
    int t[4], n[4];
    //tはチケットの種類(1はS席、2はA席、3はB席、4はC席)
    //nは売れたチケットの枚数

    for(int i = 0; i < 4; i++){
        cin >> t[i] >> n[i];
    }

    int sales; //売上
    for(int i = 0; i < 4; i++){
        if(t[i] == 1){
            sales = 6000 * n[i];
            cout << sales << endl;
        }
        else if(t[i] == 2){
            sales = 4000 * n[i];
            cout << sales << endl;
        }
        else if(t[i] == 3){
            sales = 3000 * n[i];
            cout << sales << endl;
        }
        else{
            sales = 2000 * n[i];
            cout << sales << endl;
        }
    }
}


Measured memory_bytes: 3096
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------


//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;cin>>n;
    string s=to_string(n);
    for(int i=0;i<2;i++){
        if(s[i]=='9'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>

int main(){
    int n;
    std::cin >> n;
    int sum = 0;
    int maxCost = 0;
    for(int i = 0; i < n; i++){
        int p;
        std::cin >> p;
        sum += p;
        maxCost = std::max(maxCost, p);
    }
    sum -= maxCost;
    sum += maxCost / 2;
    std::cout << sum << std::endl;
    return 0;
}


Measured memory_bytes: 256
/*
    BY - master_coder ( Tanu kumar )
    college - AIT
    Problem - contest ( div 3 )
*/
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define rep(i,a,n) for( int i = a ; i < n ; i++ )
#define prep( i, a , n ) for ( int i = a ; i>= n ; i--)
#define   pr pair<int,int>
const int N = 1e5 + 5 , M=N,inf=(int)1e9;
const int mod=1e9+7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
ll ans ;
map< pair<int,int> , int > mp;
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
vector < int > h[N];
void cnt( ll  n){
    int a , b , c ;
    a = b = c = 0 ;
    while( n != 0){
        if( n%10 == 3) a++;
        if( n%10 == 5) b++;
        if( n%10 == 7) c++;
        n /= 10 ;
    }
    if( a > 0 && b > 0 && c > 0 ) ans++;
}
int cal(ll n , ll x){
    if( n > x)
        return ans ;
    cnt(n);
    cal(n*10+3 , x );
    cal(n*pow(10,1)+5,x);
    cal(n*pow(10,1)+7,x);
}
void solve(){
    ll  n ;
    cin >> n ;
    cal(3,n);
    cal(5,n);
    cal(7,n);
    cout << ans ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
    //cin >> q;
    while(q--)
        solve();
}
/*
    ---------------- lemmas-----------------------------------
   1)
   2)
   3)

*/


Measured memory_bytes: 2560
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<complex>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
#define EPS (long double) 1e-8
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};

int main(void) {
	int n;
	cin>>n;
	set<string> s;
	REP(i, n) {
		string buf;
		cin>>buf;
		s.insert(buf);
	}
	int m;
	cin>>m;
	int d = 0;
	REP(i, m) {
		string buf;
		cin>>buf;
		if(s.count(buf) == 0) {
			cout<<"Unknown "<<buf<<endl;
		} else {
			if(d) cout<<"Closed by "<<buf<<endl;
			else cout<<"Opened by "<<buf<<endl;
			d = !d;
		}
	}
}

Measured memory_bytes: 3236
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
long long util(vector<int> heights,int n)
{
  long long dp[n];
  for(int i=0;i<n;i++)
  dp[i]=INT_MAX;
  dp[0]=0;
  dp[1]=abs(heights[0]-heights[1]);
  for(int i=2;i<n;i++)
  {
    dp[i]=min(dp[i-1]+abs(heights[i]-heights[i-1]),dp[i-2]+abs(heights[i]-heights[i-2]));
  }
  return dp[n-1];
}
int main()
{
  int n;
  cin>>n;
  vector<int> heights;
  for(int i=0;i<n;i++)
  {
    int temp;
    cin>>temp;
    heights.push_back(temp);
  }
  long long ans=util(heights,n);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1912
#define SUBMIT

#include <bits/stdc++.h>

using namespace std;

struct card {
    char suit;
    int value;
};

void print_array(const vector<card>& a) {
    for (int i = 0; i < a.size(); ++i) {
        if (0 < i) cout << " ";
        cout << a[i].suit << a[i].value;
    }
    cout << endl;
}

void bubble_sort(vector<card>& a) {
    for (int i = 0; i < a.size() - 1; ++i) {
        for (int j = a.size() - 1; j >= i; --j) {
            if (a[j].value < a[j - 1].value) swap(a[j], a[j - 1]);
        }
    }
}

void selection_sort(vector<card>& a) {
    for (int i = 0; i < a.size() - 1; ++i) {
        auto min_j = i;
        for (int j = i; j < a.size(); ++j) {
            if (a[j].value < a[min_j].value) min_j = j;
        }
        swap(a[i], a[min_j]);
    }
}

bool is_stable(const vector<card>& a, const vector<card>& b) {
    for (int i = 0; i < a.size(); ++i) {
        if (a[i].suit != b[i].suit) return false;
    }
    return true;
}

int main() {
#ifdef SUBMIT
    auto& in = cin;
#else
    stringstream in(R"(5
H4 C9 S4 D2 C3
)");
#endif
    int n;
    in >> n;
    vector<card> a, b;
    for (int i = 0; i < n; ++i) {
        char c;
        int x;
        in >> c >> x;
        a.push_back(card{.suit = c, .value = x});
        b.push_back(card{.suit = c, .value = x});
    }

    selection_sort(a);
    bubble_sort(b);
    bool stable = is_stable(a, b);

    print_array(b);
    cout << "Stable" << endl;
    print_array(a);
    cout << (stable ? "Stable" : "Not stable") << endl;
    return 0;
}


Measured memory_bytes: 3164
#include <iostream>
#include <stdio.h>
#include <string>

int main() {
    std::string moji;
    int a, b;
    
    while (1) {
        std::cin >> a >> b;
        moji = std::to_string(a+b);
        if (std::cin.eof()) break;
        std::cout << moji.size() << std::endl;
    }
    
    return 0;
}




Measured memory_bytes: 3252
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    INT(x); INT(y);
    int ans = 0;
    while(x <= y){
        ans++;
        x *= 2;
    }
    ANS;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace  std;
#define f(i,n) 		for(i=0;i<n;i++)
#define fr(i,n,a) 	for(i=n;i>=a;i--)
#define fa(i,a,n) 	for(i=a;i<n;i++)
#define deb(x)		cout<<#x<<" "<<x<<endl;
#define deb2(x,y)	cout<<#x<<","<<#y<<" "<<x<<","<<y<<endl;
#define buf(x)		cout<<"Check"<<x<<endl;
#define ll			long long int 
#define ft			first
#define s			second
#define pb			push_back
#define mp			make_pair
#define do			double
#define all(v)		v.begin(),v.end()	
#define et(v)		for(auto itr:v)
#define mod			1000000007
inline void p(vector<ll> x,int n)	{	int i;f(i,n)cout<<x[i]<<" ";cout<<endl; }
 
void dfs(ll root,vector<ll> adj[],vector<bool> &vis)
{
	vis[root]=true;
	ll s=adj[root].size();
	ll i;
	f(i,s)
	{
		if(!vis[adj[root][i]])
			dfs(adj[root][i],adj,vis);
	}
}
ll ans(ll N,vector<ll> adj[])
{
	ll i,cnt=0;
	vector<bool> vis(N+1,false);
	fa(i,1,N+1)
	{
		if(!vis[i])
		{
			//sdeb(i)
			dfs(i,adj,vis);
			++cnt;
		}
	}
	return cnt;
}
void solve()
{  	
	ll N,M,i,j,sum=1,pos,neg=0,z=0;
	ll x,y,k;
	cin>>N>>M;
	vector<ll> adj[N+1];

	f(i,M)
	{
		ll u,v;
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	cout<<ans(N,adj)-1;

}

	

int main()
{	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
	ll t=1,c=1;
	//cin>>t;
	while(t--)
	{
		
 
		//cout<<"Case #"<<c++<<": "<<endl;
		solve();
		cout<<"\n";
		
	}
	return 0;
}

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

int main(int argc, char **argv)
{
  double d;
  cout.precision(8);
  cout << fixed;
  while (cin>>d) {
    double acm = d;
    for (int i = 2; i <= 10; i++) {
      if (i%2) {
        d /= 3;
        acm += d;
      } else {
        d *= 2;
        acm += d;
      }
    }
    cout << acm << endl;
  }
  return 0;
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;

const int MOD = 1e9 + 7;
const int INF = INT_MAX / 10;

vector<ll> f(int N, int A, vector<ll_i> di, vector<ll> a) {
	priority_queue<ll, vector<ll>, greater<ll> > pq;
	vector<ll> b(N + 1);
	ll sum = 0;
	rep(t, N) {
		int i = di[t].second;
		sum += a[i]; pq.push(a[i]);
		if (pq.size() > A) { sum -= pq.top(); pq.pop(); }
		b[t + 1] = sum;
	}
	return b;
}

int main() {
	int A, B, C; cin >> A >> B >> C;
	int N = A + B + C;
	vector<ll> a(N), b(N), c(N);
	rep(i, N) scanf("%lld%lld%lld", &a[i], &b[i], &c[i]);
	ll ans = 0;
	rep(i, N) ans += c[i], a[i] -= c[i], b[i] -= c[i];
	vector<ll_i> di(N);
	rep(i, N) di[i] = ll_i(b[i] - a[i], i);
	sort(di.begin(), di.end());
	vector<ll> dp1 = f(N, A, di, a);
	reverse(di.begin(), di.end());
	vector<ll> dp2 = f(N, B, di, b);
	ll ma = LLONG_MIN;
	rep(i, N + 1) if (i >= A && N - i >= B) ma = max(ma, dp1[i] + dp2[N - i]);
	cout << ans + ma << endl;
}


Measured memory_bytes: 9812
n, k = map(int, input().split())
a = []
for i in range(n):
	a.append(int(input()))
a = sorted(a)
counter = a[k - 1] - a[0]
for i in range(n - k + 1):
	b = a[i + k - 1] - a[i]
	if counter > b:
		counter = b
print(counter)


Measured memory_bytes: 8280
# Code for B - Distance
# Use input() to fetch data from STDIN
import math

n, d = map(int, input().split())
ans: int = 0

for i in range(n):
    x, y = map(int, input().split())
    if d >= math.sqrt(x*x + y*y):
        ans = ans+ 1

print(ans)



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

long long bigmod(long long a,long long b)
{
    if(b==0)
    {
        return 1;
    }
    long long x=bigmod(a,b/2);
    x=(x*x);
    if(b%2==1)x=(x*a);

    return x;
}

int main()
{
    long long k;
    cin>>k;

    for(long long i=-1000;i<=1000;i++)
    {
        for(long long j=-1000;j<=1000;j++)
        {
            if(bigmod(i,5)-bigmod(j,5)==k)
            {
                cout<<i<<" "<<j<<endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt();
		int ans=0;
		if(a > b)ans += b;
		else ans += a;
		if(c > d)ans += d;
		else ans += c;
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
// ABC073_C
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)

typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N;
    cin >> N;
    vector<ll> vec(N), count(N);
    REP(i, N) cin >> vec[i];
    sort(vec.begin(), vec.end());
    
    unordered_map<ll, ll> mp;
    REP(i, N) {
        auto iter = mp.find(vec[i]);
        if (iter != mp.end()) {
            mp[vec[i]]++;
        } else {
            mp[vec[i]] = 1;
        }
    }
    
    auto begin = mp.begin(), end = mp.end();
    ll res = 0;
    for (auto itr = begin; itr != end; itr++) {
        if (itr->second%2 != 0) res++;
    }
    
    cout << res << "\n";
    
    return 0;
}


Measured memory_bytes: 5924
#include<stdio.h>
 
  #define H 500001
 
 
  int A[H];
  int n;
 
void BuildMaxHeap(void){
  int i;
  for(i = (n/2);i >=1;i--){
    Heapify(i);
  }
}
 
 int main(){
   
  int i;
 
  scanf("%d",&n);
  for(i = 1;i <= n;i++){
    scanf("%d",&A[i]);
  }
 
  BuildMaxHeap();
 
  for(i = 1;i <= n;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
 
  return 0;
}

void Heapify(int i){
  int Left = 2*i;
  int Right = 2*i+1;
  int Largest;
  int temp;
 
  if(Left <= n && A[Left] > A[i]){
    Largest = Left;
  }
  else{
    Largest = i;
  }
  if(Right <= n && A[Right] > A[Largest]){
    Largest = Right;
  }
  if(Largest != i){
    temp = A[i];
    A[i] = A[Largest];
    A[Largest] = temp;
    Heapify(Largest);
  }
}

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

int main(){
    int a,b;
    cin>>a>>b;
    
    if( a < b ) cout<<"a < b"<<endl;
    if( a == b ) cout<<"a == b"<<endl;
    if( a > b ) cout<<"a > b"<<endl;
    
}


Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    vector<int> v(3);
    int a, b, c, max, ans;
    cin >> v[0];
    cin >> v[1];
    cin >> v[2];

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

    cout << v[2] * 10 + v[1] + v[0] << '\n';
}

Measured memory_bytes: 256
N = int(input())
S = input()

count = 0
numberlist = [str(i) for i in range(10)]

for a in numberlist:
    idx1 = S.find(a)
    if idx1 == -1 or idx1 >= N - 2:
        continue
    
    for b in numberlist:
        idx2 = S[idx1+1:].find(b)
        if idx2 == -1 or idx2 >= N - 1:
            continue

        count += len(set(S[idx1+idx2+2:]))

print(count)

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

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define F(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define endl '\n'

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }





void solve() {
	int n;
	cin >> n;
	ll ans = 0, cnt = 0; 
	for (int i = 1; i <= n; ++i) {
		if ((i % 3) && (i % 5)) ans += i, ++cnt;
	}
	cout << ans << endl;
}





int main() {
	ios::sync_with_stdio(false);
	cout << fixed;

#ifdef LOCAL
	double cl = clock();
#endif

	int T = 1;
	while (T--) solve();

#ifdef LOCAL
  cerr << "Time elapsed: " << (clock() - cl) / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



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

bool is_squere(int n) {
    int r = (int)floor(sqrt((long double)n));  // 切り捨てした平方根
    return (r * r) == n;
}

int main() {
  int n,d;
  cin >> n >> d;
  vector<vector<int>> x(n, vector<int>(d));
  rep(i,0,n) rep(j,0,d) cin >> x[i][j];
  int ans = 0;
  rep(i,0,n-1) rep(j,i+1,n) {
    int dist = 0;
    rep(k,0,d) {
      dist += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
    }
    if (is_squere(dist)) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3676
#include <stdio.h>
int main(void)
{
	int x, y,h;
	
	while (1) {
		scanf("%d %d", &x, &y);
		if (x > y) {
			h = x;
			x = y;
			y = h;
		}
		if (x == 0 && y == 0)break;
		printf("%d %d\n", x, y);
	}
	return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  vector<string> str(a);
  for (int i = 0; i < a; i++) {
    cin >> str[i];
  }
  sort(str.begin(), str.end());
  for (int i = 0; i < a; i++) {
    cout << str[i];
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

const ll mod = 998244353;
string S;
ll dp[4010][4010];
pii ball[2010];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> S;
    int N = S.length();
    for(int i = 0; i < N; ++i){
        int num = '2' - S[i];
        ball[i].first += num;
        ball[i].second += 2 - num;
        ball[i + 1] = ball[i];
    }
    dp[0][0] = 1;
    for(int i = 0; i < 2 * N; ++i){
        for(int j = 0; j < 2 * N; ++j){
            int p = min(i + j, N - 1);
            if(ball[p].first > i){
                dp[i + 1][j] += dp[i][j];
                dp[i + 1][j] %= mod;
            }
            if(ball[p].second > j){
                dp[i][j + 1] += dp[i][j];
                dp[i][j + 1] %= mod;
            }
        }
    }
    cout << dp[ball[N - 1].first][ball[N - 1].second] << endl;
    return 0;
}

Measured memory_bytes: 125568
#include <unistd.h>
#define IN_MAX 65536
#define OUT_MAX 65536
#define D_MAX 10
#define V_MAX 200000
#define E_MAX 399998
char in_buf[IN_MAX];
char *in_ptr = in_buf, *in_end = in_buf + IN_MAX;
void read_stdin(void) {
	int k = read(0, (void *)in_buf, (size_t)IN_MAX);
	if(k < IN_MAX) {
		in_buf[k] = (char)'\x00';
	}
	in_ptr = in_buf;
	return;
}
int read_int_plus(void) {
	int n = 0;
	while((int)*in_ptr >= '0' && (int)*in_ptr <= '9') {
		n = n * 10 + (int)*in_ptr++ - '0';
		if(in_ptr == in_end) {
			read_stdin();
		}
	}
	if((int)*in_ptr == '\n' || (int)*in_ptr == ' ') {
		++in_ptr;
		if(in_ptr == in_end) {
			read_stdin();
		}
	}
	return n;
}
char out_buf[OUT_MAX];
char *out_ptr = out_buf, *out_end = out_buf + OUT_MAX;
void write_stdout(void) {
	write(1, (void *)out_buf, (size_t)(out_ptr - out_buf));
	out_ptr = out_buf;
	return;
}
void write_int_plus(int n, char c) {
	int s[D_MAX + 1];
	s[0] = 0;
	if(!n) {
		s[++s[0]] = 0;
	}
	while(n) {
		s[++s[0]] = n % 10;
		n /= 10;
	}
	while(s[0]) {
		*out_ptr++ = (char)(s[s[0]--] + '0');
		if(out_ptr == out_end) {
			write_stdout();
		}
	}
	*out_ptr++ = c;
	if(out_ptr == out_end) {
		write_stdout();
	}
	return;
}
void calc(int *score, int *first, int *next, int *dest, int start) {
	int s[V_MAX + 1];
	s[0] = 0;
	int p[V_MAX + 1];
	p[start] = 0;
	s[++s[0]] = start;
	while(s[0]) {
		int d = s[s[0]--];
		score[d] += score[p[d]];
		for(int i = first[d]; i; i = next[i]) {
			if(dest[i] != p[d]) {
				p[dest[i]] = d;
				s[++s[0]] = dest[i];
			}
		}
	}
	return;
}
int main(int argc, char **argv) {
	read_stdin();
	int n, q;
	n = read_int_plus();
	q = read_int_plus();
	int first[V_MAX + 1], next[E_MAX + 1];
	for(int i = 1; i <= n; ++i) {
		first[i] = 0;
	}
	int dest[E_MAX + 1];
	int m = 2 * (n - 1), k = 1;
	while(k <= m) {
		int a, b;
		a = read_int_plus();
		b = read_int_plus();
		next[k] = first[a];
		dest[first[a] = k++] = b;
		next[k] = first[b];
		dest[first[b] = k++] = a;
	}
	int score[V_MAX + 1];
	for(int i = 1; i <= n; ++i) {
		score[i] = 0;
	}
	while(q--) {
		int p, x;
		p = read_int_plus();
		x = read_int_plus();
		score[p] += x;
	}
	score[0] = 0;
	calc(score, first, next, dest, 1);
	for(int i = 1; i <= n; ++i) {
		write_int_plus(score[i], i == n ? '\n' : ' ');
	}
	write_stdout();
	return 0;
}

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

typedef long long ll;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }

const long long INF = 1LL << 60;

int main()
{
    ll N, set1, set2, ans = 0;
    cin >> N;
    set2 = N-1;
    repd(i, 2, N) {
        if (N / i == N % i) {
            ans += i;
        }
        set1 = (N / i) + 1;
        if (set1 <= i) break;
        ll mod = N % set2;
        if (mod == i-1) ans += set2;
        else if (mod == 0) ans += (set2-1);
        set2 = set1 - 1; 
    }
    /*

    repd(i, 2, N) {
        if (N / i > i - 1) continue;
        else {
            set = i;
            break;
        }
    }

    repd(i, set, N) {
        if (N / i == N % i) {
            ans += i;
        }
    }

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

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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	int a;
	string s;

	cin >> a;
	cin >> s;

	if (a >= 3200)
		cout << s << endl;
	else
		cout << "red" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
int A[100000];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  int ctr = 0;
  int cont = 0;
  rep(i, N) {
    cin >> A[i];
    A[i]--;
    if (A[i] == i) {
      cont++;
    }
    else {
      if (cont > 0) ctr += (cont+1)/2;
      cont = 0;
    }
  }
  if (cont > 0) ctr += (cont+1)/2;
  cout <<ctr << "\n";
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll uint64_t
#define vi vector <int>
#define vl vector <ll>
#define dl pair <ll, ll>
#define ii pair <ll, ll>
#define vii vector <ii>
#define graph vector <set <int> >
#define inf 1000000000
 
using namespace std;
 
int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
 
    string s;
    cin >> s;
    int n = s.size();
    int suma = 0;
    for (int i = 0; i < n; i++) {
        suma += (s[i] - '0');
    }
    if (suma % 9 == 0) cout <<"Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 3760
import sys
def main():
    n = int(input())
    print("0")
    sys.stdout.flush()
    x = input().rstrip()
    if x == "Vacant":
        sys.exit()
    print(n//2)
    sys.stdout.flush()
    y = input().rstrip()
    if y == "Vacant":
        sys.exit()
    l, r= 0, 0
    z = ""
    if x == y:
        if n//2%2 == 1:
            l = 0
            r = n//2
            z = x
        else:
            l = n//2
            r = n
            z = y
    else:
        if n//2%2 == 1:
            l = n//2
            r = n
            z = y
        else:
            l = 0
            r = n//2
            z = x
    while True:
        p = (l+r)//2
        print(p)
        sys.stdout.flush()
        w = input().rstrip()
        if w == "Vacant":
            sys.exit()
        if z == w:
            if l%2 == p%2:
                l = p
            else:
                r = p
        else:
            if l%2 == p%2:
                r = p
            else:
                l = p
                z = w

if __name__ == "__main__":
    main()


Measured memory_bytes: 3780
from itertools import product, permutations

def main():
    N, C = map(int, input().split())
    D = [list(map(int, input().split())) for _ in range(C)]
    c = [list(map(int, input().split())) for _ in range(N)]
    T = [[0] * C for _ in range(3)]
    for x, y in product(range(N), repeat=2):
        r = (x + y) % 3
        for i in range(C):
            T[r][i] += D[c[x][y] - 1][i]
    Q = []
    for j in range(3):
        Q.append(sorted((t, i) for i, t in enumerate(T[j])))
    m = 10**10
    for x, y, z in product(range(3), repeat=3):
        X, Y, Z = Q[0][x], Q[1][y], Q[2][z]
        if X[1] == Y[1] or Y[1] == Z[1] or Z[1] == X[1]:
            continue
        m = min(m, X[0] + Y[0] + Z[0])
    return m


print(main())


Measured memory_bytes: 5620
import java.util.Scanner;

public class Main {
	public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		int m1 = sc.nextInt();
		int d1 = sc.nextInt();
		int m2 = sc.nextInt();
		int d2 = sc.nextInt();
		if (m1!=m2){
			System.out.println(1);
		}else{
			System.out.println(0);
		}
	}

}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

ll val_sum(ll x){
    ll sum = 0;
    while(x){
        sum += x%10;
        x /= 10;
    }
    return sum;
}

int main(){
    ll a,n,m;
    int ct = 0;
    cin >> a >> n >> m;
    rep(y,1,73){
        ll x = pow(y+a,n);
        if(x <= m && val_sum(x) == y) ct++;
    }
    cout << ct << endl;
}


Measured memory_bytes: 3412
from collections import deque

n,m = map(int,input().split())
edge_li = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    edge_li[a-1].append(b-1)
    edge_li[b-1].append(a-1)

stack = deque([0])
visited = [False]*n
visited[0] = True

def dfs(visited,stack):
    tmp = 0
    while stack:
        x = stack.pop()
        if all(visited):
            return 1
        for e in edge_li[x]:
            if visited[e]:
                continue
            visited[e]=True
            stack.append(e)
            tmp+=dfs(visited,stack)

            visited[e]=False
    return tmp

print(dfs(visited,stack))

Measured memory_bytes: 3316
import collections

N = int(input())
A = list(map(int, input().split()))

count = collections.Counter()

for a in A:
    count[a] += 1
    
ans = 0

for num, c in count.items():
    if num < c:
        ans += c - num
    elif num > c:
        ans += c
    else:
        continue
        
print(ans)

Measured memory_bytes: 18664
#include<stdio.h>
int main(){
  int i[3],n,m,ans=1e9,s=0,a,b,d[50][50],c[510][510],e[5][50]={};
  scanf("%d %d",&n,&m);
  for(a=0;a<m;a++){
    for(b=0;b<m;b++)scanf("%d",&d[a][b]);
  }
  for(a=0;a<n;a++){
    for(b=0;b<n;b++)scanf("%d",&c[a][b]);
  }
  for(a=0;a<n;a++){
    for(b=0;b<n;b++)e[(a+b+2)%3][c[a][b]-1]++;
  }
  /*for(a=0;a<3;a++){
    for(b=0;b<m;b++)printf("%d ",e[a][b]);printf("\n");
    }//*/
  for(i[0]=0;i[0]<m;i[0]++){
    for(i[1]=0;i[1]<m;i[1]++){
      for(i[2]=0;i[2]<m;i[2]++){
	if(i[0]==i[1]||i[1]==i[2]||i[2]==i[0])continue;
	for(a=s=0;a<3;a++){
	  for(b=0;b<m;b++)s+=d[b][i[a]]*e[a][b];
	}
	/*for(a=s=0;a<n;a++){
	  for(b=0;b<n;b++)s+=d[c[a][b]-1][i[(a+b+2)%3]];
	  }//*/
	if(ans>s)ans=s;
      }
    }
  }
  printf("%d\n",ans);
  return 0;
}


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

int  main()
{
string a;
cin>>a;
int cnt=0,mxcnt=0;
for(unsigned int i=0;i<a.size();i++)
{
if(a[i]=='R')
cnt++;
else
{
mxcnt=max(mxcnt,cnt);
cnt=0;
}
}
mxcnt=max(mxcnt,cnt);
cout<<mxcnt;
return 0;
}

Measured memory_bytes: 3636
numbers = []
3.times { numbers << gets.split.map(&:to_i) }

def deduct_minimum(ary)
  ary.each_with_index do |row, index|
    min = row.min
    row.each_with_index do |num, index2|
      ary[index][index2] -= min
    end
  end
  ary
end

numbers = deduct_minimum(numbers)
numbers = deduct_minimum(numbers.transpose)

puts numbers.flatten.inject(:+) == 0 ? "Yes" : "No"


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long
#define ld long double
#define zeros(x) x^(x-1)&x
#define pii pair<ll,ll>
#define cd complex<double>
#define dbg(x) cerr<<#x<<": "<<x<<endl;ll
#define Nmax 400005
#define OFF 100001
using namespace std;

ll N, x,ans[Nmax];

int main()
{
    cin >> N >> x;
    if (x==1 || x == 2 * N - 1){
        cout << "No\n";
        return 0;
    }

    for (int i=N, j = x;i>=1;i--, j--){
        if (j==0) j = 2*N-1;
        ans[i] = j;
    }
    for (int i=N+1, j = x+1;i<=2*N-1;i++,j++){
        if (j==2*N) j = 1;
        ans[i] = j;
    }
    cout << "Yes\n";
    for (int i=1;i<=2*N-1;i++) cout << ans[i] << '\n';

    return 0;
}


Measured memory_bytes: 3072
using System;

namespace AizuOnline
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var A = new int[10000];
            var M = new string[10000];
            var B = new int[10000];
            var i = 0;
            while (true)
            {
                var x = Console.ReadLine().Split(' ');
                A[i] = Convert.ToInt32(x[0]);
                M[i] = x[1];
                B[i] = Convert.ToInt32(x[2]);

                if (M[i] == "?")
                {
                    break;
                }

                i++;
            }

            for (int j = 0; j < A.Length; j++)
            {
                var a = A[j];
                var m = M[j];
                var b = B[j];

                if (m == "?")
                {
                    break;
                }
                var answer = 0;
                if (m == "+")
                {
                    answer = a + b;
                }
                else if (m == "-")
                {
                    answer = a - b;
                }
                else if (m == "/" && b != 0)
                {
                    answer = a / b;
                }
                else if (m == "*")
                {
                    answer = a * b;
                }
                Console.WriteLine(answer);
            }

            Console.ReadLine();
        }
    }
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n;

int main() {
    cin >> n;

    if (n%10 == 9 || n/10%10 == 9) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }

    return 0;
}


Measured memory_bytes: 256