akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
using mint = atcoder::modint998244353;
struct S
{
    mint a;
    int size;
};
struct F
{
    mint a, b;
};

S op(S x, S y)
{
    return S{x.a + y.a, x.size + y.size};
}

S e()
{
    return S{0, 0};
}
S mapping(F l, S r)
{
    return S{l.a * r.a + r.size * l.b, r.size};
}

F composition(F l, F r) //l∘r
{
    return F{r.a * l.a, r.b * l.a + l.b};
}

F id()
{
    return F{1, 0};
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<S> a(n);
    for (size_t i = 0; i < n; i++)
    {
        ll x;
        cin >> x;
        a[i] = S{x, 1};
    }
    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(a);
    for (size_t i = 0; i < q; i++)
    {
        bool t;
        cin >> t;
        if (!t)
        {
            int l, r;
            ll b1, c1;
            mint b, c;
            cin >> l >> r >> b1 >> c1;
            b = b1;
            c = c1;
            seg.apply(l, r, F{b, c});
        }
        else
        {
            int l, r;
            cin >> l >> r;
            cout << seg.prod(l, r).a.val() << '\n';
        }
    }

    return 0;
}

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

int num_comb(int A, int B, int C, int X) {
  int ans = 0;
  if (A == 0 && B == 0 && C == 0) {
    ans = X == 0 ? 1 : 0;
  } else if (A == 0 && B == 0) {
    for (int i = 0; i <= C && X - 50 * i >= 0; i++)
      ans += num_comb(0, 0, 0, X - 50 * i);
  } else if (A == 0) {
    for (int i = 0; i <= B && X - 100 * i >= 0; i++)
      ans += num_comb(0, 0, C, X - 100 * i);
  } else {
    for (int i = 0; i <= A && X - 500 * i >= 0; i++)
      ans += num_comb(0, B, C, X - 500 * i);
  }
  // printf("A = %d, B = %d, C = %d, X = %d, ans = %d\n", A, B, C, X, ans);
  return ans;
}

int main(int argc, char *argv[]) {
  int A, B, C, X;
  scanf("%d %d %d %d", &A, &B, &C, &X);
  printf("%d\n", num_comb(A, B, C, X));
}


Measured memory_bytes: 128
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int solve(int n, int p) {
    int pepole[n];
    int ans = -1;
    for (int i = 0; i < n; i++) {
        pepole[i] = 0;
    }
    int check = 0;
    while (1) {
        for (int i = 0; i < n; i++) {
            if (p != 0) {
                p--;
                pepole[i]++;
            } else if (pepole[i] != 0) {
                p += pepole[i];
                pepole[i] = 0;
            } else {
                check = 0;
                for (int j = 0; j < n; j++) {
                    if (pepole[j] != 0) {
                        ans = j;
                        check++;
                    }
                }
                if (check == 1) break;
            }
        }
        if (check == 1) break;
    }
    return ans;
}

int main() {
    cin.tie(0);
    vector<int> ans;
    int n, p;
    while (1) {
        cin >> n >> p;
        if (n == 0 && p == 0) break;
        ans.push_back(solve(n, p));
    }
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << endl;
    }
}


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

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

int main(void)
{
    ll n,q;
    string str; 
    cin>>n>>q>>str;

    vector<ll> s(n+1,0);
    rep(i,n){
        if(i+1<n&&str[i]=='A'&&str[i+1]=='C') s[i+1]=s[i]+1;
        else s[i+1]=s[i];
    }

    rep(i,q){
        ll l,r; cin>>l>>r;
        l--; r--;
        cout<<s[r]-s[l]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const int N = 3050;
int n;
double p[N], mem[N][N];
bool vis[N][N];

double dp(int idx, int w) {
	if (w == 0) {
		return 1;
	}
	if (idx == n) {
		return 0;
	}
	if (vis[idx][w]) {
		return mem[idx][w];
	}
	vis[idx][w] = true;

	double ans = 0;
	ans += dp(idx + 1, w) * (1 - p[idx]);
	ans += dp(idx + 1, w - 1) * p[idx];

	return mem[idx][w] = ans;
}

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

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

	cout << setprecision(11) << dp(0, (n + 1) / 2) << '\n';

	return 0;
}


Measured memory_bytes: 80768
#include <iostream>

using namespace std;

int n;
int ans = 0;
int d[105];

int main() {
	cin >> n;
	for (int i = 1, a; i <= n; i ++) {
		cin >> a;
		d[a] ++;
	}
	for (int i = 1; i <= 100; i ++)
		if (d[i])
			ans ++;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
string S;
  cin >>S;
  int x=S.size();
  bool ans=true;
  rep(i,x-1) {
    repl(j,i+1,x) {
      if(S.at(i)==S.at(j)) {
        ans=false;
        break;
      }
    }
  }
  
  if(ans) {
    cout<<"yes"<< endl;
  }
else {
cout <<"no"<< endl;
}

  
}

  


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

double distance(const int* a, const int* b, const int n, const int p);

int main(void){
	int n=0;			// input; verctor division 1<=n<=100
	int x[100]={0};		// input; x vector
	int y[100]={0};		// input; y vector
	int i=0;			// loop index
	double ans_1=0.0;
	double ans_2=0.0;
	double ans_3=0.0;
	double ans_i=0.0;

	scanf("%d", &n);
	for(i=0;i<n;i++) scanf("%d", &x[i]);
	for(i=0;i<n;i++) scanf("%d", &y[i]);

	printf("%lf\n", distance(x, y, n, 1));
	printf("%lf\n", distance(x, y, n, 2));
	printf("%lf\n", distance(x, y, n, 3));
	printf("%lf\n", distance(x, y, n, 0));

	return 0;
}

double distance(const int* a, const int* b, const int n, const int p){
	double sum=0.0;
	double ans=0.0;
	int i=0;

	switch(p){
	case 1:
		for(i=0;i<n;i++) sum += fabs((double)*(a+i) - (double)*(b+i));
		ans = sum;
		break;
	case 2:
		for(i=0;i<n;i++) sum += pow(fabs((double)*(a+i) - (double)*(b+i)), 2);
		ans = sqrt(sum);
		break;
	case 3:
		for(i=0;i<n;i++) sum += pow(fabs((double)*(a+i) - (double)*(b+i)), 3);
		ans = pow(sum, 1.0 / 3.0);
		break;
	case 0:
		for(i=0;i<n;i++){
			sum = fabs((double)*(a+i) - (double)*(b+i));
			if(ans < sum) ans = sum;
		}
		break;
	default:
		break;
	}

	return ans;
}

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

using namespace std;
typedef long long LL;


int n, m, x;
int a[105];

int main()
{
	cin >> n >> m >> x;
	int c = 0;
	int b = 0;
	for(int i = 1;i <= m;i++)
	{
		scanf(" %d",&a[i]);
		if(a[i] <= x)
		{
			c++;
		}
		else b++;
	}
	int y = min(c, b);
	cout << y << endl;
}

Measured memory_bytes: 256
# your code goes here
n=int(input())
a,b=map(int,input().split())
c=list(map(int,input().split()))
mi=(10000000000,-1)
for i in range(len(c)):
	mi=min(mi,(abs(a-c[i]*0.006-b),i))
print(mi[1]+1)
	

Measured memory_bytes: 3060
N = int(input())
num = list(map(int,input().split()))
dict = {}
dist = []
for i in range(N):
  if num[i] not in dict:
    dict[num[i]] = 1
    dist.append(num[i])
  else:
    dict[num[i]] += 1
dist.sort(reverse=True)
rec = []    
for j in range(len(dist)):
  if 4 <= dict[dist[j]]:
    rec.append(dist[j])
    rec.append(dist[j])
    break
  elif 2<= dict[dist[j]]:
    rec.append(dist[j])
  if 2 <= len(rec):
    break
if len(rec) < 2:
  print(0)
else:
  print(rec[0]*rec[1])

Measured memory_bytes: 17960
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <sstream>
#include <complex>

using namespace std;

using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using iii = pair<int, ii>;
using viii = vector<iii>;

using ll = long long int;
using vc = vector<char>;
using vb = vector<bool>;
using ib = pair<int, bool>;
using vib = vector<ib>;

#define MOD 1000 * 1000 * 1000 + 7
#define INF 1000 * 1000 * 1000
#define EMPTY -10
#define mp(a, b) make_pair(a,b)

struct tTarta {
	ll Ai, Bi, Ci;
	int posA, posB, posC;
};

struct cmp {
	bool operator()(tTarta const& t1, tTarta const& t2) {
		return t1.Ai + t1.Bi + t1.Ci < t2.Ai + t2.Bi + t2.Ci;
	}
};

bool resuelveCaso() {
	int x, y, z, k;
	cin >> x >> y >> z >> k;
	if (!cin) return false;

	vector<ll> A(x), B(y), C(z);
	for (int i = 0; i < x; ++i) cin >> A[i];
	for (int i = 0; i < y; ++i) cin >> B[i];
	for (int i = 0; i < z; ++i) cin >> C[i];

	priority_queue<tTarta, vector<tTarta>, cmp> pq;

	sort(A.begin(), A.end()); reverse(A.begin(), A.end());
	sort(B.begin(), B.end()); reverse(B.begin(), B.end());
	sort(C.begin(), C.end()); reverse(C.begin(), C.end());

	tTarta mtar; 

	mtar.posA = 0; mtar.posB = 0; mtar.posC = 0;
	mtar.Ai = A[0]; mtar.Bi = B[0]; mtar.Ci = C[0];
	pq.push(mtar);

	set<iii> marcaje;
	marcaje.insert(mp(0, mp(0, 0)));

	int cont = 0;
	while (cont < k) {
		tTarta tarAct = pq.top(); pq.pop();

		cout << tarAct.Ai + tarAct.Bi + tarAct.Ci << '\n';

		if (tarAct.posA < x - 1 && marcaje.find(mp(tarAct.posA +1, mp(tarAct.posB,tarAct.posC))) == marcaje.end()) {
			pq.push({A[tarAct.posA + 1], tarAct.Bi, tarAct.Ci, tarAct.posA + 1, tarAct.posB, tarAct.posC});
			marcaje.insert(mp(tarAct.posA + 1, mp(tarAct.posB, tarAct.posC)));
		}
		if (tarAct.posB < y - 1 && marcaje.find(mp(tarAct.posA , mp(tarAct.posB + 1, tarAct.posC))) == marcaje.end()) {
			pq.push({  tarAct.Ai, B[tarAct.posB + 1], tarAct.Ci, tarAct.posA , tarAct.posB+ 1, tarAct.posC });
			marcaje.insert(mp(tarAct.posA , mp(tarAct.posB+ 1, tarAct.posC)));
		}
		if (tarAct.posC < z - 1 && marcaje.find(mp(tarAct.posA , mp(tarAct.posB, tarAct.posC+ 1))) == marcaje.end() ) {
			pq.push({  tarAct.Ai, tarAct.Bi, C[tarAct.posC + 1], tarAct.posA , tarAct.posB, tarAct.posC + 1});
			marcaje.insert(mp(tarAct.posA , mp(tarAct.posB, tarAct.posC+ 1)));
		}
		++cont;
	}

	return true;
}

int main() {
	while (resuelveCaso()) {}
	return 0;
}

Measured memory_bytes: 896
package main

import (
	"fmt"
	"sort"
)

func main()  {
	var n, m int
	fmt.Scan(&n, &m)
	x := make([]int, m)

	for i := range x {
		fmt.Scan(&x[i])
	}

	if n > m {
		fmt.Println(0)
		return
	}
	sort.Ints(x)

	ans := 0
	y := make([]int, m-1)
	for i:=0;i<m-1;i++ {
		y[i] = x[i+1] - x[i]
	}
	sort.Ints(y)
	for i:=0;i<m-n;i++ {
		ans += y[i]
	}
	fmt.Println(ans)
}

Measured memory_bytes: 5504
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Main
{
    public static class Program
    {
        public static List<int> list = new List<int>();

        static void Main(string[] arg)
        {
            int n = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().ToCharArray();
            int k = int.Parse(Console.ReadLine());
            var answer = "";
            char a = input[k-1];
            foreach(char c in input){
                if(c != a){
                    answer += "*";
                }
                else{
                    answer += c;
                }
            }



            Console.WriteLine(answer);
            Console.ReadLine();

        }
        public static int Check_Max(int i, int j, int k, int max)
        {
            if (i + j + k > max)
            {
                return i + j + k;
            }
            else
            {
                return max;
            }
        }
        
        #region libraries
        private static int[] GetIntList(string line)
        {
            return line.Split(' ').Select(x => int.Parse(x)).ToArray();

        }
        private static double[] GetDoubleList(string line)
        {
            return line.Split(' ').Select(x => double.Parse(x)).ToArray();

        }
        private static ulong[] GetUlongList(string line)
        {
            return line.Split(' ').Select(x => ulong.Parse(x)).ToArray();
        }
        private static long[] GetLongList(string line)
        {
            return line.Split(' ').Select(x => long.Parse(x)).ToArray();
        }
        private static int SearchNearest(this IEnumerable<int> list, int target)
        {
            var min = list.Min(c => Math.Abs(c - target));
            return list.First(c => Math.Abs(c - target) == min);
        }
        public static bool IsOdd(int i)
        {
            return i % 2 == 1 ? true : false;
        }
        public static int Gcd(int a,int b)
        {
            if(a < b)
            {
                Gcd(b, a);
            }
            while (b != 0)
            {
                var rm = a % b;
                a = b;
                b = rm;
            }
            return a;
        }
        #endregion
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(c,itr) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	rep(i,s.size()){
		s[i]+=n;
		if(s[i]>'Z'){
			s[i]-='Z';
			s[i]+='A'-1;
		}
		cout<<s[i];
	}
	re 0;
}

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


int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    
    if (A + B > C + D) cout << "Left" << endl;
    else if (A + B < C + D) cout << "Right" << endl;
    else cout << "Balanced" << endl;
}

Measured memory_bytes: 3604
#include<stdio.h>

int main(void){
    int k,x,i;
    scanf("%d %d", &k, &x);
    for ( i = x-k+1; i < x+k; i++)
    {
        if (-1000000 <= i && 1000000 >= i)
        {
            printf("%d", i);
            if (i<x+k-1)
                printf(" ");
        }
    }
    return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
bool IsPrime(long long int n) {
    if (n==1) {
        return true;
    } else if (n==2) {
        return true;
    } else if (n%2==0) {
        return false;
    } else {
        double sqrtNum=sqrt(n);
        for (int i=3;i<=sqrtNum;i+=2) {
            if (n%i==0) {
                return false;
            }
        }
        return true;
    }
}
int main(void){
    long long int a,b;
    cin>>a>>b;
    while (a%b!=0) {
        long long int tmp=b;
        b=a%b;
        a=tmp;
    }
    if (b!=1) {
        std::deque<long long int> deq;
        for (long long int i=1;i<=sqrt(b);i++) {
            if (b%i==0) {
                deq.emplace_back(i);
                deq.emplace_back(b/i);
            }
        }
        long long int count=0;
        for (int i=0;i<deq.size();i++) {
            if (IsPrime(deq[i])==true) {
                count++;
            }
        }
        cout<<count<<endl;
    } else {
        cout<<1<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <time.h>
#include <stdio.h>
#include <vector>
#define int long long
using namespace std;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int mypow(int x, int y) {
	if (y == 0)return 1;
	if (y % 2)return mypow(x, y - 1)*x;
	else return mypow(x, y / 2)*mypow(x, y / 2);
}
int Max(int x, int y) {
	if (x > y)return x;
	else return y;
}
int Min(int x, int y) {
	if (x < y)return x;
	else return y;
}
int kai(int x) {
	int cnt = 1;
	if (x == 0)return 1;
	cnt = kai(x - 1);
	return x * cnt;
}
inline void shoki()
{
	srand((unsigned int)time(NULL));
}

/*Library End!*/

signed main() {
	int n;
	cin >> n;
	if(n == 1||n== 2||n== 3||n== 5||n== 6||n==9||n==10||n==13||n==17)puts("No");
	else puts("Yes");
}

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

typedef long long ll;
typedef pair<int, int> pii; 
const int N = 2e5+10, mod = 1e9+7;

void solve() {
    ll a, b, k; cin >> a >> b >> k;

    ll c = min(a, k);
    a -= c;
    k -= c;
    cout << a << " ";

    if (k > 0) {
        if (b <= k) {
            b = 0;
        } else {
            b -= k;
        }  
    }
    cout << b << endl;
}   

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;
    while (t--) solve();
    return 0;
}


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

using namespace std;

struct xyz {
    int start;
    int limit;
};

int main() {
    int n, m;
    cin >> n >> m;
    
    vector<xyz> v(m);
    int min = 0;
    int max = 1000000;
    for(int i = 0; i < m; i++) {
        cin >> v[i].start >> v[i].limit;
        if(min < v[i].start) {
            min = v[i].start;
        }
        if(max > v[i].limit) {
            max = v[i].limit;
        }
    }
    
    if(min <= max) {
        cout << max - min + 1 << endl;
    }
    else {
        cout << 0 << endl;
    }
    
    return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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

    int x;
    cin>>x;

    if(x >= 30)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    

    return 0;
}


Measured memory_bytes: 3636
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll a,b,c;
  cin>>a>>b>>c;
  cout<<b+min(a+b+1,c)<<endl;
}

Measured memory_bytes: 256
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
temp_dif_abs=[]
for i in range(N):
    temp_dif_abs+=[abs(A-(T-H[i]*0.006))]
print(temp_dif_abs.index(min(temp_dif_abs))+1)

Measured memory_bytes: 3060
X = int(input())
A = []
for i in range(200):
    A.append(pow(i, 5))
for i in range(200):
    for j in range(200):
        a = abs(A[i] - A[j])
        b = A[i] + A[j]
        if a == X:
            if i <= j:
                B = [j, i]
            else:
                B = [i, j]
            print(' '.join(map(str, B)))
            exit()
        elif b == X:
            B = [i, -j]
            print(' '.join(map(str, B)))
            exit()


Measured memory_bytes: 9192
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<cstring>
using namespace std;
int n,a[100009][3],p,mx,my,x,y,idx,idy,ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&p);
		a[p][i%2]++;
	}
	for(int i=1;i<=1e5;i++){
		if(a[i][1]>=x)mx=x,idx=i,x=a[i][1];
		else if(mx<a[i][1])mx=a[i][1];
		if(a[i][0]>=y)idy=i,my=y,y=a[i][0];
		else if(my<a[i][0])my=a[i][0];
	}
	if(idx==idy){
		if(my+x>mx+y)printf("%d",n-my-x);
		else printf("%d",n-mx-y);
	}
	else printf("%d",n-x-y);
	getchar();
	return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>
int cmpintU(const void *x, const void *y) { return *(int *)x - *(int *)y; }
int cmpintD(const void *x, const void *y) { return *(int *)y - *(int *)x; }
int main() {
	int n, m, x[100000], dis[100000 - 1], min;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		scanf("%d", &x[i]);
	}
	qsort(x, m, sizeof(int), cmpintU);
	min = x[m - 1] - x[0];
	for (int i = 0; i < m - 1; i++) {
		dis[i] = x[i + 1] - x[i];
	}
	qsort(dis, m - 1, sizeof(int), cmpintD);
	for (int i = 0; i < n - 1; i++) {
		min -= dis[i];
	}
	printf("%d\n", min);
	return 0;
}

Measured memory_bytes: 1268
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <set>

using namespace std;

struct po
{
	int x,y;
	bool operator < (const po &a) const
	{
		return x == a.x ? y > a.y : x < a.x; 
	}
	bool operator == (const po &a) const
	{
		return x == a.x && y == a.y;
	}
}P[100050];

int lis[100050],lcnt;
const int mod = 1000000007;

struct BIT
{
	int val[100050];
	void add(int pos,int vl)
	{
		for(int i = pos;i <= lcnt;i += i & -i)
			val[i] = (val[i] + vl) % mod;
	}
	int query(int pos)
	{
		int ans = 0;
		for(int i = pos;i;i -= i & -i)
			ans = (ans + val[i]) % mod;
		return ans;
	}
}tree;

int n,m;
int minn,maxn;
int seq[100050];
int as = 0;
int f[100050];
set<int> st;

int main()
{
	minn = 2e9;
	scanf("%d%d",&n,&m);
	for(int i = 1;i <= n; ++ i) scanf("%d",&seq[i]);
	for(int i = 1;i <= m; ++ i)
	{
		int vl2; scanf("%d",&vl2);
		st.insert(vl2);
		minn = min(minn,vl2); maxn = max(maxn,vl2);
	}
	int c = 0;
	for(int i = 1;i <= n; ++ i)
	{
		if(seq[i] < minn || seq[i] > maxn) continue;
		P[++ c].x = *st.lower_bound(seq[i]) - seq[i];
		P[c].y = seq[i] - *(--st.lower_bound(seq[i]));
		lis[++ lcnt] = P[c].y;
	}
	lis[++ lcnt] = 0;as = 1;
	sort(lis + 1,lis + 1 + lcnt);
	lcnt = unique(lis + 1,lis + 1 + lcnt) - lis - 1;
	for(int i = 1;i <= c; ++ i)
		P[i].y = lower_bound(lis + 1,lis + 1 + lcnt,P[i].y) - lis;
	sort(P + 1,P + 1 + c);
	c = unique(P + 1,P + 1 + c) - P - 1;
	for(int i = 1;i <= c; ++ i)
	{
		f[i] = tree.query(P[i].y - 1) + 1;
		f[i] %= mod;
		as = (as + f[i]) % mod;
		tree.add(P[i].y,f[i]);
	}
	printf("%d\n",as);
}

Measured memory_bytes: 7040
#include<stdio.h>
#define Z 500001
 
int A[Z];
int n;
 
void MaxHeapify(int i){
  int Left = 2*i;
  int Right = 2*i+1;
  int Largest;
  int temp;
 
  if(Left <= n && A[Left] > A[i]){
    Largest = Left;
  }
  else{
    Largest = i;
  }
  if(Right <= n && A[Right] > A[Largest]){
    Largest = Right;
  }
  if(Largest != i){
    temp = A[i];
    A[i] = A[Largest];
    A[Largest] = temp;
    MaxHeapify(Largest);
  }
}
 
void BuildMaxHeap(void){
  int i;
  for(i = (n/2);i >=1;i--){
    MaxHeapify(i);
  }
}
 
int main(){
  
  int i;
 
  scanf("%d",&n);
  for(i = 1;i <= n;i++){
    scanf("%d",&A[i]);
  }
 
  BuildMaxHeap();
 
  for(i = 1;i <= n;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
 
  return 0;
}

Measured memory_bytes: 2552
#include <iostream>

using namespace std;

int main() {
	int h, w;
	while (true) {
		cin >> h >> w;
		if (h == 0 && w == 0) break;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if ((i + j) % 2 == 0) cout << "#";
				else cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3100
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
	long int a,b;
	cin>>a>>b;
	while((a!=0)&&(b!=0)){
		if(a>b){
			a=a%b;
		}else{
			b=b%a;
		}
	}
	if(a==0){
		cout<<b<<endl;
	}else{
		cout<<a<<endl;
	}
	return 0;
}

Measured memory_bytes: 3088
m,d=map(int,input().split())
if d<22:
  print(0)
else:
  ans=0
  for M in range(m+1)[1:]:
    for D in range(d+1)[22:]:
      q=D%10
      r=(D-q)//10
      if r>=2 and q>=2 and M==q*r:
        ans += 1
  print(ans)


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int cmax(int n, int count[50]){
	int max;
	for(int i = 0;i < n;i++){
		if(i == 0 || max < count[i]){
			max = count[i];
		}
	}

	return max;
}

int main(){
	int n, p;

	while(1){
		cin >> n >> p;
		if(n == 0 && p == 0) break;

		int i = 0;
		int q = p;
		int count[50] = {0};
		while(1){
			if(p == 1){
				count[i]++;
				p--;
				if(count[i] == q) break;
			} else if (p == 0){
				p += count[i];
				count[i] = 0;
			} else {
				count[i]++;
				p--;
			}

			if(i == n - 1){
				i = 0;
			} else {
				i++;
			}
		}

		cout << i << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};
 
int main(){
  int n;
  cin>>n;
  int ans;
  ans = 800*n-200*(n/15);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
struct UnionFind {
    vector<int> data;

    UnionFind(int sz) { data.assign(sz, -1); }

    bool unite(int x, int y) {
        x = find(x), y = find(y);
        if(x == y)
            return (false);
        if(data[x] > data[y])
            swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return (true);
    }

    int find(int k) {
        if(data[k] < 0)
            return (k);
        return (data[k] = find(data[k]));
    }
    bool isSame(int x, int y) { return find(x) == find(y); }
    ll size(int k) { return (-data[find(k)]); }
};
int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<int>> fre(n), blk(n);
    UnionFind uf(n);
    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        fre[a].push_back(b);
        fre[b].push_back(a);
        uf.unite(a, b);
    }
    for(int i = 0; i < k; i++) {
        int c, d;
        cin >> c >> d;
        c--, d--;
        blk[c].push_back(d);
        blk[d].push_back(c);
    }
    for(int i = 0; i < n; i++) {
        int ans = uf.size(i) - 1 - fre[i].size();
        for(auto e : blk[i]) {
            if(uf.isSame(i, e)) {
                ans--;
            }
        }
        cout << ans << " ";
    }
    cout << endl;
}

Measured memory_bytes: 12152
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
//#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 200100
//#define NIL -1

int main() {
    LL x;
    LL count=0;
    cin >> x;
    LL tmp=100;
    
    while(tmp<x){
        tmp=tmp+tmp/100;
        count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3624
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

const ll INF=1e18;
const ll mod=1e9+7;
const double eps=0.000000001;

vector<string> ans;

ll n;

void dfs(string s,ll cnt){
    ll m=s.length();
    if(m==n){
        ans.push_back(s);
        return ;
    }
    for(ll i=0;i<=cnt;i++){
        if(i<cnt){
            char c='a'+i;
            string u=s+c;
            dfs(u,cnt);
        }
        else{
            char c='a'+cnt;
            string u=s+c;
            dfs(u,cnt+1);
        }
    }
}

int main(){
    
    cin >> n;
    dfs("",0LL);
    sort(ans.begin(),ans.end());
    ll a=ans.size();
    rep(i,a){
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 7476
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  string S;
  cin >> S;
  string ans = "ABC";
  if (S == "ABC") ans = "ARC";
  cout << ans << endl;
  return 0;
}

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

int main() {
  int N, A, x;
  cin >> N >> A ;

  if (N >= 500) {
  	x = N % 500;
  }
  else {
  	x = N;
  }
  
  if (x <= A) {
    cout << "Yes" << endl;
  }
  else {
  	cout << "No" << endl;
  }
  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    int arr[n + 1];
    for (int i = 0; i < n; i++)
        cin >> arr[i+1];
    vector<int> freq[n + 1];
    for(int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        freq[a].push_back(b);
        freq[b].push_back(a);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
    {
        if (freq[i].size() == 0)
            ans++;
        else
        {
            bool there = true;
             int x = freq[i].size();
            for(int j = 0; j < x; j++)
            {
                int p = freq[i][j];
                if (arr[i] <= arr[p])
                {
                    there = false;
                    break;
                }
            }
            if (there)
                ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
  int n, k, x, y;
  cin >> n;
  cin >> k;
  cin >> x;
  cin >> y;
  int sum = 0;
  for (int i = 0; i < n; i++)
  {
    sum += i < k ? x : y;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
n = gets.to_i
a = gets.strip.split.map {|x| x.to_i}
b = n.times.map{|i| a[i]-i}
b.sort!
median = (b.size % 2).zero? ? b[b.size/2 - 1, 2].inject(:+) / 2 : b[b.size/2]
ans = (0..n-1).inject(0){|sum, i| sum + (b[i]-median).abs}
puts ans



Measured memory_bytes: 21760
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
  public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
  public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};


int main(){
  string s,T; cin >> s >> T;

  //map<char,vi> C;
  vvi C(26);
  rep(i,s.size()) C[s[i]-'a'].pb(i);

  // rep(j,26) {
  //   rep(i,C[j].size()) cout << j << " " << C[j][i] << endl;
  // }

  rep(i,T.size()) {
    if(C[T[i]-'a'].empty()){
      cout << -1 << endl;
      return 0;
    }
  }

  ll ans = 0;
  ll cnt = 0;
  int j = -1;
  rep(i,T.size()){
    int c = T[i]-'a';
    int n = C[c].size();
    int k = upper_bound(all(C[c]),j) - C[c].begin();
    if(k == n){
      k = 0;
      cnt++;
    }
    j = C[c][k];
  }
  ans = cnt * s.size() + j+1;
  cout << ans << endl;
}

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

const int LIKE_NUMBER = 753;

int main(){
    int result = 1000;
    string input = "";
    cin >> input;

    // 連続した文字列から3つの数字を取り出す
    for (int i = 0; i < input.length() - 2; i++){
        string tmp = "";
        for (int j = i; j < i + 3; j++){
            tmp += input[j];
        }
        int number = stoi(tmp);
        if (abs(LIKE_NUMBER - number) < result){
            result = abs(LIKE_NUMBER - number);
        }
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()

    kabu_price = LI()

    cash = 1000
    kabu = 0

    for i in range(N - 1):
        ratio = kabu_price[i + 1] / kabu_price[i]

        if ratio == 1:
            continue

        if ratio < 1:
            if kabu > 0:
                cash += kabu * kabu_price[i]
                kabu = 0

        if ratio > 1:
            if cash >= kabu_price[i]:
                num_parcha = cash // kabu_price[i]
                kabu += num_parcha
                cash = cash % kabu_price[i]

    cash += kabu * kabu_price[-1]

    print(cash)


main()


Measured memory_bytes: 65096
#include <stdio.h>
int main() {
	int x[3000], y[3000];
	int i = 0, j = 0;

	while (1) {
		scanf("%d %d\n", &x[i], &y[i]);
		if (x[i] == 0 && y[i] == 0) {
			break;
		}
		i++;
	}

	while (j < i) {
		if (x[j] < y[j]) {
			printf("%d %d\n", x[j], y[j]);
		} else {
			printf("%d %d\n", y[j], x[j]);
		}
		j++;
	}

	return 0;
}

Measured memory_bytes: 628
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
const string pass[9]={"BD","ACE","BF","AEG","BFHD","CEI","DH","EIG","FH"};//ABCDEFGHIの直前のマス
string str;
int main(){
	for(int i = 0;i < 1000;i++){
		cin>>str;
		bool flag = true;
		for(int j = 0;j < str.length()-1;j++){
			if(pass[str[j+1]-'A'].find(str[j])==string::npos){
				flag =false;
				break;
			}
		}
		if(flag)
			cout <<str<<endl;
	}
	return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<cstdio>
using namespace std;
static const int N=100;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
int n,M[N+1][N+1];
int color[N+1],d[N+1],f[N],tt;
void dfs_visit(int u){
    int v;
    color[u]=GRAY;
    d[u]=++tt;
    for(int v=1;v<=n;v++){
        if(M[u][v]==0)continue;
        if(color[v]==WHITE) dfs_visit(v);
    }
    color[u]=BLACK;
    f[u]=++tt;
}
void dfs(){
    for(int u=1;u<=n;u++)color[u]=WHITE;
    tt=0;
    for(int u=1;u<=n;u++){
        if(color[u]==WHITE)dfs_visit(u);
    }
    for(int u=1;u<=n;u++)
        cout<<u<<" "<<d[u]<<" "<<f[u]<<"\n";
}
int main(){
    int u,v,k;
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++)
            M[i][j]=0;
    }
    for(int i=1;i<=n;i++){
        cin>>u>>k;
        for(int j=1;j<=k;j++){
            cin>>v;
            M[u][v]=1;
            
        }
    }
    dfs();
    return 0;
}



Measured memory_bytes: 3108
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>
#include <map>   
#include <stdio.h>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ull unsigned long long
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;

int main() {
	int N, K, i, one_saisyo, one_saigo, zero_saisyo, zero_saigo, before;
	string S;
	vector<pair<int, int>> zero, one;
	cin >> N >> S >> K;
	char s = S[K-1];
	REP(i, N) {
		if (S[i] == s)
			cout << s;
		else
			cout << "*";
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
using namespace std;
string z(int i){string s="";if(i>25){s+='a'+i/25;i%=25;}s+='a'+i;return s;}
int main(){
	string s;
	map<string,int>m;
	int i=0;
	cout<<"?shiritori"<<endl;
	for(;i<50;i++){
		cin>>s;
		if(s[0]!='i'||m[s]){cout<<"!OUT"<<endl;return 0;}
		m[s]=1;cout<<string("?")+s[s.size()-1]+z(i)+"i"<<endl;
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
    int n,s[1001] = {};
    double m,ans;
    while(1){
        cin >> n;
        if(n == 0) break;
        m = 0;
        ans = 0;
        for(int i = 1; i <= n; i ++){
            cin >> s[i];
            m += s[i];
        }
        m = m / n;
        for(int i = 1; i <= n; i ++){
            ans += pow(s[i] - m,2);
        }
        printf("%f\n",sqrt(ans/n));
        
    }
    return 0;
}


Measured memory_bytes: 3220
import java.util.*;

public class Main {

    public static void main(String[] args)
    {
        //変数
        int count=0;
        boolean sw=false;
        int max=Integer.MIN_VALUE;
        int min=Integer.MAX_VALUE;
        String answer="Yay!";
        //入力
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        int d=sc.nextInt();
        int e=sc.nextInt();
        int k=sc.nextInt();
        //処理
        if(b-a>k)
        {
            count++;
        }else if(c-a>k)
        {
            count++;
        }else if(d-a>k)
        {
            count++;
        }else if(e-a>k)
        {
            count++;
        }else if(c-b>k)
        {
            count++;
        }else if(d-b>k)
        {
            count++;
        }else if(e-b>k)
        {
            count++;
        }else if(d-c>k)
        {
            count++;
        }else if(e-c>k)
        {
            count++;
        }else if(e-c>k)
        {
            count++;
        }
        if(count>0)
        {
            answer=":(";
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 24020
#include "bits/stdc++.h"

using namespace std;

const int m = 100010;

void solve()
{
	int Q;
	cin >> Q;
	vector<int> ps(m), vs(m);
	for (int i = 2; i < m;i++)
	{
		if (ps[i]) continue;
		for (int j = i * 2; j < m; j += i)
		{
			ps[j] = 1;
		}
	}
	for (int i = 3; i < m; i += 2)
	{
		if (!ps[i] && !ps[(i+1)/2]) vs[i] = 1;
	}
	for (int i = 0; i < m-1; i++)
	{
		vs[i + 1] += vs[i];
	}
	while(Q--)
	{
		int l, r;
		cin >> l >> r;
		cout << vs[r] - vs[l-1] << endl;
	}
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define rep(i,n,N) for(int i=n;i<=N;i++)
#define rap(i,n,N) for(int i=(int)n;i>=(int)N;i--)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define piii pair<pii,int>
#define piiii pair<pii,pii>
#define endl "\n"
const int MAX=1e6+5;
const ll MAX2 = 11;
const int MOD=1000000000 + 7;
const ll INF=20000;
const int dr[]={1,0,-1,0,1,1,-1,-1};
const int dc[]={0,1,0,-1,1,-1,1,-1};
const double pi = acos(-1);

int n,x[MAX],bit[MAX],v[MAX],q,ls,ans[MAX];
piii y[MAX];

inline void upd(int i,int z){
	for(; i<=n; i+=(i&-i))bit[i]+=z;
}

inline int que(int i){
	int ret = 0;
	for(; i> 0; i-=(i&-i))ret+=bit[i];
	return ret;
}

int main(){
//	cout<<fixed<<setprecision(10);
    //freopen("input.txt", "r", stdin);
	//freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n>>q;
    rep(i,1,n)cin>>x[i];
    rep(i,1,q)cin>>y[i].fs>>y[i].ff, y[i].se = i;
    sort(y+1,y+1+q);
    ls = 0;
    rep(i,1,q){
    	while(ls<y[i].ff){
    		ls++;
    		if(v[x[ls]])upd(v[x[ls]],-1);
    		v[x[ls]] = ls;
    		upd(ls,1);
		}
		ans[y[i].se] = que(y[i].ff)-que(y[i].fs-1);
	}
	rep(i,1,q)cout<<ans[i]<<endl;
    return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  int n;
  char boin[6]={'a','i','u','e','o','A'};
  while(1){
    cin >> n;
    if(n==0) return 0;
    vector<string> s(n);
    bool flag;
    for(int i=0;i<n;i++){
      cin >> s[i];
      for(int j=1;j<s[i].length();j++){
        flag=false;
        for(int k=0;k<6;k++){
          if(s[i][j-1]==boin[k]){
            flag=true;
          }
        }
        if(!flag){
          flag=false;
          for(int k=0;k<6;k++){
            if(s[i][j]==boin[k]){
              flag=true;
            }
          }
          if(flag){
            s[i][j]='A';
          }else{
            s[i][j]='X';
          }
        }
      }
      for(int j=0;j<s[i].length();j++){
        if(s[i][j]=='A'||s[i][j]=='X'){
          s[i].erase(j,1);
          j--;
        }
      }
    }
    flag=false;
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
        if(s[i]==s[j]){
          flag=true;
          break;
        }
      }
    }
    int ans=0;
    if(flag){
      cout << -1 << endl;
    }
    if(!flag){
      for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
          flag=false;
          for(int k=0;k<min(s[i].length(),s[j].length());k++){
            if(s[i][k]!=s[j][k]){
              ans=max(ans,k+1);
              flag=true;
              break;
            }
          }
          if(!flag){
            ans=max(ans,min(s[i].length(),s[j].length())+1);
          }
        }
      }
      cout << ans << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3148
# coding: utf-8
N = int(input())
A = [int(n) for n in input().split(" ")]
cnt = 0
isKeep = True
while(isKeep):
    for i in range(len(A)):
        if A[i] % 2 == 0:
            A[i] = A[i]/2
        else:
            isKeep = False
    if isKeep:
        cnt = cnt + 1
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{
    vi a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int k;
    cin >> k;
    cout << a[k-1] << endl;
    
    
    
    

    return 0;
}


Measured memory_bytes: 256