akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class itr, class itr2> bool next_sequence2(itr first, itr last, itr2 first2, itr2 last2){ itr now = last; itr2 now2 = last2; while(now != first){ now--, now2--; (*now)++; if((*now) == (*now2)){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    lint A, B;
    cin >> A >> B;
    cout << A * B / gcd(A, B) << endl;
}




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

int main(){
	/*input*/
	int n, k;	cin >> n >> k;
	vector<int>a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	/*calculation*/
	int ans = 0;
	int len = n;
	len -= k;
	ans++;
	if(len%(k - 1)){
		ans += len/(k - 1);
		ans++;
	}else{
		ans += len/(k - 1);
	}
	/*output*/
	cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>
#include <map>
#include <time.h>
#include <iomanip>
#include <bitset>

using namespace std;

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
    string s;
    cin >> s;
    cout << s;
    if(s[s.length() - 1] == 's') {
        cout << "es" << endl;
    }else {
        cout << 's' << endl;
    }
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef pair <int, P> PP;
typedef long double ld;

ll h, w;
ll ch, cw, dh, dw; 
vector<string> s;
vector<vector<bool>> used;
ll ans = 0;

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

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h >> w;
    cin >> ch >> cw >> dh >> dw;
    ch--; cw--; dh--; dw--;
    s.resize(h); rep (i, h) cin >> s[i];
    used.resize(h); rep (i, h) used[i].resize(w);
    priority_queue<PP, vector<PP>, greater<PP>> pq;
    pq.emplace(0, P{ch, cw});
    while (!pq.empty()) {
        auto [d, p] = pq.top(); pq.pop();
        auto [i, j] = p;
        if (used[i][j]) continue;
        if (i == dh && j == dw) {
            cout << d << "\n";
            return 0;
        }
        used[i][j] = true;
        rep (dir, 4) {
            int y = i + dy[dir], x = j + dx[dir];
            if (y < 0 || y >= h || x < 0 || x >= w) continue;
            if (!used[y][x] && s[y][x] != '#') {
                pq.emplace(d, P{y, x});
            }
        }
        rep (dyy, -2, 3) {
            rep (dxx, -2, 3) {
                if (dyy == 0 && dxx == 0) continue;
                int y = i + dyy, x = j + dxx;
                if (y < 0 || y >= h || x < 0 || x >= w) continue;
                if (!used[y][x] && s[y][x] != '#') {
                    pq.emplace(d + 1, P{y, x});
                }
            }
        }
    }
    cout << -1 << "\n";
    return 0;
}

Measured memory_bytes: 6100
#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define int long long
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r
#define intl __int128
#define pii pair<int, int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
const int mod = 1e9 + 7;
inline int ksm(int a, int b)
{
	int ans = 1;
	for (; b; b >>= 1, a = a * a % mod)
		if (b & 1)
			ans = ans * a % mod;
	return ans;
}
const int maxn = 1e6+20;
char s[maxn];
int dp[maxn][2];
signed main()
{
    //freopen("D:\\code\\text\\input.txt","r",stdin);
    //freopen("D:\\code\\text\\output.txt","w",stdout);
    s[0] = '0';
    scanf("%s", s + 1);
    int n = strlen(s + 1);
    dp[n][0] = (s[n] - '0');
    dp[n][1] = 10 - (s[n] - '0');
    for (int i = n - 1; i >= 0; --i)
    {
        dp[i][0] = min(dp[i + 1][0] + (s[i] - '0'), dp[i + 1][1] + (s[i] - '0') + 1);
        dp[i][1] = min(dp[i + 1][0] + 10 - (s[i] - '0'), dp[i + 1][1] + 10 - (s[i] - '0' + 1));
    }
    printf("%lld\n", min(dp[0][0], dp[0][1]+1));
    return 0;
}

/*

 4 6

 1  2  3   4 

*/

Measured memory_bytes: 16896
H,W,K = map(int,input().split())
c = []
for i in range(H):
    c.append(input())

import numpy as np
import copy
import itertools


M = np.zeros((H,W))
for i in range(H):
    for j in range(W):
        if c[i][j]=='.':
            M[i][j] = 0
        else:
            M[i][j] = 1

l = [0,1]

h_list = list(itertools.product(l, repeat=H))
w_list = list(itertools.product(l, repeat=W))
h_list = np.array(h_list)
w_list = np.array(w_list)

ans = 0

for item_h in h_list:
    for item_w in w_list:
        tmp = copy.deepcopy(M)
        l = np.where(item_h==1)
        for item in l:
            tmp[item,:] = 0
        l = np.where(item_w==1)
        for item in l:
            tmp[:,item] = 0
        if np.sum(tmp) == K:
            ans += 1
 
print(ans)

Measured memory_bytes: 27300
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

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;

using std::setprecision;
using std::fixed;

long long min(long long a, long long b) {return a < b ? a : b;}
long long min(int a, long long b) {return a < b ? a : b;}
long long min(long long a, int b) {return a < b ? a : b;}
long long min(int a, int b) {return a < b ? a : b;}

long long max(long long a, long long b) {return a > b ? a : b;}
long long max(int a, long long b) {return a > b ? a : b;}
long long max(long long a, int b) {return a > b ? a : b;}
long long max(int a, int b) {return a > b ? a : b;}

#define int long long

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const long long INF = 1e18;
const int N = 210110;
const int MOD = 1e9 + 7;
const double eps = 1e-8;

int n, D;
int root[N], sz[N];
long long ans = 0;
int a[N];

struct Edge{
    long long v, u, w;
};
vector<Edge> edges;
bool comp(Edge A, Edge B)
{
    return A.w < B.w;
}

int Root(int x)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x]);
}

int Merge(int v, int u)
{
    v = Root(v), u = Root(u);
    if (v == u) return 0;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
    return 1;
}

void call(int l, int r)
{
    if (l + 1 == r) return;
    int m = (l + r) / 2;
    int id1 = l, id2 = m;
    for (int i = l; i < m; i++)
    {
        if (a[i] - i * D < a[id1] - id1 * D) id1 = i;
    }
    for (int i = m; i < r; i++)
    {
        if (a[i] + i * D < a[id2] + id2 * D) id2 = i;
    }
    for (int i = l; i < r; i++)
    {
        edges.push_back({i, id1, a[i] + a[id1] + abs(id1 - i) * D});
        edges.push_back({i, id2, a[i] + a[id2] + abs(id2 - i) * D});
    }
    call(l, m);
    call(m, r);
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> D;
    for (int i = 0; i < n; i++) cin >> a[i], root[i] = i, sz[i] = 1;
    call(0, n);
    sort(all(edges), comp);
    for (auto e : edges)
    {
        ans += Merge(e.v, e.u) * e.w;
    }
    cout << ans;
}


Measured memory_bytes: 203868
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

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

    string str{"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"};
    int N;
    string S;
    cin >> N >> S;

    rep (i, S.size())
    {
        cout << str[S[i] - 'A' + N];
    }
    cout << "\n";
    return 0;
}



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

using namespace std;

#define MAX 1000000

int a[MAX],N,cnt;

void insertionSort(int g){
  for(int i = g ; i < N ; i++){
    int v = a[i] , j = i-g;
    while(j >= 0 && a[j] > v){
      a[j+g] = a[j];
      j -= g;
      cnt++;
    }
    a[j+g] = v;
  }
}

void shellSort(){
  cnt = 0;
  int G[MAX],p = 0,m;

  for(m = 1 ; m*3+1 < N ; m = m*3+1);

  for(; m > 0 ; m /= 3){
    G[p++] = m;
  }

  if(p > 100){
    p = 100;
  }

  for(int i = 0 ; i < p ; i++){
    insertionSort(G[i]);
  }

  cout << p << endl;
  for(int i = 0 ; i < p ; i++){
    if(i != p-1){
      cout << G[i] << " ";
    }else{
      cout << G[i] << endl;
    }
  }

  cout << cnt << endl;
  for(int i = 0 ; i < N ; i++){
    cout << a[i] << endl;
  }

}

int main(){
  cin >> N;
  for(int i = 0 ; i < N ; i++){
    cin >> a[i];
  }
  shellSort();

  return 0;
}

Measured memory_bytes: 5068
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define debug(x) cout << #x << " = " << x << endl
#define print(x) cout << x << endl;
ll MOD = 1000000007;

ll modPow(ll a, ll n, ll p)
{
    if (n == 1)
        return a % p;
    if (n % 2 == 1)
        return (a * modPow(a, n - 1, p)) % p;
    long long t = modPow(a, n / 2, p);
    return (t * t) % p;
}

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

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

    ll nCa = 1;
    ll nCb = 1;

    ll a_inv = 1;
    ll b_inv = 1;
    for (ll i = 0; i < a; i++)
    {
        nCa = (nCa * (n - i)) % MOD;
        a_inv = (a_inv * (i + 1)) % MOD;
    }

    for (ll i = 0; i < b; i++)
    {
        nCb = (nCb * (n - i)) % MOD;
        b_inv = (b_inv * (i + 1)) % MOD;
    }

    nCa = (nCa * modInv(a_inv, MOD)) % MOD;
    nCb = (nCb * modInv(b_inv, MOD)) % MOD;

    ll ans = (modPow(2, n, MOD) - 1 - nCa - nCb) % MOD;
    if (ans < 0)
    {
        ans += MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import Data.List

f :: Int -> Int -> Int-> Int
f a b c = ff 0 (y-x) (z-x) 
  where [x,y,z] = sort [a,b,c]

ff ::Int -> Int -> Int-> Int
ff a b c
  | length odds == 1 = 1 + ff x y z
  | length odds == 2 = 2 + ff x y z
  | otherwise        = (c - a + c - b) `div` 2
  where xs             = [a,b,c]
        (odds , evens) = partition odd xs
        [x,y,z] = sort $ map (subtract 1) odds ++ evens

main = do
   [a,b,c] <- map read . words <$> getLine
   print $ f a b c

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

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int[,] card = new int[3, 3];

            for (int i = 0; i < 3; i++)
            {
                int c = 0;
                foreach (var v in Console.ReadLine().Split(' '))
                    card[i, c++] = int.Parse(v);
            }

            int N = int.Parse(Console.ReadLine());
            for (int i = 0; i < N; i++)
            {
                Bingo(card, int.Parse(Console.ReadLine()));
            }

            Check(card);
        }

        private static void Bingo(int[,] card, int num)
        {
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    if (card[i, j] == num)
                        card[i, j] = -0;
                }
            }
        }

        private static void Check(int[,] card)
        {
            int sum3 = 0;
            int sum4 = 0;

            for (int i = 0; i < 3; i++)
            {
                int sum = 0;
                int sum2 = 0;

                for (int j = 0; j < 3; j++)
                {
                    sum += card[i, j];
                    sum2 += card[j, i];
                }

                if (sum == 0 || sum2 == 0)
                {
                    Console.WriteLine("Yes");
                    return;
                }

                sum3 += card[i, i];
                sum4 += card[i, 2 - i];
            }

            if (sum3 == 0 || sum4 == 0)
            {
                Console.WriteLine("Yes");
                return;
            }

            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 17800
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>

#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

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

int main(void) {

  long double r;
  cin >> r;

  cout << 2.0 * r * 3.14159265 << endl;
}


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

class Program
{
    public static void Main()
    {
        var mod = 1000000007;
        var ab = Console.ReadLine().Split(' ').Select(x => Decimal.Parse(x)).ToArray();
        var ans = (long)(ab[0] * ab[1]);
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 28188
#include<cstdio>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#define re(i,a,b) for(int i=a;i<=b;i++)
#define _re(i,a,b) for(int i=a;i>=b;i--)
#define for_edge(x) for(int i=head[x];i;i=e[i].nxt)
#define ll long long
#define maxn 100005
#define inf 1e9
using namespace std;
inline int read(){char c = getchar();int ans = 0,f=1;while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9'){ans = ans*10 + c - '0';c = getchar();}return f*ans;}
//____________________________________________________________________________________________________________________________________________________________________
struct edge
{
	int nxt,to;
	edge(int nxt=0,int to=0)
	:nxt(nxt),to(to){};
}e[maxn*2];
int n,head[maxn],TOT,rd[maxn],dp[maxn];
inline void add(int x,int y)
{
	rd[y]++;
	e[++TOT] = edge( head[x],y );
	head[x] = TOT;
}
int ans;
void dfs(int x,int fa)
{
	int cnt= 0;
	for_edge(x)
	{
		int y = e[i].to ;
		if(y==fa) continue;
		dfs(y,x);
		if(!dp[y])
			cnt++;
		dp[x] += dp[y];
	}
	if(cnt)
		dp[x] += cnt-1;
}
int main()
{
	n = read();
	re(i,1,n-1)
	{
		int x = read() , y=read();
		add(x,y);add(y,x);
	}
	int root = -1 ;
	re(i,0,n-1)
		if(rd[i]>2)
			root = i;
			
//	printf("%d\n",root);
	if(root==-1)
		printf("1\n");
	else
	{
		//printf("%d\n",root);
		dfs(root,-1);
		printf("%d\n",dp[root]);
	}
	return 0;
}

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

#define loop(i,n) for(int i=1;i<=n;i++)
bool shoutai[502];
bool tomo[502][502];

int solve(){
	int n, m, a, b;
	cin >> n >> m;
	if (n == 0)return 0;
	loop(i, n){
		shoutai[i] = 0;
		loop(j, n)tomo[i][j] = 0;
	}
	loop(i, m){
		cin >> a >> b;
		tomo[a][b] = tomo[b][a] = 1;
	}
	loop(i, n){
		if (tomo[1][i]){
			shoutai[i] = 1;
			loop(j, n){
				if (tomo[i][j]){
					shoutai[j] = 1;
				}
			}
		}
	}
	shoutai[1] = 0;
	int count = 0;
	loop(i, n)count += shoutai[i];
	cout << count << endl;
	return 1;
}

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

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;
const ll mod=1000000007;

int main(){
  int n,k,r,s,p; cin>>n>>k>>r>>s>>p;
  string t; cin>>t;
  int id=0;
  ll ans=0;
  vector<bool> f(n,0);
  rep(i,n){
    if(i<k){
      if(t[i]=='r'){
        ans+=p;
        f[i]=1;
      }
      else if(t[i]=='s'){
        ans+=r;
        f[i]=1;
      }
      else{
        ans+=s;
        f[i]=1;
      }
    }else{
      if(t[i]=='r'){
        if(t[id]!='r'){
          ans+=p;
          f[i]=1;
        }
        else if(t[id]=='r'&&!(f[id])){
          ans+=p;
          f[i]=1;
        }
      }
      else if(t[i]=='s'){
        if(t[id]!='s'){
          ans+=r;
          f[i]=1;
        }
        else if(t[id]=='s'&&!(f[id])){
          ans+=r;
          f[i]=1;
        }
      }
      else{
        if(t[id]!='p'){
          ans+=s;
          f[i]=1;
        }
        else if(t[id]=='p'&&!(f[id])){
          f[i]=1;
          ans+=s;
        }
      }
      id++;
    }
  }
  cout<<ans<<endl;

  return 0;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> data(H, vector<char>(W));
  for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) cin >> data.at(i).at(j);
  vector<int> dx = {1,0,0,-1};
  vector<int> dy = {0,1,-1,0};
  bool answer = true;
  for (int p = 0; p < H; p++) {
    for (int q = 0; q < W; q++) {
      if (data.at(p).at(q) == '.') continue;
      else {
        bool can = false;
        for (int i = 0; i < 4; i++) {
          int x = p + dx.at(i);
          int y = q + dy.at(i);
          if (x < 0 || x >= H) continue;
          if (y < 0 || y >= W) continue;
          if (data.at(x).at(y) == '#') can = true;
        }
        if (can == false) {
          answer = false;
          break;
        }
      }
    }
    if (answer == false) break;
  }
  if (answer) cout << "Yes" << endl;
  else cout << "No" << endl;
}

        

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	num := 1
	ans := 0
	for i := 0; i < n; i++ {
		if a[i] == num {
			num++ // 次の数字の探索に移る
		} else {
			ans++ // 砕く
		}
	}
	if num == 1 {
		ans = -1
	}
	fmt.Println(ans)
}


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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;
ll gcd(ll a, ll b)
{
    return (b ? gcd(b, a % b) : a);
}
int main()
{
    speed;
    cout << fixed << setprecision(10);
    /*start*/
    ll n;
    cin >> n;
    ll ans = 0;
    if (n % 2 == 1)
    {
        ans = n * (n / 2);
    }
    else
    {
        ans = n * (n / 2 - 1) + n / 2;
    }
    c(ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<complex>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int main() {
    string w; cin >> w;
    rep(i, w.size()) w[i] = toupper(w[i]);
    string text;
    int c = 0;
    while (cin >> text && text != "END_OF_TEXT") {
        rep(i, text.size()) text[i] = toupper(text[i]);
        if (text == w) {c++; /*cout << text << endl;*/}
    }
    cout << c << endl;
}



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

int main() {
	string s, t; cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());
	if(s<t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


int main() {
	int a, b, k;
	cin >> a >> b >> k;
	vector<int> vec;

	if (b > a) swap(a, b);
	rep(i, a) {
		if (a%(i+1)==0 and b%(i+1)==0) vec.push_back(i+1);
	}
	sort(vec.begin(), vec.end(), greater<int>());
	cout << vec.at(k-1) << endl;
}

Measured memory_bytes: 256
//B.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

ll modpow(ll a, ll n, ll mod){
  ll res = 1;
  while(n > 0){
    if(n & 1) res = res*a%mod;
    a = a*a%mod;
    n >>= 1;
  }
  return res;
}

ll moddiv(ll a, ll mod){
  return modpow(a,mod-2,mod);
}

ll a[200001];
ll b[200001];
int main(){
  ll n,k;
  cin >> n >> k;
  a[0] = 0;
  for(int i = 1; i <=n; i++){
    a[i] = a[i-1]+i;
    // printf("%lld\n", a[i]);
  }
  b[0] = n;
  for(int i = 1; i <= n; i++){
    b[i] = b[i-1] + n -i;
    // printf("%lld\n", b[i]);
  }
  ll ans = 0;
  for(int i = k; i <= n; i++){
    ans += b[i-1]-a[i-1] + 1;
    // printf("%lld %lld\n", b[i-1], a[i-1]);
    ans %= mod;
  }
  ans += 1;
  ans %= mod;
  printf("%lld\n", ans);
  return 0;
}


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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SORT(v, n) sort(v, v+n);
#define SSORT(v, n) sort(v, v+n, greater<int>())

int main(){
	int n,m,l;
	cin >> n;
	int a[n];
	REP(i,n) cin >> a[i];
	m = l = n-1;
	while(m>0){
		SSORT(a,n);
		REP(i,m){
			a[i] = a[i] % a[m];
			if(a[i]==0) l--;
		}
		m=l;
	}
	SSORT(a,n);
	cout << a[0] << endl;


}

Measured memory_bytes: 640
def main():
  n=int(input())
  w=[]
  for _ in range(n):
    w.append(input())
  if len(set(w))!=n:
    print("No")
    return
  for i in range(n-1):
    if w[i][-1]!=w[i+1][0]:
      print("No")
      return
  print("Yes")
    
main()

Measured memory_bytes: 3060
import bisect,collections,copy,itertools,math,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
X = I()
_500 = X//500
_nokori = (X%500)//5
print(_500*1000+_nokori*5)


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

constexpr ll mod = 1e9 + 7;
unordered_map<string, ll> dp[105];

bool CanConcatinate(const string& s, char c) {
  if (s.size() < 2) return true;
  if (s.size() == 2) {
    if (s == "AG" && c == 'C') return false;
    if (s == "GA" && c == 'C') return false;
    if (s == "AC" && c == 'G') return false;
    return true; 
  } else if (s.size() == 3) {
    if (s[0] == 'A' && s[2] == 'G'&& c == 'C') return false;
    if (s[0] == 'A' && s[1] == 'G'&& c == 'C') return false;
    return CanConcatinate(s.substr(1), c);
  } else {
    return CanConcatinate(s.substr(1), c);
  }
}

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

  int n;
  cin >> n;
  dp[0]["A"] = 1;
  dp[0]["C"] = 1;
  dp[0]["G"] = 1;
  dp[0]["T"] = 1;
  rep(i, n-1) {
    for(auto& e : dp[i]) {
      const char *next_ch = "AGCT";
      rep(j, 4) {
        if (CanConcatinate(e.first, next_ch[j])) {
          string s = e.first + next_ch[j];
          if (s.size() > 4) s = s.substr(1);
          dp[i+1][s] += e.second;
          dp[i+1][s] %= mod; 
        }
      }
    }
  }
  ll ans = 0;
  for (auto& e : dp[n-1]) {
    ans += e.second;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2688
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	array<int, 3> a = { 0, 0, 0 };
	for(int i = 0; i < n; ++i){
		int t;
		cin >> t;
		++a[t % 3];
	}
	if(a[1] == 0 && a[2] == 0){
		cout << 1 << endl;
		return 0;
	}
	int answer = 0;
	if(a[1] >= 1){
		auto b = a;
		int local = 1, c = 1;
		--b[1];
		while(c != 0){
			if(b[0] > 0){
				--b[0];
				++local;
			}else if(c == 1 && b[1] > 0){
				--b[1];
				++local;
				c = 2;
			}else if(c == 2 && b[2] > 0){
				--b[2];
				++local;
				c = 1;
			}else if(c == 1 && b[2] > 0){
				--b[2];
				++local;
				c = 0;
			}else if(c == 2 && b[1] > 0){
				--b[1];
				++local;
				c = 0;
			}else{
				break;
			}
		}
		answer = max(answer, local);
	}
	if(a[1] >= 2){
		auto b = a;
		int local = 2, c = 2;
		--b[1]; --b[1];
		while(c != 0){
			if(b[0] > 0){
				--b[0];
				++local;
			}else if(c == 1 && b[1] > 0){
				--b[1];
				++local;
				c = 2;
			}else if(c == 2 && b[2] > 0){
				--b[2];
				++local;
				c = 1;
			}else if(c == 1 && b[2] > 0){
				--b[2];
				++local;
				c = 0;
			}else if(c == 2 && b[1] > 0){
				--b[1];
				++local;
				c = 0;
			}else{
				break;
			}
		}
		answer = max(answer, local);
	}
	if(a[2] >= 1){
		auto b = a;
		int local = 1, c = 2;
		--b[2];
		while(c != 0){
			if(b[0] > 0){
				--b[0];
				++local;
			}else if(c == 1 && b[1] > 0){
				--b[1];
				++local;
				c = 2;
			}else if(c == 2 && b[2] > 0){
				--b[2];
				++local;
				c = 1;
			}else if(c == 1 && b[2] > 0){
				--b[2];
				++local;
				c = 0;
			}else if(c == 2 && b[1] > 0){
				--b[1];
				++local;
				c = 0;
			}else{
				break;
			}
		}
		answer = max(answer, local);
	}
	if(a[2] >= 2){
		auto b = a;
		int local = 2, c = 1;
		--b[2]; --b[2];
		while(c != 0){
			if(b[0] > 0){
				--b[0];
				++local;
			}else if(c == 1 && b[1] > 0){
				--b[1];
				++local;
				c = 2;
			}else if(c == 2 && b[2] > 0){
				--b[2];
				++local;
				c = 1;
			}else if(c == 1 && b[2] > 0){
				--b[2];
				++local;
				c = 0;
			}else if(c == 2 && b[1] > 0){
				--b[1];
				++local;
				c = 0;
			}else{
				break;
			}
		}
		answer = max(answer, local);
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 3216
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto s = readln.chomp.to!int;
  int an = s;
  int[int] cnt;

  foreach (i; 2..1_000_001) {
    cnt[an]++;
    int am;
    if (an % 2) {
      am = 3 * an + 1;
    } else {
      am = an / 2;
    }
    if (cnt.get(am, 0)) {
      writeln(i);
      break;
    } else {
      an = am;
    }
  }
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Util{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
        int N = ri();

        List<string> ss = new List<string>();
        for(int i = 0; i < N; i++) ss.Add(rs());
        // int ACcnt = 0;
        // int WAcnt = 0;
        // int TLEcnt = 0;
        // int REcnt = 0;
        Dictionary<string, int> dic = new Dictionary<string, int>() {
            {"AC", 0},
            {"WA", 0},
            {"TLE", 0},
            {"RE", 0},
        };
        
        foreach(string s in ss) dic[s]++;

        string ans = "";

        foreach(string key in dic.Keys) ans += key + " x " + dic[key] + "\r\n";

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

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 32868
a,b = map(int, input().split())

import math

if a % 2 == 1:
  ax = a
  an = a+1
else:
  ax = 0
  an = a

if b % 2 == 1:
  bx = 0
  bn = b
else:
  bx = b
  bn = b-1

tmp = ax ^ bx
if ((bn - an + 1) // 2) % 2 == 1:
  ans = tmp ^ 1
else:
  ans = tmp
  
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main()
{
    char S[16];
    scanf("%s",&S);
    int i, ocounter=0,k=0;
    for(i=0;i<16;i++)
    {
        if(S[i]=='o'||S[i]=='x') k++;
        if(S[i]=='o') ocounter++;
    }
    if(ocounter+15-k>=8) printf("YES");
    else printf("NO");
    //printf("%d %d",k,ocounter);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define clr(x) memset(x, 0, sizeof(x))
#define sz(x) (int)x.size()

using namespace std;

typedef long long ll;
typedef pair<long , long> pll;

const ll mx = 105;
const ll maxn = 1000001;
const ll mod = 1000000007;

vector<vector<int>> adj;
vector<int> res;
vector<int> ord;

int main(){

   ios_base::sync_with_stdio(false);
   cin.tie(0);
   
   ll n, m, i, j, k, l, res = 0;

   cin>>k;

   for(i = 1;i <= k;i++){

       for(j = 1;j <= k;j++){
           for(l = 1;l <= k;l++){
                
                res += __gcd(i, __gcd(j, l));
           }
       }

   }
   cout<<res<<"\n";
}




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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main(){
    gearup;
    ll n,k;cin>>n>>k;
    ll r,s,p;cin>>r>>s>>p;
    string t;cin>>t;

    vc c(n);
    ll res = 0;
    rep(i,n){
        if(t[i] == 'r'){
            if(i-k<0){
                res += p;
                c[i] = 'p';
            }
            else{
                if(c[i-k] == 'p'){
                    c[i] = 'm';
                }
                else{
                    res += p;
                    c[i] = 'p';
                }
            }
        }
        else if(t[i] == 's'){
            if(i-k<0){
                res += r;
                c[i] = 'r';
            }
            else{
                if(c[i-k] == 'r'){
                    c[i] = 'm';
                }
                else{
                    res += r;
                    c[i] = 'r';
                }
            }
        }
        else{
            if(i-k<0){
                res += s;
                c[i] = 's';
            }
            else{
                if(c[i-k] == 's'){
                    c[i] = 'm';
                }
                else{
                    res += s;
                    c[i] = 's';
                }
            }
        }
    }
    out(res);
}

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

int main() {
  int n;
  cin >> n;
  vector<int>a(n);
  ll sum = 0;
  rep(i,0,n) cin >> a[i];
  int v = a[0];
  rep(i,1,n){
    if(v > a[i]) sum += v-a[i];
    else v = a[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 4052
//#define _GLIBCXX_DEBUG
//#include <atcoder/all>
#include <bits/stdc++.h>


using namespace std;
//using namespace atcoder;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);
int dx[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 1, 0, -1, 1, -1, -1, 1, 0};

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



int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  ll D; cin>>D;
  rep(i,D){
    cout<<i%26+1<<'\n';
  }
  return 0;
}


Measured memory_bytes: 3660
n = int(input())
h = [int(i) for i in input().split()]
c = 0
m = 0
for i in range(n-1):
	if h[i] >= h[i+1]:
		if i == n - 1:
			c += 2
		else:
			c += 1
		m = max(c,m)
	else:
		c = 0
print(m)

Measured memory_bytes: 14252
N = int(input())
H = list(map(int,input().split()))

if N == 1:
    print("Yes")
    exit(0)

now = 0
for k in range(N):
    if H[k] == now:
        pass
    elif H[k] == now + 1:
        pass
    elif H[k] >= now + 2:
        now = H[k]-1
    elif H[k] < now:
        print("No")
        exit(0)

print("Yes")


Measured memory_bytes: 14228
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;

int main()
{
    char c;
    cin >> c;
    char ans[100];
    if(c=='a' || c=='i' || c=='u' || c=='e' || c=='o'){
        strcpy(ans, "vowel");
    }else{
        strcpy(ans, "consonant");
    }
    cout << ans << endl;
    return 0;
}


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

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

int input[52],n,summ;
int ans[52];
int used[52];
int cnt[14];

bool dfs(int cc,int sum) {
    if(cc == n) return true;
    rep(i,14) {
        if(cnt[i] == 0) continue;
        if((sum-i)%i == 0) {
            cnt[i]--;
            ans[cc] = i;
            if(dfs(cc+1,sum-i)) return true;
            ans[cc] = -1;
            cnt[i]++;
        }
    }
    return false;
}

int main() {
    while(cin>>n, n) {
        summ = 0;
        memset(ans, 0, sizeof(ans));
        memset(cnt, 0, sizeof(cnt));
        memset(used, -1, sizeof(used));
        rep(i,n) {
            cin>>input[i];
            summ += input[i];
            cnt[input[i]]++;
        }
        rep(i,52) used[i] = -1;

        if(dfs(0,summ)) {
            reverse(ans, ans+n);
            rep(i,n-1) cout<<ans[i]<<" ";
            cout<<ans[n-1]<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
}

Measured memory_bytes: 868
#include<stdio.h>
 
int main(){
	int a,b;
	
    scanf("%d%d",&a,&b);
	if(a%2 !=0 && b%2 !=0)
    {
		printf("Yes");
	}
  	else
    {
		printf("No");
	}
	
	return 0;
}

Measured memory_bytes: 128
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n, m;
vector<int> a, b;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    cout<<max(n-m,ll(0))<<"\n";
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,m,s0 = map(int,input().split())
s0 = min(2500,s0)
G = [[] for i in range(n)]
for i in range(m):
  u,v,a,b = map(int,input().split())
  u-=1;v-=1
  G[u].append((v,-a,b))
  G[v].append((u,-a,b))
for i in range(n):
  c,d = map(int,input().split())
  G[i].append((i,c,d))

def ceil(x,y):
  return (x-1)//y+1


def dijktra(g,s):
    n=len(g)
    dist = [[inf]*2501 for i in range(n)]
    dist[s][s0] = 0
    hq=[]
    heapq.heappush(hq,(0,s0,s))
    while hq:
        time,money,u = heapq.heappop(hq)
        if dist[u][money] < time: continue
        for v,money1,time1 in g[u]:
          M = min(2500,money+money1)
          if not M >= 0: continue
          if dist[v][M] > time + time1:
            dist[v][M] = (time + time1)
            heapq.heappush(hq,(time + time1, M,v))
    return dist

dist = dijktra(G,0)
# print(dist)
for i in range(1,n):
  print(min(dist[i]))





Measured memory_bytes: 97092
#include <iostream>
#include <vector>

using namespace std;

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

int N;
VI TABLE;
int pena;

void solve(VI table)
{
	if(pena == 0) return;  
	bool change = false;
	REP(y, 5)
	{
		REP(x, 4)
		{
			int idx1 = y * 4 + x;
			if(idx1 >= table.size()) continue;

			for(int dy=-1; dy<=1; dy++)
			{
				for(int dx=-1; dx<=1; dx++)
				{
					if(dx==0 && dy==0) continue;
					int xx = x + dx;
					int yy = y + dy;
					int idx2 = yy * 4 + xx;
					if(xx>=0 && yy>=0 && xx<4 && yy<5 && idx2<table.size())
					{
						if(table[idx1] == table[idx2])
						{
							VI new_table = VI(table.size());
							std::copy(table.begin(), table.end(), new_table.begin());
							new_table.erase(new_table.begin() + max(idx1, idx2));
							new_table.erase(new_table.begin() + min(idx1, idx2));
							solve(new_table);
							change = true;
						}
					}
				}
			}
		}
	}

	if(!change)
	{
		if(pena > table.size())
		{
			pena = table.size();
		}
	}
}

int main()
{
	cin >> N;
	REP(t, N)
	{
		TABLE = VI(20);
		REP(i, 20)
			cin >> TABLE[i];

		pena = 21;
		solve(TABLE);
		cout << pena << endl;
	}

}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  dump(a.back() == b.front() && b.back() == c.front() ? "YES" : "NO");
  return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()
ans = 0
for i in range(1,len(S)):
    X = S[:i]
    Y = S[i:]
    dic = {}
    for j in X:
        if( (j in Y) == True):
            dic[j] = 0
        ans = max(ans,len(dic))
print(ans)

Measured memory_bytes: 39152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[4];
		String numStr = sc.next();

		String s = "Good";
		for (int i = 0; i < 3; i++) {
			if (numStr.charAt(i) == numStr.charAt(i + 1)) {
				s = "Bad";
				break;
			}
		}
		System.out.println(s);

	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define reps(i, n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define repi(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
int root(int x,vector<int> &data){
    return (data[x] < 0)? x : data[x]=root(data[x],data);
}

bool unite(int x, int y,vector<int> &data){
    x=root(x,data);
    y=root(y,data);
    if( x != y ){
        if( data[y] < data[x] ) swap(x, y);
        data[x] += data[y];
        data[y] = x;
    }
    return x!=y;
}

bool find(int x, int y,vector<int> &data){
    return root(x,data) == root(y,data);
}

int size(int x,vector<int> &data){
    return -data[ root(x,data) ];
}

int main(){
    int n,k,l;
    cin>>n>>k>>l;
    
    vector<int> douro(n,-1),tetsudou(n,-1);
    rep(i,k){
        int p,q;
        cin>>p>>q;
        p--;q--;
        unite(p,q,douro);
    }
    rep(i,l){
        int r,s;
        cin>>r>>s;
        r--;s--;
        unite(r,s,tetsudou);
    }
    
    map<pair<int,int>,int> ans;
    rep(i,n) ans[make_pair(root(i,douro),root(i,tetsudou))]++;
    rep(i,n){
        cout<<ans[make_pair(root(i,douro),root(i,tetsudou))];
        if(i==n-1) cout<<endl;
        else cout<<" ";
    }
}


Measured memory_bytes: 13568
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
ll mod=(ll)(1000000007),p8[1000000],p9[1000000],p10[1000000];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	p8[0]=p9[0]=p10[0]=1;
	for(int i=1;i<=n;i++){
		p8[i]=8*p8[i-1];
		p9[i]=9*p9[i-1];
		p10[i]=10*p10[i-1];
		p8[i]%=mod;
		p9[i]%=mod;
		p10[i]%=mod;
	}
	cout<<(p10[n]+mod-p9[n]-p9[n]+p8[n]+mod)%mod;
	return 0;
}

Measured memory_bytes: 26956