akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long q = sc.nextLong();
        long h = sc.nextLong();
        long s = sc.nextLong();
        long d = sc.nextLong();
        long n = sc.nextLong();
        sc.close();
        
        if(q*2 < h) h = q*2;
        if(h*2 < s) s = h*2;
        if(s*2 < d){
            System.out.print(n*s);
        }else{
            if(n%2 == 0){
                System.out.print(n*d/2);
            }else{
                System.out.print((n/2)*d + s);
            }
        }
    }
}

Measured memory_bytes: 23252
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double EPS = 1e-9;
const double INT_MAX = 2147483647;
#define rep(i, n) REP(i, 0, n)clim
#define REP(i, x, n) for(int i = x; i < (int)(n); i++)
#define rrep(i, n) RREP(i, 0, n)
#define RREP(i, x, n) for(int i = (int)(n) - 1 - (int)(x); i >= 0; i--)

int main(void){
    // Your code here!
    string s,t;
    cin >>s>>t;
    t.pop_back();
    if(s==t) cout << "Yes";
    else cout << "No";
}


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



int l[4],r[4];
double a[4]={1.1,0.6,0.2,0.1};

int main(){
	double x,y;
	while(cin>>x>>y){
		for(int i=0;i<4;i++){
			if(a[i]<=x){
				l[i]++;
				break;
			}
		}
		for(int i=0;i<4;i++){
			if(a[i]<=y){
				r[i]++;
				break;
			}
		}
	}
	for(int i=0;i<4;i++){
		cout<<l[i]<<' '<<r[i]<<endl;
	}
	return 0;
}

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


int main()
{
    int a,b;
    scanf("%d  %d",&a,&b);
    if(a-(2*b)>=0){printf("%d",a-(2*b));}
    else
    {
        printf("0");
    }
    return 0;
   
   
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

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;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

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

  constexpr ll MOD = 1000000007;
  int n, k;
  cin >> n >> k;
  if (n > k) {
    cout << 0 << endl;
    return 0;
  }
  vector<ll> fac(k + 1);
  vector<ll> inv_fac(k + 1);
  fac[0] = 1;
  FOR(i, 1, k + 1) { fac[i] = fac[i - 1] * i % MOD; }
  REP(i, k + 1) {
    ll x = fac[i];
    ll ans = 1;
    ll expo = MOD - 2;
    while (expo > 0) {
      if ((expo & 1) == 1) {
        ans = ans * x % MOD;
      }
      x = x * x % MOD;
      expo >>= 1;
    }
    inv_fac[i] = ans;
  }
  ll ans = (fac[k] * inv_fac[n] % MOD) * inv_fac[k - n] % MOD;
  cout << ans << endl;

  return 0;
}


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

long long int K, N, A[303030], L, R;

int main(){
    scanf("%lld%lld", &K, &N);
    if(K ^ 1){
        if(K & 1){
            fill(A, A + N, (K + 1) / 2);
            L = N;
            for(R = N / 2 + 1; --R;)if(--A[--L])for(; L < N; A[++L] = K);
            for(int i = 0; i < N; cout << A[i++] << " ")if(!A[i])return 0 & puts("");
        }else{
            cout << K / 2 << " ";
            for(; --N; cout << K << " ");
        }
    }else for(N = (N + 3) / 2; --N; cout << "1 ");
    return 0;
}


Measured memory_bytes: 4608
using System;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Trim();

            var i = s.Length - 1;
            var len = 0;
            while(i > 1){
                if(i % 2 == 0){
                    var l = i / 2;
                    var a = s.Substring(0, l);
                    var b = s.Substring(l, l);

                    if(a.Equals(b)){
                        len = Math.Max(len, i);
                    }
                }
                i--;
            }

            Console.WriteLine(len);
        }
    }
}


Measured memory_bytes: 13140
from itertools import accumulate

# 入力
Q = int(input())
l, r = zip(*(map(int, input().split()) for _ in range(Q)))

# エラトステネスのふるいにより、素数表を作成する
is_prime = [i >= 2 for i in range(10**5 + 1)]
for i in range(2, 10**5 + 1):
    if is_prime[i]:
        for j in range(2 * i, 10**5 + 1, i):
            is_prime[j] = False

# i以下の2017に似た数の累積和を求める
dp = list(
    accumulate(
        range(10**5 + 1),
        lambda acc, i:
            acc + 1 if is_prime[i] and is_prime[(i + 1) // 2] else
            acc
    )
)

# 累積和を用いて各クエリに回答する
ans = '\n'.join(
    str(dp[b] - dp[a - 1])
    for a, b in zip(l, r)
)

# 出力
print(ans)


Measured memory_bytes: 57604
#include <cstdlib>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 100005
#define pb push_back
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double PI  =3.141592653589793238463;
long long MOD = 1000000007;

int stringToInteger(string x){
    int gg=0;
    //stringstream geek(x);
    //geek >> gg;
    return gg;
}

ll powmod(ll a,ll b,ll m)
{
    ll ans=1;
    while(b>0){ if(b%2)
        {ans*=a; ans%=m;}
         b/=2; a=a*a; a=a%m;
        }
        return ans%m;
}
ll gcd(ll a,ll b)
{

    return __gcd(a,b);
}
ll mulmod(ll a,ll b,ll m)
{  ll ans=0;
    a %=m;
    while (b>0)
    {       if(b&1) ans = (ans + a) % m;
        a = (a * 2)%m;
        b /= 2;
    }
    return ans % m;
}

ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a;
 while(b > 0)
 	{
 		if(b%2 == 1)
 	{
 		x=(x*y);
 		if(x>MOD) x%=MOD;
 	}
 	y = (y*y);
 	if(y>MOD) y%=MOD;
 	b /= 2;
 	}
 return x;
}
ll modInverse(ll a, ll m)
{
    a = a%m;
    for (int x=1; x<m; x++)
       if ((a*x) % m == 1)
          return x;
}
ll maxDivide(ll a, ll b)
{
  while (a%b == 0)
   a = a/b;
  return a;
}
  set<ll>ans;
void primeFactors(ll n)
{

    while (n % 2 == 0)
    {
       ans.insert(2);
        n = n/2;
    }

    for (ll i = 3; i <= sqrt(n); i = i + 2)
    {
        // While i divides n, print i and divide n
        while (n % i == 0)
        {
            ans.insert(i);
            n = n/i;
        }
    }

    // This condition is to handle the case when n
    // is a prime number greater than 2
    if (n > 2)
        ans.insert(n);
}
ll is(ll no)
{   if(no==1) return 0;
    set<ll>::iterator it;
for(it=ans.begin();it!=ans.end();it++){
  no = maxDivide(no, *it);
  if(no==1) return 1;
//  if()
 // no = maxDivide(no, 3);
 // no = maxDivide(no, 5);
}
//if(no==1) return 1;
//for(it=ans.begin();it!=ans.end();it++){
//if(no==*it) return 1;
//}
  return 0;
}

int comp(string a,string b)
{
    string aa = a.append(b);
    string bb = b.append(a);

    return aa.compare(bb) > 0 ? 1: 0;

}
vector<pair<int,int> >adj[100005];
int colors[100005]={0};
void dfs(int i,int color,int prev1=-1)
{
 for(int j=0;j<adj[i].size();j++)
 {
     if(adj[i][j].first==prev1) continue;
//cout<<adj[i][j].second<<endl;
     if(adj[i][j].second&1)
     {

         colors[adj[i][j].first]=1-color;
     }
     else
         colors[adj[i][j].first]=color;
     dfs(adj[i][j].first,colors[adj[i][j].first],i);

 }
}
int main()
{
   long long a,b;
   cin>>a>>b;
   a=a*3;
   cout<<(a+b)/2<<endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define repi(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int gcd (int x, int y) {
    if (x < y) swap(x, y);
    if (y == 0) return x;
    return gcd(x % y, y);
}
int main(){
    int n;
    cin>>n;
    int ans=0;
    rep(i,n){
        int a;
        cin>>a;
        ans=gcd(ans,a);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
N = int(input())
ans = [0]*N
for i in range(1,100):
    for j in range(i,100):
        for k in range(j,100):
            x = i**2+j**2+k**2+i*j+j*k+k*i
            if x <= N:
                if i == j:
                    if j == k:
                        ans[x-1] += 1
                    else:
                        ans[x-1] += 3
                else:
                    if j == k:
                        ans[x-1] += 3
                    else:
                        ans[x-1] += 6
            else:
                break
            
                

for i in ans:
    print(i)

Measured memory_bytes: 9308
#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
using namespace std;

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





Measured memory_bytes: 3100
#include <iostream>
#include <string>

using namespace std;

int max(int a, int b) {

	return (a > b) ? a : b;

}

int main(void) {

	string strLine;
	int iI, iLocal, iGlobal;

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

	cin >> strLine;

	iLocal = 1;
	iGlobal = 0;

	for (iI = 1; iI < 4; iI++) {
		if (strLine[iI] == strLine[(iI - 1)])
			iLocal++;
		else
			iLocal = 1;
		iGlobal = max(iLocal, iGlobal);
	}

	(iGlobal >= 3) ? cout << "Yes\n" : cout << "No\n";

	return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <vector>

using namespace std;

int main(){
	int n, k, x, y, sum=0;
	scanf("%d",&n);
	scanf("%d",&k);
	scanf("%d",&x);
	scanf("%d",&y);

	for(int i=1; i<=n; i++){
		if( i < k+1 ) sum += x;
		else sum += y;
	}
	printf("%d\n",sum);

	return 0;
}


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

int main() {
  int a,b,c;
  while(cin >> a >> b >> c) {
    int d[11];
    fill(d,d+11,1);
    d[a]=0;d[b]=0,d[c]=0;
    int cnt=0;
    for(int i=1; i<=10; i++) {
      if(d[i] && a+b+i<=20) cnt++;
    }
    if(cnt>3) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 1152
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        long m = sc.nextLong();
        long[] values = new long[n];
        long lcm = 1;

        for (int i = 0; i < n; i++) {
            long value = sc.nextLong();
            values[i] = value;
            long valid = value / 2;
            lcm = (lcm * valid) / gcd(lcm, valid);
            if (m < lcm) {
                // 最小公倍数が上限より大きい
                System.out.println(0);
                return;
            }
        }

        for (int i = 0; i < n ; i++) {
            if (lcm % values[i] == 0) {
                // lcmはvalidの2が最大乗数分かけられていて、1 / 2される前の値と合致するということはvalues内の値の2の倍数の個数が違う
                System.out.println(0);
                return;
            }
        }

        System.out.println((m - lcm) / (2 * lcm) + 1);
    }

    private static long gcd(long a, long b) {
        long temp;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return b;
    }
}

Measured memory_bytes: 58308
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
	int N;
	cin >> N;
	vector<P> v;
	for(int i = 0; i < N; i++){
		int num;
		cin >> num;
		v.push_back(P(num, i + 1));
	}
	sort(v.begin(), v.end());
	for(int i = 0; i < N; i++){
		cout << v[i].second;
		if(i != N - 1){
			cout << " ";
		}else{
			cout << endl;
		}
	}
	return 0;
}

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

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;
    int dist[N+1][N+1];
    int ans[N+1];
    memset(dist, 0x3F, sizeof(dist));
    memset(ans, 0, sizeof(ans));
    for (int i = 1; i < N; i++){
        for (int j = i+1; j <= N; j++){
            dist[i][j] = min({abs(j-i), abs(X-i)+1+abs(j-Y), abs(Y-i)+1+abs(j-X)});
            ans[dist[i][j]]++;
        }
    }
    for (int i = 1; i < N; i++){
        cout << ans[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 15872
/******************************************
* AUTHOR : SOMU KUMAR *
* INSTITUTION : IIT BHUBANESWAR *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//code here...............//
int n;
cin>>n;
string s;
cin>>s;
int r=0,w=0;
for(int i=0;i<s.length();i++){
	if(s[i]=='R')r++;
	else w++;
}
string tmp="";
while(r--)tmp+='R';
while(w--)tmp+='W';
int cnt=0;
for(int i=0;i<s.length();i++){
	if(s[i]!=tmp[i])cnt++;
}
cout<<cnt/2<<endl;

return 0;
}

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

int main() {
  int w,h,n;
  cin >> w >> h >> n;
  int x1=0;
  int x2=w;
  int y1=0;
  int y2=h;
  for(int i=0;i<n;i++){
    vector<int> a(3);
    cin >> a.at(0) >> a.at(1) >> a.at(2);
    if(a.at(2)==1){
      x1=max(x1,a.at(0));
    }
    else if(a.at(2)==2){
      x2=min(x2,a.at(0));
    }
    else if(a.at(2)==3){
      y1=max(y1,a.at(1));
    }
    else{
      y2=min(y2,a.at(1));
    }
  }
  if(x2>x1 && y2>y1){
    cout << (x2-x1)*(y2-y1) << endl;
  }
  else{
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Contexts;
class Simple {
    private int N, K;
    private int[] a;
    void Solve() {
        //input
        N = io.Int;
        K = io.Int;
        a = new int[N];
        for(int i = 0; i < N; ++i) a[i] = io.Int;
        //cal
        Func <int, bool> check = (n) => {
            if(a[n] > K) return true;
            var dp = new bool[K];
            dp[0] = true;
            for(int i = 0; i < N; ++i) {
                if(i == n) continue;
                for(int j = K - 1; j >= 0; --j) 
                    if(dp[j] && j + a[i] < K)
                        dp[j + a[i]] = true;
            }
            for(int i = K - a[n]; i < K; ++i) 
                if(dp[i]) return true;
            return false;
        };
        Array.Sort(a);
        var ans = search(a, -1, N, check);
        //ret
        Console.WriteLine(ans);
    }
    int search(int[] arr, int ng, int ok, Func <int, bool> f) {
        while(Math.Abs(ok - ng) > 1) {
            var mid = (ok + ng) / 2;
            if(f(mid)) ok = mid;
            else ng = mid;
        }
        return ok;
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    private void Stream() {
        //var exStdIn = new System.IO.StreamReader("stdin.txt");
        //System.Console.SetIn(exStdIn);
        Solve();
        io.Flush();
    }
}
class SimpleIO {
    string[] _nextBuffer;
    int _bufferCnt;
    char[] cs = new char[] {' ', '"', ','};
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
    public SimpleIO() {
        _nextBuffer = new string[0];
        _bufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if(_bufferCnt < _nextBuffer.Length) return _nextBuffer[_bufferCnt++];
        var st = Console.ReadLine();
        while(st == "") st = Console.ReadLine();
        if(st != null) _nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        else st = "";
        _bufferCnt = 0;
        return _nextBuffer[_bufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void Flush() { Console.Out.Flush(); }
}
static class NumericEx {
    public static string pad0 <T>(this T v, int n) { return v.ToString().PadLeft(n, '0'); }
    public static double RoundOff(this double v, int n) { return Math.Round(v, n - 1, MidpointRounding.AwayFromZero); }
    public static bool Odd(this int v) { return v % 2 != 0; }
    public static bool Odd(this long v) { return v % 2 != 0; }
    public static void REP(this int v, Action <int> act) {
        for(int i = 0; i < v; ++i) act(i);
    }
    public static void REPR(this int v, Action <int> act) {
        for(int i = v - 1; i >= 0; --i) act(i);
    }
}


Measured memory_bytes: 13408
#include <bits/stdc++.h>
				using namespace std;
				#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
				#define ll long long int
				#define pb push_back
				#define fe first
				#define se second
				#define endl "\n"
				#define pii pair<int, int>

				#define PI 3.14159265358979323846
				const int N = 1e5 + 10;
				int a,b,c;	   
               
				void solve() {
					
					cin>>a>>b>>c;
					int yo=b/a;
					if(yo>c)
					  cout<<c;
					else
					   cout<<yo;  
						
				}	  
					
				
					   

				int main() {
				  cool;
				  int t = 1;
				  while (t--)
					solve();

				  return 0;
				}


Measured memory_bytes: 256
import sys
H,W = map(int,input().split())
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
S = []

for i in range(H):
    s = list(input().split())
    S.append(s)

for i in range(H):

    for j in range(W):

        if S[i][j] == "snuke":
            print (alp[j]+str(i+1))
            sys.exit()


Measured memory_bytes: 38256
import itertools
n,m = map(int,input().split())
p = []
for i in range(m):
    p.append(list(map(int, input().split())))
l = [[] for i in range(n+1)]
for pi in p:
    l[pi[0]].append(pi[1])
    l[pi[1]].append(pi[0])
c = list(itertools.permutations(range(2,n+1), n-1))
ans = 0
for i in c:
  if i[0] not in l[1]:
    continue
  else:
    for j in range(1,len(i)):
      if i[j] not in l[i[j-1]]:
        break
    else:
      ans += 1
print(ans)
  

Measured memory_bytes: 3572
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
A = get_ints

def cumulative_sum(arr)
  arr.reduce([0]) do |prev, cur|
    prev.push(prev.last + cur)
    prev
  end
end

MAX = (10**9) * 2 * (10 ** 5)
ax = cumulative_sum(A)

def check(arr)
  left_sums = []
  left = 0
  right = 0
  while left < N && right < N
    right_sum = arr[right] - arr[left]
    left_sum = arr[left]
    if left_sum >= right_sum
      prev_right_sum = left > 0 ? arr[right] - arr[left - 1] : MAX
      prev_left_sum = left > 0 ? arr[left - 1] : 0
      if (right_sum - left_sum).abs < (prev_right_sum - prev_left_sum).abs
        left_sums[right] = [left_sum, right_sum]
      else
        left_sums[right] = [prev_left_sum, prev_right_sum]
        left -= 1
      end
      right += 1
    else
      left += 1
    end
  end
  left_sums
end

left_sums = check(ax)[1..]

ax2 = cumulative_sum(A.reverse)

right_sums = check(ax2)[1..].reverse

ans = MAX
left_sums.zip(right_sums) do |(a, b), (c, d)|
  min = [a, b, c, d].min
  max = [a, b, c, d].max
  ans = max - min if max - min < ans
end

puts ans


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

using namespace std;

int f0[(int)1e6 +10 ];
int f1[(int)1e6 +10 ];

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

  string s; cin >> s;

  int d0 = s[0] - '0';
  f0[0] = d0;
  f1[0] = 10 - d0 + 1;
  int last_not_9 = d0 == 9 ? -1 : 0;

  for (size_t i = 1; i < s.length(); i++) {
    int d = s[i] - '0';
    f0[i] = d + min(f0[i - 1], f1[i - 1]);

    if (last_not_9 < 0) {
      f1[i] = 10 - d + 1;
    } else {
      f1[i] = 10 - d  + min(f1[last_not_9] - 1, f0[last_not_9] + 1);
    }

    if (d < 9) 
      last_not_9 = int(i);
  }

  
  cout << min(f0[s.length() - 1], f1[s.length() -1]) << endl;
}


Measured memory_bytes: 9116
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#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 all(x) (x).begin(), (x).end()
template <typename T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long MOD = 1e9 + 7;

int main() {
    ll N;
    cin >> N;
    ll fl = floor(sqrt(N)) + 1;
    ll min = LLONG_MAX;
    rep(i, 1, fl) {
        if(N % i != 0) continue;
        chmin(min, i + N / i - 2);
    }
    cout << min << endl;
}


Measured memory_bytes: 3608
function main()
    (N, Y) = map(x -> parse(Int, x), split(readline()))
    res10000 = res5000 = res1000 = -1
    for a = 0:N
        for b = 0:N - a
            c = N - a - b
            total = 10000 * a + 5000 * b + 1000 * c
            if total == Y
                res10000 = a
                res5000 = b
                res1000 = c
            end
        end
    end

    println("$res10000 $res5000 $res1000")
end

main()



Measured memory_bytes: 171040
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
typedef long long ll;
int main(){
    int n,k;cin>>n>>k;
    vector<int> v(n);
    rep(i,n) cin>>v[i];
    int maxi=0;
    rep(a,min(n,k)+1){
        rep(b,min(k-a,n-a)+1){
            int now=0;
            priority_queue<int, vector<int>, greater<int> > que;
            rep(i,a){
                que.push(v[i]);
            }
            reverse(v.begin(),v.end());
            rep(i,b){
                que.push(v[i]);
            }
            rep(i,(k-a-b)){
                if(que.size()==0||que.top()>=0)break;
                que.pop();
            }
            
            reverse(v.begin(),v.end());
            while(que.size()){
                now+=que.top();
                que.pop();
            }
            maxi=max(now,maxi);
        }
    }
    cout<<maxi<<endl;
}

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

ans = 0
m = 10**10
k = 0
for i in range(N):
    ans += abs(A[i])
    m = min(m,abs(A[i]))
    if A[i] < 0:
        k += 1

if k % 2 == 0:
    print(ans)
else:
    print(ans - 2*m)

Measured memory_bytes: 64752
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	x := getNextInt(scanner)
	n := getNextInt(scanner)
	pp := make([]int, n)
	for i := 0; i < n; i++ {
		pp[i] = getNextInt(scanner)
	}
	exists := make([]int, 201)
	for i := 0; i < n; i++ {
		exists[pp[i]] = 1
	}
	for i := 0; i < 101; i++ {
		if x-i >= 0 && exists[x-i] == 0 {
			fmt.Fprintln(writer, x-i)
			return
		}
		if x+i < 201 && exists[x+i] == 0 {
			fmt.Fprintln(writer, x+i)
			return
		}
	}
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1808
#include <bits/stdc++.h>
#define int long long
using namespace std;
int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

signed main(){
    int N,ans=0;
    cin >> N;
    int p[N];
    for(int i=0;i<N;i++){
        cin >> p[i];
        ans += p[i];
    }
    
    sort(p,p+N,greater<int>());
    
    
    cout << ans-p[0]/2 << endl;
    
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
n,p = map(int,input().split())
s = list(input())
s = [int(x) for x in s][::-1]
if p != 2 and p != 5:
    ans = 0
    data = [0 for _ in range(p)]
    now = 1
    data[0] = 1
    a = 0
    for i in range(n):
        a += now*s[i]
        a %=p
        data[a]+=1
        now *= 10
        now %= p
    for x in data:
        ans += x*(x-1)//2
    print(ans)
if p == 2:
    ans = 0
    for i,x in enumerate(s[::-1]):
        if x%2 == 0:
            ans += i+1
    print(ans)
if p == 5:
    ans = 0
    for i,x in enumerate(s[::-1]):
        if x%5 == 0:
            ans += i+1
    print(ans)

Measured memory_bytes: 61552
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;




signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(0);   

  #ifndef ONLINE_JUDGE
      if(fopen("INPUT.txt","r"))
      {
      freopen ("INPUT.txt" , "r" , stdin);
      freopen ("OUTPUT.txt" , "w" , stdout);
      }
    #endif  

  int n;
  cin>>n;
  multiset<int>s;
  int x;
  for(int i=0;i<(1<<n);i++)
  {
    cin>>x;
    s.insert(x);
  }  
  auto j=s.end();
  j--;

  vector<int>cur;
  cur.push_back(*j);
  s.erase(j);
  int cnt=n;
  while (cnt--)
  {
    vector<int>temp;
    for(auto i:cur)
    {
      auto j=s.lower_bound(i);
      if(j!=s.begin())
        j--;
      else
      {
        cout<<"No";
        return 0;
      }
      temp.push_back(*j);
      s.erase(j);
    }
    for(auto i:temp)
      cur.push_back(i);
  }
  
  cout<<"Yes";

}

Measured memory_bytes: 18312
#include <iostream> // cout, endl, cin
#include <iomanip>
#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 <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;
const int BG = 1000000007;

int main()
{
    vector<int> a(3);
    rep(i, 3) cin >> a.at(i);
    sort(a.begin(), a.end());
    cout << a[0] + a[1] << endl;
}


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

x2 = 0
for i in range(N):
    if i%2:
        x2 -= A[i]
    else:
        x2 += A[i]

ans = [0] * N
ans[0] = x2//2
for i in range(N-1):
    ans[i+1] = A[i] - ans[i]
for i in range(N):
    ans[i] *= 2
    
print(*ans)

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

int i, j, n, r, k, t, p, s, _d, v, ans;
int dic(int d[][100]) {
  int mi = s, f[100] = {};
  vector <int> cost(100, 100000000);
  cost[s] = 0; //テ・ツ、ツァテ、ツコツ?
  for(i = 0; i < n; i++) {
    f[mi] = 1;
    for(j = 0; j < n; j++)  if(d[mi][j] == 1 && !f[j] && cost[j] > cost[mi] + 1) cost[j] = cost[mi] + 1;
    int min = 200000000;
    for(j = 0; j < n; j++)  if(!f[j] && min > cost[j]) min = cost[mi = j];
  }
  return cost[_d];
}    

int main() {
  while(cin >> n) {
    int d[100][100] = {};
    for(i = 0; i < n; i++) {//
      cin >> r >> k;
      r--;
      while(k--) {
	cin >> t;
	t--;
	d[r][t] = 1;
      }
    }
    cin >> p;
    while(p--) {
      cin >> s >> _d >> v;
      s--; _d--;
      ans = dic(d) + 1;
      if(ans <= v)  cout << ans << endl;
      else cout << "NA" << endl;
    }
  }
  return 0;
}
    

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

int main()
{
    string n;
    cin >> n;
    if (n[0] == '7')
    {
        cout << "Yes" << endl;
    }
    else if (n[1] == '7')
    {
        cout << "Yes" << endl;
    }
    else if (n[2] == '7')
    {
        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;

    return 0;
}

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

input1 = raw_input()
input2 = raw_input()

N = int(input1)
S = input2


cutdic = {}
#切り方
for i in range(N):
    count = 0
    X = S[:i]
    Y = S[i:]
    setX = set(X)
    #print X, Y, setX
    for j in setX:
        if j in Y:
            count += 1
        cutdic[str(i) + "," + str(j)] = count

print (max(cutdic.values()))

Measured memory_bytes: 2948
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for C - Five Transportations
	var N int
	fmt.Scanf("%d", &N)

	var A, B, C, D, E float64
	fmt.Scanf("%f\n%f\n%f\n%f\n%f", &A, &B, &C, &D, &E)

	var min int
	min = int(math.Min(A, math.Min(B, math.Min(C, math.Min(D, E)))))
	fmt.Println(int(math.Ceil(float64(N)/float64(min))) + 4)
}


Measured memory_bytes: 1840
import java.util.Scanner;
public class Main{
	int x;
	public void solve(){
		Scanner sc=new Scanner(System.in);
		x=sc.nextInt();
		System.out.println(x*x*x);
	}
	
	public static void main(String[] args){
		Main obj=new Main();
		obj.solve();
	}
}

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

int main(int argc, char const *argv[])
{
  vector<int> a(3);
  for(int i = 0; i < 3; i++)
    cin >> a[i];

  sort(a.begin(), a.end());
  cout << a[0] << " " << a[1] << " " << a[2] << endl;
  return 0;
}

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

using namespace std;

int main(){
    int n,k; scanf("%d%d",&n,&k);
    int ans = 1;
    
    for(int i = 0 ; i < n ; i++){
        ans = min(ans * 2 , ans + k);
    }
    
    printf("%d\n",ans);
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll INF = 1e18+5;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string a,b;
    cin>>a>>b;
    vector<vector<pair<int,pair<int,int>>>> dp(a.size()+1,vector<pair<int,pair<int,int>>>(b.size()+1,{0,{0,0}}));
    // dp[i][j] - the max total length so far
    for (int i = 0; i < a.size(); ++i) {
        for (int j = 0; j < b.size(); ++j) {
            if(a[i]==b[j]){
                dp[i+1][j+1]=max(dp[i+1][j+1],{dp[i][j].first+1,{i,j}});
            }
            dp[i+1][j]=max(dp[i+1][j],{dp[i][j].first,{i,j}});
            dp[i][j+1]=max(dp[i][j+1],{dp[i][j].first, {i,j}});
        }
    }
    pair<int,pair<int,int>> res={0,{0,0}};
    for (int i = 0; i <= a.size(); ++i) {
        for (int j = 0; j <= b.size(); ++j) {
            res=max(res,{dp[i][j].first,{i,j}});
        }
    }
    string s="";
    if(res.first!=0){
        pair<int,int> cur=res.second;
        while(true){
            if(cur.first==0||cur.second==0){
                break;
            }
            int i=cur.first,j=cur.second;
            pair<int,int> prev=dp[i][j].second;
            if(prev==make_pair(i-1,j-1)){
                s+=a[i-1];
            }
            cur=prev;
        }
    }
    reverse(s.begin(),s.end());
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 105984
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		List<String> L1 = new List<String>();
		List<String> L2 = new List<String>();
		String[] A = new String[]{ "..",".#","##","#."};
		foreach(var s in A){
			var res = Query(s);
			if(res =="T"){
				L1.Add(s.Substring(0,1));
				L2.Add(s.Substring(1));
			}else if(res =="end"){
				return;
			}
		}
		
		var ans = L1[0]+L2[0];
		bool forward = true;
		while(true){
			if(forward){
				bool chk = false;
				for(int t=0;t<L1.Count;t++){
					int n = ans.Length/2;
					var res = Query(L1[t]+ans.Substring(0,n)+L2[t]+ans.Substring(n));
					if(res == "end"){
						return;
					}else if(res == "T"){
						ans = L1[t]+ans.Substring(0,n)+L2[t]+ans.Substring(n);
						chk = true;
						break;
					}
				}
				if(!chk)forward = false;
			}else{
				for(int t=0;t<L1.Count;t++){
					int n = ans.Length/2;
					var res = Query(ans.Substring(0,n)+L1[t]+ans.Substring(n)+L2[t]);
					if(res == "end"){
						return;
					}else if(res == "T"){
						ans = ans.Substring(0,n)+L1[t]+ans.Substring(n)+L2[t];
						break;
					}
				}
			}
			
		}
		
		
		
		
	}
	
	String Query(String s){
		int n = s.Length/2;
		Console.WriteLine(s.Substring(0,n) +"\n" + s.Substring(n));
		Console.Out.Flush();
		return Console.ReadLine();
	}
	
	int N;
	public Sol(){
		N = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;

int main() {
    lli p, q, r;
    cin >> p >> q >> r;
    if (p >= q && p >= r)
        cout << q+r << endl;
    else if (q >= p && q >= r)
        cout << p+r << endl;
    else
        cout << p+q << endl;
}


Measured memory_bytes: 256
#include <cstdint>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

#define GRAPH_SIZE 10000
#define WEIGHT_MAX UINT32_MAX

enum state_t { WHITE, GRAY, BLACK };

static state_t state[GRAPH_SIZE];
static priority_queue<pair<uint32_t, uint32_t>, vector<pair<uint32_t, uint32_t>>, greater<pair<uint32_t, uint32_t>>> min_queue;
static vector<pair<uint32_t, uint32_t>> graph[GRAPH_SIZE];
static uint64_t dist[GRAPH_SIZE];

void single_source_shortest_path(size_t num)
{
  for (uint32_t i = 0; i < num; i++) {
    dist[i] = WEIGHT_MAX;
    state[i] = WHITE;
  }

  state[0] = GRAY;
  dist[0] = 0;
  min_queue.push(make_pair(dist[0], 0));

  while (!min_queue.empty()) {
    pair<uint32_t, uint32_t> min = min_queue.top();
    min_queue.pop();
    uint32_t min_index = min.second;
    if (state[min_index] != BLACK) {
      state[min_index] = BLACK;
      for (uint32_t i = 0; i < graph[min_index].size(); i++) {
        pair<uint32_t, uint32_t> to = graph[min_index][i];
        uint32_t to_index = to.first;
        uint32_t to_weight = to.second;
        if (((dist[min_index] + to_weight) < dist[to_index]) && (state[to_index] != BLACK)) {
          dist[to_index] = dist[min_index] + to_weight;
          min_queue.push(make_pair(dist[to_index], to_index));
          state[to_index] = GRAY;
        }
      }
    }
  }
}

int32_t main()
{
  uint32_t num;
  cin >> num;

  for (uint32_t i = 0; i < num; i++) {
    uint32_t index, len;
    cin >> index >> len;
    for (uint32_t j = 0; j < len; j++) {
      uint32_t connect, weight;
      cin >> connect >> weight;
      graph[index].push_back(make_pair(connect, weight));
    }
  }

  single_source_shortest_path(num);

  for (uint32_t i = 0; i < num; i++) {
    cout << i << " " << dist[i] << endl;
  }

  return 0;
}

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

int x, y, dir;

void paint(vector<vector<int>>& bar, int color, int times) {
  for (int i = 0; i < times; ++ i) {             
    bar[x][y] = color;
    if (!dir) {
      ++ y;
      if (y == bar[0].size()) {
        -- y;
        ++ x;
        dir = 1;
      }
    } else {
      -- y;
      if (y < 0) {
        ++ y;
        ++ x;
        dir = 0;
      }
    }
  }
}

int main()
{
  int H, W, N;
  cin >> H >> W >> N;
  vector<vector<int>> bar = vector<vector<int>> (H, vector<int> (W));
 
  x = y = dir = 0;
  int times;
  for (int i = 1; i <= N; ++ i) {
    cin >> times;
    paint(bar, i, times);
  }
  for (int i = 0; i < bar.size(); ++ i) {
    for (int j = 0; j < bar[0].size(); ++ j) {
      cout << bar[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
const double EPS=1e-10;
typedef pair<int,int> pii;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int n,m;
const int Maxn=2e5+5;
vector<int>from[Maxn];

bool vis[Maxn];
int size_group[Maxn];
int cpnCount;

void dfs(int u){
	if(vis[u])return;
	vis[u]=true;
	size_group[cpnCount]++;
	for(int i=0;i<SZ(from[u]);i++){
		int to=from[u][i];
		dfs(to);
	}
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		a--;
		b--;
		from[a].push_back(b);
		from[b].push_back(a);
	}
	for(int i=0;i<Maxn;i++){
		if(!vis[i]){
			dfs(i);
			cpnCount++;
		}
	}
	int ans=0;
	for(int i=0;i<cpnCount;i++){
		chkmax(ans,size_group[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 21044
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
long long n,a[120000],b[120000],x,tail,tot;
char s[10]; 
int main(){
	scanf("%lld",&n);
	scanf("%lld",&a[1]);
	tail=1;
	tot=a[1];
	for(int i=2;i<=n;i++){
		scanf("%s",s+1);
		scanf("%lld",&x);
		tot+=x;
		if(s[1]=='-'){
			tail++;
			a[tail]=x;
			b[tail]=x;
		}else a[tail]+=x;
	}
	long long ans=1000000000000000000LL,bns=0;
	for(int i=2;i<=tail;i++){
		ans=min(ans,bns+a[i]);
		bns+=b[i];
	}
	if(tail==1)ans=0;
	printf("%lld\n",tot-2*ans);
}

Measured memory_bytes: 1792
#include <iostream>

int main()
{
    int n;

    std::cin >> n;

    for (int i7 = 0; i7 < n; i7++) {
        for (int i4 = 0; i4 < n; i4++) {
            int sum = i7 * 7 + i4 * 4;
            if (sum == n) {
                std::cout << "Yes" << std::endl;
                return 0;
            }
        }
    }

    std::cout << "No" << std::endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt(), M = scn.nextInt();
		System.out.println((N==M)?"Yes":"No");
	}

}


Measured memory_bytes: 23764
/**
*    author:  y_takano
*    created: 19.06.2020 11:30:14
**/

#include <bits/stdc++.h>

using namespace std;

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

    int n, x;
    cin >> n;

    for (int i = 1; i <= n; i++)
    {
        x = i;
        if (x % 3 == 0)
        {
            cout << ' ' << i;
            continue;
        }

        while (x != 0)
        {
            if (x % 10 == 3)
            {
                cout << ' ' << i;
                x = 0;
            }
            x /= 10;
        }
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 3204
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define ll long long
#define rep(i, a, b) for(ll i = (ll)a; i < (ll)b; i++)
using namespace std;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  rep(i, 0, n) {
    rep(j, 0, (int)s.size()) {
      if(s[j] == 'Z') s[j] = 'A';
      else s[j]++;
    }
  }
  cout << s << "\n";
}

Measured memory_bytes: 3616
h, w = map(int, input().split())
magic = [list(map(int, input().split())) for _ in range(10)]
for i in range(10):
    for j in range(10):
        for k in range(10):
            magic[j][k] = min(magic[j][k], magic[j][i]+magic[i][k])

ans = 0
for i in range(h):
    a = list(map(int, input().split()))
    for j in range(w):
        if a[j] == -1:
            continue
        ans += magic[a[j]][1]

print(ans)


Measured memory_bytes: 40556
///
// File:  b.go
// Author: ymiyamoto
//
// Created on Sat Jun 16 23:17:04 2018
//
package main

import "fmt"

var D, N int

func main() {
	fmt.Scan(&D, &N)

	ans := 1
	for i := 0; i < D; i++ {
		ans *= 100
	}

	if N == 100 {
		fmt.Println(ans*N + ans)
	} else {
		fmt.Println(ans * N)
	}
}


Measured memory_bytes: 512
typedef struct CC{
  int i;
  int y;
  char z;
} CC;

#include <stdio.h>

int gu(){
  int n = 0;
  int x = getchar_unlocked();
  if(x<=47||58<=x){
    return x;
  }
  while(48<=x&&x<58){
    n=10*n+(x & 0xf);
    x = getchar_unlocked();
  }
  return n;
}

void pn(int n){
  int i=0;
  char c[11];
  
  if(!n){
    putchar_unlocked('0');
    return;
  }
  while(n){
    c[i++]=(char)(n%10+'0'),n/=10;
  }
  while(i--){
    putchar_unlocked(c[i]);
  }
}

void *qp(CC *lon, CC *pan){
  CC pores = *(pan-1);
  CC *p = lon-1;
  for(CC *w = lon; w!=pan-1;++w){
    if(w->y<=pores.y){
      p++;
      CC bum = *p;
      *p = *w;
      *w = bum;
    }
  }
  CC bum = *++p;
  *p=pores;
  *(pan-1)=bum;
  return p;
}

void clock(void *lon, void *pan, size_t C){
  if(pan-lon<=C){
    return;
  }
  void *mi = qp(lon,pan);
  clock(lon,mi,C);
  clock(mi,pan,C);
}

int main(int argc, char **argv){
  int n = gu();
  CC X[n];
  for(int i=0;i<=n-1;++i){
    X[i].z=getchar_unlocked();
    getchar_unlocked();
    X[i].y=gu();
    X[i].i=i;
  }
  clock(X,X+n,sizeof(CC));

  int f=0;
  for(int i=1;i<=n-1;++i){
    if(X[i].y==X[i-1].y&&X[i].i<X[i-1].i){
      f=1;
	break;
    }
  }
  puts(f ? "Not stable" : "Stable");
  for(int i=0;i<=n-1;++i){
    putchar_unlocked(X[i].z), putchar_unlocked(' ');
    pn(X[i].y), putchar_unlocked('\n');
  }
  return 0;
}



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

class Class3
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());

        int wari = N / 1000;

        if (N % 1000 != 0)
        {
            wari = wari + 1;
        }

        Console.WriteLine((wari)*1000 - N);

    }
}

Measured memory_bytes: 27516
import java.util.Scanner;
public class Main{
    static char [][] f;
    static int H,W;
    static int count;
    static boolean [][] k;
    
    static void kukaku(int i,int j) {
        if(!k[i][j]) {
            k[i][j]=true;
            if(j+1<W && f[i][j+1]==f[i][j]) {
                kukaku(i,j+1);
            }
            if(i+1<H && f[i+1][j]==f[i][j]) {
                kukaku(i+1,j);
            }
            if(j-1>=0 && f[i][j-1]==f[i][j]) {
                kukaku(i,j-1);
            }
            if(i-1>=0 && f[i-1][j]==f[i][j]) {
                kukaku(i-1,j);
            }
        }
    }
    
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)){
            while(true) {
                H = Integer.parseInt(sc.next());
                W = Integer.parseInt(sc.next());
                if(H==0 && W==0) break;
                f = new char[H][W];
                k = new boolean[H][W];
                for(int i=0;i<H;i++) {
                    f[i] = sc.next().toCharArray();
                }
                count = 0;
                for(int i=0;i<H;i++) {
                    for(int j=0;j<W;j++) {
                        if(!k[i][j]) {
                        	kukaku(i,j);
                        	count++;
                        	//System.err.println(i+" "+j+" "+count);
                        }
                    }
                }
                System.out.println(count);
            }
        }
    }
}


Measured memory_bytes: 29424
//#include<bits/stdc++.h>	// 全てのヘッダーファイルをinclude
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<set>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR (i,n) for(int i=n;i>0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
const int MOD{ int(1e9 + 7) };	// int 1000000007
const int inf{ int(1e9) };	// inf = 1000000000 // 1e9 はdouble型
using namespace std;
typedef long long ll;

int main(void) {

	vector<string> s(3);
	cin >> s[0] >> s[1] >> s[2];
	
	char str = s[0][0];

	while (1) {
		if (str == 'a') {
			if (s[0].length() == 0) {
				cout << "A" << endl;
				break;
			}
			str = s[0][0];
			s[0].erase(s[0].begin());
		}
		else if (str == 'b') {
			if (s[1].length() == 0) {
				cout << "B" << endl;
				break;
			}
			str = s[1][0];
			s[1].erase(s[1].begin());
		}
		else if (str == 'c') {
			if (s[2].length() == 0) {
				cout << "C" << endl;
				break;
			}
			str = s[2][0];
			s[2].erase(s[2].begin());
		}
	}
	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[] p = new int[n];
    boolean ok = true;

    for (int i = 0; i < n; i++) {
      p[i] = sc.nextInt();
    }

    for (int i = 0; i < n; i++) {
      if (p[i] != (i + 1)) {
        if (ok) {
          int index = 0;
          for (int j = i + 1; j < n; j++) {
            if (p[j] == (i + 1)) {
              index = j;
              break;
            }
          }
          int tmp = p[i];
          p[i] = p[index];
          p[index] = tmp;
          ok = false;
        } else {
          System.out.println("NO");
          return;
        }
      }
    }

    System.out.println("YES");

  }
}

Measured memory_bytes: 35656