akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12); // debuged
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  string s, t;
  cin >> s >> t;
  int ans = 0;
  rep(i, sz(s)) if (s[i] != t[i]) ans++;
  cout << ans << endl;
}


Measured memory_bytes: 3792
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var aa = ToIntArray(input.ReadLine(), n);
        var bb = ToIntArray(input.ReadLine(), n);

        long overb = 0;
        long overa = 0;

        for(int i=0; i<n; i++) {
            if(aa[i] > bb[i]) {
                overa += aa[i] - bb[i];
            } else if(aa[i] < bb[i]) {
                overb += (bb[i] - aa[i]) /2;
            }
        }

        if(overa > overb) return No;
        return Yes;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 14688
package main

import (
	"math/rand"
	"time"
	"os"
	"bufio"
	"fmt"
	"strconv"
	"strings"
)

var(
	inf = 10000000071000000
	sc = bufio.NewScanner(os.Stdin)
	stdin = bufio.NewReader(os.Stdin)
	mod = 1000000007
	mod9 = 1000000009
)

func init()  {
	rand.Seed(time.Now().UnixNano())
	buf := make([]byte, 0) //ここのサイズは何でもよさそう
	sc.Buffer(buf, 1000000009)
}


func main() {
  n := goint();m := goint()
  a := make([]int,m)
  for i:=0;i<m;i++{
    a[i] = goint()
  }
	Sort(a,0,len(a)-1)
	//逆順に
	for i := 0;i <= (len(a)-1)/2;i ++{
		a[i],a[len(a)-1-i] = a[len(a)-1-i],a[i]
	}
	num := map[int]int{1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
	dp := make([]int,n+1)
	dp[0] = 0
	for i:=1;i<len(dp);i++{
		check := -inf
		for _,v := range a{
			if i - num[v] >= 0{
				check = max(check,dp[i - num[v]] + 1)
			}
		}
		dp[i] = check
	}
	i := n
	for ;i > 0;  {
		for _,v := range a{
			if i - num[v] >= 0{
				if dp[i - num[v]] + 1 == dp[i] {
					fmt.Print(v)
					i = i - num[v]
					break
				}
			}
		}
	}
	fmt.Println("")
}

//ソートする
//sは最初のインデックス fは最後のインデックス
func Sort(ls []int,l int,r int)  {
	if r - l <= 0{return}
	pipot := l + rand.Intn(r-l+1)
	ls[r],ls[pipot] = ls[pipot],ls[r]
	i := l
	for j:=l;j<r;j++{
		if ls[j] < ls[r]{
			ls[i],ls[j] = ls[j],ls[i]
			i ++
		}
	}
	ls[i],ls[r] = ls[r],ls[i]
	Sort(ls,l,i-1)
	Sort(ls,i+1,r)
}

//||||||||||||||||||||||||||入力|||||||||||||||||||||||||||||||||||||||\
//数字一文字入力
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

//文字列を一行入力
func nextLine() string {
	sc.Scan()
	return sc.Text()
}

//空白区切りの文字列の入力
func spaceLine() []string {
	sc.Scan()
	return strings.Split(sc.Text()," ")
}

//数字を一行入力
func intLine() []int {
	str := spaceLine()
	buf := make([]int,len(str))
	for i,s:=range str{
		buf[i],_ = strconv.Atoi(s)
	}
	return buf
}

//次のスペースか改行まで読み込む
func gostring() string {
	byte_ls := make([]byte,0)
	for  {
		b, _ := stdin.ReadByte()
		if b == 32 || b == 10 || b == 0{
			return string(byte_ls)
		} else if b == 13 {
			continue
		} else {
			byte_ls = append(byte_ls,b)
		}
	}
}

//上の関数のintバージョン
func goint() int {
	n,_ := strconv.Atoi(gostring())
	return n
}

//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

func sum(a ...int) int {
	ans := 0
	for i:=0;i<len(a);i++{
		ans += a[i]
	}
	return ans
}

func min(a ...int) int {
	ans := a[0]
	for i:=1;i<len(a);i++{
		if ans > a[i]{
			ans = a[i]
		}
	}
	return ans
}

func abs(n int) int {
	if n >= 0{
		return n
	} else {
		return -n
	}
}

func max(a ...int) int {
	ans := a[0]
	for i:=1;i<len(a);i++{
		if ans < a[i]{
			ans = a[i]
		}
	}
	return ans
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
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; }
       

struct Edge {
  int from, to;
  Edge(){};
  Edge(int from, int to) : from(from), to(to) {}

  void scanFrom(std::istream& strm, int base = 1) {
    strm >> from >> to;
    if (base == 1) --from, --to;
  }

  Edge reverse() const { return Edge(to, from); }
};

inline std::istream& operator>>(std::istream& strm, Edge& t) {
  t.scanFrom(strm);
  return strm;
}
       
       

template <typename T>
struct WeightedEdge {
  int from, to;
  T _weight;
  WeightedEdge(){};
  WeightedEdge(int from, int to, T weight)
      : from(from), to(to), _weight(weight) {}

  void scanFrom(std::istream& strm, int base = 1) {
    strm >> from >> to >> _weight;
    if (base == 1) --from, --to;
  }

  T weight() const { return _weight; }

  WeightedEdge reverse() const { return WeightedEdge(to, from, _weight); }
};

template <typename T>
inline std::istream& operator>>(std::istream& strm, WeightedEdge<T>& t) {
  t.scanFrom(strm);
  return strm;
}

template <typename Edge>
class Digraph {
  int _E, _V;
  vector<vector<Edge>> _adjacencyList;

 public:
  int E() const { return _E; }

  int V() const { return _V; }
  int size() const { return _V; }

  Digraph() : _V(0), _E(0){};
  Digraph(int V, int E = 0) : _V(V), _E(E) { _adjacencyList.resize(V); }

  void addEdge(const Edge& e) {
    _adjacencyList[e.from].push_back(e);
    ++_E;
  }

  void addUndirectedEdge(const Edge& e) {
    _adjacencyList[e.from].push_back(e);
    _adjacencyList[e.to].push_back(e.reverse());
    ++_E;
  }

  void addNode() {
    ++_V;
    _adjacencyList.push_back(vector<Edge>());
  }

  void scanFrom(std::istream& strm, int base = 1) {
    if (_V == 0) strm >> _V;
    if (_E == 0) strm >> _E;
    _adjacencyList.resize(_V);
    for (int i = 0; i < _E; ++i) {
      Edge e;
      e.scanFrom(cin, base);
      assert(0 <= e.from < _V);
      assert(0 <= e.to < _V);
      addEdge(e);
    }
  }

  vector<Edge> operator[](int u) const { return _adjacencyList[u]; }
  vector<vector<Edge>>& adjacencyList() { return _adjacencyList; }
};

template <typename Edge>
inline std::istream& operator>>(std::istream& strm, Digraph<Edge>& t) {
  t.scanFrom(strm);
  return strm;
}

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

  Digraph<Edge> G(n);
  for (int i = 0; i < (int)(n); ++i) {
    int u, k;
    cin >> u >> k;
    --u;
    for (int j = 0; j < (int)(k); ++j) {
      int v;
      cin >> v;
      --v;
      G.addEdge(Edge(u, v));
    }
  }

  vector<int> d(n, -1), f(n);
  function<int(int, int)> dfs = [&](int u, int t) {
    d[u] = t;
    for (Edge &e : G[u]) {
      if (d[e.to] != -1) continue;
      t = dfs(e.to, t + 1);
    }
    return f[u] = t + 1;
  };

  int t = 0;
  for (int i = 0; i < (int)(n); ++i) {
    if (d[i] == -1) t = dfs(i, t + 1);
  }

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

  return 0;
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    i64 A, B, N;
    cin >> A >> B >> N;
    cout << ((i64)floor(A * min(N, B - 1) / B)) << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll n,m;
  cin >> n >> m;
  vector<P> p(n);
  rep(i,n){
    cin >> p[i].first >> p[i].second;
  }
  sort(p.begin(),p.end());
  priority_queue<ll> pq;
  ll j=0;
  ll ans=0;
  rep(i,m+1){
    while(p[j].first==i){
      pq.push(p[j].second);
      j++;
    }
    if(pq.size()){
      ll t=pq.top();
      ans +=t;
      pq.pop();
    }
    else{
      continue;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 2936
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
using namespace std;
typedef long long int lld;
typedef pair<int, int> pii;

const lld M = 1000000007;
const int MAXN = 200002;

int n, m;
int arr[MAXN];
lld bucket[MAXN];
lld dp[MAXN];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int act = -1;
  for (int i = 0; i < n; ++i) {
    int x; cin >> x;
    if (x == act) continue;
    act = arr[m++] = x;
  }

  dp[0] = 1;
  bucket[arr[0]] = 1;
  for (int i = 1; i < m; ++i) {
    dp[i] = dp[i-1] + bucket[arr[i]];
    bucket[arr[i]] += dp[i-1];
    dp[i] %= M;
    bucket[arr[i]] %= M;
  }
  cout << dp[m-1] << "\n";
  return 0;
}

Measured memory_bytes: 4224
package main

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

const INFINITY = math.MaxInt64/2 - 1

func exec(stdin *Stdin, stdout *Stdout) {
	s := stdin.Read()
	s = strings.Replace(s, "BC", "D", -1)

	a := 0
	ans := 0
	for i := 0; i < len(s); i++ {
		if s[i] == 'A' {
			a++
		} else if s[i] == 'D' {
			ans += a
		} else {
			a = 0
		}
	}
	stdout.Println(ans)
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), INFINITY)
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

func (s *Stdin) ReadIntSlice(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadInt()
	}
	return a
}

func (s *Stdin) ReadStringSlice(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = s.Read()
	}
	return a
}

func (s *Stdin) ReadFloat64Slice(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadFloat64()
	}
	return a
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Min(a int, b ...int) int {
	for _, v := range b {
		if v < a {
			a = v
		}
	}
	return a
}

func Max(a int, b ...int) int {
	for _, v := range b {
		if a < v {
			a = v
		}
	}
	return a
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}

func Pow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x *= x
			y /= 2
		} else {
			z *= x
			y -= 1
		}
	}
	return z
}

func CreateMatrix(x, y int) [][]int {
	matrix := make([][]int, x)
	for i := 0; i < x; i++ {
		matrix[i] = make([]int, y)
	}
	return matrix
}


Measured memory_bytes: 1536
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<bits/stdc++.h>
#include<sstream>
using namespace std;
int n;
int main()
{
	cin>>n;
	for(int i=1;i<=9;i++)
		if(n%i==0&&n/i<10)
			cout<<"Yes",exit(0);
	cout<<"No";	
	
}


Measured memory_bytes: 3592
n, x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()

t = 0
c = 0
p = sum(a)
if x > p:
        print(n - 1)
elif x == p:
        print(n)
else:
        for i in range(n):
                t += a[i]
                if t <= x:
                        c += 1
                else:
                        break
        print(c)


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<string>
#include<cstdio>
#include<queue>
#include<functional>
using namespace std;
int main() {
	int n, a[20], b[20], c[19]; cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	for (int i = 0; i < n; ++i) cin >> b[i];
	for (int i = 0; i < n - 1; ++i) cin >> c[i];
	int sum = b[a[0] - 1];
	for (int i = 1; i < n; ++i) {
		sum += b[a[i] - 1];
		if (a[i - 1] == a[i] - 1) sum += c[a[i - 1] - 1];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
N, M, X, Y = map(int, input().split())  # Aの支配下数N, Bの支配下数M, Aの首都X, Bの首都Y

domi_x = list(map(int, input().split()))
domi_y = list(map(int, input().split()))

domi_x.append(X)
domi_y.append(Y)

max_x = max(domi_x)
min_y = min(domi_y)

if min_y > max_x:
    print("No War")
else:
    print("War")


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

int main() {
  int N;
  cin >> N;
  
  int n = 0;
  
  for (int i = 0; i < N; i++) {
  	string c;
  	cin >> c;
    if ( c == "Y" ) {
      	n = 1;
      	break;
    }
  }
  
  if ( n == 0 ) {
  	cout << "Three" << endl;
  }
  else {
  	cout << "Four" << endl;
  }
}


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

// int dfs(vector<vector<char>> &v, int i, int j, int h, int w, set<int> rows, set<int> cols, int k)
// {
//     if (i >= h || j >= w)
//     {
//         cout << i << ' ' << j << endl;
//         for (auto e : rows) cout << e << ' ';
//         cout << endl;
//         for (auto e : cols) cout << e << ' ';
//         cout << "\n";
//         int count = 0;
//         for (int r = 0; r < h; ++r)
//         {
//             for (int c = 0; c < w; ++c)
//             {
//                 if (v[r][c] == '#' && !rows.count(r) && !cols.count(c))
//                 {
//                     ++count;
//                 }
//             }
//         }
//         cout << count << "\n\n";
//         return count == k;
//     }
//     int res = 0;
//     res += dfs(v, i+1, j+1, h, w, rows, cols, k);
//     rows.insert(i);
//     res += dfs(v, i+1, j, h, w, rows, cols, k);
//     rows.erase(i);
//     cols.insert(j);
//     res += dfs(v, i, j+1, h, w, rows, cols, k);
//     return res;
// }

int main()
{
    int h, w, k;
    cin >> h >> w >> k;

    vector<vector<char>> grid(h, vector<char>(w, false));

    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            cin >> grid[i][j];
        }
    }
    int ans = 0;
    for (int mR = 0; mR < (1 << h); ++mR)
    {
        for (int mC = 0; mC < (1 << w); ++mC)
        {
            int black = 0;
            for (int i = 0; i < h; ++i)
            {
                for (int j = 0; j < w; ++j)
                {
                    if (grid[i][j] == '#' && ((mR >> i) & 1) == 0 && ((mC >> j) & 1) == 0)
                    {
                        ++black;
                    }
                }
            }
            if (black == k)
            {
                ++ans;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
n = int(input())
P = [int(p) for p in input().split()]
ans = 0
for i in range(n-2):
 if (P[i+1] < P[i+2] and P[i+1] > P[i]) or (P[i+1] > P[i+2] and P[i+1] < P[i]):
   ans += 1
print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define brep(i,n) for(int i=n-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<n;i++)
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
#define ll long long
unsigned const int MOD = 1e9+7;

int main(void){
    int a,b,k;
    cin >> a >> b >> k;
    rep(i,k){
        if(i%2==0){
            if(a%2==1)a--;
            b+=a/2;
            a-=a/2;
        }
        else{
            if(b%2==1)b--;
            a+=b/2;
            b-=b/2;
        }
    }
    
    
    cout << a <<" "<< b << endl;
    return 0;
}

Measured memory_bytes: 256
s = input()
if (s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]) or (s[0]==s[3] and s[1]==s[2] and s[0]!=s[1]) or (s[0]==s[2] and s[1]==s[3] and s[0]!=s[1]):
    print("Yes")
else:
    print("No")



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

namespace ConsoleApp1
{
    class Program
    {
        class NIJ
        {
            public NIJ(int n, int i, int j)
            {
                N = n;
                I = i;
                J = j;
            }
            public int N;
            public int I;
            public int J;
        }

        static void Update(List<char[]> table, List<NIJ> queue, int n, int i, int j, int h, int w)
        {
            if (i < 0 || j < 0 || i >= h || j >= w)
            {
                return;
            }

            if (table[i][j] == '.')
            {
                table[i][j] = '!';
                queue.Add(new NIJ(n + 1, i, j));
            }
        }

        static void Main(string[] args)
        {

            var line1 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var h = line1[0];
            var w = line1[1];
            var table = new List<char[]>();

            for (var i = 0; i < h; i++)
            {
                table.Add(Console.ReadLine().ToCharArray());
            }

            var queue = new List<NIJ>();
            var cnt = 0;


            for (var i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    var c = table[i][j];

                    if (c == '#')
                    {
                        queue.Add(new NIJ(0, i, j));
                        table[i][j] = '!';  // reset flag...
                    }
                }
            }

            var last_n = -1;
            var idx = 0;

            while(cnt < h * w)
            {
                var nij = queue[idx];
                idx++;

                if(table[nij.I][nij.J] != '#')
                {
                    cnt++;
                    last_n = nij.N;

                    table[nij.I][nij.J] = '#';

                    Update(table, queue, nij.N, nij.I - 1, nij.J, h, w);
                    Update(table, queue, nij.N, nij.I + 1, nij.J, h, w);
                    Update(table, queue, nij.N, nij.I, nij.J - 1, h, w);
                    Update(table, queue, nij.N, nij.I, nij.J + 1, h, w);

                }
            }

            Console.WriteLine(last_n);
        }
    }
}


Measured memory_bytes: 58396
#良い展望台がいくつあるのか
N, M = map(int, input().split()) #N個の展望台

H = list(map(int, input().split()))

check = [1]*N #i番目の展望台が良い展望台なら1

for i in range(M):
    A, B = map(int, input().split())
    if H[A-1] > H[B-1]:
        check[B-1] = 0
    elif H[B-1] > H[A-1]:
        check[A-1] = 0
    elif H[A-1] == H[B-1]:
        check[A-1] = 0
        check[B-1] = 0

print(sum(check))


Measured memory_bytes: 20024
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}



main(){
  double w,h,x,y;
  cin>>w>>h>>x>>y;

  double ans=(w*h)/2;

  printf("%lf ",ans);
  if(x==w/2&&y==h/2){
    cout<<1<<endl;
  }else{
    cout<<0<<endl;
  }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

int n,m,q;
bool sw[1111];
bool light[1111][50];

int main(){
	cin.sync_with_stdio(false);
  while(1){
    cin>>n>>m>>q;
    if(n==0)break;
    memset(sw,0,sizeof(sw));
    rep(i,1111)rep(j,50)light[i][j]=true;
    rep(hoge,q){
      string s1,s2;
      cin>>s1>>s2;
      rep(i,n){
        if(s1[i]=='1')sw[i]=1-sw[i];
      }
      rep(i,m){
        rep(j,n){
          if((!sw[j]&&s2[i]=='1')||(sw[j]&&s2[i]=='0'))light[i][j]=false;
        }
      }
    }
    rep(i,m){
      int cnt=0,idx;
      rep(j,n)if(light[i][j]){
        cnt++; idx=j;
      }
      //dbg(cnt);
      if(cnt!=1)cout<<"?";
      else cout<<(char)(idx>9?'A'+idx-10:'0'+idx);
    }
    cout<<endl;
  }
	return 0;
}

Measured memory_bytes: 3204
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    cout << fixed << setprecision(15);
    int n;cin >> n;
    int a[n];
    fff(i,n)
    cin >> a[i];
    
    int ans=0;
    fff(i,n) {
        for(int j=i+1;j<n;j++) {
            ans+=(a[i]*a[j]);
        }
    }
    cout << ans;
    
	return 0;
    
}

Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
int n,a[85];
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>n;
    rep(i,n)cin>>a[i];
    int cur=1000;
    rep(i,n-1){
        if(a[i]<a[i+1]){
            int k=cur/a[i];
            cur-=a[i]*k;
            cur+=k*a[i+1];
        }
    }
    cout<<cur<<endl;
    return 0;
}


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

typedef long long ll;

int main()
{
    int n,ans=1,f=0;
    cin >> n;
    vector<int>a(n);
    rep(i, n) cin >> a[i];
    rep(i,n-1){
        if(f==0){
            if (a[i] < a[i + 1])
                f = 1;
            else if(a[i] > a[i + 1])
                f = 2;
        }
        else if (f == 1 && a[i] > a[i + 1]){
            f = 0;
            ans++;
        }
        else if (f == 2 && a[i] < a[i + 1]){
            f = 0;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long int 
#define w(x) int x; cin>>x; while(x--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
using namespace std;
int main(){
#ifndef ONLINE_JUDGE 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll a,b;
	cin>>a>>b;
	if(a==1 && b==2)
		cout<<3;
	if(a==1 && b==3)
		cout<<2;
	if(a==2 && b==3)
		cout<<1;
	if(a==2 && b==1)
		cout<<3;
	if(a==3 && b==1)
		cout<<2;
	if(a==3 && b==2)
		cout<<1;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const int MOD = 1000000007;
ll cnt =0,ans=0;
bool graph[8][8];

 int main(){
     char a; cin >> a;
     if(a+0<=90)cout << "A" << endl;
     else cout << "a" << endl; 
    }

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int arr[2019];
int main(){
	int n,a[99999];
	cin>>n;
	long long sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
		a[i]*=2;
	}
	int x[99999];
	long long tmp=0;
	for(int i=1;i<n;i+=2)
		tmp+=a[i];
	for(int i=0;i<2*n;i+=2){
		x[i%n]=sum-tmp;
		tmp+=a[i%n]-a[(i+1)%n];
	}
	for(int i=0;i<n;i++)
		cout<<x[i]<<(i+1==n?'\n':' ');
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;

// main() {vi is_prime = Eratos(MAX);}
// is_prime[i]:= 1 or 0
vector<int> Eratos(int MAX) {
    vi is_prime(MAX,1);
    is_prime[0] = 0; is_prime[1] = 0;
    for(int i = 2; i < MAX; ++i) {
        if(!is_prime[i]) continue;
        for(int j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }
    return is_prime;
}

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

int MAX = 100005;
vi is_prime = Eratos(MAX);

int X;
cin >> X;
for(int i = X; i <= MAX; i++) {
    if(is_prime[i] == 1) {
        cout << i << endl;
        return 0;
    }
} 

return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int a,b,c;
    cin>>a>>b>>c;
    if (b-a==c-b)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define INF 1000000000000 //10^12:極めて大きい値,∞
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    //cout << x+r << ' ' << y+r << ' ' << x-r << ' ' << y-r <<endl;
    if(W >= x + r && H >= y + r && x - r >= 0 && y - r >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3092
n,k,s = map(int,input().split())
if s%2 == 0:
    for i in range(k):
        print(s,end=" ")
    for i in range(n-k):
        if n-k-1 == i:
            print(11021021)
            break
        print(11021021,end=" ")
else:
    for i in range(k):
        print(s,end=" ")
    for i in range(n-k):
        if n-k-1 == i:
            print(11021021)
            break
        print(11021021,end=" ")

Measured memory_bytes: 4212
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
  
    float a,b;
    cin>>a>>b;
    
    float c=(a+b)/2;
    int d=(a+b)/2;
    
    if((c/1-d/1)!=0){
        cout<<d+1<<endl;
    }else{
        cout<<d<<endl;
    }
    
    
    return 0;
}







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

typedef long long lli;
typedef pair<lli,lli> pii;


int main(){
  lli W,H,ans=0;
  pii input;
  vector<pii> p,q;

  cin>>W>>H;
  for(lli i=0;i<W;i++){
    cin>>input.first;
    p.push_back(input);
  }

  for(lli i=0;i<H;i++){
    cin>>input.first;
    q.push_back(input);
  }

  sort(p.begin(),p.end());
  sort(q.begin(),q.end());

  for(lli i=0;i<W;i++)
    p[i].second=i;

  for(lli i=0;i<H;i++)
    q[i].second=i;
  
  pii P;
  P.first = 1000000000;
  P.second = W;
  p.push_back(P);
  P.second = H;
  q.push_back(P);
  
  for(lli i=0;i<W;i++){
    ans+=p[i].first*(H+1-((*lower_bound(q.begin(),q.end(),p[i])).second));
    //   cout<<p[i].first<<" "<<(H+1-((*lower_bound(q.begin(),q.end(),p[i])).second))<<endl;
  }
  for(lli i=0;i<H;i++){
    ans+=q[i].first*(W+1-((*upper_bound(p.begin(),p.end(),q[i])).second));
    // cout<<q[i].first<<" "<<(W+1-((*upper_bound(p.begin(),p.end(),q[i])).second))<<endl;
  }

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 4976
open Hashtbl
let n = read_int ()
let ss = Array.init n @@ fun _ -> read_line ()
let h, ks, ans = create 5, [|'M'; 'A'; 'R'; 'C'; 'H'|], ref 0
let f i = try find h ks.(i) with _ -> 0
let _ = Array.iter (fun s -> replace h s.[0] @@ try find h s.[0] + 1 with _ -> 1) ss;
  for i = 0 to 4 do for j = i + 1 to 4 do for k = j + 1 to 4 do ans := !ans + f i * f j * f k done done done; Printf.printf "%d\n" !ans

Measured memory_bytes: 6528
/*
Dear ToM,
Congratulations on your graduation!
You did a great job!
     ☆ﾟ*＠*ﾟ☆
　　(＠*｡☆｡*＠
　 /☆｡*＠ﾟ*☆
▲/／｡＠｡*☆＠*
　▼―ｰ｡*＠ﾟ*☆
*/

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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

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

int main(){
	ll n;
	while(cin >> n){
		if(n == 0) break;
		else if(n == 1){
			char c;
			cin >> &c;
			cout << c << " " << 1 << endl;
		}else{
			vector<ll> cnt(27, 0);
			int vote;
			int fst = 26;
			int snd = 26;
			bool end = false;

			rep(i, n){
				char c;
				cin >> &c;
				vote = int(c - 'A');
				cnt[vote]++;

				if(end) continue;
				rep(j, (int)cnt.size()){
					if(cnt[j] > cnt[fst]){
						snd = fst;
						fst = j;
					}else if(j != fst && (cnt[j] > cnt[snd])){
						snd = j;
					}
				}
				if((cnt[fst] > cnt[snd] + (n - (i + 1)))){
					cout << char('A' + fst) << " " << (i + 1) << endl;
					end = true;
				}
			}
			if(!end) cout << "TIE\n";
		}
	}

	return 0;
}



Measured memory_bytes: 3080
program abc169
implicit none
integer :: x , y , i , z
read *, x , y

i = 0
z = 4 * x - 2 * i

do i = 0 , x
  if(z == y)then
    goto 10
  end if
  z = 4 * x - 2 * i
10 end do

if(z == y)then
  print *,'Yes'
else
  print *,'No'
end if

end program abc169

Measured memory_bytes: 2860
/*
AizuOnline A0545
Title Party
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
int m,n;
int a[10000];
int b[10000];
int f[501];
int cnt;
//
main()
{
  int i;

  while(1)
    {
      scanf("%d",&n);
      scanf("%d",&m);

      if(m == 0 && n == 0)
	break;
      for(i=0;i<m;i++)
	scanf("%d %d",&(a[i]),&(b[i]));
      for(i=1;i<=n;i++)
	f[i]=0;
      for(i=0;i<m;i++)
	{
	  if(a[i] == 1)
	    f[b[i]] = 1;
	  if(b[i] == 1)
	    f[a[i]] = 1;
	}
      for(i=0;i<m;i++)
	{
	  if(f[a[i]] == 1 && f[b[i]]==0)
	    f[b[i]] = 2;
	  if(f[b[i]] == 1 && f[a[i]]==0)
	f[a[i]] = 2;
	}

      cnt = 0;
      for(i=2;i<=n;i++)
	cnt += ((f[i])?1:0);

      printf("%d\n",cnt);
    }

return(0);
}

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

int main() {
    string s; cin >> s;
    int l = 0;
    for (int i = 1; i < s.size(); i++) {
        if (s[i-1] != s[i]) {
            l = i-1;break;
        }
        l++;
    }

    int r = s.size()-1;
    int ans = 0;
    char c = s[s.size()-1];

    for (int i = s.size()-1-1; i >= 0; i--) {
        if (i == l) {
            ans++;
            break;
        }
        if (s[i] == c) continue;
        c = s[i];
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3708
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n,k;
  cin>>n>>k;
  long long int a[n],i,sum=0,c=1;
  for( i=0;i<n;i++)
    cin>>a[i];
  for(i=0;i<n;i++)
  {
    sum+=a[i];
    if(sum<=k)
    {
      c+=1;
    }
  }
  cout<<c;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 111;
int d[maxn][maxn]; // d[x][y] = min x * a + y * b + f[a][b]
int f[maxn][maxn]; // f[a][b] = max x * a + y * b - d[x][y]
int S[maxn], T[maxn];
int main(){
	int A, B;
	cin >> A >> B;
	for(int x = 1; x <= A; x++){
		for(int y = 1; y <= B; y++){
			cin >> d[x][y];
			for(int a = 0; a < maxn; a++){
				for(int b = 0; b < maxn; b++){
					f[a][b] = max(f[a][b], -(x * a + y * b - d[x][y]));
				}
			}
		}
	}
	for(int x = 1; x <= A; x++){
		for(int y = 1; y <= B; y++){
			int mi = 1<<30;
			for(int a = 0; a < maxn; a++){
				for(int b = 0; b < maxn; b++){
					mi = min(mi, x * a + y * b + f[a][b]);
				}
			}
			if(mi != d[x][y]){
				cout << "Impossible" << endl;
				return 0;
			}
		}
	}
	cout << "Possible" << endl;
	int nds = 1;
	for(int i = 0; i < maxn; i++){
		S[i] = nds++;
		T[i] = nds++;
	}
	cout << 2 * maxn << " " << 2 * maxn - 2 + maxn * maxn << endl;
	for(int i = 0; i < maxn - 1; i++){
		cout << S[i] << " " << S[i + 1] << " X" << endl;
	}
	for(int i = maxn - 1; i > 0; i--){
		cout << T[i] << " " << T[i - 1] << " Y" << endl; 
	}
	for(int a = 0; a < maxn; a++){
		for(int b = 0; b < maxn; b++){
			cout << S[a] << " " << T[b] << " " << f[a][b] << endl;
		}
	}
	cout << S[0] << " " << T[0] << endl;
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<set>
using namespace std;
int main(){
  int Q,N;
  int ans;
  cin>>Q;
  for(int i=0;i<Q;i++){
    cin>>N;
    set<int>used;
    bool ok=true;
    ans=0;
    while(N/10){
      if(used.count(N)){
        ans=-1;
        break;
      }
      used.insert(N);
      ans++;
      int max=0;
      for(int p=1;p<N;p*=10){
        if((N/p)*(N%p)>max)max=(N/p)*(N%p);
      }
      N=max;
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp);
void ipgraph(int m);
//void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
// vector<int>adj[100005];
// int dp[100005];
// bool vis[100005];
// int in_degree[100005];
// void dfs(int src){
//     vis[src]=true;    
//     for(auto it:adj[src]){
//         dp[it]=max(dp[it],dp[src]+1);
//         --in_degree[it];
//         if(in_degree[it]==0)dfs(it);
//         }
//
//
//
// }
//
const ll INF=1e18L+5;
ll int dp[2090][3000];   
int main(){
ios_base::sync_with_stdio(0);
ll int t,n,i,j,k,m;
t=1;

// cin>>t;
int T;
Fo(T,1,t+1){
//  cout<<"Case #"<<T<<": ";
        cin>>n;
       ll int a[n];
        fo(i,n){
            cin>>a[i];
        }
        auto sum =[&](int L,int R){
        ll int s=0;
            
            for(int i=L;i<=R;i++){
            s+=a[i];
            }
            return s;
        };
        for(int L=n-1;L>=0;L--){
            for(int R=L;R<n;R++){
                if(L==R){
                    dp[L][R]=0;
                }
                else{
                    dp[L][R]=INF;
                    ll int s=sum(L,R);
                for(int i=L;i<=R-1;i++){
                dp[L][R]=min(dp[L][R],dp[L][i]+dp[i+1][R]+s);
                }
            }
            }
        }
        cout<<dp[0][n-1];
            
}
}


Measured memory_bytes: 5736
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <unordered_map>
using namespace std;

int main() {
	int N;
	cin >> N;
	unordered_map<string, unsigned long long int> map;
	int p = 0;
	unsigned long long int count = 0;
	for (int n = 0; n < N; n++) {
		string str;
		cin >> str;
		sort(str.begin(), str.end());
		count += map[str]++;
	}
	cout << count << endl;
}

Measured memory_bytes: 10660
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<n;(i)++)

int main(){
  int n,c,k;
  cin >> n >> c >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());
  int f = 0;
  int ans = 0;
  rep(i,n){
    if(a[i] - a[f] > k || i-f+1>c){f=i; ans++;}
  }
  cout << ans+1 << endl;
  return 0;
}
  

Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
	int a, b;
	cin >> a>>b;
	

	if (a<b){
		cout << "a < b" << endl;
	}
	else if (a>b){
		cout << "a > b" << endl;
	}
	else if (a==b){
		cout << "a == b" << endl;
	}
	


	return 0;
}



Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    bool flag=true;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='C')
        {
            for(int j=i;j<s.size();j++)
            {
                if(s[j]=='F')
                {
                    cout<<"Yes"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool is(int n){
    if(n>=1&&n<=9)return true;
    return false;
}
int main(){
    int n,m;
    cin>>n>>m;
    if(is(n)&&is(m)){
        cout<<n*m<<endl;
    }
    else cout<<-1<<endl;
    return 0;
}


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

using namespace std;


int main() {
  int N, A[200000], B[200000];

  cin >> N;
  int low = 0;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    low += A[i] & 1;
  }

  int bit = 0;
  for(int i = 0; i < N; i++) {
    cin >> B[i];
    if(B[i] & 1) {
      if((N - low) & 1) bit ^= 1;
    } else {
      if(low & 1) bit ^= 1;
    }
  }
  for(int i = 28; i >= 1; i--) {
    const int mask = (1 << i) - 1;
    vector< int > vs;
    for(int j = 0; j < N; j++) {
      if((B[j] >> i) & 1) continue;
      vs.emplace_back(B[j] & mask);
    }
    sort(begin(vs), end(vs));
    bool beet = false;
    for(int j = 0; j < N; j++) { //Aのbitが0 Bのbitも0
      if((A[j] & mask) == 0) continue;
      if((A[j] >> i) & 1) continue;
      int digit_up = (1 << i) - (A[j] & mask);
      int po = lower_bound(begin(vs), end(vs), digit_up) - begin(vs); // digit_up 以上ならOK
      beet ^= (vs.size() - po) & 1;
    }
    for(int j = 0; j < N; j++) { //Aのbitが1 Bのbitが0
      if(~(A[j] >> i) & 1) continue;
      int digit_up = (1 << i) - (A[j] & mask);
      int po = lower_bound(begin(vs), end(vs), digit_up) - begin(vs);
      beet ^= po & 1;
    }
    vs.clear();
    for(int j = 0; j < N; j++) {
      if(~(B[j] >> i) & 1) continue;
      vs.emplace_back(B[j] & mask);
    }
    sort(begin(vs), end(vs));
    for(int j = 0; j < N; j++) { //Aのbitが0 Bのbitが1
      if((A[j] >> i) & 1) continue;
      int digit_up = (1 << i) - (A[j] & mask);
      int po = lower_bound(begin(vs), end(vs), digit_up) - begin(vs); // digit_up 以上ならOK
      beet ^= po & 1;
    }
    for(int j = 0; j < N; j++) { //Aのbitが1 Bのbitが1
      if(~(A[j] >> i) & 1) continue;
      if((A[j] & mask) == 0) continue;
      int digit_up = (1 << i) - (A[j] & mask);
      int po = lower_bound(begin(vs), end(vs), digit_up) - begin(vs);
      beet ^= (vs.size() - po) & 1;
    }
    bit |= beet << i;
  }

  cout << bit << endl;
}


Measured memory_bytes: 2936
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

int vector_finder(std::vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main(){
    int N; cin>>N;
    vector<int> data;
    for(int i=1;i<=9;i++){
        for(int j=i;j<=9;j++) data.push_back(i*j);
    }

    if(vector_finder(data,N)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


} 


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		partA100();
	}
	

	public static void partA100() {
		Scanner scA = new Scanner(System.in);
		int A = scA.nextInt();
		int B = scA.nextInt();
		
		if(A > 8 || B > 8) {
			System.out.println(":(");
		}else {
			System.out.println("Yay!");
		}
	}
}

Measured memory_bytes: 21460
N,W = map(int, input().split())
wv = [[int(i) for i in input().split()] for j in range(N)]
maxV = 10 ** 5
dp = [float('inf')]*(maxV+1)
dp[0] = 0

for w, v in wv:
    for i in range(maxV, -1, -1):
        dp[i] = min(dp[i], dp[i-v] + w)

for i in range(maxV, -1, -1):
    if dp[i] <= W:
        print(i)
        break

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

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

    int a,b,i,j,q;
    cin >> q;

  for (  i = 0; i < q; i++ ) {

    string str;
    cin >> str;

    if ( str == "print" ) {

      cin >> a >> b;
      cout << s.substr( a, b - a + 1 ) << endl;

    }
    else if ( str == "reverse" ) {

     cin >> a >> b;
     k = s;
     for (  int j = a; j <= b; j++ ) {
	s[j] = k[a+b-j];
      }

    }else if ( str == "replace" ) {

      cin >> a >> b;

      for (  j = a; j <= b; j++ ) {
	char c;
	cin >> c;
	s[j] = c;
      }

    }

  }

  return 0;

}



Measured memory_bytes: 3196