akhauriyash/Code-Regression huggingface dataset:
/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>
using namespace std;

#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 100005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
#define MSV(A,a) memset(A, a, sizeof(A))
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define finish(x) {cout<<x<<'\n'; return;}
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';

void solve() {
	int d, s, t;
	cin>>d>>t>>s;
	if(d > s*t) finish("No")
	finish("Yes");
}

int main() {
	int t = 1;
	
	//~cin>>t;
	while(t--) {
		solve();
	}
    return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>

int A[44];

void fibo(int n){
    A[0] = 1;
    A[1] = 1;
    for(int i=2; i<=n; i++){
        A[i] = A[i-1] + A[i-2]; //メモ化
    }
}

int main(){

    int n;
    scanf("%d", &n);

    fibo(n);
    printf("%d\n", A[n]);
    return 0;
}


Measured memory_bytes: 2732
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

N = LSI()
K = I()
dp = FILL3(0,len(N)+1,K+1,2)
dp[0][0][0] = 1
for i in range(len(N)):
    for j in range(K+1):
        for k in range(2):
            m = N[i]
            max_d = 9 if k else m
            for d in range(max_d+1):
                k_ = k or d<max_d
                j_ = j + (d!=0)
                if j_ > K:
                    continue
                dp[i+1][j_][k_]+=dp[i][j][k]
print(dp[len(N)][K][0] + dp[len(N)][K][1])


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

template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))

int main(){
    int N, K, Q;
    cin >> N >> K >> Q;
    int A[N];
    int A_sorted[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
        A_sorted[i] = A[i];
    }
    sort(A_sorted, A_sorted + N);
    int ans = 1e9;
    for(int i = 0; i < N; i++){
        vector<int> can_use_items;
        vector<int> continuity;
        for(int j = 0; j < N; j++){
            if(A[j] >= A_sorted[i]){
                continuity.push_back(A[j]);
            }else{
                sort(all(continuity));
                for(int k = 0; !continuity.empty() && k < K - 1; k++){
                    continuity.pop_back();
                }
                can_use_items.insert(can_use_items.end(), all(continuity));
                continuity.clear();
            }
        }
        sort(all(continuity));
        for(int j = 0; !continuity.empty() && j < K - 1; j++){
            continuity.pop_back();
        }
        can_use_items.insert(can_use_items.end(), all(continuity));
        if(can_use_items.size() < Q){
            continue;
        }
        sort(all(can_use_items));
        ans = min(ans, can_use_items[Q - 1] - A_sorted[i]);
    }
    cout << ans << endl;
}





Measured memory_bytes: 384
// E - Travel by Car

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

const int MAX_N = 300;
const ll INF = 9223372036854775807;
using IDX_STEP_PAIR = pair<int, int>;

int N, M, L;
ll d[MAX_N][MAX_N]; // d[i][j] : 頂点iから頂点jへの最小コスト
ll d2[MAX_N][MAX_N]; // 補給なしで移動できる町への距離を1としたグラフ

void Warshall_Floyd(ll d[MAX_N][MAX_N]) {
	for (int k=0; k<N; k++) {
		for (int i=0; i<N; i++) {
			if (d[i][k] == INF) continue;
			for (int j=0; j<N; j++) {
				if (d[k][j] == INF) continue;
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

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

	for (int i=0; i<N; i++) {
		for (int j=0; j<N; j++) {
			d[i][j] = ((i == j) ? 0 : INF);
			d2[i][j] = ((i == j) ? 0 : INF);
		}
	}

	int A, B, C;
	for (int i=0; i<M; i++) {
		cin >> A >> B >> C;
		A--;
		B--;
		d[A][B] = C;
		d[B][A] = C;
	}

	Warshall_Floyd(d);

	// 補給なしで行ける町への距離を1とするグラフを新たに作成
	for (int i=0; i<N; i++) {
		for (int j=0; j<N; j++) {
			if (d[i][j] <= L) {
				d2[i][j] = 1;
			}
		}
	}

	Warshall_Floyd(d2);

	int Q;
	cin >> Q;
	vector<int> ans;
	int s, t;
	for (int i=0; i<Q; i++) {
		cin >> s >> t;
		s--;
		t--;
		ans.push_back(d2[s][t] == INF ? -1 : d2[s][t] - 1);
	}

	for (int a : ans) {
		cout << a << endl;
	}

	return 0;
}

Measured memory_bytes: 2424
#最小全域技問題(UnionFindと貪欲の合わせ技)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

class UnionFindPathCompression():
    def __init__(self, n):
        self.parents = list(range(n))
        self.rank = [1]*n
        self.size = [1]*n
        
    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        px = self.find(x)
        py = self.find(y)

        if px == py:
            return
        else:
            if self.rank[px] < self.rank[py]:
                self.parents[px] = py
                self.size[py] += self.size[px]
            else:
                self.parents[py] = px
                self.size[px] += self.size[py]
                #ランクの更新
                if self.rank[px] == self.rank[py]:
                    self.rank[px] += 1

N = int(input())
town = [[i]+list(map(int,input().split())) for i in range(N)]
root = []
#x軸の小さい順
town = sorted(town, key=lambda x: x[1])
for i in range(1,N):
    px,nx = town[i-1][1], town[i][1]
    root.append([town[i-1][0], town[i][0], nx-px])
#y軸の小さい順
town = sorted(town, key=lambda x: x[2])
for i in range(1,N):
    py,ny = town[i-1][2], town[i][2]
    root.append([town[i-1][0], town[i][0], ny-py])
#コストの少ない順
root = sorted(root, key=lambda x: x[2])
ufpc = UnionFindPathCompression(N)
ans = 0
for pp,np,cost in root:
    if ufpc.find(pp) != ufpc.find(np):
        ufpc.union(pp,np)
        ans += cost
        #print(pp,np,cost,ans)
print(ans)

Measured memory_bytes: 136016
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> N >> K;
    vector<int> h(N);
    cin >> h;
    sort(h.rbegin(), h.rend());
    for (int i = 0; i < N; i++) {
        if (K <= 0) {
            ans += h[i];
        }
        K--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  vi a(n),h(n);
  vector<bool> f(n,false);
  rep(i,n)cin>>a[i];//left
  rep(i,n){
    h[i]=a[i];
    if(i==0 || a[i]!=a[i-1])f[i]=true;
  }
  rep(i,n)cin>>a[i];//right
  for(i=n-1;i>=0;i--){
    if(f[i]){
      if(i==n-1 || a[i]!=a[i+1]){
	if(h[i]!=a[i]){
	  cout<<0<<endl;
	  return 0;
	}
      }else{
	if(h[i]>a[i]){
	  cout<<0<<endl;
	  return 0;
	}
      }
    }else{
      if(i==n-1 || a[i]!=a[i+1]){
	if(h[i]<a[i]){
	  cout<<0<<endl;
	  return 0;
	}
	h[i]=a[i];
	f[i]=true; 
      }else{
	if(h[i]>a[i])h[i]=a[i];
      }
    } 
  }

  ll ans=1;
  rep(i,n)if(f[i]==false)ans=(ans*h[i])%MOD;
  cout<<ans<<endl;

}


Measured memory_bytes: 1024
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    ll a=in(),b=in(),c=in(),d=in();
    while(true){
        if((c-=b)<=0){
            cout<<"Yes"<<endl;
            break;
        }
        if((a-=d)<=0){
            cout<<"No"<<endl;
            break;
        }
    }
}


Measured memory_bytes: 3616
#7_B
import math

def findlimit(n, x, v):
    a = n - (v-1)
    b = math.floor(x/v)
    if a>=b:
        return b
    else:
        return a

while 1:
    n, x = map(int, input().split())
    l_a = findlimit(n,x,3)
    count = 0
    if n==0 and x==0:
        break
    if x<6:
        res = 0
    else:
        for a in range(l_a):
            a = a + 1
            y = x - a
            l_b = findlimit(n,y,2)
            b_ini = a + 1
            
            for b in range(l_b-b_ini+1):
                b = b + b_ini
                z = y - b
                if b<z<=n:
                    count += 1
    print(count)


Measured memory_bytes: 5664
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ld = long double;
using P = pair<int,int>;

int main() {
  int l;
  cin >> l;
  ld ans = l*l*l;
  ans /= 27;
  printf("%.10Lf\n",ans);
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

int main() {
    int n, m; cin >> n >> m;
    int wa[n + 1];
    bool ac[n + 1];

    for(int i = 1; i <= n; i++){
        wa[i] = 0;
        ac[i] = false;
    }

    int acNum = 0;
    int waNum = 0;
    while(m--){
        int p;
        string s;
        cin >> p >> s;
        if(ac[p]) continue;
        if(s == "AC"){
            ac[p] = true;
            acNum++;
            waNum += wa[p];
        }else{
            wa[p]++;
        }
    }
    cout << acNum << " " << waNum << endl;
}


Measured memory_bytes: 768
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<iostream>
using namespace std;
char ans[7];
int a[10];
bool tp;
char s[10];
void dfs(int s)
{
	if(s==4)
	{
		int res=0;
		res=a[1];
		for(int i=1;i<=3;i++)
		{
			if(ans[i]=='+')
			{
				res+=a[i+1];
			}
			else
			{
				res-=a[i+1];
			}
		}
		if(res==7)
		{
			tp=true;
			return;
		}
		return;
	}
	if(tp)
	{
		return;
	}
	ans[s]='+';
	dfs(s+1);
	if(tp)
	{
		return;
	}
	ans[s]='-';
	dfs(s+1);
	if(tp)
	{
		return;
	}
}
int main()
{
	scanf("%s",s+1);
	for(int i=1;i<=4;i++)
	{
		a[i]=s[i]-'0';
    }
	tp=false;
	dfs(1);
	printf("%d",a[1]);
	cout<<ans[1];
	printf("%d",a[2]);
	cout<<ans[2];
	printf("%d",a[3]);
	cout<<ans[3];
	printf("%d",a[4]);
	cout<<'=';
	cout<<'7';
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<(int)(b);(i)++)
#define RREP(i,a,b) for(int (i)=(a);(i)>=(int)(b);(i)--)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;


int main(){
    vector<ll> sum[4];
    int n, W, w1;
    cin >> n >> W;
    REP(i,0,n){
        int a, b;
        cin >> a >> b;
        if (i == 0) w1 = a;
        sum[a - w1].push_back(b);
    }

    REP(i,0,4){
        sort(sum[i].begin(), sum[i].end());
        sum[i].push_back(0);
        reverse(sum[i].begin(), sum[i].end());

        REP(j,1,sum[i].size()){
            sum[i][j] += sum[i][j - 1];
        }
    }

    ll ans = 0;
    for (ll i = 0; i < sum[0].size(); i++){
        for (ll j = 0; j < sum[1].size(); j++){
            for (ll k = 0; k < sum[2].size(); k++){
                for (ll l = 0; l < sum[3].size(); l++){
                    if (w1 * i + (w1 + 1) * j + (w1 + 2) * k + (w1 + 3) * l > W) continue;
                    ans = max(ans, sum[0][i] + sum[1][j] + sum[2][k] + sum[3][l]);
                }
            }
        }
    }

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

Measured memory_bytes: 256
def insertationSort(sort_list, n, g):
    cnt = 0
    for i in range(g, n):
        v = sort_list[i]
        j = i - g

        while j >= 0 and sort_list[j] > v:
            sort_list[j + g] = sort_list[j]
            j -= g
            cnt += 1
        sort_list[j + g] = v

    return cnt


def shellSort(sort_list, n):

    cnt = 0

    G = [1]

    while True:
        if G[len(G)-1] * 3 + 1 <= n:
            G.append(G[len(G)-1] * 3 + 1)
        else:
            break

    m = len(G)


    for i in G[::-1]:
        cnt += insertationSort(sort_list, n, i)

    print(m)
    print(' '.join([str(i) for i in G[::-1]]))
    print(cnt)
    for ans in sort_list:
        print(ans)


if __name__ == "__main__":
    N = int(input())

    sort_list = list()

    for _ in range(N):
        sort_list.append(int(input()))

    shellSort(sort_list, N)


Measured memory_bytes: 45524
import sys
input = sys.stdin.readline


def main():
    AB = []
    n = int(input())
    for i in range(n):
        a, b = map(int, input().split())
        AB.append([a, b])
    AB = sorted(AB, key=lambda x: (x[1], -x[0]))
    time = 0
    for span, dead in AB:
        time += span
        if time > dead:
            print('No')
            return
    print('Yes')
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 58500
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, L;
	cin >> N >> L;

	vector<int> taste(N);
	int sum = 0;
	for (int i = 0; i < N; i++) {
		taste[i] = L + i;
		sum += L + i;
	}

	int tmp = INF,idx;
	for (int i = 0; i < N; i++) {

		if (tmp > abs(taste[i])) {
			tmp = abs(taste[i]);
			idx = i;
		}
	}

	cout << sum - taste[idx] << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <iostream>
using namespace std;
int a[6], t; string s;
int main() {
	for(int i = 0; i < 6; i++) cin >> a[i];
	cin >> s;
	for(int i = 0; i < s.size(); i++) {
		t = a[0];
		switch(s[i]) {
		case 'N':
			a[0] = a[1];
			a[1] = a[5];
			a[5] = a[4];
			a[4] = t;
			break;
		case 'E':
			a[0] = a[3];
			a[3] = a[5];
			a[5] = a[2];
			a[2] = t;
			break;
		case 'S':
			a[0] = a[4];
			a[4] = a[5];
			a[5] = a[1];
			a[1] = t;
			break;
		case 'W':
			a[0] = a[2];
			a[2] = a[5];
			a[5] = a[3];
			a[3] = t;
			break;
		}
	}
	cout << a[0] << endl;
	return 0;
}

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

int main(){
  int N;
  cin >>N;
  
  vector<char> S(N);
  rep(i,0,N) cin >>S.at(i);
 
  set<char> st;
  rep(i,0,N) st.insert(S.at(i));
  
  string ans;
  st.size()==3 ? ans = "Three" : ans = "Four";
  
  cout <<ans<< endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<string.h>
#include<algorithm>
#include<climits>
using namespace std;

int main() {
  int N, Q;
  string s;
  int ans = 0;
  int cnt = 0;

  cin >> N >> Q;
  cin >> s;
  vector <int> l(Q);
  vector <int> r(Q);
  for(int i = 0; i < Q; i++){
    cin >> l[i] >> r[i];
  }

  vector <int> c(N+1);
  for(int i = 0; i <= N; i++){
    if(i >= 2){
      if(s[i-2]== 'A' && s[i-1] == 'C'){
        cnt++;
      }
    }
    c[i] = cnt;
    // cout << c[i] << ",";
  }
  // cout << endl;

  int tmpl = 0;
  for(int i = 0; i < Q; i++){
    tmpl = max(c[l[i]-1], c[l[i]]);
    ans = c[r[i]] - tmpl;

    // cout << "tmpl = " << tmpl << ", c[r[" << i+1 << "]] = " << c[r[i]]  << endl;

    cout << ans << endl;
  }
}


Measured memory_bytes: 2176
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)

        {
            var a = Console.ReadLine().Split();
            int N, M;
            Int32.TryParse(a[0], out N);
            Int32.TryParse(a[1], out M);
            var a2 = (N <= M) ? N : M;
            string ans = "";
            for (int i = 0; i< (M+N-a2); i++)
            {
                ans += a2.ToString();
            }
            Console.WriteLine(ans);
        }
    }
}


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

int main(){
    int n;
    string s;
    cin >> n >> s;
    if( n % 2 != 0){
        cout << "No" << endl;
        return 0;
    }else{
        REP(i,n/2){
            if(s[i] == s[i+(n/2)]);
            else{
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    //cin >> n;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
 
int main()
{   long long p,n,base=1,ans;
    scanf("%lld%lld",&n,&p);
    if(n==1){
        printf("%lld",p);
        return 0;
    }
    while(pow(base,n)<=p){
        if(p%(long long)(pow(base,n))==0){
            ans=base;
        }
        base++;
    }
    
    printf("%d",ans);
 
    return 0;
}

Measured memory_bytes: 128
/*
  AOJ 1110
  Title:Patience
  @kankichi573
*/
#include <stdio.h>
#include <string.h>
#define max(x,y) (((x)>(y))?(x):(y))
int max_;
char buf[20];

void remove2(char cards[],char out[],int m1,int m2)
{
  int i,j;
 
  //printf("rm %d %d\n",m1,m2);

  for(i=j=0;i<20;i++)
    {
      if(i != m1 && i!= m2)
	{
	  out[j]=cards[i];
	  j++;
	}
    }
}
void dump(char buf[],int depth)
{
  int i,j;
  for(i=0;i<5;i++)
    {
      for(j=0;j<4;j++)
	{
	  if(i*4+j >= 20-depth*2)
	    goto END;
	  printf("%d|",buf[i*4+j]);
	}
      if(i<4)
	printf("\n");
    }
 END:
  printf("\n------- [%d]\n",depth);
  return;
}
int solve(char buf[],int depth)
{
  int  i,last_;
  char mybuf[4][20];


  last_=20-2*depth;
#ifdef DEBUG
  dump(buf,depth);
#endif
  for(i=0;i<last_;i++)
    {
      if(i < 16 && i+4 < last_ && buf[i]==buf[i+4])
	{
	  remove2(buf,&mybuf[0][0],i,i+4);
	  solve(&mybuf[0][0],depth+1);
	}
      if((i % 4)< 3 && i+1 < last_ && buf[i]==buf[i+1])
	{
	  remove2(buf,&mybuf[1][0],i,i+1);
	  solve(&mybuf[1][0],depth+1);
	}
      if(i < 16 && (i % 4)< 3 && i+5 < last_ && buf[i]==buf[i+5])
	{
	  remove2(buf,&mybuf[2][0],i,i+5);
	  solve(&mybuf[2][0],depth+1);
	}
      if(i < 16 && (i % 4)> 0 && i+3 < last_ && buf[i]==buf[i+3])
	{
	  remove2(buf,&mybuf[3][0],i,i+3);
	  solve(&mybuf[3][0],depth+1);
	}
    }
  max_=max(max_,depth);
}

main()
{
  
  int i,j,n,ret;

  scanf("%d ",&n);
  for(i=0;i<n;i++)
    {
      for(j=0;j<20;j++)
	{
	  scanf("%c ",&buf[j]);
	  buf[j] -= '0';
	}
      max_=0;
      ret=solve(buf,0);
      printf("%d\n",20-max_*2);
    }
  return(0);
}

Measured memory_bytes: 600
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,m;


ll gcd(ll a,ll b){
  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
return b;
}


int main(){
  ll ans=1LL;
  cin >> n>> m;

  vi dp(4096,1100000000);
  dp[0]=0;

  REP(i,m){
    int a,b;
    cin >> a>>b;
    int t;
    vi c(12);
    int ac=0;
    REP(j,b){
      cin>>t;
      c[t-1]=1;
      ac+=1<<(t-1);
    }

    REP(k,4096){
      dp[k | ac]=min(dp[k]+a,dp[k | ac]);
    }
  }



  int ac=0;
  REP(i,n){
    ac+=1<<i;
  }


  ans=dp[ac];
  if (ans>=1100000000)ans=-1;

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

Measured memory_bytes: 256
input = gets.split
stack = []

input.each do |e|
  if e =~ /\A[-+]?[0-9]*\.?[0-9]+\Z/
    stack.push(e.to_i)
  else
    res = stack[-2] + stack[-1] if e == "+"
    res = stack[-2] - stack[-1] if e == "-"
    res = stack[-2] * stack[-1] if e == "*"
    res = stack[-2] / stack[-1] if e == "/"
    stack.pop(2)
    stack.push(res)
  end
  #print stack
end

puts stack


Measured memory_bytes: 6876
#include <cstdio>
using namespace std;
int main(void){
  char c;
  int flg = true;
  while(scanf("%c",&c),c>='a'&&c<='z'){
    if (flg){
      printf("%c",c);
    }
    flg = !flg;
  }
  puts("");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define FT() int t; scanf("%d",&t); while(t--)
#define pb push_back
#define nl printf("\n")
#define fi(i,start,end) for(int i=start; i < (int)end ; ++i)
#define ip(n)   scanf("%d",&n)
#define mz(a)   memset(a,0,sizeof(a))
#define inpArr(A,n) fi(i,0,n)   ip(A[i]);
#define print(a)  for(auto i : a)   cout<<i<<" "; nl;
#define Fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
ll max(ll a,ll b) { return a>b?a:b;}
ll min(ll a,ll b) { return a<b?a:b;}
//std::cout << std::fixed;
//std::cout << std::setprecision(6);
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    
    ll a;
    cin>>a;
    cout<<(a + a*a + a*a*a);
    

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
    #endif
    
    return 0;
}


Measured memory_bytes: 3588
def main():
    N = int(input())
    ans = 0
    def c(i, j):
        res = 0
        str_i = str(i)
        str_j = str(j)
        for k in range(1, N+1):
            if str(k)[0] == str_i and str(k)[-1] == str_j:
                res += 1
        return res

    for i in range(1, 10):
        for j in range(1, 10):
            ans += c(i,j) * c(j, i)

    print(ans)
main()

Measured memory_bytes: 73356
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> a(5, 0);
  int A, B;
  cin >> A >> B;
  if (A < B) {
    int tmp = A;
    A = B;
    B = tmp;
  }
  if (A > B + 1) {
    cout << A + A - 1 << endl;
  } else {
    cout << A + B << endl;
  }

  return 0;
}


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

int partition(std::vector<int>& A, int p, int r)
{
  int x = A[r];
  int i = p - 1;
  for(int j = p; j < r; ++j){
    if(A[j] <= x){
      i = i + 1;
      std::swap(A[i],A[j]);
    }
  }
  std::swap(A[i+1],A[r]);
  return i+1;
}

int main()
{
  int n;
  std::cin >> n;
  std::vector<int> A(n);
  for(int i = 0; i < n; ++i){
    std::cin >> A[i];
  }
  int q = partition(A, 0, n-1);
  for(int i = 0; i < n; ++i){
    if(i) std::cout << " ";
    if(i == q) std::cout << "[" << A[i] << "]";
    if(i != q) std::cout << A[i];
  }
  std::cout << std::endl;
  
  return 0;
}

Measured memory_bytes: 1532
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.000000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

ll fun(vi &a,ll b)
{
    ll sum=0;
    for(ll i=0;i<sz(a);i++)
        sum+=abs(a[i]-(b+i+1));
    return sum;
}
int main()
{
    fast();
    ll n;
    cin>>n;
    vi a(n);
    cin>>a;
    for(ll i=0;i<n;i++)
        a[i]-=(i+1);
    sort(all(a));
    ll b=a[(sz(a)-1)/2];

    ll ans=0;
    for(ll i=0;i<n;i++)
        ans+=abs(a[i]-b);
    cout<<ans<<nl;
}


Measured memory_bytes: 4732
#include<stdio.h>

int zt(int x){if(x > 0){return x;}return -x;}

int minim(int x,int y){if(x < y){return x;}return y;}

int main(void){
	int w,a,b;
	scanf("%d%d%d",&w,&a,&b);
	if(a <= b+w && b <= a+w){printf("0\n");return 0;}
	printf("%d\n",minim(zt(b-a-w),zt(a-b-w)));
	return 0;
}

Measured memory_bytes: 128
sx,sy,tx,ty= map(int, input().split())
s=''
for i in range(tx-sx):
    s+='R'
for i in range(ty-sy):
    s+='U'
for i in range(tx-sx):
    s+='L'
for i in range(ty-sy):
    s+='D'
s+='D'
for i in range(tx-sx+1):
    s+='R'
for i in range(ty-sy+1):
    s+='U'
s+='LU'
for i in range(tx-sx+1):
    s+='L'
for i in range(ty-sy+1):
    s+='D'
s+='R'
print(s)

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

using namespace std;

using int64 = long long;
const int mod = 1000003;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

int main() {
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  --A, --B, --C, --D;
  string S;
  cin >> S;

  auto check = [&](int x, int y) {
    int cur = x;
    while(cur < y) {
      if(cur + 1 <= y && S[cur + 1] == '.') cur += 1;
      else if(cur + 2 <= y && S[cur + 2] == '.') cur += 2;
      else return false;
    }
    return cur == y;
  };
  auto check2 = [&]() {
    if(A < B) {
      for(int x = B; x <= D; x++) {
        int ok1 = S[x] == '.';
        int ok2 = S[x + 1] == '.';
        int ok3 = S[x - 1] == '.';
        if(ok1 && ok2 && ok3) return true;
      }
      return false;
    } else {
      return true;
    }
  };
  if(C > D) {
    if(check(A, C) && check(B, D) && check2()) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    if(check(A, C) && check(B, D)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}




Measured memory_bytes: 592
#include <iostream>

using namespace std;

int main()
{
	char s[100];
	cin >> s;
	int ans = 0;

	for (int i = 0;i < 100;i++)
	{
		if (s[i] == 'A'&&s[i + 1] == 'C') {
			ans++;
			break;
		}
	}
	if (ans > 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i, a, b) for (int i = (a); i <= (b); ++i)
#define FD(i, a, b) for (int i = (b); i >= (a); --i)
#define DEBUG(x) cerr << #x << ": " << (x) << '\n';

const int N = 1005;
int n, a[N][N], ind[N * N], f[N * N];
vector<int> g[N * N];
int encode(int x, int y) {
  if (x > y) swap(x, y);
  return (x - 1) * n + y - 1;
}

int main() {
  cin >> n;
  FI(i,1,n) FI(j,1,n-1) scanf("%d", &a[i][j]);
  FI(i,1,n) {
    for (int j = 1; j + 1 < n; ++j) {
      int u = encode(i, a[i][j]);
      int v = encode(i, a[i][j + 1]);
      g[u].push_back(v);
      ++ind[v];
    }
  }
  vector<int> topo;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      int u = encode(i, j);
      if (ind[u] == 0) topo.push_back(u);
    }
  } 
  for (int i = 0; i < int(topo.size()); ++i) {
    int u = topo[i];
    for (int v: g[u]) {
      --ind[v];
      if (!ind[v]) topo.push_back(v);
    }
  }
  if ((int)topo.size() != n * (n - 1) / 2) return puts("-1"), 0;
  reverse(topo.begin(), topo.end());
  int ans = 0;
  for (int u: topo) {
    f[u] = 1;
    for (int v: g[u]) f[u] = max(f[u], f[v] + 1);
    ans = max(f[u], ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 53492
#include<stdio.h>

int n,A[20];

int solve(int i,int m)//再帰関数
{
	int r,l;
	if(m==0) return 1;//m=0の場合、作れる
	if(i>=n) return 0;//与えられた数列以上の場合、失敗
	l=solve(i+1,m);//iを用いなかった場合
	r=solve(i+1,m-A[i]);//iを用いた場合
	if(r>l) return r;
	else return l;
}

int main(void)
{
	int q,M,i;
	
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&A[i]);
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&M);
		if(solve(0,M)==1) printf("yes\n");
		else printf("no\n");
	}

	return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

string dig = "ixcm";
int dec(string s) {
    int ret = 0;
    reverse(s.begin(), s.end());
    int d = 1;
    bool on = false;
    rep(i,0,s.length()) {
        if(dig.find(s[i]) != string::npos) {
            if(on) ret += d;
            on = true;
        }
        else {
            ret += (s[i] - '0') * d;
            on = false;
        }

        if(s[i] == 'i') d = 1;
        else if(s[i] == 'x') d = 10;
        else if(s[i] == 'c') d = 100;
        else if(s[i] == 'm') d = 1000;
    }
    if(on) ret += d;
    return ret;
}

string enc(int n) {
    string ret = "";
    int d = 0;
    while(n != 0) {
        char c = (char)(n % 10 + (int)'0');
        if(c != '0' && c != '1') {
            ret += dig[d];
            ret += c;
        }
        else if(c == '1') {
            ret += dig[d];
        }
        n /= 10;
        d++;
    }
    reverse(ret.begin(), ret.end());
    return ret;
}

signed main() {
    int n; cin >> n;
    rep(i,0,n) {
        string s1, s2; cin >> s1 >> s2;
        int a = dec(s1), b = dec(s2);
        // printf("a: %lld, b: %lld\n", a, b);
        cout << enc(a + b) << endl;
    }
    return 0;
}

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


void solve(long long N, long long M){
	cout << (N*(N-1)/2)+(M*(M-1)/2) << endl;

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


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

int main(){
  string S;
  cin >> S;
  int count = 0;
  for(int i=0;i<3;i++){
    for(int j=i+1;j<4;j++){
      if(S.at(i) == S.at(j)){
        count++;
      }
    }
  }
    if(count == 2)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c;
	cin>>a>>b>>c;
	if(a&1 || b&1 || c&1){
		cout<<0<<'\n';
		return 0;
	}
	if(a==b && b==c){
		cout<<-1<<'\n';
		return 0;
	}
	int cnt=0;
	while((a&1)==0 && (b&1)==0 && (c&1)==0){
		int aa=a, bb=b, cc=c;
		a=bb/2+cc/2;
		b=aa/2+cc/2;
		c=aa/2+bb/2;
		++cnt;
	}
	cout<<cnt<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
class fastio {
public:
    fastio() {
        ios_base::sync_with_stdio(false);
        cout.tie(nullptr);
        cin.tie(nullptr);
    }
} __fastio;
int main() {
  __fastio;
  int a; string s;
  cin >> a >> s;
  if(a < 3200) cout << "red" << endl;
  else cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int C[4][14]={0};
    int n;
    cin>>n;
    char X;
    for(int i=0;i<n;i++){
        int x,y;
        
        cin>>X;
     if(X == 'S'){
        x=0;
     }else if(X=='H'){
        x=1;
}else if(X =='C'){
        x=2;
     }else{
            x=3;
        }
        cin>>y;
        C[x][y] =1;
    }
    for(int x=0;x<4;x++){
        for(int y=1;y<14;y++){
            if( !(C[x][y] ==1)){
                switch(x){
                    case 0: cout<<"S "<<y<<endl; break;
                    case 1: cout<<"H "<<y<<endl; break;
                    case 2: cout<<"C "<<y<<endl; break;
                    case 3: cout<<"D "<<y<<endl; break;
                }
            }
        }
    }
return 0;
}           

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define N 2147483647
long long int ans[1100][1100];
int main()
{
    int n,m;
    int a[1100][2];
    int T;
    scanf("%d",&T);
    for(int i=0;i<T;i++)
    {
        scanf("%d%d",&a[i][0],&a[i][1]);
    }
    long long int p=a[0][0];
    long long int q=a[0][1];
    for(int i=1;i<T;i++)
    {
        long long int p1,p2;
        if(p%a[i][0]==0)
        {
           p1=p/a[i][0];
        }
        else
        {
            p1=p/a[i][0]+1;
        }
        if(q%a[i][1]==0)
        {
            p2=q/a[i][1];
        }
        else
        {
            p2=q/a[i][1]+1;
        }
        p1=max(p1,p2);
        p=a[i][0]*p1;
        q=a[i][1]*p1;

    }
    printf("%lld\n",p+q);
    return 0;
}


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;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int main(){
	int k;
	v1 a{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cin >> k;
	cout << a[k-1] << endl;
}


Measured memory_bytes: 3592
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
typedef pair<ll,ll> Pair;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }

const ll INF=99999999999999;
const ll MOD=1000000007;

class AAirplane {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll p,q,r;
	    in >> p >> q >> r;
	    out << min(p+q,min(q+r,p+r));

	}
};


int main() {
	AAirplane solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,m,i,a=1;
  scanf("%d %d\n",&n,&m);
  for(i=0;i<m;i++){
    a=a*2;
  }
  printf("%d\n",1900*m*a+100*(n-m)*a);
  return 0;
}

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

struct Node {
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int key) {
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = new Node;
    z->key = key;
    z->left = NIL;
    z->right = NIL;

    while (x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z->parent = y;
    if (y == NIL) {
        root = z;
    } else {
        if (z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u) {
    if (u == NIL) { return; }
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if (u == NIL) { return; }
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int n;
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        string command;
        cin >> command;
        if (command == "insert") {
            int key;
            scanf("%d", &key);
            insert(key);
        } else if (command == "print") {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}


Measured memory_bytes: 26732
#include <bits/stdc++.h>
#define LL long long
#define INF 0x7FFFFFFF//or 0x3f3f3f3f ? -Wall
using namespace std;

template<class T> inline
void read(T& x) {
	int f = 1; x = 0;
	char ch = getchar();
	while (ch < '0' || ch > '9')   {if (ch == '-') f = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}

/*============ Header Template ============*/

const int N = 100000 + 5;

int n, flag, rt;
LL a[N], in[N], f[N];
vector<int> v[N];

void dfs(int x, int p) {
	LL sum = 0, mx = -INF, cnt = 0; f[x] = 0;
	for (int i = 0; i < (int) v[x].size(); i++) {
		int y = v[x][i];
		if (y == p) continue;
		if (in[y] != 1) dfs(y, x);
		//printf("%d %d\n", x, y);
		sum += a[y] - f[y];
		mx = max(mx, a[y] - f[y]);
	}
	LL res = sum - mx;
	if (res <= mx) cnt = res;
	else cnt = sum / 2;
	f[x] = sum - a[x];
	if (f[x] < 0) flag = 0;
	if (f[x] > cnt) flag = 0;
	if (x == rt && a[x] != f[x]) flag = 0;
}

int main() {
	read(n);
	for (int i = 1; i <= n; i++) read(a[i]);
	if (n == 2) {
		if (a[1] == a[2]) printf("YES\n");
		else printf("NO\n");
		return 0;
	}
	for (int i = 1, x, y; i < n; i++) {
		read(x), read(y);
		v[x].push_back(y);
		v[y].push_back(x);
		in[x]++; in[y]++;
	}
	flag = 1;
	for (int i = 1; i <= n; i++) {
		if (in[i] != 1) {
			rt = i;
			dfs(i, 0);
			break;
		}
	}
	if (flag) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 16000
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<functional>
#include<numeric>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))

#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1};
const int _dy[] = {1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

char g[60][60];
int memo[60][60];

int main(){
  int h, w; cin >> h >> w;
  
  REP(i, h) cin >> g[i];

  typedef pair<int, pair<int,int> > data;

  priority_queue<data, vector<data>, greater<data> > pq;

  pq.push(mp(0, mp(0,0)));

  REP(i,h) REP(j,w) memo[i][j] = -1;

  while(pq.size()){
    data d = pq.top();
    int cost = d.f;
    int x    = d.s.f;
    int y    = d.s.s;
    pq.pop();

    if(memo[y][x] != -1) continue;
    memo[y][x] = cost;

    if(x == w - 1 && y == h - 1){
      cout << cost << endl;
      return 0;
    }

    REP(i,2){
      int xx = x + _dx[i];
      int yy = y + _dy[i];

      if(ISIN(xx, yy, w, h) && (memo[yy][xx] == -1)){
	int cc = cost + (g[yy][xx] - '0');
	pq.push(mp(cc, mp(xx, yy)));
      }
    }

  }

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;

double distance(double x1, double x2, double y1, double y2) {
    double X = (x1 - x2) * (x1 - x2);
    double Y = (y1 - y2) * (y1 - y2);
    return (double) sqrt(X + Y);
}

int factorial(int n) {
    if(n == 0) return 1;
    return n * factorial(n - 1); 
}

int main() {
    int n;  cin >> n;
    double x[n], y[n];

    for(int i = 0; i < n; i++) cin >> x[i] >> y[i];

    int v[n];
    for(int i = 0; i < n; i++) v[i] = i;

    int num = factorial(n);
    double d[num] = {};

    int j = 0;
    do {
        for(int i = 0; i < n - 1; i++) {
            d[j] += distance(x[v[i]], x[v[i + 1]], y[v[i]], y[v[i + 1]]);
        }
        j++;
    } while(next_permutation(v, v + n));

    double sum = 0;
    for(int i = 0; i < num; i++) sum += d[i];

    cout << setprecision(15) << sum / num << endl; 

    return 0;
}

Measured memory_bytes: 512
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
H = [0] + H
judge = [True] * (N + 1)
AB = []
for _ in range(M):
    ab = list(map(int, input().split()))
    AB.append(ab)

for i in range(M):
    if H[AB[i][0]] > H[AB[i][1]]:
        judge[AB[i][1]] = False
    elif H[AB[i][0]] < H[AB[i][1]]:
        judge[AB[i][0]] = False
    elif H[AB[i][0]] == H[AB[i][1]]:
        judge[AB[i][0]] = False
        judge[AB[i][1]] = False
print(judge.count(True) - 1)

Measured memory_bytes: 31844