akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main{
    static Scanner s = new Scanner(System.in);
    static class calendarSystem implements Comparable<calendarSystem>{
        String EraName;
        int EraBasedYear;
        int WesternYear;

        calendarSystem(String eraName, int eraBasedYear, int westernYear) {
            EraName = eraName;
            EraBasedYear = eraBasedYear;
            WesternYear = westernYear;
        }

        public int compareTo(calendarSystem x){
            return this.WesternYear-x.WesternYear;
        }

    }

    public static void main(String[] args) {
        while(true){
            int N = s.nextInt();
            int Q = s.nextInt();
            if(N==0 && Q==0) break;
            calendarSystem[] eraYear = new calendarSystem[N];

            for(int i=0;i<N;i++){
                String  EraName = s.next();
                int EraBasedYear = s.nextInt();
                int WesternYear = s.nextInt();

                eraYear[i] = new calendarSystem(EraName,EraBasedYear,WesternYear);
            }
            Arrays.sort(eraYear);

            for(int i=0;i<Q;i++){
                int Query = s.nextInt();

                convertingYear(Query,eraYear);
            }
        }
    }
    static void convertingYear(int Query,calendarSystem[] eraYear){
        for(int i=0;i<eraYear.length;i++){
            int WesternYear = eraYear[i].WesternYear;
            int EraBasedYear = eraYear[i].EraBasedYear;
            String EraName = eraYear[i].EraName;

            if(Query<=WesternYear && Query>=WesternYear-EraBasedYear+1){
                int Year = EraBasedYear-(WesternYear-Query);
                System.out.println(EraName+" "+Year);
                return;
            }
        }
        System.out.println("Unknown");
    }
}

Measured memory_bytes: 65540
#include "stdio.h"
#include "stdlib.h"
#include "iostream"
#include "math.h"
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include "algorithm"


using namespace std;
#define fori0(G) for(int i=0;i<G;i++)
#define fori1(G) for(int i=1;i<=G;i++)
#define forj0(G) for(int j=0;j<G;j++)
#define forj1(G) for(int j=1;j<=G;j++)
#define fork0(G) for(int k=0;k<G;k++)
#define fork1(G) for(int k=1;k<=G;k++)
int dx[] = { -1,0,1,0 ,0 }, dy[] = { 0,1,0,-1,0 };
#define nxnycon (0<=nx&&nx<h&&0<=ny&&ny<w) 
#define lo long long int

int n,a,x,t=1000000000+1;




int main() {
	cin >> n;
	fori0(n) {
		cin >> a;
		x = max(x, a);
		t = min(t, a);
	}
	cout << (x - t);
	//system("pause");
	return 0;

}



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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = (a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (a); i <= (long long)(n); i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int n, K;
    cin >> n >> K;

    v_ll x(n), y(n);
    
    irep(i, n) {
        cin >> x[i] >> y[i];
    }

    ll ans = LINF*4 + 2;

    irep(i, n) {
        irep(j, n) {
            irep(k, n) {
                irep(l, n) {
                    ll x1 = x[i], x2 = x[j];
                    ll y1 = y[k], y2 = y[l];
                    int cnt = 0;
                    if(x2 > x1 && y2 > y1) {
                        irep(a, n) {
                            bool x_lim = false, y_lim = false;
                            ll xn = x[a], yn = y[a];

                            if(x2 >= xn && xn >= x1) { x_lim = true; }
                            if(y2 >= yn && yn >= y1) { y_lim = true; }
                            if(x_lim & y_lim) {
                                cnt++;
                            }
                        }
                        ll s = (x2 - x1) * (y2 - y1);
                        if(cnt >= K) {
                            ans = min(ans, s);
                        }
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}
/** atcoder **/


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


using namespace std;
int MOD = 1e9+7;
int dp[1001][1001];

// int print(int h, int w){
// 	for(int i=0; i<h; i++) {
//   		for(int j=0; j<w; j++) {
//   			cout<<dp[i][j]<<' ';
//   		}
//   		cout<<'\n';
//   	}
//   	cout<<'\n';
// }

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  	
  	int h,w;
  	cin>>h>>w;
  	char grid[h][w];
  	

  	memset(dp,-1,sizeof(dp));

  	for(int i=0; i<h; i++) {
  		for(int j=0; j<w; j++) {
  			cin>>grid[i][j];
  		}
  	}

  	for(int i=0; i<h; i++) {
  		if(grid[i][0]=='#'){
  			for(int j=i; j<h; j++) {
  				dp[j][0]=0;
  			}
  			break;
  		}
  		else{
  			dp[i][0]=1;
  		}

  	}
  	for(int i=0; i<w; i++) {
  		if(grid[0][i]=='#'){
  			for(int j=i; j<w; j++) {
  				dp[0][j]=0;
  			}
  			break;
  		}
  		else{
  			dp[0][i]=1;
  		}
  	}
  	// print(h,w);
  	for(int i=1; i<h; i++) {
  		for(int j=1; j<w; j++) {
  			dp[i][j] = (grid[i][j]=='#')?0:(dp[i-1][j] + dp[i][j-1])%MOD;
  		}
  	}
  	// print(h,w);

  	cout<<dp[h-1][w-1]<<'\n';



    return 0;
}

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

const int mod=998244353;
int n,k,sum[500005],L[200005],R[200005];

void add(int x,int c) {
	if (c<0) c=(c+mod)%mod;
	for (;x<=n;x+=x&-x) sum[x]=(sum[x]+c)%mod;
}

int que(int x) {
	int ret=0;
	for (;x>=1;x-=x&-x) ret=(ret+sum[x])%mod;
	return ret;
}

int main()
{
	scanf("%d%d",&n,&k);
	for (int i=1;i<=k;i++) {
		scanf("%d%d",&L[i],&R[i]);
	}
	sum[1]=1;
	for (int i=1;i<=n;i++) {
		for (int j=1;j<=k;j++) {
			if (i+L[j]<=n) add(i+L[j],que(i));
			add(min(n+1,i+R[j]+1),-que(i));
		}
	}
	printf("%d\n",que(n));
	
	return 0;
}

Measured memory_bytes: 4612
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
 
using namespace std;
typedef long long ll;
 
int main(){
    string dateTime; cin>>dateTime;
    if(dateTime[6]=='4'){
        cout<<"Heisei"<<endl;
    }else if((dateTime[5]=='0' && dateTime[6]=='1')
         || (dateTime[5]=='0' && dateTime[6]=='2')
         || (dateTime[5]=='0' && dateTime[6]=='3')){
        cout<<"Heisei"<<endl;
    }else{
        cout<<"TBD"<<endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<limits.h>

#define MOD 1000000007
#define DEBUG 0


using namespace std;

long long int modpow(long long int a, int n) {

	if (n == 0)return 1;
	if (n == 1) return a;

	long long int wk = modpow(a, n / 2);

	long long int ret = 0;
	if (n % 2 == 0) {
		ret = 1;
	}
	else {
		ret = a;
	}

	return (((ret * wk) % MOD) * wk) % MOD;

}

long long int gcd(long long int a, long long int b) {
	long long int tmp;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	long long int r = a % b;

	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

long long int lcm(long long int a, long long int b) {

	long long int wk_int;

	wk_int = (a * b) % MOD;
	
	long long int ret;

	ret = (wk_int * modpow(gcd(a, b), MOD - 2)) % MOD;

	return ret;

}

bool isPrime(int n) {
	if (n == 1)return false;
	if (n == 2)return true;

	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}

	return true;
}








int main()
{
	
	int a, b;
	cin >> a >> b;

	if (a == b)cout << "Yes" << endl;
	else cout << "No" << endl;



	return 0;

}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

template<class T> class SegmentTree {
    public:
    typedef function<T(T, T)> F;
    size_t n;
    vector<T> data;
    T def;  // 単位元
    T initial_value;    // 初期値
    F update_func;  // 更新用関数
    F find_func;  //クエリ用関数

    SegmentTree(size_t _n, T def, T initial_value, F update_func, F find_func)
        : def(def), initial_value(initial_value), update_func(update_func), find_func(find_func) {
        n = 1;
        while(n < _n) n <<= 1;
        data = vector<T>(2*n-1, initial_value);
    }

    void update(size_t i, T x) {
        i += n-1;
        data[i] = update_func(data[i], x);
        while(i) {
            i = (i-1) / 2;
            data[i] = find_func(data[2*i+1], data[2*i+2]);
        }
    }

    T find(size_t s, size_t t, size_t k, size_t kl, size_t kr) {
        if(kr <= s || t <= kl) return initial_value;
        if(s <= kl && kr <= t) return data[k];
        size_t kc = (kl+kr) / 2;
        T vl = find(s, t, 2*k+1, kl, kc);
        T vr = find(s, t, 2*k+2, kc, kr);
        return find_func(vl, vr);
    }

    T find(size_t s, size_t t) {
        return find(s, t, 0, 0, n);
    }
};

int main() {
    unsigned int n, q, com, x, y;
    cin >> n >> q;
    SegmentTree<unsigned int> tree(
        n+1, 0u, 0u, 
        [](unsigned int a, unsigned int b) { return a+b; }, 
        [](unsigned int a, unsigned int b) { return a+b; }
    );

    while(q--) {
        cin >> com >> x >> y;
        if(com) {
            cout << tree.find(x, y+1) << endl;
        } else {
            tree.update(x, y);
        }
    }
    
}


Measured memory_bytes: 3924
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int a, int b) {  
  return b != 0 ? gcd(b, a % b) : a;
}//MAX
int lcm(int a, int b) { 
   return a * b / gcd(a, b);
   }
//MIN

 main() {
int a,b,c;
cin >> a >> b >> c;
if(a==b&&b==c)cout <<"Yes"<<endl;
else cout <<"No"<<endl;
 }


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

typedef long long ll;
typedef long double ld;

ll niz[1000005];

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n;
    cin >> n;
    ll mx1 = 0, mx2 = 0;
    for(int i=1; i<=n; i++){
        cin >> niz[i];
    }
    sort(niz+1, niz+1+n);
    for(int i=n; i>=1; i--){
        if(niz[i] == niz[i-1]){
            if(mx1) mx2 = max(mx2, niz[i]);
            else mx1 = niz[i];
            i--;
        }
    }
    cout << mx1 * mx2;
    return 0;
}


Measured memory_bytes: 1024
pr=[True]*50100
for i in range(2,225):
    if pr[i]:
        for j in range(i*2,50100,i):
            pr[j]=False

while True:
    try:
        n=int(input())
    except:
        break
    for i in range(n-1,0,-1):
        if pr[i]:
            print(i,end=" ")
            break
    for i in range(n+1,50100):
        if pr[i]:
            print(i)
            break

Measured memory_bytes: 7720
#include <bits/stdc++.h>
using longlong=long long;

int main() {
    std::cin.tie(0); std::cin.sync_with_stdio(false);
    int a, b, c;
    std::cin >> a >> b >> c;
    std::cout << (a+b+c+9*std::max({a,b,c})) << std::endl;
    return 0;
}

Measured memory_bytes: 256
/*-------------------------------*
| Name: Ayush Kumar              |
| Site: atcoder                  |
| Email: ayushkr667@gmail.com    |
*-------------------------------*/

#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
#define mod 1000000007
#define ll long long 
 
ll n,w, weigh[100001], val[100001];
ll dp[101][100001];
 
ll solve(int r, int idx) 
{
    if(idx > n)
        return r == 0 ? 0 : INT_MAX;
 
    if(dp[idx][r] != -1)
    	return dp[idx][r];
 
    ll ans = solve(r, idx + 1);
    if(val[idx] <= r)
    	ans = min(ans, weigh[idx] + solve(r - val[idx], idx + 1));
 
    return dp[idx][r] = ans;
}
 
int Ans(int v_max) 
{
 
	for(int i = v_max; i >= 0; i--) 
    {
		if(solve(i, 1) <= w)
			return i;
	}
	return 0;
}
 
int main() 
{
 
    cin>>n>>w;
    memset(dp, -1, sizeof(dp));
 
    int max_value = 0;
 
    for(int i = 1; i <= n; i++) 
    {
        cin>>weigh[i]>>val[i];
        max_value += val[i];
    }
    cout<<Ans(max_value);
}

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

using namespace std;

using int64 = long long;

int main() {
  int64 A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  C *= 2;

  int64 ret = 1LL << 60;
  for(int i = 0; i <= 1000000; i++) {
    int64 need1 = max(0LL, X - i);
    int64 need2 = max(0LL, Y - i);
    ret = min(ret, i * C + need1 * A + need2 * B);
  }
  cout << ret << endl;
}


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

int main() {
  int n;
  cin>>n;
  int s[n],i,sum=0;
  for(i=0;i<n;i++){
    cin>>s[i];
    sum+=s[i];
  }
  sort(s,s+n);
  if(sum%10==0){
    for(i=0;i<n;i++){
      if(s[i]%10!=0){
        sum-=s[i];
        break;
      }
      if(i==n-1 && s[i]%10==0)
        sum=0;
    }
  }
  cout<<sum;
      
    
  
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
using namespace std;
#define sci(n) scanf("%lld", &(n))
#define scd(n) scanf("%Ld", &(n))
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> pll;

LL n, A, B, C;
vector<LL> bam;
LL dfs(LL cur, LL a, LL b, LL c) {
	if (cur == n) {
		return ((min(a, min(b,c)) > 0) ? (abs(a - A) + abs(b - B) + abs(c - C) - 30) : 10e9);
	}
	LL ret0 = dfs(cur + 1, a, b, c);
	LL ret1 = dfs(cur + 1, a + bam[cur], b, c) + 10;
	LL ret2 = dfs(cur + 1, a, b + bam[cur], c) + 10;
	LL ret3 = dfs(cur + 1, a, b, c + bam[cur]) + 10;

	return min(ret0, min(ret1, min(ret2, ret3)));
}

int main(void)
{
	sci(n); sci(A); sci(B); sci(C);
	bam.resize(n);
	for (int i = 0; i < n; i++) sci(bam[i]);

	cout << dfs(0, 0, 0, 0);

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
const int MaxN = 105;
int n,m;
int a[MaxN];
int main(){
	while(~scanf("%d%d",&n,&m)){
		if(n>m)
			printf("%d\n",n-m);
			else
				printf("0\n");
	}
}

Measured memory_bytes: 128
{
  const main = (input: string): void | string | number => {
    const r = _reader(input)
    const X = r.n()

    for (let i = X; i < X + 10000; i++) {
      if (_isPrime(i)) {
        return i
      }
    }

    return -1
  }

  const _reader = (str: string, i = 0) => {
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')
    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map(v => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }
  const _isPrime = (n: number) => {
    for (var i = 2; i < n; i++) if (n % i === 0) return false
    return n > 1
  }

  const _getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  const _res = main(_getInput())

  if (typeof _res === 'number' || typeof _res === 'string') console.log(_res)
}


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

using namespace std;

int main()
{
    int N, M, i=0;

    cin >> N;
    cin >> M;

    string input[N], l;

    // 標準入力
    while(cin>>l){
        input[i] = l;
        i++;
        if (i >= N) {
            break;
        }
    }

    // ソート
    sort(input, input+N);

    // 出力
    string result = "";
    for (int i = 0; i < N; i++)
    {
        result = result + input[i];
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
T1,T2=map(int, input().split())
A1,A2=map(int, input().split())
B1,B2=map(int, input().split())
C1=A1*T1
D1=A2*T2
C2=B1*T1
D2=B2*T2
if (A1-B1)*(A2-B2)>0:
  print(0)
else:
  C=C1-C2
  D=D1-D2
  if C<0:
    C=-C
    D=-D
  E=C+D
  if E>0:
    print(0)
  elif E==0:
    print("infinity")
  else:
    k=C//int(-E)
    if k==C/int(-E):
      print(2*k)
    else:
      print(2*k+1)
    

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	
	int K;
	cin >> K;
	int A[100000];
	rep(i, K) cin >> A[i];

	ll a = 2;
	ll b = 2;
	int muri = 0;
	for (int i = K - 1; i >= 0; i--) {
		a = (a + A[i] - 1) / A[i] * A[i];
		if (a > b) {
			muri = 1;
			break;
		}
		b = b / A[i] * A[i] + A[i] - 1;
	}

	if (muri) co(-1);
	else {
		cosp(a);
		co(b);
	}

	Would you please return 0;
}

Measured memory_bytes: 640
<?php
 
$word = fgets(STDIN);
$word = trim($word);
$word_num = strlen($word);
 
$num = fgets(STDIN);
$arr = [];
 
for ($i = 0; $i < $word_num; $i++) {
  $tmp = substr($word, 0, 1);
  array_push($arr, $tmp);
  $word = substr($word, 1);
}
 
$ans_arr = [];
 
for ($i = 0; $i < $word_num; $i++) {
    if ($i === 0 || $i % $num === 0) {
        array_push($ans_arr, $arr[$i]);
    } 
}
 
$ans = implode("", $ans_arr);
 
echo $ans;
 
?>

Measured memory_bytes: 16244
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vvp g;
vi vis,s;
vl a;

int Cdfs(int v,int p){
	s[v]=1;
	for(auto i:g[v]){
		int u=i.first;
		if(!vis[u]&&u!=p) s[v]+=Cdfs(u,v);
	}
	return s[v];
}

P Cdfs1(int v,int p,int S){
	P q={inf,0};
	int M=0,S_=S-1;
	for(auto i:g[v]){
		int u=i.first;
		if(!vis[u]&&u!=p){
			q=min(q,Cdfs1(u,v,S));
			M=max(M,s[u]);
			S_-=s[u];
		}
	}
	return min(q,{max(M,S_),v});
}

int Cent(int v){
	Cdfs(v,-1);
	return Cdfs1(v,-1,s[v]).second;
}

void dfs(int v,int p,ll e,vp& b){
	b.push_back({e,v});
	a[v]+=e;
	for(auto i:g[v]){
		int u=i.first;
		if(!vis[u]&&u!=p) dfs(u,v,min(e,(ll)i.second),b);
	}
}

void f(vp b,ll t){
	sort(b.begin(),b.end());
	ll S=b.size(),sum=0;
	for(int i=0;i<S;i++){
		ll e=b[i].first,v=b[i].second;
		a[v]+=(sum+e*(S-i-1))*t;
		sum+=e;
	}
}

void Rec(int v){
	int C=Cent(v);
	vp b;
	for(auto i:g[C]) if(!vis[i.first]){
		vp b_;
		dfs(i.first,C,i.second,b_);
		for(auto j:b_){
			a[C]+=j.first;
			b.push_back(j);
		}
		f(b_,-1);
	}
	f(b,1);
	vis[C]++;
	for(auto i:g[C]){
		int u=i.first;
		if(!vis[u]) Rec(u);
	}
}

int main(){
	cin>>n;
	g=vvp(n);
	a=vl(n);
	vis=s=vi(n);
	for(int i=1;i<n;i++){
		int u,v,c;
		cin>>u>>v>>c;
		u--;v--;
		g[u].push_back({v,c});
		g[v].push_back({u,c});
	}
	Rec(0);
	for(auto i:a) cout<<i<<endl;
}

Measured memory_bytes: 22076
use std::collections::HashSet;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let s = sc.chars();

    let result = (1..n).map(|i| {
        let a: HashSet<&char> = s[0..i].iter().collect();
        let b: HashSet<&char> = s[i..n].iter().collect();

        let res = a.intersection(&b).count();
        res
    }).max_by(|x, y| x.cmp(y)).unwrap();

    println!("{}", result);
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  int max = 0;
  cin >> A.at(0);
  for(int i=1;i<N;i++){
    cin >> A.at(i);
    if(A.at(i) > A.at(max)) max = i;
  }
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  if(A.at(0)==A.at(1)){
    for(int i=0;i<N;i++) cout << A.at(0) << endl;
  }
  else{
    for(int i=0;i<N;i++){
      if(i == max) cout << A.at(1) << endl;
      else cout << A.at(0) << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 2432
#include <cmath>
#include <stdio.h>
#include <iostream>
using namespace std;

class xy_t{
public:
  double x;
  double y;
};

xy_t P[110];
int main(){
  int N = 0;
  double mx, my;
  while(scanf("%lf,%lf", &mx, &my) != EOF){
    P[N].x = mx;
    P[N].y = my;
    N++;
  }
  double sum = 0.0;
  for(int i=0; i+2<N; i++){
    xy_t a=P[0], b=P[i+1], c=P[i+2];
    sum += 0.5*abs((b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x));
    
   
  }
  printf("%.6f\n", abs(sum));
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#include <string.h>
#define rep(i, n) for(int i = 0; i<(n); i++)
using namespace std;
typedef long long ll;
static const int MAX = 200000; 
//pi = 3.14159265358979323846

int main() {

    int n;
    int h[MAX];

    cin >> n;
    rep(i, n){
        cin >> h[i];
    }
    rep(i, n){
        if(i == 0) h[i]--;
        else if(h[i - 1] > h[i]){
            cout << "No" << endl;
            return 0;
        }else if (h[i - 1] < h[i]) h[i]--;
        
    }
    cout << "Yes" << endl;

}



Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
#include <cstring>
#define maxn 200010
using namespace std;
struct node{
	char s[12];
}q[maxn];
char pre[12];
int cmp(node a,node b){
	return strcmp(a.s,b.s)<0;
}
int main(){
	int n,i,cnt=1;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%s",q[i].s);
	sort(q+1,q+1+n,cmp);
	strcpy(pre,q[1].s);
	for(i=2;i<=n;i++)
		if(strcmp(q[i].s,pre)!=0)strcpy(pre,q[i].s),cnt++;
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 4076
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    string S;
    cin >> S;
    ll K;
    cin >> K;
    ll len = S.size();
    ll sub_count = 0;
    ll count = 0;
    rep(i,len - 1){
        if (S[i] == S[i + 1]){
            sub_count++;
            if (sub_count % 2 == 1){
                count++;
            }
        }
        else{
            sub_count = 0;
        }
    }
    ll count_net = 1;
    ll ans = 0;
    rep(i,len - 1){
        if (S[0] == S[i + 1]) count_net++;
    }
    if (count_net == len){
        ans = (len * K) / 2;
    }
    else if (S[0] != S[len - 1]){
        ans = count * K;
    }
    else{
        ll cnt1 = 1;
        while(cnt1 < len){
            if (S[cnt1 - 1] != S[cnt1]){
                break;
            }
            else cnt1++;
        }
        ll cnt2 = 1;
        while(cnt2 < len){
            if (S[len - cnt2 - 1] != S[len - cnt2]){
                break;
            }
            else cnt2++;
        }
        ans =  count * K + ((cnt1 + cnt2) / 2) * (K - 1) - (cnt1 / 2) * (K - 1) - (cnt2 / 2) * (K - 1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("tune=native")
using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1000000000000000000LL;
const int MAX_N = 5005;

int n, k;
int p[MAX_N];
ll c[MAX_N];
bool used[MAX_N];

ll maxCircularSum(const vector<ll>& a, int maxSz)
{
	maxSz = min(maxSz, (int)a.size());
	if (maxSz == 0)
		return 0LL;
	ll result = -INF;
	for (int i = 0; i < (int)a.size(); i++)
	{
		ll res = 0;
		for (int j = i, kk = 0; kk < maxSz; j++, kk++)
		{
			if (j == (int)a.size())
				j = 0;
			res += a[j];
			result = max(result, res);
		}
	}
	return result;
}

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

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

	ll result = -INF;
	for (int i = 0; i < n; i++)
		if (!used[i])
		{
			vector<ll> a;
			ll aSum = 0;
			int u = i;
			while (!used[u])
			{
				used[u] = true;
				a.push_back(c[u]);
				aSum += c[u];
				u = p[u];
			}

			ll res = 0;
			if (aSum > 0)
			{
				ll cnt = max(0LL, (k / (ll)a.size()) - 1LL);
				res = max(cnt * aSum + maxCircularSum(a, k - cnt * (ll)a.size()),
					(k / (ll)a.size()) * aSum + maxCircularSum(a, int(k) % (int)a.size()));
			}
			else
				res = maxCircularSum(a, k);
			result = max(result, res);
		}
	cout << result << '\n';

	return 0;
}

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

int main() {
    
    // 'a' = 97
    string S;
    cin >> S;
    int V = 26; // アルファベットの総数
    int num[V] = {0};

    for(int i = 0; i < S.length(); ++i) {
        ++num[ int(S[i]) - int('a') ];
    }
    for(int i = 0; i < V ; ++i ) {
        
        if(num[i] == 0) {
            cout << char(i+int('a')) << endl;
            exit(0);
        }
    }
    cout << "None" << endl;

}

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

#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i,a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
ll mod = static_cast<ll>(1e9 + 7);
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class A, int N, class T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

template<class T>
struct ModInt {
    T x;
    ModInt(T x = 0) :x((x + mod) % mod) {}
    ModInt& operator+=(const ModInt a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(const ModInt a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator*=(const ModInt a) {
        (x *= a.x) %= mod;
        return *this;
    }
    ModInt operator+(const ModInt a) const {
        ModInt res(*this);
        return res += a;
    }
    ModInt operator-(const ModInt a) const {
        ModInt res(*this);
        return res -= a;
    }
    ModInt operator*(const ModInt a) const {
        ModInt res(*this);
        return res *= a;
    }
    ModInt pow(T t) const {
        if (!t) return 1;
        ModInt a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    ModInt inv() const {
        return pow(mod - 2);
    }
    ModInt& operator/=(const ModInt a) {
        return (*this) *= a.inv();
    }
    ModInt operator/(const ModInt a) const {
        ModInt res(*this);
        return res /= a;
    }
};
using mint = ModInt<long long>;


string s;
int d;
mint dp[10005][105][2];
void solve() {
    cin >> s >> d;
    dp[0][0][0] = 1;
    rep(i, sz(s)) rep(j, d + 1) rep(k, 10) {
        if (k < s[i] - '0') dp[i + 1][(j + k) % d][1] += dp[i][j][0];
        else if (k == s[i] - '0') dp[i + 1][(j + k) % d][0] += dp[i][j][0];
        dp[i + 1][(j + k) % d][1] += dp[i][j][1];
    }
    cout << (dp[sz(s)][0][0] + dp[sz(s)][0][1] - mint(1)).x << endl;
}

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


Measured memory_bytes: 16640
import math

N = int(input())

L = [list(map(int, input().split())) for _ in range(N)]

total = 0

for i in range(N):
    for j in range(N):
        if i != j:
            total += math.sqrt((L[i][0]-L[j][0])**2 + (L[i][1]-L[j][1])**2)
 
print(total/N)

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

int main(){

  int N, ans=1024, num;
  cin >> N;
  int A[N];
  for(int i=0; i<N; i++){
    cin >> A[i];
  }

  for(int i=0; i<N; i++){
    num = 0;
    while(!(A[i]%2)){
      A[i] /= 2;
      num++;
    }
    ans = min(ans, num);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
def divisors_list(mini, maxi, n):
    divisors = []
    for i in range(a, b + 1):
        if n%i == 0:
            divisors.append(i)
    return divisors


a, b, c = map(int, input().split())

# 1. cを因数分解する
# 2. 約数をリストアップする
# 3. a~bの間にある約数を抽出する

d = divisors_list(a, b, c)
print(len(d))



Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
const int N = 205;
const int maxS = 40005;
long long f[2][2*maxS],n,m,a[N];
const long long MOD =1e17+7;
void nhap()
{
    cin >> n >> m;
    for (int i=1; i<=n; i++) {
        cin >> a[i];
        a[i] -= m;
    }
}
void xuli()
{
    memset(f,0,sizeof(f));
    f[0][maxS] = 1;
    for (int i = 1; i<=n; i++) {
        for (int j = 0; j<2*maxS; j++) {
             f[1][j] = ((f[1][j]%MOD) + (f[0][j]%MOD))%MOD;
             if (j+a[i] < 2*maxS) f[1][j+a[i]] = ((f[1][j+a[i]]%MOD) + (f[0][j]%MOD))%MOD;
        }
        for (int j = 0; j<2*maxS; j++) {
            f[0][j] = f[1][j];
            f[1][j] = 0;
        }
    }
    cout << f[0][maxS] - 1  << '\n';
}
int main()
{
        nhap();
        xuli();

}


Measured memory_bytes: 1536
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100000;

int n;
vector<int> adj[MAXN];

int cnt[MAXN];
int parlen[MAXN];
int mxlen[MAXN];
int limit;

int cur[MAXN],ncur;

bool dfs(int at,int par) {
	//printf("dfs(%d,%d)\n",at+1,par+1);
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		if(!dfs(to,at)) return false;
	}
	cnt[at]=1,mxlen[at]=0; ncur=0;
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		cnt[at]+=cnt[to];
		mxlen[at]=max(mxlen[at],mxlen[to]);
		cur[ncur++]=parlen[to];
	}
	sort(cur,cur+ncur);
	int pos=0,nskipped=0,mnskipped=-1,res=-1,single=-1;
	for(int i=ncur-1;i>=0;--i) {
		if(pos>=i) {
			if(pos==i) {
				if(mnskipped==-1) mnskipped=cur[pos];
				++nskipped;
			}
			break;
		}
		if(cur[pos]+cur[i]>limit) {
			if(nskipped>0) { --nskipped; if(nskipped==0) mnskipped=-1; continue; }
			if(ncur%2==0&&single==-1) { mxlen[at]=max(mxlen[at],cur[i]); single=cur[i]; continue; }
			if(res==-1) { res=cur[i]+1; continue; }
			return false;
		}
		while(pos+1<i&&cur[pos+1]+cur[i]<=limit) {
			if(mnskipped==-1) mnskipped=cur[pos];
			++nskipped,++pos;
		}
		mxlen[at]=max(mxlen[at],cur[pos]+cur[i]);
		++pos;
	}
	nskipped%=2;
	if(nskipped==0&&res==-1) res=1;
	if(nskipped==1&&res==-1) res=mnskipped+1;
	parlen[at]=res; mxlen[at]=max(mxlen[at],parlen[at]); cnt[at]-=(ncur+1)/2;
	//printf("limit=%d: %d -> cnt=%d parlen=%d mxlen=%d\n",limit,at+1,cnt[at],parlen[at],mxlen[at]);
	//printf("cur:"); REP(i,ncur) printf(" %d",cur[i]); puts("");
	return mxlen[at]<=limit;		
}

void run() {
	scanf("%d",&n);
	REP(i,n-1) { int a,b; scanf("%d%d",&a,&b); --a,--b; adj[a].PB(b); adj[b].PB(a); }
	//n=MAXN; REP(i,n-1) adj[0].PB(i+1),adj[i+1].PB(0);

	int rt=0; while(SZ(adj[rt])!=1) ++rt; //printf("rt=%d\n",rt+1);
	int x=adj[rt][0];
	limit=INT_MAX;
	assert(dfs(x,rt));
	int rescnt=cnt[x];
	int l=0,r=mxlen[x];
	while(l+1<r) {
		limit=l+(r-l)/2;
		if(dfs(x,rt)) r=limit; else l=limit;
	}
	printf("%d %d\n",rescnt,r);
}

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


Measured memory_bytes: 14720
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int N,M,Q;

int cnt[512][512];
int ans = 0;

int main(){
    scanf("%d %d %d",&N,&M,&Q);
    rep(i,M){
        int L,R;
        scanf("%d %d",&L,&R);
        L--;
        R--;
        cnt[L][R]++;
    }

    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cnt[i][j+1] += cnt[i][j];
        }
    }

    rep(i,Q){
        int p,q;
        scanf("%d %d",&p,&q);
        p--;
        q--;
        ans = 0;
        for(int l=p;l<=q;l++){
            ans += cnt[l][q];
        }
        printf("%d\n",ans);
    }
}


Measured memory_bytes: 1920
#include<iostream>
#include<stack>
#include<map>
using namespace std;

int main(){
	int N,M;
	cin>>N>>M;
	map<int,int> a;
	int tmp;
	for(int i=0;i<M;++i){
		cin>>tmp;
		a[tmp] = 1;
	}
	long ans[N];
	ans[0] = 1;
	if(a[1]==0)ans[1]=1;
	else ans[1]=0;
	for(int i=2;i<=N;++i){
		if(a[i]==0){
			ans[i] = (ans[i-2] + ans[i-1])%1000000007;
		}
		else ans[i]=0;
	}
	/*
	for(int i=0;i<=N;++i){
		cout<<ans[i]<<endl;
	}
	*/
	cout<<ans[N]<<endl;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
long long arr[100005];

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

    int n;
    cin >> n;
    for(int i=0; i<n; i++)
        cin >> arr[i];
    reverse(arr, arr + n);
    long long lo = 2, hi = 2;
    for(int i=0; i<n; i++){
        long long ch = (hi / arr[i]) * arr[i] + arr[i] - 1;
        long long cl = ( (lo + (arr[i] - 1))/ arr[i] ) * arr[i];
        if(cl > ch){
            cout << -1 ;
            return 0;
        }
        lo = cl, hi = ch;
    }
    cout << lo << " " << hi << endl;
    return 0;
}


Measured memory_bytes: 1024
n=int(input())
L=[0,0,0,0]
x = [input() for i in range(n)]

for i in range(n):

  if x[i]=='AC':
    L[0]=L[0]+1
  elif x[i]=='WA':
    L[1]=L[1]+1
  elif x[i]=='TLE':
    L[2]=L[2]+1
  else:
    L[3]=L[3]+1


print('AC'+' x '+str(L[0]))
print('WA'+' x '+str(L[1]))
print('TLE'+' x '+str(L[2]))
print('RE'+' x '+str(L[3]))



Measured memory_bytes: 16248
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<(n);i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;

int main(){
    ll n;cin>>n;
    ll ans = INFL;
    rep(i,sqrt(n)+1){
        if(i==0)continue;
        if(n%i==0){
            ll a = i,b=n/i;
            string sa =to_string(a),sb=to_string(b);
            ans =min(ans,(ll)max(sa.length(),sb.length()));
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,val,v[1000001];
bool tag = true;

int main(){
	ios_base::sync_with_stdio(false);
	cout.tie(NULL);
	cin.tie(NULL);
	cin >> n;
	for(int i = 1 ; i <= n ; i += 1){
		int a;
		cin >> a;
		if(i == 1){
			val = a;
		}else{
			val = __gcd(val,a);
		}
		if(tag){
			for(int j = 2 ; j*j <= a ; j += 1){
				if(a % j == 0){
					v[j] += 1;
					if(v[j] > 1){
						tag = false;
					}
					while(a % j == 0){
						a /= j;
					}
				}
			}
			if(a > 1){
				v[a] += 1;
				if(v[a] > 1){
					tag = false;
				}
			}
		}
	}
	if(tag){
		cout << "pairwise coprime" << endl;
	}else if(val == 1){
		cout << "setwise coprime" << endl;
	}else{
		cout << "not coprime" << endl;
	}
}

Measured memory_bytes: 7488
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <iostream>
#include <fstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <iterator>
#include <iomanip>
#include <unordered_map>

using namespace std;

int main()
{

    //freopen("input.txt", "r", stdin); // for getting input from input.txt
    //freopen("output.txt", "w", stdout);// for writing output to output.txt

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s, t;
    cin>>s>>t;
    if(s+t[t.size()-1]==t)
        cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
ll n,m,a[222222],ans;
int main()
{
	cin>>n>>m;
	for(ll i=1;i<=n;i++)
		a[i%m]++;
	ans=a[0]*a[0]*a[0];
	if(m%2==0)
		ans+=a[m/2]*a[m/2]*a[m/2];
	cout<<ans;
}

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

int main() {
  int k;
  string s;
  cin >> k >> s;
  int S = s.size();
  if(k >= S) cout << s << endl;
  else {
    string sub = s.substr(0, k);
    for(int i = 0; i < 3; i++) {
      sub.insert(sub.size(), ".");
    }
  cout << sub << endl;
  }
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	/**
	 * problem solver
	 */
	public static class Problem {

		/**
		 * paramters
		 */
		private int a;
		private int b;

		/**
		 * constructor
		 */
		Problem() {
			a = 0;
			b = 0;
		}

		/**
		 * standard input
		 */
		void input() {
			Scanner sc = new Scanner(System.in);
			a = sc.nextInt();
			b = sc.nextInt();
			sc.close();
		}


		/**
		 * solver
		 */
		void solve() {
			int ans=0;
			if (a >=13) {
				ans = b;
			} else if (6 <= a && a <= 12) {
				ans = b/2;
			} else {
				ans = 0;
			}
			
			System.out.println(ans);
		}

	}

	public static void main(String args[]) {

		Problem p = new Problem();

		p.input();

		p.solve();
	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <set>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <numeric>

using namespace std;

typedef long long ll;

#define forn(i, n) for(int i = 0; i < (int)(n);++i)
#define fore(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)
#define fi first
#define se second
#define pb push_back
#define pll pair<ll,ll>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vb vector<bool>
#define vvi vector<vi>
#define vpll vector<pll>
#define vll vector<ll>
#define vvll vector<vll>
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

void fastik() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}


int main() {
    fastik();
    string s; cin >>s;
    ll ans = 0;
    ll n = sz(s);
    ll r = 0;
    ll b = 0;
    forn(i,n){
        if(s[i] == '0'){
            r++;
        }else{
            b++;
        }
        if(b > 0 && r > 0){
            ans++;
            b--;
            r--;
        }
    }



    cout << ans*2;

}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int A[2000000],B[2000000],C[10001];
void Sort(int n)
{
    int i;
    for(i=0;i<10001;i++)
        C[i] = 0;
    for(i=0;i<n;i++)
        C[A[i]]++;
    for(i=0;i<10000;i++)
        C[i+1] += C[i];
    for(i=n-1;i>=0;i--)
    {
        B[C[A[i]]-1] = A[i];
        C[A[i]]--;
    }
}
int main()
{
    int n,i;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>A[i];
    Sort(n);
    for(i=0;i<n;i++)
    {
        if(i)
            cout<<' ';
        cout<<B[i];
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 18704
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i,n){
    cin >> d[i];
    if(d[i] == 0){
      cout << 0 << "\n";
      return 0;
    }
  }

  map<int,int> mp;
  rep(i,n) mp[d[i]]++;
  vector<int> des(0),tem(0);
  
  for(auto& itr:mp){
    if(itr.second>=3){
      cout << 0 << "\n";
      return 0;
    }
    else if(itr.second==2){
      des.push_back(itr.first);
      des.push_back(24-itr.first);
    }
    else{
      tem.push_back(itr.first);
    }
  }

  int m = tem.size();
  int maxs = 0;
  rep(S,(1<<m)){
    vector<int> vec = des;
    vec.push_back(0);
    rep(i,m){
      if((S>>i)&1){
	vec.push_back(24-tem[i]);
      }
      else{
	vec.push_back(tem[i]);
      }
    }

    int mins = 50;
    int vs = vec.size();
    rep(i,vs) rep(j,vs){
      if(i==j) continue;
      int a = vec[i],b = vec[j];
      if(a>b) swap(a,b);
      mins = min(mins , min(b-a , 24+a-b));
    }
    maxs = max(maxs,mins);
  }
  
  cout << maxs << "\n";
  return 0;
}


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

int main(){
  ll a,b,c;
  cin>>a>>b>>c;
  cout<<c<< " " << a << " " <<b<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    string s; cin >> s;
    int month = (s[5] - '0') * 10 + (s[6] - '0');
    if(month >= 5) cout << "TBD" << endl;
    else cout << "Heisei" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int n; cin >> n;
	vector<int> ss(1 << n);
	for (auto& s : ss) {
		cin >> s;
	}

	sort(ss.begin(), ss.end());

	vector<int> bs(1 << n);
	int p = 0;
	{
		int s = 0;
		int c = 0;
		FOR_LT(i, 0, 1 << n) {
			if (ss[i] != s) {
				s = ss[i];
				if (i != 0) {
					bs[p] = c;
					p++;
					c = 0;
				}
			}
			c++;
		}
		//cout << p << " " << c << endl;
		bs[p] = c;
	}

	if (bs[p] != 1) {
		cout << "No" << endl;
		return 0;
	}

	vector<int> cs(p + 1);
	cs[p] = 1;
	bs[p]--;

	FOR_LT(i, 0, n) {
		//cout << i << endl;
		int c = 0;
		FOR_DW(j, p, 0) {

			//cout << p << " " << bs[j] << " " << cs[j] << c << endl;
			int cc = min(bs[j], c);
			c += cs[j];

			c -= cc;
			cs[j] += cc;
			bs[j] -= cc;
		}
		if (c != 0) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;


	return 0;
}

Measured memory_bytes: 3328
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    Yes(n/10==9||n%10==9);
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cmath>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int s;
	bool f[1000001];
	cin >> s;
	f[s]=true;
	for (int i = 0; i < 1000001; i++) {
		if (s % 2 == 0) {
			s /= 2;
			if (f[s] == true) {
				cout << i+2 << endl;
				return 0;
			} else {
				f[s] = true;
			}
		} else {
			s = s * 3 + 1;
			if (f[s] == true) {
				cout << i+2 << endl;
				return 0;
			} else {
				f[s] = true;
			}
		}
	}
	return 0;
}



Measured memory_bytes: 256