akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int MAXN = 1e6 + 100;
int a[MAXN], n, sol;

int main()
{
	scanf("%d",&n);
	string s;
	cin>>s;

int r = 0;
	for (int i =0;i<n;i++)
	{
		if (s[i] == 'R')r++;
	}

	int sol = 0;
	for (int i = r;i<n;i++)
	{
		if (s[i] == 'R')sol++;
	}
	cout<<sol<<endl;

	return 0;
}

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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;

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

    int h, n;
    cin >> h>> n;
    int a;
    REP(i,n) {
        cin >> a;
        h -= a;
    }
    if(h<=0) cout << "Yes" << endl;
    else cout << "No" << endl;
        
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#define MAXN 1000006
#include<algorithm>
using namespace std;
int ans,n,l,cnt,r,q[MAXN];
char s[MAXN],t[MAXN];
int main()
{
	//freopen("blank.in","r",stdin);
	//freopen("blank.out","w",stdout);
	scanf("%d",&n);
	scanf("%s",s+1);
	scanf("%s",t+1);
	l=1;
	if(!strcmp(s+1,t+1))
	{
		printf("0");
		return 0;
	}
	for(int i=n,j=n;i>=1;i--)
	{
		if(t[i]==t[i-1]) continue;
		j=min(i,j);
		while(j&&t[i]!=s[j]) 
			j--;
		if(!j)
		{
			printf("-1");
			return 0;
		}
		while(l<=r)
		{
			if(q[l]-(r-l)>i) l++;
			else break;
		}
		q[++r]=j;
		if(i!=j) ans=max(ans,r-l+1);
	}
	printf("%d\n",++ans);
}

Measured memory_bytes: 6144
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <cassert>

using namespace std;

const int mod = 1000000007;

int p[100500];

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n, a;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++){
        cin >> p[i];
    }
    for (int i = 1; i < n; i++)
        if (p[i] == i){
            ans++;
            swap(p[i], p[i + 1]);
        }
    if (p[n] == n){
        ans++;
        swap(p[n - 1], p[n]);
    }
    cout << ans;    
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int, a,b,c,x,y);

	int ans=INF;
	ans = min(ans,x*a+y*b);
	ans = min(ans,max(x,y)*2*c);
	if(x>y){
		ans = min(ans,min(x,y)*2*c+a*(x-y));
	}else{
		ans = min(ans,min(x,y)*2*c+b*(y-x));
	}
	OUT(ans)BR;
  
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

const int N = 2'009;

int a[N];
int f[N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < N; ++i) {
    f[i] = 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
    ++f[a[i]];
  }
  for (int i = 1; i < N; ++i) {
    f[i] += f[i - 1];
  }
  sort(a, a + n);
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      ans += f[a[i] + a[j] - 1] - f[a[j] - 1] - 1 - (a[i] == a[j]);
    }
  }
  for (int i = 1; i < N; ++i) {
    int v = f[i] - f[i - 1];
    ans -= (long long)v * (v - 1) * (v - 2) / 6 * 2;
    ans -= (long long)v * (v - 1) / 2 * f[i - 1];
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 128
/*  -*- coding: utf-8 -*-
 *
 * a.cc: C: Candies
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;

/* typedef */

/* global variables */

int as[MAX_N], bs[MAX_N], asums[MAX_N + 1], bsums[MAX_N + 1];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++)
    scanf("%d", &as[i]), asums[i + 1] = asums[i] + as[i];
  for (int i = 0; i < n; i++)
    scanf("%d", &bs[i]), bsums[i + 1] = bsums[i] + bs[i];

  int maxsum = 0;
  for (int i = 1; i <= n; i++) {
    int sum = asums[i] + bsums[n] - bsums[i - 1];
    if (maxsum < sum) maxsum = sum;
  }

  printf("%d\n", maxsum);
  return 0;
}


Measured memory_bytes: 256
import bisect

N = int(input())
A = []
for i in range(N):
  A.append(int(input()))

SA = sorted(A)
ans = 0
for i in range(N):
  rank = bisect.bisect_left(SA,A[i])
  #print(rank,A[i])
  if (i + rank) % 2 == 1:
    ans += 1
print(ans//2)

Measured memory_bytes: 52440
n=int(input())
A=[int(input()) for _ in range(n)]

if A[0]!=0:print(-1);exit()

cnt,length=0,0
for i in range(n-1):
    if A[i]!=0:length +=1
    else:length=0

    if A[i]<=length:
        if A[i]+1==A[i+1]:cnt +=1
        elif A[i+1]-A[i]>1:print(-1);exit()
        else:cnt +=A[i+1]
    else:print(-1);exit()
print(cnt)

Measured memory_bytes: 57560
N, K = map(int, input().split())
a = tuple(map(int, input().split()))

def main():
    l = [False] * (K+1)
    for i in range(a[0] -1, K+1):
        l[i] = any(not l[i-j] if i >= j else False for j in a)
    if l[-1]:
        print('First')
    else:
        print('Second')


main()


Measured memory_bytes: 44512
#include<cstdio>
using namespace std;
int n,k,ans,p;
int map[12][6]={
    {4,2,0,9,7},
    {1,10,8,6,4},
    {9,7,5,3,1},
    {6,4,2,0,9},
    {3,1,10,8,6},
    {0,9,7,5,3},
    {8,6,4,2,0},
    {5,3,1,10,8},
    {2,0,9,7,5},
    {10,8,6,4,2},
    {7,5,3,1,10}};
int main()
{
    scanf("%d%d",&n,&k);n-=2;
    p=n%11;n/=11;
    ans=n*5;
    for(int i=0;i<p;i++)
        for(int j=0;j<5;j++)
            if(map[i][j]==k)ans++;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
fn main() {
    let input = read::<String>();
    let mut res: i32 = 0;
    for c in input.chars() {
        res += c as i32 - 48;
    }
    println!("{}", res);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

string s;
ll k;

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

	cin >> s >> k;
	ll cnt = 1;
	ll fa = 0;
	ll ans = 0;
	if (s[0] != s[s.length() - 1]) {
		for (int i = 1; i < s.length(); i++) {
			while (s[i - 1] == s[i]) {
				cnt++;
				i++;
			}
			fa += cnt / 2;
			cnt = 1;
		}
		cout << fa * k;
	}
	else {
		int b = 0;
		while (b < s.length() - 1 && s[b] == s[b + 1]) {
			b++;
		}
		if (b == s.length() - 1) {
			cout << s.length() * k / 2;
			return 0;
		}
		for (int i = 1; i < s.length(); i++) {
			while (i<s.length()&&s[i - 1] == s[i]) {
				cnt++;
				i++;
			}
			ans += cnt / 2;
			cnt = 1;
		}
		string s2;
		s2.append(s);
		s2.append(s);
		for (int i = b + 1; i < b + s.length(); i++) {
			while (s2[i - 1] == s2[i]) {
				cnt++;
				i++;
			}
			fa += cnt / 2;
			cnt = 1;
		}
		cout << ans + fa * (k - 1);
	}
}

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

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

Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 50;

vi G[N];
int A[N],B[N];
bool v[N];

int main() {
	int n,m;cin>>n>>m;
	rep(i,m) {
		int a,b;cin>>a>>b;a--;b--;
		A[i]=a;B[i]=b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	queue<int> Q;
	int ans=0;
	rep(i,m) {
		rep(j,n) v[j]=false;
		Q.push(0);v[0]=true;
		while(!Q.empty()){
			int k=Q.front();Q.pop();
			for(auto l:G[k]){
				if((k==A[i]&&l==B[i])||(k==B[i]&&l==A[i])) continue;
				if(v[l]) continue;
				v[l]=true;
				Q.push(l);
			}
		}
		rep(j,n) if(!v[j]) {ans++;break;}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 60);
typedef pair<ll, ll> pii;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
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;
}

int main()
{
    int dp[100001];
    int N;
    cin >> N;
    REP(i, 100002)
    {
        dp[i] = -1;
    }
    dp[0] = 0;
    vi all_list;
    vi now_list;
    all_list.push_back(1);
    int temp = 6;
    while (true)
    {
        all_list.push_back(temp);
        temp = temp * 6;
        if (temp > 100001)
            break;
    }
    temp = 9;
    while (true)
    {
        all_list.push_back(temp);
        temp = temp * 9;
        if (temp > 100001)
            break;
    }
    sort(ALL(all_list));
    REP(i, 100002)
    {
        if (i == 0)
            continue;
        if (i == all_list[0])
        {
            now_list.push_back(i);
            all_list.erase(all_list.begin());
        }
        int min_temp = 1000000;
        REP(j, now_list.size())
        {
            min_temp = min(min_temp, dp[i - now_list[j]] + 1);
        }
        dp[i] = min_temp;
    }
    cout << dp[N] << endl;
    //system("pause");
}

Measured memory_bytes: 640
#include<iostream>
#include<cmath>
#include<climits>
#define ll long long
using namespace std;
int main()
{
    ll a,b,c,k1,k2;
    cin>>a>>b>>c;
    if(c>=b)
        c=b-1;
    cout<<floor((a*c)/b)-(a*floor(c/b));    
    return 0;
}

Measured memory_bytes: 3772
N = int(input())
# [[1番の人の証言], [2番の人の証言], ..., [N番の人の証言]]
l = [[-1 for i in range(N)] for j in range(N)]
# N人についてそれぞれ証言をまとめる
for i in range(N):
    # 証言の数
    a = int(input())
    # 各証言をlに格納
    for _ in range(a):
        x, y = map(int, input().split())
        l[i][x - 1] = y

ans = 0

# bit全探索
# N人について聖人/狂人の計2**N通り
for i in range(2**N):
    # iをN桁2bitに変換, 1が聖人に対応
    d = [0 for _ in range(N)]
    # 下からj桁目のbitが立っているか否か
    for j in range(N):
        if i >> j & 1:
            d[j] = 1
    """
    ex. N=3の時、
    i = 0,1,2,3,4,5,6,7 この時、dはそれぞれ 
    [0, 0, 0],[1, 0, 0],[0, 1, 0],[1, 1, 0],
    [0, 0, 1],[1, 0, 1],[0, 1, 1],[1, 1, 1]
    """

    flag = True

    # dの中身を左から順に見ていく
    for j in range(N):
        # jの全員に対する証言について
        for k in range(N):
            # 狂人(d[j]==0)の証言は意味がないので無視して良い
            if d[j] == 1:
                # l[j][k] == -1 なら、その人に対する証言は存在しない
                if l[j][k] == -1:
                    continue
                # kについての証言と、kの実情が異なる場合（矛盾）
                if l[j][k] != d[k]:
                    flag = False
                    break

    # 一つも矛盾が存在しなかった場合
    # sum(d)は聖人の総数を表す
    if flag == True:
        ans = max(ans, sum(d))

print(ans)


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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for(int i = (int)(n); i > 0; --i)
#define all(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define rall(f,x,...) ([&](decltype((x)) whole) { return (f)(rbegin(whole), rend(whole), ## __VA_ARGS__); })(x)
#define sz(a) (int)(a).size()
#define mins(a,...) a = min<decltype(a)>({a, ## __VA_ARGS__})
#define maxs(a,...) a = max<decltype(a)>({a, ## __VA_ARGS__})
#define plusMod(a,b) a = (a % mod + b % mod) % mod
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) {
    return os.put(os.widen('\n'));
}
template<typename A, size_t N, typename T>
void fillArray(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}

string s, t;
void solve() {
    cin >> s >> t;

    int ans = 0;
    rep(i, 3)
        if (s[i] == t[i])
            ++ans;

    cout << ans << endn;

}


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    solve();

    cout << flush;

    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int sum[4][110];

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, l;
    cin >> n >> l;
    vector<int> w(n), v(n);
    int MIN = INF;
    rep(i, 0, n){
        cin >> w[i] >> v[i];
        chmin(MIN, w[i]);
    }
    vector<int> d[4];
    rep(i, 0, n){
        d[w[i] - MIN].push_back(v[i]);
    }
    rep(i, 0, 4){
        sort(all(d[i]));
        reverse(all(d[i]));
        sum[i][0] = 0;
        rep(j, 1, 110){
            sum[i][j] += sum[i][j - 1];
            if(j <= d[i].size()) sum[i][j] += d[i][j - 1];
        }
    }
    int ans = 0;
    rep(i, 0, n + 1){
        rep(j, 0, n + 1){
            rep(k, 0, n + 1){
                rep(p, 0, n + 1){
                    int cnt = i + j + k + p;
                    if(cnt * MIN + j + 2 * k + 3 * p > l) break;
                    chmax(ans, sum[0][i] + sum[1][j] + sum[2][k] + sum[3][p]);
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long 
#define pb push_back

#define f(i,n) for(i=0;i<n;i++)
#define fr(i,n) for(i=1;i<=n;i++)
#define fi first
#define se seecond
#define in insert

using namespace std;

int main() {
  ll n,i,j=0,k,q,b,c;
  cin>>n;
map <long,long> m;
 fr(i,n)
 {
     cin>>k;
     m[k]++;
     j+=k;
 }
 cin>>q;
 
 while(q--)
 {
     cin>>b>>c;
    j= j-b*m[b]+c*m[b];
    i=m[b];
    m[b]=0;
    m[c]+=i;
    cout<<j<<'\n';
 }
}

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

A=[int(i) for i in input().split()]
Ans=[]
C=[False]*n
for i in reversed(range(n)):
  if A[i]==1:    
    if 2*(i+1)>n:
      Ans.append(i+1)
      C[i]=True
    else:
      c=0
      j=2
      while j*(i+1)<=n:
        if C[j*(i+1)-1]==True:
          c^=1
        j+=1
      if c==0:
        Ans.append(i+1)
        C[i]=True
        
  elif A[i]==0:    
    c=0
    j=2
    while j*(i+1)<=n:
      if C[j*(i+1)-1]==True:
        c^=1
      j+=1
    if c==1:
      Ans.append(i+1)
      C[i]=True
      
if len(Ans)==0:
  print(0)
else:
  print(len(Ans))
  Ans.sort()
  print(*Ans)

Measured memory_bytes: 14100
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)*}
    };
}

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)*}
    };
}

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, usize1) => {
        read_value!($next, usize) - 1
    };

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

fn main() {
    input!{
        a: usize,
        p: usize
    }
    println!("{}", (a * 3 + p) / 2);
}


Measured memory_bytes: 4352
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))

def main():
    dic = {'A':'T','T':'A','C':'G','G':'C'}
    print(dic[input()])
if __name__ == '__main__':
  main()


Measured memory_bytes: 5148
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

int main(void){
    ll n;
    cin >> n;
    string s[n];
    rep(i, 0, n){
        cin >> s[i];
    }

    ll sum = 0;
    ll a = 0, b = 0, c = 0;
    bool flag = true;
    rep(i, 0, n){
        if(s[i][0] == 'B' && s[i][s[i].size()-1] == 'A'){
            a++;
        }else if(s[i][0] == 'B'){
            b++;
        }else if(s[i][s[i].size()-1] == 'A'){
            c++;
        }

        rep(j, 0, s[i].size() - 1){
            if(s[i][j] == 'A' && s[i][j+1] == 'B'){
                sum++;
            }
        }
    }

    if(b + c == 0 && a > 0){
        sum += a - 1;
    }else{
        sum += min(b, c) + a;
    }
    cout << sum << endl;
}


Measured memory_bytes: 768
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll = long long;
const ll MOD = 1000000007; 
using plong = pair<ll,ll>;

int main(){
    ll N,K;
    cin>>N>>K;
    ll res=0;
    if(K%2==1){
        ll num = N/K;
        res=num*num*num;
    }else{
        ll num = N/K;
        res += num*num*num;

        num = (N+K/2)/K;
        res += num*num*num;

    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
//
//  supercon.cpp
//
//
//  Created by Fourier Shuzaei on 2018/06/02.
//

#include "bits/stdc++.h"
using namespace std;
#define ri(a,b,c) for(int a=(b);a<(c);++a)
#define ll long long
#define rll(a,b,c) for(ll a=(b);a<(c);++a)

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

    int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
  cin>>n>>k;
  ri(i,0,n){
    cin>>a;
    if(a==1)b=i+1;
  }
int  min=100000;
ri(i,0,k){
if(b-i>0&&b+k-i-1<=n){
p=(b-i-1+k-2)/(k-1)+(n-(b+k-i-1)+k-2)/(k-1)+1;
  min=min<p?min:p;}
}











    cout<<min<<"\n";
}



Measured memory_bytes: 256
n = int(input())
s = input()
c = [0, 0, 0]
col1 = []
col2 = []
col3 = []
res = 0

for i in range(n):
    if s[i] == "R":
        col1.append(i)
    elif s[i] == "G":
        col2.append(i)
    else:
        col3.append(i)

res = len(col1) * len(col2) * len(col3)

for i in range((n + 1) // 2):
    for j in range(n - (i + 1) * 2):
        x = s[j]
        y = s[j + i + 1]
        z = s[j + (i + 1) * 2]
        if x == y or y == z or x == z:
            continue
        else:
            res = res - 1

print(res)

Measured memory_bytes: 9044
a =int(input())
b =int(input())
c =int(input())
d =int(input())
e =int(input())
sample_list = []
sample_list.append(a)
sample_list.append(b)
sample_list.append(c)
sample_list.append(d)
sample_list.append(e)
x = []
for i in sample_list:
  if i%10 == 0:
    x.append(0)
  else:
    x.append(10-(i%10))
print(sum(sample_list)+sum(x)-max(x))

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

int comp(int m,int y,int w,double in,int ch){
	for(int i=0;i<y;i++){
		m = m * (1.0 + in) - ch;
	}
	return m;
}
int simp(int m,int y,int w,double in,int ch){
	int sum = 0;
	for(int i=0;i<y;i++){
		sum += m * in;
		m -= ch;
	}
	return sum + m;
}
int main(){
	int d,m,y,n;//f[^Zbg,ú^pà,^pN,^píÞ
	int w,ch;// {¡|P},è¿
	double in;//N¦
	cin>>d;
	//for(;m>0;--m)
	for(int i=0;i<d;i++){
		int maxM=0;
		cin>>m>>y>>n;
		for(int j=0;j<n;j++){
			cin>>w>>in>>ch;
			if(w)maxM=max(maxM,comp(m,y,w,in,ch));			else maxM=max(maxM,simp(m,y,w,in,ch));
		}
		cout<<maxM<<endl;

	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    cout << ((b - a) % 2 ? min(a + (b - a - 1) / 2, n - b + 1 + (n - (a + n - b + 1)) / 2) : (b - a) / 2) << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long ll;
const ll INF = 0x7fffffffffffffffll;

ll radix_convert(ll x, int base){
	ll a = x, b = 0, c = 1;
	while(a > 0){
		if(a % base >= 10){ return -1; }
		b = b + a % base * c;
		a /= base;
		c *= 10;
	}
	return b;
}

int main(){
	while(true){
		ll a, b, c;
		cin >> a >> b >> c;
		if(a < 0 && b < 0 && c < 0){ break; }
		bool accept = false;
		for(int base = 2; base <= 16; ++base){
			if(radix_convert(a, base) == b){ accept = true; break; }
		}
		if(!accept){
			cout << -1 << endl;
			continue;
		}
		for(++a; a <= c; ++a){
			ll d = INF;
			for(int base = 2; base <= 16; ++base){
				ll e = a, f = 0, g = 1;
				while(e > 0){
					if(e % base >= 10){ break; }
					f = f + e % base * g;
					e /= base;
					g *= 10;
				}
				if(e == 0 && f >= b){
					d = min(d, f);
				}
			}
			b = d;
			if(b == INF){ break; }
		}
		cout << b << endl;
	}
	return 0;
}

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

int main(){
  int n,ans=0;
  cin >> n;
  string s;
  cin >> s;
  
  for(int i=0;i<1000;i++){
    int x=i;
    string key="";
    for(int j=0;j<3;j++){
      key+='0'+x%10;
      x/=10;
    }
    
    int point=0;
    for(int j=0;j<n;j++){
      if(s.at(j)==key.at(point)){
        point++;
      }
      if(point==3){
        break;
      }
    }
    if(point==3){
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <iomanip>
using ll = long long;
using namespace std;
//#define int long long

#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = 0; i <= (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int i = n; i >= 0; i--)
int factorical(int n) {
	int sum = 1;
	for (int i = 1; i <= n; ++i)
	{
		sum *= i;
	}
	return sum;
}

vector<int> divisors(int n) {
	vector<int> res;
	for (int i = 1; i * i <= n; ++i) {
		if (n % i != 0) continue;
		res.push_back(i);
		if (n / i == i) continue; // 上の行で追加済み。
		res.push_back(n / i);
	}
	return res;
}
vector<ll> divisors_ll(ll n) {
	vector<ll> res;
	for (ll i = 1; i * i <= n; ++i) {
		if (n % i != 0) continue;
		res.push_back(i);
		if (n / i == i) continue; // 上の行で追加済み。
		res.push_back(n / i);
	}
	return res;
}


void printVector(const vector<int>& vec) {
	for (int value : vec) {
		cout << value << " ";
	}
	cout << endl;
}

bool pal(string s) {
	int n = s.length() / 2;
			rep(i, n) {
			if (s[i] != s[s.length() - 1 - i]) return false;
		}
			return true;
}

int main() {
	string s1, s2, s3, ans;
	cin >> s1;
	s2 = s1.substr(0, ((s1.length() - 1) / 2) );
	s3 = s1.substr( (s1.length() + 3) / 2 - 1, s1.length() - ( (s1.length() + 3) / 2 ) + 1 );
	(pal(s1) && pal(s2) && pal(s3)) ? ans = "Yes" : ans = "No";
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(){
	int n,k;
	cin>>n>>k;
	vi boat(n);
	REP(i,k){
		int m;
		cin>>m;
		REP(j,m){
			int bunny;
			cin>>bunny;
			boat[bunny-1]=i;
		}
	}
	int r;
	cin>>r;
	vvi ng(n,vi(n));
	REP(i,r){
		int p,q;
		cin>>p>>q;
		ng[p-1][q-1]=1;
		ng[q-1][p-1]=1;
	}
	int ans=0;
	REP(i,n){
		bool omg=false;
		REP(j,n){
			if(ng[i][j]&&boat[i]==boat[j]){
				omg=true;
				break;
			}
		}
		if(omg){
			ans++;
		}
	}
	cout<<ans<<endl;
}

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

int main()
{
    int n, i;
    cin >> n;
    int a[n];
    for(i=0; i<n; i++)
    {
        cin >> a[i];
    }
    sort(a, a+n);
    for(i=0; i<n-1; i++)
    {
        if(a[i]==a[i+1])
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 1024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskE {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			int D = in.nextInt();
			int[] d = new int[n];
			for (int i = 0; i < n; i++) {
				d[i] = in.nextInt();
			}
			int numQueries = in.nextInt();
			Query[] queries = new Query[numQueries];
			for (int i = 0; i < numQueries; i++) {
				int q = in.nextInt() - 1;
				queries[i] = new Query();
				queries[i].id = i;
				queries[i].x = q;
			}

			// The suffix starting from i can represent any number in [1, f[i]].
			int[] f = new int[n + 1];
			f[n] = 0;
			for (int i = n - 1; i >= 0; i--) {
				int x = f[i + 1];
				f[i] = x;
				if (x + 1 > d[i] / 2) {
					f[i] = x + d[i];
				}
			}

			{
				int i = 0;
				int x = D;
				Arrays.sort(queries, (a, b) -> (a.x - b.x));
				for (Query q : queries) {
					while (i < q.x) {
						int nx = Math.abs(x - d[i]);
						x = Math.min(x, nx);
						i++;
					}
					q.ans = f[i + 1] < x;
				}
			}

			boolean[] ans = new boolean[numQueries];
			for (Query q : queries) {
				ans[q.id] = q.ans;
			}
			for (int i = 0; i < numQueries; i++) {
				out.println(ans[i] ? "YES" : "NO");
			}
		}

		class Query {
			int x;
			int id;
			boolean ans;

		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}



Measured memory_bytes: 112256
#include <iostream>
#include <string.h>

using namespace std;
int main(void)
{
	int n = 0;
	double x = 0.0;
	char y[3];
	
	cin >> n;
	
	double sum = 0.0;
	for (int i = 1; i <= n; i++) {
		cin >> x >> y;
		if (!strcmp(y, "BTC")) {
			sum += x * 380000.0;
		}
		else if (!strcmp(y, "JPY")){
			sum += x;
		}
		else {
			return 1;
		}
	}
	
	cout << sum << endl;
	
	return 0;
}


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

int main() {
    int n,ans,cc=0,tmp=1;cin>>n;
    int a[n];
    for(int i=0;i<n;++i){
        cin>>a[i];
    }
    while(cc<=n+1){
        tmp=a[tmp-1];
        cc++;
        if(tmp==2)break;
    }
    if(cc>=n+1)ans=-1;
    else ans=cc;
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	private int[] nico;
	private int[] tmp;
	
	private ArrayList<Integer> pungal;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);

		while (sc.hasNextLine() == true) {
			String line = sc.nextLine();
			ArrayList<Integer> al = new ArrayList<Integer>();
			
			for (int i = 0; i < 9; i++) {
				nico = new int[9];
				for (int j = 0; j < line.length(); j++) {
					nico[line.charAt(j) - '1']++;
				}
				nico[i]++;
				
				pungal = new ArrayList<Integer>();
				
				boolean flag = false;
				for (int j = 0; j < nico.length; j++) {
					if (nico[j] >= 3) pungal.add(j);
					if (nico[j] > 4) flag = true;
				}
				if (flag == true) continue;
				
				if (judge() == true) al.add(i + 1);
			}
			
			if (al.size() == 0) {
				System.out.println("0");
			} else {
				System.out.print(al.get(0));
				for (int i = 1; i < al.size(); i++) {
					System.out.print(" " + al.get(i));
				}
				System.out.println();
			}
		}
	}
	
	private boolean judge() {
		tmp = Arrays.copyOf(nico, nico.length);

		return pung(0);
	}
	
	private boolean pung(int counter) {
		if (counter == pungal.size()) {
			return pair();
		}

		if (pung(counter + 1) == true) return true;
		
		tmp[pungal.get(counter)] = tmp[pungal.get(counter)] - 3;
		if (pung(counter + 1) == true) {
			tmp[pungal.get(counter)] = tmp[pungal.get(counter)] + 3;
			return true;
		}
		
		tmp[pungal.get(counter)] = tmp[pungal.get(counter)] + 3;
		return false;
	}
	
	private boolean pair() {
		for (int i = 0; i < tmp.length; i++) {
			if (tmp[i] >= 2) {
				tmp[i] = tmp[i] - 2;
				if (chow() == true) {
					tmp[i] = tmp[i] + 2;
					return true;
				}
				
				tmp[i] = tmp[i] + 2;
			}
		}
		return false;
	}
	
	private boolean chow() {
		int[] test = Arrays.copyOf(tmp, tmp.length);
		for (int i = 0; i < test.length - 2; i++) {
			if (test[i] > 0) {
				test[i]--;
				test[i + 1]--;
				test[i + 2]--;
				
				i = -1;
			}
		}
		
		for (int i = 0; i < test.length; i++) {
			if (test[i] != 0) return false;
		}
		
		return true;
	}
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

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

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N;
    cin >> N;
    vector<int> v(N);
    for(int i = 0; i < N; ++i) {
        cin >> v[i];
    }

    for(int i = 0; i < N - 1; ++i) {
        if(v[i + 1] - v[i] >= 2) {
            cout << -1 << endl;
            return 0;
        }
    }

    if(v[0] != 0) {
        cout << -1 << endl;
        return 0;
    }

    LL res = 0;
    for(int i = 0; i < N - 1; ++i) {
        if(v[i] + 1 == v[i + 1]) ++res;
        else res += v[i + 1];
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4004
#include <vector>
#include <iostream>
#include <string>
#include <math.h>

using namespace std;



int main(void){

  
  int A,B,ans;

  cin >> A >> B ; 
 
 int wa = A + B;
 int sa = A - B;
 int seki = A * B;

ans = max(wa,sa);
ans = max(ans,seki);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
use std::vec::Vec;
use std::cmp::max;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let (k, n) = read_touple::<usize>();
    let mut a: Vec<i64> = read_vec();
    let k = k as i64;
    let mut ans = 0;
    for i in 0..n {
      let mut t = a[(i + 1) % n] - a[i];
      if t < 0 {
        t += k;
      }
      ans = max(ans, t);
    }

    println!("{}", k - ans);
}


Measured memory_bytes: 10492
import sys
n = int(input())
data = [list(map(int,input().split())) for i in range(n)]

for i in range(n):
    if i>0:
        distance = abs(data[i][1]-data[i-1][1])+abs(data[i][2]-data[i-1][2])
        time = abs(data[i][0]-data[i-1][0])
    else:
        distance = abs(data[i][1])+abs(data[i][2])
        time = abs(data[i][0])
    
    if distance <= time:
        if (data[i][0] + data[i][1] + data[i][2])% 2 == 0:
            continue
        else:
            break
    else:
        break
else:
    print("Yes")
    sys.exit()

print("No")


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

using namespace std;

int main () {
    int N, i;
    cin >> N;
    vector<int> A(N), B(N), C(N);
    

for(i = 0; i < N; ++i){
    cin >> A[i] >> B[i] >> C[i];
}

for(i = 0; i < N; ++i){
    if(A[i]*A[i] + B[i]*B[i] == C[i]*C[i] || A[i]*A[i] + C[i]*C[i] == B[i]*B[i] || B[i]*B[i] + C[i]*C[i] == A[i]*A[i]){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

}



Measured memory_bytes: 3096
#include<stdio.h>
int main()
{
    int a,b,c,d,x,y;
    while(scanf("%d%d%d%d",&a,&b,&c,&d)==4)
    {
        if(a>=c)x=a;
        else x=c;
        if(b>=d)y=d;
        else y=b;
        if(y-x>=0)printf("%d\n",y-x);
        else printf("%d\n",0);
    }
    return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=5010;
int n,m,b[maxn][maxn],s[maxn],l[maxn][maxn],r[maxn][maxn],w[maxn];
ll a[maxn],A[maxn][maxn];
int main(){
    scanf("%d%d",&n,&m);
    for(int i=2;i<=n;i++)scanf("%lld",&a[i]),a[i]+=a[i-1];
    for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)scanf("%d",&b[j][i]);
    for(int i=1;i<=m;i++){
        int top=0;
        for(int j=1;j<=n;j++){
            while(top&&b[i][j]>b[i][s[top]])top--;
            if(top)l[i][j]=s[top]+1;else l[i][j]=1;
            s[++top]=j;
        }
        top=0;
        for(int j=n;j>=1;j--){
            while(top&&b[i][j]>b[i][s[top]])top--;
            if(top)r[i][j]=s[top]-1;else r[i][j]=n;
            s[++top]=j;
        }
        for(int j=1;j<=n;j++){
            A[l[i][j]][j]+=b[i][j];
            A[l[i][j]][r[i][j]+1]-=b[i][j];
            A[j+1][j]-=b[i][j];
            A[j+1][r[i][j]+1]+=b[i][j];
        }
    }
    ll ans=-1ll<<60;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++)A[i][j]+=A[i][j-1];
        for(int j=1;j<=n;j++)A[i][j]+=A[i-1][j];
        for(int j=i;j<=n;j++)ans=max(ans,A[i][j]-a[j]+a[i]);
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 213760
from numpy import cos, pi, sqrt
li = list(map(int, input().split()))
A, B, H, M = li[0], li[1], li[2], li[3]

thetaA = pi*(H/6 + M/360)
thetaB = pi*M/30
dtheta = abs(thetaA - thetaB)
if dtheta > pi:
    dtheta = 2*pi - dtheta
x = sqrt(A**2 + B**2 -2*A*B*cos(dtheta))
print(x)

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

#include "bits/stdc++.h"
using namespace std;


class APluralForm {
public:
	void solve(std::istream& in, std::ostream& out) {
    string s;
    in >> s;
    if(s[s.length() - 1] == 's') s += "es";
    else s += "s";
    out << s << endl;
	}
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
	APluralForm solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3652
import sys
H, W = list(map(int, input().split()))
C = [list(input()) for _ in range(H)]
for i in range(H):
    for j in range(W):
        if C[i][j] == '#':
            cnt = 0
            if i - 1 >= 0 and C[i - 1][j] == '#':
                cnt += 1
            if i + 1 < H and C[i + 1][j] == '#':
                cnt += 1
            if j - 1 >= 0 and C[i][j - 1] == '#':
                cnt += 1
            if j + 1 < W and C[i][j + 1] == '#':
                cnt += 1
            if cnt == 0:
                print('No')
                sys.exit()
print('Yes')


Measured memory_bytes: 9212
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int[] a = new int[n-1];
    String[] str = in.readLine().split(" ");
    in.close();
    int[] boss = new int[n];
    for(int i=0; i<n-1; i++) {
      a[i] = Integer.parseInt(str[i]); 
      boss[a[i]-1]++;
    }
    for(int i=0; i<n; i++) {
      System.out.println(boss[i]);
    }
  }
}


Measured memory_bytes: 66568
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<62

int x[50];
int y[50];
int N, K;

void input() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) cin >> x[i] >> y[i];
}

void solve() {
	ll ans = LLINF;
	ll x1, x2, y1, y2;

	for (int i = 0; i < N; i++) { // x
		for (int j = i+1; j < N; j++) { // x
			for (int k = 0; k < N; k++) { // y
				for (int l = k+1; l < N; l++) { // y
					x1 = min(x[i], x[j]);
					x2 = max(x[i], x[j]);
					y1 = min(y[k], y[l]);
					y2 = max(y[k], y[l]);
					int cnt = 0;

					for (int m = 0; m < N; m++) if (x1 <= x[m] && x[m] <= x2 && y1 <= y[m] && y[m] <= y2) cnt++;
					if (cnt >= K) ans = min(ans, (x2 - x1)*(y2 - y1));
				}
			}
		}
	}
	
	cout << ans << endl;
}

int main() {
	input();
	solve();

	return 0;
}

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

using namespace std;

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

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    multiset<int> b;
    b.insert(a[n - 1]);

    for (int i = n - 2; i >= 0; i--) {
        multiset<int>::iterator ite = b.upper_bound(a[i]);
        if (ite != b.end()) {
            b.erase(ite);
        }

        b.insert(a[i]);
    }

    cout << b.size() << endl;
}


Measured memory_bytes: 5376
//git pull --rebase origin master
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define wi(t) int t;cin>>t;while(t--)
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];
ll int gcd(ll int a, ll int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
int tc=1;
void solve()
    { 
        ll int n;
        cin>>n;
        ll int ans=0;
        for(int i=1;i<n;i++)
        {   
           ans+=(n-1)/i;
        }
        cout<<ans;
    }

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

  //  wi(t)
    {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
    int i, u, v;
    while(m--){
        cin>>u>>v;
    u--, v--;
        g[u].pb(v);
        g[v].pb(u);
    }
}

void dfs(int u, int par){
    for(int v:g[u]){
        if (v == par) continue;
        dfs(v, u);
    }
}







Measured memory_bytes: 10644
import sys
sys.setrecursionlimit(100000)

while True:
    w, h = map(int, input().split())
    if w == 0:
        break
    field = [list(map(int, input().split())) for _ in range(h)]
    searched = [[False for _ in range(w)] for __ in range(h)]
    
    islands = 0
    
    def search(x, y):
        if not (0 <= x < w and 0 <= y < h):
            return 0
        if searched[y][x]:
            return 0
        searched[y][x] = True
        if field[y][x] == 0:
            return 0
        
        search(x-1, y-1)
        search(x-1, y)
        search(x-1, y+1)
        search(x, y-1)
        search(x, y+1)
        search(x+1, y-1)
        search(x+1, y)
        search(x+1, y+1)
        
        return 1
        
    for y in range(h):
        for x in range(w):
            if not searched[y][x]:
                islands += search(x, y)
                    
    print(islands)
    


Measured memory_bytes: 7912
#include<cstdio>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
#define ll long long
using namespace std;
char ch[500];
int  m[500][500];
int  vis[500];
int  tag[500];
int  N,M,C;
int cnt=0;
void init()
{
	for(int i=0;i<500;i++)
	for(int j=0;j<500;j++)
	m[i][j]=0x3f3f3f7f;
	
	for(int i=0;i<500;i++)
	vis[i]=1;
	memset(tag,0,sizeof(tag));
	cin>>N>>M>>C;

   for(int i=1;i<=C;i++)
   {
   	  int t;cin>>t;
   	  tag[cnt++]=t;
   	  vis[t]=0;
   }

	for(int i=1;i<=M;i++)
	{
	   	int a,b,c;
	   	cin>>a>>b>>c;
	   	m[a][b]=m[b][a]=c;
	}
}

int S=0x3f3f3f3f;
int sum=0;
void dfs(int i)
{

	int flag=0;
	for(int j=0;j<cnt;j++)
	{
		if(!vis[tag[j]])
		{
			flag=1;
			sum+=m[i][tag[j]];
			vis[tag[j]]=1;
	        dfs(tag[j]);
	        sum-=m[i][tag[j]];
	        vis[tag[j]]=0;
		}
	}
	if(!flag)
	{
		if(sum<S)
		S=sum;
	}
}
int main()
{
   //freopen("data.in","r",stdin);
   //freopen("data.out,"w",stdout);
  ll sum=0;
  init();
  for(int k=1;k<=N;k++)
	for(int i=1;i<=N;i++)
	  for(int j=1;j<=N;j++)
	    if(i!=j)
		m[i][j]=min(m[i][k]+m[k][j],m[i][j]);
   int MIN=0x3f3f3f3f;
   for(int i=0;i<cnt;i++)
   {
   	  vis[tag[i]]=1;
   	  dfs(tag[i]);
	  vis[tag[i]]=0;
	  sum=0;
   }
   cout<<S<<endl;
   return 0;
}


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

int main()
{ 
	int n;
    cin >> n;
 	int h[n];
    rep(i,n)cin >> h[i];
    int ans = 0;
    int x = 0;
    rep(i,n-1){
        if(h[i]>=h[i+1])ans++;
        else ans = 0;
        x = max(x,ans);
    }
    cout << x << endl;
  return 0;
}

Measured memory_bytes: 640
n =int(input())
w =[]
for i in range(n):
    w.append(input())
import sys
for i in range(n):
    for j in range(n):
        if i != j:
            if w[i] ==w[j]:
                print("No")
                sys.exit()

for i in range(n-1):
    if w[i][-1] != w[i+1][0]:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 3064
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
 
input = sys.stdin.readline
a, b, c = map(int, input().split())
if (a + b) >= c:
    print(b + c)
    exit(0)
else:
    print(a + 2 * b + 1)
    exit(0)


Measured memory_bytes: 2940