akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <string>
#include <iostream>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <unordered_map>
using namespace std;

const int N = 1e6;

namespace fastinput
{
	/** Interface */

	inline long long readChar();
	template <class T = long long> inline T readInt();
	template <class T> inline void writeInt(T x, char end = 0);
	inline void writeChar(long long x);
	inline void writeWord(const char *s);

	/** Read */

	static const long long buf_size = 16384;

	inline long long getChar() {
		static char buf[buf_size];
		static long long len = 0, pos = 0;
		if (pos == len)
			pos = 0, len = fread(buf, 1, buf_size, stdin);
		if (pos == len)
			return -1;
		return buf[pos++];
	}

	inline long long readChar() {
		long long c = getChar();
		while (c <= 32)
			c = getChar();
		return c;
	}

	template <class T>
	inline T readInt() {
		long long s = 1, c = readChar();
		T x = 0;
		if (c == '-')
			s = -1, c = getChar();
		while ('0' <= c && c <= '9')
			x = x * 10 + c - '0', c = getChar();
		return s == 1 ? x : -x;
	}

	/** Write */

	static long long write_pos = 0;
	static char write_buf[buf_size];

	inline void writeChar(long long x) {
		if (write_pos == buf_size)
			fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
		write_buf[write_pos++] = x;
	}

	template <class T>
	inline void writeInt(T x, char end) {
		if (x < 0)
			writeChar('-'), x = -x;

		char s[24];
		long long n = 0;
		while (x || !n)
			s[n++] = '0' + x % 10, x /= 10;
		while (n--)
			writeChar(s[n]);
		if (end)
			writeChar(end);
	}

	inline void writeWord(const char *s) {
		while (*s)
			writeChar(*s++);
	}

	struct Flusher {
		~Flusher() {
			if (write_pos)
				fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
		}
	} flusher;
}

using namespace fastinput;

long double group = 0;

int can1[N];
int amount[N];

int main()
{
	::ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n = readInt();
	int m = readInt();
	can1[0] = 1;
	for (int i = 0; i < n; ++i)
		amount[i] = 1;

	for (int i = 0; i < m; ++i)
	{
		int x = readInt(), y = readInt();
		--x, --y;
		--amount[x];
		++amount[y];
		if (can1[x])
			can1[y] = 1;
		if (amount[x] == 0)
			can1[x] = 0;
	}
	int ans = 0;
	for (int i = 0; i < n; ++i)
		ans += can1[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main()
{
    int n,m;
    int i=0, j=0;
    int A[101][101]={0};
    int b[101]={0};
    int c[101]={0};

    
    scanf("%d %d",&n, &m);
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            scanf("%d",&A[i][j]); 
        }
    }
    for(j=0; j<m; j++){
        scanf("%d",&b[j]); 
    }
    
    
    
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            c[i] += A[i][j] * b[j]; 
        }
    }


    for(i=0; i<n; i++){
        printf("%d\n",c[i]);
    }
    return 0;
}


Measured memory_bytes: 2084
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int dish[n + 1];
	int satisfaction[n + 1];
	int extra[n];

	for (int j = 0; j < n; j++) cin >> dish[j];
	for (int j = 0; j < n; j++) cin >> satisfaction[j];
	for (int j = 0; j < n - 1; j++) cin >> extra[j];
	int gr = satisfaction[0];
	for (int i = 1; i < n; i++)
	{

		gr += satisfaction[i];
		if (dish[i] == dish[i - 1] + 1)
		{
			gr += extra[dish[i - 1] - 1];
		}
	}
	cout << gr << endl;




	return 0;
}


Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
use rand::prelude::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;
use std::time::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn calc_score(t: &Vec<usize>, c: &Vec<isize>, s: &Vec<Vec<isize>>) -> isize {
    let n = c.len();
    let d = t.len();
    let mut last = vec![0; n];
    let mut score = 0;
    for i in 0..d {
        let ti = t[i];
        score += s[i][ti];
        last[ti] = i + 1;
        for j in 0..n {
            score -= c[j] * (i + 1 - last[j]) as isize;
        }
    }
    score
}

fn initial_guess(c: &Vec<isize>, s: &Vec<Vec<isize>>) -> Vec<usize> {
    let n = c.len();
    let d = s.len();
    let mut t = vec![0; d];
    let mut last = vec![0; n];
    for i in 0..d {
        t[i] = (0..n)
            .max_by_key(|&j| {
                s[i][j]
                    - (0..n)
                        .map(|k| c[k] * (i + 1 - last[k]) as isize)
                        .sum::<isize>()
            })
            .unwrap();
        last[t[i]] = i + 1;
    }
    t
}

fn main() {
    let start = SystemTime::now();
    let limit = Duration::from_millis(1500);
    let n = 26;
    input! {
        d: usize,
        c: [isize; n],
        s: [[isize; n]; d],
    }
    let mut t = initial_guess(&c, &s);
    let mut rng = thread_rng();
    let mut score = calc_score(&t, &c, &s);
    eprintln!("{}", score);
    loop {
        let di = rng.gen_range(0, d);
        let qi = rng.gen_range(0, n);
        let old = t[di];
        t[di] = qi;
        let new_score = calc_score(&t, &c, &s);
        if new_score <= score {
            t[di] = old;
        } else {
            score = new_score;
        }
        if start.elapsed().unwrap() >= limit {
            break;
        }
    }
    eprintln!("{}", score);
    for &ti in &t {
        println!("{}", ti + 1);
    }
}


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

using namespace std;

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

    int n;
    cin >> n;
    map<string, int> mp;
    string s;

    while (n--) {
        cin >> s;
        ++mp[s];
    }
    vector<string> v = {"AC", "WA", "TLE", "RE"};
    for (auto i : v) {
        cout << i << " x " << mp[i] << '\n';
    }

}

Measured memory_bytes: 3672
def show(imos):
    print(imos[:20])
    print()
n, C = [int(i) for i in input().split()]
imos = [[0 for _ in range(C)] for _ in range(10**5+10)]
for i in range(n):
    s, t, c = [int(i) - 1 for i in input().split()]
    imos[s][c] += 1
    imos[t][c] -= 1
# show(imos)
_max = 0
for i in range(1, len(imos)):
    _count = 0
    for j in range(C):
        if imos[i][j] < 0:
            _count += -imos[i][j]
        imos[i][j] += imos[i-1][j]
    _max = max(_max, sum(imos[i]) + _count)
# show(imos)
print(_max)

Measured memory_bytes: 40312
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
  cin>>s;
  int N=s.size();
  string ans="";
  for(int i=0;i<N;i++){
  if(i%2==0)
    ans+=s.at(i);
  }cout<<ans<<endl;
  return 0;
}

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

pair<int,int> dat[105];
vector<int> vt[4];

map<int, int> mp[2];

int main()
{
	int n, w;
	scanf("%d%d",&n,&w);

	for (int i = 0; i < n; i++)
	{
		scanf("%d%d",&dat[i].first,&dat[i].second);
		vt[dat[i].first - dat[0].first].push_back(dat[i].second);
	}

	int b = dat[0].first;

	for (int i = 0; i < 4; i++)
	{
		sort(vt[i].begin(), vt[i].end(), greater<>());
		for (int j = 1; j < vt[i].size(); j++)
		{
			vt[i][j] += vt[i][j - 1];
		}

		vt[i].insert(vt[i].begin(), 0);
	}

	for (int x = 0; x < 4; x += 2)
	{
		for (int i = 0; i < vt[x].size(); i++)
		{
			for (int j = 0; j < vt[x + 1].size(); j++)
			{
				long long cost = (b + x) * 1ll * i + (b + x + 1) * 1ll * j;
				if (cost > w) continue;

				mp[x / 2][cost] = max(mp[x / 2][cost], vt[x][i] + vt[x + 1][j]);
			}
		}
	}

	int ans = 0;

	for (auto &e : mp[0])
	{
		for (auto &f : mp[1])
		{
			if (e.first + f.first <= w) ans = max(ans, e.second + f.second);
		}
	}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int> color;//0:白1:灰2:黒
vector<vector<int>> M;
vector<int> d;
vector<int> p;
typedef long long int Int;

const int INF = 10000000;
int n;
void dijkstra(int s){
    
    for(int i=0;i<n;i++){
        d[i] = INF;
    }
    d[s] = 0;
    p[s] = -1;

    while(1){
        int u=-1;
        int mincost = INF;
        for(int i=0;i<n;i++){
            if(color[i]!=2&&d[i]<mincost){
                mincost = d[i];
                u = i;
            }
        }
        if(mincost == INF) break;
        color[u] = 2;
        for(int v=0;v<n;v++){
            if(color[v]!=2&&M[u][v]!=INF){
                if(d[u]+M[u][v]<d[v]){
                    d[v] = d[u]+M[u][v];
                    p[v] = u;
                    color[v] = 1;
                }
            }
        }
    }
}

int main(){
    cin >> n;
    color.assign(n,0);//0:白1:灰2:黒
    M.assign(n,vector<int>(n,INF));
    d.resize(n);
    p.resize(n);
    for(int i=0;i<n;i++){
        int id,k;cin >> id >> k;
        for(int j=0;j<k;j++){
            int v,cost;cin >> v >> cost;
            M[id][v] = cost;
        }
    }
    dijkstra(0);
    for(int i=0;i<n;i++){
        cout << i << " ";
        cout << d[i] << endl;
    }
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

void _main() {
  int N;
  cin >> N;
  int A[N];
  rep(i, 0, N) cin >> A[i];

  int ans=0;
  rep(i, 0, N) {
    ans++;
    while (N > i+1 && A[i] == A[i+1]) i++;
    if (N == i+1) break;
    if (A[i] < A[i+1]) {
      while (N > i+1 && A[i] <= A[i+1]) i++;
    } else {
      while (N > i+1 && A[i] >= A[i+1]) i++;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 640
import heapq

N = int(input())
happiness = [list(map(int, input().split())) for i in range(N)]

queue = []
for i in range(N):
    x, y = happiness[i]
    queue.append([-(x+y), x, y])

heapq.heapify(queue)
takahashi = 0
aoki = 0
for i in range(N):
    dish = heapq.heappop(queue)
    if i % 2 == 0:
        takahashi += dish[1]
    else:
        aoki += dish[2]

print(takahashi-aoki)

Measured memory_bytes: 37876
INF = 10 ** 10

def synthetic_kadomatsu(n, a, b, c, l)
  dfs = ->(cur, a_len, b_len, c_len) {
    if cur == n
      return [a_len, b_len, c_len].min > 0 ? (a - a_len).abs + (b - b_len).abs + (c - c_len).abs - 30 : INF # 最初の1回分のMP10のコストは本来不要。a,b,c3回分の30引く
    end

    ret0 = dfs.call(cur + 1, a_len, b_len, c_len)
    ret1 = dfs.call(cur + 1, a_len + l[cur], b_len, c_len) + 10
    ret2 = dfs.call(cur + 1, a_len, b_len + l[cur], c_len) + 10
    ret3 = dfs.call(cur + 1, a_len, b_len, c_len + l[cur]) + 10
    [ret0, ret1, ret2, ret3].min
  }
  dfs.call(0, 0, 0, 0)
end

n, a, b, c = gets.split.map(&:to_i)
l = []
n.times { l << gets.to_i }

puts synthetic_kadomatsu(n, a, b, c, l)


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
typedef long long i64;
int main(){
    int N;
    cin >> N;
    int sqrt_int = (int)sqrt(N);
    cout << sqrt_int*sqrt_int << endl;
    return 0;
}


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

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var S = Input.Line();
            Console.WriteLine(S.First() + (S.Length - 2).ToString() + S.Last());
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

Measured memory_bytes: 13268
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


class B {
	int x, y, z;
public:
	B()
	{
		cin >> x >> y >> z;
	}
	void solve()
	{
		x -= z;

		cout << x / (y + z) << endl;

	}
};


int main()
{
	B solution;
	solution.solve();

	return 0;
}

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
   
     if(a < b && b < c){
     int a, b ,c;
     cout << "Yes" << endl;
   }else{
     int a, b, c;
     cout << "No" << endl;
   }
  return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
int n, a[1001], ans, k, po[43];
vector<int> x, y;
bool ck;
 
signed main(){
    cin >> n >> k;
    po[0] = 1;
    for(int i = 1; i <= 42; i++) po[i] = po[i - 1] * 2;
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 1; i <= n; i++){
        int ans = 0;
        for(int j = i; j <= n; j++){
            ans += a[j];
            x.push_back(ans);
        }
    }
    //for(int i = 0; i < x.size(); i++) cout << x[i] << endl;
    for(int i = 42; i >= 0; i--){
        //cout << i << " " << tmp << "\n";
        y.clear();
        for(int j = 0; j < x.size(); j++){
            //cout << (x[j] & po[i]) << " ";
            if((x[j] & po[i])) y.push_back(x[j]);
        }
        //cout << endl;
        //cout << i << " " << y.size() << endl;
        if(y.size() < k) continue;
        ans += po[i];
        x.clear();
        x = y;
    }
    cout << ans;
}

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

int main() {
  int64_t n, ans=0;
  cin>>n;
  if(n%2==1){
    cout<<0<<endl;
    return 0;
  }
  else{
    n/=10;
    while(n>0){
      ans+=n;
      n/=5;
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"
#include "stack"
#include "tuple"

#define rep(n) for (int i = 0; i < n; ++i)
#define REP(n,i) for (int i = 0; i < n; ++i)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define mkt make_tuple
#define P pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int m, n, dp[2001][2001][2] = {}, ans = 0;
string s, t;

int main() {
	cin >> m >> n >> s >> t;
	for (int i = 0; i != m+1; ++i) {
		for (int j = 0; j != n+1; ++j) {
			if (i&&s[i-1] == 'O'&&dp[i - 1][j][1])
				dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][1] + 1);
			if (j&&t[j-1] == 'O'&&dp[i][j - 1][1])
				dp[i][j][0] = max(dp[i][j][0], dp[i][j - 1][1] + 1);
			if ((i>0&&s[i-1] == 'I') || (j>0&&t[j-1] == 'I'))
				dp[i][j][1] = max(dp[i][j][1],1);
			if (i&&s[i-1] == 'I')
				dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][0] + 1);
			if (j&&t[j-1] == 'I')
				dp[i][j][1] = max(dp[i][j][1], dp[i][j - 1][0] + 1);
		}
	}
	for (int i = 0; i != m+1; ++i) {
		for (int j = 0; j != n+1; ++j) {
			ans = max(ans, dp[i][j][1]);
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 34480
object Main {
  def main(args: Array[String]) = {

    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt
    val I = List.fill(N)(sc.nextInt)
    sc.close()

    val ans = I.tail.foldLeft(I.head)((acc, cur) => acc ^ cur)
    ans == 0 match {
      case true => println("Yes")
      case _    => println("No")
    }
  }
}

Measured memory_bytes: 56388
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl '\n';

int main(){
    ios_base::sync_with_stdio(0); cin.tie(nullptr);
    ll n,k; cin>>n>>k;
    ll cnt=0;
    while(n--){
    	ll a,b; cin>>a>>b;
    	if(sqrt(a*a+b*b)<=k) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int n;
	vector<int>listn, listc;

	cin >> n;

	for (int i = 0; i < n; i++) {
		int num;
		cin >> num;
		listn.push_back(num);
	}

	for (int i = 0; i < n; i++) {
		int num;
		cin >> num;
		listc.push_back(num);
	}

	int sum = 0;

	for (int i = 0; i < n; i++) {
		if (listn[i] > listc[i]) {
			sum += (listn[i] - listc[i]);
		}
	}

	cout << sum << endl;



	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n,k;
int a[100001];
int maxsum,sum;

int main(){
	while(1){
		cin >> n>>k;
		if(n==0&&k==0)break;
		for(int i=0;i<n;i++){
			cin >>a[i];
		}
		sum=maxsum=0;
		for(int i=0;i<k;i++){
			sum+=a[i];
		}
		maxsum=sum;
		for(int i=0;i<n-k;i++){
			sum=sum+a[i+k]-a[i];
			if(maxsum<sum)maxsum=sum;
		}
		cout <<maxsum <<endl;
	}
	return 0;
}

Measured memory_bytes: 3472
#include<iostream>

using namespace std;

int main(){
   int n,i,j,k,d,b,flg=0,ans=0;
   cin >> n >> k;
   int a[101];
   for(i=0;i<101;i++){
       a[i]=0;
   }
    for(i=0;i<k;i++){
        cin >> d;
        for(j=0;j<d;j++){
            cin >> b;  
            a[b-1] =1;
                    
        }
    }
    for(i=0;i<101;i++){
        flg =flg + a[i];
    }
    ans = n-flg;
    cout << ans << endl;
    return 0;
}

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

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

    if (k % 2 == 1) {
        cout << (n / k) * (n / k) * (n / k) << endl;
    } else {
        cout << (n / k) * (n / k) * (n / k) + ((n + k / 2) / k) * ((n + k / 2) / k) * ((n + k / 2) / k) << endl;
    }
}

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


int r,n;
int a,b,c;
int main(){

	while(1){
		cin>>r>>n;
		if(r==0&&n==0)return 0;
		
		int h[40]={0};

		for(int i=0;i<n;i++){
			cin>>a>>b>>c;

			for(int j=a;j<b;j++){
				h[j+20]=max(h[j+20],c);
			}
		}

		// for(int i=0;i<40;i++){
		// 	cout<<i<<":"<<h[i]<<endl;
		// }

		double ans=114514.0;
		double tmp;

		for(int i=-1*r;i<r;i++){
			tmp=max(sqrt(r*r-i*i),sqrt(r*r-(i+1)*(i+1)));
			ans=min(ans,h[i+20]-tmp+r);
		}
		cout<<ans<<endl;	
	}
}

Measured memory_bytes: 3216
import java.util.Scanner;
public class Main {
  public static void main( String[] args ) {
	  Scanner scan = new Scanner(System.in);
	  long N = scan.nextLong();
	  long moveCnt = (long)Math.pow(10,18);
	  for( long i = 1;i * i <= N;i++ ) {
		  if( N % i != 0 )continue;
		  long j = N / i;
		  if( moveCnt > i + j - 2 ) {
			  moveCnt = i + j - 2;
		  }
	  }
	  System.out.println(moveCnt);
  }
}



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

int main(void){
  string a, b, c; cin >> a >> b >> c;
  if((a[a.size()-1] == b[0]) && (b[b.size()-1] == c[0])) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author lstd
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>

using namespace std;

#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i,1,n)
#define REP(i,n) FOR(i, 0, (int)(n)-1)
#define fst first
#define snd second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}



void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

int XMOV[4] = {0, 0, 1, -1};
int YMOV[4] = {1, -1, 0, 0};

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using namespace std;

class CFiveTransportations {
public:
	void solve(std::istream& in, std::ostream& out) {
		vector<ll> v;
		ll x;
		ll n;
		in >> n;
		REP(i,6)
			in >> x, v.pb(x);
		sort(v.begin(), v.end());
		ll ans = ceil(n/(double)v[0]);
		ans += 4;
		out << ans;

	}
};

int main() {
	CFiveTransportations solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
//raja1999
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);
map <int ,int>mapi;
map< int,int  > ::iterator it;
int a[1005][1005],b[1005];
int main(){
	int n;
	cin>>n;
	if(n/10==0){
		if(n==9){
			cout<<"Yes"<<endl;
		}
		else
		{
			cout<<"No"<<endl;
		}
	}
	else{
		if(n%10==9||n/10==9){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    int x,y,M,N,xmax,ymin;
    scanf("%d %d %d %d",&N,&M,&xmax,&ymin);
    for(int i = 0; i < N; i++)
    {
        scanf("%d",&x);
        if(x > xmax) xmax = x;
    }
    for(int i = 0; i < M; i++)
    {
        scanf("%d",&y);
        if(y < ymin) ymin = y;
    }
    
    printf("%s\n",(xmax >= ymin)? "War":"No War");
}


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

using Lint=long long;


// Cooley–Tukey FFT algorithm O(N log N)
vector<complex<double>> fft(vector<complex<double>> a, bool inverse = false) {
    int n = a.size();
    int h = 0; // h = log_2(n)
    for (int i = 0; 1 << i < n; i++) h++;
    // バタフライ演算用の配置入れ替え
    for (int i = 0; i < n; i++) {
        int j = 0;
        for (int k = 0; k < h; k++) j |= (i >> k & 1) << (h - 1 - k);
        if (i < j) swap(a[i], a[j]);
    }
    // バタフライ演算
    for (int b = 1; b < n; b *= 2) {
        // 第 log_2(b) + 1 段
        // ブロックサイズ = b * 2
        for (int j = 0; j < b; j++) {
            // ブロック内 j 個目
            // 重み w = (1 の原始 2b 乗根の j 乗)
            complex<double> w =
                polar(1.0, (2 * M_PI) / (2 * b) * j * (inverse ? 1 : -1));
            for (int k = 0; k < n; k += b * 2) {
                // k を先頭とするブロック
                complex<double> s = a[j + k];         // 前
                complex<double> t = a[j + k + b] * w; // 後
                a[j + k] = s + t;                     // 前の更新
                a[j + k + b] = s - t;                 // 後の更新
            }
        }
    }
    // 逆変換時にサイズで割る調整
    if (inverse)
        for (int i = 0; i < n; i++) a[i] /= n;
    return a;
}
// Cooley–Tukey FFT algorithm O(N log N)
vector<complex<double>> fft(vector<double> a, bool inverse = false) {
    vector<complex<double>> a_complex(a.size());
    for (int i = 0; i < a.size(); i++) a_complex[i] = complex<double>(a[i], 0);
    return fft(a_complex, inverse);
}

// FFT による畳み込み O(N log N)
vector<double> convolve(vector<double> a, vector<double> b) {
    int s = a.size() + b.size() - 1; // 畳み込み結果のサイズ
    int t = 1; // FFT に使う配列のサイズ（2 の累乗）
    while (t < s) t *= 2;
    a.resize(t); // FFT するためにリサイズ
    b.resize(t); // FFT するためにリサイズ
    vector<complex<double>> A = fft(a);
    vector<complex<double>> B = fft(b);
    for (int i = 0; i < t; i++) {
        A[i] *= B[i]; // 畳み込み結果の FFT 結果を得る
    }
    A = fft(A, true); // IFFT で畳み込み結果を得る
    a.resize(s);      // 畳み込み結果を入れるためにリサイズ
    for (int i = 0; i < s; i++) a[i] = A[i].real(); // 実部が答え
    return a;
}

int main() {
    // 畳み込みで答えを計算
    Lint N,M; cin>>N>>M;

   const int MAX=100000;
   vector<double> c(2*MAX+1);
   for(int i=0;i<N;i++){
      int a; cin>>a; 
      c[a]++;
   };

   vector<double> a=c,b=c;
   vector<double> ans=convolve(a, b);
   vector<Lint> cnt(2*MAX+1);
   for(int i=0;i<=2*MAX;i++){
      cnt[i]=(Lint)(ans[i]+0.5);
   }
   /*
   vector<Lint> cnt(2*MAX+1);
   for(int i=2;i<=2*MAX;i++){
      for(int j=1;j<i;j++) cnt[i]+=c[j]*c[i-j];
   }
   */
   // for(int i=1;i<=MAX*2;i++) cout<<cnt[i]<<' '; cout<<endl;
   Lint sum=0;
   for(int i=MAX*2;i>=2;i--){
      if(M>0){
         Lint num=min(M,cnt[i]);
         sum+=(Lint)i*num;
         M-=num;
      }
   }
   cout<<sum<<endl;
   return 0;
}


Measured memory_bytes: 42432
from sys import stdin


def main():
    S = input()
    new_S = ''.join(list(reversed(S)))
    sum_ = 0

    for i in range(len(S)):
        if not S[i] == new_S[i]:
            sum_ += 1

    print(sum_//2)


if __name__ == "__main__":
    main()


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int result = 0;
    for (int i = 0; i < n; ++i) {
        while (a[i] % 2 == 0) {
            a[i] /= 2;
            result += 1;
        }
    }
    cout << result << endl;
}


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


int main() {
	int H, W;
	cin >> H >> W;
	vector<vector<char>> s(H, vector<char>(W));
	rep(r, H) rep(c, W) cin >> s[r][c];
	const int inf = 1001001001;
	vector<vector<int>> dp(H, vector<int>(W, inf));
	dp[0][0] = 0;
	if(s[0][0] == '#') dp[0][0]++;
	
	rep(r, H) rep(c, W) {
		if(r < H-1) {
			if(s[r][c] != s[r+1][c]) dp[r+1][c] = min(dp[r+1][c], dp[r][c] + 1);
			else dp[r+1][c] = min(dp[r+1][c], dp[r][c]);
		}
		if(c < W-1) {
			if(s[r][c] != s[r][c+1]) dp[r][c+1] = min(dp[r][c+1], dp[r][c] + 1);
			else dp[r][c+1] = min(dp[r][c+1], dp[r][c]);
		}
	}
	cout << (dp[H-1][W-1]+1)/2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int mod=998244353;
const int N=3e5+5;
const int inf=1e9+7;
int da[N];
char s[N];

int main()
{
    long double x;
    cin>>x;
    long double ans=x/3.0;
    cout<<fixed<<setprecision(9)<<ans*ans*ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static int binarySearch(int n, int A[], int key) {
        int left = 0;
        int right = n;
        while(left < right) {
            int mid = (left + right) / 2;
            if(A[mid] == key) return 1;
            else if(key < A[mid]) right = mid;
            else left = mid + 1;
        }
        return 0;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        int[] A;
        A = new int[n];
        for(int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        for(int i = 0; i < q; i++) {
            int key = sc.nextInt();
            count += binarySearch(n, A, key);
        }
        System.out.println(count);
    }    
}


Measured memory_bytes: 68172
ab = gets.to_s
ab = ab.split(" ")
a = ab[0].to_i
b = ab[1].to_i
sum = 0

if a > b
  sum += a
  a = a - 1
else
  sum += b
  b = b - 1
end

if a > b
  sum += a
  a = a - 1
else
  sum += b
  b = b - 1
end
puts sum


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

int main(){
  int n, min, temp, count=1;
  cin >> n;
  cin >> min;
  rep(i, n-1){
    cin >> temp;
    if (temp < min){
      count++;
      min = temp;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
"""
i - j = A[i] + A[j]
> i - A[i] = j + A[j]
i > j
"""
N = int(input())
high = list(map(int, input().split()))

ans = 0
calc = {}
for i in range(1, N+1):
  try:
    ans += calc[i - high[i-1]]
  except KeyError:
    pass
  if (i + high[i-1]) in calc.keys():
    calc[i + high[i-1]] += 1
  else:
    calc[i + high[i-1]] = 1

print(ans)

Measured memory_bytes: 40376
// kartikay26
#include <bits/stdc++.h>
using namespace std;
#define debug(x...) 
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
template<typename L>void print(L x){cout << x << endl;}
template<typename T, typename... A>
void print(T x,A... r){cout << x << " ";print(r...);}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef long long int ll;
#define int ll
const int inf = LLONG_MAX;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int mod = 1e9+7;
const int N = 1e6+1;

int32_t main(){
	fast_io();
	int n; cin >> n;
	vi b(n-1);
	for(auto &i : b){
		cin >> i;
	}
	vi a(n);
	// print(b,a);
	for (int i = 1; i < n-1; ++i) {
		a[i] = min(b[i-1], b[i]);
	}
	a[0] = b[0];
	a[n-1] = b[n-2];
	int s = 0;
	for(auto &i : a){
		s += i;
	}
	print(s);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
    { for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
    { os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
    { cerr << " " << H; debug_out(T...); }
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int r;
    cin >> r;
    cout << r * r << endl;
}

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


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define fori(a,b) for(int i=a;i<b;i++)
#define forj(a,b) for(int j=a;j<b;j++)
#define ford(b,a) for(int i=b;i>=a;i--)
typedef pair<int, int> pi;
#define PI 3.14159265359
#define vi vector<int>
long long mod=1000000007;
//int count=INT_MAX;
 
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int testcases=1;
    //cin>>testcases;
    //cout<<t;
    //scanf("%d",&t);
    while(testcases--){  
        int t;
        cin>>t;
        if(t>=30){
            cout<<"Yes\n";
        }
        else cout<<"No\n";
    }                                                                                          
    
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <deque>

int main()
{
    std::string initial;

    std::cin >> initial;

    int queryCount = 0;
    std::cin >> queryCount;

    std::deque<std::string::value_type> work;
    work.assign(initial.begin(), initial.end());

    bool inverted = false;
    for (auto count = 0; count < queryCount; ++count)
    {
        int instruction = 0;
        std::cin >> instruction;
        if (instruction == 1)
        {
            inverted = !inverted;
        }
        else
        {
            int option = 0;
            std::cin >> option;
            bool optionInvert = inverted;
            if (option == 1)
            {
                optionInvert = !optionInvert;
            }

            char append = '\0';
            std::cin >> append;

            if (optionInvert)
            {
                work.push_front(append);
            }
            else
            {
                work.push_back(append);
            }
        }
    }

    if (inverted)
    {
        std::cout << std::string(work.rbegin(), work.rend());
    }
    else
    {
        std::cout << std::string(work.begin(), work.end());
    }
    
    return 0;
}

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

using namespace std;

int main(){
    int n,a[10],b[10],c[10];
    cin>>n;
    for(int i=0;i<n;i++)
        c[i]=i+1;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
        cin>>b[i];
    int a1,b1,s=0;
    do{
        s++;
        bool t1=true,t2=true;
        for(int i=0;i<n;i++)
            if(c[i]!=a[i])
                t1=false;
        for(int i=0;i<n;i++)
            if(c[i]!=b[i])
                t2=false;
        if(t1)
            a1=s;
        if(t2)
            b1=s;
    }while(next_permutation(c,c+n));

    cout<<abs(a1-b1)<<endl;


    return 0;
}


Measured memory_bytes: 256
a11,a12,a13 = input().split()
a21,a22,a23 = input().split()
a31,a32,a33 = input().split()
A=[[a11,a12,a13],[a21,a22,a23],[a31,a32,a33]]
N = int(input())
b=[input() for i in range(N)]
bingo=[[False,False,False],[False,False,False],[False,False,False]]

for i in range(3):
  for j in range(3):
    for k in range(N):
      if A[i][j]==b[k]:
        bingo[i][j]=True

ans="No"
if bingo[0][0] and bingo[0][1] and bingo[0][2]:
  ans = "Yes"
if bingo[1][0] and bingo[1][1] and bingo[1][2]:
  ans = "Yes"
if bingo[2][0] and bingo[2][1] and bingo[2][2]:
  ans = "Yes"
if bingo[0][0] and bingo[1][0] and bingo[2][0]:
  ans = "Yes"
if bingo[0][1] and bingo[1][1] and bingo[2][1]:
  ans = "Yes"
if bingo[0][2] and bingo[1][2] and bingo[2][2]:
  ans = "Yes"
if bingo[0][0] and bingo[1][1] and bingo[2][2]:
  ans = "Yes"
if bingo[0][2] and bingo[1][1] and bingo[2][0]:
  ans = "Yes"
  
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N,M;cin >> N >> M;
    vector<vector<bool>> ab(N,vector<bool>(N,false));   // 隣接行列
    vector<int> p(N);
    rep(i,N)p[i] = i;       //  順列
    rep(i,M){       //  グラフ作成
        int a,b;cin >> a >> b;
        a--,b--;
        ab[a][b] = true;
        ab[b][a] = true;
    }
    bool ok = true;
    LL ans = 0;
    do{
        ok = true;
        if(p[0]!=0)continue;
        rep(i,N-1)if(ok)if(!ab[p[i]][p[i+1]])ok = false;
        if(ok)ans++;
    }while(next_permutation(all(p)));
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int gcd(int x, int y) {
	return y == 0 ? x : gcd(y, x%y);
}

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

	char b, res;
	cin >> b;
	if (b == 'A') res = 'T';
	else if (b == 'T') res = 'A';
	else if (b == 'G') res = 'C';
	else res = 'G';
	cout << res << "\n";
	
	return 0;
}

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

using namespace std;

struct Point
{
    int x, y;
};

struct Node
{
    vector<int> edges;
    int pair = -1;
};

using Graph = pair<vector<Node>, vector<Node>>;

vector<Point> ReadPoints(int size)
{
    vector<Point> points(size);
    for (auto &p : points) {
        cin >> p.x >> p.y;
    }
    return points;
}

bool CanBeFriends(const Point &red, const Point &blue)
{
    return red.x <= blue.x && red.y <= blue.y;
}

Graph BuildGraph(const vector<Point> &red, const vector<Point> &blue)
{
    Graph graph { vector<Node>(red.size()), vector<Node>(blue.size()) };

    for (size_t i = 0; i < red.size(); i += 1) {
        for (size_t j = 0; j < blue.size(); j += 1) {
            if (CanBeFriends(red[i], blue[j])) {
                graph.first[i].edges.push_back(j);
                graph.second[j].edges.push_back(i);
            }
        }
    }
    return graph;
}

int CountPairs(const Graph &g)
{
    int pairs = 0;
    for (const auto &node : g.first) {
        pairs += (node.pair != -1 ? 1 : 0);
    }
    return pairs;
}

bool FindPair(Graph &g, int node, vector<bool> &used)
{
    if (used[node]) {
        return false;
    }
    used[node] = true;

    for (const auto &other : g.first[node].edges) {
        if (g.second[other].pair == -1) {
            g.first[node].pair = other;
            g.second[other].pair = node;
            return true;
        }
    }

    for (const auto &other : g.first[node].edges) {
        if (FindPair(g, g.second[other].pair, used)) {
            g.first[node].pair = other;
            g.second[other].pair = node;
            return true;
        }
    }
    return false;
}

int FindMaxMatch(Graph &g)
{
    auto changed = true;
    while (changed) {
        changed = false;

        vector<bool> used(g.first.size(), false);
        for (size_t i = 0; i < g.first.size(); i += 1) {
            if (g.first[i].pair == -1 && FindPair(g, i, used)) {
                changed = true;
            }
        }
    }
    return CountPairs(g);
}

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

    auto red = ReadPoints(points);
    auto blue = ReadPoints(points);

    auto graph = BuildGraph(red, blue);
    auto res = FindMaxMatch(graph);
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
ans = []
while True:
    w, h = map(int, input().split())
    if w == 0 and h == 0:
        break
    c = [list(map(int, input().split())) for _ in range(h)]
    # print(*c, sep='\n')
    dx = [0, -1, 1]
    dy = [0, -1, 1]
    seen = [[0 for _ in range(w)] for _ in range(h)]
    cnt = 0
    def dfs(y, x, seen):
        seen[y][x] = 1
        # print(x, y, *seen,sep='\n')
        # print('\n')

        for i in range(3):
            for j in range(3):
                if i == 0 and j == 0:
                    continue
                if 0 <= x+dx[i] < w and 0 <= y+dy[j] < h:
                    if c[y+dy[j]][x+dx[i]] == 1 and seen[y+dy[j]][x+dx[i]] == 0:
                        dfs(y+dy[j], x+dx[i], seen)

    for i in range(h):
        for j in range(w):
            if not (seen[i][j] == 1 or c[i][j] == 0):
                dfs(i, j, seen)
                cnt += 1

    ans.append(cnt)

print(*ans, sep='\n')



Measured memory_bytes: 8056
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    ll r,d,x;
    cin>>r>>d>>x;
    rep(i,10){
        cout << (x=r*x-d) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int n,A,B,a,b;
	while(1){
		scanf("%d",&n);
		if(!n)break;
		A=B=0;
		while(n--){
			scanf("%d%d",&a,&b);
			a>b?A+=a+b:(a<b?B+=a+b:(A+=a,B+=b));
		}
		printf("%d %d\n",A,B);
	}
	return 0;
}

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

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

using Graph = vector<vector<int>>;

ll kzyou(ll a,ll k){//aのk乗を返す
    ll zyou = 1;
    for(ll i = 1;i<=k;i++){
        zyou *= a;
    }
    return zyou;
}
typedef pair<int,int> P;

bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}

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

  while(true){
   if(is_prime(X)){
     cout << X << endl;
     break;
   }
    X++;
  }
 }

Measured memory_bytes: 256
import Foundation

extension String {
    func toIntList() -> [Int] {
        return self.split(separator: " ").map{Int($0)!}
    }
    
    func toList() -> [String] {
        return self.map{String($0)}
    }
    
    func count(c:Character) -> Int{
        var result = 0

        for e in self{
            if e == c{
                result += 1
            }
        }
        return result
    }

    func counter() -> Dictionary<Character, Int>{
        var result:[Character:Int] = [:]
        
        for c in self{
            guard let _ = result.index(forKey: c) else {
                result[c] = 1
                continue
            }
            result[c]! += 1
        }
        return result
    }
}

extension Int {
    func toBin() -> String {
        return String(self, radix: 2)
    }
    
    func toD() -> Double {
        return Double(self)
    }
}

extension Double {
    func toI() -> Int {
        return Int(self)
    }
}

extension Array where Element: Equatable{
    func count(n:Self.Element) -> Int{
        var result = 0
        for e in self{
            if e == n{
                result += 1
            }
        }
        return result
    }
}


func agc016a() -> Int{
    var S = readLine()!
    let N = S.count
    let counter = S.counter()
    var answer = 999
    for c in counter.keys{
        var t = S
        var a = 0
        while t.count(c: c) != t.count {
            var tmp = ""
            for i in 0..<t.count-1 {
                let index = t.index(t.startIndex, offsetBy: i)
                let indexPlus = t.index(t.startIndex, offsetBy: i+1)
                if t[index] == c || t[indexPlus] == c{
                    tmp.append(c)
                } else {
                    tmp.append(t[index])
                }
            }
            a += 1
            t = tmp
        }
        answer = min(a, answer)
    }
    return answer
}

print(agc016a())


Measured memory_bytes: 13324
N, K = map(int, input().split())
A = list(map(lambda x: x-1, map(int, input().split())))
T = [False]*N

initcount = 0
count = 0
cur = 0
for _ in range(N):
    count += 1
    T[cur] = True
    cur = A[cur]
    if T[cur]:
        break
initcur = 0
for _ in range(count+1):
    initcount += 1
    initcur = A[initcur]
    if initcur == cur:
        break
if count != initcount:
    count -= initcount

if K <= initcount:
    cur = 0
    for _ in range(K):
        cur = A[cur]
    print(cur+1)
else:
    K -= initcount
    count = K%count
    for _ in range(count):
        cur = A[cur]
    print(cur+1)



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


vector<int> g[100010];

int dfs(int root){
    vector<int> r;
    for( auto i : g[root]){
        r.push_back(dfs(i));
    }
    sort(r.rbegin(), r.rend());
    int mx = 0;
    for(int i = 0 ; i < r.size() ; i++){
        mx = max(mx, r[i] + i + 1);
    }
    return mx;
}

void solve(long long N, vector<long long> a){
    for(int i = 0 ; i < N-1 ; i++){
        g[a[i]-1].push_back(i+1);
    }
    cout << dfs(0) << endl;

}

int main(){    
    long long N;
    scanf("%lld",&N);
    vector<long long> a(N-2+1);
    for(int i = 0 ; i < N-2+1 ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, a);
    return 0;
}



Measured memory_bytes: 16640