akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Solve
{
    public Solve() { }
    public static int Main()
    {
        new Solve().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int a = cin.nextInt();
        int[] mochi = cin.ArrayInt(a);
        HashSet<int> hash = new HashSet<int>();
        for (int i = 0; i < a; i++){
            hash.Add(mochi[i]);
        }

        Console.WriteLine(hash.Count());
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13280
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <list>
#include <algorithm>

using namespace std;

int min(int p, int q) {
	if( p > q ) return q;
	return p;
}

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);

	while(1){
		int n,m;
		cin >> n >> m;
		if( n == 0 && m == 0 ) break;

		vector<int> x,y;
		int sum = 0;
		int xmax, ymax;
		x.push_back(0);
		y.push_back(0);

		for(int i = 0; i < n; i++) {
			int tmp;
			cin >> tmp;
			sum += tmp;
			y.push_back(sum);
		}
		ymax = sum;
		sum = 0;
		for(int i = 0; i < m; i++) {
			int tmp;
			cin >> tmp;
			sum += tmp;
			x.push_back(sum);
		}
		xmax = sum;

		vector<int> dx,dy;
		int width = x.size();
		int height = y.size();

		for(int i = 0; i <= xmax; i++)
			dx.push_back(0);
		for(int i = 0; i <= ymax; i++)
			dy.push_back(0);

		for(int i = 0; i < width; i++)
			for(int j = i + 1; j < width; j++)
				dx.at( x.at(j) - x.at(i) ) ++;

		for(int i = 0; i < height; i++)
			for(int j = i + 1; j < height; j++)
				dy.at( y.at(j) - y.at(i) ) ++;

		int ans = 0;
		int size = min( dx.size(), dy.size() );

		for(int i = 0; i < size; i++)
			ans += dx.at(i) * dy.at(i);

		cout << ans << endl;
	}

	//while(1){}
	return 0;
}

Measured memory_bytes: 7160
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int N;
int dp[100009];

void DP(int x){
    for(int i=N;i-x>=0;i--){
        if(dp[i-x]!=INF) chmin(dp[i],dp[i-x]+1);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    cin>>N;
    
    rep(i,N+1) dp[i]=INF;
    dp[0]=0;
    
    ll is9=1;
    while(is9*9<=N) is9*=9;
    while(is9>=9){
        rep(i,8) DP(is9);
        is9/=9;
    }
    
    ll is6=1;
    while(is6*6<=N) is6*=6;
    while(is6>=6){
        rep(i,5) DP(is6);
        is6/=6;
    }
    
    rep1(i,N) chmin(dp[i],dp[i-1]+1);
    cout1(dp[N])
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using tvinfo = tuple<int, int, int>;

int main() {
    int N, C; cin >> N >> C;
    vector<vector<int>> d(C+1, vector<int>(100005, 0));

    for (int i = 0; i < N; i++)
    {
        int s, t, c; cin >> s >> t >> c;
        c--;
        d[c][s-1]++;
        d[c][t]--;
    }
    for (int j = 0; j < C; j++)
    {
        for (int i = 0; i < 100005; i++)
        {
            if(i>0) d[j][i] += d[j][i-1];
            if(d[j][i]>0) d[C][i]++;
        }
    }
    int ans = 0;
    for (int i = 0; i < 100005; i++) ans = max(ans, d[C][i]);
    cout << ans << endl;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int mod = 1e9+7;

int power(int a, int b, int m)
{
    int res = 1;
    while(b>0)
    {
        if(b&1)
        {
            res = res * a;
            res %= m;
        }
        a = a * a;
        a %= m;
        b >>= 1;
    }
    return res;
}

int32_t main()
{
    int n, k;
    cin >> n >> k;
    vector<int> dp(k+1, 0);

    for(int i=k; i>=1; i--)
    {
        int curCount = k/i;
        int ans = power(curCount, n, mod);
        for(int j=2*i; j<=k; j+=i)
        {
            ans -= dp[j];
            ans = (ans + mod) % mod;
        }
        dp[i] = ans;
    }

    int sum = 0;
    for(int i=1; i<=k; i++)
    {
        sum += i * dp[i];
        sum %= mod;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3984
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n){
        cin>>a[i];
    }
    ll mi=*min_element(begin(a),end(a));
    ll ma=*max_element(begin(a),end(a));
    if(mi>=0){
        cout<<n-1<<endl;
        rep(i,n-1){
            cout<<i+1<<' '<<i+2<<endl;
        }
    }else if(ma<=0){
        cout<<n-1<<endl;
        for(int i=n;i>=2;i--){
            cout<<i<<' '<<i-1<<endl;
        }
    }else{
        if(-mi<=ma){
            ll ind=max_element(begin(a),end(a))-begin(a);
            cout<<2*(n-1)<<endl;
            rep(i,n){
                if(i==ind) continue;
                cout<<ind+1<<' '<<i+1<<endl;
            }
            rep(i,n-1){
                cout<<i+1<<' '<<i+2<<endl;
            }
        }else{
            ll ind=min_element(begin(a),end(a))-begin(a);
            cout<<2*(n-1)<<endl;
            rep(i,n){
                if(i==ind) continue;
                cout<<ind+1<<' '<<i+1<<endl;
            }
            for(int i=n;i>=2;i--){
                cout<<i<<' '<<i-1<<endl;
            }
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
#define REP(i,n) for (int i=0;i<=(n);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int INF = 10000000;

int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    int a; cin >> a;
    cout << a + (a * a) + (a * a * a) << endl;

}

Measured memory_bytes: 3592
#include <iostream>
#include <valarray>
#include <iomanip>

int main() {
    std::valarray<double> P1(2), P2(2);
    std::cin >> P1[0] >> P1[1] >> P2[0] >> P2[1];

    auto vec = P2 - P1;
    double distance = std::sqrt((vec * vec).sum());
    std::cout << std::fixed << distance << std::endl;
}



Measured memory_bytes: 3292
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;
ll n,m,x;
ll f(ll a) {
  return a*a % m;
}  

int main() {
  cin >> n >> x >> m;
  vector<int> id(m,-1);
  vector<int> seen;
  ll tot = 0;
  int len = 0;
  while (id[x] == -1)
  {
    seen.push_back(x);
    id[x] = len;
    len++;
    tot += x;
    x = f(x);
  }
  
  int c = len - id[x];
  ll s =  0;
  for (int i = id[x]; i < len; i++) s += seen[i];

  ll ans = 0;
  if (n <= len) {
    rep(i,n) ans += seen[i];
  } else {
    ans += tot;
    n -= len; 
    ans += s*(n/c);
    n %= c;
    rep(i,n) ans += seen[id[x]+i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3988
#include <iostream>
#include <string>

int main(int argc, char *argv[]) {
  int a, b, c;
  std::cin >> a >> b >> c;

  if (a < b && b < c) {
    std::cout << "Yes" << std::endl;
    return 0;
  }
  std::cout << "No" << std::endl;
}



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

using namespace std;
#define ll long long
#define M 1000000007
vector<ll>arr[100005];
vector<ll>mark(100005,0);
vector<ll>topo;
void dfs(ll s)
{
    mark[s]=1;
    for(ll i=0;i<arr[s].size();i++)
    {
        if(mark[arr[s][i]]==0)
            dfs(arr[s][i]);
    }
    topo.push_back(s);
}
int main()
{
   ll n,m;
   cin>>n>>m;
   vector<ll>indeg(n+1,0),depth(n+1,0);
   for(ll i=0;i<m;i++)
   {
    ll a,b;
    cin>>a>>b;
    arr[a].push_back(b);
    indeg[b]++;
   }
   vector<ll>hold;
   for(ll i=1;i<=n;i++)
    if(indeg[i]==0)
        hold.push_back(i);

   ll ans=0;
   for(ll i=0;i<hold.size();i++)
    {
        dfs(hold[i]);
    }
    for(ll i=topo.size()-1;i>=0;i--)
    {
        ll z=topo[i];
        for(ll j=0;j<arr[z].size();j++)
        {
            depth[arr[z][j]]=max(depth[z]+1,depth[arr[z][j]]);
            ans=max(ans,depth[arr[z][j]]);
        }
    }
    // cout<<"okk\n";
    
   // cout<<"eon\n";
   // for(ll i=0;i<=n;i++)
   //  cout<<depth[i]<<" ";
   //  cout<<endl;
   cout<<ans<<endl; 
   
}

Measured memory_bytes: 12408
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int T = sc.nextInt();
    for (int i = 0; i < T; i++) {
      int N = sc.nextInt();
      long answer = 0;
      TreeSet<Camel> setA = new TreeSet<>();
      TreeSet<Camel> setB = new TreeSet<>();
      TreeSet<Camel> setC = new TreeSet<>();
      ArrayList<Camel> listA = new ArrayList<>();
      ArrayList<Camel> listB = new ArrayList<>();
      for(int j = 1; j <= N; j++){
        int k = sc.nextInt();
        int l = sc.nextInt();
        int r = sc.nextInt();
        Camel c = new Camel(j, k, l, r);
        if(l > r){
          listA.add(c);
        } else {
          listB.add(c);
        }
      }
      listA.sort(Comparator.comparingInt(Camel::getK));
      listB.sort(Comparator.comparingInt(Camel::getK).reversed());

      for(Camel c : listA){
        if(!setA.isEmpty() && setA.size() >= c.getK()){
          if(setA.first().getGap() < c.getGap()){
            setC.add(setA.pollFirst());
            setA.add(c);
          } else {
            setC.add(c);
          }
        } else {
          setA.add(c);
        }
      }

      for(Camel c : listB){
        if(N == c.getK()){
          setC.add(c);
        } else if(!setB.isEmpty() && setB.size() >= N - c.getK()){
          if(setB.first().getGap() < c.getGap()){
            setC.add(setB.pollFirst());
            setB.add(c);
          } else {
            setC.add(c);
          }
        } else {
          setB.add(c);
        }
      }
      for(Camel c : setA){
        answer += c.l;
      }
      for(Camel c : setB){
        answer += c.r;
      }
      for(Camel c : setC){
        answer += Math.min(c.l, c.r);
      }
      System.out.println(answer);
    }
  }

  static class Camel implements Comparable<Camel> {

    int number;
    int k, l, r;

    public int getK() {return k;}
    public int getGap() { return Math.abs(l - r);}
    public Camel(int number, int k, int l, int r) {
      this.number = number;
      this.k = k;
      this.l = l;
      this.r = r;
    }

    @Override
    public int compareTo(Camel o) {
      int ret = Integer.compare(getGap(), o.getGap());
      if(ret == 0){
        return Integer.compare(number, o.number);
      }
      return ret;
    }
  }
}


Measured memory_bytes: 84544
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);

		int num = s.nextInt();
		
		int uder_hundred = num % 100;
		int under_ten = uder_hundred % 10;
		
		String out = "";
		switch (under_ten) {
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			out = "hon";
			break;
		case 0:
		case 6:
		case 1:
		case 8:
			out = "pon";
			break;
						
		case 3:
			out = "bon";
			break;
			
		}
		
		System.out.println(out);
		
	}

}


Measured memory_bytes: 35720
#include <cstdio>

int p[100010];

int main(){
  int N, K; scanf("%d%d", &N, &K);
  for(int i = 1; i <= N; i++) scanf("%d", &p[i]);

  long long Ksum = 0, Psum = 0;
  for(int i = 1; i <= K; i++) Ksum += p[i];
  for(int i = K + 1; i <= N; i++) if(p[i] > 0) Psum += p[i];

  long long ans = Psum + (Ksum > 0 ? Ksum : 0);

  for(int i = 2; i <= N - K + 1; i++){
    int x = i - 1, y = i + K - 1;

    Ksum -= p[x]; if(p[x] > 0) Psum += p[x];
    Ksum += p[y]; if(p[y] > 0) Psum -= p[y];

    long long res = Psum + (Ksum > 0 ? Ksum : 0);
    if(res > ans) ans = res;
  }

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

Measured memory_bytes: 512
from fractions import gcd
from collections import defaultdict

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

N = int(input())

divs = make_divisors(N)

res = N+1

for div in divs:
    res = min(N+1, div+N//div)

print(res-2)




Measured memory_bytes: 5216
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 16 12:35:58 2020

@author: liang
"""

N, M = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort(reverse=True)
#print(A)
count = 0
while count != M:
    A[0] //= 2
    count += 1
    tmp = A[0]
    for i in range(1,N):
        if count == M:
            break
        if A[i] > tmp:
            A[i] //= 2
            count += 1
        ##   break
    A.sort(reverse=True)
ans = sum(A)
#print(A)
print(ans)

Measured memory_bytes: 19868
n, k = map(int, input().split())

if k % 2 != 0:
    count = 0
    for i in range(1, n+1):
        if i % k == 0:
            count += 1

    print(count ** 3)
else:
    count1, count2 = 0, 0
    for i in range(1, n+1):
        if i % k == 0:
            count1 += 1
        if i % k == (k / 2):
            count2 += 1

    print(count1 ** 3 + count2 ** 3)


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


#define lld long long 

lld max(lld x,lld y)
{
	if(x>y)
		return x;
	return y;
}		
lld min(lld x,lld y)
{

	if(x<y)
		return x;
	return y;
}
void solve()
{
	lld n,k ;
	cin>>n>>k;
	lld a[n+1];
	for(lld i=1;i<=n;i++)
	{
		cin>>a[i];
	}

	lld dp[n+1];
	memset(dp,0,sizeof(dp));
	for(lld i=2;i<=n;i++)
	{
		//cout<<"pp";
		lld x=INT_MAX;
		for(lld j=i-1;j>=max(i-k,1);j--)
		{
			x=min(x,dp[j]+abs(a[i]-a[j]));
			//cout<<"ok"<<" "<<i<<" "<<j<<" "<<x<<"\n";
			
		}
		dp[i]=x;

	}	
	/*for(lld i=0;i<=n;i++)
		cout<<dp[i]<<" ";
	cout<<"\n";*/
	cout<<dp[n]<<"\n";




}
	
				


int main()

{
	solve();
	
}

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

int main()
{
    int N, M;
    std::cin >> N >> M;
    std::vector<int> a(M);
    for (int i = 0; i < M; i++) {
        std::cin >> a[i];
    }
    std::cout << N - M - 1 << std::endl;
    return 0;
}

Measured memory_bytes: 3116
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define rrep(i, n) for (ll i = n - 1; i >= 0; --i)
#define pp pair<ll, ll>
#define ppp pair<ll, pp>
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define fi first
#define se second
const ll mod = 1e9 + 7, INF = 1e16;
const ll N = 1000010;
ll fact[N], inv[N];
ll ppow(ll x, ll n)
{
	ll ans = 1;
	while (n > 0)
	{
		if ((n & 1) == 1)
			ans = ans * x;
		x = x * x;
		n >>= 1;
		x %= mod;
		ans %= mod;
	}
	return ans;
}
void setinv(ll n)
{
	fact[0] = 1;
	inv[0] = 1;
	for (int i = 1; i <= n; i++)
	{
		fact[i] = (fact[i - 1] * i) % mod;		   //階乗を求める
		inv[i] = ppow(fact[i], (ll)mod - 2) % mod; // フェルマーの小定理で逆元を求める
	}
}
ll conv(ll n, ll r)
{ //nCr
	if (n - r < 0)
		return 0;
	return fact[n] * inv[r] % mod * inv[n - r] % mod;
}
ll x, y, a, b;
int main()
{
	setinv(1000005);
	cin >> x >> y;
	b = (2 * y - x) / 3;
	if ((2 * y - x) % 3 || b < 0)
	{
		cout << 0 << endl;
		return 0;
	}
	a = y - 2 * b;
	if (a < 0)
	{
		cout << 0 << endl;
		return 0;
	}
	cout << conv(a + b, a) << endl;
}

Measured memory_bytes: 15872
# 解き直し
n, k = map(int, input().split())
ans = 0
for i in range(1, n + 1):
    tmp, cnt = i, 0
    while tmp < k:
        tmp *= 2
        cnt += 1
    ans += (1 / n) * (1 / 2) ** cnt
print(ans)


Measured memory_bytes: 2940
import sys

read = sys.stdin.buffer.read


a, b, c, k = map(int, read().split())

ans = 0

i = min(a, k)
k = max(k-i, 0)
j = min(b, k)
k = max(k-j, 0)
l = min(c, k)

print(i+j*0-l)

Measured memory_bytes: 9192
import java.util.Scanner;
import java.util.Arrays;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt(),x=sc.nextInt(),a[]=new int[n],s=0;
        for(int i=0;i<n;++i)a[i]=sc.nextInt();
        sc.close();
        Arrays.sort(a);
        for(int i=0;i<n-1;++i){
            if(x>=a[i]){
                x-=a[i];
                ++s;
            }
        }
        if(x==a[n-1])++s;
        System.out.print(s);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define endl            "\n"
#define forn(i,n)       for(int i=0; i<n; i++)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void zeus()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void subsetsUtil(vector<int>& A, vector<vector<int> >& res,
                 vector<int>& subset, int index)
{
    res.push_back(subset);
    for (int i = index; i < A.size(); i++) {

        // include the A[i] in subset.
        subset.push_back(A[i]);

        // move onto the next element.
        subsetsUtil(A, res, subset, i + 1);

        // exclude the A[i] from subset and triggers
        // backtracking.
        subset.pop_back();
    }

    return;
}

// below function returns the subsets of vector A.
vector<vector<int> > subsets(vector<int>& A)
{
    vector<int> subset;
    vector<vector<int> > res;

    // keeps track of current element in vector A;
    int index = 0;
    subsetsUtil(A, res, subset, index);

    return res;
}




int32_t main()
{
    zeus();

    int n, m, x; cin >> n >> m >> x;

    int cost[n];

    int know[n][m];

    forn(i, n) {
        cin >> cost[i];
        forn(j, m) {
            cin >> know[i][j];
        }
    }


    forn(i, m) {
        int sum = 0;
        forn(j, n) {
            sum += know[j][i];

        }

        if (sum < x) {
            cout << -1 << endl;
            return 0;
        }
    }

    vector<int> array;

    forn(i, n) {
        array.pb(i);
    }

    vector<vector<int>> res = subsets(array);
    int min_cost = INT_MAX;

    for (int i = 0; i < res.size(); i++) {
        int sum[m] = {0};
        int costy = 0;
        for (int j = 0; j < res[i].size(); j++) {
            forn(k, m) {
                sum[k] += know[res[i][j]][k];
            }

            costy += cost[res[i][j]];


        }
        //cout << costy << endl;
        int flag = 1;
        forn(k, m) {
            //cout << "sum" << sum[k] << endl;
            if (sum[k] < x) {
                flag = 0;
                break;
            }
        }
        if (flag == 1) {
            min_cost = min(min_cost, costy);
        }
    }

    cout << min_cost;



}

Measured memory_bytes: 3856
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

int main()
{
    int a;
    cin >> a;
    string s;
    cin >> s;
    if (a >= 3200)
        cout << s <<endl;
    else
        cout << "red" << endl;    
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			int n = Integer.parseInt(br.readLine());
			Map<String, Integer> map = new TreeMap<>();
			int max = 0;
			for (int i = 0; i < n; i++) {
				String s = br.readLine();
				int val = map.containsKey(s) ? map.get(s) + 1 : 1;
				map.put(s, val);
				max = Math.max(max, val);
			}
			PrintWriter out = new PrintWriter(System.out);
			for (String key : map.keySet()) if (map.get(key) == max) out.println(key);
			out.flush();
		}
	}
}

Measured memory_bytes: 56732
/*
    author: Salam_35
    Created at :

*/

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

#define ll long long int
#define pb push_back
#define sc(n) scanf("%d",&n)
#define Max 100005
#define scan(n) scanf("%lld",&n)
#define pi acos(-1.0)
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ALL(x) x.begin(),x.end()
#define sci(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define load(array,size)  for(ll i=0 ; i<size ; i++) cin>>array[i] ;
#define load1(array,size)  for(ll i=1 ; i<=size ; i++) cin>>array[i] ;
#define INF	1LL<<19
#define pll pair<ll,ll>
#define mst(arr,value) memset(arr,value,sizeof(arr));
#define tst() int t;cin >> t;while(t--)


const ll MOD = 1e9+7;

typedef vector<ll>vec;
typedef pair<ll,ll> pii;
typedef map<ll,ll>mpll;
typedef set<ll>seet;

int main()
{
    set<int>a;
  int m,n,b;
  cin >> m >> n >> b;
  a.insert(m);
  a.insert(n);
  a.insert(b);
  if(a.size()==2)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}





Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b,c,d;
  int timeMin,timeMax;
  
  scanf("%d %d %d %d",&a,&b,&c,&d);
  
  if(a<c){
    timeMin = c;
  }
  else{
    timeMin = a;
  }
  if(b<d){
    timeMax = b;
  }
  else{
    timeMax = d;
  }
  if(timeMax-timeMin > 0){  
    printf("%d",timeMax-timeMin);
  }
  else{
    printf("0");
  }
  return 0;
}

Measured memory_bytes: 128
from collections import Counter

def main():
    N = int(input())
    counter = Counter()
    for i in range(N):
        k = "".join(sorted(input().strip()))
        counter[k] += 1
    answer = 0
    for k, c in counter.items():
        answer += (c * (c-1)) // 2
    print(answer)

def main2():
    N = int(input())
    counter = Counter("".join(sorted(input().strip())) for i in range(N))
    print(sum((c * (c-1)) // 2 for c in counter.values()))

def main3():
    print(sum((c * (c-1)) // 2 for c in Counter("".join(sorted(input().strip())) for i in range(int(input()))).values()))


main3()


Measured memory_bytes: 18220
n=int(input())
xy=[[0]*n,[0]*n,[0]*n,[0]*n]
for i in range(n):
  x,y=map(int,input().split())
  xy[0][i]=x+y
  xy[1][i]=x-y
  xy[2][i]=-x+y
  xy[3][i]=-x-y
print(max(max(xy[0])-min(xy[0]),max(xy[1])-min(xy[1]),max(xy[2])-min(xy[2]),max(xy[3])-min(xy[3])))

Measured memory_bytes: 40544
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	n := getNextLine(scanner)
	l := len(n)
	dp := make([][2][16]int, l+1)
	list := []rune{'0', '3', '5', '7'}
	dp[0][0][0] = 1

	for i := 0; i < l; i++ {
		for ii := 0; ii < 2; ii++ {
			for iii := 0; iii < 16; iii++ {
				for index, r := range list {
					if iii > 1 && index == 0 {
						continue
					}
					if rune(n[i]) < r && ii == 0 {
						continue
					}
					if ii == 0 && rune(n[i]) == r {
						dp[i+1][0][iii|1<<uint(index)] += dp[i][ii][iii]
						continue
					}
					dp[i+1][1][iii|1<<uint(index)] += dp[i][ii][iii]
				}
			}
		}
	}
	fmt.Println(dp[l][0][14] + dp[l][1][14] + dp[l][0][15] + dp[l][1][15])
}


Measured memory_bytes: 640
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		String s = sc.next();
		String t = sc.next();

		sc.close();

		int ans = N*2;

		for(int i=N;i>0;i--) {
			//重なりがiを調べる

			if(t.substring(0,i).equals(s.substring(N-i))) {
				ans = N*2-i;
				break;
			}

		}

		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 21972
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var N int
	fmt.Scan(&N)
	var i int
	var a,b int
	a = 0
	b = 0
	check := false
	for i= 2; i * i <= N; i++ {
		// a<√nを求めれば良い (√n * √n = n の時最大を迎えるので)
		if N % i == 0 {
			a = N/i
			b = i
			check = true
		}
	}
	if check {
		if a > b {
			fmt.Println(len(strconv.Itoa(a)))
		} else {
			fmt.Println(len(strconv.Itoa(b)))
		}
	} else {
		fmt.Println(len(strconv.Itoa(N)))
	}
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N, A, B;
  cin >> N;

  if(N == 1){
    cout << "Hello World\n";
    return 0;
  }

  cin >> A >> B;

  cout << A + B << "\n";
  
  return 0;
}


Measured memory_bytes: 3608
import math


def sieve_of_eratosthenes(n):
    if n == 1:
        return []
    limit = int(math.sqrt(n))
    targets = [i for i in range(2, n + 1)]
    primes = []
    while targets[0] <= limit:
        p = targets[0]
        primes.append(p)
        targets = [i for i in targets if i % p != 0]
    primes.extend(targets)
    return primes


n = int(input())
p = sieve_of_eratosthenes(n)
ans = 1
for i in p:
    cnt = 0
    for j in range(2, n + 1):
        while j % i == 0:
            j //= i
            cnt += 1
    ans *= cnt + 1
    ans %= 10 ** 9 + 7
print(ans)

Measured memory_bytes: 3064
/*Be patient && calm!
All our dreams can come true, if we have the courage to pursue them.
I fear not the man who has practiced 10,000 kicks once, but I fear the man who has practiced one kick 10,000 times.
Do not pray for an easy life, pray for the strength to endure a difficult one.
When something is important enough, you do it even if the odds are not in your favor.
First, solve the problem. Then, write the code.
Fix the cause, not the symptom.
Simplicity is the soul of efficiency.
Make it work, make it right, make it fast.
No matter how hard it gets, NEVER GIVE UP*/

#include <bits/stdc++.h>

#define pb push_back
#define MP make_pair
#define ALL(r) (r).begin(),(r).end()

typedef long long int ll;

#define FOR(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; ++i )
#define FORN(i,m,n) for(ll i=(ll)(m-1) ; i >= (ll) (n) ; --i )

#define RUN_FAST ios::sync_with_stdio(false);

using namespace std;



void solve()
{
    ll a,b,c,d,m,n,p,q,r,x,y,z,aa,bb,cc,dd,h; //variable
    ll i,j,k,l; //pointer
    ll cnt=0,cnt1=0,cnt2=0,cnt3=0,sum=0,mx=LLONG_MIN,mn=LLONG_MAX; //counter
    ll flag=0,flag2=0; //flag
    vector <ll> vec1,vec2,vec3;
    string s1,s2,s3;

    //PULOK SAHA
    //BMO

    cin >> a >> b;

    FOR(i,a,b+1)
    {
        s1=to_string(i);
        l = 0;
        h=s1.size()-1;
        flag=0;
        while (h > l)
        {
            if (s1[l++] != s1[h--])
            {
                flag=1;
                break;
            }
        }
        if(!flag)
            cnt++;
    }
    cout << cnt << endl;

}

int main()
{
    RUN_FAST
    //PULOK SAHA
    //BMO

    ll t=1;//test case

    //cin >> t;
    while(t--)
    {
        solve();
    }

    return 0;
}






//PULOK SAHA

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

using namespace std;

void Main() {
    while (true) {
        int n, x;
        cin >> n >> x;
        if (n == 0 && x == 0) {
            break;
        }

        int ans = 0;
        for (int i = 1; i <= n - 2; ++i) {
            for (int j = i + 1; j <= n - 1; ++j) {
                for (int k = j + 1; k <= n; ++k) {
                    if (i + j + k == x) {
                        ++ans;
                    }
                }
            }
        }
        cout << ans << endl;
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}



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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12
#define MAX_N 100000

int main(void)
{
  ll n, a, b;
  cin >> n >> a >> b;
  ll x[MAX_N];
  REP(i, n) cin >> x[i];

  ll ret = 0;
  REP(i, n-1) {
    if((x[i+1] - x[i]) * a > b) ret += b;
    else ret += (x[i+1] - x[i])*a;
  }

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 1024
def main():
    n = int(input())
    ls = [int(x) for x in input().split()]
    ans = [0 for _ in range(n)]
    for i in range(n):
        if ls[i]==i+1:
            ans[i] = 1
    cnt = 0
    for i in range(n-1):
        if ans[i]==1:
            ans[i]=0
            if ans[i+1]==1:
                ans[i+1]=0
            cnt +=1
    if ans[n-1]==1:
        print(cnt+1)
    else:
        print(cnt)
if __name__ == "__main__":
    main()

Measured memory_bytes: 56172
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
typedef pair<int, bool> sP;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

int n, m;
vector<int> G[600];
bool used[600];
vector<ld> memo[600];
void dfs(int id) {
	if (used[id])return;
	used[id] = true;
	vector<ld> res(n, INF);
	if (id == n - 1) {
		fill(res.begin(), res.end(), 0);
		//res[n - 1] = 0;
		memo[id] = res;
		return;
	}
	Rep(i, id + 1, n)res[i] = 0;
	rep(j, G[id].size()) {
		int to = G[id][j];
		dfs(to);
		Rep(i, id + 1, n) {
			res[i] += memo[to][i];
		}
	}
	ld sum = res[n - 1];
	Rep(i, id + 1, n) {
		res[i] /= (ld)G[id].size();
	}
	if (G[id].size() > 1) {
		//cout << id << endl;
		ld len = G[id].size() - 1;
		rep(j, G[id].size()) {
			int to = G[id][j];
			res[id] = min(res[id], (sum - memo[to][n - 1]) / len);
		}
	}
	Rep(i, id, n)res[i]++;
	rep(i, n)res[i] = min(res[i], res[n - 1]);
	memo[id] = res;
	return;
}
void solve() {
	cin >> n >> m;
	rep(i, m) {
		int s, t; cin >> s >> t; s--; t--;
		G[s].push_back(t);
	}
	dfs(0);
	ld ans = INF;
	rep(i, n)ans = min(ans, memo[0][i]);
	//rep(i, n)cout << memo[i][i] << endl;
	//rep(i, n)cout << memo[i][n-1] << endl;
	cout << ans << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(7);
	//init();
	solve();
	//stop
	return 0;
}



Measured memory_bytes: 7168
# Acceptance of input
import sys

f_i = sys.stdin

V, E = map(int, f_i.readline().split())

adj = [[] for i in range(V)]

for l_i in f_i:
    s, t = map(int, l_i.split())
    adj[s].append(t)
    adj[t].append(s)


# dfs traverse
prenum = [1] + [None] * (V - 1)
parent = [0] * V
lowest = [1] + [V] * (V - 1)

import collections

path = collections.deque()
path.append(0)

cnt = 1

while path:
    u = path[-1]
    adj_v = adj[u]
    for v in adj_v:
        if not prenum[v]:
            parent[v] = u
            path.append(v)
            cnt += 1
            prenum[v] = cnt
            lowest[v] = cnt
            adj[u].remove(v)
            adj[v].remove(u)
            break
    if u == path[-1]:
        for v in adj_v:
            lowest[u] = min(lowest[u], lowest[v])
            adj[u].remove(v)
            adj[v].remove(u)
        p = parent[u]
        lowest[p] = min(lowest[u], lowest[p])
        path.pop()


# output
bridge = []

for u in range(1, V):
    p = parent[u]
    if prenum[p] < lowest[u]:
        b = [p, u]
        b.sort()
        bridge.append(b)

bridge.sort()

for b in bridge:
    print(*b)

Measured memory_bytes: 13176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;

int a[20];
bool vis[20];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int T;cin>>T;
	while(T--){
		bool flag=false;
		for(int i=1;i<=10;i++){
			cin>>a[i];
		}
		int k[20];
		int len=1;
		k[1]=a[1];
		for(int i=2;i<=10;i++){
			if(a[i]<k[len]){
				k[++len]=a[i];
			}else{
				*upper_bound(k+1,k+1+len,a[i],greater<int>())=a[i];
			}
			if(len>2){
				flag=true;
				break;
			}
		}
		cout<<(flag?"NO\n":"YES\n");
	}
	return 0;
}


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

const int MAXN = 2e5 + 7;

int seg[4 * MAXN];
int n; 
int h[MAXN], v[MAXN];

int query(int x, int l, int r, int a, int b) {
	if (r < a || l > b)
		return 0;
	if (a <= l && r <= b)
		return seg[x];
	int mid = (l + r) / 2;
	int p1 = query(2 * x, l, mid, a, b);
	int p2 = query(2 * x + 1, mid + 1, r, a, b);
	return max(p1, p2);
}

void update(int x, int l, int r, int a, int v) {
	if (l == r) {
		seg[x] = v;
		return;
	}
	int mid = (l + r) / 2;
	if (l <= a && a <= mid)
		update(2 * x, l, mid, a, v);
	else
		update(2 * x + 1, mid + 1, r, a, v);
	seg[x] = max(seg[2 * x], seg[2 * x + 1]);
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> h[i];
	}
	for (int i = 1; i <= n; i++) {
		cin >> v[i];
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int q = query(1, 1, n, 1, h[i] - 1);
		//cout << "i = " << i << " query ans = " << q << " final = " << q + v[i] << '\n';
		ans = max(ans, q + v[i]);
		update(1, 1, n, h[i], q + v[i]);
	}
	cout << ans << '\n';
}

Measured memory_bytes: 8448
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <numeric>
#include <limits>
#include <cmath>
#include <math.h>
#include <iomanip>

using namespace std;

bool Cut(string & s, string & word) {
    if (s.size() < word.size()) {
        return 0;
    }
    while (!word.empty() && s.back() == word.back()) {
        s.pop_back();
        word.pop_back();
    }
    return word.empty();
}

int main() {
    string s;
    cin >> s;
    bool ans = true;
    while(!s.empty()) {
        string word;
        if (s.back() == 'm') {
            word = "dream";
        }
        if (s.back() == 'e') {
            word = "erase";
        }
        if (s.back() == 'r') {
            size_t n = s.size();
            if (n > 2 && s[n - 3] == 'm') {
                word = "dreamer";
            }
        }
        if (word.empty()) {
            word = "eraser";
        }
        if (!Cut(s, word)) {
            ans = false;
            break;
        }
    }
    if (ans) {
        cout << "YES";
    } else {
        cout << "NO";
    }
    return 0;
}


Measured memory_bytes: 512
#include"bits/stdc++.h"
#include"math.h"
using namespace std;

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
 

using ll = long long int;
using ld = long double;
using pii = pair<int,int>;

#define REP(i,m,n) for(ll i = m; i < (ll)(n);++i)
#define rep(i,n) REP(i,0,n)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
 
using vi=vc<int>;

const ll mod=1e9+7;
const ll INF = 1e18;

int main(){
  int n,m,q;
  ll c[550][550],x[550][550];
  cin >> n >> m >> q;
  rep(i,m){
    int l,r;
    cin >> l >> r ;
    c[l][r]++;}
  rep(i,520)
    rep(j,520){
    x[i+1][j]=x[i][j]+c[i][j];}
  rep(i,q){
    int ans=0;
    int y,z;
    cin >> y >>z;
    
    for(int j=y;j<z+1;j++){
      ans+=x[z+1][j]-x[y][j];
    }
    cout << ans << endl;
  }
}
  
      

Measured memory_bytes: 5632
import java.util.* ; 
class Main{
  public static void main(String[] args) {
    Scanner scan = new Scanner (System.in);
    String s = scan.next() ;
    char arr[] = s.toCharArray() ;
    ArrayList<Character> a = new ArrayList<>();
    for (int i = 0 ; i <arr.length ; i++){
        if(!a.contains(arr[i])){
          a.add(arr[i]);
        }
    }
   // System.out.println(arr.length);
   // System.out.println(a.size()) ;
    if(a.size() == arr.length){
      System.out.println("yes");
    }else{
      System.out.println("no");
    }
     
  }
}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n%10==2 || n%10==4 || n%10==5 || n%10==7 || n%10==9){
        cout<<"hon";
    }
    else if(n%10==0 || n%10==1 || n%10==6 || n%10==8){
        cout<<"pon";
    }
    else
        cout<<"bon";
}

Measured memory_bytes: 3628
n = int(input())
a = list(map(int, input().split()))
a = set(a)

n2 = int(input())
b = list(map(int, input().split()))
b = set(b)

count = 0
for i in a:
    for j in b:
        if i == j:
            count += 1
print(count)


Measured memory_bytes: 6312
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int C = sc.nextInt();
		int B[] = new int[M];
		int A[][] = new int[N][M];
		int counter = 0;
		int total = 0;
		for(int i = 0; i<M; i++) {
			B[i] = sc.nextInt();
		}
		for(int i = 0; i<N; i++) {
			for(int j = 0; j<M; j++) {
			A[i][j] = sc.nextInt();
			}
		}
		
		for(int T = 0; T<N; T++) {
			for(int i = 0; i<M; i++) {
			 	total += A[T][i]*B[i];
			}
			total += C;
			if(total > 0) {
				counter++;
			}
			total = 0;
		}
		System.out.println(counter);
		
		
	}

}

Measured memory_bytes: 23252
#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <queue>
#include <algorithm>
using namespace std;
int main() {
    int a,b,x;
    double s,J;
    scanf("%d%d%d",&a,&b,&x);
    s=double(x)/a;
    if(s>(0.5*a*b)){
        s=a*b-s;
        J=atan((2*s)/(a*a));
        J=180*J/M_PI;
    }else{
        J=atan((b*b)/(2*s));
        J=180*J/M_PI;
    }
    printf("%lf",J);
}

Measured memory_bytes: 256
a, b, c, d, e, f = gets.split.map{|x| x.to_i}

s = []
w = []
50.times do |i|
	50.times do |j|
		k = c * i + d * j
		s << k if k < f
		k = (a * i + b * j) * 100
		w << k if k <= f && k > 0
	end
end

maxPr = 0
sumA = 0
sumS = 0

w.each do |i|
	s.each do |j|
		if i + j <= f
			pr = j.to_f / (i + j)
			if pr > maxPr && j * 100 <= e * i
				maxPr = pr
				sumA = i + j
				sumS = j
			end
		end
	end
end

sumA = a * 100 if sumA == 0
print sumA, ' ', sumS

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

int a[3];
int eikaku, tyokkaku, donkaku;

signed main()
{
	while (true) {
		rep(i,3) cin >> a[i];
		sort(a, a + 3);

		if (a[2] >= a[0] + a[1]) {
			cout << eikaku + tyokkaku + donkaku << " " << tyokkaku << " " << eikaku << " " << donkaku << endl;
			break;
		}

		if (a[0]*a[0] + a[1]*a[1] - a[2]*a[2] == 0) {
			tyokkaku++;
		} else if (a[0]*a[0] + a[1]*a[1] - a[2]*a[2] < 0) {
			donkaku++;
		} else {
			eikaku++;
		}
	}
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
using namespace std;
 
int main() {

int N;
cin >> N;

vector<string> vec(N);
for (int i=0;i<N;i++){
    cin >> vec.at(i);
}
int ans=1;
sort(vec.begin(),vec.end());

for (int j=0;j<N-1;j++){
    if(vec.at(j) != vec.at(j+1)){
        ans++;
    }
    }
cout << ans <<endl;
}

Measured memory_bytes: 9520
H, W = map(int, input().split())

s = []
s.append(["."]*(W+2))

for _ in range(H):
    a = [i for i in input()]
    a.append(".")
    a.insert(0, ".")
    s.append(a)
s.append(["."]*(W+2))

flg = 0
for i in range(1, W):
    for j in range(1, H):
        if s[j][i] == "#":
            if s[j-1][i] == "." and s[j+1][i] == "." and s[j][i-1] == "." and s[j][i+1] == ".":
                flg = 1
                break
print("Yes" if flg == 0 else "No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
	int n;
	vector<int> h, dp;
	cin>>n;
	h.assign(n, 0);
	dp.assign(n+2, 0);
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	dp[n-1] = 0;
	dp[n-2] = abs(h[n-2]-h[n-1]);
	for(int i=n-3;i>=0;i--){
		dp[i] = min(dp[i+1]+abs(h[i]-h[i+1]), dp[i+2]+abs(h[i]-h[i+2]));
		//cout<<dp[i]<<"\n";
	}
	cout<<dp[0]<<"\n";
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void){

  char S[100];
  scanf("%s",S);
  int i, count=0;
  for(i=0;S[i]!='\0';i++){
    count+=1;
  }
  int j;
  for(j=0;j<count;j++){
    if(j%2!=0){
      if(S[j]=='R'){
	break;
      }
    }
    else{
      if(S[j]=='L'){
	break;
      }
    }
  }
  if(j==count){
    printf("Yes");
  }
  else{
    printf("No");
  }

  return 0;
}


Measured memory_bytes: 128
<>;@D=(1)x2e6;$==1e9+7;$s=.5;($x^=$_)?$P[$x]+=($D[$x]+=$P[$x]*($%-$c[$x]))%=$=:($%++,$s=$s*2%$=),$c[$x]=$%for split$",<>;$s+=$_ for@P;print$x?$D[$x]:$s%$=

Measured memory_bytes: 189184
/*input
3 3
3 1 2
-1000 -2000 -3000
*/

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> p(n), c(n);
    rep(i, n) cin >> p[i], --p[i];
    rep(i, n) cin >> c[i];
    ll ans = c[0];
    rep(i, n) {
        int prv = i, rl = 0;
        ll rs = 0;
        do {
            rl++;
            rs += c[prv = p[prv]];
        } while (prv != i);
        int mj = min(rl, k);
        rs = max(rs, 0LL);
        ll s = 0;
        prv = i;
        for (int j = 1; j <= mj; j++) {
            s += c[prv = p[prv]];
            ans = max(ans, s+(ll)(k-j)/rl*rs);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#!/usr/bin/env python3
import sys, math
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans=count=0

n,x=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
for i in range(n-1):
    ai=A[i]
    if x>=ai:
        x-=ai
        count+=1
if A[n-1]==x:
    count+=1
print(count)

Measured memory_bytes: 40464
#include <iostream>

using namespace std;


int main()
{
    int a, b;
    cin >> a >> b;
    if (a > b)
       cout << "a > b" << endl;
    else if (a < b)
       cout << "a < b" <<endl;
    else
       cout << "a == b" << endl;
     
    return 0;
}









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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    VL a(n), b(n);
    REP(i, n) cin >> a[i];
    REP(i, n) cin >> b[i];
    
    if(accumulate(ALL(a), 0LL) < accumulate(ALL(b), 0LL)) {
        cout << -1 << ln;
        return 0;
    }

    VPL diff;
    int ans = 0;
    ll negative_sum = 0;
    REP(i, n) {
        diff.push_back(PL(a[i] - b[i], i));
        if(a[i] - b[i] < 0) ans++;
        negative_sum += min(a[i] - b[i], 0LL);
    }
    sort(ALL(diff), greater<PL>());
    
    REP(i, n) {
        if(negative_sum >= 0) break;
        negative_sum += diff[i].first;
        ans++;
    }
    cout << ans << ln;
    return 0;
}


Measured memory_bytes: 3956