akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
  int N;
  cin >> N;
  vector<int> x(N), y(N), h(N);
  rep(i, N) cin >> x.at(i) >> y.at(i) >> h.at(i);
  int x0, y0, h0, i;
  h0 = 0, i = 0;
  while(h0 == 0){
    if(h.at(i)){
      x0 = x.at(i);
      y0 = y.at(i);
      h0 = h.at(i);
      break;
    }
    i++;
  }
  
  int ans_x, ans_y, ans_h;
  for(int cx = 0; cx <= 100; cx++){
    for(int cy = 0; cy <= 100; cy++){
      int dis = abs(x0 - cx) + abs(y0 - cy);
      int ch = h0 + dis;
      bool flag = true;
      for(int j = 0; j < N; j++){
        if( h.at(j) != max(ch - abs(x.at(j) - cx) - abs(y.at(j) - cy), 0)){
          flag = false;
          break;
        }
      }
      if(flag){
        ans_x = cx; ans_y = cy; ans_h = ch;
      }
    }
  }
  
  cout << ans_x << ' ' << ans_y << ' ' << ans_h << endl;
}

Measured memory_bytes: 256
#define SORT(v) sort(v.begin(), v.end())
#include "iostream"
#include "map"
#include "vector"
#include <stack>
#include "cstdlib"
#include <algorithm>
#include <cstdarg>
// #include "ane.cpp"

#define INF (int)1e9
#define NMAX 200
#define MMAX 200
#define MOD 100000
using namespace std;

// コメントアウトするとdb_printf()を実行しない
#define DEBUG
// デバッグ用printf
void db_printf(const char* format, ...){
    #ifndef DEBUG
    return;
    #endif
    va_list arg;
    va_start(arg, format);
    vprintf(format, arg);  // コンソールに出力
    va_end(arg);
}
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
typedef pair<int, int> P;

int N,M,K,A,B,C,D,E,dp[NMAX][MMAX] = {};

static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

int ans = 0;

void solve(){
    // 解答アルゴリズム
    if (N == M)
    {
        cout << "Draw" << endl;
    }else if(N == 1){
        cout << "Alice" << endl;
    }else if(M == 1){
        cout << "Bob" << endl;
    }else if(N > M){
        cout << "Alice" << endl;
    }else{
        cout << "Bob" << endl;
    }
}
void debug(){
    // デバッグ用出力
}
void answer(){
    // 解答出力
    // cout << ans << endl;
}
int main(int argc, char const *argv[])
{
    // 入力の読み込み，番兵法
    ios::sync_with_stdio(false);

    Fill(dp, -1);

    cin >> N >> M;
    solve();
    #ifdef DEBUG
    debug();
    #endif
    answer();

    return 0;
}

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  int n , k;
  cin >> n >> k;
  vector<vector<int> > x(n), y(n);
  vector<vector<int> > blanc(k, vector<int>(k, 0)), negre(k, vector<int>(k, 0));
  for (int i = 0; i < n; i++) {
    char z;
    int x, y, c = 0;
    cin >> x >> y >> z;
    x %= 2*k;
    y %= 2*k;
    if (z == 'B') c = 1;
    if (x >= k) {
      x -= k;
      c = 1 - c;
    }
    if (y >= k) {
      y -= k;
      c = 1 - c;
    }
    if (c == 0) blanc[x][y]++;
    else negre[x][y]++;
  }
  vector<vector<int> > acblanc(k+1, vector<int>(k+1, 0)), acnegre(k+1, vector<int>(k+1, 0));
  for (int i = 1; i <= k; i++)
    for (int j = 1; j <= k; j++) {
      acblanc[i][j] = acblanc[i-1][j] + acblanc[i][j-1] - acblanc[i-1][j-1] + blanc[i-1][j-1];
      acnegre[i][j] = acnegre[i-1][j] + acnegre[i][j-1] - acnegre[i-1][j-1] + negre[i-1][j-1];
    }
  int sol = 0;
  for (int i = 0; i < k; i++)
    for (int j = 0; j < k; j++) {
      int cand = 2*acblanc[i][j] + acblanc[k][k] - acblanc[k][j] - acblanc[i][k];
      cand += acnegre[i][k] - 2*acnegre[i][j] + acnegre[k][j];
      sol = max(sol, cand);
      sol = max(sol, n-cand);
    }
  cout << sol << endl;
  
  return 0;
}



Measured memory_bytes: 20736
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;

void solve()
{
    ll d, t, s;
    cin >> d >> t >> s;
    if (s>=(d+t-1)/t)
        cout << "Yes";
    else
        cout << "No";

}


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

    ll t=1;
    //cin >> t;

    while (t--)
    {
        solve();
        cout << '\n';
    }

}

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

#define ll long long
#define ld long double
#define ull unsigned long long
#define endl "\n"
#define MohamedMotaz ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0);
#define f(a, b, c) for(int a = b; a < c; a++)
using namespace std;
const ll mod = 1e9 + 7;



//ll fact[1000001]; ll inv[1000001];
//ll primes[100007];
//ll arr[1000007];
//ll modPower(ll b, ll p) {
//	if (p == 0)
//		return 1;
//
//	ll halfpow = modPower(b, p / 2);
//	ll toReturn = (halfpow * halfpow) % mod;
//	if (p % 2)
//		toReturn = (toReturn * b) % mod;
//
//	return toReturn;
//}
//
//ll fastPower(ll b, ll p) {
//	if (p == 0)
//		return 1;
//	ll ans = fastPower(b, p / 2);
//	ans = (ans * ans);
//	if (p % 2 != 0)
//		ans = (ans * b);
//	return ans;
//}
//ll GcdRecursive(ll a, ll b) {
//	if (b == 0) return a;
//	return GcdRecursive(b, a % b);
//}
//ll modLCM(ll a, ll b) {
//	ll val = GcdRecursive(a, b);
//	ll tmp = ((a % mod) * (b % mod)) % mod;
//	ll finalVal = ((tmp % mod) * (arr[val] % mod)) % mod;
//	return finalVal;
//
//}
//ll LCM(ll a, ll b) {
//	return (a * b) / GcdRecursive(a, b);
//}
//void move1step(ll& a, ll& b, ll q) { // a and b by reference
//	ll c = a - q * b;
//	a = b;
//	b = c;
//}
//ll GcdIterative(ll a, ll b) {
//	while (b) move1step(a, b, a / b);
//	return a;
//}
//
//void pre(ll n) {
//
//	fact[0] = 1;
//	inv[0] = 1;
//
//	for (ll i = 1; i <= n; i++) {
//		fact[i] = (i * fact[i - 1]) % mod;
//		inv[i] = modPower(fact[i], mod - 2);
//		arr[i] = modPower(i, mod - 2);
//	}
//}
//
//ll npr(ll n, ll r) {
//	return ((fact[n] * inv[n - r]) % mod);
//}
//
//ll ncr(ll n, ll r) {
//	return ((((fact[n] * inv[n - r]) % mod) * inv[r]) % mod);
//}
//
//void sieve(ll val) {
//	memset(primes, 1, sizeof primes);
//	primes[0] = primes[1] = false;
//	for (int i = 2; i <= val; i++) {
//		if (primes[i]) {
//			for (int j = i * i; j <= val; j += i) {
//				primes[j] = 0;
//			}
//		}
//	}
//
//}






int main()
{
    MohamedMotaz;

    ll x; cin >> x;
    ll sum = 0;
    /*
    while (x >= 500) {
        sum += 1000;
        x -= 500;
    }
    
    while (x >= 5) {
        sum += 5;
        x -= 5;
    }*/
    sum += (x / 500) * 1000;
    x %= 500;

    sum += (x / 5) * 5;
    x -= sum / 5;
    cout << sum;
}








Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < (int)(n); i++)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

int main(){
    ll n; cin >> n;
    vector<ll> a(n); rep(i,n) cin >> a[i];

    ll en = 1000, stock = 0;
    for(long long i = 0; i < n; i++){
        if(a[i+1] > a[i]){
            en += stock * a[i];
            stock = 0;
            stock = en / a[i];
            en -= stock * a[i];
        }else if(a[i+1] < a[i]){
            en += stock * a[i];
            stock = 0;
        }
    }
    en += stock * a[n-1];
    put(en);
}

Measured memory_bytes: 3616
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)
#define INF 10000000

typedef long long ll;
typedef pair<ll, ll> P;
typedef std::priority_queue<P, std::vector<P>, std::greater<P> > PReversePrioQueue; //A->Z

void solve(void){
    int n; ll k;
    scanf("%d%lld\n", &n, &k);
    ll c = 0;
    PReversePrioQueue pq;

    rep (n, i) {
        P ptemp;
        scanf("%lld%lld\n", &(ptemp.first), &(ptemp.second));
        pq.push(ptemp);
    }
    ll ans;
    while(c < k){
        P ptemp = pq.top();
        ll a = ptemp.first, b = ptemp.second;
        pq.pop();
        c += b;
        ans = a;
    }
    cout << ans << '\n';
}

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


Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define db long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator

#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define EB emplace_back
#define fi first
#define se second

#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));

#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2

#define INF ((1ll<<60)-233)
#define sqr(x) ((x)*(x))
#define debug puts("wzpkking")
using namespace std;

const int N=200005;
int n,m,h,t;
vector<int> e[N];
int cnt[N][2],q[N];
bool ok[N];
char s[N];
int main(){
	scanf("%d%d%s",&n,&m,s+1);
	For(i,1,n) s[i]-='A',ok[i]=1;
	For(i,1,m){
		int x,y; scanf("%d%d",&x,&y);
		e[x].PB(y); e[y].PB(x);
		cnt[x][s[y]]++; cnt[y][s[x]]++;
	}
	For(i,1,n)
		if (!cnt[i][0]||!cnt[i][1])
			q[++t]=i,ok[i]=0;
	while (h!=t){
		int x=q[++h]; ok[x]=0;
		for (int i=0;i<e[x].size();i++)
			if (ok[e[x][i]])
				if (!--cnt[e[x][i]][s[x]])
					q[++t]=e[x][i],ok[e[x][i]]=0;
	}
	puts(t==n?"No":"Yes");
}

Measured memory_bytes: 12928
using System;
using System.Linq;

namespace CSharp
{
    class Program
    {
        public static void Main()
        {
            var N = int.Parse(Console.ReadLine());

            var town = new int[N][];
            for (int i = 0; i < N; i++)
            {
                town[i] = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            }

            var dist = 0.0;
            var x = 0;
            var y = 0;
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    if (i == j)
                    {
                        continue;
                    }
                    x = Math.Abs(town[i][0] - town[j][0]) * Math.Abs(town[i][0] - town[j][0]);
                    y = Math.Abs(town[i][1] - town[j][1]) * Math.Abs(town[i][1] - town[j][1]);
                    dist += Factorial(N - 1) * Math.Sqrt(x + y);
                }
            }

            Console.WriteLine(dist / Factorial(N));
        }

        private static int Factorial(int n)
        {
            var result = 1;
            for (int i = 0; i < n; i++)
            {
                result *= (i + 1);
            }
            return result;
        }
    }
}

Measured memory_bytes: 13524
#include<iostream>

using namespace std;

int main(){

  int in;
  while(cin >> in && in){

    int data[2*in+1];
    for(int i = 0; i <= 2*in; i++){
      data[i] = i;
    }

    int num;
    cin >> num;
    for(int i = 0; i < num; i++){
      int po;
      cin >> po;
      int copy[2*in+1];
      for(int j = 0; j <= 2*in; j++) copy[j] = data[j];

      if(po){
  	for(int j = po+1,k = 1; k <= 2*in-po; j++,k++) data[k] = copy[j];
	for(int j = 2*in-po+1,k = 1; j <= 2*in; j++,k++) data[j] = copy[k];
      }else{
	for(int j = 1, k = 1; j <= 2*in; j+=2,k++) data[j] = copy[k];
	for(int j = 2,k = in+1; j <= 2*in; j+=2,k++) data[j] = copy[k];
      }
    }
    for(int i = 1; i <= 2*in; i++) cout << data[i] << endl;
  }
  return 0;
}

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

int main() {
  int k,s;
  cin >> k >> s;
  int count = 0;
  
  for(int x=0; x<=k; x++){
    for(int y=0; y<=k; y++){
      if(0<=s-x-y && s-x-y<=k) count++;
    }
  }
  
  cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    A, B, C = map(int, input().split())

    for i in range(1000):
        if A % 2 or B % 2 or C % 2:
            print(i)
            return

        a = (B + C) // 2
        b = (A + C) // 2
        c = (A + B) // 2
        A = a
        B = b
        C = c

    print(-1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MAX = 5100000;
ll gcd(ll a, ll b) {
    return (b==0) ? a : gcd(b, a%b);
}

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 以下から
const int MAX_N = 100000;
struct Edge {
    int to;
    int id;
};

vector<vector<Edge>> g;
vector<int> ans;
const int MN = 15;
vector<int> searched(MN, 0);
vector<int> color(MN, -1);

int main() {
    int a,b; cin >> a >> b;
    bool one  = true;
    bool two = true;
    bool three = true;
    if (a == 1 || b == 1) {
        one = false;
    }
    if (a == 2 || b == 2) {
        two = false;
    }
    if (a == 3 || b == 3) {
        three = false;
    }

    int ans = 0;
    if (one) {
        ans = 1;
    } else if (two) {
        ans = 2;
    } else if (three) {
        ans = 3;
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include <vector>
#include<math.h>


using namespace std;

bool f[10000002];
int N=1000000;
int main () {
  for(int i=3;i<=N;i+=2){f[i]=true;
	  for(int j=3;j*j<=i;j+=2)
		  if(i%j==0)f[i]=false;
  }
  int x;
  while(1){

  int ans=0;
  cin>>x;if(x==0)break;
  for(int i=3;i<=x/2;i+=2)
	  if(f[x-i]==true&&f[i]==true)ans++;//cout<<i<<" "<<x-i<<endl;//
	  
  cout<<ans<<endl;
}
  return 0;
}

Measured memory_bytes: 2136
using AtCoderBeginnerContest134.Questions;
using AtCoderBeginnerContest134.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest134.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var r = inputStream.ReadInt();
            yield return 3 * r * r;
        }
    }
}


namespace AtCoderBeginnerContest134
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest134.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest134.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13140
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
res = 0
A = []
for i in range(N):
  A = list(map(int, input().split()))
  tot = C
  for j in range(M):
    tot += A[j] * B[j]
  if tot > 0:
    res += 1
print(res)



Measured memory_bytes: 62124
import heapq

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

N0 = 2**(N-1).bit_length()
INF = 2**31-1
seg_min = [INF]*(2*N0)
seg_min_idx = [0] * (2 * N0)


def update(idx, value):
    idx += N0 - 1
    seg_min[idx] = value
    seg_min_idx[idx] = idx
    while idx > 0:
        idx = (idx - 1) // 2
        seg_min[idx] = min(seg_min[idx * 2 + 1], seg_min[idx * 2 + 2])
        seg_min_idx[idx] = seg_min_idx[idx * 2 + 1] if seg_min[idx * 2 + 1] <= seg_min[idx * 2 + 2] else seg_min_idx[idx * 2 + 2]


def query(first, last):
    first += N0 - 1
    last += N0 - 1
    ret = INF
    min_idx = 0
    while first <= last:
        if not first & 1:
            if seg_min[first] < ret:
                min_idx = seg_min_idx[first]
            ret = min(ret, seg_min[first])
        if last & 1:
            if seg_min[last] < ret:
                min_idx = seg_min_idx[last]
            ret = min(ret, seg_min[last])
        first = first // 2
        last = last // 2 - 1
    min_idx -= (N0-1)
    return ret, min_idx


for i, x in enumerate(A):
    update(i, x)

A_index = []
left_right_used = []
for i, x in enumerate(A):
    A_index.append((x, i))
    left_right_used.append([i, i, 0])
A_index.sort(key=lambda a: a[0], reverse=True)

pq = []
ans = 10 ** 10
for i in range(N):
    left_used_flag = 0
    right_used_flag = 0
    index = A_index[i][1]
    left_right_used[index][2] = 1
    if index - 1 >= 0:
        if left_right_used[index - 1][2] == 1:
            left_used_flag = 1
    if index + 1 < N:
        if left_right_used[index + 1][2] == 1:
            right_used_flag = 1
    if left_used_flag == 1 and right_used_flag == 1:
        leftmost = left_right_used[index - 1][0]
        rightmost = left_right_used[index + 1][1]
    elif left_used_flag == 1 and right_used_flag == 0:
        leftmost = left_right_used[index - 1][0]
        rightmost = index
    elif left_used_flag == 0 and right_used_flag == 1:
        leftmost = index
        rightmost = left_right_used[index + 1][1]
    else:
        leftmost = rightmost = index
    num_old = max(0, left_right_used[leftmost][1] - left_right_used[leftmost][0] - K + 2) * left_used_flag\
              + max(0, left_right_used[rightmost][1] - left_right_used[rightmost][0] - K + 2) * right_used_flag
    left_right_used[leftmost][1] = rightmost
    left_right_used[rightmost][0] = leftmost
    num_new = max(0, left_right_used[leftmost][1] - left_right_used[leftmost][0] - K + 2)
    num_add = num_new - num_old
    for j in range(num_add):
        range_min, min_index = query(leftmost, rightmost)
        update(min_index, 10 ** 10)
        heapq.heappush(pq, range_min * (-1))

    for j in range(num_add):
        if len(pq) > Q:
            heapq.heappop(pq)
    if len(pq) == Q:
        maximum = heapq.heappop(pq) * (-1)
        ans_new = maximum - A[index]
        ans = min(ans, ans_new)
        heapq.heappush(pq, maximum * (-1))

print(ans)


Measured memory_bytes: 59608
// finish date: 2018/08/19
#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>>
        vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>>
        vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


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

    cout << A * B - (A + B - 1) << endl;


    return 0;
}



Measured memory_bytes: 256
n = int(input())
a = [input() for _ in range(n)]
cnt = {}
for i in range(n):
    if a[i] not in cnt:
        cnt[a[i]] = 1
    else:
        cnt[a[i]] += 1
mx = max(cnt.values())
ans = []
for i in cnt.keys():
    if cnt[i] == mx:
        ans.append(i)
ans.sort()
for _ in ans:
    print(_)





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

int cal(vector<int> f, int index){
    int sum = 0;
    for(int i = 0; i < 5; i++){
        if(i == index){
            sum += f[i];
        }
        else{
            if(f[i] < 10){
                sum += 10;
            }
            else{
                if(f[i] % 10 != 0){
                    f[i] /= 10;
                    f[i]++;
                    sum += (f[i] * 10);
                }
                else{
                    sum += f[i];
                }
            }
        }
    }

    return sum;
}

int main(){
    vector<int> food(5);
    for(int i = 0; i < 5; i++){
        cin >> food[i];
    }

    int min = 644;
    for(int i = 0; i < 5; i++){
        int sum = cal(food, i);
        if(min > sum){
            min = sum;
        }
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
word = input()
 
word_cnt = {}
 
for s in word:
  if s in word_cnt:
  	word_cnt[s]+=1
  else:
    word_cnt[s]=1
  
if len(word_cnt) != 2:
  print('No')
  sys.exit()
  
for cnt in word_cnt.values():
  if cnt != 2:
    print('No')
    sys.exit()

print('Yes')

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

public class Main {
	public static void main(String args[]) throws IOException {
	// 2020/2/2 No.153
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	String str[] = br.readLine().split(" ");
	int n = Integer.parseInt(str[0]);
	int m = Integer.parseInt(str[1]);

	br.close();
	int cnt;

	if(n % m == 0) {
		cnt = n / m;
	} else {
		cnt = (int) (Math.floor(n / m) + 1);
	}

	System.out.println(cnt);
	}
}

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

int main(){
  int H=0;
  int W=0;
  string S;
  cin>>H>>W;
  char p[H][W];
  for (int i=0;i<H;i++){
      cin>>S;
    for (int j=0;j<W;j++){
      p[i][j]=S.at(j);
    }
  }
  
  int tempi=0;
  int tempj=0;
  while(!((tempi==H-1)&&(tempj==W-1))){
    if(p[tempi+1][tempj]=='#'){
      p[tempi][tempj]='.';
      tempi++;
      continue;
    }
    if(p[tempi][tempj+1]=='#'){
      p[tempi][tempj]='.';
      tempj++;
      continue;
    }
    cout<<"Impossible"<<endl;
    return 0;
  }
  p[H-1][W-1]='.';

  for(int i=0;i<H;i++){
    for (int j=0;j<W;j++){
      if (p[i][j]=='#'){
        cout<<"Impossible"<<endl;
        return 0;
      }
    }
  }
  cout<<"Possible"<<endl;
  return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7;
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define f first
#define s second

ll K;
ll digit(ll x){
  ll ret=0;
  while(x/10){
    ret+=(x%10);
    x/=10;
  }
  ret+=(x%10);
  return ret;
}

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>K;

ll p=1;
ll n=1;
ll k=0;
while(1){
	if((n+p)*digit(n)>=n*digit(n+p)){
		cout<<n<<endl; 
		k++;
		n+=p;
		if(k==K) break;
	}else{
		n-=p;
		p*=10;
		n+=p;
	}
}


}
	


Measured memory_bytes: 256
def gcd(a,b):
	return a if b==0 else gcd(b,a%b)

while 1:
	n=input()
	if n==0:break
	s=[map(int,raw_input().split()) for i in range(n)]
	c=1
	for i in s:
		c=c*i[1]/gcd(c,i[1])
	for i in range(n):
		s[i]=c*s[i][0]/s[i][1]
	c=1
	for i in s:
		c=c*i/gcd(c,i)
	for i in s:
		print c/i

Measured memory_bytes: 4244
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

long long max(long long a, long long b)
{
    if (a > b)
        return a;
    return b;
}
long long min(long long a, long long b)
{
    if (a > b)
        return b;
    return a;
}
typedef long long ll;
typedef pair<long long, long long> pii;
typedef pair<ll, ll> pll;

namespace MySpace{

};

#define forn(i, n) for (long long (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return

string s;
int dp[500000];

int ok(int l, int r)
{
    vector<char> c;
    for (int i = l; i <= r; i++)
    {
        c.push_back(s[i]);
    }
    vector<char> dream = {'d', 'r', 'e', 'a', 'm'};
    vector<char> dreamer = {'d', 'r', 'e', 'a', 'm', 'e', 'r'};
    vector<char> eraser = {'e', 'r', 'a', 's', 'e', 'r'};
    vector<char> erase = {'e', 'r', 'a', 's', 'e'};
    if (c == dream) return 1;
    if (c == dreamer) return 1;
    if (c == eraser) return 1;
    if (c == erase) return 1;
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
    cin >> s;
    dp[0] = 1;
    for (int i = 0; i < s.size(); i++)
    {
        if (dp[i] == 1)
        {
            for (int j = i; j < min((int)s.size(), i + 10); j++)
            {
                if (ok(i, j))
                    dp[j + 1] = 1;
            }
        }
    }
    //for (int i = 0; i <= s.size(); i++)
    //    cout << dp[i] << " ";
    if (dp[s.size()])
        cout << "YES";
    else
        cout << "NO";
}


Measured memory_bytes: 976
#include<stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))

ll dp[420][420];
ll ans=INF;

int main(){
	int n,ma,mb;
	scanf("%d%d%d",&n,&ma,&mb);
	rep(i,0,410)rep(j,0,410)dp[i][j]=INF;
	dp[0][0]=0;
	rep(i,0,n){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		for(int aa=400;aa>=0;aa--)for(int bb=400;bb>=0;bb--)if(dp[aa][bb]!=INF)dp[aa+a][bb+b]=min(dp[aa+a][bb+b],dp[aa][bb]+c);
	}
	for(int aa=ma,bb=mb;aa<=400&&bb<=400;aa+=ma,bb+=mb)ans=min(ans,dp[aa][bb]);
	printf("%lld\n",ans==INF?-1:ans);
	return 0;
}

Measured memory_bytes: 1536
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    public static long ReadInt()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] ReadInts()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    public static void Main()
    {
        var input = ReadInts();
        var r = input[0];
        var D = input[1];
        var X = input[2];
        var x = new List<long>();
             
        x.Add( r * X - D);
        for (int i = 1; i < 10; i++)
            x.Add(r * x[i - 1] - D);
        for (int i = 0; i < x.Count; i++)
            Console.WriteLine(x[i]);
    }
}

Measured memory_bytes: 11348
#include<bits/stdc++.h>
/*
g++ -std=c++11 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG abc073/d.cpp
*/
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
typedef long long ll;

int N, M, R;
vector<int> r;
vector<vector<int>> dist;
ll inf = 100000000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);//おまじないでcin, cout早くする
    cin >> N >> M >> R;
    r.resize(R);
    dist.resize(N);
    rep(i, R){
        int tmp;
        cin >> tmp;
        r[i] = tmp - 1;
    }
    rep(i, N){
        dist[i].resize(N);
        rep(j, N){
            if(i == j) dist[i][j] = 0;
            else dist[i][j] = inf;
        }
    }
    rep(i, M){
        int a, b, d;
        cin >> a >> b >> d;
        a--;
        b--;
        dist[a][b] = d;
        dist[b][a] = d;
    }

    rep(k, N){
        rep(i, N){
            rep(j, N){
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
                dist[j][i] = dist[i][j];
            }
        }
    }
    // 距離行列できた
    ll ans = inf;
    sort(r.begin(), r.end());
    do{
        ll dd = 0;
        rep(i, R - 1){
            // cout << r[i] << " ";
            dd += dist[r[i]][r[i + 1]];
        }
        // cout << r[R - 1];
        // cout << "\n";
        // cout << dd << "\n";
        ans = min(ans, dd);
    }while(next_permutation(r.begin(), r.end()));

    // cout << "\n";
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 384
N=int(input())
d=input()
r=d.count('R')
w=N-r
ans=r
leftr,leftw,rightr,rightw=0,0,r,N-r
for i in range(N):
  if d[i]=='R':
    leftr+=1
    rightr-=1
  else:
    leftw+=1
    rightw-=1
  if leftw==rightr:
    f=rightr
  elif leftw<rightr:
    f=rightr
  else:
    f=leftw
  ans=min(ans,f)
print(ans)

Measured memory_bytes: 9488
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int BIT[200010];
inline void add(int A) {
	while (A <= 200010) {
		BIT[A]++;
		A += A & -A;
	}
}

inline int query(int A) {
	int kotae = 0;
	while (A > 0) {
		kotae += BIT[A];
		A -= A & -A;
	}
	return kotae;
}

void pakuripair_sort(int N, ll A[], int B[]) {
	const int b = 9;
	ll tmp[200001];
	int tmp2[200001];
	rep(k, 6) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) {
			tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
			tmp2[kazu[A[i] >> k * b & ((1 << b) - 1)]] = B[i];
		}
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) {
			A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
			B[kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp2[i];
		}
	}
}

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

	int N = getint();
	int K = getint();

	ll A[200001];
	A[0] = (ll)N * K;
	int B[200001];
	B[0] = 0;
	rep1(i, N) {
		B[i] = i;
		A[i] = A[i - 1] + getint() - K;
	}
	pakuripair_sort(N + 1, A, B);
	rep(i, N + 1) A[B[i]] = i + 1;

	ll kotae = 0;
	rep(i, N + 1) {
		kotae += query(A[i]);
		add(A[i]);
	}
	printf("%lld", kotae);

	Would you please return 0;
}

Measured memory_bytes: 5760
#include<iostream>
using namespace std;
#include<cstdio>
#include<cmath>

struct Point{ double x, y; };

Point set_p(double a, double b)
{
    Point p;
    p.x = a; p.y = b;
    return p;
}

struct Vector{ double vx, vy; };

Vector set_v(const Point &p1, const Point &p2)
{
    Vector v;
    v.vx = p2.x - p1.x;
    v.vy = p2.y - p1.y;
    return v;
}

double dot(const Vector &v1, const Vector &v2)
{
    return (v1.vx * v2.vx) + (v1.vy * v2.vy);
}

double cross(const Vector &v1, const Vector &v2)
{
	return (v1.vx * v2.vy) - (v1.vy * v2.vx);
}

double onenorm(const Vector &v)
{
	return abs(v.vx) + abs(v.vy);
}

int ccw(const Point &P0, const Point &P1, const Point &P2)
{
	Vector V1 = set_v(P0, P1);
	Vector V2 = set_v(P0, P2);
	double c = cross(V1, V2);
	if(c > 0){ return 1; }else if(c < 0){ return -1; }
	if(dot(V1, V2) < 0){ return -2; }
	if(onenorm(V1) < onenorm(V2)){ return 2; }
	return 0;
}

int main()
{
    int q;
    scanf("%d", &q);
    double x0, y0, x1, y1, x2, y2, x3, y3;
    for(int i = 0; i < q; i++){
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x0, &y0, &x1, &y1, &x2, &y2, &x3, &y3);
        Point P0 = set_p(x0, y0), P1 = set_p(x1, y1), P2 = set_p(x2, y2), P3 = set_p(x3, y3);
        if(ccw(P0, P1, P2) * ccw(P0, P1, P3) <= 0 && ccw(P2, P3, P0) * ccw(P2, P3, P1) <= 0){
            printf("1\n");
        }else{
            printf("0\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1204
package main

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

var sc = bufio.NewScanner(os.Stdin)

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}

func oneInt64() int64 {
	var a int64
	fmt.Scan(&a)
	return a
}

func oneStr() string {
	var a string
	fmt.Scan(&a)
	return a
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func scanNums() (nums []int) {
	s := nextLine()
	numStr := strings.Split(s, " ")

	for _, n := range numStr {
		i, _ := strconv.Atoi(n)
		nums = append(nums, i)
	}
	return nums
}

func scanStrings() (strs []string) {
	s := nextLine()
	list := strings.Split(s, " ")
	strs = append(strs, list...)
	return strs
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

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

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}

func permutation(n int, k int) int {
	v := 1
	if 0 < k && k <= n {
		for i := 0; i < k; i++ {
			v *= (n - i)
		}
	} else if k > n {
		v = 0
	}
	return v
}

func factorial(n int) int {
	return permutation(n, n-1)
}

func combination(n int, k int) int {
	return permutation(n, k) / factorial(k)
}

func homogeneous(n int, k int) int {
	return combination(n+k-1, k)
}

var memo []int
var hights []int
var k int

func main() {
	N := oneInt()
	k = oneInt()

	for index := 0; index < N; index++ {
		hights = append(hights, oneInt())
		memo = append(memo, math.MaxInt64)
	}

	fmt.Print(rec(N - 1))
}

func rec(i int) int {
	if memo[i] < math.MaxInt64 {
		return memo[i]
	}

	if i == 0 {
		memo[i] = 0
		return 0
	}

	var scores []int
	for index := 1; index <= k; index++ {
		if i >= index {
			scores = append(scores, abs(hights[i]-hights[i-index])+rec(i-index))
		}
	}

	memo[i] = min(scores...)
	return memo[i]
}


Measured memory_bytes: 39572
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
typedef long long ll;
typedef pair<int, int> P;
typedef struct{
  int first;
  int second;
  int third;
}T;

//昇順
bool comp_Se(T& l, T& r){
  return l.second < r.second;
}

int main(void){
  int N;
  cin >> N;
  vector<int> a(N,-1);
  vector<vector<int> > b(N);
  bool flg = true;
  int i,j,k,l,x;
  REP(i,N){
    cin >> x;
    if(i<x-1) flg= false;
    b[x-1].push_back(i);
  }
  if(!flg){
    cout << -1 << endl;
    return 0;
  }

  for(i=N-1;i>=0;i--){
    for(j=b[i].size()-1;j>=0;j--){
      int num = 0;
      for(k=i;k>=0;k--){
        for(l=b[k].size()-1;l>=0;l--){
          if(b[k][l] <= b[i][j]) break;
          num++;
        }
      }
      int pre_num = num;
      int end = 0;
      do{
        pre_num = num;
        for(k=i+num-1;k>=end;k--)if(a[k] > i+1 )num++;
        end = i+pre_num;
      }while(pre_num!=num);
      while(a[i+num] != -1){
        num++;
        if(i+num == N){
          cout << -1 << endl;
          return 0;
        }
      }
      a[i+num] = i+1;
    }
  }
  REP(i,N) cout << a[i] << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++) 
int grid[14][14];
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int u;
	roop(i, 0) { roop(j, 0) { grid[i][j] = 0; } }
	int pow1x[5] = { 0,1,-1,0,0 };
	int pow1y[5] = { 0,0,0,1,-1 };
	int pow2x[9] = { 0,0,0,1,1,1,-1,-1,-1 };
	int pow2y[9] = { -1,0,1,-1,0,1,-1,0,1 };
	int pow3x[13] = { 0 ,0,0,0,0,1,1,1,-1,-1,-1,2,-2 };
	int pow3y[13] = { 2,1,0,-1,-2,1,0,-1,1,0,-1,0,0 };
	int x, y, power;
	char g, h;
	while (cin >> x >> g >> y >> h >> power) {
		
		x += 2; y += 2;
		power = power * 4 + 1;
		if (power == 5) {
			for (int i = 0; i < power; i++) {
				grid[pow1x[i] + x][pow1y[i] + y]++;
			}
		}
		else if (power == 9) {
			for (int i = 0; i < power; i++) {
				grid[pow2x[i] + x][pow2y[i] + y]++;
			}
		}
		else {
			for (int i = 0; i < power; i++) {
				grid[pow3x[i] + x][pow3y[i] + y]++;
			}
		}
	}
	int ans1 = 0;
	int ans2 = 0;
	for (int i = 2; i < 12; i++) {
		for (int j = 2; j < 12; j++) {
			ans2 = max(ans2, grid[i][j]);
			if (grid[i][j] > 0) {
				ans1++;
			}
			/////
			//cout<< grid[i][j]<<" ";
		}//cout<<endl;
	}
	
	cout << 100-ans1 << endl << ans2 << endl;
	return 0;
}


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

#define pan(i,n) for(int i=0;i<n;i++)
#define pans(i,n,a) for(int i=a;i<n;i++)
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define INF 1000000007
#define PI 3.141592653
#define inf 100007
#define P pair<ll,ll>

using namespace std; 

int main(){
    int n,k;
    cin>>n>>k;
    ll ans=0;
    if(k%2==0){
        int p=k/2,x=n/p,r=x/2;
        ans=pow(r,3)+pow(x-r,3);
    }
    else ans=pow(n/k,3);
    cout<<ans;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int r = sc.nextInt();
    int D = sc.nextInt();
    int x = sc.nextInt();


    for(int i = 0; i < 10; i++){
      x = (r * x) - D;
      System.out.println(x);
    }
  }
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		while (number != 0) {
			
			String convertionTable[][] = new String [number][2];
			
			for (int i = 0; i < number; i++) {
				convertionTable[i][0] = sc.next();
				convertionTable[i][1] = sc.next();
				//System.out.println(convertionTable[i][0] + " " + convertionTable[i][1]);
			}
			
			int dataNumber = sc.nextInt();
			String data[] = new String [dataNumber];
			for (int i = 0; i < dataNumber; i++) {
				data[i] = sc.next();
				for (int j = 0; j < number; j++) {
					if (data[i].equals(convertionTable[j][0])) {
						//System.out.println(data[i] + " " + convertionTable[j][1]);
						data[i] = convertionTable[j][1];
						break;
					}
				}
			}
			
			for (int p = 0; p < dataNumber; p++) {
				System.out.print(data[p]);
			}
			System.out.println();
			number = sc.nextInt();
		}
	}

}

Measured memory_bytes: 70568
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X, t;
  cin >> X >> t;
  
  if (X-t > 0) {
    cout << X-t << endl;
  } else {
    cout << 0 << endl;
  }
  
  
  return 0;  
}

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

bool prime(int n)
{
	if(n<=1)
		return false;
	for(int i=2;i*i<=n;i++){
		if(n%i==0)
			return false;
	}
	return true;
}
int main()
{
	int n;
	while(cin >> n){
		if(n==0)
			break;
		int count=0;
		for(int i=1;i<=n;i++){
			if(prime(i)){
				if(prime(n-i+1)){
					count++;
				}
			}
		}

		cout << count << endl;
	}
	return 0;
}

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


fn main() {
  let _n: usize = read();
  let ds: String = read();

  let ans = ds.chars().fold(" ".to_string(), |acc, cur| {
    if acc.chars().last().unwrap() != cur { acc + &cur.to_string() } else { acc }
  }).len();
  
  println!("{}", ans - 1);
}


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

inline int gi()
{
    char c = getchar();
    while(c < '0' || c > '9') c = getchar();
    int sum = 0;
    while('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
    return sum;
}

typedef long long ll;
const int maxn = 55, maxm = 105, mod = 1e9 + 7;

int n, m, col, fac[maxm << 1], ifac[maxm << 1];

struct edge
{
    int to, next;
} e[maxm * 2];
int h[maxn], tot;

inline void add(int u, int v)
{
    e[++tot] = (edge) {v, h[u]}, h[u] = tot;
    e[++tot] = (edge) {u, h[v]}; h[v] = tot;
}

int dfn[maxn], low[maxn], Time, top, bccno[maxn], cnt, siz_p[maxn], siz_e[maxn];
pair<int, int> stk[maxm];
vector<int> vec[maxn];

void dfs(int u, int fa)
{
    dfn[u] = low[u] = ++Time;
    for (int i = h[u], v; v = e[i].to, i; i = e[i].next)
        if (v != fa) {
            if (!dfn[v]) {
                stk[++top] = make_pair(u, v);
                dfs(v, u);
                low[u] = min(low[u], low[v]);
                if (dfn[u] <= low[v]) {
                    ++cnt;
                    while (1) {
                        int x = stk[top].first, y = stk[top].second;
                        ++siz_e[cnt];
                        if (bccno[x] != cnt) bccno[x] = cnt, ++siz_p[cnt], vec[cnt].push_back(x);
                        if (bccno[y] != cnt) bccno[y] = cnt, ++siz_p[cnt], vec[cnt].push_back(y);
                        --top;
                        if (x == u && y == v) break;
                    }
                }
            } else if (dfn[v] < dfn[u]) stk[++top] = make_pair(u, v), low[u] = min(low[u], dfn[v]);
        }
}

inline int fpow(int x, int k)
{
    int res = 1;
    while (k) {
        if (k & 1) res = (ll)res * x % mod;
        x = (ll)x * x % mod; k >>= 1;
    }
    return res;
}

inline int C(int n, int m)
{
    return (ll)fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}

int main()
{
    n = gi(); m = gi(); col = gi();

    for (int i = 1; i <= m; ++i) add(gi(), gi());

    for (int i = 1; i <= n; ++i)
        if (!dfn[i]) dfs(i, 0);

    fac[0] = ifac[0] = ifac[1] = 1;
    for (int i = 1; i <= m + col; ++i) fac[i] = (ll)fac[i - 1] * i % mod;
    for (int i = 2; i <= m + col; ++i) ifac[i] = (ll)(mod - mod / i) * ifac[mod % i] % mod;
    for (int i = 2; i <= m + col; ++i) ifac[i] = (ll)ifac[i - 1] * ifac[i] % mod;
//	printf("%d\n", cnt);
    int ans1 = 1, ans2 = 1, ans3 = 1;
    for (int i = 1; i <= cnt; ++i) {
    //	printf("%d %d\n", siz_p[i], siz_e[i]);
        if (siz_e[i] == 1) ans1 = (ll)ans1 * col % mod;
        else if (siz_e[i] == siz_p[i]) {
            int sum = 0;
            for (int j = 1; j <= siz_e[i]; ++j) {
                sum += fpow(col, __gcd(j, siz_p[i]));
                if (sum >= mod) sum -= mod;
            }
            ans2 = (ll)ans2 * sum % mod * fpow(siz_e[i], mod - 2) % mod;
        } else {
			ans3 = (ll)ans3 * C(siz_e[i] + col - 1, col - 1) % mod;
		//	printf("%d %d %d\n", siz_e[i], col, C(siz_e[i] + col - 1, col - 1));
		}
	}
	
    printf("%lld\n", (ll)ans1 * ans2 % mod * ans3 % mod);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

int main(){
  int N,Q,com,A,B;
  string S;
  vector<set<int>> ST(26);
  cin >> N >> S >> Q ;
  rep(i,N){
    int X=S[i]-'a';
    ST[X].insert(i);
  }
  rep(i,Q){
    cin >> com ;
    if(com==1){
      char C;
      cin >> A >>C;
      A--;
      int X=C-'a';
      int Y=S[A]-'a';
      ST[Y].erase(A);
      ST[X].insert(A);
      S[A]=C;
    }
    else{
      cin >> A >> B;
      A--;B--;
      int Z=0;
      rep(i,26){
        if(ST[i].lower_bound(A)!=ST[i].upper_bound(B)){
          Z++;
        }
      }
      cout << Z << endl;
    }
  }
}

Measured memory_bytes: 27228