akhauriyash/Code-Regression huggingface dataset:
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 S          PIC X(100).
01 A          PIC 9(10).
01 B          PIC 9(10).
01 i          PIC 9(10).
01 ans        PIC 9(10) VALUE ZERO.
01 zs         PIC Z(9)9.

PROCEDURE DIVISION.
  ACCEPT S.
  PERFORM VARYING i FROM 1 BY 1 UNTIL FUNCTION STORED-CHAR-LENGTH(S) / 2 < i
    IF S(i : 1) <> S(FUNCTION STORED-CHAR-LENGTH(S) - i + 1 : 1) THEN
      ADD 1 TO ans
    END-IF
  END-PERFORM.
  MOVE ans TO zs.
  DISPLAY FUNCTION TRIM(zs).
  STOP RUN.


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

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll mod = 1000000007;


int main()
{
	ll h, w, k;
	cin >> h >> w >> k;
	vector<vector<ll>> c(h , vector<ll>(w));
	vector<string> SS(h);
	for(ll i = 0; i < h; i++)cin >> SS[i];
	for(ll i = 0; i < h; i++){
		for(ll j = 0; j < w; j++)c[i][j] = SS[i][j] - '0';
	}
	ll ans = 1e9;

	//どこで区切るか
	for(ll bit = 0; bit < (1LL << (h - 1)); bit++){

		vector<vector<vector<ll>>> cut;
		ll cur_cnt = 0;
		vector<vector<ll>> cur;


		cur.push_back(c[0]);
		for(ll i = 0; i < h - 1; i++){
			if(bit & (1 << i)){
				cut.push_back(cur);
				cur.resize(0);
				cur_cnt++;
				cur.push_back(c[i + 1]);
			}else{
				cur.push_back(c[i + 1]);
			}
		}
		cut.push_back(cur);
		vector<vector<ll>> sum;

		for(auto cho : cut){

			vector<ll> D(w);
			for(ll i = 0; i < w; i++){
				ll dd = 0;
				for(ll j = 0; j < (ll)cho.size(); j++){
					dd += cho[j][i];
				}
				if(dd > k)cur_cnt = 1e10;
				D[i] = dd;
			}
			sum.push_back(D);
		}


		vector<ll> zi(sum.size());
		for(ll i = 0; i < w; i++){
			bool curc = false;
			for(ll j = 0; j < (ll)sum.size(); j++){
				if(zi[j] + sum[j][i] > k){
					curc = true;
					cur_cnt++;
					break;
				}else{
					zi[j] += sum[j][i];
				}
			}
			if(curc){
				for(ll j = 0; j < (ll)sum.size(); j++){
					zi[j] = sum[j][i];
				}
			}
		}

		ans = min(cur_cnt, ans);
	}

	cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
ll n,x,ans,a,b;

int main()
{
    scanf("%lld%lld",&n,&x);
    ans = n;
    a = x,b = n - x;
    while (a != 0 && b != 0)
    {
        if (a < b)
            swap(a,b);
        ans += (a / b) * 2 * b;
        if (a % b == 0)
            ans -= b;
        a -= (a / b) * b;
    }
    printf("%lld\n",ans);

    return 0;
}


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

int main()
{
    int k;
    long ans;
    // scanf("%d", &x);
    cin >> k;
    if (k <= 10)
    {
        cout << k << endl;
        return 0;
    }
    queue<long> que;
    long i = 0;
    rep(j, 9)
    {
        que.push(i + 1);
        i++;
    }
    long next;
    long prev;
    while (i < k)
    {
        prev = que.front();
        que.pop();
        long d = prev % 10;
        if (d != 0)
        {
            next = prev * 10 + d - 1;
            que.push(next);
            i++;
        }
        if (i == k)
        {
            break;
        }
        next = prev * 10 + d;
        que.push(next);
        i++;
        if (i == k)
        {
            break;
        }
        if (d != 9)
        {
            next = prev * 10 + d + 1;
            que.push(next);
            i++;
        }
    }

    // printf("%d\n", x * x * x);
    cout << next << endl;
}

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

int a[505], b[505];
int V;
vector<int> g[1010];
int match[1010];
bool used[1010];

void add_edge(int u, int v) {
  g[u].push_back(v);
  g[v].push_back(u);
}

bool dfs(int v) {
  used[v] = true;
  for(int i=0; i<(int)g[v].size(); ++i) {
    int u = g[v][i], w = match[u];
    if(w < 0 || (!used[w] && dfs(w))) {
      match[v] = u;
      match[u] = v;
      return true;
    }
  }
  return false;
}

int bipartite_matching() {
  int res = 0;
  memset(match, -1, sizeof(match));
  for(int v = 0; v < V; ++v) {
    if(match[v] < 0) {
      memset(used, 0, sizeof(used));
      if(dfs(v)) {
        res++;
      }
    }
  }
  return res;
}

int main() {
  while(true) {
    int m, n;
    cin >> m >> n;
    if(!m && !n) break;
    for(int i=0; i<m; ++i) cin >> a[i];
    for(int j=0; j<n; ++j) cin >> b[j];

    V = m+n;
    for(int i=0; i<V; ++i) g[i].clear();
    for(int i=0; i<m; ++i) {
      for(int j=0; j<n; ++j) {
        if(__gcd(a[i], b[j]) != 1) {
          add_edge(i, j+m);
        }
      }
    }
    /*for(int i=0; i<m; ++i) {
      cout << i << " " << a[i] << ":";
      for(int j: g[i]) {
        cout << "(" << j << "," << b[j-m] << ") ";
      }
      cout << endl;
    }*/
    cout << bipartite_matching() << endl;
  }
}

Measured memory_bytes: 4968
// AOJ DSL_3_D Sliding Minimum Elements
// 2018.5.5 bal4u

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

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(int n)
{
	int i;
	char ob[20];

	if (!n) pc('0');
	else {
		i = 0; while (n) ob[i++] = n%10 + '0', n/=10;
		while (i--) pc(ob[i]);
	}
}

#define INF 0x50505050		// > 10^9

// セグメント木の初期化
int seg[1<<21]; int sz;

void segtree(int n, int init_val)
{
	sz = 2; while (sz < n) sz <<= 1;
	n = sz << 1;
	memset(seg+sz-1, INF, sz<<2);
}

void update()
{
	int i, k, n, p, v;

	n = sz;	while (n > 0) {
		for (p = n-1, i = 0; i < n; i+=2, p+=2) {
			k = p >> 1;
			v = seg[p+1]; if (v > seg[p]) v = seg[p];
			seg[k] = v;
		}
		n >>= 1;
	}
}

// 空間 [a, b] 内の最小値
int range_min_query(int a, int b, int k, int l, int r) 
{
	int m, lmin, rmin;

	if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return seg[k];
	k <<= 1, m = (l+r) >> 1;
    lmin = range_min_query(a, b, k+1, l, m);
    rmin = range_min_query(a, b, k+2, m, r);
	if (lmin > rmin) lmin = rmin;
    return lmin; 
}


int main()
{
	int N, L, i, j;

	N = in(), L = in();
	segtree(N, INF);
	j = sz-1;
	for (i = 0; i < N; i++) seg[j++] = in();
	update();
	out(range_min_query(0, L, 0, 0, sz));
	i = 1, j = L+1, N -= L;
	while (i <= N) {
		pc(' ');
		out(range_min_query(i++, j++, 0, 0, sz));
	}
	pc('\n');
	return 0;
}



Measured memory_bytes: 9848
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, MA, MB, ABC):
    dp = defaultdict(lambda: defaultdict(
        lambda: defaultdict(lambda: sys.maxsize)))
    AB_MAX = N*10
    dp[0][0][0] = 0
    for i, (a, b, c) in enumerate(ABC):
        for j in range(AB_MAX):
            for k in range(AB_MAX):
                if not (i in dp and j in dp[i] and k in dp[i][j]):
                    continue
                dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k])
                dp[i+1][j+a][k+b] = min(dp[i+1][j+a][k+b], dp[i][j][k] + c)

    ans = sys.maxsize
    for a in dp[N]:
        if a == 0:
            continue
        for b in dp[N][a]:
            if b == 0:
                continue
            if a*MB == b*MA:
                ans = min(ans, dp[N][a][b])

    return ans if ans != sys.maxsize else -1


def main():
    N, MA, MB = read_int_n()
    ABC = [read_int_n() for _ in range(N)]

    print(slv(N, MA, MB, ABC))


if __name__ == '__main__':
    main()


Measured memory_bytes: 25988
a,b,n=list(map(int,input().split()))
if n%500!=0:n=n+500-n%500
if a>=b*2:
    print((n//500)*b)
elif a<b:
    if n%1000!=0:n=n+1000-n%1000
    print((n//1000)*a)
else:
    print(((n//1000)*a)+((n%1000)//500)*b)


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

int main() {
	
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    
      long long n,i,j,k,sum=0,count=0,ans=0,x=0,y=0,l,r,m;
      cin>>n;
      long long a[n];
      for(i=0;i<n;i++)
      {
          cin>>a[i];
      }
      if(n<=2)
      {
          cout<<0; return 0;
      }
      for(i=0;i<=(n-3);i++)
      {
          for(j=i+1;j<=(n-2);j++)
          {
              for(x=j+1;x<n;x++)
              {
                  long long b[3];
                  b[0]=a[i];
                  b[1]=a[j];
                  b[2]=a[x];
                  sort(b,b+3);
                  if((b[0]+b[1])>b[2] && b[0]!=b[1] && b[1]!=b[2] && b[0]!=b[2])
                  ans++;
                  
              }
          }
      }
      cout<<ans;
	return 0;
}

Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var first = consoleReader.SplitInt32();
            var N = first[0];
            var Q = first[1];
            var s = consoleReader.ReadLine();

            var atCounts = new int[N];
            var lrs = consoleReader.RepeatSplitInt32(Q);

            for (int i = 1; i < atCounts.Length; i++)
            {
                atCounts[i] = atCounts[i - 1];
                if (s[i - 1] == 'A' && s[i] == 'C')
                    atCounts[i]++;
            }

            return string.Join("\n", lrs.Select(lr => atCounts[lr[1] - 1] - atCounts[lr[0] - 1]));
        }

        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program().Calc());
    }

    public class ConsoleReader
    {
        public virtual string ReadLine() => Console.ReadLine();
        public int ReadLineInt32() => int.Parse(ReadLine());
        public long ReadLineInt64() => long.Parse(ReadLine());
        public ulong ReadLineUInt64() => ulong.Parse(ReadLine());
        public double ReadLineDouble() => double.Parse(ReadLine());
        public string[] Split() => ReadLine().Split().ToArray();
        public int[] SplitInt32() => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public long[] SplitInt64() => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public ulong[] SplitUInt64() => ReadLine().Split().Select(s => ulong.Parse(s)).ToArray();
        public double[] SplitDouble() => ReadLine().Split().Select(s => double.Parse(s)).ToArray();

        public IEnumerable<string> Repeat(int count)
        {
            for (int i = 0; i < count; i++)
                yield return ReadLine();
        }
        public IEnumerable<int> RepeatInt32(int count)
        {
            for (int i = 0; i < count; i++)
                yield return ReadLineInt32();
        }
        public IEnumerable<long> RepeatInt64(int count)
        {
            for (int i = 0; i < count; i++)
                yield return ReadLineInt64();
        }
        public IEnumerable<string[]> RepeatSplit(int count)
        {
            for (int i = 0; i < count; i++)
                yield return Split();
        }
        public IEnumerable<int[]> RepeatSplitInt32(int count)
        {
            for (int i = 0; i < count; i++)
                yield return SplitInt32();
        }
    }
    static class DicExt
    {
        public static V GetOrDefault<K, V>(this Dictionary<K, V> dic, K key, V defaultValue = default(V))
        {
            V val;
            return dic.TryGetValue(key, out val) ? val : defaultValue;
        }
    }
}


Measured memory_bytes: 20156
#include<bits/stdc++.h>
#define  ll  long long int
#define  sz   200010
using namespace std;

int main()
{

    string s;

    cin>>s;

    ll i,j,k,p,a,b,c,d;
    a=s[0]-'0' ;
    b=s[1]-'0' ;
    c=s[2]-'0' ;
    d=s[3]-'0' ;

    if (a -b -c - d ==7)cout<<a<<"-"<<b<<"-"<<c<<"-"<<d;
    else if (a +b - c + d ==7)cout<<a<<"+"<<b<<"-"<<c<<"+"<<d;
    else if (a + b +c - d ==7)cout<<a<<"+"<<b<<"+"<<c<<"-"<<d;
    else if (a + b + c + d ==7)cout<<a<<"+"<<b<<"+"<<c<<"+"<<d;
    else if (a -b - c + d ==7)cout<<a<<"-"<<b<<"-"<<c<<"+"<<d;
    else if (a - b +c - d ==7)cout<<a<<"-"<<b<<"+"<<c<<"-"<<d;
    else if (a - b + c + d ==7)cout<<a<<"-"<<b<<"+"<<c<<"+"<<d;
    else if ( a +b -c - d ==7)cout<<a<<"+"<<b<<"-"<<c<<"-"<<d;

    cout<<"=7"<<endl;


    return 0;

}


Measured memory_bytes: 256
N, M, C = map(int,input().split())

B = list(map(int,input().split()))
A = []

for i in range(N):
    A.append(list(map(int,input().split())))

count = 0
for i in range(N):
    x = 0
    for j in range(M):
        x += A[i][j] * B[j]
    if (x+C) > 0:
        count += 1

print(count)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(), (x).end()
#define pb push_back
int main()
{
    vi v;
    v.push_back(1);
    int six = 1;
    while (pow(6, six) <= 100000)
    {
        v.push_back(pow(6, six));
        six++;
    }
    int nine = 1;
    while (pow(9, nine) <= 100000)
    {
        v.push_back(pow(9, nine));
        nine++;
    }
    sort(all(v));
    int n;
    cin >> n;
    vector<int> dp(n+1, INF);
    dp[0] = 0;
    rep(i, n+1)
    {
        rep(j, v.size())
        {
            if ((i - v[j]) >= 0)
            {
                dp[i] = min(dp[i], dp[i - v[j]] + 1);
            }
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640
import Foundation

let numstr = readLine()!
let last   = String(numstr.last!)

var word = ""
switch Int(last) {
    case 2,4,5,7,9: word = "hon"
    case 0,1,6,8 :  word = "pon"
    case 3:         word = "bon"
    default : break
}

print(word)



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

using pii = pair<int, int>;
using ll  = long long;
#define rep(i, j) for (int i = 0; i < (int)(j); i++)
#define repeat(i, j, k) for (int i = (j); i < (int)(k); i++)
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " : " << x << endl

template <class T>
bool set_min(T &a, const T &b) {
    return a > b ? a = b, true : false;
}
template <class T>
bool set_max(T &a, const T &b) {
    return a < b ? a = b, true : false;
}
// vector
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &a : v) is >> a;
    return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (const T &t : v) os << "\t" << t;
    return os << endl;
}
// pair
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
    return os << "<" << v.first << ", " << v.second << ">";
}

const int INF = 1 << 30;
const ll INFL = 1LL << 60;

bool check(string &s) {
  for(int i = 0; i <= s.size() / 2; i++) {
    if(s[i] != s[s.size() - i - 1]) return false;
  }
  return true;
}

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

    string S; cin >> S;
    string t = S.substr(0, (S.size() - 1) / 2);
    string u = S.substr((S.size() + 3) / 2 - 1);
    cout << (check(S) and check(t) and check(u) ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 200000;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll q,h,s,d,n;
    cin >> q >> h >> s >> d >> n;
    s = min({q*4,h*2,s});
    if (2*s <= d){
        PRINT(n*s);
    }
    else{
        PRINT(n/2*d+n%2*s);
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int f[55], p[55];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> f[i];
    p[i] = f[i];
  }
  sort(&f[0], &f[n]);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (f[i] != p[i]) cnt++;
  }
  cout << (cnt <= 2 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
A, B = map(int, input().split())
ans = 0
for i in range(40):
    # 含まれる1の数を数える
    tmp = (B-A) // 2**(i+1) * 2**i
    p = A%(2**(i+1))
    q = (B-A)%(2**(i+1))
    # p から p+qの中で余りが2**i ~ 2**(i+1)-1になる個数を求める
    tmp += max(min(p+q,2**(i+1)-1) - max(p,2**i)+1,0)
    tmp += max(min(p+q,2**(i+1)-1 + 2**(i+1)) - max(p,2**i + 2**(i+1))+1,0)
    ans += (tmp%2) * 2**i
print(ans)

Measured memory_bytes: 9136
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}

signed main() {
	int n;
	cin >> n;
	if (n % 2 == 0) {
		cout << (n - 2) * (n / 2) << endl;
		vector<int>vec[50];
		rep(i, n / 2) {
			vec[i].push_back(i+1);
			vec[i].push_back(n - i);
		}
		rep(i, n / 2) {
			for (int j = i + 1; j < n / 2; j++) {
				cout << vec[i][0] << " " << vec[j][0] << endl;
				cout << vec[i][0] << " " << vec[j][1] << endl;
				cout << vec[i][1] << " " << vec[j][0] << endl;
				cout << vec[i][1] << " " << vec[j][1] << endl;
			}
		}
	}
	else {
		n--;
		cout << (n - 2) * (n / 2) + n << endl;
		vector<int>vec[50];
		rep(i, n / 2) {
			vec[i].push_back(i + 1);
			vec[i].push_back(n - i);
		}
		rep(i, n / 2) {
			for (int j = i + 1; j < n / 2; j++) {
				cout << vec[i][0] << " " << vec[j][0] << endl;
				cout << vec[i][0] << " " << vec[j][1] << endl;
				cout << vec[i][1] << " " << vec[j][0] << endl;
				cout << vec[i][1] << " " << vec[j][1] << endl;
			}
		}
		rep(i, n) {
			cout << n + 1 << " " << i + 1 << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<queue>
using namespace std;
int main() {
  int H,W;
  cin >> H >> W;
  char s[25][25];
  int i,j;
  for(i=0;i<H;i++)for(j=0;j<W;j++)cin >> s[i][j];
  vector<int> G[410];
  int d[410];
  for(i=0;i<H;i++)for(j=0;j<W;j++)if(s[i][j] == '.') {
    if(i>0)if(s[i-1][j] == '.') {
      G[(i-1)*W+j].push_back(i*W+j);
      G[i*W+j].push_back((i-1)*W+j);
    }
    if(j>0)if(s[i][j-1] == '.') {
      G[i*W+j-1].push_back(i*W+j);
      G[i*W+j].push_back(i*W+j-1);
    }
  }
  int ans = 0;
  for(i=0;i<H*W;i++) {
    priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> q;
    for(j=0;j<H*W;j++)d[j] = 1000;
    d[i] = 0;
    q.push(pair<int,int>(0,i));
    while(!q.empty()) {
      pair<int,int> p = q.top();
      q.pop();
      if(d[p.second] < p.first)continue;
      for(j=0;j<G[p.second].size();j++) {
        int e = G[p.second][j];
        if(d[e] > d[p.second]+1) {
          d[e] = d[p.second] + 1;
          q.push(pair<int,int>(d[e],e));
        }
      }
    }
    for(j=0;j<H*W;j++)if(d[j] != 1000)ans = max(ans,d[j]);
  }
  cout << ans << endl;
}

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

using namespace std;

int main(){
  string S; cin >> S; int s = S.size(); int cnt = 0;
 
  if(S[0] == 'A' && 'a' <= S[1] && S[1] <= 'z'&& 'a' <= S[s-1] && S[s-1]<= 'z'){
    for(int i = 2;  i <= s - 2; i++){
      if( S[i] == 'C'){cnt++;}
      else if( S[i] > 'z'){ cout << "WA"<<endl; return 0;}}
    if(cnt == 1){cout << "AC" <<endl;return 0;}
    else{cout << "WA" <<endl; return 0;}}
  
  cout << "WA" <<endl;
  return 0;}
      


Measured memory_bytes: 256
#include<bits/stdc++.h>
	using namespace std;
	typedef long long ll;
	typedef double d;
    #define    thunder   ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL)
    int main()

    {
    thunder;
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    ll c=0;
    for(int i=1;i<n;i++)
    {
        if(a[i]<a[i-1]) {c+=(a[i-1]-a[i]);a[i]=a[i-1];}
    }
    cout<<c;
    }

Measured memory_bytes: 4332
import java.util.*;

public class Main{
 public static void main(String[] args) {
   Scanner sc = new Scanner(System.in);
   
   int n = sc.nextInt();
   int i = 0;
   
   while(n != 0){
     System.out.println("Case " + (++i) + ": " + n);
     n = sc.nextInt();
   }
 }
}

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

int main() {
	string S;
	cin >> S;

	vector<char> ans;

	for (int i = 0; i <= 25; i++) {
		if (S.find(char(97 + i)) == string::npos) {
			ans.push_back(char(97 + i));
		}
	}

	bool b = ans.empty();

	if (b) {
		cout << "None" << endl;
	}
	else cout << ans[0] << endl;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define vs vector<string>
#define ss second
#define pb push_back
#define mp make_pair
#define int long long
#define ll long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define tr1(x)                cout<<#x<<": "<<x<<endl
#define tr2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define tr4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl
#define tr3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define db1(x) cerr << #x << ": " << x <<'\n'
#define db2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define db3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<pair<string,int>, int> &a,const pair<pair<string,int>, int> &b)
{
    if(a.ff.ff == b.ff.ff) {
        return (a.ff.ss > b.ff.ss);
    }
    return (a.ff.ff<b.ff.ff);
}
int min(int a, int b){
    if(a<b){
        return a;
    }
    else{
        return b;
    }
}
int max(int a, int b){
    if(a>b){
        return a;
    }
    else{
        return b;
    }
}
int max(int a, int b, int c){
    return(max( max(a,b), c ));
}
int min(int a, int b, int c){
    return (min ( min(a,b) , c));
}
int poww(int a, int b)
{
    int res = 1;
    for(int i = 1; i<=b; ++i)
        res *= a;

    return res;
}
int findlcm(int arr[], int n) 
{ 
    // Initialize result 
    int ans = arr[0]; 
  
    // ans contains LCM of arr[0], ..arr[i] 
    // after i'th iteration, 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (__gcd(arr[i], ans))); 
  
    return ans; 
}
bool prime[100001];
void SieveOfEratosthenes(int n) 
{
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
  }
}

//Define mx for maximum range and MOD for large numbers
#define mx 500005
#define mod 1000000007 

// Declare all the variables and global functions here -

int32_t main(){
    IOS;
    string s;
    cin >> s;
    rep(i, 0, 3){
        if(s[i] == s[i+1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
}   

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[n];
		for (int i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		System.out.print(a[n-1]);
		for (int i = n - 2; i >= 0; i--) {
			System.out.print(" " + a[i]);
		}
		System.out.println();
	}
}

Measured memory_bytes: 26312
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort{|x,y|y<=>x} end##
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
x=gi

m = x%100
d = x/100

mm=m
cnt=0
5.downto(1) do |i|
  cnt+=mm/i
  mm=mm%i
end

puts cnt<=d ? 1 : 0

Measured memory_bytes: 1916
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll,ll>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

int main(){
    ll n,k;cin>>n>>k;
    vector<P>p;
    rep(i,n){
        ll a,b;cin>>a>>b;
        p.emplace_back(a,b);
    }
    sort(ALL(p));
    ll res;
    rep(i,n){
        if(k==0)break;
        ll f = p[i].first,s = p[i].second;
      //cout<<f<<" "<<s<<endl;
        if(k<=s)res = f;
        k -= min(s,k);
    }
    cout<<res;
}



Measured memory_bytes: 2420
from collections import deque
import numpy as np
import math

h, w = list(map(int, input().split()))
SHWs = [input() for i in range(h)]

def bfs(sy, sx):
    visited = [[-1]*w for i in range(h)]
    visited[sy][sx] = 0
    que = deque([[sy, sx]])
    while que:
        
        y,x = que.popleft()
        for i, j in [(1,0),(0,1),(-1,0),(0,-1)]:
            next_y, next_x = y+i, x+j
            # print(visited)
            if next_y < 0 or next_x < 0 or next_y > h-1 or next_x > w-1:
                continue
            if SHWs[next_y][next_x] == '.' and (visited[next_y][next_x] == -1 or visited[next_y][next_x] > visited[y][x]+1):
                visited[next_y][next_x] = visited[y][x] + 1
                que.append([next_y, next_x])
    
    return np.amax(np.array(visited))

            
ans = 0
for sy in range(h):
    for sx in range(w):
        if SHWs[sy][sx] == '#':
            continue
        count = bfs(sy=sy, sx=sx)

        if count > ans:
            ans = count


print(ans)



Measured memory_bytes: 12256
mod = 10**9 + 7
_factorial = [1]
def fact(n):
    ''' n! % mod '''
    if n >= mod:
        return 0
    _size = len(_factorial)
    if _size < n+1:
        for i in range(_size, n+1):
            _factorial.append(_factorial[i-1]*i % mod)
    return _factorial[n]
    
_factorial_inv = [1]
def fact_inv(n):
    ''' n!^-1 % mod '''
    if n >= mod:
        raise ValueError('Modinv is not exist! arg={}'.format(n))
    _size = len(_factorial)
    if _size < n+1:
        for i in range(_size, n+1):
            _factorial.append(_factorial[i-1]*i % mod)
    _size_inv = len(_factorial_inv)
    if _size_inv < n+1:
        for i in range(_size_inv, n+1):
            _factorial_inv.append(modinv(_factorial[i]))
    return _factorial_inv[n]
    
def comb(n, r):
    ''' nCr % mod '''
    if r > n:
        return 0
    t = fact(n) * modinv(fact(n-r)) % mod
    t = t * modinv(fact(r)) % mod
    return t

def xgcd(a, b):
    x0, x1, y0, y1 = 0, 1, 1, 0
    while a != 0:
        (q, a), b = divmod(b, a), a
        y0, y1 = y1, y0 - q * y1
        x0, x1 = x1, x0 - q * x1
    return b, x0, y0

def modinv(n):
    g, x, _ = xgcd(n, mod)
    if g != 1:
        raise ValueError('Modinv is not exist! arg={}'.format(n))
    return x % mod        

x, y = sorted(map(int, input().split()))
q, r = divmod(x+y, 3)
if r != 0:
    print(0)
else:
    print(comb(q, y-q))


Measured memory_bytes: 35208
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#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++)
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}




int main()
{
    ll X;
    cin >> X;

    ll Y = 100;
    int year = 0;
    while(Y < X){
        Y *= 1.01;
        year++;
    }

    cout << year << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 3636
int main(int argc, const char * argv[]) {
    int a,b;
    scanf("%d %d",&a,&b);
    if(1<=a&&a<=100){
        if(1<=b&&b<=100){
            printf("%d %d\n",a*b,2*a+2*b);
        }
        
    }
    return 0;
}

Measured memory_bytes: 596
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

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

struct edge {
  int to, color;
};

int N;
vector<edge> Graph[101010];
int A[101010], B[101010];
int K;

void dfs(int cur, int from, int from_color) {
  int cnt = 1;
  for (int i = 0; i < Graph[cur].size(); ++i) {
    edge e = Graph[cur][i];
    if (cnt == from_color) ++cnt;

    if (e.to == from) {
      Graph[cur][i] = edge{e.to, from_color};
      continue;
    } else {
      Graph[cur][i] = edge{e.to, cnt};
      dfs(e.to, cur, cnt);
      ++cnt;
    }
  }
  chmax(K, cnt - 1);
}

int main() {
  cin >> N;
  rep(i, 0, N - 1) {
    int a, b;
    cin >> a >> b;
    Graph[a].push_back(edge{b, 0});
    Graph[b].push_back(edge{a, 0});
    A[i] = a;
    B[i] = b;
  }

  dfs(1, 0, 0);

  cout << K << "\n";
  rep(i, 0, N - 1) {
    for (auto e : Graph[A[i]]) {
      if (e.to == B[i]) {
        cout << e.color << "\n";
        continue;
      }
    }
  }
}


Measured memory_bytes: 12776
object Main {
  def main(args: Array[String]): Unit = {
    val input: Array[Int] = io.StdIn.readLine.split(' ').map(_.toInt)
    if (input(2) >= input(0) && input(2) <= input(1)) {
      println("Yes")
    } else {
      println("No")
    }
  }
}

Measured memory_bytes: 25388
#include <iostream>
using namespace std;
  int main(){
    int S;
    cin >> S;
    int h = (S-(S-S%60)%60)/3600;
    int m = (S-h*3600)/60;
    int s = S%60;
    cout << h << ":" << m << ":" << s << endl;
  }


Measured memory_bytes: 3072
# B - Minesweeper
import copy
H, W = map(int, input().split())
S_src = []
for i in range(H):
    S_src.append(list(input()))

S_tgt = copy.deepcopy(S_src)
for i in range(H):
    for j in range(W):
        if S_src[i][j] == '#':
            continue

        count = 0
        for m in range(-1, 2):
            if not (0 <= i + m < H):
                continue
            for n in range(-1, 2):
                if not (0 <= j + n < W):
                    continue
                if S_src[i+m][j+n] == '#':
                    count += 1
        S_tgt[i][j] = str(count)

for i in range(H):
    print("".join(S_tgt[i]))



Measured memory_bytes: 9440
from collections import deque

def fix(alst, blst, floar, buil, n):
  if buil == 0:
    lst = alst
  else:
    lst = blst
  
  if lst[floar] == 0:
    return floar
  if lst[floar] == 1:
    while floar + 1 < n and lst[floar + 1] == 1:
      floar += 1
    return floar
  if lst[floar] == 2:
    while lst[floar] == 2:
      floar -= 1
    return floar 

def search(alst, blst, n):
  que = deque()
  #(cost, floar, buil)
  init_floar_a = fix(alst, blst, 0, 0, n)
  init_floar_b = fix(alst, blst, 0, 1, n)
  if n - 1 in (init_floar_a, init_floar_b):
    print(0)
    return
  que.append((0, init_floar_a, 0))
  que.append((0, init_floar_b, 1))
  dic = {}
  dic[(0, init_floar_a)] = 0
  dic[(0, init_floar_b)] = 0
  while que:
    total, floar, buil = que.popleft()
    next_buil = (buil + 1) % 2
    for i in range(3):
      if floar + i >= n:
        break
      to = fix(alst, blst, floar + i, next_buil, n)
      if to == n - 1:
        print(total + 1)
        return
      if (to, next_buil) not in dic:
        dic[(to, next_buil)] = total + 1
        que.append((total + 1, to, next_buil))
  print("NA")


while True:
  n = int(input())
  if n == 0:
    break
  alst = list(map(int, input().split()))
  blst = list(map(int, input().split()))
  search(alst, blst, n)
  


Measured memory_bytes: 6008
#include <stdio.h>
#define N 1000000
int dequeue(void);
void enqueue(int);
void visit(int);
int n,adj[101][101],d[101],time,p[N],head,tail;
char color[101];
int main(){  
  int i,j,a,b,u,v;
  scanf("%d",&n);
 
  for(i=1;i<=n;i++) {
    scanf("%d%d",&a,&b);    
    for(j=1;j<=b;j++)
      scanf("%d",&adj[a][j]);
  }
  
 

    for(j=1;j<=n;j++){

      color[j] = 'W';
      d[j] = -1;
    }
    

    color[1] = 'G';
    d[1] = 0;
    head=tail =1;
    enqueue(1);

    while( head!=tail){
      u = dequeue();
      for(j=1;j<=n;j++){
	if(adj[u][j]!=0){
	  v=adj[u][j];
	  if (color[v] == 'W'){
	    color[v] = 'G';
	    d[v] = d[u] + 1;
	    enqueue(v);
	  }
	}

      }
    }
      color[u] = 'B';
    


  

for(i=1;i<=n;i++)
  printf("%d %d\n",i,d[i]);
  return 0;
}



int dequeue(void){
  int x;
  x = p[head];
  if (head + 1 == N)
    head = 0;
  else head = head + 1;
  return x;

}
void enqueue(int x){
  p[tail] = x;
  if(tail + 1 == N)
    tail = 0;
  else tail = tail + 1;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define MOD 1000000007

int main() {
    int N, M;
    cin >> N >> M;
    int L = 0, R = 100005;
    rep(i, M) {
        int l, r; cin >> l >> r;
        L = max(L, l);
        R = min(R, r);
    }

    cout << (R - L + 1 >= 0 ? R - L + 1 : 0) << endl;

}


Measured memory_bytes: 256
(defparameter *mod* 1000000007)

(defun modExpt (a e m)
  (let ((res 1) (bit_str (format nil "~B" e)))
    (loop :for c :across bit_str :do
          (if (eq c #\0)
            (setq res (mod (* res res) m))
            (setq res (mod (* (mod (* res res) m) a) m))
            )
          )
    res))

(defun main ()
  (let* ((h (read)) (w (read)) (a (read)) (b (read))
         (fact_table (make-array (- (+ h w) 1) :initial-element 1))
         (inv_fact_table (make-array (- (+ h w) 1) :initial-element 1))
         (result 0))
    (loop :for i :from 2 :below (- (+ h w) 1) :do
          (setf (aref fact_table i) (mod (* (aref fact_table (- i 1)) i) *mod*)))

    (loop :for i :below (- (+ h w) 1) :do
          (setf (aref inv_fact_table i) (modExpt (aref fact_table i) (- *mod* 2) *mod*)))

    (defun comb (n r m)
      (mod (* (mod (* (aref fact_table n) (aref inv_fact_table r)) m) (aref inv_fact_table (- n r))) m))

    (loop :for i :from b :upto (- w 1) :do
          (setq result (+ result
                          (* (comb (- (+ (- h a) i) 1) (- (- h a) 1) *mod*)
                             (comb (- (- (+ w a) i) 2) (- a 1) *mod*))))
          )
    (setq result (mod result *mod*))
    (princ result) (princ #\newline)
    ))

(main)

Measured memory_bytes: 61800
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
using namespace std;



int long long solve(int n,int long long x){
    if(x==0){return 0;}
    if(n==0){return 1;}
    if(x<=pow(2,(int long long)n+1)-2) return solve(n-1,x-1);
    
    return solve(n-1,x-pow(2,(int long long)n+1)+1)+pow(2,n);
}


int main(){
    int a;
    int long long b;
    cin>>a>>b;
    int long long ans =solve(a,b);
    cout<<ans<<endl;
return 0;
}


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

using namespace std;
using ll = long long int;
using ull = unsigned long long int;
#define vll vector<ll>

#define FOR(i, b, e) for(int i = (b); i < (e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define REV(v) reverse((v).begin(), (v).end())
#define IN(v) cin >> (v);
#define VIN(v, n) REP(i, n) cin >> v[i];
#define OUT(v) cout << (v) << endl;
#define YN(b) OUT((b) ? "YES" : "NO")
#define Yn(b) OUT((b) ? "Yes" : "No")
#define yn(b) OUT((b) ? "yes" : "no")

const ll MOD = 1000000007;

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

  int x, y;
  cin >> x >> y;

  FOR(i, 0, x + 1) {
    if (i * 2 + (x - i) * 4 == y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>
#include <cmath>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

int P[200];
int main(){
    int N;
    cin >> N;
    int A, B;
    cin >> A >> B;
    int a=0,b=0,c=0;
    REP(i,N){
        int p;
        cin >> p;
        //P[i] = p;
        if(p <= A) a++;
        else if(p <= B) b++;
        else
            c++;
            
    }

    ll ans = 0;
    ans = min(a, min(b,c));

    cout << ans << endl;
    return 0;
}


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

int main() {
  long ans=0;
  string n;
  cin >> n;
  vector<int> nn(n.size());
  for(int i=0;i<n.size();i++) {
    nn[i]=n[i]-'0';
  }
  for(int i=n.size()-1;i>=0;i--) {
    if(i!=0) {
      if(nn[i-1]>4&&nn[i]==5) {
        ans+=5;
        nn[i-1]++;
        continue;
      }
    }
    if(nn[i]==10) {
      if(i==0) ans+=1;
      else nn[i-1]++;
    } else if(nn[i]<6) {
      ans+=nn[i];
    } else {
      if(i==0) {
        ans+=11-nn[i];
      } else {
        ans+=10-nn[i];
        nn[i-1]++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 5252
package main

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

type pair struct {
	a int
	b int
}
func main() {
	_sc.Split(bufio.ScanWords)
	N := nextInt()
	graph := [1001][1001]int{}
	offset := [1001]int{}
	for i := 1; i < N+1; i++ {
		for j := 0; j < N-1; j++ {
			graph[i][j] = nextInt()
		}
	}
	queue := make([]pair, 0)
	for i := 1; i < N; i++ {
		if graph[graph[i][0]][0] == i && i < graph[i][0] {
			queue = append(queue, pair{i, graph[i][0]})
		}
	}
	ans := 0
	for cnt := 0; cnt < N*(N-1)/2; ans++ {
		if len(queue) == 0 {
			fmt.Println("-1")
			return
		}
		for b := len(queue); b > 0; b-- {
			n := queue[0].a
			offset[n]++
			if graph[graph[n][offset[n]]][offset[graph[n][offset[n]]]] == n {
				queue = append(queue, pair{n, graph[n][offset[n]]})
			}
			n = queue[0].b
			offset[n]++
			if graph[graph[n][offset[n]]][offset[graph[n][offset[n]]]] == n {
				queue = append(queue, pair{n, graph[n][offset[n]]})
			}
			queue = queue[1:]
			cnt++
		}
	}
	fmt.Printf("%d\n", ans)
}

const _bufferSize = 100000

var _sc = bufio.NewScanner(os.Stdin)
var _rd = bufio.NewReaderSize(os.Stdin, _bufferSize)

func nextInt() int {
	_i, _ := strconv.ParseInt(nextLine(), 10, 64)
	return int(_i)
}

func nextLine() string {
	_sc.Scan()
	return _sc.Text()
}

func readLine() string {
	_b, _, _ := _rd.ReadLine()
	return string(_b)
}


Measured memory_bytes: 14080
let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let pair = Array.init n @@ fun _ -> Scanf.scanf "%s %d\n" @@ fun s t -> (s, t) in
  Scanf.scanf "%s\n" @@ fun x ->
  let sum = Array.fold_left (fun sum p -> sum + snd p) 0 pair in
  let listen = Array.fold_left
      (fun (sum, b) p -> if fst p = x then (sum + snd p, true) else if b then (sum, b) else (sum + snd p, b))
      (0, false) pair  in
  Printf.printf "%d\n" (sum - fst listen)

Measured memory_bytes: 384
from math import sqrt
def isPrime(n):
    if n == 1:
        return False
    if n == 2 or n == 3:
        return True
    if n % 2 == 0 or n % 3 == 0:
        return False
    for i in range(5, int(sqrt(n)) + 1, 2):
        if n % i == 0:
            return False
    return True

def main():
    x = int(input())
    while not isPrime(x):
        x += 1
    print(x)

if __name__ == "__main__":
    main()


Measured memory_bytes: 9220
l = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())
for i in range(n):
    b,f,r,v = [int(i) for i in input().split()]
    l[b-1][f-1][r-1] += v

for b in range(4):
    for f in range(3):
        out = ""
        for r in range(10):
            out += " " + str(l[b][f][r])
        print(out)
    if 3 != b:
        print("####################")


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

int main(){
	priority_queue<int> pq;
	int N, M; cin >> N >> M;
	vector<int> G[100001];
	for(int i=0; i<N; i++){
		int a, b; cin >> a >> b;
		G[a].push_back(b);
	}
	int ans = 0;
	for(int i=M; i>=0; i--){
		for(int j=0; j<G[M-i].size(); j++){
			pq.push(G[M-i][j]);
		}
		if(!pq.empty()){
			ans += pq.top();
			pq.pop();
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5632
#include <stdio.h>

int c[10][10];
int A[205][205];

int min(int a,int b){
	if(a<=b){return a;}
	else{return b;}
}

void warshall_floyd(){

	int i,j,k;

	for(k=0;k<=9;k++){
		for(i=0;i<=9;i++){
			for(j=0;j<=9;j++){
				c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
			}
		}
	}

}

int main(){

	int H,W;

	scanf("%d %d",&H,&W);

	int i,j;


	for(i=0;i<=9;i++){
		for(j=0;j<=9;j++){
			scanf(" %d",&c[i][j]);
		}
	}

	warshall_floyd();

	int ans=0;

	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			scanf(" %d",&A[i][j]);
			if(A[i][j]!=-1&&A[i][j]!=1){
			ans+=c[A[i][j]][1];
			}
		}
	}
	printf("%d\n",ans);

	return 0;
}

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

int main(){
    vector<ll> time;
    ll tmp;
    ll mamr=9;
    ll amr=0;
    ll min=0;
    rep(i,5){
        cin>>tmp;
        time.push_back(tmp);
        amr = tmp%10;
        if(amr!=0){
            if(amr<=mamr){
                min=i;
                mamr=amr;
            }
        }
    }
    // cout<<min<<":"<<mamr<<endl;
    ll ans=0;
    rep(i,5){
        tmp = time[i];
        if(i!=min){
            if(tmp%10!=0){
                tmp=tmp-tmp%10+10;
            }
        }
        ans+=tmp;
    }
    cout<<ans<<endl;



}



Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define nl '\n'
int main()
{
    int x,a,b;
    cin>>x>>a>>b;
    if(abs(x-a)<abs(x-b))
      cout<<'A';
    else
      cout<<'B';
    cout<<nl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1000000000;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

VVI edge(100001, VI(0)); vector<bool> flag(100001, false);
void dfs(int v) {
	flag[v] = true;
	REP(i, edge[v].size()) {
		if (!flag[edge[v][i]])
			dfs(edge[v][i]);
	}
	return;
}

int main() {
	int n, m;
	cin >> n >> m;
	int x, y, z;
	REP(i, m) {
		cin >> x >> y >> z;
		edge[x].push_back(y);
		edge[y].push_back(x);
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (!flag[i]) {
			dfs(i);
			ans++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 8832
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<bitset>
#define lson node<<1,st,mid
#define rson node<<1|1,mid+1,ed
#define mem(a,x) memset(a,x,sizeof(a))
#define me(a) memset(a,0,sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define lowbit(x) x&(-x)
#define up(i,x,y) for(long long i=x;i<y;i++)
#define down(i,x,y) for(long long i=x;i>=y;i--)
#define in freopen("in.txt","r",stdin)
#define out freopen("out.txt","w",stdout)   
typedef long long ll;
const ll mod = 1e9+7;
const ll INF = 0x3f3f3f3f;
const ll maxn = 1e6+5;
const ll N = 1e3+5;
const double pi = acos(-1.0);
const double eps=1e-9;
using namespace std;

int main(){
    ll r;
    cin>>r;
    printf("%.20lf\n",2*r*pi);
}


Measured memory_bytes: 3256
#include<bits/stdc++.h>
using namespace std;
const int N = 105;
const int W = 1e5+5;
long long dp[W];
int main()
{
    long long n,lim;
    scanf("%lld %lld",&n,&lim);
    for(long long i=1;i<=100000;i++)  dp[i] = 1e15;
    for(long long i=1,w,v;i<=n;i++)
    {
        scanf("%lld %lld",&w,&v);
        for(long long j=100000;j>=0;j--)
        {
            if(j>=v&&dp[j-v]!=1e15) dp[j] = min(dp[j],dp[j-v]+w);
        }
    }
    for(long long j=100000;j>=0;j--)    if(dp[j]<=lim)  return printf("%lld\n",j),0;
}


Measured memory_bytes: 1024