akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.PrintWriter;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int k=sc.nextInt();
		int[] a=new int[n+1];
		long[] b=new long[m+1];
		for(int i=1; i<=n;i++){
			a[i]=sc.nextInt();
		}
		for(int i=1; i<=m; i++){
			b[i]=b[i-1]+sc.nextInt();
		}
		int bIndex=m;
		int ans=0;
		for(int i=0; i<=n; i++){
			k-=a[i];
			if(k<0){
				break;
			}
			int leftTime=k;
			while(leftTime<b[bIndex]){
				bIndex--;
			}
			ans=Math.max(ans,i+bIndex);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 63440
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		//行と列の変数を宣言
		int row = scan.nextInt();
		int column = scan.nextInt();

		//行列の二次元配列を宣言
		int[][] matrix = new int[row][column];

		//ベクトルを宣言
		int[] vector = new int[column];
		int[] vectorAnswer = new int[row];

		//行列に入力した値を格納
		for(int rowI = 0 ;rowI < row ;rowI++){
			for(int columnI = 0 ;columnI < column;columnI++){
				matrix[rowI][columnI] = scan.nextInt();
			}
		}
		//ベクトルに入力した値を格納
		for(int columnI = 0 ;columnI < column ;columnI++){
			vector[columnI] = scan.nextInt();
		}
		//答えのベクトルを計算
		for(int rowI = 0 ;rowI < row ;rowI++){
			for(int columnI = 0 ;columnI < column;columnI++){
				vectorAnswer[rowI] += matrix[rowI][columnI] * vector[columnI];
			}
		}
		//計算したものを出力
		for(int rowI = 0 ;rowI < row ;rowI++ ){
			System.out.println(vectorAnswer[rowI]);
		}

	}
}



Measured memory_bytes: 40668
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import division, print_function
import sys


def main():
    h, w = map(int, sys.stdin.readline().strip().split(" "))
    aa = ""
    for _ in range(h):
        aa += sys.stdin.readline().strip()
    d = {}
    for c in aa:
        if c in d:
            d[c] += 1
        else:
            d[c] = 1

    # print(d)
    fours = 0
    evens = 0
    odds = 0

    for c, count in d.items():
        fours += count // 4
        evens += (count % 4) // 2
        odds += count % 2

    # print(fours, evens, odds)
    if h % 2 == 0 and w % 2 == 0:
        print("Yes" if odds == 0 and evens == 0 else "No")
    elif h % 2 == 0 and w % 2 == 1:
        if odds != 0:
            print("No")
            return
        if 4 * fours < h * (w - 1):
            print("No")
            return
        print("Yes")
    elif h % 2 == 1 and w % 2 == 0:
        if odds != 0:
            print("No")
            return
        if 4 * fours < w * (h - 1):
            print("No")
            return
        print("Yes")
    else:
        if odds != 1:
            print("No")
            return
        if 4 * fours < (w - 1) * (h - 1):
            print("No")
            return
        print("Yes")


if __name__ == '__main__':
    main()


Measured memory_bytes: 2696
use std::cmp::{min,max};
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)*}
    };
}

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)*}
    };
}

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, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main(){
    input!{
        n:usize,
        k:i64,
        s:chars,
    }
    let mut s = s;
    s.push('E');
    let mut ans = std::usize::MIN;
    let mut l:usize = 0;
    let mut r:usize = 0;
    
    let mut count  = if s[0] == '0' {1} else {0};
    while r < n {
        if count <= k {
            if s[r] == '1' && s[r+1] == '0' {
                count += 1;
            }
            ans = max(ans,r-l+1);
            r +=1;
        } else if l == r {
            l += 1;
            r += 1;
        } else {
            if s[l] == '0' && s[l+1] == '1'{
                count -= 1;
            }
            l += 1;
        }
    }
    println!("{}",ans);
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD_NUM 1000000007
using namespace std;

int main(){

	int N,div;
	scanf("%d %d",&N,&div);

	int* table = new int[N];
	int* indexTable = new int[200001];
	int index = N-1,tmp;
	priority_queue<int> Q;

	for(int i = 0; i < N; i++){
		scanf("%d",&tmp);
		Q.push(tmp);
	}

	while(!Q.empty()){
		table[index--] = Q.top();
		Q.pop();
	}

	for(int i = 0; i <= 200000; i++)indexTable[i] = -1;

	for(int i = 0; i < N; i++){
		indexTable[table[i]] = i;
	}

	indexTable[0] = 0;
	for(int i = 1; i <= 100000; i++){
		if(indexTable[i] == -1){
			indexTable[i] = indexTable[i-1];
		}
	}
	for(int i = 100001;i <= 200000; i++){
		indexTable[i] = indexTable[i-1];
	}

	ll ans = 1;

	for(int i = 0,k = 0; i <= N-1;i++){
		k = indexTable[table[i]+div]-(i-1);
		ans *= k;
		ans %= MOD_NUM;
	}

	printf("%lld\n",ans%MOD_NUM);

	return 0;
}

Measured memory_bytes: 4052
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        Map<String, Long> cnt = new HashMap<>();
        String[] words = new String[N];

        for (int i = 0; i < words.length; i++) {
            String word = in.next();
            char[] arr = word.toCharArray();
            Arrays.sort(arr);
            String sorted = String.valueOf(arr);
            cnt.put(sorted, cnt.getOrDefault(sorted, (long) 0) + 1);
        }

        long res = 0;
        for (Long i : cnt.values())
            res += i * (i - 1) / 2;
        System.out.println(res);
    }
}


Measured memory_bytes: 54276
from bisect import bisect_right as br
N = int(input())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
s, t = 0, 0
for i in range(N):
    s ^= A[i]
    t ^= B[i]
ans = (s ^ t) * (N % 2)
for k in range(1, 29):
    m = (1<<k)
    AA = sorted([a % m for a in A])
    BB = sorted([a % m for a in B])[::-1]
    i, j = 0, 0
    while i < N and AA[i] + BB[j] < m:
        i += 1
    s = 0
    while i < N:
        while j < N and AA[i] + BB[j] >= m:
            j += 1
        s += j
        i += 1
    ans ^= (s % 2) << k
print(ans)

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

typedef long long ll;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    
    int n;
    cin>>n;
    
    map<string,ll>m;
    
    ll tot=0;
    
    for(int i=0;i<n;i++)
    {
    	string x;
    	cin>>x;
    	sort(x.begin(),x.end());
    	m[x]++;
    }
    
    for(auto it: m)
    {
    	ll temp=it.second*(it.second-1);
    	temp/=2;
    	tot+=temp;
    }
    
    cout<<tot;

  
    return 0;

}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vc= vector<char>;
#define REP(i,x,n) for(int i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()


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

  if(a>=b*2){
    cout << a-(b*2) << endl;
  }
  else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

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

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

  if(count % 2 == 0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }

  return 0;
}


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] str = Console.ReadLine().Split(' ');
            if(str[1] == "+")
            {
                Console.WriteLine(int.Parse(str[0]) + int.Parse(str[2]));
            }
            else
            {
                Console.WriteLine(int.Parse(str[0])-int.Parse(str[2]));
            }
            }
    }
}


Measured memory_bytes: 13140
// c++include
#include <iostream>
#include <algorithm>
// cinclude
#include <stdio.h>
#include<string.h>
#include<math.h>
//c++標準ライブラリ
#include<vector>
#include<string>
//std使用<-namespace
using namespace std;

// define, typedef
#define rpt(i, n) for(ll i = 0; i < (n); i++)
typedef long long ll;


// main関数
int main(void) {
	const int max = 100000 + 1;
	ll n, b[max];
	vector<ll> a;
	cin >> n;
	rpt(i, n) {
		ll x;
		cin >> x;
		a.push_back(x);
	}
	rpt(i, n) {
		b[a[i]] = i + 1;
	}
	for (ll i = 1; i <= n; i++) {
		cout << b[i] << " ";
	}

	return 0;
}

Measured memory_bytes: 2548
#include<bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
int main(){
    int64_t X;
    cin >> X;
    X = abs(X);
    int64_t K;
    cin >> K;
    int64_t D;
    cin >> D;
    int64_t result;
    int64_t quotient = X / D;
    if(quotient > K){
        result = X - D * K;
    }
    else{
        if((K - quotient) % 2 == 0){
            result = X - quotient * D;
        }
        else{
            result = abs(X - D * (quotient + 1));
        }
    }
    cout << result << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <map>
using namespace std;
int main(){
  int N,cnt=0;
  string str;
  map<string,int> smap;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> str;
    smap[str]++;
    cnt=max(cnt,smap[str]);
  }
  for(auto it=smap.begin();it!=smap.end();it++){
    if((*it).second==cnt)cout << (*it).first << endl;
  }
  return 0;
}

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

class UnionFind{
    public:
        vector<int> uni;
        UnionFind(int s) : uni(s, -1) { }
 
       //頂点aが所属するグループを調べる
        int root(int a)
        {
            if (uni[a] < 0) return a;
            return uni[a] = root(uni[a]);
        }
    
        //頂点aと頂点bを繋ぐ。もともと同じグループの時falseを返す
        bool connect(int a,int b)
        {
            a = root(a);
            b = root(b);
            if (a == b) return false;
    
            if (uni[a] > uni[b])
            {
                a ^= b;
                b ^= a;
                a ^= b;
            }
    
            uni[a] = uni[a] + uni[b];
            uni[b] = a;
            return true;
        }
    
        //頂点a,bが同じグループであるかを調べる
        bool isConnect(int a,int b)
        {
            return root(a) == root(b);
        }
    
        //頂点aを含むグループの頂点数を調べる
        int size(int a)
        {
            return -uni[root(a)];
        }
    
    };


int main(void){
  int n, m;
  cin >> n >> m;

  int mx = 0;
  UnionFind uni(n);
  rep(i, m){
    int a, b;
    cin >> a >> b;a--;b--;
    if(!uni.isConnect(a,b)){
      uni.connect(a,b);
    }
    mx = max(mx, uni.size(a));
  }
  if(mx==0)mx=1;
  cout << mx;
}



Measured memory_bytes: 4044
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


int main() {
	int N; cin >> N;
	vector<int>d(N);
	for (int i = 0; i < N; i++) {
		cin >> d[i];
	}
	int sum = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			sum += d[i] * d[j];
		}
	}
	cout << sum << endl;


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	string w;
	int count[26] = {};
	cin >> w;

	rep(i, w.size())count[w[i]-'a']++;
	//rep(i, 26)cout << i << " " << count[i] << endl;
	for (int i = 0; i < 26; i++) {
		if (count[i] % 2 != 0) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template
int A[32] = {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};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int K;
    cin >> K;
    output(A[K - 1]);
    return 0;
}


Measured memory_bytes: 256
N = int(input())
abc = []
abc.append((0, 0, 0))
for _ in range(N):
    a, b, c = map(int, input().split())
    abc.append((a, b, c))

dp = [[float("inf") for _ in range(3)] for _ in range(N + 1)]
dp[0] = [0, 0, 0]

for i in range(1, N + 1):
    dp[i][0] = max(dp[i - 1][1] + abc[i][0], dp[i - 1][2] + abc[i][0])
    dp[i][1] = max(dp[i - 1][2] + abc[i][1], dp[i - 1][0] + abc[i][1])
    dp[i][2] = max(dp[i - 1][0] + abc[i][2], dp[i - 1][1] + abc[i][2])

print(max(dp[-1][0], dp[-1][1], dp[-1][2]))


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

const int MAXN = 1000000 + 10;
const int MOD = 1e9 + 7;
int n, a, b, c, d;

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin >> n >> a >> b >> c >> d;

    int diff = abs(a-b);
    if (diff > d * (n-1)) {
        cout << "NO\n";
        return 0;
    }

    int p, q;
    p = a - (n-1) * d;
    q = a - (n-1) * c;

    bool ok = false;
    for (int i = 0; i < n; i++) {
        if (p <= b && b <= q) {
            ok = true;
            break;
        }
        p += c + d;
        q += c + d;
    }

    if (ok) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }


    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>

using namespace std;

typedef long long ll;
typedef long double ld;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define mll map<ll,ll>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define srta(a) sort(all(a))
#define srtd(a) sort(all(a),greater<型>())
#define rvs(s) reverse(all(s))
#define psb push_back
#define ppb pop_back
#define isu isupper
#define isl islower

const int I_INF = 1001001001;
const ll LL_INF = 1001001001001001001;
const ld EPS = 0.001;



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

    ll MAX = 10000005;
    vl a(MAX, 1);
    for (int i=2; i<MAX; ++i) {
        for (int j=i; j<MAX; j += i) a[j]++;
    }

    ll ans = 0;
    rep1 (i, N) {
        ans += i*a[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 81392
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
	int N;
	cin >> N;
	vector<int> vec(N);
	for(int i = 0;i < N;i++) {
		cin >> vec.at(i);
	}
	for(int i = 0;i < N;i++) {
		vec.at(i) -= i + 1;
	}
	sort(vec.begin(),vec.end());
	int cnt;
	if(N % 2 == 1) {
		cnt = vec.at(N / 2);
	}
	else {
		cnt = (vec.at(N / 2 - 1) + vec.at(N / 2)) / 2;
	}
	int ret = 0;
	for(int i = 0;i < N;i++) {
		ret += abs(vec.at(i) - cnt);
	}
	cout << ret << endl;
}

Measured memory_bytes: 1792
def main():
    _ = int(input())
    a = [int(an) for an in input().split()]
    a.sort()
    half_val = -(-a[-1] // 2)
    dist_list = [abs(half_val - an) for an in a[:-1]]
    min_index = dist_list.index(min(dist_list))
    print(f'{a[-1]} {a[min_index]}')


if __name__ == '__main__':
    main()

Measured memory_bytes: 92308
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
ll power(ll x, ll y); 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitcount(n) __builtin_popcountll(n)
#define in_edges(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B);}
#define in_edges3(M) repp(I, 1, M){int A, B, C; cin >> A >> B >> C; v[A].pb(B, C), v[B].pb(A, C);}
#define endl "\n"

const ll MOD = 1000000007;
const ll INF = 1e18;
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    ll n, x, t;
    cin >> n >> x >> t;

    ll res = n/x;
    if(n % x != 0) res++;
    cout << res*t;
}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Measured memory_bytes: 3656
#include <iostream>

using namespace std;

int main()
{
	int a = 700;
	string str;
	
	cin >> str;
	
	for (int i = 0; i < 3; i++) {
		if (str[i] == 'o') {
			a += 100;
		}
	}
	
	cout << a << endl;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>                 // [PRIMES]               1777 ~2^10.80  
using namespace std;                     //                       10333 ~2^13.33
using ll=long long;                      // seq 1 128 | factor   100333 ~2^16.61
using vl=vector<ll>;                     //   | grep -v ' .* '  1300111 ~2^20.31
using vvl=vector<vl>;                    //                    10300777 ~2^23.30
using vb=vector<bool>;                   //                   100400999 ~2^26.58
using vs=vector<string>;                 //                  1300400999 ~2^30.28
using pll=pair<ll,ll>;                   //                 10200500333 ~2^33.25
const ll oo =0x3f3f3f3f3f3f3f3fLL;       //                100200400777 ~2^36.54
const double eps=1e-9;                   //               1200300700111 ~2^40.13
#define sz(c) ll((c).size())             //              10200300500777 ~2^43.21
#define all(c) begin(c),end(c)           //             100200300400777 ~2^46.51
#define mp make_pair                     //            1200300400600999 ~2^50.09
#define mt make_tuple                    //           10200300400600111 ~2^53.18
#define pb push_back                     //          100200300400600333 ~2^56.48
#define eb emplace_back                  //         1200300400500800999 ~2^60.06
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })
int main() {
  cin.sync_with_stdio(0);
  ll n;
  cin >> n;
  ll d;
  cin >> d;
  ll count = 0;
  FOR(i, 0, n) {
	  ll xi, yi;
	  cin >> xi >> yi;

	  if (xi*xi + yi*yi <= d*d) {
		  count++;
	  }
  }

  cout << count << endl;
}


Measured memory_bytes: 3608
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	private static final int N = 3;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			System.out.println((N == IntStream.range(0, s.length).map(i -> s[i]).distinct().count()) ? "Yes" : "No");
		}
	}
}


Measured memory_bytes: 28500
/*
  AUTHOR:SOURABH
  CREATED:14:03:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pll , null_type, less< pll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("in.txt","r",stdin);
    //freopen(2 "out.txt","w",stdout);

    ll t,a,b,c,q,s;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>a>>b>>c;
        ld p=2*(ld)sqrt((ld)a*b);
        q=p;
        s=c-a-b;
        if(s>q)
                cout<<"Yes";
            else
                cout<<"No";
    }
    return 0;
}





Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	char a,b;
	scanf("%c %c",&a,&b);
	
	if(a=='H' && b=='H')
		printf("H\n");
	else if(a=='D' && b=='D')
		printf("H\n");
	else if(a=='H' && b=='D')
		printf("D\n");
	else if(a=='D' && b=='H')
		printf("D\n");
	
	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++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    string s;
    cin >>s;
    if(s[5] == '1'){
        cout << "TBD" << endl;
        return 0;
    }else if(s[6] <= '4'){
        cout << "Heisei" << endl;
    }else{
        cout << "TBD" << endl;
    }
    return 0;
}

Measured memory_bytes: 3720
n = int(input())
raw = list(map(int,input().split()))
can = []
for i in range(n):
  now = raw[i]
  can.append(now-1)
  can.append(now)
  can.append(now+1)
can.sort()
ans = 0
for j in range(3*n):
  try:
    if can[j-1] == can[j]:
      cnt += 1
    else:
      cnt = 1
  except:
    #i==0
    cnt = 1
  if cnt > ans:
    ans = cnt
#print(can)
print(ans)

Measured memory_bytes: 17620
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>

using namespace std;

int main(){


	int A;
	int B;

	cin >> A >> B;

	if(A == B){
		cout << "Draw";
		return 0;
	}

	if(A == 1){
		cout << "Alice";
		return 0;
	}

	if(B == 1){
		cout << "Bob";
		return 0;
	}

	if(A < B){
		cout << "Bob";
	}else{
		cout << "Alice";
	}



	return 0;

}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
import collections

n = int(input())
a = list(map(int, input().split()))
alis = collections.Counter(a)
ss = []
for i in range(1, n+1):
    ss.append(alis[i]*(alis[i]-1)//2)
#print(ss,alis)

chinpo=sum(ss)
#print(chinpo)
for i in range(n):
    #ss[a[i]-1] = (alis[a[i]]-1)*(alis[a[i]]-2)//2
    print(chinpo-ss[a[i]-1]+(alis[a[i]]-1)*(alis[a[i]]-2)//2)


Measured memory_bytes: 25920
def min_join(strings):
    """文字を全て結合して、辞書順で最も小さくなる文字を探す。"""
    strings.sort()
    return ''.join(strings)


def main():
    N, L = (int(i) for i in input().split())
    strings = [input() for _ in range(N)]
    print(min_join(strings))
    

main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007;

ll gcd(ll a,ll b){
    while(b!=0){
        a%=b;
        swap(a,b);
    }
    return a;
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}

int main() {
    ll A,B,C,D;
    cin>>A>>B>>C>>D;
    ll ans=B-A+1;
    ans-=B/C-(A-1)/C;
    ans-=B/D-(A-1)/D;
    ans+=B/lcm(C,D)-(A-1)/lcm(C,D);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

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

        BigInteger A = sc.nextBigInteger();
        BigInteger B = sc.nextBigInteger();

        System.out.println(solve(A, B));

        sc.close();
    }

    static String solve(BigInteger A, BigInteger B) {
        int cmp = A.compareTo(B);
        if (cmp < 0) {
            return "LESS";
        } else if (cmp > 0) {
            return "GREATER";
        } else {
            return "EQUAL";
        }
    }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define inf (int)(3e18)
#define P pair<int,int>
#define mod (int)(1e9+7)

template<class T> inline void chmin(T &a, T b) {
	a = min(a, b);
}
template<class T> inline void chmax(T &a, T b) {
	a = max(a, b);
}

int H,W;
char c[305][305];
int dp[305][305];
signed main() {
	cin>>H>>W;
	rep(i,H)rep(j,W)cin>>c[i][j];
	int ans=0;
	REP(i,W){
		int sum[305][305];
		memset(sum,0,sizeof(sum));
		rep(j,H)rep(k,H){
			sum[j+1][k+1]+=sum[j][k];
			if(c[j][i-1]==c[k][i])sum[j+1][k+1]++;
		}
		rep(j,H+1)rep(k,H+1)dp[j][k]=inf;
		dp[H][H]=0;
		for(int j=H;j>=0;j--){
			for(int k=H;k>=0;k--){
				if(dp[j][k]==inf)continue;
				if(j)chmin(dp[j-1][k],dp[j][k]+sum[j][k]);
				if(k)chmin(dp[j][k-1],dp[j][k]+sum[j][k]);
			}
		}
		ans+=dp[0][0];
	}
	cout<<ans<<endl;
}


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

const int INF = 1000000000;

int main()
{
	while(true){
		int n, m;	//線路の情報の数n, 駅の数m
		cin >> n >> m;

		if(n==0 && m==0)
			break;

		int C[100][100];	//costのグラフ
		int T[100][100];	//timeのグラフ
		for(int i=0; i<m; i++){
			for(int j=0; j<m; j++){
				if(i==j){
					C[i][j] = T[i][j] = 0;		//対角線は0
				}
				else{
					C[i][j] = T[i][j] = INF;    
				}
			}
		}

		for(int i=0; i<n; i++){
			int a, b, c, t;		//線路の情報a,bとcost,time
			cin >> a >> b >> c >> t;

			C[a-1][b-1] = C[b-1][a-1] = c;
			T[a-1][b-1] = T[b-1][a-1] = t;
		}

		for(int i=0;i<m;i++){
			for(int j=0;j<m;j++){
				for(int k=0;k<m;k++){
					if(C[j][k]>C[j][i]+C[i][k])
						C[j][k] = C[j][i]+C[i][k];
					if(T[j][k]>T[j][i]+T[i][k])
						T[j][k] = T[j][i]+T[i][k];
				}
			}
		}

		int k;	//問い合わせの数
		cin >> k;
		for(int i=0;i<k;i++){
			int p, q, r;	//出発駅p, 到着駅q, 値の種類r
			cin >> p >> q >> r;
			if(r)	//r==1なら最短時間
				cout << T[p-1][q-1] << endl;
			else
				cout << C[p-1][q-1] << endl;
		}	
	}

	return 0;
}


Measured memory_bytes: 3084
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstdlib>
#include<utility>

typedef long long ll;
#define INF 10e9

using namespace std;

ll dp[200005];

int main() {
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < s.size(); i++) {
	    if (s[i] == '2') ans++;
	}
	cout << ans << 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 ) * } };
}
#[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 , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

fn main() {
    input! {
        n: usize,
        a: [u64; n]
    }

    let mut hmap = std::collections::HashMap::new();
    for i in 0..n {
        if a[i]>=1 {*hmap.entry(a[i]-1).or_insert(0u64) += 1}
        *hmap.entry(a[i]).or_insert(0u64) += 1;
        *hmap.entry(a[i]+1).or_insert(0u64) += 1;
    }
    let mut max = 0u64;
    for &v in hmap.values() {
        max = std::cmp::max(max, v);
    }
    println!("{}", max);
}


Measured memory_bytes: 12540
#include <iostream>
#include <cstdio>
using namespace std;
int a[105];
int main()
{
	int n,d,x;
	cin>>n>>d>>x;
	for(int i=1;i<=n;i++)
	  cin>>a[i];
	for(int i=1;i<=n;i++)
	  {
	  	int m=1,t=0;
	  	do
	  	{
	  		x++;
	  		t=(a[i]*m+1);
	  		m++;
	  	}while(t<=d);
	  }
	  cout<<x;
}


Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <string>
 
#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 1000000007
#define PI acos(-1.0)
 
using namespace std;
 
typedef pair <int, int> pii;
typedef long long ll;
typedef vector <ll> vll;

string a, b;
int lt[2000], rt[2000];
pii arr[2000];
int n;

int main() {
	cin >> a >> b;
	n = a.length();
	if (a == b) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = 0; i < n; i++) {
		if (b[i] == '1')
			break;
		if (i == n - 1) {
			cout << -1 << endl;
			return 0;
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (b[(i + j) % n] == '1') {
				rt[i] = j;
				break;
			}
		}
		for (int j = 0; j < n; j++)
			if (b[(n + i - j) % n] == '1') {
				lt[i] = j;
				break;
			}
	}
	int ans = n * 2;
	for (int i = 0; i < n; i++) {
		int cur = 0;
		int l = 0, r = 0;
		for (int j = 0; j < n; j++) {
			if (a[(j + i) % n] != b[j]) {
				cur++;
				arr[j] = make_pair(max(lt[(j + i) % n] - i, 0), rt[(j + i) % n]);
			} else {
				arr[j] = make_pair(0, 0);
			}
		}
		ans = min(ans, cur + n + i);
		sort(arr, arr + n);
		priority_queue <int> pq;
		pq.push(0);
		int index = 0;
		reverse(arr, arr + n);
		for (int j = n - 1; j >= 0; j--) {
			while (index < n && arr[index].first > j) {
				pq.push(arr[index].second);
				index++;
			}
			ans = min(ans, cur + i + 2 * j + 2 * pq.top());
		}
		for (int j = 0; j < n; j++) {
			if (a[(j + i) % n] != b[j]) {
				arr[j] = make_pair(max(rt[(j + i) % n] - ((n - i) % n), 0), lt[(j + i) % n]);
			} else arr[j] = make_pair(0, 0);
		}
		sort(arr, arr + n);
		pq = priority_queue <int>();
		pq.push(0);
		index = 0;
		reverse(arr, arr + n);
		for (int j = n - 1; j >= 0; j--) {
			while (index < n && arr[index].first > j) {
				pq.push(arr[index].second);
				index++;
			}
			ans = min(ans, cur + n - i + 2 * j + 2 * pq.top());
		}
	}
	cout << ans << endl;
	return 0;
}

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

const int m=500000;
int prime[m];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    for(int i=0; i<m; i++) prime[i]=1;
    for(int i=3; i<1000; i+=2) {
        if(!prime[i>>1]) continue;
        for(int j=(i*i)/2; j<m; j+=i) prime[j]=0;
    }
    for(int i=1; i<m; i++) prime[i]+=prime[i-1];
    int n;
    while(cin>>n) {
        if(n<2) cout<<"0\n";
        else cout<<prime[(n-1)/2]<<'\n';
    }
    return 0;
}



Measured memory_bytes: 5084
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int k = scan.nextInt();
	if(k % 2 != 0){
	    System.out.println((k/2)*(k/2+1));
	}else{
	    System.out.println((int)Math.pow(k/2,2));
	}
    }
}
			       


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define DOF 0x7f7f7f7f
#define mem(a,b) memset(a,b,sizeof(a))
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int ma=1e9;
int main()
{IO;
    ll n,k,s;scanf("%lld%lld%lld",&n,&k,&s);
    for(ll i=0;i<k;++i) printf("%lld ",s);
    if(s==ma){
        for(int i=0;i<n-k;++i) printf("%lld ",s-1);
    }
    else{
        for(int i=0;i<n-k;++i) printf("%lld ",s+1);
    }
    return 0;
}


Measured memory_bytes: 1280
import java.lang.Math;
import java.util.Scanner;
class Main {
	private static Scanner sc;
	
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		String s = sc.next();
		double r = Double.parseDouble(s);
		System.out.println(String.format("%f %f", r * r * Math.PI, 2 * r * Math.PI));
    }
}

Measured memory_bytes: 26384
import sys

sys.setrecursionlimit(10 ** 7)
# import bisect
# import numpy as np
# from collections import deque
from collections import deque
# map(int, sys.stdin.read().split())
import itertools
import heapq


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    mod = 10 ** 9 + 7
    A.sort()
    A = deque(A)
    #    print(A)
    A_minus = deque([s for s in A if s < 0])
    A_plus = deque([s for s in A if s >= 0])

    #    print(A_plus)
    #    print(A_minus)
    AA = []
    if N == K:
        ans = 1
        for l in range(N):
            ans *= A[l] 
            ans %=mod
        print(ans % mod)

    elif K % 2 == 0:
        while len(A_minus) >= 2:
            a1 = A_minus.popleft()
            a2 = A_minus.popleft()
            AA.append(-a1 * a2)

        while len(A_plus) >= 2:
            a1 = A_plus.pop()
            a2 = A_plus.pop()
            AA.append(-a1 * a2)
        ans = 1
        heapq.heapify(AA)
        for i in range(K // 2):
            ans *= (-1 * heapq.heappop(AA)) % mod
            ans %= mod
        print(ans % mod)

    elif len(A_plus) == 0:
        ans = 1
        for i in range(K):
            ans *= A_minus.pop() % mod
            ans %= mod
        print(ans % mod)

    else:
        ans = A_plus.pop()
        while len(A_minus) >= 2:
            a1 = A_minus.popleft()
            a2 = A_minus.popleft()
            AA.append(-a1 * a2)

        while len(A_plus) >= 2:
            a1 = A_plus.pop()
            a2 = A_plus.pop()
            AA.append(-a1 * a2)

        heapq.heapify(AA)
        for i in range(K // 2):
            ans *= (-1 * heapq.heappop(AA)) 
            ans %= mod
        print(ans % mod)


if __name__ == "__main__":
    main()


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


int main() {
	int r, g, b,n;
	cin >> r >> g >> b;
	n = g * 10 + b;
	if (n % 4 == 0) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}

	return 0;
}

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

using namespace std;

typedef long long ll;
int main()
{
    int n;
    scanf("%d", &n);
    
    ll inp[n][n];
    ll g[n][n];
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++) {
            scanf("%lld", &inp[i][j]);
            g[i][j] = inp[i][j];
        }
    
    bool canDelete[n][n];
    memset(canDelete, false, sizeof(canDelete));
    for(int k = 0; k < n; k++)
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++) {
                if(i != k && k != j && g[i][k] + g[k][j] == inp[i][j]) {
                    // printf("%lld %lld %lld\n", g[i][k], g[k][j], inp[i][j]);
                    // printf("%d %d %d\n", i, k, j);
                    canDelete[i][j] = true;
                }
                g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
            }

    ll ans = 0;
    for(int i = 0; i < n && ans != -1; i++)
        for(int j = i + 1; j < n && ans != -1; j++) {
            if(i == j)
                continue;

            if(g[i][j] != inp[i][j]) {
                ans = -1;
                break;
            }

            if(canDelete[i][j] == false)
                ans += g[i][j];
        }

    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 1792
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const S = args[0][0]
	const W = 'CODEFESTIVAL2016'
	let cnt = 0

	for (let i = 0; i < 16; i++) {
		if (S[i] !== W[i]) cnt++
	}

	console.log(cnt)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

using ll = long long;
#define int long long
using P = pair<int, int>;

#define LOG(variable) cerr << #variable":\t" << (variable) << "\n"
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cerr << (i) << ":\t" << (container)[(i)] << "\n"
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
template<typename T = int>
T in() {T a; cin >> a; return a;}
/***** MAIN *****/
signed main() {
  string s, t; cin >> s >> t;
  int ans = t.size();
  for(int i = 0; i <= s.size() - t.size(); ++i) {
    int counter = 0;
    for(int j = 0; j < t.size(); ++j) {
      if(s[i+j] != t[j]) ++counter;
    }
    ans = min(ans, counter);
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n;
    long long ans = 0;
    bool flg = true;
    cin >> n;
    vector<int> a(3*n);
    for(int i = 0;i < 3*n;i++) cin >> a[i];
    sort(a.begin(),a.end());
    for(int i = n;i < 3*n;i++){
        if(flg){
            ans += a[i];
            flg = false;
        }else flg = true;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  string n;
  cin>>n;
  char x=n[n.size()-1];
  if(x=='2'||x=='4'||x=='5'||x=='7'||x=='9'){
    cout<<"hon"<<endl;
  }
  else if(x=='0'||x=='1'||x=='6'||x=='8'){
    cout<<"pon"<<endl;
  }
  else{
    cout<<"bon"<<endl;
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define el '\n'
typedef long long ll;
const int MAXN = 4e3+2;
int N, psa[4][MAXN];
ll ans;
string S;
map<char, int>m;
int get(int cur, int cur2){
	if((cur==1&&cur2==2)||(cur==2&&cur2==1))return 3;
	else if((cur==2&&cur2==3)||(cur==3&&cur2==2))return 1;
	return 2;
}
int main() {
	cin >> N >> S;
	m['R']=1; m['G'] = 2; m['B'] = 3;
	for(int i = 1;i<=N;i++){
		psa[1][i]+=psa[1][i-1];
		psa[2][i]+=psa[2][i-1];
		psa[3][i]+=psa[3][i-1];
		psa[m[S[i-1]]][i]++;
	}
	for(int i = 1;i<=N;i++){
		int cur = m[S[i-1]];
		for(int j = i+1;j<=N;j++){
			int cur2 = m[S[j-1]], diff = j-i;
			if(cur==cur2)continue;
			int cur3 = get(cur, cur2), k = diff+j;
			if(k<=N&&m[S[k-1]]==cur3){
				ans-=1;
			}
			ans+=(psa[cur3][N]-psa[cur3][j]);
		}
	}
	cout << ans << el;
	return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
typedef int integer;
#define int long long
#define pb push_back
#define mp make_pair
#define sz(x) (int) x.size()
#define mod 1000000007
using namespace std;


int ar[100000];

integer main() {
    ios_base::sync_with_stdio(false);

    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 0; i < k; i++){
        cin >> ar[i];
    }
    int arr[n][m];
    int z = 0;
    for (int i = 0; i < n; i++){
        if (i % 2 == 0){
            for (int j = 0; j < m; j++){
                arr[i][j] = z+1;
                ar[z]--;
                if (!ar[z]) z++;
            }
        }
        else {
            for (int j = m-1; j >= 0; j--){
                arr[i][j] = z+1;
                ar[z]--;
                if (!ar[z]) z++;
            }
        }
    }
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            cout << arr[i][j] << ' ';
        }
        cout << endl;
    }
}

Measured memory_bytes: 512
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long INF = 1L << 59;

void main() {
    auto s = readln.split.map!(to!int);
    auto D = s[0];
    auto G = s[1].to!long;
    auto PC = D.iota.map!(_ => readln.split.map!(to!long).array).array;
    int ans = 1 << 29;

    foreach (mask; 0..(1<<D)) {
        long tmp = 0;
        int cnt = 0;
        foreach (i; 0..D) {
            if (mask & (1 << i)) {
                tmp += PC[i][0] * (i + 1) * 100 + PC[i][1];
                cnt += PC[i][0];
            }
        }
        for (int i = D-1; i >= 0 && tmp < G; --i) {
            if (mask & (1 << i)) continue;
            long hoge = (G - tmp - 1) / ((i + 1) * 100) + 1;
            hoge = min(hoge, PC[i][0]);
            tmp += hoge * (i + 1) * 100;
            cnt += hoge;
        }
        if (tmp >= G) ans = min(ans, cnt);
    }

    ans.writeln;
}


Measured memory_bytes: 256
N = int(input())
a = input().split()
a = [int(i) for i in a]
res_list = {}
def gcd(a,b):
    while b:
        a, b = b, a % b
    return a
def lcm(x,y):
    return (x * y) // gcd(x, y)
for i in range(len(a)):
    if i == 0:
        res = a[i]
        continue
    else:
        res = lcm(res,a[i])
res2 = 0
for i in a:
    res2 += (res-1) % i
print(res2)


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

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long
#define For(i,a,b) for (int i=a;i<=b;i++)
#define Forx(i,a,b) for(int i=a;i<=b;i+=2)
#define Rep(i,a,b) for (int i=b;i>=a;i--)
using namespace std;
inline int read(){
	int k=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}
	return k*f;
}
int n,m;
char s1[510][510],s2[510][510],s[510];
int main()
{
	n=read();m=read();
	For(i,1,n)For(j,1,m)s1[i][j]=s2[i][j]='.';
	For(i,1,n)s1[i][1]='#',s2[i][m]='#';
	Forx(i,1,n)For(j,2,m-1)s1[i][j]='#';
	Forx(i,2,n)For(j,2,m-1)s2[i][j]='#';
	For(i,1,n)
	{
		scanf("%s",s+1);
		For(j,1,m)if(s[j]=='#')s1[i][j]='#',s2[i][j]='#';
	}
	For(i,1,n)
	{
		For(j,1,m)putchar(s1[i][j]);
		puts("");
	}
	puts("");
	For(i,1,n)
	{
		For(j,1,m)putchar(s2[i][j]);
		puts("");
	}
	return 0;
}

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

long long greedy(int a, int b, long long v, long long acc = 0) {
    if (v == 0) return acc;
    if (v / b) {
        return greedy(a, b, v % b, acc + v / b);
    } else if (v / a) {
        return greedy(a, b, v % a, acc + v / a);
    } else {
        return acc + v;
    }
}

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

    int a, b;
    cin >> a >> b;
    if (b % a == 0) {
        cout << -1 << endl;
        return 0;
    }

    for (int i = 1; i < 10000000; i++) {
        long long v = 1ll * a * i;
        if (i < greedy(a, b, v)) {
            cout << v << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}


Measured memory_bytes: 3196
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define FFOR(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define rep(i,n) FOR(i,0,n-1)
#define int long long
#define MOD 998244353
#define MAXN  100005
#define P pair<int,int>


signed main(){
	
	int a,b,c;cin>>a>>b>>c;
	
	rep(i,100000000)
	{
		if(a%2 or b%2 or c%2)
		{
			cout << i << endl;
			return 0;
		}
		
		int ta=(b+c)/2;
		int tb=(a+c)/2;
		int tc=(a+b)/2;
		a=ta, b=tb,c=tc;
	}
	
	cout << -1 << endl;

}

Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
x=int(input())
cnt=0
for i in range (a+1):
    for j in range (b+1):
        for k in range (c+1):
            if 500*i+100*j+50*k==x:
                cnt+=1

print(cnt)

Measured memory_bytes: 8972