akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b; cin >> a >> b;
	int ans = 0;
	int re = 0;
	ans = max(a, b);
	re = min(a, b);		
	ans += max(ans - 1, re);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int m,f,r;
	char p,x;
	
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1 && f==-1 && r==-1)break;
		while(1){
			
			if(m==-1 || f==-1){
				p='F';
				break;
			}
			
			if(m==-1)m=0;
			if(f==-1)f=0;
			x=m+f;
			
			if(x>=30 && x<50){
				if(r<50){
					p='D';
				}
				else if(r>=50){
					p='C';
				}
				break;
			}
			
			if(x>=50 && x<65){
				p='C';
				break;
			}
			else if(x>=65 && x<80){
				p='B';
				break;
			}
			else if(x>=80){
				p='A';
				break;
			}
			if(x<30){
				p='F';
				break;
			}
		}
		printf("%c\n",p);
	}
	return 0;
}

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

using namespace std;

#define llong long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.rbegin(); itr != x.rend(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int MOD = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = 1LL << 31;
const static int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

template<typename T> T my_gcd(T a, T b) {
    return (a ? my_gcd(b % a, a) : b);
}

template<typename T> T my_lcm(T a, T b){
	return a * b / my_gcd(a, b);	
}

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, l;
    cin >> n >> l;
    vector<int> P;
    int sum = 0;
    rep(i, n) {
        P.push_back(l + i);
        sum+=P[i];
    }
    int res = inf, ans;
    rep(i, n) {
        if (abs(sum - (sum - P[i])) < res) {
            res = abs(sum - (sum - P[i]));
            ans = sum - P[i];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import math
Q=int(input())
querys = [list(map(int,input().split())) for x in range(Q)]
large = max(q[1] for q in querys)
like2017 = [0]*(large+1)

#siever
cands = [False if (5 < i and (i%2)*(i%3)*(i%5) == 0) or (i < 2) or (i == 4) else True for i in range(large+1)]
if 5 <= large:
  for i in range(6,int(math.sqrt(large)+1)):
    if cands[i]:
      for j in range(i*i,large+1,i):
        if cands[j]:
          cands[j] = False

#find 2017-like-number          
for x in range(large+1):
  if cands[x] and cands[(x+1)//2]:
    like2017[x] = 1
for y in range(1,large+1):
  like2017[y] += like2017[y-1]

for q in querys:
  print(like2017[q[1]]-like2017[q[0]-1])

Measured memory_bytes: 32032
#!/usr/bin/env python3

def II(): return int(input())
def MII(): return map(int, input().split())
def LII(): return list(map(int, input().split()))

def main():
    N = II()

    xl = []
    for _ in range(N):
        X, L = MII()
        xl.append((X, L))
    
    xl = sorted(xl, key=lambda x: x[0])

    ans = 1
    r = xl[0][0] + xl[0][1]
    for x, l in xl[1:]:
        if r <= x - l:
            r = x + l
            ans += 1
        elif x + l <= r:
            r = x + l
       
    print(ans)


if __name__ == '__main__':
    main()


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

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


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

int main() {
    int n; scanf("%d", &n);
    vector<int> h(n), p(n), ord(n);
    for (int i = 0; i < n; ++i) {
        scanf("%d%d", &h[i], &p[i]);
        assert(h[i] <= 1'000'000'000);
        assert(p[i] <= 1'000'000'000);
    }
    iota(ord.begin(), ord.end(), 0);
    sort(ord.begin(), ord.end(), [&](int i, int j) { 
        if (h[i] + p[i] != h[j] + p[j]) return h[i] + p[i] < h[j] + p[j];
        return h[i] < h[j];
    });
    
    constexpr int64_t kInf = 1'000'000'000'000'000;
    vector<int64_t> dp(n + 1, kInf);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        vector<int64_t> nxt(n + 1, kInf);
        for (int j = 0; j <= n; ++j) {
            if (dp[j] == kInf) continue;
            if (dp[j] <= h[ord[i]]) nxt[j + 1] = min(nxt[j + 1], dp[j] + p[ord[i]]);
            nxt[j] = min(nxt[j], dp[j]);
        }
        dp = nxt;
    }
    for (int i = n; i >= 0; --i) {
        if (dp[i] < kInf) {
            printf("%d\n", i);
            return 0;
        }
    }
}


Measured memory_bytes: 512
n, m, c = list(map(int, input().split()))
Bs = list(map(int, input().split()))
As = [list(map(int, input().split())) for i in range(n)]

counter = 0
for i in range(n):
    x = 0
    for j in range(m):
        x += As[i][j] * Bs[j]
    x += c
    if x > 0:
        counter += 1
print(counter)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner stdIn = new Scanner(System.in);

		int summerVacationCnt = stdIn.nextInt();
		int homeworkCnt = stdIn.nextInt();

		int resultCnt = summerVacationCnt;

		for (int i = 0; i < homeworkCnt; i++) {
			resultCnt -= stdIn.nextInt();
		}

		stdIn.close();

		System.out.println(resultCnt >= 0 ? resultCnt : -1);
	}

}


Measured memory_bytes: 45980
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    int n;
    ll *a;
    cin >> n;
    a = new ll[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }

    ll ans = 1;
    for (int i = 0; i < n; i++) {
        if (a[i] > 1000000000000000000 / ans) {
            cout << -1 << endl;
            return 0;
        }
        ans *= a[i];
    }

    if (ans > 1000000000000000000)
        cout << -1 << endl;
    else
        cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4420
#include<stdio.h>
int main(void)
{
	int x, y, i;
	i=0;
	while(1)
	{
		scanf("%d %d", &x, &y);
		if(x==0&&y==0)
		{
		break;
		}
		else if(i==3000)
		{
		break;
		}
		i++;
		
		if(y<x)
		{
			printf("%d %d\n", y, x);
		}
		else
		{
			printf("%d %d\n", x, y);
		}
	}
	return 0;
}


Measured memory_bytes: 2612
from math import *

N=int(input())
tonaris = [[] for i in range(N)]
for _ in range(1,N):
    u,v,w = tuple(map(int,input().split()))
    u -= 1
    v -= 1
    w = w%2
    tonaris[u].append((v,w))
    tonaris[v].append((u,w))


colors = [None for i in range(N)]

q = [0]
colors[0]=0
while len(q)!=0:
    u = q.pop()
    for v,w in tonaris[u]:
        tonaris[v].remove((u,w))
        colors[v] = colors[u] ^ w
        q.append(v)

for color in colors:
    print(color)

Measured memory_bytes: 35756
def getter(starts, ends):
    while starts:
        if starts[-1][0] < ends[-1][1]:
            yield (starts.pop(), True)
        else:
            yield (ends.pop(), False)


def foo(C, targets):
    starts = sorted(targets, key=lambda x:x[0], reverse=True)
    ends = sorted(targets, key=lambda x: x[1], reverse=True)

    result = 0
    active = [0]*(C+1)
    for x, p in getter(starts, ends):
        if p:
            active[x[2]] += 1
        else:
            active[x[2]] -= 1
        result = max(result, sum(map(lambda x: 1 if x > 0 else 0 ,active)))
    return result


if __name__ == "__main__":
    n, C  = map(int, input().split())

    targets = []
    for i in range(n):
        s, t, c = list(map(int, input().split()))
        targets.append((s-1, t, c))
    print(foo(C, targets))



Measured memory_bytes: 20468
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
total = sum(b)
last_dish = a[0]
for d in a[1:]:
  if d-last_dish == 1:
    total += c[last_dish-1]
  last_dish = d
print(total)

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>












int n;
string res;


void solve()
{
	cin >> n;
	n %= 10;
	if(n == 3)
	{
		res = "bon";
	}
	else if(n == 0 || n == 1 || n == 6 || n == 8)
	{
		res = "pon";
	}
	else
	{
		res = "hon";
	}
	cout << res << "\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define re return
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii; 
int n;
string s;
vector<int>nw;
ll ans;
int main() { 
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>s;
	int n=s.size();
	for(int i=0;i<n;i++){
		if(s[i]=='A')nw.push_back(1);
		else if(i+1<n &&s[i]=='B' && s[i+1]=='C')nw.push_back(2),i++;
		else {
			int cnt=0;
			for(int j=0;j<nw.size();j++){
				if(nw[j]==2){
					ans+=j-cnt;
					cnt++;
				}
			}
			nw.clear();
		}
	}
	int cnt=0;
	for(int j=0;j<nw.size();j++){
		if(nw[j]==2){
			ans+=j-cnt;
			cnt++;
		}
	}
	cout<<ans<<endl;
    return 0; 
}

Measured memory_bytes: 1532
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int n;
vector<int> G[1010];
int x[1010];
bool ans = true;

int dfs(int now){
    if(G[now].size() == 0) return 0;
    vector<P> d; 
    int sum = 0;
    rep(i, 0, G[now].size()){
        int next = G[now][i];
        int tmp = dfs(next);
        sum += tmp + x[next];
        d.push_back(P(tmp, x[next]));
    }
    vector<int> f(5010, -1);
    f[0] = 0;
    rep(i, 0, G[now].size()){
        int next = G[now][i];
        vector<int> g(5010, -1); 
        rep(j, 0, x[now] + 1){
            if(f[j] != -1){
                if(j + d[i].first <= x[now]) g[j + d[i].first] = f[j] + d[i].second;
                if(j + d[i].second <= x[now]) g[j + d[i].second] = f[j] + d[i].first;
            }
        }
        swap(f, g);
    }
    int res = -1;
    repb(i, x[now], 0) if(f[i] != -1){res = f[i]; break;}
    if(res == -1){ans = false; return 0;}
    return res;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    rep(i, 1, n){
        int p; cin >> p; p--;
        G[p].push_back(i);
    }
    rep(i, 0, n){
        cin >> x[i];
    }
    dfs(0);
    if(ans) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 384
// Problem : E - This Message Will Self-Destruct in 5s
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Muallif: Azimjon Mehmonali o'g'li

#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define sqr(x) (x) * (x)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define ALL(a) a.begin(), a.end()
#define rALL(a) a.rbegin(), a.rend()
#define SORT(a) sort(ALL(a))
#define sc scanf
#define pr printf
#define xatop(a) cerr << #a << " = " << a << endl;
#define jsatr xatop(__LINE__)
#define INF 1000000000
#define mod 1000000007

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

	vi a(n + 1);
	for (int i = 1; i <= n; i++)
		sc("%d", &a[i]);

	map<int, int> dp1, dp2;

	for (int i = 1; i <= n; i++) {
		dp1[a[i] + i]++;
		dp2[i - a[i]]++;
	}

	ll jv = 0;
	for (auto it = dp1.begin(); it != dp1.end(); it++) {
		jv += 1ll * it->S * dp2[it->F];
	}

	cout << jv << endl;

	return 0;
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    string S; cin >> S;
    S.replace(S.begin(), S.begin()+4, "2018");
    cout << S << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define aio()                         \
    do {                              \
        std::ios::sync_with_stdio(0); \
        std::cin.tie(0);              \
    } while (0)
using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
    aio();

    long n;
    cin >> n;
    string s;
    cin >> s;

    long cnt = 0;
    for (long i = 0, j = n - 1; i < j;) {
        if (s[i] == 'R') {
            i++;
            continue;
        }
        if (s[j] == 'W') {
            j--;
            continue;
        }
        cnt++, i++, j--;
    }

    cout << cnt;
}


Measured memory_bytes: 3776
// fn search_recursive(i: u32, target: i32, arr: &mut Vec<i32>, a: &Vec<i32>) -> bool {
//     let sum = arr.iter()
//         .zip(a.iter())
// //        .cloned()
//         .filter(|&(&u, &_)| u == 1)
//         .map(|(&_u, &a)| a)
//         .fold(0, |s, n| s + n);

//     if sum == target {
//         return true;
//     } else if sum > target {
//         return false;
//     }

//     if i >= arr.len() as u32 {
//         return false;
//     }

//     let res1 = search_recursive(i + 1, target, arr, &a);
//     arr[i as usize] = 1;

//     let res2 = search_recursive(i + 1, target, arr, &a);
//     arr[i as usize] = 0;

//     res1 || res2
// }

// fn search(target: i32, arr: &Vec<i32>) -> () {
//     let mut v: Vec<i32> = vec![0; arr.len()];
//     if search_recursive(0, target, &mut v, arr) {
//         println!("yes");
//     } else {
//         println!("no");
//     }
// }

fn search_recursive(arr: &Vec<i32>, target: i32, i: usize) -> bool {
    if target == 0 {
        return true;
    }
    if i == arr.len() {
        return false;
    }
    search_recursive(arr, target, i + 1) || search_recursive(arr, target - arr[i], i + 1)
}

fn search(target: i32, arr: &Vec<i32>) -> () {
    if search_recursive(arr, target, 0) {
        println!("yes");
    } else {
        println!("no");
    }
}

fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();

    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();
    let mut inputs_a: Vec<i32> = line.split_whitespace()
        .map(|e| e.parse::<i32>().ok().unwrap())
        .collect();

    inputs_a.sort();
    inputs_a.reverse();

    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();

    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();
    let inputs_t: Vec<i32> = line.split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect();

    // println!("{:?}", inputs_a);
    // println!("{:?}", inputs_t);

    for t in inputs_t {
        search(t, &inputs_a);
    }
}


Measured memory_bytes: 5020
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;
	public static final long HUGE_NUM = 99999999999999999L;
	public static final double EPS = 0.000000001;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
				int num_query = Integer.parseInt(br.readLine());

				ArrayList<String> list = new ArrayList<String>();
				StringBuilder ans = new StringBuilder();

				for(int loop = 0; loop < num_query; loop++){

					String input_str[] = br.readLine().split("\\s+");

					switch(input_str[0]){
					case "0":

						list.add(input_str[1]);
						break;

					case "1":

						ans.append(list.get(Integer.parseInt(input_str[1]))).append("\n");
						break;

					case "2":
						list.remove(list.size()-1);
						break;
					}
				}

				System.out.print(ans.toString());

			} catch (NumberFormatException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			} catch (IOException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
		}
}

class UTIL{

	//文字が半角数字か判定する関数
	public static boolean isNumber(String tmp_str){

		if(tmp_str == null || tmp_str.length() == 0){

			return false;
		}

		Pattern pattern = Pattern.compile("\\A[0-9]+\\z");
		Matcher matcher = pattern.matcher(tmp_str);
		return matcher.matches();
	}
}


Measured memory_bytes: 113248
def cmb(n, r, mod):
    c=1
    for i in range(1, r+1):
        c = (c * (n-i+1) * pow(i, mod-2, mod)) % mod
    return c

n, a, b = map(int, input().split())
MOD = 10**9 + 7
print((pow(2, n, MOD) - cmb(n, a, MOD) - cmb(n, b, MOD) - 1) % MOD)

Measured memory_bytes: 3064
def main():
    S = input()
    ans = 0
    for n in range(2**(len(S)-1)):
        fig = S[0]
        index = 1
        for _ in range(len(S)-1):
            if n % 2:
                fig += "+"+S[index]
            else:
                fig += S[index]
            n >>= 1
            index += 1
        ans += eval(fig)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

bool foo(vector<string> A, vector<string> B, long i, long j) {
  if (i + B.size() > A.size()) return false;
  if (j + B[0].size() > A[0].size()) return false;

  rep (x, B.size()) rep (y, B[0].size()) {
    if (B[x][y] != A[x+i][y+j]) return false;
  }

  return true;
}


void solve() {
  long N, M;
  cin >> N >> M;
  vector<string> A(N);
  rep (i, N) cin >> A[i];
  vector<string> B(M);
  rep (i, M) cin >> B[i];

  rep (i, 100) rep (j, 100) {
    if (foo(A, B, i, j)) {
      cout << "Yes" << endl;
      return;
    }
  }

  cout << "No" << endl;
}

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


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int R = scan.nextInt();

		int re = 0;

		if(N >= 10) {
			re = R;
		}else {
			re = R + 100*(10-N);
		}
		System.out.println(re);
		scan.close();

	}

}


Measured memory_bytes: 21972
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

std::string convert(int64_t i) {
    std::ostringstream ss;
    ss << std::setw(3) << std::setfill('0') << i;
    return ss.str();
}

bool ok(std::string s1, std::string s2) {
    int64_t cur = 0;
	int64_t max = s1.size();
    for (int64_t i = 0; i < max; i++) {
        while(true) {
            if (cur == s2.size()) return false;
            if (s1[i] == s2[cur]) {
                cur++;
                break;
            }
            cur++;
        }
    }
    return true;
}

void solve()
{
    int64_t N;
	std::cin >> N;
	std::string S;
	std::cin >> S;

	int64_t ans = 0;
	for (int64_t i = 0; i <= 999; i++) {
        if (ok(convert(i), S)) {
            ans++;
	    }
	}
	std::cout << ans << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	solve();
}


Measured memory_bytes: 512
//abc137

#include "iostream"
#include <string>
//#include <deque>
#include <algorithm>
#include <map>
using namespace std;

long long CalValue(int val)
{
	long long ret = 1;
	if (val < 2)
		return 0;
	for (int i = val; i > val - 2; i--)
	{
		ret *= i;
	}
	return ret / 2;
}

int main(void)
{
	int N;
	int i;
	string s;
	int count = 0;
	long long maxCount = 0;
	map <string,int> Map;
	map<string, int  >::iterator iter;
	cin >> N;

	for (i = 0; i < N; i++)
	{
		cin >> s;
		sort(s.begin(),s.end());

		if (Map.count(s) == 1)
		{
			iter = Map.find(s);
			(*iter).second++;
		}
		else
		{
			Map.insert(make_pair(s, 1));
		}

//		Map[s]++;
		maxCount += (Map[s] - 1);
	}

	//map<string,int  >::iterator iter;

	//for (iter = Map.begin(); iter != Map.end(); iter++)
	//{
	//	maxCount += CalValue((*iter).second);
	//}

	//for (i = 0; i < N; i++)
	//{
	//	cout << psArray[i]<<endl;
	//}

	cout << maxCount;
	return 0;
}


Measured memory_bytes: 11136
import heapq

n = int(input())
v = list(map(int, input().split()))
heapq.heapify(v)
while len(v) > 1:
  x = heapq.heappop(v)
  y = heapq.heappop(v)
  heapq.heappush(v, (x + y) / 2.0)

res = heapq.heappop(v)
print("{:.6f}\n".format(res))

Measured memory_bytes: 3060
n, m = map(int, input().split())

if n == 1 and m == 1:
    res = 1
elif n == 1 or m == 1:
    res = max(n, m) - 2
elif n == 2 or m == 2:
    res = 0
else:
    res = n * m - (n * 2 + (m-2) * 2)

print(res)


Measured memory_bytes: 2940
n=int(input())
s=input()
cnt=0
ans=[]
for i in range(n):
	a=s[:i]
	b=s[i:]
	l=[]
	cnt=0
	for j in range(len(a)):
		if b.count(a[j])>=1\
		and a[j] not in l:
			cnt+=1
			l.append(a[j])
	ans.append(cnt)
print(max(ans))



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  char A;
  cin >> A;

  if (isupper(A)) {
    COUT("A");
  } else {
    COUT("a");
  }

  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;

int main() {
  string S;
  cin >> S;
  int ans   = 0;
  int count = 0;
  for (int i = 0; i < S.size(); i++) {
	  if (S[i] == 'A' || S[i] == 'T' || S[i] == 'G' || S[i] == 'C') {
		  count++;
		  ans = max(count, ans);
		  continue;
		}
	  count = 0;
	}
  cout << ans << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int N;
ll a[310][310];
bool x[310][310];
int main(){
  cin >> N;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      cin >> a[i][j];
      x[i][j] = true;
    }
  }

  ll res = 0;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(i == j)  continue;
      for(int k = 0; k < N; k++){
        if(i == k || j == k)  continue;
        if(a[i][k] + a[j][k] < a[i][j]){
          res = -1;
        }
        else if(a[i][k] + a[j][k] == a[i][j]){
          x[i][j] = false;
        }
      }
    }
  }

  if(res == -1) cout << -1 << endl;
  else{
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        if(x[i][j]) res += a[i][j];
      }
    }
    cout << res / 2 << endl;
  }


  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
 
int main(void)
{
int n,x,i,j,l,k;
while(1){
k=0;
scanf("%d %d",&n,&x);
if(n==0&&x==0){
  break;
}
  for(i=1;i<=n-2;i++){
  for(j=i+1;j<=n-1;j++){
  for(l=j+1;l<=n;l++){
   if(i+j+l==x){
          k=k+1;
         }
        }
      }
  }
printf("%d\n",k);
}
return 0;
}
   


Measured memory_bytes: 2120
def main():
    s = input()
    s1 = s[0:int((len(s)-1)/2)]
    s2 = s[int((len(s)+3)/2)-1:len(s)]
    print('Yes') if s == s[::-1] and s1 == s1[::-1] and s2 == s2[::-1] else print('No')


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
 
//scanf("%d",&x);
//printf("%d",x);
//for(i=0;i<N;i++){  }
//if( == ){  }else{  }
//while( ){  }
 
/*
int N, i;
int H[100];
scanf("%d", &N);
for (i = 0; i < N; i++) scanf("%s", &H[i]);
*/
 
int main()
{
	int a[4];
	int i;
 
	
	for (i = 0; i < 3; i++) scanf("%d", &a[i]);
 
	for (i = 0; i < 3; i++) {
		for (int j = i + 1; j < 3; j++) {
 
			if (a[i] > a[j]) {
				int tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
	}
	
	
 
	int Ans = a[2] * 10 + a[1] + a[0];
 
	printf("%d", Ans);
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

int main(){

  int W,H,x,y,r;

  cin>>W>>H>>x>>y>>r;

  if(x+r>W||y+r>H||x-r<0||y-r<0){

    cout<<"No"<<endl;
  }


 
  else{

    cout<<"Yes"<<endl;
  }


  return 0;
}

Measured memory_bytes: 3100
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<limits>
#include<list>
#include <stdio.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0;i < (n); ++i)
#pragma GCC optimize("Ofast")


int main(){
	int n, m, c;
	cin >> n >> m >> c;
	vector<int>b(m);
	rep(i, m)cin >> b[i];
	vector<vector<int>>a(n, vector<int>(m));
	rep(i, n) {
		rep(j, m)cin >> a[i][j];
	}
	int count = 0;
	vector<int>p(n,c);
	rep(i, n) {
		rep(j, m) {
			p[i] += (a[i][j] * b[j]);
			if (j == m - 1 && p[i] >0) {
				count++;
			}
		}
		
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 3616
#include<cstdio>
void shuffle (int [], int, int);

int main(){
  int n,r,p,c;
  while(1){
    scanf("%d%d",&n,&r);
    if(n==0 && r==0)
      break;
    int data[n];
    for(int i=0;i<n;i++)
      data[i]=n-i;
    for(int i=0;i<r;i++){
      scanf("%d%d",&p,&c);
      shuffle(data,p,c);
    }
    printf("%d\n",data[0]);
  }
  return 0;
  
}

void shuffle(int data[] ,  int p ,int c){
  int bd[c];
  p--;
  for(int i=0;i<c;i++)
    bd[i]=data[p+i];
  for(int i=0;i<p;i++)
    data[p+c-1-i]=data[p-1-i];
  for(int i=0;i<c;i++)
    data[i]=bd[i];
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;

ll a,b,c,d;
ll n;
map<ll,ll> mp;

ll dfs(ll k){
  //cout << k << endl;
  if (k == 0) return 0;
  if (k == 1) return d;
  if(mp.count(k)){
    return mp[k];
  }
  ll l2,r2,l3,r3,l5,r5;
  l2 = k/2*2;
  r2 = (k+1)/2*2;
  l3 = k/3*3;
  r3 = (k+2)/3*3;
  l5 = k/5*5;
  r5 = (k+4)/5*5;

  ll res = INFLONG;
  if(d < INFLONG / k){
    res = k*d;
  }
  chmin(res,dfs(l2/2) + abs(l2-k) * d + a);
  chmin(res,dfs(r2/2) + abs(r2-k) * d + a);
  chmin(res,dfs(l3/3) + abs(l3-k) * d + b);
  chmin(res,dfs(r3/3) + abs(r3-k) * d + b);
  chmin(res,dfs(l5/5) + abs(l5-k) * d + c);
  chmin(res,dfs(r5/5) + abs(r5-k) * d + c);

  mp[k] = res;
  return res;
}

int main(){
  ll t;
  cin >> t;
  rep(i,t){
    cin >> n >> a >> b >> c >> d;
    mp.clear();
    mp[1] = 0;
    cout << dfs(n) << endl;
  }
}


Measured memory_bytes: 4228
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    LL n,m;
    cin >> n >> m;
    string str;
    cin >> str;

    vector<vector<LL>> vertex(n+1);

    for(int i = 0; i < m; i++){
        LL a,b;
        cin >> a >> b;
        vertex[a].push_back(b);
        vertex[b].push_back(a);
    }

    vector<bool> ng(n+1,false);
    vector<LL> state(n+1,0);

    queue<LL> que;
    for(int i = 1; i <= n; i++){
        if(!ng[i]){
            que.push(i);
            state[i] = 1;
        }
        while(!que.empty()){
            LL t = que.front();
            que.pop();
            if(ng[t] || state[t] == 2)continue;
            state[t] = 2;
            vector<bool> check(2,false);
            vector<LL> back;
            for(int j = 0; j < vertex[t].size(); j++){
                if(!ng[vertex[t][j]]){
                    check[str[vertex[t][j] - 1] - 'A'] = true;
                    if(state[vertex[t][j] == 0]){
                        que.push(vertex[t][j]);
                        state[vertex[t][j]] = 1;
                    }else if(state[vertex[t][j]] == 2){
                        back.push_back(vertex[t][j]);
                    }
                }
            }
            if(check[0]&&check[1]){

            }else{
                ng[t] = true;
                for(int j = 0; j < back.size(); j++){
                    que.push(back[j]);
                    state[back[j]] = 1;
                }
            }
        }
    }

    bool ok = false;
    for(int i = 1; i < n+1; i++){
        ok |= (!ng[i]);
    }

    if(ok){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}

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

int main()
{
  int64_t h, w;
  cin >> h >> w;
  if (h == 1 || w == 1) {
    cout << 1 << endl;
  } else {
    cout << (h * w + 1) / 2 << endl;
  }
}


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

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}

ll a[220000];

int main() {
    int n;
    scanf("%d", &n);
    ll sm = 0;
    for (int i = 0; i < n; ++i)
        scanf("%lld", a + i), sm += a[i];
    ll nsm = 0;
    ll ans = 1e18;
    for (int i = 0; i < n - 1; ++i) {
        nsm += a[i];
        sm -= a[i];
        ans = min(ans, abs(nsm - sm));
    }
    cout << ans << "\n";
    return 0;
}




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

typedef long long ll;
typedef int64_t i64;
using namespace std;

int main()
{
	int a,b,c;
	cin >> a >>  b >> c;
	if((a == b && b != c) || (a == c && b != a) || (b==c && b != a)){
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define INF 1000000007
#define SMO -1000000007
#define P pair<int,int>
#define fi first
#define se second
using namespace std;
bool prime(int n){
	for(int i=2;i<=sqrt(n);i++){
		if(n%i==0)return false;
	}
	return n!=1;
}
int kaicnt;
int kai(int n,int x){
	kaicnt++;
	if(kaicnt==x){
		kaicnt=0;
		return n%INF;
	}
	return (kai(n-1,x)%INF*n)%INF;
}
int conbi(int n,int x){
	x=min(x,n-x+1);
	return kai(n,x)/kai(x,x);
}
int pow_mod(int n,int k,int m){
	if(k==0)return 1;
	else if(k%2==1)return pow_mod(n,k-1,m)*n%m;
	else {
		int t=pow_mod(n,k/2,m);
		return t*t%m;
	}
}
int n;
map<char,int>mp;
string s;
signed main(){
	cin>>n;
	for(int i=0;i<26;i++){
		mp[(char)('a'+i)]=INF;
	}
	for(int i=0;i<n;i++){
		cin>>s;
		map<char,int>memo;
		for(int j=0;j<26;j++){
			memo[(char)('a'+i)]=0;
		}
		for(int j=0;j<s.size();j++){
			memo[s[j]]++;
		}
		for(int j=0;j<26;j++){
			mp[(char)('a'+j)]=min(mp[(char)('a'+j)],memo[(char)('a'+j)]);
		}
	}
	for(int i=0;i<26;i++){
		if(mp[(char)('a'+i)]==INF)continue;
		for(int j=0;j<mp[(char)('a'+i)];j++)cout<<(char)('a'+i);
	}
	cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tii;
#define rep(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

int main(){
  ll A,B; cin >> A >> B;
  if(A<B) swap(A,B);
  ll y = gcd(A,B);
  ll yy = y;
  ll x = 2;
  ll ans = 1;
  while(x*x<=y&&yy!=1){
    if(yy%x==0){
      ans++;
      while(yy%x==0) yy /= x;
    }
    x++;
  }
  if(yy!=1) ans++;
  cout << ans << endl;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int A, B;
bool ans[100][100];

int main(){
  cin >> A >> B;
  fill((bool*)ans, (bool*)(ans + 50), true);
  A--; B--;

  int i = 0, j = 0;
  while (B > 0){
    ans[i][j] = false;
    j+=2;
    if (j >= 100){
      j %= 100; i+=2;
    }
    B--;
  }

  i = 99; j = 0;
  while (A > 0){
    A--;
    ans[i][j] = true;
    j+=2;
    if (j >= 100){
      j %= 100; i-=2;
    }
  }

  cout << 100 << " " << 100 << endl;
  for (int i = 0; i < 100; i++){
    for (int j = 0; j < 100; j++){
      if (ans[i][j]) cout << '.';
      else cout << '#';
    }
    cout << endl;
  }

  return 0;
}


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

using namespace std;

template< class T >
struct CumulativeSum2D
{
  vector< vector< T > > data;

  CumulativeSum2D(int W, int H) : data(W + 1, vector< int >(H + 1, 0)) {}

  void add(int x, int y, int z)
  {
    ++x, ++y;
    if(x >= data.size() || y >= data[0].size()) return;
    data[x][y] += z;
  }

  void build()
  {
    for(int i = 1; i < data.size(); i++) {
      for(int j = 1; j < data[i].size(); j++) {
        data[i][j] += data[i][j - 1] + data[i - 1][j] - data[i - 1][j - 1];
      }
    }
  }

  T query(int sx, int sy, int gx, int gy)
  {
    return (data[gx][gy] - data[sx][gy] - data[gx][sy] + data[sx][sy]);
  }
};

int main()
{
  int N, K;
  int mat1[2000][2000] = {{}}, mat2[2000][2000] = {{}};

  cin >> N >> K;
  for(int i = 0; i < N; i++) {
    int x, y;
    char c;
    cin >> x >> y >> c;
    if(c == 'W') mat1[y % (2 * K)][x % (2 * K)]++;
    else mat2[y % (2 * K)][x % (2 * K)]++;
  }

  CumulativeSum2D< int > sum1(K * 4, K * 4), sum2(K * 4, K * 4);

  for(int i = 0; i < 2 * K; i++) {
    for(int j = 0; j < 2 * K; j++) {
      sum1.add(i, j, mat1[i][j]);
      sum1.add(i + 2 * K, j, mat1[i][j]);
      sum1.add(i, j + 2 * K, mat1[i][j]);
      sum1.add(i + 2 * K, j + 2 * K, mat1[i][j]);
      sum2.add(i, j, mat2[i][j]);
      sum2.add(i + 2 * K, j, mat2[i][j]);
      sum2.add(i, j + 2 * K, mat2[i][j]);
      sum2.add(i + 2 * K, j + 2 * K, mat2[i][j]);
    }
  }
  sum1.build();
  sum2.build();

  int ret = 0;
  for(int k = 0; k < 2; k++, swap(sum1, sum2)) {
    for(int i = 0; i < K; i++) {
      for(int j = 0; j < K; j++) {
        int latte1 = sum1.query(i, j, i + K, j + K);
        int latte2 = sum1.query(i + K, j + K, i + K + K, j + K + K);

        int malta1 = sum2.query(i + K, j, i + K + K, j + K);
        int malta2 = sum2.query(i, j + K, i + K, j + K + K);

        ret = max(ret, latte1 + latte2 + malta1 + malta2);

      }
    }
  }

  cout << max(ret, N - ret) << endl;
}

Measured memory_bytes: 156800
def prim():
    global n
    global ct
    color=[0]*n
    d=[float('inf')]*n
    d[0]=0
    while True:
        mincost=float('inf')
        for i in xrange(n):
            if color[i]!=2 and d[i]<mincost:
                mincost=d[i]
                u=i
        if mincost==float('inf'):
            break
        ct+=d[u]
        color[u]=2
        for v in xrange(n):
            if color[v]!=2 and m[u][v]!=-1:
                if m[u][v]<d[v]:
                    d[v]=m[u][v]
                    color[v]=1
    
if __name__=='__main__':
    n=input()
    m=[map(int,raw_input().split()) for _ in xrange(n)]
    ct=0
    prim()
    print(ct)
    

Measured memory_bytes: 6580
package main

import (
	"fmt"
)

func multiplicationTable(x, y int) int {
	if x > 9 || y > 9 {
		return -1
	}
	return x * y
}

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	fmt.Println(multiplicationTable(a, b))
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int h;
int grid[10][5];

int getPoint() {
    int point = 0;
    for (int y = 0; y < h; ++y) {
        for (int x = 0; x < 5; ++x) {
            int cnt = 0;
            int tnt = grid[y][x];
            while (grid[y][x] == tnt && x < 5) {
                cnt++;
                x++;
            }
            x--;
            if (cnt > 2) {
                point += cnt * tnt;
                for (int c = 0; c < cnt; ++c ) {
                    grid[y][x-c] = 0;
                }
            }
        }
    }
    return point;
}

void deleteBlock() {
    for (int x = 0; x < 5; ++x) {
        bool flag = true;
        while (flag) {
            flag = false;
            for (int y = h - 1; y > 0; --y) {
                if (grid[y][x] == 0 && grid[y-1][x] > 0) {
                    swap(grid[y][x], grid[y-1][x]);
                    flag = true;
                }
            }
        }
    }
}

int solve() {
    int point = 0;
    while (1) {
        int tmp = getPoint();
        if (tmp == 0) break;
        point += tmp;
        deleteBlock();
    }
    return point;
}

int main (int argc, char *argv[]) {
    while (cin>>h, h) {
        for (int y = 0; y < h; ++y) {
            for (int x = 0; x < 5; ++x) {
                cin>>grid[y][x];
            }
        }
        cout<<solve()<<endl;
    }
    return 0;
}


Measured memory_bytes: 3092
#include <stdio.h>

int main(){
    int comprimento, pessoa, espaco, qtd_pessoas = 0;
    scanf("%d %d %d", &comprimento, &pessoa, &espaco);
    for (int i = 1;;i++){
        if (comprimento >= (pessoa*i + espaco*(i+1)))
            qtd_pessoas = i;
        else
            break;
    }
    printf("%d\n", qtd_pessoas);
    return 0;
}


Measured memory_bytes: 128
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

const long MOD = 1_000_000_007;

void main(){
	int n = readln.chomp.to!int;
	long[] ts = readln.chomp.split.map!(to!long).array;
	long[] as = readln.chomp.split.map!(to!long).array;
	
	const long long0 = 0;
	ts = [long0] ~ ts ~ [long0];
	as = [long0] ~ as ~ [long0];
	
	BigInt ans;
	ans = BigInt(1);
	
	for(int i = 1; i <= n; i ++){
		long x;
		bool ft, fa;
		if(ts[i - 1] == ts[i]) ft = 1; else ft = 0;
		if(as[i] == as[i + 1]) fa = 1; else fa = 0;
		
		if(ft && fa){
			x = min(ts[i], as[i]);
			}
		if(ft && !fa){
			if(as[i] <= ts[i]) x = 1;
			else x = 0;
			}
		if(!ft && fa){
			if(ts[i] <= as[i]) x = 1;
			else x = 0;
			}
		if(!ft && !fa){
			if(ts[i] == as[i]) x = 1;
			else x = 0;
			}
		
		ans *= x;
		ans %= MOD;
		debug writeln(i, " ", ts[i], " ", as[i], " ", ft, " ", fa, " ", x, " ", ans);
		
		}
	
	ans.writeln;
	}


/*
tsは増える一方
i-1からiで増えたときはiはその高さが確定
増えなかったときはその高さ以下

asは減る一方
iからi+1で減るときはiはその高さが確定
減らなかったときはiはその高さ以下
*/

Measured memory_bytes: 10824
// https://atcoder.jp/contests/agc029/tasks/agc029_b

#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

// long gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// long lcm(long a, long b) { return a * b / gcd(a, b); }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, ans = 0;
    cin >> n;
    // 値に対して個数を持つ。ペアとして使用する際に個数を数える。
    map<int, int> m;

    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (m.count(a) == 0) {
            m[a] = 1;
        } else {
            m[a]++;
        }
    }

    // 大きい値から順に処理する
    while (!m.empty()) {
        // 残っている要素から最大値を取得
        auto a = m.rbegin();
        int x = a->first;
        int cnt = a->second;
        if (cnt >= 2) {
            m[x]--;
        } else {
            m.erase(x);
        }

        // xより大きい２のべき乗を作成
        ll p = 1;
        while (p <= x)
            p *= 2;
        int y = p - x; // ペアとなるyは1通り
        auto itr = m.find(y);
        if (itr != m.end()) {
            ans++;
            if (itr->second >= 2) {
                itr->second = itr->second - 1;
            } else {
                m.erase(itr);
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
//////////////////////////////////

int f(int n, int d) {
  return n / d;
}

int main() {
  int l, r, d; cin >> l >> r >> d;
  cout << f(r, d) - f(l-1, d) << endl;
  return 0;
}

// EOF

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

void solve(long long N){
    long long ans = 0;
    for(long long n = 1; n <= N; n = n + 2){
        long long cnt = 0;
        for(long long i = 1; i * i <= n; ++i){
            if(n % i == 0){
                cnt++;
                if(i * i != n) cnt++;
            }
        }
        if(cnt == 8) ans++;
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define pb push_back
string en="\n";
string t="hello";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define srch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef unsigned long long ULL;
bool isprm(LL a)
{
    for(LL i=2; i*i<=a; i++)
    {
        if(a%i==0)
            return false;
    }
    return true;
}
bool palin(string a)
{
    for(int i=0; i<a.sz; i++)
    {
        if(a.at(i)!=a.at(a.sz-i-1))
            return 0;
    }
    return 1;
}
bool isVowel(char ch)
{
    ch=toupper(ch);
    if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E')
        return true;
    return false;
}
int toInt(string s)
{
    int sm;
    stringstream ss(s);
    ss>>sm;
    return sm;
}
template<typename T>inline T gcd(T a,T b)
{
    if(a<0)
        return gcd(-a,b);
    if(b<0)
        return gcd(a,-b);
    return (b==0)?a:gcd(b,a%b);
}
template<typename T>inline T lcm(T a,T b)
{
    if(a<0)
        return lcm(-a,b);
    if(b<0)
        return lcm(a,-b);
    return a*(b/gcd(a,b));
}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,c=0;
    while(cin>>n>>k)
    {
        vl p(n+1) ,a(n+1) ;
        Rep(i,n)
        {
            cin>>p[i];
        }
        p[0]=a[0]=0;
        Rep(i,n)
        {
           a[i]=p[i]+a[i-1];
        }
        s=c=0;
        for(i=1;i<n-k+2;i++)
        {
            s=max(s,a[i+k-1]-a[i-1]);
        }
        double dd=((s+k)*1.0)/2;
        cout<<fixed<<setprecision(10)<<dd<<en;
    }
}


Measured memory_bytes: 3328
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
ll dp[50][5000] = {};
ll x[50] = {};
ll n,a;

void make(){
	if (x[0] == 0){
		dp[0][2450]=2;
	}
	else{
	dp[0][x[0]+2450] = dp[0][2450] = 1;
	}
	FOR(i,1,n){
		rep(j,4901){
			dp[i][j] = dp[i-1][j] + dp[i-1][j-x[i]];
		}
	}
}

int main(){
	cin >> n>>a;
	ll sub;
	rep(i,n){
		cin >> sub;
		x[i] = sub-a;
	}

	make();
	/*
	rep(i,n){
		FOR(j,2449,2453){
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	*/
	cout << dp[n-1][2450] - 1 << endl;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
ll MOD = (ll)INF + 7;

#ifndef PRIME_FACTOR
#define PRIME_FACTOR
//素因数分解, o(sqrt(n))
template<typename T>
map<T, int> primeFactor(T n){
	map<T, int> res;
	for(int i = 2; i * i <= n; i++){
		while(n % i == 0){
			res[i]++;
			n /= i;
		}
	}
	if(n != 1) res[n] = 1;
	return res;
}
#endif


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

    vector<int> num(N+1, 0);

    for(int i = 1; i <= N; i++){
        map<int, int> mp = primeFactor(i);
        for(int j = 2; j <= i; j++){
            num[j] += (mp[j] % MOD);
            num[j] %= MOD;
        }
    }

    ll res = 1;
    for(int i = 0; i <= N; i++){
        // printf("num[%d] = %d\n", i, num[i]);
        res *= (num[i] + 1);
        res %= MOD;
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 256