akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin (),(x).end()
#define sqrt(x) sqrt(abs(x))
#define re return
#define sz(x) ((int)(x).size ())
#define prev PREV
#define next NEXT

using ll = long long;
using ii = pair<int, int>;
using ld = long double;
using D = double;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vs = vector<string>;

template<typename T> T abs (T x) { re x < 0 ? -x : x; }
template<typename T> T sgn (T x) { re x < 0 ? -1 : (x > 0 ? 1 : 0); }
template<typename T> T sqr (T x) { re x * x; }
template<typename T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; }

int n;
int m;
int x[100];

int main () {
	scanf ("%d%d", &n, &m);
	for (int i = 0; i < n; i++) scanf ("%d", &x[i]);
	sort (x, x + n);
	int ans = 0;
	while (ans < n && x[ans] <= m) {
		m -= x[ans];
		ans++;
	}
	if (ans == n && m > 0) ans--;
	printf ("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	static int MOD = 1000000007;
	static long[] fac = new long[1000000];
	static long[] finv = new long[1000000];
	static long[] inv = new long[1000000];

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int x = Integer.parseInt(str[0]);
		int y = Integer.parseInt(str[1]);

		int a = (2 * x - y) / 3;
		int b = (2 * y - x) / 3;

		if (((-x + 2 * y) % 3 != 0) || ((2 * x - y) % 3 != 0)) {
			System.out.println(0);
		} else {
			COMinit();
			System.out.println(COM(a + b, a));
		}
	}

	public static void COMinit() {
		fac[0] = 1L;
		fac[1] = 1L;
		finv[0] = 1L;
		finv[1] = 1L;
		inv[1] = 1L;
		for (int i = 2; i < 1000000; i++) {
			fac[i] = fac[i - 1] * i % MOD;
			inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
			finv[i] = finv[i - 1] * inv[i] % MOD;
		}
	}

	public static long COM(int n, int k) {
		if (n < k) {
			return 0L;
		}
		if (n < 0 || k < 0) {
			return 0L;
		}
		return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	}
}

Measured memory_bytes: 56436
import java.util.*;

public class Main {
	Scanner sc;
	int N;
	int[] v;

	public Main() {
		sc = new Scanner(System.in);
	}
	
	private void calc() {
		N = sc.nextInt();
		v = new int[N];
		for (int i = 0; i < N; i++) v[i] = sc.nextInt();
		
		Arrays.sort(v);
		double ans = (double)v[0];
		for (int i = 1; i < N; i++) ans = (ans + v[i])/2d;
		
		System.out.println(ans);
		System.out.flush();
	}

	public static void main(String[] args) {
		new Main().calc();
	}

}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

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

if(3200 <= a) print(s);
else print("red");
}


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

#ifdef LOCAL
  #include <contest/local.hpp>
#else
  #define LOG(...) do {} while (false)
#endif

#define REP(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)
#define ALL(x) (x).begin (), (x).end ()

using namespace std;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);
  cout << fixed << boolalpha;

  int64_t L, R;
  cin >> L >> R;

  R = min (R, L + 2019);

  int64_t ans = 2019;
  for (auto i = L; i < R; ++ i)
  {
    for (auto j = i + 1; j <= R; ++ j)
    {
      ans = min (ans, i * j % 2019);
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	int X, t;
	cin >> X >> t;

	cout << max(0, X - t);

	return 0;
}


Measured memory_bytes: 3640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <algorithm>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++ i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; -- i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++ i)
#define ri rd<int>
using namespace std;
const int maxN = 207;
const int M = 10000000;
const int maxM = 1e7 + 7;

template<class T> inline T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - 48; return f ? x : -x;
}

int n;
int a[maxN];
int b[maxN], m;
bool ntpri[maxM];
int pri[maxM], cnt;
int link[maxN], vis[maxN];
bool adj[maxN][maxN];

void seive() {
	ntpri[1] = 1;
	rep (i, 2, M) {
		if (!ntpri[i]) pri[++cnt] = i;
		rep (j, 1, cnt) {
			if (1LL * i * pri[j] > M) break;
			ntpri[i * pri[j]] = 1;
			if (i % pri[j] == 0) break;
		}
	}
	ntpri[2] = ntpri[0] = 1;
}

int match(int x) {
	vis[x] = 1;
	rep (y, 1, m) if (adj[x][y] && (!link[y] || (!vis[link[y]] && match(link[y])))) {
		link[y] = x;
		return 1;
	}
	return 0;
}

int main() {

	n = ri();
	rep (i, 1, n) a[i] = ri();

	b[++m] = a[1] - 1;
	rep (i, 2, n) if (a[i-1] + 1 < a[i]) b[++m] = a[i-1], b[++m] = a[i] - 1;
	b[++m] = a[n];

	seive();

	rep (i, 1, m) if (b[i] & 1) 
		rep (j, 1, m) if (ntpri[abs(b[i] - b[j])] == 0) adj[i][j] = 1; 

	int res = 0, cc = 0;
	memset(link, 0, sizeof link);
	rep (i, 1, m) if (b[i] & 1) {
		memset(vis, 0, sizeof vis);
		res += match(i);
		++ cc;
	}

	int ans = res;
	ans += ((cc - res) >> 1) << 1;
	ans += ((m - cc - res) >> 1) << 1;
	ans += 3 * ((m - cc - res) & 1);

	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 14208
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#define LL long long
using namespace std;
int sum[2][2010][2010],n,pos[2][2010];
LL f[2010][2010];
char s[5];
struct node{int c,a;}a[4010];
int main()
{
	scanf("%d",&n);getchar();
	for(int i=1;i<=2*n;i++)
	{
		int x;scanf("%s %d",s+1,&x);
		a[i].c=(s[1]=='B');a[i].a=x;
		pos[a[i].c][a[i].a]=i;
	}
	for(int k=0;k<2;k++)
	{
		for(int i=2;i<=n;i++)
			for(int j=1;j<i;j++) sum[k][i][0]+=(pos[k][j]>pos[k][i]);
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++) sum[k][i][j]=sum[k][i][j-1]+(pos[k^1][j]>pos[k][i]);
	}
	memset(f,63,sizeof(f));
	f[0][0]=0;
	for(int i=0;i<=n;i++)
		for(int j=0;j<=n;j++)
		{
			if(i!=0) f[i][j]=min(f[i][j],f[i-1][j]+sum[0][i][j]);
			if(j!=0) f[i][j]=min(f[i][j],f[i][j-1]+sum[1][j][i]);
		}
	printf("%lld",f[n][n]);
}

Measured memory_bytes: 63360
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {

  let (n, m) = {
    let v: Vec<usize> = read_vec();
    (v[0], v[1])
  };

  let mut a: Vec<i64> = Vec::new();
  let mut b: Vec<i64> = Vec::new();

  for _ in 0..m {
    let v: Vec<i64> = read_vec();
    a.push(v[0] - 1);
    b.push(v[1] - 1);
  }

  let mut ans: Vec<i64> = vec![0; m];
  ans[m-1] = n as i64 * (n-1) as i64 / 2;

  let mut uni: UnionFind = initUnionFind(n);

  for i in (1..m).rev() {
    // 繋がってないののに対して
    if uni.root(a[i]) != uni.root(b[i])  {
      // 新しく繋がるから不便さが減少する
      ans[i-1] = ans[i] - uni.size(a[i]) * uni.size(b[i]);
      // 新しく繋げておく
      uni.connect(a[i], b[i]);
    }
    else {
      ans[i-1] = ans[i];
    }
  }

  for e in ans {
    println!("{}", e);
  }

}

struct UnionFind {
  // 親のノードの番号を書くのする。親だった場合は-(その集合のサイズ)
  Parent: Vec<i64>,
}

// コンストラクター
fn initUnionFind(n: usize) -> UnionFind {
  return UnionFind {Parent: vec![-1; n]};
}

impl UnionFind {

  // aがどのグループに属しているか調べる
  // 属している木のの根を返す
  fn root(&mut self, a: i64) -> i64 {

    if self.Parent[a as usize] < 0 {
      return a;
    }
    // aに属してる集合の根にaを直接つなぐ
    let tmp = self.Parent[a as usize];
    self.Parent[a as usize] = self.root(tmp);

    return self.Parent[a as usize];
  }

  // 自分おいるグループの頂点数を調べる
  fn size(&mut self, a: i64) -> i64 {
    let tmp = self.root(a) as usize;
    return -self.Parent[tmp];
  }

  // aとbをくっつける
  fn connect(&mut self, a: i64, b: i64) -> bool {
    let mut at = self.root(a);
    let mut bt = self.root(b);

    if at == bt {
      // すでにくっついてるからくっつけない
      return false;
    }

    // 大きい方aに小さい方bをくっつける
    // 大小が逆だったらひっくり返す
    if self.size(at) < self.size(bt) {
      let temp = at;
      at = bt;
      bt = temp;
    }

    // aのサイズを更新する
    self.Parent[at as usize] += self.Parent[bt as usize];
    // bの親をaに更新する
    self.Parent[bt as usize] = at;
    return true

  }
}


Measured memory_bytes: 9468
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=sum(b)
for i in range(n-1):
    if a[i+1]==a[i]+1:
        ans+=c[a[i]-1]
print(ans)

Measured memory_bytes: 61684
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
#define int long long
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
inline int rnd(int x){
	return (rand()<<16|rand())%x;
}
const int N=300005,mod=998244353;
int n,a,b,k,ans,c[N];
inline int ksm(int a,int b){
	int ans=1;
	for(;b;b>>=1){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}
	return ans;
}
signed main(){
	n=read(); a=read(); b=read(); cin>>k;
	c[0]=1; for(int i=1;i<=n;i++)c[i]=c[i-1]*(n-i+1)%mod*ksm(i,mod-2)%mod;
	for(int i=0;i<=n;i++)if((k-i*a)%b==0){
		int t=(k-i*a)/b;
		if(t>=0&&t<=n)
		ans=(ans+c[i]*c[t])%mod;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 2560
n,m=list(map(int,input().split()))
check=[[] for i in range(n)]
for i in range(m):
  p,s=list(input().split())
  p=int(p)
  check[p-1].append(s)

ac_num=0
wr_num=0
for i in range(n):
  if "AC" in check[i]:
    ac_num=ac_num+1
    wr_num=wr_num+check[i].index("AC")

print(str(ac_num)+" "+str(wr_num))
    

Measured memory_bytes: 20376
#include <iostream>
#include <cmath>

using namespace std;

int ans = 0x7f7f7f, a[4];

bool vis[4] = {0};

void dfs(int res, int num, int lst)
{
    if (res > ans)
        return;
    if (num == 3)
    {
        ans = min(ans, res);
        return;
    }
    for (int i = 1; i <= 3; i++)
    {
        if (!vis[i])
        {
            vis[i] = 1;
            if (num == 0)
                dfs(0, 1, i);
            else
                dfs(res + abs(a[lst] - a[i]), num + 1, i);
            vis[i] = 0;
        }
    }
    return;
}

int main()
{
    cin >> a[1] >> a[2] >> a[3];
    dfs(0, 0, -1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>

using namespace std;

typedef struct {
	int time;
	int data;
} EVENT;

bool operator< (const EVENT& a, const EVENT& b)
{
	if (a.time == b.time){
		return (a.data < b.data);
	}
	return (a.time < b.time);
}

int main(void)
{
	EVENT ev[200];
	int n;
	int ev_cnt;
	int wait;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		ev_cnt = 0;
		for (int i = 0; i < n; i++){
			int m, a, b;
			
			scanf("%d%d%d", &m, &a, &b);
			
			ev[ev_cnt].time = a;
			ev[ev_cnt++].data = m;
			ev[ev_cnt].time = b;
			ev[ev_cnt++].data = -m;
		}
		sort(ev, ev + ev_cnt);
		
		wait = 0;
		for (int i = 0; i < ev_cnt; i++){
			wait += ev[i].data;
			
			if (wait > 150){
				break;
			}
		}
		
		if (wait > 150){
			printf("NG\n");
		}
		else {
			printf("OK\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 0
#include<stdio.h>
int d[105],l[105];
int main()
{
	int n,x,i,j;
	while(~scanf("%d%d",&n,&x))
	{
		int sum=0;
		for(i=1;i<=n;i++)
		    scanf("%d",&l[i]);
		d[1]=0;
		for(j=2;j<=n+1;j++)
		    d[j]=d[j-1]+l[j-1];
		for(i=1;i<=n+1;i++)
		    if(x>=d[i])sum++;
		    else break;
		printf("%d\n",sum);    
	}
}


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


int main(){
  int N,K;
  string S;
  cin>>N>>S>>K;
  char target=S[K-1];
  for(int i=0;i<N;i++){
    if(S[i]!=target) S[i]='*';
  }
  cout<<S<<endl;

  return 0;
}

Measured memory_bytes: 256
Module B
    Sub Main()
        Dim input As String = Console.ReadLine()
        Dim arr() As String = Split(input, " ")
        Dim n, a, b As ULong
        n = arr(0) : a = arr(1) : b = arr(2)
        If a = 0 Then
            Console.WriteLine(0)
            Return
        End If
        If b = 0 Then
            Console.WriteLine(n)
            Return
        End If
        Dim cnt As ULong = Math.Floor(n / (a + b))
        Dim zan As ULong = n - (a + b) * cnt
        Console.WriteLine(If(zan > a, cnt * a + a, cnt * a + zan))
    End Sub
End Module

Measured memory_bytes: 13536
#include <iostream>
#include <algorithm>
#include <vector>

typedef long long ll;

int main(){
  ll N, M, X;
  std::cin >> N >> M >> X;
  std::vector<ll> C(N);
  std::vector<std::vector<ll> > A(N, std::vector<ll> (M) );
  for(int i = 0 ; i < N ; i++){
    std::cin >> C[i];
    for(int j = 0 ; j < M ; j++){
      std::cin >> A[i][j];
    }
  }
  ll resa = 1000000000000000;
  for(int i = 1 ; i < ( 1 << N ) ; i++ ){
    std::vector<ll> du(M);
    ll money = 0;
    for(int j = 0 ; j < N ; j++){
      if(( i >> j & 1) == 1){
	money += C[j];
	for(int k = 0 ; k < M ; k++){
	  du[k] += A[j][k];
	}// k
      }// if
    }// j
    bool check = std::all_of(du.begin(), du.end(), [&](ll x){return x >= X;});
    if(check == true){
      if(money <= resa) resa = money;
    }// if
  }// i

  if(resa != 1000000000000000){
    std::cout << resa << std::endl;
  }else{
    std::cout << "-1" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 3644
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    decp(15);
    double a,b,h,m;cin>>a>>b>>h>>m;
    const double pi=3.14159265358979;
    double ans=sqrt(a*a+b*b-2*a*b*cos(pi*(m/30-h/6-m/360)));
    cout<<ans<<endl;
}

Measured memory_bytes: 4228
import itertools
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n = ri()
s = rs()
print(len(list(itertools.groupby(s))))

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

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

int main() {
  int a, b, c, d, m, ans = 0;
  cin >> a >> b >> c >> d;
  m = max(b, d);
  for (int i = 0; i <= m; ++i)
    if (a <= i && i <= b && c <= i && i <= d) ans++;

  cout << (ans == 0 ? 0 : ans - 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
using namespace std;
struct SegmentTree {
private:
    int n;
    vector<int> node;
public:
    SegmentTree(vector<int> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }

    void add(int k, int val) {
        k += (n - 1);
        node[k] += val;

        while(k > 0) {
            k = (k - 1) / 2;
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

    int getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];

        int vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        int vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    int n;cin >> n;
    string s;cin >> s;
    int q;cin >> q;
    vector<set<int> > posi(26);
    REP(i,n){
        posi[s[i] - 'a'].insert(i);
    }
    REP(_,q){
        int t;cin >> t;
        if(t == 1){
            int id;char c;cin >> id >> c;
            id--;
            if(s[id] == c)continue;
            else{
                posi[s[id] - 'a'].erase(id);
                posi[c - 'a'].insert(id);
                s[id] = c;
            }
        }else{
            int l,r;cin >> l >> r;
            l--,r--;
            int cnt = 0;
            REP(i,26){
                if(posi[i].size() == 0)continue;
                auto itr = posi[i].lower_bound(l);
                if(itr == posi[i].end())continue;
                int it = *posi[i].lower_bound(l);
                if(l <= it and it <= r)cnt++;
            }
            cout << cnt << '\n';
        }
    }
    return 0;
}


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

const int N=2e+5+5;
int a[N];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<n;i++)
    {
        int j;
        cin>>j;
        a[j]++;
    }
    for(int i=1;i<=n;i++)
        cout<<a[i]<<"\n";
}

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

using namespace std;

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

string s;

int main(){
    cin >> s;
    int c = 0;
    REP(i, s.size()-1){
        if(s[i] != s[i+1]) c += 1;
    }
    cout << c << endl;
}


Measured memory_bytes: 512
#include <stdio.h>
#define NIL -1
struct Node{
  int parent,left,right;
};
struct Node R[10000];
int n;
void preorder(int);
void inorder(int);
void postorder(int);

void preorder(int x){
  if(x==NIL)
    return;
  printf(" %d",x);
  preorder(R[x].left);
  preorder(R[x].right);
}
void inorder(int x){
  if(x==NIL)
    return;
  inorder(R[x].left);
  printf(" %d",x);
  inorder(R[x].right);
}
void postorder(int x){
  if(x==NIL)
    return;
  postorder(R[x].left);
  postorder(R[x].right);
  printf(" %d",x);
}

int main(){
  int i,a,b,c,root;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    R[i].parent=NIL;
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a,&b,&c);
    R[a].left=b;
    R[a].right=c;
    if(b!=NIL)R[b].parent=a;
    if(c!=NIL)R[c].parent=a;
  }
  for(i=0;i<n;i++){
    if(R[i].parent==NIL)
      root=i;
  }
  printf("Preorder\n");
  preorder(root);
  printf("\n");
  printf("Inorder\n");
  inorder(root);
  printf("\n");
  printf("Postorder\n");
  postorder(root);
  printf("\n");
  return 0;
}

  



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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int n;
  scanf("%d", &n);
  vector<int> cards(n);
  for (int i = 0; i < n; ++i) { scanf("%d", &cards[i]); }
  int alice = 0, bob = 0;
  sort(cards.begin(), cards.end(), greater<int>());
  for (int i = 0; i < n; ++i) {
    if (i % 2 == 0) { alice += cards[i]; }
    else { bob += cards[i]; }
  }
  int ans = alice - bob;
  printf("%d\n", ans);

  return 0;
}


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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
#define guard(x) if( not ( x ) ) continue;
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      Int n; scan(n);
      Int res = (1LL << 53);
      for(Int i = 0; i < n; ++i) {
         Int x, y; scan(x, y);
         res = std::min(res, x + y);
      }
      printf("%ld\n", res);
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




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

int main()
{
	int n, q; cin >> n >> q;
	string s; cin >> s;

	vector<int> l(q);
	vector<int> r(q);
	vector<int> sum(s.size());

	for (int i = 0; i < q; i++) cin >> l[i] >> r[i];

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

	for (int i = 0; i < q; i++)
	{
		cout << sum[r[i] - 1] - sum[l[i] - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define fs first
#define sc second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 2e5+10;
const int mod = 998244353;
using namespace std;

ll N,M,K;
ll f[maxn],invf[maxn];
void init(int N){
    f[0] = invf[0] = f[1] = invf[1] = 1;
    for(int i=2;i<=N;i++) f[i]=f[i-1]*i%mod,invf[i]=(mod-mod/i)*invf[mod%i]%mod;
    for(int i=2;i<=N;i++) invf[i]=invf[i-1]*invf[i]%mod;
}
ll C(ll n,ll m){
	if(n == m) return 1;
    return f[n]*invf[n-m]%mod*invf[m]%mod;
}
ll ksm(ll a,ll b){
	ll res = 1;
	while(b){
		if(b&1) res = res*a%mod;
		a = a*a%mod;
		b>>=1;
	}
	return res;
}
int main(){
	// debug;
	ios;
	init(maxn);
	ll ans = 0;
	cin>>N>>M>>K;
	for(int t = N-K;t<=N;t++){
		ans += C(N-1,t-1) * M % mod * ksm(M-1,t-1)%mod; 
		ans %= mod;
	}
	cout<<ans<<'\n';
	
	return 0;
}


Measured memory_bytes: 6724
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

struct Work {
  int time;
  int deadline;
  bool operator<(const auto &right) const {
    if (deadline != right.deadline) return deadline < right.deadline;
    else                            return time < right.time;
  }
};

int main() {
  int N; std::cin >> N;
  std::vector<Work> works(N);
  for (int i = 0; i < N; ++i) {
    int a, b; std::cin >> a >> b;
    works[i] = {a, b};
  }
  std::sort(works.begin(), works.end());

  LL total = 0;
  for (auto w : works) {
    total += w.time;
    if (total > w.deadline) {
      std::cout << "No" << std::endl;
      return 0;
    }
  }
  std::cout << "Yes" << std::endl;
}


Measured memory_bytes: 1792
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val k = minOf(sc.nextInt(), 100)
    val a = Array(n) { sc.nextInt() }
    for (_i in 0 until k) {
        val b = Array(n + 1) { 0 }
        for (i in 0 until n) {
            val s = maxOf(i - a[i], 0)
            val e = minOf(i + a[i] + 1, n)
            b[s]++
            b[e]--
        }
        val sum = Array(n + 1) { 0 }
        for (i in 0 until n) {
            sum[i + 1] = sum[i] + b[i]
            a[i] = sum[i + 1]
        }
    }
    println(a.joinToString(" "))
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 100168
n, m = list(map(int, input().split()))
yp = []
for i in range(m):
  y, p = list(map(int, input().split()))
  yp.append([i+1, y, p])
  
yp.sort(key=lambda x: x[2])
counter = [1]*n
for i in range(m):
  num1 = "0"*(6-len(str(yp[i][1]))) + str(yp[i][1])
  junban = str(counter[yp[i][1]-1])
  counter[yp[i][1]-1] += 1
  num2 = "0"*(6-len(junban)) + junban
  yp[i].append(num1+num2)
  
yp.sort(key=lambda x: x[0])
for i in range(m):
  print(yp[i][3])

Measured memory_bytes: 35356
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll x,a,b;
    cin >> x >> a >> b;
    if(abs(x-a) < abs(b-x)) cout << "A";
    else cout <<"B";
    cout <<endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

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

int main()
{
    string s1, s2;
    cin >> s1 >> s2;
    
    reverse(s2.begin(), s2.end());
    bool ok = (s1 == s2);

    cout << (ok ? "YES" : "NO") << endl;
}

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

struct Info{
    string str;
    int p;
    int itr;
    int ans;
};

bool cmp(const Info &a, const Info &b)
{
    if(a.str == b.str){
        return a.p > b.p;
    }else{
        return a.str < b.str;
    }
}
bool cmp2(const Info &a, const Info &b){
    return a.itr < b.itr;
}
int main(){
    int N;
    string str;
    int p;
    cin >> N;
    Info a[100];
    for(int i=0;i<N;i++){
        cin >> str >> p;
        a[i].str = str;
        a[i].p = p;
        a[i].itr = i;
    }
    //cout << endl;
    sort(a, a+N, cmp);
    for(int i=0;i<N;i++){
        a[i].ans = i;
    }
    //for(int i=0;i<N;i++){
    //    cout << a[i].str <<" "<<a[i].p << " " << a[i].itr<< endl;
    //}  
    //sort(a, a+N, cmp2);
    for(int i=0;i<N;i++){
        cout << a[i].itr+1 << endl;
    }
    
}


Measured memory_bytes: 256
Sd = input()
T = input()

def check(A, B):
    for a, b in zip(A, B):
        if a != '?' and a != b:
            return False

    return True


for i in range(len(Sd) - len(T) + 1)[::-1]:
    if check(Sd[i:i + len(T)], T):
        print((Sd[:i] + T + Sd[i + len(T):]).replace('?', 'a'))
        break
else:
    print('UNRESTORABLE')


Measured memory_bytes: 3060
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var infos = new Info[N - 1];
            for (var i = 0; i < infos.Length; i++)
            {
                var CSF = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
                infos[i] = new Info { C = CSF[0], S = CSF[1], F = CSF[2] };
            }

            for (var i = 0; i < N; i++)
            {
                var answer = 0;
                for (var j = i; j < infos.Length; j++)
                {
                    var nc = infos[j].C;
                    var ns = infos[j].S;
                    var nf = infos[j].F;
                    if (answer <= ns) answer = ns;
                    else if (answer % nf != 0) answer += nf - answer % nf;
                    answer += nc;
                }
                Console.WriteLine(answer);
            }
        }
    }

    public class Info
    {
        public int C { get; set; }
        public int S { get; set; }
        public int F { get; set; }
    }
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;



int n,k,s;

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

    cin>>n>>k>>s;
    
    int rest = s==int(1e9)? int(1e9)-1: int(1e9);

    for (int i=0; i<n; i++) {
	if (i<k) {
	    cout<<s<<" ";
	} else {
	    cout<<rest<<" ";
	}
    }
    cout<<endl;    
    return 0;
}


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

int store[107];

int main()
{
    int n;
    cin >> n;
    int sum = 0;
    int val = INT_MAX;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &store[i]);
        sum += store[i];
        if (store[i] % 10 && store[i] < val) val = store[i];
    }

    if  (val == INT_MAX) sum = 0;
    else if (sum % 10 == 0) sum -= val;

    cout << sum << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
#define pi (3.141592653589)
int main(){
  double a, b, c, S, L, h;

  scanf("%lf %lf %lf",&a,&b,&c);
  S = a * b * sin(c * pi / 180) / 2;
  L = a + b + sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(c * pi / 180));
  h = 2 * S / a;

  printf("%8lf\n",S);
  printf("%8lf\n",L);
  printf("%8lf\n",h);

  return 0;

}

Measured memory_bytes: 680
using System;
//A->0, G->1, C->2, T->3

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[,,,] Dp = new int[101, 4, 4, 4];
            int Mod = 1000000007;
            //長さ0の文字列は1である
            Dp[0, 3, 3, 3] = 1;
            //文字列の文字数
            for (int len = 0; len < n; len++)
            {
                //最後から一番目の文字
                for (int c1 = 0; c1 < 4; c1++)
                {
                    //最後から2番目の文字
                    for (int c2 = 0; c2 < 4; c2++)
                    {
                        //最後から3番目の文字
                        for (int c3 = 0; c3 < 4; c3++)
                        {
                            //条件に当てはまるものがない場合
                            if (Dp[len, c1, c2, c3] == 0) continue;
                            //新しく追加する文字列
                            for (int a = 0; a < 4; a++)
                            {
                                if (a == 2 && c1 == 1 && c2 == 0) continue;
                                if (a == 2 && c1 == 0 && c2 == 1) continue;
                                if (a == 1 && c1 == 2 && c2 == 0) continue;
                                if (a == 2 && c1 == 1 && c3 == 0) continue;
                                if (a == 2 && c2 == 1 && c3 == 0) continue;
                                Dp[len + 1, a, c1, c2] += Dp[len, c1, c2, c3];
                                Dp[len + 1, a, c1, c2] %= Mod;
                            }
                        }
                    }
                }
            }
            int ans = 0;
            //最後から一番目の文字
            for (int c1 = 0; c1 < 4; c1++)
            {
                //最後から2番目の文字
                for (int c2 = 0; c2 < 4; c2++)
                {
                    //最後から3番目の文字
                    for (int c3 = 0; c3 < 4; c3++)
                    {
                        ans += Dp[n, c1, c2, c3];
                        ans %= Mod;
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27548
package main

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

const (
	white int = iota
	gray
	black
)
const INFTY int = 2001

var G [][]int
var color []int
var d []int
var p []int
var N int

func prim() int {
	u := 0
	d[u] = 0
	for {
		minCost := INFTY
		for i:=0; i<N; i++ {
			if color[i] != black && d[i] < minCost {
				minCost = d[i]
				u = i
			}
		}

		if minCost == INFTY {
			break
		}

		color[u] = black

		for v:=0; v<N; v++ {
			if color[v] != black && G[u][v] != -1 {
				if G[u][v] < d[v] {
					d[v] = G[u][v]
					p[v] = u
					color[v] = gray
				}
			}
		}
	}
	// sum
	sum := 0
	for i:=0; i<N; i++ {
		if p[i] != -1 {
			sum += G[i][p[i]]
		}
	}
	return sum
}




func initVariable(N int) {
	G = make([][]int, N)
	for i:=0; i<N; i++ {
		G[i] = make([]int, N)
	}
	color = make([]int, N)
	d = make([]int, N)
	p = make([]int, N)
	for i:=0; i<N; i++ {
		d[i] = INFTY
		p[i] = -1
	}
}

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	N = nextInt(scanner)
	initVariable(N)
	for i:=0; i<N; i++ {
		for j:=0; j<N; j++ {
			G[i][j] = nextInt(scanner)
		}
	}
	fmt.Printf("%d\n", prim())
}


Measured memory_bytes: 1200
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#include<chrono>
#include<random>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
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');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=100005;
vector<pii> ans;
int n;
int main()
{
	n=read();if(__builtin_popcount(n)==1)return puts("No"),0;
//	pr2(__builtin_ctz(n));
	puts("Yes");int k=1;for(;(k<<1)-1<=n;k<<=1);--k;
	for(int i=1;i<k;i++)ans.emplace_back(mp(i,i+1)),ans.emplace_back(mp(i+n,i+1+n));
	ans.emplace_back(mp(k,1+n));
	for(int i=k+1;i+1<=n;i+=2)
	{
		ans.emplace_back(mp(i,1+n));
		ans.emplace_back(mp(i+1,i));
		ans.emplace_back(mp(1+n,i+1+n));
		ans.emplace_back(mp(i+1+n,i+n));
	}
	if(!(n&1))
	{
		int ls=(1<<(__builtin_ctz(n)));
		int val=n^ls;
		if(val&1)ans.emplace_back(mp(val+n,n));
		else ans.emplace_back(mp(val,n));
		if(ls<=2)ans.emplace_back(mp(3,n+n));
		else ans.emplace_back(mp(ls+n,n+n));
	}
	for(auto p:ans)pr1(p.first),pr2(p.second);
	return 0;
}



Measured memory_bytes: 4464
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  vector<int> vec = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int A;
  cin >> A;
  cout << vec.at(A - 1) << endl;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int a, b, c;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> a >> b >> c;
    if (a+b >= c) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	c := a * b
	var res string
	if c & 1 == 1 {
		res = "Odd"
	} else {
		res = "Even"
	}
	fmt.Println(res)
}

Measured memory_bytes: 512
#include<stdio.h>

int main(){
	int A;
	int B;//A!=B;
	int K;

	scanf("%d %d",&A,&B);

    K=(A+B)/2;

	if((A+B)%2==0){
		printf("%d",K);
	}else{
		printf("IMPOSSIBLE");
	}

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string.h>
#include <stdlib.h>
using namespace std;

int main() {
	string s;
	cin >> s;
	int digit = s.size();

	int count = 0;
	
	for(int i=0;i<digit;i++){
		if((i%2==0)&&(s[i]=='1')){
			count++;
		}
		if((i%2==1)&&(s[i]=='0')){
			count++;
		}
	}

	if(count*2<digit) cout << count << endl;
	else cout << digit - count << endl;
	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int c[3][3];
    for(int i=0; i<3; i++)
        for(int j=0; j<3; j++)
            cin>>c[i][j];

    int a[3], b[3];
    a[0]=0; b[0]=c[0][0]-a[0];
    a[1]=c[1][0]-b[0]; b[1]=c[1][1]-a[1];
    a[2]=c[2][1]-b[1]; b[2]=c[2][2]-a[2];

    for(int i=0; i<3; i++) {
        for(int j=0; j<3; j++) {
            if(a[i]+b[j]!=c[i][j]) {
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<ext/rope>
using namespace std;
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    if(a<b) swap(a,b);
    int c=a+b-n;
    if(c<0) c=0;
    cout<<b<<" "<<c<<endl;
    return 0;
}



Measured memory_bytes: 256
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

a,b,c,d= map(int,input().split())
e = a + b
f= c + d
if e > f:
    print("Left")
elif e == f:
    print("Balanced")
else:
    print("Right")

Measured memory_bytes: 3316
#include <stdio.h>

int main(){
	long long int x;
	scanf("%lld", &x);
	long long int x1[x];
	long long int x2 = 1;
	long long int max = 1000000000000000000;
	
	for(int a=0;a<x;a++){
		scanf("%lld",&x1[a]);
	}
	
	for(int a1=0;a1<x;a1++){
		if(x1[a1]==0){
			printf("0\n");
			return 0;
		}
		
	}
	
	for(int a2=0;a2<x;a2++){
		if(x1[a2]<=max/x2){
			x2= x2*x1[a2];
		}
		else{
			printf("-1\n");
			return 0;
		}
	}
	printf("%lld",x2);
	
	
	
	
	
	
	return 0;
}

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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

const int nsz = 15, msksz = (1 << nsz) - 1, inf = 0x3f3f3f3f;
int n, m, full, lg[msksz + 5], g[nsz + 5], w[nsz + 5][nsz + 5], sum[msksz + 5], dp[msksz + 5][nsz + 5];

int inline at(int S, int id) { return S >> id & 1; }

int inline lowbit(int S) { return S & -S; }

string inline bin(int S, int len = n) {
	string s;
	loop (i, len) s += at(S, i) + 48;
	return s;
}

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

int main() {
	ios::sync_with_stdio(0);
	cin >> n >> m;
	full = (1 << n) - 1;
	cont (i, m) {
		int u, v, w;
		cin >> u >> v >> w;
		--u, --v;
		g[u] |= 1 << v;
		g[v] |= 1 << u;
		::w[u][v] = ::w[v][u] = w;
	}
	loop (i, n) lg[1 << i] = i;
	
	memset(sum, -inf, sizeof(sum));
	sum[0] = 0;
	cont (S, full) {
		int u = lg[lowbit(S)];
		sum[S] = sum[S - lowbit(S)];
		for (int t = g[u] & S, d = t & -t; d; t -= d, d = t & -t) {
			int v = lg[d];
			sum[S] += w[u][v];
		}
	}
	memset(dp, -inf, sizeof(dp));
	cont (S, full) {
		if (!at(S, 0) || at(S, n - 1)) continue;
		dp[S][0] = sum[S];
	}
	circ (S, 0, full) {
		for (int rS = (S ^ full), T = rS; T; T = (T - 1) & rS) {
			if (sum[T] < 0) continue;
			for (int t = S, d = t & -t; d; t -= d, d = t & -t) {
				int u = lg[d];
				if (dp[S][u] < 0) continue;
				for (int t = T & g[u], d = t & -t; d; t -= d, d = t & -t) {
					int v = lg[d];
					upd(dp[S | T][v], dp[S][u] + sum[T] + w[u][v]);
				}
			}
		}
	}
	cout << sum[full] - dp[full][n - 1] << ln;
}

Measured memory_bytes: 2944
const main = (standardInput) => {
    const lengthList = standardInput.split(' ');
    const a = Number.parseInt(lengthList[0]);
    const b = Number.parseInt(lengthList[1]);

    if(a<b){
      console.log("a < b");
    }else if(a>b){
      console.log("a > b");
    }else{
      console.log("a == b");
    }

  }

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));



Measured memory_bytes: 15100
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n, w;
    std::cin >> n >> w;
    std::vector<i64> wt(n), v(n);
    for (int i = 0; i < n; i++) {
        std::cin >> wt[i] >> v[i];
    }

    std::vector<i64> dp[100];
    dp[0].resize(w + 1);
    for (int i = wt[0]; i <= w; i++) {
        dp[0][i] = v[0];
    }
    for (int i = 1; i < n; i++) {
        dp[i].resize(w + 1);
        for (int j = 0; j < wt[i]; j++) {
            dp[i][j] = dp[i - 1][j];
        }
        for (int j = wt[i]; j <= w; j++) {
            dp[i][j] = std::max(dp[i - 1][j], dp[i - 1][j - wt[i]] + v[i]);
        }
    }
    std::cout << dp[n - 1][w] << std::endl;

    return 0;
}

Measured memory_bytes: 78592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e15;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, m, l, a, b, c, q, s, t, dst[500][500];

void warshall_floid(){
	for(ll k = 1; k <= n; k++)
		for(ll i = 1; i <= n; i++)
			for(ll j = 1; j <= n; j++)
				dst[i][j] = min(dst[i][k]+dst[k][j], dst[i][j]);
}

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n >> m >> l;
	
	rep(i, 1, n){rep(j, 1, n){dst[i][j] = INF;} dst[i][i] = 0;}
	rep(i, 1, m){
		cin >> a >> b >> c;
		if(c <= l){
			dst[a][b] = c;
			dst[b][a] = c;
		}
	}

	warshall_floid();
	
	rep(i, 1, n){
		rep(j, 1, n){
			if(dst[i][j] <= l){
				dst[i][j] = 1;
			}
			else{
				dst[i][j] = INF;
			}
		}
		dst[i][i] = 0;
	}
	
	warshall_floid();
	
	cin >> q;
	rep(k, 1, q){
		cin >> s >> t;
		if(dst[s][t] < INF){
			print(dst[s][t]-1)
		}
		else{
			print(-1)
		}
	}
	return 0;
}


Measured memory_bytes: 1792
import math
xyzk = list(map(int,input().split()))
abc = [list(map(int,input().split())) for a in range(3)]
for a in range(3):
    abc[a].sort()
    abc[a].reverse()
abc2=[]
for a in range(len(abc[0])):
    for b in range(len(abc[1])):
        if (a+1)*(b+1)>xyzk[3]:
            break
        for c in range(len(abc[2])):
            if (a+1)*(b+1)*(c+1)>xyzk[3] :
                break
            abc2.append(abc[0][a]+abc[1][b]+abc[2][c])
abc2.sort()
abc2.reverse()
for a in range(xyzk[3]):
    print(abc2[a])

Measured memory_bytes: 46320
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#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)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int main(){
    ll s,w;cin>>s>>w;
    if(w>=s)cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
    return 0;
}

Measured memory_bytes: 3636
N,K =map(int,input().split())
have=[0]*N
for i in range(K):
    d=int(input())
    a_list=list(map(int,input().split()))
    for pick in a_list:
        have[pick-1]+=1

#print(have)
cnt=0
for chk in have:
    if(chk==0):
        cnt+=1
print(cnt)

Measured memory_bytes: 9196
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  ll n;
  std::cin >> n;

  int ans = 0;

  while(1) {
    if(n < 10) {
      ans += n;
      break;
    }
    else {
      if(n%10 < 9) {
        ans += 9;
        n/=10;
        --n;
      }
      else {
        ans += 9;
        n/=10;
      }
    }
  }

  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256