akhauriyash/Code-Regression huggingface dataset:
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    AIN(ll, A, N);
    SORT(A);
    ll s = 0;
    ll ans = N;
    REP(i, N - 1)
    {
        s += A[i];
        if (A[i + 1] > 2 * s)
        {
            ans = N - (i + 1);
        }
    }
    OUT(ans);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;

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

    // solution comes here
    ll N, Q;    string S;
    cin >> N >> Q >> S;

    vl SUM(N);
    SUM[0] = 0;
    rep(i, N-1) SUM[i+1] = SUM[i] + (S.substr(i, 2) == "AC");
    
    ll l, r;
    rep(i, Q) {
        cin >> l >> r;
        cout << SUM[--r] - SUM[--l] << nl;
    }
}

Measured memory_bytes: 1872
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
using namespace std;


int main (int argc, char const *argv[])
{
    string N;
    cin>>N;

    
    if (N[0]==N[1]&&N[1]==N[2]) {
        cout<<"Yes"<<endl;
    }
    else 
    if (N[1]==N[2]&&N[2]==N[3]) {
        cout<<"Yes"<<endl;
    }else
    
    {
        cout<<"No"<<endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
input_ = input()

front = int(input_[0:2])
back = int(input_[2:])

is_front_month = False
is_back_month = False

if(front >= 1 and front <= 12):
    is_front_month = True
if(back >= 1 and back <= 12):
    is_back_month = True

if is_front_month and is_back_month:
    print('AMBIGUOUS')
elif not is_front_month and is_back_month:
    print('YYMM')
elif is_front_month and not is_back_month:
    print('MMYY')
elif not is_front_month and not is_back_month:
    print('NA')


Measured memory_bytes: 3060
#include <cstdio>

const int MOD = 1e9 + 7, MAX_N = 2e5 + 5;
typedef long long LL;

LL factorial[MAX_N];
LL inverse_factorial[MAX_N];

LL power_mod(LL x, LL power, LL MOD)
{
    LL answer = 1;

    while(power)
    {
        if(power%2 == 1)
            answer = (answer*x)%MOD;

        x = (x*x)%MOD;
        power = power >> 1;
    }

    return answer;
}

LL choose(LL n, LL r, LL MOD)
{
    LL numerator = factorial[n];
    LL denominator_inverse = (inverse_factorial[r]*inverse_factorial[n - r])%MOD;

    return (numerator*denominator_inverse)%MOD;
}

int main()
{
    const int MOD = 1e9 + 7;

    factorial[0] = 1;
    for(int i = 1; i < MAX_N; i++)
        factorial[i] = (i*factorial[i - 1])%MOD;

    inverse_factorial[MAX_N - 1] = power_mod(factorial[MAX_N - 1], MOD - 2, MOD);
    for(int i = MAX_N - 2; i >= 0; i--)
        inverse_factorial[i] = ( (i + 1)*inverse_factorial[i + 1] )%MOD;

    int no_of_factors, n;
    scanf("%d %d", &no_of_factors, &n);

    LL answer = 1;
    for(int i = 2; i*i <= n; i++)
    {
        int exponent = 0;

        while(n%i == 0)
        {
            n = n/i;
            exponent++;
        }

        LL no_of_ways_of_placing_this_prime = choose(exponent + no_of_factors - 1, exponent, MOD);
        answer = (answer*no_of_ways_of_placing_this_prime)%MOD;
    }

    if(n > 1)
    {
        int exponent = 1;

        LL no_of_ways_of_placing_this_prime = choose(exponent + no_of_factors - 1, exponent, MOD);
        answer = (answer*no_of_ways_of_placing_this_prime)%MOD;
    }

    printf("%lld\n", answer);
    return 0;
}


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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define printf(x) cout << fixed << setprecision(9) << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

//最小公倍数
int lcm(int number1,int number2){
	return number1 * number2 / gcd(number1,number2);	
}

int main(){

int N, L;
cin >> N >> L;
int eat = L;
int sum = 0;
for(int i = 0; i < N; i++){ 
   int taste = i + L;
   sum += taste;
   if(abs(eat) > abs(taste)) eat = taste;
}

int ans = sum - eat;
cout << ans << endl; 
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
long long int dp[1001][1001];
int main(void)
{
	int N,M,i,j,D[1001],C[1001];

	scanf("%d %d", &N, &M);
	for (i = 1; i <= N; i++)
	{
		scanf("%d", &D[i]);
	}
	for (j = 1; j <= M; j++)
	{
		scanf("%d", &C[j]);
	}
	memset(dp, 0x7f, sizeof(dp));
	for (i = 0; i <= N; i++)
	{
		for (j = i; j <= M; j++)
		{
			if (i == 0)
			{
				dp[i][j] = 0;
			}
			else
			{
				dp[i][j] = min(dp[i][j - 1], dp[i - 1][j - 1] + D[i] * C[j]);
			}
		}
	}
	printf("%d\n", dp[N][M]);
	return 0;
}

Measured memory_bytes: 10564
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
#define int long long

signed main(void){
  int n,m;
  int a,b;
  cin >> n >> m;
  vector<int> ret;
  for(int i = 0; i < n; i++)ret.push_back(0);

  for(int i = 0; i < m; i++){
    cin >> a >> b;
    ret[a-1]++;
    ret[b-1]++;
  }
  for(int i = 0; i < n; i++)cout << ret[i] << "\r\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
int f(int n){
	if (n%2==0) return false;
	int ans=0;
	rep(i,n) if(n%(i+1)==0) ans++;
	return ans==8;
}
int main(){
	int n,ans=0;
	cin>>n;
	rep(i,n) if(f(i+1)) ans++;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<31)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define vii vector<int>
#define vll vector<long long>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n;
ll ans = 0;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    vll a(n);
    rep(i, 0, n) cin >> a[i];
    int cnt = 1;
    rep(i, 0, n) {
        if (a[i] % 2 == 0) cnt *= 2;
    }
    ans = (ll)pow(3, n) - cnt;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int w = scanner.nextInt();
        int h = scanner.nextInt();
        long n = scanner.nextLong();
        Map<String, Integer> map = new HashMap<>();
        for (long i = 0; i < n; i++) {
            int ax = scanner.nextInt() - 1;
            int ay = scanner.nextInt() - 1;
            for (int x = -1; x <= 1; x++) {
                for (int y = -1; y <= 1; y++) {
                    if (ax + x >= 1 && ax + x < w - 1) {
                        if (ay + y >= 1 && ay + y < h - 1) {
                            String key = (ax + x) + "," + (ay + y);
                            Integer compute = map.compute(key, (s, integer) -> {
                                if (integer == null) {
                                    return 1;
                                } else {
                                    return integer + 1;
                                }
                            });

                        }
                    }
                }
            }
        }
        int[] r = new int[10];
        Object[] values = map.values().toArray();
        BigDecimal all = new BigDecimal(w - 2).multiply(new BigDecimal(h - 2));
        for (int i = 0; i < values.length; i++) {
            r[(Integer) values[i]]++;
        }
        for (int i = 0; i < r.length; i++) {
            all = all.subtract(new BigDecimal(r[i]));
        }
        System.out.println(all);
        for (int i = 1; i < r.length; i++) {
            System.out.println(r[i]);
        }

    }

}

Measured memory_bytes: 177352
from math import atan, degrees

def angle(a, b, x):
    return degrees(atan(((a * b ** 2) / ( 2 * x)) if x <= 0.5 * b * a ** 2 else ((2 * (b - (x / (a ** 2)))) / a)))
	
print(angle(*map(int, input().split())))

Measured memory_bytes: 9364
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  ll a,b,n;
  cin>>a>>b>>n;
  ll x=b-1;
  if(b-1>n) x=n;
  ll ans=a*x/b-(a*x%b)/b;
  cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define mod 1000000007
#define INF2 9999999999
#define INF (1 << 30)
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)

using namespace std;
using ll = __int64_t;

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

int train[501][501] = {};
int C[501][501] = {};

void solve(){
    int N, M, Q, l, r, p, q;
    cin >> N >> M >> Q;

    for(int i = 0; i < M; i++){
        cin >> l >> r;
        train[l][r]++;
    }
    for(int i = 1; i <= N; i++){
        for(int j = i; j <= N; j++){
            C[i][j] = C[i][j-1] + train[i][j];
        }
    }
    for(int i = 0; i < Q; i++){
        cin >> p >> q;
        int res = 0;
        for(int j = p; j <= q; j++){
            res += C[j][q] - C[j][p-1];
        }
        cout << res << endl;
    }
}

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

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

double th = M_PI * 60.0 / 180.0;

int cnt, n;


int koch(int n, std::vector<double> left, std::vector<double> right){
    
    if(n == 0){
        return 0;
    } 
  
    std::vector<double> m1(2);
    std::vector<double> m2(2);
    std::vector<double> m3(2);

    m1[0] = left[0] + (right[0] - left[0]) / 3.0;
    m1[1] = left[1] + (right[1] - left[1]) / 3.0;

    koch(n-1, left, m1);


    printf("%lf %lf\n", m1[0], m1[1]);


    m2[0] = left[0] + (right[0] - left[0]) * 2.0 / 3.0;
    m2[1] = left[1] + (right[1] - left[1]) * 2.0 / 3.0;

    double xm3 = m2[0] - m1[0];
    double ym3 = m2[1] - m1[1];

    m3[0] = cos(th) * xm3 - sin(th) * ym3 + m1[0];
    m3[1] = sin(th) * xm3 + cos(th) * ym3 + m1[1]; 
 
    koch(n-1, m1, m3);

    printf("%lf %lf\n", m3[0], m3[1]);

    koch(n-1, m3, m2);

    printf("%lf %lf\n", m2[0], m2[1]);

    koch(n-1, m2, right);


    
    
}

int main(void){
    std::vector<double> left = {0, 0};
    std::vector<double> right = {100, 0};
    cnt = 0;

    scanf("%d", &n);

    printf("%lf %lf\n", left[0], left[1]);

    koch(n, left, right);

    printf("%lf %lf\n", right[0], right[1]);


    return 0;
}


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

using namespace std;

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

    int n;
    cin >> n;
    vector<long long> a(n + 1);
    for(int i =1; i<=n; ++i) {
        for(int j =i; j<=n; j += i) {
            a[j]++;
        }
    }
    long long ans = 0;
    for(long long i =1; i<=n; ++i) ans = ans + i * a[i];
    cout << ans;
}

Measured memory_bytes: 81268
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
const int INF = 1 << 20;

typedef long long ll;

bool kaibun(string s){
  int n = s.size()/2;
  bool f = true;
  REP(i,n){
    if(s[i] != s[s.size()-i-1]){
      return false;
    }
  }
  return true;
}


int main(){
  string s;
  cin >> s;
  string str = "";
  REP(i,s.size()){
    if(s[i] != 'x'){
      str += s[i];
    }
  }
  bool f = kaibun(str);
  if(!f){
    cout << -1 << endl;
    return 0;
  }
  else{
    int num = str.size()/2;
    if(str.size()%2 == 0)
      num--;
    int now = 0;
    int pos,ps;
    REP(i,s.size()){
      if(s[i] == str[now]){
	now++;
      }
      if(now > num){
	pos = i;
	break;
      }
    }
    
    vector <int> r;
    vector <int> l;
    int n = 0;
    //cout << pos << endl;
    REP(i,pos+1){
      if(s[i] == 'x'){
	n++;
      }
      else{
	l.pb(n);
	n = 0;
      }
      /*
      if(i == pos - 1 && s[i] == 'x'){
	l.pb(n);
	break;
	}*/
    }
    n = 0;
    int sum = 0;
    if(str.size()%2 == 0){
      for(int i = pos+1;i < s.size();i++){
	if(s[i] != 'x'){
	  pos = i;
	  break;
	}
      }
    }
    for(int i = s.size()-1;i >= pos ;i--){
      if(s[i] == 'x'){
	n++;
      }
      else{
	r.pb(n);
	n = 0;
      }
      /*
      if(i == pos+1 && s[i] == 'x'){
	r.pb(n);
	break;
	}*/
      
      
    }
    REP(i,r.size()){
      //cout << "l : " << l[i] << "  r : " << r[i] << endl;
      sum += abs(l[i] - r[i]);
    }
    cout << sum << endl;
  }
  return 0;
}


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

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

	int tmp;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		if (tmp >= k) sum++;
	}
	cout << sum << endl;

	return 0;
}

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

def gcd(x, y):
    if x == 0 or y == 0:
        return max(x, y)
    if y == 0:
        return x
    return gcd(y, x % y)

param = [[0, 0, 0]]
addr = 0
while True:
    if len(param) <= 0:
        break
    addr, Li, Lv = param.pop()
    if addr == 0:
        if Li == N-1:
            Rv = 0
            M, isCall = Lv, False
            continue            
        param += [[1, Li, Lv], [0, Li+1, gcd(Lv, A[Li])]]
        isCall = True
        continue 
    elif addr == 1:
        Rv = gcd(A[Li+1], Rv)
        M, isCall = max(M, gcd(Lv, Rv)), False
        continue

print(M)


Measured memory_bytes: 20840
#include <bits/stdc++.h>
using namespace std;
 
 
int main(){
    #define int long long 
    int N;
    string S;
    map<char,int>m;
    cin >> N >> S;
    int cnt1=0;
    int cnt2=0;
    int cnt3=0;
 
    for(int i=0;i<N;i++){
        if(S[i]=='R')cnt1++;
        if(S[i]=='G')cnt2++;
        if(S[i]=='B')cnt3++;
    }
 
    int ans=0;
    int num=0;
    ans+=cnt1*cnt2*cnt3;
    int dis=0;
    for(int a=0;a<N;a++){
        for(int b=0;b<N;b++){
            if(a-b<=0||S[a]==S[b]){
                continue;
            }
            dis=a-b;
            if(b-dis>=0){
                if(S[b-dis]!=S[b]&&S[b-dis]!=S[a]){
                    num++;
                }
            }
 
            if(a+dis<N){
                if(S[a+dis]!=S[b]&&S[a+dis]!=S[a]){
                    num++;
                }                
            }
        }
    }
    ans=ans-num/2;
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <set>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;

set<vector<int>> S;
int P,Q,A,N;

struct Frac{
    int p,q;//frac{p}{q}
    Frac(int P, int Q){
        p=P; q=Q;
    }
    int gcd(int a, int b){
        if(b==0) return a;
        return gcd(b,a%b);
    }
    void reduce(){
        int d=gcd(p,q);
        if(d<0)d=-d;
        p/=d; q/=d;
    }
    Frac operator*(const Frac& F){
        Frac ret(p*F.p,q*F.q);
        ret.reduce();
        return ret;
    }
    Frac operator*(int d){
        Frac ret(p*d,q);
        ret.reduce();
        return ret;
    }
    Frac operator/(const Frac& F){
        Frac ret(p*F.q,q*F.p);
        ret.reduce();
        return ret;
    }
    Frac operator/(int d){
        Frac ret(p,q*d);
        ret.reduce();
        return ret;
    }
    Frac operator+(const Frac& F){
        Frac ret(p*F.q+q*F.p,q*F.q);
        ret.reduce();
        return ret;
    }
    Frac operator+(int d){
        Frac ret(p+q*d,q);
        ret.reduce();
        return ret;
    }
    Frac operator-(const Frac& F){
        Frac ret(p*F.q-q*F.p,q*F.q);
        ret.reduce();
        return ret;
    }
    Frac operator-(int d){
        Frac ret(p-q*d,q);
        ret.reduce();
        return ret;
    }
    bool operator<(const Frac& F){
        Frac ret(p*F.q-q*F.p,q*F.q);
        ret.reduce();
        return ret.p<0;
    }
    bool operator<=(const Frac& F){
        Frac ret(p*F.q-q*F.p,q*F.q);
        ret.reduce();
        return ret.p<=0;
    }
};

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
/*
int rec(int max, int a, int p, int q, int n){
    // if(q*a>A) return 0;
    if(p==0&&n>=0) return 1;
    if(n<0||a>A) return 0;
    int ret=0;
    for(int r=max+1;a*r<=A;r++){
        //for(int k=1,ar=a*r;ar<=A&&Frac(k,r)<=f;k++,ar*=r){
        for(int k=1,ar=a*r;ar<=A&&k*q<=r*p;k++,ar*=r){
            //ret+=rec(r,ar,f-Frac(k,r),n-k);
            int fp=p*r-k*q,fq=q*r;
            int d=gcd(fp,fq);
            if(fq/d*a<=A) ret+=rec(r,ar,fp/d,fq/d,n-k);
        }
    }
    return ret;
}*/

int rec2(int rmin, int p, int q, int n){
    if(n<0||p*Q>q*P) return 0;
    if(p*Q==q*P) return 1;
    int ret=0;
    for(int r=rmin;q*r<=A;r++){
        ret+=rec2(r,p*r+q,q*r,n-1);
    }
    return ret;
}


int main(){
    while(cin>>P>>Q>>A>>N,P){
        //cout<<rec(0,1,P,Q,N)<<endl;
        cout<<rec2(1,0,1,N)<<endl;
    }
    return 0;
}

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

int main(){
  int n;
  vector<string> vec;

  cin >> n;

  for(int i = 0;i < n;i++){
    string tmp;
    cin >> tmp;
    vec.push_back(tmp);
  }

  for(int i = 0;i < vec.size()-1;i++){
    if(vec[i][vec[i].size()-1] != vec[i+1][0]){
      cout << "No" << endl;
      return 0;
    }
    for(int j = i+1;j < vec.size();j++){
      if(vec[i] == vec[j]){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;

  return 0;
}


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

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

  int n, w;
  cin >> n >> w;
  vector<int> value(n), weight(n);
  for(int i = 0; i < n; ++i) cin >> value[i] >> weight[i];

  vector<vector<int>> dp(n + 1, vector<int>(w + 1, 0));
  for(int i = 0; i < n; ++i) {
    for(int j = 0; j <= w; ++j) {
      dp[i + 1][j] = dp[i][j];
      if(j >= weight[i]) dp[i + 1][j] = max(dp[i + 1][j], max(dp[i][j - weight[i]], dp[i + 1][j - weight[i]]) + value[i]);
    }
  }
  cout << dp[n][w] << endl;
}


Measured memory_bytes: 6840
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
	public static void main(String [] args) throws IOException {
		FastScanner in= new FastScanner(System.in);
		
		int n= in.nextInt();
		if(n==0) {
			System.out.println(0);
			return;
		}
		String res="";
		while(n!=0) {
			int thing= n/-2;
			int rem= n%-2;
			if(rem<0) {
				rem= (rem+2)%2;
				if(thing<0) thing--;
				else thing++;
			}
			
//			System.out.println(rem);
			res=  ""+rem+res;
			n= thing;
		}
		
		System.out.println(res);
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}

		public String next() throws IOException {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
				return next();
			}
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
	public static int go(String a) {
		int res=0;
		for (int i = 0; i < a.length(); i++) {
			res+= a.charAt(i)-'0';
		}
		return res;
	}
	public static int len(String a) {
		int res=0;
		for (int i = a.length()-1; i >=0; i--) {
			if(a.charAt(i)-'0'==0) res++;
			else return res;
		}
		return res;
	}
}


Measured memory_bytes: 21332
#include <stdio.h>
int main(void){
	int x,y,z;
	while(1){
		scanf("%d %d",&x,&y);
		if(x==0 && y==0){
			break;
		}else if(x > y){
			z = x;
			x = y;
			y = z;
		}
		printf("%d %d\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
using namespace std;
int main(void){
    int D,N;
    cin >> D >> N;
    long long ans;
    if(D == 0){
        ans = N;
        if(N == 100){
            ans ++;
        }
    }
    if(D == 1){
        ans = 100 * N;
        if(N == 100){
            ans += 100;
        }
    }
    if(D == 2){
        ans = 10000 * N;
        if(N == 100){
            ans += 10000;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3096
#include<iostream>
using namespace std;
int main()
{
	int n,i,s=0,k,n1;
	cin>>n;
	n1=n;
	for(i=1;;i++)
	{
		k=n%10;
		s=s+k;
		n=n-k;
		if(n==0)
		{
			break;
		}
		n=n/10;
	} 
	if(n1%s==0)
	{
		cout<<"Yes"<<endl;
	}
	if(n1%s!=0)
	{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;


int gcd(int a, int b) {
    if (a < b)swap(a, b);
    if (a % b == 0)return b;
    return gcd(b, a % b);
}

int main()
{

    int n;
    cin >> n;
    int ans = 0;
    for (int i= 1;i <= n;i++) {
        for (int j = 1;j <= n;j++) {
            for (int k = 1;k <= n;k++) {
                ans += gcd(i, gcd(k, j));
                
            }
        }
  }
    cout << ans << endl;
    


    return 0;

}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    private static final int GRAY = 0;
    private static final int BROWN = 1;
    private static final int GREEN = 2;
    private static final int WATER = 3;
    private static final int BLUE = 4;
    private static final int YELLOW = 5;
    private static final int ORANGE = 6;
    private static final int RED = 7;
    private static final int OTHERS = 8;

    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int[] colors = new int[9];
        for (int i = 0; i < n; i++) {
            final int a = scanner.nextInt();
            if (a < 400) {
                colors[GRAY]++;
            } else if (a < 800) {
                colors[BROWN]++;
            } else if (a < 1200) {
                colors[GREEN]++;
            } else if (a < 1600) {
                colors[WATER]++;
            } else if (a < 2000) {
                colors[BLUE]++;
            } else if (a < 2400) {
                colors[YELLOW]++;
            } else if (a < 2800) {
                colors[ORANGE]++;
            } else if (a < 3200) {
                colors[RED]++;
            } else {
                colors[OTHERS]++;
            }
        }

        int min = 0;
        int max;
        for (int i = 0; i <= RED; i++) {
            if (colors[i] > 0) {
                min++;
            }
        }

        max = min + colors[OTHERS];
        min = min == 0 && colors[OTHERS] > 0 ? 1 : min;

        System.out.println(min + " " + max);
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <chrono>
#include<math.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std::chrono;
using namespace std;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// declaration: ordered_set os;  methods->  1. *os.find_by_order(x)   2. os.order_of_key(k) ->return int

#define fr(x,i,n) for(int x = i; x < n; ++x)
#define fb(x,i,n) for(int x = i; x >= n; --x)
#define pr pair<ll,ll>
#define ll long long int
#define ld long double
const ll mod=1e9+7;
const int N=2e6+5;
/*
ll f(ll x, ll n){
    ll r=1;
    while(n>0){
        if(n&1)
        r=(r*x)%mod;
        x=(x*x)%mod;
        n/=2;
    }
    return r;
}

ll fact[N],ifact[N];
void build(){
    fact[0]=1;
    fact[1]=1;
    for(ll i=2;i<N;i++)
    fact[i]=(fact[i-1]*i)%mod;
    fr(i,0,N)
    ifact[i]=f(fact[i],mod-2);
}
ll C(ll n, ll r){
    if(r==0)
    return 1;
    ll ans=fact[n];
    ans=(ans*ifact[r])%mod;
    ans=(ans*ifact[n-r])%mod;
    return ans;
}
vector<vector<ll> > matmul(vector<vector<ll> > v1,vector<vector<ll> > v2){
    vector<vector<ll> > v(6,vector<ll>(6,0));
    fr(i,0,6){
        fr(j,0,6){
            fr(k,0,6)
            v[i][j]=(v[i][j]+ v1[i][k]*v2[k][j])%mod;
        }
    }
    return v;
}
vector<vector<ll> > matf(ll n){
    vector<vector<ll> >z={
    {1,1,1,1,1,1},
    {1,0,0,0,0,0},
    {0,1,0,0,0,0},
    {0,0,1,0,0,0},
    {0,0,0,1,0,0},
    {0,0,0,0,1,0}},
    r={{1,0,0,0,0,0},
    {0,1,0,0,0,0},
    {0,0,1,0,0,0},
    {0,0,0,1,0,0},
    {0,0,0,0,1,0},
    {0,0,0,0,0,1}};

    while(n>0){
        if(n&1){
            r=matmul(r,z);
        }
        z=matmul(z,z);
        n/=2LL;
    }
    return r;
}*/
void solve(){
    char c;
    cin>>c;
    if(c>='A'&&c<='Z')
    cout<<'A';
    else
    cout<<'a';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
//    build();
    int t=1;
//    cin>>t;
    while(t--)
    solve();

}


Measured memory_bytes: 3664
fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val a = longList()
    if (a.find { it == 0L } != null) {
        println("0")
        return
    }
    var t = 1L
    val max = 1e18.toLong()
    var prev = 1L
    a.forEach {
        t *= it
        if(prev > t) {
            println("-1")
            return
        }
        if (max < t) {
            println("-1")
            return
        }
        prev = t
    }
    println(t.toString())
}


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

using namespace std;

typedef vector<int> vi;
const int M = 51;
vector<string> words;

int main() {

   int n;
   cin >> n;
   string s;
   cin >> s;
   int skiriasi = 0;
   for (int i = 0; i < n; i++)
   {
       if(s[i]!=s[i+1])skiriasi++;
   }
   cout << skiriasi;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

//const double PI = 3.1415926535897932384626433832795;

int main() {
  string s;
  cin >> s;
  string r = s;
  reverse(r.begin(), r.end());
  if(s != r) {
    cout << "No" << endl;
    return 0;
  }
  int sublen = (s.size() - 1) / 2;
  string sub = s.substr(0, sublen);
  string subr = sub;
  reverse(subr.begin(), subr.end());
  if(sub != subr) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
int
main ()
{
  
int m, n, i, j, a[100][100], b[100], c[100];
  
scanf ("%d %d", &n, &m);
  
for (i = 0; i < n; i++)
    {
      
for (j = 0; j < m; j++)
	{
	  
scanf ("%d ", &a[i][j]);
	
}
    
}
  
for (j = 0; j < m; j++)
    {
      
scanf ("%d", &b[j]);
    
}
  
for (i = 0; i < n; i++)
    {
      
c[i] = 0;
    
}
  
for (i = 0; i < n; i++)
    {
      
for (j = 0; j < m; j++)
	{
	  
c[i] += (a[i][j] * b[j]);
	
}
    
}				//-----                          
  for (i = 0; i < n; i++)
    {
      
printf ("%d\n", c[i]);
    
}
  
return 0;

}



Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int maxV = 90010;
const int maxN = 2e5+10;
const int inf = 0x3f3f3f3f;
const ll MOD = 1e9+7;
const ll INF = 1000000000000000010LL;
#define X first
#define Y second


ll a[maxN];
ll s[maxN];
int n,k;
int main() {
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	for(int i=1;i<=n;i++)
	{
		s[i] = s[i-1] + a[i];
	}
	for(int i=1;i<=n;i++)
	{
		s[i] = s[i]-i;
		s[i]%=k;
	}
	unordered_map<int,vector<int> > mp;
	for(int i=0;i<=n;i++)
	{
		mp[s[i]].push_back(i);
	}
	ll ans = 0;
	for(auto it=mp.begin();it!=mp.end();it++)
	{
		auto v = it->second;
		int m = v.size();
		for(int i=0;i<m;i++)
		{
			ll x = v[i];
			int pos = lower_bound(v.begin(),v.end(),x+k) - v.begin();
			ans += pos - i-1;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 21064
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  vector<vector<char>> map(h+2,vector<char>(w+2));
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
    cin>>map[i][j];
    }
  }
  for(int i=1;i<=h+1;i++){
    map[i][w+1]='#';
  }
  for(int i=1;i<=w+1;i++){
    map[h+1][i]='#';
  }
  vector<int> col(w+1);
  vector<int> row(h+1);
  vector<vector<int>> map_s(h+2,vector<int>(w+2));
  vector<vector<int>> map_v(h+2,vector<int>(w+2));
  int buf_s;
  int buf_v;
  int sum_s;
  int sum_v;
  for(int i=1;i<=h+1;i++){
    buf_s=1;
    for(int j=1;j<=w+1;j++){
      if(map[i][j]=='#'){
	sum_s=j-buf_s;
	for(int k=buf_s;k<j;k++){
	  map_s[i][k]=sum_s;
	}
	map_s[i][j]=0;
	buf_s=j+1;
      }
    }
  }
  for(int j=1;j<=w+1;j++){
    buf_v=1;
    for(int i=1;i<=h+1;i++){
     if(map[i][j]=='#'){
	sum_v=i-buf_v;
	for(int l=buf_v;l<i;l++){
	  map_v[l][j]=sum_v;
	}
	map_v[i][j]=0;
	buf_v=i+1;
     }
    }
  }
  int max=0;
  vector<vector<int>> ans_map(h+1,vector<int>(w+1));
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      ans_map[i][j]=map_s[i][j]+map_v[i][j];
      if(max<ans_map[i][j]) max=ans_map[i][j];
      //      cout<<map_v[i][j]<<" ";
    }
    //    cout<<endl;
  }
  cout<<max-1<<endl;
  return 0;
}


Measured memory_bytes: 51456
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N,0);
    vector<P> B(N);
    for(ll i=0;i<N;i++){
        cin>>A[i];
        B[i]=P(A[i],-i);
    ;}
    //C[i]は全部をA[i]以下にするための労力
    vector<ll> C(N,0);

    //でかい順に
    sort(B.begin(), B.end());
    reverse(B.begin(), B.end());
    vector<ll> ikou(N+1,0);
    for(ll i=N-1;i>=0;i--){
        ikou[i]=ikou[i+1]+B[i].first;
    }
    for(ll i=0;i<N;i++){
        C[-B[i].second]=ikou[0]-ikou[i]-i*B[i].first;
    ;}
    vector<ll> ans(N,0);

    priority_queue<P> pq; 
    ll ch=-B[0].second;
    for(ll i=0;i<N;i++){
        if(-B[i].second<=ch){
            pq.push(B[i]);
            ch=-B[i].second;
        }
    ;}

    //kは既に行った労力
    ll k=0;
    while(pq.size()){
        auto x=pq.top();
        pq.pop();
            if(pq.empty()){
                ans[-x.second]=ikou[0]-k;break;
            }
        //B[i]について
        ans[-x.second]=C[-pq.top().second]-k;
        k=C[-pq.top().second];
    ;}
    for(ll i=0;i<N;i++){
        cout<<ans[i]<<endl;
    ;}

    
    return 0;
}


Measured memory_bytes: 7408
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String S = sc.next();
      String T = sc.next();

      if (S.length() != T.length()-1){
        System.out.println("No");
      } else {
        if (S.equals(T.substring(0, T.length()-1))){
          System.out.println("Yes");
        } else {
          System.out.println("No");
        }
      }
  }
}

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

//ask the right questions.  

// dp[i][j] means maximum subsequence length when we have seen upto ith index in s and jth index in t.    

int dp[3001][3001];
int choices[3001][3001];

int main()
{
    string s, t;
    cin >> s >> t;
    int n = s.length();
    int m = t.length();

    //trivial case;

    //iteratin gover items (not indexes in dp equation)
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            //not equal: cannot include
            if(s[i-1]!=t[j-1]){
                dp[i][j]=max(dp[i-1][j], dp[i][j-1]);
                if(dp[i-1][j]>=dp[i][j-1])
                    choices[i][j]=1;
                else
                    choices[i][j]=2;
            }
            else{//equal: choice is to include or not
                //not-include to initialize dp[i][j]
                dp[i][j]=max(dp[i-1][j], dp[i][j-1]);
                if(dp[i-1][j]>=dp[i][j-1])
                    choices[i][j]=1;
                else
                    choices[i][j]=2;
                //now see whetther inclusion maximises over non inclusion
                dp[i][j]=max(dp[i-1][j-1]+1,dp[i][j]);
                if(dp[i][j]<=dp[i-1][j-1]+1)
                    choices[i][j]=3;
            }
        }
    }

    // for(int i=0;i<=n;i++){
    //     for(int j=0;j<=m;j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    // cout << endl;
    // for(int i=0;i<=n;i++){
    //     for(int j=0;j<=m;j++){
    //         cout << choices[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    //cout << dp[n][m] <<endl;
    int i = n; int j = m;
    string ans="";
    while(i>0 && j>0)
    {
        if(choices[i][j]==1)
        {
            //cout << "choice 1" <<endl;
            //cout << i << " " <<j <<endl;
            i--;
        }
        else if (choices[i][j]==2)
        {
            //cout << "choice 2" <<endl;
            //cout << i << " " <<j <<endl;
            j--;
        }
        else
        {
            ans+=s[i-1];
            i--;
            j--;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans <<endl;

    return 0;
}



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

int main()
{
  int t[5];
  for (int i = 0; i < 5; ++i)
  {
    scanf("%d", t + i);
  }
  std::sort(t, t + 5, [](auto a, auto b){ return ((a - 1) % 10) > ((b - 1) % 10); });
  
  int ans = 0;
  for (int i = 0; i < 4; ++i)
  {
    ans += 10 * ((t[i] + 9) / 10);
  }
  printf("%d\n", ans + t[4]);
  return 0;
}

Measured memory_bytes: 128
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int64 a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  if (a == 1) {
    cout << 1 << endl;
  } else {
    int64 ret = (a * b + 1) / 2;
    cout << ret << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;
 
int main()
{
    NFS
 	int h,a;
 	cin>>h>>a;
 	if(h%a==0)
 		cout<<h/a<<endl;
 	else
 		cout<<h/a+1<<endl;
    return 0;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
class HeavyLight{
	public:
	int pathCount,n;
	vi size,parent,in,out,path,pathRoot;
	vvi tree;
	
	HeavyLight(vvi t)
		:pathCount(0),n(t.size()),size(n),parent(n),in(n),out(n),
		path(n),pathRoot(n),tree(t){
		int time=0;
		dfs(0,-1,time);
		buildPaths(0,newPath(0));
	}
	void dfs(int u,int p,int &k){
		in[u]=k++,parent[u]=p,size[u]=1;
		for(auto v=tree[u].begin();v!=tree[u].end();v++)if(*v!=p)
			dfs(*v,u,k),size[u]+=size[*v];
		out[u]=k++;
	}
	int newPath(int u){pathRoot[pathCount]=u;return pathCount++;}
	void buildPaths(int u,int pt){
		path[u]=pt;
		for(auto v=tree[u].begin();v!=tree[u].end();v++)if(*v!=parent[u]){
			buildPaths(*v,2*size[*v]>=size[u]?pt:newPath(*v));
		}
	}
	bool inAncestor(int p,int ch){
		return in[p]<=in[ch]&&out[ch]<=out[p];
	}
	int lca(int a,int b){
		for(int root;!inAncestor(root=pathRoot[path[a]],b);a=parent[root]);
		for(int root;!inAncestor(root=pathRoot[path[b]],a);b=parent[root]);
		return inAncestor(a,b)?a:b;
	}
};
int main(){
	int n;
	cin>>n;
	vvi tree(n);
	rep(i,n){
		int k;cin>>k;
		rep(j,k){
			int ch;cin>>ch;
			tree[i].pb(ch);
		}
	}
	HeavyLight hl(tree);
	
	int q;
	cin>>q;
	while(q--){
		int a,b;
		cin>>a>>b;
		cout<<hl.lca(a,b)<<endl;
	}
}

Measured memory_bytes: 24892
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1e9+7,INF=1e17;
const int iINF=1e9;
#define enld endl
int main(){
    ll n,x,sum=0,mini=iINF;
    cin>>n>>x;
    vector<ll>m(n);
    for(int i=0;i<n;i++){
        cin>>m[i];
        sum+=m[i];
        mini=min(mini,m[i]);
    }
    cout<<n+(x-sum)/mini<<endl;


}

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

static const int N = 1000;

int lcs(string X, string Y){
	int c[N+1][N+1];
	int m = X.size();
	int n = Y.size();
	int maxl = 0;
	X = ' ' + X;
	Y = ' ' + Y;
	for (int i=0; i<=m; i++) c[i][0] = 0;
	for (int j=0; j<=n; j++) c[0][j] = 0;

	for (int i = 1; i <= m; i++){
		for (int j = 1; j <= n; j++){
			if (X[i] == Y[j]){
				c[i][j] = c[i-1][j-1] + 1;
			} else{
				c[i][j] = max(c[i][j-1], c[i-1][j]);
			}
			maxl = max(maxl, c[i][j]);
		}
	}

	return maxl;

}

int main(){
	string s1, s2;
	int q;
	cin >> q;
	for (int i=0; i<q;i++){
		cin >> s1 >> s2;
		cout << lcs(s1, s2) << endl;
	}
	return 0;

}

Measured memory_bytes: 5128
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    
    let mut iter = buf.split_whitespace();
    
    let t: f64 = iter.next().unwrap().parse().unwrap();
    let x: f64 = iter.next().unwrap().parse().unwrap();
    
    println!("{}", t/x);
}

Measured memory_bytes: 4352
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

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

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

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// main
func check(x int64) bool {
	s := math.Sqrt(float64(x))
	for i := int64(2); i <= int64(s); i++ {
		if x%i == 0 {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)
	x := nextInt64()
	for true {
		if check(x) {
			break
		}
		x++
	}

	fmt.Println(x)
}


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


int main(){
    int k;
    cin >> k;
    queue<ll> list;
    for(int i=1;i<10;i++){
        list.push(i);
    }
    ll s=0;
    for(int i=0;i<k;i++){
        s = list.front();
        list.pop();
        if(k<list.size())continue;
        else{
            ll p = s%10;
            for(ll i=-1;i<=1;i++){
                ll r = p + i;
                if(r<0 || r>9) continue;
                list.push(s*10+r);
            }
        }
    }
    cout << s << endl;
}


Measured memory_bytes: 1024
inp = input().split()
satu= int(inp[0])
en = int(inp[1])
h =0

for i in range(satu+1):
	nokori = satu - i
	for k in range(nokori+1):
		nokori2 = nokori - k
		kin = i * 1000 + k * 5000 + nokori2 * 10000
		if kin == en:
			h = 1
			break
	else:
		continue
	break
if h != 1:
    
	nokori2 = -1
	k = -1
	i  = -1
print(nokori2,k,i)



Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define MAX 200005
#define INF 200005

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

int n;
ll ans=0;
map<P, int> M;

P f(int k){
  int i=k%10;
  int j;
  while(k){
    j=k;
    k/=10;
  }
  return P(i, j);
}

int main(){
  cin >> n;
  repo(i, n){
    P p=f(i);
    M[p]++;
  }
  rep(i, 10){
    rep(j, 10){
      if(i==0 && j==0)continue;
      P a(i, j);
      P b(j, i);
      ans+=M[a]*M[b];
    }
  }
  cout << ans << endl;
  return 0;
}


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

ans = 0

x = min(N, B-1)

A_x = A * x
left_ = int(A_x / B)
right_ = A * int(x / B)
fnc_ = left_ - right_
if x <= N:
  ans = max(ans, fnc_)
  # print("入れ替わりans", ans)

print(ans)


Measured memory_bytes: 9116
// atcoder/abc086/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s;
  while (cin >> s) {
    s[3] = '8';
    cout << s << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256