akhauriyash/Code-Regression huggingface dataset:
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);

void main()
{
    auto n = lread();
    auto a = aryread();
    long[long] ary;
    foreach (i; 0 .. n)
    {
        ary[a[i]] = ary.get(a[i], 0) + 1;
    }
    foreach (value; ary)
    {
        if (value > 1)
        {
            writeln("NO");
            return;
        }
    }
    writeln("YES");

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}


Measured memory_bytes: 21532
N, X = map(int, input().split())
a, p = [1], [1]
for i in range(N):
  a.append(a[i] * 2 + 3)
  p.append(p[i] * 2 + 1)

def f(N, X):
  if N == 0:
    return 0 if X <= 0 else 1
  elif X <= 1 + a[N-1]:
    return f(N-1, X-1)
  else:
    return p[N-1] + 1 + f(N-1, X-2-a[N-1])

print(f(N, X))


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
 
int main() {
	int n,tmp,flag=0;
	cin>>n;
	
	tmp=n/100;
	n=n%100;
	if(tmp==7){
		flag=1;
	}
	
	tmp=n/10;
	n=n%10;
	if(tmp==7){
		flag=1;
	}
	
	tmp=n;
	if(tmp==7){
		flag=1;
	}
	if(flag==1){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
string ss;
int length;
int go(char a,char b)
{
	int mida=0,midb=0,val=1;
	if(a==b&&(length>1||length==1&&ss[0]>=a))
		mida=midb=1;
	for(int i=0;i<=length-3;i++)
	{
		mida+=val;
		midb+=val;
		val*=10;
	}
	int adda=0,addb=0;
	if(length>=2)
		adda=addb=1;
	if(a>ss[0])
		adda=0;
	else if(a==ss[0])
	{
		int val2=1;
		for(int i=length-2;i>=1;i--)
		{
			adda+=(ss[i]-'0')*val2;
			val2*=10;
		}
		if(b>ss[length-1])
			adda--;
	}
	else if(a<ss[0])
		adda=val;
	mida+=adda;
	if(b>ss[0])
		addb=0;
	else if(b==ss[0])
	{
		int val2=1;
		for(int i=length-2;i>=1;i--)
		{
			addb+=(ss[i]-'0')*val2;
			val2*=10;
		}
		if(a>ss[length-1])
			addb--;
	}
	else if(b<ss[0])
		addb=val;
	midb+=addb;
	int res=mida*midb;
	return res;
}
void fl()
{
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
int main()
{
	ios::sync_with_stdio(0);
//    fl();
	cin>>ss;
	length=ss.length();
	long long ans=0;
	for(char i='1';i<='9';i++)
	{
		for(char j='1';j<='9';j++)
		{
			ans+=(long long)go(i,j);
//			printf("%c %c:%d\n",i,j,go(i,j));
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

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

  ll n, k;
  cin >> n >> k;

  ll ans = min(n % k, abs(n % k - k));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
//This Code was made by Chinese_zjc_.
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<bitset>
#include<cmath>
#include<queue>
#include<stack>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<set>
#include<time.h>
// #include<windows.h>
#define int long long
#define PI 3.14159265358979323
#define INF 0x3fffffffffffffff
using namespace std;
int n,a[200005],sum,ans;
signed main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;++i)
    {
        cin>>a[i];
        sum+=a[i];
    }
    for(int i=1;i<=n;++i)
    {
        sum-=a[i];
        (ans+=sum%1000000007*a[i])%=1000000007;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5216
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readC(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=rdsp;foreach(ref v;t)pick(r,v[i]);}}

void main()
{
  int n; readV(n);
  int[] t; readA(n, t);
  int m; readV(m);
  int[] p, x; readC(m, p, x); p[] -= 1;

  auto s = t.sum;
  foreach (i; 0..m)
    writeln(s - t[p[i]] + x[i]);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int

int main(void){
	ll S;
	scanf("%lld",&S);
	ll x1=0,x2,x3,y1=0,y2,y3;
	// s = abs(x2*y3-x3*y2)*0.5
	const int v = 1e9;
	x2 = v;
	y2 = 1;
	x3 = (v-S%v)%v;
	y3 = (S+x3)/v;
	
	printf("%lld %lld %lld %lld %lld %lld",x1,y1,x2,y2,x3,y3);
	return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cstring>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
int MOD = 1000000007;

int main() {
	int n; cin >> n;
	int x = 0, y = 0;
	while (n--) {
		string s, t; cin >> s >> t;
		if (s == t) {
			x++; y++;
		}
		if (s > t) x += 3;
		if (s < t) y += 3;
	}
	cout << x << ' ' << y << endl;
}

Measured memory_bytes: 1208
import math
# 時針の速度
# 360度/720分 = 1/2度/m
# 分針の速度
# 360度/60分 = 6度/m
# 時針と分針の度数は両者を減算したものの絶対値
# 使用するのは余弦定理

# def str_to_int(str_num):
#     int_num = int(str_num)
#     return int_num


line = input().split(' ')
# int_line = list(map(lambda str_num: int(str_num), line))
int_line = [int(str_num) for str_num in line]
# print(int_line)

# 時針の進行角度
# radian_h =　(H * 60 + M) * 0.5
# radian_m = M * 6

# 時針と分針の角度
degree = abs((int_line[2] * 60 + int_line[3]) * 0.5 - int_line[3] * 6)

# 分針と時針の末端同士の距離
distance_squared = int_line[0] ** 2 + int_line[1] ** 2 - 2 * \
    int_line[0] * int_line[1] * math.cos(math.radians(degree))

distance = math.sqrt(distance_squared)

print(distance)


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

int main(){
    ll INF = 1e18;
    int v, e;
    cin >> v >> e;
    vector<vector<ll>> dp(v, vector<ll>(v, INF));
    for(int i = 0; i < v; i++) dp[i][i] = 0;

    for(int i = 0; i < e; i++){
        int s, t, d;
        cin >> s >> t >> d;
        dp[s][t] = d;
    }

    for(int k = 0; k < v; k++){
        for(int i = 0; i < v; i++){
            for(int j = 0; j < v; j++){
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
            }
        }
    }

    for(int i = 0; i < v; i++){
        if(dp[i][i] < 0){
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }

    for(int i = 0; i < v; i++){
        for(int j = 0; j < v; j++){
            if(j) cout << ' ';
            if(dp[i][j] < 1e12) cout << dp[i][j];
            else cout << "INF";
        }
        cout << endl;
    }
}


Measured memory_bytes: 3232
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;

const long long _MOD = 1000000007;
const long long MOD = 998244353;

template<typename T>
constexpr T gcd(T m, T n) noexcept {
	T g = 1;

	while (m != 0) {
		if (m < n) swap(m, n);

		if (m & 1) {
			if (n & 1) m = (m - n) >> 1;
			else n = n >> 1;
		}
		else {
			if (n & 1) {
				m = m >> 1;
			}
			else {
				n = n >> 1;
				m = m >> 1;
				g = g << 1;
			}
		}
	}

	return g * n;
}

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

	int n;
	string s;
	cin >> n >> s;

	pii *r, *g, *b;
	r = new pii[n];
	g = new pii[n];
	b = new pii[n];
	int R = 0, G = 0, B = 0;
	rrep(i, n-1) {
		if (i == n - 1) {
			r[i] = pii(0, 0);
			g[i] = pii(0, 0);
			b[i] = pii(0, 0);
		}
		else {
			r[i] = r[i + 1];
			g[i] = g[i + 1];
			b[i] = b[i + 1];
		}


		if (s[i] == 'R') {
			++R;
			r[i].first += G;
			r[i].second += B;
		}
		else if (s[i] == 'G') {
			++G;
			g[i].first += R;
			g[i].second += B;
		}
		else {
			++B;
			b[i].first += R;
			b[i].second += G;
		}
	}

	ll ans = 0;
	rep(i, n - 2) {
		if (s[i] == 'R') {
			ans += g[i + 1].second + b[i + 1].second;
		}
		else if (s[i] == 'G') {
			ans += r[i + 1].second + b[i + 1].first;
		}
		else {
			ans += r[i].first + g[i + 1].first;
		}

		REP(j, 1, ((n - 1 - i) / 2) + 1) {
			if (s[i] != s[i + j] && s[i] != s[i + j + j] && s[i + j] != s[i + j + j]) --ans;
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3696
#include <iostream>

int main(int argc, char **argv)
{
    int a, b;
    std::cin >> a >> b;
    std::string Sa(""), Sb("");

    for(int i = 0; i < b; i++){
        Sa += (a+'0');
    }
    for(int i = 0; i < a; i++){
        Sb += (b+'0');
    }
    
    std::cout << std::min(Sa, Sb) << std::endl;
}


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

// GCD, LCM
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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

    cout<<a+a*a+a*a*a<<endl;
    
    return 0;
}

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

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var str = "";
			while ((str = Console.ReadLine()) != null)
			{
				var r = "";
				var n = int.Parse(str);
				for (int i = 0; i < 10; i++)
				{
					if (((n >> i) & 1) != 0)
						r += Math.Pow(2, i) + " ";
				}
				Console.WriteLine(r.TrimEnd(' '));
			}
		}
	}
}

Measured memory_bytes: 5688
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath>

using namespace std;

struct Node
{
    int x, y;
};

typedef Node node;

bool cmp(node a, node b)
{
    return a.x < b.x;
}

node arr[100010];
int range[200010][2];
int result[200010];

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

    for(int i = 0; i < m; i++)
    {
        scanf("%d%d", &arr[i].x, &arr[i].y);
    }

    sort(arr, arr + m, cmp);

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

    for(int i = 0; i < m; i++)
    {
        range[arr[i].y][0] = range[arr[i].y - 1][0] = min(range[arr[i].y - 1][0], range[arr[i].y][0]);
        range[arr[i].y][1] = range[arr[i].y - 1][1] = max(range[arr[i].y - 1][1], range[arr[i].y][1]);
    }


    for(int i = 0; i < n; i++)
    {
        printf("%d", range[i][1]-range[i][0]+1);

        if(i < n - 1)
        {
            printf(" ");
        }
        else
        {
            printf("\n");
        }
    }

    return 0;
}

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

int main(void) {
  char N[4];
  cin >> N;
  if( (N[0] == N[1] && N[1] == N[2])
     || (N[1] == N[2] && N[2] == N[3]) ){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3564
from collections import Counter

N,*f = map(int, open(0).read().split())
A = f[:N]
Q = f[N]
BC = [f[N+i*2+1:N+i*2+3] for i in range(Q)]
c = Counter(A)
ans = sum(A)
for B, C in BC:
    if c[B] > 0:
        if c[C] > 0:
            ans += (C-B) * c[B]
            c[C] += c.pop(B)
        else:
            ans += (C-B) * c[B]
            c[C] = c.pop(B)
    print(ans)

Measured memory_bytes: 44096
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

const int maxn = 100000;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int q;
bool pt[maxn];
int t[maxn + 1] = { 0 };
int l[maxn], r[maxn];
int rm = 0;

bool jud(int k) {

	for (int i = 2; i <= k / 2; i++) {

		if (k%i == 0)return false;

	}

	return true;
}

int main() {

	cin >> q;

	rep(i, q) {
		cin >> l[i] >> r[i];
		rm = max(rm, r[i]);
	}

	pt[0] = false;
	pt[1] = false;
	pt[2] = true;
	
	for (int i = 3; i <= rm; i++) {
		if (i % 2 == 1)pt[i] = jud(i);
	}
	
	for (int i = 1; i <= rm; i++) {
		t[i] += t[i - 1];
		if (pt[i] && pt[(i + 1) / 2])t[i]++;
	}

	rep(i, q) {
		cout << t[r[i]] - t[l[i]-1] << endl;
	}

	return 0;
}

Measured memory_bytes: 2300
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args)  {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt(); 
        if(N%2==0){
            System.out.println(N);
        }else{
            System.out.println(2*N);
        }
    }    
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
long long n,dp[100005][2];
vector<int>a[100005];
bool check[100005]={false};
void dfs(int node){
    if(check[node]==true) return ;
    check[node]=true;
    for(auto i=a[node].begin();i!=a[node].end();i++){
        if(check[*i]==false){
            dfs(*i);
            dp[node][0]=dp[node][0]*((dp[*i][1]+dp[*i][0])%mod)%mod;
            dp[node][1]=dp[node][1]*dp[*i][0]%mod;
        }
    }
}
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) dp[i][0]=1,dp[i][1]=1;
    for(int i=1;i<n;i++){
        int x,y;
        cin>>x>>y;
        a[x].push_back(y);
        a[y].push_back(x);
    }
    dfs(1);
    cout<<(dp[1][0]+dp[1][1])%mod;
    return 0;
}


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

using namespace std;
using ll  = long long;
using ii  = pair < int , int >;
using pll = pair < ll , ll >;
using i3  = pair < int , ii >;
using vi  = vector < int >;
using vl  = vector < ll >;
using vii = vector < ii >;
using vi3 = vector < i3 >;

const int N = 2e5 + 5;
const ll INF = 1e12;
const double eps = 1e-9 , PI = acos(-1);

int n , m;
char s[12];
string ans = "";

void solve(){
    scanf("%s" , s);

    for(int i = 0 ; s[i] ; i ++){
        if(s[i] == 'B'){
            if(ans.length() != 0)ans.pop_back();
        }
        else ans += s[i];
    }

    printf("%s" , ans.c_str());
}

main(){
    int t = 1;
    //scanf("%d" , &t);

    while( t -- ){
            solve();
    }

    return 0;
}




Measured memory_bytes: 256
S = input().strip()
T = input().strip()

def pattern(s):
  s_dict = {}
  pattern = [None for _ in range(len(s))]
  for i,c in enumerate(s):
    if not c in s_dict:
      s_dict[c] = len(s_dict)
    pattern[i] = s_dict[c]
  return pattern

if pattern(S) == pattern(T):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 6960
import Control.Applicative

powMod _ 0 _ = 1
powMod base exponent modulus = ((if exponent `mod` 2 == 1 then base else 1) * powMod ((base * base) `mod` modulus) (exponent `div` 2) modulus) `mod` modulus

invMod x p = powMod x (p - 2) p

fallingFactorialMod _ 0 _ = 1
fallingFactorialMod 0 _ _ = 0
fallingFactorialMod x n p = (x * fallingFactorialMod (x - 1) (n - 1) p) `mod` p

combinationMod n k p = ((fallingFactorialMod n k p) * invMod (fallingFactorialMod k k p) p) `mod` p

main = do
  [n, k] <- map read . words <$> getLine
  print $ combinationMod k n (10 ^ 9 + 7)



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

#define MAX_N 1000
#define MAX_M 1000


int main(){
	ll a, b, c;
    cin >> a >> b >> c;
    ll tmp  = b - 1;
    if(tmp > c) tmp = c;
    ll ans = a * tmp / b;
    cout << ans << endl;

}




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

using namespace std;
int main(){

ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

int n;
cin>>n;
int k=n/500;
  int d=n%500;
int c=d/5;
cout<<k*1000+c*5;


return 0;
}


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

int step=0;

int gcd(int x,int y){
	if(y==0)return x;
	else{
		step++;
		return gcd(y,x%y);
	}
}

int main(void){
	int x,y,ans;
	while(1){
		scanf("%d%d",&x,&y);
		if(x==0 && y==0)break;
		step=0;
		if(x>y)ans=gcd(x,y);else ans=gcd(y,x);
		cout << ans << " " << step << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
const int N=15;
char ch[N][N];
int n,m,v[N],vis[N];
bool sam(int a,int b){
	for(int i=1;i<=n;i++)if(ch[i][a]!=ch[n-i+1][b])return 0;
	return 1;
}
void check(){
	int fff=0; memset(v,0,sizeof(v));
	for(int i=1;i<=m;i++)if(!v[i]){
		int flag=0;
		for(int j=i+1;j<=m;j++)if(!v[j]&&sam(i,j)){
			v[j]=1; flag=1; break;
		}
		if(!flag&&(m%2==0))return;
		else if(!flag&&fff)return;
		else if(!flag&&!sam(i,i))return;
		else if(!flag)fff=1;
	}
	puts("YES"); exit(0);
}
void dfs(int p){
	if(p>n){
		check(); return;
	}
	if(vis[p]){
		dfs(p+1); return;
	}
	for(int i=p;i<=n;i++)if(!vis[i]){
		vis[i]=1; swap(ch[p],ch[i]); dfs(p+1); swap(ch[p],ch[i]); vis[i]=0;
	}
}
int main(){
	n=read(); m=read();
	for(int i=1;i<=n;i++){
		scanf("%s",ch[i]+1);
	}
	dfs(1);
	puts("NO");
}


Measured memory_bytes: 256
/*No.1137 Numeral System*/

#include <stdio.h>

void print_mcxi(int s);
int mcxi_integer(char *array);
int integer(char c);

int main(void){

  int i;
  int n;
  int sum=0;

  scanf("%d",&n);

  for(i=0;i<n;i++){

    char num_1[10]={0};
    int  sum_1=0;
    char num_2[10]={0};
    int sum_2=0;

    scanf("%s%s",num_1,num_2);

    sum_1=mcxi_integer(num_1);
    sum_2=mcxi_integer(num_2);

    sum=sum_1+sum_2;

    print_mcxi(sum);
 }

  return 0;
}

void print_mcxi(int s){
  int m=0;
  int c=0;
  int x=0;
  int i=0;

  if(s>999 && s<10000){
    m=s/1000;
    c=(s-m*1000)/100;
    x=(s-m*1000-c*100)/10;
    i=s-m*1000-c*100-x*10;
  }
  else if(s>99 && s<1000){
    c=s/100;
    x=(s-c*100)/10;
    i=s-c*100-x*10;
  }
  else if(s>9 && s<100){
    x=s/10;
    i=s-x*10;
  }
  else if(s>0 && s<10){
    i=s;
  }

  if(m==1){printf("m");}
  if(m>1){printf("%dm",m);}
  if(c==1){printf("c");}
  if(c>1){printf("%dc",c);}
  if(x==1){printf("x");}
  if(x>1){printf("%dx",x);}
  if(i==1){printf("i");}
  if(i>1){printf("%di",i);}

  printf("\n");
}

int mcxi_integer(char *array){

  int j;
  int sum=0;

  for(j=0;array[j]!='\0';j++){
    
    if(j==0){
      switch(array[j]){
      case 'm': sum+=1000;break;
      case 'c': sum+=100;break;
      case 'x': sum+=10;break;
      case 'i': sum+=1;break;
      default: break;
      }
    }
    else if(j>0){
      switch(array[j]){
      case 'm': sum+=(integer(array[j-1])*1000);break;
      case 'c': sum+=(integer(array[j-1])*100);break;
      case 'x': sum+=(integer(array[j-1])*10);break;
      case 'i': sum+=(integer(array[j-1])*1);break;
      default : break;
      } 
    }
      
  }

  return sum;

}
  
int integer(char c){

  int m;

  switch(c){
  case '2': m=2;break;
  case '3': m=3;break;
  case '4': m=4;break;
  case '5': m=5;break;
  case '6': m=6;break;
  case '7': m=7;break;
  case '8': m=8;break;
  case '9': m=9;break;
  default : m=1;break;
  }

  return m;
}

Measured memory_bytes: 604
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  
  int ct = 0;
  int ans = 0;
  for (int i = min(A, B); i >=  0; i--) {
    if (A % i == 0 && B % i == 0) {
      ct++;
    }
    if (ct == K) {
      ans = i;
      break;
    }
  }
  
  cout << ans << endl;

  return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n,k;
    cin >> n >> k;
    vector<double> sums(n+1,0);
    for (int i = 0;i < n;++i) {
        double a;cin >> a;
        sums[i+1] = (a+1)/2+sums[i];
    }
    double ans = 0;
    for (int i = 0;i < n-k+1;++i) ans = max(ans,sums[i+k]-sums[i]);
    cout << fixed << setprecision(9) << ans << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

char S[271828], T[271828];

char ST[256], TS[256];

int main(void) {
	int i;
	if (scanf("%271828s", S) != 1) return 1;
	if (scanf("%271828s", T) != 1) return 1;
	for (i = 0; S[i] != '\0'; i++) {
		int sidx = (unsigned char)S[i];
		int tidx = (unsigned char)T[i];
		if (T[i] == '\0') {
			puts("No");
			return 0;
		}
		if (ST[sidx] == 0) {
			ST[sidx] = T[i];
		} else {
			if (ST[sidx] != T[i]) {
				puts("No");
				return 0;
			}
		}
		if (TS[tidx] == 0) {
			TS[tidx] = S[i];
		} else {
			if (TS[tidx] != S[i]) {
				puts("No");
				return 0;
			}
		}
	}
	puts(T[i] == '\0' ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 512
#!/usr/bin/env pypy3

import itertools


L = 10 ** 16
SIGNS = [(1, 1), (1, -1), (-1, 1), (-1, -1)]


def enum_fifth_powers(limit=None):
    if limit is None:
        limit = L
    res = []
    for i in itertools.count():
        i5 = i * i * i * i * i
        if i5 > limit:
            return res
        else:
            res.append(i5)


def solve(x):
    pow_table = enum_fifth_powers()
    for sa, sb in SIGNS:
        for (a, a5), (b, b5) in itertools.product(enumerate(pow_table), repeat=2):
            if sa * a5 - sb * b5 == x:
                return sa * a, sb * b


def test():
    vs = enum_fifth_powers()
    # print(vs)
    print(len(vs))


def main():
    x = int(input())
    print(*solve(x))


if __name__ == "__main__":
    main()


Measured memory_bytes: 68024
ans = 0
R, G, B, N = gets.chomp.split.map(&:to_i)
(0..N).each do |r|
  (0..N).each do |g|
    rem = N - (R*r + G*g)
    if rem >= 0 and rem % B == 0
      ans += 1
    end
  end
end
puts ans

Measured memory_bytes: 1788
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <math.h>

#define MOD 1000000007
#define REP(i,n) for ((i)=0;i<(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define LL long long
#define ULL unsigned long long

int compare_ll(const void *a, const void *b){
	return *(ULL*)b - *(ULL*)a;
}



int main(void) {
	ULL data[3];

	scanf("%lld %lld %lld", &data[0], &data[1],&data[2]);

	qsort(data, 3, sizeof(ULL), compare_ll);

	if(data[0]%2==0){
		puts("0");
	}else{
		printf("%lld", data[1]*data[2]);
	}

	return 0;
}

/* 最後の改行忘れるな！！ */


Measured memory_bytes: 128
S = input()
ans = 0
for i in range(len(S)):
    for j in range(len(S), i, -1):
        trial = {x for x in S[i:j] if x not in 'ACGT'}
        if len(trial) == 0 and ans < len(S[i:j]):
            ans = len(S[i:j])
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define T() long long t;cin>>t;for(long long i=1;i<=t;i++)
#define INF (int)MAX_INT
#define INFS (int)MIN_INT
#define mod 1000000007
#define FOR(a, b, n) for(int a = b; a < n; a++)
#define REP(a,c, b) for(int a = c; a < b; a++)
#define FORD(a, b, c) for(int a = b; a >= c; a--)
#define REPD(a, c,b) for(int a = b-1; a >= c; a--)
#ifdef HOHOHO
#define DEBUG(x) cerr << #x << " : " << x << '\n'
#define DEBUGV(x) cerr << #x << " : { "; REP(_it, x.size()) cerr << x[_it] << ' '; cerr << "}" << '\n'
#define DEBUGA(x, y) cerr << #x << " : { "; REP(_it, y) cerr << x[_it] << ' '; cerr << "}" << '\n'
#define PRINTF(...) fprintf(stderr,__VA_ARGS__)
#define CHECKPOINT cerr << "OK LINE #" << __LINE__ << '\n'
#else
#define DEBUG(x) {}
#define DEBUGV(x) {}
#define DEBUGA(x, y) {}
#define PRINTF(...) {}
#define CHECKPOINT {}
#endif
#define RESET(a, b) memset(a, b, sizeof a)
#define EPS 1e-9
#define m_p make_pair
#define pb push_back
#define fi first
#define se second
#define RALL(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define ALL(x, y) x, x+y
#define SZ(x) ((int)x.size())
#define  pi(a)  pair<a, a> 
#define  vi(a)  vector<a> 
#define  vii(a) vector<pi(a)>
#define  vs vector<string>
template<class T> T sqr(T x){ return x*x; }
template<class T> T binPow(T p, int q, int MOD) {
    if(q == 1) return p % MOD;
    if(q & 1) return p*(binPow(p, q-1, MOD) % MOD) % MOD;
    else return sqr(binPow(p, q/2, MOD) % MOD) % MOD;
}
 
ll nxt() {
    ll temporaryVariable;
    cin >> temporaryVariable;
    return temporaryVariable;
}
const double PI = acos(-1.0);
#define MAXN 100001
const int G = 2e5 + 5;



int main(){
  ios::sync_with_stdio(false);
 
   int k;cin>>k;
   REP(i,0,k)
   cout<<"ACL";
  
    
    #ifdef HOHOHO
    fprintf(stderr, "%.3lf\n", clock() / (double) CLOCKS_PER_SEC );
#endif
}
 

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

#define MAX 4
int main(void)
{
	int n,i,j;
	char c;
	int num;
	unsigned short his[MAX] = {0};
	const char c1[MAX] = {'S','H','C','D'};

	cin >> n;
	for (i=0; i<n; i++) {
		cin >> c;
		cin >> num;

		switch (c) {
		case 'S':
			his[0] |= (1 << (num-1));
			break;
		case 'H':
			his[1] |= (1 << (num-1));
			break;
		case 'C':
			his[2] |= (1 << (num-1));
			break;
		case 'D':
			his[3] |= (1 << (num-1));
			break;
		default:
			break;
		}
	}
	for (i = 0; i < MAX; i++) {
		for (j = 0; j < 13; j++) {
			if ((his[i] & 1) == 0) {
				cout << c1[i] << " " << j+1 << endl;
			}
			his[i] >>= 1;
		}
	}
	return 0;
}


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  ll n;
  cin>>n;
  ll temp= sqrt(n);
  ll ans;
  for(int i=temp;i>=1;i--)
  {
      if(n%i==0)
      {
          ans=i;
          break;
      }
  }
   ll ans2=n/ans;
   ll f= ans-1 + ans2-1;
  cout<<f;
}


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

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

ans = 'APPROVED'

for i in range(0,N):
    if (A[i]%2)==0:
        if not ((A[i] % 3) == 0 or (A[i] % 5) == 0):
            ans = 'DENIED'
            break

print(ans)

Measured memory_bytes: 9172
#include<bits/stdc++.h>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

int main(){
  string a, b; cin >> a >> b;
  if(a == "H" && b == "H") cout << "H" << endl;
  else if (a == "D" && b == "D") cout << "H" << endl;
  else cout << "D" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template <class T> inline bool chmax(T &a, T b) {if(a < b) {a= b;return 1;}return 0;}
template <class T> inline bool chmin(T &a, T b) {if(a > b) {a= b;return 1;}return 0;}
ll mod= 1e9 + 7;


int main(){
  int a,b,c;
  cin >> a >>b >> c;
  cout << a+b+c-max({a,b,c}) << endl;
}

Measured memory_bytes: 3584
//#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
//#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
//#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
#define WAIT system ("pause")
#define rt0 return 0
using namespace std;
int main()
{
    string a[3];
    int i;
    for(i=0;i<3;i++) cin>>a[i];
    cout<<a[0][0]<<a[1][1]<<a[2][2];
    WAIT;
    rt0;
}


Measured memory_bytes: 504
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] p=new int[100001];
		for(int i=0; i<n; i++){
			int a=sc.nextInt();
			p[a]++;
			p[a+1]++;
			if(a!=0){
				p[a-1]++;
			}
		}
		Arrays.sort(p);
		System.out.println(p[100000]);
	}
}


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

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            //ここから

            string ans = "No";
            var N = IO.ReadLineToInt();
            for(int i = 1; i < 10; i++)
            {
                for(int j = 1; j < 10; j++)
                {
                    if (i * j == N) ans = "Yes";
                }
            }

            //ここまで
            Console.WriteLine(ans);
            Console.ReadKey();
        }

        public static double ToAngle(this double radian)
        {
            return (double)(radian * 180 / Math.PI);
        }

        public static double ToRadian(this double angle)
        {
            return (double)(angle * Math.PI / 180);
        }
    }

    static class Func
    {
        static long mod = 1000000007;
        static public void Swap<T>(ref T a, ref T b) { T temp = a; a = b; b = temp; }
        static public long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }
        static public long LCM(long a, long b) { return (long)a * b / GCD(a, b); }
        static public int Factorial(int a) { return a == 1 ? a : a * Factorial(a - 1); }

        static public long Conbination(int n,int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * Conbination(n - 1, m - 1) / m;
        }

        static public void Factoring(long num, ref long[] vs)
        {
            if (num == 1)
            {
                vs[1]++;
            }
            for (long i = 2; i < (long)Math.Sqrt(num); i++)
            {
                if (num % i == 0)
                {
                    vs[i]++;
                    Factoring(num / i, ref vs);
                }
            }
            vs[1]++;
        }
    }

    static class IO
    {
        static public string ReadLineToString() { return Console.ReadLine(); }
        static public int ReadLineToInt() { return int.Parse(Console.ReadLine()); }
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> ReadLineToStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> ReadLineToIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }

        static public void WriteStrings(object[] strings) { foreach (var o in strings) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 13140
N = int(input())
An = [int(n) for n in input().split()]
M = sorted(set(An))
mini=M[0]
            
while len(M) > 1:
    M = [mini] + [x%mini for x in M[1:] if x % mini != 0]
    M.sort()
    if 1 in M:
        mini=1
        break
    mini = min(mini,M[0])
print(M[0])


Measured memory_bytes: 14252
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define file_input
//#define multitest
//#define measure_time
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<v32>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
#define debug(x) cerr << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>
void print_container(const ContainerType<ValueType, Args...> &c)
{
	cout << "{ ";
	for (const auto &v : c)
		cout << v << ' ';
	cout << '}' << ln;
}
 
const int N = 2e5 + 5;
ll dp[N][2];
 
void solve()
{
	int n;
	cin >> n;
	v64 arr(n + 1, 0);
	for (int i = 1; i < n + 1; i++)
		cin >> arr[i];
	memset(dp, 0, sizeof(dp));
	dp[2][1] = arr[2];
	dp[2][0] = arr[1];
	for (int i = 3; i < n + 1; i++)
	{
		if (i & 1)
		{
			ll temp = max({dp[i - 3][1], dp[i - 3][0], dp[i - 2][1], dp[i - 2][0]});
			dp[i][1] = arr[i] + temp;
			dp[i][0] = max({arr[i - 1] + dp[i - 2][0], arr[i - 1] + dp[i - 3][1], arr[i - 1] + dp[i - 3][0], arr[i - 2] + dp[i - 3][0]});
		}
		else
		{
			dp[i][1] = arr[i] + max({dp[i - 2][1], dp[i - 2][0], dp[i - 1][0]});
			dp[i][0] = arr[i - 1] + dp[i - 2][0];
		}
	}
	cout << max(dp[n][1], dp[n][0]) << ln;
	return;
}
 
int main()
{
	FASTIO;
#ifdef file_input
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	clock_t start, stop;
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
#ifdef measure_time
	start = clock();
#endif
	for (int tc = 1; tc < t + 1; tc++)
		solve();
#ifdef measure_time
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}

Measured memory_bytes: 7980
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
 	string s1, s2;
 	int flag = 0;
 	cin >> s1 >> s2; 
 	if ((int)s1.size() == (int)s2.size()) {
 		for (int i = 0; i < (int)s1.size();i++) {
 			if (s1[i] > s2[i]) {
 				cout << "GREATER";
 				flag = 1;
 				break;
 			}
 			else {
 				if (s1[i] < s2[i]){
 					cout <<"LESS";
 					flag = 1;
 					break;
 				}
 				
 			}
 		}
 		if (flag == 0)
 			cout << "EQUAL";
 	}
 	else{
 		if ((int)s1.size() > (int)s2.size())
 			cout <<"GREATER";
 		else
 			cout << "LESS";
 	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m; vector<int>edge[15];
double dp[(1<<14)],p;
int main(){
	cin >> n >> m >> p; p/=100.;
	for(int i=0;i<m;i++){
		int a,b; cin >> a >> b; a--; b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	for(int i=0;i<n;i++) dp[(1<<i)] = 1.0;
	for(int i=1;i<(1<<n);i+=2){
		if(__builtin_popcount(i) <= 1) continue;
		for(int j=i;j>=0;j--){
			j&=i;
			if(j==i||j%2==0) continue;
			double add = 1.0;
			for(int x=0;x<n;x++){
				if(!((j>>x)&1)) continue;
				for(int y=0;y<edge[x].size();y++){
					if(!((i>>edge[x][y])&1)) continue;
					if(((j>>edge[x][y])&1)) continue;
					add *= p;
				}
			}
			dp[i] += dp[j]*add;
		}
		dp[i] = 1.0-dp[i];
	}
	printf("%.12f\n",dp[(1<<n)-1]);
}

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

// 参考資料 : https://drken1215.hatenablog.com/entry/2020/04/25/032000  O( n*log(a) )
// xor は各桁で考えるのが定石 （二進数で考える）
// k 桁目の合計値が 1 増えるのは、k 桁目に(0, 1)の組み合わせのペアがあるとき
// 上記組み合わせは k 桁目が0の数をp個, k 桁目が1の数をq個, とすると pq 通りある
// 二進数のため、k 桁目の合計値が 1 増えるのは、2^k の増加に等しい

#define N_DIGIT_TWO 60
#define MOD 1000000007

int main(void){
    int n;
    long cntOne[N_DIGIT_TWO];
    cin >> n;
    for (int i = 0; i < N_DIGIT_TWO; i++){
        cntOne[i] = 0;
    }
    
    for (int i = 0; i < n; i++){
        long a;
        cin >> a;
        for (int j = 0; j < N_DIGIT_TWO; j++){
            cntOne[j] += (a>>j)&1;
        }
    }
    
    long ans = 0;
    long digit;
    for (int i = 0; i < N_DIGIT_TWO; i++){
        long pattern = cntOne[i] * ( n - cntOne[i] ) % MOD;
        if (i == 0){ digit = 1; }
        else { digit = digit * 2 % MOD; }
        ans = ( ans + ( digit * pattern % MOD ) ) % MOD;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3668
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    var N =int.Parse(Console.ReadLine());
    var zenbu = Console.ReadLine().Split();
    var a = new int [N];
    var b = new int [N];
    for(int k = 1;k<N;k++){
        a[k]= int.Parse(zenbu[k-1]);
    }
    for(int j =1;j<N;j++){b[a[j]]+=1;;}
    for(int i =1;i<N;i++){Console.WriteLine(b[i]);}
    Console.WriteLine("0");
  }
}

Measured memory_bytes: 39072
using System;

class Data
{
    public int count, sum, n;

    public Data(int count, int sum, int n)
    {
        this.count = count;
        this.sum = sum;
        this.n = n;
    }
}

class Program
{
    static void Main(string[] args)
    {
        var nabc = Console.ReadLine().Split(' ');
        var n = int.Parse(nabc[0]);
        var a = int.Parse(nabc[1]);
        var b = int.Parse(nabc[2]);
        var c = int.Parse(nabc[3]);

        var d = new int[n];
        for (int i = 0; i < n; i++)
        {
            d[i] = int.Parse(Console.ReadLine());
        }

        var datas = new Data[] {
            new Data(0, 0, 0),
            new Data(0, 0, a),
            new Data(0, 0, b),
            new Data(0, 0, c),
        };

        var ans = m1(d, 0, datas);
        Console.WriteLine(ans);
    }

    static int m1(int[] d, int n, Data[] datas)
    {
        if (d.Length <= n)
        {
            var sum = 0;
            for (int i = 1; i < datas.Length; i++)
            {
                if (datas[i].count == 0)
                {
                    return int.MaxValue;
                }

                sum += (datas[i].count - 1) * 10 + Math.Abs(datas[i].sum - datas[i].n);
            }
            return sum;
        }

        var min = int.MaxValue;
        for (int i = 0; i < datas.Length; i++)
        {
            datas[i].count++;
            datas[i].sum += d[n];
            min = Math.Min(min, m1(d, n + 1, datas));
            datas[i].count--;
            datas[i].sum -= d[n];
        }
        return min;
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
int main(){
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200)cout << s << endl;
    else cout << "red" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
int n, x;

int main() {
	cin >> n;
	int tmp = n, cnt = 0;
	while(tmp--) {
		cin >> x;
		if(!(x & 1)) cnt++;
	}
	if(cnt == n) puts("second");
	else puts("first");
}

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

int n;
vector<int>g[100002];
int color[100002];

void dfs(int r,int c);
void assigncolor();//割り当てる

int main(){
  int s,t,m,q;

  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>s>>t;
    g[s].push_back(t);
    g[t].push_back(s);
  }
  
  assigncolor();

  cin>>q;
  
  for(int i=0;i<q;i++){
    cin>>s>>t;
    if(color[s]==color[t])cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }

  return(0);
}

void assigncolor(){
  int id=1;
  for(int i=0;i<n;i++)color[i]=-1;
  for(int i=0;i<n;i++){
    if(color[i] == -1)dfs(i,id);
    id++;
  }
}

void dfs(int r,int c){
  stack<int>st;
  st.push(r);
  color[r]=c;
  while(!st.empty()){
    int u=st.top();
    st.pop();
    for(int i=0;i<g[u].size();i++){
      int v=g[u][i];
      if(color[v]==-1){
	color[v]=c;
	st.push(v);
      }
    }
  }
}

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

using namespace std;

int main()
{
    int A, B, K;
    vector<int> l;
    cin >> A;
    cin >> B;
    cin >> K;

    int i = 1;
    int count = 0;
    while (i <= 100) {
        if (A%i == 0 && B%i == 0) l.push_back(i);
        i++;
    }
    int len = l.size();
    cout << l[len-K];

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int N, X, Y, Z; cin >> N >> X >> Y >> Z;
  int l = X+Y+Z;
  ll num = 0;
  num += (1<<(X+Y+Z-1));
  num += (1<<(Y+Z-1));
  num += (1<<(Z-1));

  ll dp[N+1][1<<l] = {};
  rep(i,N+1) {
    if (i==0) dp[i][0] = 1;
    else {
      rep(j,1<<l) {
        repr(k,1,11) {
          ll now = ((j<<k)+(1<<(k-1)))%(1<<l);
          if ((num&now)!=num) {
            dp[i][now] = (dp[i][now]+dp[i-1][j])%MOD;
          }
        }
      }
    }
  }
  // rep(i,N+1) debug(dp[i],dp[i]+(1<<l));
  ll sum = 0; rep(i,(1<<l)) sum = (sum+dp[N][i])%MOD;
  ll result = 1; rep(i,N) result = (result*10)%MOD;
  result = (result-sum+MOD)%MOD;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 42240
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q[ohara], p[ohara],
    r[ohara];
ll dp[ohara];
pq que;

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

  cin >> x >> y >> a >> b >> c;
  rep(i, a) cin >> p[i];
  rep(i, b) cin >> q[i];
  rep(i, c) cin >> r[i];
  sort(p, p + a);
  reverse(p, p + a);
  sort(q, q + b);
  reverse(q, q + b);
  rep(i, x) dp[i] = p[i];
  rep(i, y) dp[i + x] = q[i];
  rep(i, c) que.push(r[i]);
  sort(dp, dp + x + y);

  rep(i, x + y) {
    ll moto = que.top();
    if (dp[i] < moto && !que.empty()) {
      ans += moto;
      que.pop();
    } else {
      ans += dp[i];
    }
  }
  Cout(ans);
  return 0;
}

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

int N;
vector<string> S(200);
vector<int> bw(200,0);
int dist[200][200];

int BFS(){
	queue<int> que;
	que.push(0);
	bw[0]=1;
	while(!que.empty()){
		int f=que.front();
		que.pop();
		for(int j=0;j<N;j++){
			if(S[f][j]=='1'){
				if(bw[f]==bw[j])return 0;
				if(bw[j]==0){
					bw[j]=bw[f]*-1;
					que.push(j);
				}
			}
		}
	}
	return 1;
}

int main(){
	cin >> N;
	for(int i=0;i<N;i++)cin >> S[i];
	
	if(BFS()==0){
		cout << "-1" << endl;
		return 0;
	}
	
	for(int i=0;i<N;i++)for(int j=0;j<N;j++){
		if(i==j)dist[i][j]=0;
		else if(S[i][j]=='1')dist[i][j]=1;
		else dist[i][j]=9999999;
	}
	
	for(int k=0;k<N;k++)for(int i=0;i<N;i++)for(int j=0;j<N;j++)dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
	
	int ans=0;
	for(int i=0;i<N;i++)for(int j=0;j<N;j++)if(dist[i][j]<9999999)ans=max(ans,dist[i][j]);
	cout << ans+1 << endl;
	
	return 0;
}

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

#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

vector<map<int,int>> children;
vector<int> parent, dist;

void build_tree(int root){
    int n = (int)children.size();
    parent  = vector<int>(n,-1);
    dist    = vector<int>(n,0);
    
    queue<int> q;
    q.push(root);
    
    while(!q.empty()){
        int i = q.front(); q.pop();
        for(auto p : children[i]){
            int to = p.first;
            children[to].erase(i);
            parent[to] = i;
            dist[to]   = dist[i] + p.second;
            q.push(to);
        }
    }
}

void add_node(int a, int b, int c){
    children[a][b] = c;
    children[b][a] = c;
}

signed main(){
    int n; cin >> n;
    children = vector<map<int,int>>(n);
    rep(i,n-1){
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        add_node(a, b, c);
    }
    
    int Q, K; cin >> Q >> K;
    build_tree(K-1);
    
    rep(query, Q){
        int x, y;
        cin >> x >> y;
        x--; y--;
        cout << dist[x] + dist[y] << endl;
    }
}

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


int main(){

    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;


    int money = 0;

    if( A + B > 2*C ){
        money += 2*C * min( X, Y );
        if( X > Y ){
            if( A > 2*C ) money += 2*C * (X - Y);
            else money += A * (X - Y);
        }else{
            if( B > 2*C ) money += 2*C * (Y - X);
            else money += B * (Y - X);
        }
    }else{
        money += A*X + B*Y;
    }

    cout << money << endl;

    return 0;

}

Measured memory_bytes: 256
A,B,C,D,E,F = map(int, input().split())
W = set()
for a in range(0,F+1,100*A):
  for b in range(0,F+1,100*B):
    W.add(a+b)
S = set()
for c in range(0,F+1,C):
  for d in range(0,F+1,D):
    S.add(c+d)
rate = -1
for w in W:
  for s in S:
    if 0 < w+s <= F and s*100 <= E*w:
      if s/(s+w) > rate:
        rate = s/(s+w)
        ans = w+s,s
print(ans[0],ans[1])

Measured memory_bytes: 3828