akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());
            Console.WriteLine(x+x*x+x*x*x);
        }
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // long[] NK = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // long N = NK[0];
            // long K = NK[1];
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int x = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int N = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] s = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
        
        // //最小公倍数
        // static long Lcm(long a, long b)
        // {
        //     return a/Gcd(a,b)*b;
        // }

        // //最大公約数
        // static long Gcd(long m, long n)
        // {
        //     if(n==0)return m;
        //     return Gcd(n,m%n);
        // }
    }
}


Measured memory_bytes: 27508
#include<bits/stdc++.h>
using namespace std;
#define int long long
main()
{
  int N;
  while(scanf("%lld", &N), N) {
    vector< int > P(N), J(N, 0);
    for(int i = 0; i < N; i++) {
      scanf("%lld", &P[i]);
    }
    for(int i = 1; i < N; i++) {
      scanf("%lld", &J[i]);
    }
    sort(J.begin() + 1, J.end(), greater< int >());
    for(int i = 1; i < N; i++) {
      J[i] += J[i - 1];
    }
    int ret = 0, sum = accumulate(P.begin(), P.end(), 0);
    for(int i = 0; i < N; i++) {
      ret = max(ret, (sum + J[i]) * (N - i));
    }
    printf("%lld\n", ret);
  }
}

Measured memory_bytes: 2056
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int K,A,B;cin>>K>>A>>B;
  int bis=1;
  if(B-A<=2){
    print(K+1);
    re 0;
  }
  while(K){
    if(bis>=A&&K>=2){
      bis+=B-A;
      K-=2;
    }
    else{
      bis++;
      K--;
    }
  }
  print(bis);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
int main(){
    ll n,m,ans=0,i;
    cin>>n>>m;
    n+=1;
    ll pre[n+2];
    pre[0] = 0;
    for(i=1;i<=n+1;i++)
        pre[i]=pre[i-1]+i;
    if(m==0){
        ans=ans+n;
        m+=1;
    }
    for(i=m;i<n;i++)
        ans=(ans+(pre[n-1]-pre[n-i-1])-(pre[i-1]-pre[0])+1)%mod;
    ans = (ans+1)%mod;
    cout<<ans;
}

Measured memory_bytes: 5156
<?php
fscanf(STDIN, '%d %d %d %d', $h, $w, $a, $b);
for ($i = 0; $i < $h; $i++) {
    for ($j = 0; $j < $w; $j++) {
        echo $i < $b && $j < $a || $i >= $b && $j >= $a ? '1' : '0';
    }
    echo PHP_EOL;
}

Measured memory_bytes: 5624
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        String s = sc.next();
        int k = sc.nextInt();

        Set<String> set = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            for (int j = 1; j <= k && (i + j) <= s.length(); j++) {
                set.add(s.substring(i, i + j));
            }
        }

        String sort[] = set.stream().sorted().toArray(String[]::new);
        System.out.println(sort[k - 1]);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 28624
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=1007;

int n, m;
char wcz[nax][nax];
int dp[nax][nax];

int main()
{
	scanf("%d%d", &n, &m);
	for (int i=1; i<=n; i++)
	{
		scanf("%s", wcz[i]+1);
	}
	for (int i=0; i<=n+1; i++)
		for (int j=0; j<=m+1; j++)
			dp[i][j]=nax*nax;
	dp[0][1]=0;
	wcz[0][1]='.';
	wcz[n][m+1]='.';
	for (int i=1; i<=n; i++)
	{
		for (int j=1; j<=m+(i==n); j++)
		{
			dp[i][j]=min(dp[i][j-1]+(wcz[i][j]!=wcz[i][j-1]), dp[i-1][j]+(wcz[i][j]!=wcz[i-1][j]));
		}
	}
	int x=dp[n][m+1];
	//~ debug() << imie(wcz);
	printf("%d\n", x/2);
	return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
#ifndef __MACRO_H__
#define __MACRO_H__
 
#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)				// repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)			// repeat reverse
 
#endif
 
int main(void)
{
  ll k, x;
  cin >> k >> x; 
 
  rep(i, x-k+1, x+k)
    cout << i << " ";
 
  return 0;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            Console.WriteLine(N*N*N);

        }
    }
}


Measured memory_bytes: 11092
import math
A,B = map(float,input().split())
ans = 0
# if A > 100:
#     B *= 100
#     ans = int(A) * int(B)
#     ans = ans//100
#     print(ans)
# else:
#     ans = A*B
#     # print(ans)
#     print(int(ans))

B *= 1000
ans = int(A) * int(B)
ans = ans//1000
print(ans)

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H, W = MAP()

if H%3==0 or W%3==0:
    print(0)
    exit()

H, W = max(H, W), min(H, W)

a = H // 3
bc = H - a
ans1 = max(abs(bc*ceil(W, 2)-a*W), abs(bc*(W//2)-a*W), abs(bc*ceil(W, 2)-bc*(W//2)))
a = ceil(H, 3)
bc = H - a
ans2 = max(abs(bc*ceil(W, 2)-a*W), abs(bc*(W//2)-a*W), abs(bc*ceil(W, 2)-bc*(W//2)))

H, W = min(H, W), max(H, W)

a = H // 3
bc = H - a
ans3 = max(abs(bc*ceil(W, 2)-a*W), abs(bc*(W//2)-a*W), abs(bc*ceil(W, 2)-bc*(W//2)))
a = ceil(H, 3)
bc = H - a
ans4 = max(abs(bc*ceil(W, 2)-a*W), abs(bc*(W//2)-a*W), abs(bc*ceil(W, 2)-bc*(W//2)))

ans5 = abs(ceil(W, 3)*H-W//3*H)
ans6 = abs(ceil(H, 3)*W-H//3*W)

print(min(ans1, ans2, ans3, ans4, ans5, ans6))


Measured memory_bytes: 3192
import sys

input = sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A2 = list(map(int, input().split()))
    t = A[0]
    t2 = sum(A2)
    ans = t + t2
    for i in range(1, N):
        t += A[i]
        t2 -= A2[i-1]
        ans = max(ans, t+t2)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9192
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ll binpowmod(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ll res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
ull gcd(ull x,ull y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
bool comp(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
bool comp_pairs_by_s(pair<ll,ll> &x ,pair<ll,ll> &y)
{
    return x.second<y.second;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}

class cmp      //comparator for priority_queue 
{               //declaration: priority_queue<int,vector<int>,cmp>
public:         
    bool operator()(pair<int,int> A,pair<int,int> B)
    {
        if(abs(A.first-A.second)==abs(B.first-B.second))
            return A.first>B.first;
        return abs(A.first-A.second)<abs(B.first-B.second);
    }
};
// int prime[100005]={0};
// void sieve(void)
// {
//  int i,j;
//  for(i=0;i<100005;i++)
//         prime[i]=1;
//  prime[0]=0,prime[1]=0;
//  for(i=2;i<=sqrt(100005);i++){
//      if(prime[i]){
//          for(j=i*i;j<100005;j+=i){
//              prime[j]=0;
//          }
//      }
//  }
    
// }
void swap(int &x,int &y){
    int temp=x;
    x=y;
    y=temp;
}
void solve()
{   
    ll n;
    cin>>n;
    cout<<n*(n-1)/2;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a, b) << ' ' << max(0, a + b - n) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N;
  cin >> N;

  deque<char> ret;

  while(N > 0){
      N--;
      ret.push_front((char)(N % 26) + 'a');
      N /= 26;
  }

  while(!ret.empty()){
    cout << ret.front();
    ret.pop_front();
  }

  cout << "\n";
  
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep2(i,x,y) for (int i = x; i < (y); ++i)
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
int INF = 100100101;
int main()
{
  ios::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n){
    cin >> a[i];
  }
  for(int i = n-1; i > 0; i--){
    cout << a[i] << " ";
  }
  cout << a[0] << endl;
  return 0;
}



Measured memory_bytes: 3112
n, m = map(int, input().split())
edge = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)


def dfs(v, seen, res):
    seen[v] = True
    if all(seen):
        res += 1

    for i in edge[v]:
        if not seen[i]:
            tmp = [tf for tf in seen]
            res = dfs(i, tmp, res)

    return res


visited = [False]*n
ans = dfs(0, visited, 0)
print(ans)


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

int c[40];
string s;
bool ans = true;

int main() {
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		for (int j = 0; j < 30; j++) {
			if (s[i] == j + 'a')c[j]++;
		}
	}
	for (int i = 0; i < 30; i++)if (c[i] % 2 == 1)ans = false;
	ans ? cout << "Yes" << endl : cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int,P> P3;
typedef pair<double, P3> P4;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(3e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    string s;
    cin >> s;
    int cnt[2]{};
    for(auto c : s){
        cnt[c-'0']++;
    }
    cout << min(cnt[0],cnt[1])*2 << endl;
    return 0;
}


Measured memory_bytes: 512
package main

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

var (
	// ReadString returns a WORD string.
	ReadString func() string
)

func init() {
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
}

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	n, _ := strconv.Atoi(ReadString())
	return n
}

// 10 11 12 => [10, 11, 12]
func readIntSlice(size int) []int {
	a := make([]int, size)
	for i := 0; i < size; i++ {
		a[i] = readInt()
	}
	return a
}

func get2byte(size int) [][]byte {
	a := make([][]byte, size)
	for i := 0; i < size; i++ {
		var low string
		fmt.Scan(&low)
		a[i] = []byte(low)
	}
	return a
}

func transpose(a [][]int) {
	n := len(a)
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			a[i][j], a[j][i] = a[j][i], a[i][j]
		}
	}
}

func fact(n, m int) int {
	res := 1
	for i := m + 1; i <= n; i++ {
		res *= i
	}
	return res
}

func perm(n, r int) int {
	if r > n {
		return 0
	}
	return fact(n, n-r)
}

func comb(n, m int) int {
	if m > n {
		return 0
	}
	return fact(n, n-m) / fact(m, 0)
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

func max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

func main() {
	n, k := readInt(), readInt()
	as := readIntSlice(n)
	left := 0
	right := max(as...)
	res := right
	for left+1 != right {
		mid := (left + right) / 2
		if cutCount(as, mid) <= k {
			if res > mid {
				res = mid
			}
			right = mid
		} else {
			left = mid
		}
	}
	fmt.Println(res)
}

func cutCount(as []int, len int) int {
	var count int
	for _, a := range as {
		count += a / len
		if a%len == 0 {
			count--
		}
	}
	return count
}


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

using namespace std;

int main(){

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

int a1,a2,ans;

a1 = 100 * a/8;
a2 = 10 * b;
if (a1*0.08<a)
{
    a1++;
}
if (a2*0.1<b)
{
    a2++;
}
if (b <= a1 /10&& a1/10 < b+1)
{
   ans = a1;
}
else if (a <= a2 *0.08 && a2 * 0.08 < a + 1)
{
   ans = a2;
}

else ans = -1;



cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>

int main()
{
    int CheeseHeight, CheeseWidth, CheeseLength;
    
    while (std::cin >> CheeseHeight >> CheeseWidth >> CheeseLength) {
        if (CheeseHeight == 0 && CheeseWidth == 0 && CheeseLength == 0) {
            break;
        }
        
        std::array<int, 3> CheeseData = {CheeseHeight, CheeseWidth, CheeseLength};
        std::sort(CheeseData.begin(), CheeseData.end());
        
        int exit_num;
        std::cin >> exit_num;
        
        for (int i = 0; i < exit_num; ++i) {
            int exit_radius;
            
            std::cin >> exit_radius;
            
            double exit_limit = std::sqrt(
                    static_cast<double>(CheeseData.at(0) * CheeseData.at(0) / 4.0 
                    + CheeseData.at(1) * CheeseData.at(1) / 4.0)
                    );
            
            if (exit_limit < exit_radius) {
                std::cout << "OK" << std::endl;
            } else {
                std::cout << "NA" << std::endl;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1168
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(N: int, L: int, S: "List[str]"):
    S.sort()
    print("".join(S))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    L = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, L, S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();
        long ans;
        if ((b - a) % 2 == 0) {
            ans = (b - a) / 2;
        } else {
            ans = Math.min(n + 1 - b, a) + (b - 1 - a) / 2;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23892
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    string s;
    cin >> s;
    ll n = s.size();

    vvl dp(n+1, vl(13));  // dp[i+1][j] : 先頭i文字(iは0-index)で13で割った余りがjとなるものの数
    dp[0][0] = 1;
    rep(i, n) {
        rep(j, 13) {
            if(s[i] == '?') {
                rep(k, 10) {
                    dp[i+1][(10*j + k)%13] += dp[i][j];
                    dp[i+1][(10*j + k)%13] %= mod; 
                }
            }
            else {
                ll x = s[i] - '0';
                dp[i+1][(10*j + x)%13] += dp[i][j];
                dp[i+1][(10*j + x)%13] %= mod;
            }
        }
    }

    out(dp[n][5]);
    re0;
}

Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
const double EPS=1e-10;
typedef pair<int,int>P;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int h,w,k;
string s[10];
int main(){
	cin>>h>>w>>k;
	rep(i,h){
		cin>>s[i];
	}
	
	int ans=INF;
	rep(mask,1<<h-1){
		int tmp=0;
		int sz=1;
		for(int k=0;k<h-1;k++){
			if(mask>>k&1){
				tmp++;
				sz++;
			}
		}
		vector<int>add(sz,0);
		vector<int>count(sz,0);
		int id;
		rep(j,w){
			
			id=0;
			rep(i,h){
				add[id]+=s[i][j]=='1';
				if(mask>>i&1)id++;
			}
			
			bool cut=false;
			rep(x,sz){
				if(add[x]>k)tmp=INF;
				if(count[x]+add[x]>k)cut=true;
			}
			if(cut){
				tmp++;
				rep(x,sz)count[x]=0;
			}
			
			rep(x,sz){
				count[x]+=add[x];
				add[x]=0;	
			}
			
		}
		chkmin(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <vector>
#include <queue>
using namespace std;
using ll = long long;

const int N = 5005;
const int B = 13131;
ll base[N], h[N];
char s[N];
int n;

bool chk(int len){
	map<ll, int> m;
	for(int i=len;i<=n;++i){
		ll k = h[i] - h[i-len] * base[len];
		auto &v = m[k];
		if(!v) v = i;
		else if(i>=v+len) return true;
	}
	return false;
}

int main(){
	scanf("%d%s", &n, s);
	h[0]=0; base[0]=1;
	for(int i=0;i<n;++i){
		h[i+1] = h[i] * B + s[i];
		base[i+1] = base[i] * B;
	}
	int i;
	for(i=n/2;i;--i){
		if(chk(i)){
			cout << i << endl;
			break;
		}
	}
	if(!i) cout << i << endl;
	return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    long double N,K;
    cin >> N >> K;

    long double ans = 0;
    FOR(i,1,N+1){
        long double x = ceil(log2(K/i));
        if(x<= 0){
            ans += 1 / N;
        }else{
            ans += pow(0.5,x) / N;
        }
    }

    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 3844
#include<stdio.h>
int main()
{
    long long int a,b,c,d,e,f,i,j,k,n,ans=0;
    scanf("%lld %lld %lld",&n,&c,&b);
for(i=1;i<=n;i++)
{
    a=i;
    k=0;
    for(j=0;;j++)
    {
f=a%10;
k=k+f;
a=a/10;
if(a==0) break;
    }
if(k>=c && k<=b) ans=ans+i;
}
printf("%lld\n",ans);
return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define int long long

bool is_lunlun(int n){
    string s = to_string(n);
    rep(i,s.length()-1){
        if(abs(s[i]-s[i+1]) > 1) return false;
    }
    return true;
}

int next_lunlun(int n){
    if(is_lunlun(n+1)) return n+1;
    
    string s = to_string(n);
    int d = (int)s.length();
    
    //swap last two digits
    if(s[d-1] != s[d-2]){
        swap(s[d-1],s[d-2]);
        if(is_lunlun(stoll(s))) return stoll(s);
        swap(s[d-1],s[d-2]);
    }
    
    string prev;
    for(int i = (int)d-3; i>=0; i--){
        prev = s;
        s[i] = (char)(s[i] + 1);
        reps(j, i+1, d-1){
            s[j] = max('0', (char)(s[j-1] - 1));
        }
        if(stoll(prev) > stoll(s)){
            s = prev;
            continue;
        }
        if(is_lunlun(stoll(s))) break;
    }
    return stoll(s);
}

signed main(){
    int K; cin >> K;
    
    int lunlun = 0;
    rep(i,K){
        lunlun = next_lunlun(lunlun);
    }
    
    cout << lunlun << endl;
}

Measured memory_bytes: 384
n,k,*h=map(int,open(0).read().split())

INF=float("inf")
dp=[INF]*(n)
dp[0]=0

for i in range(n):
    for j in range(1,k+1):
        # try:
        #     dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
        # except:
        #     pass

        if not i-j<0:
            dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))


print(dp[-1])

Measured memory_bytes: 59948
x = int(input())
dp = [0]*(x + 105 + 1)
dp[100] = 1 
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1

for i in range(100,x+1):
    for j in range(100,106):
        dp[i+j] = max(dp[i] , dp[i+j])

print(dp[x])

Measured memory_bytes: 9408
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int inf=1e9;
const ll INF=1e18;
const double pi=3.14159265358979323846;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,ans=inf,dp[100005]={};
  cin >> n;
  dp[0]=0;
  for(int i=1; i<=n; i++) {
    dp[i]=dp[i-1]+1;
    for(int j=6; j<=i; j*=6) {
      dp[i]=min(dp[i],dp[i-j]+1);
    }
    for(int j=9; j<=i; j*=9) {
      dp[i]=min(dp[i],dp[i-j]+1);
    }
  }
  cout << dp[n] << endl;
}




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

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, maxx=0, ans = 0, x;
    cin >> n;
    while(n--){
        cin >> x;
        if(x >= maxx){
            maxx = x;
            ++ans;
        }
    }
    cout << ans << "\n";
    return 0;
}


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

using namespace std;

int dp[6][6][6][6];

int solve(int lm, int rm, int lo, int ro)
{
  int &ret = dp[lm][rm][lo][ro];
  if(~ret) return ret;
  if(lo == 5 && ro == 5) return ret = 1;
  ret = 0;  
  if(lm < 5) {
    if(lo < 5) ret |= !solve(min(lo+lm, 5), ro, lm, rm);
    if(ro < 5) ret |= !solve(lo, min(ro+lm, 5), lm, rm);
  }
  if(rm < 5) {
    if(lo < 5) ret |= !solve(min(lo+rm, 5), ro, lm, rm);
    if(ro < 5) ret |= !solve(lo, min(ro+rm, 5), lm, rm);
  }
  return ret;
}

int main()
{
  int li, ri, ln, rn;
  cin >> li >> ri >> ln >> rn;
  memset(dp, -1, sizeof(dp));
  cout << (solve(li, ri, ln, rn) ? "ISONO" : "NAKAJIMA") << endl;
  return 0;
}

Measured memory_bytes: 3088
n=int(input())
a=0
b=0
for i in range(1,7):
  if 10**(i-1)<=n<10**i:
    a=i
if a==2:
  print(9)
if a==4:
  print(909)
if a==6:
  print(90909)
if a==1:
  print(n)
if a==3:
  print(n-90)
if a==5:
  print(n-9090)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int ans[11], an,n;
	an = 0;
	while (1) {
		cin >> n;
		if (n == 0) {
			goto a;
		}
		an = an + 1;
		ans[an] = 0;
		n = 1000 - n;
		while (n >= 500) {
			ans[an] = ans[an] + 1;
			n = n - 500;
		}
		while (n >= 100) {
			ans[an] = ans[an] + 1;
			n = n - 100;
		}
		while (n >= 50) {
			ans[an] = ans[an] + 1;
			n = n - 50;
		}
		while (n >= 10) {
			ans[an] = ans[an] + 1;
			n = n - 10;
		}
		while (n >= 5) {
			ans[an] = ans[an] + 1;
			n = n - 5;
		}
		while (n >= 1) {
			ans[an] = ans[an] + 1;
			n = n - 1;
		}
	}
a:;
	for (int i = 1; i <= an; i++) {
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 3108
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string s;
  vector<int> x;
  while (1) {
    cin >> s;
    if (s == "0")
      break;
    int tmp = 0;
    rep(i, s.size()) tmp += s[i] - '0';
    x.push_back(tmp);
  }

  rep(i, x.size()) cout << x[i] << endl;

  return 0;
}


Measured memory_bytes: 3204
#include<queue>
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define mem(a,b) memset(a,b,sizeof a)
#define  For(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define rFor(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
using namespace std;
typedef long long LL;
const LL mod=1e9+7;
template<typename T>inline T chkmax(T _A,T _B){return _A>_B?_A:_B;}
template<typename T>inline T chkmin(T _A,T _B){return _A<_B?_A:_B;}
template<typename T>void read(T&x)
{
    x=0;int _f(0);char ch=getchar();
    while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
    while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
    x=_f?-x:x;
}
inline void file()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
}
int n,m;
LL ans=1;
int main()
{
	read(n),read(m);
	if(n-m>1||m-n>1)puts("0");
	else
	{
		For(i,2,n)ans=ans*i%mod;
		For(i,2,m)ans=ans*i%mod;
		if(n==m)ans=ans*2%mod;
		printf("%lld\n",ans);
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main {

	static int size;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PriorityQueue<Integer> pQue = new PriorityQueue<Integer>(10,COMPARATOR);

		while (true) {
			String line = br.readLine();
			if (line.equals("end")){
				break;
			}else if (line.startsWith("insert")) {
				pQue.add(Integer.parseInt(line.substring(line.indexOf(" ")+1)));
			}else {
				System.out.println(pQue.poll());
			}

		}
	}

	public static final Comparator<Integer> COMPARATOR = new Comp();
	
	private static class Comp implements Comparator<Integer>{
		public int compare(Integer x,Integer y){
			return (x < y) ? 1 : ((x == y) ? 0 : -1);
		}
	}
}

Measured memory_bytes: 153748
import java.util.Scanner;
public class Main{
public static void main(String args[]){
  Scanner scan=new Scanner(System.in);
int check=scan.nextInt()-1;
int ar[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
System.out.println(ar[check]);
}
}


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

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;

constexpr int MAXW = 1000, MOD = 1000000007;

int dp[MAXW + 2];

int main() {
	int H, W;
	cin >> H >> W;
	char a;
	cin >> a;
	dp[0] = a  == '.';
	for(int i = 1; i < W; i++) {
		cin >> a;
		dp[i] = a == '.' ? dp[i - 1] : 0;
	}
	for(int i = 1; i < H; i++) {
		cin >> a;
		if(a != '.')
			dp[0] = 0;
		for(int j = 1; j < W; j++) {
			cin >> a;
			dp[j] = a == '.' ? (dp[j - 1] + dp[j]) % MOD : 0;
		}
	}
	cout << dp[W - 1] << endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	p := make([]int, n)
	for i := range p {
		fmt.Scan(&p[i])
	}

	var m, ans int
	for i, v := range p {
		if i == 0 || v < m {
			m = v
		}
		if p[i] == m {
			ans++
		}
	}
	fmt.Println(ans)
}


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

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i]--;
	}
	vector<int> used(n, 0);
	int ans = -1;
	for (int cur = 0, i = 1; i <= n; i++) {
		cur = a[cur];
		if (cur == 1) {
			ans = i;
			break;
		}
		if (used[cur]) break;
		used[cur] = 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <climits>
#include <array>
using namespace std;
          
long int A[200001];  
    
int main(){
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>A[i];
    
    long int a=INT_MIN;
    long int m=INT_MAX;
    for(int i=0;i<n;i++){
       a=max(a,A[i]-m);
       m=min(m,A[i]);
    }
    cout<<a<<endl;
    return 0;
}

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

int main() {
  ll X, A, B;
  cin >> X >> A >> B;
  string ans;
  if (B - A <= 0) {
    ans = "delicious";
  } else if (B - A <= X) {
    ans = "safe";
  } else {
    ans = "dangerous";
  }
  cout << ans << endl;
  return 0;
}

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

int dp[1000010];
int dp2[1000010];

inline int tetnum(int n) {
	return n * (n + 1) * (n + 2) / 6;
}

int main () {
	dp[0] = 0;
	fill(dp, dp + 1000010, 0x7ffffff);
	fill(dp2, dp2 + 1000010, 0x7ffffff);
	for (int i = 0; tetnum(i) < 1000010; i++) dp[tetnum(i)] = 1;
	for (int i = 0; tetnum(i) < 1000010; i++) {
		if (tetnum(i) & 1) dp2[tetnum(i)] = 1;
	}
	for (int i = 1; i <= 1000010; i++) {
		for (int j = 0; i - tetnum(j) > 0; j++) {
			dp[i] = min(dp[i], dp[i - tetnum(j)] + 1);
			if (tetnum(j) & 1) {
				dp2[i] = min(dp2[i], dp2[i - tetnum(j)] + 1);
			}
		}
	}
	int n;
	while (cin >> n, n) {
		cout << dp[n] << ' ' << dp2[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 8972
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}
	int MOD = 1000000007;
	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		long a[]=new long[n];
		for(int i=0; i<n; i++) {
			a[i]=sc.nextLong();
		}
		long ans=0;
		for(int i=0; i<60; i++) {
			long x=0;
			for(int j=0; j<n; j++) {
				if( ((a[j]>>i)&1) == 1 ) {
					x++;
				}
			}
			long tmp=(x*(n-x))% MOD;
			for(int j=0; j<i; j++) {
				tmp = (tmp * 2) % MOD;
			}
			ans += tmp;
			ans %= MOD;
		}
		System.out.println(ans);
		sc.close();
	}
}

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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin >> n;
    string s;
    cin >> s;

    rep(i, s.size()) {
        s[i] = (((s[i] - 'A') + n) % 26) + 'A';
    }

    cout << s << endl;

    return 0;
}


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

struct edge{int to,cost;};
typedef pair<int,int> P;
const int INF=1000000;

vector<edge> G[3001];
int d[3001];
int n,m,k;

void dijk(vector<int>sv){
	priority_queue<P ,vector<P>,greater<P> > que;
	fill(d,d+3001,INF);
	for(int i=0;i<sv.size();i++){
      d[sv[i]]=0;
      que.push(P(0,sv[i]));
	}
	while(!que.empty()){
		P p=que.top();que.pop();
		int v=p.second;
		if(d[v]<p.first)continue;
		for(int i=0;i<G[v].size();i++){
			edge e=G[v][i];
			if(d[e.to]>d[v]+e.cost){
				d[e.to]=d[v]+e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
	}
}

int main(void){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<m;i++){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		edge e;
		e.to=b,e.cost=c;
		G[a].push_back(e);
		e.to=a;
		G[b].push_back(e);
	}
	vector<int> sv;
	for(int i=0;i<k;i++){
		int a;
		scanf("%d",&a);
		sv.push_back(a);
	}
	dijk(sv);

	int maxi=0;
	for(int i=0;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			for(int k=0;k<G[i].size();k++){
				int cost=0;
				edge e=G[i][k];
				if(e.to==j)cost=((d[i]+d[j]+e.cost+1)/2);
				maxi=max(maxi,cost);
			}
		}
	}
	printf("%d\n",maxi);
    return 0;
}

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

public class Main {
	//?????°
	private static int valueOfCard = 9; //?????????????????°
	private static int numberOfCard = 9; //?????????????????????????¨??????°(1???9 = 9)
	private static int colorOfCard = 3; //??????????????????????¨??????°(RGB = 3)
	private static int winSetCount = 3; //???????????????????????¢?????°

	/**
	 * 1??????????????????????????¨???????????????????????????
	 * @author SS
	 *
	 */
	static class Card {
		private int number;
		private String color;

		public int getNumber() {
			return number;
		}
		public void setNumber(int number) {
			this.number = number;
		}
		public String getColor() {
			return color;
		}
		public void setColor(String color) {
			this.color = color;
		}
	}

	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		//??\????????°?????????
		int intLoop = scan.nextInt();
		//????¨?????´???´????¢????
		ArrayList<Integer> ansList = new ArrayList<Integer>();
		ArrayList<Card> cards = new ArrayList<Card>();

		//??\?????????
		for(int i = 0; i < intLoop; i++){

			for(int j = 0; j < valueOfCard; j++){
				Card card = new Card();
				card.setNumber(scan.nextInt());
				cards.add(card);
			}
			for(int j = 0; j < valueOfCard; j++){
				Card card = cards.get(j + i * valueOfCard);
				card.setColor(scan.next());
				cards.set(j + i * valueOfCard, card);
			}
		}
		scan.close();
		for(int i = 0; i < intLoop; i++){
			int setCount = 0; //??¢????????°
			int[][] arrayRGB = new int[colorOfCard][numberOfCard];
			//RGB???????????\?????????
			for(int j = 0; j < valueOfCard; j++){
				Card card = cards.get(j + i * valueOfCard);
				String color = card.getColor();
				if("R".equals(color)){
					arrayRGB[0][card.getNumber() - 1]++;
				}else if("G".equals(color)){
					arrayRGB[1][card.getNumber() - 1]++;
				}else if("B".equals(color)){
					arrayRGB[2][card.getNumber() - 1]++;
				}
			}
			//???????????§??????
			for(int j = 0; j < colorOfCard; j++){
				for(int k = 0; k < valueOfCard - 2; k++){
					boolean isReplay = false;
					if(arrayRGB[j][k] != 0 && arrayRGB[j][k+1] != 0 && arrayRGB[j][k+2] !=0){
						arrayRGB[j][k]--;
						arrayRGB[j][k+1]--;
						arrayRGB[j][k+2]--;
						setCount++;
						isReplay = true;
					}
					if(isReplay && arrayRGB[j][k] != 0){
						k--;
					}
				}
			}
			//???????????§??????
			for(int j = 0; j < colorOfCard; j++){
				for(int k = 0; k < valueOfCard; k++){
					if(arrayRGB[j][k] == winSetCount){
						setCount++;
						arrayRGB[j][k] -= winSetCount;
					}
				}
			}
			if(setCount == winSetCount){
				ansList.add(1);
			}else{
				ansList.add(0);
			}
		}
		//??????
		for(int i = 0; i < ansList.size(); i++){
			System.out.println(ansList.get(i));
		}
	}
}

Measured memory_bytes: 20964
N = gets.to_i
#map(&:to_i)を利用し配列に整数として要素を代入
A = gets.chomp.split(" ").map(&:to_i)
#group_byを利用→同じ要素をまとめる
B = A.group_by{|x| x}
if N % 2 == 0 then
    for i in 1..N/2 do
        if B[2*i-1].nil? || B[2*i-1].count != 2 then
            puts 0
            exit
        end
    end
    puts ((2 ** (N / 2)) % (10 ** 9 + 7))
else
    if B[0].count == 1 then
        for i in 1..(N-1)/2 do
            if B[2*i].nil? || B[2*i].count != 2 then
                puts 0
                exit
            end
        end
    else
        puts 0
        exit
    end
    puts ((2 ** ((N-1) / 2)) % (10 ** 9 + 7))
end
        


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

using namespace std;

int main(){
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        long long int a;
        cin >> a;
        if(a%2==1){
            cout << "first" << endl;
            return 0;
        }
    }

    cout << "second" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
typedef long long ll;
#include <cmath>
#include<cstdio>
#include<iomanip>

int main(int argc, char *argv[])
{
	double l;

	cin>>l;

	double ret=l*l*l/27;


	cout<<std::setprecision(10)<<ret<<endl;

	return 0;
}


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

int main()
{
	int n,b,f,r,v;
	int build[4][3][10];
	// build配列の初期化
	for (int i = 0;i < 4;i++)
	{
		for (int j = 0;j < 3;j++)
		{
			for (int k = 0;k < 10;k++)
			{
				build[i][j][k] = 0;
			}
		}
	}

	cin >> n;

	for (int i = 0;i < n;i++)
	{
		cin >> b >> f >> r >> v;
		build[b-1][f-1][r-1] += v;
	}
	
	for (int i = 0;i < 3;i++)
	{
		for (int j = 0;j < 3;j++)
		{
			for (int k = 0;k < 10;k++)
			{
				cout << ' ' <<build[i][j][k];
			}
			cout << '\n';
		}
		cout << "####################\n";
	}
	for (int i = 0;i < 3;i++)
	{
		for (int j = 0;j < 10;j++)
		{
			cout << ' ' << build[3][i][j];
		}
		cout << '\n';
	}

	return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#define debug(x)        cout<<#x<<" :"<<x<<endl;
#define ff              first
#define ar              array
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define f(i,n)          for(int i=0;i<n;i++)
#define MOD             1000000007
#define pi              3.14159265
#define umii            unordered_map<int,int>
#define umci            unordered_map<char,int>
#define umsi            unordered_map<string,int>

void k_007()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("ip1.txt", "r", stdin);
	freopen("op1.txt", "w", stdout);
#endif
}
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b);
int gcd(int a, int b) ;
int prime(int n);
int power(int x, int y);
int lcm(int a, int b);
int32_t main()
{
	k_007();
	int n, k;
	cin >> n >> k;

	int ans = 0;
	while (n >= k)
	{
		n = n / k;
		ans++;
	}

	cout << ans + 1 << endl;
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
	return (a.second < b.second);
}
int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int prime(int n) {
	int flag = 1;
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0) {flag = 0; break;}
	}
	return flag;
}
int power(int x, int y)
{
	if (y == 0)
		return 1;
	else if (y % 2 == 0)
		return ((power(x, y / 2) % MOD) * ( power(x, y / 2) % MOD)) % MOD;
	else
		return ((x % MOD) * (power(x, y / 2) % MOD) * (power(x, y / 2) % MOD)) % MOD;
}
int lcm(int a, int b)
{
	return (a * b) / gcd(a, b);
}

Measured memory_bytes: 3692
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		Integer n = sc.nextInt();

		Integer[] build = new Integer[120];

		for (Integer i = 0; i < 120; i++) {
			build[i] = 0;
		}

		for (Integer i = 0; i < n; i++) {
			Integer b = (sc.nextInt() - 1) * 30;
			Integer f = (sc.nextInt() - 1) * 10;
			Integer r = sc.nextInt();
			Integer v = sc.nextInt();

			build[b + f + r - 1] += v;
		}

		for (Integer i = 0; i < 120; i++) {
			System.out.print(" " + build[i]);
			if(i == 119) {
				System.out.println();
				return;
			}
			if ((i + 1) % 10 == 0) {
				System.out.println();
			}
			if ((i + 1) % 30 == 0) {
				System.out.println("####################");
				continue;
			}
		}

		
	}
}


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

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    int x,y;
    cin>>x>>y;
    
    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;++j){
            if(4*j + 2*i == y and i + j == x){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll X,Y;
  cin >> X >>Y;
  if(abs(X-Y)<=1LL){
    cout << "Brown" << endl;
  }else{
    cout << "Alice" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
ll ans1=0,cnt[105]={0},k;
int vis[105];
char s[105];
int main(){
	scanf("%s%lld",s+1,&k);
	vis[1]=1;int n=std::strlen(s+1);
	for(int i=1;i<=n;++i){
		if (s[i]==s[i-1])vis[i]=vis[i-1];
		else vis[i]=vis[i-1]+1;
		cnt[vis[i]]++;
	}if (vis[n]==1){ans1=n*k/2;std::cout<<ans1;return 0;}
	for(int i=2;i<vis[n];i++)ans1+=cnt[i]/2;ans1*=k;
	ans1+=cnt[1]/2+cnt[vis[n]]/2;
	if (s[n]!=s[1]){ans1+=cnt[1]/2*(k-1)+cnt[vis[n]]/2*(k-1);}
	else {
		ll size;
		size=cnt[vis[n]]+cnt[1];
		ans1+=size/2*(k-1);
	}std::cout<<ans1;	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
long long int n;
	cin >>n;
  long long int a[n],b[n];
  for (int i=0;i<n/2;i++){
  	cin >>a[i];
    cin >>b[i];
  }
  long long int counta[100000],countb[100000];
  for (int i=1;i<=100000;i++){
  	counta[i]=0;
    countb[i]=0;
  }
  for (int i=0;i<n/2;i++){
  	counta[a[i]]++;
    countb[b[i]]++;
  }
  long long int aa=0,keya,bb=0,keyb;
  for (int i=1;i<=100000;i++){
  	if(aa<counta[i]){aa=counta[i];keya=i;}
    if(bb<countb[i]){bb=countb[i];keyb=i;}
  }
  sort(counta,counta+100000);
  sort(countb,countb+100000);
  reverse(counta,counta+100000);
  reverse(countb,countb+100000);
  
  long long int ans;
  
  if(n==2 && keya==keyb) ans=1;
  else if (n==2 && keya!=keyb)ans=0;
  else if(keya==keyb)ans=min(n-counta[1]-countb[0],n-counta[0]-countb[1]);
  else ans=n-counta[0]-countb[0];
  cout << ans <<endl;
}

Measured memory_bytes: 2560