akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <vector>
using namespace std;
vector<vector<int>> G;
int n, m;
int dist[100000];
int q[100000], head, tail;
void bfs(int st) {
	for (int i = 0; i < n; i++) {
		dist[i] = -1;
	}
	dist[st] = 0;
	head = tail = 0;
	q[tail] = st;
	tail++;
	while (head != tail) {
		// q[head] -> no ?
		for (int i = 0; G[q[head]][i] != -1; i++) {
			int no = G[q[head]][i];
			if (0 <= no && no < n && dist[no] == -1) {
				dist[no] = dist[q[head]] + 1;
				q[tail] = no;
				tail++;
			}
		}
		head++;
	}
}
int min(int x, int y) {
	return x < y ? x : y;
}
int main() {
	scanf("%d%d", &n, &m);
	G.resize(n);
	for (int i = 0; i < m; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	for (int i = 0; i < n; i++) {
		G[i].push_back(-1);
	}
	bfs(0);
	bool canReach = true;
	for (int i = 0; i < n; i++) {
		if (dist[i] == -1) {
			canReach = false;
			break;
		}
	}
	if (canReach) {
		printf("Yes\n");
		for (int i = 1; i < n; i++) {
			for (int j = 0; G[i][j] != -1; j++) {
				if (dist[G[i][j]] - dist[i] == -1) {
					printf("%d\n", G[i][j] + 1);
					break;
				}
			}
		}
	} else {
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 10392
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

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

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			n = scanner.nextInt();
			if (n == 0)
				return;
			strs = new String[n];
			for (int i = 0; i < n; i++) {
				strs[i] = scanner.next();
			}
			System.out.println(solve() ? "OK" : "NG");
		}
	}

	private boolean solve() {
		int[] in = new int[26], out = new int[26];
		UnionFind unionFind = new UnionFind(26);
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			int from = (int) (strs[i].charAt(0) - 'a');
			int to = (int) (strs[i].charAt(strs[i].length() - 1) - 'a');
			in[from]++;
			out[to]++;
			list.add(from);
			unionFind.merge(to, from);
		}
		for (int i = 0; i < 26; i++) {
			if (in[i] != out[i]) {
				return false;
			}
		}
		for (int i = 1; i < list.size(); i++) {
			if (!unionFind.isSame(list.get(0), list.get(i))) {
				return false;
			}
		}

		return true;
	}

	int n;
	String[] strs;

	class UnionFind {
		int[] pars;
		int[] rank;

		@Override
		public String toString() {
			return "UnionFind [pars=" + Arrays.toString(pars) + ", rank="
					+ Arrays.toString(rank) + "]";
		}

		UnionFind(int size) {
			pars = new int[size];
			rank = new int[size];
			for (int i = 0; i < size; i++)
				pars[i] = i;
		}

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

		boolean isSame(int x, int y) {
			return root(x) == root(y);
		}

		void merge(int x, int y) {
			x = root(x);
			y = root(y);
			if (x == y)
				return;
			if (rank[x] > rank[y])
				pars[y] = x;
			else {
				pars[x] = y;
				if (rank[x] == rank[y])
					rank[y]++;
			}
		}
	}
}

Measured memory_bytes: 49116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
static const int dx[4] = { 0, 1, 0, -1 };
static const int dy[4] = { 1, 0, -1, 0 };
static const char dir[4] = { 'u', 'r', 'd', 'l' };
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;
ll N, H;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> H;
    ll maxa = 0, cnt = 0;
    vector<ll> a(N), b(N);
    rep(i, N)
    {
        cin >> a[i] >> b[i];
        maxa = max(maxa, a[i]);
    }
    sort(b.begin(), b.end(), greater<ll>());
    rep(i, N)
    {
        if (b[i] > maxa) {
            H -= b[i];
            ++cnt;
            if (H <= 0) {
                cout << cnt << endl;
                return 0;
            }
        }
    }
    cnt += (H + (maxa - 1)) / maxa;
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 1792
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int h,w; cin >> h >> w;
  vector<string> g(h);
  vector<vector<int> > dp(h,vector<int>(w));
  vector<vector<int> > dp2(h,vector<int>(w));
  rep(i,h){
    cin >> g[i];
  }
  if(g[0][0]=='#') dp[0][0]=1;
  rep(j,w){
    if(j+1<w&&g[0][j]=='.'&&g[0][j+1]=='#') dp[0][j+1]=1;
  }
  rep(i,h){
    if(i+1<h&&g[i][0]=='.'&&g[i+1][0]=='#') dp[i+1][0]=1;
  }
  dp2[0][0]=dp[0][0];
  for(int j=1;j<w;j++){
    dp2[0][j]=dp[0][j]+dp2[0][j-1];
  }
  for(int i=1;i<h;i++){
    dp2[i][0]=dp[i][0]+dp2[i-1][0];
  }
  for(int i=1;i<h;i++){
    for(int j=1;j<w;j++){
      int a=dp2[i][j-1];
      if(g[i][j-1]=='.'&&g[i][j]=='#') a++;
      int b=dp2[i-1][j];
      if(g[i-1][j]=='.'&&g[i][j]=='#') b++;
      dp2[i][j]=min(a,b);
    }
  }
  /*
  rep(i,h){
    rep(j,w){
      cout << dp[i][j];
    }cout << endl;
  }
  cout << endl;
  rep(i,h){
    rep(j,w){
      cout << dp2[i][j];
    }cout << endl;
  }
  cout << endl;
  */
  cout << dp2[h-1][w-1] << endl;
}

Measured memory_bytes: 384
# -*- Coding: utf-8 -*-

n=int(input())
s=input()

def _rot13(c):
    if 'A' <= c and c <= 'Z':
        # 13 文字分ずらす
        return chr((ord(c) - ord('A') + n) % 26 + ord('A'))

    if 'a' <= c and c <= 'z':
        # 13 文字分ずらす
        return chr((ord(c) - ord('a') + n) % 26 + ord('a'))

    # その他の文字は対象外
    return c


def rot13(ss):
    # ジェネレータ内包表記で文字列に ROT13 を適用する
    g = (_rot13(c) for c in ss)
    # 文字列に直す
    return ''.join(g)


print(rot13(s))

Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[m];
        int[] b = new int[m];
        ArrayList<Integer>[] friends = new ArrayList[n];
        ArrayList<Integer>[] blocks = new ArrayList[n];
        for (int i = 0 ; i < n ; i++) {
            friends[i] = new ArrayList<>();
            blocks[i] = new ArrayList<>();
        }
        for (int i = 0 ; i < m ; i++) {
            a[i] = sc.nextInt() - 1;
            b[i] = sc.nextInt() - 1;
            friends[a[i]].add(b[i]);
            friends[b[i]].add(a[i]);
        }
        int[] c = new int[k];
        int[] d = new int[k];
        for (int i = 0 ; i < k ; i++) {
            c[i] = sc.nextInt() - 1;
            d[i] = sc.nextInt() - 1;
            blocks[c[i]].add(d[i]);
            blocks[d[i]].add(c[i]);
        }
        Unionfind uf = new Unionfind(n);
        for (int i = 0 ; i < m ; i++) {
            uf.union(a[i], b[i]);
        }

        for (int i = 0 ; i < n ; i++) {
            int ans = uf.size(i);
            ans -= friends[i].size() + 1;
            for (int x : blocks[i]) {
                if (uf.same(x, i)) {
                    ans--;
                }
            }
            System.out.print(ans);
            if (i != n - 1) {
                System.out.print(" ");
            } else {
                System.out.print("\n");
            }
        }
    }

}

class Unionfind {
    ArrayList<Integer> parent;

    public Unionfind(int n) {
        parent = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            parent.add(-1);
        }
    }

    public boolean union(int x, int y) {
        x = findRoot(x);
        y = findRoot(y);
        if (x == y) {
            return false;
        }

        if (size(x) < size(y)) {
            int temp = x;
            x = y;
            y = temp;
        }

        parent.set(x, parent.get(x) + parent.get(y));
        parent.set(y, x);
        return true;
    }

    public int findRoot(int i) {
        if (parent.get(i) < 0) {
            return i;
        } else {
            int root = findRoot(parent.get(i));
            parent.set(i, root);
            return root;
        }
    }

    public int size(int x) {
        return -parent.get(findRoot(x));
    }

    public boolean same(int x, int y) {
        return findRoot(x) == findRoot(y);
    }
}

Measured memory_bytes: 177068
#include<iostream>
#include<cassert>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	int N;
	string S;
	cin >> N >> S;
	int r = 0, g = 0, b = 0;
	for (auto i : S) {
		if (i == 'R')r++;
		else if (i == 'G')g++;
		else b++;
	}
	int num = 0;
	for (int haba = 1; haba <= N / 2; haba++) {
		int one = 0, two = one + haba, three = two + haba;
		while (1) {
			if (three >= N)break;
			if (S[one] != S[two] && S[one] != S[three] && S[two] != S[three])num++;
			one++; two++; three++;
		}
	}
	num += r * (r - 1) * (r - 2) / 3 / 2;
	num += g * (g - 1) * (g - 2) / 3 / 2;
	num += b * (b - 1) * (b - 2) / 3 / 2;
	num += r * (r - 1) / 2 * g;
	num += g * (g - 1) / 2 * r;
	num += r * (r - 1) / 2 * b;
	num += b * (b - 1) / 2 * r;
	num += g * (g - 1) / 2 * b;
	num += b * (b - 1) / 2 * g;

	int ans = N * (N - 1) * (N - 2) / 3 / 2;
	ans -= num;
	cout << ans;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    string S = in<string>();
    bool early = 0;
    if(S[5] != '1' && S[6] <= '4'){
        early = 1;
    }
    cout <<( early ? "Heisei" : "TBD")<< "\n";
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {

        solve();
    }

    private static void solve() {

        String s1 = scanner.next();
        String s2 = scanner.next();


        System.out.println(s2.startsWith(s1) && s2.length() == s1.length() + 1 ? "Yes" : "No");

    }
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

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

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

  vector<ll> sum(n + 1, 0);
  rep(i, n) sum[i + 1] = a[i] + sum[i];

  ll ans = 0;
  map<int, int> cnt;
  rep(i, n + 1) {
    if (i >= k) cnt[(sum[i - k] - (i - k) + k) % k]--;
    ans += cnt[(sum[i] - i + k) % k];
    cnt[(sum[i] - i + k) % k]++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 12800
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

int [] a;
int [] b;



void main() {
  int n;
  readf (" %d", &n);
  int [] a = new int[n];
  int [] b = new int[n];
  foreach (i; 0 .. n) {
    readf (" %d", &a[i]);
  }
  foreach (i; 0 .. n) {
    readf (" %d", &b[i]);
  }
  int res = 0;

  int [] c = new int[n];
  int [] d = new int[n];

  foreach (k; 0 .. 30) {
    int mask = (1 << (k + 1)) - 1;  
    foreach (i; 0 .. n) {
      c[i] = a[i] & mask;
      d[i] = b[i] & mask;
    }
    //c.sort ();
    d.sort ();
    
    auto z = d.assumeSorted;
    int u = 1 << k;
    int v = 2 * u - 1;
    auto rr = 0;
    foreach (i; 0 .. n) {
      int f = (u - c[i]) & mask;
      int g = (v - c[i]) & mask;
      auto r = (f <= g) ? 
               z.lowerBound (g + 1).length - z.lowerBound (f).length :
               n - (z.lowerBound (f).length  - z.lowerBound (g + 1).length);

      rr += r;
      }
    if ((rr & 1) != 0) {
      res += 1 << k;
    }
  }
  writeln (res);
}


Measured memory_bytes: 4220
#include<stdio.h>
int main(void)
{
	int i,j,n,m;
	char a[101][101];
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		scanf("%s",a[i]);
	}
	for(i=0;i<n;i++){
		for(j=0;j<2;j++){
			printf("%s",a[i]);
			printf("\n");
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#define rep(i,n) for (int i = 0; i < (n);i++)
typedef long long ll;
using namespace std;
/*#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;*/


void Main()
{
    int n,k; cin>>n>>k;
    string s; cin >> s;
    int init =0;
    rep(i,n-1){
        if(s.at(i)==s.at(i+1))
            init++;
    }
    cout << min(init+2*k,n-1) << endl;
    
}

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

Measured memory_bytes: 512
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ll long long
#define ull unsigned long long
#define ii pair<ll, ll>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls signed
#define give main()
const int mod = 1000000007;
#pragma endregion

const int N = 500005;
int n, q, a, b, ans, d;
char c;
string st;
set<int> s[30];

pls give {
    AC;
    cin >> n >> st >> q;
    for (int i=0; i<n; i++) {
        s[st[i]-'a'].insert(i+1);
    }
    for (int i=0; i<q; i++) {
        cin >> a >> b;
        if (a == 1) {
            cin >> c;
            s[st[b-1]-'a'].erase(b);
            s[c-'a'].insert(b);
            st[b-1] = c;
        } else {
            cin >> d;
            ans = 0;
            for (int j=0; j<26; j++) {
                auto it = s[j].lower_bound(b);
                if (it != s[j].end() and *it <= d) ans++;
            }
            cout << ans << endl;
        }
    }
 }

Measured memory_bytes: 26384
function Main(input){
  var inp = input.split('\n');
  var N = parseInt(inp[0].trim());
  var A = inp[1].split(' ').map(n => { return parseInt(n.trim())});

  var Alice = 0;
  var Bob = 0;
  var a = A.sort((a, b) => {
    return (parseInt(a) < parseInt(b) ? -1 : 1)})
    .reverse();
  
  for(var i = 0; i < a.length; i++){
    if(i % 2 === 0){
      Alice += a[i];
    } else { 
      Bob += a[i];
    }
  }
  console.log(Alice - Bob);
  
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
s = int(input())

answer_list = []
answer_list.append(s)
count = 1
while True:
    count += 1
    next_s = 0
    if s % 2 == 0:
        next_s = s // 2
    else:
        next_s = s * 3 + 1
    s = next_s
    if s in answer_list:
        print(count)
        exit()
    answer_list.append(s)


Measured memory_bytes: 9152
import math

n, d = map(int, input().split())
x = [input().split() for _ in range(n)]
c = 0

for i in range(2 ** n):
    ans = []
    for j in range(n):
        if (i >> j) & 1:
            ans.append(x[j])
    
    if len(ans) == 2:
        u = 0
        for a, b in zip(ans[0], ans[1]):
            u += abs(int(a)-int(b)) ** 2

        if math.sqrt(u).is_integer():
            c += 1

print(c)

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

class Program {
    static void Main(string[] args) {
        long N;
        Input(out N);
        if(N % 2 == 1) {
            Console.WriteLine("0");
        } else {
            long m = 0;
            for(int i = 1; Pow(5, i) < N; i++) {
                m += N / 2 / Pow(5, i);
            }
            Console.WriteLine(m);
        }
    }
    static long Pow(long a, long b) {
        if(b == 0) {
            return 1;
        } else {
            if(b % 2 == 0) {
                return Pow(a * a, b / 2);
            } else {
                return a * Pow(a, b - 1);
            }
        }
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void InputArray<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = 2e9;
const int MAX_N = 200000;
const int MAX_M = 200000;

int N;
vi a, b;

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    int tmp; cin >> tmp;
    a.pb(tmp);
  }
  b = a;
  sort(b.begin(), b.end());
  for (int i = 0; i < N; i++) {
    if (a[i] <= b[N/2-1]) {
      cout << b[N/2] << endl;
    } else {
      cout << b[N/2-1] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 5488
def count(a):#関数「count」を定義
	count = 0
	if a<=36:
		for i in range(10):#()内は0から一つ前までの数
			for j in range(10):
				for k in range(10):
					for l in range(10):
						if i+j+k+l==a:
							count +=1
	print(count)
while True:
	try:
		a=int(input())
		count(a)
	except EOFError:
		break


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define N 100003
#define what_is(x) cerr << #x << " is " << x << endl;

using namespace std;

int main() {
	// for fast input output using cin cout
	std::ios_base::sync_with_stdio(false);

	// size of array
	// input
	int n, x;
	cin >> n;
	int ans = 0;
	int hash_arr[N] = {0};
	for (int i = 0; i < n; ++i) {
	 	cin >> x;
	 	if (x > 100000)
	 		ans++;
	 	else
	 		hash_arr[x]++;
	}

	for (int i = 0; i < N; ++i)
	{
		if (hash_arr[i] < i) {
			ans += hash_arr[i];
		}
		else
			ans += hash_arr[i] - i;
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
int main() {
  int n;
  cin >> n;
  ll ans = 0, sum;
  for (ll i = 1; i <= n; ++i) {
    for (ll j = 1; j <= n; ++j) {
      for (ll k = 1; k <= n; ++k) {
        sum = __gcd(i, j);
        sum = __gcd(sum, k);
//        cout<<i<<" "<<j<<" "<<k<<" "<<sum<<endl;
        ans += sum;
      }
    }
  }
  cout << ans;
}

Measured memory_bytes: 3596
/*
AuThOr Gwj
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
#define biggest(A,B) A=max(A,B)
#define smallest(A,B) A=min(A,B)
#define R(a) cin>>a
#define R2(a,b) cin>>a>>b
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	fastio;
	int r;
	cin>>r;
	int l=400;
	int res=8;
	rb(i,1,10){
		if(l+199>=r){
			break;
		}
		l+=200;
		res--;
	}cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 3668
#include <stdio.h>

int main(void)
{
    int a, b;
    int c, i;
    
    while(scanf("%d %d", &a, &b) != EOF)
    {
        c = a + b;
        i=0;
        while(c!=0)
        {
            c = c / 10;
            i++;
        }
        printf("%d\n", i);
    }

    return 0;

}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

#define P pair<lli,lli>

signed main(){

	lli n;
	cin>>n;

	set<string> ss;
	char before;
	REP(i,0,n){
		string s;
		cin>>s;
		if(i!=0){
			if(before != s.at(0)){
				cout<<"No"<<endl;
				return 0;
			}
		}
		before = s.at(s.size()-1);
		ss.insert(s);
	}
	if(ss.size()!=n){
		cout<<"No"<<endl;
	}
	else{
		cout<<"Yes"<<endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N; cin >> N;
  vector<string> v(2 * N);
  rep(i, 2 * N) cin >> v[i];
  rep(loop, N){
    string s,t;
    s = v[2 * loop]; t = v[2 * loop + 1];
    ll a = s.size(), b = t.size();
    vector<vector<ll> > dp(a + 1 , vector<ll>(b + 1, 0) );
    rep(i,a){
      rep(j,b){
        if(s[i] == t[j]){
          dp[i + 1][j + 1] = max(dp[i + 1][j] , max(dp[i][j + 1], dp[i][j] + 1) );
        }
        else{
          dp[i + 1][j + 1] = max(dp[i + 1][j] , dp[i][j + 1]);
        }
      }
    }
    /*
    rep(i,a + 1){
      rep(j,b + 1){
        cout << dp[i][j] << " ";
      }
      cout << endl;
    }
    */
    cout << dp[a][b] << endl;
  }
}



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

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

    double A, B, H, M;
    cin >> A >> B >> H >> M;

    double X1 = A * cos(2 * M_PI * (H * 60 + M) / (12 * 60));
    double Y1 = A * sin(2 * M_PI * (H * 60 + M) / (12 * 60));
    double X2 = B * cos(2 * M_PI * M / 60);
    double Y2 = B * sin(2 * M_PI * M / 60);

    cout << sqrt(pow(X1 - X2, 2) + pow(Y1 - Y2, 2)) << endl;

    return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
int n,m;
VI a,b;
bool check(VVI &c){
  set<int> st;
  rep(i,c.size()){
    for(int x: c[i]) st.insert(x);
  }
  return (st.size() == n);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  a.resize(m); b.resize(m);
  VVI c(m);
  rep(i,m){
    cin >> a[i] >> b[i];
    c[i].resize(b[i]);
    rep(j,b[i]){ cin >> c[i][j]; c[i][j]--;}
  }

  if(check(c) == false){
    cout << -1 << endl;
    return 0;
  }

  VVLL dp(m+10,VLL(1LL<<n,INT_MAX));
  dp[0][0] = 0;
  rep(i,m){
    rep(j,1LL<<n){
      // 買う
      int tmp = j;
      for(int x : c[i]) tmp |= 1LL<<x;
      dp[i+1][tmp] = min(dp[i+1][tmp], a[i] + dp[i][j]);

      // 買わない
      dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
    }
  }
  cout << dp[m][(1LL<<n) - 1] << endl;
  return 0;
}


Measured memory_bytes: 32768
#include <iostream>

using namespace std;

int main(void)
{
    while (true) {
	char buf[1002];
	cin >> buf;
	if (buf[0] == '0' && buf[1] == '\0')
	    break;

	int sum = 0;
	u_int i = 0;
	while (buf[i] != '\0')
	    sum += buf[i++] - 48;
	
	printf("%d\n", sum);
    }

    return 0;
}

Measured memory_bytes: 1116
#include <iostream>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>

using namespace std;

typedef long long signed int ll;

constexpr ll NIL = -20000000000;

class path{
public:
    int from;
    int to;
    int dist;
    path(){
        from = -1;
        to = -1;
        dist = -1;
    }
    path(int from_,int to_,int dist_){
        from = from_;
        to = to_;
        dist = dist_;
    }
    static bool compare(const path& a,const path& b) {
        return a.from < b.from;
    }
    bool operator<(const path& e) const {
        return this->dist < e.dist;
    }
};

int n,u,k,v,c;
vector<path> w;
ll d[10000];

int main() {
    for(int i = 0;i < 10000;i++)d[i] = -NIL;
    cin >> n;
    for(int i = 0;i < n;i++) {
        cin >> u >> k;
        for(int j = 0;j < k;j++) {
            cin >> v >> c;
            w.push_back(path(u,v,c));
        }
    }
    sort(w.begin(),w.end(),path::compare);
    priority_queue<pair<int,int>> q;
    q.push(make_pair(0,0));
    d[0] = 0;
    while(!q.empty()) {
        auto y = q.top();q.pop();
        if(d[y.second] != y.first) continue;
        auto r = lower_bound(w.begin(),w.end(),path(y.second,0,0),path::compare);
        auto l = lower_bound(w.begin(),w.end(),path(y.second+1,0,0),path::compare);
        for(auto itr = r;itr < l;itr++) {
            if(d[itr->to] > d[itr->from] + itr->dist) {
                d[itr->to] = d[itr->from] + itr->dist;
                q.push(make_pair(d[itr->to],itr->to));
            }
        }
    }
    for(int i = 0;i < n;i++){
        cout << i << " " << d[i] << endl;
    }
}



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

int main()
{
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	sort(arr,arr+n);
	int c=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			for(int k=j+1;k<n;k++)
			{
				if(arr[i]!=arr[j]&&arr[i]!=arr[k]&&arr[k]!=arr[j])
					if(arr[i]+arr[j]>arr[k] && arr[i]+arr[k]>arr[j] && arr[j]+arr[k]>arr[i])
						c++;
			}
		}
	}
	cout<<c<<"\n";
}


		





Measured memory_bytes: 3636
//Atcoder M-SOLUTIONS Programming Contest 2020
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 2e6 + 5;
const double E = 1e-9;

//------------------------------------------------------------------------------

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /*ifstream cin("input.txt");
    ofstream cout("output.txt");*/
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int maxx = max(a, max(b, c));
    while (b <= a && k--)
        b *= 2;
    while (c <= b && k--)
        c *= 2;
    if (c > b && b > a)
    {
        cout << "Yes";
        return 0;
    }
    cout << "No";
    return 0;
}
//Date: ###### Sat Jul 25 17:51:33 IST 2020
//------------------------------------------------------------------------------

Measured memory_bytes: 3632
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    aa = [[0] * n for _ in range(n)]
    for i in range(n):
        t = I()
        ta = [LI() for _ in range(t)]
        for x,y in ta:
            if y == 0:
                aa[i][x-1] = -1
            else:
                aa[i][x-1] = 1

    r = 0
    for i in range(2**n):
        f = [(i & 2**j) > 0 for j in range(n)]
        ok = True
        for j in range(n):
            if not f[j]:
                continue
            for k in range(n):
                if aa[j][k] == 0:
                    continue
                if aa[j][k] == 1:
                    if not f[k]:
                        ok = False
                else:
                    if f[k]:
                        ok = False
            if not ok:
                break

        if ok:
            t = len([_ for _ in f if _])
            if r < t:
                r =t

    return r


print(main())




Measured memory_bytes: 5524
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

int main() {
	int n, y;
	cin >> n >> y;
	for (int i = 0; i <= 2000; i++) {
		for (int j = 0; j <= 4000; j++) {
			int m = n - i - j;
			if (m < 0) continue;
			int money = 10000 * i + 5000 * j + 1000 * m;
			if (money == y) {
				cout << i << " " << j << " " << m << endl;
				return 0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
}

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    int sum = 0;
    sum = (n*(n-1))/2 + (m*(m-1))/2;
    cout << sum;
    return 0;
}


Measured memory_bytes: 256
/******************************************
* AUTHOR : SARTHAK GUPTA *
* NICK : SOPHOZAAR *
* INSTITUTION : BIT MESRA *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second

string longest = "";


int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ios_base& scientific (ios_base& str);
string s1, s2;
cin >> s1 >> s2;

int m = s1.length();
int n = s2.length();

int dp[m + 1][n + 1];

for(int i = 0; i <= m; i++) {
	for(int j = 0; j <= n; j++) {
		dp[i][j] = 0;
	}
}

// LCS
for(int i = 1; i <= m; i++) {
	for(int j = 1; j <= n; j++) {

		if(s1[i - 1] == s2[j - 1]) {
			dp[i][j] = 1 + dp[i - 1][j - 1];
		}
		else {
			dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
		}
	}
}

int i = m;
int j = n;

int len = dp[m][n];


while(i >= 1 && j >= 1) {
	if(longest.size() == len)
		break;

	if(s1[i - 1] == s2[j - 1]) {
		longest = s1[i - 1] + longest;
		i--;
		j--;
	}

	else if(dp[i][j - 1] > dp[i - 1][j]) {
		j--;
	}
	else
		i--;
}

cout << longest << "\n";


return 0;
}	

Measured memory_bytes: 35456
//#include <bits/stdc++.h>
#include <iostream>
#include <climits>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include<math.h>
#include <set>
#include <time.h>
#include <map>
#include <fstream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <numeric>
#include <unordered_map>
using namespace std;
#define sz(a) int((a).size())
#define ll long long
#define pb push_back
#define ld long double
#define mp make_pair
#define vi vector<ll>
#define all(c) (c).begin(),(c).end()
#define allr(c) (c).rbegin(),(c).rend()
#define For(i,n) for(ll i=0;i<n;i++)
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define input(a,n) for(long long i=0;i<n;i++)cin>>a[i]
#define output(a,n) for(long long i=0;i<n;i++)cout<<a[i]<<" "
#define max3(a,b,c) max(max(a,b),c)
#define max4(a,b,c,d) max(max3(a,b,c),d)
#define min3(a,b,c) min(min(a,b),c)
#define min4(a,b,c,d) min(min3(a,b,c),d)
#define     she_taught_me_to_code cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ep 1e-10
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
{
    return (a.second < b.second);
}
ll gcd(ll a,ll b)
{
    if (b == 0)
    return a;
    return gcd(b, a % b);
}
ll lcm(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}
ll pow2(ll n)
{
    ll x=1;
    for(ll i=1;i<=n;i++)
    {
        x*=2;
    }
    return x;
}
#define N 1000000
vector<ll> adj[N];
vector<ll> v(N);
vector<bool> visited(N,0);
void DFSUtil(ll u)
{
    visited[u] = true;
    for (ll i=0; i<adj[u].size(); i++)
    {
        if (visited[adj[u][i]] == false)
        {
            DFSUtil(adj[u][i]);
        }
    }
}
void DFS(ll n)
{
    for (ll u=0; u<n; u++)
    {
        if (visited[u] == false)
        {
            DFSUtil(u);
        }
    }
}
void aE(ll u, ll v)
{
    adj[u].push_back(v);
}
int main()
{
    she_taught_me_to_code


    map<ll,ll> m;
    for(ll i=0;i<4;i++)
    {
        ll a;
        cin>>a;
        m[a]++;
    }
    if(m[1]==1 && m[9]==1 && m[7]==1 && m[4]==1)
    {
        cout<<"YES";
    }
    else
    {
        cout<<"NO";
    }
}


Measured memory_bytes: 31616
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define F first
#define S second
#define s(x) #x<<" "<<x<<" | "<<
#define f(i,j,k) for(int i = j;i<=k;i++)
#define fr(i,j,k) for(int i = j;i>=k;i--)
#define all(A)  A.begin(),A.end()  
#define has(m,x)   (m.find(x)!=m.end())
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);  
#define endl "\n"
const int MSIZE = 1e7+5;
const int MOD = 1e9+7 ;


ll arr[MSIZE];

const int M = 1e7;
int spf[MSIZE];
void prime_seive_gen(){
    memset(spf,-1,sizeof(spf));
    for(int i=2;i*i<=M;i++) 
        if(spf[i]==-1) 
            for(int j=i*i;j<=M;j+=i)
                spf[j]=i;
}

int no_of_divs(int n) {
    int  ans = 1;
    while(n!=1 and spf[n]!=-1) {
        int cnt = 0, s = spf[n];
        while(n%s==0)   n/=s,cnt++;
        ans*=(cnt+1);
    }
    if(n!=1)    ans*=2;
    return ans;
}


int main(){

    FIO
    prime_seive_gen(); 
    arr[0] = 0;
    f(i,1,M) 
        arr[i]=arr[i-1]+i*(ll)no_of_divs(i);
    
    int n; cin>>n;
    cout<<arr[n]<<endl;
    
    
    
    return 0;
}
    


Measured memory_bytes: 120828
#include<iostream>
#include<cstdio>
#include<cstring>

const int N=100020;

int s[N];
int n,ans;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",s+i);
	ans=0;
	int k=-1;
	for(int i=1;i<=n;i++)
	{
		if(k==-1)k=0;
		else if(s[i-1]==s[i]);
		else if(s[i-1]<s[i])
		{
			if(k==0)k=1;
			else if(k==1);
			else k=0,ans++;
		}
		else 
		{
			if(k==0)k=2;
			else if(k==2);
			else k=0,ans++;
		}
	}
	if(k!=-1)ans++;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int           long long
#define	pb            push_back
#define all(a)        (a).begin(),(a).end()
#define sz(x)         (int)x.size()
#define F             first
#define S             second
#define endl          "\n"
#define inf           1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigboi        1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(all(v), RNG);
// Use mt19937_64 for 64 bit random numbers. 

void solve(){
	int n, cnt=0;
	string s;
	cin>>n>>s;
	vector<int> r, g, b;
	FOR(i, 0, n){
		if(s[i]=='R'){
			r.pb(i);
		}
		else if(s[i]=='G'){
			g.pb(i);
		}
		else{
			b.pb(i);
		}
	}

	sort(all(g));
	sort(all(r));
	sort(all(b));
    for(int ii=0; ii<r.size(); ii++) {
        for(int jj=0; jj<g.size(); jj++) {
            cnt += b.size();
            int i = r[ii]; int j = g[jj];
            if(binary_search(b.begin(), b.end(), max(i, j) + abs(i-j))) cnt--;
            if(binary_search(b.begin(), b.end(), min(i, j) - abs(i-j))) cnt--;
            if((i+j)%2==0 && binary_search(b.begin(), b.end(), (i+j)/2)) cnt--;
 
        }
    }
	cout<<cnt<<endl;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0); 	
	int t=1;
	//cin>>t;
	FOR(i, 1, t+1){	
		//cout<<"Case #"<<i<<": ";
		solve();
	}
	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
 
}


Measured memory_bytes: 3668
open System

let N =stdin.ReadLine()|>int
let W =stdin.ReadLine().Split()|>Array.map int
[<EntryPoint>]
let main argv =
    [for i in [0..N-2] do yield ([0..N-1]|>Seq.sumBy(fun c -> (if c<=i then W.[c] else -(W.[c]))))]
    |>List.map abs
    |>List.min
    |>stdout.WriteLine
    0

Measured memory_bytes: 13396
input_str=input()
A=int(input_str.split()[0])
B=int(input_str.split()[1])
ans_sum = 0

if (A > B) and ((A-1) >= B):
  ans_sum += A
  ans_sum += A-1
elif (B > A) and ((B-1) >= A):
  ans_sum += B
  ans_sum += B-1
elif A == B:
  ans_sum += A
  ans_sum += B
print(ans_sum)

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
using namespace std;

int main()
{
    int N, M;
    vector<int> T;
    vector< vector<int> > PX;

    if (scanf("%d", &N) < 1) return 0;

    T.resize(N);

    for (int i = 0; i < N; i++)
    {
        if (scanf("%d", &T[i]) < 1) return 0;
    }

    if (scanf("%d", &M) < 1) return 0;

    PX.resize(M);

    for (int i = 0; i < M; i++)
    {
        PX[i].resize(2);
        for (int j = 0; j < 2; j++)
        {
            if (scanf("%d", &PX[i][j]) < 1) return 0;
        }
    }

    for (int i = 0; i < M; i++)
    {
        int sum = 0;
        for (int j = 0; j < N; j++)
        {
            if (PX[i][0] == j + 1) sum += PX[i][1];
            else sum += T[j];
        }
        printf("%d\n", sum);
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int a[3],ans=3;
for(int i=0;i<3;i++)
cin>>a[i];
if(a[0]==a[1]){
ans-=1;
}
if(a[0]==a[2]){
ans-=1;
}
if(a[1]==a[2]){
ans-=1;
}
if(ans==0){
ans+=1;
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

    vector<set<string>> vs(3);

    REP(i, n) {
        string x = s.substr(i, 1);

        for (int j = 1; j >= 0; j--) {
            for (string y : vs[j]) {
                vs[j + 1].insert(y + x);
            }
        }

        vs[0].insert(x);
    }

    cout << vs[2].size() << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less

#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


#define FASTIO ios::sync_with_stdio(0); cin.tie(0);
#define show(x) cout << #x << " = " << x << "\n"
#define mem( a , b ) memset( a , b , sizeof a )
#define popcnt(x) __builtin_popcount(x)
#define all(x) x.begin() , x.end()
#define mod(x,m) ((x%m + m )%m)
#define SZ(a) (int)a.size()
#define ll  long long
#define ld  long double
#define vii vector  <ll>
#define dqi deque   <ll>
#define sii set     <ll>
#define vpi vector  <pii>
#define mii map     <ll,ll>
#define pii pair    <ll,ll>
#define pi  pair    <int,int>
#define pb  push_back
#define F   first
#define S   second
#define L   length()
#define OO  (ll)1e18
#define lSOne(x)(x&-x)
#define EPS 1e-20
using namespace std;
using namespace __gnu_pbds;
void ONLINE__JUDGE();

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

pii swapii( pii pr ){ return { pr.S , pr.F }; }
ll binEXP( ll x , ll pw , ll MOD = LLONG_MAX );
int dx[] = {  0 ,  0 , -1 , +1 , -1 , +1 , -1 , +1 };
int dy[] = { -1 , +1 ,  0 ,  0 , -1 , +1 , +1 , -1 };

const ll MOD = 1e9 + 7;
const ll MAX = 2e5 + 7;

ll x , cnt;
map < string, ll > mp;

int main(){
    FASTIO //ONLINE__JUDGE();

    cin >> x;
    for ( int i = 0; i < x; ++i ){
        string s; cin >> s; sort( all(s) );
        mp[s]++;
    }

    for ( auto i : mp ){
        cnt += ((i.S * (i.S - 1)) >> 1);
    }
    cout << cnt;
    return 0;
}

void ONLINE__JUDGE()
{
    #ifndef ONLINE_JUDGE
    freopen( "inp.c"         , "r" , stdin  );
    //freopen( "OutPut.txt"   , "w" , stdout );
    #endif // ONLINE_JUDGE
}

ll binEXP( ll x , ll pw , ll MOD )
{ ll res=1; while(pw>0){ pw%2 ? res *= x : 0; x *= x; x%=MOD; pw /= 2; res%= MOD; } return res%=MOD; }


Measured memory_bytes: 11264
import java.util.Scanner;
import java.lang.*;

public class Main {
  public static int count = 0;

  public static void counter(int fh, int hd, int ft, int goal) {
    int maxFH = Math.min(goal / 500, fh);
    for (int i = 0; i <= maxFH; i++) {
        int postFH = goal - i * 500;
        int maxHD = 0;
        if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        }
        for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        }
    }
  }

  public static void main(String[] args) {
    Scanner dataScanner = new Scanner(System.in);
    int fiveHundred = Integer.parseInt(dataScanner.nextLine());
    int hundred = Integer.parseInt(dataScanner.nextLine());
    int fifty = Integer.parseInt(dataScanner.nextLine());
    int goal = Integer.parseInt(dataScanner.nextLine());
    counter(fiveHundred, hundred, fifty, goal);
    System.out.println(count);
  }
}


Measured memory_bytes: 21716
import java.util.Scanner;
      public class Main{
             public static void main(String[] args){
                    Scanner stdin = new Scanner(System.in);
                    int S = stdin.nextInt();
                    int h=S/3600,m=(S/60)-(h*60),s=S-(m*60)-(h*3600);
                    System.out.println(h+":"+m+":"+s);
    } 
}


Measured memory_bytes: 26336
#include <stdio.h>
#include <stdlib.h>

int main(void){

  char  *s;
  int   n, k, i;

  scanf("%d", &n);
  s = malloc(n * sizeof(s));
  scanf("%s", s);
  scanf("%d", &k);

  for (i = 0; i < n; i++) {
    if (s[i] != s[k - 1]) {
      s[i] = '*';
    }
  }

  printf(s);

  return 0;

}


Measured memory_bytes: 128
_ = input()
a = list(input())
cnt = 0
word = 0
for i in a:
    if word == 0 and i == 'A':
        word = 1
    elif word == 1 and i =='B':
        word = 2
    elif word == 2 and i =='C':
        word = 0
        cnt += 1
    else:
        if i == 'A': 
            word = 1
        else:
            word = 0
print(cnt)

Measured memory_bytes: 8988
N = int(input())
a = list(map(int, input().split()))
for j, i in enumerate(a):
    if (i % 2 == 0) and (not (i % 3 == 0 or i % 5 == 0)):
        print('DENIED')
        break
    if j == N - 1:
        print('APPROVED')

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <algorithm>
#include <functional>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int n, pos;
vector<int> pre, in, post;

void rec(int l, int r)
{
	if (l >= r)
	{
		return;
	}
	int root = pre[pos++];
	int m = distance(in.begin(), find(in.begin(), in.end(), root));
	rec(l, m);
	rec(m + 1, r);
	post.push_back(root);
}

void solve()
{
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int k;
		cin >> k;
		pre.push_back(k);
	}
	for (int i = 0; i < n; ++i)
	{
		int k;
		cin >> k;
		in.push_back(k);
	}
	pos = 0;
	rec(0, pre.size());
	for (int i = 0; i < n; ++i)
	{
		if (i)
		{
			cout << " ";
		}
		cout << post[i];
	}
	cout << endl;
}

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

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


int main(){
  int n;
  cin >> n;
  map<string, int> mp;
  for(int i=0; i < n; i++){
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    mp[s]++;
  }
  long long ans = 0;
  for(auto& p : mp){
    int s = p.second;
    ans += (long long)s*(s-1)/2;
  }
  cout << ans << endl;
    
}


Measured memory_bytes: 11136