akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

const int MAX=2000010;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
}

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

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll r1,c1,r2,c2;
  cin>>r1>>c1>>r2>>c2;

  COMinit();

  ll ans=0;
  for(ll y=c1; y<=c2; y++){
    ans = (ans+COM(r2+y+1, y+1))%MOD;
    ans = (ans+MOD-COM(r1-1+y+1, y+1))%MOD;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 47104
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#include <iostream>

using namespace std;


int main() {

    char b;
    cin >> b;

    if (b == 'A') {
        cout << 'T' << "\n";
    } else if (b == 'T') {
        cout << 'A' << "\n";
    } else if (b == 'C') {
        cout << 'G' << "\n";
    } else {
        cout << 'C' << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a =sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int[] arr = new int[3];
        arr[0] = a; arr[1] = b; arr[2] = c;
        Arrays.sort(arr);
        //int ans = arr[2];
        //ans += (arr[2] - arr[1]);
        //ans += (arr[1] - arr[0]);
        int ans = 0;
        ans += (arr[1] - arr[0]);
        ans += (arr[2] - arr[1]);
        System.out.println(ans);
    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repext(i, a, b) for (int i = a; i < b; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (int i = b - 1; i >= a; i--)
#define vec_all(vec) vec.begin(), vec.end()

// vectorデバッグ
template <typename T>
void dump_vec(vector<T> vec)
{
    rep(i, vec.size())
    {
        cout << i << ": " << vec[i] << endl;
    }
}

template <typename T>
T gcd(T a, T b)
{
    while (b != 0)
    {
        a = a % b;
        swap(a, b);
    }

    return a;
}

template <typename T>
bool is_prime(T p)
{
    if (p == 1)
    {
        return false;
    }
    T sq_p = (T)sqrt(p);
    repext(i, 2, sq_p + 1)
    {
        if (p % i == 0)
        {
            return false;
        }
    }

    return true;
}

template <typename T>
map<T, int> factorize(T a)
{
    if (is_prime(a))
    {
        map<T, int> tmp;
        tmp.insert(make_pair(a, 1));
        return tmp;
    }

    map<T, int> ret;
    int cnt;
    T num = 2;
    T sup_num = (T) sqrt(a);
    if (a % num == 0)
    {
        ret[num] = 0;
        while (true)
        {
            if (a % num == 0)
            {
                ret[num]++;
                a /= num;
            }
            else
            {
                break;
            }
        }
    }

    num++;
    
    if (a % num == 0)
    {
        ret[num] = 0;
    }

    while (a > 1)
    {
        if (a % num == 0)
        {
            ret[num]++;
            a /= num;
        }
        else
        {
            if (num > sup_num) {
                ret[a] = 1;
                break;
            }
            num += 2;
            if (a % num == 0)
            {
                ret[num] = 0;
            }
        }
    }

    return ret;
}

// --- notice ---
// intの和はllにしろ

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

    ll g = gcd<ll>(a, b);

    map<ll, int> fact_map = factorize(g);

    cout << fact_map.size() + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ld long double
int N;
priority_queue<ld, vector<ld>, greater<ld>> v;

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        ld temp; scanf("%Lf", &temp);
        v.push(temp);
    }
    while(v.size() != 1) {
        ld temp1, temp2;
        temp1 = v.top(); v.pop();
        temp2 = v.top(); v.pop();
        v.push((temp1+temp2)/2);
    }
    cout << v.top() << endl;
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll H, W, A, B;
  cin >> H >> W >> A >> B;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if ((i < B && j < A) || (B <= i && A <= j)) {
        cout << 0;
      } else {
        cout << 1;
      }
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

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

	int count = 0;
	int bcount = 0;

	REP(i, n){
		if (s[i] == 'a'){
			if (count < a+b){
				count++;
				cout << "Yes" << endl;
			}
			else cout << "No" << endl;
		}
		else if (s[i] == 'b'){
			bcount++;
			if ((count < a+b) and bcount <= b){
				count++;
				cout << "Yes" << endl;
			}
			else cout << "No" << endl;
		}
		else cout << "No" << endl;
	}

}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#define int long long
using namespace std;
vector<int> a;
int n,x;
signed main()
{
	cin >> n;
	for(int i = 1; i <= n;i++)
	{
		int x;
		cin >> x;
		a.push_back(x);
	}
	sort(a.begin(), a.end());
	int mn, mx;
	mn = a[0]; mx = a[n-1];
	for(int i = 1; i < n - 1;i++)
	{
		if(a[i] < 0) mx = mx - a[i];
		else mn = mn - a[i];
	}
	cout << mx - mn << "\n";
	mn = a[0]; mx = a[n-1];
	for(int i = 1; i < n - 1;i++)
	{
		if(a[i] < 0){ 
		    cout << mx << " " << a[i] << "\n";
		    mx -= a[i];
		}
		else{ 
		    cout << mn << " " << a[i] << "\n";
		    mn -= a[i];
		}
	}
	cout << mx << " " << mn;
}

Measured memory_bytes: 2804
import collections
n,m = map(int,input().split())
r = []
l = []
for i in range(m):
    ll,rr = map(int,input().split())
    r.append(rr)
    l.append(ll)
ans = min(r) - max(l) +1
if ans > 0:
    print(ans)
else :
    print(0)

Measured memory_bytes: 11376
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(n: int, v: "List[int]"):
    e = v[0::2]
    o = v[1::2]

    ec = sorted([(vv, k) for k, vv in Counter(e).items()], reverse=True) + [(0, None)]
    oc = sorted([(vv, k) for k, vv in Counter(o).items()], reverse=True) + [(0, None)]

    ee1 = ec[0]
    oo1 = oc[1] if oc[0][1] == ee1[1] else oc[0]
    ret1 = len(v) - ee1[0] - oo1[0]

    oo2 = oc[0]
    ee2 = ec[1] if ec[0][1] == oo2[1] else ec[0]
    ret2 = len(v) - ee2[0] - oo2[0]
   
    return min(ret1, ret2)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    v = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    result = solve(n, v)
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 29584
#include<iostream>

using namespace std;

int main(void){
	while( 1 ){
		int cnt = 0;
		int cards[11] = {0,};
		int c1, c2, c3;

		cin >> c1 >> c2 >> c3;
		if( cin.eof() ) break;

		cards[c1] = 1;
		cards[c2] = 1;
		cards[c3] = 1;

		for(int i = 1; i < 11; i++){
			if( cards[i] == 0 ){
				if( c1 + c2 + i <= 20 ) cnt++;
			}
		}

		if( cnt >= 4 ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main() {
  int Z;
  scanf("%d", &Z);
  long long int arr[Z], max = 1e18, prods = 1, flags = 0, zeroo = 0;
  
  for (int i = 0; i < Z; i++) {

    scanf("%lld", &arr[i]);
    flags = (arr[i] > max) ? 1 : flags;
    prods *= arr[i];
    (arr[i]) ? max /= arr[i] : zeroo = 1;

  }

  (zeroo) ? puts("0") : ((flags) ? puts("-1") : printf("%lld\n", prods));
  return 0;
}

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

int main()
{
    int N, A = 0, B = 0;
    cin >> N;
    if (N == 1)
    {
        cout << "Hello World" << endl;
    }
    if (N == 2)
    {
        cin >> A >> B;
        cout << A + B << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
using namespace std;
typedef long long llong;

int N, M, L[100010], R[100010];
int l;
int r;

int main()
{
	l = 0;
	r = 200000;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> L[i] >> R[i];
		l = max(l, L[i]);
		r = min(r, R[i]);
	}
	if (r - l + 1 < 0) cout << 0;
	else cout << r - l + 1;

}

Measured memory_bytes: 1024
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using static System.Console;

namespace MyDictionary
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var n = int.Parse(ReadLine());
            var mydic = new MyDictionary<string>();
            var sw = new StreamWriter(OpenStandardOutput()) {AutoFlush = false};
            SetOut(sw);
            
            for (var i = 0; i < n; i++)
            {
                var command = ReadLine().Split(' ').ToArray();
                switch (command[0])
                {
                    case "insert":
                        mydic.Insert(command[1]);
                        break;
                    case "find":
                        mydic.Find(command[1]);
                        break;
                    default:
                        Debug.WriteLine("Invalid command");
                        break;
                }
            }
            Out.Flush();
            
        }
    }

 

    public class MyDictionary<T>{
        private HashSet<T> dic { get; set; }
        
        public MyDictionary()
        {
            dic = new HashSet<T>();
        }

        public void Insert(T str)
        {
            dic.Add(str);
        }

        public bool Find(T key)
        {
            if (dic.Contains(key))
            {
                WriteLine("yes");
                return true;
            }

            WriteLine("no");
            return false;
        }
    }
}


Measured memory_bytes: 44364
/*
 * Created by solzard on 1/31/20.
 */
#include <iostream>
using namespace std;

bool is_prime(const int n) {
  if (n == 2) return true;
  if (n < 2 || n % 2 == 0) return false;
  for (int i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return false;
  }
  return true;
}

int main() {
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (is_prime(x)) ++cnt;
  }
  cout << cnt << endl;
}


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

#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

struct Edge {
    int from;
    int to;
    long double cost;
};
struct Graph {
    Graph(const int n)
    {
        edge.resize(n);
    }
    void addEdge(const int from, const int to, const long double cost)
    {
        edge[from].push_back(Edge{from, to, cost});
        edge[to].push_back(Edge{to, from, cost});
    }
    vector<vector<Edge>> edge;
};

struct Point {
    ll x;
    ll y;
    ll r;
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll xs, ys, xt, yt;
    cin >> xs >> ys >> xt >> yt;
    int N;
    cin >> N;
    vector<Point> p(N + 2);
    for (int i = 0; i < N; i++) {
        ll x, y, r;
        cin >> x >> y >> r;
        p[i] = Point{x, y, r};
    }
    const int s = N;
    const int t = N + 1;
    p[s] = Point{xs, ys, 0};
    p[t] = Point{xt, yt, 0};
    Graph g(N + 2);
    for (int i = 0; i < N + 2; i++) {
        for (int j = i + 1; j < N + 2; j++) {
            const ll dx = (p[i].x - p[j].x);
            const ll dy = (p[i].y - p[j].y);
            const ll r = p[i].r + p[j].r;
            if (dx * dx + dy * dy <= r * r) {
                g.addEdge(i, j, 0);
            } else {
                g.addEdge(i, j, (long double)sqrt(dx * dx + dy * dy) - (long double)r);
            }
        }
    }
    using P = pair<long double, int>;
    priority_queue<P, vector<P>, greater<P>> q;
    vector<long double> d(N + 2, INF<long double>);
    d[s] = 0;
    q.push(make_pair(0, s));
    while (not q.empty()) {
        const auto& p = q.top();
        const int v = p.second;
        const long double cost = p.first;
        q.pop();
        if (d[v] < cost) {
            continue;
        }
        for (const auto& e : g.edge[v]) {
            if (d[e.to] > e.cost + d[v]) {
                d[e.to] = e.cost + d[v];
                q.push(make_pair(d[e.to], e.to));
            }
        }
    }
    cout << fixed << setprecision(12) << d[t] << endl;

    return 0;
}


Measured memory_bytes: 42928
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N];

int32_t main(){_
   
   cin>>n;

   int a, b;
   cin >> a >> b;

   int divv = n / (a+b);
   int ans = a * divv + min(a, n % (a+b));

   cout<<ans;
   

   return 0;
}

Measured memory_bytes: 256
fun main(args:Array<String>) {
    val n:Int = readLine()!!.toInt()
    val al:List<Int> = readLine()!!.split(" ").map(String::toInt)
    val bl:Set<Int> = al.toSet()
    if (n == bl.size) {
        println("YES")
    }
    else {
        println("NO")
    }
}

Measured memory_bytes: 80968
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	string a, b;
	cin >> a >> b;
	int la = a.length();
	int lb = b.length();
	if(la < lb){
		cout << "LESS" << endl;
		return 0;
	} else if(la > lb){
		cout << "GREATER" << endl;
		return 0;
	}

	for(int i = 0; i < la; i++){
		if(a[i] - '0' < b[i] - '0'){
		cout << "LESS" << endl;
		return 0;
		} else if(a[i] - '0' > b[i] - '0'){
			cout << "GREATER" << endl;
			return 0;
		}
	}
	cout << "EQUAL" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  vi vector<long long int>
#define  set1 set<long long int>
#define  pb push_back
#define  map1 map<long long int,long long int>
#define  ll    long long int
#define  mp make_pair
#define  inf 1e17
#define  minf INT_MIN
#define  setbits(x) __builtin_popcountll(x)
#define  pres(x,y) fixed<<setprecision(y)<<x
#define  pair1 pair<long long int,long long int>
#define  mk(arr,n,type) type *arr=new type[n];
#define  mod 1000000007
#define  pi  3.1415926535897932384626433832
#define  ins insert
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//find_by_order() --> returns an iterator to the k-th largest element (counting from zero)
//order_of_key()  --> the number of items in a set that are strictly smaller than our item.
#define  w(t) long long int t;t=1;while(t--)

void solve() {


	ll n, k;
	cin >> n >> k;

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

	ll dp[n + 1];

	dp[1] = 0;

	for (ll i = 2; i <= n; i++) {
		dp[i] = inf;
		for (ll j = i - 1; j >= 1 && j >= i - k; j--) {
			ll p = abs(a[i] - a[j]) + dp[j];
			dp[i] = min(p, dp[i]);
		}


	}



	cout << dp[n] << "\n";

}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("inp.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	w(t) {
		solve();
	}
	return 0;
}

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

long long solve(long long a, long long b) {
    if (a == b) return (a-1)*2;
    long long lim = a*b - 1;
    long long low = 1, high = 1LL<<31;
    while (high - low > 1) {
        long long mid = (low + high) / 2;
        long long mul = (mid+1)/2 * (mid+1 - (mid+1)/2);
        if (mul > lim) high = mid;
        else low = mid;
    }
    return low - 1;
}

int main() {
    int Q; cin >> Q;
    for (int q = 0; q < Q; ++q) {
        long long a, b; cin >> a >> b;
        cout << solve(a, b) << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long ksm(long long u,long long v){
	long long o=1;
	while(v){
		if(v&1)
			o=o*u%mo;
		u=u*u%mo;
		v>>=1;
	}
	return o;
}
long long n,i,a[100005],b[100005],j,book[3005],zhan[3005],top,x,y,ans,sum0,sum1,flag;
struct nyh{
	long long x,y;
}o[100005];
bool cmp(nyh u,nyh v){
	return u.x<v.x;
}
int main(){
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
   	n=read();
   	for(i=2;i<=2200;i++)
   		if(book[i]==0){
   			top++;
   			zhan[top]=i;
   			for(j=(i<<1);j<=2200;j+=i)
   				book[j]=1;
   		}
	for(i=1;i<=n;i++){
		a[i]=read();
		for(j=1;j<=top&&zhan[j]*zhan[j]*zhan[j]<=a[i];j++)
			while(a[i]%(zhan[j]*zhan[j]*zhan[j])==0)
				a[i]=a[i]/zhan[j]/zhan[j]/zhan[j];
		x=a[i];
		b[i]=1;
		for(j=1;j<=top;j++)
			if(a[i]%(zhan[j]*zhan[j])==0){
				b[i]*=zhan[j];
				x/=zhan[j]*zhan[j];
			}
			else if(a[i]%zhan[j]==0){
				b[i]*=zhan[j]*zhan[j];
				x/=zhan[j];
			}
		y=sqrt(x);
		if(y*y==x)
			b[i]*=y;
		else
			b[i]*=x*x;
		if(a[i]>b[i]){
			swap(a[i],b[i]);
			o[i].y=1;
		}
		o[i].x=a[i];
	}
	sort(o+1,o+n+1,cmp);
	for(i=1;i<=n+1;i++)
		if(o[i].x!=1){
			if(o[i].x!=o[i-1].x){
				ans+=max(sum0,sum1);
				sum0=0;
				sum1=0;
			}
			if(o[i].y==0)
				sum0++;
			else
				sum1++;
		}
		else
			flag=1;
	ans+=flag;
	pus(ans,2);
    return 0;
}

Measured memory_bytes: 3456
import java.util.Scanner;

// Aising2020_B
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[] a = new int[N];
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
		}

		int count = 0;
		for (int i = 0; i < N; i += 2) {
			if (a[i] % 2 == 1) {
				count++;
			}
		}

		System.out.println(count);
		sc.close();
	}

}


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

int main(void)
{
    int a,b;
    cin >> a >> b; //a日間、b個
    int i;
    rep(i,b){
        int x;
        cin >> x;

        a -=x;

    }

    if(a>=0)cout<< a <<endl;

    else cout<< -1 <<endl;

    return 0;
}


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

int findG(vector<int> &g, int i) {
  vector<int> s;
  while (g[i] != i) {
    s.push_back(i);
    i = g[i];
  }
  for (int x = 0; x < s.size(); x++) g[s[x]] = i;
  return i;
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> group(N + 1);
  for (int i = 1; i < N + 1; i++) group[i] = i;
  for (int i = 0; i < M; i++) {
    int x, y, z, gx, gy;
    cin >> x >> y >> z;
    gx = findG(group, x);
    gy = findG(group, y);
    if (gx != gy) {
      group[gx] = gy;
    }
  }
  set<int> grp;
  for (int i = 1; i < N + 1; i++) {
    grp.insert(findG(group, i));
  }
  cout << grp.size() << endl;
  return 0;
}

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

int main(){
  int year,month,date;
  char s,t;
  cin >> year >> s >> month >> t >> date;
  if(year > 2019)cout << "TBD";
  else if(year == 2019 && month >= 5)cout << "TBD";
  else cout << "Heisei";
  return 0;
}




Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
		if len(os.Args) > 2 {
			wfp, _ = os.Create(os.Args[2])
		}
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	s := getNextString(scanner)

	ans := 1
	for i := 1; i < n; i++ {
		if s[i] != s[i-1] {
			ans++
		}
	}

	fmt.Fprintln(writer, ans)

	writer.Flush()
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<int> W(N);
    for(int i = 0; i < N; i++){
        cin >> W[i];
    }

    int sum_W = 0;
    for(int i = 0; i < N; i++){
        sum_W += W[i];
    }

    int sum_tmp = 0;
    int ans = 1000000;
    for(int i = 0; i < N; i++){
        sum_tmp += W[i];
        chmin(ans, abs((sum_W-sum_tmp) - sum_tmp));
    }

    cout << ans << endl;


    return 0;
}



Measured memory_bytes: 256
#define    ll           long long
#define    dn           double
#define    mp           make_pair
#define    pb           push_back
#define    se           second
#define    fi           first
#define    mod          1000000007
#define    sob(v)       v.begin(),v.end()
#define    sobr(v)      v.rbegin(),v.rend()
#define    fr(i,a,b)    for(int i=a;i<=b;++i)
#define    frr(i,a,b)   for(int i=a;i>=b;--i)
#define    pi           acos(-1.00)
#define    inf          1e9
#define    check        cout<<"*"<<endl
#define    ffix(x)      cout<<fixed<<setprecision(x)
#define    fast         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

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

typedef vector<int> vi;
typedef map<int,int> mii;
typedef pair<int,int> pii;
///typedef pair<int,vi> pp;

int dr[8]= {0,0,-1,1,-1,-1,+1,+1};
int dc[8]= {-1,1,0,0,-1,+1,-1,+1};

const int N=1000005;

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


Measured memory_bytes: 3620
from collections import defaultdict
n = int(input())

restaurant_dict = defaultdict(list)

for i in range(n):
  name, score = input().split()
  restaurant_dict[name].append((i+1, int(score)))
  
for n, t in sorted(restaurant_dict.items()):
  for s in sorted(t, key=lambda tup: tup[1], reverse=True):
    print(s[0])

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

ll H, W, N;
ll dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
ll dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};

int main()
{
    cin >> H >> W >> N;
    set<pair<ll, ll>> st;
    set<pair<ll, ll>> br;
    vector<ll> ans(11);
    ans[0] = (H - 2) * (W - 2);
    for (int i = 0; i < N; i++)
    {
        ll y, x;
        cin >> y >> x;
        y--, x--;
        pair<ll, ll> p = make_pair(y, x);
        br.insert(p);
        st.insert(p);
        for (ll i = 0; i < 8; i++)
        {
            ll ny = y + dy[i], nx = x + dx[i];
            if (ny < 0 || ny >= H)
                continue;
            if (nx < 0 || nx >= W)
                continue;
            pair<ll, ll> q = make_pair(ny, nx);
            st.insert(q);
        }
    }
    for (auto &p : st)
    {
        ll y = p.first, x = p.second, cnt = 0;
        if (br.find(p) != br.end())
            cnt++;
        for (ll i = 0; i < 8; i++)
        {
            ll ny = y + dy[i], nx = x + dx[i];
            if (ny < 0 || ny >= H || nx < 0 || nx >= W)
            {
                cnt = -1;
                break;
            }
            pair<ll, ll> q = make_pair(ny, nx);
            if (br.find(q) != br.end())
                cnt++;
        }
        if (cnt != -1)
        {
            ans[cnt]++, ans[0]--;
        }
    }
    for (int i = 0; i <= 9; i++)
    {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 62720
import java.util.*;
 
public class Main {
 	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		int count = 0;
		int max = 0;
		String[] word = new String[str.length()];
		for (int i = 0; i < str.length(); i++) {
		    String str2 = String.valueOf(str.charAt(i));
		    // 配列に順番に格納する
		    word[i] = str2;
		}

		for(int i=0; i<str.length(); i++){
			for(int j=i; j<str.length();j++){
				if(count==0){
					if((word[j].equals("A"))||(word[j].equals("C"))||(word[j].equals("G"))||(word[j].equals("T"))){
						count++;
					}
				}else{
					if((word[j].equals("A"))||(word[j].equals("C"))||(word[j].equals("G"))||(word[j].equals("T"))){
						count++;
					}else{
						if(max<count){
							max=count;
						}
						count=0;
					}
				}
			}
			if(max<count){
				max=count;
			}
			count=0;
		}
		System.out.println(max);
	}
}


		


Measured memory_bytes: 21588
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
typedef pair<char, long long> P;
int main() {
	int N; cin >> N;
	int tmp = N, ans = 0;
	while (tmp != 0) {
		ans += tmp % 10;
		tmp /= 10;
	}
	if (N % ans == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

class Program {
    static void Main(string[] args) {
        int a = Cin.Ni();
        int b = Cin.Ni();
        int c = Cin.Ni();
        int d = Cin.Ni();

        Console.WriteLine(Math.Max(a * b, c * d));
    }
}


public class Cin {
    private static string[] s = new string[0];
    private static int i = 0;

    private static char[] cs = new char[] { ' ' };

    public static string Next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return Next();
    }

    public static int Ni() {
        return int.Parse(Next());
    }

    public static long NextLong() {
        return long.Parse(Next());
    }

    public static double NextDouble() {
        return double.Parse(Next());
    }

}


Measured memory_bytes: 2648
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (int) 1e9+7
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define vi vector<int>
ll xpow(ll a, ll b)
{
	if (b == 0)
		return 1;
	if (b % 2 == 0)
	{
		ll k = xpow(a, b / 2);
		return k * k;
	}
	if (b % 2 != 0)
		return a * xpow(a, b - 1);
}
double fun(double x, double y) {
	return sqrt(x * x + y * y);
}
int main()
{

#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out1.txt", "w", stdout);
#endif
	fio;
	double n, d;
	cin >> n >> d;
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		double x, y;
		cin >> x >> y;
		if (fun(x, y) <= d)
			cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3736
let () = Scanf.scanf "%d" @@ fun x -> Printf.printf "%d\n" @@
  let cache = Array.make 4001 0 in
  cache.(0) <- 100;
  for i=1 to 4000 do
    cache.(i) <- cache.(i-1) + cache.(i-1) / 100
  done;
  List.find (fun i -> x <= cache.(i)) @@
  List.init 4001 Fun.id

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

using namespace std;

typedef long long ll;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

const int inf = 1e9 + 7;
const int mod = 1e9 + 7;

inline void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}

inline int mul(int a, int b) {
  return (a * (ll) b) % mod;
}

inline int pw(int x, int n) {
  int res = 1;
  while (n > 0) {
    if (n % 2) {
      res = mul(res, x);
      n--; 
    } else {
      x = mul(x, x);
      n /= 2;
    }
  }
  return res;
}

const int N = 1e3 + 7;

int dp[N][N];
int a[N][N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char c;
      cin >> c;
      a[i][j] = (c == '.' ? 0 : 1);
    }
  }
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (i + j == 0 || a[i][j]) {
        continue;
      }
      if (i > 0) add(dp[i][j], dp[i - 1][j]);
      if (j > 0) add(dp[i][j], dp[i][j - 1]);
    }
  }
  cout << dp[n - 1][m - 1] << endl;
  return 0;
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StackSub createDataArr = new StackSub(in.readLine().split(" "));
		System.out.println(createDataArr.calcData());
	}
}

class StackSub {
	private String[] readData;
	private int[] stack = new int[100];
	private int ans;

	StackSub(String[] readData) {
		this.readData = readData;
	}

	void createData(String[] criateDataArr) {
		readData = new String[criateDataArr.length];
	}

	int calcData() {
		int stackNum = 0;
		for (int i = 0; i < readData.length; i++) {
			if (readData[i].charAt(0) == '+') {
				stack[stackNum - 2] = stack[stackNum - 2] + stack[stackNum - 1];
				stackNum -= 1;
			} else if (readData[i].charAt(0) == '-') {
				stack[stackNum - 2] = stack[stackNum - 2] - stack[stackNum - 1];
				stackNum -= 1;
			} else if (readData[i].charAt(0) == '*') {
				stack[stackNum - 2] = stack[stackNum - 2] * stack[stackNum - 1];
				stackNum -= 1;
			} else {
				stack[stackNum] = Integer.parseInt(readData[i]);
				stackNum++;
			}
		}
		ans = stack[0];
		return ans;
	}
}

Measured memory_bytes: 24480
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
    if cur == N:
        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    
    return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))

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

using namespace std;

typedef long double db;
struct cp
{
	complex<db> mycp;
	int ind;
	cp operator -(cp b)
	{
		return {mycp - b.mycp, -1};
	}
	db real()
	{
		return mycp.real();
	}
	db imag()
	{
		return mycp.imag();
	}
	bool operator ==(cp b)
	{
		return mycp == b.mycp;
	}
};
//typedef complex<db> cp;

db cross(cp a, cp b)
{
	return a.real() * b.imag() - a.imag() * b.real();
}

int main()
{
	int n;
	cin >> n;
	cout.precision(30);
	vector<cp> pts(n);	
	for (int i = 0; i < n; ++i)
	{
		db x, y;
		cin >> x >> y;
		pts[i].mycp.real(x);
		pts[i].mycp.imag(y);
		pts[i].ind = i;
	}
	cp mn = pts[0];
	for (cp x : pts)
		if (x.imag() < mn.imag() || x.imag() == mn.imag() && x.real() <= mn.real())
			mn = x;
	pts.erase(find(pts.begin(), pts.end(), mn));
	sort(pts.begin(), pts.end(), [&](cp a, cp b)
			{
				db kek = cross(a - mn, b - mn);
				if (kek)
					return kek > 0;
				return abs((a - mn).mycp) < abs((b - mn).mycp);
			});
	vector<cp> st(1, mn);
	for (auto x : pts)
	{
		while (st.size() >= 2 && cross(st.back() - st[st.size() - 2], x - st.back()) <= 0)
			st.pop_back();
		st.push_back(x);
	}
	vector<double> ans(n);
	//double M_PI = 3.14159265;
	for (int i = 0; i < st.size(); ++i)
	{
		int pr = i == 0 ? st.size() - 1 : i - 1;
		int nx = i + 1 == st.size() ? 0 : i + 1;
		ans[st[i].ind] = abs(arg((st[nx] - st[i]).mycp / (st[i] - st[pr]).mycp) / M_PI / 2);
	}
	for (auto& x : ans)
		cout << x << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef DEBUG
#include "_debug.cpp"
#include "callable.hpp/callable.hpp"
#endif
#define endl '\n'
using namespace std;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k;
    cin >> n >> k;
    int curr = 1;
    for(int i = 0; i < n; i++) {
        curr = min(curr * 2, curr + k);
    }
    cout << curr << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ll fact(ll L) {
  ll res = L;
  ll mod = 1e9 + 7;
  for (int i = L - 1; i >= 1; i--) {
    res = (res * i) % mod;
  }
  return res % mod;
}
ll mfact(ll x) {
  ll mod = 1e9 + 7;
  ll res = 1;
  for (ll i = 1; i <= x; i++) {
    res = res * i % mod;
  }
  return res;
}
ll qmi(ll b, ll p) {
  ll mod = 1e9 + 7;
  ll res = 1;
  while (p) {
    if (p & 1) res = res * b % mod;
    p = p >> 1;
    b = b * b % mod;
  }
  return res % mod;
}

ll inv(ll b) {
  ll mod = 1e9 + 7;
  return qmi(b, mod - 2) % mod;
}
ll quickpower(ll a, ll b) {
  ll res = 1;
  ll mod = 1e9 + 7;
  while (b) {
    if (b & 1) {
      res = (res * a) % mod;
    }
    b = b >> 1;
    a = (a * a) % mod;
  }
  return res;
}
ll choose(ll N, ll K) {
  ll mod = 1e9 + 7;
  return mfact(N) * inv(mfact(K) * mfact(N - K) % mod) % mod;
}
int main() {
  int X, Y;
  cin >> X >> Y;
  ll res = 0;
  if ((2 * X - Y) % 3 == 0 && (2 * Y - X) % 3 == 0) {
    ll moves_1 = (2 * Y - X) / 3;
    ll moves_2 = (2 * X - Y) / 3;
    if (moves_1 < 0 || moves_2 < 0) {
      res = 0;
    } else {
      res = choose(moves_1 + moves_2, moves_2);
    }
  }
  cout << res << endl;
  return 0;
}

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

    class Program
    {
        static void Main(string[] args)
        {
            var inputlist = new List<long>();

            Console.ReadLine();
            string inputstring = Console.ReadLine();

            string[] strArray = inputstring.Split(' ');

            foreach(string str in strArray)
            {
                inputlist.Add(int.Parse(str));
            }

            Console.Write(inputlist.Min() + " ");
            Console.Write(inputlist.Max() + " ");
            Console.WriteLine(inputlist.Sum());
        }
    }


Measured memory_bytes: 10536
#include <bits/stdc++.h>
using namespace std;
// #ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
// #else
// #define dlog(str)
// #endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380
// RLの点で行ったり来たり
int main() {
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    int l = s.size();

    vector<int> ans(l);
    vector<bool> passed(l);
    REP(i, l) {
        if(passed[i])
            continue;
        if(i < l && s[i] == 'L' && s[i + 1] == 'L')
            continue;
        int p = i;
        int cnt = 0;
        queue<int> t;
        t.push(p);
        while(true) {
            if(s[p] == 'L' && s[p - 1] == 'R')
                break;
            p += pm(s[p] == 'R');
            t.push(p);
            cnt++;
        }

        int j = 0;
        while(!t.empty()) {
            int p2 = t.front();
            t.pop();
            if(passed[p2])
                break;
            ans[p - (cnt - j) % 2]++;
            passed[p2] = true;
            j++;
        }
        chmax(i, p);
    }
    REP(i, l) { cout << ans[i] << " "; }
    return 0;
}


Measured memory_bytes: 1232
#include <stdio.h>
#define min(a,b) a<b?a:b

int main(){
	int n;
	int i,j;
	int c;
	int a[1000001];
	int b[1000001];
 
	for(i = 0;i < 1000001;i++){
		a[i] = i;
		b[i] = i;
	}

	for(i = 3,c = 4;c < 1000001;i++){
		for(j = c;j < 1000001;j++){
			a[j] = min(a[j],a[j-c]+1);
		}
		if(c % 2){
			for(j = c;j < 1000001;j++){
				b[j] = min(b[j],b[j-c]+1);
			}
		}
		c = i * (i+1) * (i+2) / 6;
	}

	while(scanf("%d",&n),n){
		printf("%d %d\n",a[n],b[n]);
	}
	
	return 0;
}

Measured memory_bytes: 8408
import sys
sys.setrecursionlimit(10**7)
def dfs_rec():
    W,H = list(map(int,input().split()))
    if W == 0 and H == 0:
        exit()
    C = [list(map(int,input().split())) for _ in range(H)]
    D = [[0,1],[0,-1],[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1]]
    
    def dfs(C, x, y):
        C[y][x] = 2
        for d in D:
            if x+d[0] < 0 or x+d[0] > W-1 or y+d[1] < 0 or y+d[1] > H-1:
                continue
            if C[y+d[1]][x+d[0]] == 0 or C[y+d[1]][x+d[0]] == 2:
                continue
            dfs(C, x+d[0], y+d[1])
    
    count = 0
    for w in range(W):
        for h in range(H):
            if C[h][w] == 0 or C[h][w] == 2:
                continue
            dfs(C, w, h)
            count += 1
    
    print(count)

while True:
    dfs_rec()


Measured memory_bytes: 8476
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 1000005
using namespace std;
int n,ans,q[maxn],fr=1,bk;
char s[maxn],t[maxn];
int main()
{
	scanf("%d%s%s",&n,s+1,t+1);
	if(!strcmp(s+1,t+1)) { printf("0\n"); return 0; }
	for(int i=n,pos=n;i;i--)
	{
		if(t[i]==t[i-1]) continue;
		for(pos=min(pos,i);pos&&s[pos]!=t[i];pos--);
		if(!pos) { printf("-1\n"); return 0; }
		while(fr<=bk&&q[fr]-(bk-fr+1)+1>i) fr++;
		q[++bk]=pos;
		if(i!=pos) ans=max(ans,bk-fr+1);
	}
	printf("%d\n",ans+1);
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rem(i, s, n) for (int i = (s); i >= (n); --i)
using ll = long long;
const int MOD = 1e9 + 7;

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

    if (0 < a) {
        if (a <= k) {
            k -= a;
            a = 0;
        }
        else {
            a -= k;
            k = 0;
        }
    }
    if (0 < k && 0 < b) {
        b = max(0ll, b - k);
    }

    cout << a << " " << b << endl;

    return 0;
}

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

bool isPrime(int a){
	int x = (int)sqrt(a);
	int val = 1;
	for (int i = 2; i <= x; i++) val *= (a % i != 0);
	return (val == 1);
}

int main(){
	int n, count, a;
	cin >> n;
	count = 0;
	for (int i = 0; i != n; i++){
		cin >> a;
		count += isPrime(a);
	}
	cout << count << endl;
}


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

 //if((a+b)%2==0)cout<<(a+b)/2<<endl;
 //else cout<<(a+b)/2+1<<endl;
 cout<<(a+b+1)/2<<endl;
 return 0;
}

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

using namespace std;
#define int long long
const int INF = 200000000007;


  
signed main(){
    int n,k,p=1;
    cin>>n>>k;
    int m=n;
    int sum=0,all=n,al;
    while((k-1)/p!=0){
        al=all;
        if(m>(k-1)/p){
           sum = 2*sum+(m-(k-1)/p);
          
           m=(k-1)/p;
        }
         all*=2;
        p*=2;
    }
    al=all;
    sum = 2*sum+(m-(k-1)/p);
           all*=2;
    //cerr<<sum<<all;
    long double ans1=al,ans2=sum;
    cout<< setprecision(15)<<ans2/ans1;
    
   
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>

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

using namespace std;

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

const int MAX_N = 1005;
int a[MAX_N*MAX_N];
int b[MAX_N*MAX_N];

int main(){
	int n, m;
	while(cin >> n >> m, n|m){
		vector<ll> v(n+1);
		rep(i, n) cin >> v[i];
		n++;
		rep(i, n){
			rep(j, n){
				a[i*n+j] = b[i*n+j] = v[i]+v[j];
			}
		}
		sort(b, b+n*n);
		int ans = 0;
		rep(i, n*n){
			if(m-a[i] >= 0) ans = max(ans, a[i] + *(upper_bound(b, b+n*n, m-a[i])-1));
		}
		cout << ans << endl;
	}

	return 0;
}

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

namespace AtCoderExamCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string S, T;

            S = Console.ReadLine();
            T = Console.ReadLine();

            int answer = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] != T[i])
                {
                    answer++;
                }
            }

            Console.WriteLine(answer);
        }
    }
}


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

int main() {
	long long int N, M;
	cin >> N >> M;
	if(N > M){
		swap(N, M);
	}
	if(N * M == 1){
		cout << 1 << endl;
	}else if(N == 1){
		cout << M - 2 << endl;
	}else{
		cout << (N - 2) * (M - 2) << endl;
	}
	return 0;
}


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

int main() {
  int P, Q, R;
  int D[3];

  cin >> P >> Q >> R;

  D[0] = P + Q;
  D[1] = P + R;
  D[2] = Q + R;
  sort(D, D + 3);

  cout << D[0] << endl;
  return 0;
}

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

public class Program
{

	public void Proc()
	{
        string inpt = Reader.ReadLine();
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < inpt.Length; i+=2) {
            ans.Append(inpt[i]);
        }
        Console.WriteLine(ans.ToString());
    }


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"



atcoder


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 11616
N, M = map(int, input().split())

AB = [tuple(map(int,input().split())) for i in range(M)]

es = [[] for _ in range(N)]
for a, b in AB:
    es[a-1].append(b-1)
    es[b-1].append(a-1)

ans = [-1] * N
ans[0] = 0

import queue
que = queue.Queue()
que.put(0)

while que.qsize():
    s = que.get()
    for v in es[s]:
        if ans[v] == -1:
            ans[v] = s+1
            que.put(v)

print("Yes")
print(*ans[1:], sep="\n")

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;
  VL cs(N), ss(N), fs(N);
  REP(i,N-1){
	cin >> cs[i] >> ss[i] >> fs[i];
  }
  VL ans(N);
  REP(i,N){
	LL crt = 0;
	FOR(j,i,N-1){
	  crt = max(ss[j], crt + (fs[j] - crt % fs[j]) % fs[j]) + cs[j];
	}
	ans[i] = crt;
  }

  REP(i,N)
	cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 256
N=int(input())
for h in range(1,3501):
    if 4*h<=N:
        continue
    for w in range(h,3501):
        if 4*h*w>(h+w)*N and (N*h*w)%(4*h*w-(h+w)*N)==0:
            print(h,w,(N*h*w)//(4*h*w-(h+w)*N))
            exit()

Measured memory_bytes: 39152