akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define REV(s) (s).rbegin(), (s).rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

int main(){
	int T;
	cin >> T;
	while(T--){
		int c, a, n;
		cin >> c >> a >> n;
		int ans = 0;
		int x = min(c, min(a, n));
		ans += x;
		c -= x, a -= x, n -= x;
		if(a){
			x = min(c/2, a);
			ans += x;
			c -= x*2, a -= x;
		}
		ans += c/3;
		cout << ans << endl;
	}

	return 0;
}

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

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

int main() {
  int N;
  cin >> N;
  if(N%2==0)
    cout << N/2 << endl;
  else
    cout << N/2+1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 998244353LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll h, w, n;
	cin >> h >> w >> n;
	vector<vector<ll>> p(h);
	REP(i, n) {
		ll x, y;
		cin >> x >> y;
		x--; y--;
		p[x].pb(y);
	}
	REP(i, h) sort(ALL(p[i]));
	ll r = 0;
	FOR(i, 1, h) {
		if(p[i].empty()) {
			r++;
			continue;
		}
		if(p[i][0] <= r) {
			cout << i << endl;
			return 0;
		}
		if(p[i][0] != r + 1) r++;
	}
	cout << h << endl;
	return 0;
}

/* --------------------------------------- */


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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int n;

int32_t main()
{
    IOS
    cin>>n;
    cout<<(n-1)*n/2<<endl;
}



Measured memory_bytes: 256
N = int(input())
a = list(map(int,list(input())))
a = list(map(lambda x:x-1,a))
x = 0
num_mod = [0]*N
for i in range(1,N):
  tmp = 0
  t = i
  while t%2==0:
    t//=2
    tmp+=1
  num_mod[i] = num_mod[i-1]+tmp
  
for i,n in enumerate(a):
  if n%2==0:
    continue
  else:
    if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i]):
      x+=1

if x%2!=0:
  print(1)
  
elif 1 in a:
  print(0)

else:
  a = [x//2 for x in a]
  x = 0
  for i,n in enumerate(a):
    if n%2==0:
      continue
    else:
      if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i]):
        x+=1
  if x%2!=0:
    print(2)
  else:
    print(0)

Measured memory_bytes: 58228
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;
const int MAX=100000;
const int mod=1000000007;
int N;
int a[MAX];
int t[MAX];
int min(int a,int b){
  if(a<b)return a;
  else return b;
}
int main(){
  cin >> N;
  for(int i=0;i<N;i++)cin >> t[i];
  for(int i=0;i<N;i++)cin >> a[i];

  int f,g;
  long long int ans=1;
  for(int i=0;i<N;i++){
    if(i==0)f=0;
    else if(t[i-1] < t[i])f=0;
    else f=1;

    if(i==N-1) g=0;
    else if(a[i] > a[i+1])g=0;
    else g=1;

    if(f==0 && g==0){
      if(t[i]==a[i])ans*=1;
      else ans*=0;
    }
    else if(f==0 && g==1){
      if(t[i]<=a[i])ans*=1;
      else ans*=0;
    }
    else if(f==1 && g==0){
      if(t[i] >= a[i]) ans*=1;
      else ans*=0;
    }
    else ans*=min(t[i],a[i]);
    ans%=mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

int sum[2010][2010];

int query(int x1, int y1, int x2, int y2) {
    if(x1 > x2 || y1 > y2) return 0;
    return sum[x2][y2] - sum[x1 - 1][y2] - sum[x2][y1 - 1] + sum[x1 - 1][y1 - 1];

}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K; cin >> N >> K;
    rep(i, N) {
        int x, y; char c;
        cin >> x >> y >> c;
        if (c == 'B') {x += K;}
        sum[x % (K * 2) + 1][y % (K * 2) + 1]++;
    }
    // cout << endl;
    // rep(i, K * 2 + 1) {
    //     rep(j, K * 2 + 1) {
    //         cout << sum[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    rep(i, K * 2 + 1) {
        rep(j, K * 2) {
            sum[i][j + 1] += sum[i][j];
        }
    }
    rep(j, K * 2 + 1) {
        rep(i, K * 2) {
            sum[i + 1][j] += sum[i][j];
        }
    }
    // cout << endl;
    // rep(i, K * 2 + 1) {
    //     rep(j, K * 2 + 1) {
    //         cout << sum[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    int ans = 0;
    rep(i, K + 1) {
        rep(j, K + 1) {
            // x o o o x x
            // x o o o x x
            // o x x x o o
            // o x x x o o
            // o x x x o o
            // x o o o x x
            int sum = 0;
            sum += query(1, 1, i, j);
            sum += query(i + 1, j + 1, i + K, j + K);
            sum += query(i + K + 1, j + K + 1, K * 2, K * 2);
            sum += query(i + K + 1, 1, K * 2, j);
            sum += query(1, j + K + 1, i, K * 2);
            // cout << "*" << 1 << " " << 1 << " " << i << " " << j << " " << query(1, 1, i, j) << endl;
            // cout << "*" << i + 1 << " " << j + 1 << " " << i + K << " " << j + K << " " << query(i + 1, j + 1, i + K, j + K) << endl;
            // cout << "*" << i + K + 1 << " " << j + K + 1 << " " << K * 2 << " "<< K * 2 << " " << query(i + K + 1, j + K + 1, K * 2, K * 2) << endl;
            // cout << "*" <<  i + K + 1 <<" "<< 1 << " " << K * 2 <<" " <<j << " " << query(i + K + 1, 1, K * 2, j) << endl;
            // cout << "*" << 1 << " " << j + K + 1 << " " << i << " " <<K * 2 << " " << query(1, j + K + 1, i, K * 2) << endl;
            // cout << endl;
            ans = max(ans, sum);
            ans = max(ans, N - sum);
        }
        
    }
    cout << ans << endl;

    return 0;
}


// o o o x x x
// o o o x x x
// o o o x x x
// x x x o o o
// x x x o o o
// x x x o o o

// x o o o x x
// x o o o x x
// o x x x o o
// o x x x o o
// o x x x o o
// x o o o x x

// x o o o x x
// x o o o x x
// x o o o x x
// o x x x o o
// o x x x o o
// o x x x o o


Measured memory_bytes: 31744
n,k=map(int,input().split())
l=sorted(list(map(int,input().split())))
mod=10**9+7
fact=[1]*(n+1)
inv=[1]*(n+1)
for i in range(2,n+1):
    fact[i]=i*fact[i-1]%mod
inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(n,1,-1):
    inv[i-1]=inv[i]*i%mod
ans=0
for i in range(n):
    if i>=k-1:
        ans+=l[i]*fact[i]*inv[k-1]*inv[i-k+1]%mod
    if n-i-1>=k-1:
        ans-=l[i]*fact[n-i-1]*inv[k-1]*inv[n-i-1-k+1]%mod
    ans%=mod
print(ans)

Measured memory_bytes: 15056
N, T = map(int, input().split())
c = []
t = []

for i in range(N):
    d, s = map(int, input().split())
    c.append(d)
    t.append(s)

min_c = 1001

for i in range(N):
    if t[i] <= T:
        if min_c > c[i]:
            min_c = c[i]

if min_c == 1001:
    print("TLE")
else:
    print(min_c)


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(x) ll t; cin >> t; x.push_back(t);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<string> vvs;

const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    ll a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22) {
        MSG("bust")
    } else {
        MSG("win")
    }
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        //入力
        double[] tmp = Console.ReadLine().Split().Select(double.Parse).ToArray();
        double w = tmp[0];
        double h = tmp[1];
        double x = tmp[2];
        double y = tmp[3];

        //中心を通って切ることで面積は常に半分
        double ans1 = w * h / 2;

        //xyが中心の場合のみ分割方法が複数ある
        double ans2 = 0;
        if (w / 2 == x && h / 2 == y)
        {
            ans2 = 1;
        }


        Console.WriteLine(ans1 + " " + ans2);
    }

}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define INF 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}

bool cmp(pii a, pii b){
    if(a.ft == b.ft) return a.sd < b.sd;
    return a.ft > b.ft;
}
void solve(){
    ll n, x;
    cin >> n >> x;
    ll a[n];
    rep(i, n) cin >> a[i];
    sort(a, a+n);
    ll s = 0;
    rep(i, n)
    {
        if(x >= a[i]){
            x -= a[i];
            s++;
        }
        else ANS(s);
    }
    if(x)s--;
    cout << s;
}
main(){
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define IOS cin.tie(0); ios::sync_with_stdio(false)
const int INF = 1e9;
using namespace std;

signed main() {
    int N; cin >> N;
    char S[301][301];
    int cnt=0;
    rep(i,N) rep(j,N){
        cin >> S[i][j];
    }
    rep(k,N){
        bool can = true;
        rep(i,N){
            rep(j,N){
                if(i==j) continue;
                if(S[i][(j+k)%N]==S[j][(i+k)%N]);
                else {
                    can = false;
                } 
            }
        }
        if(can) cnt++;
    }
    cout << cnt*N << endl; 

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define M 1e9 + 5
#define C 998244353
#define pi 3.14159265359
#define loop(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
#define rloop(i,a,b) for(ll i = ll(a); i >= ll(b); --i)
#define sloop(i,a) for (std::set<ll>::iterator i = a.begin(); i != a.end(); ++i)
#define pb push_back
#define all(v) v.begin(), v.end()
typedef long long int ll;
typedef unsigned long long int ull;

int solve(){
    ll m=0,n,res=0,flag=0,ans=0,ma=-1,mb=-1;
    cin >> n;
    vector<ll>d1,d2;
    loop(i,0,n){
        ll a,b;
        cin >> a >> b;
        d1.pb(a);
        d2.pb(b);
    }
    loop(i,1,n-1){
        if(d1[i]==d2[i] and d1[i-1]==d2[i-1] and d1[i+1]==d2[i+1]){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    loop(f,0,t){    
        solve();
    }   
}

Measured memory_bytes: 3672
# https://atcoder.jp/contests/abc093/tasks/arc094_a

import itertools
import collections
import bisect

def main():
    A, B, C = map(int, input().split())
    min_v = min(A, B, C)
    A -= min_v
    B -= min_v
    C -= min_v

    z = [A, B, C].count(0)
    if z == 3:
        print(0)
    elif z == 2:
        print(max(A, B, C))
    else:
        D = A if A != 0 else B
        E = C if C != 0 else B
        # print("D = {}, E = {}".format(D, E))
        count = min(D, E) // 2
        min_de = (min(D, E) // 2) * 2
        D -= min_de
        E -= min_de
        # print("{}, {}, min = {}".format(D, E, min_de))
        count += D + E
        print(count)


if __name__ == '__main__':
    main()



# 1 -> -1
# 2 -> -2

Measured memory_bytes: 3316
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

void myReverse(string str);

int main()
{
	string str;
	cin >> str;
	
	myReverse( str );
	
	return 0;
}

void myReverse(string str)
{
	vector<char> v_r_str( str.size() );
	
	int i = 0;
	for(auto it = v_r_str.rbegin(); it != v_r_str.rend(); it++)
	{
		*it = str[i];
		i++;
	}
	
	for(auto it = v_r_str.begin(); it != v_r_str.end(); it++)
		cout << *it;
	cout << endl;
}

Measured memory_bytes: 3220
#include<stdio.h>
#include<stdlib.h>
#define array(N,t) (t*)calloc(N,sizeof(t))
signed main(void)
{
  int N,i,j,p;long long K;
  i=scanf("%d %lld",&N,&K);
  int *A=array(N,int),*town=array(N,int);
  for(i=0;i<N;i++)town[i]=-scanf("%d",&A[i]);
  for(i=0,j=0;;i=A[i]-1,j++)if(town[i]<0)town[i]=j;else break;
  for(p=0;K>0;p=A[p]-1,K--)if(i==p){K%=town[i]-j;if(!K)break;}
  free(A),free(town);
  return printf("%d\n",p+1),0;
}

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

const long long mod = 1000000007LL;
int main()
{
    int N;
    cin >> N;
    vector<int> freq(N + 1, 0);
    for (int n = 1; n <= N; ++n){
        int m = n;
        for (int i = 2; m > 1; ++i){
            while (m % i == 0){
                freq[i] += 1;
                m /= i;
            }
        }
    }
    long long ans = 1LL;
    for (auto f : freq){
        if (f){
            ans = (ans * (f + 1)) % mod;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

int main() {
    int n;
    cin >> n;
    vector<int> a(n-1);
    rep(i, n-1) cin >> a[i];

    vector<int> c(n);
    rep(i, n-1) {
        c[a[i]-1]++;
    }

    rep(i, n) {
        cout << c[i] << endl;
    }
}

Measured memory_bytes: 4776
import sys
range = xrange
input = raw_input

mod = 2019

S = input()
X = [0]
power = 1
for c in reversed(S):
    X.append((int(c) * power + X[-1]) % mod)
    power = power * 10 % mod

counter = [0]*mod
for x in X:
    counter[x] += 1

ans = 0
for c in counter:
    ans += c * (c - 1) // 2
print ans


Measured memory_bytes: 80300
n=int(input())
l=[None for i in range(n)]
for i in range(n):
  l[i]=sorted(input())
l.sort()
l+="l"
cnt=1
ans=0
for i in range(n):
  if l[i]!=l[i+1]:
    ans+=(cnt-1)*cnt//2
    cnt=1
    continue
  cnt+=1
print(ans)


Measured memory_bytes: 92320
'use strict'

function main(input) {
  input = input
    .trim()
    .split(' ')
    .map(v => Number(v))
  const k = input[0]
  const s = input[1]
  let count = 0
  for (let xi = 0; xi <= k; xi++) {
    for (let yi = 0; yi <= k; yi++) {
      const tmp = s - (xi + yi)
      if (tmp >= 0 && tmp <= k) count++
    }
  }

  console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
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 <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

int main() {
  cout << setprecision(10);
  string s;
  cin >> s;
  /*
  LL N = s.size();
  string S(2 * N + 1, '_');
  for (int i = 0; i < N; i++) S[2 * i + 1] = s[i];
  vector<int> R(S.size());
  int i = 0, j = 0;
  while (i < S.size()) {
    while (i - j >= 0 && i + j < S.size() && S[i - j] == S[i + j]) ++j;
    R[i] = j;
    int k = 1;
    while (i - k >= 0 && i + k < S.size() && k + R[i - k] < j)
      R[i + k] = R[i - k], ++k;
    i += k;
    j -= k;
  }
  */
  LL N = s.size();

  LL ans = N * (N - 1) / 2 + 1;
  vector<LL> cnt(26, 0);
  for (char c : s) {
    cnt[c - 'a']++;
  }
  for (auto c : cnt) {
    ans -= c * (c - 1) / 2;
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  set<string> d;
  for (int i = 1; i <= 5; i++) {
    string s;
    for (int j = 0; j < i; j++) {
      s.append("hi");
    }
    d.insert(s);
  }

  string s;
  cin >> s;
  if (d.find(s) == d.end()) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

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

int n ;
ll Z ;

int main(){
  int count = 0 ;
  cin >> n >> Z ;
  ll x[n] , y[n] ;
  for(int i = 0 ; i < n ; i++) cin >> x[i] >> y[i] ;
  for(int i = 0 ; i < n ; i++){
    if(x[i]*x[i] + y[i]*y[i] <= Z*Z) count = count + 1 ;
  }
  cout << count << endl ;
}

Measured memory_bytes: 6672
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main()
{
    long long a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22)cout<<"bust\n";
    else cout<<"win\n";
    return 0;
}


Measured memory_bytes: 384
#!/usr/bin/ruby
R=[]
cx1,cy1,r1=gets.split.map(&:to_f)
cx2,cy2,r2=gets.split.map(&:to_f)
cxd=cx2-cx1
cyd=cy2-cy1
w=cxd**2+cyd**2
d_outer=cxd**2+cyd**2-(r1+r2)**2
if d_outer>-1e-9
	d_outer=0 if d_outer.abs<1e-9
	R<<[r1*(cxd*(r1+r2)+cyd*Math.sqrt(d_outer))/w+cx1,r1*(cyd*(r1+r2)-cxd*Math.sqrt(d_outer))/w+cy1]
	R<<[r1*(cxd*(r1+r2)-cyd*Math.sqrt(d_outer))/w+cx1,r1*(cyd*(r1+r2)+cxd*Math.sqrt(d_outer))/w+cy1]
end
d_inner=cxd**2+cyd**2-(r1-r2)**2
if d_inner>-1e-9
	d_inner=0 if d_inner.abs<1e-9
	R<<[r1*(cxd*(r1-r2)+cyd*Math.sqrt(d_inner))/w+cx1,r1*(cyd*(r1-r2)-cxd*Math.sqrt(d_inner))/w+cy1]
	R<<[r1*(cxd*(r1-r2)-cyd*Math.sqrt(d_inner))/w+cx1,r1*(cyd*(r1-r2)+cxd*Math.sqrt(d_inner))/w+cy1]
end
puts R.uniq.sort.map{|e|e*' '}

Measured memory_bytes: 8808
N = int(input())
a = list(map(int, input().split()))
 
set_a = set(a)
cnt = [0] * (max(a)+1)
ans = 0
 
for i in a:
    cnt[i] += 1
 
if len(cnt) == 1:
    print(cnt[0])
elif len(cnt) == 2:
    print(sum(cnt))
else:
    for i in range(1, max(a)):
        ans = max(ans, cnt[i-1]+cnt[i]+cnt[i+1])

    print(ans)

Measured memory_bytes: 13964
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;

int main(){
    vector<int>a(3);
    rep(i, 3)   cin >> a[i];
    sort(a.begin(), a.end());
    int ans = 0;
    int key = 0;
    rep(i, 3){
        if(key != a[i]){
            ans++;
            key = a[i];
        }
    }
    cout << ans << endl;
}


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

#define LEN(x) (int)x.size()
#define ALL(x) x.begin(), x.end()

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

const int MOD = 1000'000'007;
const double EPS = 0.000'000'001;

inline int fcmp(double x, double y)
{ return (x < y + EPS ? (x < y - EPS ? -1 : 0) : 1);}

const int N = 105, W = 100010;
int n, w;
ll dp[N][W];
pii x[N];

ll solve(int i, int j)
{
	if(j > w) return -(MOD * 1LL * MOD);
	if(i == n || j == w) return 0;	

	ll& r = dp[i][j];

	if(r == -1)
	{
		r = max(solve(i + 1, j), x[i].first + solve(i + 1, j + x[i].second));
	}

	return r;
}

int main()
{
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);
	cout.precision(10);
	
	cin >> n >> w;

	for(int i = 0; i < n; i++)
		cin >> x[i].second >> x[i].first;
	
	memset(dp, -1, sizeof(dp));

	cout << solve(0, 0) << endl;
	
	//cerr << "Tempo de execucao: " << (double)clock() / CLOCKS_PER_SEC << endl;
	return 0;
}

Measured memory_bytes: 82304
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int NMAX = 3010, TMAX = 3010;

ll dp1[NMAX][TMAX];
ll dp2[NMAX][TMAX];

int solve(){
  int N,T;cin >> N >> T;
  vector<PII> v(N);
  rep(i,N)cin >> v[i].first >> v[i].second;

  rep(i,N){
    int j = N-1-i;
    rep(t,T){
      dp1[i+1][t] = max(dp1[i+1][t],dp1[i][t]);
      dp2[j][t] = max(dp2[j][t],dp2[j+1][t]);
      int t_;
      t_  = t+v[i].first;
      if(t_<T) dp1[i+1][t_] = max(dp1[i+1][t_],dp1[i][t]+v[i].second);
      t_ = t+v[j].first;
      if(t_<T) dp2[j][t_] = max(dp2[j][t_],dp2[j+1][t]+v[j].second);
    }
  }

  ll ans = 0;
  rep(i,N){
    rep(t,T){
      ans = max(ans, dp1[i][t] + dp2[i+1][T-1-t]+v[i].second);
    }
  }
  cout << ans << endl;
  return 0;
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  solve();
  return 0;
}


Measured memory_bytes: 141696
#include<stdio.h>
int main()
{
    int x,a,b,c;
    scanf("%d",&x);
    a=x%10;
    x/=10;
    b=x%10;
    x/=10;
    c=x%10;
    if(a==b&&b==c || a==c)
    printf("Yes\n");
    else
    printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>

using ll = long long int;

using namespace std;

int n;
string s;

ll solve(char a, char b, char c) {
    ll sum = 0;
    vector<int> r(n+1, 0);
    for (int i=n-1; i>=0; --i) {
        r[i] = r[i+1] + (s[i] == a);
    }

    for (int i=0; i<n; ++i) {
        if (s[i] != b) continue;
        for (int j=i+1; j<n; ++j) {
            if (s[j] != c) continue;
            sum += r[j+1];
            if (2*j-i<n and s[2*j-i] == a) sum--;

        }
    }

    return sum;
}

int main() {
    cin>>n;
    cin>>s;

    cout << 
    solve('R', 'G', 'B') +
    solve('R', 'B', 'G') +
    solve('G', 'R', 'B') +
    solve('G', 'B', 'R') +
    solve('B', 'R', 'G') +
    solve('B', 'G', 'R') << endl;

}

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

int main() {
  int K, S;
  cin >> K >> S;
  int ans = 0;
  for(int X = 0; X <= K; ++X){
    for(int Y = 0; Y <= K; ++Y){
      int Z = S - X - Y;
      if(0 <= Z && Z <= K) ++ans;
      }
    }
  
  cout << ans << endl;
}

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

int main() {
    string S;
    cin >> S;
    long long N = stol(S);
    long long ans = 0;
    if (S.size()>=2) {
        ans += 9;
        if (S.size()>=4) {
            ans += 900;
            if (S.size()>=6) {
                ans += 90000;
            }
            else if (S.size()>=5) ans += (N-9999);
        }
        else if (S.size()>=3) ans += (N-99);
    }
    else ans += N;
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
const int MN = 105;
int main() {
	ll n;
	cin >> n;
	n++;
	vl bu;
	vl res;
	while(n) {
		bu.push_back(n&1);
		n >>= 1;
	}
	reverse(bu.begin(),bu.end());
	res.push_back(1);
	int lo = 0,hi = 2;
	for(int i=1;i<bu.size();i++) {
		if(i > 1) {res.push_back(hi);hi++;}
		if(bu[i]) {
			res.push_back(lo);lo--;}
	}
	for(int i=0;i<res.size();i++) {
		res[i] -= lo;
	}
	int sz = res.size();
	for(int i=0;i<sz;i++) {
		res.push_back(i+1);
	}
	cout << res.size() << '\n';
	for(int i=0;i<res.size();i++) {
		if(i > 0) {cout << " ";}
		cout << res[i];
	}
	cout << '\n';
}


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

struct Group{
  string name;
  set<string> member;    
};

struct Group group[100];
bool use[100];
int n;

void open(int x){
  bool f;
  set<string>::iterator ite;

  f = false;
  for(ite = group[x].member.begin();ite!=group[x].member.end();ite++){

    if(f)ite = group[x].member.begin();
    f = false;

    for(int i=0;i<n;i++){
      if(group[i].name == *ite){

	if(!use[i])open(i);
	group[x].member.erase(ite);

	set<string>::iterator j;
	for(j=group[i].member.begin();j!=group[i].member.end();j++){
	  group[x].member.insert(*j);
	}

	f = true;
	break;
      }
    }
  }
  use[x] = true;
}

int main(){
  int i,c;
  string tmp,tmp2;

  while(1){
    cin >> n;
    if(!n)break;

    for(i=0;i<n;i++){
      group[i].name.clear();
      group[i].member.clear();
    }

    for(i=0;i<n;i++){
      cin >> tmp;
      c = 0;
      while(tmp[c]!=':'){
	group[i].name.push_back(tmp[c]);
	c++;
      }
      while(tmp[c] != '.'){
	tmp2.clear();
	c++;
	while(tmp[c] != ',' && tmp[c] != '.' ){
	  tmp2.push_back(tmp[c]);
	  c++;
	}
	group[i].member.insert(tmp2);
      }
    }

    for(i=0;i<n;i++)use[i] = false;
    open(0);
    
    cout << group[0].member.size() << endl;    
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int gcd(int n, int m){
    if(n < m) swap(n, m);
    while(m != 0){
        if(n < m) swap(n, m);
        int tmp = n%m;
        n = m;
        m = tmp;
    }
    return n;
}

int main(){
    int N, X;
    int x[100000];
    cin >> N >> X;
    for(int i = 0; i < N; i++){
        cin >> x[i];
        x[i] -= X;
        if(x[i] < 0) x[i] = -x[i];
    }
    int ans = gcd(x[0], x[1]);
    for(int i = 2; i < N; i++){
        ans = gcd(ans, x[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i = 0; i< (n); i++)
#define REP(i,n) for (int i = 1; i<= (n); i++)
#define MAX_MOD 1000000007LL
#define MOD 998244353LL
const long double PI = acos(-1);
using ll = long long;
using ld = long double;
using namespace std;

int main() {
    ld t, x;
    cin >> t >> x;
    ld ans = t / x;
    printf("%.10Lf", ans);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n;
    long long int a[100010];
    long long int prod = 1;

    scanf("%d",&n);


    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);

        if(a[i]==0){
            printf("0");
            return 0;
        }
    }


    for(int i=0;i<n;i++){
        if(a[i]<=1000000000000000000/prod){ // oq essa linha faz??
            prod*=a[i];
        }else{
            printf("-1\n");
            return 0;
        }
    }
    
    printf("%lld\n",prod);

    return 0;
}


Measured memory_bytes: 2492
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  string a,b;
  int d=1,c[100]={};
  cin>>a;
  for(int i=0;i<a.size();i++){
    c[a[i]-97]=1;
  }
  for(int i=0;i<26;i++){
	if(c[i]==0){
      d=0;
      b=i+97;
      cout<<b;
      break;
    }
  }
  if(d) cout<<"None";
  cout<<"\n";
}

Measured memory_bytes: 512
#include<iostream>
#include<sstream>
using namespace std;
bool c(int a)
{
	stringstream ss;
	ss<<a;
	string s;
	ss>>s;
	bool f=1;
	for(int i=1;i<s.size();i++)f&=s[i]==s[i-1]+1;
	return f;
}
main()
{
	int n;cin>>n;
	int a[1001];
	for(int i=0;i<n;i++)cin>>a[i];
	int Max=-1;
	for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)
	{
		if(c(a[i]*a[j])&&a[i]*a[j]>Max)Max=a[i]*a[j];
	}
	cout<<Max<<endl;
}



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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vs = V<string>;

int main(){
	int n;
	cin>>n;
	Vs s(n);
	Vi t(n);
	for(int i=0; i<n; i++){
		cin>>s[i]>>t[i];
	}
	string x;
	cin>>x;

	bool flag = false;
	int total = 0;
	for(int i=0; i<n;i++){
		if(flag) total += t[i];
		if(x == s[i]) flag = true;
	}

	cout<<total<<endl;

	return 0;
}

Measured memory_bytes: 256
N,W = map(int,input().split())
L = list(list(map(int,input().split())) for i in range(N))
upper = 10**5
dp = [float("inf") for i in range(upper+1)] #dp[i] = "価値の総和=i"の最小重さ
dp[0] = 0

for item in range(N) :
    weight_i,value_i = L[item]
    for value in range(upper, value_i-1, -1) :
        if dp[value - value_i] + weight_i <= W :
            dp[value] = min(dp[value], dp[value - value_i] + weight_i)

for value in range(upper, -1, -1) :
    if dp[value] < float("inf") :
        ans = value
        break

print(ans)


Measured memory_bytes: 54144
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for (int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int imos[31][100010];

int main()
{
    int N, C;
    cin >> N >> C;
    imfor(i, N)
    {
        int s, t, c;
        cin >> s >> t >> c;
        imos[c][s - 1] += 1;
        imos[c][t] -= 1;
    }
    imfor(i, C + 1)
    {
        imfor(j, 100010)
        {
            if (j == 0)
            {
                continue;
            }
            imos[i][j] += imos[i][j - 1];
        }
    }
    int ans = 0;
    imfor(i, 100010)
    {
        int tmp = 0;
        imfor(j, C + 1)
        {
            if (imos[j][i] >= 1)
            {
                tmp++;
            }
        }
        if (tmp > ans)
        {
            ans = tmp;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 12416
import sys
input = sys.stdin.readline

def main():
    n,m=map(int,input().split())
    w=[0]*(n+1)
    a=[0]*(n+1)
    for i in range(m):
        p,s=map(str,input().split())
        p=int(p)
        if a[p]==0:
            if s=='WA':
                w[p]+=1
            else:
                a[p]=1
    wa=0
    for i in range(1,n+1):
        wa=wa+a[i]*w[i]
    print(sum(a),wa)

if __name__ == '__main__':
    main()

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

using namespace std;

int main()
{
    int n;
    int a=0, b=0, c=0, d=0;
    cin>>n;
    while(n--)
    {

        char s[10];
        cin>>s;
        if(s[0]=='A') a++;
        else if(s[0]=='W') b++;
        else if(s[0]=='T') c++;
        else if(s[0]=='R') d++;

    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<b<<endl;
    cout<<"TLE x "<<c<<endl;
    cout<<"RE x "<<d<<endl;
    return 0;
}




Measured memory_bytes: 3604
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 100011
#define maxLog 19

int n, i, q, a, b, p;
ll x[maxN], L;
ll dad[maxLog][maxN];

int main()
{
   // freopen("test.in","r",stdin);

    scanf("%d", &n);
    for (i = 1; i <= n; i++) scanf("%lld", &x[i]);
    scanf("%lld", &L);

    for (i = n; i > 0; i--) {
        int pos = upper_bound(x + 1, x + n + 1, x[i] + L) - x - 1;
        dad[0][i] = pos;

        for (int act = 1; act < maxLog; act++)
            dad[act][i] = dad[act - 1][ dad[act - 1][i] ];
    }

    scanf("%d", &q);
    for (i = 1; i <= q; i++) {
        scanf("%d%d", &a, &b);
        if (a > b) swap(a, b);

        int ans = 0;
        p = a;

        for (int step = maxLog - 1; step >= 0; step--)
            if (dad[step][p] != 0)
                if (dad[step][p] < b)
                    p = dad[step][p], ans += 1 << step;

        printf("%d\n", ans + 1);
    }


    return 0;
}


Measured memory_bytes: 16512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<double> a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
    a[i] = 1/a[i];
  }
  double ans=0;
  for(int i=0; i<n; i++) ans += a[i];
  ans = 1/ans;
  cout << ans << endl;
}

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

using namespace std;

#define sum(n) (n) * (n + 1) / 2

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

    int n, k, cnt = 0;
    cin >> n >> k;
    set<int> adj[n];
    bool v[n][n] = {};
    set<pair<int, int>> ans;

    if (k > sum(n - 2))
        return cout << "-1\n", 0;

    for (int i = 1; i < n; i++)
        adj[0].insert(i), adj[i].insert(0);

    for (int i = 0; i < sum(n - 2) - k; i++) {
        for (int j = 0; j < n; j++)
            for (int k = 0; k < n; k++)
                if (k != j && adj[j].find(k) == adj[j].end()) {
                    adj[j].insert(k);
                    adj[k].insert(j);
                    goto out;
                }

    out:
        continue;
    }

    for (int i = 0; i < n; i++) {
        for (int x : adj[i]) {
            int u = i, v = x;
            if (u > v)
                swap(u, v);

            ans.insert({u, v});
        }
        cnt += adj[i].size();
    }

    cout << ans.size() << '\n';

    for (auto x : ans)
        cout << x.first + 1 << ' ' << x.second + 1 << '\n';

    return 0;
}

Measured memory_bytes: 1024
N = int(input())
X = list(map(int,input().split()))

minhp = float('inf')


for p in range(min(X),max(X)+1):
    hp = 0
    for x in X:
         hp += (x-p)**2
    
    if hp < minhp:
        minhp = hp

print(minhp)

Measured memory_bytes: 38640
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>

#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)

#define S_RTN(S)  s_cout(S);return 0


#define _itoa(A,N) sprintf(A, "%d", N);

int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);

int s_asorts(const void* a, const void* b);

//昇順
int s_asorts(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	for (i = 0; i < n; i++) {
		i_cin(*(a + i));
	}

	return 0;
}
int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}

long _max(long a, long b) {
	return a > b ? a : b;
}
long _min(long a, long b) {
	return a < b ? a : b;
}
int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}

#pragma endregion


int main(void) {
	int n,i,j;
	char S[30];

	s_cin(S);
	n=strlen(S);

	for(i = 0; i < n; i++) {
		for (j = i + 1; j < n; j++)
			if (S[i] == S[j]) { S_RTN("no"); }

			
	}
	S_RTN("yes"); 
	
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
    
using namespace std;
    
struct vw_pair {
    int v, w;
    vw_pair(int v,int w) : v(v), w(w) {};
};
    
typedef pair<int, int> ii;
typedef vector <ii> vii;
typedef vector<int> vi;
typedef vector <string> vs;
typedef vector <vi> vvi;
typedef vector <vector<vw_pair>> adj_list;
typedef vector <bool> vb;
typedef long long ll;
typedef unsigned long long ull;
typedef priority_queue<int> max_heap_int;
typedef priority_queue<int, vi, greater<>> min_heap_int;
    
#define isOn(S, j) (S & (1<<j))
#define setBit(S, j) (S |= (1<<j))
#define clearBit(S, j) (S &= ~(1<<j))
#define toggleBit(S, j) (S ^= (1<<j))
#define lowBit(S) (S & (-S))
#define setAll(S, n) (S = (1<<n)-1)
    
#define modulo(S, N) ((S) & (N-1))   // returns S % N, where N is a power of 2
#define isPowerOfTwo(S) (!(S & (S-1)))
#define nearestPowerOfTwo(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
#define turnOffLastBit(S) ((S) & (S-1))
#define turnOnLastZero(S) ((S) | (S+1))
#define turnOffLastConsecutiveBits(S) ((S) & (S+1))
#define turnOnLastConsecutiveZeroes(S) ((S) | (S-1))
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int a,b;
    cin >> a >> b;

    int x = (a + b) / 2;
    if (abs(a - x) == abs(b - x)) cout << x << "\n";
    else cout << "IMPOSSIBLE\n";

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,m,i,j,max=0,p,mj=0;
  int d[1000];
  int r[1000]={0};
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++)scanf("%d",&d[i]);
  for(i=0;i<m;i++){
    scanf("%d",&p);
    for(j=0;j<n;j++){
      if(d[j]<=p){
	r[j]++;
	if(r[j]>max){
	  max=r[j];
	  mj=j;
	}
	break;
      }
    }
  }
  printf("%d\n",mj+1);
  return 0;
}

Measured memory_bytes: 604
# include<stdio.h>
# include<algorithm>
using namespace std;
int s[5];
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	s[0]=a-b;
	s[1]=a*b;
	s[2]=a+b;
	sort(s,s+3);
	printf("%d\n",s[2]);
	return 0;
}

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

string s;

string solve();

int main() {
  cin >> s;
  cout << solve() << endl;
  return 0;
}

string solve() {
  if (s == "zyxwvutsrqponmlkjihgfedcba") return "-1";
  vector<bool> ch(26, 0);
  for (int i = 0; i < s.size(); ++i) ch[s[i] - 'a'] = 1;
  if (s.size() != 26)
    for (int i = 0; i < 26; ++i)
      if (!ch[i]) return s += ('a' + i);
  string t = s, res;
  next_permutation(t.begin(), t.end());
  for (int i = 0; i < 26; ++i) {
    res += t[i];
    if (t[i] != s[i]) break;
  }
  return res;
}

Measured memory_bytes: 256
k=int(input())
from collections import deque
q=deque([])
i=0
while True:
  if i<=8:
    q.append(i+1)
    i+=1
    if i==k:break
    continue
  
  x=q.popleft()
  
  if x%10!=0:
    q.append(x*10+x%10-1)
    i+=1
    if i==k:break
    
  q.append(x*10+x%10)
  i+=1
  if i==k:break
  
  if x%10!=9:
    q.append(x*10+x%10+1)
    i+=1
    if i==k:break
      
print(q.pop())

Measured memory_bytes: 73908
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
int main()
{
	string s;
	cin>>s;
	bool a=0,b=0;
	REP(i,s.size())
	{
		if(s[i]=='A')a=1;
		if(s[i]=='B')b=1;
	}
	if(a&&b)cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}



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

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);

  for(int i = 0; i < N; i++) cin >> A[i];

  int ans = 1;
  int sum = K;
  while(sum <  N) {
    sum += (K - 1);
    ans++;
  }

  cout << ans;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back()
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    string s; cin >> s;
    int  r=0,b=0;
    rep(i,s.size()){
        if(s[i]=='0') r++;
        else b++;
    }
    cout << s.size()-abs(r-b) << endl;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if(a<=b && c<=b){
    printf("%d",10*b+a+c);
  }else if(b<=a && c<=a){
    printf("%d",10*a+b+c);
  }else{
    printf("%d",10*c+a+b);
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

vector<lol> ans;
lol n;

void dfs(lol num){
  if(num > 3234566667){
    return;
  }
  ans.pu(num);
  lol memo = num % 10;
  dfs(num * 10 + memo);
  if(memo != 0){
    dfs(num * 10 + (memo - 1));
  }
  if(memo != 9){
    dfs(num * 10 + (memo + 1));
  }
  return;
}
signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  cin >> n;
  reps(i, 9){
    dfs(i);
  }
  sort(all(ans));
  cout << ans[n - 1] << '\n';
  return 0;
}


Measured memory_bytes: 4256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstdlib>
#include<algorithm>
using namespace std;
long long n,m,gs;
char a[1000][1000];
int main()
{
cin>>n>>m;
for(int i=1; i<=n; i++)
{
	for(int j=1; j<=m; j++)
	{
		cin>>a[i][j];
	}
}
for(int i=1; i<=n; i++)
{
	for(int j=1; j<=m; j++)
	{
		gs=0;
		if(a[i][j]=='#')cout<<'#';
		else 
		{
			if(a[i-1][j-1]=='#')gs++;
			if(a[i-1][j]=='#')gs++;
			if(a[i-1][j+1]=='#')gs++;
			if(a[i][j-1]=='#')gs++;
			if(a[i][j+1]=='#')gs++;
			if(a[i+1][j-1]=='#')gs++;
			if(a[i+1][j]=='#')gs++;
			if(a[i+1][j+1]=='#')gs++;
			cout<<gs;
		}
	}
	cout<<endl;
}
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,v[10005],t,i,a;
    scanf("%d",&n);
    t=0;
    a=0;
    for(i=0;i<n;i++)
    {
        scanf("%d",&v[i]);
        t=t+v[i];
        if(v[i]>a)
        {
           a=v[i];
        }
    }
    t=t-a;
    t=t+(a/2);
    printf("%d\n",t);
    return 0;
}


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

const int N = 200005;
typedef long long ll;


int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	long long n;
	cin>>n;
	long long ans = 3*n*n;
	cout<<ans;
	
	return 0;
}


Measured memory_bytes: 3648