akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
map<string,int>a;
string s[200005],s1[200005];
int maxn,numb;
int n,k;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        cin>>s[i];
        a[s[i]]++;
        if(a[s[i]]==maxn)
        {
          s1[++numb]=s[i];
        }
        else if(a[s[i]]>maxn)
        {
            s1[1]=s[i];
            maxn++;
            numb=1;
        }
    }
    sort(s1+1,s1+numb+1);
    for(int i=1;i<numb;i++)
    {
           cout<<s1[i];
            puts("");
    }
    cout<<s1[numb];
    return 0;
}


Measured memory_bytes: 28288
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    string A,B,C;
    cin >>A>>B>>C;
    
    cout << A[0]<<B[1]<<C[2] << endl;


    return 0;
    

}

Measured memory_bytes: 3604
import collections
n,k=map(int, input().split())
r,s,p=map(int, input().split())
t = list(input())

ans = 0
tk = ['0'] * n
for i in range(len(t)):
    if i < k:
        if t[i] == 'r':
            tk[i] = 'p'
        elif t[i] == 's':
            tk[i] = 'r'
        else:
            tk[i] = 's'
    else:
        if t[i] == 'r' and tk[i-k] != 'p':
            tk[i] = 'p'
        elif t[i] == 's' and tk[i-k] != 'r':
            tk[i] = 'r'
        elif t[i] == 'p' and tk[i-k] != 's':
            tk[i] = 's'
        else:
            continue
c = collections.Counter(tk)
print(c['r']*r + c['s']*s + c['p']*p)

Measured memory_bytes: 5052
/*
 *  Created on: 5 / 8 / 2020
 *  Author:     Eslam Waheed
 */

#define _CRT_SECURE_NO_WARNINGS
//#define __USE_MINGW_ANSI_STDIO

#include <bits/stdc++.h>
//#include <bits/BIGINT.h>
//#include <bits/Int128.h>
using namespace std;

#define Eslam__Waheed ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

#define ll   long long
#define ull  unsigned ll
#define dd   double
#define ld   long dd
#define ss   string

#define pb      push_back
#define all(c)  c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define stp(n)  cout << fixed << setprecision(n);
#define iq(v)   v.resize(unique(v.begin(),v.end())-v.begin())
#define sz(s)   (ll)(s.size())
#define endl    '\n'

#define loop(i,m,n)  for(ll i=m;i<n;i++)
#define test(t)      while(t--)

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

//const ld PI = acos(-1);
//const ll mod = 1e9 + 7;
//const ld EPS = 1e-8;
/*
 you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )
*/
int main()
{
	//stp(0)
	Eslam__Waheed;
	ll l, r, d; cin >> l >> r >> d;
	--l; 
	ll a = l / d;
	ll b = r / d;
	cout << b - a;
}

Measured memory_bytes: 3548
#include <iostream>
using namespace std;
int main(){
  int n,d,x,c=0;
  cin>>n;
  cin>>d>>x;
  int a[100];
  for (int i=0;i<n;i++){
    int tmp;
    cin>>tmp;
    a[i]=tmp;
  }
    for (int i=0;i<n;i++){
      int k=0;
      while(true){
        if (a[i]*k+1<=d) c++;else break;
        k++;
      }
    }

  cout<<c+x<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0;i<n;i++)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;

int main(int argc, char const *argv[]) {
    ll x;
    vector<ll> v(10001);
    cin >> x;
    rep(i, 5000){
        v[i]=i*i*i*i*i;
    }
    rep(i, 5000){
        ll b=v[i];
        rep(j, 5000){
            ll a=v[j];
            if(a-b==x){
                cout << j << " " << i << endl;
                return 0;
            }else if(a+b==x){
                cout << j << " " << -i << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3704
// In The Name Of God
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define sqr(A) ((A) * (A))
#define X first
#define Y second
#define MP make_pair
#define bsz  __builtin_popcount
#define all(A) A.begin(), A.end()
using namespace std;
using namespace __gnu_pbds;
template < typename T >
using ordered_set = tree < T , null_type , less < T > , rb_tree_tag , tree_order_statistics_node_update >;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
const int MOD2 = 1e9 + 9;
const int PR = 727;
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;

const int N = 1e2 + 20;
const int M = 1e5 + 20;
ll w[N], v[N], n, dp[2][M], W;

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> W;
	for (int i = 0; i < n; i++)
		cin >> w[i] >> v[i];
	for (int i = 0; i <= W; i++)
		if (i >= w[0])
			dp[0][i] = v[0];
	for (int i = 1; i < n; i++)
		for (int j = 0; j <= W; j++) {
			dp[i % 2][j] = dp[1 - (i % 2)][j];
			if (j >= w[i])
				dp[i % 2][j] = max(dp[i % 2][j], dp[1 - (i % 2)][j - w[i]] + v[i]);
		}
	cout << dp[1 - (n % 2)][W] << endl;
}



Measured memory_bytes: 1792
/*input
1
*/
#include <bits/stdc++.h>
using namespace std;

namespace my_template {
	typedef long long ll;
	typedef long double ld;
	typedef complex<ld> cd;

	typedef pair<int, int> pi;
	typedef pair<ll,ll> pl;
	typedef pair<ld,ld> pd;

	typedef vector<int> vi;
	typedef vector<vi> vii;
	typedef vector<ld> vd;
	typedef vector<ll> vl;
	typedef vector<vl> vll;
	typedef vector<pi> vpi;
	typedef vector<vpi> vpii;
	typedef vector<pl> vpl;
	typedef vector<cd> vcd;
	typedef vector<pd> vpd;
	typedef vector<bool> vb;
	typedef vector<vb> vbb;
	typedef std::string str;
	typedef std::vector<str> vs;

	#define x first
	#define y second
	#define debug(...) cout<<"["<<#__VA_ARGS__<<": "<<__VA_ARGS__<<"]\n"

	const ld PI = 3.14159265358979323846264338327950288419716939937510582097494L;

	template<typename T>
	pair<T, T> operator+(const pair<T, T> &a, const pair<T, T> &b) { return pair<T, T>(a.x + b.x, a.y + b.y); }
	template<typename T>
	pair<T, T> operator-(const pair<T, T> &a, const pair<T, T> &b) { return pair<T, T>(a.x - b.x, a.y - b.y); }
	template<typename T>
	T operator*(const pair<T, T> &a, const pair<T, T> &b) { return (a.x * b.x + a.y * b.y); }
	template<typename T>
	T operator^(const pair<T, T> &a, const pair<T, T> &b) { return (a.x * b.y - a.y * b.x); }

	template<typename T>
	void print(vector<T> vec, string name = ""){
		cout << name;
		for(auto u: vec)
			cout << u << ' ';
		cout << '\n';
	}
}
using namespace my_template;

const int MOD = 1000000007;
const ll INF = std::numeric_limits<ll>::max();
const int MX = 100101;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int x;
	cin >> x;
	x = 1- x;
	printf("%d ", x);
}

/* Look for:
* special cases (n=1?)
* overflow (ll vs int?)
* the exact constraints (multiple sets are too slow for n=10^6 :( ) 
* array bounds
*/
	

Measured memory_bytes: 3784
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() int {
	_ = scanInt(sc)
	s := scanString(sc)
	v := 0
	max := v
	for i := 0; i < len(s); i++ {
		switch s[i] {
		case 'I':
			v++
		case 'D':
			v--
		}
		if max < v {
			max = v
		}
	}
	return max
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


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

using namespace std;

#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define MP make_pair
#define PB push_back
#define PH push
#define fst first
#define snd second
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;

const ll INF = 1e18;
const int m[] = {2, 3, 5};

ll n, d;
ll c[3];
map<ll, ll> mp;

ll myMin(ll x, ll d, ll f){
	return (x > (ldb)f / d ? f : x * d);
}

inline ll solve(ll x){
	if(mp.find(x) != mp.end())
		return mp[x];
	if(!x)
		return 0;
	ll &ret = mp[x], nx1, nx2, res1, res2;
	ret = myMin(x, d, INF);
	FOR(i, 0, 3){
		for(nx1 = x, res1 = 0; nx1 % m[i]; ++nx1, res1 += d);
		for(nx2 = x, res2 = 0; nx2 % m[i]; --nx2, res2 += d);
		if(res1 <= res2){
			ret = min(ret, solve(nx1 / m[i]) + res1 + c[i]);
		}
		if(res1 >= res2){
			ret = min(ret, solve(nx2 / m[i]) + res2 + c[i]);
		}
	}
	return ret;
}

int main(){
	int T;
	for(scanf("%d", &T); T--; ){
		scanf("%lld%lld%lld%lld%lld", &n, &c[0], &c[1], &c[2], &d);
		mp.clear();
		printf("%lld\n", solve(n));
	}
	return 0;
}


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


int main() {
  int n;
  cin >> n;
  int x = 1;
  while (x <= n) {
    x *= 2;
  }
  cout << x/2 << endl;

}

Measured memory_bytes: 256
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1

//{
#pragma GCC optimize ("O3","unroll-loops")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}



main(){
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	int x=-1,y=-1;
	for(int i=0;i<=f;i+=100*a){
		for(int j=0;i+j<=f;j+=100*b){
			for(int k=0;i+j+k<=f;k+=c){
				for(int l=0;i+j+k+l<=f;l+=d){
					if(i+j+k+l==0||(100+e)*(k+l)>e*(i+j+k+l))continue;
					if(x==-1||x*(i+j+k+l)<y*(k+l)){
						x=k+l;
						y=i+j+k+l;
					}
				}
			}
		}
	}
	dump(y,x);
}

Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

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


// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
} 

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
	cin >> n >> k;

  	vector<int> v(n);
	for(int i =0 ;i< n; ++i)
	{
		cin >> v[i];
	}
	sort(v.begin(),v.end());
	ll sol  = 0;
	for(int i = 0 ;  i < max(0,n - k); ++i)
	{
		sol+=v[i];
	}	
  
	cout << sol;
    return 0;
}

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

#define EB emplace_back
#define int long long
#define F first
#define S second
#define N 100005
#define ALL(x) x.begin(),x.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)


using namespace std;


int32_t main()
{
    IOS;

    int tt=1;
	//cin >> tt;
	while (tt--)
	{
		string s; cin >> s;
		for (int i = 0; i < s.size(); i++)
		{
			if(s[i] == '7') return cout << "Yes",0;
		}
		
		cout << "No";
		
		
	}
    return 0;
}


Measured memory_bytes: 3648
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
n = int(input())
k = int(input())
x = list(map(int, input().split()))
ans = 0
for i in x:
    ans += min(abs(i), abs(i - k)) * 2
print(ans)

Measured memory_bytes: 5176
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N;
int A[310];
double dp[310][310][310];
bool used[310][310][310];

double dfs(int x, int y, int z)
{
	if (!x && !y && !z)return 0.0;
	if (used[x][y][z])return dp[x][y][z];
	used[x][y][z] = true;

	double res = (double)N / (x + y + z);
	if (x > 0)res += dfs(x - 1, y, z)*(double)x / (x+y+z);
	if (y > 0)res += dfs(x + 1, y - 1, z)*(double)y / (x + y + z);
	if (z > 0)res += dfs(x, y + 1, z - 1)*(double)z / (x + y + z);
	dp[x][y][z] = res;
	return res;
}

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

	int C[3] = { 0 };
	cin >> N;
	rep(i, 0, N)
	{
		cin >> A[i];
		C[A[i] - 1]++;
	}

	printf("%.15lf\n", dfs(C[0], C[1], C[2]));

	return 0;
}

Measured memory_bytes: 256256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
ll powmod(ll n, ll k, ll m) {
ll r=1;
 for(; k>0; k >>=1) {
   if(k&1) r=(r*n)%m;
   n=(n*n)%m;
 }
  return r;
}

ll fact(ll n) {
ll a=1;
rep(i,n) {
a=a*(n-i);
}
return a;
}

ll pow(ll a, ll b) {
ll x=1;
rep(i,b) {
x=x*a;
}
return x;
}



int main() {
ll N;
  cin >>N;
ll sum=0;
  repl(i,1,N) {
    ll A=N-i;
 
    int a, ans = 1;
  a=A;
    
    

  for (int i = 2; i <= sqrt(a); i++) {
    int cnt = 0;
    while (a % i == 0) {
      cnt++;
      a /= i;
    }
    ans *= (cnt + 1);
    if (a == 1) break;
  }
  if (a != 1) ans *= 2;

  
    
    
    
    

    sum+=ans;
  }
    
    
    
    
    
  
  cout<<sum<<endl;
}

    

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define ll long long
#define p pair<int, int>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<p> v;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        v.push_back(p(a[i], i));
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    int id1 = v[0].second;
    for (int i = 0; i < n; i++) {
        if (i == id1) {
            cout << v[1].first << endl;
        } else {
            cout << v[0].first << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 4080
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

//using namespace __gnu_pbds;
using namespace std;

typedef  long long ll;
typedef long double ld;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define endl "\n"
#define ioss ios::sync_with_stdio(0);cin.tie(0);
#define pb push_back
#define eb emplace_back



double startTime;
double gct()//get_current_time
{
    return ((double)clock()-startTime)/CLOCKS_PER_SEC;
}

void suraj();

int main()
{
    startTime=(double)clock();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt,"w",stdout);
    //ioss
    //int t;cin>>t;while(t--)
    suraj();
    //suraj2();
    //suraj3();
    //suraj4();
    return 0;
}


































const int mod=1e9+7,mx_h=1000,mx_w=1000;

void suraj(){
int h,w;cin>>h>>w;
vector<string>v(h);for(string &i:v)cin>>i;
vector<vector<int>>dp(h,vector<int>(w));
for(auto &i:dp){
    for(int &j:i)
        j=0;
}
dp[0][0]=1;
for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
        if(v[i][j]=='#'){
            dp[i][j]=0;
        }
        else{
            if(i-1>=0&&j-1>=0)
        dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
            else if(i-1>=0)
                dp[i][j]=dp[i-1][j];
            else if(j-1>=0)
                dp[i][j]=dp[i][j-1];
    }
    }
}
/*for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
        cout<<dp[i][j];
    }cout<<endl;
}*/
cout<<dp[h-1][w-1]%mod<<endl;
}//













Measured memory_bytes: 9504
#include <bits/stdc++.h>
 
using namespace std;
 
#define BOOST        std::ios::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define sp           <<" "<<
#define ll           long long
#define ld           long double
#define AZI(i,x)     for(auto i=x.begin();i!=x.end();i++)
#define AZ(x)        x.begin(),x.end()
#define P(x,y)       pair < x,y >
#define V(x)         vector < x >
#define fi           first
#define se           second
#define pb           push_back
#define mp           make_pair
#define PI           3.14159265358979323846264338327950288419716939937510
 
const ll mod=1e9+7,N=1e5+5,INF = 1e18;

int n,k;
ll a[3005];
ll dp[3005][3005]={}; 
bool chk[3005][3005]={}; 

ll deq(int i1,int i2,bool turn)
{
    if(i1>i2)
        return 0;
    
    if(chk[i1][i2])
        return dp[i1][i2];

    chk[i1][i2] = 1;
    
    if(turn)
        return dp[i1][i2] = i1==i2 ? a[i1]:max( a[i1] + deq(i1+1,i2,!turn), a[i2] + deq(i1,i2-1,!turn));

    else
        return dp[i1][i2] = i1==i2 ? -a[i1]:min( -a[i1] + deq(i1+1,i2,!turn), -a[i2] + deq(i1,i2-1,!turn));
}

int main() 
{ 
    BOOST

    cin>>n;

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


Measured memory_bytes: 78592
N,X,M = map(int,input().split())
R = [X]
dr = {}
for i in range(M):
    dr[i] = 0
m = min(N,M)
for i in range(m):
    r = R[-1]
    r = r**2%M
    if dr[r] == 1:
        break
    R.append(r)
    dr[r] = 1
for i in range(len(R)):
    if r == R[i]:
        break
a = 0
b = sum(R)
for j in range(i):
    a += R[j]
    b -= R[j]
n = len(R) - i
t = N - i
p = t // n
q = t % n
c = 0
for j in range(q):
    c += R[i+j]
ans = a + b*p + c
print(ans)

Measured memory_bytes: 19444
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val ab = Array.fill(2)(sc.next).mkString("").toInt

    val r = Math.sqrt(ab).toInt
    if (r * r == ab) "Yes" else "No"
  }
}


Measured memory_bytes: 25420
package main

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

func main() {
	sc := NewScanner()
	N, K := sc.NextInt(), sc.NextInt()
	V := map[int]int{}

	for i := 0; i < N; i++ {
		a, b := sc.NextInt(), sc.NextInt()
		V[a] += b
	}

	ks := make([]int, len(V))
	i := 0
	for k, _ := range V {
		ks[i] = k
		i++
	}
	sort.Ints(ks)

	t := 0
	for i := 0; i < len(V); i++ {
		t += V[ks[i]]
		if t >= K {
			fmt.Println(ks[i])
			return
		}
	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 7552
//
// Created by chuta on 2020/09/19.
//

#include <bits/stdc++.h>
//#include <atcoder/all>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main() {
    //CFS;
    ll n, x, m;
    cin >> n >> x >> m;
    ll ans = 0;
    vi tim(m, -1);
    vl rui(m, 0);
    rep(i, n) {
        if (tim[x] != -1) {
            ll k = i - tim[x];
            ll d = ans + x - rui[x];
            ans += d * ((n-i) / k);
            rep(j, (n-i) % k) {
                ans += x;
                x = x * x % m;
            }
            break;
        }
        ans += x;
        tim[x] = i;
        rui[x] = ans;
        x = x * x % m;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4244
A,B,K = map(int,input().split())
numbers_list = []
min_number = min(A,B)
for i in range(1,min_number+1):
    if A%i==0 and B%i==0:
        numbers_list.append(i)
        #print(numbers_list)
numbers_list.reverse()
answer = numbers_list[K-1]
print(answer)
    

Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
#include<string.h>
#include<set>
#include<algorithm>
using namespace std;

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

    int rec=0,max=0;
    for(int i=0;i<a;++i){
        switch(b[i]){
            case 'I':++rec;break;
            case 'D':--rec;break;
        }
        if(rec>max)max = rec;
    }
    cout<<max;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
using namespace std;

int main(){
    int N, T;
    cin >> N >> T;
    int c[N];
    int t[N];
    int min_cost = 1001;
    bool is_kaeru = false;
    for(int i = 0; i < N; i++){
        cin >> c[i] >> t[i];
        if(t[i] <= T){
            is_kaeru = true;
            min_cost = min(min_cost, c[i]);
        }   
    }
    if(is_kaeru == true){
        cout << min_cost << endl;
    }else{
        cout << "TLE" << endl;
    }

    return 0;
}

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

using namespace std;

int n, a, b;
vector <int> ans;

void imp(){
	printf("-1\n");
	exit(0);
}

int getlis(){
	set < int > s;
	set < int > :: iterator it;
	for(auto u : ans){
	    s.insert(u);
	    it = s.upper_bound(u);
	    if(it != s.end())
	        s.erase(it);
	}
	return s.size();
}

void check(){
	if(getlis() != a) imp();
	reverse(ans.begin(), ans.end());
	if(getlis() != b + 1) imp();
	reverse(ans.begin(), ans.end());
}

int main(){
	scanf("%d %d %d", &n, &a, &b);
	if(a + b - 1 > n) imp();
	if(b == 1 && n - a != 0) imp();
	for(int i = a - 1; i >= 0; --i){
		ans.push_back(n - i);
	}
	int cur = n - a;
	vector <int> Ans;
	b -= 1;
	while(cur > 0){
		int st = max(1, cur - b + 1);
		int en = cur;
		for(int i = st; i <= en; ++i){
			Ans.push_back(i);
		}
		cur = st - 1;
	}
	reverse(Ans.begin(), Ans.end());
	for(auto u : Ans) ans.push_back(u);
	check();
	for(auto u : ans) printf("%d ", u);
	printf("\n");
	return 0;
}


Measured memory_bytes: 15472
n=int(input())
a=list(map(int,input().split()))
import collections
a=collections.Counter(a)
a=a.most_common()
ans=0
l=len(set(a))
for i in range(l):
  if a[i][0]>a[i][1]:
    ans+=a[i][1]
  if a[i][0]<a[i][1]:
    ans+=a[i][1]-a[i][0]
print(ans)

Measured memory_bytes: 21236
import heapq
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]
earn = 0
AB.sort(key=lambda x:x[0])
pos=0
cando=[]
for remain in range(M+1):
    for i in range(pos,len(AB)):
        if AB[i][0] <= remain:
            heapq.heappush(cando, -AB[i][1])
            pos=i+1
        else:
            pos=i
            break
    if cando:
        earn-=heapq.heappop(cando)
print(earn)


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

int main() {
  vector<string> ss(3);
  for (int i = 0; i < 3; i++) {
    cin >> ss[i];
  }
  string t = "";
  for (string s : ss) {
    t += toupper(s[0]);
  }
  cout << t << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int W=sc.nextInt();
		int H=sc.nextInt();
		int x=sc.nextInt();
		int y=sc.nextInt();
		int count=0;
		double res=(double)W*(double)H/2;
		if(2*x==W && 2*y==H) count=1;
		
		System.out.println(String.format("%.6f", res)+" "+count);
	}

}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){
  
  int a,b,c,x;
  cin >> a >> b >> c >> x;
  int res = 0;
  REP(i,a+1)REP(j,b+1)REP(k,c+1)if(i*500+j*100+k*50 == x)res++;
  cout << res << endl;


  return 0;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        int num;
        cin >> num;
        N -= num;
    }
    if (N < 0) cout << "-1" << endl;
    else cout << N << endl;
    return 0;
}

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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define long long long
#define db double
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
template <class T> inline void chmin(T &a, const T& val) { if (a > val) a = val; }
template <class T> inline void chmax(T &a, const T& val) { if (a < val) a = val; }
template <class T> long sqr(T a) { return 1ll * a * a; }
template <class T> void compress(T &a){
  sort(all(a)); a.resize(unique(all(a)) - a.begin());  
}

const db pi = acos(-1.00);
const db eps = 1e-6;
const int INF = 1e9;
const int MOD = 1e9+7;
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {-1, 1, 0, 0};

int main()
{
  fastio;
  int res = 0; string s, t;
  cin >> s >> t;
  for (int i = 0; i < s.size(); i++) res += (s[i] != t[i]);
  cout << res;
  return 0;
}

Measured memory_bytes: 3864
a = input()
a = a.split(' ')
stack = []
for i in a:
    if i == '+' or i == '-' or i == '*':
        s = int(stack.pop())
        t = int(stack.pop())
        if i == '+':
            u = t + s
        if i == '-':
            u = t - s
        if i == '*':
            u = t * s
        stack.append(u)
    else:
        stack.append(i)

print(stack.pop())

Measured memory_bytes: 7672
#include <stdio.h>

  int main()

{

  int n, a, i, max = -1000000, min = 1000000;

  long long sum = 0;

  scanf("%d", &n);

  for (i = 0; i < n; i++) {

    scanf("%d", &a);

    if (max < a) {

      max = a;

    }

    if (min > a) {

      min = a;

    }

    sum += a;

  }

  printf("%d %d %lld\n", min, max, sum);

  return 0;

}

Measured memory_bytes: 600
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int a, b;
		
		a = sc.nextInt();
		b = sc.nextInt();
		
		if(a < b)
			System.out.println("a < b");
		else if(a > b)
			System.out.println("a > b");
		else
			System.out.println("a == b");
	}
}

Measured memory_bytes: 26312
#include <iostream>
#include <math.h>
#include <vector>
#include <utility>
#include <algorithm>
#include <iomanip>
using namespace std;


double distance_town(double xi, double yi , double xj , double yj)
{
    return sqrt((xi-xj)*(xi-xj) + (yi-yj)*(yi-yj));

}

int factorial(int n)
{
    int ret = 1;
    for(int i = n; i>=1  ; i--)ret*=i;
    return ret;
}


int main()
{



    vector<pair<int,int>> town_positions;

    int n;
    cin>>n;

    double sum = 0 ;

    town_positions = vector<pair<int,int>>(n);
    vector<int> pos = vector<int>(n);

    for(int i =0 ; i<n ;i++)pos[i]=i+1;

    for(int i = 0 ; i<n ; i++)
    {   int xi; int yi;
        cin>>xi>>yi;
        town_positions[i] = make_pair(xi,yi);
    }


    do
    {
        for(int i = 1; i<n ; i++)
        {
            sum+=distance_town(town_positions[pos[i-1]-1].first,town_positions[pos[i-1]-1].second,town_positions[pos[i]-1].first, town_positions[pos[i]-1].second);
        }
    }
    while(next_permutation(pos.begin(),pos.end()));


    sum = (double)sum/(double)factorial(n);
    cout<<fixed<<setprecision(7)<<sum<<endl;

    return 0;
}


Measured memory_bytes: 256
//
//  header_useful.h
//  c++_acm
//
//  Created by 李弘辰 on 2019/7/23.
//  Copyright © 2019 李弘辰. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility> // pair
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm> // sort
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>

using namespace std;

#define ll long long
#define uchar unsigned char
#define ushort unsigned short
#define uint unsigned int
#define ulong unsigned long
#define ull unsigned long long

#define INT_INF 0x7fffffff

#define pi acos(-1)

#define mx(a,b) (a) > (b) ? (a) : (b)
#define mn(a,b) (a) < (b) ? (a) : (b)
#define mem(a,b) memset(a,b,sizeof(a))
#define fre(a) freopen(a,"r",stdin)

#define cio ios::sync_with_stdio(false); // Do not use it with "scanf" and other c input!
#define pb push_back
#define rep(i,a,b) for (int i = a;i <= b;i ++)
#define pre(i,a,b) for (int i = a;i >= b;i --)
#define REP(i,a,b) for (int i = a;i < b;i ++)

#define _read(a,s,n) rep(i,s,n) scanf("%d",a + i);
#define _READ(a,s,n) REP(i,s,n) scanf("%d",a + i);

#define _read_ll(a,s,n) rep(i,s,n) scanf("%lld",a + i);
#define _READ_ll(a,s,n) REP(i,s,n) scanf("%lld",a + i);

#define _T_(T) int T;scanf("%d",&T);while (T --)

#define itn int
#define nit int
#define inr int
#define mian main
#define ednl endl
#define fro for
#define fir for
#define reutrn return
#define retunr return
#define reutnr return


/* header_useful_h */


int main()
{
    
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d\n",a * b);
}


Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
#define INF 1000000000
const int MAX = 1000000;
const int MOD = 1000000007;


int main(){
	int n;
    cin>>n;
    vector<P> r(n);
    REP(i,n){
        int x,y;
        cin>>x>>y;
        r[i]={x,y};
    }
    double sum=0;
    REP(i,n){
        REP(j,n){
            sum+=sqrt(pow((r[i].first-r[j].first),2)+pow((r[i].second-r[j].second),2));
        }
    }
    double ans=sum/n;
    printf("%.8lf\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,x,y;
  cin >> n;
  switch(n){
    case 1:
      cout << "Hello World";
      break;
    case 2:
      cin >> x >> y;
      cout << x+y;
      break;
  }
  return 0;
}


Measured memory_bytes: 256
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    H, W = LI()
    S = [list(SS()) for _ in range(H)]

    idx_w = []
    for i in range(H):
        tmp = [-1]
        for j in range(W):
            if S[i][j] == '#':
                tmp.append(j)
        tmp.append(W)
        idx_w.append(tmp)

    idx_h = []
    for i in range(W):
        tmp = [-1]
        for j in range(H):
            if S[j][i] == '#':
                tmp.append(j)
        tmp.append(H)
        idx_h.append(tmp)

    ans = [[0] * W for _ in range(H)]
    for i in range(H):
        for j in range(len(idx_w[i]) - 1):
            for k in range(idx_w[i][j] + 1, idx_w[i][j+1]):
                ans[i][k] += idx_w[i][j+1] - idx_w[i][j] - 1

    for i in range(W):
        for j in range(len(idx_h[i]) - 1):
            for k in range(idx_h[i][j] + 1, idx_h[i][j+1]):
                ans[k][i] += idx_h[i][j+1] - idx_h[i][j] - 2

    # for i in ans:
    #     print(i)

    print(max([max(i) for i in ans]))

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 331004
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)
#define rrep(i, j, n) for(int i = (n) - 1; (j) <= i; --i)


constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;


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

	int n; cin >> n;
	map<string, int> mp;
	rep(i, 0, n) {
		string s; cin >> s;
		mp[s]++;
	}

	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <string>
using namespace std;

long long h, w;
string a[1010];
long long dp[1010][1010];

long long solve(int p, int q) {
    if (dp[p][q] >= 0) return dp[p][q];
    
    if (a[p][q] == '#') {
        dp[p][q] = 0;
    }
    else if (p == 0 && q == 0) {
        dp[p][q] = 1;
    }
    else if (p == 0) {
        dp[p][q] = solve(p, q - 1);
    }
    else if (q == 0) {
        dp[p][q] = solve(p - 1, q);
    }
    else {
        dp[p][q] = (solve(p, q - 1) + solve(p - 1, q)) % 1000000007;
    }
    
    return dp[p][q];
}


int main(void){
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        cin >> a[i];
    }
    
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            dp[i][j] = -1;
        }
    }
    
    cout << solve(h - 1, w - 1) << endl;
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
void File()
{
freopen("output.txt", "w", stdout);
freopen("input.txt", "r", stdin);
}
void yAsEr_HaFiz() {
    //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout);

 ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

 }



typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pair<int,int> > vii;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<long, long> mll;
typedef set<int> si;
typedef set<string> st;
typedef set<long> sl;
typedef pair<int, int> pii;
#define lp(i,n) for(int i = 0;i < int(n);i++)
#define rlp(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rng(i,a,b) for(int i = int(a);i <= int(b);i++)
#define mp(x,y)  	make_pair((x),(y))
#define pb(x)    	push_back((x))
#define all(v)  	((v).begin()),((v).end())
#define sz(x)  		((int) (x).size())
#define setzero(a)	memset(a,0,sizeof(a))
#define bits(a) 	__builtin_popcountll(a)
#define fr first
#define sc second
#define el      	 "\n"
#define pii pair<int, int>
#define sortva(v) sort(all(v))
#define sortvd(v) sort(v.rbegin(),v.rend())
#define sortaa(a,n) sort(a,a+n)
#define sortad(a,n) sort(a,a+n),reverse(a,a+n)
#define ndl puts("")
#define SS stringstream
#define ll long long
#define endl '\n'
#define clr(x, y) memset(x, y, sizeof(x))
#define foreach(it,x) for(__typeof__((x).begin()) it = (x).begin(); it != (x).end(); ++it)
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };




int const N = 5e5 + 9, MOD = 1e9+7 , oo = 1e9+7;
//------------------------------------------------------------------------------------









int main()
{
    yAsEr_HaFiz();

    int n;
    cin>>n;
    if (n<1200)cout<< "ABC";
    else cout<< "ARC";





















    /*
    */
return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.range, std.algorithm;

void main() {
    int[] tmp = readln.split.to!(int[]);
    int n = tmp[0], l = tmp[1];
    auto apple = iota(l, l+n).array.sort!("a * a < b * b");
    writeln(apple.sum - apple[0]);    
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#define M 5070721
#define NIL (-1)
#define L 14
typedef long long ll;
char H[M][L];

int getChar(char ch){
	if(ch=='A')return 1;
	else if(ch=='C')return 2;
	else if(ch=='G')return 3;
	else if(ch=='T')return 4;
	else return 0;
}

ll getKey(char str[]){
	ll sum=0,p=1,i;
	int len=strlen(str);
	for(i=0;i<len;i++){
		sum+=p*(getChar(str[i]));
		p*=5;
	}
	return sum;
}

int h1(int key){
	return key%M;
}

int h2(int key){
	return 1+(key%(M-1));
}

int find(char str[]){
	ll key,i,h;
	key=getKey(str);
	for(i=0;;i++){
		h=(h1(key)+i*h2(key))%M;
		if(strcmp(H[h],str)==0)return 1;
		else if(strlen(H[h])==0)return 0;
	}
	return 0;
}

int insert(char str[]){
	ll key,i,h;
	key=getKey(str);
	for(i=0;;i++){
		h=(h1(key)+i*h2(key))%M;
		if(strcmp(H[h],str)==0)return 1;
		else if(strlen(H[h])==0){
			strcpy(H[h],str);
			return 0;
		}
	}
	return 0;
}


int main(void){
	int n;
	char str[L],com[9];
	for(int i=0;i<M;i++){
		H[i][0]='\0';
	}
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%s %s",com,str);
		if(com[0]=='i'){
			insert(str);
		}else{
			if(find(str)){
				printf("yes\n");
			}else{
				printf("no\n");
			}
		}
	}
	return 0;
}



Measured memory_bytes: 72088
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

s=get_nsp.map(&:to_i)
cnt_1=s.count(1)
cnt_0=s.count(0)
if cnt_1>cnt_0
    puts cnt_0*2
else
    puts cnt_1*2
end

Measured memory_bytes: 7676
#include <bits/stdc++.h>
using namespace std;
constexpr int P = 998244353;
void inc(int &a, int b) {(a += b) >= P ? a -= P : 0;}
int dif(int a, int b) {return (a -= b) < 0 ? a += P : a;}
int power(int base, int exp) {
    int result = 1;
    while (exp > 0) {
        if (exp & 1)
            result = 1LL * result * base % P;
        base = 1LL * base * base % P;
        exp >>= 1;
    }
    return result;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    int ans = 0;
    vector<int> factorial(k + 1), inv_factorial(k + 1);
    factorial[0] = 1;
    for (int i = 1; i <= k; ++i)
        factorial[i] = 1LL * factorial[i - 1] * i % P;
    inv_factorial[k] = power(factorial[k], P - 2);
    for (int i = k; i >= 1; --i)
        inv_factorial[i - 1] = 1LL * inv_factorial[i] * i % P;
    auto binom = [&](int n, int m)->int {
        if (m < 0 || n < m)
            return 0;
        return 1LL * factorial[n] * inv_factorial[m] % P * inv_factorial[n - m] % P;
    };
    auto countPath = [&](int x, int y, int t) {
        if (t < 0)
            return 0;
        return dif(binom(x + y, x), binom(x + y, x + t));
    };
    for (int red = 0; red <= k; ++red) {
        int blue = k - red;
        if (red < blue)
            continue;
        if (red == blue)
            inc(ans, countPath(red, blue - 1, red - n + 1));
        else
            inc(ans, countPath(red, blue, red - n + 1));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4732
#include<iostream>

#define MAX 10
#define RATE 380000.0

using namespace std;

void process(int n);
int main()
{
    int n;
    
    cin >> n;
    process(n);
}

void process(int n)
{
    int i;
    double price;
    double sum;
    string type;
    
    sum = 0;
    for(i=0;i<n;i++){
        cin >> price;
        cin >> type;
        if( type == "BTC"){
            sum += price * RATE;
        }else{
            sum += price;
        }
    }
    
    cout << sum << endl;
}


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

x = [int(x) for x in input().split()][1:]
final = set(x)

for i in range(1, n):
    x = [int(x) for x in input().split()][1:]
    final = final.intersection(x)

print(len(final))

Measured memory_bytes: 3188