akhauriyash/Code-Regression huggingface dataset:
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
typedef pair<LL, LL> P;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define mp          make_pair
# define eb          emplace_back
# define FOR(i,a,b)  for(int i=(a);i<(b);i++)
# define RFOR(i,a,b) for(int i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

int a, b, c;


int main() {
	cin >> a >> b >> c;
	cout << (a + b >= c ? "Yes" : "No") << endl;
}

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

#define INF (2e9)
#define FOR(i, a, b) for (ll (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using namespace std;

template<class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

using ll = long long;
using ld = long double;

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<ll>;
using vvi = vc<vi>;

template<class T>
using va = valarray<T>;
using vad = va<ld>;
using vai = va<ll>;

using pii = pair<ll, ll>;

vi Read(ll n) {
    auto      v = vi(n);
    for (auto i = std::size_t(0); i < n; ++i) {
        cin >> v[i];
    }
    return v;
}

template<class T>
void DumpRow(const T& A) {
    for (const auto& value : A)
        cout << value << "\n";
}

template<class T>
void DumpColumn(const T& A) {
    auto isFirst = true;
    for (const auto& value : A) {
        if (isFirst) {
            cout << value;
            isFirst = false;
        } else {
            cout << " " << value;
        }

    }
    cout << endl;
}

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

    ll n;
    cin >> n;
    auto v = set<int>();

    REP(i, n) {
        int q, x;
        cin >> q >> x;
        if (q == 0) {
            v.insert(x);
            cout << v.size() << endl;
        } else {
            auto it = v.find(x);
            if (it != v.end()) cout << 1 << endl;
            else cout << 0 << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 12412
#include <bits/stdc++.h>
using namespace std;
int main(){

    string a, b; cin >> a >> b;
    if( a[0] == b[2] && a[2] == b[0] && a[1] == b[1] ){
        cout << "YES\n";
    }else{
        cout << "NO\n";
    }

}


Measured memory_bytes: 764
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		
		int list[] = new int[n];
		for(int i=0; i<list.length; i++){
			list[i] = sc.nextInt();
		}

		int maxhigh = list[0];
		int count = 1;
		for(int j=1; j<list.length; j++){
			if(maxhigh <= list[j]){
				count++;
				maxhigh = list[j];
			}
		}

		System.out.println(count);
    }
}

Measured memory_bytes: 21844
function Main(input) {
  input = input.split("\n");
  const n = parseInt(input[0], 10);
  const ls = input[1].split(" ").map((l) => parseInt(l, 10));
  ls.sort((a, b) => a - b);
  let count = 0;
  for (let i=0; i<n; i++) {
    const li = ls[i];
    outer: for (let j=i+1; j<n; j++) {
      const lj = ls[j];
      if (li === lj) continue;
      for (let k=j+1; k<n; k++) {
        const lk = ls[k];
        if (lj === lk) continue;
        if (li + lj <= lk) continue outer;
        count++;
      }
    }
  }
  console.log(count);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 32332
#include <iostream>
#include <cstdio>
#include <string>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
#include <vector>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
#define P 1000000007
using namespace std;

int powmp(long long x,long long n){
	const long long p = 1000000007;
	if(n==0) return 1;
	long long y = x%p;
	if(n==1) return y;
	long long tmp = (powmp(y,n/2))%p;
	if(n%2==0) return (tmp*tmp)%p;
	else return (powmp(y,n-1)*y)%p;
}

int main(int argc, char const *argv[])
{
	map<char,int> m;
	int h,w;
	char a;
	int c4,c2,c1;
	c4=0;
	c2=0;
	c1=0;
	cin >> h >> w;
	REP(i,h){
		REP(j,w){
			cin >> a;
			if(m.find(a) == m.end()){
				m[a] = 1;
			}else{
				m[a] = m[a] + 1;
			}
		}
	}
	for(char c='a';c<='z';c++){
		if(m.find(c) != m.end()){
			int t = m[c];
			if(t%4==0) c4++;
			else if(t%2==0) c2++;
			else c1++; 
		}
	}
	if(h%2==0&&w%2==0){
		if(c2==0&&c1==0) cout << "Yes" <<"\n";
		else cout << "No" <<"\n";
	}
	else if(h%2==0&&w%2==1){
		int t = h/2;
		if(c1==0&&c2<=t&&c2%2==t%2) cout << "Yes" <<"\n";
		else cout << "No" <<"\n";
	}
	else if(h%2==1&&w%2==0){
		int t = w/2;
		if(c1==0&&c2<=t&&c2%2==t%2) cout << "Yes" <<"\n";
		else cout << "No" <<"\n";
	}
	else{
		int t = (w+h-2)/2;
		if(c1==1&&c2<=t&&c2%2==t%2) cout << "Yes" <<"\n";
		else cout << "No" <<"\n";
	}
	return 0;
}	

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

using namespace std;

void solve()
{
	string str;
	while(cin >> str)
	{
		vector<int> Vec;
		for(int i = 0; i < str.size(); ++i)
		{
			if(str[i] == 'M')
			{
				Vec.push_back(1000);
			}
			else if(str[i] == 'D')
			{
				Vec.push_back(500);
			}
			else if(str[i] == 'C')
			{
				Vec.push_back(100);
			}
			else if(str[i] == 'L')
			{
				Vec.push_back(50);
			}
			else if(str[i] == 'X')
			{
				Vec.push_back(10);
			}
			else if(str[i] == 'V')
			{
				Vec.push_back(5);
			}
			else if(str[i] == 'I')
			{
				Vec.push_back(1);
			}
		}
		int sum = 0;
		bool flag = false;
		for(int i = 0; i < Vec.size() - 1; ++i)
		{
			flag = false;
			if(Vec[i] < Vec[i + 1])
			{
				sum += Vec[i + 1] - Vec[i];
				++i;
				flag = true;
			}
			else
			{
				sum += Vec[i];
			}
		}
		if(!flag)
		{
			sum += Vec[Vec.size() - 1];
		}
		cout << sum << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1212
// https://atcoder.jp/contests/abc105/tasks/abc105_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int n;

  cin >> n;

  bool a = false;
  REP(i, floor(n / 4) + 1)
  {
    if ((n - i * 4) % 7 == 0)
    {
      a = true;
      break;
    }
  }

  string r = a ? "Yes" : "No";

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
using namespace std;
using v = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}

int main(int argc, char *argv[]){
    int n, m; cin >> n >> m;
    // vector<pari<int, int>> G(m);
    vector<vector<int>> G(n, vector<int>(n));
    int a, b;
    rep(i, m){
        cin >> a >> b;
        a--; b--;
        if(G[a][b] == 0) G[a][b] = G[b][a] = 1;
        else{
            G[a][b] += 1;
            G[b][a] += 1;
        }
    }
    rep(i, n){
        // cout << sum(G[i]) << endl;
        cout << accumulate(all(G[i]), 0) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter

val pw = PrintWriter(System.out)

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

fun func() {
    val (a, b) = listOfInt()
    println(if ((a * b) % 2 == 1) "Yes" else "No")
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt()= listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 35896
n, m = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(m)]

B = A[:]
A.sort()
cnt = 0
prev = 0
ans = dict()

for p, y in A:
    if prev != p:
        cnt = 1
        prev = p
    ans[(p, y)] = '{0:06d}{1:06d}'.format(p, cnt)
    cnt += 1

for p, y in B:
    print(ans[(p, y)])

Measured memory_bytes: 42380
S = input()
li = [chr(ord('a') + i) for i in range(26)]
used = [0] * 26
dic = dict(zip(li, used))
for i in range(len(S)): dic[S[i]] = 1
if(len(S) < 26):
    for i in range(26):
        k = chr(ord('a') + i)
        v = dic[k]
        if(v == 0):
            print(S + k)
            exit(0)

if(len(S) == 26):
    for i in range(25, -1, -1):
        for j in range(26): dic[chr(ord('a') + j)] = 0
        for j in range(i): dic[S[j]] = 1
        add_c = ""
        for j in range(i + 1, 26):
            if(S[j] > S[i]):
                if(add_c == ""): add_c = S[j]
                else: add_c = min(add_c, S[j])
        if(add_c):
            print(S[:i] + add_c)
            exit(0)
print(-1)


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const double PI = acos(-1);

int n;
int dp[MAX_N];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	cin >> n;

	//最大でN回
	rep(i, MAX_N) dp[i] = n;

	dp[0] = 0;

	//配るDP
	for (int i = 0; i < n; i++) {
		for (int pow6 = 1; pow6 <= n - i; pow6 *= 6) {
			chmin(dp[i + pow6], dp[i] + 1);
		}
		for (int pow9 = 1; pow9 <= n - i; pow9 *= 9) {
			chmin(dp[i + pow9], dp[i] + 1);
		}
	}

	//貰うDP
	/*for (int i = 1; i <= n; i++) {
		for (int pow6 = 1; pow6 <= i; pow6 *= 6) {
			chmin(dp[i], dp[i - pow6] + 1);
		}
		for (int pow9 = 1; pow9 <= i; pow9 *= 9) {
			chmin(dp[i], dp[i - pow9] + 1);
		}
	}*/

	out(dp[n]);

	return 0;
}

Measured memory_bytes: 640
def solve(x, k, d):
    x = abs(x)
    n = x // d
    if n > k:
        return x - k*d
    else:
        best = x - n*d
        if (k - n) % 2 == 0:
            return best
        else:
            return abs(best - d)

x, k, d = map(int, input().split())
print(solve(x, k, d))


Measured memory_bytes: 9172
#include<stdio.h>
int main(){
  int n,m,d,i,b[100010]={};
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++){
    scanf("%d",&d);
    b[d]=1;
  }
  for(i=0;1;i++){
    if(b[n-i]==0){
      printf("%d\n",n-i);
      return 0;
    }
    if(b[n+i]==0){
      printf("%d\n",n+i);
      return 0;
    }
  }
}
    


Measured memory_bytes: 2124
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

r = ri()
print(3*r**2)

















Measured memory_bytes: 27096
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    X = sorted(il())

    diff = []
    for n in range(M - 1):
        diff.append(abs(X[n] - X[n + 1]))
    diff = sorted(diff, reverse=True)
    ret = sum(diff[N-1:])
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 19888
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
3
1 3 2
3 1 2
---+/
/+---test
8
7 3 5 4 2 1 6 8
3 8 2 5 4 6 7 1
---+/
/+---test
3
1 2 3
1 2 3
---+/

void main(string[] args) {
  const N = readln.chomp.to!long;

  const A = readln.split.map!(to!long).array;
  const B = readln.split.map!(to!long).array;

  long a, b, i;
  auto arr = iota(1, N+1).array;
  do {
    if (arr.equal(A)) a = i;
    if (arr.equal(B)) b = i;
    ++i;
  } while (arr.nextPermutation);

  (a-b).abs.writeln;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
5 6
0 1
1 0
1 2
2 4
4 3
3 2
4
0 1
0 3
2 3
3 4

output:
1
0
1
1
"""

import sys

sys.setrecursionlimit(int(1e5))


def generate_adj_table(_v_info):
    for v_detail in _v_info:
        v_from, v_to = map(int, v_detail)
        init_adj_table[v_from].append(v_to)
    return init_adj_table


def Tarjan(current, low, dfn, scc_stack, in_scc_stack):
    global timer
    timer += 1
    dfn[current] = low[current] = timer

    scc_stack.append(current)
    in_scc_stack[current] = True

    current_scc_set = set()
    for adj in adj_table[current]:
        if not dfn[adj]:
            Tarjan(adj, low, dfn, scc_stack, in_scc_stack)
            low[current] = min(low[current], low[adj])

        elif in_scc_stack[adj]:
            low[current] = min(low[current], dfn[adj])

    scc_candidate = -1
    if dfn[current] == low[current]:
        while scc_candidate != current:
            scc_candidate = scc_stack.pop()
            in_scc_stack[scc_candidate] = False
            current_scc_set.add(scc_candidate)

        init_scc_sets_list.append(current_scc_set)

    return None


def scc_cluster():
    dfn = [0] * vertices
    low = [0] * vertices
    scc_stack = list()
    in_scc_stack = [False] * vertices

    for v in range(vertices):
        if not dfn[v]:
            Tarjan(v, low, dfn, scc_stack, in_scc_stack)

    return init_scc_sets_list


def solve(_scc_sets_list):
    for question in q_list:
        flag = False
        ele1, ele2 = map(int, question)
        for each in _scc_sets_list:
            if (ele1 in each) and (ele2 in each):
                flag = True
                break
        if flag:
            print('1')
        else:
            print('0')

    return None


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices, edges = map(int, _input[0].split())
    v_info = map(lambda x: x.split(), _input[1:edges + 1])
    q_num = int(_input[edges + 1])
    q_list = map(lambda x: x.split(), _input[edges + 2:])

    init_adj_table = tuple([] for _ in range(vertices))
    adj_table = generate_adj_table(v_info)

    timer = 0
    init_scc_sets_list = []
    scc_sets_list = scc_cluster()

    solve(scc_sets_list)

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);

  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  int i = 0, j = 1;
  for(int k=0; k<N+1; k++){
    if(a.at(i) != 2){
    i = a.at(i)-1;
    j++;
    }else{
      cout << j;
      break;
    }
    if(k >= N ){
      cout << -1;
    }
  }
}


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

N, M = map(int, input().split())
D = []
for i in range(M):
    p, y = map(int, input().split())
    D.append((p, y, i))

D.sort(key=lambda x:x[1])
D.sort(key=lambda x:x[0])

ID = [0] * M
tp, id = 1, 0
for i in range(M):
    p, y, ix = D[i]
    if tp == p:
        id += 1
    else:
        tp, id = p, 1
    ID[ix] = (p, id)

for i in range(M):
    print("{:0>6}{:0>6}".format(ID[i][0], ID[i][1]))


Measured memory_bytes: 32108
import bisect
 
 
def main():
    n = input()
    aa = []
    xx = [-input()]
    for _ in xrange(n - 1):
        aa.append(-input())
    for a in aa:
        if a >= xx[-1]:
            xx.append(a)
        else:
            i = bisect.bisect_right(xx, a)
            if i == len(xx):
                i -= 1
            xx[i] = a
    print len(xx)
 
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 7552
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main() {
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < s.size(); i++) {
    if (s == t) {
      cout << "Yes" << endl;
      return 0;
    }
    s = s.substr(1) + s[0];
  }
  if (s == t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
N, M =  map(int,input().split(" "))
A = list(map(int,input().split(" ")))
A.sort()
BC = []
for i in range(M):
    B,C = map(int,input().split(" "))
    BC.append((B,C))

BC.sort(reverse=True,key=lambda x: x[1])

i = 0
flg = True
for B,C in BC:
    for j in range(B):
        if C > A[i]:
            A[i] = C
            i += 1
        else:
            flg = False
            break

        if i == N:
            break
    if i == N or (not flg):
        break

print(sum(A))



Measured memory_bytes: 74280
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using P = pair<int, int>;

signed main() {

    int n, m;
    cin >> n >> m;
    
    vector<int> c(m);
    rep(i, m){
        cin >> c[i];
    }
    
    vector<int> dp(n+1, INT_MAX);
    dp[0] = 0;
    REP(i, 1, n+1){
        rep(j, m){
            if(i - c[j] >= 0){
                dp[i] = min(dp[i], dp[i - c[j]] + 1);
            }
            else if(dp[i] == INT_MAX){
                dp[i] = dp[i-1];
            }
        }
    }

    cout << dp[n] << endl;
        
    return 0;
}



Measured memory_bytes: 3104
n=int(input())
S=[]
T=[]
for i in range(n):
  S.append(input())
while True:
  char=S[0][0]
  min=len(S[0])
  for i in range(n):
    if S[i].count(char)<min:
      min=S[i].count(char)
    S[i]=S[i].replace(char,'')
  for i in range(min):
    T+=[char]
  if len(S[0])==0:
    break
T=sorted(T)
print(''.join(T))

Measured memory_bytes: 3064
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<utility>
#include<functional>
#include<cassert>
#include<cmath>
#include<math.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vint;
typedef vector<vint> vvint;
#define PI 3.1415926535;
#define MOD 1000000007;



int main(void) {
	int a, b,add,sub,mul,ans=-10000000;
	cin >> a >> b;
	add = a + b;
	ans = max(add, ans);
	sub = a - b;
	ans = max(ans, sub);
	mul = a * b;
	ans = max(ans, mul);
	cout << ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import numpy as np
import sys
input = sys.stdin.readline
n, m, q = map(int, input().split())
cnt = [[0]*(n+1)for _ in range(n+1)]
for _ in range(m):
    L, R = map(int, input().split())
    cnt[L][R] += 1

S = np.cumsum(cnt, axis=0).cumsum(axis=1)

L, R = map(np.array, zip(
    *[tuple(map(int, input().split())) for _ in range(q)]))


ans = S[R, R]-S[R, L-1]-S[L-1, R]+S[L-1, L-1]
print(*ans, sep='\n')

Measured memory_bytes: 34192
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <math.h>
//const long long mod = 1000000007;
//const long long mod = 998244353;

int main() {
	int a, b, x;
	scanf("%d %d %d", &a, &b, &x);
	double A = a;
	double B = b;
	double X = x;
	double max = A * A*B;
	double tan;
	if (X <= max / 2) {
		tan = A * B*B / (2 * X);
	}
	else {
		tan = 2 * (max - X) / (A*A*A);
	}
	double res = atan(tan) * 180 / 3.14159265359;
	printf("%f", res);
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = a;i < n;i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n],c[n];
    
    
    rep(i,0,n){
        cin >> a[i];
    }
    
    
    int q,b,e;
    cin >> q;
    
    rep(i,0,q){
        cin >> b >> e;
        rep(j,b,e){
            c[j] = a[j];
        }
        rep(j,0,e-b){
            a[b+j] = c[e-j-1];
        }
    }
    
    rep(i,0,n){
        cout << a[i];
        if(i != n-1) cout << " ";
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 3084
#include<stdio.h>

int main(){
	int N[101],M[101],L[101],n;
	for (int a = 1;a<10;a++){
		scanf("%d", &N[a]);
	}
	scanf("%d", &n);
	for (int b = 1;b<n+1;b++){
		scanf("%d", &M[b]);
	}

	for (int c = 1; c < n+1;c++){
		for (int d = 1; d < 10;d++){
			if(N[d] == M[c]){
				L[d]=1;
			}
		}
	}

	for (int e = 1;e<4;e++){
		if(L[3*e-2]==1 && L[3*e-1]==1 && L[3*e]==1){
			printf("Yes");
			return 0;
		}else if(L[e]==1 && L[3+e]==1 && L[6+e]==1){
			printf("Yes");
			return 0;
		}else if(L[1]==1 && L[5]==1 && L[9]==1){
			printf("Yes");
			return 0;
		}else if(L[3]==1 && L[5]==1 && L[7]==1){
          printf("Yes");
			return 0;
        }
	}
  printf("No");

		return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N, C;
    cin >> N >> C;
    int s, t, c;
    vector<pair<int, pair<int, int> > > E(N*2);
    for (int i = 0; i < N; i++) {
        cin >> s >> t >> c;
        E[i*2] = make_pair(s-1, make_pair(1, c));
        E[i*2+1] = make_pair(t, make_pair(0, c));
    }
    sort(E.begin(), E.end());
    int ans = 0;
    map<int, int> M;
    for (const auto &e : E) {
        if (e.second.first) {
            M[e.second.second]++;
        } else {
            M[e.second.second]--;
        }
        int size = 0;
        for (auto &m : M) if (m.second) size++;
        ans = max(ans, size);
    }
    printf("%d\n", ans);
    return 0;
}

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


int main()
{
int n,x,t,d;
cin>>n>>x>>t;
if(n<=x){cout<<t<<endl;}
else{
    d=n/x;
    if(n%x!=0){d++;}
    cout<<d*t<<endl;
}
}


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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

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

const ll MOD = 1000000007;
const long double EPS = 10e-10;

int main(){
    double W,H,w,h,x,y;
    cin >> W >> H >> w >> h >> x >> y;

    double cx = (min(W/2.0, x+w/2.0) + max(-W/2.0, x-w/2.0));
    double cy = (min(H/2.0, y+h/2.0) + max(-H/2.0, y-h/2.0));
    printf("%.10lf\n", cy/cx);
    
}



Measured memory_bytes: 3288
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,k;
    scanf("%lld%lld",&n,&k);
    ll *a = new ll[n];
    for(ll i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    ll *dp =new ll[n];
    dp[0] = 0;
    for(ll i=1;i<n;i++)
    {
        dp[i] = LONG_LONG_MAX;
        for(ll j=i-1;((j>=0)&&(j>=i-k));j--)
        {
            dp[i] = min(dp[i],dp[j]+abs(a[i]-a[j]));
        }
    }
    printf("%lld\n",dp[n-1]);
}


Measured memory_bytes: 1792
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e3 + 10;
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, k;
	cin >> n >> k;
	vector<pair<int, int>> vp;
	string str;
	cin >> str;
	str.push_back('*');
	int cnt = 1;
	for (int i = 1; i < str.length(); i++)
	{
		if (str[i] != str[i - 1]) vp.emplace_back(cnt, (str[i - 1] - '0') ^ 1), cnt = 1;
		else cnt++;
	}
	int ans = 0;
	int sum = 0;
	int ptr = 0;
	int o = 0;
	for (int i = 0; i < vp.size(); i++)
	{
		while (ptr < vp.size() && o + vp[ptr].second <= k)
		{
			o += vp[ptr].second;
			sum += vp[ptr].first;
			ptr++;
		}
		ans = max(ans, sum);
		o -= vp[i].second;
		sum -= vp[i].first;
	}
	cout << ans << endl;
	return 0;
}

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

namespace AizuOnlineJudge
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;

            var alphs = new int['z' - 'a' + 1];

            while((s = Console.ReadLine()?.ToLower()) != null)
            {
                foreach(var c in s)
                {
                    if('a' <= c && c <= 'z') alphs[c - 'a']++;
                }
            }
            for(var i = 0; i < alphs.Length; ++i)
            {
                Console.WriteLine($"{Convert.ToChar('a' + i)} : {alphs[i]}");
            }
        }

        /*private static bool IsInput(out int[] arr)
        {
            var s = Console.ReadLine();
            if (s == "0 0") { arr = null; return false; }

            arr = s.Split(' ').Select(int.Parse).ToArray();
            return true;
        }
        // */
    }
}


Measured memory_bytes: 17916
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define repp(i,a,n) for(i=a;i<n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpowmod(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll modInverse(ll n, ll p)
{
    return binpowmod(n, p-2, p);
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,m,i,f=0,j,ans=0,k,x,r;
    double n;
    cin >> n ;
    n*=3.1415926536;
    n*=2;
    cout << fixed << setprecision(4) << n ;
    
    return 0;
}

Measured memory_bytes: 3812
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;

int main()
{
    int N;
    cin >> N;
    map<string, int> mp;
    rep(i, N) {
        string s;
        cin >> s;
        mp[s]++;
    }

    int mx = 0;
    for (auto itr : mp)mx = max(mx, itr.second);
    vector<string> result;
    for (auto itr : mp)if (itr.second == mx)result.push_back(itr.first);
    sort(result.begin(), result.end());
    for (auto res : result)cout << res << endl;
    return 0;
}


Measured memory_bytes: 26868
a, b, x = map(int,input().split())
import math
if a*a*b/2 <= x:
    # print(b-(x/a/a*2-b))
    print(math.atan((b-(x/a/a*2-b))/a)*180/(math.pi))
else:
    print(90-math.atan(x/a/b*2/b)*180/(math.pi))

Measured memory_bytes: 38384
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

class UnionFind {
public:
    int n;
    std::vector<int> par;
    UnionFind(int n) : n(n), par(n, -1) {}

    // 集合の代表を返す
    int find(int x) {
        if (par[x] < 0) return x;
        return par[x] = find(par[x]);
    }
    // x と y が同じ集合に属するかを判別
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    // x が属する集合の大きさを返す
    int size(int x) {
        return -par[find(x)];
    }
    // x と y を結合 (merge した場合に true を返す)
    bool unite(int x, int y) {
        int px = find(x), py = find(y);
        if (px == py) return false;
        if (par[px] > par[py]) swap(px, py);
        par[px] += par[py];
        par[py] = px;
        return true;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    UnionFind uni(n);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        a--, b--;
        uni.unite(a, b);
    }

    int ans = 0;
    for (int i = 0; i < n; i++) chmax(ans, uni.size(i));
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3988
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
typedef long long ll;
int n,a[N];
ll m;
ll sum[N];
bool judge(int mid)
{
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        int j=lower_bound(a+1,a+1+n,mid-a[i])-a;
        ans+=n-j+1;
    }
    return ans>=m;
}
int main()
{
    scanf("%d%lld",&n,&m);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++) sum[i]=sum[i-1]+a[i];
    int l=0,r=200000,res;
    while(l<=r)
    {
        int m=l+r>>1;
        if(judge(m)) res=m,l=m+1;
        else r=m-1;
    }
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        int j=lower_bound(a+1,a+1+n,res+1-a[i])-a;
        ans+=(ll)(n-j+1)*a[i]+sum[n]-sum[j-1];
        m-=n-j+1;
    }
    ans+=m*res;
    printf("%lld\n",ans);
}


Measured memory_bytes: 1408
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>
#include <functional>
#include <queue>

#define int long long

int inf = (1LL <<  62);

using namespace std;


signed main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> mp(200000);
    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        mp[x-1].push_back(y - 1);
    }
    if(mp[0].size() == 0){
        cout << "IMPOSSIBLE";
        exit(0);
    }
    for(int i = 0; i < mp[0].size(); i++){
       vector<int>sg = mp[mp[0][i]];
        if(find(sg.begin(), sg.end(), n - 1) != sg.end()){
            cout << "POSSIBLE";
            exit(0);
        }
    }
    cout << "IMPOSSIBLE";
}


Measured memory_bytes: 8960
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
vector<int> gr[114514];
int cal(int v,int u){
	//cout<<v<<' '<<u<<endl;
	int ret=0;
	rep(i,gr[v].size()){
		int w=gr[v][i];
		if(w==u) continue;
		ret^=cal(w,v);
	}
	return ret+1;
}
int main()
{
	int n,x,y;
	cin>>n;
	rep(i,n-1){
		cin>>x>>y;x--;y--;
		gr[x].pb(y);gr[y].pb(x);
	}
	if(cal(0,-1)==1) cout<<"Bob"<<endl;else cout<<"Alice"<<endl;
}
	

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

int main () {
    string s, p;
    cin >> s >> p;
    s += s;
    bool flag = true;

    for (int i = 0; i < s.size(); i++) {
        if (p == s.substr(i, p.size())) {
            printf("Yes\n");
            flag = false;
            break;
        }
    }
    if (flag) printf("No\n");

}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
int n,a[20000010];
bool x(int i,int j,int k) {
    if(a[i]<=k&&a[j]<=k) return 1;
    else return 0;
}
bool y(int i,int j,int k){
    if(a[i]>k&&a[j]>k) return 1;
    else return 0;
} 
bool check(int a){
    for(int i=0;i<n-1;i++){
        if(y(n+i,n+i+1,a)||y(n-i,n-i-1,a)) return 0;
        if(x(n+i,n+i+1,a)||x(n-i,n-i-1,a)) return 1;
    }
    return x(1,1,a);
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=2*n-1;i++) scanf("%d",&a[i]);
    int l=1,r=2*n-1,mid;
    while(l<r){
	 	mid=(l+r)/2;
        if(check(mid)) r=mid;
        else l=mid+1;
    }
    printf("%d",l);
    return 0; 
}

Measured memory_bytes: 1024
import time
st_time=time.time()

from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
ts=time.time()
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
show_flg=False
show_flg=True


n=I()
d=[]
for i in range(1,10):
    for j in range(1,10):
        d+=[i*j]
if n in d:
    print('Yes')
else:
    print('No')

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

int main(){
	char a, b, c;
  	std::cin>>a>>b>>c;
  	
  	//std::cout<<a<<b<<c;
  
  	if(a=='R'){
    
      if(b=='S'){
      std::cout<<'1';
      }else if(c=='S'){
      std::cout<<'2';
      }else{
      std::cout<<'3';
      }
    }else{
      
      if(b=='S'){
        if(c=='S'){
        std::cout<<'0';
        }else{
        std::cout<<'1';
        }
      }else if(c=='R'){
        std::cout<<'2';
      }else{
        std::cout<<'1';
      }
      
    }
  
  
	return 0;
}

Measured memory_bytes: 3636
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    low = 2
    high = 2
    for a in A[::-1]:
        if(high < a):
            print(-1)
            return
        high = a * (high//a)
        low = a * ceil(low,a)
        if(high<low):
            print(-1)
            return
        high += a-1
    print(low,high)
if __name__ == '__main__':
    main()

Measured memory_bytes: 17420
n = int(input())
a = sorted(list(map(int,input().split())))
ans = a[-1]
x = ans//2
m = x-a[0]
ans2 = a[0]
for i in a[1:]:
    if i!=ans:
        z = min(i,ans-i)
        dif = x-z
        if m>dif:
            m,ans2 = dif,i
print(ans,ans2)

Measured memory_bytes: 62704
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}



void solve()
{
    int t,n,m,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U; 
    // int a,b,c;
    cin>>n>>m;
    if(n==m) cout<<"Yes";
    else cout<<"No";
}
 
 
signed main()
{
    
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        if(t)cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main(){
string S;
  cin>>S;
  if(S.at(0)==S.at(1)||S.at(1)==S.at(2)||S.at(2)==S.at(3)){
  cout<<"Bad"<<endl;
    
  }
 else{
 cout<<"Good"<<endl;
 }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n; cin >> n;
  ll h, w; cin >> h >> w;
  int ans = 0;
  while (n--) {
    ll x, y; cin >> x >> y;
    if ((x >= h && y >= w)) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;
const int mxn=1e5+5;
const int inf=1e9;
int main() {
	string s;
	string t;
	cin>>s>>t;
	int k=s.size()-t.size();
	int ans=inf;
	for(int i=0;i<=k;i++) {
		int r=0;
		for(int j=i;j<i+t.size();j++) {
			if(s[j]!=t[j-i])r++;
		}
		ans=min(ans,r);
	}

	cout<<ans<<endl;;
}

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

using namespace std;
using ll = long long;

//cout << std::fixed << std::setprecision(15) << y << endl;

int main() {
    string s = "";
    cin >> s;
    int MAX = 0;
    for(int i = 0;i < s.size();i++){
        int j = i;
        int tmpMax = 0;
        while(s[j] == 'A' || s[j] == 'T' || s[j] == 'G' || s[j] == 'C'){
            tmpMax++;
            j ++;
        }
        MAX = max(tmpMax,MAX);
    }
    cout << MAX << endl;
    return 0;
}

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

int main(){
  int D, M=26;
  cin >> D;
  vector<long long> c(M);
  for(int i=0; i<M; i++){
    cin >> c[i];
  }
  vector<vector<long long>> s(D,vector<long long>(M));
  for(int i=0; i<D; i++){
    for(int j=0; j<M; j++){
      cin >> s[i][j];
    }
  }
  long long la,onelos=0;
  for(int j=0; j<M; j++){
    onelos += c[j];
  }
  long long num = 10;
  vector<long long> sat(num,0), los(num,0), nlos(num,0);
  vector<pair<long long, long long>> tmpsat(num*M);
  vector<vector<long long>> last(num,vector<long long>(M,-1)), nlast(num,vector<long long>(M,-1));
  vector<vector<long long>> t(num,vector<long long>(D)), nt(num,vector<long long>(D));
  for(int i=0; i<D; i++){
    for(int j=0; j<num; j++){
      for(int k=0; k<M; k++){
        la = (long long)i - last[j][k];
    	tmpsat[j*M+k].first = sat[j] + s[i][k] - los[j] - onelos + la*c[k];
        tmpsat[j*M+k].first -= los[j]*8; //mahou
        tmpsat[j*M+k].second = j*M+k;
      }
    }
    sort(tmpsat.begin(), tmpsat.end(), greater());
    for(int j=0; j<num; j++){
      sat[j] = tmpsat[j].first;
      long long ty = tmpsat[j].second%M;
      long long prenum = tmpsat[j].second/M;
      nlast[j] = last[prenum];
      nlast[j][ty] = (long long)i;
      nlos[j] = los[prenum] + onelos - ((long long)i - last[prenum][ty])*c[ty];
      nt[j] = t[prenum];
      nt[j][i] = ty;
    }
    for(int j=0; j<num; j++){
      last[j] = nlast[j]; los[j] = nlos[j]; t[j] = nt[j];
    }
  }
  //cout << sat[0] << endl;
  for(int i=0; i<D; i++){
    cout << t[0][i]+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 3792
#include<bits/stdc++.h>
// #define int long long
#define ll long long
template<class T> inline void read(T &x){
	x=0; register char c=getchar(); register bool f=0;
	while(!isdigit(c))f^=c=='-',c=getchar();
	while(isdigit(c))x=x*10+c-'0',c=getchar(); if(f)x=-x;
}
const int N=205;
int n,m,k,mod,binom[N][N],f[N][N][N][2],trans1[N][N][N],trans2[N][N][N];
inline void add(int &x,int y){x=(x+y)%mod;}
inline int fpow(int a,int b){int s=1;for(;b;b>>=1,a=(ll)a*a%mod)if(b&1)s=(ll)s*a%mod;return s;}
signed main(){
	read(n),read(m),read(k),read(mod);
	for(int i=0;i<=std::max(n,m);i++){
		binom[i][0]=1;
		for(int j=1;j<=i;j++)binom[i][j]=(binom[i-1][j]+binom[i-1][j-1])%mod;
	}
	for(int c=1;c<=k;c++)
		for(int d,i=0;i<=m;i++){
			d=(ll)(fpow(c,m-i)-fpow(c-1,m-i)+mod)%mod*fpow(k-c+1,i)%mod;
			for(int s=1,j=0;j<=n;j++,s=(ll)s*d%mod)trans1[c][i][j]=s;
		}
	for(int c=1;c<=k;c++)
		for(int d,i=0;i<=n;i++){
			d=(ll)(fpow(k-c+1,i)-fpow(k-c,i)+mod)%mod*fpow(c,n-i)%mod;
			for(int s=1,j=0;j<=m;j++,s=(ll)s*d%mod)trans2[c][i][j]=s;
		}
	f[0][0][0][0]=1;
	for(int c=0;c<k;c++){
		for(int i=0;i<=n;i++)
			for(int j=0;j<=m;j++){
				for(int k=0;i+k<=n;k++){
					// if((ll)f[c][i][j][0]*trans1[c+1][j][k]%mod*binom[n-i][k]%mod)printf("[%d %d %d %d] -> [%d %d %d %d] : %d %d %d\n",c,i,j,0,c  ,i+k,j,1,f[c][i][j][0],trans1[c+1][j][k],binom[n-i][k]);
					add(f[c  ][i+k][j][1],(ll)f[c][i][j][0]*trans1[c+1][j][k]%mod*binom[n-i][k]%mod);
				}
				for(int k=0;j+k<=m;k++){
					// if((ll)f[c][i][j][1]*trans2[c+1][i][k]%mod*binom[m-j][k]%mod)printf("[%d %d %d %d] -> [%d %d %d %d] : %d %d %d\n",c,i,j,0,c+1,i+k,j,1,f[c][i][j][1],trans2[c+1][i][k],binom[m-j][k]);
					add(f[c+1][i][j+k][0],(ll)f[c][i][j][1]*trans2[c+1][i][k]%mod*binom[m-j][k]%mod);
				}
			}
		// std::cerr<<f[c+1][n][m][0]<<std::endl;
	}
	printf("%d\n",f[k][n][m][0]);
}

Measured memory_bytes: 70912
from bisect import insort_right as ir

N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = [0]

def right(x, k, l, lim):
    if lim > k:
        lim = k
    for vr in V[::-1][:lim]:
        k -= 1
        ir(l, vr)
        if vr <= 0:
            x += 1
        ans.append(sum(l[min(k, x):]))    

x1, k1, l1, lim1 = 0, K, [], N
if lim1 > K:
    lim1 = K
right(0, K, [], N - 1)
for vl in V[:lim1]:
    k1 -= 1
    ir(l1, vl)
    if vl <= 0:
        x1 += 1
    ans.append(sum(l1[min(k1, x1):]))
    x2, k2, l2, lim2 = x1, k1, l1[:], N + k1 - K
    right(x2, k2, l2, lim2)
ans.append(sum(l1[min(k1, x1):]))
print(max(ans))

Measured memory_bytes: 3316
import java.util.*
import java.math.*
import java.lang.Math.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrintln: (String)->Unit = { msg -> System.err.println(msg) }
private val MOD = 1e9.toLong()+7


fun solveB(N: Int, A: Int, B: Int, H: List<Long>): Long {

    fun canWin(x: Long): Boolean {
        val h = H.map { it - B*x }
        var cnt = 0L
        for (i in 0 until N) {
            if (h[i] > 0L) {
                cnt += (h[i]+ A-B-1)/(A-B)
            }
        }
        return cnt <= x
    }

    var l = 0L; var r = 1e9.toLong()  // (l, r]
    while(l + 1 < r) {
        var m = (l + r) / 2
        if (canWin(m)) {
            r = m
        } else {
            l = m
        }
    }

    return r
}


fun main(args: Array<String>) {
    val (N,A, B) = readListInt()
    var H = LongArray(N)
    for(i in 0 until N) {
        H[i] = readLong()
    }

    val ans = solveB(N, A, B, H.toList())

    println(ans)
}


Measured memory_bytes: 68468
#include <iostream>
using namespace std;
int main()
{
    int x,y,z,a,b,c;
    while(cin>>x>>y>>z){
        a=y+z;b=x%a;c=x/a;
        if(b<z) c--;
        cout<<c<<endl;
    }
    return 0;
}


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

template <typename T>
T gcd(T a , T b){
	if (b==0) return a;
	return gcd(b , a%b);
}

int main(){
	int a , b ;
	while(cin>>a>>b){
		printf("%d %d\n" , gcd(a,b) , (a/gcd(a, b)*b));
	}
	return 0;
}

Measured memory_bytes: 1144
n,m = map(int, input().split())

ship = {}

for i in range(m):
  a,b = (map(int, input().split()))
  if a == 1 or b == n:
    if a in ship: #keyにaがあるばあい
      ship[a].append(b)
    else:
      ship[a] = [b]

if 1 in ship:
  for i in ship[1]:
    if i in ship and n in ship[i]:
      print("POSSIBLE")
      exit()
      


  
  
print("IMPOSSIBLE")


Measured memory_bytes: 29640