akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;

void solve()
{
	string s;
	cin >> s;
	
	int n = s.size();
	if(s.back() == 'R')
		s += 'S';
	
	int cnt = 0;
	int best = 0;
	for(int i = 0; i < n; i++)
	{
		if(s[i] == 'R')
		{
			if(s[i+1] == 'R') cnt++;
			else 
			{
				best = max(best, cnt+1);
				cnt = 0;
			}
		}
	}
	
	cout << best << "\n";
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//int TT; cin >> TT; 
	//for(int tt = 1; tt <= TT; tt++)
		solve();
}


Measured memory_bytes: 3636
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func main() {
	scanner.Split(bufio.ScanWords)

	a := nextInt()
	b := nextInt()
	c := nextInt()

	if a+b == c || a+c == b || b+c == a {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

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

int main() {
  int h,w; cin>>h>>w;
  vector<vector<char>> A(h, vector<char>(w));
  rep(i, h) {
    rep(j, w) {
      cin >> A[i][j];
    }
  }

  rep(i, h) {
    rep(j, w) {
      int tmp = 0;
      rep(k, 8) {
        int y = i + dy[k];
        int x = j + dx[k];
        if (0>y||y>=h) continue;
        if (0>x||x>=w) continue;
        if (A[y][x]=='#') tmp++;
      }
      if (A[i][j] != '#') A[i][j] = (char)(tmp + '0');
      cout<<A[i][j];
    }
    cout<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
using namespace std;

int N,K;
int D[11] = {0};

int main(){
	cin >> N >> K;
	string S = to_string(N);
	for(int i=0;i<K;i++){
		int a;
		cin >> a;
		D[a] = 1;
	}
	bool judge = false;
	int A = N;
	while(1){
		int j = 10;
		while(A!=0){
			if(D[A%j]==1){
				break;
			}else{
				A /= j;
			}
		}
		if(A==0){
			cout << N << endl;
			break;
		}else{
			N++;
			A = N;
		}
	}
	//cout << ansnum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++) //これでiやjを定義しなくていいらしい
using namespace std;

int main(){
  int A,B;
  cin >> A >> B;
  cout << A*B << endl;

  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = 1e9 + 7;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    LL q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;

    q *= 4, h *= 2;
    cout << min(n / 2 * d + n % 2 * min({q, h, s}), n * min({q, h, s})) << endl;
}

Measured memory_bytes: 256
#include<cstring>
#include<cstdio>
#include<iostream>
#define maxn 10000+100
#define mod 1000000007
using namespace std;
typedef long long ll;
ll fac[maxn];
void init() {
	fac[0]=1;
	for(int i=2;i<maxn;i+=2) {
		fac[i]=fac[i-2]*(i-1);
		fac[i]%=mod;
	}
}
int fa[maxn];
int count[605][605];
int ok[605][605];
ll dp[605][605];
int main() {
	int n;
	int u,v;
	int m;
	init();
	cin >> n >> m;
	n*=2;
	for(int i=0;i<m;i++) {
		scanf("%d%d",&u,&v);
		fa[u]=v;
		fa[v]=u;
	}
	memset(count,0,sizeof(count));
	memset(ok,0,sizeof(ok));
	for(int i=1;i<=n;i++) {
		for(int j=i;j<=n;j++) {
			count[i][j]=count[i][j-1]+(fa[j]==0?1:0);
			for(int k=i;k<=j;k++) {
				if(fa[k]!=0&&fa[k]<i||fa[k]>j) {
					ok[i][j]=1;
					break;
				}
			}
		}
	}
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=n;i++) {
		for(int j=i;j<=n;j++) {
			if(ok[i][j]) continue;
			dp[i][j]=fac[count[i][j]];
			if(dp[i][j]==0)  continue;
			for(int k=i;k<j;k++) {
				dp[i][j]-=dp[i][k]*fac[count[k+1][j]]%mod;
				dp[i][j]+=mod;
				dp[i][j]%=mod;
			}
		}
	}
	ll ans=0;
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=n;j++) {
			ans+=dp[i][j]*fac[n-2*m-count[i][j]]%mod;
			ans%=mod;
		}
	}
	printf("%lld\n",ans);
} 

Measured memory_bytes: 6016
using System;

namespace ITP1_11
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] dice = getdice();
            int x = changedice(Console.ReadLine());
            Console.WriteLine(dice[x]);
        }

        static int[] getdice()
        {
            int[] dice = new int[7];

            string[] input = Console.ReadLine().Split(' ');
            for (int i =1 ; i <= 6; i++)
            {
                dice[i] = int.Parse(input[i-1]);
            }

            return dice;
        }

        static int changedice(string str)
        {
            int[] s = { 0, 1, 2, 3, 4, 5, 6 };
            for (int i = 0; i < str.Length; i++)
            {
                int[] memo = new int[7];
                for (int k = 1; k <= 6 ; k++)
                {
                    memo[k] = s[k];
                } 
                if (str[i] == 'E')
                {
                    s[1] = memo[4];
                    s[4] = memo[6];
                    s[6] = memo[3];
                    s[3] = memo[1];
                }
                else if(str[i] == 'N')
                {
                    s[1] = memo[2];
                    s[2] = memo[6];
                    s[6] = memo[5];
                    s[5] = memo[1];
                }
                else if (str[i] == 'S')
                {
                    s[1] = memo[5];
                    s[5] = memo[6];
                    s[6] = memo[2];
                    s[2] = memo[1];
                }
                else if (str[i] == 'W')
                {
                    s[1] = memo[3];
                    s[3] = memo[6];
                    s[6] = memo[4];
                    s[4] = memo[1];
                }
            }
            return s[1];
        }
    }
}

Measured memory_bytes: 9196
import collections
n = int(input())
l = sorted(list(map(int, input().split())) )
c = collections.Counter(l)
L = [0]*(10**5+1)
M = [0]*(10**5+1)
 
for x,y in c.items():
    L[x] += y
 
M[0] = L[0]
M[10**5] = L[10**5]
for i in range(1,10**5):
    M[i] = L[i-1] + L[i] + L[i+1]
print(max(M))

Measured memory_bytes: 20856
A, B = map(int, input().split())
ans = 0
for i in range(A, B + 1):
    a = str(i)
    a_len = len(a)
    a_len_mid = len(a) // 2
    pre = a[:a_len_mid]
    pos = ''.join(list(reversed(a[(a_len_mid + 1):a_len])))
    #if pre in pos:
    if pos.startswith(pre):
        ans += 1
print(ans)


Measured memory_bytes: 9056
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
k = int(input())
s = 0
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      s += gcd(a,b,c)
print(s)
      

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

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}

int fl[220000];
ll a[220000];
int n;
ll k;
vector<ll> vv;
ll pr[220000];

ll get(ll x) {
    x = lower_bound(vv.begin(), vv.end(), x) - vv.begin();
    ll ans = 0;
    for (; x >= 0; x = (x & (x + 1)) - 1)
        ans += fl[x];
    return ans;
}

void add(ll x) {
    x = lower_bound(vv.begin(), vv.end(), x) - vv.begin();
    for (; x < vv.size(); x |= (x + 1))
        fl[x] += 1;
}

int main() {
    scanf("%d%lld", &n, &k);
    for (int i = 0; i < n; ++i)
        scanf("%lld", a + i), a[i] -= k;
    pr[0] = 0;
    for (int i = 0; i < n; ++i)
        pr[i + 1] = pr[i] + a[i];
    for (int i = 0; i <= n; ++i)
        vv.push_back(pr[i]);
    sort(vv.begin(), vv.end());
    vv.resize(unique(vv.begin(), vv.end()) - vv.begin());
    ll ans = 0;
    for (int i = 0; i <= n; ++i) {
        ans += get(pr[i]);
        add(pr[i]);
    }
    cout << ans << "\n";
    return 0;
}




Measured memory_bytes: 6388
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=1e4+9;

int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    while(n--){
    	cout<<"ACL";
    }
    
}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

// {{{ Modint
// using mint = modint<1000000007>;
// mint x = 2;
// std::cout << x.a << std::endl;
template <std::int64_t M>
class modint {
 public:
  int64_t a;

  explicit constexpr modint(const int64_t x = 0) noexcept :
    a((x % M + M) % M) {}
  constexpr int64_t &value() noexcept { return a; }
  constexpr const int64_t &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= M) {
      a -= M;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += M;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % M;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    int64_t exp = M - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
  constexpr modint pow(ll t) const {
    if (!t) return modint(1);
    modint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
};
// }}}
using mint = modint<1000000007>;

// dp[i][j]: i番目の人までにj個の飴の配り方
// A: dp[i][j]   = sum_{t=0~a[i]} dp[i-1][j-t]
// B: dp[i][j-1] = sum_{t=0~a[i]} dp[i-1][j-1-t]
// A-Bより
// dp[i][j] = dp[i][j-1] + dp[i-1][j] - dp[i-1][j-1-a[i]]
mint dp[200][200000];
ll N, K;
ll a[200];


signed main() {
  cin >> N >> K;
  dp[0][0] = mint(1);
  for (ll i=1; i<=N; i++) {
    cin >> a[i];
  }
  for (ll i=1; i<=N; i++) {
    for (ll j=0; j<=K; j++) {
      mint p;
      if (j-1 >= 0) p += dp[i][j-1];
      if (i-1 >= 0) p += dp[i-1][j];
      if (i-1 >= 0 && j-1-a[i] >= 0) p -= dp[i-1][j-1-a[i]];
      dp[i][j] = p;
    }
  }
  cout << dp[N][K].value() << endl;
  return 0;
}


Measured memory_bytes: 156416
#include<bits/stdc++.h>
using namespace std;
 
 
int main()
{
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  bool flag=true;
  while(a>0 && c>0){
      c=c-b;
      if(c<=0){
          break;
      }
      a=a-d;
      if(a<=0){
          flag=false;
          break;
      }
  }
  if(flag==true)
    cout<<"Yes"<<endl;
else{
    cout<<"No"<<endl;
}
   return 0;
}

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

using namespace std;

#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

long long n,a[100005],ret=0,m,maks,idx,cnt,b[100005];
bool flag=1;

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    if(n==1) {
    	cout<<"YES"<<endl;
    	return 0;
	}
    m=(n*(n+1))/2;
    for(long long i=0;i<n;i++) {
    	cin>>a[i];
    	ret=ret+a[i];
	}
	if(ret%m!=0) {
		cout<<"NO"<<endl;
		return 0;
	}
	cnt=ret/m;
	for(int i=0;i<n;i++) {
		b[i]=(a[(i+1)%n]-a[i]-cnt);
	}
	for(long long i=0;i<n;i++) {
		if(b[i]>0 || abs(b[i])%n!=0) {
			flag=0;
			break;
		}
	}
	if(!flag) {
		cout<<"NO"<<endl;
	}
	else {
		cout<<"YES"<<endl;
	}
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+5;
int main() {
	map<int,int> M;
	int n,T;cin>>n>>T;
	std::vector<int> price(n+1);
	for(int i=1;i<=n;i++) cin>>price[i];
	int mn=price[1],mx=0;
	for(int i=2;i<=n;i++) {
		mn=min(mn,price[i]);
		mx=max(price[i]-mn,mx);
	}
	int ans=0;mn=price[1];
	for(int i=2;i<=n;i++) {
		if(price[i]-mn==mx) ans++;
		mn=min(mn,price[i]);
	}
	cout<<ans<<endl;
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  vector<int> b(N);
  vector<int> c(N);
  vector<int> d(N);
  vector<pair<int,int>> red(N);
  vector<pair<int,int>> blue(N);
  for(int i = 0; i < N; i++){
    cin >> a[i] >> b[i];
    red[i] = make_pair(a[i],b[i]);
  }

  for(int i = 0; i < N; i++){
    cin >> c[i] >> d[i];
    blue[i] = make_pair(c[i],d[i]);
  }

  int num = 0;
  int ans = 0;
  sort(red.begin(),red.end());
  sort(blue.begin(),blue.end());
  int aka[N],ao[N];

  for(int i = 0; i < N; i++){
    aka[i] = 0;
    ao[i] = 0;
  }
  int flag = 0;
  for(int i = 0; i < N; i++){
    flag = 0;
    int max = -1;
    int mita = 0;
    for(int j = 0; j < N; j++){
      if(red[j].first < blue[i].first && red[j].second < blue[i].second && aka[j] == 0 && ao[i] == 0 && red[j].second > max){ max = red[j].second; flag = j; mita = 1; }
    }
    if(mita == 1){
    aka[flag] = 1;
    ao[i] = 1;
    ans++;
    }
    }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $N);
$A = array_unique(explode(" ", trim(fgets(STDIN))));

$flg = true;
$ans = 0;

while ($flg) {
    foreach ($A as $k => $v) {
        if ($v % 2 === 0) {
            $A[$k] = $v / 2;
        } else {
            $flg = false;
        }
    }
    if ($flg) $ans++;
}

echo $ans . "\n";


Measured memory_bytes: 4728
def get_input():
    N = int(input())
    H = [int(_) for _ in input().split(" ")]
    return N,H

def solve(N,H):
    maximums = [max(H[:i+1]) for i in range(N)]
    count = 0
    for h,maximum in zip(H,maximums):
        if h>=maximum:
            count+=1
    return count 

if __name__ == "__main__":
    N,H = get_input()
    ans = solve(N,H)
    print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

const int m=1046527;
const int NIL=-1;
const int l=14;

typedef long long LL;

char H[m][l];

int getchar(char ch)
{
    if(ch=='A'){
        return 1;
    }else if(ch=='C'){
        return 2;
    }else if(ch=='G'){
        return 3;
    }else if(ch=='T'){
        return 4;
    }else{
        return 0;
    }
}

LL getkey(char str[])
{
    LL sum=0,p=1;
    int len=strlen(str);
    for(int i=0;i<len;i++){
        sum+=p*(getchar(str[i]));
        p*=5;
    }
    return sum;
}

int h1(int key)
{
    return key%m;
}

int h2(int key)
{
    return 1+(key%(m-1));
}

int find(char str[])
{
    LL key;
    key=getkey(str);
    for(int i=0;;i++){
        int h=(h1(key)+i*h2(key))%m;
        if(strcmp(H[h],str)==0){
            return 1;
        }else if(strlen(H[h])==0){
            return 0;
        }
    }
    return 0;
}

int insert(char str[])
{
    LL key;
    key=getkey(str);
    for(int i=0;;i++){
        int h=(h1(key)+i*h2(key))%m;
        if(strcmp(H[h],str)==0){
            return 1;
        }else if(strlen(H[h])==0){
            strcpy(H[h],str);
            return 0;
        }
    }
    return 0;
}

int main()
{
    int n;
    char str[l],com[9];
    for(int i=0;i<m;i++){
        H[i][0]=0;
    }
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%s %s",com,str);
        if(com[0]=='i'){
            insert(str);
        }else{
            if(find(str)){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
    return 0;
}
/*
6
insert AAA
insert AAC
find AAA
find CCC
insert CCC
find CCC
*/



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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

ll gcd(ll x, ll y) {  return y == 0 ? x : gcd(abs(y), abs(x) % abs(y)); }

ll lcm(ll x, ll y) {
  ll m = gcd(x, y);
  return m * (x / m) * (y / m);
}

int main()
{
  int N; scanf("%d", &N);
  vector<ll> T(N);
  for (int i = 0; i < N; ++i) {
    scanf("%lld", &T[i]);
  }

  ll ans = 1;
  for (int i = 0; i < N; ++i) {
    ans = lcm(ans, T[i]);
  }
  printf("%lld\n", ans);
  return 0;
}


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

abc = 0
def checker(a,b,c):
    if a != b and b != c and c != a:
        if a + b > c and b + c > a and c + a > b:
            return 1
        else:
            return 0
    else:
        return 0

ans = 0

for i in range(N - 2):
    for j in range(i, N - 1):
        for k in range(j, N):
            ans += checker(bou[i],bou[j],bou[k])
            
print(ans)

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

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

  int ans = 1;
  
  for (int i = 0; i < N; i++) {
    if (i == 0) continue;
    
    if (S.at(i) != S.at(i - 1)) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main() {
  int H, W;

  for ( ; ; ) {
    cin >> H >> W;
    if ((H == 0) && (W == 0)) break;
    for (int i = 0; i < H; ++i) {
      for (int j = 0; j < W; ++j) {
        cout << 
          (((i == 0) || (i == (H - 1)) ||
            (j == 0) || (j == (W - 1))) ? '#' : '.');
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
} 



Measured memory_bytes: 3072
from collections import deque

query_n = int(input())

d = deque()

for _ in range(query_n):
    query = input().split()
    
    if query[0] == "0":
        if query[1] == "0":
            d.appendleft(query[2])
        elif query[1] == "1":
            d.append(query[2])
    elif query[0] == "1":
        print(d[int(query[1])])
    elif query[0] == "2":
        if query[1] == "0":
            d.popleft()
        elif query[1] == "1":
            d.pop()


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

int main(){
	int n,x,t=0;
	map<int,int> a;
	cin>>n;
	for(int i=0;i<n;i++) {
		cin>>x;
		if (a[x]==0)
			a[x]=1;
		else
			a[x]++;
	}
	for(map<int,int>::iterator it=a.begin();it!=a.end();it++){
		if(it->first<it->second)
			t+=it->second-it->first;
		else if(it->first>it->second)
			t+=it->second;
	}
	cout<<t;
	return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	LL A,B,C,D,E,F;
	cin >> A >> B >> C >> D >> E >> F;
	double ans = 0;
	LL ans1 = 0;
	LL ans2 = 0;
	for(int i=0; i<=31; i++){
		for(int j=0; j<=31; j++){
			LL m = A*100*i+B*100*j;
			for(int k=0; k<=3001; k++){
				LL n = C*k;
				if(m/100*E < n || F < n+m) break;
				for(int l=0; l<=3001; l++){
					n += D*l;
					if(m/100*E < n || F < n+m) break;
					if(ans <= (double)n/(double)(m+n)){
						ans = (double)n/(double)(m+n);
						ans1 = n;
						ans2 = m+n;
						//cout << ans2 << " " << ans1 << endl;
					}
					n -= D*l;
				}
			}
		}
	}
	cout << ans2 << " " << ans1 << endl;

	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
//
#define int long long
#define ALL(x) (x).begin(), (x).end()
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))
// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((a) >> (b)) & 1
#define bitcount(a) __builtin_popcountll((a))
//
typedef long long lint;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;
//
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
//
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  int n, k;
  cin >> n >> k;

  vec x(n), y(n), xary, yary;

  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    xary.push_back(x[i]);
    yary.push_back(y[i]);
  }

  sort(ALL(xary));
  sort(ALL(yary));

  int ans = 1LL * abs(xary[0] - xary[n - 1]) * abs(yary[0] - yary[n - 1]);

  for (int xi = 0; xi < n; xi++) {
    for (int xj = xi + 1; xj < n; xj++) {
      for (int yi = 0; yi < n; yi++) {
        for (int yj = yi + 1; yj < n; yj++) {

          int cont = 0;
          int lx = xary[xi], rx = xary[xj];
          int ly = yary[yi], ry = yary[yj];

          for (int i = 0; i < n; i++) {
            if (lx <= x[i] && x[i] <= rx && ly <= y[i] && y[i] <= ry) {
              cont++;
            }
          }

          if (cont < k) {
            continue;
          }

          int temp = (rx - lx) * (ry - ly);
          ans = min(ans, temp);
        }
      }
    }
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair

int N;
vector<string> res;

void dfs(int cnt, int tot, string tmp)
{
	if(tmp.length() == N){
		if(cnt == tot){
			res.pb(tmp);
		}
		return;
	}
	for(int i=0;i<cnt;++i){
		tmp += i+'a';
		dfs(cnt, tot, tmp);
		tmp.pop_back();
	}
	if(cnt < tot){
		tmp += cnt+'a';
		dfs(cnt+1,tot,tmp);
		tmp.pop_back();
	}
}

void helper(int x)
{
	if(x == 0) res.pb(string(N, 'a'));
	else if(x == N){
		string t;
		for(int i=0;i<N;++i) t += i+'a';
		res.pb(t);
	}else{
		dfs(0, x, "");
	}
}

void solve()
{
	for(int i=0;i<=N;++i) helper(i);
	const int n = res.size();
	set<string> ans;
	for(int i=0;i<n;++i) ans.emplace(res[i]);
	for(auto& s : ans){
		cout << s << '\n';
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N;
	solve();
	return 0;
}

Measured memory_bytes: 14452
n, k = map(int, input().split())

people = [0 for i in range(n)]

for i in range(k):
 d = int(input())
 a_array = list(map(int, input().split()))
 for j in range(len(a_array)):
  people[a_array[j] - 1] += 1

print(people.count(0))

Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAX=1e18;
const int N=1e5+10;
ll a[N];
int main()
{
	ll n;
	ll cnt=1;
	cin>>n;
	int zero=0;
	for(ll i=0;i<n;i++) {
		cin>>a[i];
		if(!a[i]) zero++;
	}
	if(zero>0) cout<<0<<endl;
	else 
	{
		for(ll i=0;i<n;i++) 
		{
			if(a[i]<=MAX/cnt) cnt*=a[i];
			else
			{
				cout<<-1<<endl;
				return 0;
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 4416
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_que<int> pque;//これは大きい順
//typedef priority_que<int, vector<int>, greater<int>> pque;//これは小さい順


int main(){
	char s[110],t[110];
	scanf("%s%s",&s,&t);
	printf("%s%s\n",t,s);

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
int n, a;
map<ll, ll> m;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n){
    cin >> a;
    FOR(j, -1, 2){
      if(m.find(a+j) == m.end()) m[a+j] = 0;
      m[a+j]++;
    }
  }
  ll ans = 0;
  each(itr, m) maxs(ans, itr->se);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6144
import java.io.*;
import java.util.*;
public class Main{
   
     public static void main(String []args){
       Scanner s=new Scanner(System.in);
       long n=s.nextLong();
       long r=s.nextLong();
       if(n>=10)
       System.out.println(r);
       else
       System.out.println(100*(10-n)+r);
     }}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
inline int read(){
    int sum=0;
    char c=getchar();
    while(!isdigit(c)) c=getchar();
    while(isdigit(c)){
        sum=sum*10+(c^48);
        c=getchar();
    }
    return sum;
}
int const inf=1e8;
int n,m,e[20][20],sum[32769],wang[32769][20],f[32769][20];
//sum表示点集内部连边的边权总和,wang表示一个点集和一个点连边的边权总和
int main(){
    n=read(),m=read();
    for(int i=1;i<=n;i++)
      for(int j=1;j<=n;j++)
        e[i][j]=-inf;
    for(int i=1;i<=m;i++){
        int x=read(),y=read(),z=read();
        e[x][y]=e[y][x]=z;
    }
    for(int i=0;i<(1<<n);i++)
      for(int j=1;j<=n;j++)
        if(i&(1<<(j-1)))
          for(int k=1;k<j;k++)//注意范围，不然重复计算
            if(e[j][k]>-inf && (i&(1<<(k-1))))
              sum[i]+=e[j][k];
    for(int i=1;i<=n;i++)
      for(int j=0;j<(1<<n);j++)
        if(!(j&(1<<(i-1))))
          for(int k=1;k<=n;k++)
            if((j&(1<<(k-1))) && e[k][i]>-inf)
              wang[j][i]+=e[k][i];
    for(int i=0;i<(1<<n);i++)
      for(int j=1;j<=n;j++)
        f[i][j]=-inf;
    f[1][1]=0;
    for(int i=1;i<(1<<n);i++)
      for(int j=1;j<=n;j++)
        if(f[i][j]>-inf){
            for(int k=1;k<=n;k++)
              if(!(i&(1<<(k-1))) && e[j][k]>-inf)
                f[i|(1<<(k-1))][k]=max(f[i|(1<<(k-1))][k],f[i][j]+e[j][k]);
            int total=(1<<n)-1-i;
            for(int x=total;x;x=(x-1)&total)
              f[i|x][j]=max(f[i|x][j],f[i][j]+wang[x][j]+sum[x]);
        }
    int ans=0;
    for(int i=0;i<(1<<n);i++)
      ans=max(ans,f[i][n]);
    cout<<sum[(1<<n)-1]-ans<<endl;
    return 0;
}

Measured memory_bytes: 5504
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
 
using namespace std;
 
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;

const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;

ll f(ll a, ll b){
	return max((ll)log10(a)+1, (ll)log10(b)+1);
}

int main(){
	ll n;
	
	cin >> n;
	
	double root = pow(n, 0.5);
	
	ll r = (ll)root;
	r++;
	
	ll a = 1;
	
	FOR(i,2,r+1){
		if (n%i == 0) a = i;
	}
	
	cout << f(a, n/a) << endl;
	
	return 0;
}

Measured memory_bytes: 640
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define f(i,a,b) for(int i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using si = stack<LL>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

#pragma endregion 

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

	LL x;
	cin >> x;
	LL i = 0;
	if (x > 11) {
		i += (x / 11) * 2;
		x %= 11;
	}
	if (x > 6 && x <= 11) {
		i += 2;
	}
	if (x > 0 && x <= 6) {
		i += 1;
	}
	cout << i;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  int t = N, c = 0;
  
  while (t > 0){
    c += t % 10,t /= 10;
  }
  if (N % c == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

int main()
{
    int a,b;
    cin >> a >> b;
    if(a>=13) cout << b;
    else if(a>=6) cout << b/2;
    else cout << 0;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
    int x;
    char c;
    int f=1;
    while((c=getchar())!='-' && (c>'9' || c<'0'));
    if(c=='-') f=-1,c=getchar();
    x=c^'0';
    while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
    return x*f;
}
inline ll readll(){
    ll x;
    char c;
    int f=1;
    while((c=getchar())!='-' && (c>'9' || c<'0'));
    if(c=='-') f=-1,c=getchar();
    x=c^'0';
    while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
    return x*f;
}
const int maxn=1e5+10;
char s[maxn];
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	if(s[n]=='1' || s[n-1]=='0' || s[1]=='0') return printf("-1\n"),0;
	bool flag=1;
	REP(i,1,n>>1) flag&=(s[i]==s[n-i]);
	if(flag==0) return printf("-1\n"),0;
	int lst=1,num=1,lstnum=1;
	REP(i,2,n-1) if(s[i]=='1'){
		printf("%d %d\n",lstnum,num+1);
		++num;
		lstnum=num;
		REP(j,1,i-lst-1){
			++num;
			printf("%d %d\n",lstnum,num);
		}
		lst=i;
	}
	if(num<n) printf("%d %d\n",lstnum,num+1);
    return 0;
}


Measured memory_bytes: 1536
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int n,m;
    cin >> n >> m;
    int *food;
    food = new int[m];
//    for(int i=0;i<m;i++)
//    {
//        food[i]=0;
//    }
    for(int i=0;i<n;i++)
    {
        int k;
        cin >>k;
        int A;
        for(int l=0;l<k;l++)
        {
            scanf("%d",&A);
            food[A-1]++;
//            printf("%d ",A);
//            printf("%d ",food[A]);
        }
//        printf("\n");
    }
    int all=0;
    for(int i=0;i<m;i++)
    {
        if(food[i]==n) { all++; }
    }
    // 出力
    cout << all << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
M = 10**9+7

from collections import Counter
cd = Counter(A)
# A.sort()

if N & 1:
    # odd
    if cd[0] != 1:
        print(0)
        exit(0)
    ng = False

    for ix in range(2, N//2 + 1, 2):
        if cd[ix] != 2:
            ng = True
            break

    if len(cd) != N//2 + 1:
        ng = True
    
    if ng:
        print(0)
    else:
        print(pow(2,(N//2),M))

else:
    # even
    ng = False
    for ix in range(1, N//2+1, 2):
        if cd[ix] != 2:
            ng = True
            break
    
    if len(cd) != N//2:
        ng = True
    
    if ng:
        print(0)
    else:
        print(pow(2,(N//2),M))


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

main() {
  int A,B,C;
  cin >>A>>B>>C;
  int A2=A;
  vector<bool> B2(B);
  for(int i=0;i<1e6;++i){
    B2[A2%B]=true;
    A2+=A;
  }
  cout<<(B2[C]?"YES":"NO")<<endl;
}


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

typedef long long int ll;

int main(){

  string s;
  cin >> s;
  int n= s.size(),ans=0;
  for(int i=0;i<n;i++){
    if(s[i]!=s[n-1-i])ans++;
  }
  cout<<ans/2<<endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: chars,
    }
    let n = s.len();
    let mut result = 0;
    let mut count = 0;
    for i in 0..n {
        if s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T' {
            count += 1;
        } else {
            count = 0;
        }
        if count > result {
            result = count;
        }
    }
    println!("{}", result);
}


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

int main() {
  char c;
  cin >> c;
  
  if ( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mx 20005
#define ll long long
int main(){
	//freopen("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	string s, t;
	cin>>s>>t;
	int n = s.length();
	int m = t.length();

	int dp[n+1][m+1];

	for(int i=0; i<=n; i++){
		for(int j=0; j<=m; j++){
			if(i == 0 || j==0) dp[i][j]=0;

			else if(s[i-1]==t[j-1]) dp[i][j] = 1 + dp[i-1][j-1];

			else dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
		}
	}



	int i = n, j = m;
	string str = "";
	while(i>0 && j>0){
		if(dp[i][j]== dp[i][j-1])
			j--;
		else if(dp[i][j]== dp[i-1][j])
			i--;
		else{

			str += t[j-1];
			i--;
			j--;
		}
	}
	reverse(str.begin(), str.end());
	cout<<str<<endl;



	return 0;
}

Measured memory_bytes: 35456
#include<iostream>
#include<algorithm>
using namespace std;
int r, c, ans;
bool osenbei[15][10010];
void Zen_Re_Kkyo(int p) {
	if (p == r) {
		int sum = 0;
		for (int i = 0; i < c; i++) {
			int a = 0, b = 0;
			for (int j = 0; j < r; j++) {
				if (osenbei[j][i])a++;
				else b++;
			}
			sum += max(a, b);
		}ans = max(sum, ans);
		return;
	}
	Zen_Re_Kkyo(p + 1);
	for (int i = 0; i < c; i++)osenbei[p][i] = !osenbei[p][i];
	Zen_Re_Kkyo(p + 1);
	for (int i = 0; i < c; i++)osenbei[p][i] = !osenbei[p][i];
	return;
}
int main() {
	while (cin >> r >> c, r, c) {
		ans = 0;
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				cin >> osenbei[i][j];
			}
		}
		Zen_Re_Kkyo(0);
		cout << ans << endl;
	}
}


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

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    int res=0;
    for(int o=0;o<n;o++) for(int i=o+1;i<n;i++) res+=(a[o]*a[i]);
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func Swap(x, y int) (int, int) {
	return y, x
}

func main(){
	var x, y int
	
		for {	
			fmt.Scan(&x)
			fmt.Scan(&y)

				if x > y {
					x, y = Swap(x, y)
				} else if x == 0 && y == 0{
					break
				}
			
			fmt.Println(x, y)
		}
}


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

int main()
{
    int n;
    while(cin >> n,n!=1){
        cout<<n<<":";
        int sat;
        vector<int> vsat;
        vsat.push_back(1);
        if(!(n%6)){
            vsat.push_back(6);
            cout << " " << 6;
        }
        unsigned int i;
        for(int m=1;sat<=n;m++){
            sat=7*m+1;
            if(!(n%sat)){
                for(i=0;i<vsat.size();i++){
                    if(i!=0&&!(sat%vsat[i])) break;
                    if(i==vsat.size()-1){
                        vsat.push_back(sat);
                        cout << " " << sat;
                    }
                }
            }
            sat=7*m+6;
            if(!(n%sat)){
                for(i=0;i<vsat.size();i++){
                    if(i!=0&&!(sat%vsat[i])) break;
                    if(i==vsat.size()-1){
                        vsat.push_back(sat);
                        cout << " " << sat;
                    }
                }
            }
        }
        
        cout << endl;
    }
}

Measured memory_bytes: 3008
#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;


ull gcd(ull a,ull b){
	if(!b) return a;
	return gcd(b,a%b);
}


int main(){
	ll n,a,cnt = 0;
	cin >> n >> a;
	ll x[n] = {0},dp[n+1][n+1][2501] = {0};
	
	rep(i,0,n){
		cin >> x[i];
	}
	
	rep(i,0,n+1){
		rep(j,0,n+1){
			rep(k,0,n*a+1){
				if(i == 0 && j == 0 && k == 0){
					dp[i][j][k] = 1;
				}
				else if(i >= 1 && j >= 1 && k >= x[i-1]){
					dp[i][j][k] = dp[i-1][j-1][k-x[i-1]]+dp[i-1][j][k];
				}
				else if(i >= 1 && k < x[i-1]){
					dp[i][j][k] = dp[i-1][j][k];
				}
				else{
					dp[i][j][k] = 0;
				}
			}
		}
	}
	
	rep(i,1,n+1){
		cnt += dp[n][i][i*a];
	}
	
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 51072
S = input()
MM = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
if (S[0:2] in MM) & (S[2:] in MM):
	print('AMBIGUOUS')
elif S[0:2] in MM:
	print('MMYY')
elif S[2:] in MM:
	print('YYMM')
else:
	print('NA')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
#define pi 3.1415926535
typedef long long ll;


int main(){
    int N;
    cin>>N;
    vector<int>D(N);
    map<int,int>s;
    rep(i,N){
        cin>>D[i];
        s[D[i]]++;
    }
    int M;
    cin>>M;
    vector<int>T(M);
    rep(i,M){
        cin>>T[i];
    }
    int count=0;
    rep(i,M){
        if(s[T[i]]>0){
            count++;
            s[T[i]]--;
        }
    }
    if(count==M){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }

    return 0;
}

Measured memory_bytes: 11136
public class Main {
	
		
		public static void main(String[] args) {
			java.util.Scanner scan = new java.util.Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		if( 0<= a && 0<= b && 0<= c && 100>= a && 100>= b && 100>= c){
		if( a < b && b < c){;
		
		System.out.println("Yes");
		}else{
		System.out.println("No");
		}
		}
		}	
			
		
}

Measured memory_bytes: 26148
n = int(input())

h = list(map(int,input().split()))
c=0
while max(h)>0:   
    ##断裂の数を数える
    if h[0] > 0:
      h.insert(0,0)
    if h[-1] > 0:
      h.append(0)
    p=0
    for i in range(len(h)-1):
      if h[i]>=1 and h[i+1]<=0:
        p+=1
    ##加算値は断裂
    c+=max(1,p)
    ##地盤沈下させる
    h = [n-1 for n in h]
    #print("c=",c,"p=",p,"h=",h)
    
print(c)

Measured memory_bytes: 3064
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,MOD=1e9+7,ans=1;
map<ll,ll>mp;
ll f(ll x){
    if(x==0)return 1;
    return x*f(x-1)%MOD;
}
ll ff(ll x,ll y){
    if(y==0)return 1;
    if(y%2==0)return ff(x,y/2)*ff(x,y/2)%MOD;
    else return ff(x,y-1)*x%MOD;
}
int main(void){
    cin>>m>>n;
    m--;
    for(int i=2;i*i<=1024000000;i++){
        if(n==1)break;
        while(n%i==0){
            mp[i]++;
            n/=i;
        }
    }
    if(n!=1)mp[n]++;
    for(auto x:mp){
        ll X=x.second,Y=m;
        //cout<<X<<" "<<Y<<endl;
        ans*=f(X+Y)*ff(f(X),1e9+5)%MOD*ff(f(Y),1e9+5)%MOD;
        ans%=MOD;
    }
    cout<<ans<<endl;
}


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

using namespace std;

const int max_n = 5555, inf = 1000111222;

int n, k;
string s;

string getr(const string &s, int pos) {
    return {s.rbegin() + s.length() - 1 - pos, s.rbegin() + s.length() - 1 - pos + n};
}

string one_step(const string &s) {
    string rs = s;
    reverse(rs.begin(), rs.end());
    string t = s + rs;
    string res = s;
    for (int i = 1; i < n; ++i) {
        res = min(res, t.substr(i, n));
    }
    return res;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n >> k >> s;
    --k;
    char mn = s[0];
    for (char c : s) {
        mn = min(mn, c);
    }
    if (k) {
        string rs = s;
        reverse(rs.begin(), rs.end());
        int mx = 0, pos = 0;
        string t = s + rs;
        for (int i = 0; i < t.length(); ++i) {
            int st = i;
            while (i < t.length() && t[i] == mn) {
                ++i;
            }
            int cnt = i - st;
            if (i - 1 >= s.length() && (mx < cnt || mx == cnt && getr(t, pos) > getr(t, i - 1))) {
                pos = i - 1;
                mx = cnt;
            }
        }
        //cout << t << endl;
        //cout << mx << " " << pos << " " << getr(t, pos) << endl;
        s = getr(t, pos);
        reverse(s.begin(), s.end());
        --k;
        //cout << "$" << s << " " << k << endl;
        mx = min(mx, n);
        k = min(k, 20);
        while (k--) {
            string rs = s;
            reverse(rs.begin(), rs.end());
            string t = s + rs;
            s = getr(t, s.length() + mx - 1);
            reverse(s.begin(), s.end());
            mx *= 2;
            mx = min(mx, n);
        }
        //cout << s << endl;
    }
    cout << one_step(s) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int cnt = 0;
    for (int i = 1; i <= N; i++) {
      if (String.valueOf(i).length() % 2 != 0) {
        cnt++;
      }
    }
    System.out.println(cnt);
  }
}


Measured memory_bytes: 27732