akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define PB push_back
#define ll long long
using namespace std;
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n, k;
	cin >> n >> k;
	
	ll a[n+1], p = 1, ind = 0, m;
	bool vis[n+1];
	
	vector<ll> pe;
	for (ll i = 1; i <= n; i++) {
		cin >> a[i];
		vis[i] = 0;
	}
	while (vis[p] == 0) {
		pe.PB(p);
		vis[p] = 1;
		p = a[p];
	}
	while (pe[ind] != p) ind++;
	if (k < pe.size()) cout << pe[k];
	else {
		m = pe.size() - ind;
		ll q = (k-ind)%m+ind;
		cout << pe[q];
	}
}

Measured memory_bytes: 7088
def resolve():
    n = int(input())
    al = list(map(int, input().split()))
    al = sorted(al, reverse=True)
    an = 0
    bn = 0
    for i in range(n):
        if i % 2 == 0:
            an += al[i]
        elif i % 2 == 1:
            bn += al[i]
    print(an - bn)
resolve()

Measured memory_bytes: 9116
use std::cmp;
use whiteread::parse_line;

fn main() {
    let (_n, m, x): (usize, usize, usize) = parse_line().unwrap();
    let a: Vec<usize> = parse_line().unwrap();

    let small = a.iter().filter(|s| **s < x).count();
    let large = m - small;
    println!("{}", cmp::min(small, large));
}


Measured memory_bytes: 2160
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            final int n = in.nextInt();
            int z = in.nextInt();
            int w = in.nextInt();
            List<Integer> a = new ArrayList<>();
            for (int i = 0; i < n; i++) a.add(in.nextInt());

            if (n == 1) {
                out.println(Math.abs(a.get(0) - w));
            } else {
                out.println(Math.max(Math.abs(a.get(a.size() - 1) - w), Math.abs(a.get(a.size() - 2) - a.get(a.size() - 1))));
            }
        }

    }
}



Measured memory_bytes: 26068
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
const int INF (1<<30);

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

  ll ans = 0LL;
  if (((b-a)%2LL) == 0) {
    ans = (b-a) / 2LL;
  } else if (a <= (n-b+1LL)) {
    ans += (a-1LL);
    b = b - (a-1LL);
    a = 1LL;
    b -= 1LL;
    ans += 1LL;
    ans += (b-a) / 2LL;
  } else {
    ans += (n-b);
    a = a + (n-b);
    b = n;
    a += 1LL;
    ans += 1LL;
    ans += (b-a) / 2LL;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
S = input()
C = [0] * 26
for s in S:
    C[ord(s)-ord('A')] += 1
v = 0
for  c in C:
    if c == 2:
        v += 1
    elif c != 0:
        print('No')
        break
if v == 2:
    print('Yes')




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

int main() {
	string S;
	cin >> S;
	string T = S.substr(0, (S.size() - 1) / 2);
	string RS = S, RT = T;
	reverse(RS.begin(), RS.end()), reverse(RT.begin(), RT.end());
	if (RS == S && RT == T) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


M = Mod(10**9+7)
def C(n, r):
    ans = 1
    for i in range(r):
        ans = M.mul(ans, n - i)
        ans = M.div(ans, i+1)
    return ans

@mt
def slv(N, A, B):

    # C = Combination(N, 10**9+7)
    ans = M.pow(2, N)
    ans = M.sub(ans, 1)
    ans = M.sub(ans, C(N, A))
    ans = M.sub(ans, C(N, B))
    return ans


def main():
    N, A, B = read_int_n()
    print(slv(N, A, B))


if __name__ == '__main__':
    main()


Measured memory_bytes: 61804
#!/usr/bin/env python3
import sys


def solve(N: int, L: "List[int]"):
    from itertools import combinations
    from bisect import bisect_left as bl
    L = sorted(L)
    ans = 0
    for ai, a in enumerate(L):
        for bi, b in enumerate(L[ai+1:-1], ai+1):
            ci = bl(L, a+b)
            ans += ci - bi - 1
    return ans

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    L = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, L))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 9360
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N; cin >> N;
    vector<int> A(N); for (int& a : A) cin >> a;
    vector<int> B(N); for (int& b : B) cin >> b;
    vector<int> C;
    long long acc = 0, cnt = 0;
    for (int i = 0; i < N; i++) {
        int t = A[i] - B[i];
        if (t > 0) C.push_back(t);
        if (t < 0) acc += -t, cnt++;
    }
    if (cnt == 0) {
        cout << 0 << endl;
        return 0;
    }
    sort(rbegin(C), rend(C));
    for (int i = 0; i < C.size(); i++) {
        acc -= C[i];
        if (acc <= 0) {
            cout << cnt + i + 1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

ll count(ll n){
  ll res = 0;
  ll d = 10;
  while(d <= n){
    res += n / d;
    d *= 5;
  }
  return res;
}

int main(){
  ll N;
  cin >> N;
  if(N % 2 == 0){
    cout << count(N) << endl;
  }else{
    cout << 0 << endl;
  }
}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

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

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

int n, m;
double p[17][17];
double dp[17][1<<16];

double solve(int room, int bit) {
  if(room == n) return 1;
  double& res = dp[room][bit];
  if(res != -1) return res;
  res = 0;
  rep(i, m) if(!((bit>>i)&1)) {
    double tmp = 0, r = 1;
    reps(j, room, n+1) {
      tmp += r*(1-p[i][j])*solve(j, bit|1<<i);
      r *= p[i][j];
    }
    chmax(res, tmp);
  }
  return res;
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin >> m >> n;
  rep(i, m) {
    rep(j, n) cin >> p[i][j];
    p[i][n] = 0;
  }
  fill(dp[0], dp[16], -1);
  cout << solve(0, 0) << endl;

  return 0;
}

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

int main() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	vector<vector<int>> dp(n+1, vector<int>(n+1));
	for(int i = n-1; i >= 0; i--) {
		for(int j = n-1; j >= 0; j--) {
			if(s[i] != s[j]) continue;
			dp[i][j] = dp[i+1][j+1] + 1;
		}
	}
	rep(i, n) rep(j, n) {
		if(i >= j) continue;
		int now = min(dp[i][j], j-i);
		ans = max(ans, now);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 98176
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   String str = sc.next();
if(str.charAt(0) == str.charAt(1) ||str.charAt(1) == str.charAt(2) ||str.charAt(2) == str.charAt(3) ){
   System.out.println("Bad");       
    }else{
   System.out.println("Good");       
    }
 }
}

Measured memory_bytes: 25172
#include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;
int main()
{    cout<<fixed<<setprecision(10);
    double h,m,a,b;
    cin>>a>>b>>h>>m;
    double theta=(((h+m/60)*330)/360)*(2*acos(-1));
    cout<<sqrt(a*a+b*b-2*a*b*cos(theta));
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

ll eql[110][5];
ll wngr[110][5];

int main(){
	string s; int k; cin >> s >> k;
	eql[1][1] = 1;
	wngr[1][1] = (s[0]-'0')-1;
	wngr[1][0] = 1;
	for( int i = 1; i < s.size(); ++i ){
		int d = s[i] - '0';
		wngr[i+1][0] = wngr[i][0];
		wngr[i+1][1] = 9*wngr[i][0] + wngr[i][1]; 
		wngr[i+1][2] = 9*wngr[i][1] + wngr[i][2];
		wngr[i+1][3] = 9*wngr[i][2] + wngr[i][3];
		if( d != 0 ){
			wngr[i+1][1] += eql[i][0]*(d-1) + eql[i][1];
			wngr[i+1][2] += eql[i][1]*(d-1) + eql[i][2];
			wngr[i+1][3] += eql[i][2]*(d-1) + eql[i][3];
		}
		if( d != 0 ) {
			eql[i+1][3] = eql[i][2];
			eql[i+1][2] = eql[i][1];
			eql[i+1][1] = eql[i][0];
		} else {
			eql[i+1][0] = eql[i][0];
			eql[i+1][1] = eql[i][1];
			eql[i+1][2] = eql[i][2];
			eql[i+1][3] = eql[i][3];
		}
	}
	cout << eql[s.size()][k] + wngr[s.size()][k] << endl;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

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

    ll H, W;
    cin >> H >> W;

    if (H%3 == 0 || W%3 == 0) {
        cout << 0 << endl;
        return 0;
    } 

    ll ans = INF;
    for (ll i = 1; i < H; i++) {
        ll tmp1 = i*W;
        if ((H-i)%2 == 0) {
            ll tmp2 = ((H-i)/2)*W;
            ans = min(ans, abs(tmp1-tmp2));
        } else {
            ll tmp2 = ((H-i)/2)*W;
            ll tmp3 = ((H-i)/2+1)*W;

            ll tmp4 = max(tmp1, max(tmp2, tmp3));
            ll tmp5 = min(tmp1, min(tmp2, tmp3));
            ans = min(ans, abs(tmp4-tmp5));
        }
    }
    for (ll i = 1; i < H; i++) {
        ll tmp1 = i*W;
        if (W%2 == 0) {
            ll tmp2 = (W/2)*(H-i);
            ans = min(ans, abs(tmp1-tmp2));
        } else {
            ll tmp2 = (W/2)*(H-i);
            ll tmp3 = ((W/2)+1)*(H-i);

            ll tmp4 = max(tmp1, max(tmp2, tmp3));
            ll tmp5 = min(tmp1, min(tmp2, tmp3));
            ans = min(ans, abs(tmp4-tmp5));
        }
    }
    for (ll i = 1; i < W; i++) {
        ll tmp1 = i*H;
        if ((W-i)%2 == 0) {
            ll tmp2 = ((W-i)/2)*H;
            ans = min(ans, abs(tmp1-tmp2));
        } else {
            ll tmp2 = ((W-i)/2)*H;
            ll tmp3 = ((W-i)/2+1)*H;

            ll tmp4 = max(tmp1, max(tmp2, tmp3));
            ll tmp5 = min(tmp1, min(tmp2, tmp3));
            ans = min(ans, abs(tmp4-tmp5));
        }
    }
    for (ll i = 1; i < W; i++) {
        ll tmp1 = i*H;
        if (H%2 == 0) {
            ll tmp2 = (H/2)*(W-i);
            ans = min(ans, abs(tmp1-tmp2));
        } else {
            ll tmp2 = (H/2)*(W-i);
            ll tmp3 = ((H/2)+1)*(W-i);

            ll tmp4 = max(tmp1, max(tmp2, tmp3));
            ll tmp5 = min(tmp1, min(tmp2, tmp3));
            ans = min(ans, abs(tmp4-tmp5));
        }
    }

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

Measured memory_bytes: 256
n = int(input() )
for i in range(n):
    a, b, c = [int(x) for x in input().split()]
    if (b > a):
        a, b = b, a
    if (c > a):
        a, c = c, a #a = max
    if (b*b + c*c - a*a == 0):
        print("YES")
    else:
        print("NO")
    
    
    
    
    


Measured memory_bytes: 5604
[N, K] = [int(i) for i in input().split()]

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

print(len(Base_10_to_n(N, K)))

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

const ll MAX = 1e6;
ll fac[MAX], finv[MAX], inv[MAX];

//前処理
void COMinit (){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(ll i = 2; i < MAX; i++){
        fac[i] = fac[i-1]*i%mod;
        inv[i] = mod-inv[mod%i]*(mod/i)%mod;
        finv[i] = finv[i-1]*inv[i]%mod;
    }
}
//二項係数
ll COM(ll n, ll k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return (fac[n]*(finv[k]*finv[n-k]%mod))%mod;
}

int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    COMinit();
    for(ll i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(),a.end());
    ll ans = 0;
    if(k == 1){
        cout << 0 << endl;
        return 0;
    }
    for(ll i = 0; i <= n-k; i++){
        ans += COM(n-i-1,k-1)*((a[n-i-1]-a[i])%mod);
        ans %= mod;
    }
    cout << (ans+mod)%mod << endl;
    return 0;
}

Measured memory_bytes: 24448
#include <iostream>
#include <cstring>
#include <set>
using namespace std;

const int MAXN = 200010;
int a[MAXN];
int main() {
	int n, k;
	cin>>n>>k;
	for (int i=0; i<n; i++)
		cin>>a[i];
	set<int> s;
	for (int i=0; i<k; i++)
		s.insert(a[i]);
	int ans = 0, flagasc = 0;
	int rcount = 0;
	for (int i=1; i<k; i++)
		if (a[i-1] > a[i])
			rcount++;
	if (rcount)
		ans = 1;
	else
		flagasc = 1;
	for (int i=k; i<n; i++) {
		int round = 0;
		s.erase(a[i-k]);
		if (a[i-k] > a[i-k+1])
			rcount--;

		if (a[i-k] > *s.begin() && rcount != 0)
			round = 1;
		if (a[i] < *s.rbegin())
			round = 1;

		s.insert(a[i]);
		if (a[i-1] > a[i])
			rcount++;
		ans += round;
		if (rcount == 0)
			flagasc = 1;
	}
	cout<<ans + flagasc<<endl;
	return 0;
}

Measured memory_bytes: 10368
import sys
import numpy as np
input = sys.stdin.readline

MOD=10**9+7
N, K = map(int, input().split())
grid = np.empty((0,N), dtype='O')
for i in range(N):
  array = list(map(int, input().strip().split()))
  array2 = np.array(array)
  grid = np.append(grid,[array2],axis=0)
#print(grid)
dp=[[grid]]
gridsave=grid
i=1
while 2**i<=K:
  #print(i)
  #dp.insert(1,grid*grid)
  gridsave=np.dot(dp[i-1][0],dp[i-1][0])
  gridsave=np.mod(gridsave,MOD)
  #print(gridsave)
  dp.append([gridsave])
  i+=1
i-=1
K-=2**i
i-=1
#print('dp',dp)
grid1=dp[len(dp)-1][0]
#print(grid1)
#print(i)
while K>0:
  if K>=2**i:
    #print('i',i)
    grid1=np.dot(grid1,dp[i][0])
    grid1=np.mod(grid1,MOD)
    K-=2**i
    #print('grid1',grid1)
  i-=1
  #print('K',K)
ans=0
#print(grid1)
for i in range(N):
  for j in range(N):
    ans=(ans+grid1[i][j])%MOD
print(ans)


Measured memory_bytes: 18008
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {

		Input input = new Input();
		Converter conv = new Converter();
		String a[]= conv.strArr_(input.input(), "");
		String b[] = conv.strArr_(input.input(), "");
		String c[] = conv.strArr_(input.input(), "");
		int asize = a.length,bsize = b.length,csize = c.length;
		int acount=0,bcount=0,ccount=0;

		String index = a[0];
		acount++ ;

		while(acount<=asize && bcount<=bsize && ccount<=csize) {
			switch(index) {
			case "a":
				if(acount == asize) {
					System.out.println("A");
					acount++;
				}else{
					index = a[acount];
					acount++;
					}
				break;

			case "b":
				if(bcount == bsize) {
					System.out.println("B");
					bcount++;
				}else{
					index = b[bcount];
					bcount++;
					}
				break;

			case "c":
				if(ccount == csize) {
					System.out.println("C");
					ccount++;
				}else{
					index = c[ccount];
					ccount++;
					}
				break;
			}
		}
		}
	}


class Input{

	private String buf;
	BufferedReader bufferdReader = new BufferedReader(new InputStreamReader(System.in));
	
    public String input() {
	try{
		this.buf = bufferdReader.readLine();
	}catch(Exception e) {
	}
	return buf;
	}
}


class Converter{

	private int convInt=0;
	private String convStrArr[];

	public int int_(String convInt){
		this.convInt = Integer.parseInt(convInt);
		return this.convInt;
	}

	public String[] strArr_(String convStrArr,String breakStr){
		this.convStrArr = convStrArr.split(breakStr,0);
		return this.convStrArr;
	}
}


Measured memory_bytes: 33100
//AtCoder ABC082 B - Two Anagrams
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    string s,t;
    cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end(),[](auto&a,auto&b){return a>b;});
    cout<<(s<t?"Yes":"No")<<endl;
    return 0;
}

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

int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	if(n&1)
		cout<<"No\n";
	else
	{
		int j=n/2;
		int i=0;
		while(i<n/2 && j<n)
		{
			if(s[i++]!=s[j++])
			{
				cout<<"No\n"; return 0;
			}
		}
		cout<<"Yes\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxk=1e5+1;
const int maxn=101;
int k,n,arr[maxn];
bool dp[maxk];
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>arr[i];
	dp[0]=0;
	for(int i=1;i<=k;i++)
	{
		bool f=0;
		for(int j=0;j<n;j++)
		{
			if(arr[j]>i)continue;
			if(!dp[i-arr[j]])
			{
				f=1;
				break;
			}
		}
		dp[i]=f?1:0;
	}
	cout<<(dp[k]?"First":"Second")<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#define Mod 1000000007
#define INF 1e14
typedef long long int ll;
const ll N=1e6+5;
bool x[N+1]={false};
ll fast(ll n,ll a)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll res=fast(n/2,a)%Mod;
        if(n%2==0)
        {
            return (((res%Mod)*(res%Mod))%Mod);
        }
        else{
            return (((((res%Mod)*a)%Mod)*res)%Mod);
        }
    }
}
int main()
{
  int n,d;
  cin>>n>>d;
  int a[n][d];
  int i,j;
  for(i=0;i<n;i++)
  {
      for(j=0;j<d;j++)
      {
          cin>>a[i][j];
      }
  }
  int ans=0;
  for(i=0;i<n;i++)
  {
      for(j=0;j<i;j++)
      {
          int dist=0;
          for(int k=0;k<d;k++)
          {
              dist+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
          }
          int y=(int)sqrt(dist);
          if(y*y==dist)
            ans++;
      }
  }
  cout<<ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>

int main(){
 int X,N;
 std::cin>>X>>N;

 std::map<int,int> map;
 int rec=0;
 for(int i=0;i<N;i++){
  std::cin>>rec;
  map[rec]=1;
 }

 int i=0;
 int ans=0;
 while(1){
  if(map[X-i]==0){
   ans=X-i;
   break;
  }else if(map[X+i]==0){
   ans=X+i;
   break;
  }else{
   i++;
  }
 }

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

 return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

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; }

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    int x;
    cin >> x;
    cout << lcm(360, x) / x << endl;
}

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

#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll> 
#define ld long double

const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);

ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{ 
    return os<<'('<<p.F<< ","<<p.S<<')'; 
}

int _runtimeTerror_()
{
    int n;
    cin>>n;
    cout<<(n>=30?"Yes\n":"No\n");
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--)
        _runtimeTerror_();
    return 0;
}

Measured memory_bytes: 3632
/**
       **********    ************
	  Author : Avi J Patel
	  University : DA-IICT
       **********    ************
**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair 
#define mt make_tuple
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define Mod 998244353
#define N 200001
#define large 10000000000000001
#define For(i,m,n) for(long long i=m;i<n;i++)
#define st(x) sort(x.begin(),x.end())
#define re(x,i) reverse(x.begin()+i,x.end())
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    if(a.second < b.second) return true; 
    else if(a.ss==b.ss) return a.ff<b.ff;
	else return false;
}
bool sortbyboth(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.first<b.first) return true;
	else if(a.first==b.first) return a.second<b.second;
	else return false;
}
int main()
{
	FAST
	int a,b;
	cin>>a>>b;
	int r=a-2*b;
	if(r>0)
	cout<<r;
	else
	cout<<0;
	return 0;
}















Measured memory_bytes: 256
import 'dart:io';

void main() {
  String abcd = stdin.readLineSync();
  int i = int.parse(abcd[0]);
  int j = int.parse(abcd[1]);
  int k = int.parse(abcd[2]);
  int l = int.parse(abcd[3]);

  if (i + j + k + l == 7) {
    print("$i+$j+$k+$l=7");
  } else if (i - j + k + l == 7) {
    print("$i-$j+$k+$l=7");
  } else if (i + j - k + l == 7) {
    print("$i+$j-$k+$l=7");
  } else if (i + j + k - l == 7) {
    print("$i+$j+$k-$l=7");
  } else if (i - j - k + l == 7) {
    print("$i-$j-$k+$l=7");
  } else if (i - j + k - l == 7) {
    print("$i-$j+$k-$l=7");
  } else if (i + j - k - l == 7) {
    print("$i+$j-$k-$l=7");
  } else if (i - j - k - l == 7) {
    print("$i-$j-$k-$l=7");
  }
}

Measured memory_bytes: 13204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
void chmin(int &a, int b) {if(a > b) a = b;}

const int mod = 1000000007;
const int inf = 1e9;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};


int main(){
    int n, k;
    cin >> n >> k;
    ll ans = 0;
    if(k%2==0){
        ans += pow(n/k, 3);
        ans += pow(floor((double)n/k+0.5), 3);
    }else{
        ans += pow(n/k, 3);
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
t = int(input())
a = list(map(int, input().split()))
f = 0
for i in range(t):
	if a[i] % 2 == 0 and not (a[i] % 3 == 0 or a[i] % 5 == 0):
		f = 1
		break
if f:
	print("DENIED")
else:
	print("APPROVED")


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

class A {
    static StreamWriter Out = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    static void Main(string[] args) {
        int N;
        Input(out N);
        int[] D;
        Inputs(out D);
        if(N % 2 == 0) {
            Array.Sort(D);
            int S = D[N / 2] - D[N / 2 - 1];
            Print(S);
        } else {
            Print(0);
        }
        Out.Flush();
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void Inputs<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
    static void Print<T>(T s) => Out.WriteLine(s);
    static void Print<T>(params T[] s) => Out.WriteLine(string.Join(" ", s));
    static void Print<T>(IEnumerable<T> e) => Out.WriteLine(string.Join(" ", e));
}

Measured memory_bytes: 27484
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


S = LS2()
r = 0
left,right = [],[]

Q = I()
for i in range(Q):
    A = LS()
    if A[0] == '1':
        r = 1-r
    else:
        f,c = A[1],A[2]
        if (r == 0 and f == '1') or (r == 1 and f == '2'):
            left.append(c)
        else:
            right.append(c)

if r == 0:
    left.reverse()
    print(''.join(left+S+right))
else:
    S.reverse()
    right.reverse()
    print(''.join(right+S+left))




Measured memory_bytes: 100892
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
    s.find_by_order(k) ---> returns iterator to the element at index(from 0) k
    s.order_of_key(val) ---> number of elements that are strictly smaller than the given value
*/
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int tc; cin >> tc; cin.ignore(); while(tc--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define HASH 18014398241046527
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
template <typename T>
ll SIZEOF(T a){return (ll)a.size();}

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





void SOLVE(){
    inps(n, k);
    inpv(a, n);
    sort(all(a));
    ll ans = 0;
    for(ll i=0; i<k; i++){
        ans += a[i];
    }
    cout << ans;
}

int main() {
	fastIO();
	// #ifndef ONLINE_JUDGE
    //     freopen("i.txt", "r", stdin);
    //     freopen("o.txt", "w", stdout);
	// #endif

    ll TC = 1;
    // cin >> TC;
    for(ll tc1=1; tc1<=TC; tc1++){
        // cout << "Case #" << tc1 << ": ";
        SOLVE();
    }
    printclock;
}

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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()


struct IoSetup {
    IoSetup() {
        // cin.tie(nullptr);
        // ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int n; 
vector<int> l;
bool isOK(int index, int key){
    if(l[index] >= key) return true;
    else return false;
}
int binary_search(int key){
    int ng = -1;
    int ok = (int)l.size();

    while(abs(ok-ng)>1){
        int mid = (ok + ng) /2;

        if(isOK(mid,key)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    l.resize(n);
    rep(i, n) cin >> l[i];
    sort(all(l));
    i64 ans = 0;
    rep(i, n - 1){
        rep(j, i + 1, n){
            i64 a = l[i];
            i64 b = l[j];
            i64 left  = binary_search(max(a - b,b - a) + 1);
            i64 right = binary_search(a + b);
            ans += (right - 1) - left + 1;
            if(left <= i && i < right) --ans;
            if(left <= j && j < right) --ans;
        }
    }
    cout << ans / 3 <<endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <memory.h>
#include <set>
#include <cmath>
#define fio ios::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main(void) {
	int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d);
	printf("%d\n", (a - c)*(b - d));
	return 0;
}

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

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

template<typename T, typename U>
istream &operator >> (istream &istr, pair<T,U> &p){
    istr >> p.first >> p.second;
    return istr;
}

template<typename T>
ostream &operator << (ostream &ostr, vector<T> &v){
    if(!v.empty()){
        ostr << v.front();
        for(auto itr = ++v.begin(); itr != v.end(); itr++)
            // ostr << *itr;
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream &operator << (ostream &ostr, pair<T,U> &p){
    // ostr << p.first << p.second;
    // ostr << p.first << ", " << p.second;
    ostr << "(" << p.first << ", " << p.second << ")";
    return ostr;
}

template<typename T>
ostream &operator << (ostream &ostr, vector<vector<T>> &vv){
    if(!vv.empty()){
        ostr << vv.front();
        for(auto itr = ++vv.begin(); itr != vv.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream &operator << (ostream &ostr, vector<pair<T,U>> &vp){
    if(!vp.empty()){
        ostr << vp.front();
        for(auto itr = ++vp.begin(); itr != vp.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<double> vd;
// vll v(n); v[i]=x;
typedef vector<vll> vvll;
typedef vector<vc> vvc;
typedef vector<vd> vvd;
// vvll v(m,vll(n)); v[i][j]=x;
typedef pair<ll,ll> pll;
typedef pair<double,double> pd;
typedef vector<pll> vpll;
typedef vector<pd> vpd;
// vpll v(n); v[i]=make_pair(x,y); v[i].first/second;
// v.front() : v[0]
// v.back()  : v[v.size()-1]

#define PI 3.1415926535897932
#define EPS 1e-12
#define INF ((ll)1e+12)
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<=(b); i++)
#define FORR(i,a,b) for(ll i=(b); i>=(a); i--)
#define fix(x) cout << fixed << setprecision(x)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()

template<typename T> T sum(vector<T> &v){return accumulate(all(v), (T)0);}
template<typename T> inline void sort(vector<T> &v){sort(all(v));}
template<typename T> inline void rsort(vector<T> &v){sort(all(v), greater<T>());}
template<typename T> inline void chmin(T &a, T b){if(a>b) a=b;}
template<typename T> inline void chmax(T &a, T b){if(a<b) a=b;}

int main(){
    ll n;
    cin >> n;
    n %= 10;
    if(n==3){
        cout << "bon" << endl;
    }
    else if(n==0 || n==1 || n==6 || n==8){
        cout << "pon" << endl;
    }
    else{
        cout << "hon" << endl;
    }
    return 0;
}


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

p = [0] * 62

def insert(x):
    for i in range(60, -1, -1):
        if x >> i & 1:
            if not p[i]:
                p[i] = x
                break
            x ^= p[i]

all = 0 
for x in a:
    all ^= x

for i in range(61):
    if all >> i & 1:
        for j in range(n):
            if a[j] >> i & 1:
                a[j] -= (1<<i)

for x in a:
    insert(x)
ans = 0
for i in range(60, -1, -1):
    if p[i]^ans > ans:
      ans = p[i] ^ ans
print(ans + (ans ^ all))


Measured memory_bytes: 77088
import java.util.Scanner;

//Make Purse Light
public class Main {

	public static int minCoin;
	public static int[] coins;
	public static int[] used;
	public static int[] ans;

	public static int returnCoin(int x){
		int s = 0;
		s += x/500;
		x %= 500;
		s += x/100;
		x %= 100;
		s += x/50;
		x %= 50;
		s += x/10;
//		System.out.println("R: " + x + " " + s);
		return s;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean first = true;
		while(true){
			int x = sc.nextInt();
			if(x==0)break;
			if(!first)System.out.println();
			first = false;
			minCoin = Integer.MAX_VALUE;
			coins = new int[4];
			int num = 0;
			for(int i=0;i<4;i++){
				coins[i] = sc.nextInt();
				num += coins[i];
			}
			used = new int[4];
			ans = new int[4];
			for(used[0]=0;used[0]<=coins[0];used[0]++){
				for(used[1]=0;used[1]<=coins[1];used[1]++){
					for(used[2]=0;used[2]<=coins[2];used[2]++){
						for(used[3]=0;used[3]<=coins[3];used[3]++){
							int sum = used[0]*10 + used[1]*50 + used[2]*100 + used[3]*500;
							if(sum >= x && num-(used[0]+used[1]+used[2]+used[3])+returnCoin(sum-x)<minCoin){
								minCoin = num-(used[0]+used[1]+used[2]+used[3])+returnCoin(sum-x);
//								System.out.println("min" + minCoin);
								for(int i=0;i<4;i++)ans[i]=used[i];
							}
						}
					}
				}
			}
			for(int i=0;i<4;i++){
				if(ans[i]!=0){
					System.out.println((i==0?10:i==1?50:i==2?100:500) + " " + ans[i]);
				}
			}
		}
	}
}

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

using namespace std;


int main()
{
  int t;cin>>t;
  int arra[t];
  for(int i=0;i<t;i++)
  {
      cin>>arra[i];
  }
  int cnt=0;
  for(int j=1;j<t-1;j++)
  {
     if((arra[j-1]<arra[j] && arra[j]<arra[j+1])||(arra[j-1]>arra[j] && arra[j]>arra[j+1])) cnt++;
  }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
using namespace std;



int main(){
string s;
cin>>s;
bool ff[256]={0};
for(ll i=0;i<s.size();i++){
  if(ff[s[i]]==true){
    cout<<"no"<<endl;
    return 0;
  }
  ff[s[i]]=true;
}
cout<<"yes"<<endl;




}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include <queue>
#include <functional>

using namespace std;

#define REP(i,n) for(int i=0;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())

typedef long long ll;
typedef tuple<int,int,bool> Tb;


int atcoder(){
    int n,m;
    cin >> n >> m;
    ll ans = 0;
    ll ar[110000] = {};
    ar[0] = 1;
    ll mod = 1000000007;
    
    if(m>n) swap(n,m);
    if(n-m==0 || n-m==1){
        for(int i=1; i<=n; ++i){
            ar[i] = (i * ar[i-1])%mod;
        }
        ans = (ar[n] * ar[m] * (2-n+m)%mod);
    }

    cout << ans << ENT;

    return 0;
}

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


Measured memory_bytes: 1152
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var (H, W) = ReadLine().Split(' ').Select(int.Parse).ToArray();
        var a = Enumerable.Range(0, H).Select(i => ReadLine().ToArray()).ToArray();

        T[][] Flip<T>(T[][] src, int h, int w)
        {
            var dst = new T[w][];
            for (int i = 0; i < w; i++)
            {
                dst[i] = new T[h];
                for (int j = 0; j < h; j++)
                    dst[i][j] = src[j][i];
            }
            return dst;
        }

        var aH = a.Where(_a => _a.Any(x => x == '#')).ToArray();
        var aHFlip = Flip(aH, aH.Length, aH[0].Length);
        var aHWFlip = aHFlip.Where(_a => _a.Any(x => x == '#')).ToArray();
        var aHW = Flip(aHWFlip, aHWFlip.Length, aHWFlip[0].Length);

        foreach (var _a in aHW)
            WriteLine(string.Join("", _a));
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 28764
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int i = 0; i <n; i++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;

using namespace std;
int main(){
    int a[5];
    for(int i=0;i<5;i++)std::cin >> a[i];
    int k=10;int w=0;
    for(int i=0;i<5;i++){
        int b=a[i]%10;
        
        if(b==0)b=10;
        w+=a[i]+10-b;
        k=min(b,k);
    }
    std::cout << w+k-10 << std::endl;
}



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

int main(){
	int n;
	cin>>n;
	int ans=1e9;;
	for(int i=0;i<n;i++){
		int tmp=0;
		int a;
		cin>>a;
		while(a%2==0){
			a/=2;
			tmp++;
		}
		ans=min(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  //vector<int> b(101);
  //b.at(0)=1;
  string S;
  cin >> S;
  int jj=S.length();
  int i, j;
  for (i=j=0; i<jj; i++) {
    if (S.at(i)=='0') j++;
  }
  //cout << i << ":" << j << ":" << jj << endl;////////////////
  j = min(j, jj - j);
  cout << j * 2 << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll mod = 1e9+7;


void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
template<typename T>
T argument(const pair<T, T> &a, const pair<T, T> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

/* 注意 

    1LL<<60 * N とかのオーバーフローに気を付けろ
    制約がヒントになる、ちゃんと全ての制約を見ろ

*/

int const MAX = 2000000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod/i) % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
}
long long COM(int n, int k){
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

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

    COMinit();
    int n, k; std::cin >> n >> k;
    if (n<k) { std::cout << 0 << std::endl; return 0; }
    std::vector<std::vector<ll>> p(1010, std::vector<ll>(1010, 0));
    rep(j, 1010) p[0][j] = 1;
    repr(i, 1, 1010) repr(j, 1, 1010) {
        p[i][j] = p[i][j-1];
        if (i-j>=0) p[i][j] += p[i-j][j];
        chmod(p[i][j]);
    }
    std::cout << p[n-k][k] << std::endl;
    
    return 0;
}


Measured memory_bytes: 57796
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  string s;
  cin>>s;
  rep(i,s.size()-1){
    int k=s.size()-i-2;
    bool ok=true;
    rep(j,k/2) if(s[j]!=s[(k+1)/2+j]) ok=false;
    if(ok){
      cout<<k<<endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(int argc, char const *argv[])
{
	int n,k;
	cin>>n;
	cin>>k;
	int sum=1;
	int max;
	int l,r;
	max=sum;
	while(n>0)
	{
		{
			l=sum*2;
			r=sum+k;
		}
		sum=min(l,r);
		n--;
	}
	cout<<sum;
	return 0;
}

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

using namespace std;

int n, W, v[110], w[110], dp[110][10010];
int calc() {
	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j <= W; j++) {
			if (j < w[i])dp[i][j] = dp[i + 1][j];
			else dp[i][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
		}
	}
	return dp[0][W];
}
int main() {
	int ans;
	cin >> n >> W;
	for (int i = 0; i < n; i++) {
		cin >> v[i] >> w[i];
	}
	ans = calc();
	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 6956