akhauriyash/Code-Regression huggingface dataset:
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

import collections

N, M = rl()
edges = collections.defaultdict(list)
for i in range(M):
	a, b = rl()
	edges[a-1].append(b-1)
	edges[b-1].append(a-1)

queue = collections.deque()
queue.append(0)

visited = {}
while queue:
	n = queue.popleft()
	for e in edges[n]:
		if e in visited: continue
		visited[e] = n
		queue.append(e)

for i in range(N):
	if i not in visited:
		print('No')
		exit()
print('Yes')
for i in range(1,N):
	print(visited[i]+1)


Measured memory_bytes: 115584
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int n;
long long ans;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;++i)
	 for (int j=1;j<=n;++j)
	 {
	 	int now=__gcd(i,j);
	 	if (now==1) ans+=n;
	 	else
	 	{
	 		for (int k=1;k<=n;++k) ans+=__gcd(now,k);
	 	}
	 }
	printf("%lld\n",ans);
return 0;
}

Measured memory_bytes: 3812
#include <stdio.h>

int main()
{
  unsigned long long int n,i,x,sum=0,count=0,flag=0;
   char a[1000000];
   
   
gets(a);
for(i=0;i<strlen(a);)
{
    if(a[i]=='e')
    {
    if(a[i]=='e'&& a[i+1]=='r' && a[i+2]=='a' && a[i+3]=='s' && a[i+4]=='e'&& a[i+5]=='r')
    {
        i+=6;
    }else{
        if(a[i]=='e'&& a[i+1]=='r' && a[i+2]=='a' && a[i+3]=='s' && a[i+4]=='e')
        {
        i+=5;
        }
        else{
            flag=1;
            break;
        }
    }
    }else{
        if(a[i]=='d')
        {
            if(a[i]=='d'&& a[i+1]=='r' && a[i+2]=='e' && a[i+3]=='a' && a[i+4]=='m'&& a[i+5]=='e' && a[i+6]=='r' && a[i+7]!='a' && a[i+8]!='s')
         {
        i+=7;
       }else{
          if(a[i]=='d'&& a[i+1]=='r' && a[i+2]=='e' && a[i+3]=='a' && a[i+4]=='m'){
        i+=5;
         } else{
             flag=1;
            break;
         }
       }
        }else{
            flag=1;
            break;
        }
        
    }
}
if(flag==1)
{
    printf("NO");
}else{
    printf("YES");
}
    return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i

hons = [2, 4, 5, 7, 9]
pons = [0, 1, 6, 8]
bons = [3]

k = n % 10

if hons.include?(k)
    puts 'hon'
elsif pons.include?(k)
    puts 'pon'
else
    puts 'bon'
end


Measured memory_bytes: 14316
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e18;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dp[3005][6005];
signed main() {
    int N,T;
    cin >> N >> T;
    vector<P>A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i].first >> A[i].second;
    }
    sort(A.begin(),A.end());
    for(int i = 0; i < N; i++) {
        if(i == 0) {
            dp[i][A[i].first] = A[i].second;
            continue;
        }
        for(int j = 0; j < T; j++) {
            dp[i][j+A[i].first] = max(dp[i][j+A[i].first],dp[i-1][j]+A[i].second);
        }
        for(int j = 0; j < 6005; j++) {
            dp[i][j] = max(dp[i][j],dp[i-1][j]);
        }
    }
    int ans = 0;
    for(int i = 0; i < 6005; i++) {
        ans = max(ans,dp[N-1][i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 144352
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
//#pragma GCC optimize("Ofast")  //デバッグ時にoptimized-outされて邪魔だった
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

void dfs(vector<vpii>& points, vi& colors, unordered_set<int>& seen, int cur, int prevc) {
  int col = 1;
  for(auto p : points[cur]) {
    if(seen.find(p.first) == seen.end()) {
      if(col == prevc) col ++;
      seen.emplace(p.first);
      colors[p.second] = col;
      dfs(points, colors, seen, p.first, col);
      col++;
    }
  }
}

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  invar(int, N);
  vector<vpii> points(N, vpii());
  
  rep(i, N-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    points[a].push_back(make_pair(b, i));
    points[b].push_back(make_pair(a, i));
  }
  
  unordered_set<int> seen;
  seen.emplace(0);
  vi colors(N-1);
  dfs(points, colors, seen, 0, 0);
  
  int mv = 0;
  rep(i, N-1) {
    chmax(mv, colors[i]);
  }
  
  fin(mv);
  
  rep(i, N-1) {
    fin(colors[i]);  
  }  
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    int n; std::cin >> n;
    n %= 10;
    string s;
    if (n == 3) s = "bon";
    else if (n == 0 || n == 1 || n == 6 || n == 8) s = "pon";
    else s = "hon";
    std::cout << s << "\n";
}


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

int main() {
    int n;
    cin >> n;
    while(n != 0) {
        if(n % 10 == 9) {
            cout << "Yes" << endl;
            return 0;
        } else {
            n /= 10;
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
int visited[200000]= {0};
long long int visited2[200000]= {0};
int main()
{
    map<long long int,long long int>m;
    vector<pair<long long int,long long int> >par;
    long long int n;
    cin>>n;
    long long int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    long long int summ=0;
    long long int sum=0;
    for(int i=0; i<n; i++)
    {
        if(visited[a[i]]==0)
        {
            par.push_back(make_pair(a[i],m[a[i]]));
            summ=summ+m[a[i]];
            sum=sum+(m[a[i]]*(m[a[i]]-1))/2;
            visited[a[i]]=1;
        }
        if(summ==n)
        {
            break;
        }
    }
    long long int s=0;
    for(int i=0; i<n; i++)
    {
        s=sum-(m[a[i]]*(m[a[i]]-1))/2+((m[a[i]]-1)*(m[a[i]]-2))/2;
        cout<<s<<endl;
    }
}


Measured memory_bytes: 13936
using System;
using System.Linq;
class aoj
{
    static void Main()
    {
        int[] c = new int[8];
        c[0] = 1;c[1] = 2;c[2] = 1;c[3] = 2;c[4] = 1;c[5] = 4;c[6] = 1;c[7] = 4;
        while (true)
        {
            string a = Console.ReadLine();
            if (String.IsNullOrEmpty(a)) break;
            int[] b = a.Split(' ').Select(int.Parse).ToArray();
            int[] f = new int[3];
            f[0] = 1000000000;
            for (int i = 0; i < 8; i++)
            {
                int e = 0;
                char[] h = new char[8];
                for (int j = 0; j < 8; j++)
                {
                    int d = j + i;
                    if (d >= 8)
                        d -= 8;
                    int g = b[j] - c[d];
                    if (g < 0)
                        g = 0;
                    e += g;
                    h[j] = (char)(c[d] + '0');
                }
                if (f[0] > e)
                {
                    f[0] = e;
                    f[1] = i;
                    string k = new string(h);
                    f[2] = int.Parse(k);
                }
                if (f[0] == e)
                {
                    string k = new string(h);
                    int l = int.Parse(k);
                    if (f[2] > l)
                    {
                        f[1] = i;
                        f[2] = l;
                    }
                }
            }
            int m = f[1];
            for (int i = 0; i < 8; i++)
            {
                int n = m + i;
                if (n >= 8)
                    n -= 8;
                if (i == 0)
                    Console.Write(c[n]);
                else
                    Console.Write(" " + c[n]);
            }
            Console.WriteLine();
        }
    }
}

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

signed main() {
	int ans = 0;
	string e; cin >> e; 
	for (int i = 0; i < e.length(); i++) {
		for (int j = i; j < e.length(); j++) {
			string a = e.substr(i, j - i+1);
			int b = 0;
			for (char c : a) {
				if (c == 'A' || c == 'T' || c == 'G' || c == 'C')b++;
			}
			if (b == a.length())ans = max(ans, b);
		}
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
def gcd(a,b):
	if a == 0:
		return b
	if b == 0:
		return a
	if a < b:
		n = b//a
		return gcd(a,b-n*a)
	else:
		n = a//b
		return gcd(a-n*b,b)

N=int(input())
A =list(map(int,input().split(' ')))

ans = A[0]
for i in A[1:]:
	ans = gcd(ans,i)
print(ans)




Measured memory_bytes: 14228
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};

int main(){
  int H,W,cnt=0,nx,ny;
  queue<pair<int,int>> q;
  pair<int,int> p;
  cin>>H>>W;
  vector<vector<int>> A(H,vector<int>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      char cha;
      cin>>cha;
      if(cha=='#'){
        A[i][j]=0;
        q.push(pair<int,int>(i,j));
      }
      else A[i][j]=INF;
    }
  }
  while(q.size()){
    pair<int,int> P=q.front();
    q.pop();
    for(int k=0;k<4;k++){
      nx=P.second+dx[k],ny=P.first+dy[k];
      if(0<=nx&&nx<W&&0<=ny&&ny<H&&A[ny][nx]==INF){
        A[ny][nx]=A[P.first][P.second]+1;
        cnt=A[ny][nx];
        q.push(pair<int,int>(ny,nx));
      }
    }
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 12432
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

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

int main() {

  long long N,M;
  string s,t;
  cin >> N >> M >> s >> t;

  long long g = gcd(N,M),l = N * M / g;
  long long a = N / g,b = M / g;

  for(int i = 0;i < g;i++) {
    if(s[i*a] != t[i*b]) {
      cout << -1 << endl;
      return 0;
    } 
  }

  cout << l << endl;
}


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

const int MOD = (int)1e9+7;

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

  vector<int> x;
  for(int i=1;i<=min(A,B);i++){
    if(A%i==0 && B%i==0)  x.push_back(i);
  }
  cout << x.at(x.size()-K) << endl;

  return 0;
}


Measured memory_bytes: 256
nk = list(map(int,input().split()))
n,k = nk[0],nk[1]
d = []
a = []
for i in range(k):
    dd = int(input())
    d.append(dd)
    b = list(map(int,input().split()))
    a.append(b)
okasi = []
for i in range(k):
    for j in range(d[i]):
        okasi.append(a[i][j])
okasi = list(set(okasi))
hito = [i for i in range(1,n+1)]
for i in okasi:
    if i in hito:
        hito.remove(i)
ans = len(hito)
print(ans)

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

int main(){
    std::string S;
    std::cin >> S;
    for(int i = 0; i < S.size(); i++){
        if(S[i] == '1') S[i] = '9';
        else S[i] = '1';
    }
    std::cout << S << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define INF 1000000000
#define mod 1000000007
#define endl "\n"
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;

int main()
{
	fio
	ll n;
	cin >> n;
	ll a, b, c;
	ll dp[n + 1][3];
	cin >> a >> b >> c;
	dp[1][1] = a;
	dp[1][2] = b;
	dp[1][3] = c;
	for(ll i = 2; i <= n; i++) {
		cin >> a >> b >> c;
		dp[i][1] = a + max(dp[i - 1][2], dp[i - 1][3]);
		dp[i][2] = b + max(dp[i - 1][1], dp[i - 1][3]);
		dp[i][3] = c + max(dp[i - 1][1], dp[i - 1][2]);
	}
	cout << max(max(dp[n][1], dp[n][2]), dp[n][3]);
 	return 0;
}


Measured memory_bytes: 5964
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int H = stdIn.nextInt();
		int A = stdIn.nextInt();
		int ans = 0;
		if(H % A == 0){
			ans = H / A;
		}
		else{
			ans = H / A;
			ans = ans + 1;
		}
		System.out.println(ans);
		stdIn.close();
	}
}


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

#define U1 unsigned char
#define S1 char
#define	S4 int
#define DU double
#define VD void

#define MAX_HEAP_SIZE     (500000)   /* 最大ヒープサイズ */


/* TODO ヒープ配列のローカル変数化 */
S4 s4_g_heap[MAX_HEAP_SIZE];

S4 s4_d_setHeap(S4*);
VD vd_d_maxHeapify(S4*, S4, S4);
VD vd_d_buildMaxHeap(S4*, S4);
VD vd_d_outputHeap(S4*, S4);
S4 s4_d_calcRightIndex(S4);
S4 s4_d_calcLeftIndex(S4);
VD vd_d_swap(S4*, S4*);

S4 main()
{
	S4 s4_t_heapSize;

	s4_t_heapSize = s4_d_setHeap(s4_g_heap);
	vd_d_buildMaxHeap(s4_g_heap, s4_t_heapSize);
	vd_d_outputHeap(s4_g_heap, s4_t_heapSize);

	return((S4)0);
}

/* ユーザが入力した値をヒープに設定する */
/* 戻り値：ヒープサイズ */
S4 s4_d_setHeap(S4* s4_ap_heap)
{
	S4 s4_t_i;
	S4 s4_t_heapSize;

	s4_t_i = (S4)0;

	(VD)scanf("%d", &s4_t_heapSize);

	for (s4_t_i = (S4)0; s4_t_i < s4_t_heapSize; s4_t_i++)
	{
		(VD)scanf("%d", &s4_ap_heap[s4_t_i]);
	}

	return (s4_t_heapSize);
}

/* ヒープs4_ap_heapのインデックスs4_a_rootIndexの子ノードたちをmaxヒープ化 */
/* 子のキーが親より大きければ入れ替える、を再帰的に繰り返す */
VD vd_d_maxHeapify(S4* s4_ap_heap, S4 s4_a_rootIndex, S4 s4_a_heapSize)
{
	S4 s4_t_leftIndex;
	S4 s4_t_rightIndex;
	S4 s4_t_LargestIndex;	/* キーが最大のインデックス */

	s4_t_LargestIndex = s4_a_rootIndex;	/* 暫定で親のキーが最大とする */

	s4_t_leftIndex = s4_d_calcLeftIndex(s4_a_rootIndex);
	s4_t_rightIndex = s4_d_calcRightIndex(s4_a_rootIndex);

	/* 左の子が存在すれば、左の子と親のキーを比較 */
	if (s4_t_leftIndex < s4_a_heapSize)
	{
		if (s4_ap_heap[s4_t_leftIndex] > s4_ap_heap[s4_a_rootIndex])
		{
			s4_t_LargestIndex = s4_t_leftIndex;
		}
	}

	/* 右の子が存在すれば、右の子と親のキーを比較 */
	if (s4_t_rightIndex < s4_a_heapSize)
	{
		if (s4_ap_heap[s4_t_rightIndex] > s4_ap_heap[s4_t_LargestIndex])
		{
			s4_t_LargestIndex = s4_t_rightIndex;
		}
	}

	/* 親のキーが最大となるように入れ替え */
	if (s4_t_LargestIndex != s4_a_rootIndex)
	{
		vd_d_swap(&(s4_ap_heap[s4_t_LargestIndex]), &(s4_ap_heap[s4_a_rootIndex]));
		vd_d_maxHeapify(s4_ap_heap, s4_t_LargestIndex, s4_a_heapSize);
	}
}

/* ヒープをmaxヒープ化 */
VD vd_d_buildMaxHeap(S4* s4_ap_heap, S4 s4_a_heapSize)
{
	S4 s4_t_index;

	for (s4_t_index = s4_a_heapSize / (S4)2; s4_t_index >= (S4)0; s4_t_index--)
	{
		vd_d_maxHeapify(s4_ap_heap, s4_t_index, s4_a_heapSize);
	}
}

/* ヒープの値を出力する */
VD vd_d_outputHeap(S4* s4_ap_heap, S4 s4_a_heapSize)
{
	S4 s4_t_i;
	s4_t_i = (S4)0;

	for (s4_t_i = (S4)0; s4_t_i < s4_a_heapSize; s4_t_i++)
	{
		printf(" %d", s4_ap_heap[s4_t_i]);
	}
	printf("\n");
}

/* 引数s4_a_indexの右の子のインデックスを返す */
S4 s4_d_calcRightIndex(S4 s4_a_index)
{
	/* インデックスnの右の子は2n+2 */
	return((S4)2 * s4_a_index + (S4)2);
}

/* 引数s4_a_indexの左の子のインデックスを返す */
S4 s4_d_calcLeftIndex(S4 s4_a_index)
{
	/* インデックスnの左の子は2n+1 */
	return((S4)2 * s4_a_index + (S4)1);
}

/* 変数xと変数yの値を入れ替える */
VD vd_d_swap(S4* s4_ap_x, S4* s4_ap_y)
{
	S4 s4_t_tmp;
	s4_t_tmp = *(s4_ap_y);
	*(s4_ap_y) = *(s4_ap_x);
	*(s4_ap_x) = s4_t_tmp;
}


Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define plll pair<ll,pll>
#define ppll pair<pll, pll>
#define pii pair<int, int> 
#define pb push_back
#define mod 1000000007
#define N 2000007
ll power(ll a,ll b){
    ll res=1ll;
    while(b>0){
        if(b%2!=0) res=(res*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return res%mod;
}
ll ncr(ll n,ll k){
    if(k>n-k) k=n-k;
    ll pro=1;
    for(ll i=0;i<k;i++){
        pro=(pro*(n-i))%mod;
        pro/=(i+1);
    }
    return (pro)%mod;
}

void swap(ll *a,ll *b) {
    ll temp=*a;
    *a=*b;
    *b=temp;
}
vector<ll> prime;
void seive(){
    vector<bool > isprime(1000001,true);
    for(int i=2;i*i<=1000000;i++){
        if(isprime[i]){
            for(int j=i*i;j<=1000000;j+=i){
                isprime[j]=false;
            }
        }
    }
    for(int i=2;i<=1000000;i++){
        if(isprime[i]) prime.push_back(i);
    }
}
vector<ll> parent;
ll find(ll p) {
    if(parent[p]==p) return parent[p];
    return parent[p]=find(parent[p]); 
}
void unun(ll a,ll b) {
    ll r1=find(a);
    ll r2=find(b);
    if(r1!=r2) parent[r2]=r1;
}
void solve() {
    string str;
    cin>>str;
    if(str=="ABC" ) cout<<"ARC";
    else cout<<"ABC";

}   


int main(void){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    t=1;
    // cin>>t;
    while(t--) {
        solve();
        // cout<<endl;
    }
    return 0; 

}


Measured memory_bytes: 3656
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;

int main(void) {
    Int a, b;
    cin >> a >> b;
    if (a == b) {
        cout << 2 * a << endl;
    } else if (a > b) {
        cout << 2 * a - 1 << endl;
    } else {
        cout << 2 * b - 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, n , m) for(int i = n; i <= m; i++)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
const int mod = 1000000007; 
long long inv[200000],fact[200000],ifact[200000];
long long comb(ll n, ll k){
	if(n<k)return 0;
	else if (n<0||k<0) return 0;
	else return fact[n] * ifact[k] % mod * ifact[n-k] % mod;
}
 
 
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	/*inv[1] = fact[0] = fact[1] = ifact[0] = ifact[1] = 1; for (int i=2;i<200000;i++){ inv[i] = (mod - mod / i) * inv[mod % i] % mod; fact[i] = fact[i-1] * i % mod;ifact[i] = ifact[i-1] * inv[i] % mod;
	}*/ //nCr
	int N,A,B;
	cin>>N>>A>>B;
	cout<<min(B,A*N)<<endl;
}

Measured memory_bytes: 384
a,b=map(int,input().split())

def f(x):
    if x%2==0:
        if x%4==0:
            return x
        else:
            return x^1
    else:
        if (x+1)%4==0:
            return 0
        else:
            return 1

print(f(a-1)^f(b))


Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

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

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define log(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
int ctoi(char c){return c-'0';}


// TODO: write
int main() {
  ll m = 100;
  ll n;cin>>n;
  int ans = 0;
  while(m < n){
    ans++;
    m += m/100;
  }
  print(ans);
  return 0; 
}


Measured memory_bytes: 3624
import java.io.*;

class Main{
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = br.readLine();
String[] strAry = str.split(" ");
int x = Integer.parseInt(strAry[0]);
int y = Integer.parseInt(strAry[1]);
System.out.println(x*y +" "+ 2*(x+y));
}
}

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

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

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

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 100010

ll N, A;

signed main()
{
    cin >> N >> A;
    if(N % 500 <= A) { printf("Yes\n"); }
    else { printf("No\n"); }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
const int MOD = 1e9 + 7;

int main() {
   ios_base::sync_with_stdio(0); cin.tie(0);
   int n;
   string s;
   cin>>n>>s;
   int i = 0,ans=  0;
   while(i < (int) s.size()) {
   		char a = s[i];
   		i++; ans++;
   		while(s[i] == a) {
   			i++;
   		}
   }
   cout<<ans<<"\n";
   return 0;   
}

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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<bool> a(10, false);
  vector<bool> b(100, false);
  vector<bool> c(1000, false);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 100; j++) {
      if (b[j]) {
        c[10 * j + (s[i] - '0')] = true;
      }
    }
    for (int j = 0; j < 10; j++) {
      if (a[j]) {
        b[10 * j + (s[i] - '0')] = true;
      }
    }
    a[s[i] - '0'] = true;
  }
  int ans = 0;
  for (int i = 0; i < 1000; i++) {
    if (c[i])
      ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,m,a=0;    
  int i,j;
  scanf ("%d%d",&n,&m);

  int score[100][100];
  int b[100];
  int c[100];

  for(i=0;i<100;i++){
    for(j=0;j<100;j++){
      score[i][j]=0;
      b[j]=0;
      c[i]=0;
    }
  }
  
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a);
      score[i][j]=a;
    }
  }

  for(j=0;j<m;j++){
    scanf("%d",&a);
    b[j]=a;
  }

  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      c[i]=c[i]+score[i][j]*b[j];
    }
    printf("%d\n",c[i]);
    
  }

 
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <queue>
#include <atcoder/mincostflow>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;

const int INF = 10000;

int main()
{
    int n, m;
    cin >> n >> m;
    string s[52];
    for(int i = 0; i < n; i++) cin >> s[i];
    P p[102];
    int c = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(s[i][j] == 'o'){
                p[c] = P(i, j);
                c++;
            }
        }
    }
    mcf_graph<ll, ll> g(n * m + c + 2);
    for(int i = 0; i < c; i++){
        int d[52][52];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++) d[i][j] = INF;
        }
        d[p[i].first][p[i].second] = 0;
        queue<P> que;
        que.push(p[i]);
        while(que.size()){
            P q = que.front();
            que.pop();
            int x = q.first, y = q.second;
            g.add_edge(n * m + i, x * m + y, 1, INF - d[x][y]);
            if(x + 1 < n && s[x + 1][y] != '#' && d[x + 1][y] == INF){
                que.push(P(x + 1, y));
                d[x + 1][y] = d[x][y] + 1;
            }
            if(y + 1 < m && s[x][y + 1] != '#' && d[x][y + 1] == INF){
                que.push(P(x, y + 1));
                d[x][y + 1] = d[x][y] + 1;
            }
        }
    }
    for(int i = 0; i < c; i++){
        g.add_edge(n * m + c, n * m + i, 1, 0);
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            g.add_edge(i * m + j, n * m + c + 1, 1, 0);
        }
    }
    cout << INF * c - g.flow(n * m + c, n * m + c + 1).second << endl;
}


Measured memory_bytes: 8708
#include <stdio.h>
#include <unistd.h>

static const unsigned char TABLE_BITS_COUNT[] = {
  0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6
};

static const unsigned char TABLE_TRAILING_ZEROS[] = { 0, 1, 6, 2, 7, 5, 4, 3 };

static unsigned int
fold_bitflag_func(
  unsigned int  acc,
  unsigned int  x,
  unsigned char *ary,
           int  col)
{
  unsigned char i = TABLE_TRAILING_ZEROS[((x * 0x1d) >> 5) & 0x07];
  return acc + TABLE_BITS_COUNT[ary[i] & col];
}

static unsigned int
fold_bitflag(
  unsigned int  n,
  unsigned int  init,
  unsigned int  (*func)(unsigned int, unsigned int, unsigned char *, int),
  unsigned char *data0,
           int  data1)
{
  unsigned int flg;

  while (1) {
    flg = n & ((~n) + 1);
    if (flg == 0) {
      break;
    }
    init = func(init, flg, data0, data1);
    n ^= flg;
  }

  return init;
}

static void
abc173_c(void)
{
  unsigned int h, w, k;
  unsigned char ary[6];

  (void)scanf("%d %d %d\n", &h, &w, &k);

  for (int i = 0; i < h; i++) {
    unsigned char buf[8];
    (void)scanf("%s\n", buf);

    unsigned char c = 0;
    for (int j = 0; j < w; j++) {
      if (buf[j] == '#') {
        c |= (1 << j);
      }
    }
    ary[i] = c;
  }

  unsigned int ans = 0;
  for (int row = 0; row < 1 << h; row++) {
    for (int col = 0; col < 1 << w; col++) {
      unsigned int cnt = fold_bitflag(row, 0, fold_bitflag_func, ary, col);
      if (cnt == k) {
        ans += 1;
      }
    }
  }
  printf("%d\n", ans);
}

int
main(void)
{
  abc173_c();
  return 0;
}


Measured memory_bytes: 1640
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

template<typename T> T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }
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 MOD = 1000000007;
const lint INF = 1LL << 60;

int main() {
    int H, N;
    cin >> H >> N;
    int dp[20050];
    rep(i, 20010) dp[i] = 1e9;
    dp[0] = 0;
    rep(i, N) {
        int A, B;
        cin >> A >> B;

        for (int j = 0; j + A <= 20000; j++) {
            chmin(dp[j+A], dp[j] + B);
        }
    }
    int res = 1e9;
    for (int i = H; i < 20000; i++) {
        res = min(res, dp[i]);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
        int ans;
        if (a + w < b) {
            ans = b - a - w;
        } else if (b + w < a) {
            ans = a - b - w;
        } else {
            ans = 0;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

int main(){
    string s, t;
    cin >> s >> t;
    vector<string> S;
    int ss = s.size(), ts = t.size();
    int n = ss - ts + 1;
    for (int i = 0; i < n; i++) {
        string x = s;
        bool f = true;
        for (int j = 0; j < ts; j++) if(!(x[i+j] == '?' || x[i+j] == t[j])) f = false;
        if(f){
            for (int j = 0; j < ts; j++) x[i+j] = t[j];
            replace(x.begin(), x.end(), '?', 'a');
            S.push_back(x);
        }
    }
    if(!S.size()){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    string ans = S[0];
    for (int i = 1; i < S.size() ; i++) {
        if(ans > S[i]) ans = S[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    string s;
    cin >> s;
    int n = s.size();
    VVLL dp(2,VLL(2019));
    //vector<unordered_map<int,LL>> dp(n);
    VI a(n);
    REP(i,0,n) a[i] = s[i] - '0';
    dp[0][a[0]] = 1;
    LL ans = 0;
    REP(i,1,n) {
        REP(j,0,2019) dp[i%2][j] = 0;
        REP(j,0,2019) {
            dp[i%2][(j*10+a[i])%2019] += dp[(i+1)%2][j];
        }
        dp[i%2][a[i]]++;
        ans += dp[i%2][0];
    }
    cout << ans << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#ifndef LOCAL
#pragma GCC optimize(3)
#else
#endif
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

typedef long long ll;
const double eps=1e-6;
const int inf=0x3f3f3f3f;
const int maxn=1e5+100;
map<string, int> cnt;
int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif // LOCAL
    int n; cin >> n;
    ll ans=0;
    for (int i=0; i<n; i++) {
        string s; cin >> s;
        sort(s.begin(), s.end());
        ans+=cnt[s];
        cnt[s]++;
    }
    
    cout << ans;
    return 0;
}

Measured memory_bytes: 11136
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=3005;
const int mod=1e9+7;
int f[MAXN][MAXN][2],n,m;
void ad(int &x,int y){x+=y;if(x>=mod)x-=mod;}
int main()
{
	n=read();m=read();
	f[0][0][1]=1;for(int i=1;i<=n;i++)f[0][i][0]=1;
	for(int i=0;i<m;i++)for(int j=0;j<=n;j++)for(int k=0;k<=1;k++)if(f[i][j][k])
	{
		if(j)ad(f[i+1][j][k|(j==1)],f[i][j][k]);
		if(j)ad(f[i+1][j-1][k|(j==1)],f[i][j][k]);
		if(j<n)ad(f[i+1][j+1][k],f[i][j][k]);
		if(j<n)ad(f[i+1][j][k],f[i][j][k]);
	}
	int ans=0;for(int i=0;i<=n;i++)ad(ans,f[m][i][1]);
	pr2(ans);
	return 0;
}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
#define MAX 5002
#define pb push_back
#define For(i,s,e) for (int i=(s); i<(e); i++)
#define Debug_array(a,n) for (int i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (int i=(s); i<=(e); i++)
#define Fod(i,s,e) for (int i=(s)-1; i>=(e); i--)
#define Mod 1000000007
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"

using namespace std;

typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false);
	
	ll n,x;cin>>n>>x;
	ll a[n];
	For(i,0,n) cin>>a[i];
	sort(a,a+n);

	ll ans = 0;
	For(i,0,n-1){
		if(a[i]<=x){
			ans++;
			x = x - a[i];
		}
	}


	if(x==a[n-1]) ans++;

	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    if(s.substring(0,1).equals(t.substring(2,3))){
      if(s.substring(1,2).equals(t.substring(1,2))){
        if(s.substring(2,3).equals(t.substring(0,1))){
          System.out.println("YES");
          return;
        }
      }
    }
           System.out.println("NO");
  }
  

  
}

Measured memory_bytes: 21844
N = int(input())
S = input()

dic = {'(':1, ')':-1}

rlt = ''
cnt = 0
for s in S:
  cnt += dic[s]
  rlt += s
  if cnt < 0:
    rlt = '(' + rlt
    cnt = 0
  
if cnt > 0:
  rlt += ')'*cnt
  
print(rlt)

Measured memory_bytes: 61936
n=int(input())
a=list(map(int,input().split()))
not_two=0
yes_four=0
for i in a:
  if i%2!=0:
    not_two+=1
  if i%4==0:
    yes_four+=1
if yes_four-not_two>=0:
  print('Yes')
elif yes_four+not_two==n and yes_four-not_two==-1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 14252
H, W, N = list(map(int, input().split()))
D = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    for dy in (-1, 0, +1):
        y = a + dy
        if y<=1 or y>=H: continue
        for dx in (-1, 0, +1):
            x = b + dx
            if x<=1 or x>=W: continue
            D.append((x,y))

D = sorted(D)

i = 0
M = len(D)
ans = [0]*10
while i<M:
    n = 1
    d = D[i]
    while i+n<M and D[i+n]==d: n+=1
    ans[n] += 1
    i+=n

ans[0] = (H-2)*(W-2) - sum(ans)
print(*ans, sep='\n')

Measured memory_bytes: 116512
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define f first 
# define s second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

# define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
# define debug cerr<<"ERROR"<<endl
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

template<class T> void umin(T &a,T b){a=min(a,b);}
template<class T> void umax(T &a,T b){a=max(a,b);}

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

const int inf=1e9,mod=998244353,N=2e5+5;

void solve(){
	int n,k;
	cin>>n>>k;
	vector<int>a(n),dp(n,1);
	//dp[i] is the length of max subsequence than ends in position i
	pqueue<pii>s;
	rep(i,n){
		cin>>a[i];
	}
	for(int i=0;i<n;++i){
		pqueue<pii>d;
		while(!s.empty()){
			pii v=s.top();
			s.pop();
			d.push(v);
			if(abs(v.s-a[i])<=k){
				dp[i]=max(dp[i],v.f+1);
				break;
			}
		}
		while(!d.empty()){
			s.push(d.top());
			d.pop();
		}
		s.push({dp[i],a[i]});
	}
	int ans=1;
	rep(i,n){
		umax(ans,dp[i]);
	}
    cout<<ans;

}

int main(){
 	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)solve();
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    ll h, w, ans;
    cin >> h >> w;
    if (w == 1 || h == 1) {
        cout << 1 << endl;
        return 0;
    }
    ans = w / 2 * h;
    if (w % 2) ans += h / 2 + h % 2;
    cout << ans << endl;
    return 0;
}


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

main(){
	int n , sum = 0 ;
	int m[] = {1,5,10,50,100,500} ;
	
	for( int i=0 ; i<6 ; i++ ){
		cin >> n ;
		sum += n * m[i] ;
	}
	
	if( sum/1000 ) cout << 1 << endl ;
	else cout << 0 << endl ;
}

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

int main() {
  int H, W; //縦、横
  cin >> H >> W;
  string data[H];
  for (int i = 0; i < H; i++) {
    cin >> data[i];
  }
  bool Hline[H], Wline[W];
  for (int i = 0; i < H; i++) Hline[i] = false;
  for (int i = 0; i < W; i++) Wline[i] = false;
  for (int i = 0; i < H; i++) {
  	for (int j = 0; j < W; j++) {
        if (data[i][j] == '#') {
        	Hline[i] = true;
          	Wline[j] = true;
        }
    }
  }
  
  for (int i = 0; i < H; i++) {
    int count = 0;
  	for (int j = 0; j < W; j++) {
        if (!Hline[i] || !Wline[j]) {
			count += 1;
        } else {
        	cout << data[i][j];
        }
    }
    if (count != W) cout << endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;
const int MOD = 1e9 + 7;

int main(){
	ll	n;	scanf("%lld", &n);
	ll sum = 1;
	for(ll i = 2; i <= n; ++i){
		sum = (sum * i) % MOD;
	}
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e18;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define lb(x,a) lower_bound(all(x),a)
#define ub(x,a) upper_bound(all(x),a)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

void solve(){
 ll n;
  cin >> n;
  ll ans=0;
  for(ll a=1;a<n;a++){
    ll b=n/a;
    if(a*b!=n) ans+=b;
    else ans+=max(0ll,b-1);
  }
  
  cout << ans << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int mod=1000000007;
int fact[500003];
int inv(int x)
{
    int r,y;
    for(r=1,y=mod-2;y>0;x=(x*x)%mod,y/=2)
        if(y%2==1)
            r=r*x%mod;
    return r;
}
int nCr(int n, int m)
{
    if(n<m || n==0)
        return 0;
    return fact[n] *inv(fact[m])%mod *inv(fact[n-m])%mod ;
}
int32_t main() 
{
    IOS;
    fact[0]=1;
    for(int i=1;i<=500001;i++)
        fact[i]=(i*fact[i-1])%mod;
    int n,k;
    cin>>n>>k;
    int ans=0;
    for(int i=0;i<=min(n-1,k);i++)
    {
        int val1=nCr(n,i);
        int val2=nCr(n-1,i);
        int val=(val1*val2)%mod;
        ans=(ans+val)%mod;
    }
    print(ans);
}   


Measured memory_bytes: 7548
#include <bits/stdc++.h>
using namespace std;
constexpr int P = 1'000'000'007, INV2 = 500'000'004;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    vector<vector<int>> f(n, vector<int>(n));
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            f[i][j] = a[i] > a[j];
    for (int i = 0; i < q; ++i) {
        int x, y;
        cin >> x >> y;
        --x;
        --y;
        for (int j = 0; j < n; ++j) {
            if (j != x && j != y) {
                int v = 1LL * (f[x][j] + f[y][j]) * INV2 % P;
                f[x][j] = f[y][j] = v;
                v = 1LL * (f[j][x] + f[j][y]) * INV2 % P;
                f[j][x] = f[j][y] = v;
            }
        }
        int v = 1LL * (f[x][y] + f[y][x]) * INV2 % P;
        f[x][y] = f[y][x] = v;
    }
    int ans = 0;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < i; ++j)
            ans = (ans + f[j][i]) % P;
    for (int i = 0; i < q; ++i)
        ans = 2 * ans % P;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 37504
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = Integer.parseInt(sc.next());
		int s = Integer.parseInt(sc.next());

		int count = 0;

		for (int x = 0; x <= k; x++) {
			for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				} else if(z < 0){
					break;
				}
			}
		}

		System.out.println(count);
		sc.close();
	}

}


Measured memory_bytes: 21456
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
    int x,y,z,i;
    cin>>x>>y>>z;
    for(i = x/y;i >= 0;i --)
    {
        if(x >= y*i + z + z * i)break;
    }
    cout<<i;
}


Measured memory_bytes: 256
import sys
a, b, c = map(int, input().split())

d = a + b
e = b + c
f = c + a

if d <= e and d <= f:
    print(d)
    sys.exit()
if e <= d and e <= f:
    print(e)
    sys.exit()
if f <= e and f <= d:
    print(f)
    sys.exit()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
typedef unsigned int uint;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<vector<int> > VV;
 
const int INF = 1 << 28;
const double EPS = 1e-9;
 
int n;
VV par;
VD x, y, r;
VI c;
map<int,int> m;
 
string toString (int era) {
    string str;
    for (int i = 0; i < n; i++) {
        str = (era % 2 ? "1" : "0") + str;
    }
 
    return str;
}
 
int dfs (int era) {
    if (era == ((1 << n) - 1)) return 0;
    int cera = ((1 << n) - 1) ^ era;
    if (m.find(era) != m.end()) {
        return m[era];
    }
     
    VV count(5);
    rep (i,n) {
        bool flag = true;
        if (era & (1 << i)) continue; 
        rep(j,par[i].size()) {
            if (cera & (1 << par[i][j])) {
                flag = false;
                break;
            }
        }
        if (flag) {
            count[c[i]].push_back(i);
        }
    }
 
    int ret = 0;
    REP(i,1,5) {
        if (count[i].size() >= 2) {
            rep(j,count[i].size()-1) REP(k,j+1,count[i].size()) {
                int tera = era;
                tera |= (1 << count[i][j]);
                tera |= (1 << count[i][k]);
                ret = max(ret, dfs(tera) + 2);
            }
        }
    }
 
    return m[era] = ret;
}
 
int main()
{
    while (cin >> n, n) {
        x.resize(n), y.resize(n), r.resize(n), c.resize(n);
        m.clear();
         
        rep(i, n) {
            cin >> x[i] >> y[i] >> r[i] >> c[i];
        }
         
        par.clear();
        par.resize(n);
        rep(i,n) rep(j,i) {
            double dis = pow(x[i] - x[j], 2.) + pow(y[i] - y[j], 2.);
            if (sqrt(dis) < r[i] + r[j]) {
                par[i].push_back(j);
            }
        }
 
        cout << dfs(0) << endl;
    }
                 
    return 0;
}

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

long long int N, a, i, le;
char s[100000];

int main(){
    scanf("%s", s);
    le = strlen(s);
    for(i = 1; i < le; i++){
        if(s[i] != s[i - 1])a++;
    }
    cout << a << endl;
    return 0;
}


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

LL gcd(LL a, LL b) {
  return b ? gcd(b, a % b) : a;
}

LL lcm(LL a, LL b) {
  LL tmp = a / gcd(a, b);
  return tmp * b;
}

int main() {
  int n;
  cin >> n;
  vector<LL> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
  }

  LL ans;
  if (n == 1) ans = a.at(0);
  else {
    ans = lcm(a.at(0), a.at(1));
    for (LL i = 2; i < n; i ++) {
      ans = lcm(ans, a.at(i));
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256