akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<double> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        a[i] = i;
    }
    double sum = 0, co = 0;
    do {
        for (int i = 1; i < n; i++) {
            sum += sqrt(pow(x[a[i]] - x[a[i - 1]], 2) +
                        pow(y[a[i]] - y[a[i - 1]], 2));
        }
        co += 1.0;
    } while (next_permutation(all(a)));
    sum /= co;
    cout << fixed << setprecision(10) << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int status[102][102];
char field[102][102];
void serch(int h,int w)
{
    if(status[h][w]==1)cout<<"LOOP"<<endl;
    else{
        status[h][w]++;
        if(field[h][w]=='>')serch(h,w+1);
        else if(field[h][w]=='<')serch(h,w-1);
        else if(field[h][w]=='v')serch(h+1,w);
        else if(field[h][w]=='^')serch(h-1,w);
        else cout<<w<<" "<<h<<endl;
    }
}
int main()
{
    int H,W;
    while(cin>>H>>W&&H!=0){
        for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                        status[i][j]=0;
                        cin>>field[i][j];
                }
        }
        serch(0,0);
    }
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    string s;
    cin >> s;

    bool ok = true;
    REP(i, 1, s.size()){
        if(s[i - 1] == s[i]){
            ok = false;
        }
    }

    if(ok){
        cout << "Good" << endl;
    }else{
        cout << "Bad" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a_b = [input() for i in range(n)]
min = 1000000001
max = -1
max_point = 0
for i in a_b:
    a, b = map(int, i.split())
    if(min > a):
        min = a
    if(max < a):
        max = a
        max_point = b

num = 0
num += min
num += max - min
num += max_point

print(num)


Measured memory_bytes: 11040
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
int n,a[500010],bit[22],ans;
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	int l=0,r=0;
	while(l<n&&r<n){
		rep(i,21){
			if((a[r]>>i)&1){
				if(bit[i]){
					rep(j,21){
						if((a[l]>>j)&1)bit[j]=0;
					}
					ans+=r-l;
					l++;
					goto sh;
				}
			}
		}
		rep(i,21){
			if((a[r]>>i)&1)bit[i]=1;
		}
		r++;
		sh:;
		if(r==n){
			int c=r-l;
			ans+=(1+c)*c/2;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

coin_count = [int(input()) for _ in range(3)]
X = int(input())

result = 0
for i in range(min(X//500, coin_count[0]) + 1):
    for j in range(min((X - 500*i)//100, coin_count[1]) + 1):
        if 500 * i + 100 * j + 50 * coin_count[2] >= X:
            result += 1
print(result)

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

#define ll long long int

int main(){
  long long int a,b,c,k,s=0;cin>>a>>b>>c>>k;
 if(k>0)
 {s=s+min(a,k);k=k-min(a,k);} 
 if(k>0)
 {s=s+(0*min(b,k));k=k-min(b,k);} 
if(k>0)
 {s=s+(-1*min(c,k));k=k-min(c,k);} 
cout<<s<<endl;  
  return 0;
}

Measured memory_bytes: 3632
# -*- coding: utf-8 -*-

def next_point(x1, y1, x2, y2):
    dx = x2 - x1
    dy = y2 - y1
    return x2 - dy, y2 + dx

def restore(x1, y1, x2, y2):
    x3, y3 = next_point(x1, y1, x2, y2)
    x4, y4 = next_point(x2, y2, x3, y3)
    return x3, y3, x4, y4

def main():
    x1, y1, x2, y2 = map(int, input().split())
    x3, y3, x4, y4 = restore(x1, y1, x2, y2)
    print(x3, y3, x4, y4)

main()


Measured memory_bytes: 3064
/*
*  author: mkbaloch
*  time:   2020-01-13 15:49:08
*/

#include<bits/stdc++.h>
#define vi vector<int>
#define ll long long
#define pi pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for(int i=a; i<=b; i++)
#define repn(i, n) for(int i=0; i<(int)n; i++)

using namespace std;

int main()
{
 int n;
 string s;
 cin >> n >> s;
 int ans = 0;
 for(int i = 0; i<n; i++){
  int found = s.find("ABC", i);
  if(found != string::npos)
  {
   ans++;
   i = found + 1;
  }
 }
 cout << ans << endl;
 return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np
from collections import deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

H, W = map(int, readline().split())
S = [list(readline().decode('utf-8').rstrip()) for _ in range(H)]


def adjacent_4(h, w):
    ret = []
    for (dh, dw) in [(0, 1), (1, 0), (0, -1), (-1, 0)]:
        h_ = h + dh
        w_ = w + dw

        if (0 <= h_) & (h_ < H) & (0 <= w_) & (w_ < W):
            ret.append((h_, w_))
    return ret


def bfs(S, h, w):

    visited = [[10**9] * W for _ in range(H)]
    visited[h][w] = 1

    que = deque()
    que.append((h, w))

    while len(que) != 0:
        h_, w_ = que.popleft()
        acc = visited[h_][w_]

        for adj_h, adj_w in adjacent_4(h_, w_):
            if S[adj_h][adj_w] == '#':
                continue
            acc_ = acc + 1
            if acc_ >= visited[adj_h][adj_w]:
                continue
            visited[adj_h][adj_w] = acc_
            que.append((adj_h, adj_w))

    return max(visited[h][w] for h in range(H)
               for w in range(W) if visited[h][w] != 10**9) - 1


"""
ans = 0
for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            continue
        ans = max(ans, bfs(S, h, w))
"""
ans = max(bfs(S, h, w) for h in range(H) for w in range(W) if S[h][w] != '#')
print(int(ans))

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

using namespace std;

int main(void)
{
  int n,buff;
  vector<int> h;

  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> buff;
    h.push_back(buff);
  }

  int max = 0,_max = 0;

  for(int i = 0;i < n - 1;i++){
    if(h[i] >= h[i + 1]) _max++;
    else _max = 0;
    if(max < _max) max = _max;
  }

  cout << max << endl;

  return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define FOR(i,a,b) for (size_t i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (size_t i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define INF 1e7

int p1[5555], p2[5555];
vector<int> a, b;

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

  for (int i = 100; i > 0; i /= 10) {
    if (a / i % 10 == 1) b += 9 * i;
    else b += 1 * i;
  }
  cout<<b<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		boolean same = true;
		for(int i = 0; i < s.length; i++) {
			if(s[i] != s[s.length - 1 - i]){
				System.out.println("No");
				System.exit(0);
			}
		}
		for(int j = 0; j <= (s.length - 2) / 2; j++) {
			if(s[j] != s[(s.length - 2) / 2 - j]){
				System.out.println("No");
				System.exit(0);
			}
		}
		int count = 0;
		for(int a = (s.length + 2) / 2; a < s.length; a++){
		if(s[a] != s[(s.length - 2) / 2 - count]){
			System.out.println("No");
			System.exit(0);
		}
		count++;
	}
		System.out.println("Yes");
	}
}

Measured memory_bytes: 35568
main :: IO()
main = do
  _ <- getLine
  ai <- map read . words <$> getLine
  print $ slv (product ai) 32 0

slv :: Integer -> Integer -> Integer -> Integer
slv n 0 ret = ret
slv n m ret | n `mod` 2^m == 0 = slv (n `div` 2^m) m (ret + m)
            | otherwise = slv n (m-1) ret

Measured memory_bytes: 8572
#include<iostream> 
#include<string> // for string class
#include <math.h> 
#include<bits/stdc++.h> 
using namespace std; 
int main() 
{
	string a, b;
	int a1,b1;
	string c;
	cin>> a>>b;
	cin>>a1>>b1;
	cin>>c;
     if(a.compare(c)==0)a1--;
     else if(b.compare(c)==0)b1--;
     cout<<a1<<" "<<b1;
     

 return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
typedef long long LL;

int main()
{
    int n;
    cin>>n;
    int m;
    cin>>m;
    while(m--)
    {
        int x;
        cin>>x;
        n-=x;
    }
    cout<<max(-1,n);




    int ab;
    cin>>ab;
    return 0;
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <algorithm>

using namespace std;
using ll = long long;
void solve();
int main() {
	solve();
#ifdef DBG
	while (true);
#endif
}

void solve() {
	ll n, A[200000], B[200000];
	scanf("%lld", &n);
	ll less = 0, lead = 0, equal = 0, greate = 0, min_g = 1e9;
	for (int i = 0; i < n; i++) {
		scanf("%lld %lld", A + i, B + i);
		if (A[i] < B[i])
			less += A[i], lead += B[i] - A[i];
		else if (A[i] > B[i])
			greate += A[i], min_g = min(min_g, B[i]);
		else
			equal += A[i];
	}
	ll total = less;
	if (lead != 0)
		total += equal;
	if (lead != 0)
		total += greate - min_g;
	printf("%lld\n", total);
}

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

int N;
int A[100001];

void solve() {
    int count = 0;
    for (int i = 1; i <= N; i++) {
        int val = A[i];
        if (A[val] == i) {
            count++;
        }
    }
    std::cout << (int) count / 2 << std::endl;
}

int main() {
    std::cin >> N;
    for (int i = 1; i <= N; i++) {
        std::cin >> A[i];
    }
    solve();
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#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 pb push_back
#define all(v) (v).begin(), (v).end()
#define P pair<int, int>
#define V vector<int>
#define M map<int, int>
#define S set<int>
#define itn int
#define tin int
#define tni int
bool dbg = false;
bool ans = true;
int N, H[100010];
void solve()
{
}

signed main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(i, 0, N)
    cin >> H[i];
    FOR(i, 1, N)
    {
        if (H[i] < H[i - 1]) {
            cout << "No" << endl;
            return 0;
        } else if (H[i] > H[i - 1])
            H[i]--;
    }
    cout << "Yes" << endl;
    solve();
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()

int main(){
    int n,i,ans=0;
    string a,b,c;
    cin>>n>>a>>b>>c;
    for(i=0;i<n;i++){
        if(a[i]!=b[i] && b[i]!=c[i] && c[i]!=a[i]){
            ans+=2;
        }else if(a[i]==b[i] && b[i]==c[i]){
            ans+=0;
        }else if((a[i]==b[i] && a[i]!=c[i]) || (b[i]==c[i] && b[i]!=a[i]) || (c[i]==a[i] and c[i]!=b[i])){
            ans+=1;
        }
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<cstring>

using namespace std;

#ifdef LDEBUG
#define debug(x) cout << #x << ":" << x << endl
#else
#define debug(...)
#endif

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

typedef unsigned long long u64;
typedef long long i64;

int n, k;
string s;

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

        cin >> n >> k >> s;

        s[k-1] = (char)s[k-1] - ('A' - 'a');

        cout << s << endl;


        return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

ans = 1
flag = False
A.sort()
for i in range(N):
  ans *= A[i]
  if(ans>1000000000000000000):
    flag = True
    break

if(flag):
  print(-1)
else:
  print(ans)


Measured memory_bytes: 21636
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c; cin>>a>>b>>c;
    int ans = 1e9;
    ans= min(ans, a+b);
    ans= min(ans, a+c);
    ans= min(ans, b+c);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramA
    {
        static void Main(string[] args)
        {
            var a = long.Parse(Console.ReadLine());
            var list = a.ToString().ToCharArray().Reverse();
            var rs = "";
            foreach (var c in list)
            {
                rs += c.ToString();
            }
            var ra = int.Parse(rs);

            Console.WriteLine(a == ra ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 28136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int N, M; cin >> N >> M;
    vector<bool> ok1(N+1, false), ok2(N+1, false);

    for(int i=0; i<M; i++){
        int a, b; cin >> a >> b;
        if(a == 1) ok1[b] = true;
        if(b == N) ok2[a] = true;
    }

    bool flg = false;
    for(int i=2; i<N; i++) if(ok1[i] && ok2[i]) flg = true;

    if(flg) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{

    long long x,y;
    cin>>x;
    y=x;
    int lose=0;
    int ans=0;
    int first;
    while(y)
    {
        int w=y%10;
        if(w==9)
            lose++;
        ans++;
        if(y/10==0)
            first=w;
        y=y/10;
    }

    if(!(lose+(first!=9?1:0)==ans))
    {
        ans=(ans-1)*9+first-1;
    }
    else
    {
        ans=(ans-1)*9+first;
    }

    cout<<ans<<endl;


    //cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define SREP(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)

//printf
#define PRINTD(d) printf("%d\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9

typedef long long ll;
int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int a, int b) {
	return (a) > (b) ? (a) : (b);
}

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	int cnt = 0;
	SREP(i, a, b + 1) {
		if (i / 10000 == i % 10 && i / 1000 % 10 == i / 10 % 10)cnt++;
	}
	PRINTD(cnt);
}

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

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

    map<int, int> A;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        A[tmp]++;
    }

    if (A.size() == 0) {
        cout << 0 << endl;
        return 0;
    }

    vector<bool> dp(A.rbegin()->first + 1, true);

    for (auto num : A) {
        int count = 2;
        while (count * num.first < dp.size()) {
            dp[count * num.first] = false;
            count++;
        }
    }

    int output = 0;
    for (auto num : A) {
        if (dp[num.first] && num.second == 1) {
            output++;
        }
    }

    cout << output << endl;

    return 0;
}


Measured memory_bytes: 13020
#include<iostream>
#include<string>
using namespace std;
int a;
int main() {
	string s;
	cin >> s;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'o') {
			a++;
		}
	}
	cout << 700 + a * 100 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<map>
#include<deque>
#include<numeric>
#include<algorithm>
#include<unordered_map>
#include<cmath>

using namespace std;
using ll = long long int;
constexpr int INF = 1 << 29;
constexpr ll MOD = ll(1e9 + 7);

bool is_prime(ll n) {
	if (n < 2)
		return false;
	else if (n == 2)
		return true;
	else if (n % 2 == 0)
		return false;
	else {
		for (ll i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

ll gcd(ll a, ll b) {
	ll x = max(a, b);
	ll y = min(a, b);
	while (x % y != 0) {
		ll tmp = x;
		x = y;
		y = tmp % y;
	}
	return y;
}

ll prime_factor_num(ll n) {
	ll ret = 0;
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			ret++;
			while (n % i == 0)
				n /= i;
		}
	}
	if (n != 1)
		ret++;
	return ret;
}

int main(void) {
	ll a, b;
	cin >> a >> b;
	ll GCD = gcd(a, b);
	cout << prime_factor_num(GCD) + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  double w;

  while(cin >> w) {
    if(w > 91) cout << "heavy" <<endl;
    else if(w > 81) cout << "light heavy" << endl;
    else if(w > 75) cout << "middle" << endl;
    else if(w > 69) cout << "light middle" << endl;
    else if(w > 64) cout << "welter" << endl;
    else if(w > 60) cout << "light welter" << endl;
    else if(w > 57) cout << "light" << endl;
    else if(w > 54) cout << "feather" << endl;
    else if(w > 51) cout << "bantam" << endl;
    else if(w > 48) cout << "fly" << endl;
    else cout << "light fly" << endl;
  }
}

Measured memory_bytes: 1220
import Data.List
main=do
 n<-getLine;a<-map read.words<$>getLine
 putStrLn$unwords(h(g [f x|x<-a]))
  where f x | x<400  ='a'
            | x<800  ='t'
            | x<1200 ='l'
            | x<1600 ='w'
            | x<2000 ='s'
            | x<2400 ='g'
            | x<2800 ='o'
            | x<3200 ='c'
            |otherwise = 'f'
        g s =[(length(nub (filter(/='f')s))),(length(filter(=='f')s))]
        h l = if l!!0==0 then "1":[show (l!!1)] else [show(l!!0),show(sum l)]

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll bin_pow(ll a,ll b,ll m)
{
    ll res=1;
    a%=m;
    while(b>0)
    {
        if(b&1)
            res=res*a%m;
        b>>=1;
        a=a*a%m;
    }
    return res;
}
bool miller_rabin(ll d,ll n)
{
    ll a=2+rand()%(n-4);
    ll x=bin_pow(a,d,n);
    if(x==1 || x==n-1)
        return true;
    while(d!=n-1)
    {
        x=(x*x)%n;
        d*=2;
        if(x==1)
            return false;
        if(x==n-1)
            return true;
    }
    return false;
}
bool prime(ll n,ll k)
{
    if(n==1 || n==4)
        return false;
    if(n<=3)
        return true;
    ll d=n-1;
    while(d%2==0)
        d/=2;
    for(int i=0; i<k; i++)
    {
        if(!miller_rabin(d,n))
            return false;
    }
    return true;
}
int n;
string s;
ll ans = 0;

void solve(ll x,ll y){
    if(x==n+1){
        ans += y;
        return;
    }
    ll cur = 0;
    for(ll i=x;i<=n;i++){
        cur = (10*cur) + (s[i]-'0');
        solve(i+1,y+cur);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int cnt[100005]={0};
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        cnt[x]++;
    }
    int mx=0;
    for(int i=0;i<=100000;i++)mx=max(mx,cnt[i]+cnt[i+1]+cnt[i+2]);
    cout<<mx<<endl;
}


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

int main() {
  int k, s;
  cin >> k >> s;
  int count = 0;
  for (int x = 0; x <= min(k, s); x++) {
    for (int y = 0; y <= min(k, s-x); y++) {
      if (s-x-y <= k) count++;
    }
  }
  cout << count << endl;
}

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

using namespace std;

typedef long long ll;
#define SWAP(x,y,z) {if ( y > z ) swap(y,z); if ( x > y ) swap(x,y); if (y > z) swap(y,z);}

int a[105];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n,m;
    int sum = 0;
    cin >> n;
    for ( int i = 1; i <= n; i++ )
    {
        cin >> a[i];
        sum += a[i];
    }
    cin >> m;
    for ( int i = 1; i <= m; i++ )
    {
        int x,y,temp;
        cin >> x >> y;
        temp = sum - (a[x]-y);
        cout << temp << endl;
    }

    return 0;
    // 274751WM
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
int n,a[100005];
inline void Swap(int &x,int &y){
	int t=x;
	x=y;
	y=t;
}
int main(){
	scanf("%d",&n);
	int xb,x2,cnt=0;
	for(xb=0;xb<n;xb++){
		scanf("%d",a+xb);
		a[xb]--;
	}
	for(xb=1;xb<n;xb++){
		if(a[xb-1]==xb-1 && a[xb]==xb){
			Swap(a[xb-1],a[xb]);
			cnt++;
		}
	}
	for(xb=0;xb<n;xb++){
		if(a[xb]==xb){
			if(xb==0){
				Swap(a[xb],a[xb+1]);
			}
			else if(xb==n-1){
				Swap(a[xb],a[xb-1]);
			}
			else Swap(a[xb],a[xb+1]);
			cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define FOR(i,a) for (int i=0;i<(a);++i)
#define FORD(i,a) for (int i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (int i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (int i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define all(v) v.begin(),v.end()
#define make_unique(v) v.erase(unique(all(v),v.end()))
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define dbg(x);
#define dbgv(v);
#define srng mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define y1 EsiHancagorcRepa
#ifdef ALEXPC
#define dbg(x); cout<<#x<<" = "<<x<<endl
#define dbgv(v); cout<<#v<<" = ["; trav(tv,v)cout<<"tv,";cout<<"]"<<endl
#endif

//const int N=100,M=N*N;
const ll MOD=1000*1000*1000+7;

const int N=1e6+6;


int main(){
    fastio;
    srng;
    string s;
    cin>>s;
    FOR(i,s.length()-1){
        if (s[i]==s[i+1]){
            cout<<"Bad"<<endl;
            return 0;
        }
    }
    cout<<"Good"<<endl;
    return 0;
}


Measured memory_bytes: 764
#!/usr/bin/env ruby

result = []
numbers = []

loop do
    temp = 0
    numbers = gets.split.map(&:to_i)
    if numbers[0] == 0 and numbers[1] == 0 then
        break
    end
    1.upto(numbers[0]) do |index1|
        (index1+1).upto(numbers[0]) do |index2|
            (index2+1).upto(numbers[0]) do |index3|
                if index1 + index2 + index3 == numbers[1] then
                    temp += 1
                end
            end
        end
    end
    result << temp
end
puts result


Measured memory_bytes: 6872
#include <stdio.h>
#include <stdlib.h>

int compare(int *a, int *b){
	return *a - *b;
}

int main(void){

	int Sides[3];

	int Num, i;
	scanf("%d", &Num);
	
	for(i = 0; i < Num; i++){
		scanf("%d %d %d", &Sides[0], &Sides[1], &Sides[2]);
		qsort(Sides,3,sizeof(int),(void *)compare);
	
		if(Sides[0]*Sides[0]+Sides[1]*Sides[1]==Sides[2]*Sides[2])
			printf("YES\n");
		else
			printf("NO\n");
	}

	return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

ll gcm(ll a,ll b);

int main(){
  int n,k;
  cin >> n >> k;
  int ans = 1;
  if(n-k >= 0){
    if((n - k) % (k-1) == 0) cout << ans + ((n - k) / (k-1)) << endl;
    else cout << ans + ((n - k) / (k-1)) + 1 << endl;
  }
  else{
    cout << ans << endl;
  }
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
using str=string;
typedef pair<int,int> P;
typedef vector<int> vi;

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

ll lcm(ll a,ll b){
    return (a*b/gcd(a,b));
}

const int MAX_N=100000;



int main(){
    int n;
    pair<int,int> a[MAX_N];
    cin >> n;
    rep(i,n){
        cin >> a[i].first;
        a[i].second=i;
    }
    sort(a,a+n);
    rep(i,n){
        cout << a[i].second+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 1536
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  ll x;
  cin >> x;
  ll t = 1;
  ll res = 100;
  while (true) {
    res *= 1.01;
    if (x <= res) {
      cout << t << endl;
      return 0;
    }
    t++;
  }
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <queue>
const int INF=1000000;
using namespace std;

int h,w,d[55][55];
char maze[55][55];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};  //4个方向移动的向量

typedef pair<int,int> p;
int bfs()
{
    for(int i=0;i<55;i++)
        for(int j=0;j<55;j++)
            d[i][j]=INF;
    d[1][1]=1;
    queue<p> Q;
    Q.push(p(1,1));
    while(!Q.empty())
    {
        p po=Q.front();
        Q.pop();
        if(po.first==h&&po.second==w)
            break;
        for(int i=0;i<4;i++)
        {
            int nx=po.first+dx[i];
            int ny=po.second+dy[i];
            if(nx>0&&nx<=h&&ny>0&&ny<=w&&d[nx][ny]==INF&&maze[nx][ny]!='#')//不超过边界，未被访问，且可移动
            {
                d[nx][ny]=d[po.first][po.second]+1;
                Q.push(p(nx,ny));
            }
        }
    }
    return d[h][w];
}
int main()
{
    int ans,cnt=0;
    cin >> h >> w;
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++)
        {
             cin >> maze[i][j];
             if(maze[i][j]=='.')
                cnt++;
        }
    ans=bfs();
    if(ans==INF)
        cout << -1 << endl;
    else
        cout << cnt-ans << endl;
    return 0;
}


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

int main() {
  int64_t N;
  cin >> N;
  vector<int64_t> vec(N+1);
  vec.at(0)=2;
  vec.at(1)=1;
  for(int i=2;i<vec.size();i++){
    vec.at(i)=vec.at(i-1)+vec.at(i-2);
  }
  cout << vec.at(N) << endl;
}

Measured memory_bytes: 3572
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    k = int(input().strip())
    S = input().strip()
    if len(S) <= k:
        print(S)
    else:
        print(S[0:k]+"...")


if __name__ == '__main__':
    main()

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

int main (void) {
  ios::sync_with_stdio(false);cin.tie(0);
  int n; cin >> n;
  string vs[] = {"AC", "WA", "TLE", "RE"};
  map<string, int> verdicts;
  for (int i = 0; i < n; i++) {
    string s; cin >> s;
    verdicts[s]++;
  }
  for (const string s : vs)
    cout << s << " x " << verdicts[s] << '\n';
  return 0;
}



Measured memory_bytes: 3656
#include<stdio.h>

int main(){
  char s[100010];

  scanf("%s", s);

  int one[2] = {}, zero[2] = {};

  int i = 0;

  while(s[i] == 48 || s[i] == 49){
    if(i % 2 == 0 && s[i] == 48) zero[0]++;
    else if(i % 2 == 0 && s[i] == 49) one[0]++;
    else if(s[i] == 48) zero[1]++;
    else if(s[i] == 49) one[1]++;

    i++;
  }

  int ans = 0;

  ans = zero[0] + one[1];
  
  if(ans > zero[1] + one[0]) ans = zero[1] + one[0];

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <math.h>

using namespace std;


int main () {
	int nquery;
	cin >> nquery;
	long long A, B;
	int count = 0;
	for(int i = 0; i < nquery; i ++){
		count = 0;
		cin >> A >> B;
		unsigned long long product = A*B;
		if (A < B) {
			int temp = A;
			A = B;
			B = temp;
		}
		if (A == B) cout << 2 * (A-1);
		else if (A == B+1){
			long long C = floor( sqrt(product));
			if (C*C == product) cout << A-1+B-1-1;
			else cout << A-1+B-1-1;
		}
		else {
			long long C = floor( sqrt(product));
			if (C*C == product) cout << 2*C-3;
			else if ((C*(C+1)) < product) cout << 2*C-1;
			else cout << 2*C-2;		
		}
		cout << endl;
	}

	return 0;
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a,b,k;
    cin >> a >> b >> k;  
    if(k<=a){
        cout << a-k << " ";
        cout << b<< endl;
    }else if(a+b>=k){
        cout << 0 << " ";
        cout << a+b-k << endl;
    }else{
        cout << 0 << " ";
        cout << 0 << endl;
    }
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9 + 7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) begin(a), end(a)

int main(void) {
    int N, K;
    cin >> N >> K;
    vector<ll> a(N);
    REP(i, N) cin >> a[i];
    ll ans = INF;
    REP(i, 1 << N) {
        vector<bool> b(N);
        ll num = 0;
        REP(j, N) {
            b[j] = (i >> j) & 1;
            if (b[j]) num++;
        }
        if (num < K) continue;
        ll cost = 0;
        ll highest = 0;
        REP(j, N) {
            if (b[j]) {
                if (a[j] <= highest) {
                    cost += highest - a[j] + 1;
                    highest++;
                }
            }
            if (a[j] > highest) highest = a[j];
        }
        ans = min(cost, ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
const int oo = 1e6;
bool sortbysec(const pair<int, int>& a,
	const pair<int, int>& b)
{
	return (a.second < b.second);
}
int main() {
	string a, b;
	cin >> a >> b;
	int lena = a.length(), lenb = b.length();
	int ans;
	if (lena > lenb) ans = 1;
	else if (lena < lenb) ans = -1;
	else {
		for (int i = 0; i < lena; i++) {
			if (a[i] > b[i]){ ans = 1; break;}
			else if (a[i] < b[i]) { ans = -1; break; }
			else { ans = 0; break; }
		}
	}
	if (ans == 1)cout << "GREATER \n";
	else if (ans == -1) cout << "LESS \n";
	else cout << "EQUAL \n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = true;
}  // namespace mydef
using namespace mydef;
#define pb push_back
//#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans


void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N, ans = 0;
    cin >> N;
    vi a(N * 3);
    for (int i = 0; i < N * 3; i++) {
        cin >> a[i];
    }
    sort(all(a));
    for (int i = 0; i < N; i++) {
        ans += a[N + i * 2];
    }
    cout << ans << endl;

    solve();
    return 0;
}


Measured memory_bytes: 5576
def main():
    n = int(input())
    tab = [1000000] + list(map(int,input().split()))
    cost = [0] * (n+1)
    for x in range(2,n+1):
        a = abs(tab[x]-tab[x-1])
        b = abs(tab[x]-tab[x-2])
        cost[x] += min(a+cost[x-1], b + cost[x-2])
    print(cost[n])

main()




Measured memory_bytes: 13976
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    //i縦j横
    int bingo[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> bingo[i][j];
        }
    }
    
    int N,a;
    cin >> N;
    for(int k=0;k<N;k++){
        cin >> a;
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(bingo[i][j] == a){
                    bingo[i][j] = 0;
                }
            }
        }
    }
    
    //条件確認
    //横
    if(bingo[0][0]+bingo[0][1]+bingo[0][2]==0){
        printf("Yes");
        return 0;
    }
    if(bingo[1][0]+bingo[1][1]+bingo[1][2]==0){
        printf("Yes");
        return 0;
    }
    if(bingo[2][0]+bingo[2][1]+bingo[2][2]==0){
        printf("Yes");
        return 0;
    }
    //縦
    if(bingo[0][0]+bingo[1][0]+bingo[2][0]==0){
        printf("Yes");
        return 0;
    }
    if(bingo[0][1]+bingo[1][1]+bingo[2][1]==0){
        printf("Yes");
        return 0;
    }
    if(bingo[0][2]+bingo[1][2]+bingo[2][2]==0){
        printf("Yes");
        return 0;
    }
    //ななめ
    if(bingo[0][0]+bingo[1][1]+bingo[2][2]==0){
        printf("Yes");
        return 0;
    }
    if(bingo[0][2]+bingo[1][1]+bingo[2][0]==0){
        printf("Yes");
        return 0;
    }
    
    printf("No");
    return 0;
   
}


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

NUM = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
INF = 10**14

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

dp = [-INF]*(N+1)
dp[0] = 0
for i in range(N):
    for a in A:
        c = NUM[a]
        if i + c <= N:
            dp[i+c] = max(dp[i+c], dp[i]+1)

D = dp[N]
ind = N
ans = ''
for _ in range(D):
    for a in A:
        c = NUM[a]
        if ind - c < 0: continue
        if dp[ind] == dp[ind-c] + 1:
            ind -= c
            ans += str(a)
            break
print(ans)

Measured memory_bytes: 3388
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    int a=0,b=0,c=0,d=0;
    rep(i,n) {
        string s;
        cin >> s;
        if (s=="AC") a++;
        if (s=="WA") b++;
        if (s=="TLE") c++;
        if (s=="RE") d++;
    }
    cout << "AC x " << a << endl;
    cout << "WA x " << b << endl;
    cout << "TLE x " << c << endl;
    cout << "RE x " << d << endl;
}

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

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

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  string s;
  cin>>N>>s;

  int r=0;
  int b=0;
  for(auto it:s){
    if(it=='R')r++;
    if(it=='B')b++;
  }

  if(r>b)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

ll N, M;
ll P[MAX_N];
ll Y[MAX_N];
vector<ll> city[MAX_N];
map<string, pair<ll, ll> > ans;

static inline string make_key(ll pref, ll year) { return to_string(pref) + "-" + to_string(year); }

signed main()
{
    cin >> N >> M;
    REP(i, M) {
        cin >> P[i] >> Y[i];
        city[P[i]].push_back(Y[i]);
    }
    REP(i, N+1) {
        SORT(city[i]);
    }
    REP(i, N+1) {
        REP(j, city[i].size()) {
            ans[make_key(i, city[i][j])] = make_pair(i, j+1);
        }
    }
    REP(i, M) {
        pair<ll, ll> disp = ans[make_key(P[i], Y[i])];
        printf("%06lld%06lld\n", disp.first, disp.second);
    }
    return 0;
}


Measured memory_bytes: 20992
s=list(input())
t=list(input())
num=len(s)-len(t)
ans1=-1
for i in range(num+1):
    num1=0
    num2=num-i
    for j in range(len(t)):
        if s[num2+j]!=t[j] and s[num2+j]!="?":
            num1=1
            break
    if num1==0:
        ans1=num2
        break
if ans1==-1:
    print("UNRESTORABLE")
else:
    ans=""
    for i in range(len(t)):
        s[ans1+i]=t[i]
    for i in range(len(s)):
        if s[i]=="?":
            s[i]="a"
        ans+=s[i]
    print(ans)


Measured memory_bytes: 9160
import math
a, b, x = map(int, input().split())
x /= a


def is_ok(theta):
    if math.tan(theta) * b < a:
        return x <= math.tan(theta) * b * b / 2
    else:
        p = a/math.tan(theta)
        return x <= a*p/2+a*(b-p)


def bisect(ng, ok):
    while (abs(ok - ng) > 1e-9):
        mid = (ok + ng) / 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok


ans = bisect(0, math.pi)
ans = 90- ans * 180 / math.pi
print(ans)


Measured memory_bytes: 62356
#include<iostream>

using namespace std;

int main(){
	
	int n,m;
	cin>>n>>m;
	for(int i=m-n+1;i<=m;i++)
	{
		cout<<i;
		if(i!=m)
		cout<<" ";
	}
		for(int i=m+1;i<=m+n-1;i++)
	{
		if(i==m+1)
		cout<<" ";
		cout<<i;
		if(i!=m+n-1)
		cout<<" ";
	}
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int k = scan.nextInt();
    int [] ls = new int[n];
    for (int i = 0; i < k; i++){
      int d = scan.nextInt();
      for (int j = 0; j < d; j++){
        int a = scan.nextInt();
        ls[a-1]++;
      }
    }
    int ans = 0;
    for (int i = 0; i < n; i++){
      if (ls[i] == 0){
        ans++;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 46132
from sys import stdin
n = int(stdin.readline())
a,b,c = [],[],[]
for _ in range(n):
    A,B,C = map(int,stdin.readline().split())
    a.append(A)
    b.append(B)
    c.append(C)
dpa,dpb,dpc = [a[0]],[b[0]],[c[0]]
for i in range(1,n):
    dpa.append(a[i]+max(dpb[i-1],dpc[i-1]))
    dpb.append(b[i]+max(dpa[i-1],dpc[i-1]))
    dpc.append(c[i]+max(dpb[i-1],dpa[i-1]))
print(max(dpa[-1],dpb[-1],dpc[-1]))


Measured memory_bytes: 101556
a,b,c,d = map(int,input().split())
turn = 0
while 1:
	if turn == 0:
		if a <= 0:
			print('No')
			exit()
		c-= b
		turn ^=1
	else:
		if c <= 0:
			print('Yes')
			exit()
		a-= d
		turn ^=1


Measured memory_bytes: 9036
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;

void main() {
    int[] input = readln.split.to!(int[]);
    int N = input[0];
    int M = input[1];
    int[] A = new int[N];
    int[] count = new int[N];
    foreach(int i; 0..N) {
        A[i] = readln.chomp.to!int;
    }
    foreach(int i; 0..M) {
        int B = readln.chomp.to!int;
        foreach(int j; 0..N) {
            if (A[j] <= B) {
                count[j]++;
                break;
            }
        }
    }
    int[] index = N.iota.map!(a=>a+1).array;
    sort!("a[0]>b[0]")(zip(count, index));
    index[0].writeln;
}

Measured memory_bytes: 2584
#include <cstdio>

using namespace std;
int i,n,a[30];
long long r;
char x,s[200004];
int main()
{
    scanf ("%c", &x);
    n=0;
    while (x!='\n')
    {
        s[n]=x;
        n++;
        scanf ("%c", &x);
    }
    for (i=0;i<=(n-1);i++)
        a[s[i]-'a']++;
    r=(1LL)+(1LL)*n*(n-1)/2;
    for (i=0;i<=25;i++)
        r=(0LL)+r-(1LL)*a[i]*(a[i]-1)/2;
    printf ("%lld\n", r);
    return 0;
}


Measured memory_bytes: 384
# PROBLEM C
from collections import Counter
from itertools import combinations

n = int(input())
ss = [input() for _ in range(n)]

fl2c = Counter(s[0] for s in ss if s[0] in 'MARCH')
res = 0
for a, b, c in combinations(fl2c, 3):
    res += fl2c[a] * fl2c[b] * fl2c[c]
print(res)

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

int main()
{
  int K, S;
  cin >> K >> S;

  int X, Y, Z, cnt=0;
  for (X = 0; X <= K; X++) {
    for (Y = 0; Y <= K; Y++) {
      Z = S - X - Y;
      if (0 <= Z && Z <= K) cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n=ni()
d,x=nm()

cnt=0
for i in range(n):
  a = ni()
  for j in range(1,d+1,a):
    cnt+=1

print(cnt+x)


Measured memory_bytes: 73812
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>
#include <math.h>
#define all(x) (x).begin(), (x).end()
#define xx first
#define yy second

using namespace std;

using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;

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

	i64 asum = 0;
	i64 dfsum = 0;

	vector<int> a(n), b(n);
	int bsmall = 0;	
	int minb = 1987654321;

	for (int i = 0; i < n; i++)
	{
		scanf("%d %d", &a[i], &b[i]);

		if (a[i] <= b[i])
			asum += a[i];

		if (b[i] > a[i])
			dfsum += b[i] - a[i];
		
		if (a[i] > b[i])
		{
			bsmall++;
			minb = min(minb, b[i]);
		}
	}

	if (dfsum == 0)
	{
		printf("0\n");
		return 0;
	}

	// b[i] < a[i]인게 1개 뿐이면 그대로 끝
	if (bsmall == 1)
	{
		printf("%lld\n", asum + dfsum);
		return 0;
	}

	// bsmall이 2개 이상이면, a 입장에서는 하나씩 깎아나가면서 다 0으로 만드는게 이득
	// b < a 인 b중에 제일 작은거 하나 빼고 나머지 전체 합만큼 가능

	i64 bs = -minb;

	for (int i = 0; i < n; i++)
		bs += b[i];
	
	printf("%lld\n", bs);

	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	string s; cin >> s;

	ll cnt = 0;
	ll ans = 0;
	for (int i = 0;i < s.size();i++){
		if(s[i] == 'W'){
			ans += (i-0-cnt);
			cnt++;
		}
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 720