akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

int gcd(int a,int b){
    if(a<=0||b<=0){
        return 0;
    }
    if(a<b)swap(a,b);
    int r=a%b;
    while(r){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

int lcm(int a,int b){
    return a / gcd(a,b) * b;
}

signed main(){
    int N,Ans=1;
    int T;
    cin >> N;
    REP(i,N){
        cin >> T;
        Ans=lcm(Ans,T);
    }
    cout << Ans << endl;
    return 0;
}      


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

int main(){
int a[30],b;
memset(a,0,sizeof(int)*30);
for(int i=0;i<28;i++){
scanf("%d",&b);
a[b-1]=1;
}
for(int i=0;i<30;i++) if(a[i]==0) printf("%d\n",i+1);
return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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 long long MAX = 5100000;
const long long INF = 1LL << 60;
const int inf = 1 << 28;
//const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int height[200500];
int width[205000];

int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	int N, W, H; scanf("%d %d %d", &N, &W, &H);
	for (int i = 0; i < N; i++) {
		int x, y, w; scanf("%d %d %d", &x, &y, &w);
		int mn_x = max(0, x - w);
		int mx_x = min(W, x + w);
		width[mn_x]++;
		width[mx_x]--;
		int mn_y = max(0, y - w);
		int mx_y = min(H, y + w);
		height[mn_y]++;
		height[mx_y]--;
	}
	for (int i = 0; i <= H; i++) {
		height[i + 1] += height[i];
	}
	for (int i = 0; i <= W; i++) {
		width[i + 1] += width[i];
	}
	bool flagh = true;
	bool flagw = true;
	for (int i = 0; i < H; i++) {
		if (!height[i]) {
			flagh = false;
			break;
		}
	}
	for (int i = 0; i < W; i++) {
		if (!width[i]) {
			flagw = false;
			break;
		}
	}
	if (flagh or flagw) puts("Yes");
	else puts("No");
	return 0;
	/*
		おまじないを使ったらscanfとprintf関連注意！！！！！！！！！！！！
	*/
}


Measured memory_bytes: 3944
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for (ll i = (ll)(a); i<(ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
void bOUT(bool c, string s, string t) { OUT(c ? s : t); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

int main(void) {
	ll N;
	cin >> N;
	vec<ll> A(N);
	REP(i, N)cin >> A[i];

	ll mx = 0;
	REP(i, N) {
		REP(j, N) {
			if (i == j)continue;
			mx = max(mx, abs(A[i] - A[j]));
		}
	}
	cout << mx << endl;
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
idxs = Array.new(n,-1)
a = n.times.map{|i|idxs[gets.to_i-1] = i}

cnt = 1
max = 1

(n-1).times{|i|
  if idxs[i]<idxs[i+1]
    cnt += 1
    max = cnt if max < cnt
  else
    cnt = 1
  end
}

p n-max


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, m,a,b;
  cin >> n >> m;
  map<int, int> mp;
  mp[0] = 0;
  for (int i = 1; i <= n; ++i) mp[i] = 0;

  rep(i, m) { cin >> a >> b;
    mp[a]++;
    mp[b]++;
  }

for (int i = 1; i <= n; ++i) {
  cout << mp[i] << endl;
}
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		int c = sc.nextInt();
		// 出力
		if (b == c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

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

namespace ALDS1_5_B
{
    public class Program

    {

        public static void Main(string[] args)
        {

            int n = ReadInt();
            int[] line = ReadIntAr();

            int comparisonTimes = MergeSort(line, 0, n - 1);

            Console.WriteLine(String.Join(" ", line.Select(x => x.ToString()).ToArray()));
            Console.WriteLine(comparisonTimes);

        }

        public static int MergeSort(int[] array, int left, int right)
        {
            if (left == right) return 0;

            int mid = (left + right) / 2;
            int comparisonTimes = MergeSort(array, left, mid) + MergeSort(array, mid + 1, right);
            comparisonTimes += Merge(array, left, mid, right);

            return comparisonTimes;
        }

        private static int Merge(int[] array, int left, int mid, int right)
        {
            int comparisonTimes = 0;

            int n1 = mid - left + 1;
            int n2 = right - (mid + 1) + 1;
            int[] L = new int[n1 + 1];
            int[] R = new int[n2 + 1];
            for (int a = 0 ; a < n1 ; a++) { L[a] = array[left + a]; }
            for (int a = 0 ; a < n2 ; a++) { R[a] = array[(mid + 1) + a]; }
            L[n1] = int.MaxValue;
            R[n2] = int.MaxValue;

            int i = 0, j = 0;
            for (int k = left ; k <= right ; k++)
            {
                if (L[i] <= R[j])
                {
                    array[k] = L[i];
                    i++;
                }
                else
                {
                    array[k] = R[j];
                    j++;
                }
                comparisonTimes++;
            }
            return comparisonTimes;
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 69092
w,h,n=map(int,input().split())
res=[[1]*w for _ in range(h)]
for i in range(n):
    x,y,a=map(int,input().split())
    if a == 1:
        for j in range(0,x):
            for k in range(0,h):
                res[k][j] = 0
    elif a == 2:
        for j in range(x,w):
            for k in range(0,h):
                res[k][j] = 0
    elif a == 3:
        for j in range(0,y):
            for k in range(0,w):
                res[j][k] = 0
    elif a == 4:
        for j in range(y,h):
            for k in range(0,w):
                res[j][k] = 0
cnt=0
for a in reversed(res):
    cnt += a.count(1)
print(cnt)
            

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  ll n,k;cin>>n>>k;

  int index;
  rep(i,n){
    cin>>index;
    if(index==1){
      index=i;
      break;
    }
  }
  int ans=0;
  int a=index;
  while(a>0){
    a-=k-1;
    ans++;
  }
  n+=a;
  a=index;
  while(a<n-1){
    a+=k-1;
    ans++;
  }
  cout<<ans<<endl;
}













Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var (
		N int64
		s string
	)
	A := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	fmt.Scan(&N)
	fmt.Scan(&s)
	for i := 0; i < len(s); i++ {
		d := (s[i] - A[0] + byte(N)) % 26
		fmt.Printf("%s", string(A[d]))
	}
	fmt.Println()
}


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

#define all(x) x.begin(),x.end()
#define pb push_back
#define ss second
#define ff first

int main(){
	int n;	cin>>n;
	vector<int>A(n);	for(int i=0;i<n;i++)	cin>>A[i];
	sort(all(A));
	int mid = n/2;
	cout<<A[mid]-A[mid-1]<<endl;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());
        var S = ReadLine();

        var ans = ((N % 2 == 1) || (S.Substring(0, N / 2) != S.Substring(N / 2))) ? "No" : "Yes";
        

        WriteLine(ans);
    }
}


Measured memory_bytes: 27448
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define ull unsigned long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int W, H;
	cin >> W >> H;
	vector<int> a(W); REP(i, W) cin >> a[i];
	vector<int> b(H); REP(i, W) cin >> b[i];
	REP(i, H) {
		sort(a.begin(), a.end(), greater<int>());
		int k = b[i];
		REP(j, k) {
			if(a[j] == 0) break;
			a[j]--; b[i]--;
		}
		if(b[i] != 0) {
			cout << 0 << endl;
			return 0;
		}
	}
	cout << 1 << endl;
}



Measured memory_bytes: 3212
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> inputs;
    inputs.resize(N);

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

    int answer = 0;
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            if(abs(inputs[j] - inputs[i]) > answer) {
                answer = abs(inputs[j] -inputs[i]);
            }
        }
    }

    cout << answer << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    long long N,H,W,i,A,B,ans=0;
    cin>>N>>H>>W;
    for(i=0;i<N;i++){
        cin>>A>>B;
        if(A>H-1&&B>W-1){
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;

int N, M, Q;
vector<int> a;
vector<int> b;
vector<int> c;
vector<int> d;

vector<int> num;
int ans = 0;
int now = 0;
void dfs(int S, int cnt){
  if( cnt == N ){
    now = 0;
    for( int i = 0; i < Q; i++ ){
      if( num.at(b[i]) - num.at(a[i]) == c[i] ) now += d[i];
    }
    if( now > ans ) ans = now;
  }else{
    for( int i = S; i <= M; i++ ){
      num.push_back(i);
      dfs(i, cnt+1);
      num.pop_back();
    }
  }
}

signed main() {
  
  cin >> N >> M >> Q;
  for( int i = 0; i < Q; i++ ){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    A--;
    B--;
    a.push_back(A);
    b.push_back(B);
    c.push_back(C);
    d.push_back(D);
  }
  dfs(1, 0);
  cout << ans << endl;
  
}

Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    set<int> paint;
    paint.insert(a);
    paint.insert(b);
    paint.insert(c);
    out(paint.size());
}


Measured memory_bytes: 256
// Problem : A - Plural Form
// Contest : AtCoder - AtCoder Beginner Contest 179
// URL : https://atcoder.jp/contests/abc179/tasks/abc179_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
#define pb push_back
#define mod 1000000007
ll power(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % mod; 
    p = (p * p) % mod; 
  
    return (y%2 == 0)? p : (x * p) % mod; 
} 
ll factorial[1000007];
void fact(ll n)
{
    memset(factorial,0,sizeof(factorial));
    factorial[0]=1;
factorial[1]=1;

    for(int i=1;i<n;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ll i;
    ans=factorial[n];
    ll ans1=power(factorial[n-r],mod-2);
    ll ans2=power(factorial[r],mod-2);
    ans=((ans*ans1)%mod*ans2)%mod;
    return ans;
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 

bool prime[100000006];
void sieve(ll n){
    memset(prime,true,sizeof(prime));
	prime[1]=false; 
    for (ll p=2;p*p<=n;p++){
        if (prime[p]){  
            for (ll i=p*p;i<=n;i+=p)
                prime[i]=false;
        }
    }
}
void bfs(vector<int> v[],int o,int n,int dp[]){
	queue<int> q;
	q.push(o);
	dp[o]=0;
	bool visited[n+1]={0};
	visited[o]=true;
	while(q.empty()==false){
		int a=q.front();
		q.pop();
		for(int i=0;i<v[a].size();i++){
			if(visited[v[a][i]]==false){
				visited[v[a][i]]=true;
				q.push(v[a][i]);
				dp[v[a][i]]=dp[a]+1;
			}
		}
	}
}
int nov[1000001];
bool visited[1000001];
int dp[1000001];
int dfs(vector<int> v[],int o)
{
    if(visited[o]==0)
    {
        visited[o]=1;
        for(int i=0;i<v[o].size();i++)
        {
            if(visited[v[o][i]]==0)
            {
            dp[v[o][i]]=dp[o]+1;
            nov[o]+=dfs(v,v[o][i]);
            }
        }
        return nov[o]+1;
    }
    else
    return 0;
}
// string s=bitset<64>(n).to_string();
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	string s;
	cin>>s;
	if(s[s.size()-1]=='s')
	{
		s.append("es");
	}
	else
	{
		s.pb('s');
	}
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 3664
N = int(input())
lst = []
for i in range(N):
    A,B = map(int,input().split())
    lst.append([B,A])
    
if N == 1:
    print("Yes" if B - A >= 0 else "No")
    exit()
    
lst.sort()  
left = lst[0][0] - lst[0][1]

for i in range(1,N):
    left = left + (lst[i][0] - lst[i-1][0])
    left -= lst[i][1]
    if left < 0:
        print("No")
        exit()
print("Yes")        

Measured memory_bytes: 105380
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;

int main(){
    ll i,j;
    char b;
    cin>>b;
    char s;
    if(b=='A') s='T';
    else if(b=='T') s='A';
    else if(b=='G') s='C';
    else s='G';

    cout<<s<<endl;
     
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/
 
 
 
 
 
int A, B;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> A >> B;

	int seki = A * B;

	if (seki % 2 == 0) cout << "Even" << endl;
	else cout << "Odd" << endl;
}
 

Measured memory_bytes: 256
import qualified Control.Monad as M

main :: IO ()
main = do
  l <- readLn
  M.replicateM_ l proc

proc :: IO ()
proc = do
  a <- readLn
  b <- readLn
  let x = a + b
  if length (show x) > 80
     then putStrLn "overflow"
     else print x

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

long long calcPermutation(long long x, long long y)
{
    long long ans = 1;
    for (long long i = 0; i < y; i++)
    {
        ans *= (x - i);
    }
    return ans;
}

long long calcCombination(long long x, long long y)
{
    if (x == 0)
    {
        return 0;
    }
    if ((x - y) < y)
    {
        y = x - y;
    }
    long long ans = calcPermutation(x, y);
    while (y > 0)
    {
        ans /= y;
        y--;
    }
    return ans;
}

int main()
{
    int N, M;
    cin >> N >> M;
    int A;
    int cumulative_sum[N + 1] = {};
    map<int, long long> counts;
    for (int i = 1; i <= N; i++)
    {
        cin >> A;
        cumulative_sum[i] = (cumulative_sum[i - 1] + A) % M;
        counts[cumulative_sum[i]]++;
    }
    counts[0]++;

    long long ans = 0;
    for (auto count = counts.begin(); count != counts.end(); count++)
    {
        ans += count->second * (count->second - 1) / 2;
    }
    cout << ans << endl;
}


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

void Main()
{
    /*
    a + b = x
    2a + 4b = y

    2a + 4x-4a = y
    2a = 4x - y    ...(1)

    2x-2b + 4b = y
    2b = -2x + y   ...(2)
    */

    int x, y;
    cin >> x >> y;
    int a = 4*x - y;
    int b = -2*x + y;
    if(a>=0 && b>=0 && a%2==0 && b%2==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

int main(int argc, char **argv)
{
    Main();
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>

int main()
{
	int i,d;
	long int sum=1;

	do
	{
		scanf("%d",&d);
	}while(d>20);

	for(i=d;i>0;i--)
	{
		sum*=i;
	}
	printf("%ld\n",sum);

	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=1e5+5;
ll n,ans,a[N],b[N];
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    for(ll i=0;i<n;i++)cin>>a[i]>>b[i];
    for(ll i=n-1;i>=0;i--)ans+=(b[i]-(a[i]+ans)%b[i])%b[i];
    cout<<ans;
}



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

int main (){
  int r,g,b;
  cin >> r >> g >> b;
  int x = 100*r + 10*g + b;
  
  if(x%4 == 0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
 
}

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

flag = 1
cnt = 0
while flag:
    flag = 0
    for j in reversed(range(1, N)):
        if A[j] < A[j-1]:
            cnt += 1
            tmp = A[j]
            A[j] = A[j-1]
            A[j-1] = tmp
            flag = 1
print(' '.join([str(i) for i in A]))
print(cnt)



Measured memory_bytes: 5608
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;

    bool f = b - a == c - b;

    auto YesOrNo = [](bool f) { cout << (f ? "YES" : "NO") << endl; };
    YesOrNo(f);
}


Measured memory_bytes: 256
import qualified Data.Map.Strict as Map
import Control.Monad

action::Map.Map Int ()->Int->Map.Map Int ()
action m i = if Map.member i m then Map.delete i m else Map.insert i () m

mult_act::Map.Map Int ()->[Int]->Map.Map Int ()
mult_act = foldl action

main::IO()
main=do
  nc<-getLine
  let n = read nc::Int
  d<-forM [1..n] (\_->getLine)
  let ls = map read d ::[Int]
  print (Map.size (mult_act Map.empty ls))

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

int main() {
  int N;
  scanf("%d", &N);
  int A[N];
  unordered_map<int, int> balls;
  rep(i,N) {
    scanf("%d", &A[i]);
    if (balls.count(A[i]) == 0) {
      balls[A[i]] = 0;
    }
    balls[A[i]]++;
  }
  
  long unbanned_patterns = 0;
  for (auto pair:balls) {
    unbanned_patterns += (long) pair.second * (pair.second - 1) / 2;
  }
  rep(i,N) {
    printf("%ld\n", unbanned_patterns - balls[A[i]] + 1);
  }
}


Measured memory_bytes: 8392
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###
import sys
sys.setrecursionlimit(10000000)

N = int(input())

adj = [set() for _ in range(N)] #adj[i] = (i_adj, 距離0or1)
for _ in range(N-1):
  u, v, w = mi()
  #0スタートに
  u -= 1
  v -= 1
  adj[u].add((v, w%2))
  adj[v].add((u, w%2))

from collections import deque
q = deque([])

seen = [0] * N
bw = [0] * N

#とりあえずノード0から探索をスタートすることにする
#0の距離は0としておく
q.append(0)
bw[0] = 0 #必要無いが、分かりやすくするために
seen[0] = 1


def solve(): #前のノードまでの色（0or1）を引き継ぐ
  try: nownode = q.popleft()
  except: return
  nowcolor = bw[nownode]

  #今のノードから隣接しているものを探索
  for adjidx, w in adj[nownode]:
    if seen[adjidx]!=1:
      q.append(adjidx)
      seen[adjidx]=1
      bw[adjidx] = (nowcolor+w)%2

  solve()

solve()

for color in bw:
  print(color)



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

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

    if (s == "SUN")
        cout << 7 << endl;
    else if (s == "MON")
        cout << 6 << endl;
    else if (s == "TUE")
        cout << 5 << endl;
    else if (s == "WED")
        cout << 4 << endl;
    else if (s == "THU")
        cout << 3 << endl;
    else if (s == "FRI")
        cout << 2 << endl;
    else if (s == "SAT")
        cout << 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int n,m,a,b;
int main()
{
	scanf("%d%d%d%d",&n,&m,&a,&b);
	if(b%2)
		printf("%d",m-n);
	else
		printf("%d",n-m);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;


int main(){
	int w;
	string s;
	cin >> s >> w;

	for(int i=0; i*w < s.size(); i++){
		cout << s[i*w];
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
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


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


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


def read_float():
    return float(buff_readline())


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


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().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(A, B, C, K):
    for _ in range(K):
        if A >= B:
            B *= 2
        elif B >= C:
            C *= 2
    return 'Yes' if A < B < C else 'No'


def main():
    A, B, C = read_int_n()
    K = read_int()
    print(slv(A, B, C, K))


if __name__ == '__main__':
    main()


Measured memory_bytes: 76832
'use strict';

function main(stdin) {
  const input = stdin.split(' ').map(v => parseInt(v, 10));
  const N = input[0];
  const K = input[1];
  let ans = N - K;
  if (K === 1) ans = 0;
  
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 22080
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

int N, A[212345], B[212345];

int main() {

	scanf("%d", &N);
	rep(i, N) scanf("%d%d", &A[i], &B[i]);
	vector<pair<int, int>> s(N);
	rep(i, N) s[i] = { B[i], A[i] };

	sort(s.begin(), s.end());

	int t = 0;
	rep(i, N) {
		t += s[i].second;
		if (s[i].first < t) {
			printf("No\n");
			return 0;
		}
	}

	printf("Yes\n");

	return 0;
}


Measured memory_bytes: 3328
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

if max(c) < 0:
    res = max(c)
else:
    res = 0

for i in range(n):
    score = []
    s = 0
    pos = i
    visited = [False] * n
    loop = 0
    while True:
        if visited[pos]:
            break

        visited[pos] = True
        s += c[p[pos]-1]
        score.append(s)
        pos = p[pos] - 1
        loop += 1

    if k < loop:
        res = max(res, max(score[:k]))
    elif score[-1] <= 0:
        res = max(res, max(score))
    elif k % loop == 0:
        res = max(res, score[-1] * (k // loop), score[-1] * (k // loop - 1) + max(score))
    else:
        res = max(res, score[-1] * (k // loop) + max(score[:k%loop]), score[-1] * (k // loop - 1) + max(score))

print(res)

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    long long int n, m;
    cin >> n >> m;

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

    vector<pair<long long int, long long int>> v;
    for (int i = 0; i < m; i++){
        pair<long long int, long long int> p;
        cin >> p.second >> p.first;
        v.push_back(p);
    }
    
    sort(a.begin(), a.begin() + n);
    sort(v.begin(), v.end());
    
    int idx = 0;
    for (int i = v.size() - 1; i >= 0; i--){
        for (int j = 0; j < v[i].second; j++){
            if (idx == n)
                break;
            if (a[idx] < v[i].first){
                a[idx] = v[i].first;
                idx += 1;
            }
            else
                break;
        }
        if (idx == n)
            break;
    }

    long long int sum = 0;
    for (auto i: a)
        sum += i;

    cout << sum << '\n';

    return 0;
}


Measured memory_bytes: 3188
N = int(input())
lis = list(map(int,input().split()))
lis.sort()
S = 0
ans = 10**10
for i in range(lis[0],lis[N-1]+1):
    for j in range(N):
        S += (i-lis[j])**2
    if S < ans:
        ans = S
    S = 0
print(ans)

Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN = 100;
int n;
int s[MAXN+5], ans, cnt[MAXN+5];
int main()
{
	scanf("%d", &n);
	for(int i=1; i<=n; i++)
	{
		scanf("%d", &s[i]);
		cnt[s[i]]++;
		if(s[i-1] != s[i])
			ans += cnt[s[i-1]] / 2, cnt[s[i-1]] = 0;
	}
	ans += cnt[s[n]] / 2;
	printf("%d", ans);
}

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

int main()
{
    int N;
    cin >> N;
    int cnt = 0;
    for (int i = 0; i < N; ++i) {
        int d1, d2;
        cin >> d1 >> d2;
        if (d1 == d2) {
            ++cnt;
            if (cnt == 3) {
                cout << "Yes" << endl;
                return 0;
            }
        } else
            cnt = 0;
    }
    cout << "No" << endl;
}





Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll MOD = 1e9 + 7;
ll n, k;

vector <pll> ans;

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

	cin >> n >> k;

	ll i = 1;
	for (; i*i <= n; i++)
	{
		ans.push_back({ 1, 1 });
	}

	ll last = --i;
	if (i*i == n) i--;
	for (i; i > 0; i--)
	{
		ans.push_back({ n / i - last, 1 });
		last += n / i - last;
	}
	if (last < n)
		ans.push_back({n-last,1});

	for (int i = 0; i < k; i++)
	{
		ll psum[100000] = { 0, };
		for (int j = 0; j < ans.size(); j++)
		{
			psum[j] = ans[j].first * ans[j].second % MOD;
			if (j) psum[j] += psum[j - 1], psum[j] %= MOD;
		}
		for (int j = 0; j < ans.size(); j++)
		{
			ans[j].second = psum[ans.size() - j - 1];
		}
	}

	cout << ans[0].second;
}

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

int main(){
  ll vec[11000]={};
  for(int i=1;i<102;i++){
    for(int j=1;j<102;j++){
      for(int k=1;k<102;k++){
        int p=i*i+j*j+k*k+i*j+j*k+k*i;
        if(p<11000){
          vec[p]++;
        }
      }
    }
  }
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    cout<<vec[i]<<endl;
  }
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <queue>
#define pb push_back
#define ll long long

using namespace std;

int main()
{
    map<int,int> mp;
    int n, a; cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a;
        mp[a] = i;
    }
    for(int i = 1; i <= n; i++) {
        cout << mp[i] << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 5504
#include <iostream>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
using namespace std;

int main()
{

    int n, d, x, a[110], cnt = 0, ans = 0;

    cin >> n >> d >> x;

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

    for(int i = 0; i < n; i++){
        cnt = 0;
        for (int j = 0; j * a[i] + 1 < d + 1; j++){
            cnt++;
        }
        ans += cnt;
    }
    cout << ans + x << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string S;
int n,sum,pre[100010],size[100010],ans[100010];
int mark[100010];
int Find(int x){
	if(pre[x]==x)return x;

}
int main(){
	cin>>S;
	n=S.size();
	for(int i=0;i<=n-1;i++)pre[i]=i,size[i]=1;
	for(int i=0;i<n-1;i++){
		if(S[i]=='R'&&S[i+1]=='L')mark[i]=1,mark[i+1]=2;
	}
	for(int i=0;i<n;i++){
		if(mark[i])continue;
		if(S[i]=='R')size[i+1]+=size[i],size[i]=0;
	}
	for(int i=n-1;i>=0;i--){
		if(mark[i])continue;
		if(S[i]=='L')size[i-1]+=size[i],size[i]=0;
	}
	//for(int i=0;i<n;i++)cout<<size[i]<<" ";
	//cout<<endl;
	for(int i=0;i<n;i++){
		if(mark[i]==1){
			size[i]--;
			ans[i]++;
			ans[i+1]+=(size[i]+1)/2;
			ans[i]+=size[i]/2;
		}
		if(mark[i]==2){
			size[i]--;
			ans[i]++;
			ans[i-1]+=(size[i]+1)/2;
			ans[i]+=size[i]/2;
		}
	}
	for(int i=0;i<n;i++)printf("%d ",ans[i]);
	return 0;
}

Measured memory_bytes: 2176
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int Maxn = 100010;
char s[Maxn]; int n;
int main() {
	int i, j, k;
	scanf("%s", s+1);
	n = strlen(s+1);
	if(s[n] == '1' || s[1] == '0'){ printf("-1\n"); return 0; }
	for(i = 1; i < n; i++){
		if(s[i] == '1' && s[n-i] != '1'){ printf("-1\n"); return 0; }
	}
	int last = 1, tot = 1, rt = 1;
	for(i = 2; i <= n/2; i++){
		if(s[i] == '1'){
			tot++;
			printf("%d %d\n", tot, rt);
			rt = tot;
			int p = i-last-1;
			while(p--){
				tot++;
				printf("%d %d\n", tot, rt);
			}
			last = i;
		}
	}
	if(tot < n){
		tot++;
		printf("%d %d\n", tot, rt);
		rt = tot;
		for(i = tot+1; i <= n; i++) printf("%d %d\n", i, rt);
	}
	return 0;
}

Measured memory_bytes: 1408
import java.util.*;
import java.lang.*;

public class Main {
    static final int INF = 1000000000;             
    static final int MAXN = 111111; 
    static int[] parentOf;
    public static void main(String[] args) throws Exception {                
        Scanner input = new Scanner(System.in);
        int n, q;
        n = input.nextInt();
        q = input.nextInt();
        parentOf = new int[n];
        for (int i = 0; i < n; ++i) parentOf[i] = -1;
        for (int i = 0; i < q; ++i) {
            int op = input.nextInt();
            int u, v;
            u = input.nextInt();
            v = input.nextInt();
            if (op == 0) {
                union(u, v);
            } else {
                if (rootOf(u) == rootOf(v)) System.out.println("1");
                else System.out.println("0");
            }
        }
    }                  
    
    static void union(int u, int v) {
        u = rootOf(u);
        v = rootOf(v);
        if (u == v) return;
        if (parentOf[u] < parentOf[v]) {
            parentOf[u] = v;
            --parentOf[v];
        } else {
            parentOf[v] = u;
            --parentOf[u];
        }
    }
    
    static int rootOf(int x) {
        if (parentOf[x] < 0) return x;
        parentOf[x] = rootOf(parentOf[x]);
        return parentOf[x];
    }
}

Measured memory_bytes: 94884
# coding: utf-8

H, W = map(int, input().split())
# print(H, W)

N = int(H * W / 2)
# print(int(N))
if H == 1 or W == 1:
    print(1)
elif H * W % 2 != 0:
    print(N + 1)
else:
    print(N)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include <math.h>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int x,y,z;
	cin >> x>> y>> z;
    string ans;
    if(abs(x-y)<abs(x-z))ans="A";
    else ans = "B";
      cout << ans << endl;
}

Measured memory_bytes: 256
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    count = 0
    for i in range(N):
        while A[i] % 2 == 0:
            count += 1
            A[i] //= 2
    print(count)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 4084
#include<iostream>
using namespace std;
int main()
{
	long long N, h, n, w;
	cin >> N;
	int flag = 0;
	for (h = 1; h <= 3500; h++)
	{
		for (n = 1; n <= 3500; n++)
		{
			if ((4 * h*n - N*h - N*n) > 0 && ((N*h*n) % (4 * h*n - N*h - N*n) == 0))
			{
				flag = 1;
				break;
			}
		}
		if (flag == 1)
		{
			cout << h << " " << n << " " << (N*h*n) / (4 * h*n - N*h - N*n) << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int s,n,m,t,p;
int x[2000];

map<int,int> mp;
vector<int> A,B;
int dp[2005][2005];
 
int main(){
  cin>>s>>n>>m;
  for(int i=0;i<s;i++)cin>>x[i];
  for(int i=0;i<n;i++){
    cin>>t>>p;
    mp[t-x[p-1]]++;
  } 
  A.push_back(0);
  B.push_back(0);
  map<int,int> :: iterator it;
  for(it=mp.begin();it!=mp.end();it++){
    A.push_back(it->first);
    B.push_back(it->second);
  }
  int size=A.size()-1,base=A[1];
  for(int i=1;i<=size;i++)A[i]-=base;
  fill(dp[1],dp[2005],1e9);
  for(int i=1;i<=size;i++){ 
    for(int j=1;j<=m;j++){
      int sum=0;
      for(int k=i-1;k>=0;k--){
        dp[i][j]=min(dp[i][j],dp[k][j-1]+sum);
        sum+=(A[i]-A[k])*B[k];
        if(sum>dp[i][j])break;
      }
    }
  }
  cout<<dp[size][m]<<endl;
  return 0;
}

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

int main(){
  double n;
  cin >>n;
  n=ceil(n/2.0);
  cout <<n <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Joe ios::sync_with_stdio(0); cin.tie(NULL); ios_base::sync_with_stdio(0); cout.tie(NULL);
#define INF 1e9+7
const long long N =1e5+5;
using namespace std;
int main(){
	Joe
	int n; cin>>n;
	int arr[n+5];
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	int dp[n+5];
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
	}
	cout<<dp[n-1]<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

////////////////////////////////////////////////////////


int main() {
    ll n, a, b; cin >> n >> a >> b;
    Vl x(n);
    rep(i, 0, n) cin >> x[i];

    ll d = b/a;
    if(b%a != 0) d++;

    ll ans = 0;
    rep(i, 1, n){
        if(x[i]-x[i-1] >= d) ans += b;
        else ans += a * (x[i]-x[i-1]);
    }
    co(ans);

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pii pair<long long,long long>
#define endl '\n'
#define N 200001
 int ans;
void bfs( int k )
{
    priority_queue<int,vector<int>,greater<int>> pq;
    for(int i=1;i<10;i++)
    pq.push(i);
    int cnt=0;
    while(1)
    {
        int num = pq.top();
        pq.pop();
        cnt++;
        if(cnt==k)
        {
            ans=num; break;
        }
        int rem = num%10;
        pq.push(num*10+rem);
        if(rem!=0)
        {
            pq.push(num*10+rem -1);
        }
        if(rem!=9)
        {
            pq.push(num*10+rem+1);
        }
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test; test=1;
    while(test--)
    {
        int n; cin>>n;
        bfs(n);
        cout<<ans<<endl;
    }
}

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

using namespace std;
int main(void)
{
   string str;
   cin >> str;
   int m1 = str[5]-'0';
   int m2 = str[6]-'0';
   m1 = 10*m1+m2;
   if(m1<=4)
      cout<<"Heisei"<<endl;
   else
      cout<<"TBD"<<endl;

   return 0;
} 

Measured memory_bytes: 256
n = int(input())
dic = {}

for i in range(n):
  s,p = input().split()
  num = 100 - int(p)
  num_zero = str(num).zfill(3)
  s2 = s + num_zero
  dic[s2] = i + 1
  
array = sorted(dic.keys())

for s in array:
  print(dic[s])

Measured memory_bytes: 3064
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val k = sc.nextLong()
  val n = 50
  val a = Array.fill(n)(n - 1 + k/n)
  val x = (k % n).toInt
  for (i <- 0 until n-x) {
    a(i) -= x
  }
  for (i <- n-x until n) {
    a(i) += n-x+1
  }

  println(n)
  println(a.mkString(" "))
}


Measured memory_bytes: 55516
iogetints :: IO [Int]
iogetints = do
  s <- getLine
  return $ map read $ words s

solve :: Int -> Int -> Char
solve a b
	| a + b == 15 = '+'
	| a * b == 15 = '*'
	| otherwise = 'x'

main :: IO ()
main = do 
	[a, b] <- iogetints
	putChar (solve a b)

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  bool flag = false;
  for(int i = 0; i < s.size(); ++i) {
    if(s[i] == '9') flag = true;
  }

  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int H, W;
int main(int argc, char const* argv[]) {
  cin >> H >> W;
  vector<string> S(H);
  for (size_t i = 0; i < H; i++) {
    cin >> S[i];
  }
  string sharp(W+2, '#');
  cout << sharp << endl;
  for (size_t i = 0; i < H; i++) {
    cout << '#' << S[i] << '#' << endl;
  }
  cout << sharp << endl;
  return 0;
}


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

using namespace std;

int n, m, p[100005];
int par[100005];
int ans;

int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);
}

void merge(int x, int y){
    x = find(x);y=find(y);
    par[x] = y;
}

int main() {
    cin>>n>>m;
    for (int i = 1; i <= n; i++) {par[i] = i;scanf("%d", p+i);}
    for (int i = 1; i <= m; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        merge(x, y);
    }
    for (int i = 1; i <= n; i++) {
        if (find(i) == find(p[i])) ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */


int main(const int argc, char * argv [])
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  size_t n;
  int64_t dist;
  cin >> n >> dist;
  vector<int64_t> x(n);
  cin >> x;

  vector<int64_t> d;
  d.reserve(n);
  {
    int64_t s = dist;
    for(const auto i: x)
    {
      d.push_back(s);
      s = min(s, abs(s - i));
      // d.push_back(min(s, abs(s - i)));
      // s = d.back();
    }
  }

  DEBUG(d);

  vector<int64_t> t(n);
  // t.back() = x.back() == 1 ? 2 : 1;
  {
    int64_t r = 1;
    for(size_t i = n - 1; i < n; --i)
    {
      t[i] = r;
      // if(x[i] < r + 1)
      if(r != min(r, abs(r - x[i])))
        r += x[i];

      // if(t[i + 1] < x[i])
      //   t[i] = t[i + 1];
      // else
      //   t[i] = t[i + 1] + x[i];
    }
  }
  DEBUG(t);

  size_t q;
  for(cin >> q; q; --q)
  {
    size_t i;
    cin >> i;
    -- i;
    cout << (t[i] < d[i] + 1 ? "YES" : "NO") << '\n';
  }

  return EXIT_SUCCESS;
}



Measured memory_bytes: 13696
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
ll MOD=1e9+7;
#define INF 2*1e9
#define N 600010
using namespace std;
int gcd(int x,int y){
    if(x==0)return y;
    return gcd(y%x,x);
}
main(){
    int n,x,y[200000];
    cin>>n>>x;
    rep(i,n)cin>>y[i];
    int g=abs(y[0]-x);
    rep(i,n-1){
        g=gcd(g,abs(y[i+1]-y[i]));
    }
    cout<<g;
}


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

int main() {
  ll n;
  vl a(3), b(3);
  cin >> n;
  rep(i, 3) cin >> a[i];
  rep(i, 3) cin >> b[i];
  rep(_, 2) {
    vl dp(n + 1, 0);
    rep(i, 3) rep(j, n) {
      ll nj = j + a[i];
      if(nj <= n) dp[nj] = max(dp[nj], dp[j] + b[i]);
    }
    ll mx = n;
    rep(j, n + 1) mx = max(mx, n - j + dp[j]);
    swap(a, b);
    n = mx;
  }
  cout << n << endl;
}

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

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;
    --X;
    --Y;
    vector<int> count(N-1,0);
    rep(i,N) {
        for(int j = i + 1; j < N; ++j) {
            int dist = min(j-i,abs(X-i)+abs(Y-j)+1);
            ++count.at(dist-1);
        }
    }
    rep(i,N-1) cout << count.at(i) << endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit )  for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

int main(){
  ll x,y; scanf("%lld%lld",&x,&y);
  if(y>=0){
    ll ans = INF;
    if(x<=y) ans = min(ans,1ll*y-x);
    if(-x<=y) ans = min(ans,1ll*y+x+1);
    if(abs(x)>=abs(y)){
      if(x<0) ans=min(ans,abs(x)-abs(y)+1);
      else ans=min(ans,2+abs(x)-abs(y));
    }
    printf("%lld\n",ans);
  }else{
    if(x<=y) printf("%lld\n",y-x);
    else{
      if(abs(x)>=abs(y)){
        ll ans = 1+abs(x)-abs(y);
        printf("%lld\n",ans);
      }else{
        ll ans = min(1+abs(y)-x,2+abs(y)+x);
        printf("%lld\n",ans);
      }
    }
  }   
  return 0;
}

Measured memory_bytes: 256