akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>
#define MAX 1000

int main(){
    int n;
    int i, j=0, sum;
    int score[MAX];
    double ave, tmp;
    double dev[MAX];

    while(1){
        scanf("%d", &n);
        if(n==0)break;
        sum=0;
        for(i=0;i<n;i++){
            scanf("%d", &score[i]);
            sum+=score[i];
        }
        ave=(double)sum/(double)n;
        tmp=0.0;
        for(i=0;i<n;i++){
            tmp+=pow(score[i]-ave, 2);
        }
        dev[j++]=sqrt(tmp/(double)n);
    }
    for(i=0;i<j;i++){
        printf("%f\n", dev[i]);
    }
    return 0;
}


Measured memory_bytes: 2052
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main{

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] token = br.readLine().split(" ");
		int row = Integer.parseInt(token[0]);
		int col = Integer.parseInt(token[1]);
		int[][] table = new int[row + 1][col + 1];

		for(int i = 0; i < row; i++){

			token = br.readLine().split(" ");

			for(int j = 0; j < col; j++){
				table[i][j] = Integer.parseInt(token[j]);
			}

		}

		for(int i = 0; i < row; i++){

			int sum = 0;

			for(int j = 0; j < col; j++){
				sum += table[i][j];
			}

			table[i][col] = sum;

		}

		for(int i = 0; i <= col; i++){

			int sum = 0;

			for(int j = 0; j < row; j++){
				sum += table[j][i];
			}

			table[row][i] = sum;

		}

		for(int i = 0; i <= row; i++){
			for(int j = 0; j <= col; j++){

				System.out.print(table[i][j]);

				if(j != col){
					System.out.print(" ");
				}else{
					System.out.print("\n");
				}

			}
		}

	}
}

Measured memory_bytes: 32776
#include<stdio.h>
#include<math.h>
#define N 6
 
typedef struct{
  double x;
  double y;
}XY;
 
void koch(int,XY,XY);
 
int main()
{
  int n,i;
 
  XY p1 = {0.0,0.0},p2 = {100.0,0.0};
  scanf("%d",&n);
  printf("%.8f %.8f\n",p1.x,p1.y);
  koch(n,p1,p2);
  printf("%.8f %.8f\n",p2.x,p2.y);
 
  return 0;
}
 
void koch(int n,XY p1,XY p2)
{
  XY s,t,u;
 
  if(n == 0) return;
 
  s.x = (2 * p1.x + 1 * p2.x) / 3;
  s.y = (2 * p1.y + 1 * p2.y) / 3;
  t.x = (1 * p1.x + 2 * p2.x) / 3;
  t.y = (1 * p1.y + 2 * p2.y) / 3;
  u.x = (t.x - s.x) * 1 / 2 - (t.y - s.y) * sqrt(3) / 2 + s.x;
  u.y = (t.x - s.x) * sqrt(3) / 2 + (t.y - s.y) * 1 / 2 + s.y;
 
  koch(n-1,p1,s);
  printf("%.8f %.8f\n",s.x,s.y);
 
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
 
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
 
  koch(n-1,t,p2);
}

Measured memory_bytes: 644
$<.each do |l|
  d = l.split(',').map(&:to_i)
  ls = d[0...10].inject(0){|s, n| s += n}
  h = ls.to_f/(d[10]+d[11])
  p d[0...10].inject([0, h*d[10]]){|arr, l| arr[1] > 0 ? [arr[0]+1, arr[1]-d[arr[0]]] : arr}[0]
end

Measured memory_bytes: 6116
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    int n,d;
    cin >> n >> d;
    double a[11][11];
    for(int i=0;i<n;i++)for(int j=0;j<d;j++)cin >> a[i][j];
    int cnt =0;
    double po = 0;
    for(int i=0;i<n;i++)for(int j=0;j<i;j++){
        po = 0;
        for(int k=0;k<d;k++){
            po += abs(a[i][k] - a[j][k]) * abs(a[i][k] - a[j][k]);
        }
        po = sqrt(po);
        //cout << po << endl;
        if(ceil(po) == floor(po))cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<map>

std::map<long long, long long> m;

int main()
{
    int n = 0;
    while (scanf("%d", &n) == 1 && n) {
        m.clear();
        long long  w = 0;
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            scanf("%lld", &w);
            m[w]++;
        }
        std::map<long long, long long>::const_iterator it = m.begin();
        for (; it != m.end(); it++) {
            if (it->second & 1) cnt++;
        }
        printf("%d\n", cnt);
    }
    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define N 1000000007
typedef long long ll;
#define all(v) (v).begin(),(v).end()
#define sz(x) int(x.size())
int main(){
	int a,b,x;
	cin>>a>>b>>x;
	double ans;
	
	if(x<a*a*b/2){
		ans=90-atan((double)2*x/(a*b*b))/M_PI*180;
		}else{
			ans=atan(((double)2*b/a)-(double)2*x/(a*a*a));
	ans=ans/M_PI*180;
		}
	printf("%.9lf\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a, b, c, n;
string s;



int main()
{
cin>>a;
  cout<<a/3<<endl;
	
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

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 / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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


int main(){
ll a,b;
cin>>a>>b;
if(a!=b){
    cout<<max(a,b)+max(a,b)-1<<endl;
}
else{
    cout<<a*2<<endl;
}
}









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

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i, n) cin >> d[i];
  sort(d.begin(), d.end());
  int k = d[n/2] - d[n/2-1];
  cout << k << endl;
  
  return 0;
}

Measured memory_bytes: 3724
#include<iostream>
#include<string>
#include <vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<bitset>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define vsort(v) sort(v.begin(), v.end())
#define rv(v) reverse(v.begin(), v.end())
#define ll long long
using vll = vector<ll>;
using Graph = vii;
const ll MOD = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	vector<pii> a(n);
	rep(i, n) {
		int k;
		cin >> k;
		pii p;
		p = make_pair(k, i + 1);
		a[i] = p;
	}
	vsort(a);
	rep(i, n) {
		cout << a[i].second<<" ";
	}
	cout << endl;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define pb push_back
using namespace std;

int ans;

void solve(void){
	int n;
	cin >> n;
	for(int a = 1; a <= n-1; a++){
		int last = n / a;
		if(n % a == 0){
			last--;
		}
		if(!last){
			continue;
		}
		ans += (last-1+1);
	}
	
	cout << ans << endl;
}

signed main() {
int t = 1;
// cin >> t;    
	while(t--)
    solve();

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>

using namespace std;
typedef long long ll;
ll N;

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

    vector<int > l(N, 0);

    for(int i = 0; i < N; i++){
        cin >> l[i];
    }

    int ans = 1;
    int f = 0;
    for(int i = 1; i < N; i++){
        int t = l[i];
        int f = 0;
        for(int j = i - 1; j >= 0; j--){
            //cout << l[j] << endl;
            if(t < l[j]){
                f = 1;
                break;
            }
        }

        if(f != 1){
            ans++;
        }
        
    }
    cout << ans << endl;
} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int K = scanner.nextInt();
    int Q = scanner.nextInt();
    int[] win = new int[N];
    for (int i = 0; i < Q; i++) win[scanner.nextInt() - 1]++;
    for (int i = 0; i < N; i++) {
      if (K - Q + win[i] > 0) System.out.println("Yes");
      else System.out.println("No");
    }
  }
}


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

int main(){
    int n;
    cin>>n;
    
    int i=1;
    while(1){
        int x=i;
        
        if(x%3==0){
            cout<<" "<<i;
        }
        else{
            while(1){
                if(x%10==3){
                    cout<<" "<<i;
                    break;
                }
                x/=10;
                if(x==0)break;
            }
        }
        
        if(++i>n) break;
    }
    cout<<endl;
    
    return 0;
}


Measured memory_bytes: 3096
# coding: utf8

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

if __name__ == "__main__":
    n, m, X, Y  = read_int_n()
    x = read_int_n()
    y = read_int_n()
    x.append(X)
    y.append(Y)
    x_max = max(x)
    y_min = min(y)
    if y_min > x_max:
        print("No War")
    else:
        print("War")

Measured memory_bytes: 3064
n,m=map(int,input().split())
n_pict=[]
m_pict=[]
for _ in range(n):
  n_pict.append(input())
for _ in range(m):
  m_pict.append(input())
  
for y in range(n-m+1):
  for x in range(n-m+1):
    found=True
    for a in range(m):
      if m_pict[a]!=n_pict[y+a][x:x+m]:
        found=False
        break
    if found:
      print("Yes")
      exit()
print("No")
  

Measured memory_bytes: 9152
import itertools

n = int(input())
name_list = []
march = [0] * 5
name = {'M', 'A', 'R', 'C', 'H'}

for i in range(n):
    s = input()
    if s[0] not in name:
        continue
    else:
        name_list.append(s[0])
        if s[0] == 'M':
            march[0] += 1
        elif s[0] == 'A':
            march[1] += 1
        elif s[0] == 'R':
            march[2] += 1
        elif s[0] == 'C':
            march[3] += 1
        elif s[0] == 'H':
            march[4] += 1
if len(set(name_list)) < 3:
    print(0)
    exit()
else:
    ans = 0
    for i in itertools.combinations(set(name_list), 3):
        tmp = 1
        for j in i:
            if j == 'M':
                j = 0
            elif j == 'A':
                j = 1
            elif j == 'R':
                j = 2
            elif j == 'C':
                j = 3
            else:
                j = 4
            tmp *= march[j]
        ans += tmp

    print(ans)

Measured memory_bytes: 4024
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#include<bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define F first
#define S second
#define int long long
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()


void accell() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}

const int N = 2e5;


signed main() {
    accell();
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && b != c || a == c && a != b || b == c && a != b) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int a,b,c,j,e;
  scanf("%d %d %d",&a,&b,&c);
int d[a];
  
  for(j=0;j<a;++j)
  {
  scanf("%d",&d[j]);
    e=1;
  while(e<=b){e=e+d[j];
             c++;
             }
  }
  
  printf("%d",c);
  
return 0;
}

Measured memory_bytes: 128
N,M = gets.split.map(&:to_i)

A = Array.new
B = Array.new

(1..N).each do |i|
    str = gets
    A.push(str)
end 

(1..M).each do |i|
    str = gets
    B.push(str)
end

(0..(N - M)).each do |i|
    (0..(N - M)).each do |j|
        f = true
        (0..M - 1).each do |k|
            (0..M-1).each do |l|
                f = false if B[k][l] != A[i + k][j + l]
            end
        end
        if f
            puts("Yes")
            exit(0)
        end
    end
end

puts("No")

Measured memory_bytes: 14316
#include <bits/stdc++.h>
    using namespace std;
    
    int main(){
        int n;
        cin >> n;
        long ans = 0;
        long x , y;
        x = n * 800;
        y = n / 15;
        y *= 200;
        cout << x - y << endl;
        return 0;
    }

Measured memory_bytes: 256
import math

# print("{}/{}={} %{}".format(-123, 10, -123/10, -123 %10))
n = int(input())
if n == 0:
    print(0)
    exit()
out = ""
i = 0
while n != 0:
    if n % -2 != 0:
        out = str(- (n % -2)) + out
        # print("n:{} div:{}=(-2)^{}".format(n, (-2) ** i, i))
    else:
        out = str(- (n % -2)) + out

    # 12 -> 2 + 10^1, -12 -> 8 + 2*(-10)^1
    if n > 0:
        n = int(n / (-2))
    else:
        n = math.ceil(n / (-2))
    i += 1
print(out)


Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

const ll mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) 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 {
  std::vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    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];
  }
};

ll N, A, B, C;
combination comb( 1000010 );

int main()
{
  std::cin >> N >> A >> B >> C;

  mint hund = mint(100).inv();
  mint p = mint(A+B).inv()*A;
  mint q = mint(A+B).inv()*B;
  mint pProd = 1, qProd = 1;

  mint ans = 0;

  rep( i, N ) {
    ans += mint(p).pow(N)*qProd*comb( N-1+i, i )*(N+i);
    ans += pProd*mint(q).pow(N)*comb( N-1+i, i )*(N+i);
    pProd *= p;
    qProd *= q;
  }

  ans /= hund*(A+B);

  std::cout << ans.x << std::endl;

  return 0;
}

Measured memory_bytes: 16000
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	ll a, b; cin >> a >> b;
	cout << a / __gcd(a, b) * b << endl;
	
	return 0;
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

bool comp(int a, int b){
    return (a<b);
}

int main(){
    int n; cin >> n;
    vector<int> a(n), b(n);
    REP(i,0,n) cin >> a[i];
    b = a;
    sort(a.begin(), a.end());
    string flg = "YES";
    int cnt = 0;
    REP(i,0,n){
        if(a[i]!=b[i]){
            cnt++;
            if(cnt>2) flg = "NO";
        }
    }
    cout << flg << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
	public static void main(String[] args) {
 
	    Scanner sc = new Scanner(System.in);
	    int x = sc.nextInt();
	    int y = sc.nextInt();
	    
	    for (int i = 0; i <= x; i++) {
	      if (2*i + 4*(x-i) == y) {
	        System.out.println("Yes");
	        System.exit(0);
	      }
	    }
	    System.out.println("No");
  }
}

Measured memory_bytes: 27052
#include<bits/stdc++.h>
using namespace std;
#define ll long long
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;


int main(){
    fast_io

    int s, w;
    cin>>s>>w;

    if(w>=s) cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
    
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
  using namespace std;
  #define int long long int
  #define vi vector<int>
  #define pii pair<long long ,long long>
  #define pll pair<int,int>
  #define mod 1000000007
  #define hell 998244353
  #define all(x) x.begin(),x.end()
  #define mp(x,y) make_pair(x,y)
  #define mem(a,val) memset(a,val,sizeof(a))
  #define eb push_back
  #define ff first
  #define ss second
  #define rep(n) for(int i=0;i<n;i++)
  #define lb lower_bound
  #define up upper_bound
  int dp[105][100005];
  int pre[100005];
  void solve()
  { 
     
      
   int n,k;
    cin>>n>>k;
    vi v(n);
    rep(n)
     cin>>v[i];

    for(int i=0;i<=k;i++)
    {
       if(i<=v[0])
       dp[0][i]=1;

    }

    for(int i=1;i<n;i++)
    {
       pre[0]=dp[i-1][0];
       for(int l=1;l<=100000;l++)
       {
           pre[l]=(pre[l-1]%mod+dp[i-1][l]%mod)%mod;
           pre[l]%=mod;
       }
       for(int j=0;j<=k;j++)
       {
           
           int g=j-v[i];
           
           dp[i][j]=g>0?(pre[j]%mod-pre[g-1]%mod+mod)%mod:(pre[j]%mod);
           

       }
    } 

    cout<<dp[n-1][k];



   

  






  }



  signed main()
  {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


   
    
    
    int T;
    T=1;
    
    while(T--)
    {
      solve();
    }
    return 0;
  }

Measured memory_bytes: 80128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <string>

typedef long long ll;
using namespace std;
const int mod = 1000000007;

int main() {


    ll n; cin >> n;

    ll ans = 0;

    for (ll i = 10; i <= n; i*=5) {
        ans += n / i;
    }

    if (n % 2) {
        cout << 0 << '\n';
    }
    else {
        cout << ans << '\n';
    }

}


Measured memory_bytes: 256
INTMAX = 9223372036854775807
def LI(): return [int(x) for x in input().split()]
def II(): return int(input())

N=II()
INL=LI()
dp=[INTMAX]*N
dp[0] = 0
dp[1] = abs(INL[1]-INL[0])

for i in range(2, N):
    dp[i] = min(dp[i-1]+abs(INL[i-1]-INL[i]), dp[i-2]+abs(INL[i-2]-INL[i]))

print(dp[N-1])


Measured memory_bytes: 13980
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repb(i, n) for (int i = (int)n; i >= 0; i--)
#define reps(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define repsb(i, m, n) for (int i = (int)m; i >= (int)n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[])
{
    int n;
    long long int t, x = 0;

    cin >> n >> t;

    vector<long long int> v(n);
    rep(i, n)
    {
        cin >> v[i];
    }
    x = t;
    rep(i, n - 1)
    {
        if (t + v[i] > v[i + 1])
        {
            x += v[i + 1] - v[i];
        }
        else
        {
            x += t;
        }
    }
    cout << x << endl;

    return 0;
}


Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)

n=int(input())
d=list(map(int,input().split()))
S=sum(d)
ans=0
for i in range(n):
    S-=d[i]
    ans+=d[i]*S
print(ans)

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

main(){
	int dp[100000],n,v[200000],ans;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(abs(v[i]-v[i-1])+dp[i-1],abs(v[i]-v[i-2])+dp[i-2]);
	}

	
	cout<<dp[n-1];
}
	

Measured memory_bytes: 1024
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;

int main(int argc, char* argv[])
{
    int a,b;
    scanf("%d%d", &a, &b);
    ll sum=0;
    if(a==1) {
        sum+=300000;
    }
    else if(a==2) {
        sum+=200000;
    }
    else if(a==3) {
        sum+=100000;
    }

    if(b==1) {
        sum+=300000;
    }
    else if(b==2) {
        sum+=200000;
    }
    else if(b==3) {
        sum+=100000;
    }
    if(a==1 && b==1) {
        sum+=400000;
    }
    printf("%lld\n", sum);

    return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

//scanf("%d",&x);
//printf("%d",x);
//for(i=0;i<N;i++){  }
//if( == ){  }else{  }
//while( ){  }

/*
int N, i;
int H[100];
scanf("%d", &N);
for (i = 0; i < N; i++) scanf("%s", &H[i]);
*/

int main()
{
	int N, i, S1 = 0, S2 = 0;;
	int A[20];
	int B[50];
	int C[50];
	scanf("%d", &N);
	for (i = 0; i < N; i++) scanf("%d", &A[i]);
	for (i = 0; i < N; i++) scanf("%d", &B[i]);
	for (i = 0; i < N-1; i++) scanf("%d", &C[i]);

	for (i = 0; i < N; i++) {
		S1 += B[i];
	}

	for (i = 0; i < N; i++) {
		if (A[i] + 1 == A[i + 1]) {
			int t = A[i];
			S2 += C[t-1];
		}
	}

	printf("%d", S2+S1);
}


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

n, m = map(int, input().split())
s = input().strip()

ans = []

now = n
while now != 0:
    tmp = False
    for i in range(m, 0, -1):
        if now-i >= 0 and s[now-i] == '0':
            tmp = True
            now -= i
            ans.append(i)
            break
    if not tmp:
        print(-1)
        sys.exit()
print(*ans[::-1])

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

int main() {
  int n, a, c ;
  cin >> n >> a;
  c = n % 500;
 //  cout << c << endl;
  if (c <= a) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  // ここにプログラムを追記
}

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

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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

int on[30][1000001];

int solve(){
  int n,C;cin>>n>>C;

  int s,t,c;
  rep(i, n){
    cin>>s>>t>>c;
    s *= 10;
    s -= 5;
    t *= 10;
    c--;
    on[c][s] += 1;
    on[c][t] -= 1;
  }
  dump_1d(on[1], 121);

  rep(i, 30){
    rep(j, 1000000){
      on[i][j+1] += on[i][j];
    }
  }

  int res = 0;
  rep(j, 1000000){
    int cnt = 0;
    rep(i, 30){
      cnt += (on[i][j] ? 1: 0);
      chmax(res, cnt);
    }
  }

  cout << res << endl;

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 234752
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;

int main() {
	int n = 0;
	cin >> n;
	long long count = 0, rating = 0;
	set<string> s;
	for (int i = 0; i < n; i++) {
		cin >> rating;
		if (rating >= 1 && rating <= 399)
			s.insert("grey");
		else if (rating >= 400 && rating <= 799)
			s.insert("brown");
		else if (rating >= 800 && rating <= 1199)
			s.insert("green");
		else if (rating >= 1200 && rating <= 1599)
			s.insert("cyan");
		else if (rating >= 1600 && rating <= 1999)
			s.insert("blue");
		else if (rating >= 2000 && rating <= 2399)
			s.insert("yellow");
		else if (rating >= 2400 && rating <= 2799)
			s.insert("orange");
		else if (rating >= 2800 && rating <= 3199)
			s.insert("red");
		else
			count++;
	}
	if (s.size() > 0)
		cout << s.size() << " " << (long long) s.size() + count << endl;
	else if (count > 0)
		cout << 1 << " " << count << endl;
	else
		cout << 0 << " " << 0 << endl;
	return 0;
}


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

#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int

int32_t main()
{
	fastIO;
	
	int n,t,i;
	cin>>n>>t;
	int ans=100000;
	for(i=0;i<n;i++)
	{
		int x,y;
		cin>>x>>y;
		if(y<=t)
		{
			ans=min(ans,x);
		}
	}
	if(ans<=1000)
		cout<<ans;
	else
		cout<<"TLE";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	vector<string> s(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> s.at(i);
	}
	sort(s.begin(),s.end());
	int count=0;
	if(n==1){
		cout << 1 << endl;
	}
	else{
	for (int i = 0; i < n-1; ++i)
	{
		if(s.at(i+1)!=s.at(i)){
			count++;
		}
	}

	cout << count+1 << endl;
	}
}

Measured memory_bytes: 9520
#!/usr/bin/env python
# coding: utf-8

# In[3]:


X = int(input())


# In[4]:


if X < 600:
    ans = 8
elif X < 800:
    ans = 7
elif X < 1000:
    ans = 6
elif X < 1200:
    ans = 5
elif X < 1400:
    ans = 4
elif X < 1600:
    ans = 3
elif X < 1800:
    ans = 2
elif X < 2000:
    ans = 1
print(ans)


# In[ ]:






Measured memory_bytes: 9172
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  ll a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;
  if (v <= w) {
    cout << "NO" << endl;
  } else {
    if (abs(a - b) <= t * (v - w)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3644
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

priority_queue<ll> a;
vector<ll> lis;
std::map<ll, ll> bun;
void saiki(ll current, ll val){
    if(current < lis.size() ){
        for (int i = 0; i <= bun[lis[current]]; i++) {
            saiki(current+1,val*(ll)pow(lis[current],i));
        }
    }else{
        // std::cout << val << std::endl;
        a.push(val);
    }
}

int main() {
    ll n,m;
    std::cin >> n>>m;
    ll now = m;
    ll c=2;
    
    while(c<=sqrt(m)){
        while(now!= 0 && now%c==0){
            bun[c]++;
            now/=c;
        }
        c++;
    }
    if(now!=1){
        bun[now]++;
    }
    for (auto e : bun) {
        lis.push_back(e.first);
    }
    
    saiki(0,1);
    
    while(!a.empty()){
        ll b = a.top();
        a.pop();
        if(m/b>=n){
            std::cout << b << std::endl;
            return 0;
        }
    }
    // 最大公約数をgとすると、ag,bg,cg,,,,zg = M;
    // (a+b+c+...+z)*g = M;
    // k*g = M;
    // k>=n
    // gが大きくなるためには、kをできるだけ小さく
    // n以上のMの約数で最小のK
    
}


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

using namespace std;

typedef long long ll;

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

    vector<ll> A(3*N);
    for(int i=0;i<3*N;i++){
        cin >> A[i];
    }

    vector<ll> presums(N+1, 0); // presums[i] = largest sum using only elements in [0, N+i)
    vector<ll> postsums(N+1, 0); // postsums[i] = smallest sum using only elements in [N+i, 3N)

    ll cursum = 0;
    priority_queue<ll> vals;
    for(int i=0;i<N;i++){
        cursum += A[i];
        vals.push(-A[i]);
    }

    presums[0] = cursum;
    for(int i=0;i<N;i++){
        // add next
        cursum += A[N+i];
        vals.push(-A[N+i]);
        // remove smallest
        ll smallest = vals.top();
        cursum += smallest;
        vals.pop();

        presums[i+1] = cursum;
    }

    // get postsums
    cursum = 0;
    while(!vals.empty()) vals.pop();

    for(int i=0;i<N;i++){
        cursum += A[3*N-1-i];
        vals.push(A[3*N-1-i]);
    }

    postsums[N] = cursum;
    for(int i=1;i<=N;i++){
        cursum += A[2*N-i];
        vals.push(A[2*N-i]);
        //remove largest
        ll largest = vals.top();
        cursum -= largest;
        vals.pop();

        postsums[N-i] = cursum;
    }
/*
    for(int i=0;i<=N;i++){
        cout << i << " " << presums[i] << " " << postsums[i] << endl;
    }*/

    ll best = presums[0] - postsums[0];
    for(int i=1;i<=N;i++){
        ll cur = presums[i] - postsums[i];
        if(cur>best) best=cur;
    }

    cout << best << endl;

    return 0;
}


Measured memory_bytes: 5368
import java.util.*;
import java.util.stream.*;

public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    long N = in.nextLong();
    long[] A = new long[5];
    long min = Long.MAX_VALUE;
    for (int i = 0; i < 5; i++) {
      A[i] = in.nextLong();
      min = Math.min(min, A[i]);
    }
    if (N <= min) {
      System.out.println(5);
    } else {
      System.out.println(N / min + (N % min == 0 ? 0 : 1) + 4);
    }
  }
}

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

int s[8][8];

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

int count(int x, int y, int tu) {
	int res = 0;
	for (int i = 0; i < 8; i++) {
		for (int j = 1;; j++) {
			int tx = x + dx[i] * j, ty = y + dy[i] * j;
			if (tx >= 0 && tx < 8 && ty >= 0 && ty < 8 && s[tx][ty]) {
				if (s[tx][ty] == tu) {
					res += j - 1;
					break;
				}
			}
			else {
				break;
			}
		}
	}
	return res;
}

void pu(int x, int y, int tu) {
	s[x][y] = tu;
	for (int i = 0; i < 8; i++) {
		for (int j = 1;; j++) {
			int tx = x + dx[i] * j, ty = y + dy[i] * j;
			if (tx >= 0 && tx < 8 && ty >= 0 && ty < 8 && s[tx][ty]) {
				if (s[tx][ty] == tu) {
					for (int k = j - 1; k > 0; k--) {
						s[x + dx[i] * k][y + dy[i] * k] = tu;
					}
					break;
				}
			}
			else {
				break;
			}
		}
	}
}

int main()
{
	char c;
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			cin >> c;
			if (c == 'o') {
				s[i][j] = 1;
			}
			else if (c == 'x') {
				s[i][j] = -1;
			}
		}
	}
	int tu = 1, tc = 0;
	while (true) {
		int px, py, cha = 0;
		if (tu == 1) {
			for (int i = 0; i < 8; i++) {
				for (int j = 0; j < 8; j++) {
					if (s[i][j] == 0) {
						int cnt = count(i, j, tu);
						if (cnt > cha) {
							cha = cnt;
							px = i;
							py = j;
						}
					}
				}
			}
		}
		else {
			for (int i = 7; i >= 0; i--) {
				for (int j = 7; j >= 0; j--) {
					if (s[i][j] == 0) {
						int cnt = count(i, j, tu);
						if (cnt > cha) {
							cha = cnt;
							px = i;
							py = j;
						}
					}
				}
			}
		}
		if (cha == 0) {
			if (tc == 0) {
				tc++;
			}
			else {
				break;
			}
		}
		else {
			tc = 0;
			pu(px, py, tu);
		}
		tu = -tu;
	}
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			cout << (s[i][j] ? s[i][j] > 0 ? 'o' : 'x' : '.');
		}
		cout << endl;
	}
	return 0;
}

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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

using namespace std;

typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector< vector<int> > Matrix;

int main() {
	vi h;
	int n, i, j, k;

	cin >> n;
	h.resize(n);
	rep(i, n) {
		cin >> h[i];
	}

	k = 1;
	j = h[0];
	
	repj(i, 1, n) {
		if (j <= h[i]) {
			k++;
			j = h[i];
		}
	}

	cout << k;

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define REP3(i,x,n) for(int i=x; i>(n); i--)
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    string s;
    cin >> s;
    ll q;
    cin >> q;
    string t;
    REP(qi,q){
        int ty;
        cin >> ty;
        if(ty ==1){
            swap(s,t);
        }else{
            int f; char c;
            cin >> f >> c;
            if(f == 1){
                t +=c;
            }else{
                s += c;
            }
        }
    }
    reverse(ALL(t));
    t +=s;
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 1200
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d,i;
    cin>>a>>b>>c;
    i=0;
    for (int x = a; x <= b; x++){
        d=c%x;
        if (d==0) i+=1;
    }
    cout<<i<<endl;
    return 0;
}


Measured memory_bytes: 3112
import           System.IO
import           Control.Monad
import           Control.Applicative
import           Control.Monad.State

f i =
  (state $ \(x, n) -> (i, ((max x (i - n)), (min n i)))) :: State (Int, Int) Int
main = do
  n    <- readLn
  list <- replicateM n (readLn :: IO Int)
  let listS = sequence $ map f list
  print $ fst $ execState listS (minBound, maxBound)



Measured memory_bytes: 182304
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  cout <<a-1+(b>=a) << endl;
  return 0;
}

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

LLs = []

def dfs(d, num):
    LLs.append(num)
    
    if d == 10: return

    a = num % 10
    for i in [-1, 0, 1]:
        b = a + i
        if  0 <= b < 10:
            dfs(d+1, num * 10 + b)

d = 1
for i in range(1, 10):
    dfs(d, i)

print(sorted(LLs)[K-1])

Measured memory_bytes: 13824
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a+b+c >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

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


int main(){
  ll A,B; cin>>A>>B;

  ll ans = A*B/gcd(A,B);
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  int i,max,mi,mj,len,l,r=0,b[1000]={0};
  char d[1000][40],s[40];
  while(scanf("%s",s)!=EOF){
    for(i=0;i<r;i++){
      if(strcmp(s,d[i])==0)break;
    }
    if(i==r)strcpy(d[r++],s);
    b[i]++;
    if(max<b[i])max=b[mi=i];
    l=strlen(s);
    if(len<l){
      len=l;
      mj=i;
    }
  }
  printf("%s %s\n",d[mi],d[mj]);
  return 0;
}

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

int n;
double d1,x,ans;

int main(){
	cin>>n>>d1>>x;
	while(n){
		ans+=d1+(n-0.5)*x;
		d1=((n+1)*d1+2.5*x)/n;
		x*=2.0/n+1;
		--n;
	}
	printf("%.9f\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
 
int main() {
 
  string a,b,c;
  cin >> a;
  
  cout << a.substr(0,4) << " " << a.substr(4,8)<<endl;
  
  
  return 0;
}


Measured memory_bytes: 256
def bfs(field,H,W,start_x,start_y,tmp_N):
    direction = [[-1,0],[1,0],[0,-1],[0,1]]
    que = []
    que.append([start_x,start_y])
    INF = 1000000
    min_path = [[INF] * W for i in range(H)]
    min_path[start_y][start_x] = 0
    while len(que) != 0:
        current = que.pop(0)
        for d in direction:
            nx = current[0] + d[0]
            ny = current[1] + d[1]
            if 0 <= nx < W and 0 <= ny < H and field[ny][nx] != "X" and min_path[ny][nx] == INF:
                min_path[ny][nx] = min_path[current[1]][current[0]] + 1
                if field[ny][nx] == tmp_N:
                    return nx,ny,min_path[ny][nx]
                else:
                    que.append([nx,ny])

def getField():
    matrix = []
    first = input().strip()
    H,W,N = map(int,first.split())
    for i in range(H):
        row = list(input().strip())
        for j in range(W):
            if row[j].isdigit():
                row[j] = int(row[j])
        matrix.append(row)
    return matrix,H,W,N

def getStart(field):
    for y in range(len(field)):
        for x in range(len(field[0])):
            if field[y][x] == "S":
                return x,y

def main():
    matrix,H,W,N = getField()
    sx,sy = getStart(matrix)
    distance = 0
    tmp_x,tmp_y,tmp_dist = bfs(matrix,H,W,sx,sy,1)
    distance += tmp_dist
    tmps = [tmp_x,tmp_y]
    for k in range(N-1):
        tmp_x,tmp_y,tmp_dist = bfs(matrix,H,W,tmps[0],tmps[1],k+2)
        distance += tmp_dist
        tmps = [tmp_x,tmp_y]
    print(distance)

if __name__=='__main__':
    main()

Measured memory_bytes: 36936
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
vector<vector<int> > G;
int n, k;

ll dfs(int i, int par){
    int colorpat;
    if(par == -1) colorpat = k-1;
    else colorpat = k-2;

    if(k < (int)G[i].size()) return 0;
    ll patt = 1;
    for(auto e : G[i]) {
        if(e == par) continue;
        (patt *= colorpat * dfs(e, i)%MOD) %= MOD;
        --colorpat;
    }
    return patt;
}

int main(){

    cin >> n >> k;
    G.resize(n);

    for(int i = 0; i < n-1; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    cout << k*dfs(0, -1)%MOD << endl;

    return 0;
}


Measured memory_bytes: 11520
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log  # log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint


def ceil(a, b): return (a + b - 1) // b


inf = float('inf')
mod = 10 ** 9 + 7


def pprint(*A):
    for a in A:     print(*a, sep='\n')


def INT_(n): return int(n) - 1


def MI(): return map(int, input().split())


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [I() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')

def main():
    a = I()
    print(a + a*a + a*a*a)


if __name__ == '__main__':
    main()

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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b && a!=c) cout<<"Yes";
  else if(b==c && b!=a) cout<<"Yes";
  else if(c==a && c!=b) cout<<"Yes";
  else cout<<"No";
}

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using ll=long long;
using ld=long double;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;

template<typename T> bool chmin(T &a,const T b){if(a>b){a=b; return true;}return false;}
template<typename T> bool chmax(T &a,const T b){if(a<b){a=b; return true;}return false;}



int main(){
    int N, M; cin >> N >> M;
    vi L(M), R(M);
    for(int i=0; i<M; i++){
        cin >> L[i] >> R[i];
    }

    int l=L[0], r=R[0];
    bool flag=0;
    for(int i=1; i<M; i++){
        if(max(l, L[i]) <= min(r, R[i])){
            l=max(l, L[i]);
            r=min(r, R[i]);
        }
        else flag=true;
    }
    if(flag) cout << 0 << endl;
    else cout << r-l+1 << endl;
    return 0;
}

Measured memory_bytes: 4040