akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PipedInputStream;
import java.util.*;

public class Main {
    private static final int MOD = (int) Math.pow(10, 9);
    private static final int[][] DIRS = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};

    public static void main(String[] args) {
        FastReader sc = new FastReader();
        Set<Integer> set = new HashSet<>();

        set.add(sc.nextInt());
        set.add(sc.nextInt());
        set.add(sc.nextInt());
        print(""+set.size());
        System.exit(0);
    }

    static  private void print(String s) {
        System.out.println(s);
    }

    static private int log2(int x) {
        return (int)(Math.log(x) / Math.log(2));
    }

    static private long gcd(long m, long n) {
        if (m < n) { return gcd(n, m); }
        if (m % n == 0) { return n; }
        return gcd(n, m%n);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try{
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
// #include "lib.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define LLINF 1e18//1234567890987654321
#define INF 1234567890
#define pb push_back
#define ins insert
#define f first
#define s second
#define db 0
#define MAXN 200026
#define MAXK 26
#define MAXX 15000006
#define rep(kk, l1, l2)for(long long kk = l1; kk < l2; kk++)
#define rep1(kk, l1, l2)for(long long kk = l1; kk <= l2; kk++)
#define bg(ms) *ms.begin()
#define ed(ms) *prev(ms.end(), 1)
#define addedge(a, b, c) v[a].pb(pi(b, c)); v[b].pb(pi(a, c))
#define ph push
#define all(x) x.begin(), x.end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef long long ll;
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
string s;
ll n, add;
void solve()
{
	rep(i, 1, s.length())if(s[i] > s[0])add = 1;
	ll num = s[0] - 48;
	if(add)cout << num+1 << num+1 << num+1;
	else cout << s[0] << s[0] << s[0];
}
int main()
{
	cin >> s;
	solve();
}


Measured memory_bytes: 256
def five_transportations(n, a, b, c, d, e)
  ans = 0
  params = [a, b, c, d, e]
  min_index = 0
  1.upto(4) do |i|
    if params[min_index] > params[i]
      min_index = i
    end
  end

  (n / params[min_index].to_f).ceil + 4
end

n = gets.to_i
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
puts five_transportations(n, a, b, c, d, e)

Measured memory_bytes: 3836
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cstdio>
#include <climits>
#include <cmath>
#include <array>
#include <functional>
#include <sstream>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;

int n;
int syaku[100010];
int main(int argc,char const* argv[])
{
  double a,b;
  cin >> a >> b;
  if(a>b) swap(a,b);
  if((b-a)>180.0)
    {
      b-=360.0;
    }
  double ans=(a+b)/2.0;
  if(ans<0) ans+=360.0;
  cout << fixed <<setprecision(9) <<  ans << endl;
  return 0;
}



Measured memory_bytes: 3272
#include <bits/stdc++.h>
#include <ctime>
#include <unordered_map>
#include <stdlib.h>
using namespace std;
#define ll  long long int
#define mod 1000000007
#define modd 998244353
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// #include<boost/multiprecision/cpp_int.hpp>
// using boost ::multiprecision::cpp_int;
/*__builtin_clz();
__builtin_ctz();
__builtin_popcount();*/
int calcAngle(double h, double m)  
{  
    // validate the input  
    if (h == 12) h = 0;  
    if (m == 60) m = 0;  
  
    // Calculate the angles moved  
    // by hour and minute hands  
    // with reference to 12:00  
    int hour_angle = 0.5 * (h * 60 + m);  
    int minute_angle = 6 * m;  
  
    // Find the difference between two angles  
    int angle = abs(hour_angle - minute_angle);  
  
    // Return the smaller angle of two possible angles  
    angle = min(360 - angle, angle);  
  
    return angle;  
}  
int main()
{
    boost;
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    double x;
    double o = abs(30*h -5.5*m);
    o = (M_PI  * o)/180;
    // cout<<o<<"\n";
    x= sqrt(a*a+ b*b - 2*a*b*cos(o));
    cout<<setprecision(10)<<x<<"\n"; 
    cerr << "\nTime elapsed: " << 1000 * clock()/CLOCKS_PER_SEC << "ms\n";
}
/* AnsHuman_7 || Anshuman Gaur */


Measured memory_bytes: 4220
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int oo = 1e18;
int dp[1 << 16];
int sum[1 << 16];
int a[16][16];
int n;

int getbit(int x, int i)
{
    return (x >> i) & 1;
}

void opti(int &a, int b)
{
    if (a < b) a = b;
}

int solve(int cur)
{
    int &res = dp[cur];
    if (!cur) return 0;
    if (res != -oo) return res;
    for (int sub = cur; sub > 0; sub = (sub - 1) & cur)
    {
        opti(res, solve(cur - sub) + sum[sub]);
    }
    return res;
}

signed main()
{
    //freopen("file.inp","r",stdin);
    cin >> n;
    for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
    {
        cin >> a[i][j];
    }
    for (int i = 0; i < (1 << n); i++)
    {
        for (int j = 0; j < n; j++)
        for (int k = j + 1; k < n; k++)
        {
            if (getbit(i, j) && getbit(i, k)) sum[i] += a[j][k];
        }
        dp[i] = -oo;
    }
    cout << solve((1 << n) - 1);
    return 0;
}


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

int main() {
   int N;
   string S;
   cin >> N >> S;
   int m=0,x=0;
   for (int i=0; i<N; i++) {
       if (S.at(i)=='I') x++;
       if (S.at(i)=='D') x--;
       m=max(m,x);
   }
   cout << m << endl;
}

Measured memory_bytes: 256
#include <iostream> 

using namespace std;
int main()
{
	int f[100];
	int n;
	cin >> n;
	f[0] = 1;
	f[1] = 1;
	for(int i = 0; i < n; i++)
	{
		f[i+2] = f[i+1] + f[i];
	}
	cout << f[n] << endl;
    return 0;
}


Measured memory_bytes: 3088
//
//  main.cpp
//  DPq2
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using P=pair<int,int>;
using ll = long long;
vector<ll>dat;
int leaf=1;
void update(int i,ll x){
    i+=leaf-1; // 更新したい葉の番号
    dat[i]=x;
    while(i>0){
        i=(i-1)/2; // 親の番号
        dat.at(i)=max(dat.at(i*2+1),dat.at(i*2+2));
    }
}
// 左の子　dat.at(2*i+1)
// 右の子　dat.at(2*i+2)
// 親　dat.at((i-1)/2)
ll query_sub(int a,int b,int k,int l,int r){
    // k:現在のノード　[l,r):dat[k]が表している区間
    if(r<=a||b<=l){
        return 0;
    } else if(a<=l && r<=b){
        return dat[k];
    } else {
        ll vl=query_sub(a, b, k*2+1, l, (l+r)/2);
        ll vr=query_sub(a, b, k*2+2, (l+r)/2, r);
        return max(vl,vr);
    }
}
ll query(int a,int b){return query_sub(a,b,0,0,leaf);} // [a,b)の最大値を求める

int main(int argc, const char * argv[]) {
    int n;
    cin>>n;
    vector<vector<int>> hana(n,vector<int>(3)); // 0:h 1:i 2:a
    rep(i,n) cin>>hana.at(i).at(0); // h:高さ
    rep(i,n) cin>>hana.at(i).at(2); // a:美しさ
    rep(i,n) hana.at(i).at(1)=i; // i:並び順
    sort(hana.begin(),hana.end()); // 高さの昇順
    int x=0;
    while(n>leaf){
        leaf=1<<x;
        x++; // nより大きい数（2のx乗）を求める
    }
    dat.resize(2*(1<<x)-1);
    for(int now=0;now<n;now++){
        int ord=hana.at(now).at(1);
        update(ord,query(0, ord)+hana.at(now).at(2));
    }
    cout<<dat.at(0)<<endl;
    return 0;
}


Measured memory_bytes: 21856
#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <bitset>
#include <map>

typedef long long ll;

using namespace std;

#define all(x) x.begin(), x.end()

const long long MOD = 1e9 + 7;

ll n, m;
string s;
ll dp[3002][3002];
ll ps[5000];
ll cnk[3002][3002];
ll R[5000];

int summ(int l, int r)
{
    return ps[r] - ps[l - 1];
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    cin >> s;
    s = "0" + s;
    for (int i = 1; i <= n; i++)
    {
        ps[i] = ps[i - 1] + s[i] - '0';
    }
    for (int i = 1; i <= n; i++)
    {
        R[i] = i;
    }
    for (int i = 0; i < m; i++)
    {
        ll l, r;
        cin >> l >> r;
        R[l] = max(R[l], r);
    }
    for (int i = 1; i <= n; i++)
    {
        R[i] = max(R[i], R[i - 1]);
    }
    dp[1][summ(1, R[1])] = 1;
    for (int p = 1; p <= n; p++)
    {
        if (p > 1 && R[p] > R[p - 1])
        {
            for (int j = n; j >= summ(R[p - 1] + 1, R[p]); j--)
            {
                dp[p][j] = dp[p][j - summ(R[p - 1] + 1, R[p])];
                if (summ(R[p - 1] + 1, R[p]) != 0)
                    dp[p][j - summ(R[p - 1] + 1, R[p])] = 0;
            }
        }
        for (int c = 0; c <= n; c++)
        {
            if (R[p] - (p + 1) + 1 >= c)
            {
                dp[p + 1][c] = (dp[p][c] + dp[p][c + 1]) % MOD;
            }
        }
    }
    cout << (dp[n][1] + dp[n][0]) % MOD;
}


Measured memory_bytes: 70784
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <map>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;

long long N, A;

string S, T;
long long a[10010], b[10010];
void solve(){
    for(int i=0; i<N; ++i) cin >> a[i];
    for(int i=0; i<N; ++i) cin >> b[i];
    
    long long an=0, bn=0;
    for(int i=0; i<N; ++i){
        an += b[i]-a[i];
        if(a[i]<b[i]){
            bn += (b[i]-a[i]+1)/2;
        }
    }
    if(an>=bn) cout << "Yes" << endl;
    else cout << "No" << endl;
}
int main() {
    cin >> N;
    solve();
	return 0;
}

Measured memory_bytes: 384
from sys import stdin
n = int(stdin.readline().rstrip())
data = list(map(int,stdin.readline().rstrip().split()))
zantei = 0
k = 0
while k < n-1:
    point = 0
    for i in range(k,n-1):
        if data[i] >= data[i+1]:
            k += 1
            point += 1
        else:
            k += 1
            break
    if point > zantei:
        zantei = point
    point = 0
print(zantei)

Measured memory_bytes: 14252
import sys
from collections import defaultdict

def solve():
    input = sys.stdin.readline
    H, W, N = map(int, input().split())
    C = defaultdict(int)
    for _ in range(N):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        for h in range(3):
            for w in range(3):
                if 0 <= a-h < H - 2 and 0 <= b-w < W - 2:
                    C[(a-h, b-w)] += 1
    
    ans = [0] * 10
    s = 0
    for key in C:
        ans[C[key]] += 1
        s += 1
    ans[0] = ((H - 2) * (W - 2) - s)
    print(*ans, sep="\n") 
    #print(C)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 166896
#include<stdio.h>
#include<string.h>
void show(int a[],int n)
{
    for(int i=0;i<n;i++)
    {
        if(i) putchar(' ');
        printf("%d",a[i]);
    }
}
void bubble(int a[],int n)
{
    int flag=1,i,j,count=0;
    for(i=0;flag;i++)
    {
        flag=0;
        for(j=n-1;j>=i+1;j--)
        {
            if(a[j-1]>a[j])
            {
                flag=1;
                a[j]^=a[j-1];
                a[j-1]^=a[j];
                a[j]^=a[j-1];
                count++;
            }
        }
    }
    show(a,n);
    putchar('\n');
    printf("%d\n",count);
}

int main()
{
    int a[101];
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    bubble(a,n);
}



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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;

// 素因数分解
// https://qiita.com/drken/items/a14e9af0ca2d857dad23
vector<pair<ll, ll>> prime_factorize(ll N) {
    vector<pair<ll, ll>> res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

void Main() {
  ll n;
  cin >> n;
  ll min_count = INF;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      min_count = min(min_count, i + n/i - 2);
    }
  }
  COUT(min_count);


}



int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}

/*
2
-879 981
-866 890
*/


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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    ll ans=0;
    rep(i,n){
        ll l,r; cin>>l>>r;
        ans+=r-l+1;
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

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

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

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

    double R;
    cin >> R;
    cout << R * 2.0 * 3.1415926535 << endl;

    return 0;
}


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


int main ()
{


    int a,b,c;
    cin>>a>>b>>c;

    vector<int>vec;

    vec.push_back(a);

    vec.push_back(b);

    vec.push_back(c);
    sort(vec.begin(),vec.end());
    int h = vec.back();

    int k;
    cin>>k;

    for(int i=1; i<=k; ++i)
    {
        h = h*2;
    }
    cout<<vec[0]+vec[1]+h<<endl;

    return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        int a = int.Parse(Console.ReadLine());
        string a1 = Console.ReadLine();
        int s1 = 0;
        string a2 = Console.ReadLine();
        for (int i = 0; i < a; i++)
        {
            if (a1.Substring(a - i - 1) == a2.Substring(0, 1 + i))
            {
                s1 = i + 1;
            }
        }
        Console.WriteLine(a * 2 - s1);
        Console.ReadLine();
    }
}


Measured memory_bytes: 13140
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MAX 300005
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1e18;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
   	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
int main()
{
	fast();
	string s;
	cin>>s;
	cout<<(s=="ABC"?"ARC":"ABC");
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
*/

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

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

	int ans = 0;
	ans = n - k + 1;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int m,d,s;
	
while(1){
	
	scanf("%d %d",&m,&d);
			if((m==0)&&(d==0)){
				return 0;
			}

	if(m==1){
		s=0;
	}
	if(m==2){
		s=31;
	}
	if(m==3){
		s=60;
	}
	if(m==4){
		s=91;
	}
	if(m==5){
		s=121;
	}
	if(m==6){
		s=152;
	}
	if(m==7){
		s=182;
	}
	if(m==8){
		s=213;
	}
	if(m==9){
		s=244;
	}
	if(m==10){
		s=274;
	}
	if(m==11){
		s=305;
	}
	if(m==12){
		s=335;
	}
	
	s+=d;
	
	s=s%7;
	
	if(s==0){
		printf("Wednesday\n");
	}
	if(s==1){
		printf("Thursday\n");
	}
	if(s==2){
		printf("Friday\n");
	}
	if(s==3){
		printf("Saturday\n");
	}
	if(s==4){
		printf("Sunday\n");
	}
	if(s==5){
		printf("Monday\n");
	}
	if(s==6){
		printf("Tuesday\n");
	}
	
	
	}
	return 0;
}

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

int main(){
  int a;

  for(int i=0;i<5;++i){
    cin >> a;
    if (a == 0){
      cout << i + 1 << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	ll x,y;cin>>x>>y;
	if(x % y == 0){
		cout << -1 << endl;
		return 0;
	}
	cout << x * (y + 1) << endl;
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;

int f(int x, int y) {
	return 0 <= y - x ? y - x : 2*INF;
}

int main() {
	int x, y; 
	ni(x); ni(y);
	pri(min(min(f(x,y),f(x,-y)+1), min(f(-x, -y) + 2, f(-x, y) + 1)));
	return 0;
}


Measured memory_bytes: 256
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[B[i] for i in range(N)]
X=[A[i] for i in range(N+1)]
for i in range(N):
    if X[i]<C[i]:
        C[i]-=X[i]
        X[i]=0
        X[i+1]=max(0,X[i+1]-C[i])
    else:
        X[i]-=C[i]
        C[i]=0
print(sum(A)-sum(X))

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

#define rep(i,n) for(int i = 0; i < (n); ++i)

signed main()
{
    int r,d; cin >> r >> d;
    long long x; cin >> x;

    rep(i,10){
        x = r * x - d;
        cout << x << endl;
    }
    return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

vector<lli> f(lli a){
    lli two = 2;
    vector<lli> rtn(60);
    for(lli i=0;i<60;i++){
        rtn[i] = a/two*(two/2);
        rtn[i] += max(0LL,(a%two)-(two/2-1));
        two*=2;
    }
    return rtn;
}

void func(long long A, long long B){

    vector<lli> a = f(A-1);

    vector<lli> b = f(B);
    REP(i,0,10){
        LOG3(i,a[i],b[i]);
    }

    lli ans = 0;
    REP(i,0,a.size()){
        lli num = b[i]-a[i];
        if(num%2){
            ans += (1LL<<i);
        }
    }
    cout<<ans<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    func(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

string s;

int main(void){
    int n=0;
    bool ans = true;
    cin >> s;
    n = s.size();
    int num = (s.size()-1)/2;
    if(num % 2){
        num=(num -1) /2;
    }else{
        num = num/2;
    }

    for(int i=0; i< (n-1)/2; i++){
//            cout << s[i] << " " << s[(s.size())-i-1] << endl ;
        if(s[i] != s[ (s.size()-1)-i ] ){
            ans = false;
            break;
        }
    }


    for(int i=0; i< num; i++){
        
//             cout << s[i] << " " << s[ (((n-1)/2) -1)-i ] << endl;
        if(s[i] != s[ (((n-1)/2) -1)-i  ] ){
            ans = false;
            break;
        }
    }


    for(int i=0; i< num; i++){
        if(s[ (((n+3)/2)-1)+i ] != s[(s.size()-i)-1] ){
            ans = false;
            break;
        }
    }

    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;

    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
   int m, f, r;       // input; m, f<=50 , r<=100

   scanf("%d %d %d", &m, &f, &r);
   while(m!=-1 || f!=-1 || r !=-1){
      if(m == -1 || f == -1) printf("F\n");
      else if(m+f>=80) printf("A\n");
      else if(m+f>=65) printf("B\n");
      else if(m+f>=50) printf("C\n");
      else if(m+f>=30){
          if(r>=50) printf("C\n");
          else printf("D\n");
      }else printf("F\n");

      scanf("%d %d %d", &m, &f, &r);
   }

   return 0;
}

Measured memory_bytes: 584
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353


class UnionFind():
    # 要素0=n-1
    # parentsには親番号．根の場合は-(グループの要素数)
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    # xの属するグループの根
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    # xの属するグループとyの属するグループを併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    # xの属するグループの要素数
    def size(self, x):
        return -self.parents[self.find(x)]

    # x,yが同じグループに属するか否か
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # xの属するグループの要素からなるリスト
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    # 全グループの根からなるリスト
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    # グループ数
    def group_count(self):
        return len(self.roots())

    # {ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    # {ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書（print用）
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

class UnionFindLabel(UnionFind):
    def __init__(self, labels):
        assert len(labels) == len(set(labels))

        self.n = len(labels)
        self.parents = [-1] * self.n
        self.d = {x: i for i, x in enumerate(labels)}
        self.d_inv = {i: x for i, x in enumerate(labels)}

    def find_label(self, x):
        return self.d_inv[super().find(self.d[x])]

    def union(self, x, y):
        super().union(self.d[x], self.d[y])

    def size(self, x):
        return super().size(self.d[x])

    def same(self, x, y):
        return super().same(self.d[x], self.d[y])

    def members(self, x):
        root = self.find(self.d[x])
        return [self.d_inv[i] for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [self.d_inv[i] for i, x in enumerate(self.parents) if x < 0]


N, M = map(int, input().split())

l = [i for i in range(1, N+1)]
u = UnionFindLabel(l)

for i in range(M):
    x, y, z = map(int, input().split())

    u.union(x, y)

print(len(u.roots()))



Measured memory_bytes: 121788
#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;

const int N = 2e5 + 7;
int a[N];
int arr[N];

int main() {
    int n;
    scanf("%d", &n);
    forn (i, 0, n) {
        scanf(" %d", &a[i]);
    }
    
    ll ans = 0;
    
    int l = 0;
    int r = 1;
    ll cur = a[l];
    
    while (l < n) {
        if (r < n && (cur & a[r]) == 0) {
            cur += a[r];
            r++;
        } else {
            cur -= a[l];
            
            int d = r - l;
            ans += d;
            
            l++;
            if (l >= r) {
                r = l + 1;
                cur = a[l];
            }
        }
    }
   
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1024
def main():
    H, W = (int(i) for i in input().split())
    c = [input() for i in range(H)]
    cnt = 0
    for h in range(H):
        for w in range(W):
            if c[h][w] == "#":
                cnt += 1
    if cnt == H+W-1:
        print("Possible")
    else:
        print("Impossible")


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
X, Y = map(int, input().split())

myans = 0

if X == 1:
    myans += 300000
if Y == 1:
    myans += 300000
if X == 2:
    myans += 200000
if Y == 2:
    myans += 200000
if X == 3:
    myans += 100000
if Y == 3:
    myans += 100000
if X == 1 and Y == 1:
    myans += 400000
    
print(myans)

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

int main() {
  int a,b;
  cin>>a>>b;
  if(a==1){
    a+=13;
  }
  if(b==1){
    b+=13;
  }
  if(a>b){
    cout<<"Alice"<<endl;
  }
  else if(a<b){
    cout<<"Bob"<<endl;
  }
  else {
    cout<<"Draw"<<endl;
  }
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int,input().split()))
DP = [0]
for i in range(1,N):
    if(i == 1):
        DP.append(abs(H[i]-H[i-1]))
    else:
        DP.append(min(abs(H[i]-H[i-1])+DP[i-1],abs(H[i] - H[i-2])+DP[i-2]))
print(DP[-1])

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

int main() {
  string s;cin>>s;
  for (int i=0;i<(int)s.size();i++) {
    if (i%2 == 0) {
      if (s[i] == 'L'){
        cout << "No" << endl;
        return 0;
      }
    } else {
      if (s[i] == 'R'){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3616
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
#include <unordered_map>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.0000000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define SECOND_MOD 1000000009
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<long long>input;
	REP(i, n) {
		long long a;
		cin >> a;
		input.push_back(a);
	}
	map<long long, long long> hogea;
	long long ans = 0;
	long long now = 0;
	hogea[0]++;
	for (int i = 0; i < n; ++i) {
		now += input[i];
		ans += hogea[now];
		hogea[now]++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 14320
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main() {
	string str;
	cin >> str;
	int len,memo=1;
	len = str.length();
	for (int i = len / 2-2; i >= 0; i--) {
		memo = 1;
		for (int j = i + 1; j <= 2 * i+1; j++) {
			if (str[j] != str[j-i-1]) { memo = 0; break; }
		}
		if (memo == 1) { cout << 2*i+2; return 0;}
	}
}

Measured memory_bytes: 256
import numpy as np

l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
l = l1 + l2 + l3
n = int(input())

bl = [int(input()) for _ in range(n)]

for i in range(len(l)):
    for j in bl:
        if l[i] == j:
            l[i] = 0
            
bingo = np.array(l).reshape(3,3)
print("Yes" if (min(bingo.sum(axis=1)) == 0) | (min(bingo.sum(axis=0)) == 0) | (min([np.diag(bingo).sum(), np.diag(np.fliplr(bingo)).sum()]) == 0) else "No")

Measured memory_bytes: 27224
n = int(input())
s = input()

R = 0
G = 0
B = 0

for i in range(n):
    if s[i] == "R":
        R += 1
    elif s[i] == "G":
        G += 1
    elif s[i] == "B":
        B += 1

cnt = 0
for i in range(n):
    for j in range(i+1, n):
        k = 2*j - i
        if 0 < k < n:
            if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
                cnt += 1

ans = R*G*B - cnt
print(ans)

Measured memory_bytes: 9224
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

struct edge
{
    int from, to, cost;
};

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

    int n, m;
    cin >> n >> m;

    vector< edge > e;
    const int inf = 1e9;
    int d[n][n];
    rep (i, n) for (int j = i + 1; j < n; ++j) d[i][j] = d[j][i] = inf;
    rep (i, n) d[i][i] = 0;
    rep (i, m)
    {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        e.push_back({a, b, c});
        e.push_back({b, a, c});
        d[a][b] = c;
        d[b][a] = c;
    }

    rep (k, n)
    {
        rep (i, n)
        {
            rep (j, n)
            {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

    int ans = 0;
    rep (i, e.size())
    {
        bool found = false;
        rep (j, n)
        {
            int from = e[i].from;
            int to = e[i].to;
            int cost = e[i].cost;
            if (d[j][to] == d[j][from] + cost)
            {
                found = true;
                break;
            }
        }
        if (!found) ++ans;
    }

    cout << ans / 2 << "\n";
    return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S1, S2, S3;
  cin>>S1>>S2>>S3;
  string ans;
  ans.push_back(S1[0]-'a'+'A');
  ans.push_back(S2[0]-'a'+'A');
  ans.push_back(S3[0]-'a'+'A');
  cout<<ans<<endl;
}



Measured memory_bytes: 3616
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n, d = map(int, input().split())
    tree = 1
    ans = 0
    while True:
        ans += 1
        tree += 2 * d
        if tree >= n:
            print(ans)
            return
        tree += 1

if __name__ == '__main__':
    main()

Measured memory_bytes: 9112
#include <iostream>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <cmath>
#define INF 1000000007
using namespace std ;

int main(int argc, char const *argv[])
{

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

	int ans = 0 ;

	while(n){n/=k ; ++ans ;}
      cout<<ans<<endl ;
	return 0;
}

Measured memory_bytes: 256
using System;
class Program{
	static void Main(){
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		long[] a=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		Array.Sort(a,ca);
		long d=0;
		int m=0,k=0;
		for(int i=0;i<s[0];i++){
			if(i<s[1]){d+=a[i];}
			if(a[i]>a[s[1]-1]){m++;}
			else if(a[i]==a[s[1]-1]){k++;}
		}

		long[,] cb=new long[k+1,k+1];
		for(var i=0;i<=k;i++){
			for(var j=0;j<=i;j++){
				if(j==0||j==i){cb[i,j]=1;}
				else{cb[i,j]=(cb[i-1,j]+cb[i-1,j-1]);}
			}
		}
		
		Console.WriteLine("{0}",1.0*d/s[1]);
		if(m==0){
			long ans=0;
			for(int i=s[1]-m;i<=k&&i<=s[2];i++){ans+=cb[k,i];}
			Console.WriteLine("{0}",ans);
		}
		else{Console.WriteLine("{0}",cb[k,s[1]-m]);}
	}
	static int ca(long a,long b){
		if(a<b){return 1;}
		else if(a>b){return -1;}
		else{return 0;}
	}
}

Measured memory_bytes: 13364
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#define REP(i, N) for(int i=0; i<N; i++)
using namespace std;

//#include "atcoder.hpp"

long long gcd(long long a, long long b) {
    if (a>b) swap(a,b);
    
    auto r = b % a;
    
    return (r ? gcd(r, a) : a);
}

int main() {
    int N;
    
    cin >> N;
    
    vector<int> V(N), C(N);
    
    for (auto& i : V)
        cin >> i;
    for (auto& i : C)
        cin >> i;
    
    int r = 0;
    auto it = C.begin();
    
    for (auto i : V) {
        if (i > *it)
            r += i - *it;
        ++it;
    }

    cout << r << endl;
    
    return 0;
}




Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		HashMap<Character,String> map1 = new HashMap<Character,String>();
		map1.put(' ',"101");
		map1.put('\'',"000000");
		map1.put(',',"000011");
		map1.put('-',"10010001");
		map1.put('.',"010001");
		map1.put('?',"000001");
		map1.put('A',"100101");
		map1.put('B',"10011010");
		map1.put('C',"0101");
		map1.put('D',"0001");
		map1.put('E',"110");
		map1.put('F',"01001");
		map1.put('G',"10011011");
		map1.put('H',"010000");
		map1.put('I',"0111");
		map1.put('J',"10011000");
		map1.put('K',"0110");
		map1.put('L',"00100");
		map1.put('M',"10011001");
		map1.put('N',"10011110");
		map1.put('O',"00101");
		map1.put('P',"111");
		map1.put('Q',"10011111");
		map1.put('R',"1000");
		map1.put('S',"00110");
		map1.put('T',"00111");
		map1.put('U',"10011100");
		map1.put('V',"10011101");
		map1.put('W',"000010");
		map1.put('X',"10010010");
		map1.put('Y',"10010011");
		map1.put('Z',"10010000");

		HashMap<String,Character> map2 = new HashMap<String,Character>();
		map2.put("00000",'A');
		map2.put("00001",'B');
		map2.put("00010",'C');
		map2.put("00011",'D');
		map2.put("00100",'E');
		map2.put("00101",'F');
		map2.put("00110",'G');
		map2.put("00111",'H');
		map2.put("01000",'I');
		map2.put("01001",'J');
		map2.put("01010",'K');
		map2.put("01011",'L');
		map2.put("01100",'M');
		map2.put("01101",'N');
		map2.put("01110",'O');
		map2.put("01111",'P');
		map2.put("10000",'Q');
		map2.put("10001",'R');
		map2.put("10010",'S');
		map2.put("10011",'T');
		map2.put("10100",'U');
		map2.put("10101",'V');
		map2.put("10110",'W');
		map2.put("10111",'X');
		map2.put("11000",'Y');
		map2.put("11001",'Z');
		map2.put("11010",' ');
		map2.put("11011",'.');
		map2.put("11100",',');
		map2.put("11101",'-');
		map2.put("11110",'\'');
		map2.put("11111",'?');

		Scanner sc = new Scanner(System.in);
		while(sc.hasNextLine()){
			String s = sc.nextLine();
			String out = "";

			for(char ch : s.toCharArray()) out += map1.get(ch);

			int rem = 5 - out.length() % 5;
			if(rem < 5) while(rem-- > 0) out += "0";

			for(int i=0;i<out.length();i+=5){
				System.out.print(map2.get(out.substring(i,i+5)));
			}
			System.out.println();
		}
	}
}

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

struct Vertex {
	int id;
	vector<int> vertices;
	int visited;
	int completed;
};

int getNext(Vertex vertices[], int id){
	Vertex v = vertices[id-1];
	int size = v.vertices.size();
	for(int i=0;i<size;i++){
		int nId = v.vertices[i];
		if (vertices[nId-1].visited==-1){
			return nId;
		}
	}
	return -1;
}

void dfs(int n, Vertex vertices[]){
	
	int time = 0;

	for(int i=0;i<n;i++){
		stack<int> st;
		if(vertices[i].visited==-1){
			st.push(vertices[i].id);
		}
		while(!st.empty()){
			int id=st.top();
			if(vertices[id-1].visited==-1){
				vertices[id-1].visited=++time;
			}
			int nId=getNext(vertices,id);
			if(nId!=-1){
				vertices[nId-1].visited=++time;
				st.push(nId);
			} else {
				vertices[id-1].completed=++time;
				st.pop();
			}
		}
	}
}

int main(){
	

	int n;
	cin >> n;
	Vertex vertices[n];

	for(int i=0;i<n;i++){
	
		int id;
		cin >> id;
		vertices[i].id = id;
		vertices[i].visited = -1;
		vertices[i].completed = -1;

		int cnt;
		cin >> cnt;
		for(int j=0;j<cnt;j++){
			cin >> id;
			vertices[i].vertices.push_back(id);
		}
	}
	
	dfs(n,vertices);
	
	for(int i=0;i<n;i++){
		Vertex v = vertices[i];
		cout << v.id << " ";
		cout << v.visited << " ";
		cout << v.completed << endl;
	}

	return 0;
}



Measured memory_bytes: 3168
package main

import (
	"fmt"
)

func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func solve(x int64, k int64, d int64) int64 {
	x = abs(x)
	
	var answer int64
	if x/d >= k {
		answer = x - d*k
	} else {
		e := x/d
		k -= e
		x -= e*d
		if k%2 == 1 {
			x = abs(x-d)
		}
		answer = x
	}


	return answer
}

func scanNums(len int) (nums []int64) {
	var num int64
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func main() {
	nums := scanNums(3)
	x := nums[0]
	k := nums[1]
	d := nums[2]

	result := solve(x, k, d)
	fmt.Println(result)
}


Measured memory_bytes: 1772
a = gets.chomp  
n, k = a.split(" ")
b = gets.chomp
nums = b.split(" ")
sum = 0
ans = 0
temp = []
n = n.to_i
k = k.to_i
nums.each_with_index do |n, i|
  temp[i] = (1.0 + nums[i].to_i) / 2.0
  sum += temp[i] 
  sum -= temp[i-k] if (i-k >= 0)
  ans=sum if (sum > ans)
end
p ans

Measured memory_bytes: 16076
<?php
$input = readline();
if(!empty($input))readline_add_history($input);

$var = explode(' ',$input);

$a_max = $var[0]; $a_in = $var[1]; $b_in = $var[2];

$b_nokori = $b_in - ($a_max - $a_in);
if($b_nokori < 0)$b_nokori = 0;

echo $b_nokori;

Measured memory_bytes: 3828
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
#include<functional>
using namespace std;
int n,k;
int a[100005];
vector<int> edge[100005];

int main()
{
	cin>>n;
	for(int i=0;i<n-1;i++)
	{
		int x,y;
		cin>>x>>y;
		x--;
		y--;
		edge[x].push_back(y);
		edge[y].push_back(x);
	}
	memset(a,-1,sizeof(a));
	priority_queue<pair<int,int> > q;
	cin>>k;
	for(int i=0;i<k;i++)
	{
		int x,v;
		cin>>x>>v;
		x--;
		a[x]=v;
		q.push(make_pair(-v,x));
	}
	while(!q.empty())
	{
		int x,v;
		x=q.top().second;
		q.pop();
		for(int i=0;i<edge[x].size();i++)
		{
			int y=edge[x][i];
			if(a[y]==-1)
			{
				a[y]=a[x]+1;
				q.push(make_pair(-a[y],y));
			}
		}
	}
	for(int x=0;x<n;x++)
		for(int i=0;i<edge[x].size();i++)
		{
			int y=edge[x][i];
			if(a[x]-a[y]!=1&&a[x]-a[y]!=-1)
			{
				cout<<"No";
				return 0;
			}
		}
	cout<<"Yes"<<endl;
	for(int i=0;i<n;i++)
		cout<<a[i]<<endl;
	return 0;
}


Measured memory_bytes: 7924
A1,A2,A3 = map(int, input().split())
A4,A5,A6 = map(int, input().split())
A7,A8,A9 = map(int, input().split())
N = int(input())
B = []
for _ in range(N):
    B.append(int(input()))
if A1 in B and A2 in B and A3 in B:
  print('Yes')
elif A4 in B and A5 in B and A6 in B:
  print('Yes')
elif A7 in B and A8 in B and A9 in B:
  print('Yes')
elif A1 in B and A4 in B and A7 in B:
  print('Yes')
elif A2 in B and A5 in B and A8 in B:
  print('Yes')
elif A3 in B and A6 in B and A9 in B:
  print('Yes')
elif A1 in B and A5 in B and A9 in B:
  print('Yes')
elif A3 in B and A5 in B and A7 in B:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9156
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 1
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

a,b = I()

A = str(a)*b
B = str(b)*a

print(min(A,B))

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

int main() {
  int n;
  cin >> n;
  string s[n];
  int p[n];
  bool ch[n];
  for ( int i = 0; i < n; i++ ) {
    cin >> s[i] >> p[i];
    ch[i] = true;
  }

  int pos = -1;
  string t;
  for ( int i = 0; i < n; i++ ) {
    pos = -1;
    t = "zzzzzzzzzzz";
    for ( int j = 0; j < n;  j++ ) {
      if ( s[j] < t && ch[j] ) {
        t = s[j];
        pos = j;
      } else if ( s[j] == t && ch[j] && p[j] > p[pos] ) {
        t = s[j];
        pos = j;
      }
    }
    ch[pos] = false;
    cout << pos+1 << endl;
  }

  return 0;
}

Measured memory_bytes: 256