akhauriyash/Code-Regression huggingface dataset:
macro_rules! scan_sub {
    ( $itr:ident, $t:ty ) => {
        let mut buf = String::new();
        let $itr = {
            while buf.trim().len() == 0 {
                buf = String::new();
                std::io::stdin().read_line(&mut buf).unwrap();
            }
            buf.split_whitespace().map(|n| n.parse::<$t>().unwrap())
        };
    };
}

macro_rules! scan {
    ( $x:ident; Vec<$t:ty> ) => {
        scan_sub!(itr, $t);
        let $x = itr.collect::<Vec<_>>();
    };
    ( $( $x:ident ),*; $t:ty ) => {
        scan_sub!(itr, $t);
        let mut itr = itr;
        $(
            let $x = itr.next().unwrap();
        )*
    };
}

fn main() {
    scan!(n, m; usize);
    scan!(heights; Vec<usize>);

    let mut paths = vec![vec![0; 0]; n];
    for _ in 0..m {
        scan!(a, b; usize);
        paths[a - 1].push(b - 1);
        paths[b - 1].push(a - 1);
    }

    let res = paths.into_iter()
        .enumerate().filter(|(ip, p)| {
            let h = heights[*ip];
            p.iter().all(|&j| h > heights[j])
        }).collect::<Vec<_>>().len();

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


Measured memory_bytes: 11024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
	int N;
	cin >> N;
	vector<int> A(N), B(N), C(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> C[i];
	}
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());
	vector<ll> cntB(N);
	for (int i = 0; i < N; i++) {
		cntB[i] = C.end() - upper_bound(C.begin(), C.end(), B[i]);
	}
	for (int i = 1; i < N; i++) {
		cntB[i] += cntB[i - 1];
	}
	ll res = 0;
	for (int i = 0; i < N; i++) {
		int id = upper_bound(B.begin(), B.end(), A[i]) - B.begin();
		res += cntB[N - 1] - (id == 0 ? 0 : cntB[id - 1]);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 2176
let modulo = 1000000007
let (+@) a b = (a + b) mod modulo
let ( *@ ) a b = (a * b) mod modulo
let rec modpow a n =
  if n = 0 then 1
  else if n mod 2 = 1 then a *@ modpow a (n-1)
  else let h = modpow a (n/2) in h *@ h

let () =
  Scanf.scanf "%s" @@ fun s ->
  let n = String.length s in
  let s = Array.init n (fun i -> i, s.[i]) in
  let m, z =
    Array.fold_left (fun (m, z) (i, c) ->
      match c with
      | '0' -> (m, z)
      | _ (* '1' *) -> (2 *@ m, z +@ m *@ modpow 3 (n-1-i))
    ) (1, 0) s
  in
  Printf.printf "%d\n" (m +@ z)
  


Measured memory_bytes: 6784
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long d = sc.nextLong();
		long e = sc.nextLong();
		sc.close();

		long max = 0;
		n--;
		max = Math.max(max, n / a);
		max = Math.max(max, n / b);
		max = Math.max(max, n / c);
		max = Math.max(max, n / d);
		max = Math.max(max, n / e);
		System.out.println(max + 5);
	}
}


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

using namespace std;
#define ll unsigned long long int
#define SIZE 100001
#define pb push_back
ll mod = 1000000007;
ll root[SIZE], size[SIZE];
vector<ll> adj[SIZE];

ll getroot(ll u)
{
	while(root[u]!=u)
	{	
		root[u]=root[root[u]];
		u = root[u];
	}

	return u;

}

void unionNodes(ll u, ll v)
{
	ll r_u=getroot(u);
	ll r_v=getroot(v);
	
	if(r_u!=r_v)
	{	
		if(size[r_u]>size[r_v])
		{
			root[r_v]=root[r_u];
			size[r_u]+=size[r_v];
			//size[r_v]=0;
		}
	
		else
		{
			root[r_u]=root[r_v];
			size[r_v]+=size[r_u];
			//size[r_u]=0;
		}
	}
    
}

int main(void)
{
	ll n, m, k;
	cin>>n>>m>>k;
	ll cnt[n+1];
	memset(cnt, 0, sizeof(cnt));
	for(ll i=1; i<=n; i++)
	{
		root[i]=i;
		size[i]=1;
	}
	
	for(int i=0; i<m; i++)
	{
		ll x, y;
		cin>>x>>y;
		unionNodes(x, y);
		adj[x].pb(y);
		adj[y].pb(x);
	}

	for(int i=0; i<k; i++)
	{
		ll x, y;
		cin>>x>>y;
		if(getroot(x)==getroot(y))
		{
			adj[x].pb(y); 
			adj[y].pb(x);
		}
	}

	for(int i=1; i<=n; i++)
	{
		ll r=getroot(i);
		cout<<size[r]-adj[i].size()-1<<" ";
	}
	cout<<"\n";
	
	return 0;

}

Measured memory_bytes: 12032
#%%
N = int(input())
L = [int(i) for i in input().split()]
Q = int(input())
order = [[] for _ in range(Q)]

for i in range(Q):
    order[i] = [int(i) for i in input().split()]
#%%
cnt = {}
for i in L:
    if i in cnt:
        cnt[i] += 1
        
    else:
        cnt[i] = 1

ans = [sum(L)]
for i in order:
    if i[0] not in cnt:
        print(ans[-1])
        continue
    temp = cnt[i[0]] * (i[1] - i[0])
    ans.append(temp + ans[-1])
    print(ans[-1])
    
    if i[1] in cnt:
        cnt[i[1]] += cnt[i[0]]
    else:
        cnt[i[1]] = cnt[i[0]]

    del cnt[i[0]]        
        





Measured memory_bytes: 37988
#include <stdio.h>

int main(){
	int i;
	int N;
	int change;

	scanf("%d", &N);

	int x[N];
	int y[N];
	int z[N];

	for(i=0;i<N;i++){
		scanf("%d %d %d", &x[i], &y[i], &z[i]);
	}

	for(i=0;i<N;i++){

		if(x[i] <= y[i]){
			change = x[i];
			x[i] = y[i];
			y[i] = change;
		}

		if(x[i] <= z[i]){
			change = x[i];
			x[i] = z[i];
			z[i] = change;
		}

		if(x[i]*x[i] == y[i]*y[i] + z[i]*z[i]){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
		
	}

	return 0;

}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
static const int64_t mod=1000000007;
int main(){
  int N;cin>>N;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  int64_t ans=1;int64_t a=0;
  for(int i=0;i<N;i++){
  if(A.at(i)<=2*a){ans=(ans*(a+1))%mod;a--;}
    a++;
  }for(int64_t i=1;i<=a;i++)
    ans=(ans*i)%mod;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4024
import java.util.*

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    val N = scn.nextInt()
    val S = scn.next()

    var cnt = 0

    for(i in 0..N-3){
        if(S.substring(i, i+3) == "ABC") cnt++
    }

    println(cnt)
}

Measured memory_bytes: 29476
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define fi first
#define se second
#define pt(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;



int main(void) {
    ll N;
    cin >> N;
    string s;
    cin >> s;
    ll i, j;
    
    ll ans=0;
    
    for(ll mid=0; mid<N; mid++) {
        ll cnt[26]={};
        ll t=0;
        
        for(i=0; i<mid; i++) {
            for(j=mid; j<N; j++) {
                if(s[i]==s[j] & cnt[s[i]-'a']==0) {
                    t++;
                    cnt[s[i]-'a']=1;
                }
            }
        }
        
        ans=max(ans, t);
        
    }
    pt(ans);
    
}

























Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL =long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 9; //924844033 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum, ans,dp[800][800], a[200000], b[20000];
string str, ss;
bool f;
char c[800][800];
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<Edge>vec[20000];
vector<edge>ed;
vector<LL>v;
map<string,LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> h >> w;
	rep(i, h)
		rep(j, w) {
		cin >> c[i][j];
		dp[i][j] = -1;
	}
	rep(p, h)rep(q, w) {
		if (dp[p][q] != -1)continue;
		queue<Pll>qu;
		qu.push(Pll(p, q));
		dp[p][q] = sum;
		while (!qu.empty()) {
			Pll now = qu.front();
			qu.pop();
			LL x = now.fir, y = now.second;
			rep(k, 4) {
				LL X = x + di[k][0], Y = y + di[k][1];
				if (X >= 0 && Y >= 0 && X < h&&Y < w&&c[x][y] != c[X][Y] && dp[X][Y] == -1) {
					dp[X][Y] = sum;
					qu.push(Pll(X, Y));
				}
			}
		}
		sum++;
	}
	rep(i, h)rep(j, w) {
		if(c[i][j]=='.')
		a[dp[i][j]]++;
	}
	rep(i, h)rep(j, w) {
		if (c[i][j] == '#') {
			ans += a[dp[i][j]];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;
const long long INF=-mod;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
//ショートカット
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,k,n) for(int i=k;i<n;i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

//関数
//最大公約数
long long gcd(long long m,long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m,long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x,long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//nCr
long long C(long long n, long long r);
//nCr (mod)
long long modC(long long n, long long r) {
    vector<long long> f(n+1),inv(n+1),invf(n+1);
    f[0]=f[1]=1;
    invf[0]=invf[1]=1;
    inv[1]=1;
    for (long long i=2;i<n+1;i++) {
        f[i]=(i*f[i-1])%mod;
        inv[i]=mod-((mod/i)*inv[mod%i])%mod;
        invf[i]=(inv[i]*invf[i-1])%mod;
    }
    long long cmb=f[n]*(invf[r]*invf[n-r]%mod)%mod;
    if (n>=r) return cmb;
    else return 0;
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  lin(N);lin(M);
  vector<vector<bool>>graph(N,vector<bool>(N,false));
  
  rep(i,M){
    lin(a);lin(b);
    graph[a-1][b-1]=true;
    graph[b-1][a-1]=true;
  }
  
  vector<int>v(N-1);
  rep(i,N-1) v[i]=i+1;
  ll res=0;
  do{
    for(int i=0;i<N-1;i++){
      ll p,q;
      if(i==0)
        p=0;
      else
        p=v[i-1];
      q=v[i];
      
      if(!graph[p][q]){
        break;
        //cout<<p<<" "<<q<<endl;
      }
      //cout<<v[i]<<" "<<v[i+1]<<endl;
      if(i==N-2) res++;
    }
  }while(next_permutation(all(v)));
  cout<<res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define eb emplace_back
#define INF (0x3f3f3f3f)
using namespace std;
typedef pair<int, int> pii;

struct SCC {
	static const int MAXN = 131100;

	vector<int> G[MAXN];
	int A[MAXN], An;
	bitset<MAXN> chk;

	vector<pii> EV;
	vector<int> V;

	void dfs(int i) {
		chk[i] = true;
		for(int v : G[i]) if(!chk[v]) dfs(v);
		V.eb(i);
	}
	void dfslabel(int i) {
		chk[i] = true;
		for(int v : G[i]) if(!chk[v]) {
			A[v] = A[i];
			dfslabel(v);
		}
	}

	void init() {
		EV.clear();
		An = 0;
	}
	void add(int a, int b) { EV.eb(a, b); }
	void run() {
		for(int i = 0; i < MAXN; i++) G[i].clear();
		for(auto &e : EV) G[e.first].eb(e.second);
		chk.reset();
		for(int i = 0; i < MAXN; i++) if(!chk[i]) dfs(i);
		for(int i = 0; i < MAXN; i++) G[i].clear();
		chk.reset();
		for(auto &e : EV) G[e.second].eb(e.first);
		reverse(V.begin(), V.end());
		for(int v : V) if(!chk[v]) {
			A[v] = ++An;
			dfslabel(v);
		}
		V.clear();
	}
};

struct SAT {
	SCC scc;

	void init() { scc.init(); }
	void add(int a, bool av, int b, bool bv) {
		scc.add(a<<1|int(!av), b<<1|int(bv));
		scc.add(b<<1|int(!bv), a<<1|int(av));
	}
	bool solve() {
		scc.run();
		for(int i = 0; i < SCC::MAXN; i += 2)
			if(scc.A[i] == scc.A[i|1])
				return false;
		return true;
	}
} sat;

const int MAXN = 10055;
const int MX = 32768;

int O[MAXN*2], RO[MAXN*2];
int A[MAXN], B[MAXN];

int N;

int f(int i) { return (i&1) ? B[i>>1] : A[i>>1]; }

void make(int i, int s, int e) {
	if(s < 0) s = 0; if((N<<1) <= e) e = (N<<1)-1;
	for(i += MX, s += MX, e += MX; s <= e; s >>= 1, e >>= 1) {
		if(s&1) sat.add(i, true, s++, true);
		if(~e&1) sat.add(i, true, e--, true);
	}
}

bool isp(int L) {
	if(!L) return true;
	sat.init();

	for(int i = 1; i < MX; i++) {
		sat.add(i, false, i<<1, true);
		sat.add(i, false, i<<1|1, true);
	}
	for(int i = 0; i < N; i++)
		sat.add(RO[i<<1]+MX, false, RO[i<<1|1]+MX, false);
	for(int i = N<<1, x, oi, s, e; i--;) {
		x = (i&1) ? B[i>>1] : A[i>>1];
		oi = RO[i];
		if(oi && x-L < f(O[oi-1])) {
			s = 0; e = oi-1; for(int m, y = x-L; s < e;) {
				m = (s+e) >> 1;
				if(y < f(O[m])) e = m;
				else s = m+1;
			}
			make(oi, s, oi-1);
		}
		if(oi+1 < (N<<1) && f(O[oi+1]) < x+L) {
			s = oi+1; e = (N<<1)-1; for(int m, y = x+L; s < e;) {
				m = (s+e+1) >> 1;
				if(f(O[m]) < y) s = m;
				else e = m-1;
			}
			make(oi, oi+1, s);
		}
	}

	return sat.solve();
}

int getAns() {
	int s = 0, e = INF; for(int m; s < e;) {
		m = (s+e+1) >> 1;
		if(isp(m)) s = m;
		else e = m-1;
	}
	return s;
}

int main() {
	ios::sync_with_stdio(false);

	cin >> N;
	for(int i = 0; i < N; i++) cin >> A[i] >> B[i];
	iota(O, O+(N<<1), 0); sort(O, O+(N<<1), [&](int a, int b) {
			return f(a) < f(b);
			});
	for(int i = N<<1; i--;) RO[O[i]] = i;

	cout << getAns() << endl;
	return 0;
}

Measured memory_bytes: 45668
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

from collections import Counter
def main():
    n = II()
    a_s = LI()
    if len(Counter(a_s)) == n:
        print("YES")
    else:
        print("NO")

if __name__ == '__main__':
    main()

Measured memory_bytes: 33328
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

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

ll n;
Vec2<ll> board;
Vec2<bool> sit;

bool inBoard(ll x, ll y){
	return x >= 0 && x < n && y >= 0 && y < n;
}

void dfs(ll x, ll y, ll c){
	if (!inBoard(x, y)) return;
	if(chmin(board[x][y], c)){
		rep(i, 4) dfs(x + dx[i], y + dy[i], c + sit[x][y]);
	}
}

int main(void){
	cin >> n;
	board.resize(n);
	rep(i, n) board[i].resize(n, INF);
	sit.resize(n);
	rep(i, n) sit[i].assign(n, true);
	Vec p(n * n);
	rep(i, n * n) cin >> p[i];
	rep(i, n * n) --p[i];

	rep(i, n){
		rep(j, n){
			chmin(board[i][j], i);
			chmin(board[i][j], j);
			chmin(board[i][j], n - 1 - i);
			chmin(board[i][j], n - 1 - j);
		}
	}

	ll ans = 0;
	rep(i, n * n){
		ll x = p[i] / n, y = p[i] % n;
		ans += board[x][y];
		sit[x][y] = false;
		rep(j, 4) dfs(x + dx[j], y + dy[j], board[x][y]);
		//co({i, board[2][2]});
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 29700
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			Question.Exec();
		}
	}

	public static class Question
	{
		public static void Exec()
		{
			string s = Console.ReadLine();
			List<char> list = s.ToCharArray().ToList();
			var list2 = list.Distinct().ToList();

			if (list.Count == list2.Count) {
				Console.WriteLine("yes");
			} else {
				Console.WriteLine("no");
			}

			Console.ReadKey();
		}
	}
}

Measured memory_bytes: 13152
#include <stdio.h>

int main(){
    char s[200010], t[200010];

    scanf("%s", s);
    scanf("%s", t);

    int i=0;
    int diff=0;

    while(s[i] != '\0'){
        if(s[i] != t[i]){
            diff++;
        }

        i++;
    }

    printf("%d", diff);
}

Measured memory_bytes: 2096
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a != b && b != c && c != a) dump(3);
  else if (a == b && b == c && c == a) dump(1);
  else dump(2);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
using namespace std;

const long long int mod=998244353;
const long long int INF=99999999999999999;

long long int n,m,sum=0,res=0;
long long int a[200005],b[200005];

int main() {
	cout << fixed << setprecision(10);
    cin>>n;
    if(n%2==0){
        cout<<n/2-1<<endl;
    }else{
        cout<<n/2<<endl;
    }
} 


Measured memory_bytes: 256
N,M = map(int,input().split())

Submittion = [None]*M
for i in range(M):
    Submittion[i] =input().split()
    Submittion[i][0] =int(Submittion[i][0])

answer = [0]*(N)
WA = [0]*N
for i in range(M):
    if Submittion[i][1] == "AC":
        answer[Submittion[i][0]-1] +=1
    else:
        if answer[Submittion[i][0]-1] == 0:
            WA[Submittion[i][0]-1]+=1

print_ans = 0
print_wa = 0
for i in range(len(answer)):
    if answer[i] >0:
        print_ans+=1

    if answer[i] >0:
        print_wa +=WA[i]

print(print_ans,print_wa)

Measured memory_bytes: 31384
x,y,a,b,c=map(int,input().split())
red=list(map(int,input().split()))
green=list(map(int,input().split()))
colorless=list(map(int,input().split()))
temp=[]
red.sort(reverse=True)
green.sort(reverse=True)
colorless.sort(reverse=True)
for i in range(min(x,a)):
  temp.append(red[i])
for i in range(min(y,b)):
  temp.append(green[i])
for i in range(c):
  temp.append(colorless[i])
temp.sort(reverse=True)
ans=0
for i in range(x+y):
  ans+=temp[i]
print(ans)

Measured memory_bytes: 29376
using System;
using System.Collections.Generic;

class Hoge {
    public static void Main()
    {
        /*
        string[] str = Console.ReadLine().Split(' ');
        int a = int.Parse(str[0]);
        int b = int.Parse(str[1]);
        List<int> aa = new List<int> { };

        aa.Add(a + b);
        aa.Add(a - b);
        aa.Add(a * b);
        int max = aa[0];

        if(max < aa[1])
        {
            max = aa[1];
        }
        if (max < aa[2])
        {
            max = aa[2];
        }
        Console.WriteLine(max);
        */

        string[] str = Console.ReadLine().Split(' ');
        int k = int.Parse(str[0]);
        int x = int.Parse(str[1]);

        for(int i = x - k + 1; i < x + k - 1; i++)
        {
            Console.Write("{0} ", i);
        }
        Console.WriteLine(x + k - 1);

    }
}

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

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

using namespace std;

int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    vector<int> black, white(n);
    black.push_back(0);
    white[n] = 0;
    for(int i = 1; i <= n; i++){
        if(s[i-1] == '#'){
            black.push_back(black[i-1] + 1);
        }else{
            black.push_back(black[i-1]);
        }
        if(s[n-(i-1)] == '.'){
            white[n-i] = white[n-(i-1)] + 1;
        }else{
            white[n-i] = white[n-(i-1)];
        }
    }
    int min = -1;
    rep(i,n){
        if(min == -1 || min > black[i] + white[i]) {
            min = black[i] + white[i];
        }
    }
    cout << min << endl;
}


Measured memory_bytes: 2428
N, M = map(int, input().split())

mod = 10**9+7
dp = [0]*(N+1)
dp[0] = 1
for i in range(1, M+1):
    a = int(input())
    dp[a] = -1
for i in range(0, N-1):
    if dp[i] == -1:
        continue
    if dp[i+1] != -1:
        dp[i+1] += dp[i]%mod
        dp[i+1] %= mod
    if dp[i+2] != -1:
        dp[i+2] += dp[i]%mod
        dp[i+2] %= mod
if dp[-2] != -1:
    dp[-1] += dp[-2]%mod
    dp[-1] %= mod
print(dp[-1])

Measured memory_bytes: 6900
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h> 
#include <set>
#include <map>

using namespace std;

#define ll long long int
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, n) for(int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
using vi = vector<int>;
using vs = vector<string>;
const int MOD = 1e9 + 7;



int Get_Digit(ll A) {
    int digits = 0;
    while (A > 0) {
        A /= 10;
        digits++;
    }
    return digits;
}

int main() {
    string A, B;
    cin >> A >> B;
    int a = A.size();
    int b = B.size();
    string ans;
    if (a > b) ans = "GREATER";
    else if(a < b) ans = "LESS";
    else {
        if (A > B) ans = "GREATER";
        else if (A < B) ans = "LESS";
        else ans = "EQUAL";
    }
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

const int MOD = 1000000007;

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

    int N;
    cin >> N;

    vector<ll> table(N+1, 0);

    for (int i = 2; i <= N; i++) {
        int num = i;
        for (int j = 2; j <= N; j++) {
            while (num % j == 0) {
                table[j]++;
                num /= j;
            }
        }
    }

    ll ans = 1;
    for (auto e : table) {
        ans *= (e + 1);
        ans %= MOD;
    }

    cout << ans << "\n";
}

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

int D, G;
//vector<int> p(D), c(D);
vector<int> p(20), c(20);

int ans = 1e9;

void rec(int sum, int counter, int i, vector<bool> D_bool) {
  if (i == D) {
    if (sum >= G) {
      ans = min(ans, counter);
    }
    else {
      rrep(j,D-1) {
        if (D_bool.at(j)) 
          continue;
        else {
          for (int l = 0; l < p.at(j)-1 && sum < G; l++) {
            sum += 100*(j+1);
            counter++;
          }
          if (sum >= G) ans = min(ans,counter);
        }
      }
    }
  }
  else {
    D_bool.at(i) = false;
    rec(sum, counter, i+1, D_bool);
    
    D_bool.at(i) = true;
    rep(j,p[i]) {
      sum += 100*(i+1);
      counter++;
    }
    sum += c.at(i);
    rec(sum, counter, i+1, D_bool);
  }
}

int main() {
  cin >> D >> G;
  rep(i,D) cin >> p.at(i) >> c.at(i);
  
  vector<bool> vec_bool(D, false);
  
  rec(0,0,0,vec_bool);
  
  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#ifndef LOCAL
#define endl '\n'
#endif

const int mod = 1e9 + 7;

int pwr(int a,int b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

const int N = 1e5 + 5;
int n, a[N];
vector<int> v1, v2, v3, v4;

void gen(int i,int j,int k) {
	int n = 2 * i + 2 * j + k;
	for(int p = 1; p <= n; p++) {
		if(p <= 2 * i) {
			if(p & 1) {
				a[p] = v1.back();
				v1.pop_back();
			}
			else {
				a[p] = v4.back();
				v4.pop_back();
			}
		}
		else if(p <= 2 * i + 2 * j) {
			a[p] = v2.back();
			v2.pop_back();
		}
		else {
			a[p] = v3.back();
			v3.pop_back();
		}
	}
	sort(a + 1, a + n + 1);
}

bool check() {
	int g = 0;
	ll s = 0;
	for(int i = 1; i <= n; i++) {
		g = __gcd(g, a[i]);
		s += a[i];
	}
	if(g != 1) {
		return 0;
	}
	for(int i = 1; i <= n; i++) {
		if(__gcd((ll)a[i], s) == 1){
			return 0;
		}
	}
	sort(a + 1, a + n + 1);
	int nn = unique(a + 1, a + n + 1) - a - 1;
	if(n != nn) return 0;
	return 1;
}

void solve() {
	cin >> n;
	int c1 = 0, c2 = 0;
	for(int i = 30000; i >= 1; i--) {
		if(i % 6 == 0) {
			v3.push_back(i);
		}
		else if(i % 3 == 0) {
			v2.push_back(i);
		}
		else if(i % 2 == 0) {
			if((i / 2) % 3 == 1) {
				v1.push_back(i);
			}
			else {
				v4.push_back(i);
			}
		}
	}
	if(n == 3) {
		cout << "2 5 63" << endl;
	}
	else if(n == 4) {
		cout << "2 5 20 63" << endl;
	}
	else {
		for(int i = 1; i <= 5000; i++) {
			for(int j = 1; j <= 2500; j++) {
				if(n - 2 * i - 2 * j >= 0 && n - 2 * i - 2 * j <= 5000) {
					gen(i, j, n - 2 * i - 2 * j);
					for(int i = 1; i <= n; i++) {
						cout << a[i] << " ";
					}
					cout << endl;
					assert(check());
					return;
				}
			}
		}
	}
}

signed main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	// cin >> t;
	t = 1;
	for(int tt = 1; tt <= t; tt++) {
		// cout << "Case #" << tt << ": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 640
import numpy as np
def q52(n, l):
    maxarg = np.argmax(l)
    m = max(l)
    del l[maxarg]
    if m < sum(l):
        return 'Yes'
    else:
        return 'No'

N = int(input())
L = [int(i) for i in input().split()]
print(q52(N, L))

Measured memory_bytes: 12516
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int n;
vvi G;
int dfs(int a,int p){
	vi t;
	rep(i,G[a].size())if(G[a][i]-p)t.pb(dfs(G[a][i],a));
	if(t.size()==0)return 1;
	int w=0;
	rep(i,20){
		int c=0;
		rep(j,t.size())if(t[j]&1<<i)c++;
		if(c>1)w=i;
	}
	int b=0;
	rep(i,t.size())b|=t[i];
	loop(j,w,20)if((b&1<<j)==0){
		b>>=j;
		b++;
		b<<=j;
		return b;
	}
}
signed main(){
	cin>>n;
	G=vvi(n);
	rep(i,n-1){
		int a,b;
		cin>>a>>b;
		a--;b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	int a=dfs(0,-1);
	for(int i=19;i>=0;i--)if(a&1<<i){
		cout<<i<<endl;
		return 0;
	}
}















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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;


signed main(){
    int N, T;
    int c[100], t[100];
    cin >> N >> T;
    REP(i, N) cin >> c[i] >> t[i];
    int ans = INT32_MAX;
    REP(i, N){
        if(t[i] <= T) ans = min(ans, c[i]);
    }
    if(ans == INT32_MAX) PRINT("TLE");
    else PRINT(ans);
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n,m; cin>>n>>m;
	VI ans(n); rep(i,n) ans[i]=-1;

	rep(i,m){
		int s,c; cin>>s>>c; s--;
		if((ans[s]!=-1&&ans[s]!=c)||(s==0&&c==0&&n!=1)) return cout<<-1<<endl,0;
		ans[s] = c;
		rep(j,n) cerr << ans[j] << ' ';
		cerr << endl;
	}

	if(m==0){
		if(n==1) return cout<<0<<endl,0;
		return cout<<(int)pow(10,n-1)<<endl,0;
	}

	rep(i,n){
		if(ans[i]==-1){
			if(i==0) cout << 1;
			else cout<<0;
		}
		else cout<<ans[i];
	}
	cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int seat[17] = {0};
	int X = 0;
	int stop[100] = {0};
	int time = 0;
	queue<int> Q;
	while(X < 100){
		int x;
		if(time%5 == 0 && time < 500){
			Q.push(time/5);
		}
		while(1){
			if(Q.size())x = Q.front();
			else x = -1;
			bool f = false;
			
			if(~x){
				int people = (x%5==1?5:2);
				int use = 19 + 3 * (x%3) + 17 * (x%2);
				rep(i,17-people+1){
					bool flag = true;
					rep(j,people){
						flag &= seat[i+j] == 0;
					}
					if(flag){
						rep(j,people){
							seat[i+j] = use;
						}
						f = true;
						break;
					}
				}
			}
			if(f){	
				stop[x] = time - x * 5;
				Q.pop();
				X++;
			}
			if(!f)break;
		}
		rep(i,17){
			seat[i] = max(0,seat[i]-1);
		}
		time++;
	}
	int n,c=0;
	
	while(cin >> n){
		if(n == 5)c++;
		cout << stop[n] << endl;
	}
	int a = 0;
	while(c>=1){cout << a/a << endl;};
	
}

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

template <int M> class ModInt {
    int x;

  public:
    constexpr ModInt() : x(0) {}
    constexpr ModInt(int64_t y) : x(y >= 0 ? y % M : (M - (-y) % M) % M) {}
    constexpr ModInt &operator+=(const ModInt p) {
        if((x += p.x) >= M) x -= M;
        return *this;
    }
    constexpr ModInt &operator-=(const ModInt p) {
        if((x += M - p.x) >= M) x -= M;
        return *this;
    }
    constexpr ModInt &operator*=(const ModInt p) {
        x = (int)(1LL * x * p.x % M);
        return *this;
    }
    constexpr ModInt &operator/=(const ModInt p) {
        *this *= p.inverse();
        return *this;
    }
    constexpr ModInt operator-() const { return ModInt(-x); }
    constexpr ModInt operator+(const ModInt p) const {
        return ModInt(*this) += p;
    }
    constexpr ModInt operator-(const ModInt p) const {
        return ModInt(*this) -= p;
    }
    constexpr ModInt operator*(const ModInt p) const {
        return ModInt(*this) *= p;
    }
    constexpr ModInt operator/(const ModInt p) const {
        return ModInt(*this) /= p;
    }
    constexpr bool operator==(const ModInt p) const { return x == p.x; }
    constexpr bool operator!=(const ModInt p) const { return x != p.x; }
    constexpr ModInt inverse() const {
        int a = x, b = M, u = 1, v = 0, t = 0;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }
    constexpr ModInt pow(int64_t k) const {
        ModInt ret(1), mul(x);
        while(k > 0) {
            if(k & 1) ret *= mul;
            mul *= mul;
            k >>= 1;
        }
        return ret;
    }
    constexpr friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }
    constexpr friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t = 0;
        is >> t;
        a = ModInt(t);
        return (is);
    }
};
using mint = ModInt<1000000007>;

int N, D;

int K[10009];

mint dp[10009][2][109];

int main() {
    string s;
    cin >> s;
    N = s.size();
    for(int i = 0; i < N; i++)
        K[i] = s[i] - '0';

    cin >> D;

    dp[0][1][0] = 1;

    for(int i = 0; i < N; i++) {
        for(int d = 0; d < D; d++) {
            // 0 -> 0
            for(int k = 0; k < 10; k++)
                dp[i + 1][0][(d + k) % D] += dp[i][0][d];
            // 1 -> 0
            for(int k = 0; k < K[i]; k++)
                dp[i + 1][0][(d + k) % D] += dp[i][1][d];
            // 1 -> 1
            dp[i + 1][1][(d + K[i]) % D] += dp[i][1][d];
        }
    }

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

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll t1,t2,a1,b1,a2,b2;
    cin>>t1>>t2>>a1>>a2>>b1>>b2;
    // a1>b1としたい
    if(b1>a1){
        swap(a1,b1);
        swap(a2,b2);
    }

    ll da1 = a1*t1;
    ll da2 =a2*t2;
    ll db1 = b1*t1;
    ll db2 = b2*t2;

    ll a =0;
    ll b =0;

    ll x = da1-db1;
    ll dx = da1-db1+da2-db2;
    if(dx>0){
        cout<<0<<endl;
        return 0;
    }
    if(dx==0){
        cout<<"infinity"<<endl;
        return 0;
    }

    ll ans = x/abs(dx);

//    dbg(x);
//    dbg(dx);

    if(x%abs(dx)==0){
        cout<<ans*2<<endl;
    }else{
        cout<<ans*2+1<<endl;
    }

    return  0;
}


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

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const LL INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

int go(VI a)
{
	while(SZ(a) != 1)
	{
		/*FOR (i, 0, SZ(a))
		{
			cout<<a[i]<<' ';
		}
		cout<<endl;*/
		VI b;
		FOR (i, 0, SZ(a) - 2)
		{
			VI c;
			c.PB(a[i]);
			c.PB(a[i+1]);
			c.PB(a[i+2]);

			sort(ALL(c));
			b.PB(c[1]);
		}

		a = b;
	}

	return a[0];
}

bool check(int n, int x, VI a)
{
	if (x == 1 || x == 2*n-1)
	{
		if (a[0] == -1) return true;
		return false;
	}

	if (SZ(a) != n * 2 - 1) return false;
	set<int> s;
	FOR (i, 0, SZ(a))
	{
		if (s.count(a[i])) return false;
		s.insert(a[i]);
		if (a[i] < 1 || a[i] > 2 * n - 1) return false;
	}

	if (go(a) != x) return false;
	return true;
}

VI solve(int n, int x)
{
	if (n == 2)
	{
		if (x == 2)
		{
			VI res;
			res.PB(1);
			res.PB(2);
			res.PB(3);
			return res;
		}

		return VI(1, -1);

	}


	n = 2 * n - 1;

	if (x == 1 || x == n)
	{
		return VI(1, -1);
	}

	VI a;
	if (x > 2)
	{
		int v = 1;
		FOR (i, 0, n / 2 - 1)
		{
			while(v >= x-2 && v <= x + 1) v++;
			a.PB(v);
			v++;
		}
		a.PB(x-1);
		a.PB(x);
		a.PB(x + 1);
		a.PB(x - 2);

		while(SZ(a) < n)
		{
			while(v >= x-2 && v <= x + 1) v++;
			a.PB(v);
			v++;
		}
	}
	else
	{
		int v = 1;
		FOR (i, 0, n / 2 - 1)
		{
			while(v >= x-1 && v <= x + 2) v++;
			a.PB(v);
			v++;
		}
		a.PB(x+1);
		a.PB(x);
		a.PB(x - 1);
		a.PB(x + 2);

		while(SZ(a) < n)
		{
			while(v >= x-1 && v <= x + 2) v++;
			a.PB(v);
			v++;
		}
	}

	return a;
}

int main()
{
	//freopen("in.txt","r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int n, x;
	cin>>n>>x;
	//FOR (n, 2, 100)
	{
		//FOR (x, 1, n*2)
		{

			VI res = solve(n, x);

			if (res[0] == -1) cout<<"No"<<endl;
			else
			{
				cout<<"Yes"<<endl;
				FOR (i, 0, SZ(res))
				{
					cout<<res[i]<<"\n";
				}
			}
			/*bool b =check(n, x, res);
			if (!b)
			{
				cout<<n<<' '<<x<<endl;
				throw -1;
			}*/

		}
	}
//	cout<<endl<<go(a)<<endl;

}


Measured memory_bytes: 2420
#include<stdio.h>
int main(void)
{
	int n,p[100],i,j,x,y[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&p[i]);
	}
	
	for(i=n;i>0;i--){
		x=0;
		for(j=0;j<n;j++){
			if(i<=p[j]){
				x++;
			}
		}
		if(x>=i){
			break;
		}
	}
	printf("%d\n",i);
	return 0;
}


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

int main() {
  string S,T;
  int A=0,i;
  cin >> S >> T;
  for ( i = 0; i < 3; i++)
  {
    if (S[i]==T[i])
    {
      A++;
    }
  }
  
  cout << A << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <utility>
#include <algorithm>

using namespace std;

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

ll gcd(ll a,ll b){
    if(a==0) return b;
    if(b==0) return a;
    if(a>b) return gcd(a-(a/b)*b,b);
    return gcd(a,b-(b/a)*a);
}



int main(){
    int N;
    ll A[100000];
    cin>>N;
    rep(i,N) cin>>A[i];
    ll ans=0;
    ll front[100000],back[100000];
    rep(i,N){
        if(i==0){
            front[i]=A[i];
            back[i]=A[N-1-i];
        }else{
            front[i]=gcd(front[i-1],A[i]);
            back[i]=gcd(back[i-1],A[N-1-i]);
        }
    }
    rep(i,N){
        if(i==0) ans=back[N-2];
        else if(i<N-1) ans=max(ans,gcd(front[i-1],back[N-2-i]));
        else ans=max(ans,front[N-2]);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  int t[10];

  for(int i = 0; i < 10; i++){
    cin >> t[i];
  }
  sort(t, t + 10, greater<int>());

  for(int i = 0; i < 3; i++){
    cout << t[i] << endl;
  }
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,sa,ga,d;
string s[31];
bool ch(){
  int sx=sa;
  r(i,d){
    if(!sx){
      if(s[i][0]=='1')sx++;
    }
    else if(sx==n-1){
      if(s[i][n-2]=='1')sx--;
    }
    else{
      if(s[i][sx]=='1')sx++;
      else if(s[i][sx-1]=='1')sx--;
    }
  }
  return sx==ga;
}
int main(){
  while(cin>>n,n){
  cin>>sa>>ga>>d;sa--;ga--;
  r(i,d)cin>>s[i];
  r(i,d)s[i]+='0';
  if(n==1){
    if(sa==ga)cout<<0<<endl;
    else cout<<1<<endl;
  }
  else{
  if(ch()){cout<<0<<endl;goto L;}//r(k,d)cout<<s[k]<<endl;
  r(i,d)r(j,n-1){
    if(!j){
      if(s[i][0]=='0'&&s[i][1]=='0'){
        s[i][0]='1';
        if(ch()){cout<<i+1<<' '<<j+1<<endl;goto L;}
        s[i][0]='0';
      }
    }
    else if(j==n-2){
      if(s[i][j]=='0'&&s[i][j-1]=='0'){
        s[i][j]='1';
        if(ch()){cout<<i+1<<' '<<j+1<<endl;goto L;}
        s[i][j]='0';
      }
    }
    else{
      if(s[i][j]=='0'&&s[i][j+1]=='0'&&s[i][j-1]=='0'){
        s[i][j]='1';
        if(ch()){cout<<i+1<<' '<<j+1<<endl;goto L;}
        s[i][j]='0';
      }
    }
  }
  cout<<1<<endl;L:;}
  }
}

Measured memory_bytes: 3048
import collections 
n,k=map(int,input().split())
c=list(map(int,input().split()))
l=collections.Counter(c)
s=l.most_common()
p=[]
if len(s)<=k:
    print(0)
else:
    d=0
    for a,b in s[:k]:
        d+=b
    print(n-d)

Measured memory_bytes: 39312
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m=map(int,input().split())
    E=[[] for _ in range(n)]
    for _ in range(m):
        x,y,z=map(int,input().split())
        x-=1; y-=1
        E[x].append(y)
        E[y].append(x)

    visited=[0]*n
    def dfs(v,p)->bool:
        if(visited[v]):
            return False
        visited[v]=1
        for nv in E[v]:
            if(nv==p): continue
            dfs(nv,v)
        return True

    ans=0
    for v in range(n):
        ans+=dfs(v,-1)
    print(ans)
resolve()

Measured memory_bytes: 129020
package main

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

var sc = bufio.NewScanner(os.Stdin)
func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	n := scanInt()

	a := make([]int64,n)
	for i := 0; i < n; i++ {
		a[i] = int64(scanInt())
	}

	x := make([]int64, n)

	for i := 0; i < n; i++ {
		if i%2==0 {
			x[0] += a[i]
		} else {
			x[0] -= a[i]
		}
	}
	
	for i := 0; i < n; i++ {
		if i == 0 {
			fmt.Print(x[0])
			continue
		} else {
			fmt.Print(" ")
		}

		x[i] = 2*a[i-1]-x[i-1]
		fmt.Print(x[i])
	}

	fmt.Print("\n")
	
}


Measured memory_bytes: 6528
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split(' ').ToList();
        if (input[1] == "+")
        {
            Console.WriteLine(int.Parse(input[0]) + int.Parse(input[2]));
        }
        else
        {
            Console.WriteLine(int.Parse(input[0]) - int.Parse(input[2]));
        }
    }
}

Measured memory_bytes: 13268
fun main(args: Array<String>) {
    var first: String = getInputStr()

    var count = 0
    first.reduce { a, b ->
        var num = b
        if(a.equals(b)) {
            if(a.equals('0')) {
                num = '1'
            } else {
                num = '0'
            }
            count++
        }
        num
    }
    println(count)
}

fun getInputStr() : String {
    return readLine()!!.toString()
}

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

using namespace std;

int main() {
  int n, q;
  cin >> n >> q;
  vector<queue<int> > que(n);
  while(q--) {
    int k, t;
    cin >> k >> t;
    if(k == 0) {
      int x;
      cin >> x;
      que[t].push(x);
    } else if(k == 1) {
      if(que[t].empty()) continue;
      cout << que[t].front() << endl; // error
    } else if(k == 2) {
      if(que[t].empty()) continue;
      que[t].pop(); // error
    } else {
      assert(false);
    }
  }
  return 0;
}



Measured memory_bytes: 4236