akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define MOD 1000000007
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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


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

	ll n;
	cin >> n;
	string s;
	cin >> s;

	ll ans = 0;
	ll pre = -1;
	REP(i, n) {
		if (pre != s[i]) ans++;
		pre = s[i];
	}



	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            var n = ReadLineIntSpilit();
            var result = "Bob";

            var array = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1 };
            if (n[0] == n[1]) result = "Draw";
            else if(Array.IndexOf(array, n[0]) > Array.IndexOf(array, n[1])) {
                result = "Alice";
            }

            Console.WriteLine(result);
            ReadLine();
        }

        /// <summary>
        /// コンビネーション
        /// </summary>
        /// <param name="n"></param>
        /// <param name="m"></param>
        /// <returns></returns>
        static int nCm(int n, int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * nCm(n - 1, m - 1) / m;
        }

        /// <summary>
        /// stringを一文字ずつintにキャストして配列に変換します。
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static int[] StringCharArrayIntArray(string str)
        {
            List<int> b = new List<int>();
            for (int i = 0; i < str.Length; i++) {
                b.Add( int.Parse(str[i].ToString()));
            }
            return b.ToArray();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }

        public static int ReadLineInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static string[] ReadLineStringSplit(char a = ' ')
        {
            return ReadLine().Split(a).ToArray();
        }

        public static int[] ReadLineIntSpilit(char a = ' ')
        {
            return ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        }

        static string[] GetAplhaLowerArray() => new string[]{ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
        static string[] GetAplhaUpperArray() => new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
    }
}

Measured memory_bytes: 13396
/*         ?????????
       ???????????????
????????????????????????  ?????
???????????????????????????????
??????????????????????????????
??????????????????????????????
?????????????????????????????
?????????????????? ??????????
?????????????????? ?????????
?????????????????? ????????
?????????????????? ?????????
??????        ???        ???
????????????????????????????
????????????????????????????
????????????????????????????
????????????????????????????
????????????????????????????
????????????????????????????
???????????????????????????
?????????????????????????
??????????????????????
???????????????????


 ??????     ???   ???    ???   ???    ????????    ???  ???
????????    ???? ????    ???   ???    ????????    ???  ???
????????     ???????     ???   ???    ????????    ????????
????????      ?????      ???   ???    ????????    ????????
???  ???       ???       ?????????    ????????    ???  ???
???  ???       ???        ???????     ????????    ???  ???


*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX_CHAR=26;
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
//cin>>t;
t=1;
while(t--)
{
   ll d,t,s;
   cin>>d>>t>>s;
   ll a=t*s;
   //cout<<a;
   if(a>=d)
   cout<<"Yes";
   else
   cout<<"No";
}


}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

int gcd(int p, int q) {
  if (p < q) {
    int t = p;
    p = q;
    q = t;
  }
  while (q != 0) {
    int t = p;
    p = q;
    q = t % q;
  }
  return p;
}

int pow2(int a, int b){
  int e = a, p = 1;
  while (b != 0) {
    while ((b & 1) == 0){b>>=1;e *= e;}
    p *= e;
    b>>=1, e *= e;
  }
  return p;
}

struct Frac {
  int p, q;
  Frac() {}
  Frac(int p, int q) {
    int d = gcd(p, q);
    p /= d, q /= d;
    this->p = p, this->q = q;
  }
  Frac(int n) : p(n), q(1) {}
  Frac operator+(const Frac rhs) const {
    return Frac(p * rhs.q + q * rhs.p, q * rhs.q);
  }
  bool operator<(const Frac rhs) const {
    return (p * rhs.q  - q * rhs.p < 0);
  }
  bool operator==(const Frac rhs) const {
    return (!(*this < rhs) && !(rhs < *this));
  }
  int gauss() {
    if (p % q == 0) {
      return p;
    }
    return (p / q) + 1;
  }
};

int P, Q, A, N;

int ans(Frac tar, int m, int prod, int rest) {
  //printf("tar = %d/%d, m = %d, prod = %d, rest = %d\n",
  //	 tar.p, tar.q, m, prod, rest);
  if (tar < 0) {
    return 0;
  }
  if (prod > A) {
    return 0;
  }
  if (tar == 0) {
    //printf("Found\n");
    return 1;
  }
  if (rest == 0) {
    return 0;
  }
  int min_q;
  for (min_q = m;; min_q++) {
    if (Frac(1, min_q) < tar || Frac(1, min_q) == tar) {break;}
  }
  int sum = 0;
  for (int i = min_q;; i++) {
    if (prod * pow2(i, min(Frac(tar.p * i, tar.q).gauss(), rest)) > A) {
      break;
    }
    if (Frac(rest, i) < tar) {
      break;
    }
    sum += ans(tar + Frac(-1, i), i, prod * i, rest - 1);
  }
  return sum;
}

void solve() {
  printf("%d\n", ans(Frac(P, Q), 1, 1, N));
}

int main() {
  while (scanf("%d %d %d %d", &P, &Q, &A, &N) == 4) {
    if (P == 0 && Q == 0 && A == 0 && N == 0) {
      break;
    }
    solve();
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>


int main(void){
	unsigned long long i;
	unsigned long long  k;//<=50*10^16
	scanf("%lld",&k);
	unsigned long long n=50LL;//数列長は50以下
	unsigned long long a[n];//<=10^16+1000
	for(i=0;i<n;i++){a[i]=n-1;}

	unsigned long long roop=0L;
	unsigned long long amari=0L;
	
	roop=k/50LL;
	amari=k%50LL;
	for(i=0;i<n;i++){a[i]=n-1+roop;}

	for(i=0;i<amari;i++){a[i]+=(n-amari+1LL);}
	for(i=amari;i<n;i++){a[i]-=amari;}



	printf("%lld\n", n);
	for(i=0;i<n;i++){printf("%lld ", a[i]);}
	return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>

int main(){

  int a,b,c,d,total,x,y;

    scanf("%d %d %d %d",&a,&b,&c,&d);
  total=a+b+c+d;
  x=total/60;
  y=total-x*60;

  printf("%d\n",x);
  printf("%d\n",y);
  return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

int main()
{
    llong A;
    llong B, N;
    cin >> A >> B >> N;
    llong x = min(B-1, N);
    llong y = floor(A*x/B) - A*floor(x/B);
    cout << y << endl;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
#define dame { printf("No\n"); return 0;}
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int( 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)

int n;
int vis[MAX];
vector<pair<int,int>> g[MAX]; 



void solve(int x,int color){
    vis[x] = color;
    itrfor(itr,g[x]){
        if( vis[(itr->fi)] == -1){
            if( (itr->se) %2 ==0 ){
                solve(itr->fi,color);
            }
            else solve(itr->fi,1 - color);
        }
    }
}



signed main(){
    cin >> n;
    int u,v,w;
    REP(i,n-1){
        scanf("%lld%lld%lld",&u,&v,&w);
        u--;
        v--;
        g[u].push_back(mp(v,w));
        g[v].push_back(mp(u,w));
    }

    REP(i,n) vis[i] = -1;
    solve(0,0);

    REP(i,n){
        printf("%lld\n",vis[i]);
    }

}


Measured memory_bytes: 10240
#include <iostream>
#include <cmath>
using namespace std;
int main() {
    int count = 0;
    long long int ans = 1;
    cin >> count;
    int pp = (10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 *10) +7;
    for (int i = 1; i <= count; ++i) {
        ans = ans * i;
        ans = ans % pp;
    }
    cout << ans;
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    int A[N];
    int i, j, k, v;
    for(i=0; i<N; i++)
        cin >> A[i];

    cout << A[0];
    for(k=1; k<N; k++)
        cout << ' ' << A[k];
    cout << endl;

    for(i=1; i<N; i++) {
        v = A[i];
        j = i - 1;
        while(j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;

        cout << A[0];
        for(k=1; k<N; k++)
            cout << ' ' << A[k];
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3080
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,random
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = int(input())
tmp = 0
cnt = 0
while True:
    cnt += 1
    tmp += cnt
    if N == tmp:
        break
    elif N < tmp:
        print('No')
        sys.exit()

print('Yes')
print(cnt+1)
M = cnt

B = [1]
Bs = 1
for k in range(M,1,-1):
    Bs += k
    B.append(Bs)
B.sort()
#print(B)

S =[[] for _ in range(M+1)]
for i in range(1,N+1):
    ind = bisect.bisect_right(B,i)
    #print(i,ind,B[ind-1])
    S[ind-1].append(i)
    S[ind+(i-B[ind-1])].append(i)

for i in range(M+1):
    print (' '.join(map(str,[M]+S[i])))


Measured memory_bytes: 10700
/* Trico */
#include <iostream>
#include <bits/stdc++.h>
#define inf 1e18
#define ll long long
#define x first
#define y second
#define pll pair<ll, ll>
#define pii pair<int, int>
#define mll map<ll, ll>
#define mii map<int, int>
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define p push
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, def[100], x, ans = 0;
  	cin>>n;
    for(int i = 0;i<n;i++) cin>>def[i];
    for(int i = 0;i<n;i++) {cin>>x; def[i] -= x;}
	sort(def, def+n);
  	for(int i = 0;i<n;i++)
    	ans += (def[i] > 0)?def[i]:0;
  	cout<<ans;
} 

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	double ans = 0, tmp;
	int N;
	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> tmp;
		ans += 1.0 / tmp;
	}

	printf("%f\n", 1.0 / ans);

	return 0;
}

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

int main() {
  string S;
  cin >> S;
  int day;
  vector<string> STR = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  for(int i = 0; i < 7; i++){
    if(S == STR.at(i)) day = i; 
  }

  int result;
  for(int i = 1; i < 8; i++){
    if( (day + i) % 7 == 0 ){
      result = i;
      break;
    }
  }
  cout << result << endl;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map(String::toLong)
    val vList = readLine()!!.split(' ').map(String::toLong)
    val queue = ArrayDeque<Long>()
    vList.forEach { queue.add(it) }

    var ans = 0L
    for (tk in 1..k) {
        for (left in 0..tk) {
            val tq = queue.clone()
            val have = mutableListOf<Long>()
            val right = tk - left
            for (i in 1..left) {
                if (tq.isNotEmpty()) have.add(tq.pollFirst())
            }
            for (i in 1..right) {
                if (tq.isNotEmpty()) have.add(tq.pollLast())
            }

            if (have.isEmpty()) break
            have.sort()
            var re = k - tk
            while (re-- > 0 && have[0] <= 0) {
                have.removeAt(0)
                if (have.isEmpty()) break
            }
            ans = Math.max(ans, have.sum())
        }
    }
    println(ans)
}

Measured memory_bytes: 44292
#include <iostream>
using namespace std;
int main(){
int n,ans=0;
  string a,b,c;
  cin>>n>>a>>b>>c;
  for(int i=0;i<n;i++){
  if(a[i]==b[i]){
  if(b[i]!=c[i])ans++;
  }
    else if(b[i]==c[i])ans++;
    else if(a[i]==c[i])ans++;
    else ans+=2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
h,w,n = map(int, input().split())
sr,sc = map(int, input().split())
s = input()
t = input()
now = [sc,sc,sr,sr]
ans = "YES"
for i,j in zip(s,t):
  if i == "L":
    now[0] -= 1
    if now[0] <= 0:
      ans = "NO"
      break
  elif i == "R":
    now[1] += 1
    if now[1] > w:
      ans = "NO"
      break
  elif i == "U":
    now[2] -= 1
    if now[2] <= 0:
      ans = "NO"
      break
  else:
    now[3] += 1
    if now[3] > h:
      ans = "NO"
      break
  if j == "L":
    now[1] = max(1,now[1]-1)
  elif j == "R":
    now[0] = min(w,now[0]+1)
  elif j == "U":
    now[3] = max(1,now[3]-1)
  else:
    now[2] = min(h,now[2]+1)
print(ans)
   

Measured memory_bytes: 3888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(), (x).end()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end());

int main() {
  int A, B;
  string S, ans;
  bool x = 0, y = 0, z = 0;

  cin >> A >> B >> S;

  if (S[A] == '-') x = 1;

  for (int i = 0; i < A; i++) {
    if ('0' <= S[i] && S[i] <= '9') {
      y = 1;
    } else {
      y = 0;
      break;
    }
  }

  for (int i = A + 1; i < A + B + 1; i++) {
    if ('0' <= S[i] && S[i] <= '9') {
      z = 1;
    } else {
      z = 0;
      break;
    }
  }

  if (x + y + z == 3)
    ans = "Yes";
  else
    ans = "No";

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		int H = in.nextInt();
		int W = in.nextInt();
		
		for(int i=1; i<=W+2; i++){
			System.out.print("#");
		}
		in.nextLine();
		System.out.println();
		for(int i=0; i<H; i++){
			System.out.print("#");
			String s = in.nextLine();
			System.out.print(s);
			System.out.println("#");
		}
		
		for(int i=1; i<=W+2; i++){
			System.out.print("#");
		}
	}
}


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

# define pb push_back
# define fr first
# define sc second
# define mk make_pair

using namespace std;

const int inf = 1e9 + 7;
const int N = 2002;

typedef long long ll;

int n, m, ans, a[N][N], table[11][N][N], numlog[N];
char ch[N][N];

void build(int x)
{
      for(int i = 0; i <= numlog[m]; i ++)
      {
            int curlen = 1 << i;
            for(int j = 1; j <= m; j ++)
            {
                  if(i == 0)
                  {
                        table[i][x][j] = a[x][j];
                        continue;
                  }
                  table[i][x][j] = min(table[i - 1][x][j], table[i - 1][x][j + curlen / 2]);
            }
      }
}

int get(int l, int r, int x)
{
      int curlog = numlog[(r - l + 1)];
      return min(table[curlog][x][l], table[curlog][x][r - (1 << curlog) + 1]);
}

int main()
{
      for(int i = 2; i < N; i ++)
            numlog[i] = numlog[i / 2] + 1;

      memset(table, 127, sizeof(table));

      scanf("%d %d", &n, &m);

      for(int i = 1; i <= n; i ++)
      {
            scanf("\n");
            for(int j = 1; j <= m; j ++)
                  scanf("%c", &ch[i][j]);
      }

      ans = max(n, m);

      for(int i = 1; i < n; i ++)
            for(int j = 1; j < m; j ++)
            {
                  if(ch[i][j] == '#') a[i][j] ++;
                  if(ch[i][j + 1] == '#') a[i][j] ++;
                  if(ch[i + 1][j] == '#') a[i][j] ++;
                  if(ch[i + 1][j + 1] == '#') a[i][j] ++;
                  a[i][j] %= 2;
                  a[i][j] ^= 1;
                  if(a[i][j]) a[i][j] += a[i - 1][j];
            }

      for(int i = 1; i <= n; i ++)
            build(i);

      for(int i = 1; i < n; i ++)
      {
            for(int j = 1; j < m; j ++)
            {
                  int h, w, l = 1, r = j;
                  if(!a[i][j]) continue;
                  while(r - l > 1)
                  {
                        int md = (l + r) >> 1;
                        if(get(md, j, i) >= a[i][j])
                              r = md;
                        else
                              l = md;
                  }
                  if(get(l, j, i) >= a[i][j])
                        r = l;
                  h = r;

                  l = j, r = m;

                  while(r - l > 1)
                  {
                        int md = (l + r) >> 1;
                        if(get(j, md, i) >= a[i][j])
                              l = md;
                        else
                              r = md;
                  }
                  if(get(j, r, i) >= a[i][j])
                        l = r;
                  w = l;

                  ans = max(ans, (w - h + 2) * (a[i][j] + 1));
            }
      }

      cout << ans << endl;
}


Measured memory_bytes: 192000
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define re(i,n) for(ll i=0;i<(n);++i)
#define itn int
#define ocut cout
#define ouct cout
#define outc cout

int main(){
    long long h;
    cin >> h;
    long long a=1,m=0;
    while(h>0){
        h=h/2;
        m=m+a;
        a=a*2;
    }
    cout << m;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int add = a + b;
    int delta = a - b;
    int multiply = a * b;
    int[] number = new int[3];
    number[0] = add;
    number[1] = delta;
    number[2] = multiply;
    Arrays.sort(number);
    System.out.println(number[2]);
  }
}

Measured memory_bytes: 21972
A,B,C = map(int,input().split())
K = int(input())
count = 0
if(B > A):
    pass
else:
    while(A >= B):
        B *= 2
        count += 1
if(C > B):
    pass
else:
    while(B >= C):
        C *= 2
        count += 1
if(count <= K):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9076
#include<cstdio>
#include<algorithm>
using namespace std;
int h,w,a,b;
int main(){
	scanf("%d%d%d%d",&h,&w,&a,&b);
	for(int i=1;i<=b;i++){
		for(int j=1;j<=w;j++)
			putchar(j<=a?'1':'0');
		putchar('\n');
	}
	for(int i=b+1;i<=h;i++){
		for(int j=1;j<=w;j++)
			putchar(j<=a?'0':'1');
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)

signed main() {
	for (int N, M; cin >> N >> M && N;) {
		vector<int> u(M), v(M);
		vector<vector<int>> G(N);
		rep(i, 0, M) {
			cin >> u[i] >> v[i];
			u[i]--, v[i]--;
			G[u[i]].push_back(v[i]);
			G[v[i]].push_back(u[i]);
		}

		vector<bool> vis(N);
		vector<bool> id(N);

		using State = tuple<bool, int, int>;
		queue<State> q;
		q.emplace(0, 0, -1);
		while (q.size()) {
			bool d; int v, p; tie(d, v, p) = q.front(); q.pop();
			vis[v] = true;
			for (auto& x : G[v]) {
				if (vis[x])continue;
				id[x] = !id[v];
				q.emplace(id[x], x, v);
			}
		}

		bool isbipartite = true;
		rep(i, 0, M) {
			if (id[u[i]] == id[v[i]])
				isbipartite = false;
		}

		vector<int> ans;
		if (!isbipartite) {
			cout << 0 << endl;
			continue;
		}

		int A = 0;
		rep(i, 0, N)if (id[i])A++;
		int B = N - A;

		if (A > B)swap(A, B);

		if (A % 2 == 0)ans.push_back(A / 2);
		if (B % 2 == 0 && A != B)ans.push_back(B / 2);
		cout << ans.size() << endl;
		for (auto x : ans)
			cout << x << endl;
	}
	return 0;
}


Measured memory_bytes: 3228
#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;
    cin >> n;
    vector<int> a(n, 0);
    for (int i = 2; i <= n; i++) {
        int k;
        cin >> k;
        a[k - 1]++;
    }
    rep(i, n) {
        cout << a[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3992
import sys
input = sys.stdin.readline


n = int(input())
routes = []
dic = [{}] * n
edges = [[]for _ in range(n)]
used = [0]*n

for i in range(n-1):
    a, b = map(int, input().split())
    routes.append([a-1, b-1])
    edges[a-1].append(b-1)

for node in range(n):
    unanle = used[node]
    count = 1
    if count == unanle:
        count += 1
    for to in edges[node]:
        dic[node][to] = count
        used[to] = count
        count += 1
        if count == unanle:
            count += 1

print(max(used))
for _from, to in routes:
    print(dic[_from][to])

Measured memory_bytes: 82736
package main

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

var sc *bufio.Scanner

const BufferSize = 1024

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

func binarySearch(b []int, max, v int) int {
	min := 0
	var i int
	for min < max {
		debugf("b: %v\n", b)
		debugf("v: %d, i: %d, min: %d, max: %d\n", v, i, min, max)
		i = (max + min) / 2
		if v <= b[i] {
			min = i + 1
		} else {
			max = i
		}
	}
	debugf("v: %d, i: %d, min: %d, max: %d\n", v, i, min, max)
	debugf("return i: %d\n", min)
	return min
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := make([]int, n)
	b := make([]int, n)
	for i := range b {
		b[i] = -1
	}

	ans := 0
	for i := range a {
		a[i] = nextInt()
	}
	debugf("a: %v\n", a)
	for i := range a {
		//j := sort.Search(ans, func(k int) bool { return b[k] < a[i] })
		j := binarySearch(b, ans, a[i])
		if b[j] == -1 {
			b[j] = a[i]
			ans++
		} else if b[j] < a[i] {
			b[j] = a[i]
		}
		debugf("b: %v\n", b)
		/*
		for j := range b {
			if b[j] == -1 {
				b[j] = a[i]
				ans++
				break
			} else if b[j] < a[i] {
				b[j] = a[i]
				break
			}
		}
		*/
	}

	_, _ = fmt.Fprintf(writer, "%d", ans)
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 5504
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    K, T = MI()
    types = LI()

    types.sort(reverse=True)
    max_num = types[0]
    others_num = sum(types[1:])
    ans = max(max_num - 1 - others_num, 0)
    print(ans)


main()


Measured memory_bytes: 64936
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  string t = "keyence";
  int n = s.size() - t.size();
  if( n<0 ){
    cout << "NO";
    return 0;
  }
  for( int i =0;i+n<s.size();i++){
    string w = s;
    w.erase(i,n);
    if( w==t){
      cout <<"YES";
      return 0;
    }
  }
  cout << "NO";
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mod 1000000007
int main(){
   ll n;
   double m;
   cin>>n>>m;
   double a[n],sum=0;
   for(ll i=0; i<n; i++){
    cin>>a[i];
    sum+=a[i];
   }
   double z = sum/(4*m);
   ll res=0;
   for(ll i=0; i<n; i++){
    if(a[i]>=z)res++;
   }
   if(res>=m)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int i,j,k,l,n;
	while(scanf("%d",&n)!=EOF){
	int a=0;
	for(i=0;i<10;i++){
		for(j=0;j<10;j++){
			for(k=0;k<10;k++){
				for(l=0;l<10;l++){
					if(i+j+k+l==n){
						a++;
					}
				}
			}
		}
	}
	printf("%d\n",a);
	}
return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	ll X, ans = 0;

	cin >> X;

	ans += 1000 * (X / 500);
	X %= 500;

	ans += 5 * (X / 5);

	cout << ans << endl;

	return 0;
}


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

int main() {
  char c;
  string ans;
  cin >> c;
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
  {
    ans = "vowel";
  }else {
    ans = "consonant";
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 256
#include<unordered_map>
#include<utility>
template<typename T>
class UnionFind {
 public:
  void unite(const T& a, const T& b) {
    auto x = find(a), y = find(b);
    if(rank_[x] < rank_[y]) std::swap(x, y);
    parent_[y] = x;
    if(rank_[x] == rank_[y]) rank_[x] += 1;
  }
  T find(const T& x) {
    if(!parent_.count(x)) {
      rank_[x] = 1;
      return parent_[x] = x;
    }
    return (parent_[x] == x) ? x : (parent_[x] = find(parent_[x]));
  }
 private:
  std::unordered_map<T, T> parent_;
  std::unordered_map<T, int> rank_;
};

#include<bits/stdc++.h>
using namespace std;

int sum(auto v) {
  return accumulate(begin(v), end(v), 0, [](auto sum, auto i) {return sum ^= i;});
}

bool neq(auto a, auto b) {
  sort(begin(a), end(a));
  sort(begin(b), end(b));
  return a != b;
}

int solve(auto a, auto b) {
  if(a == b) return 0;

  a.emplace_back(sum(a));
  b.emplace_back(sum(b));

  if(neq(a, b)) return -1;

  auto res = 0;
  set<int> used;
  UnionFind<int> g;
  for(auto i = 0; i < a.size() - 1; ++i) if(a[i] != b[i]) {
    ++res;
    used.emplace(a[i]);
    used.emplace(b[i]);
    g.unite(b[i], a[i]);
  }
  used.emplace(a.back());
  used.emplace(b.back());
  g.unite(b.back(), a.back());
  return res + count_if(begin(used), end(used), [&](auto i) {return i == g.find(i);}) - 1;
}

int main() {
  int N;
  cin >> N;
  vector<int> a(N), b(N);
  for(auto p: {&a, &b}) for(auto& i: *p) cin >> i;
  cout<< solve(a, b) << endl;
}


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

int main() {
    int h, n, ans=100000000;
    cin >> h >> n;
    vector<int> a(n), b(n);
    vector<vector<int>> dp(n+1, vector<int>(20000));

    
    for(int i=0; i<n; i++) cin >> a[i] >> b[i];
    for(int i=0; i<=n; i++) dp[i][0]=0;
    for(int j=1; j<20000; j++) dp[0][j]=100000000;
    for(int i=0; i<n; i++) {
        for(int j=0; j<20000; j++) {
            if(j<a[i]) dp[i+1][j]=dp[i][j];
            else {
                dp[i+1][j]=min(dp[i][j],dp[i+1][j-a[i]]+b[i]);
            }
        }
    }
    for(int i=0; i<=n; i++) {
        for(int j=h; j<20000; j++) {
            ans=min(ans,dp[i][j]);
        }
    }
    cout << ans;
}

Measured memory_bytes: 78592
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    var dx = [-1, 0, 1, -1, 1, -1, 0, 1];
    var dy = [-1, -1, -1, 0, 0, 1, 1, 1];

    var size = input[0].split(' ');
    var h = parseInt(size[0], 10);
    var w = parseInt(size[1], 10);
    var s = new Array(h);
    for (var i = 0; i < h; i++) {
        s[i] = new Array(w);
        var grids = input[i + 1].split('');
        for (var j = 0; j < w; j++) {
            if (grids[j] == '.') {
                s[i][j] = 0;
            }
            else {
                s[i][j] = -1;
            }
        }
    }

    for (var i = 0; i < h; i++) {
        for (var j = 0; j < w; j++) {
            if (s[i][j] < 0) {
                continue;
            }
            for (var k = 0; k < 8; k++) {
                if (i + dy[k] < 0 || i + dy[k] >= h || j + dx[k] < 0 || j + dx[k] >= w) {
                    continue;
                }
                if (s[i + dy[k]][j + dx[k]] < 0) {
                    s[i][j]++;
                }
            }
        }
    }

    for (var i = 0; i < h; i++) {
        var line = '';
        for (var j = 0; j < w; j++) {
            if (s[i][j] < 0) {
                line += '#';
            }
            else {
                line += '' + s[i][j];
            }
        }
        console.log(line);
    }

    return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int N;
ll D, A;
vector<ll> X, H;

ll solve()
{
    vector<int> idx(N);
    rep(i, N) idx[i] = i;
    sort(idx.begin(), idx.end(), [](int i, int j) { return X[i] < X[j]; });
    vector<ll> NX(N), NH(N);
    rep(i, N) NX[i] = X[idx[i]], NH[i] = H[idx[i]];
    X = NX, H = NH;

    vector<ll> IMOS(N + 1, 0); //[N]は飛び出した時のため
    ll res = 0;
    rep(i, N)
    {
        if (IMOS[i] < H[i])
        {
            ll need = (H[i] - IMOS[i] - 1) / A + 1;
            ll right = X[i] + 2 * D;
            int r_id = upper_bound(X.begin(), X.end(), right) - X.begin();

            IMOS[i] += need * A;
            IMOS[r_id] -= need * A;

            res += need;
        }
        IMOS[i + 1] += IMOS[i];
    }
    return res;
}

int main()
{
    cin >> N >> D >> A;
    X.resize(N);
    H.resize(N);
    rep(i, N) cin >> X[i] >> H[i];
    cout << solve() << endl;
}

Measured memory_bytes: 11888
//Solution By SlavicG
#include <bits/stdc++.h>
using namespace std;
 
#define ll                          long long
 
#define forn(i,n)                   for(int i=0;i<n;i++)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend()
	
#define pb                          push_back
#define sz(a)                       (int)a.size()
 
#define   endl                       "\n"
#define fastio                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int  main()
{
	int k, x;
	cin >> k >> x;
	for(int i = x - k + 1;i < x + k;i++)
		cout << i << " ";
}

Measured memory_bytes: 3652
#include <iomanip>
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main() {
  int N;
  cin >> N;
  
  stringstream ss;
  ss << setw(3) << to_string(N);
  
  string s;
  s = ss.str().substr(2, 1);
  
  switch (stoi(s)) {
    case 0:
      cout << "pon" << endl;
      break;
    case 1:
      cout << "pon" << endl;
      break;
    case 2:
      cout << "hon" << endl;
      break;
    case 3:
      cout << "bon" << endl;
      break;
    case 4:
      cout << "hon" << endl;
      break;
    case 5:
      cout << "hon" << endl;
      break;
    case 6:
      cout << "pon" << endl;
      break;
    case 7:
      cout << "hon" << endl;
      break;
    case 8:
      cout << "pon" << endl;
      break;
    case 9:
      cout << "hon" << endl;
      break;
  }
}


Measured memory_bytes: 3668
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}


/*
a b q
s1 .. sa
t1 .. tb
x1 .. xq

a b 10^5
q 10^5
s,t x 10^10
 */
int a,b,q;
ll s[100000],t[100000];
#define INF 1000000000000LL

int is(ll x){
  return lower_bound(s, s+a, x) - s;
}

int it(ll x){
  return lower_bound(t, t+b, x) - t;
}

ll vs(int i){
  if(i<0 || i>=a) return INF;
  else return s[i];
}

ll vt(int i){
  if(i<0 || i>=b) return INF;
  else return t[i];
}


int main(){
  cin>>a>>b>>q;
  REP(i,a){
    cin>>s[i];
  }

  REP(i,b){
    cin>>t[i];
  }

  REP(i,q){
    ll x;
    cin>>x;

    ll ans[2], u[2],v[2];

    //s de yaru
    u[0] = vs(is(x));
    u[1] = vs(is(x)-1);
      
    REP(j,2){
      v[j] = abs(x - u[j]) + min(abs(u[j] - vt(it(u[j]))), abs(u[j] - vt(it(u[j])-1)));
    }
    ans[0] = min(v[0],v[1]);

    // t de yaru
    u[0] = vt(it(x));
    u[1] = vt(it(x)-1);
      
    REP(j,2){
      v[j] = abs(x - u[j]) + min(abs(u[j] - vs(is(u[j]))), abs(u[j] - vs(is(u[j])-1)));
    }
    ans[1] = min(v[0],v[1]);

    cout<<min(ans[0],ans[1])<<endl;

  }

  return 0;
}


Measured memory_bytes: 2816
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<iomanip>
#include<map>
using namespace std;
typedef pair<int, pair<int, int> >PP;
typedef long long ll;
typedef pair<ll, ll>P;
typedef vector<int>vec;
int inf=-1;
ll mod = pow(10, 9) + 7;

int main() {
	int r;cin>>r;
	cout<<3*r*r<<endl;
	return 0;
}

Measured memory_bytes: 764
N = int(input())
P = [int(x) for x in input().split()]
count = 0
for i in range(1,N-1):
  if P[i]!=min(P[i-1],P[i],P[i+1]) and P[i]!=max(P[i-1],P[i],P[i+1]):
    count +=1
print(count)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

int main(){
	int n;
	long long d;
	std::cin>>n;
	std::cin>>d;

	std::vector<long long> xList(n);
	std::vector<long long> yList(n);

	for(int i=0; i<n; i++)
		std::cin>>xList[i]>>yList[i];

	int count=0;
	d= d*d;

	for(int i=0; i<n; i++){
		long long dist= xList[i]*xList[i] + yList[i] * yList[i];

		if(dist<= d)
			count++;
	}
	
	std::cout<<count<<std::endl;

	return 0;	
}

Measured memory_bytes: 6372
#pragma warning(disable: 4996)
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<string.h>
#include<vector>
#include<queue>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int INF=1001001001;

const int mod=100000;


/*
??????????????°???????????°?????????????????§???,??¶????????????????????§????????´????????????????????????????????????????????????,??????????????´???????????§??????????????´?????????????°????????????§,??\???????????¶????????£?????????????????????
 ??¢ ????????´???????????? N ??? N ??????????????????????????????????????????????????????????????£??´??°??????????????????????????????????????????????????´??°?????¨?????°?????????
??¢ ????????????????????????????????´??°??? 1 ??\??? M ??\?????§?????????
??¢ ????????´??????????????????????????????N??N????????´??°???????¨???? S ??§?????????
??¢ ????????????????????¨????????????????????????????????£?????´??°????????????????????§?????????
??¢ ????????????????????´??°???????????????????????????????????????????????´??°???????????§?????????
 
??\????????? N = 5, M = 50, S = 685 ?????¨??????????????´?????????????????§?????????

 

????????????????????????????????¶????????????????????´??????????????§????????????????????????????????????????????????????????????????????????2?????\????????£????????????????????????????????¨?????§??????????????´?????????????????°????????§?????? 100000 ??§?????£????????????????????????????????°????????????????????????
 
??\???

 ??\??????1???????????????, ???????????????????????´????????????????????? N (1???N???7), ????????????????????????????????´??°????????? M (1???M???2000),????????´????????????????????????????????´??°???????¨? S (1???S???3000) ?????¨???3????????£??´??°????????????????????§??????????????????????????????, ???????????????????????\???????????????????????????????????¶????????????????????´????????????1?????\??????????????¨?????§?????????
 
??????
 
???????????¨?????§??????????????´?????????????????°????????§?????? 100000 ??§?????£??????????????????????????? 
*/

int main(){
 int N,M,S;
 int dp[66][3003];
 const int mod=100000;
 while(1){
 scanf("%d %d %d",&N,&M,&S);
 if(N==0)break;
 memset(dp,0,sizeof(dp));
 dp[0][0]=1;
 for(int k=1;k<M+1;k++){
	for(int i=N*N;i>0;i--){
	  for(int j=1;j<S+1;j++){
		  if(j-k>-1)dp[i][j]+=dp[i-1][j-k];
		  dp[i][j]%=mod;
	  }
	}
 }
  printf("%d\n",dp[N*N][S]%mod);
 }
}

Measured memory_bytes: 1808
s=input()*2;n=len(s)//2;X=[(0,0)]*4
for j in range(n+1):
 for k in range(3,-1,-1):
  a=int(s[n-j])
  X[k]=(X[k][0]+9*X[k-1][0]if k else 1,(X[k][0]+(a-1)*X[k-1][0]+X[k-1][1]if k else 1)if a else X[k][1])
print(X[int(input())][1])

Measured memory_bytes: 38384
//DUEL
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("unroll-loops")
#define shandom_ruffle(a, b) shuffle(a, b, rng)
#define vi vector<int>
#define vl vector<ll>
#define popcnt __builtin_popcount
#define popcntll __builtin_popcountll

using namespace std;
using namespace __gnu_pbds;

using ll=long long;
using ull=unsigned long long;
using ld=long double;
int MOD=1000000007;
int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void yes() {cout<<"YES"<<en; exit(0);}
void no() {cout<<"NO"<<en; exit(0);}
inline int rund() {int x576363482791fuweh=rng();return abs(x576363482791fuweh)%RAND_MAX;}
template<class T>
void prVec(vector<T> w,bool fl=false)
{
	cout<<w.size()<<en;
	for (int i=0;i<int(w.size())-1;++i) cout<<w[i]<<' ';
	if (w.size()) cout<<w[w.size()-1]<<en;
	if (fl) cout<<flush;
}

void M998()
{
	swap(MOD,MOD2);
}

ll raand()
{
	ll a=rund();
	a*=RAND_MAX;
	a+=rund();
    return a;
}

#define rand raand

ll raaand()
{
	return raand()*(MOD-7)+raand();
}

string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}

string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

ll sti(string a,int base=10)
{
	ll k=0;
	for (int i=0;i<(int)a.size();++i)
	{
		k*=base;
		k+=a[i]-'0';
	}
	return k;
}

template<class T>
void eras(vector<T>& a,T b)
{
	a.erase(find(a.begin(),a.end(),b));
}

string its(ll k,int base=10)
{
	if (k==0) return "0";
	string a;
	while (k)
	{
		a.push_back((k%base)+'0');
		k/=base;
	}
	reverse(a.begin(),a.end());
	return a;
}

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

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

ll max(ll a,int b)
{
	if (a>b) return a;
	return b;
}

ll max(int a,ll b)
{
	if (a>b) return a;
	return b;
}

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

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

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

inline int mult(ll a,ll b)
{
	return (a*b)%MOD;
}

inline int pot(int n,int k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

int divide(int a,int b)
{
	return mult(a,pot(b,MOD-2));
}

inline int sub(int a,int b)
{
	if (a-b>=0) return a-b;
	return a-b+MOD;
}

inline int add(int a,int b)
{
	if (a+b>=MOD) return a+b-MOD;
	return a+b;
}

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

const int N=300010;
int n;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	for (int i=0;i<10;++i) bases.push_back(rand()%(MOD-13893829*2)+13893829);
	char a;
	cin>>a;
	cout<<char(a+1);
}





Measured memory_bytes: 256
#include<cstdio>
#include<list>
#include<algorithm>
using namespace std;
int main(){
	int q,x;
	char com[20];
	list <int> v;
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%s",com);
		if(com[0]=='i'){
			scanf("%d",&x);
			v.push_front(x); 
		}else if(com[6]=='L'){
			v.pop_back();
		}else if(com[6]=='F'){
			v.pop_front();
		}else if(com[0]=='d'){
		scanf("%d",&x);
		for(list<int>::iterator it=v.begin();it !=v.end();it++ ){
			if(*it==x){
				v.erase(it);
				break; 
				}
			}	
		}
	}
	int i=0;
	for(list<int>::iterator it=v.begin();it!=v.end();it++){
		if(i++){
			printf(" ");
		}
		printf("%d",*it);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 33860
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  cout << a[n-1]-a[0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n, 0);
    rep(i, n) cin >> a[i];
    int ans = 10000000;
    rep(t, n)
    {
        int now = 0;
        rep(i, n)
        {
            if (i <= t)
            {
                now += a[i];
            }
            else
            {
                now -= a[i];
            }
        }

        ans = min(ans, abs(now));
    }
    cout << ans << endl;

    return 0;
}

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

int main() {
    long long a,b,k; scanf("%lld %lld %lld", &a, &b, &k);

    if (a < k) {
        k -= a;
        a = 0;
    } else {
        a -= k;
        k = 0;
    }

    b = max((long long)0, b - k);

    printf("%lld %lld\n", a, b);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int inf=1e9;
int main(void)
{
    int ans=0;
    int X,Y;
    cin >> X >> Y;
    ans+=100000*(max(4-X,0))+100000*(max(4-Y,0));
    if(X==1 && Y==1) ans+=400000;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	long a,b,c,k;

	scanf("%ld%ld%ld%ld",&a,&b,&c,&k);

	if(a>=k){
		printf("%ld",k);
		return 0;
	}
	else if(k-a-b<=0){
		printf("%ld",k-b);
		return 0;
	}
	else{
		printf("%ld",a-(k-a-b));
		return 0;
	}
}

Measured memory_bytes: 1736
#include<iostream>
using namespace std;
char S[100];
int main()
{
	int n = 1;
	char C;
	scanf("%c", &C);
	while (C != 10)
	{
		S[n++] = C;
		scanf("%c", &C);
	};
	if (n % 2 == 0)
	{
		printf("No");
		return 0;
	}
	
	for (int i = 1; i < n ; i+=2)
	{
		
		if (S[i] != 'h' || S[i + 1] != 'i')
		{
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
#include<deque>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	map<char, int> mp;
	mp['M'] = 0;
	mp['A'] = 1;
	mp['R'] = 2;
	mp['C'] = 3;
	mp['H'] = 4;
	vector<i64> x(5);

	int n;
	cin >> n;
	string s;
	rep(i, 0, n) {
		cin >> s;
		if (mp.count(s[0])) {
			x[mp[s[0]]]++;
		}
	}
	i64 ans = 0;
	rep(i, 0, 5) {
		rep(j, i + 1, 5) {
			rep(k, j + 1, 5) {
				ans += x[i] * x[j] * x[k];
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;

LL n;
LL s[100],cnt;
LL dp[1000000+10];

inline bool cmp(int a,int b){return a>b;}
inline void init(){
	LL t=6LL;
	s[++cnt]=1LL;
	while(1){
		if(t>n)break;
		s[++cnt]=t;
		t*=6;
	}
	t=9LL;
	while(1){
		if(t>n)break;
		s[++cnt]=t;
		t*=9;
	}
	sort(s+1,s+cnt+1);
}

#include<cstring>
int main(){
	cin>>n;
	init();
	memset(dp,127,sizeof(dp));
	dp[0]=0;
	for(int i=0;i<=n;i++){
		for(int j=1;j<=cnt;j++){
			dp[i+s[j]]=min(dp[i+s[j]],dp[i]+1);
		}
	}
	printf("%lld\n",dp[n]);
	return 0;
}


Measured memory_bytes: 8064
#include <cstdio>
#include <cstdlib>
#include <cstring>

int map[55][55], count[55];

int main()
{
	int n, m, x, y, i, j,a,b;
	while (scanf("%d%d", &n, &m) != EOF) 
	{
		memset(map, 0, sizeof(map));
		memset(count, 0, sizeof(count));
		for (i = 0; i < m; i++)
		{
			scanf("%d%d", &a, &b);
			map[a][b] = map[b][a] = 1;
			count[a]++;
			count[b]++;
		}
		int count_all = 0;
		int flag = 1;
		while (flag)
		{
			flag = 0;
			for (i = 1; i <= n; i++)
			{
				if (count[i] == 1)
				{
					flag = 1;

					// 寻找next
					for (j = 1; j <= n; j++)
					{
						if (map[i][j])
						{
							map[i][j] = map[j][i] = 0;
							count[i]--;
							count[j]--;
							count_all++;
						}
					}
				}
			}
		}
		printf("%d\n", count_all);
	}
	return 0;
}


Measured memory_bytes: 128
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arr= limii()

bs = [0,399,799,1199,1599,1999,2399,2799,3199,4801]
bc = [0,1,2,3,4,5,6,7,8]
ans = [0,0,0,0,0,0,0,0,0]

for i in range(n):
    score = arr[i]
    chk=True
    ank=0
    while chk:
        if bs[ank]<score<=bs[ank+1]:
            chk=False
        ank+=1
    ans[ank-1]+=1

for i in range(8):
    if ans[i]>0:
        ans[i]=1
if sum(ans[:-1])!=0:
    print(str(sum(ans[:-1]))+" "+str(sum(ans)))
else:
    print(str(1)+" "+str(sum(ans)))






Measured memory_bytes: 63724