akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
long long cnt,all[19],dp[30][100030],prime[22]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79};
map<long long,long long>mp;
long long C(long long x,long long y){
	y=min(y,x-y);
	long long ans=1,xx[y],cnt[22];
	memset(cnt,0,sizeof(cnt));
	for(long long i=0;i<y;i++)xx[i]=x-i;
	for(long long i=1;i<=y;i++){
		long long tmp=i;
		for(long long xxx=0;xxx<22;xxx++)
			while(tmp%prime[xxx]==0)
				tmp/=prime[xxx],
				cnt[xxx]++;
	}
	for(long long i=0;i<y;i++)
		for(long long xxx=0;xxx<22;xxx++)
			while(xx[i]%prime[xxx]==0&&cnt[xxx])
				cnt[xxx]--,
				xx[i]/=prime[xxx];
	for(long long i=0;i<y;i++)ans=(ans*xx[i])%1000000007;
	return ans;
}
vector<long long>v;
long long ans=1;
int main(){
	long long n,m;
	cin>>n>>m;
	if(m==1){
		cout<<1;
		return 0;
	}
	for(long long i=2;i<=sqrt(m);i++)
		if(m%i==0)
		{
			m/=i;
			v.push_back(i);
			if(!mp[i])mp[i]=++cnt;
			i--;
		}
	v.push_back(m);
	mp[m]=++cnt;
	for(long long i=0;i<v.size();i++)
		all[mp[v[i]]-1]++;
	for(long long i=0;i<cnt;i++)
		ans=(ans*C(all[i]+n-1,n-1))%1000000007;
	cout<<ans;
}

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

typedef long long ll;

int main()
{
    int n,d;
    cin >> n >> d;
    vector< vector<int> > arr;
    for(int i = 0; i < n; i++){
        vector<int> point;
        for(int j = 0; j < d; j++){
            int p;
            cin >> p;
            point.push_back(p);
        }
        arr.push_back(point);
    }
    int count = 0;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            double ans = 0;
            for(int k = 0; k < d; k++){
                ans += (arr[i][k]-arr[j][k])*(arr[i][k]-arr[j][k]);
            }
            double sr = sqrt(ans);
            if(sr-floor(sr) == 0){
                count++;
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define sz size
#define mper make_pair
#define fe first
#define se second
#define pb push_back
#define mal ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
using namespace std;

string s;

vector < pair <char, int> > g;

ll get(ll x) {

    return x * (x + 1) / 2ll;

}

int main() {

    cin >> s;

    ll ct1 = 0, ct2 = 0;

    for(int i = 0; i < s.sz(); ++i) {

        if(s[i] == '>') {
            ct1++;

            if(ct2) {

                g.pb(mper('<', ct2));
                ct2 = 0;

            }

        }

        else if(s[i] == '<') {
            ct2++;

            if(ct1) {

                g.pb(mper('>', ct1));
                ct1 = 0;

            }

        }

    }

    if(ct1) {

        g.pb(mper('>', ct1));

    }

    else if(ct2) {

        g.pb(mper('<', ct2));

    }


    ll sum = 0;

    for(int i = 1; i < g.sz(); ++i) {

        char c = g[i].fe;

        if(c == '<') {

            sum += get(g[i].se);

        }

        else {

            if(g[i - 1].fe == '<' && g[i - 1].se <= g[i].se) {

                sum -= g[i - 1].se;
                sum += get(g[i].se);

            }

            else {

                sum += get(g[i].se - 1);

            }


        }

    }

    cout << sum + get(g[0].se);

return 0;
}


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

using namespace std;

int n;
int su(int x) {
    if (x == 0) return 0;

    int out = 0;
    while (x > 0) {
        out += x%10;
        x /= 10;
    }
    return out;
}

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

    int sol = 0x3f3f3f3f;
    for (int i = 1; i < n; i++) {
        int b = n - i;
        sol = min(sol, su(i) + su(b));
    }
    printf("%d", sol);
    return 0;
}


Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int maxN = 2 * (int)1e5 + 10;
vector < int > g[2][maxN];
int id[2][maxN];
int m[2];
int n;
int sz;
int ID;
bool used[maxN];
void dfs(int v) {
    id[ID][v] = sz;
    used[v] = true;
    for (int to : g[ID][v]) {
        if (!used[to]) dfs(to);
    }
}
map < pair < int, int >, int > mp;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    cin >> n >> m[0] >> m[1];
    for (int i = 0; i < 2; i++) {
        ID = i;
        for (int j = 0; j < m[i]; j++) {
            int a, b;
            cin >> a >> b;
            g[i][a].emplace_back(b);
            g[i][b].emplace_back(a);
        }
        sz = 0;
        memset(used, 0, sizeof used);
        for (int p = 1; p <= n; p++) {
            if (used[p]) continue;
            dfs(p);
            sz++;
        }
    }
    for (int i = 1; i <= n; i++) {
        mp[{id[0][i], id[1][i]}]++;
    }
    for (int i = 1; i <= n; i++) {
        cout << mp[{id[0][i], id[1][i]}] << " ";
    }
    return 0;
}

Measured memory_bytes: 28160
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: i64 = read();
    let m: i64 = read();

    let mut ans = 0;
    ans += 1900 * m;
    ans += 100 * (n - m);
    let mut mutm = m;

    while mutm > 0 {
        mutm -= 1;
        ans *= 2;
    }
    println!("{}", ans);
}

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


void solve(long long R){
    cout << (R < 1200 ? "ABC" : (R < 2800 ? "ARC" : "AGC")) << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long R;
    scanf("%lld",&R);
    solve(R);
    return 0;
}


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

using std::min;
using std::max;

using lint = long long int;
using pii = std::pair<int, int>;

int dat[100010];
int mini = 100100, maxi = 0;

int main(void) {
	int N;
	scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		scanf("%d", &dat[i]);
		mini = min(mini, dat[i]);
		maxi = max(maxi, dat[i]);
	}

	if (maxi - mini >= 2) {
		printf("No");
		return 0;
	}
	if (maxi - mini == 0) {
		if (maxi == N - 1 || N / maxi >= 2) {
			printf("Yes");
		}
		else {
			printf("No");
		}
	}
	else {
		int cou = 0;
		for(int i = 1; i <= N; i++){
			if (dat[i] == mini) {
				cou++;
			}
		}
		if ((N - cou) >= (maxi - cou) * 2 && cou <= mini) {
			printf("Yes");
		}
		else {
			printf("No");
		}
	}

	return 0;
}

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

N, M = map(int, raw_input().split())
start, finish = [], []
for i in range(M):
    a, b = map(int, raw_input().split())
    if a == 1:
        start.append(b)
    elif b == N:
        finish.append(a)

if set(start) & set(finish):
    print 'POSSIBLE'
else:
    print 'IMPOSSIBLE'


Measured memory_bytes: 24676
#include <bits/stdc++.h>
using ll = long long;
using namespace std;

const int inf = 1e9;
const ll linf = 1e18;

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

    int n, m; cin >> n >> m;
    cout << ((n == m) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
// #include <unordered_map>
// #include <bitset>
// #include <iomanip>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define EPS 1e-9
#define LL_INF 0x3fffffffffffffff
#define MEM(a, b) memset(a, b, sizeof(a))
#define PPER(i, n, m) for (int i = n; i >= m; i--)
#define REPP(i, n, m) for (int i = n; i <= m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define PER(i, n, m) for (int i = n; i > m; i--)
#define SA(n) scanf("%d", &(n))
#define SLLA(n) scanf("%lld", &(n))
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define DE(val) cout << #val << ": " << val << endl;
// #define DBG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
// #else
// #define DBG(...) 42
// #endif
const int dx44[6] = {0, -1, -1, 1, 1};
const int dy44[6] = {0, -1, 1, -1, 1};
const int dx4[6] = {0, 0, 1,-1};
const int dy4[6] = {1, -1, 0,0};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int dx82[9] = {0, -1, -1, 1, 1, 2, 2, -2, -2};
const int dy82[9] = {0, 2, -2, 2, -2, 1, -1, 1, -1};

void update(ll& x,ll v){
    if(x==-1)x=v;
    else if(x>v)x=v;
}
 
ll po(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
void extgcd(ll a, ll b, ll &d, ll &x, ll &y)
{
    if (!b)
    {
        d = a;
        x = 1;
    }
    else
    {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
ll inverse(ll a, ll n)
{
    ll d, x, y;
    extgcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn = 1e5 + 15;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
#define mst(x, a) memset(x, a, sizeof(x))
/*************************************************************************/


ll dp[maxn];

int main()
{   

    //  ios::sync_with_stdio(false);
    //  cin.tie(nullptr);
    ll s;
    SLLA(s);
    dp[0] = 1;
    REPP(i,1,s) {
        REPP(k,3,s) {
            if(i >= k) {
                dp[i] += dp[i-k];
                dp[i] %= mod;
            }
        }
    }
    printf("%lld\n", dp[s]);
    return 0;
 
}


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

void dfs(vector<vector<pair<int, int>>>& ver, int par, int v, int dist, vector<int>& res) {
	for(auto vx : ver[v]) {
		if(vx.first != par) {
			res[vx.first] = (dist + vx.second)% 2;
			dfs(ver, v, vx.first, res[vx.first], res);
		}
	}
}

int main() {
	int n, u, v, w;
	cin >> n;
	vector<int> res(n + 1);
	vector<vector<pair<int, int>>> ver(n +  1);
	for(int i = 0; i < n - 1; i++) {
		cin >> u >> v >> w;
		ver[u].push_back(make_pair(v, w));
		ver[v].push_back(make_pair(u, w));
	}
	res[1] = 0;
	dfs(ver, -1, 1, 0, res);
	for(int i = 1; i <= n; i++) {
		cout << res[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 9728
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

const int maxn = 200010, P = 1000000007;
int n, ans, pos[maxn], f[maxn], s[maxn];
pair<int, int> p[maxn], seg[maxn];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d %d", &p[i].second, &p[i].first), pos[i] = i;
    }
    sort(pos + 1, pos + n + 1, [&](int x, int y) { return p[x] < p[y]; });
    for (int i = 1; i <= n; i++) {
        p[pos[i]].first = i;
    }
    sort(pos + 1, pos + n + 1, [&](int x, int y) {
        return p[x].second < p[y].second; });
    for (int i = 1, j = 0; i <= n; i++) {
        j = max(j, p[pos[i]].first);
        seg[pos[i]].first = j;
    }
    for (int i = n, j = n + 1; i; i--) {
        j = min(j, p[pos[i]].first);
        seg[pos[i]].second = j;
    }
    sort(seg + 1, seg + n + 1), f[0] = s[0] = 1;
    for (int i = 1; i <= n; i++) {
        int l = lower_bound(seg, seg + i, make_pair(seg[i].second - 1, 0)) - seg;
        f[i] = (s[i - 1] - (l ? s[l - 1] : 0) + P) % P;
        s[i] = (s[i - 1] + f[i]) % P;
        if (seg[i].first == n) (ans += f[i]) %= P;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 5760
s1 = input().strip()
s2 = input().strip()
F = True
d = {}
s = {}
for i in range(len(s1)):
  if s2[i] not in s:
     s[s2[i]] = s1[i]
  elif s[s2[i]] != s1[i]:
      F = False
      break
  if s1[i] not in d:
      d[s1[i]] = s2[i]
  elif d[s1[i]] != s2[i]:
       F = False
       break
if F:
   print('Yes')
else:
   print('No')

Measured memory_bytes: 3632
#include <iostream>
#include <utility>
#include <queue>
#include <memory>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)

using namespace std;
using ll = long long;
const int mod = 1e9+7;
#define ALL(a)  (a).begin(),(a).end()


int main(){
    int a,b,q;
    cin >> a >> b >> q;
    vector<ll> s(a+2),t(b+2);

    s[0]=-2e14;
    s[1]=-1e14;
    t[0]=-2e14;
    t[1]=-1e14;

    rep(i,a) cin >> s[i+2];
    rep(i,b) cin >> t[i+2];
    
    s.push_back(1e14);
    s.push_back(2e14);
    t.push_back(1e14);
    t.push_back(2e14);
    ll x;

    rep(i,q){
        
        priority_queue<ll,vector<ll>,greater<ll> > pq;
        cin >> x;
        
        auto right_sh = lower_bound(ALL(s),x);
        auto left_sh = --lower_bound(ALL(s),x);
        auto right_te = lower_bound(ALL(t),x);
        auto left_te = --lower_bound(ALL(t),x);

        auto rs_rte = lower_bound(ALL(t),*right_sh);
        auto rs_lte = --lower_bound(ALL(t),*right_sh);
        
        auto ls_rte = lower_bound(ALL(t),*left_sh);
        auto ls_lte = --lower_bound(ALL(t),*left_sh);

        auto rt_rsh = lower_bound(ALL(s),*right_te);
        auto rt_lsh = --lower_bound(ALL(s),*right_te);

        auto lt_rsh = lower_bound(ALL(s),*left_te);
        auto lt_lsh = --lower_bound(ALL(s),*left_te);


        pq.push(abs(x-*right_sh) + abs(*rs_rte - *right_sh));
        pq.push(abs(x-*right_sh) + abs(*rs_lte - *right_sh)); 
        pq.push(abs(x-*right_te) + abs(*rt_rsh - *right_te));
        pq.push(abs(x-*right_te) + abs(*rt_lsh - *right_te)); 
        
        pq.push(abs(x-*left_sh) + abs(*ls_rte - *left_sh)); 
        pq.push(abs(x-*left_sh) + abs(*ls_lte - *left_sh)); 
        pq.push(abs(x-*left_te) + abs(*lt_rsh - *left_te)); 
        pq.push(abs(x-*left_te) + abs(*lt_lsh - *left_te));
       cout << pq.top() << endl;
    }
    return 0;
}



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

namespace abc117_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            int outmax = 0;
            String[] Lst = Console.ReadLine().Split(' ');
            int[] L = new int[Lst.Length];
            for(int i = 0; i < Lst.Length; i++)
            {
                L[i] = Convert.ToInt32(Lst[i]);
            }
            Array.Sort(L);
            Array.Reverse(L);
            for(int i = 1; i < L.Length; i++)
            {
                outmax = outmax + L[i];
            }
            if (L[0] < outmax)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);

void solve(){
    int n; cin >> n;
    vector<int> a(100001);
    for(int i=1; i<=100001; i++){
        if((1<=i && i<=9) || (100<=i && i<=999) || (10000<=i && i<=99999)){
            a[i] = a[i-1] + 1;
        }
        else{
            a[i] = a[i-1];
        }
    }
    cout << a[n] << endl;
}

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

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int k = sc.nextInt();
        int t = k;
        int b = x;

        while(x < n){
            x += b;
            k += t;

        }
        System.out.println(k);
    }
}

Measured memory_bytes: 35764
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
set<char> hina;
for (int i = 0;i < N;i++) {
  char a;
  cin >> a;
  hina.insert(a);
}
if (hina.size() == 3) cout << "Three" << endl;
else cout << "Four" << endl;




return 0;
}

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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

typedef long long ll;

int main(){
  int n;  cin >> n;
  map<string, int> mp;
  for (int i = 0; i < n; ++i){
    string s; cin >> s;
    mp[s]++;
  }
  cout << mp.size() << endl;
  return 0;
}

Measured memory_bytes: 19228
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

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

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int n;
	double a[25];
	cin >> n;
	for(int i = 0;i < n;i++) cin >> a[i];
	const int lim = 200000;
	double dp[25][lim + 10];
	for(int i = 0;i <= n;i++){
		for(int j = 1;j <= lim;j++) dp[i][j] = (i ? INF : (abs((double)j - a[0]) / a[0]));
	}
	for(int i = 0;i < n - 1;i++){
		for(int j = 1;j <= lim;j++){
			for(int k = j;k <= lim;k += j) chmin(dp[i + 1][k],max(dp[i][j],abs((double)k - a[i + 1]) / a[i + 1]));
		}
	}
	double ans = INF;
	for(int i = 1;i <= lim;i++) chmin(ans,dp[n - 1][i]);
	printf("%.14lf\n",ans);
}


Measured memory_bytes: 36024
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}



//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int main(){
int N; cin>>N;
  set<string> se;
  rep(i,N){
    string s;cin>>s;
    se.insert(s);
  }
  cout<<se.size()<<endl;
}







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

using namespace std;

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

    if (N % 2 == 0) {
        cout << N / 2 << endl;
        return 0;
    } else {
        cout << N / 2 + 1 << endl;
        return 0;
    }

}

Measured memory_bytes: 3512
#include <stdio.h>
#include<math.h>
#include <string.h>
#include <ctype.h>

int main(){
int n,f,i;
while(scanf("%d",&n)!=EOF){
f=2;
for(i=2;i<=n;i++){
f+=i;
}
printf("%d\n",f);
}

return 0;
}

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

using namespace std;
typedef long long ll;


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

    double rad;
    if (x / a > (a * b / 2)) {
        double h = 2 * (a*b - (x/a)) / a;
        rad = atan2(h , a);
    }else {
        double h = 2 * x / (a * b);
        rad = atan2(b,h);
    }


    double deg = rad / (2 * M_PI) * 360;

    printf("%.10f", deg);

}


Measured memory_bytes: 256
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e5+1);

//Required Functions

ll power(ll x,ll y) 
{ 
	if (y == 0) 
		return 1; 
	ll p = power(x, y/2) % MOD; 
	p = (p * p) % MOD; 
  
	return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work
ll dp[INIT]={0};

int main()
{
	#ifndef ONLINE_JUDGE
	if (fopen("INPUT.txt", "r"))
	{
		freopen ("INPUT.txt" , "r" , stdin);
		//freopen ("OUTPUT.txt" , "w" , stdout);
	}
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	clock_t clk;
	clk = clock();
//-----------------------------------------------------------------------------------------------------------//

	READV(N);
	READV(K);
	FORD(i,K,0)
	{
		ll cnt=K/i;
		dp[i]=power(cnt,N);
		for (ll j = 2*i; j <= K; j+=i)
		{
			dp[i]=(dp[i]-dp[j]+MOD)%MOD;
		}
	}
	ll ans=0;
	FORI(i,1,K+1)
	{
		ans=(ans+(i*dp[i])%MOD)%MOD;
	}
	cout<<ans<<endl;

//-----------------------------------------------------------------------------------------------------------//


	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

	return 0;
}

Measured memory_bytes: 4584
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
# from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, sin, pi, tan
from collections import defaultdict as dd, deque, Counter as C
# from itertools import combinations as comb, permutations as perm
# from bisect import bisect_left as bl, bisect_right as br, bisect
# from time import perf_counter
# from fractions import Fraction

# sys.setrecursionlimit(pow(10, 6))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = pow(10, 9) + 7
mod2 = 998244353


def data(): return sys.stdin.readline().strip()


def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)


def l(): return list(sp())


def sl(): return list(ssp())


def sp(): return map(int, data().split())


def ssp(): return map(str, data().split())


def l1d(n, val=0): return [val for i in range(n)]


def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


k = int(data())
s = data()
answer = []
t = True
for i in range(len(s)):
    if i + 1 > k:
        t = False
        break
    answer.append(s[i])
if not t:
    answer.append("...")
out(''.join(answer))


Measured memory_bytes: 9572
#include <cstddef>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <list>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>
#include <regex>
#include <complex>

using ll = long long;
using ull = unsigned long long;
using ld = long double;

//vector
template <class T>
using vec = std::vector<T>;

template <class T>
using vvec = vec<vec<T>>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }

constexpr ll lim = 1000000000000000ll;

int main()
{
	using namespace std;
	using std::cin;

	int n, k;
	cin >> n >> k;

	vec<int> H(n);

	for (auto& h : H)
		cin >> h;

	sort(H.rbegin(), H.rend());

	ll ans{};

	for (int i = k; i < n; ++i)
		ans += H[i];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main(){
  int N,M;
  cin >> N >> M;

  vector<long long int> a(N);
  long long int b;
  priority_queue<long long int>s;
  for(int i=0; i<N; i++){
    cin >> a[i];
    s.push(a[i]);
  }

  for(int i=0; i<M; i++){
    //std::vector<LL>::iterator maxIt = std::max_element(a.begin(), a.end());
    //size_t maxIndex = std::distance(a.begin(), maxIt);
    long long int x = s.top();
    s.pop();
    x = x/2;
    s.push(x);
    //b = a[maxIndex];
    //a.erase(maxIt);
    //a.insert(maxIt, b/2);
  }

  long long int sum=0;
  for(int i=0; i<N; i++){
    sum += s.top();
    s.pop();
    //printf("%d\n", a[i]);
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 2168
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

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

    void solve(Scanner sc) {
        int n = sc.nextInt();
        int k = sc.nextInt();
        Map<Integer, Integer> countMap = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int key = sc.nextInt();
            countMap.put(key, countMap.getOrDefault(key, 0) + 1);
        }

        ArrayList<Integer> countList = new ArrayList<>(countMap.values());
        Collections.sort(countList);
        int ans = 0;
        for (int i = 0; i < countList.size() - k; i++) {
            ans += countList.get(i);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 101040
M = 10**9+7
r = tuple(tuple((j-i) * 4 % 13 for i in range(10)) for j in range(13))
d = [1] + [0] * 12
for c in input():
    if c > "9":
        d = [(sum(d[i] for i in j)) % M for j in r]
    else:
        d = [d[((j - int(c)) * 4 % 13)] for j in range(13)]
print(d[5])

Measured memory_bytes: 3188
#include<stdio.h>

int main(void){
  int n,x=0,y=0;
  scanf("%d",&n);
  int a[n],b[n];
  for(int i=0;i<n;i++) scanf("%d",&a[i]);
  for(int i=0;i<n;i++) scanf("%d",&b[i]);
  for(int i=0;i<n;i++){
    if(a[i]>b[i]){
      x+=a[i];
      y+=b[i];
    }
  }
  printf("%d\n",x-y);
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main(void){
    double a,b,c,d,e,f,x,y;
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
        if(a==0){
            y=c/b;
            x=(f-e*y)/d;
        }
        else if(d==0){
            y=f/e;
            x=(c-b*y)/a;
        }
        else{
            y=(c-f*(a/d))/(b-e*(a/d));
            x=(c-b*y)/a;
        }
        printf("%.3f %.3f\n", x, y);
    }
    return 0;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
  int N;
  cin >> N;
  char s;
  for(int i=0;i<N;i++){
    cin >> s;
    if(s=='Y'){
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

#define BIAS 1.1

typedef struct {
	char result[16];
	int strength;
	int move_number;
} move;

int func_strength(int N, char array[]) {
	int i;
	int ans = 0;

	for(i = 0; i < N; i++)
		if(array[i] == 'o')
			ans++;

	return ans;
}

void sort_strength_order(int N, move array[]) {
	int i;
	int sorted = N - 1;
	move temp;

	while(sorted) {
		int index_last_sort = 0;
		for(i = 0; i < sorted; i++) {
			if(array[i].strength < array[i + 1].strength) {
				strcpy(temp.result, array[i].result);
				temp.strength = array[i].strength;
				temp.move_number = array[i].move_number;

				strcpy(array[i].result, array[i + 1].result);
				array[i].strength = array[i + 1].strength;
				array[i].move_number = array[i + 1].move_number;

				strcpy(array[i + 1].result, temp.result);
				array[i + 1].strength = temp.strength;
				array[i + 1].move_number = temp.move_number;

				index_last_sort = i;
			}
		}

		sorted = index_last_sort;
	}
}

int main() {
	int N;
	char judge_chart[16][16];
	move input[16];
	int rival[100][10];
	int count_rival_move[16] = {0};
	int my_move = 0;
	int pattern_num_i_lose;
	int rival_input_sum_i_lose;

	int i, j;
	int k, l;

	scanf("%d", &N);

	for(i = 0; i < N; i++) {
		scanf("%s", judge_chart[i]);
		strcpy(input[i].result, judge_chart[i]);
		input[i].strength = func_strength(N, input[i].result);
		input[i].move_number = i + 1;
	}

	sort_strength_order(N, input);

	for(i = 0; i < 100; i++) {
		for(j = 0; j < 10; j++) {
			printf("%d\n", input[my_move].move_number);
			fflush(stdout);

			scanf("%d", &rival[i][j]);
			count_rival_move[rival[i][j] - 1]++;
		}

		for(k = 0, my_move = 0; k < N; k++) {
			for(l = 0, pattern_num_i_lose = 0, rival_input_sum_i_lose = 0; l < N; l++) {
				if(input[my_move].result[l] == 'x') {
					pattern_num_i_lose++;
					rival_input_sum_i_lose += count_rival_move[l];
				}
			}

			if(rival_input_sum_i_lose / (10 * (i + 1)) > pattern_num_i_lose / N * BIAS)
				my_move++;

			else break;
/*
			if(count_rival_move[k] > (double)(1 / N) * (i + 1) * BIAS) {
				if(input[my_move].result[k] == 'x') {
					my_move++;
					break;
				}

				else if(input[my_move].result[k] == '-' && (count_rival_move[k] > (i + 1) * 0.9)) {
					my_move++;
					break;
				}
			}

			else
				continue;
*/
		}

	}

	return 0;
}

Measured memory_bytes: 1332
//#include <cstdio>
#include <iostream>

#include <cstring>

#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cassert>

using namespace std;

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;



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

   llong N;
   cin >> N;

   llong res = -1;
   for (llong d = 1; d*d <= N; ++d) {
      if ((N % d) == 0) {
         llong k = N / d;
         llong dist = (d-1) + (k-1);
         if (res < 0 || res > dist)
            res = dist;
      }
   }
   cout << res << endl;

   return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
int pos[100001];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int P;
		cin >> P;
		pos[P] = i;
	}
	set<int> S1, S2;
	S1.insert(N);
	S2.insert(1);
	ll ans = 0;
	for (ll i = N; i >= 1; i--) {
		int r = *S1.upper_bound(pos[i]);
		int l = -(*S2.upper_bound(-pos[i]));
		if (r < N) {
			int rr = *S1.upper_bound(r);
			ans += i * (rr - r)*(pos[i] - l);
		}
		if (l > -1) {
			int ll = -(*S2.upper_bound(-l));
			ans += i * (r - pos[i])*(l - ll);
		}
		S1.insert(pos[i]);
		S2.insert(-pos[i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 9984
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] strA = br.readLine().split(" ");
        String[] strB = br.readLine().split(" ");
        int[] A = Stream.of(strA).mapToInt(Integer::parseInt).toArray();
        int[] B = Stream.of(strB).mapToInt(Integer::parseInt).toArray();
        
        long monsters = 0;
        for(int i = 0; i < N; i++){
            int monster1 = Math.min(B[i], A[i]);
            A[i] -= monster1;
            B[i] -= monster1;
            monsters += monster1;
            
            if ( B[i] > 0 ){
                int monster2 = Math.min(B[i], A[i+1]);
                A[i+1] -= monster2;
                monsters += monster2;
            }
        }
        
        System.out.println(monsters);

    }
}


Measured memory_bytes: 62672
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  vector<ll> r(n);
  rep(i, n){
    cin >> r[i];
  }
  ll mini = r[0];
  ll res = -inf;
  FOR(i, 1, n){
    res = max(res, r[i] - mini);
    mini = min(mini, r[i]);
  }
  cout << res << endl;
	return 0;
}



Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
ll comb(ll n, ll r){
  if (r*2>n) r=n-r;
  ll x=1, y=1;
  reps(i,1,r+1){ x *= (n-i+1); y *= i; }
  return x / y;
}


int main(){
  int n; cin >> n;
  vector<int> a(n); rep(i,n) cin >> a[i];
  sort(all(a));
  int ans=0, cnt=1;
  rep(i,n){
    if(a[i]==a[i+1]){ cnt *= -1; ans += cnt; }
    else{ ans++; cnt=1; }
  }
  
  cout << ans;
  
return 0;
}


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

int main(int argc, char **argv) {
  int d=0, t=0, g, n, x;
  scanf("%d %d", &n, &x);
  if(d <= x) ++t;
  for(int i = 0; i < n; ++i) {
    scanf("%d", &g);
    d += g;
    if(d <= x) ++t;
  }
  printf("%d\n", t);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y,z,i;
  cin>>x>>y>>z;
  i=x;
  x=y;
  y=i;
  i=z;
  z=x;
  x=i;
  cout<<x<<" "<<y<<" "<<z<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
#define MOD 1000000007

vector<ll> G[200010];
stack<ll> col[200010];
ll C[200010];
ll ans[200010];

ll seg[524288];
ll app[200010];
ll N;

void raq(ll s = 0, ll t = 262143, ll v = 1, ll k = 1, ll l = 0, ll r = 262143) {
	if (t < l || r < s)return;
	if (s <= l && r <= t) {
		seg[k] += v;
		return;
	}
	raq(s, t, v, k * 2, l, (l + r) / 2);
	raq(s, t, v, k * 2 + 1, (l + r) / 2 + 1, r);
}

ll gets(ll x) {
	x += 262144;
	ll ans = 0;
	while (x) {
		ans += seg[x];
		x /= 2;
	}
	return ans;
}

void pini(ll x, ll v) {
	ll a = gets(x);
	raq(x, x, v - a);
}

ll alc = 0;

void euler(ll c, ll p) {
	for (ll i : G[c]) {
		if (i == p)continue;
		col[C[c]].push(gets(C[c]));
		pini(C[c], 0);
		raq();
		raq(C[i], C[i], -1);
		euler(i, c);
	}

	if (p == 0) {
		for (ll i = 1;i <= N;i++) {
			ll gc = gets(i);
			ans[i] += gc * (gc - 1) / 2;
		}
		return;
	}
	ll gc = gets(C[p]);
	ans[C[p]] += gc * (gc - 1) / 2;
	pini(C[p], col[C[p]].top());
	col[C[p]].pop();
	return;
}

int main() {
	for (ll i = 0;i < 200010;i++)ans[i] = app[i] = C[i] = 0;
	for (ll i = 0;i < 524288;i++)seg[i] = 0;
	ll a, b;
	cin >> N;
	for (ll i = 1;i <= N;i++) {
		cin >> C[i];
		app[C[i]]++;
	}
	for (ll i = 1;i < N;i++) {
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	raq();
	pini(C[1], 0);

	euler(1, 0);
	for (ll i = 1;i <= N;i++) {
		if (app[i] == 0)cout << 0 << endl;
		else
			cout << N * (N - 1) / 2 - ans[i] + app[i] << endl;
	}
}


Measured memory_bytes: 187328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define mod (1000000007)

void solve() 
{
    int a[2010];
    a[0]=1;a[1]=0;a[2]=0;
    rep(i,3,2010)a[i]=(a[i-1]+a[i-3])%mod;
    int s;cin>>s;
    cout<<a[s]<<endl;
}

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

Measured memory_bytes: 3656
data class Point(val t: Int, val x: Int, val y: Int)

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val points = (1..n).map {
        val triple = readLine()!!.split(" ").map { it.toInt() }
        Point(triple[0], triple[1], triple[2])
    }.toMutableList()

    points.add(0, Point(0, 0, 0))

    fun dist(p1: Point, p2: Point): Int = Math.abs(p1.x - p2.x) + Math.abs(p1.y - p2.y)

    for (i in (0 until points.size - 1)) {
        val now = points[i]
        val next = points[i + 1]

        val dist = dist(now, next)
        val dt = next.t - now.t

        if (dt < dist) {
            println("No")
            return
        }
        if ((dt % 2 == 0) != (dist % 2 == 0)) {
            println("No")
            return
        }
    }

    println("Yes")
}

Measured memory_bytes: 54304
#include<iostream>

#include<string>

using namespace std;

int main(){
  
  string a,b,c;
  //cin>>n;//読み込み

  //cout<<n<<endl;//System.out.println
  
    cin>>a>>b>>c;
  
  if((a[a.size()-1]==b[0])&&(b[b.size()-1]==c[0])){
  cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,k;
    string s;
    cin>>n>>s>>k;
    for (int i=0;i<n;i++) {
        if (s[i]!=s[k-1]) {
            cout<<"*";
        } else {
            cout<<s[i];
        }
    }
    cout<<endl;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_BIT 20

vector<i64> N1[MAX_BIT + 1];

int main() {
    i64 N; cin >> N;
    vector<i64> A(N);
    REP(i, N) cin >> A[i];

    i64 p = 1 << MAX_BIT;
    RREP(b, MAX_BIT + 1) {
        N1[b].resize(N + 1);
        N1[b][0] = 0;
        REP(i, N) {
            N1[b][i + 1] = N1[b][i] + A[i] / p;
            A[i] %= p;
        }
        p /= 2;
    }

    i64 cnt = 0;
    i64 right = 0;
    REP(left, N) {
        auto cond = [&]() {
            bool ok = true;
            REP(i, MAX_BIT + 1) {
                if (N1[i][right + 1] - N1[i][left] > 1) ok = false;
            }
            return ok;
        };
        while (right < N && cond()) {
            right++;
        }
        cnt += right - left;
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 34688
z,*s=gets.split(/
|T/,-1).map &:size
Y=Z=1<<8e3
X=Y<<z
s.size%2>0&&s<<0
s.map{|t|Y=Y>>t|Y<<t
X,Y=Y,X}
eval"puts X>>%d&Y>>%d&Z>0?:Yes: :No"%gets.split

Measured memory_bytes: 27568
def selectionSort(a,n)
	$count = 0
	0.upto(n-1){|i|
		minj=i
		i.upto(n-1){|j|
			if a[j] < a[minj] 
				minj=j
			end
		}
		if i!=minj then
			tmp=a[i];a[i]= a[minj];a[minj]=tmp
			$count += 1
		end
	}
end

n = gets.to_i
a = gets.split.map{|f|f.to_i}

selectionSort a,n

puts a*' '
puts $count 

Measured memory_bytes: 8712
#!/usr/bin/env python3
import sys
import itertools

def solve(S: int):
    se = ('+', '_')
    S = list(str(S))

    ans = 0
    for i in itertools.product(se,repeat=(len(S)-1)):
        t =[]
        t.append(S[0])
        for j,x in enumerate(i):
            t.append(x) 
            t.append(S[j+1])

        t = [x for x in t if(x != '_')]
        ts = ''.join(t)
        
        ans += sum(list(map(int,ts.split('+'))))
        
    print(ans)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string Yes="Yes";
string YES="YES";
string NO="NO";
string No="No";
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
 
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
const double pi=3.1415926535897932384626;
int main(){
    string s;
    std::cin >> s;
    int n=s.size();
    string ss=s.substr(0,n/2);
    //std::cout << ss << std::endl;
    int m=ss.size();
    string is=s;
    string iss=ss;
    reverse(all(iss));
    reverse(all(is));
    bool han=1;
    rep(i,n){
        if(s[i]!=is[i])han=0;
    }
    rep(i,m){
        if(ss[i]!=iss[i])han=0;
    }
    if(han)std::cout << Yes << std::endl;
    else std::cout << No << std::endl;
}


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

N_list = [0] * 3

for i in range(N):
    num = A_s[i]
    
    if (num % 4 == 0):
        N_list[2] += 1
    elif (num % 2 == 0):
        N_list[1] += 1
    else:
        N_list[0] += 1

if (N_list[2] >= N_list[0]):
    ans = 'Yes'
elif (N_list[1] == 0 and N_list[2] + 1 == N_list[0]):
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Measured memory_bytes: 14252
#coding:utf-8

n, a, b = map(int, input().split())
s = input()
domestic = 0
abroad = 0

for i in range(n):
    if s[i] == 'c':
        print('No') 
    elif s[i] == 'a' and (domestic + abroad) < (a+b):
        print('Yes')
        domestic += 1
    elif s[i] == 'b' and (domestic + abroad) < (a+b) and abroad < b:
        print('Yes')
        abroad += 1
    else:
        print('No')

Measured memory_bytes: 4016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
#define INF (1e9)

int main() {
  ll N;
  cin >> N;
  vi A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A.begin(), A.end(), greater<ll>());  // 降順

  ll ans = 0;
  for (ll i = 1; i < N; i++) {
    ans += A[i/2];
  }

  cout << ans << endl;
}


Measured memory_bytes: 4788