akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

ll a[210000];
int main(){
    ll n,tmp,ans=0;
    cin>>n;
    rep(i,1,n){cin>>tmp;a[tmp]++;}
    rep(i,1,n+1)cout<<a[i]<<endl;
    
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef long long LL;

#define SORT_ASC(c) sort((c).begin(), (c).end())
#define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_LARGE = 1000000100;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

void Main()
{
	int n,k;
	cin >> n>>k;
	string s;
	cin >>s;

	int m = 0;
	FOR(i,1,n){
		if(s[i] == s[i-1]){
			m++;
		}
	}
	cout << min(n-1,m+k*2) << endl;
	

	return;
}

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

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    ll a[n];
    ll sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum += a[i];
        sum %= mod;
    }
    ll prod = 0;
    for (int i = 0; i < n; i++)
    {

        sum -= a[i];
        if(sum<0) sum+=mod;
        prod += a[i] * sum;
        prod %= mod;
    }
    cout << prod;
    return 0;
}

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

int main()
{
    int n, d, flag, count=0;
    cin >> n >> d;
    int i=d+1;
    do{
        count++;
        flag = i+d;
        i = i+1+d*2;
    }while(flag<n);
    cout << count;
        
    return 0;
}


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

int main()
{
	int n;
	while(scanf("%d",&n) != EOF)
	{
		if(n == 0)break;
		int i;
		int asum = 0;
		int bsum = 0;
		int a,b;
		for(i = 0;i < n;i++)
		{
			scanf("%d %d",&a,&b);
			if(a > b)
			{
				asum += a+b;
			}
			else if(b > a)
			{
				bsum += a+b;
			}
			else
			{
				asum += a;
				bsum += b;
			}
		}
		printf("%d %d\n",asum,bsum);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

int main()
{
    int N, W;
    cin >> N >> W;
    vector<int> w(N), v(N);
    rep(i, 0, N) {
        cin >> w[i] >> v[i];
    }

    ll dp[N+1][W+1] = {};

    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            dp[i+1][j] = dp[i][j];
            if (j >= w[i]) {
                dp[i+1][j] = max(dp[i+1][j], dp[i][j-w[i]] + v[i]);
            }
        }
    }
    
    cout << dp[N][W] << endl;

    return 0;
}

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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define OUT(a) cout << (a) << endl;
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);

template <class T, class S>
using umap = std::unordered_map<T, S>;
using ll = long long;
using namespace std;

int main() {
    ll n, m, t = 0;
    ll a[200010];

    cin >> n >> m;

    REP(i, m){
      ll tmp;
      cin >> tmp;
      t += tmp;
    }

    if (t > n){
      cout << -1 << endl;
    } else {
      cout << n-t << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int ans;
	if (a <= c) {
		if (b <= c) ans = 0;
		else if (d <= b) ans = d - c;
		else ans = b - c;
	}
	else {
		if (d <= a) ans = 0;
		else if (b <= d) ans = b - a;
		else ans = d - a;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a[4],x[2],mina,minx,j,i;
	
	mina=1000000;
	minx=1000000;
	j=0;
	
	for(i=1;i<=4;i++){
		scanf("%d",&a[i]);
		if(a[i]<=mina){
			mina=a[i];
		}
		j+=a[i];
	}
	
	for(i=1;i<=2;i++){
		scanf("%d",&x[i]);
		if(x[i]<=minx){
			minx=x[i];
		}
		j+=x[i];
	}
	
	j=j-mina-minx;
	
	printf("%d\n",j);
	
	return 0;
}

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

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.1415926535897932384626

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int n, v, s[200005], pt, previous_pt = 1, p;
int fr[200005][20], dv[20];

void gen(int l, int r, int V){
//	printf("[%d %d %d]\n", l, r, V);
	FI(i, l, r){
		if(V) printf("Possible\n");
		else printf("Impossible\n");
	}
	return;
}

int dp[1111111];

bool res(int X){
	FI(i, 0, (1 << p + 1) - 1) dp[i] = -1;
	dp[0] = 0;
	FI(i, 0, (1 << p + 1) - 1){
		if(dp[i] == -1) continue;
		FI(j, 0, p){
			if(i & (1 << j)){}
			else{
				if(j == 0 && dp[i] + 1 != X) continue;
				if(j != 0 && dp[i] + 1 == X) continue;
				dp[i + (1 << j)] = max(dp[i + (1 << j)], fr[dp[i] + 1][j]);
			}
		}
	}
	FI(i, 0, (1 << p + 1) - 1) if(dp[i] == n) return true;
	return false;
}

int main(){
	scanf("%d %d", &n, &v);
	FI(i, 1, n) scanf("%d", &s[i]);
	FI(i, 2, n) if(s[i] - s[i - 1] > v) pt++;
	
	dv[0] = v;
	while(dv[p]){
		dv[p + 1] = dv[p];
		dv[++p] /= 2;
	}
	
	FI(i, 0, p){
		int q = 1;
		FI(j, 1, n){
			q = max(q, j);
			while(q < n && s[q + 1] - s[q] <= dv[i]) q++;
			fr[j][i] = q;
		}
		fr[n + 1][i] = n;
	}
	
	if(pt >= 20){
		FI(i, 1, n) printf("Impossible\n");
		return 0;
	}
	FI(i, 2, n) if(s[i] - s[i - 1] > v){
		gen(previous_pt, i - 1, res(previous_pt));
		previous_pt = i;
	}
	gen(previous_pt, n, res(previous_pt));
	return 0;
}


Measured memory_bytes: 23168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);
int main()
{
    int N, M;
    cin >> N >> M;
    vector<set<int>> st(M);
    int ans = 0;
    rep(i, M)
    {
        int k;
        cin >> k;
        rep(j, k)
        {
            int s;
            cin >> s;
            s--;
            st[i].insert(s);
        }
    }
    vector<int> p(M);
    rep(i, M) cin >> p[i];
    rep(i, (1 << N))
    {
        int tmp = i;
        vector<int> on;
        rep(j, N)
        {
            if (tmp % 2 == 1)
                on.push_back(j);
            tmp /= 2;
        }

        bool flag = true;
        rep(j, M)
        {
            int cnt = 0;
            rep(k, on.size())
            {
                if (st[j].count(on[k]))
                    cnt++;
            }
            if (cnt % 2 != p[j])
            {
                flag = false;
            }
            //cout << cnt << " ";
        }
        //cout << endl;
        if (flag)
        {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int tot=26+26+10;
inline void read (int &x) {
	char ch = getchar(); x = 0;
	while (!isdigit(ch)) ch = getchar();
	while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
} 
char enc(int t){
	if(t<10)return '0'+t;
	t-=10;
	if(t<26)return 'a'+t;
	t-=26;
	return 'A'+t;
}
 
string s[tot];
int sum=tot;
int ttm=0;
int query(string s){
	if(s.length()>128)return 0x3f3f3f3f;
	++ttm;
	cout << "?" << " " << s << endl;
	fflush(stdout);
	int ans=0;
	read (ans);
	return ans;
}
 
 
int len=0x3f3f3f3f;
int q[tot];
 
string merge(string a,string b){
	int i=0,j=0;
	int la=a.length(),lb=b.length();
	string fir=string();
	while(i<la&&j<lb){
		string qr=fir;
		qr+=a[i];
		for(int k=j;k<lb;k++){
			qr+=b[k];
		}
		if(query(qr)+qr.length()==len){
			fir+=a[i++];
		}else {
			fir+=b[j++];
		}
	}
	while(i<la)fir+=a[i++];
	while(j<lb)fir+=b[j++];
	return fir;
}
 
int main()
{
	for(int i=0;i<tot;i++){
		s[i]+=enc(i);
		q[i]=query(s[i])+1;
		len=min(len,q[i]);
	}
	for(int i=0;i<tot;i++){
		if(q[i]==len){
			while(query(s[i]+enc(i))+s[i].length()+1==len)s[i]+=enc(i);
		}else s[i]=string();
	}
	while(1){
    	for(int i=0;i<tot;i++)for(int j=i+1;j<tot;j++)if(s[i].length()>s[j].length())swap(s[i],s[j]);
		int t=0;
		while(!s[t].length())++t;
		if(t+1==tot)break ;
		s[t+1]=merge(s[t],s[t+1]); s[t]=string();
	}
	assert(query(s[tot-1])==0);
	cout << "! "<< s[tot-1] << endl;
	fflush(stdout);
}

Measured memory_bytes: 3800
#include <iostream>

int main() {

    int n, count = 0;

    std::cin >> n;

    int p[n];

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

    for(int i = 0; i < n-2; i++){

        if(p[i] < p[i+1] and p[i+1] < p[i+2] or p[i] > p[i+1] and p[i+1] > p[i+2])
            count++;

    }

    std::cout << count;


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;

int INF = 1001001001;

int main() {
    int n, m, l; cin >> n >> m >> l;
    vector<vector<int>> load(n, vector<int>(n, INF));
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        load[a][b] = load[b][a] = c;
    }
    for (int k = 0; k < n; k++)
    {
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                load[i][j] = min(load[i][j], load[i][k]+load[k][j]);
            }
            
        }
        
    }
    vector<vector<int>> load2(n, vector<int>(n, INF));
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if(load[i][j] <= l)
                load2[i][j] = 1;
        }
        
    }
    
    for (int k = 0; k < n; k++)
    {
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                load2[i][j] = min(load2[i][j], load2[i][k]+load2[k][j]);
            }
            
        }
        
    }
    int q; cin >> q;
    vector<int> ans(q);
    for (int i = 0; i < q; i++)
    {
        int s, t; cin >> s >> t;
        s--; t--;
        ans[i] = load2[s][t]-1;
        if(load2[s][t] == INF) ans[i] = -1;
    }
    for (int i = 0; i < q; i++)
    {
        cout << ans[i] << endl;
    }
    
}

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

int main() {
  int N ;
  cin >> N ; 
  int a[N+1] ; 
  int C=0 ; 
  
  for (int i = 0 ; i< N ; i++){
    cin >> a[i+1] ; 
  }

  for(int i = 0 ; i < N ; i++){
    if((i+1) % 2 == 1 && a[i+1] % 2 == 1 ){
      C++ ; 
      //cout << i+1 << " "<< C << endl ; 
    }
  }

  
  cout << C << endl ; 
  
}

Measured memory_bytes: 3632
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def ifn(): return float(input()) #浮動小数点読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def fmn(): return map(float, input().split()) #浮動小数点map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, input().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
MOD = 10**9+7
def add_mod(a,b): return (a+b) % MOD

H,W = imn()
aw = [input() for _ in range(H)]

dp = [[0 for _ in range(W)] for _ in range(H)]

dp[0][0] = 1

for i in range(H):
    for j in range(W):
        if i+1 < H and aw[i+1][j] == '.': dp[i+1][j] = add_mod(dp[i+1][j], dp[i][j]) 
        if j+1 < W and aw[i][j+1] == '.': dp[i][j+1] = add_mod(dp[i][j+1], dp[i][j])
print(dp[H-1][W-1])


Measured memory_bytes: 82008
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES // for C++  
#include <cmath> 
void call(int n);
using namespace std;
int main(){
	int n;
	cin>>n;
	int N[n];
	for(int i=0;i<n;i++){
		cin>>N[i];
	}
	
	for(int j=n-1;j>=0;j--){
		cout<<N[j];
		if(j!=0){cout<<' ';}
	}
	cout<<endl;
}


Measured memory_bytes: 3112
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

            return;
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;

            var ans = 2;

            while(ans <= N)
            {
                ans = ans * 2;
            }


            WriteLine(ans / 2);

        }
    }

    public static class Extensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13268
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,v=MI()
b,w=MI()
t=I()
l=abs(b-a)
vel=v-w
if t*(vel)>=l:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 9492
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#include <math.h>
#include <iomanip>
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	string s;
   	cin>>s;
   	s[3]='8';
   	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
def poll(s_list):
  s_dict = {}
  for s in s_list:
    if s not in s_dict:
      s_dict[s] = 1
    else:
      s_dict[s] += 1
#  sorted_dict = sorted(s_dict.items(), key=lambda x:x[1])
  max_val = max(s_dict.values())
  max_key = [key for key in s_dict if s_dict[key] == max_val]
#  new_s_list = sorted(dict(sorted_dict).keys())
  new_s_list = sorted(max_key)
  return new_s_list

s_list = []
n = int(input())
for i in range(n):
  s_list.append(input())

new_list = poll(s_list)

for s in new_list:
  print(s)

Measured memory_bytes: 35220
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<ll> a(N);
    rep(i,N) cin >> a[i];

    vector<vector<ll>> dp(N, vector<ll>(N));
    rep(i,N) dp[i][i] = a[i];
    for (int k = 1; k < N; k++) {
        rep(i,N-k) {
            dp[i][i+k] = max(a[i]-dp[i+1][i+k],a[i+k]-dp[i][i+k-1]);
        }
    }

    cout << dp[0][N-1] << endl;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;

/*UnionFind--------------------------*/
class UnionFind {
using i32 = int_fast32_t;
private:
    std::vector<i32> parent;
    std::vector<i32> siz;

public:
    UnionFind(i32 sz): parent(sz), siz(sz, 1) {
        for(i32 i = 0; i < sz; ++i) parent[i] = i;
    }
    void init(i32 sz) {
        for(i32 i = 0; i < sz; ++i) parent[i] = i;
    }
    /*Member Func------*/
    /*return root id*/
    i32 root(i32 x) {
        while(parent[x] != x) {
            x = parent[x] = parent[parent[x]];
        }
        return x;
    }
    /*merge two groups*/
    bool merge(i32 x, i32 y) {
        x = root(x);
        y = root(y);
        if(x == y) return false;
        //Merge Tech
        if (siz[x] < siz[y]) std::swap(x,y);
        siz[x] += siz[y];
        parent[y] = x;
        return true;
    }
    /*同じ集合にあるか*/
    bool issame(i32 x, i32 y) {
        return (root(x) == root(y));
    }
    /*xの属する集合の大きさ*/
    i32 size(i32 x) {
        return siz[root(x)];
    }
};

/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    i32 n, m, x,y,z; cin >> n >> m;
    UnionFind uf(n);
    vec<PII> lis_e, lis_o;
    rep(i,m) {
        cin >> x >> y >> z;
        --x, --y;
        if(z & 1) lis_e.emplace_back(x,y);
        else lis_o.emplace_back(x,y);
    }
    for(auto p : lis_e) {
        uf.merge(p.first, p.second);
    }
    for(auto p : lis_o) {
        uf.merge(p.first, p.second);
    }
    i32 cnt = 0;
    for(i32 i = 0; i < n; ++i) {
        if(uf.root(i) == i) ++cnt;
    }

    cout << cnt << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;
typedef long long ll;

int N;
double X[20];
string U[20];

int main(){
  cin >> N;
  rep(i, N) cin >> X[i] >> U[i];

  double ans;
  rep(i, N){
    if (U[i]=="JPY") ans += X[i];
    else ans += (double) X[i] * 380000;
  }
  cout << fixed << setprecision(10);
  cout << ans << endl;
}


Measured memory_bytes: 3728
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;

#define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n))
#define FILLA(a, x) memset((a), (x), sizeof (a))
#define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n))
#define COPYA(a, b) memcpy((b), (a), sizeof (a))

typedef unsigned long long lu;
typedef long long li;
const int mod = 1e9 + 7;

inline int Add(int x) { return x >= mod ? x - mod : x; }
inline void Add(int &x, int y) { x += y; if (x >= mod) x -= mod; }
inline int Sub(int x) { return x < 0 ? x + mod : x; }
inline void Sub(int &x, int y) { x = Sub(x - y); }
inline int Mul(int x, int y) { return (int)((lu)x * y % mod); }
inline int Mul(int x, int y, int z) { return (int)((lu)x * y % mod * z % mod); }

int Pow(int x, int y) {
  int z = 1;
  for (; y; y >>= 1) {
    if (y & 1) z = Mul(z, x);
    x = Mul(x, x);
  }
  return z;
}

int Inv(int x) { return Pow(x, mod - 2); }
template <class T> inline void Max(T &x, T y) { if (y > x) x = y; }
template <class T> inline void Min(T &x, T y) { if (y < x) x = y; }

// ----------------------------------------

const int maxn = 500;
const li infl = ~0LLU >> 2;

int n, a[maxn][maxn];
li dp[maxn][maxn], basic, total;
li sl[maxn + 1][maxn + 1], sr[maxn + 1][maxn + 1];

void Init(void) {
  for (int i = 0; i <= n; ++i) {
    sl[i][i] = sr[i][i] = 0;
  }
  for (int l = n; l >= 0; --l) {
    for (int r = l + 1; r <= n; ++r) {
      sl[l][r] = sl[l][r - 1];
      for (int k = l; k < r - 1; ++k) {
        sl[l][r] += a[r - 1][k];
      }
      sr[l][r] = sr[l + 1][r];
      for (int k = l + 1; k < r; ++k) {
        sr[l][r] += a[l][k];
      }
    }
  }
}

li CalcL(int l, int r) {
  return sl[l][r];
}

li CalcR(int l, int r) {
  return sr[l][r];
}

int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i != j) {
        scanf("%d", a[i] + j);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      basic += a[i][j];
      total += a[i][j] + a[j][i];
    }
  }

  Init();

  li global = -infl;
  for (int i = 1; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      // calc (i, j)
      li &ans = dp[i][j];
      ans = CalcL(0, j) - CalcR(0, i) - CalcR(i, j);
      for (int k = 1; k < i; ++k) {
        // try (k, i, j)
        li now = dp[k][i];
        now += CalcL(k, j) - CalcL(k, i) - CalcR(i, j);
        Max(ans, now);
      }
      li now = ans;
      now += CalcL(i, n) - CalcL(i, j) - CalcR(j, n);
      Max(global, now);
    }
  }

  Max(global, CalcL(0, n) - CalcR(0, n));
  for (int i = 1; i < n; ++i) {
    Max(global, CalcL(0, n) - CalcR(0, i) - CalcR(i, n));
  }

  global += basic;
  global = total - global;
  printf("%lld\n", global);
  return 0;
}


Measured memory_bytes: 7040
#include<iostream>
using namespace std;
int main(){
  int n,b,t,s;
  while(cin>>n){
    if(n==0) break;
    int h[4000];
    int index = 0;
    int h2 = 0;
    unsigned long long int p[4001]={0};
    for(int i=0;i<n;i++){
      cin >> b >> t >> s;
      if(p[b]==0){
	h[index] = b;
	index++;
      } 
      p[b] += t * s;
    }
    /*for(int i=0;i<index;i++){
      cout << p[h[i]] << endl;
      cout << h[i] << endl;
      }*/
    for(int i=0;i<index;i++){
      if(p[h[i]]>=1000000){
	cout << h[i] << endl;
	h2 = 1;
      }
    }
    if(h2==0) cout << "NA" << endl;
    //cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1208
#include<iostream>
#include<vector>
#include<algorithm>
#define N 151

using namespace std;

struct DATA{
  int h, w, d_2;
  DATA(int h_, int w_){
    h = h_; w = w_; d_2 = h*h + w*w;
  }
  bool operator ==(const DATA& a){
    return (h==a.h && w==a.w && d_2==a.d_2);
  }
};

bool comp(const DATA& a, const DATA& b){
  return (a.d_2 != b.d_2) ? (a.d_2 < b.d_2) : (a.h < b.h);
}

void init(vector<DATA>* data){
  data->clear();
  for(int i=1; i<=N; ++i){
    for(int j=i+1; j<=N; ++j){
      data->push_back(DATA(i,j));
    }
  }
  sort(data->begin(), data->end(), comp);
}

int main(){
  int h, w, d_2;
  vector<DATA> data;
  init(&data);
  while(1){
    cin >> h >> w;
    if(!h && !w) break;
    DATA data_(h, w);
    for(vector<DATA>::iterator it=data.begin(); it!=data.end(); ++it){
      if(data_ == *it){
	++it;
	cout << it->h << " " << it->w << endl;
	break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1332
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int a = sc.nextInt();
    
    int remainder = n % 500;
    if (a >= remainder) {
      System.out.println("Yes");
    } else { 
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21460
#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    
    int arr[32];
    stringstream ss("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 a;
    char b;
    for(int i = 0; i < 32; i++)
    {
    	ss >> a;
    	arr[i] = a;
    	ss >> b;
	}
	int k; cin >> k;
	cout << arr[k-1];
	
    
    
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        var n = int.Parse(ReadLine());
        var a = ReadLine().Split().Select(int.Parse).ToArray();
        var h = new HashSet<int>(a);
        var count = a.Length - h.Count;
        if(count % 2 != 0)
            count++;

        WriteLine(a.Length - count);
        ReadLine();
    }
}


Measured memory_bytes: 29188
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <bits/stdc++.h>

using namespace std;

/**
 * main
 */
int main () {
  int N, M;
  cin >> N >> M;

  int d[4] = {-1, -1, -1, -1};
  bool invalid = false;

  while (M--) {
    int s, c;
    cin >> s >> c;

    for (int i = 1; i <= 3; i++) {
      if (s == i) {
        if (d[s] == -1) {
          d[s] = c;
        } else if (d[s] != c) {
          invalid = true;
          break;
        }
      }
    }
  }

  if (!invalid) {
    if (N == 1) {
      printf("%d\n", (d[1] == -1 ? 0 : d[1]));
    }
    if (N == 2) {
      if (d[1] == 0) invalid = true;
      else printf("%d%d\n", (d[1] == -1 ? 1 : d[1]), (d[2] == -1 ? 0 : d[2]));
    }
    if (N == 3) {
      if (d[1] == 0) invalid = true;
      else printf("%d%d%d\n", (d[1] == -1 ? 1 : d[1]), (d[2] == -1 ? 0 : d[2]), (d[3] == -1 ? 0 : d[3]));
    }
  }

  if (invalid) cout << "-1\n";
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	_ "sort"
	"strings"
)

func main() {
	defer writer.Flush()

	var N int
	scanln(&N)
	hist := make([][26]int, N)

	for i := 0; i < N; i++ {
		var s string
		scanln(&s)
		for j := range s {
			hist[i][s[j]-'a']++
		}
	}
	for j := 0; j < 26; j++ {
		var x int64 = math.MaxInt64
		for i := 0; i < N; i++ {
			x = min64(x, int64(hist[i][j]))
		}
		print(strings.Repeat(string('a'+j), int(x)))
	}
	println()
}

func min64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func println(a ...interface{})          { fmt.Fprintln(writer, a...) }
func print(a ...interface{})            { fmt.Fprint(writer, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func scanln(a ...interface{})           { fmt.Fscanln(reader, a...) }


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

using namespace std;

int main()

{
    int a,b;
    cin>>a>>b;
    
    while(b--){
        int x;
        cin>>x;
        if((a-=x)<=0){
        cout<<"Yes";
          return 0;
        }
    }
    cout<<"No";

}

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

int main(){
	while(true){
		int H, W;
		cin >> H >> W;
		if(H == 0 && W == 0) break;
		rep(i, H){
			rep(j, W){
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
}



Measured memory_bytes: 3096
const double = Float64
const int = Int64
const vint = Vector{int}
const vdouble = Vector{double}

int(x) = parse(int,x)

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

function main()
  a = readline()
  if a=="ABC"
    println("ARC")
  else
    println("ABC")
  end
end

main()

Measured memory_bytes: 199268
#include<stdio.h>
int main()
{
  int W,H,x,y,r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(W>=x+r && H>=y+r){
    if(0<=x-r && 0<=y-r)
      printf("Yes\n");
    else
      printf("No\n");
  }
  else
    printf("No\n");
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double eps = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1};

int main() {
	// cin.tie(0); // tie
	// ios::sync_with_stdio(false); // sync
	int e;
	while (cin >> e, e) {
		int ans = inf;
		for (int z = 0; z * z * z <= e; ++z) {
			for (int y = 0; y * y + z * z * z <= e; ++y) {
				int x = e - (y * y + z * z * z);
				ans = min(ans, x + y + z);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
using namespace std;
int main(void)
{
	int date;
	cin >> date;
	while(date--){
		int X,Y,W,H;
		cin>>X>>Y>>W>>H;
		int N;
		cin>>N;
		int count=0;
		while(N--){
			int x,y;
			cin>>x>>y;
			if(0<=x-X&&x-X<=W)
				if(0<=y-Y&&y-Y<=H)
					count++;
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 0
n, m = map(int, input().split())
A = list(map(int, input().split()))
A = map(lambda x: x * (-1), A)
A = sorted(A)

from heapq import heappush, heappop

for _ in range(m):
    x = heappop(A)
    heappush(A, -(-x//2))

print(-sum(A))


Measured memory_bytes: 64356
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()

    val primeFactorList = mutableListOf<Int>()
    for (i in 1..n) {
        primeFactorList += computePrimeFactorList(i)
    }

    var count = 0
    val primeFactorCountList = mutableListOf<Int>()
    primeFactorList.sort()
    primeFactorList.forEachIndexed { index, i ->
        count++
        if (index == primeFactorList.size - 1 || i != primeFactorList[index + 1]) {
            primeFactorCountList.add(count)
            count = 0
        }
    }
    var divisorCount = 1L
    primeFactorCountList.map { it + 1L }.forEach {
        divisorCount = divisorCount * it % (1000000000 + 7)
    }
    println(divisorCount)
}

fun computePrimeFactorList(n: Int): List<Int> {
    val primeFactorList = mutableListOf<Int>()
    var primeFactor = n
    for (i in 2..n) {
        while (primeFactor % i == 0) {
            primeFactor /= i
            primeFactorList.add(i)
        }
    }
    return primeFactorList
}

Measured memory_bytes: 31260
#include <iostream>
#include <vector>

using namespace std;

int main(){

   int cnt = 0;
   vector<int> data(10001);   

   for(;;){
      cin >> data[cnt];
      if(data[cnt] == 0){
         break;
      }
      cnt++;
   }

   for(int i = 0; i < cnt; i++){
      cout << "Case " << i + 1 << ": " << data[i] << endl;
   }

   return 0;
}


Measured memory_bytes: 3104
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_A main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif

int main_A() {
    cin.tie(0);
    ios::sync_with_stdio(false);
     
    int A, B; cin >> A >> B;

    int ans = max(A+B, max(A-B, A*B));

    cout << ans << endl;

    return 0;
}

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

int main(){
    int n,k;string ss;cin>>n>>k>>ss;
    vector<ll> a,s;
    s.push_back(0);

    int count=1;
    for(int i=1;i<n;i++){
        if(ss.at(i-1)!=ss.at(i)){
            a.push_back(count);
            count=1;
        }else count++;
    }
    a.push_back(count);

    int as=a.size();
    REP(i,as) s.push_back(s.at(i)+a.at(i));

    int start=ss.at(0)-'0'-1;
    //REP(i,as+1) cout<<s.at(i)<<" ";
    //cout<<endl;
    ll ans=0;
    for(int l=start;l<as;l+=2){
        int r=min(l+k*2+1,as),sn=s.size();
        ans=max(ans,s.at(r)-s.at(max(0,l)));
        //cout<<max(0,l)<<" "<<r<<" "<<ans<<endl;
    }
    cout<<ans;
}

Measured memory_bytes: 2676
import java.util.Scanner;
import java.util.Arrays;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] p = new int[N];
   for(int i = 0; i<N ; i++){
   p[i] = sc.nextInt();
   }
   int K = 0;
   Arrays.sort(p);
   K = p[(N/2)] - p[(N/2)-1];
  System.out.println(K);   
 }
}

Measured memory_bytes: 49632
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    map<int, int> cnt;
    REP(i, N) {
        int A;
        cin >> A;
        cnt[A]++;
    }
    int res = 0;
    for (auto x : cnt) {
        int k = x.first, v = x.second;
        if (k > v) {
            res += v;
        } else if (k < v) {
            res += v - k;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
   ll a[5],k;

   for(int i=0;i<5;i++)
   {
    cin>>a[i];
   }
   cin>>k; 
   sort(a,a+5);
   if(a[4]-a[0]<=k)
      cout<<"Yay!"<<endl;
  else
    cout<<":("<<endl;

}
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;

int main(){
    string S ; cin >> S;
    string ans = "yes";
    bool end = false;

    for(int i=0;i<S.size();i++){
        for(int j=0;j<S.size();j++) {
            if(i==j) break;
            else{
                if(S[i] == S[j]) {ans = "no"; end = true; break;}
            }
        }
        if(end) break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
mat=[]
for _ in range(3):
    c=list(map(int,input().split()))
    mat.append([
        c[1]-c[0],
        c[2]-c[1],
        c[0]-c[2]
    ])
for v in zip(*mat):
    if v[0]!=v[1] or v[1]!=v[2]:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
char s[100010];
int main(){
    int n;
    while(cin>>n){
        ll ans=0;
        scanf("%s",s);
        for(int i=0; i<=9; ++i){
            int tmp=-1;
            for(int j=0; j<n; ++j){
                if(s[j]==char(i+'0')){
                    tmp=j;
                    break;
                }
            }
            if(tmp==-1)
                continue;
            for(int j=0; j<=9; ++j){
                int tmp1=-1;
                for(int k=tmp+1; k<n; ++k){
                    if(s[k]==char('0'+j)){
                        tmp1=k;
                        break;
                    }
                }
                if(tmp1==-1){
                    continue;
                }
                for(int k=0; k<=9; ++k){
                    for(int l=tmp1+1; l<n; ++l){
                        if(s[l]==char('0'+k)){
                            ++ans;
                            break;
                        }
                    }
                }
            }
        }
        cout<<ans<<endl;
    }
  return 0;
}




Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int main(){
  int i,j,n,u,k,v,V[N+1][N+1];

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      V[i][j] = 0;
    }
  }
  for(i=1;i<=n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      V[u][v] = 1;
    }
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      if(j != n){
	if(V[i][j] != 1)
	  printf("%d ",V[i][j]);
	else printf("%d ",V[i][j]);
      }
      else {
	if(V[i][j] != 1)
	  printf("%d",V[i][j]);
	else printf("%d",V[i][j]);
      }
    }
    printf("\n");
  }

return 0;
}



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

#define sync {ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
#define ll long long int
#define mod 1000000007

set<int> factors;

int n;

void solve()
{
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    
    bool coprime=true;
    
    for(int i=n-1;i>=0;i--)
    {
        for(int j=1;j*j<=a[i];j++)
        {
            if(a[i]%j==0)
            {
                if(j!=1)
                {
                    if(factors.find(j)!=factors.end())
                    {
                        coprime=false;
                        break;
                    }
                    factors.insert(j);
                }
                int k = a[i]/j;
                if(k!=1 and j!=k)
                {
                    if(factors.find(k)!=factors.end())
                    {
                        coprime=false;
                        break;
                    }
                    factors.insert(k);
                }
            }
            
        }
        if(!coprime)
            break;
    }
    
    if(coprime)
    {
        cout<<"pairwise coprime";
        return;
    }
    
    int hcf=a[0];
    
    for(int i=0;i<n;i++)
    {
        hcf = __gcd(hcf,a[i]);
    }
    
    if(hcf==1)
    {
        cout<<"setwise coprime";
        return;
    }
    
    cout<<"not coprime";
    
}

int main()
{
    sync;
    factors.clear();
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
}







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

namespace arc094_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var ABC = (Console.ReadLine().Split().Select(x => decimal.Parse(x))).ToList();

            ABC.Sort();

            decimal r = 0;

            decimal A = Math.Floor((ABC[2] - ABC[0]) / 2);
            r += A;
            ABC[0] += A * 2;

            decimal B = Math.Floor((ABC[2] - ABC[1]) / 2);
            r += B;
            ABC[1] += B * 2;

            if(ABC[0] == ABC[1] && ABC[1] == ABC[2]) 
            {

            }
            else if(ABC[0] != ABC[1]) 
            {
                r += 2;
            }
            else 
            {
                r += 1;
            }

            Console.WriteLine(r);

        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;

int main(){
	ll n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	a--;b--;c--;d--;
	string s;
	cin>>s;
	bool ans=true;
	bool flag=false;
	if(c>d){
		//if(s[d-1]=='#'||s[d+1]=='#')s[d]='#';
		int cnt=0;
		for(ll i=a;i<d+2;i++){
			if(i>=n)break;
			if(s[i]=='.'){
				cnt++;
			}else{
				cnt=0;
			}
			if(cnt>=3){
				if(cnt==3&&s[i+1]=='#'&&(i==b)){
					cnt=0;
					continue;
				}
				flag=true;
			}
		}
		if(!flag)ans=false;
		s[d]='.';
		ll a_pos = a;
		for(;;){
			if(s[a_pos+2]=='.'&&a_pos+2<=c){
				a_pos+=2;
			}else if(s[a_pos+1]=='.'&&a_pos+1<=c){
				a_pos+=1;
			}else{
				ans = false;
				break;
			}
			if(a_pos==c)break;
		}

		ll b_pos=b;
		for(;;){
			if(s[b_pos+2]=='.'&&b_pos+2<=d){
				b_pos+=2;
			}else if(s[b_pos+1]=='.'&&b_pos+1<=d){
				b_pos+=1;
			}else{
				ans = false;
				break;
			}
			if(b_pos==d)break;
		}

	}else{
		ll b_pos=b;
		for(;;){
			if(s[b_pos+2]=='.'&&b_pos+2<=d){
				b_pos+=2;
			}else if(s[b_pos+1]=='.'&&b_pos+1<=d){
				b_pos+=1;
			}else{
				//cout<<"aa"<<endl;
				ans = false;
				break;
			}
			if(b_pos==d)break;
		}
		ll a_pos = a;
		for(;;){
			if(s[a_pos+2]=='.'&&a_pos+2<=c){
				a_pos+=2;
			}else if(s[a_pos+1]=='.'&&a_pos+1<=c){
				a_pos+=1;
			}else{
				//cout<<a_pos<<" "<<endl;
				ans = false;
				break;
			}
			if(a_pos==c)break;
		}
	}
	if(ans)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

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

    ll n = S.size();
    n--;
    while(true){
        if(n % 2 == 1){
            n--;
            continue; 
        }
        if(S.substr(0, n/2) == S.substr(n/2, n/2)){
            cout << n << endl;
            break;
        }
        n--;
    }
    return 0;
}

Measured memory_bytes: 256