akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pair PaIR

const int N=1e5;
const LL N2=1e10;
const int maxn=N+10;

int n,Ans;
int primes,prime[maxn];
bool vis[maxn],Ans1;
map<LL,int> mp;

struct Data{
	LL a,norm,pair;
	bool operator < (const Data &d) const {return norm<d.norm;}
}D[maxn];

void prework()
{
	int i,j;
	vis[1]=1;
	for (i=2;i<=N;i++)
	{
		if (!vis[i]) prime[++primes]=i;
		for (j=1;j<=primes&&i*prime[j]<=N;j++)
		{
			vis[i*prime[j]]=1;
			if (i%prime[j]==0) break;
		}
	}
	for (i=1;i<=primes;i++)
		mp[(LL)prime[i]*prime[i]]=prime[i];
}

int main()
{
#ifdef h10
	freopen("D.in","r",stdin);
	freopen("D.out","w",stdout);
#endif
	int i,j;
	prework();
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%lld",&D[i].a);
		D[i].norm=D[i].pair=1;
	}

	for (i=1;i<=n;i++)
	{
		for (j=1;j<=333;j++)
			if (D[i].a%prime[j]==0)
			{
				int cc=0;
				while (D[i].a%prime[j]==0)
					D[i].a/=prime[j],cc++;
				cc%=3;
				if (cc)
				{
					D[i].norm*=prime[j];
					D[i].pair*=prime[j];
					if (D[i].pair>N2) D[i].pair=0;
					if (cc==1) D[i].pair*=prime[j];
					else D[i].norm*=prime[j];
					if (D[i].pair>N2) D[i].pair=0;
				}
			}
		if (mp.count(D[i].a))
		{
			D[i].pair*=mp[D[i].a];
			if (D[i].pair>N2) D[i].pair=0;
		}
		else
		{
			if (log(D[i].pair)+log(D[i].a)+log(D[i].a)>log(N2)) D[i].pair=0;
			else D[i].pair*=D[i].a*D[i].a;
		}
		D[i].norm*=D[i].a;
		D[i].a=1;
	}

	sort(D+1,D+n+1);
	mp.clear();
	for (i=1;i<=n;i++)
		mp[D[i].norm]++;
	for (i=1;i<=n;i++)
	{
		if (D[i].norm==1) {Ans1=1; continue;}
		Ans+=max(mp[D[i].norm],mp[D[i].pair]);
		mp[D[i].norm]=mp[D[i].pair]=0;
	}
	Ans+=Ans1;
	printf("%d\n",Ans);
}


Measured memory_bytes: 13056
#include "bits/stdc++.h"
using namespace std;

int main() {
    string a, b;
    cin >> a >> b;
    for(int i = 0; i < 200; ++i) {
        if(a == b) return !printf("Yes\n");
        a = a.substr(1) + a[0];
    }
    puts("No");
}

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

#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;


void solve() {
    ll n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << "\n";

}

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

Measured memory_bytes: 3636
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

W, H, x, y = map(int, input().split())
ans = W * H / 2.0

# if x == W // 2 and y == H // 2:  # bug!!
if x * 2 == W and y * 2 == H:
    print("{:.12f} {}".format(ans, 1))
else:
    print("{:.12f} {}".format(ans, 0))



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

int gcd(int a, int b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main()
{
  int ans = 0;
  int N; cin >> N;
  for (int i = 0; i < N; i++)
  {
    int A; cin >> A;
    ans = gcd(ans, A);
  }

  cout << ans << endl;
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

int64 mod_pow(int64 x, int64 n, int64 mod)
{
  int64 ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}

int64 rev(int64 x, int mod)
{
  return (mod_pow(x, mod - 2, mod));
}

int main()
{
  int N;
  vector< int > g[200001];
  int64 mul[200001];
  mul[0] = 1;
  for(int i = 1; i < 200001; i++) (mul[i] = mul[i - 1] * 2) %= mod;

  cin >> N;
  ++N;

  for(int i = 1; i < N; i++) {
    int x;
    cin >> x;
    g[x].emplace_back(i);
  }

  int64 ret = 0;

  vector< map< int, int64 > > dp0(N), dp1(N), dp2(N);
  vector< int > sz(N, N);
  function< void(int, int) > dfs = [&](int idx, int dep)
  {
    map< int, int64 > none, one, two;

    for(auto &to : g[idx]) {
      dfs(to, dep + 1);


      if(none.size() < dp0[to].size()) {
        none.swap(dp0[to]);
        one.swap(dp1[to]);
        two.swap(dp2[to]);
      }


      for(auto &p : dp0[to]) {
        int64 q = dp1[to][p.first];
        int64 r = dp2[to][p.first];

        if(!none.count(p.first)) none[p.first] = 1;
        (two[p.first] = two[p.first] * (p.second + q + r) % mod + one[p.first] * (q + r) % mod + none[p.first] * r % mod) %= mod;
        (one[p.first] = one[p.first] * p.second % mod + none[p.first] * q % mod) %= mod;
        (none[p.first] *= p.second) %= mod;
      }
    }


    none[dep] = 1;
    one[dep] = 1;
    --sz[dep];
    none.swap(dp0[idx]);
    one.swap(dp1[idx]);
    two.swap(dp2[idx]);
    for(auto &p : dp2[idx]) (dp0[idx][p.first] += p.second) %= mod;
    dp2[idx].clear();

  };
  dfs(0, 0);

  for(int i = 0; i < N; i++) {
    (ret += dp1[0][i] * mul[sz[i]]) %= mod;
  }

  cout << ret << endl;
}

Measured memory_bytes: 166656
#include <bits/stdc++.h>
 
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
ll n,a[15],ans=0;
void recur(ll i,ll p)
{
	if(i>n)
	{
		if(p==0)ans++;
		return ;
	}
	recur(i+1,(p*(a[i]+1))%2);
	recur(i+1,(p*(a[i]-1))%2);
	recur(i+1,(p*(a[i]))%2);
}
int main() {
slld(n);
for(int i=1;i<=n;i++)
slld(a[i]);
recur(1,1);
plld(ans);
	return 0;
           } 

Measured memory_bytes: 256
import Data.Functor( (<$>))

putList [] = return ()
putList (x:xs) = putStr (show x) >> __putList xs
  where
    __putList [] = return ()
    __putList (x:xs) = putStr (' ':show x) >> __putList xs

putListLn list = putList list >> putStrLn ""

main = do
    getLine
    nums <- (read <$>) . words <$> getLine  ::IO [Int]
    putListLn $ reverse nums



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

using namespace std;

using ll = long long;

const ll MOD = 998244353;

ll dp[4005][4005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();

    dp[0][0] = 1;
    int cntr = 0, cntb = 0;
    for (int i = 0; i < 2 * n; i++) {
        if (i < n) {
            if (s[i] == '0') cntr += 2;
            else if (s[i] == '2') cntb += 2;
            else {
                cntr++;
                cntb++;
            }
        }

        for (int r = 0; r <= cntr; r++) {
            int b = i - r;
            if (b < 0) continue;
            (dp[i+1][r] += dp[i][r] * (cntb>b) % MOD) %= MOD;
            (dp[i+1][r+1] += dp[i][r] * (cntr>r) % MOD) %= MOD;
        }
    }
    cout << dp[2*n][cntr] << endl;
    return 0;
}

Measured memory_bytes: 123648
package main

import (
	"fmt"
)

func main() {
	var x int64
	fmt.Scanf("%d", &x)
	money := int64(100)
	y := 0
	for money < x {
		money = int64(float64(money) * 1.01)
		y++
	}
	fmt.Println(y)
}


Measured memory_bytes: 1816
<?php
fscanf(STDIN,"%d %d %d %d",$taka_a, $taka_b, $ao_c, $ao_d);
    $taka_flg = null;
    while(empty($taka_flg)){
        $ao_c = $ao_c - $taka_b;
        if($ao_c <= 0) {
            $taka_flg = "Yes";
        }
        $taka_a = $taka_a - $ao_d;
        if($taka_a <= 0 && empty($taka_flg)) {
            $taka_flg = "No";
        }
    }
    echo $taka_flg;
?>

Measured memory_bytes: 16212
def c_build_stairs(N, H):
    for i in range(N - 1):
        if H[i] < H[i + 1]:
            H[i + 1] -= 1

    for i in range(N - 1):
        if H[i] > H[i + 1]:
            return 'No'
    return 'Yes'

N = int(input())
H = [int(i) for i in input().split()]
print(c_build_stairs(N, H))

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

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n){
        cin>>h[i];
    }
    int ans = h[0];
    rep(i,n-1){
        if(h[i]<=h[i+1]){
            ans += h[i+1]-h[i];
        }
    }
    
    cout << ans<< endl;
    return 0;
}


Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        n: usize,
        mut a: [usize; n],
    }
    let mut result = 0usize;
    for i in 1..n {
        if a[i - 1] > a[i] {
            let b = a[i - 1] - a[i];
            result += b;
            a[i] += b;
        }
    }
    println!("{}", result);
}


Measured memory_bytes: 5564
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    long long s = 0;
    if(a<=k){
        s+=a;
        k-=a;
    }
    else {
        s+=k;
        k=0;
    }

    if(k){
        if(b<=k){
            k=k-b;
        }
        else{
            k=0;
        }
        if(k){
            if(c<=k){
                s-=c;
            }
            else{
                s-=k;
            }
        }
    }


   // if(s<0) s=0;
    cout<<s;
}


Measured memory_bytes: 3612
/**
 * @author yuichirw
 *
 */
import java.util.*;
import static java.lang.Math.*;

public class Main {
	static double time1, time2;
	static double[] times1 = {70.0, 55.0, 50.0, 43.0, 40.0, 37.5, 35.5};
	static double[] times2 = {148.0, 116.0, 105.0, 89.0, 83.0, 77.0, 71.0};
	static String[] rank_str = {"E", "D", "C", "B", "A", "AA", "AAA"};
	static Scanner sc = new Scanner(System.in);

	static boolean read() {
		if(!sc.hasNextDouble()) return false;
		
		time1 = sc.nextDouble(); time2 = sc.nextDouble();
		return true;
	}
	
	static String solve() {
		String res = "NA";
		int rank1, rank2;
		
		rank1 = rank2 = -1;
		for(int i = 0; i < 7; i++) {
			if(times1[i] > time1) {
				rank1 = i;
			}
		}
		
		for(int i = 0; i < 7; i++) {
			if(times2[i] > time2) {
				rank2 = i;
			}
		}
		
		int rank = min(rank1, rank2);
		if(rank == -1) {
			res = "NA";
		} else {
			res = rank_str[rank];
		}

		return res;
	}
	
	public static void main(String[] args) {
		while(read()) {
			System.out.println(solve());
		}
	}

}

Measured memory_bytes: 12000
import sys

N=int(input())
cnt=0
ans='No'
 
for i in range(N):
  D_1,D_2=map(int,input().split())
  if D_1==D_2:
    cnt+=1
  else:
    cnt=0
  if cnt==3:
    ans = 'Yes'

print(ans)

Measured memory_bytes: 62248
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, Q = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]

    def segfunc(x, y):
        return max(x, y)

    def init(init_val):
        for i in range(n):
            seg[i + num - 1] = init_val[i]

        for i in range(num - 2, -1, -1):
            seg[i] = segfunc(seg[2 * i + 1], seg[2 * i + 2])

    def update(k, x):
        k += num - 1
        seg[k] = x
        while k:
            k = (k - 1) // 2
            seg[k] = segfunc(seg[k * 2 + 1], seg[k * 2 + 2])

    def query(p, q):
        if q <= p:
            return ide_ele
        p += num - 1
        q += num - 2
        res = ide_ele
        while q - p > 1:
            if p & 1 == 0:
                res = segfunc(res, seg[p])
            if q & 1 == 1:
                res = segfunc(res, seg[q])
                q -= 1
            p = p // 2
            q = (q - 1) // 2
        if p == q:
            res = segfunc(res, seg[p])
        else:
            res = segfunc(segfunc(res, seg[p]), seg[q])
        return res

    # seg tree初期値 (単位元)
    n = N
    ide_ele = 0
    num = 2 ** (n - 1).bit_length()
    seg = [ide_ele] * 2 * num

    init(A)

    def isOK(mid, m, value):
        a = query(m, mid)
        return a >= value


    B = A[::]

    for _ in range(Q):
        T, X, V = [int(x) for x in input().split()]
        if T == 1:
            update(X - 1, V)
            B[X - 1] = V
        elif T == 2:
            print(query(X - 1, V))
        else:
            a = query(X - 1, N)
            if a < V:
                print(N + 1)
            else:
                if B[X - 1] >= V:
                    print(X)
                    continue
                ok = N
                ng = X

                while abs(ok - ng) > 1:
                    mid = (ok + ng) // 2
                    if isOK(mid, X - 1, V):
                        ok = mid
                    else:
                        ng = mid

                print(ok)


if __name__ == '__main__':
    main()


Measured memory_bytes: 105036
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    ll a, b, c;
    cin >> a >> b >> c;
    if (a + b > c) {
        cout << "No";
        return 0;
    }
    if (4 * a * b < (c - a - b) * (c - a - b)) {
        cout << "Yes";
    }
    else cout << "No";

    return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define abs(x) ((x) > 0 ? (x) : -(x))
#define MOD (ll)1000000007 //10^9 + 7
#define endl printf("\n")
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n, m) for (int i = (n), i < (m); i++)

typedef struct {ll a, b;} job;

int jsort(const void *a, const void *b) {
  job x = *(job *)a, y = *(job *)b;
  if (x.b > y.b) return 1;
  if (x.b < y.b) return -1;
  return 0;
}

int
main(int argc, char *argv[])
{
  job j[200020];
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld %lld", &j[i].a, &j[i].b);

  qsort(j, n, sizeof(job), jsort);

  long long t = 0;
  for (int i = 0; i < n; i++) {
    t += j[i].a;
    if (t > j[i].b) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}
			     


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

YES = "YES"  # type: str
NO = "NO"  # type: str


def solve(N: int, A: "List[int]"):
    if N == len(set(A)):
        return YES
    else:
        return NO


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

if __name__ == '__main__':
    main()


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

typedef long long ll;

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

    int n, ans = 0;
    cin >> n;

    for(int i = 1; i <= n; i++) {
        ans += (int)log10(i) % 2 == 0;
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
N, M = map(int, input().split())
mp1 = [input() for _ in range(N)]
mp2 = [input() for _ in range(M)]

for i in range(N-M+1):
  for j in range(N-M+1):
    f = 1
    for k in range(M):
      for l in range(M):
        if mp2[k][l] != mp1[i+k][j+l]:
          f = 0
          break
      if f == 0:
        break
    if f == 1:
      print('Yes')
      exit()
      
print('No')

Measured memory_bytes: 63756
#include <iostream> // cin, cout
#include <algorithm> // sort
#include <vector> // vector
#include <cstdio> // printf
#include <cmath> // M_PI
#include <numeric> // accumulate
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)

class building {
public:
	void init(void);
	void set(void);
	void show(void);
private:
	int rooms[4][3][10];
};

void building::init(void) {
	rep(b, 4)
		rep(f, 3)
			rep(r, 10)
				rooms[b][f][r] = 0;
}

void building::set(void) {
	int b, f, r, v;
	cin >> b >> f >> r >> v;
	rooms[b - 1][f - 1][r - 1] += v;
}

void building::show() {
	rep(b, 4) {
		rep(f, 3) {
			rep(r, 10)
				cout << " " << rooms[b][f][r];
			cout << endl;
		}
		if (b != 3)
			cout << "####################" << endl;
	}
}

int		main(void)
{
	building bld;
	int n;

	bld.init(); // 初期化
	cin >> n;
	rep(i, n)
		bld.set(); // 入居
	bld.show(); // 出力
	return (0);
}



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

bool checked[100001] = {0};
int light[100001] = {0};

int main(){
    int n;
    cin >> n;
    for(int i=1;i<=n;++i)
        cin >> light[i];
    int i = 1, cnt = 0;
    while(!checked[i] && i != 2){
        checked[i] = true;
        i = light[i];
        cnt++;
    }
    if(i != 2)cout << "-1" << endl;
    else cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main () {
  int n;
  cin >> n;
  int ans = (int)1e9;
  for (int i = 0; i < n; i ++) {
    int counter = 0;
    int x;
    cin >> x;
    while (x % 2 == 0) {
      x /= 2;
      counter ++;
    }
    if (counter < ans) {
      ans = counter;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/*  /$$                                     /$$
      | $$                                    | $$
  /$$$$$$$  /$$$$$$   /$$$$$$$  /$$$$$$   /$$$$$$$  /$$$$$$   /$$$$$$
 /$$__  $$ /$$__  $$ /$$_____/ /$$__  $$ /$$__  $$ /$$__  $$ /$$__  $$
| $$  | $$| $$$$$$$$| $$      | $$  \ $$| $$  | $$| $$$$$$$$| $$  \__/
| $$  | $$| $$_____/| $$      | $$  | $$| $$  | $$| $$_____/| $$
|  $$$$$$$|  $$$$$$$|  $$$$$$$|  $$$$$$/|  $$$$$$$|  $$$$$$$| $$
 \_______/ \_______/ \_______/ \______/  \_______/ \_______/|__//$$$$$$ /$$$$$$
                                                               |______/|______/

*/
#include <bits/stdc++.h>
#define fastio        ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ln            cout<<endl;
#define vi            vector<int>
#define vll           vector<long long>
#define sortl(vec)    sort(vec.begin(), vec.end());
#define sortr(vec)    sort(vec.rbegin(), vec.rend());
#define forn(i, x, n) for(long long i = x; i < n; i++)
#define revn(i, n, x) for(long long i = n; i >= x ; i--)
#define in(vec)       for(auto &it : vec) cin >> it;
#define loop(vec)     for(auto &it : vec)
#define	out(vec)      for(auto &it : vec) cout << it << " "; ln
#define ll            long long
#define mod           1000000007
#define debug(x)      cout << x << endl;
#define pb            emplace_back
#define mp            make_pair
#define um            unordered_map
#define pii           pair<int, int>
#define pll           pair<ll, ll>
#define f             first
#define s             second
#define pi            3.14159265359
#define CLOCK         cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
using namespace std;

ll power(ll x, ll y, ll p) {
	ll res = 1;
	x = x % p;

	while (y > 0) {
		if (y & 1)
			res = (res * x) % p;

		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

ll modulo(ll a, ll b) {
	ll c = a % b;
	return (c < 0) ? c + b : c;
}

int main() {
// in(vec) works for size-defined type vectors

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input1.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output1.txt", "w", stdout);
#endif

	fastio
	ll t = 1;
	while (t--) {
		ll n;
		cin >> n;
		vll vec(n);
		in(vec)
		sortl(vec)

		vector<bool> arr(vec[n - 1] + 1, false);
		vll freq(vec[n - 1] + 1, 0);

		forn(i, 0, n) {
			arr[vec[i]] = true;
			freq[vec[i]]++;
		}

		forn(i, 1, vec[n - 1] + 1) {
			if (arr[i] == true) {
				for (ll j = 2; j * i <= vec[n - 1]; j++ )
					arr[j * i] = false;
			}

		}
		ll count = 0;
		forn(i, 1, vec[n - 1] + 1) {
			if (arr[i] && freq[i] == 1)
				count++;
		}

		cout << count << endl;


	}
	CLOCK
	return 0;
}



Measured memory_bytes: 12632
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
#include <bitset>
#include <string>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define ALL(x) (x).begin(),(x).end()
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

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

  cout << (N-2)*180 << endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  ll res = 0;
  res = pow(10,18);
  for(int i = 1;i <= sqrt(n);i++){
    if(n % i == 0){
      //cout << i << endl;
      res = min(res,i + n / i - 2);
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(a > 0){
        c -= b;
        if(c <= 0) break;
        a -= d;
    }
    if(a > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3600
#!/usr/bin/env python3
(n,m,),*s=[[*map(int,i.split())]for i in open(0)]
s.sort()
ans = 0
for a,b in s:
    if m<1:
        break
    if m > b:
        ans += a*b
        m -= b
    else:
        ans += m*a
        m=0
print(ans)


Measured memory_bytes: 27848
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<long long>())
using namespace std;
int main()
{
  speed_up;
  ll a, b, c, d;
  cin>>a>>b>>c>>d;
  ll x, i, j, k;
  x = (c*d)/__gcd(c, d);
  if(a%c == 0)
  {
     i = b/c - a/c + 1;
  }
  else if(a%c != 0)
  {
      i = b/c - a/c;
  }
  if(a%d == 0)
  {
      j = b/d - a/d + 1;
  }
  else if(a%d != 0)
  {
      j = b/d - a/d;
  }

  if(a%x == 0)
  {
      k = b/x - a/x + 1;
  }
  else if(a%x != 0)
  {
      k = b/x - a/x;
  }

  cout<<b - a - i - j + k + 1<<endl;



return 0;
}



Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>

using namespace std;


int main() {

    string s;
    cin >> s;

    int al[26];

    for (int &i : al) {
        i = 0;
    }

    for (int i = 0; i < s.length(); i++) {
        al[s[i] - 'a'] += 1;
    }
    
    for (int i = 0; i < 26; i++) {
        if (al[i] == 0) {
            printf("%c\n", (char) ('a' + i));
            return 0;
        }
    }

    cout << "None" << "\n";

    return 0;

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int; //任意長整数 
using Real32 = mp::number<mp::cpp_dec_float<32>>;
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
using Rat = boost::rational<Bint>;//有理数*/
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(c>a+b)cout<<a+2*b+1<<endl;
    else cout<<c+b<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int q = sc.nextInt();
        ArrayList<Point> li = new ArrayList<Point>();
        for(int i = 0; i < q; i++){
            li.add(new Point(sc.nextInt()-1,sc.nextInt()-1,sc.nextInt(),sc.nextInt()));
        }
        long ans = 0;
        int[] arr = new int[10];
        for(int i1 = 1; i1 <= m; i1++){
            for(int i2 = i1; i2 <= m; i2++){
                for(int i3 = i2; i3 <= m; i3++){
                    for(int i4 = i3; i4 <= m; i4++){
                        for(int i5 = i4; i5 <= m; i5++){
                            for(int i6 = i5; i6 <= m; i6++){
                                for(int i7 = i6; i7 <= m; i7++){
                                    for(int i8 = i7; i8 <= m; i8++){
                                        for(int i9 = i8; i9 <= m; i9++){
                                            long tmp = 0;
                                            arr[0] = i1;
                                            arr[1] = i2;
                                            arr[2] = i3;
                                            arr[3] = i4;
                                            arr[4] = i5;
                                            arr[5] = i6;
                                            arr[6] = i7;
                                            arr[7] = i8;
                                            arr[8] = i9;
                                            arr[9] = m;
                                            for(Point p : li){
                                                if(arr[p.b]-arr[p.a] == p.c){
                                                    tmp += p.d;
                                                }
                                            }
                                            ans = Math.max(ans,tmp);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            } 
        }
        System.out.println(ans);
    }
}

class Point{
    int a,b,c,d;
    public Point(int a, int b, int c, int d){
        this.a = a;
        this.b = b;
        this.c = c;
        this.d = d;
    }
}


Measured memory_bytes: 30200
#include <cstdio>

int main()
{
    int i, j, n;
    char mark;
    char marks[4] = {'S', 'H', 'C', 'D'};
    int num;
    bool cards[4][13] = {false};

    scanf("%d ", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%c %d ", &mark, &num);
        for (j = 0; j < 4; j++)
        {
            if (mark == marks[j])
            {
                cards[j][num - 1] = true;
                break;
            }
        }
    }
    for (i = 0; i < 4; i++)
    {
        for (j = 0; j < 13; j++)
        {
            if (cards[i][j] == false)
            {
                printf("%c %d\n", marks[i], j + 1);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2656
#include<cstdio>
inline long long min(long long x,long long y){
	return x<y?x:y;
}
long long a,b,n;
int main(){
	return scanf("%lld%lld%lld",&a,&b,&n),
	printf("%lld",a*min(b-1,n)/b),0;
}

Measured memory_bytes: 1728
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7

    N = input()
    K = int(input())
    lenN = len(N)

    # has less number before
    dp0 = [[0]*5 for _ in range(lenN+1)]
    # not had yet
    dp1 = [[0]*5 for _ in range(lenN+1)]
    dp1[0][0] = 1

    for i in range(lenN):
        k = int(N[i])
        for zero in range(4):
            dp0[i+1][zero] += dp0[i][zero]
            dp0[i+1][zero+1] += dp0[i][zero] * 9
            if k != 0:
                dp0[i+1][zero] += dp1[i][zero]
                dp0[i+1][zero+1] += dp1[i][zero] * (k-1)
                dp1[i+1][zero+1] += dp1[i][zero]
            else:
                dp1[i+1][zero] += dp1[i][zero]


    ans = dp0[lenN][K] + dp1[lenN][K]
    print(ans)



if __name__ == '__main__':
    solve()

Measured memory_bytes: 77396
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
int main (){
    ios_base::sync_with_stdio(false);
    int t;cin>>t;
    while(t--){
        ll a,b,ans=0;cin>>a>>b;
        if(a==b) ans=2*a-2;
        else {
            ll tmp=sqrt(a*b);
            if(tmp*tmp==a*b) tmp--;
            if(tmp*(tmp+1)>=a*b) ans=2*tmp-2;
            else ans=2*tmp-1;
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N, M = map(int, input().split())

class UnionFind():
  def __init__(self, n):
    self.n = n
    self.root = [-1] * (n + 1)
    self.rnk = [0] * (n + 1)

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

  def Unite(self, x, y):
    x = self.Find_Root(x)
    y = self.Find_Root(y)
    if x == y:
      return 
    elif self.rnk[x] > self.rnk[y]:
      self.root[x] += self.root[y]
      self.root[y] = x
    else:
      self.root[y] += self.root[x]
      self.root[x] = y
      if self.rnk[x] == self.rnk[y]:
        self.rnk[y] += 1

  def isSameGroup(self, x, y):
    return self.Find_Root(x) == self.Find_Root(y)

  def Count(self, x):
    return -self.root[self.Find_Root(x)]

uf = UnionFind(N)
e = []
for _ in range(M):
  u, v = map(int, input().split())
  e.append((u, v))
e.reverse()
res = [0] * M
res[0] = N * (N - 1) // 2
for i in range(M - 1):
  u, v = e[i]
  res[i + 1] = res[i]
  if uf.isSameGroup(u, v):
    continue
  else:
    res[i + 1] -= uf.Count(u) * uf.Count(v)
  uf.Unite(u, v)
res.reverse()
for r in res: print(r)

Measured memory_bytes: 97916
import sys, math
from sys import stdin, stdout
from collections import deque
from itertools import permutations

rem = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 6)
take = lambda: map(int, stdin.readline().split())

n=input()
a=take()
ans=0
for i in a:
    p=0
    while(i%2==0):
        i/=2
        p+=1
    ans+=p
print ans


Measured memory_bytes: 3832
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const ll INF = 1e18;
const int MOD = 1000000007;
// const int MOD = 998244353;

ll dp[200005][5];
int main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);

   int n;
   cin >> n;
   vector<int> a(n);
   rep(i, 0, n) cin >> a[i];
   int k = 1 + n % 2;
   rep(i, 0, n + 1) rep(j, 0, k + 1) dp[i][j] = -INF;
   dp[0][0] = 0;
   rep(i, 0, n) {
      rep(j, 0, k + 1) {
         chmax(dp[i + 1][j + 1], dp[i][j]);
         ll now = dp[i][j];
         if ((i + j) % 2 == 0) now += a[i];
         chmax(dp[i + 1][j], now);
      }
   }
   ll ans = dp[n][k];
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 11908
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        var ab = Console.ReadLine().Split().Select(decimal.Parse).ToArray();
        Console.WriteLine(Floor((ab[0] * ab[1])));
    }
}


Measured memory_bytes: 28264
#include <iostream>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

typedef map<string, int> freqmap;

freqmap fm;

int main() {
    string word;
    while (cin >> word) {
        fm[word]++;
    }

    string most_used;
    int most_used_i = 0;
    for (freqmap::iterator i = fm.begin(); i!= fm.end(); i++) {
        if (most_used_i < (*i).second) {
            most_used_i = (*i).second;
            most_used = (*i).first;
        }
    }
    cout << most_used << ' ';
    
    string max_length;
    int max_length_i = 0;
    for (freqmap::iterator j = fm.begin(); j != fm.end(); j++) {
        if (max_length_i < (*j).first.length()) {
            max_length = (*j).first;
            max_length_i = (*j).first.length();
        }
    }
    cout << max_length << endl;
    return 0;
}

Measured memory_bytes: 0
//#include<iostream>
//#include<algorithm>
//#include<string>
//#include <cmath>
//#include <vector>
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define REP(x,n) for(int x=0;x<n;x++)

//vector//
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

typedef pair<int,int> P;  //q(p.first,p.second)

int main (){
    int n;
    cin >> n;
    vector<int> t(n);
    for (int i = 0; i < n; i++)
    {
        cin >> t[i];
    }
    int m;
    cin >> m;
    vector<pair<int,int>> x(m);
    for (int j = 0; j < m; j++)
    {   
        cin >> x[j].first >> x[j].second;
    }
    
    int sum_t = accumulate(all(t),0);

    for (int i = 0; i < m; i++)
    {
        int sa = x[i].second - t[x[i].first - 1];
        cout << sum_t + sa << endl;
    }
    
}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.D_Challenge
{
    class ABC_047
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            long[] nt = ReadLongs();
            int n = (int)nt[0];
            int[] array = ReadInts();
            var maxSellIndex = new int[n];
            maxSellIndex[n - 1] = n - 1;
            int maxSurplus = 0;
            for(int i = n - 2; i >= 0; i--)
            {
                if (array[maxSellIndex[i + 1]] < array[i])
                {
                    maxSellIndex[i] = i;
                }
                else
                {
                    maxSellIndex[i] = maxSellIndex[i + 1];
                }
                maxSurplus
                    = Math.Max(array[maxSellIndex[i]] - array[i], maxSurplus);
                //Console.WriteLine(maxSellIndex[i]);
            }
            //Console.WriteLine(maxSurplus);
            int res = 0;
            for(int i = 0; i < n; i++)
            {
                int tmp = array[maxSellIndex[i]] - array[i];
                if (tmp == maxSurplus)
                {
                    res++;
                }
            }
            Console.WriteLine(res);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

//CEだった...

template<typename M>
struct segment_tree{
	typedef function<M(M, M)> F;
	int size;//2冪
	vector<M> val;//1-indexed
	F f;//演算
	M e;//単位元

	segment_tree(int N, vector<M> &data, F f, M e) : f(f), e(e){
		size = 1;
		while(size < N) size *= 2;
		val.assign(2 * size, e);
		for(int i = 0; i < N; i++) val[size + i] = data[i];
		for(int i = N; i < size; i++) val[size + i] = e;
		for(int i = size - 1; i > 0; i--) val[i] = f(val[2 * i], val[2 * i + 1]);
	}

	//k番目の要素をxに変更する
	void update(int k, M x){
		k += size;
		val[k] = x;
		while(k /= 2) val[k] = f(val[2 * k], val[2 * k + 1]);
	}

	//[a, b)の演算の結果を返す
	M query(int a, int b){
		M L = e, R = e;
		for(a += size, b += size; a < b; a /= 2, b /= 2){
			if(a & 1) L = f(L, val[a++]);
			if(b & 1) R = f(val[--b], R);
		}
		return f(L, R);
	}
};

int sum(int x, int y){
	return x + y;
}

int main(){
	int N, Q, i;
	scanf("%d%d", &N, &Q);
	vector<int> data(N, 0);
	segment_tree<int> t(N, data, sum, 0);
	for(i = 0; i < Q; i++){
		int c, x, y;
		scanf("%d%d%d", &c, &x, &y);
		if(c == 0){
			t.update(x - 1, t.query(x - 1, x) + y);
		}
		else{
			printf("%d\n", t.query(x - 1, y));
		}
	}
	return 0;
}


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

const int INF = 1e9;
const int MAX_V = 1e5;
const int MAX_E = 5e5;

struct edge {
  int to;
  int cost;
};

// first: distance, second: ID of the point
using P = pair<int, int>;

vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {  // s: start
  priority_queue<P, vector<P>, greater<P> > q;
  d[s] = 0;
  q.push(P(0, s));

  while (!q.empty()) {
    P p = q.top();
    q.pop();
    int v = p.second;
    if (d[v] < p.first) continue;

    for (int i = 0; i < G[v].size(); i++) {
      edge e = G[v][i];
      if (d[e.to] > d[v] + e.cost) {
        d[e.to] = d[v] + e.cost;
        q.push(P(d[e.to], e.to));
      }
    }
  }
}

int main() {
  int V, E, r;
  cin >> V >> E >> r;
  rep(i, V) d[i] = INF;
  rep(i, E) {
    int s, t, dist;
    cin >> s >> t >> dist;
    edge e = {t, dist};
    G[s].push_back(e);
  }
  dijkstra(r);
  rep(i, V) {
    if (d[i] == INF)
      cout << "INF" << endl;
    else
      cout << d[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 13172
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>

using namespace std;


int main(){

    char a;
    cin>>a;

    cout<<++a<<endl;
   
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define MAX_V 100005

int main(void){
 	ll n,k;
 	cin>>n>>k;
 	vector<ll> X;
 	ll x;
 	ll now = -1;
 	rep(i,n){
 		cin>>x;
 		X.push_back(x);
 		if(x >= 0 && now == -1){
 			now = i;
 		}
 	}
 	if(now == -1){//座標が全て負
 		cout<<abs(X[n-k])<<endl;
 		return 0;
 	}
 	if(now == 0){
 		cout<<abs(X[k-1])<<endl;
 		return 0;
 	}
 	int left = 0;
 	int right = left + k - 1;
 	ll ans = LINF;
 	for(left = 0; right < n; left++, right = left + k - 1){
 		ans = min(ans,min(abs(X[left]*2)+abs(X[right]), abs(X[left]) + abs(X[right]*2)));
 		if(X[left] >= 0){
 			ans = min(ans,X[right]);
 		}
 		if(X[right] <= 0){
 			ans = min(ans,abs(X[left]));
 		}
 	}
 	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1400
def main():
    x = input()
    x1, x2, x3, x4, x5 = x.split(' ') 
    W = int(x1)
    H = int(x2)
    x = int(x3)
    y = int(x4)
    r = int(x5)
    
    if r <= x <= W-r and r <= y <= H-r:
        print("Yes")
    else:
        print("No")
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 7816
;

import java.util.*;
import java.io.*;

public class Main {
	static class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		public long[] readLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
	}

	static final FS sc = new FS();
	static final PrintWriter out = new PrintWriter(System.out);
	static final int mod = 1000000007;

	public static void main(String[] args) {
		solve();
		out.close();
	}

	static void solve() {
		int a = sc.nextInt();
		
		if (a < 1200) {
			out.println("ABC");
		} else {
			out.println("ARC");
		}

	}

}


Measured memory_bytes: 32780
/*
    Mbak Sana Dong
    Mbak Chaeyoung Dong
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod = 1e9+7;
ll power(ll a, ll b)
{
    ll ret = 1;
    if(b == 0) return ret;
    while(b>0)
    {
        if(b%2==1) ret = (ret*a) % mod;
        b /= 2;
        a = (a*a) % mod;
    }
    return ret;
}
ll fact[2000010];
ll nCr(ll a, ll b)
{
    ll ret = fact[a] * power(fact[b], mod - 2);
    ret %= mod;
    ret *= power(fact[a-b], mod - 2);
    return ret % mod;
}
int main()
{
    int n,i,j,k,x,y,ans,curr,m;
    int tc;
    fact[0] = 1;
    for(i=1;i<=2000000;i++) fact[i] = (1LL*fact[i-1]*i) % mod;
    string s;
    cin >> k;
    cin >> s;
    n = s.length();
    ll chaeng = 0;
    for(i=0;i<=k;i++) {
        ll sum = power(26, i);
        sum = (sum * power(25, k-i)) % mod;
        sum = (sum * nCr(n-1+k-i, n-1)) % mod;
        chaeng += sum;
        chaeng %= mod;
    }
    cout << chaeng << endl;
    return 0;
}


Measured memory_bytes: 20972
import java.util.*;
import java.util.List;
import java.util.ArrayList;
import java.math.*;
class Main{
    public static void main(String[]args){
        Scanner scanner = new Scanner(System.in);
        String[] S = new String[11]; S = scanner.nextLine().split("");
        String[] T = new String[11]; T = scanner.nextLine().split("");
        for(int i=0;i<S.length;i++){
            if(!(S[i].equals(T[i]))){
                System.out.println("No");
                break;
            }
            else{
                if(i==S.length-1){
                    System.out.println("Yes");
                }
            }
        }
    }

}

Measured memory_bytes: 35444
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;
bool my_compare(pair<ll, ll> a, pair<ll , ll> b) {
    // 基本はfirstで比較
    if(a.first != b.first){
         return a.first < b.first; // 昇順
        //return a.first > b.first; // 降順
    }

    // それ以外はsecondで比較
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        // どちらも同じ
        return true;
    }
}

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

    ll a,b,c,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    ll h,w;
    cin>>w>>str;
    //string stra[h];
    for(ll i=1;i<w;i++){
        set<string> bs;
        set<string> as;
        rep(j,i){
            bs.insert(str.substr(j,1));
                        //cout<<str.substr(j,1);
        }
        for(ll j=i;j<w;j++){
            as.insert(str.substr(j,1));
            //cout<<str.substr(j,1);
        }
        for(auto itr=as.begin();itr!=as.end();++itr){
            if(bs.find(*itr)!=bs.end()) f++;
            //cout<<*itr;
        }
        maxi=max(f,maxi);
        f=0;
        //cout<<"aaa";
    }
    cout<<maxi<<endl;


    //cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if a[i] != a[j] and a[i] != a[k] and a[j] != a[k]:
                if a[i] + a[j] > a[k] and a[j] + a[k] > a[i] and a[k] + a[i] > a[j]:
                    ans += 1
print(ans)




Measured memory_bytes: 9192
function index(Vec, Num)
  
  N = length(Vec)
  left = 1
  right = N+1
  mid = div(right + left, 2)
  
  while left < right
    if Vec[mid] == Num
      return mid
    elseif Vec[mid] > Num
      right = mid
      mid = div(right + left, 2)
    else
      left = mid + 1
      mid = div(right + left, 2)
    end
  end
  
end

function main()
  
  (N, M) = map(x -> parse(Int, x), split(readline()))
  
  checks = [[] for i in 1:N]
  
  P = zeros(Int, M)
  Y = zeros(Int, M)
  for i in 1:M
    (P[i], Y[i]) = map(x -> parse(Int, x), split(readline()))
    push!(checks[P[i]], Y[i])
  end
  
  for i in 1:N
    sort!(checks[i])
  end
  
  for i in 1:M
    print(lpad(P[i], 6, 0))
    println(lpad(index(checks[P[i]], Y[i]), 6, 0))
  end
  
end

main()

Measured memory_bytes: 162620
import collections

n = int(input())
v = list(map(int, input().split()))

odd = [0] * (n//2)
even = [0] * (n//2)
for i in range(n):
    if i % 2 == 0:
        even[i//2] = v[i]
    else:
        odd[i//2] = v[i]

even_cnt = collections.Counter(even)
odd_cnt = collections.Counter(odd)


if even_cnt.most_common()[0][0] != odd_cnt.most_common()[0][0]:
    ans = n - even_cnt.most_common()[0][1]- odd_cnt.most_common()[0][1]
else:
    if even_cnt.most_common()[0][1] == odd_cnt.most_common()[0][1]:
        if len(even_cnt.most_common()) >= 2:
            ans = n - even_cnt.most_common()[0][1]- max(even_cnt.most_common()[1][1],odd_cnt.most_common()[1][1])
        else:
            ans = n//2
    else:
        if even_cnt.most_common()[0][1] > odd_cnt.most_common()[0][1]:
            ans = n - even_cnt.most_common()[0][1] - odd_cnt.most_common()[1][1]
        else:
            ans = n - odd_cnt.most_common()[0][1] - even_cnt.most_common()[1][1]
print(ans)

Measured memory_bytes: 19040
/*
_________________________
|   LIVE FREE OR DIE     |
|       327 2153         |
|          New           |
|_______HAMPSHIRE________|

*/
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define MAX 20
#define int long long
#define MOD 998244353

int32_t main()
{
	IOS
	int n;cin>>n;
	int p = 100;
	for(int i=1;i<4000;i++)
	{
		int sum = p/100;
		p+=sum;
		if(p>=n)
		{
			cout<<i;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<string> w;
	bool flag = true;
	for(int i = 0;i < n;i++){
		string s;
		cin >> s;
		
		if(i > 0 && w[i-1][w[i-1].size()-1] != s[0]){
			flag = false;
		}
		
		for(int j = 0;j < w.size();j++){
			if(w[j] == s){
				flag = false;
			}
		}
		
		w.push_back(s);
	}
	
	if(flag){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256