akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<vector>
using namespace std;
const int INF = 200000005;

int main()
{
	int d, n;
	cin >> d >> n;
	if (n != 100) {
		if (d == 0) cout << n << endl;
		else if (d == 1) cout << n * 100 << endl;
		else cout << n * 10000 << endl;
	}
	else {
		if (d == 0) cout << 101 << endl;
		else if (d == 1) cout << 10100 << endl;
		else cout << 1010000 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())

lastch = ''
answer = 'Yes'
words = []
for i in range(n):
    word = list(input())
    words.append(''.join(word))
    if lastch != word[0] and i != 0:
        answer = 'No'
    lastch = word[-1]

if len(set(words)) != len(words):
    answer = 'No'

print(answer)


Measured memory_bytes: 3060
#include <iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<set>
using namespace std;
#define PI acos(-1.0)
typedef long long ll;
typedef pair<int,int> P;
const int maxn=5e5+100,maxm=1e5+100,inf=0x3f3f3f3f,mod=1e9+7;
const ll INF=1e13+7;
priority_queue<P,vector<P>,greater<P> >q;
struct edge
{
    int from,to;
    int cost;
};
vector<int>G[maxn];
int get_sg(int u,int pa)
{
    int ret=0;
    for(int i=0; i<G[u].size(); i++)
    {
        if(G[u][i]==pa) continue;
        ret^=(1+get_sg(G[u][i],u));
    }
    return ret;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1; i<=n; i++) G[i].clear();
    for(int i=1; i<n; i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    if(get_sg(1,-1)) cout<<"Alice"<<endl;
    else cout<<"Bob"<<endl;
}


Measured memory_bytes: 21376
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#define nmax_def 220000
#define Cmax_def 2200
#define mod 1000000007
using namespace std;
typedef long long ll;

int main() {
	ll i, j;
	ll N, a[nmax_def], M = 0, b[nmax_def];
	cin >> N;
	for (i = 1; i <= N; i++)
		cin >> a[i];
	for (i = N; i > 0; i--)
	{
		ll sum = 0;
		for (j = i * 2; j <= N; j += i)
		{
			if (b[j] == 1)
				sum++;
		}
		b[i] = (sum + a[i]) % 2;
	}
	for (i = 1; i <= N; i++)
	{
		if (b[i] == 1)
			M++;
	}
	cout << M << endl;
	for (i = 1; i <= N; i++)
	{
		if (b[i] == 1)
			cout << i << " ";
	}
	cout << endl;
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int A,B,C,D;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B>>C>>D;
	cout<<max(0,min(B,D)-max(A,C))<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template< typename T > using matrix = vector< vector< T > >;

//FUNCTION  

void solve(void)
{
  string str;
  cin>>str;
  int D = 0;
  int cnt_s = 0, cnt_t=0;
  int N = str.size();
  stack<char> st;
  st.push(str[0]);
  for (int i = 1; i < str.size(); i++)
  {
    if(str[i] == 'S')
    {
      st.push('S');
    }
    else
    {
      if(st.empty())
      {
      st.push('T');
      }
      else if(st.top() == 'S' )
      {
        
        st.pop();
      }
      else
      {
        st.push('T');
      }
    }
    
  }
  
  cout<<st.size()<<endl;

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


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

// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

typedef long long ll; 
typedef long double ld; 
typedef vector<int> vi; 
typedef pair<int,int> pii; 
#define pb push_back
#define mp make_pair
#define prarr(a,n) cerr<<#a<<" : ";for(ll i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define prmat(mat,row,col) cerr<<#mat<<" :\n";for(ll i=0;i<row;i++) {for(ll j=0;j<col;j++) cerr<<mat[i][j]<<"\t";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
#define all(a) a.begin(),a.end()
#define sz(x) ((int)x.size())
#define endl '\n'
#define fast_io ios_base::sync_with_stdio(NULL); cin.tie(NULL)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {ll idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
template <class T> void prall(T a) { prc(all(a)); }
const int inf=1000*1000*1000+9; 
const ll infl=1ll*inf*inf; 
const int mod=1000*1000*1000+7;  

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



void solve(){
  int n,k; cin>>n>>k; 
  vector<ll> a(n), pre(n); 
  map<int,vi> ind;
  ind[0].push_back(0); 
  for(int i=0;i<n;i++){
    cin>>a[i]; 
    a[i]--; 
    pre[i]+=a[i]; 
    if(i>0) pre[i]+=pre[i-1]; 
    ind[pre[i]%k].push_back(i+1); 
  }
  ll ans=0; 
  for(auto it:ind){
    vi & v= it.second; 
    for(int i=1;i<sz(v);i++){
      int pos=upper_bound(all(v),v[i]-k)-v.begin(); 
      ll len=i-pos+1; 
      ans+=len-1; 
    }
  }
  cout<<ans<<endl;  
}



int main(){
	// clock_t beg=clock(); 
	fast_io; 
  // cout << fixed << setprecision(13); 
  int t; 
  t=1; 
  //cin>>t; 
  while(t--){
	  solve(); 	
  }
	// clock_t end=clock(); 
	// fprintf(stderr, "%lf\n", (double)(end-beg)/(CLOCKS_PER_SEC));
}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define MK make_pair
#define PB push_back




int main() {
string s;
cin>>s;
int sum = 0, l = s.size();
for(int i = 0; i < l ; i++){
    sum += (s[i] - '0');
}
if(sum % 9 == 0)
    cout<<"Yes"<<endl;
else
    cout<<"No"<<endl;
    return 0;

}

Measured memory_bytes: 3724
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;





int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ans = a * c;
	ans = max(ans, a * d);
	ans = max(ans, b * c);
	ans = max(ans, b * d);

	cout << ans << endl;
}

Measured memory_bytes: 3588
#include <iostream>
using namespace std;
int h[20];
int main()
{
  int n,br=0;
  cin >> n;
  for(int i=0;i<n;i++)
    cin>>h[i];
 int max=0;
  for(int i=0;i<n;i++)
  {
    if(h[i]>=max)
    {
      max=h[i];
      br++;
    }
  }
  cout << br;
}

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

#define int long long

const int N = 1e5 + 10;
int n, ar[N];

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> ar[i];
	sort(ar, ar + n);
	
	int x = ar[n - 1], mn = 2e9, ans = x;
	for (int i = 0; i < n - 1; i++)
		if (abs(x - 2*ar[i]) < mn)
			mn = abs(x - 2*ar[i]), ans = ar[i];
	cout << x << ' ' << ans << endl;
}


Measured memory_bytes: 1024
n = int(input())
S = [input() for i in range(n)]
m = int(input())
T = [input() for i in range(m)]

ans = 0
for s in set(S):
    p = S.count(s)
    m = T.count(s)
    if p > m:
        ans = max(ans, p-m)

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main()
{
	int S,h,m,s;
	scanf("%d",&S);
	h=S/3600;
	m=S%3600/60;
	s=S-(h*3600+m*60);
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
using namespace std;
int main(void){
    int a[5];
    for(int i = 0; i<5;i++)cin>>a[i];
    if(a[0]>=a[2]+a[4]&&a[1]>=a[3]+a[4]){
        if(a[2]-a[4]>=0&&a[3]-a[4]>=0){
            cout<<"Yes"<<endl;
        }
        else cout<<"No"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,ans1=0,ans2=0;
  char x[3];
  while(cin >> a && a != EOF){
    cin >> x[0] >> b >> x[1] >> c;
    if( a*a + b*b == c*c)ans1++;
    if(a == b)ans2++;
  }
  cout << ans1 << endl << ans2 <<endl;
  return 0;
}
    

Measured memory_bytes: 3040
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)

using namespace std;

typedef long long int lli;

class UnionFind {
public:
    vector<int> parent;
    UnionFind(int n) {
        parent.resize(n);
        REP(i, 0, n) parent[i] = i;
    }
    int Find(int a) {
        return (a == parent[a] ? a : parent[a] = Find(parent[a]));
    }
    bool isSame(int a, int b) {
        return Find(a) == Find(b);
    }
    bool Union(int a, int b) {
        if (isSame(a, b)) return false;
        int pa = Find(a);
        int pb = Find(b);
        parent[pa] = pb;
        return true;
    }
};

int main() {
    int N, M;
    cin >> N >> M;
    UnionFind uf(2 * N);
    REP (i, 0, M) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        uf.Union(a + N, b);
        uf.Union(a, b + N);
    }
    bool OK = true;
    REP (i, 0, N) if (uf.isSame(i, i + N)) OK = false;
    if (OK) {
        lli x = 0, y = 0;
        REP (i, 0, N) {
            if (uf.isSame(0, i)) x++;
            else y++;
        }
        cout << x * y - M << endl;
    } else {
        cout << (lli)N * (N - 1) / 2 - M << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
N, K = map(int, input().split(" "))
treehight = []
difference = []
for i in range(N):
    treehight.append(int(input()))
treehight.sort()
for j in range(N - K + 1):
    difference.append(treehight[j+K-1]-treehight[j])

print(min(difference))


Measured memory_bytes: 11288
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int m, d;
        cin >> m >> d;
        int ans = 0;
        for(int i = 1; i <= m; i++){
            for(int j = 1; j <= d; j++){
                string curr = to_string(j);
                if(curr.length() == 1){
                    continue;
                }
                if(curr[0] >= '2' and curr[1] >= '2' and ((curr[0] - '0') * (curr[1] - '0') == i)){
                    ans++;
                }
            }
        }
        cout << ans << '\n';
    }
}

Measured memory_bytes: 31488
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout<<#x<<" : "<<x<<'\n';
#define int long long
#define PI 3.141592653589793238

void solve()
{
	int a,b; cin>>a>>b;
	cout<<a*b<<'\n';
}

main()
{
	int t=1;
	while(t--)
		solve();
}

Measured memory_bytes: 3632
rate = int(input())
if 400 <= rate < 600:
  print("8")
elif 600 <= rate <800:
  print("7")
elif 800 <= rate <1000:
  print("6")
elif 1000 <= rate <1200:
  print("5")
elif 1200 <= rate <1400:
  print("4")
elif 1400 <= rate <1600:
  print("3")
elif 1600 <= rate <1800:
  print("2")
elif 1800 <= rate <2000:
  print("1")

Measured memory_bytes: 9188
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            long N = IO.RLong;

            long ans = 0;

            long[] f = new long[N + 1];

            for (int i = 1; i <= N; i++)
            {
                long t = i;
                while (t <= N)
                {
                    f[t]++;
                    t += i;
                }
            }
            for (int i = 1; i <= N; i++)
            {
                ans += i * f[i];
            }
            WriteLine(ans);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 94836
#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<cstdlib>
#include<utility>
#include<bitset>
using namespace std;
int n,lefts=0,rights=0;
string s;
int main()
{
	cin>>n>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='(')
			lefts++;
		else
		{
			++rights;
			if(lefts)
				--lefts,--rights;
		}
	}
	for(int i=0;i<rights;i++)
		s='('+s;
	for(int i=0;i<lefts;i++)
		s+=')';
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,D = I()
ans = 0
for i in range(N):
    x,y = I()
    if (x**2+y**2)**0.5 <= D:
        ans += 1
print(ans)

Measured memory_bytes: 10536
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
  string a,b;
  cin>>a>>b;
  int n=b.size();
  int sum=0;
  rep(i,n){
   if(a.at(i)!=b.at(i)){
     sum++;
   }
  }
    cout<<sum;
}   

Measured memory_bytes: 3848
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string s, t;
	cin >> s >> t;
	string ans = "No";
	if (s.length() + 1 == t.length()) {
		if (s == t.substr(0, t.length() - 1))
			ans = "Yes";
	}
	cout << ans;
}


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

int parse(string a) {
	int s = 0;
	for (int b = 0; b < a.length(); b++) {
		s *= 10;
		s += a[b] - 48;
	}
	return s;
}
vector<int> split(string a) {
	vector<int>s;
	string b="";
	for (int c = 0; c < a.length(); c++) {
		if (a[c] == ',') { s.push_back(parse(b)); b = ""; }
		else b += a[c];
	}
	s.push_back(parse(b));
	return s;
}
int main() {
	vector<vector<int>>s;
	string a;
	cin >> a;
	s.push_back(split(a));
	int b = 1;
	for (;;b++) {
		cin >> a;
		s.push_back(split(a));
		if (split(a).size() == 1)break;
	}
	b++;
	for (int o = 1; o < (b + 1) / 2; o++) {
		s[o][0] += s[o - 1][0];
		s[o][o] += s[o - 1][o-1];
		for (int x = 1; x < o; x++) {
			(s[o-1][x-1]>s[o-1][x]) ? (s[o][x] += s[o - 1][x-1]) : (s[o][x] += s[o - 1][x]);
		}
	}
	for (int y = (b + 1) / 2; y < b; y++) {
		for (int z = 0; z < (b - y); z++) {
			(s[y-1][z]>s[y - 1][z+1]) ? (s[y][z] += s[y-1][z]) : (s[y][z] += s[y - 1][z+1]);
		}
	}
	cout << s[b - 1][0] << endl;
}

Measured memory_bytes: 3176
<?php
$sum = [0 => PHP_INT_MAX];
$ans = 0;
$mmax = 0;
fscanf(STDIN, "%d %d", $N, $M);
$arr = array_fill(1, $M, []);
for ($i = 0; $i < $N; $i++) {
    fscanf(STDIN, "%d %d", $A, $B);
    $arr[$A][] = $B;
}

for ($i = 1; $i <= $M; $i++) {
    foreach ($arr[$i] as $dummy => $v) {
        if (!isset($sum[$v])) {
            $sum[$v] = 1;
        } else {
            $sum[$v]++;
        }
        $mmax = $mmax > $v ? $mmax : $v;
    }

    $ans += $mmax;
    if ($sum[$mmax] === 1) {
        unset($sum[$mmax]);
        $mmax = max(array_keys($sum));
    } else {
        $sum[$mmax]--;
    }
}
echo $ans;

Measured memory_bytes: 47608
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main() {
	string s;
	cin >> s;
	int n = 0;
	n = s.size();
	string ans = "yes";
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			if (s[i] == s[j]) {
				ans = "no";
				break;
			}
		}
	}

	cout << ans << endl;
	return 0;
}

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

const int mod=1e9+7,N=308;
struct node{int to,nxt,l;}c[N];
int head[N],tot;
int n,m,l[N],a[N],f[N][N][N],ans;

void add(int x,int y,int z)
{
	c[++tot].to=y;	c[tot].l=z;
	c[tot].nxt=head[x];	head[x]=tot;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int l,r,x;
		scanf("%d%d%d",&l,&r,&x);
		if(r==1&&x!=1)
		{
			puts("0");
			return 0;
		}
		add(r,l,x);
	}
	f[1][0][0]=1;
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<=i;j++)
			for(int k=j;k<=i;k++)
				if(f[i][j][k])
				{
					if(j||k) (f[i+1][k][i]+=f[i][j][k])%=mod,
								 (f[i+1][j][i]+=f[i][j][k])%=mod;
					else (f[i+1][0][i]+=f[i][j][k])%=mod;
					(f[i+1][j][k]+=f[i][j][k])%=mod;
				}
		for(int t=head[i+1];t;t=c[t].nxt)
		{
			int l=c[t].to;
			for(int j=0;j<=i;j++)
				for(int k=j;k<=i;k++)
				{
					int r=1+(j>=l)+(k>=l);
					if(r!=c[t].l) f[i+1][j][k]=0;
				}
		}
	}
	for(int j=0;j<=n;j++)
		for(int k=j;k<=n;k++)
		{
			int tmp=0;
			if(j) tmp++;	if(k) tmp++;
			if(!tmp) (ans+=(ll)f[n][j][k]*3%mod)%=mod;
			else (ans+=(ll)f[n][j][k]*6%mod)%=mod;
		}
	(ans+=mod)%=mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 110976
# ABC152F

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")





from collections import defaultdict
from queue import deque
import itertools
import functools
def find(start,goal):
    q = deque([start])
    seen = [None] * n
    seen[start] = -1
    while q:
        u = q.pop()
        d = seen[u]
        if u==goal:
            break
        for v in ns[u]:
            if seen[v] is None:
                seen[v] = u
                q.appendleft(v)
    u = goal
    es = []
    while True:
        t = (min(u, seen[u]), max(u, seen[u]))
        es.append(t)
        if seen[u]==start:
            break
        u = seen[u]
    return set(es)

n = int(input())
ns = defaultdict(set)
for _ in range(n-1):
    u,v = map(int, input().split())
    ns[u-1].add(v-1)
    ns[v-1].add(u-1)
ans = 0
m = int(input())
paths = [None] * m
for i in range(m):
    u, v = map(int, input().split())
    paths[i] = find(u-1,v-1)

ans = 0

def dfs(ind, s, ans):
    if len(ind)==m:
        if True in ind:
            ans += 2**(n-1-len(s)) * (-1)**((sum(ind)+1)%2)
        return ans
    ans = dfs(ind + [True], s | paths[len(ind)], ans)
    ans = dfs(ind + [False], s, ans)
    return ans
        
# for ind in itertools.product(*[(False, True) for _ in range(m)]):
#     num = sum(ind)+1
#     if num==1:
#         continue
#     c = 2**(n - 1 - len(functools.reduce(lambda x,y: x|y, (paths[i] for i in range(m) if ind[i]), set())))
#     ans += (-1)**num * c
ans = dfs([], set(), 0)
print(2**(n-1) - ans)

Measured memory_bytes: 53336
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std ;
using namespace __gnu_pbds;

#define ll long long
#define ull unsigned long long
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define rep(i , a , b) for(int i = (a) ; i < (b) ; ++i)
#define repp(i , a , b) for(int i = (a) ; i >= b ; --i)
#define each(x , a) for(auto &x : a)
#define len(x)  (int)x.size()
#define all(x)  (x).begin() ,(x).end()
#define mem(x , a) memset(x , a , sizeof(x))
#define vi vector<int>
#define vl vector<LL>
#define pii pair<int,int>
#define Pll pair<LL,LL>
#define io ios::sync_with_stdio(0) ; cin.tie(0);

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

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

string to_string(string s) {
	return '"' + s + '"';
}
string to_string(const char *s) {
	return to_string((string)s);
}
string to_string(bool b) {
	return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto &x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}";
	return res;
}
void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(x...) ;
#endif
int main() {
	io;
	//freopen("in.txt" ,"r" , stdin) ;
	string S , T ;
	cin >> S >> T ;
	int n = len(S) ;
	int m = len(T) ;
	int ans = INT_MAX ;
	rep(i , 0 , n - m + 1) {
		int cnt = 0 ;
		rep(j , 0 , m) {
			if (S[i + j] != T[j]) {
				cnt++ ;
			}
		}
		ans = min(cnt , ans) ;
	}
	cout << ans ;

}



Measured memory_bytes: 3664
#include <bits/stdc++.h>
#include <stdlib.h>
#include <time.h> 
 
using namespace std;
long long mod=1e9+7;
long long INF=1e7;
double EPS = 1e-12;
typedef long long int lld;
double tick(){static clock_t oldt;clock_t newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt = newt;return diff;}
#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define repI(i,a,n) for(int i = (a); i <= (n); ++i)
#define repD(i,a,n) for(long long int i = (a); i >= (n); --i)
#define repDI(i,a,n) for(int i = (a); i >= (n); --i)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld%lld",&a,&b)
#define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define scd(a) scanf("%d",&a)
#define scd2(a,b) scanf("%d%d",&a,&b)
#define scd3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scf(a) scanf("%lf",&a)
#define scf2(a,b) scanf("%lf%lf",&a,&b)
#define scf3(a,b,c) scanf("%lf%lf%lf",&a,&b,&c)
#define prL(a) printf("%lld\n",a)
#define prS(a) printf("%lld ",a)
#define prdL(a) printf("%d\n",a)
#define prdS(a) printf("%d ",a)
#define all(c) c.begin(), c.end()
#define sz(a) ((int)a.size())
#define Error(x) cout<< #x << " = " << (x) <<endl;
#define Error2(a,b) cout<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define Error3(a,b,c) cout<<"("<<#a<<" , "<<#b<<" , "<<#c<<" ) = ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<")\n";
#define Error4(a,b,c,d) cout<<"("<<#a<<" , "<<#b<<" , "<<#c<<" , "<<#d<<" ) = ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<" , "<<(d)<<")\n";
#define errop(a) cout<<#a<<" = ( "<<((a).x)<<" , "<<((a).y)<<" )\n";
#define mset(a, v) memset(a, v, sizeof(a))
#define popcount __builtin_popcountll
 
typedef pair<lld,lld> PA;
 
lld powP(lld a,lld b){
    if(b==0) return 1%mod;
    lld k;
    k=powP(a,b/2);
    k=k*k%mod;
    if(b%2==0) return k;
    else return a*k%mod;
}
 
bool bitSet(lld n,lld i){
    if((n&(1LL<<i))!=0) return true;
    else return false;
}
 
lld findGcd(lld a,lld b){
    if(a==0) return b;
    else return findGcd(b%a,a);
}
 
#define lim 300010
#define lim2 200010
#define qqqqqq 210
// Ab :)
// inline lld sqr(lld x) { return x * x; }
// unordered_map<lld,lld>::iterator it;
// std::ios::sync_with_stdio(false);
// priority_queue<PA> Q;
// lld dp[1<<18];

// vector<lld> G[lim];
// string S[lim];
lld A[lim],B[lim],C[lim];
// map<lld,lld> M;

int main(){
    lld T,i,p,j,l,n,e,r,b,c,k,m,q,a,d,w,x,y,u,v,z,t,curr,prev,sum,ans,pos,val,countA,indicator;
    sc2(n,k);
    prL(1LL * (n % k != 0));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// #define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);v++)
#define FOR(v,a,n) for(int v=a;v<(int)(n);v++)
#define FORE(x,arr) for(auto &x:arr)
#define REP(v,n) FOR(v,0,n)
#define RREP(v,n) for(int v=((int)(n)-1);v>=0;v--)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define DUMP(x) cerr<<#x<<":="<<(x)<<endl
const int DX[9]={0,1,0,-1,1,1,-1,-1,0}, DY[9]={-1,0,1,0,-1,1,1,-1,0};
const int INF=1e9; const long long INFLL=1e18;
template<class T,class U>ostream&operator<<(ostream &os,const pair<T,U> &p){
    os<<"("<<p.first<<" "<<p.second<<")";return os;}
template<class T>ostream&operator<<(ostream &os,const vector<T> &v){
    ITR(i,v)os<<*i<<(i==end(v)-1?"":" ");return os;}
//------------------------------------------------------------------------------

signed main() {
    int N;
    cin>>N;
    vi a(N);
    REP(i,N) cin>>a[i],a[i]--;
    int ans=0;
    REP(i,N) {
        if(i==a[a[i]]) ans++;
    }
    cout<<ans/2<<endl;
    return 0;
}


Measured memory_bytes: 768
#include <algorithm>
#include <array>
#include <bitset>
#include <cstdint>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <memory>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

// constexpr std::int64_t INF = 1ull << 50;
constexpr int INF = 1 << 20;

auto main() -> int {
  std::uint64_t N, M;
  std::cin >> N >> M;

  std::vector<std::uint64_t> As(N);
  for (auto& Ai : As) {
    std::cin >> Ai;
  }
  std::sort(As.begin(), As.end());

  using cibi = std::pair<std::uint64_t, std::uint64_t>; // <Ci, Bi>
  std::priority_queue<cibi, std::vector<cibi>> q{};
  for (auto i = 0ul; i < M; ++i) {
    std::uint64_t Bi, Ci;
    std::cin >> Bi >> Ci;
    q.emplace(Ci, Bi);
  }

  std::size_t cur = 0;
  std::uint64_t ans = 0;

  while (!q.empty()) {
    const auto Bi = q.top().second;
    const auto Ci = q.top().first;
    q.pop();

    // これ以上最大化できないなら終了
    if (Ci < As[cur]) {
      break;
    }

    // std::cout << "> " << Bi << ' ' << Ci << ' ';

    // 最大 Bi 枚 Ci に置き換える
    auto i = 0ul;
    for (; i < Bi && (cur + i) < N && As[cur + i] < Ci; ++i)
      ;
    ans += Ci * i;
    // std::cout << '(' << i << ')' << std::endl;

    cur += i;
  }

  // std::cout << cur << ' ' << ans << std::endl;

  // 残りを足す
  ans = std::accumulate(As.cbegin() + cur, As.cend(), ans);

  std::cout << ans << std::endl;
}


Measured memory_bytes: 3188
/*
Contest: -
Problem:
Author: tzc_wk
Time:
*/
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define fillsmall(a) memset(a,0xcf,sizeof(a))
#define y1			y1010101010101
#define y0			y0101010101010
typedef pair<int,int> pii;
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
const int MOD=1e9+7;
int n=read(),m=read(),dp[3001][3001][2];
inline void add(int &x,int y){
	x+=y;if(x>MOD)	x-=MOD;
}
signed main(){
	fz(i,0,n)	dp[0][i][0]=1;
	fz(i,0,m-1){
		fz(j,0,n){
			fz(k,0,1){
				if(j!=0)	add(dp[i+1][j-1][k|(j==1)],dp[i][j][k]);
				if(j!=0)	add(dp[i+1][j][k|(j==1)],dp[i][j][k]);
				if(j!=n)	add(dp[i+1][j][k|(j==0)],dp[i][j][k]);
				if(j!=n)	add(dp[i+1][j+1][k|(j==0)],dp[i][j][k]);
			}
		}
	}
	int ans=0;
	fz(i,0,n)	ans=(ans+dp[m][i][1])%MOD;
	printf("%d\n",ans);
	return 0;
}
/*
j-1 -0 +1 -0
j -1 +1 -0
j -0 +1 -1
j+1 -1 +1 -1
*/

Measured memory_bytes: 74004
class STNode:
    def __init__(self, k, l, r):
        self.key = k
        self.left = l
        self.right = r

def STinsert(h, z):
    p = None
    while True:
        if h.key == -1:
            break
        p = h
        if z.key < h.key:
            h = h.left
        else:
            h = h.right
    if z.key < p.key:
        p.left = z
    else:
        p.right = z

def STsearch(h, k):
    while h.key != -1:
        if k < h.key:
            h = h.left
        elif h.key < k:
            h = h.right
        else:
            print("yes")
            return
    print("no")

def preorder(head, h, A):
    if h.key == -1:
        return
    A.append(h.key)
    preorder(head, h.left, A)
    preorder(head, h.right, A)
    if head == h:
        print('', *A)

def inorder(head, h, B):
    if h.key == -1:
        return
    inorder(head, h.left, B)
    B.append(h.key)
    inorder(head, h.right, B)
    if head == h:
        print('', *B)

n = int(input())
NULLnode = STNode(-1, None, None)

first = list(input().split())
head = STNode(int(first[1]), NULLnode, NULLnode)
for i in range(n-1):
    temp = list(input().split())
    if temp[0] == "insert":
        z = STNode(int(temp[1]), NULLnode, NULLnode)
        STinsert(head, z)
    elif temp[0] == "print":
        A = []
        B = []
        inorder(head, head, B)
        preorder(head, head, A)
    else:
        STsearch(head, int(temp[1]))


Measured memory_bytes: 97536
#include <stdio.h>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <list>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (int i = 0; i<vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

int SumDigitValues(int x)
{
	int sum = 0;
	while (x)
	{
		sum += x % 10;
		x = x / 10;
	}

	return sum;
}

int Factorial(int n)
{
	if (n < 0) return 0;
	if (n == 0) return 1;
	return n * Factorial(n - 1);
}

int factorial(int n)
{
	if (n > 1)
	{
		return n * factorial(n - 1);
	}
	else
	{
		return 1;
	}
}

int main()
{
	int n;
	cin >> n;
	cout << n * n*n << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define FOR(i,L,R) for (int i = L; i < R; i++)
#define READ(n) int (n); scanf("%d",&(n))
#define getInt(a) scanf("%d", &a)

int main(){
    READ(n);
    int arr[200000], max = 1, secMax = 0;
    FOR(i, 0, n){
        getInt(arr[i]);
        if (arr[i] > max)
            max = arr[i];
        else if (arr[i] > secMax && arr[i] <= max)
            secMax = arr[i];
    }
            
    FOR(i, 0, n){
        if (arr[i] == max)
            printf("%d\n", secMax);
        else
            printf("%d\n", max);
    }
}


Measured memory_bytes: 2304
#include<iostream>
using namespace std;
int x,a,b,c;
int main()
{
	cin>>x>>a>>b;
	c=b-a;
	if (c<=0) cout<<"delicious"<<endl;
	else if (c<=x) cout<<"safe"<<endl;
	else cout<<"dangerous"<<endl;
	return 0;
}

Measured memory_bytes: 256
// Written by Kuji on 2020-05-10-18.40.05
#include<bits/stdc++.h>
#define ll long long
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define fori(i,a,b) for(ll i=a;i<b;i++)
#define forr(i,a,b) for(ll i=a;i>=b;i--)
#define forit(it,x) for (auto it=(x).begin();it!=(x).end(); it++)
#define fi first
#define se second
#define sll set<ll>
#define vll vector<ll>
#define msl map<string,ll>
using namespace std;
int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    ll a,b,c,k,p=0,n=0,z=0;
    cin>>a>>b>>c>>k;
    if(k<=a)
        cout<<k<<"\n";
    else if(k<=a+b)
        cout<<a<<"\n";
    else if(k<=a+b+c)
        cout<<a-(k-(a+b))<<"\n";
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define int ll
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> N;
    vector<ll> a(N);
    cin >> a;
    ans = 200000LL * 2020202020LL;
    int sum = accumulate(ALL(a), 0LL);
    dump(sum);
    int l = 0, r = 0;
    for (int i = 0; i < N; i++) {
        l += a[i];
        r = sum - l;
        ans = min(ans, abs(l - r));
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
N=int(input())
M=10**9+7
batu4=['AGG','AGT','ACG','ATG']
batu3=['AGC','ACG','GAC']
l=['A','G','C','T']
lx=['A','G','T']

def hash_index(s):
  num=0
  length=len(s)
  for i in range(length):
    letter=s[length-1-i]
    if letter=='A': k=0
    elif letter=='G': k=1
    elif letter=='C': k=2
    else: k=3
    num=num+k*4**i
  return num
hash_table=[]
for l1 in l:
  for l2 in l:
    for l3 in l:
      s_a=l1+l2+l3
      if s_a in batu3:
        hash_table.append([set()])
      elif s_a in batu4:
        s=set()
        for l4 in lx:
          s.add(l2+l3+l4)
        hash_table.append(s)
      else:
        s=set()
        for l4 in l:
            s_b=l2+l3+l4
            if not s_b in batu3:
              s.add(s_b)
        hash_table.append(s)
l_p=[1]*64
for l1 in l:
  for l2 in l:
    for l3 in l:
      s=l1+l2+l3
      if s in batu3:
        l_p[hash_index(s)]=0
  
#N>=4
for i in range(N-3):
  l_current=[0]*64
  for j in range(64):
    s_s=hash_table[j]
    for s in s_s:
      if not len(s)==0:
      	l_current[hash_index(s)]=(l_p[j]+l_current[hash_index(s)])%M
  l_p=l_current

num=0
for n in l_p:
  num=(num+n)%M
print(num)

Measured memory_bytes: 3188
n = int(input())
x =list(map(int, input().split()))
xl = min(x)
xr = max(x)
ans = (xr-xl)**2*n
for i in range(xl,xr+1):
        ttl = 0
        for j in x:
            ttl+=(j-i)**2
        ans = min(ans, ttl)
print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
using namespace std;
const int N=100005;
int n,a[N],b[N];
int ida[N],idb[N];
int p[N],vis[N];
bool cmpa(int x,int y){
	return a[x]<a[y];
}
bool cmpb(int x,int y){
	return b[x]<b[y];
}
int main(){
	scanf("%d",&n);
	For(i,1,n) scanf("%d",&a[i]);
	For(i,1,n) scanf("%d",&b[i]);
	For(i,1,n) ida[i]=idb[i]=i;
	sort(ida+1,ida+n+1,cmpa);
	sort(idb+1,idb+n+1,cmpb);
	For(i,1,n)
		if (a[ida[i]]>b[idb[i]])
			return puts("No"),0;
	For(i,1,n) p[idb[i]]=ida[i];
	for (int x=1;!vis[x];vis[x]=1,x=p[x]);
	For(i,1,n) if (!vis[i])
		return puts("Yes"),0;
	For(i,1,n-1) if (a[ida[i+1]]<=b[idb[i]])
		return puts("Yes"),0;
	puts("No");
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(int, N, T);

    int ans = INF;

    rep(i, 0, N) {
        var(int, c, t);
        if (t <= T) chmin(ans, c);
    }

    if (ans >= INF) {
        print("TLE");
    } else {
        print(ans);
    }

    return 0;
}


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

count = 0

for i in range( n ):
    mini = i
    for j in range( i, n ):
        if a[j] < a[mini]:
            mini = j
    if mini != i:
        count += 1
        t = a[i]
        a[i] = a[mini]
        a[mini] = t

print( *a )
print( count )

Measured memory_bytes: 7720
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/priank/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

bool chk(lli n)
{
    lli i=1;

    for(auto x:a)
    {
        if(x==i)
            i++;
    }

    return i>n;
}

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n;
    a.clear();a.reserve(n);

    fo(i,n)
    {
        cin>>in;
        a.pb(in);
    }

    lli l=0,r=n+10;
    while(r-l>1)
    {
        lli m=(l+r)/2;
        if(chk(m))
            l=m;
        else
            r=m;
    }

    dbg(l);

    if(l==0)
        l=-1;
    else
        l=n-l;
    cout<<l<<endl;

}   aryanc403();
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#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 VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;



int main(){
    int n;
    cin >> n;
    vector<P> red, blue;
    rep(i, n){
        int x, y;
        cin >> x >> y;
        red.emplace_back(y, x);       //redは(y, x)でもつ
    }
    rep(i, n){
        int x, y;
        cin >> x >> y;
        blue.emplace_back(x, y);       //blueは(x, y)でもつ
    }
    sort(ALL(red), greater<P>());
    sort(ALL(blue));

    ll res = 0;
    rep(i, n){
        int bx = blue[i].first, by = blue[i].second;
        rep(j, n){
            if(red[j].first < by && red[j].second < bx){
                res++;
                red[j].first = INF;
                red[j].second = INF;
                break;
            }
        }
        sort(ALL(red), greater<P>());
    }
    cout << res << endl;
}



Measured memory_bytes: 256
<?php
$input = trim(fgets(STDIN));
list($n, $t) = explode(' ', $input);

$min = PHP_INT_MAX;
$count = 0;
while($count < $n) {
    $input = trim(fgets(STDIN));
    list($c, $tn) = explode(' ', $input);
    if($t >= $tn && $min > $c) {
        $min = $c;
    }

    $count++;
}

if($min == PHP_INT_MAX) {
    echo 'TLE';
} else {
    echo $min;
}

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

int n, m, f[1 << 12];
int a[1010], b[1010];

int main()
{
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= m; ++i)
	{
		int k, x;
		scanf("%d %d", &a[i], &k);
		while(k--)
		{
			scanf("%d", &x);
			b[i] |= 1 << (x - 1);
		}
	}
	memset(f, 0x3f, sizeof(f));
	f[0] = 0; int lim = (1 << n) - 1;
	for(int i = 1; i <= m; ++i)
		for(int j = 0; j <= lim; ++j)
			if(f[j] != 0x3f3f3f3f)
				f[j | b[i]] = min(f[j | b[i]], f[j] + a[i]);
	printf("%d\n", f[lim] == 0x3f3f3f3f ? -1 : f[lim]);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	//java11

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] A = new long[N];
		for(int i=0; i<N; i++) {
			A[i] = sc.nextLong();
			if(A[i] == 0) {
				System.out.println(0);
				return;
			}
		}

		long ans = A[0];
		for(int i=1; i<N; i++) {
			if(A[i] <= (1000000000000000000L / ans)) {
				ans *= A[i];
			}else {
				System.out.println(-1);
				return;
			}
		}

		System.out.println(ans);

	}

}

Measured memory_bytes: 50780