akhauriyash/Code-Regression huggingface dataset:
char m[91];N,y;B(p){m[p]-49||(m[p]--,B(p+1)||B(p+2)||B(p+3),B(p-1)||B(p-2)||B(p-3),B(p+9)||B(p+18)||B(p+27),B(p-9)||B(p-18)||B(p-27));return m[p]-48;}main(n){for(scanf("%d",&n);n--;printf("Data %d:%s",++N,m+9))scanf("%74[01\n]%d%d",m+8,m,&y),B(y*9+*m);exit(0);}

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


def solve(X: int, Y: int, A: int, B: int, C: int, p: "List[int]", q: "List[int]", r: "List[int]"):
    p = sorted(p, reverse=True)
    q = sorted(q, reverse=True)
    d = sorted(p[:X] + q[:Y] + r)
    print(sum(sorted(d, reverse=True)[:X+Y]))

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(A)]  # type: "List[int]"
    q = [int(next(tokens)) for _ in range(B)]  # type: "List[int]"
    r = [int(next(tokens)) for _ in range(C)]  # type: "List[int]"
    solve(X, Y, A, B, C, p, q, r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 31320
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n,c=0;
  cin>>n;
  string s;
  cin>>s;
  string p="ABC",m="";
  for(int i=0;i<=(n-3);i++)
  {
  for(int j=i;j<(i+3);j++)
  m+=s[j];
    if(m==p)
      c++;
      //cout<<m<<" "<<p<<endl;
      m="";
  }
  cout<<c<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 18;

int sum[MAXN+1][1<<MAXN];
int boro[MAXN+1][1<<MAXN];

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

    for (int i = 0; i < (1<<n); i++) {
        cin >> boro[0][i];
        sum[0][i] = -1;
    }

    for (int p = 1; p <= n; p++) {
        for (int msk = 0; msk < (1<<n); msk++) {
            boro[p][msk] = boro[p-1][msk];
            sum[p][msk] = sum[p-1][msk];
            if (msk&(1<<(p-1))) {
                boro[p][msk] = max(boro[p][msk], boro[p-1][msk^(1<<(p-1))]);
                sum[p][msk] = max(sum[p][msk], boro[p-1][msk]+boro[p-1][msk^(1<<(p-1))]);
            }
        }
    }

    int mx = -1;
    for (int i = 1; i < (1<<n); i++) {
        mx = max(mx, sum[n][i]);
        cout << mx << "\n";
    }


    return 0;
}


Measured memory_bytes: 42548
"use strict";
function Main(input) {
    let lines = input.split("\n");

    // エラトステネスのふるい
    const MAX = 101010;
    let isPrime = new Array(MAX).fill(1);
    isPrime[0] = isPrime[1] = 0;
    for (let i = 2; i < MAX; i++) {
        if (!isPrime[i]) continue;
        for (let j = i * 2; j < MAX; j += i) isPrime[j] = 0;
    }

    // 2017-like 数かどうか
    let a = new Array(MAX).fill(0);
    for (let i = 0; i < MAX; ++i) {
        if (i % 2 == 0) continue;
        if (isPrime[i] && isPrime[(i + 1) / 2]) a[i] = 1;
    }

    // 累積和
    let s = new Array(MAX + 1).fill(0);
    for (let i = 0; i < MAX; ++i) s[i + 1] = s[i] + a[i];

    // クエリ処理
    let Q = lines.shift().trim().split(/\s/)[0] - 0;
    for (let q = 0; q < Q; ++q) {
        let lr = lines.shift().split(/\s/).map((v) => v - 0);
        let l = lr[0], r = lr[1]; ++r;
        console.log(s[r] - s[l]);
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 35136
N,K = map(int,input().split())
A = list(map(int,input().split()))

def is_ok(l):
    if l<=0: return False
    k = 0
    for a in A:
        k += a//l
        if a%l==0:
            k -= 1
        if k > K:
            return False
    return True

ok = 10**9+1
ng = -1
while ok - ng > 1:
    m = (ok+ng)//2
    if is_ok(m):
        ok = m
    else:
        ng = m
print(ok)

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

string s, t;
vector<vector<int>> G;
vector<int> visited, dist;

int64 dfs(int64 v, int64 key) {
    if (visited[v] != -1) {
        if (visited[v] == key) return INF;
        return dist[v];
    }
    visited[v] = key;
    dist[v] = 0;
    REP(i, G[v].size()) {
        chmax(dist[v], dfs(G[v][i], key)+1);
    }
    return dist[v];
}

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

	cin >> s >> t;
	string ns = s;
	while (ns.size()-s.size() < t.size()) ns += s;
	ns = t + ns;
	vector<int64> A(ns.size());
	A[0] = ns.size();
	int64 i = 1, j = 0;
	while (i < ns.size()) {
	    while (i+j < ns.size() && ns[j] == ns[i+j]) ++j;
	    A[i] = j;
	    if (j == 0) { ++i; continue; }
	    int64 k = 1;
	    while (i+k < ns.size() && k+A[k] < j) A[i+k] = A[k], ++k;
	    i += k; j -= k;
	}
	G.resize(s.size());
	visited.resize(s.size(), -1);
	dist.resize(s.size(), -1);
	FOR(i, t.size(), t.size()+s.size()) {
	    if (A[i] >= t.size()) {
	        G[i-t.size()].push_back((i)%s.size());
	    }
	}
	int64 res = 0;
	REP(i, s.size()) {
	    chmax(res, dfs(i, i));
	}
	cout << (res >= INF ? -1 : res) << endl;
}


Measured memory_bytes: 73568
N = int(input())

D =  [list(map(int, input().split())) for i in range(N)]

count = 0
for d in D:
  if d[0] == d[1]:
    count += 1
  else:
    count = 0
    
  if count == 3:
    print('Yes')
    break
else:
  print('No')

Measured memory_bytes: 9172
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int W = scan.nextInt(); //x軸
        int H = scan.nextInt(); //y軸
        int N = scan.nextInt(); //点の数
        boolean[][] isAreaBlack = new boolean[H][W];

        int x_i, y_i, a_i;
        for(int i = 0; i < N; i++) {
            x_i = scan.nextInt();
            y_i = scan.nextInt();
            a_i = scan.nextInt();
            
            switch(a_i) {
                case 1:
                    for(int j = 0; j < H; j++) {
                        for(int k = 0; k < x_i; k++) {
                            isAreaBlack[j][k] = true;
                        }
                    }
                    break;
                case 2:
                    for(int j = 0; j < H; j++) {
                        for(int k = x_i; k < W; k++) {
                            isAreaBlack[j][k] = true;
                        }
                    }
                    break;
                case 3:
                    for(int j = 0; j < y_i; j++) {
                        for(int k = 0; k < W; k++) {
                            isAreaBlack[j][k] = true;
                        }
                    }
                    break;
                case 4:
                    for(int j = y_i; j < H; j++) {
                        for(int k = 0; k < W; k++) {
                            isAreaBlack[j][k] = true;
                        }
                    }
                    break;
            }
        }
        
        
        int answer = 0;
        for(int i = 0; i < H; i++) {
            for(int j = 0; j < W; j++) if(!isAreaBlack[i][j]) answer++;
        }
        System.out.println(answer);
    }
}


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

using namespace std;
typedef long long ll;
ll t , n ,k, x , y , z , a , b , cntr , sum ;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> k >> n;
    int arr[n];
    vector<int>dif;
    for(int i = 0 ; i < n ; i++)
    {
        cin >> arr[i];

    }
    sort(arr,arr+n);
    for(int i = 0 ; i < n ; i++)
    {
        if(i)
        {
            sum+=abs(arr[i]-arr[i-1]);
            dif.push_back(abs(arr[i]-arr[i-1]));
        }
    }
    sort(dif.begin(),dif.end());
    reverse(dif.begin(),dif.end());
    x=dif.size();
    for(int i = 0 ; i < min(k-1 ,x) ;i++)
    {
        sum-=dif[i];
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 1276
N,Y=map(int,input().split())

e=0
m=0
f=0
t=0

for i in range(N+1):
    for j in range(N+1-i):
        if 10000*N-5000*i-9000*j==Y:
            e=1
            m=N-i-j
            f=i
            t=j

if e==0:
    print('-1 -1 -1')
else:
    print('{} {} {}'.format(m,f,t))

Measured memory_bytes: 3060
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    s = S()
    t = S()
    r = 0
    for i in range(3):
        if s[i] == t[i]:
            r += 1

    return r


print(main())



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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

// 左づめでの10進数xをdigits桁のN進数vectorにしてを返す
vector<int> baseNumber(int N, int digits, int x) {
  vector<int> ret(digits, 0);
  // 商
  int quotient = x;
  int counter = 0;
  while (quotient > 0) {
    // 余り
    int remainder = quotient % N;
    quotient /= N;
    ret[counter] = remainder;
    counter++;
  }

  return ret;
};

// 0からn-1までのN進数を上記のbaseNumberで返したvectorのvector
vector<vector<int>> baseNumbers(int n, int N, int digits) {
  vector<vector<int>> ret(n, vector<int> (digits));
  for (int i = 0; i < n; i++) {
    ret[i] = baseNumber(N, digits, i);
  }

  return ret;
};

bool check(vector<int> v, int N) {
  vector<int> tmp_v(v.size());
  rep(i, 0, v.size()) {
    if (v[i] == 0) {
      tmp_v[i] = 3;
    } else if (v[i] == 1) {
      tmp_v[i] = 5;
    } else if (v[i] == 2) {
      tmp_v[i] = 7;
    }
  }
  bool flag3 = false, flag5 = false, flag7 = false;
  ll n = 0;
  rep(i, 0, tmp_v.size()) {
    n += tmp_v[i] * POWLL(10, i);
    if (tmp_v[i] == 3) {
      flag3 = true;
    } else if (tmp_v[i] == 5) {
      flag5 = true;
    } else if (tmp_v[i] == 7) {
      flag7 = true;
    }
  }
  if (flag3 && flag5 && flag7 && n <= N) {
    return true;
  } else {
    return false;
  }
};

int main() {
  int N;
  cin >> N;
  int ans = 0;
  rep(i, 3, 11) {
    auto bs = baseNumbers(POWINT(3, i), 3, i);
    rep(i, 0, bs.size()) {
      // PrintVec(bs[i]);
      if (check(bs[i], N)) {
        ans++;
      }
    }
  }

  cout << ans << endl;
};


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

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

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

int main() {
    string S;
    cin >> S;
    vector<string> days = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    int ans = 7;
    for(string s : days) {
        if(s == S)
            break;
        else
            ans--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
const double PI  =3.141592653589793238463;
using namespace std;
using ll = long long;
const ll INF = +10010010000;
typedef pair<int,int> P;
const int mod = 1e9+7;

struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a){
        (x+=a.x)%=mod;
        return *this;
    }
    mint& operator-=(const mint a){
        (x-=mod-a.x)%=mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x)%= mod;
        return *this;
    }
    mint operator+(const mint a)const{
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a)const{
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a)const{
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
      if(!t)return 1;
      mint a = pow(t>>1);
      a*=a;
      if(t%1)a*=*this;
      return a;
    }

    // for prime mod
    mint inv() const {
      return pow(mod-2);
    }
    mint& operator/=(const mint a){
      return (*this) *= a.inv();
    }
    mint operator/(const mint a)const{
      mint res(*this);
      return res/=a;
    }
};

struct combination{
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i<n;++i)fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i>=1;--i) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k){
    if(k<0 || k>n)return 0;
    return fact[n] * ifact[k] + ifact[n-k]; 
  }
};

int main(){
    int d,t,s;
    cin >> d >> t >> s;
    if(t*s>=d){
        cout << "Yes"<<endl;
    }
    else{
        cout << "No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3632
import sys
sys.setrecursionlimit(200000)
import numpy as np
N = int(input())
h = list(map(int, input().split()))
defa = np.inf
dp = [defa] * N

def rec(i):
  if dp[i] != defa:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  res = defa
  res = min(res, rec(i-1)+np.abs(h[i] - h[i-1]))
  if i >= 2:
    res = min(res, rec(i-2)+np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
n = int(rec(N-1))
print(n)

Measured memory_bytes: 102576
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
 
#define rep(i,n) for(ll i=0;i<(n;i++)
typedef long long ll;
using namespace std;

int main(void){
    // Your code here!
    string S;
    cin >> S;
    int n = S.size();
    int streak = 0;
    int mstreak = 0;
    for(int i = 0;i<n;i++){
        if(S.at(i) == 'A' ||S.at(i) == 'T' ||S.at(i) == 'G' ||S.at(i) == 'C' ){
            streak++;
            mstreak = max(streak,mstreak);
        }
        else{
            streak = 0;
        }
    }
    cout << mstreak << endl;
}

Measured memory_bytes: 3632
import sys
X = int(input())
def is_prime(X):
    for i in range(2,X):
        if X % i == 0:
            return False
    return True
if is_prime(X):
    print(X)
    sys.exit(0)
else:
    while True:
        if X%2 == 0:
            X+=1
        else:
            if is_prime(X):
                print(X)
                sys.exit(0)
            X+=2
  

Measured memory_bytes: 38512
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
const int INF = 1 << 30;
const double EPS = 1e-10;
const double PI = 4.0 * atan(1.0);

int n, m;
double p[50];
double dp[50];

double getS(int last, int nxt){
  double diff = p[nxt] - p[last];
  if(diff < 0.0) diff += 1.0;
  return sin(2 * PI * diff) / 2.0;
}

int main(){
  while(cin >> n >> m && (n || m)){
    double res = 0.0, s;
    rep(i, n) cin >> p[i];
    rep(i, n){
      rep2(j, i, n) dp[j] = getS(j, i);
      
      rep(j, m - 1) {
	rep2(k, i, n){
	  s = -INF;
	  rep2(l, k + 1, n){
	    s = max(s, getS(k, l) + dp[l]);
	  }
	  dp[k] = s;
	}
      }
      
      res = max(res, dp[i]);
    }
    cout << fixed << setprecision(6) << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1004
f = list(map(int, input().split()))
q = int(input())
for i in range(q):
    a = list(map(int, input().split()))
    if a in [[f[0], f[1]], [f[1], f[5]], [f[5], f[4]], [f[4], f[0]]]:
        print(f[2])
    elif a in [[f[0], f[2]], [f[2], f[5]], [f[5], f[3]], [f[3], f[0]]]:
        print(f[4])
    elif a in [[f[0], f[4]], [f[4], f[5]], [f[5], f[1]], [f[1], f[0]]]:
        print(f[3])
    elif a in [[f[0], f[3]], [f[3], f[5]], [f[5], f[2]], [f[2], f[0]]]:
        print(f[1])
    elif a in [[f[1], f[2]], [f[2], f[4]], [f[4], f[3]], [f[3], f[1]]]:
        print(f[0])
    elif a in [[f[1], f[3]], [f[3], f[4]], [f[4], f[2]], [f[2], f[1]]]:
        print(f[5])


Measured memory_bytes: 5616
// Template
#include <bits/stdc++.h>
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, r) for (int i = (l); i < (r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T& x, const T& y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T& x, const T& y) {if (x < y) {x = y; return 1;} return 0;}
struct IOSET {IOSET() {cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10);}} ioset;

// Main
int main() {
    string s;
    cin >> s;
    if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') cout << 3 << "\n";
    else if ((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R')) cout << 2 << "\n";
    else if (s[0] == 'R' || s[1] == 'R' || s[2] == 'R') cout << 1 << "\n";
    else cout << 0 << "\n";
}


Measured memory_bytes: 3656
#include <iostream>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <stack>
#include <cstdio>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#include <iterator>
#include <sstream>
#define popcount(x) __builtin_popcount(x)
#define oddparity(x) __builtin_parity(x)
#define clz(x) __builtin_clz(x)
#define ctz(x) __builtin_ctz(x)
#define sf scanf
#define pf printf
#define ll long long int
using namespace std;

int i, j, k;
string a, b, s;

int main()
{
    cin >> a >> b;
    for (i = 0, j = 0, k = 1; ; k++) {
        if (i < a.size() && k % 2 == 1) {
            s += a[i];
            i++;
        }
        else if (j < b.size() && k % 2 == 0) {
            s += b[j];
            j++;
        }
        else {
            break;
        }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int h, w, n;
	cin >> h >> w >> n;

	cout << (n + max(h, w) - 1) / max(h, w) << endl;



	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = [list(input()) for _ in range(n)]
ans = 0
alphcnt = [0] * 26
for i in range(n):
    for j in range(n):
        alphcnt[ord(s[i][j]) - 97] += 1
if max(alphcnt) == pow(n, 2):
    print(pow(n, 2))
    exit()
for k in range(n):
    c = 1
    for i in range(n - 1):
        for j in range(i + 1, n):
            if not s[(i + k) % n][j] == s[(j + k) % n][i]:
                c = 0
                break
        if c == 0:
            break
    if c == 1:
        ans += n
print(ans)

Measured memory_bytes: 45292
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, beg, end) for (int i = beg; i < end; i++)

int main()
{
    string s;
    cin >> s;
    if(s == "ABC")
        cout << "ARC";
    else
        cout << "ABC";

    return 0;
}

Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include "iostream"
using namespace std;

#define REP(i,m,n)  for(int i = m; i < n ; i++)


int h, w;
char s[64][64];

int d[3] = { -1, 0 ,1 };


void replace(int h1,int w1) {

    int count = 0;

    REP(i, 0, 3) {
        REP(j, 0, 3) {
            int a = h1 + d[i];
            int b = w1 + d[j];
          //  cout << a << "  " << b << "  " << s[a][b] << endl;
            if ((a >= 0) && (a <= h - 1) && (b >= 0) && (b <= w - 1))
                if (s[a][b] == '#')
                    count++;
        }
    }


 //   cout  << count << endl << endl;
    s[h1][w1] = count + '0';

}






int main() {


    cin >> h >> w;
    
    REP(i, 0, h) {

        cin >> s[i];

    }


    REP(i,0,h){
        REP(j, 0, w) {
            if (s[i][j] != '#')
                replace(i, j);
        }
    }





    REP(i, 0, h) {
        cout << s[i] << endl;
    }

 



    return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    int now = 1;
    int next = 0;

    for (int i = 0; i < n; i++) {
      next = a[now - 1];
      now = next;
      if (next == 2) {
        System.out.println(i + 1);
        return;
      }
    }

    System.out.println(-1);

  }
}

Measured memory_bytes: 59276
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    string S;
    cin >> S;
    if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3])
        cout << "Bad" << endl;
    else
        cout << "Good" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

int main(void)
{
    int N, M;
    cin >> N >> M;

    vector<bool> ok1(N, false);
    vector<bool> ok2(N, false);

    int a, b;
    for (int i = 0; i < M; i++)
    {
        cin >> a >> b;
        if (a == 1)
        {
            ok1[b - 1] = true;
        }
        if (b == N)
        {
            ok2[a - 1] = true;
        }
    }

    for (int i = 0; i < N; i++)
    {
        if (ok1[i] && ok2[i])
        {
            printf("POSSIBLE\n");
            return (0);
        }
    }
    printf("IMPOSSIBLE\n");
    return (0);
}

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

int main() {
    int N, K;
    cin >> N >> K;

    vector<double> E(N);
    for (int i = 0; i < N; ++i) {
        int p;
        cin >> p;
        E[i] = (p + 1.0) / 2;
    }

    double ans = 0;
    double sum = 0;
    queue<double> q;
    for (int i = 0; i < N; ++i) {
        sum += E[i];
        q.push(E[i]);
        if (q.size() > K) {
            sum -= q.front();
            q.pop();
        }
        if (q.size() == K) {
            ans = max(ans, sum);
        }
    }
    cout << fixed << setprecision(12) << ans << endl;
}

Measured memory_bytes: 3456
#include <stdio.h>
#include <iostream>

using namespace std;

int main(void){
	char s[6];

	scanf("%s", s);

	int i = 0;
	while (s[i+1] != '\0'){
		if (s[i] == 'A' && s[i+1] == 'C'){
			cout << "Yes" << endl;
			return 0;
		}
		i++;
	}

	cout << "No" << endl;

	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  string s;
  Int k;
  cin>>s>>k;
  Int n=s.size();
  Int f=1;
  char c='1';
  for(Int i=0;i<min(n,k);i++){
    if(f) c=s[i]; 
    f&=s[i]=='1';
  }
  cout<<c<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    if(n < 1200) cout << "ABC" << endl;
    else if(n < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#include <random>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1'000'000'007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  vector<ll> A(N);
  rep(i,N) cin >> A[i];
  ll sum = 0;
  for(int i=0; i<N; i++){
    sum += A[i];
  }
  if(sum%(N*(N+1)/2) != 0){
    cout << "NO\n";
    return 0;
  }
  ll k = sum / (N*(N+1)/2);
  vector<ll> d(N);
  for(int i=0; i<N; i++){
    d[i] = A[(i+1)%N] - A[i];
    d[i] -= k;    
  }
  bool can = true;
  ll cnt = 0;
  for(int i=0; i<N; i++){
    if(d[i]%N != 0) can = false;
    if(d[i] > 0) can = false;
  }
  if(can){
    cout << "YES\n";
  }else{
    cout << "NO\n";
  }
  return 0;
}

Measured memory_bytes: 4796
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

void readInput(vector<pair<int, int> >& input)
{
    int n;
    cin >> n;
    while(--n >= 0){
        int h, m;
        cin >> h >> m;
        input.push_back(make_pair(h, m));
    }
}

int main()
{
    vector<pair<int, int> > input;
    readInput(input);
    readInput(input);
    sort(input.begin(), input.end());
    input.erase(unique(input.begin(), input.end()), input.end());

    int n = input.size();
    vector<string> ans(n);
    for(int i=0; i<n; ++i){
        ostringstream oss;
        oss << input[i].first << ':' << setfill('0') << setw(2) << input[i].second;
        ans[i] = oss.str();
    }

    cout << ans[0];
    for(unsigned i=1; i<ans.size(); ++i)
        cout << ' ' << ans[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <limits.h>
#include <memory.h>


using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef vector<double> vec;
typedef vector<vec> mat;


bool flg[26];

int main() {

	string s;
	cin>>s;

	FORI(0,s.length()){

		flg[s[i]-'a']=1;
	}
	
	FORI(0,26){
		if(!flg[i]){
			cout << (char)(i+'a') <<  endl;
			return 0;
		}

	}
	cout << "None" << endl;
	return 0;
}




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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int n; cin >> n;
	int k; cin >> k;

	for (int i = 0;i < k;i++){
		int a,b; cin >> a >> b;
		a = min(a,n-a+1); b = min(b,n-b+1);
		int d = min(a,b);
		//cout << d << endl;
	 	cout << (d-1)%3 +1 << endl;
	}

	return 0;

}



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

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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

struct name{
	string name;
	int p,id;
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<name> g(n);
	rep(i,n){
		cin>>g[i].name>>g[i].p;
		g[i].id=i+1;
	}
	sort(begin(g),end(g),[&](const name &a,const name &b){
		if(a.name!=b.name) return a.name<b.name;
		else return b.p<a.p;
	});
	rep(i,n){
		cout<<g[i].id<<endl;
	}
}

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

public class Main {

	//@2100
	public static void main(String[] args) throws IOException {
		
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		
		//f[^
		int n = Integer.parseInt(r.readLine());
		
		for(int loop = 0; loop < n; loop++) {
			r.readLine();
			String s2 = r.readLine();
			String[] sp = s2.split(" ");
			int[] data = new int[sp.length];
			for(int i = 0; i < data.length; i++) {
				data[i] = Integer.parseInt(sp[i]);
			}			
			
			int up = 0;
			int down = 0;
			
			for(int i = 0; i < data.length - 1; i++) {
				if (data[i + 1] - data[i] > up) {
					up = data[i + 1] - data[i];
				}
				if (-(data[i + 1] - data[i]) > down) {
					down = -(data[i + 1] - data[i]);
				}
				
			}
			
//			for(int i = 0; i < a.length; i++) {
//				if (i != 0) 
//					System.out.printf(" ");
//				System.out.printf("%s", a[a.length - i - 1]);
//			}
//			System.out.printf("\n");
			System.out.printf("%d %d\n", up, down);
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define w(t) while(t--)
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
#define db(x) cerr << #x << " is " << x << '\n'
#define FL freopen("in", "r", stdin),freopen("out", "w", stdout);
#define time cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x) double(x * acos(-1) / 180.0)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int main(){
    //FL;
    fin;
    int a, b;
    cin >> a >> b;
    cout << a * b << '\n';
    time;
    return 0;
}       


Measured memory_bytes: 3824
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <map>
#include <sstream>
#define ll long long
using namespace std;
// ver..(1.1)
string ent="\n";
string space=" ";
int main(){
   ios_base::sync_with_stdio(false);
   string s;
   cin >> s;

   int s_len=s.size();
   int cnt=0,rand;

   if(s_len%2==0) rand=s_len/2;
   else{         
      rand=(s_len/2)+1;
   }

   for(int i=0;i<rand;i++){
      if(s[i]!=s[s_len-i-1])  cnt++;
   }
   cout << cnt << ent;
}
/*



*/

Measured memory_bytes: 256
import sys
def S(): return sys.stdin.readline().rstrip()

N,M = map(int,S().split())
AB = []
C = []
for _ in range(M):
    AB.append(tuple(int(i) for i in S().split()))
    C.append(sum(1<<(int(i)-1) for i in S().split()))

dp = [10**8+1]*(1<<N)
dp[0] = 0

for i in range(1<<N):
    for (a,b),c in zip(AB,C):
        dp[i|c] = min(dp[i|c],dp[i]+a)

if dp[-1] == 10**8+1:
    print(-1)
else:
    print(dp[-1])

Measured memory_bytes: 42988
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};
 
int main(){
  ll N,T;
  cin>>N>>T;
  vector<ll> t(N);
  for(int i=0;i<N;i++){
    cin>>t[i];
  }
  ll ans=T;
  for(int i=1;i<N;i++){
    ans+=T;
    if(t[i]-t[i-1]<T){
      ans-=(T-(t[i]-t[i-1]));
    }
  }
  cout<<ans<<endl;
  return 0;
}
 


Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
vector<int> edge[600000];
int ans[600000];
int pa[600000];
void dfs(int now){
  int t = now;
  int count = 0;
  REP(i,edge[now].size()){
    if(edge[now][i]==pa[now]) continue;
    count ++;
    int ne = edge[now][i];
    pa[ne] = now;
    ans[ne] = count;
    dfs(ne);
  }
}

signed main(){
  int n,k;
  cin >> n >> k;
  REP(i,n-1){
    int a1,b1;
    cin >> a1 >> b1;
    edge[a1].pb(b1);
    edge[b1].pb(a1);
  }
  dfs(1);
  int ans2 = k;
  for(int i = 2;i<=n;i++){
    if(pa[i]==1) ans2 *= k-ans[i];
    else ans2 *= k-ans[i]-1;
    ans2 %= MOD;
  }
  cout << ans2 << endl;
  return 0;
}


Measured memory_bytes: 24960
#include <iostream>

using namespace std;

int main()
{
    int n ;
    cin>>n ;
    bool is = false ;
    while(n != 0){
        int x = n%10 ;
        if(x == 9){
            is = true ; break ;
        }
        n /= 10 ;
    }
    if(is)cout<<"Yes"<<endl ;
    else cout<<"No"<<endl ;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL  = long long;
using VI  = vector<LL>;
using VVI = vector<VI>;
using VB  = vector<bool>;
using VS  = vector<string>;
using PII = pair<LL, LL>;
using VP  = vector<PII>;
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first < y.first;});
#define FRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first > y.first;});
#define SSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second < y.second;});
#define SRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second > y.second;});
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define $(x) {cout << #x << " = " << (x) << endl;}


int main() {
    LL N;
    cin >> N;
    VI a(N);
    REP(i, N) cin >> a[i];

    VVI dp(N + 1, VI(N + 1));
    FOR(len, 1, N + 1) {
        for (LL i = 0; i + len < N + 1; ++i) {
            LL j = i + len;
            if ((N - len) % 2 == 0) {
                dp[i][j] = max(dp[i + 1][j] + a[i], dp[i][j - 1] + a[j - 1]);
            } else {
                dp[i][j] = min(dp[i + 1][j] - a[i], dp[i][j - 1] - a[j - 1]);
            }
        }
    }
    cout << dp[0][N] << endl;
	
    return 0;
}


Measured memory_bytes: 70784
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
	cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	cout << head;
	if (sizeof...(tail) != 0) cout << " ";
	print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
	for (auto& a : vec) {
		cout << a;
		if (&a != &vec.back()) cout << " ";
	}
	cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
	for (auto& vec : df) {
		print(vec);
	}
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	auto S = IN<string>();
	map<char, int> mp;
	REP(i, SIZE(S))
	{
		mp[S[i]]++;
		if (mp[S[i]] > 1)
		{
			print("No");
			return 0;
		}
	}
	print("Yes");
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	solve();
	return 0;
}
#endif


Measured memory_bytes: 256
package main

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

var N int

func main() {
	N = nextInt()
	A := nextInt64s(N)
	p := A[0]
	for i := 1; i < N; i++ {
		p = getRem(p, A[i])
	}
	fmt.Printf("%v", p)
}

func getRem(a int64, b int64) int64 {
	var r int64
	if a > b {
		r = a % b
		if r == 0 {
			return b
		}
		r = getRem(b, r)
	} else {
		r = b % a
		if r == 0 {
			return a
		}
		r = getRem(a, r)
	}
	return r
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}

func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func Min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func MaxIn2Values(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func MinIn2Values(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}


Measured memory_bytes: 3072
#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.at(i);
    }
   
   
    double ans=0;
    
    
    for(int i=0;i<n;i++){
        ans+=1.0/a.at(i);
    }
    
    cout<<std::fixed<<std::setprecision(7)<<1.0/ans<<endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<chrono>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define vint(a,n) vint a(n); rep(i, n) cin >> a[i];
#define vll(a,n) vll a(n); rep(i, n) cin >> a[i];
#define ALL(n) begin(n),end(n)
#define RALL(n) rbegin(n),rend(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
using vbool=vector<bool>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using P = pair<int, int>;
void prp(P& p) {cout << p.first << " " << p.second << endl;}

int main()
{
    int n; cin >> n;
    arr<int> g(n);
    vint x(n-1), y(n-1);
    rep(i, n-1){
        int a, b; cin >> a >> b;
        a--; b--;
        x[i] = a;
        y[i] = b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vint(c, n);
    sort(c.rbegin(), c.rend());

    int tmp = 0, ti=0;
    rep(i, n) {
        if(tmp < g[i].size()){
            tmp = g[i].size();
            ti = i;
        }
    }

    vector<P> p;
    rep(i, n){
        p.push_back({g[i].size(), i});
    }

    priority_queue<P> que;
    que.push(p[ti]);

    vector<bool> seen(n, false);
    vint col(n);
    int ci = 0;
    while(!que.empty()){
        int nd = que.top().second; que.pop();
        col[nd] = c[ci++];
        seen[nd] = true;

        for(int next: g[nd]){
            if(seen[next]) continue;
            que.push(p[next]);
        }
    }

    ll ans = 0;
    rep(i, n-1){
        ans += min(col[x[i]], col[y[i]]);
    }
    pr(ans);
    prvec(col);

    return 0;}

Measured memory_bytes: 4316
#include<cstdio>
using namespace std;
int money[6]{500,100,50,10,5,1};
void solve(int price){
  int ans{0};
  for(int i{0} ; i< 6 ; i++){
    while(price >= money[i]){
      price -= money[i];
      ans++;
    }
  }
  printf("%d\n",ans);
}
int main(){
  int price;
  while(true){
    scanf("%d",&price);
    if(price == 0)
      break;
    solve(1000 - price);
  }
}





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

const int MAXN = 301;

int n, a[4] = {0}, ai;
double dp[MAXN][MAXN][MAXN] = {0.0};

double solve(int i, int j, int k) {
    if ((i < 0) or (j < 0) or (k < 0) or (i + j + k == 0))
        return 0.0;

    if (dp[i][j][k] == 0.0) {
        double res = (double) n / (i + j + k) - 1.0;
        res += (solve(i - 1, j, k) + 1.0) * (double) i / (i + j + k);
        res += (solve(i + 1, j - 1, k) + 1.0) * (double) j / (i + j + k);
        res += (solve(i, j + 1, k - 1) + 1.0) * (double) k / (i + j + k);
        dp[i][j][k] = res;
    }

    return dp[i][j][k];
}

int main() {
    cout << fixed << setprecision(10);

    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> ai;
        a[ai]++;
    }

    cout << solve(a[1], a[2], a[3]) << '\n';
}


Measured memory_bytes: 213248