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

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
typedef pair<int,int>           PI;
typedef pair<ll,ll>             PL;
typedef vector<PI>               vip; 
typedef vector<int>             vi;
typedef vector<vi>              vvi;






int main (){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int d[5];
    REP(i,5){
        cin >> d[i];
    }
    int k;
    cin >> k;
    bool ans = true;
    REP(i,5){
        REP(j,5){
            if(abs(d[i] - d[j]) > k) ans = false;
        }
    }

    if(ans) cout << "Yay!" << endl;
    else cout << ":(" << endl;






    return 0;
}

Measured memory_bytes: 256
import numpy as np

H, N = map(int, input().split())
AB = np.array([list(map(int, input().split())) for i in range(N)])
A = AB[:, 0]
B = AB[:, 1]

# インデックスはライフ 値はそれを以下にする最小MP
dp = np.array([0 for i in range(H+1)])

for i in range(1, H+1):
    dp[i] = min(dp[np.maximum(i - A, 0)] + B)

print(int(dp[-1]))

Measured memory_bytes: 14692
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;

#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define ALL(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
long nCr(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
vector<int>a;
int l[100010], r[100010];
signed main() {
	int n,m;
	cin >> n>>m;
	rep(i, n) {
		int q;
		cin >> q;
		a.push_back(q);
	}
	rep(i, m) {
		cin >> l[i] >> r[i];
	}
	sort(a.begin(), a.end());
	rep(i, m) {
		auto s=upper_bound(ALL(a), r[i])-lower_bound(ALL(a),l[i]);
		cout << s << endl;
	}
}



Measured memory_bytes: 4120
#include <bits/stdc++.h>
#define lli long long int
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(lli i=0, i##_len=(lli)(n); i<i##_len; i++)
#define repf(i, n) for(lli i=1, i##_len=(lli)(n+1); i<i##_len; i++)
#define per(i, n) for(lli i=((lli)(n))-1; i>=0; i--)
#define perf(i, n) for(lli i=((lli)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<lli>
#define vvi vector<vector<lli>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    bool ans = true;
    lli size = s.size();
    rep(i, size){
        if((i+1)%2 == 0){
            if(s.at(i) == 'R') ans = false;
        }
        else{
            if(s.at(i) == 'L') ans = false;
        }
    }
    ans ? Yes() : No();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<iostream>
#include <math.h>//pow(x,y)=x^y
#include <algorithm>//sort(a.begin(), a.end());reverse(a.begin(), a.end());
#define rep(i,n) for (int i=0; i <(n);i++)
#define ll long long
#define rev(s) reverse(s.begin(),s.end())
#define sor(v) sort(v.begin(),v.end())

using namespace std;


int main() {
int N;
cin>>N;
vector<ll> L(N);
rep(i,N){
    cin >> L.at(i);
}

int result=0;
int a,b,c;

if(N==1 || N==2){
    cout<<0<<endl;
}else{
rep(i,N-2){
    for (int j=i+1; j <(N)-1;j++){
        for (int k=j+1; k <(N);k++){
            
            a = L.at(i);
            b = L.at(j);
            c = L.at(k);
            //cout<<i<<j<<k<<endl;
            //cout<<a<<b<<c<<endl;
            if((a+b>c)&&(b+c>a)&&(c+a>b)&&(a!=b)&&(b!=c)&&(c!=a)){
                result = result+1;
                //cout<<"t"<<endl;
            }

        }
    }
}
cout<<result<<endl;
}

}


Measured memory_bytes: 3580
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
long double PI = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998626034825342117;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(long long x, long long y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(long long x, long long y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
int main() {
    long long x; cin >> x;
    long long ans = x / 11;
    if (x % 11 == 0)cout << ans * 2 << endl;
    else if (x % 11 < 7)cout << ans * 2 + 1 << endl;
    else cout << ans * 2 + 2 << endl;
}

Measured memory_bytes: 3164
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;


int main()
{
  int n;
  string s;
  map<string,vector<int> > book;
  map<string,vector<int> >::iterator it;
    while(cin>>s>>n)
    {
      book[s].push_back(n);
    }
    for(it=book.begin();it!=book.end();it++)
      {
	sort(it->second.begin(),it->second.end());
	cout<<it->first<<endl;
	for(vector<int>::iterator it2=it->second.begin();it2!=it->second.end();)
	  {
	    	cout<<*it2;
		it2++;
		if(it2!=it->second.end())
		  cout<<" ";
		else
		  cout<<endl;
	  }
	//	cout<<*it<<endl;
      }
}

Measured memory_bytes: 0
N, Y = map(int, input().split())

for x in reversed(range(N + 1)): # 10000
  for y in reversed(range(N + 1 - x)): # 5000
    z = N - x - y
    if 10000*x  + 5000*y + 1000*z == Y:
      print(x, y, z)
      exit()

print(-1, -1, -1)

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

int main () {
    static int A, B;
    cin >> A >> B;
    if (A == B){
        cout << "Draw" << endl;
    }
    else if (A == 1) cout << "Alice" << endl;
    else if (B == 1) cout << "Bob" << endl;
    else if (A > B) cout << "Alice" << endl;
    else cout << "Bob" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define N 1005
using namespace std;

int n, m, a, b;
char c[N][N];
int main()
{
	int i, j;
	cin >> n >> m >> a >> b;
	for (i = 0; i < n; i++) for (j = 0; j < m; j++) c[i][j] = '.';
	if (m % 2) for (i = 0; i + 1 < n; i += 2) if (b > 0) b--, c[i][m - 1] = '^', c[i + 1][m - 1] = 'v';
	if (n % 2 && n > 2 && m > 2 && b % 2) b--, c[n - 2][m - 3] = '^', c[n - 1][m - 3] = 'v';
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			if (b > 0) {
				if (c[i][j] == '.' && c[i + 1][j] == '.') b--, c[i][j] = '^', c[i + 1][j] = 'v';
			}
		}
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			if (a > 0) {
				if (c[i][j] == '.' && c[i][j + 1] == '.') a--, c[i][j] = '<', c[i][j + 1] = '>';
			}
		}
	}
	if (a > 0 || b > 0) {cout << "NO"; return 0;}
	cout << "YES\n";
	for (i = 0; i < n; i++) printf("%s\n", c[i]);
    return 0;
}

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

int main(){
  int N;
  int h[100]={};
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> h[i];
  }
  int min=100;
  int idx=0;
  long count =0;
  while(1){
    bool flag=true;
    for(int i=0; i<N; i++){
      if(h[i]!=0){
        flag=false;
        break;
      }
    }
    if(flag) break;
    int min=101;
    for(int i=0; i<N; i++){
      if(min==101 && h[i]==0){
        idx=i+1;
        continue;
      }
      if(h[i]==0){
        for(int j=idx; j<i; j++){
          h[j]-=min;
        }
        count+=min;
        idx=i+1;
        min = 101;
        continue;
      }
      else{
        if(h[i]<min) min=h[i];
      }
    }
    for(int i=idx; i<N; i++){
      h[i]-= min;
    }
    if(idx<N) count+=min;
    min=101;
    idx=0;
  }
  cout << count << endl;

  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

from collections import Counter

n = int(input())
s = [input() for _ in range(n)]

c = [Counter(e) for e in s]

li = [chr(i) for i in range(97, 97 + 26)]

ans = ""
for li_e in li:
    mn = 50
    for c_e in c:
        mn = min(mn, c_e[li_e])
    ans += li_e * mn

print(ans)


Measured memory_bytes: 3436
#include <iostream>
#include <fstream>
#include <set>
#include <tuple>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <map>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>

int type(const std::string& str) {
	int flag = 0;
	for (const auto c : str) {
		flag |= (1 << (c - 'A'));
	}
	return flag;
}
int main() {
	int n; std::cin >> n;
	std::vector<long long int> state(3, 0); for (auto& s : state) std::cin >> s;
	std::vector<std::string> operation(n); for (auto& op : operation) std::cin >> op;
	std::vector<char> result;
	if (std::accumulate(state.begin(), state.end(), 0LL) == 1) {
		for (const auto op : operation) {
			const auto flag = type(op);
			for (auto i = 0; i < 3; ++i) {
				if ((flag & (1 << i)) != 0) {
					if (state[i] == 0) {
						++state[i];
						result.push_back('A' + i);
					}
					else if (state[i] == 1) {
						--state[i];
					}
				}
			}
			if (std::accumulate(state.begin(), state.end(), 0LL) != 1) {
				result.clear(); break;
			}
		}

	}
	else if (std::accumulate(state.begin(), state.end(), 0LL) == 2) {
		for (auto i = 0; i < n; ++i) {
			const auto flag = type(operation[i]);
			int one{ 0 }, two{ 0 };
			for (auto j = 0; j < 3; ++j) {
				if ((flag & (1 << j)) != 0) {
					if (state[j] == 1) ++one;
					else if (state[j] == 2) ++two;
				}
			}
			if (one == 2) {
				if (i + 1 < n) {
					const auto next = type(operation[i + 1]);
					for (auto j = 0; j < 3; ++j) {
						if (((next & flag) & (1 << j)) != 0) {
							if (one == 2) {
								++state[j];
								result.push_back('A' + j);
							}
							else --state[j];
							--one;
						}
						else if ((flag & (1 << j)) != 0) {
							--state[j];
						}
					}
				}
				else {
					for (auto j = 0; j < 3; ++j) {
						if ((flag & (1 << j)) != 0) {
							if (one == 2) {
								++state[j];
								result.push_back('A' + j);
							}
							else --state[j];
							--one;
						}
					}
				}
			}
			else if (one + two > 0) {
				for (auto j = 0; j < 3; ++j) {
					if ((flag & (1 << j)) != 0) {
						if (state[j] > 0) --state[j];
						else {
							++state[j];
							result.push_back('A' + j);
						}
					}
				}
			}
			else {
				result.clear();
				break;
			}
		}
	}
	else {
		for (const auto& op : operation) {
			const auto flag = type(op);
			int a{ -1 }, b{ -1 };
			for (auto i = 0; i < 3; ++i) {
				if ((flag & (1 << i)) != 0) {
					if (a >= 0) b = i;
					else a = i;
				}
			}
			if (state[a] == 0 && state[b] == 0) {
				result.clear();
				break;
			}
			else if (state[a] < state[b]) {
				++state[a];
				--state[b];
				result.push_back('A' + a);
			}
			else {
				--state[a];
				++state[b];
				result.push_back('A' + b);
			}
		}
	}
	if (result.size() == n) {
		std::cout << "Yes\n";
		for (auto c : result) std::cout << c << '\n';
	}
	else {
		std::cout << "No\n";
	}
}

Measured memory_bytes: 6732
#include<bits/stdc++.h>
#define ll long long 
#define tox x+dx[i]
#define toy y+dy[i]
using namespace std;

inline ll read(){
    ll x=0,f=1;
    char ch=getchar();
    for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
    for(;isdigit(ch);ch=getchar())x=(x<<3)+(x<<1)+ch-48;
    return x*f;
}

int main(){
    //freopen("a.in","r",stdin);
    int x=read(),y=read();
    cout<<x+y/2;
    return 0; 
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll a,b;
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(void){
    cin>>a>>b;
    cout<<a*b/gcd(a,b)<<endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        m: i64,
        d: i64,
    }

    let f = |m, d| {
        let d1 = d % 10;
        let d10 = d / 10;
        d1 >= 2 && d10 >= 2 && d1 * d10 == m
    };

    let mut ans = 0;

    for i in 0..m {
        for j in 0..d {
            if f(i + 1, j + 1) {
                ans += 1;
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Linq;

namespace at_coder
{
#if TEST
    [TestClass]
#endif
    public class Test_162_b
    {

#if TEST
        public static void Test_Main()
#else
        public static void Main()
#endif
        {
            int a = ReadInt();

            long sum = 0;

            for (int i=1;i<=a;i++)
            {
                bool fizz = i % 3 == 0;
                bool buzz = i % 5 == 0;

                if (fizz || buzz)
                {
                }
                else
                {
                    sum += i;
                }
            }

            Write(sum.ToString());
        }


        private static void Write(string s)
        {
            Console.WriteLine(s);
        }

        private static int[] ReadIntArray()
        {
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] ar = new int[ss.Length];
            for (int i = 0; i < ss.Length; i++)
            {
                ar[i] = int.Parse(ss[i]);
            }
            return ar;
        }
        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static void ReadInt(out int a, out int b)
        {
            var ar = ReadIntArray();
            a = ar[0];
            b = ar[1];
        }
        private static void ReadInt(out int a, out int b, out int c)
        {
            var ar = ReadIntArray();
            a = ar[0];
            b = ar[1];
            c = ar[2];
        }
        private static string ReadString()
        {
            return Console.ReadLine();
        }
        private static string[] ReadStringArray()
        {
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            return ss;
        }
#if !TEST
    }
}
#endif


Measured memory_bytes: 27472
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;

  bool can = false;
  if (N % 2 == 0) {
    if (K <= N / 2) {
      can = true;
    }
  } else {
    if (K <= N / 2 + 1) {
      can = true;
    }
  }

  if (can) {
    cout << "YES"
         << "\n";
  } else {
    cout << "NO"
         << "\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<sstream>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define strep(it,v) for(it=v.begin();it!=v.end();++it)
#define ii pair<int,int>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<int>
#define rs resize
const ll N = 100009;
ll fact[N];
int main()
{
   std::ios::sync_with_stdio(false);
   ll i,n,m;
   cin>>n>>m;
   if(abs(n-m)<=1)
   {
     fact[1] = 1;
     rep(i,2,N)
      fact[i] = (fact[i-1]*i)%mod;
     if(n==m)
       n = ((fact[n]*fact[n])%mod * 2)%mod;
     else
       n = (fact[n]*fact[m])%mod;
     cout<<n;
   }
   else
    cout<<0;
   return 0;
}


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

int main() {
  int n;
  std::cin >> n;
  std::vector<int> a(n);
  for (auto &i : a) {
    std::cin >> i;
  }

  std::sort(a.begin(), a.end());

  int odd = 0, even = 0;

  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      even += a[i];
    } else {
      odd += a[i];
    }
  }

  std::cout << std::abs(odd - even) << std::endl;
  return 0;
}


Measured memory_bytes: 256
a, b, c, k = map(int, input().split())  # x = 1, y = 2

sum_card = 0
sum_n = 0

if k <= a:
    print(k)
    exit()
elif k <= (a + b):
    print(a)
    exit()
else:
    print(a - (k - a - b))


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  string s; cin >> s;
  if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R'){
    cout<< 3 << endl;
  } else if((s[0] == 'R' && s[1] == 'R') ||( s[1] == 'R' && s[2] == 'R')){
    cout << 2 << endl;
  } else if(s[0] == 'R' || s[1] == 'R' || s[2] == 'R'){
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    int k=1;
    while(k*(k+1)/2<=n){
        k++;
    }
    REP(i,k){
        if(i+1==k*(k+1)/2-n){
            continue;
        }
        cout << i+1 << endl;
    }
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstring>

char s[11000];
int main()
{
	scanf("%s", s);
	int n = strlen(s);
	int w; scanf("%d", &w);
	for (int i = 0; i < n; i += w) printf("%c", s[i]);
		
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main (void)
{
    int n;
    scanf("%d",&n);
    long long a[n];
    for (int i= 0; i < n ; i ++)    {
        scanf("%lld",&a[i]);
    }
    int ans = 0;
    int j,c;
    while (1)   {
        for (j = 0; j < n; j ++)    {
            if(a[j] % 2 == 1)    break;
            else
            {
                a[j] = a[j] /2;

            }
        }
        if(j == n)    ans ++;
        else    break;
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
A=Counter(A).most_common()
A.sort(key=lambda x:x[0])
flag=1
if len(A)==3:
    for i in range(2):
        if A[i][1]==A[i+1][1]:
            continue
        else:
            flag=0
    for i in range(2):
        if i==0 :
            if A[i][0]==(A[i+1][0]^A[-1][0]):
                continue
            else:
                flag=0
        elif i==2:
            if A[i][0]==(A[i-1][0]^A[0][0]):
                continue
            else:
                flag=0
        else:
            if A[i][0]==(A[i-1][0]^A[i+1][0]):
                continue
            else:
                flag=0
    if flag==1:
        print("Yes")
    else:
        print("No")
else:
    if A[0][0]==0:
        if len(A)==1 or (len(A)==2 and A[0][1]==A[1][1]//2):
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Measured memory_bytes: 15524
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(ll, N, C, K);
  VEC(ll, T, N);
  sort(all(T));
  ll ans = 0;
  int i = 0;
  while (i < N) {
    ll t = T[i] + K;
    int c = 1;
    while (i + c < N && T[i + c] <= t && c < C) {
      c++;
    }
    ans++;
    i += c;
  }
  print(ans);
}


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

int main()
{
	ios_base::sync_with_stdio(false);	
	cin.tie(NULL);
	long long int n=0,t=0;
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		if(i%3!=0 and i%5!=0)
		t+=i;
	}
	cout<<t<<"\n";
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;

ll digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

int main() {
    ll n,a,b;
    cin >> n >> a >> b;
    ll ans = 0;
    for(int i=1;i<=n;i++){
        if(digsum(i) >= a && digsum(i) <= b){
            ans += i;
        }
    }
    cout << ans << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
import java.util.*;
import java.util.function.BiConsumer;

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 Q = sc.nextInt();
		
		int B[] = new int[Q];
		int C[] = new int[Q];
		for(int i=0; i < Q; i++) {
			B[i] = sc.nextInt();
			C[i] = sc.nextInt();
		}
		
		long total = 0;
		for(int a : A) {
			total += a;
		}
		
		int[] num = new int[100001];
			for(int j=0; j<N; j++) {
				int a = A[j];
				num[a] ++;
			}
		
		
		for(int i=0; i < Q; i++) {
			int b = B[i];
			int c = C[i];
			int count = num[b];
			total += (c - b) * count;
			num[c] += num[b];
			num[b] = 0;			
			System.out.println(total);
	
		}

		
	}
}


Measured memory_bytes: 60544
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define MAXINF 1000000005
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define repc(it, x) for(auto it = (x).begin(); it != (x).end(); ++it)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rrepc(it, x) for(auto it = (x).rbegin(); it != (x).rend(); ++it)
#define all(x) (x).begin(), (x).end()
#define P pair<int, int>

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    map<ll, ll> mp;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++) mp[i] = 0;
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
        mp[a[i]]++;
    }
    ll ans = 0;
    for(ll i = 0; i < 2*100000+5; i++) {
        ans += (mp[i]-1)*mp[i]/2;
    }
    for(ll k = 0; k < n; k++) {
        ll old = (ll)mp[a[k]]*(mp[a[k]]-1)/2;
        ll update = (ll)(mp[a[k]]-1)*(mp[a[k]]-2)/2;
        cout << ans - old + update << endl;
    }
    return 0;
}

Measured memory_bytes: 17152
package main

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

//•*¨*•.¸¸♪I/O•*¨*•.¸¸♪

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInt64() int64 {
	sc.Scan()
	a,_ := strconv.ParseInt(sc.Text(),10,64)
	return a
}

func scanFloat64() float64 {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return float64(a)
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

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

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer(make([]byte, 10000), 100000000)

	n := scanInt()

	for i := 1; i < 3501; i++ {
		for j := 1; j < 3501; j++ {
			if (4*i*j-n*(i+j)) > 0 && (n*i*j)%(4*i*j-n*(i+j)) == 0 {
				fmt.Println(i,j, (n*i*j)/(4*i*j-n*(i+j)))
				return
			}
		}
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i >= 1; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> p;


int main() {
	string s;
	cin >> s;
	bool cnt[26];
	rep(i, 26) {
		cnt[i] = true;
	}
	rep(i, s.size()) {
		cnt[s[i]-'a'] = false;
	}
	rep(i, 26) {
		if(cnt[i]){
			cout << (char)(i+'a') << endl;
			return 0;
		}
	}
	cout << "None";
	return 0;
}

//Ctrl+Aを使わない

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>

const int commandnum = 4;

struct Command
{
    std::string command[commandnum] = { "insert", "delete", "deleteFirst", "deleteLast" };
};

class Node
{
public:
    int key;
    Node *prev, *next;
};

using namespace std;

class DList
{
public:
    DList();
    ~DList();

    Node *sentinel;

    void init();
    void print();
    void insert(int);
    void del(Node*);
    void delF();
    void delL();
    Node* search(int key);
};

void Execute();

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

DList::DList() {
    init();
}

DList::~DList() {

}

void DList::init() {
    sentinel = new Node;
    sentinel->next = sentinel;
    sentinel->prev = sentinel;
}

void DList::insert(int key) {
    Node *p = new Node;

    p->key = key;
    p->next = sentinel->next;
    sentinel->next->prev = p;
    sentinel->next = p;
    p->prev = sentinel;
}

void DList::print() {
    for(Node* p = sentinel->next; p != sentinel; p = p->next) {
        if(p != sentinel->next)  cout << " ";
        cout << p->key;
    }
    cout << endl;
}

void DList::del(Node *terget) {
    if(!(terget == sentinel)) {
        terget->prev->next = terget->next;
        terget->next->prev = terget->prev;
        delete terget;
    }
}

void DList::delF() {
    del(sentinel->next);
}

void DList::delL() {
    del(sentinel->prev);
}

void Execute() {
    int n = 0, key = 0;
    DList list;
    string s;
    Command com;

    cin >> n;
    for(int i=0; i<n; ++i) {
        cin >> s;
        if(s == com.command[0]) {
            cin >> key;
            list.insert(key);
        }

        else if(s == com.command[1]) {
            cin >> key;
            list.del(list.search(key));
        }

        else if(s == com.command[2]) {
            list.delF();
        }

        else if(s == com.command[3]) {
            list.delL();
        }

        else {
            cout << "Error!" << endl;
            cout << "No such command" << endl;
        }
    }

    list.print();
}

Node* DList::search(int key) {
    Node *p = sentinel->next;
    while(p != sentinel && p->key != key) {
        p = p->next;
    }

    return (p);
}


Measured memory_bytes: 34244
//ALDS1_1_B: Greatest Common Divisor
//C++
#include <iostream>
#include <algorithm>
using namespace std;
//用循?求最大公?数
int gcd(int x,int y){
    int r;
    if(x<y)swap(x,y);//保?y<x
    while(y>0){
        r=x%y;
        x=y;
        y=r;
    } 
    return x;
} 
int main(){
    int a,b;
    cin>>a>>b;
    cout<<gcd(a,b)<<endl;
    return 0;
}

Measured memory_bytes: 3080
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n,k;
	cin>>n;
	int a[n+1];
	int b[n+1];
	for(int i=1; i<=n; i++){
		int num;
		cin>>num;
		a[i] = num;
		b[num] = i;
	}
	for(int i=1; i<=n; i++){
		cout << b[i] << ' ';
	}
}


Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
using namespace std;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >>d;
    int ans = min(b, d) - max(a,c);
    if(ans < 0)ans = 0;
    cout << ans << endl;
}


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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

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

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}


int main(){

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

    int n;
    cin>>n;

    vector<int> vt(n);
    int smallest = 1000000;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        cin>>vt[i];
        if(smallest >= vt[i]) ans++;
        smallest = min(smallest, vt[i]);

    }

    cout<<ans<<endl;

}


Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef long long ll;

int max(int a, int b){
  if(a > b) return a;
  else return b;
}
int min(int a, int b){
  if(a < b) return a;
  else return b;
}

int main(){

  int tmp;
  scanf("%d",&tmp);
  int a,b,c,d;
  d = tmp % 10; tmp/= 10;
  c = tmp % 10; tmp/= 10;
  b = tmp % 10; tmp/= 10;
  a = tmp % 10;

  if(a+b+c+d == 7){
    printf("%d+%d+%d+%d=7",a,b,c,d);
  }else if(a+b+c-d == 7){
    printf("%d+%d+%d-%d=7",a,b,c,d);
  }else if(a+b-c+d == 7){
    printf("%d+%d-%d+%d=7",a,b,c,d);
  }else if(a-b+c+d == 7){
    printf("%d-%d+%d+%d=7",a,b,c,d);
  }else if(a+b-c-d == 7){
    printf("%d+%d-%d-%d=7",a,b,c,d);
  }else if(a-b+c-d == 7){
    printf("%d-%d+%d-%d=7",a,b,c,d);
  }else if(a-b-c+d == 7){
    printf("%d-%d-%d+%d=7",a,b,c,d);
  }else if(a-b-c-d == 7){
    printf("%d-%d-%d-%d=7",a,b,c,d);
  }

  return 0;

}


Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import math
import sys
import itertools
import numpy as np
import functools
import collections
mo = 1000000007
INF = 10**100
r = range

class infix(object):
    def __init__(self, function):
        self.function = function

    def __ror__(self, other):
        self.left = other
        return self

    def __or__(self, other):
        return self.function(self.left, other)

    def __call__(self, value1, value2):
        return self.function(value1, value2)

@infix
def c(f_t_u, f_u_r): return lambda t: f_u_r(f_t_u(t))

class _Ap(object):
    def __rlshift__(self, other):
        self.value = other
        return self

    def __rshift__(self, other):
        return other(self.value)
Ap = _Ap()
A = Ap

#d = {1:2, 3:5, 6:10, 1000043:3814}
#zip(d.keys(), d.values())<<ap>>(list |c| sorted |c| reversed |c| list |c| print)

def gcd(a,b):
    if a>b: a,b=b,a
    if a==0:return b
    return gcd(a, b%a)

n=input()<<A>>int
ret = 1
for i in range(n): a=int(input()); ret = ret * a // gcd(ret, a)
print(ret);


Measured memory_bytes: 13108
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(void)
{
  int d;

  while(scanf("%d",&d)!=EOF){
    int j;
    int sum=0;
    for(j=d;j<600;j+=d)
      sum+=d*j*j;
    printf("%d\n",sum);
  }

  return 0;
}

Measured memory_bytes: 596
N=int(input())
a=len(str(N))

import itertools
ans=0
A=['7','5','3']
for i in range(3,a+1):
  for j in list(itertools.product(A,repeat=i)):
    if '7' in j and '5' in j and '3' in j:
      if int(''.join(j))<=N:
        ans+=1
print(ans)

Measured memory_bytes: 6260
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <class T> int size(const T &x) { return x.size(); }
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define iter(it,c) for(auto it = (c).begin(); it != (c).end();++it)
#define pb push_back
#define fs first
#define sc second
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int INF = ~(1<<31);
const double pi = acos(-1);
const double EPS = 1e-9;

string s;
int memo[50][50];
int dp(int at, bool lower) {
	if(at >= s.size()) return 0;
	if(memo[at][lower] != -1) return memo[at][lower];
	if(lower) {
		return dp(at+1,1)+9;
	} else {
		int mx = 0;
		rep(i,0,10) {
			if(s[at]-'0' > i) mx = max(mx, i+dp(at+1,1));
			else if(s[at]-'0' == i) mx = max(mx,i+dp(at+1,0));
		}
		return memo[at][lower] = mx;
	}


}

int main() {
    cin.sync_with_stdio(false);
	memset(memo,-1,sizeof(memo));
	cin >> s;
	cout << dp(0,0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  double kotae;
  cin >> N;
  
  if(N%2==0){
   cout<<0.5<<endl; 
  }else{
    kotae=(N/2+1)/(double)N;
   cout << kotae << endl; 
  }
  

}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;

class Main {

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

    void compute() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        long[] d = new long[N];
        Arrays.fill(d, Long.MAX_VALUE);
        d[0] = 0;
        edge[] es = new edge[M];
        for (int i = 0; i < M; i++) {
            es[i] = new edge(sc.nextInt() - 1, sc.nextInt() - 1, -sc.nextInt());
        }
        for (int i = 0; i < N - 1; i++) {
            for (int j = 0; j < M; j++) {
                edge e = es[j];
                if (d[e.from] != Long.MAX_VALUE && d[e.to] > d[e.from] + e.cost) {
                    d[e.to] = d[e.from] + e.cost;
                }
            }
        }

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                edge e = es[j];
                if (d[e.from] != Long.MAX_VALUE && d[e.to] > d[e.from] + e.cost) {
                    if (e.to == N - 1) {
                        System.out.println("inf");
                        return;
                    }
                    d[e.to] = d[e.from] + e.cost;
                }
            }
        }
        System.out.println(-d[N - 1]);
    }

    class edge {

        int from, to, cost;

        edge(int from, int to, int cost) {
            this.from = from;
            this.to = to;
            this.cost = cost;
        }
    }
}


Measured memory_bytes: 30708
#include<stdio.h>
#define N 100

void bubbleSort(void);

int main(){

  bubbleSort();

  return 0;
}
void bubbleSort(void){
  int a[N];
  int n,i,j,flag,x,kazu=0;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);
  
  flag=1;
  i=0;
  while(flag){
    flag=0;
    for(j=n-1;j>=i+1;j--){
      if(a[j]<a[j-1]){
	x=a[j];
	a[j]=a[j-1];
	a[j-1]=x;
	flag=1;
	kazu++;
      }
    }
    i++;
  }
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i!=n-1) printf(" ");
  }
  printf("\n%d\n",kazu);
}



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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */


vector<int> to[MAX];
struct LCA{
    vector<vector<int> > parent; //parent[i][u]:= u の 2^k 先の親
    vector<int> dist;
    int n, k;
    LCA(int _n, int root = 0):n(_n){ init(root); }

    void init(int root){
        k = 1;
        while((1<<k)<n) k++;
        parent.assign(k, vector<int>(n, -1));
        dist.assign(n, -1);
        dfs(root);
        rep(i, k-1) rep(v, n){
            if(parent[i][v] == -1) parent[i][v] = -1;
            else parent[i+1][v] = parent[i][parent[i][v]];
        }
    }

    void dfs(int s, int p=-1){
        parent[0][s] = p;
        if(p<0) dist[s] = 0; else dist[s] = dist[p] + 1;
        for(int t : to[s]){
            if(t == p) continue;
            dfs(t, s);
        }
    }

    int query(int u, int v){
        if(dist[u] < dist[v]) swap(u, v);
        rep(i, k){
            if((dist[u]-dist[v])&(1<<i)){ // d(u,v)を2進展開したときに2^uを含むか?
                 //(d(u,v)&(1<<i)と書いても良さそう, あとで試す)
                u = parent[i][u];
            }
        }
        if(u == v) return u;
        repr(i, k){
            if(parent[i][u] != parent[i][v]){
                u = parent[i][u];
                v = parent[i][v];
            }
        }
        return parent[0][u];
    }
};

int main(){
    int n, q;
    cin >> n;
    rep(i, n){
        int k; cin>>k;
        rep(j, k){
            int c; cin>>c;
            to[i].push_back(c);
        }
    }
    LCA lca(n, 0);
    cin >> q;
    rep(i, q){
        int u, v; cin>>u>>v;
        out(lca.query(u, v));
    }
}


Measured memory_bytes: 20792
N,K = gets.chomp.split(" ").map(&:to_i)
cnt = [0]*N
K.times do 
  onum = gets.to_i
  snum = gets.split.map(&:to_i)
  snum.each do |sn|
    cnt[sn-1] +=1
  end
end 
 
p cnt.select{|v| v==0}.size


Measured memory_bytes: 14380
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=1e9;
int main(){
      bool is_prime[10001];
      memset(is_prime,true,sizeof(is_prime));
      is_prime[0]=is_prime[1]=false;
      for(int i=2;i<=10000;i++){
            if(is_prime[i]){
                  for(int j=2*i;j<=10000;j+=i)is_prime[j]=false;
            }
      }
      int n;
      while(cin>>n){
            int ans=0;
            for(int i=1;i<=n;i++){
                  if(is_prime[i]&&is_prime[n+1-i])ans++;
            }
            cout<<ans<<endl;
      }
}

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

int main() {
  int a;
  cin>>a;
  
  vector<double> vec(a);
  double sum=0;
  
  for(int i=0;i<a;i++){
    cin>>vec.at(i);
    sum+=vec.at(i);
    }
  
  double heikin=sum/a;
  int answer=0;
  double sa=1000;
  
  for(int i=0;i<a;i++){
    if(abs(heikin-vec.at(i))<sa){
      answer=i;
      sa=abs(heikin-vec.at(i));
    }
  }
  
  cout<<answer<<endl;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

int main()
{
    char b;
    cin >> b;

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

    return 0;
}

Measured memory_bytes: 256
def combinations_mod(n, r, mod=1000000007):
    """Returns nCr in mod."""
    r = min(r, n - r)
    combs = 1
    for i, j in zip(range(n - r + 1, n + 1), range(1, r + 1)):
        combs *= (i % mod) * pow(j, mod - 2, mod)
        combs %= mod
    return combs


def main():
    n, a, b = [int(x) for x in input().split()]
    mod = 1000000007
    total = pow(2, n, mod) - 1
    ans = total - combinations_mod(n, a) - combinations_mod(n, b)
    ans %= mod
    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;

int main()
{
	string S[3];
	cin >> S[0] >> S[1] >> S[2];

	cout << S[0][0] << S[1][1] << S[2][2] << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
      // 標準入力からデータを読み込む準備
      try (Scanner sc = new Scanner(System.in)) { String line = sc.nextLine();
      String answer = "";
      String tmp;
      int length = line.length();
      for (int i = 0; i < length; i++) {
      char ch = line.charAt(i);
      if(Character.isLowerCase(ch) == true){
        
        ch = Character.toUpperCase(ch);
        tmp = String.valueOf(ch);
        answer = answer + tmp;
      }else{
        ch = Character.toLowerCase(ch);
          tmp = String.valueOf(ch);
        answer = answer + tmp;
      }
    }
    System.out.println(answer);
  }
}
}



Measured memory_bytes: 31532
//Author : Sukarna Paul

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;


int main(){
    IOS
    //freopen("output.txt","w",stdout);

    int n;
    cin>>n;
    unordered_map<int,int>mp;
    for(int i=0;i<n-1;i++){
        int a;
        cin>>a;
        mp[a]++;
    }
    for(int i=1;i<=n;i++){
        cout<<mp[i]<<"\n";
    }
}


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

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<string> A(n), B(m);
  rep(i,n) cin >> A[i];
  rep(i,m) cin >> B[i];
  rep(y,n-m+1) rep(x,n-m+1) {
    bool ok = true;
    rep(i,m) rep(j,m) {
      if (A[y+i][x+j] != B[i][j]) {
        ok = false; break;
      }
    }
    if (ok) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256