akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from collections import Counter
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = int(input())

    c = Counter()
    for _ in range(n):
        s = input()
        a = [0] * 26

        for h in s:
            a[ord(h) - 97] += 1

        c[tuple(a)] += 1

    print(sum(((i - 1) * i) // 2 for i in c.values()))

# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 117888
#include<cstdio>
#include<iostream>
#include<cmath>
#include<ctype.h>
#include<vector>
#include<cstdlib>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<time.h>

#define ll long long
#define LL long long
#define ULL unsigned long long 
#define ull unsigned long long 
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
const ll INF = -10000000000;
using namespace std;
ll dp[50000][20] = {};

int main()
{
	int n, m;
	int c[20];
	
	cin >> n >> m;
	REP(i, m) cin >> c[i];

	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < m; j++) {
			if (j == 0) {
				dp[i][0] = i;
			}
			else if (c[j] <= i) {
				dp[i][j] = min(dp[i][j - 1], dp[i-c[j]][j] + 1);
			}
			else {
				dp[i][j] = dp[i][j - 1];
			}
			
		}
	}
	
	/*
	for (int i = 1; i <= n;i++) {
		for (int j = 0; j < m;j++) {
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	*/
	cout << dp[n][m - 1] << endl;
	return 0;
}

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

int main() {
    long long int n, d, x, y, ans = 0;
    cin >> n >> d;
    for(int i = 0; i < n; ++i) {
        cin >> x >> y;
        if(x*x + y*y <= d*d) ans++;
    }
    cout << ans << '\n';
}


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

public class Main {
	static ArrayList[] gragh;
	static int n, m;
	static Scanner sc;

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

		n = sc.nextInt();
		m = sc.nextInt();
		init();

		for(int i = 0;i < n;i++){
			dijkstra(i);
		}
		int count = 0;
		for(int i = 0;i < n;i++){
			for(int j = 0;j < gragh[i].size();j++){
				Ed edge = (Ed)gragh[i].get(j);
				if(!edge.used)count++;
			}
		}

		System.out.println(count/2);
	}

	static void dijkstra(int a) {// node aからの各nodeまでの最短を計算
		boolean used[] = new boolean[n];
		int shortest[] = new int[n];
		Ed myEdge[] = new Ed[n];
		for (int i = 0; i < n; i++) {
			shortest[i] = 999999999;
		}
		shortest[a] = 0;

		for (int i = 0; i < n; i++) {
			int next = 999999999;
			int nextN = a;
			for (int j = 0; j < n; j++) {
				if (!used[j] && shortest[j] < next) {
					next = shortest[j];
					nextN = j;
				}
			}
			used[nextN] = true;
			if(nextN != a){
				myEdge[nextN].used = true;
				for(int j = 0;j < gragh[nextN].size();j++){
					Ed e = (Ed)gragh[nextN].get(j);
					if(shortest[nextN]-e.cost == shortest[e.node]){
						e.used = true;
					}
				}
			}

			for (int j = 0; j < gragh[nextN].size(); j++) {
				Ed edge = (Ed) gragh[nextN].get(j);
				if (shortest[edge.node] > shortest[nextN] + edge.cost) {
					shortest[edge.node] = shortest[nextN] + edge.cost;
					myEdge[edge.node] = edge;
				}
			}
		}

		return;
	}

	static void init() {
		gragh = new ArrayList[n];

		for (int i = 0; i < n; i++) {
			gragh[i] = new ArrayList<Ed>();
		}

		for (int i = 0; i < m; i++) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int c = sc.nextInt();

			gragh[a].add(new Ed(b, c));
			gragh[b].add(new Ed(a, c));
		}
	}
}

class Ed {
	int node;
	int cost;
	boolean used;

	Ed(int node, int cost) {
		this.node = node;
		this.cost = cost;
		used = false;
	}
}


Measured memory_bytes: 14692
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

//container util
//------------------------------------------
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

//repetition
//------------------------------------------
#define rep(i,n)  for(int i=0;i<(n);i++)

int main(){
    int n,ans=0; cin>>n;
    vi h(n);
    rep(i, n)cin>>h[i];
    
    
    bool ok = true;
    while(ok){
        ok = false;
        rep(i, n){
            if(h[i]>0){
                while(h[i]>0&&i<n){
                    h[i]--;
                    i++;
                }
                ans++;
            }
        }
        rep(i, n)if(h[i]>0)ok=true;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
def main(N):
    n_div_max = 0
    answer = 1
    for n in range(1, N + 1):
        _n = n
        tmp_n_div = 0
        while True:
            _n, m = divmod(_n, 2)
            if m > 0:
                break
            tmp_n_div += 1

        if tmp_n_div >= n_div_max:
            n_div_max = tmp_n_div
            answer = max(answer, n)

    print(answer)


def main2(N):
    # 128 = 2 ** 7
    for i in reversed(range(7)):
        n = 2 ** i
        if N >= n:
            print(n)
            return

if __name__ == '__main__':
    N = int(input())
    main2(N)


Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <cstdio>
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
    ll n;
    cin>>n;
    if(n<1000){
        cout<<"ABC"<<endl;
    }else{
        cout<<"ABD"<<endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <iomanip>
#include <map>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)
#define ALL(v) v.begin(),v.end()

#define PI 3.14159265358979323846;

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    FAST_IO
    
    ll x,y;
    cin >> x >> y;

    if(y % 2 == 0 && x * 2 <= y && y <= x * 4){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3076
using System;

namespace _165_b
{
    internal class OnePercentage
    {
        private static void Main(string[] args)
        {
            var x = long.Parse(Console.ReadLine() ?? throw new InvalidOperationException());

            long money = 100;

            for (var i = 1;; i++)
            {
                money = (long) Math.Floor(money * 1.01m);
                if (money >= x)
                {
                    Console.WriteLine(i);
                    return;
                }
            }
        }
    }
}

Measured memory_bytes: 27548
#include<iostream>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

int main(void){
  int N;
  cin >> N;
  vector<pair<int, int> > pii(N);
  for(int i=0; i<N; i++){
    cin >> pii[i].first >> pii[i].second;
  }
  
  sort(pii.begin(), pii.end());

  int count = pii[N-1].first;
  while(true){
    if(pii[N-1].second < 0){
      break;
    }
    count++;
    pii[N-1].second--;
  }
  
  cout << count -1 << endl;
  return 0;
}


Measured memory_bytes: 1024
from collections import defaultdict
from itertools import groupby, accumulate, product, permutations, combinations
def solve():
  d = defaultdict(lambda: 0)
  N = int(input())
  for i in range(N):
    S = input()
    d[S[0]] += 1
  s = 'MARCH'
  s = list(s)
  cnt = 0
  for com in combinations(s,3):
    prod = 1
    for c in com:
      prod *= d[c]
    cnt += prod
  return cnt
print(solve())

Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
constexpr uint64_t L1 = 1ull;
constexpr ull bit(int n){ return 1ull << n;}

constexpr ll INF       = 1000000000;/* 1e+9a */

void solve(istream& cin) {
    ll N, K;
    while(cin >> N >> K){
        vector<ll> h;
        for (int i = 0; i < N; ++i) {
            ll tmp;
            cin >> tmp;
            h.push_back(tmp);
        }// i
        sort(h.begin(), h.end());
        ll ans = INF;
        for (int i = K - 1; i < N; ++i) {
            ans = min(ans, h[i] - h[i-K+1]);
        }// i
        cout << ans << endl;
    
    }
}

int main(int argc, char *argv[]) {
    string FileName("C"), Modifier("_MEPH");
    string ExecutionName = FileName + Modifier;
    string sub(argv[0]);
    // pass消去
    if(sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size()-ExecutionName.size(), ExecutionName.size());

	// 数値計算もの用
    cout << setprecision(16) << scientific;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        solve(cin);
    }
    else {    
	    cerr << sub << endl;
        string inFile = "C_sample.txt";
        auto fs = fstream(inFile, fstream::in);
        solve(fs);
    }
}


Measured memory_bytes: 1400
#include <iostream>
#include <unordered_set>
#include <algorithm>
using namespace std;

int main(){
	int n;
	cin >> n;
	
	unordered_set<int> us;
	for(int i=0; i<n; i++){
		int a;
		cin >> a;
		auto itr = us.find(a);
		if(itr!= us.end()){
			us.erase(a);
		}else{
			us.insert(a);
		}
	}
	
	cout << us.size() << endl;
	return 0;
}

Measured memory_bytes: 4388
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    int N,M;
    cin >> N >> M;
    N *= N-1;
    N /= 2;
    M *= M-1;
    M /= 2;
    cout << M+N << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;

const int N = (int) 1e6 + 100;
char s[N], t[N];

const int ALP = 26;
int nx[N][ALP];

vector <int> nw;

int n;

bool check(int m)
{
    int spos = 0;
    for (int i = 0; i < (int) nw.size() - 1; i++)
    {
        int k = min(i, m);
        spos = max(spos, nw[i - k] + k);
        spos = nx[spos][t[nw[i]] - 'a'];
        if (spos > nw[i])
            return false;
        spos++;
    }
    return true;
}


int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

    scanf("%d", &n);

    scanf("%s", s);
    scanf("%s", t);
    
    for (int i = 0; i <= n; i++)
    {
        if (i == 0 || t[i] != t[i - 1])
            nw.push_back(i);
    }

    for (int i = 0; i < ALP; i++)
        nx[n][i] = n;
    for (int i = n - 1; i >= 0; i--)
    {
        for (int j = 0; j < ALP; j++)
            nx[i][j] = nx[i + 1][j];
        nx[i][s[i] - 'a'] = i;
    }

    bool eq = true;
    for (int i = 0; i < n; i++)
        if (s[i] != t[i])
            eq = false;
    if (eq)
    {
        printf("0\n");
        return 0;
    }

    int l = -1, r = 2 * n;

    while (r - l > 1)
    {
        int m = (l + r) / 2;
        if (check(m))
            r = m;
        else
            l = m;
    }

    if (r == 2 * n)
    {
        printf("-1\n");
        return 0;
    }

    printf("%d\n", r + 1);

	return 0;
}




Measured memory_bytes: 107884
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    ll N;
    cin>>N;
    string ans;
    while(N){
        N--;
        ans.push_back(char('a'+N%26));
        N/=26;
    }
    reverse(All(ans));
    cout<<ans<<endl;
}


Measured memory_bytes: 3624
// https://atcoder.jp/contests/abc122/tasks/abc122_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    int idx = 0, cnt = 0, tmp = 0;
    while (idx <= (int)S.length()) {
        if (S[idx] == 'A' || S[idx] == 'C' || S[idx] == 'G' || S[idx] == 'T') {
            tmp++;
        } else {
            cnt = max(cnt, tmp);
            tmp = 0;
        }
        idx++;
    }
    cnt = max(cnt, tmp);
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3544
#include <algorithm> // sort
#include <iostream>
using namespace std;

int N, K, p[1010];

int main(){
	cin >> N >> K;
	for(int i = 0; i < N; ++i) cin >> p[i];
  		sort(p, p + N);
	int ans = 0;
	for(int i = 0; i < K; ++i) ans += p[i];
		cout << ans << endl;
	}

Measured memory_bytes: 3628
import itertools,sys
def f(a):
 if len(a)<2:yield[a[0]]*2
 for i in range(1,len(a)):
  for p,s in f(a[:i]):
   for q,t in f(a[i:]):
    yield(p+q,f'({s} + {t})')
    yield(p-q,f'({s} - {t})')
    yield(p*q,f'({s} * {t})')
def s(a):
 for p in itertools.permutations(a):
  for n,s in f(p):
   if n==10:print(s);return 1
for e in sys.stdin:
 a=list(map(int,e.split()))
 if sum(a)and not s(a):print(0)


Measured memory_bytes: 5652
#include <bits/stdc++.h>
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
#define int ll
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n;
int pos[N];

int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n;
	for(int i=1; i<=n; i++){
		int x; cin >> x;
		pos[x] = i;
	}
	int ans = 0;
	multiset<int> ms;
	ms.insert(0); ms.insert(0); ms.insert(n+1); ms.insert(n+1);
	for(int i=n; i>0; i--){
		ms.insert(pos[i]);
		auto it = ms.find(pos[i]);
		int s1, s2, e1, e2; // s2 s1 pos[i] e1 e2
		it--;
		s1 = *it;
		it--;
		s2 = *it;
		it++; it++; it++;
		e1 = *it; 
		it++;
		e2 = *it;
		ans += i*((s1-s2)*(e1-pos[i]) + (e2-e1)*(pos[i]-s1));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5760
N, W = map(int, input().split())
v = [None] * (N + 1)
w = [None] * (N + 1)
for i in range(1, N + 1):
    v[i], w[i] = map(int, input().split())

# dp[i][j] := i番目の品物までで重さjとなるように選んだときの価値の最大値
# dp[i][j] := max(dp[i][j - w] + v, dp[i - 1][j])
#                   ~~~ 遷移前にすでにi番目の品物が入っている可能性を考慮
dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(W + 1):
        if w[i] > j:  # 今選ぼうとしている品物の重さが制限jを超える場合には当然選べない
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = max(dp[i][j - w[i]] + v[i], dp[i - 1][j])
print(dp[N][W])


Measured memory_bytes: 42264
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>

#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))

int p[20];

int main()
{
  int cnt;
  int N;
  int i;
  int tmp[3];
  int result = 0;
  
  cnt = scanf("%d", &N);

  for(i=0; i<N; i++) {
    cnt = scanf("%d", &p[i]);
  }

  for(i=1; i<(N-1); i++) {
    tmp[0] = MIN(p[i-1], MIN(p[i], p[i+1]));
    tmp[2] = MAX(p[i-1], MAX(p[i], p[i+1]));
    if ((p[i] == p[i-1]) ||
        (p[i] == p[i+1])) {
      continue;
    }
    if ((p[i] != tmp[0]) &&
        (p[i] != tmp[2])) {
      result++;
    }
  }

  printf("%d", result);

  return 0;
}



Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static final char LEFT = 'L';
	public static final char RIGHT = 'R';
	public static final char UP = 'U';
	public static final char DOWN = 'D';

	static Main instance = new Main();

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値
		char[] str = scan.next().toCharArray();

		//出力値
		String result = "Yes";

		int length = str.length;

		for (int i = 0; i < length; i++) {
			if ((i + 1) % 2 == 0 && str[i] == (RIGHT)) {
				result = "No";
			} else if ((i + 1) % 2 == 1 && str[i] == (LEFT)) {
				result = "No";
			}
		}

		System.out.println(result);
	}
}

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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;

void solve() {
  Bint x, y;
  cin >> x >> y;
  int cnt = 0;
  while (x <= y) {
    x *= 2;
    ++cnt;
  }
  cout << cnt << endl;
}

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

  solve();
  return 0;
}


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

/*
int main(void){
	int n;
	int h[100000];




	return 0;
}
*/

int main(void){

	int n;
	int c;

	c = 0;

	scanf("%d",&n);

	if(n >= 10){
		c += 9;
	}else{
		c += n;
	}

	if(n >= 1000){
		c += 900;
	}else if(n >= 100){
		c += n - 99;
	}

	if(n >= 100000){
		c += 90000;
	}else if(n >= 10000){
		c += n - 9999;
	}


		printf("%d\n",c);

	return 0;
}

Measured memory_bytes: 128
#![allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let a: Vec<i32> = read_vec();
    println!("{}", a[0] * a[1]);
}

Measured memory_bytes: 2136
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	printf("%d\n",(a-c)/(b+c));
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())

ans = 0

if K == 0:
    print(N*N)
    exit()

for b in range(K+1, N+1):
    max_p = N // b
    max_q = N % b
    if max_q < K:
        max_p -= 1
        max_q = b - 1
    # print(b,max_p,max_q)
    ans += max_p * (b-K) + (max_q-K+1)

print(ans)


Measured memory_bytes: 39024
function Main(input){
var A = parseInt(input.split(" ")[0],10);
var B = parseInt(input.split(" ")[1],10);
var T = parseInt(input.split(" ")[2],10);
var C = 0;
for(i=1;A*i<=(T+0.5);i++){
  C += B;
}
console.log(C);
}
  Main(require('fs').readFileSync('/dev/stdin','utf8'));

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

int main() {
    int H, W, M;
    cin >> H >> W >> M;
    vector<int> h(M), w(M);
    set<P> points;
    rep(i,M) {
        cin >> h.at(i) >> w.at(i);
        points.insert({ h.at(i), w.at(i) });
    }
    map<int,int> hCount, wCount;
    rep(i,M) {
        hCount[h.at(i)]++;
        wCount[w.at(i)]++;
    }

    int hMax = 0, wMax = 0;
    vector<int> hm, wm;
    for (auto hc : hCount) {
        if (hMax < hc.second) {
            hm.clear();
            hm.push_back(hc.first);
        }
        if (hMax == hc.second) hm.push_back(hc.first);
        hMax = max(hMax, hc.second);
    }
    for (auto wc : wCount) {
        if (wMax < wc.second) {
            wm.clear();
            wm.push_back(wc.first);
        }
        if (wMax == wc.second) wm.push_back(wc.first);
        wMax = max(wMax, wc.second);
    }
    int ans = hMax + wMax - 1;
    for (auto hi : hm) {
        for (auto wi : wm) {
            if (points.find({ hi, wi }) == points.end()) {
                cout << ans + 1 << endl;
                return 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)

string S,T;
int main(){
	fast;
	
	cin>>S>>T;
	
	FOR(i,0,S.size() - 1){
		if (S[i] != T[i]){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
}



Measured memory_bytes: 3612
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int N; cin >> N;
	while (N--) {
		int r, t; cin >> r >> t;
		bool onr = r % 100;
		bool ona = t % 30;
		int ft = t / 30;
		int fr = r / 100;
		const int s = ft * 5 + fr;
		if (onr&&ona) {
			cout << s <<" "<< s + 1 << " " << s + 5 << " " << s + 6 << endl;
		}
		else if (onr) {
			cout << s << " " << s + 1 << endl;
		}
		else if (ona) {
			cout << s << " " << s + 5 << endl;
		}
		else {
			cout << s << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3068
#include<stdio.h>
int main()
{
    int x;
    scanf("%d",&x);

    if(x/100<=12&&x%100>12&&x/100>0)
    {
        printf("MMYY");
    }
    else if(x/100<=12&&x%100==0&&x/100>0)
    {
        printf("MMYY");
    }
    else if(x/100>12&&x%100<=12&&x%100>0)
    {
        printf("YYMM");
    }
    else if(x%100<=12&&x/100==0&&x%100>0)
    {
        printf("YYMM");
    }
    else if(x/100<=12&&x%100<=12&&x/100>0&&x%100>0)
    {
        printf("AMBIGUOUS");
    }
    else
    {
        printf("NA");
    }
    return 0;
}

Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    a[i]=a[i]-(i+1)
import numpy as np
an=np.array(a)
b=int(np.median(an))
ans=0
for i in a:
    ans+=abs(i-b)
print(ans)

Measured memory_bytes: 37788
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}

int main() {
	int n,digits;
	int ans = 0;
	cin >> n;
	//cout << "check_digits:" << check_digits(n) << endl;
	switch (check_digits(n)) {
	case 6:
		ans = (9 + 900 + 90000);
		break;
	case 5:
		ans = (9 + 900 + (n-9999));
		break;
	case 4:
		ans = (9 + 900);
		break;
	case 3:
		ans = (9 + (n - 99));
		break;
	case 2:
		ans = 9;
		break;
	case 1:
		ans = n;
		break;
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, k; cin >> n >> k;
  vector<int> ct(n + 1, 0);
  vector<int> ti(n), di(n);
  for(int i = 0; i < n; i++) cin >> ti[i] >> di[i];
  vector<int> od(n);
  iota(od.begin(), od.end(), 0);
  sort(od.begin(), od.end(), [&](int a, int b){
    return di[a] > di[b];
  });
  long long ans = 0, diff = 0, sum = 0, ch = 0;
  multiset<int> rem;
  for(int i = 0; i < k; i++) {
    sum += di[od[i]];
    if(ct[ti[od[i]]] == 0) diff++;
    else rem.insert(di[od[i]]);
    ct[ti[od[i]]]++;
  }
  ans = sum + diff * diff;
  for(int i = k; i < n && !rem.empty(); i++){
    if(ct[ti[od[i]]]) continue;
	sum -= *rem.begin(); rem.erase(rem.begin());
    sum += di[od[i]];
    ct[ti[od[i]]]++;
    diff++;
    ans = max(ans, sum + diff * diff);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define mod 1000000007
vector<ll> fact(200001);

ll power(ll a,ll r)
{
	if (r==1) return a;
	else
	{
		ll m;
		m=power(a,r/2);
		if (r%2==0) return m*m%mod;
		else return m*m%mod*a%mod;
	}	
}

void factorial()
{
	fact[0]=1;
	for (int i=1;i<200001;i++) fact[i]=fact[i-1]*i%mod;
}

ll modinv(ll a)
{
	return power(a,mod-2);
}

ll cmb(ll n,ll r)
{
	if (r>n) return 0;
	if (n==r) return 1;
	return fact[n]*modinv(fact[r])%mod*modinv(fact[n-r])%mod;
}

int main()
{
	ll N,K; cin >> N >> K;
	vector<ll>A(N);
	factorial();
	ll ans=0;
	for (int i=0;i<N;i++)
	{
		cin >> A[i];
	}
	sort(A.begin(),A.end());
	for (int i=0;i<N;i++)
	{
	
	ans=(ans-A[i]*cmb(N-i-1,K-1)%mod)%mod;
	ans=(ans+A[i]*cmb(i,K-1)%mod)%mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include<algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n,R[200000]={};
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>R[i];
    }
    int maxv=-1000000000,minv=R[0];
    for(int j=1;j<n;j++){
        maxv=max(maxv,R[j]-minv);
        minv =min(minv,R[j]);
    }
    cout<<maxv<<endl;
    
    
}



Measured memory_bytes: 3896
h, w = map(int, input().split())
s = []
for _ in range(h):
    s.append(input())
li = [(0,-1),(-1,0),(1,0),(0,1)]
for y in range(h):
    for x in range(w):
        if s[y][x]=='.':
            continue
        for dx, dy in li:
            if not (0<=x+dx<w and 0<=y+dy<h):
                continue
            if s[y+dy][x+dx]=='#':
                break
        else:
            print('No')
            break
    else:
        continue
    break
else:
    print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

ll d[13][100001]={};

int main() {
	int n;
	cin>>n;
	int r=0;
	rep(i,n){
		if((i+1)/10000>0&&(i+1!=100000)){
			r++;
		}else if((i+1)/100>0&&(i+1)/100<=9) {
			r++;
		}else if((i+1)>0&&(i+1)<=9) {
			r++;
		}
	}
	cout<<r<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  int h, w;
  while(cin >> w >> h) {
    if(h == 0 && w == 0) return 0;
    int n; cin >> n;
    int ng[h][w]; CLR(ng);
    FOR(i,0,n) {
      int a, b; cin >> a >> b;
      --a;--b;
      ng[b][a] = true;
    }
    ll dp[h][w]; CLR(dp);
    FOR(y,0,h) {
      if(!ng[y][0]) dp[y][0] = 1;
      else break;
    }
    FOR(x,0,w) {
      if(!ng[0][x]) dp[0][x] = 1;
      else break;
    }
    FOR(y,1,h) {
      FOR(x,1,w) {
        if(ng[y][x]) continue;
        dp[y][x] = dp[y-1][x] + dp[y][x-1];
      }
    }
    cout << dp[h-1][w-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 2980
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define INF (1<<29)
#define EPS (1e-10)
#define make_pair mp
#define pb push_bacck

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pii;

int dx[] = {0,1,0,-1}, dy[] = {1,0,-1,0};
int bx[7][4] = {
							{0,1,0,1},
							{0,0,0,0},
							{0,1,2,3},
							{1,0,1,0},
							{0,1,1,2},
							{0,0,1,1},
							{1,2,0,1}};
int by[7][4] = {
							{0,0,1,1},
							{0,1,2,3},
							{0,0,0,0},
							{0,1,1,2},
							{0,0,1,1},
							{0,1,1,2},
							{0,0,1,1}};

int main(){
	string board[8];
	string line;
	int l = 0;
	while (cin >> line) {
		board[l] = line;
		if (++l == 8) {
			for (int i = 0; i < 8; i++) {
				for (int j = 0; j < 8; j++) {
					for (int k = 0; k < sizeof(bx); k++) {
						bool ok = true;
						for (int l = 0; l < 4; l++) {
							int x = j+bx[k][l], y = i+by[k][l];
							if (x < 0 || 8 <= x || y < 0 || 8 <= y || board[y][x] != '1'){
								ok = false;
								break;
							}
						}
						if (ok) {
							cout << char('A'+k) << endl;
							goto end;
						}
					}
				}
			}
			end:;
			l = 0;
		}
	}
}

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> v(n);
    int indx1 , indx2 , mx1=0 , mx2=0;
    for(int i=0 ; i<n ; i++)
    {
        cin>>v[i];
        if( v[i] >= mx1 )
        {
            mx1=v[i];
            indx1=i;
        }
    }
    for(int i=0 ; i<n ; i++)
    {
        if( v[i] >= mx2 && i!=indx1 )
        {
            mx2=v[i];
            indx2=i;
        }
    }
    for(int i=0 ; i<n ; i++)
    {
        if( i!=indx1 )
            cout<<mx1<<endl;
        else
            cout<<mx2<<endl;
    }
    return 0;
}


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

int main() {
    int a,b,count=1;
    cin >> a >> b;

    //int plug=a;
    int ans = 0;
    while (count<b) {
      count--;
      count+=a;
      ans++;
    }
    printf("%d ", ans);
}


Measured memory_bytes: 256
N,T=map(int,input().split())
x=[None] # x[0]
for i in range(1,N+1): # x[i]のiに対応させる
    x.append(tuple(map(int,input().split()))) # x[1]~x[N]
# print(x) #DB★

dp1=[[0 for j in range(T)] for i in range(N+2)] # 0~N+1 dp1[i]はx[1]からx[i]まで使用（dp1[0]は使用するx[i]なしの初期値，dp1[N+1]は余り→0で初期化していることが後で役に立つ）
for i in range(1,N+1): # dp1[0]は初期値なのでいじらない。dp1[N+1]は余りなので計算しない。dp1[N]まで計算するので，iはNまで
    for j in range(T): # 0分後からT-1分後まで計算する
        if x[i][0]>j:
            dp1[i][j]=dp1[i-1][j]
        else:
            dp1[i][j]=max(dp1[i-1][j],dp1[i-1][j-x[i][0]]+x[i][1])

# print(dp1) #DB★

dp2=[[0 for j in range(T)] for i in range(N+2)] # 0~N+1 dp2[i]はx[i]からx[N]まで（x[N]からx[i]まで）使用（dp2[N+1]は使用するx[i]なしの初期値，dp2[0]は余り）
for i in range(N,0,-1): # dp2[N+1]は初期値なのでいじらない。dp2[0]は余りなので計算しない。dp2[1]まで計算するので，iは1まで
    for j in range(T):
        if x[i][0]>j:
            dp2[i][j]=dp2[i+1][j]
        else:
            dp2[i][j]=max(dp2[i+1][j],dp2[i+1][j-x[i][0]]+x[i][1])

# print(dp2) #DB★

cans=[0 for i in range(N+1)] # i番目の料理を最後に食べる場合の満足度の最大値
for i in range(1,N+1):
    cans[i]=max([dp1[i-1][j]+dp2[i+1][T-1-j] for j in range(T)])+x[i][1]

# print(cans) #DB★ 

ans=max(cans)

print(ans)

Measured memory_bytes: 197252
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int max, min;
		Scanner sc = new Scanner(System.in);
		for(int i = 0; i <= 6; i++) {
		max = sc.nextInt();
		min = sc.nextInt();
		System.out.println(max-min);
		}

	}
	

}

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

#define pb push_back
#define fi first
#define se second
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	
	int a, b;
	cin >> a >> b;
	cout << 6 - a - b << '\n';
}


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

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a, b) for(int i=a;i<b;++i)
#define fj(a, b) for(int j=a;j<b;++j)
#define fk(a, b) for(int k=a;k<b;++k)
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pi;
///////////////////////////////



void solve(){

}

void read(){
	int cnt1, n;
	scanf("%d",&n);
	fi(0, n){
		int v;
		scanf("%d",&v);
		if(v%2 == 1){
			++cnt1;
		}
	}
	if(cnt1 % 2 == 0){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
}

void prepare(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
}

int main(){
	prepare();
	read();
	solve();


	return 0;
}

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

int main() {

	string a;
	cin >> a;
	string b = a.substr(0,2);
	string c = a.substr(2,2);
	int d = stoi(b);
	int e = stoi(c);
	if(d == 0){
		if(e == 0 || e > 12){
			cout << "NA";
		}else{
			cout << "YYMM";
		}
	}else if(e == 0){
		if(d == 0 || d > 12){
			cout << "NA";
		}else{
			cout << "MMYY";
		}
	}else if(d > 12){
		if(e > 12){
			cout << "NA";
		}else{
			cout << "YYMM";
		}
	}else if(d < 12){
		if(e > 12){
			cout << "MMYY";
		}else{
			cout << "AMBIGUOUS";
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <functional>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,j,n) for(int i=j;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    ll a,b;
	cin >> a>> b;
    ll c = ((a-1)/4+1)*4;
    ll d = (b/4)*4;
    ll ans=0;
    fr(i,c-a){
      ans = ans^(a+i);
    }
    fr(i,b-d+1){
      ans = ans^(d+i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<28)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    vector<int> l(2 * n);
    ll ans = 0;
    rep(i, 0, 2 * n) cin >> l[i];
    sort(all(l));
    for (int i = 0; i < 2 * n; i += 2) {
        ans += min(l[i], l[i+1]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
if __name__ == "__main__":
    x, y, a, b, c = map(int, input().split())
    p = list(map(int, input().split()))
    q = list(map(int, input().split()))
    r = list(map(int, input().split()))

    p = sorted(p, reverse=True)
    q = sorted(q, reverse=True)

    t_p = p[0:x]
    t_q = q[0:y]

    lst = t_p + t_q + r

    lst = sorted(lst, reverse=True)

    print(sum(lst[0:x+y]))

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

using namespace std;

int N, nr, bit[209];
long long a[209], base[209];
char t[209];

bool add (long long val)
{
    for (int i=1; i<=nr; i++)
        if (val & (1LL << bit[i]))
            val ^= base[i];
    if (val != 0)
    {
        bit[++nr] = 0, base[nr] = val;
        while ((val & (1LL << bit[nr])) == 0)
            bit[nr] ++;
        for (int i=1; i<nr; i++)
            if (base[i] & (1LL << bit[nr]))
                base[i] ^= base[nr];
        return 1;
    }
    return 0;
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

int tests;
scanf ("%d", &tests);
while (tests --)
{
    scanf ("%d", &N);
    for (int i=1; i<=N; i++)
        scanf ("%lld", &a[i]);
    scanf ("\n%s\n", t + 1);
    nr = 0;
    bool win0 = 1;
    for (int i=N; i>=1; i--)
        if (t[i] == '0') add (a[i]);
        else
        if (add (a[i]))
        {
            win0 = 0;
            break;
        }
    if (win0) printf ("0\n");
    else printf ("1\n");
}

return 0;
}


Measured memory_bytes: 3664
import math
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def factorization(n):
    arr = []
    for i in range(2,int(math.sqrt(n))+1):
        cnt = 0
        if n % i == 0:
            while n % i ==0:
                n //= i
                cnt +=1
            #arr.append([i,cnt])
            arr.append(cnt)
    if n != 1:
        #arr.append([n,1])
        arr.append(1)
    return arr
N = int(read())
arr = factorization(N)
ans = 0 
for a in arr:
  for i in range(1,50):
    if a-i>=0:
      a -=i
      ans +=1
    else:
      break
print(ans)
      

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

int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed;
  int n;
  cin >> n;
  vector<long long> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<long long> pre(n + 1);
  pre[0] = 1e18;
  for (int i = 1; i <= n; i++) {
    pre[i] = min(pre[i - 1], arr[i - 1]);
  }
  long long ans = -1e18;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, arr[i - 1] - pre[i - 1]);
  }
  cout << ans << '\n';}


Measured memory_bytes: 5996
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();

		// 計算
		int result = 0;
		if(a >= 13){
		    result = b;
		}else if(a >= 6){
		    result = b/2;
		}
		
		// 出力
		System.out.println(result);
	}
}

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

using namespace std;

struct DATA{
  int x;
  int count;
};

vector<DATA> MakeData(int);
DATA MakeOneData(int, int);

int main(){
  int i, j, n, m, count;
  vector<DATA> data1, data2;

  while(1){
    cin >> n >> m;
    if(n == 0 && m == 0) break;

    data1 = MakeData(n);
    data2 = MakeData(m);

    i = 0;
    j = 0;
    count = 0;
    while(i != data1.size() && j != data2.size()){
      if(data1[i].x == data2[j].x){
	count += (data1[i].count * data2[j].count);
	++i;
	++j;
      }else if(data1[i].x < data2[j].x){
	++i;
      }else{
	++j;
      }
    }

    cout << count << endl;
  }
  return 0;
}

vector<DATA> MakeData(int n){
  int i, j, x, count;
  vector<int> data1, data2;
  DATA _data;
  vector<DATA> data;

  for(i=0; i<n; ++i){
    cin >> x;
    data1.push_back(x);
  }
  for(i=0; i<data1.size(); ++i){
    for(j=i, x=0; j<data1.size(); ++j){
      x += data1[j];
      data2.push_back(x);
    }
  }

  sort(data2.begin(), data2.end());

  for(i=1, count=1; i<data2.size(); ++i){
    if(data2[i] == data2[i-1]){
      ++count;
    }else{
      data.push_back(MakeOneData(data2[i-1], count));
      count = 1;
    }
  }
  data.push_back(MakeOneData(data2[data2.size()-1], count));
  return data;
}

DATA MakeOneData(int n, int m){
  DATA data;
  data.x = n;
  data.count = m;
  return data;
}

Measured memory_bytes: 12000
n = int(input())
abc = [tuple(map(int, input().split())) for _ in range(n)]


dp = [[0, 0, 0] for _ in range(n+1)]
for i in range(n):
    for place_y in range(3):
        for place in range(3):
            if place_y != place:
                dp[i+1][place] = max(
                    dp[i+1][place], dp[i][place_y]+abc[i][place]
                )

print(max(dp[n]))


Measured memory_bytes: 40176
#include <iostream>
#include <cstring>
using namespace std;
string s,t;
int n;
int main(){
	cin>>n;
	cin>>s>>t;
	for(int i=0;i<n;i++){
		for(int j=0;j<2;j++){
			if(j==0)cout<<s[i];
			else cout<<t[i];
		}
	}
	return 0;
}

Measured memory_bytes: 256
def getLast(d, i):
    if last_d[i] == 0:
        return 0
    return d - last_d[i]

def calcC(d):
    res = 0
    for i in range(26):
        res = res + C[i] * getLast(d, i)
    return res

def getBestd(d):
    preLast_d = last_d[25]
    last_d[25] = d
    res = S[d][25] - calcC(d)
    last_d[25] = preLast_d
    res_i = 25
    now = 0
    for i in range(25):
        preLast_d = last_d[i]
        now = S[d][i] - calcC(d)
        last_d[i] = preLast_d
        if res > now:
            res = now
            res_i = i
    return res, res_i

D = int(input())
C = list(map(int, input().split()))
S = []
for i in range(D):
    s = list(map(int, input().split()))
    S.append(s)

score = 0

last_d = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

T = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]

resT = []

for d in range(D):
    now, i = getBestd(d)
    score = score + now
    last_d[i] = d
    resT.append(T[i])

for i in range(D):
    print(resT[i])


Measured memory_bytes: 9380
#include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define F first
#define S second
#define pll pair<ll,ll>
#define pii pair<int,int>
#define len(s) s.length()
#define all(v) v.begin(),v.end()
const ll INF = INT_MAX;
const int N = 2e5 + 5;
const ll mod = 1000000007 ;
using namespace std;

int main() {


	ios_base::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);


	ll tc = 1;
	// cin >> tc;
	while (tc--) {

		ll n, m, l, r;
		ll i, j;
		ll x, y;

		cin >> x >> y;

		cout << x*y << endl;

	}
}

Measured memory_bytes: 3648
dur=int(input())
c=list(map(int,input().split()))
d=[0]*26
r=4.17
for i in range(dur):
  t=0
  s=list(map(int,input().split()))
  m=-1<<64
  for j in range(26):
    alt=s[j]+r*c[j]*(i+1-d[j])+sum([-r*c[k]*(i+1-d[k]) for k in range(26)])
    if alt>m:
      m=alt
      t=j
  print(t+1)
  d[t]=i+1


Measured memory_bytes: 69672
#include<iostream>
#include<functional>
#include<algorithm>
using namespace std;
int main(){
int a,b,c[100000],d[100000],e;
  e=0;
  cin>>a>>b;
  for(int i=0;i<b;i++){
  cin>>c[i]>>d[i];
  }
  sort(c,c+b,greater<int>());
  sort(d,d+b);
  for(int i=0;i<1000000;i++){
  if(c[0]<=i&&i<=d[0]){e++;}
  }
  if(a>=e){cout<<e;}
  else cout<<a;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

struct BIT {
  int n;
  vector<long long> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, long long x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  long long sum(int i) {
    long long x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  long long sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};

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

    int n,q;
    cin >> n >> q;
    vector<int> c(n);
    for(int i = 0; i < n; i++) cin >> c[i], c[i]--;

    vector<pair<pair<int,int>,int>> pq;
    for(int i = 0; i < q; i++){
        int l,r;
        cin >> l >> r;
        l--;r--;
        pq.push_back(make_pair(make_pair(l,r),i));
    }

    vector<int> memo(n,-1);
    vector<pair<int,int>> cp;
    for(int i = 0; i < n; i++){
        if(memo[c[i]] != -1) cp.push_back(make_pair(memo[c[i]],i));
        memo[c[i]] = i;
    }

    sort(pq.rbegin(),pq.rend());
    sort(cp.rbegin(),cp.rend());

    BIT tree(n);
    vector<int> ans(q,0);

    int ncp = 0;
    for(int i = 0; i < q; i++){
        while(true){
            if(ncp < (int)cp.size() && pq[i].first.first <= cp[ncp].first){
                tree.add(cp[ncp].second,1);
                ncp++;
            } else break;
        }
        ans[pq[i].second] = pq[i].first.second-pq[i].first.first+1;
        ans[pq[i].second] -= tree.sum(pq[i].first.second);
    }

    for(int i = 0; i < q; i++) cout << ans[i] << endl;


    return 0;
}

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

#define ll long long

int main() {
    int N;
    int Q;
    scanf("%d%d\n", &N, &Q);
    string S;
    getline(cin, S);
    int arr[N + 1];
    for(int i = 0;i < N + 1;i++) {
        arr[i] = 0;
    }
    for(int i = 1;i < N + 1;i++) {
        if(i < 2) {
            arr[i] = arr[i - 1];
        }else if(S[i - 2] == 'A' && S[i - 1] == 'C') {
            arr[i] = arr[i - 1] + 1;
        }else{
            arr[i] = arr[i - 1];
        }
    }
    int l[Q];
    int r[Q];
    for(int q = 0;q < Q;q++) {
        scanf("%d%d", &l[q], &r[q]);
    }

    for(int q = 0;q < Q;q++) {
        printf("%d\n", arr[r[q]] - arr[l[q]]);
    }
    return 0;
}


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


int main(){
    int n, cntl = 0, cntr = 0;
    cin >> n;
    vector<int> l(n+1), r(n+1);
    string s;
    cin >> s;
    l[0] = 0;
    r[n] = 0;
    rep(i,n){
        if (s[i] == 'W') cntl ++;
        l.at(i+1) = cntl;
    }
    rep(i,n){
        if (s[n-i-1] == 'E') cntr ++;
        r.at(n-i-1) = cntr;
    }
    int ans = n;
    rep(i,n){
//      cout << l.at(i) << " " << r.at(i+1) << endl;
        ans = min(ans, l.at(i) + r.at(i+1));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3204