akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int H = nextInt();
		int W = nextInt();

		String[][] a = new String[H][];
		for(int i=0;i<H;i++){
			a[i]=toStringArray(nextString());
		}
		int wh=0;
		int ww=0;
		for(int i=0;i<H;i++){
			boolean flg=true;
			for(int k=0;k<W;k++){
				if("#".equals(a[i][k])){
					flg=false;
					break;
				}
			}
			if(flg){
				for(int k=0;k<W;k++){
					a[i][k]=null;
				}
			}
		}

		for(int i=0;i<W;i++){
			boolean flg=true;
			for(int k=0;k<H;k++){
				if("#".equals(a[k][i])){
					flg=false;
					break;
				}
			}
			if(flg){
				for(int k=0;k<H;k++){
					a[k][i]=null;
				}
			}
		}
		for(int i=0;i<H;i++){
			boolean flg=false;
			for(int k=0;k<W;k++){
				if(a[i][k]!=null){
					System.out.print(a[i][k]);
					flg=true;
				}
			}
			if(flg)
			System.out.println();
		}

	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 22100
n = gets.to_s.to_i

ans = 16 # sample 3
(n+1).times do |i|
  
  c = 0
  t = i
  while t > 0
    c += t%6
    break if ans <= c
    t /= 6
  end
  
  next if ans <= c
  
  t = n-i
  while t > 0
    c += t%9
    break if ans <= c
    t /= 9
  end
  
  ans = c if ans > c
end

puts ans

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

using namespace std;

int main()
{
    int n;
    int a[100010];
    int num[100010] = {};

    cin >> n;

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

    for (int i = 1; i <= n; i++) {
        cout << num[i] << " ";
    }
    cout << endl;

}


Measured memory_bytes: 1536
#include<stdio.h>
 
int main(void){
    int a,b,c;
 
    scanf("%d %d",&a,&b);
    c=a+b;
    if(c<a*b)c=a*b;
    if(c<a-b)c=a-b;
    printf("%d\n",c);
 
 
 
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
public static class P
{
    public static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nm[0];
        var m = nm[1];
        UnionFind uf = new UnionFind(n);
        for (int i = 0; i < m; i++)
        {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
            uf.TryUnite(st[0], st[1]);
        }
        int q = int.Parse(Console.ReadLine());
        for (int i = 0; i < q; i++)
        {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(uf.Find(st[0]) == uf.Find(st[1]) ? "yes" : "no");
        }
    }
}


class UnionFind
{
    public int Size { get; private set; }
    public int GroupCount { get; private set; }
    public IEnumerable<int> AllRepresents => Parent.Where((x, y) => x == y);
    int[] Sizes;
    int[] Parent;
    public UnionFind(int count)
    {
        Size = count;
        GroupCount = count;
        Parent = new int[count];
        Sizes = new int[count];
        for (int i = 0; i < count; i++) Sizes[Parent[i] = i] = 1;
    }
    public bool TryUnite(int x, int y)
    {
        int xp = Find(x);
        int yp = Find(y);
        if (yp == xp) return false;
        if (Sizes[xp] < Sizes[yp]) { var tmp = xp; xp = yp; yp = tmp; }
        GroupCount--;
        Parent[yp] = xp;
        Sizes[xp] += Sizes[yp];
        return true;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int GetSize(int x) => Sizes[Find(x)];
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int Find(int x)
    {
        while (x != Parent[x]) x = (Parent[x] = Parent[Parent[x]]);
        return x;
    }
}




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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

enum Face : int { Top, Front, Right, Left, Back, Bottom };
struct cube {
  int f[6];
  unordered_map<int, string> mp;
  cube(){}
  /*
            1(Top)
    4(Left) 2(Front) 3(Right) 5(Back)
            6(Bottom)
  */
  cube(vector<int> const& vs){ for(int i=0; i<6; i++) f[i] = vs[i]; }
  cube(vector<string> const& vs) { for(int i=0; i<6; i++) mp[i+1] = vs[i]; }
  void roll_z() { roll(1, 2, 4, 3); }
  void roll_y() { roll(0, 2, 5, 3); }
  void roll_x() { roll(0, 1, 5, 4); }
  void roll(int i, int j, int k, int l) {
    int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l] = t;
  }

  void roll(int k) {
    if(k == 0) roll_y();
    if(k == 1) roll_x();
    if(k == 2) for(int i=0; i<3; i++) roll_y();
    if(k == 3) for(int i=0; i<3; i++) roll_x();
  }

  bool roll_top_front(int top, int front) {
    for(int k = 0; k < 6; (k & 1 ? roll_y() : roll_x()), k++)
      for(int i = 0; i < 4; roll_z(), ++i)
        if(top == f[Top] && front == f[Front]) return true;
    return false;
  }

  bool operator== (cube const& rhs) const {
    for(int i=0; i<6; i++)
      if(f[i] != rhs.f[i]) return false;
    return true;
  }

  bool isomorphic(cube rhs) const {
    for(int k = 0; k < 6; (k & 1 ? rhs.roll_y() : rhs.roll_x()), k++)
      for(int i = 0; i < 4; rhs.roll_z(), ++i)
        if(operator==(rhs)) return true;
    return false;
  }

};

int main() {

  int N; cin >> N;
  vector<cube> cs(N); rep(i, N) rep(j, 6) cin >> cs[i].f[j];
  cout << ([&]() {
    rep(i, N) REP(j, i+1, N)
      if(cs[i].isomorphic(cs[j])) return false;
    return true;
  }() ? "Yes\n" : "No\n");
  
  return 0;
}

Measured memory_bytes: 3088
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }
        int max1 = a[0];
        for (int i = 1; i < a.length; i++) {
            max1 = Math.max(max1, a[i]);
        }
        int max2 = max1;
        for (int i = 0; i < a.length; i++) {
            if (a[i] != max1) {
                max2 = a[i];
                break;
            }
        }
        for (int i = 0; i < a.length; i++) {
            if (a[i] == max1) {
                continue;
            }
            max2 = Math.max(max2, a[i]);
        }
        int maxNumber = 0;
        for (int i = 0; i < a.length; i++) {
            if (a[i] == max1) {
                maxNumber++;
            }
        }
        if (maxNumber == 1) {
            for (int i = 0; i < a.length; i++) {
                if (a[i] == max1) {
                    System.out.println(max2);
                } else {
                    System.out.println(max1);
                }
            }
        } else {
            for (int i = 0; i < a.length; i++) {
                System.out.println(max1);
            }
        }
        sc.close();
    }
}

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

using namespace std;
using ll = long long;

int main() {
	int N;
	cin >> N;

	ll sum = 0;
	for (int i = 1; i <= N; ++i) {
		sum += i;
		if (sum >= N) {
			ll x = sum - N;
			for (int j = 1; j <= i; ++j) {
				if (j == x) { continue; }
				cout << j << endl;
			}
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
var
	N,i,sz:Longint;
	ans,T,K:int64;
	S:String;
	A:Array[1..100]of Char;
	L:Array[1..100]of Longint;
begin
	readln(S);
	readln(K);
	N:=length(S);
	A[1]:=S[1];
	L[1]:=1;
	sz:=1;
	for i:=2 to N do begin
		if A[sz]<>S[i]then begin
			inc(sz);
			A[sz]:=S[i];
			L[sz]:=1;
		end else inc(L[sz]);
	end;
	if sz=1 then begin
		writeln(K*L[1]div 2);
		exit;
	end;
	inc(ans,L[1]div 2);
	inc(ans,L[sz]div 2);
	T:=0;
	for i:=2 to sz-1 do inc(T,L[i]div 2);
	inc(ans,T*K);
	if A[1]=A[sz]then T:=(L[1]+L[sz])div 2
	else T:=L[1]div 2+L[sz]div 2;
	inc(ans,T*(K-1));
	writeln(ans);
end.


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

const int N = 2e5 + 10, mod = 1e9 + 7;



int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1; 
    //scanf("%d", &tc);
    while(tc--) {
        int n, m; cin >> n >> m;
        cout << (n * (n - 1) / 2) + (m * (m - 1) / 2) << '\n';
    }    
    return 0;
}

Measured memory_bytes: 256
// @uthor........ _|EE|_

#include<bits/stdc++.h>
#define int long long
#define double long double
#define vi vector<int>
#define vpi vector<pair<int,int> >
#define mii map<int,int>
#define mpi map<pair<int,int>,int>
#define msi map<string,int>
#define u_set unordered_set<int>
#define pb push_back
#define M 1000000007
#define endl "\n"
#define BRISK ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

signed main()
{
    BRISK;
    int n,k;
    cin>>n>>k;
    if(n%k==0)cout<<"0";
    else cout<<min(n%k,abs(n%k-k));
}


Measured memory_bytes: 256
s = input()
t = input()

length = min(len(s),len(t))

sorted_s = sorted(s)
sorted_t = sorted(t)[::-1]

flag = True
for i in range(length):
  if sorted_s[i] == sorted_t[i]:
    pass
  elif sorted_s[i] < sorted_t[i]:
    print('Yes')
    flag = False
    break
  else:
    print('No')
    flag = False
    break

if flag:
  if len(s) < len(t):
    print('Yes')
  else:
    print('No')


Measured memory_bytes: 3064
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = input()
ans = s[0] + str(len(s) - 2) + s[-1]
print(ans)


Measured memory_bytes: 27208
#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 a, b, c; cin >> a >> b >> c;
  cout << min(b / a, c) << endl;
  return 0;
}

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

cnt = 0
for a, b in zip(A, B):
    if a > b:
        cnt -= a - b
    if a < b:
        cnt += (b - a) // 2

if cnt < 0:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 4596
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let a = v[0];
	let b = v[1];
	let c = v[2];
	if b-a == 0 {
		println!("{}", c);
	}else if c-a == 0 {
		println!("{}", b);
	}else{
		println!("{}", a);
	}
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>


using  namespace std;

#define rep(i,x)for(int i=0;i<(int)(x);++i)

int N, M, s, t;
vector<int> G[100010];
int ds[100010], dt[100010];
int cnts[100010], cntt[100010];

int main()
{
    cin >> N >> M >> s >> t;
    --s, --t;

    rep(i, M) {
        int a, b; cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    {
        queue<int> q;
        memset(ds, -1, sizeof ds);
        ds[s] = 0;
        q.push(s);
        while (q.size()) {
            int u = q.front(); q.pop();
            for (int v : G[u]) {
                if (ds[v] == -1) {
                    ds[v] = ds[u] + 1;
                    q.push(v);
                }
            }
        }
        rep(i, N) cnts[ds[i]]++;
    }
    {
        queue<int> q;
        memset(dt, -1, sizeof dt);
        dt[t] = 0;
        q.push(t);
        while (q.size()) {
            int u = q.front(); q.pop();
            for (int v : G[u]) {
                if (dt[v] == -1) {
                    dt[v] = dt[u] + 1;
                    q.push(v);
                }
            }
        }
        rep(i, N) cntt[dt[i]]++;
    }

    long long ans = 0;

    int dist = ds[t];

    for (int i = 0; ; ++i) {
        if (i < 0 or dist - i - 2 < 0) break;
        if (1 or i <= dist - i - 2) {
            ans += (long long)cnts[i] * cntt[dist - i - 2];
            //printf("ans += cnts[%d] * cntt[%d]\n", i, dist-i-2);
        }
    }
    
    //rep(i, dist+1) printf("cnts[%d] = %d\n", i, cnts[i]);
    //rep(i, dist+1) printf("cntt[%d] = %d\n", i, cntt[i]);
    

    printf("%lld\n", ans);
}




Measured memory_bytes: 10224
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;


template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

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

	ll l = 0;
	ll r = N - 1;

	ll ans = 0;
	while (l < r) {
		while (S[l] != 'W' && l < N) {
			l++;
		}
		while (S[r] != 'R' && r >= 0) {
			r--;
		}
		if (l < r) {
			ans++;
			l++;
			r--;
		}
	}

	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 3748
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <stack>
using namespace std;

typedef long long ll;

#ifdef MUTABLE
int mod;
#else
template<int mod>
#endif
struct ModInt {
  int val;
  ModInt inv() const{
    int tmp,a=val,b=mod,x=1,y=0;
    while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
    return ModInt(x);
  }
  ModInt():val(0){}
  ModInt(ll x){if((val=x%mod)<0)val+=mod;}
  ModInt pow(ll t){ModInt res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
  ModInt& operator+=(const ModInt& x){if((val+=x.val)>=mod)val-=mod;return *this;}
  ModInt& operator-=(const ModInt& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
  ModInt& operator*=(const ModInt& x){val=(ll)val*x.val%mod; return *this;}
  ModInt& operator/=(const ModInt& x){return *this*=x.inv();}
  bool operator==(const ModInt& x) const{return val==x.val;}
  bool operator!=(const ModInt& x) const{return val!=x.val;}
  bool operator<(const ModInt& x) const{return val<x.val;}
  bool operator<=(const ModInt& x) const{return val<=x.val;}
  bool operator>(const ModInt& x) const{return val>x.val;}
  bool operator>=(const ModInt& x) const{return val>=x.val;}
  ModInt operator+(const ModInt& x) const{return ModInt(*this)+=x;}
  ModInt operator-(const ModInt& x) const{return ModInt(*this)-=x;}
  ModInt operator*(const ModInt& x) const{return ModInt(*this)*=x;}
  ModInt operator/(const ModInt& x) const{return ModInt(*this)/=x;}
  friend ostream& operator<<(ostream& os, const ModInt& mi) { os << mi.val; return os; }
  static int get_mod() { return mod; }
};

#ifndef MUTABLE
// using modint = ModInt<1000000007>;
using modint = ModInt<998244353>;
#endif

template <int mod>
struct Factorial {
  using mint = ModInt<mod>;
  vector<modint> Fact, Finv;
public:
  Factorial(int _n): Fact(_n+1), Finv(_n+1) {
      Fact[0]=mint(1); for (int i = 0; i < _n; ++i) Fact[i+1]=Fact[i]*(i+1);
      Finv[_n]=mint(1)/Fact[_n]; for (int i = _n; i > 0; --i) Finv[i-1]=Finv[i]*i;
  }
  mint fact(int n,bool inv=0) { if (inv) return Finv[n]; else return Fact[n]; }
  mint nPr(int n,int r){ if (n<0||n<r||r<0) return mint(0); else return Fact[n]*Finv[n-r]; }
  mint nCr(int n,int r){ if (n<0||n<r||r<0) return mint(0); else return Fact[n]*Finv[r]*Finv[n-r]; }
};

using factorial = Factorial<998244353>;

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  modint fa[n+2];
  fa[0] = 1;
  for (int i = 0; i <= n; ++i) { 
    fa[i+1] = fa[i]*modint(m-1);
  }
  factorial fact(n+1);
  modint ans = 0;
  for (int i = 0; i <= k; ++i) {
    // cout << i << " " << fa[n-i-1] << " " << fact.nCr(n-1,i) << endl;
    ans += modint(m)*fa[n-i-1]*fact.nCr(n-1,i);
  }
  cout << ans << endl;

}


Measured memory_bytes: 5428
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}




int main()
{
ll n,m;
cin>>n>>m;
cout<<(n*(n-1))/2+(m*(m-1))/2;



    return 0;

}


Measured memory_bytes: 256
a, b = map(int, input().split())
x_min = int(b * 10)
x_max = x_min + 9
ok_flag = False

for x in range(x_min, x_max + 1):
    ax = int(x * 0.08)
    if ax == a:
        ok_flag = True
        break

result = x if ok_flag else '-1'
print(result)


Measured memory_bytes: 3064
from fractions import gcd
# from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n = int(input())
    a = list(map(int, input().split()))
    if a[0] != 0:
        print(0)
        exit()
    ans = 1
    r,g,b = 0,0,0
    for i in range(n):
        if i == 0:
            r += 1
            ans = 3
        else:
            cnt = 0
            f = True
            if r == a[i]:
                cnt += 1
                r += 1
                f = False
            if g == a[i] :
                cnt += 1
                if f:
                    g += 1
                f = False
            if b == a[i] :
                cnt += 1
                if f:
                    b += 1

            
            ans = (ans * cnt) % MOD
    print(ans % MOD)            
            




    


if __name__ == '__main__':
    main()


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

int main()
{
  int N, K;
  char S[51];
  cin >> N >> K >> S;

  S[K-1]+=32;

  cout << S << endl;
}

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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  ll N, T;
  cin >> N >> T;
  ll num = 0;
  ll end = T; // おゆがでおわる時間
  ll before = 0; // 1つ前の時間

  for(int i =0; i < N; i++){
    ll tmp;
    cin >>  tmp;
    if(i == 0){
      continue;
    } else { 
      if(tmp >= end){
        num += T;
      } else {
        num += tmp - before;
      }
      end = tmp + T;
      before = tmp;
    }
  }
  cout << num + T << endl;


}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main()
{
    int d;
    scanf("%d", &d);
    if(d == 25)
        printf("Christmas\n");
    else if(d == 24)
        printf("Christmas Eve\n");
    else if(d == 23)
        printf("Christmas Eve Eve\n");
    else if(d == 22)
        printf("Christmas Eve Eve Eve\n");
    return 0;
}

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



ll lcm(ll x, ll y){
    ll g = __gcd(x, y);
    return (x / g) * y; 
}

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

    ll B = b/c + b/d - b/lcm(c, d);
    ll A = a/c + a/d - a/lcm(c, d);
    ll ans = (b-a+1) - (B - A + (a%c == 0 or a%d == 0));
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)a
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/

int main()
{
    //freopen("input.txt", "r", stdin);
    SPEED
    string s;
    cin >> s;
    cout << s.substr(0, 3);
}
/************************************** END OF PROGRAM ******************************************/
/** Stuff you should look for:
 * int overflow, array bounds, over-counting
 * special cases (n=1?), set/unordered_set TLE, multi-set/set error
 * do something instead of nothing and stay organized
 */


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

int main() {
    string s; cin >> s;
    int n = s.size();
    ll ans = 0;
    ll cnt = 0;
    for (int i = 0; i < n-2; i++){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
            ans += cnt + 1;
            s[i+2] = 'A';
            i++;
        } else if(s[i] == 'A'){
            cnt++;
        } else {
            cnt = 0;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3764
N = int(input())
B = list(map(int,input().split()))

ans = 0
for i in range(N):
    if i == 0:
        ans += B[0]
    elif i == N-1:
        ans += B[N-2]
    else:
        ans += min(B[i],B[i-1])

print(ans)

Measured memory_bytes: 38384
from collections import deque
import copy
n, a, b, c = map(int,input().split())
bamboos = []
for _ in range(n):
    bamboos.append(int(input()))

groups =deque()
groups.append([[bamboos[0]],[],[],[]])

for i in range(1,n):
    groups2 = deque()
    while len(groups)>0:
        group = groups.popleft()
        for j in range(4):
            group2 = copy.deepcopy(group)
            group2[j].append(bamboos[i])
            groups2.append(group2) 
    groups = groups2
def unite(g1,g2,g3,g4):
    kouho = []
    l1 = len(g1)
    l2 = len(g2)
    l3 = len(g3)
    l4 = len(g4)
    
    if len(g2)>0 and len(g3)>0 and len(g4)>0:
        unite_score = (l2 +l3 +l4-3)*10
        kouho.append([sum(g2),sum(g3),sum(g4),unite_score])
    if len(g1)>0 and len(g3)>0 and len(g4)>0:
        unite_score = (l1 +l3 +l4-3)*10
        kouho.append([sum(g1),sum(g3),sum(g4),unite_score])
    if len(g2)>0 and len(g1)>0 and len(g4)>0:
        unite_score = (l2 +l1 +l4-3)*10
        kouho.append([sum(g2),sum(g1),sum(g4),unite_score])
    if len(g2)>0 and len(g3)>0 and len(g1)>0:
        unite_score = (l2 +l3 +l1-3)*10
        kouho.append([sum(g2),sum(g3),sum(g1),unite_score])
    return kouho
        

def solve(a,b,c,groups):
    ans = float("inf")
    for comb_4 in groups:
        kouhos = unite(comb_4[0],comb_4[1],comb_4[2],comb_4[3])
        for kouho in kouhos:
            score = kouho.pop()
            bam = kouho
            bam.sort()
            x = bam[2]
            y = bam[1]
            z = bam[0]
            score += abs(a-x) +abs(b-y)+abs(c-z)
            ans = min(ans,score)
    print(ans)
solve(a,b,c,groups)

Measured memory_bytes: 12388
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main() {
    cin>>N>>M;
    ll C;
    vec dp(1LL<<N,INF);
    rep(i,M){
        cin>>A>>B;
        ll ins = 0;
        rep(j,B) {
            cin>>C;
            ins += (1LL << (C-1));
        }
        dp[ins] = min(dp[ins], A);
    }
    rep(i,1LL<<N){
        ll temp = dp[i];
        for(ll j = (i-1)&i; ; j = (j-1)&i){
            if(j == 0) break;
            for(ll k = (i-1)&i; ; k = (k-1)&i){
                if(k == 0) break;
                if((j|k) != i) continue;
                temp = min(temp, dp[j] + dp[k]);
            }
        }
        dp[i] = min(dp[i], temp);
    }
    cout<<(dp[(1LL<<N) - 1] == INF ? -1 : dp[(1LL<<N) - 1])<<endl;
}

Measured memory_bytes: 256
def merge( tS, left, mid, right ):
	global cnt
	n1 = mid - left;
	n2 = right - mid;
	tL = tS[ left : mid ];
	tR = tS[ mid : right ];	
	tL.append( 1000000001 )
	tR.append( 1000000001 )
	i = j = 0
	for k in range( left, right ):
		cnt += 1
		if tL[i] <= tR[j]:
			tS[k] = tL[i]
			i += 1
		else:
			tS[k] = tR[j]
			j += 1


def mergeSort( tS, left, right ):
	if left+1 < right:
		mid = ( left+right )/2
		mergeSort( tS, left, mid )
		mergeSort( tS, mid, right )
		merge( tS, left, mid, right )

n = int( raw_input() )
arrS = [ int( val ) for val in raw_input().split( ' ' ) ]
cnt = 0
mergeSort( arrS, 0, n )
print( " ".join( map( str, arrS ) ) )
print( cnt )

Measured memory_bytes: 65256
import collections
n = int(input())
Vs = list(map(int, input().split()))

# 奇数番目を見る
odd_counter = collections.Counter(Vs[0::2])
odd_counter_tuple = odd_counter.most_common()
# 頻度1番目と2番目のkeyを取り出す
if len(odd_counter_tuple) == 1:
    odd1 = odd_counter_tuple[0][0]
    odd2 = None
else:
    odd1 = odd_counter_tuple[0][0]
    odd2 = odd_counter_tuple[1][0]

# 偶数番目を見る
even_counter = collections.Counter(Vs[1::2])
even_counter_tuple = even_counter.most_common()
# 頻度1番目と2番目のkeyを取り出す
if len(even_counter_tuple) == 1:
    even1 = even_counter_tuple[0][0]
    even2 = None
else:
    even1 = even_counter_tuple[0][0]
    even2 = even_counter_tuple[1][0]

if odd1 != even1:
    ans = n - odd_counter[odd1] - even_counter[even1]
else:
    ans = min(n-odd_counter[odd2]-even_counter[even1], n-odd_counter[odd1]-even_counter[even2])

print(ans)


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

using namespace std;

int main() {
  string S;
  cin >> S;
  int N = S.length();
  int answer = N;

  {
    int count = 0;
    for (int i = 0; i < N; i++) {
      count += (i % 2 == 0) ? (S[i] == '0') : (S[i] == '1');
    }
    answer = min(answer, count);
  }
  {
    int count = 0;
    for (int i = 0; i < N; i++) {
      count += (i % 2 == 0) ? (S[i] == '1') : (S[i] == '0');
    }
    answer = min(answer, count);
  }
  cout << answer << endl;

  return 0;
}


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

long long dp[405][405],qs[405];
int data[405];

int main()
{
  int n;

  scanf("%d",&n);
  for(int c=1;c<=n;c++)
  scanf("%d",&data[c]),qs[c]=qs[c-1]+data[c];
  for(int c=0;c<405;c++)
  for(int c2=0;c2<405;c2++)
  if (c!=c2)dp[c][c2]=LLONG_MAX;
  for(int k=1;k<n;k++)
  {
    for(int c=1;c<=n-k;c++)
    {
      for(int c2=c;c2<c+k;c2++)
      {
        dp[c][c+k]=std::min(dp[c][c+k],dp[c][c2]+dp[c2+1][c+k]+qs[c+k]-qs[c-1]);
      }
    }
  }
  printf("%lld\n",dp[1][n]);
}


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

int main() {
  ll N,k,x;
  cin >> N >> k;

  x = 1;
  for (ll i=0;i<N;i++) {
    if (x<k) {
      x *= 2;
    }
    else {
      x += k;
    }
  }
  
  cout << x;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
typedef long long int ll;
const ll N = 2e5 +9;
const ll p = 31;
// const ll m = 1e9 + 7;
const ll inf= 1e14;
const ll mod = 1e9+7;
#define x first
#define y second
#define pb push_back
#define mp make_pair
using pii = pair<ll, ll>;
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }
std::vector<ll> adj[N];
ll t[4*N],lis[N],ans[N];
map<ll,ll> comp;
ll a[N],b[N];

void build(ll v,ll tl ,ll tr){
    if(tl == tr){
        t[v] = lis[tl];
    }
    else{
        ll tm = (tl+tr)/2;
        build(2*v,tl,tm);
        build(2*v+1,tm+1,tr);
        t[v] = max(t[2*v],t[2*v+1]);
    }

}
ll query(ll v,ll tl ,ll tr,ll l, ll r){
    if(l>r){
        return 0;
    }
    if(l==tl && r == tr){
        return t[v];

    }
    ll tm = (tl+tr)/2;
    return max(query(2*v,tl,tm,l,min(tm,r)),query(2*v+1,tm+1,tr,max(tm+1,l),r));

}
void update(ll v,ll tl, ll tr, ll pos,ll val){
    if(tl==tr){
        t[v] = val;
    }
    else{
        ll tm = (tl+tr)/2;
        if(pos<=tm){
            update(2*v,tl,tm,pos,val);
        }
        else{
            update(2*v+1,tm+1,tr,pos,val);
        }

        t[v] = max(t[2*v],t[2*v+1]);
    }
}
void dfs(ll v,ll p,ll ct){
    ll cur = query(1,0,ct,comp[a[v]],comp[a[v]]);
    ll ma = query(1,0,ct,0,comp[a[v]]-1);
    update(1,0,ct,comp[a[v]],ma+1);
    ll an = query(1,0,ct,0,ct);
    // cout<<v<<" "<<an<<" "<<ma<<'\n';
    ans[v] = an;
    for(auto u:adj[v]){
        if(u!=p){
            dfs(u,v,ct);
        }
    }
    update(1,0,ct,comp[a[v]],cur);
}

int main()
{   
    ios::sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
     #ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
     #endif                           
     memset(lis,0,sizeof(lis));
    ll T= 1;
    // cin >> T;
    while(T--){
        ll n;
        cin>>n;
        for(int i = 0;i<n;i++){
            cin>>a[i];
            b[i] = a[i];
        }
        for(int i = 0;i<n-1;i++){
            ll u,v;cin>>u>>v;u--;v--;
            adj[u].pb(v);
            adj[v].pb(u);
        }
        ll ct = 0;
        sort(b,b+n);
        comp[b[0]] = ct++;
        for(int i = 1;i<n;i++){
            // cout<<b[i]<<'\n';
            if(b[i]!=b[i-1]){
                comp[b[i]]=ct++;
            }
        }
        build(1,0,ct);
        dfs(0,-1,ct);
        // update(1,0,ct,0,4);
        // cout<<query(1,0,ct,0,ct)<<'\n';
        for(int i = 0;i<n;i++){
            cout<<ans[i]<<" ";
        }
        cout<<'\n';


    }
}   

Measured memory_bytes: 52656
a=gets.chomp.split('')
b=(a[0]+a[1])
c=(a[2]+a[3])
if b == "00" || c == "00"
  if b.to_i<13 && b.to_i != 0
   puts "MMYY"
  elsif c.to_i<13 && c.to_i != 0
   puts "YYMM"
  else
    puts "NA"
  end
elsif b.to_i < 13 && c.to_i <13
  puts "AMBIGUOUS"
elsif b.to_i <13
  puts "MMYY"
elsif c.to_i <13
  puts "YYMM"
else
  puts "NA"
end


Measured memory_bytes: 1788
s = raw_input().strip()
n = len(s)

def find_two(s):
	for i in range(1, n):
		if s[i] == s[i-1]:
			return i-1, i
	return -1, -1

def find_three(s):
	n = len(s)
	if n <= 2:
		return -1, -1

	for i in range(2, n):
		if s[i-2] == s[i-1]:
			return i-2, i
		if s[i-2] == s[i]:
			return i-2, i
		if s[i-1] == s[i]:
			return i-2, i
	return -1, -1

ans_two = find_two(s)
if ans_two != (-1, -1):
	print '{0} {1}'.format(ans_two[0]+1, ans_two[1]+1)
else:
	ans_three = find_three(s)
	if ans_three != (-1, -1):
		print '{0} {1}'.format(ans_three[0]+1, ans_three[1]+1)
	else:
		print '{0} {1}'.format(-1, -1)


Measured memory_bytes: 10352
#[allow(dead_code)]
fn rd() -> String {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().to_owned()
}

/// 1行の文字を空白で分割してVec<T>にする。
#[allow(dead_code)]
fn rd_vec<T : std::str::FromStr>() -> Vec<T> {
    rd().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}

/// 1つの要素を入力で受け取る
#[allow(dead_code)]
fn rd_one<T : std::str::FromStr>() -> T {
    rd().parse().ok().unwrap()
}

/// 複数回read_splitを行う
#[allow(dead_code)]
fn rd_vec_mul<T : std::str::FromStr>(count : i32) -> Vec<Vec<T>> {
    (0..count).map(|_| rd_vec()).collect()
}

/// Vecを1列で出力する
#[allow(dead_code)]
fn op_vec<T : std::fmt::Display>(item : Vec<T>, splitter : char) {
    let cnt = item.len();
    let mut c = 0;
    for i in item.iter() {
        c+=1;
        if cnt > c {print!("{}{}", i, splitter);} else {println!("{}", i);}
    }
}

fn main() {
    println!("{}", if (rd_vec() as Vec<i32>).iter().any(|x| *x % 2 == 0) {"No"} else {"Yes"});
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<int> vote(M, 0);
    int k;
    int m;
    rep(i, N)
    {
        cin >> k;
        rep(j, k)
        {
            cin >> m;
            vote[m - 1]++;
        }
    }
    sort(vote.begin(), vote.end(), greater<int>());
    int ans = 0;
    rep(i, M)
    {
        if (vote[i] == N)
        {
            ans++;
        }
        else
        {
            break;
        }
    }
    cout << ans << endl;
   // system("pause");
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

int main(){
    int N; cin >> N;
    vector<int> a(N); REP(i, N) cin >> a[i];

    int cnt = 0;
    int res = -1;

    int b = 1;
    for(int i = 0; i < 100000; ++i) {
        b = a[b - 1];
        cnt++;
        if(b == 2) {
            res = cnt;
            break;
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>

int main(void){
    char S[100];
    scanf("%s",S);

    //printf("%c",S[1]);
    int size;
    size = strlen(S);
    int flag = 1;//true

    for(int i=0;i<size;i++){
        if(i%2==0){
            if(strncmp("L",&S[i],1)==0){
            flag=0;
            //printf("iは%d、Sは%c\n",i,S[i]);
            }
        }
        if(i%2==1){
            if(strncmp("R",&S[i],1)==0){
                flag=0;
                //printf("iは%d、Sは%c\n",i,S[i]);
            }
        }
    }

    if(flag == 0)
    printf("No");
    else
    {
        printf("Yes");
    }
    
}



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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);


  int x, t; cin >> x >> t;
  cout<<max(0ll,x-t)<<endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,a) for(ll i=ll(a-1);i>=0;--i)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<long double,long double> point;
typedef complex<long double> Point;
const ll MAX = 3000;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int s;
    cin >> s;
    string ans = "",m = "ACL";
    rep(i,s) ans += m;
    PRINT(ans);
}


Measured memory_bytes: 3608
fun main(args: Array<String>) {
    val (A, B) = readLine()!!.split(" ").map(String::toLong)
    fun gcd(x: Long, y: Long): Long {
        if (y == 0L) {
            return x
        }
        return gcd(y, x % y)
    }

    /**
     * 素因数分解
     * 試し割り法
     */
    fun factorize(number: Long): List<Pair<Long, Int>> {

        var n = number

        val res = mutableListOf<Pair<Long, Int>>()

        for (i in 2..Math.sqrt(n.toDouble()).toLong() + 1) {
            //割り切れなかったら素因数ではない
            if (n % i != 0L) {
                continue
            }
            //割り切れた数だけ++
            var count = 0
            while (n % i == 0L) {
                n /= i
                count++
            }
            res.add(i to count)
        }

        // √n以上の値で素数があったら
        if (n != 1L) {
            res.add(n to 1)
        }
        return res
    }

    val gcd = gcd(A, B)
    val f = factorize(gcd)
    val ans = f.size + 1
    println(ans)


}

Measured memory_bytes: 37928
#include <bits/stdc++.h>
using namespace std;
    int main(){
      int N,K;cin>>N>>K;
      vector<int> H(N);
      for(int i=0;i<N;i++){
          cin>>H[i];
      }
      sort(H.begin(),H.end());
      reverse(H.begin(),H.end());
      for(int i=0;i<K;i++){
          H[i]=0;
          if(i==N-1)break;
      }
    long long sum=0;
      for(int i=0;i<N;i++){
          sum+=H[i];
      }
      cout<<sum<<endl;
    }
        






Measured memory_bytes: 1024
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = [0,2,5,5,4,5,6,3,7,6]
ab = {}
for i in a:
    ab[i] = b[i]
dp = [0]*(n+10)
dp[0] = ""
for i in range(n+1):
    if dp[i] == 0:
        continue
    for j in ab.keys():
        if dp[i] == "":
            dp[i+ab[j]] = str(max(int(dp[i+ab[j]]),j))
        else:
            if dp[i][0]> str(j):
                next0 = dp[i]+str(j)
            else:
                next0 = str(j)+dp[i]
            if dp[i+ab[j]] == 0:
                dp[i+ab[j]] = next0
                continue
            if len(next0) > len(dp[i+ab[j]]):
                dp[i+ab[j]] = next0
            elif len(next0) < len(dp[i+ab[j]]):
                continue
            else:
                for k in range(len(next0)):
                    if next0[k]> dp[i+ab[j]][k]:
                        dp[i+ab[j]] = next0
                        break
                    elif next0[k]< dp[i+ab[j]][k]:
                        break
                else:
                    dp[i+ab[j]] = next0

print(dp[n])

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

using namespace std;

typedef pair<int, int> P;

P f(P a, P b)
{
	return P(b.first - a.first, b.second - a.second);
}

int main()
{
	int m, n;

	while (true) {
		cin >> m;
		if (m == 0) break;

		vector<P> seiza(m);

		for (int i = 0; i < m; ++i) cin >> seiza[i].first >> seiza[i].second;

		cin >> n;

		vector<P> image(n);

		for (int i = 0; i < n; ++i) cin >> image[i].first >> image[i].second;

		P s0 = seiza[0];

		for (int i = 0; i < n; ++i) {
			int cnt = 1;

			P amount_of_change = f(s0, image[i]);
			for (int j = 1; j < m; ++j) {
				P sj = seiza[j];
				for (int k = 0; k < n; ++k) {
					if (sj.first + amount_of_change.first == image[k].first && sj.second + amount_of_change.second == image[k].second) {
						cnt++;
					}
				}
			}

			if (cnt == m) {
                printf("%d %d\n", amount_of_change.first, amount_of_change.second);
                break;
            }
		}
	}
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  bool j=false;
  if (b < a) {
    j = true;
  }
  int x=a;
  if (j) {
    x--;
  }
  cout << x << endl;
}

Measured memory_bytes: 256
n=int(input())
hs=list(map(int,input().split()))
c=0
m=max(hs)
while not m==0:
    b=0
    for i,h in enumerate(hs):
        if h==m:
            if not b==m:
                c+=1
            hs[i]-=1
        b=h
    m=max(hs)
print(c)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, l, r, X;
  cin >> N;
  X = 0;
  for (int i = 0; i < N; i++){
  cin >> l >> r;
  X = X + (r - l + 1);
  }
  cout << X << endl;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define SIZE 26 
int main()
{
  //FAST IO       
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
string s,t,p;
cin>>s;
cin>>t;
int l1=s.size();
int l2=t.size();
if(l1==l2)
{
	cout<<"No"<<"\n";
	return 0;
}
for(int i=0;i<l2-1;i++)
p+=t[i];
//cout<<p<<"\n";
int res=p.compare(s);
if(res==0)
cout<<"Yes"<<"\n";
else
cout<<"No"<<"\n";

return 0;
}

Measured memory_bytes: 3656