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

int main(int argc, char const* argv[])
{
  int n, l;
  string s[100000];
  cin >> n >> l;
  for (int i = 0; i < n; i++)
  {
    cin >> s[i];
  }
  sort(s, s + n);
  for (int i = 0; i < n; i++)
  {
    cout << s[i];
  }
  cout << endl;
  return 0;
}


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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	FOR(i, 1, 10) {
    FOR(j, 1, 10) {
      cout << i << 'x' << j << '=' << i * j << endl;
    }
  }
	return 0;
}


Measured memory_bytes: 3144
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;
		
int main(){
	ll N;
	cin >> N;
	++N;
	vector<ll> node(N);
	rep(i,N)cin >> node[i];

	vector<ll> nax(N, inf);
	vector<ll> nin(N, inf);
	nax[N-1] = node[N-1];
	nin[N-1] = node[N-1];
	for(int i = N-2; i >= 0; --i){
		nin[i] = (nin[i+1]/2 + (nin[i+1] % 2 != 0) + node[i]);
		nax[i] = (nax[i+1] + node[i]);
	}
	if(!(nin[0] <= 1 && 1 <= nax[0])){
		cout << -1 << endl;
		return 0;
	}

	ll ans = 1;
	vector<ll> det_node(N+1);
	det_node[0] = 1;
	REP(i,N-1){
		det_node[i] = min(nax[i], (det_node[i-1]-node[i-1])*2);
		ans += det_node[i];
	}
	cout << ans << endl;
}


//
//int main(){
//	int N; cin>>N;
//	++N;
//	vector<int> node(N);
//	rep(i,N)cin>>node[i];
//
//	//possible or impossible
//	{
//		int can = 1;
//		int i = 0;
//		while(i <= N && can <100100100){
//			if(node[i] > can){
//				cout << -1 << endl;
//				return 0;
//			}
//			can -= node[i];
//			can *= 2;
//			++i;
//		}
//		if(node[N] == 0){cout << -1 << endl; return 0;}
//	}
//
//	//ans
//	ll ans = N+1;
//	vector<int> rest(N+1);
//	return 0;
//}


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()

using ll = std::int64_t;
using vint = std::vector<int>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    int d[5];
    rep(i, 5) {
        cin >> d[i];
    }

    int ans = 0;
    int r_min = INF;
    rep(i, 5) {
        if (d[i] % 10 == 0) {
            ans += d[i];
            continue;
        }
        if (d[i] % 10 < r_min)r_min = d[i] % 10;
        d[i] += (10 - d[i] % 10);
        ans += d[i];
    }
    if (r_min != INF) {
        ans -= (10 - r_min);
    }
    cout << ans << endl;

}

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


Measured memory_bytes: 384
#include <stdio.h>
 
int main(void)
{
    int n, i, a, b, c, d;
 
    while (scanf("%d", &n) != EOF) {
        i = 0;
        for (a = 0; a <= 9; ++a)
            for (b = 0; b <= 9; ++b)
                for (c = 0; c <= 9; ++c)
                    for (d = 0; d <= 9; ++d)
                        if (a + b + c + d == n)
                            ++i;
        printf("%d\n", i);
    }
 
    return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
const lint MOD = pow(10, 9) + 7;

int main() {
	int n, q;
	cin >> n >> q;
	string sb;
	int ib;
	pair<string, int>pb;
	deque<pair<string, int>>A;
	rep(i, n) {
		cin >> sb >> ib;
		pb = make_pair(sb, ib);
		A.push_back(pb);
	}
	int time = 0;
	while (1) {
		if (A.empty())break;
		if (A.front().second<=q) {
			time += A.front().second;
			cout << A.front().first << ' ' << time << endl;
			A.pop_front();
		}
		else {
			A.front().second -= q;
			pb = A.front();
			A.pop_front();
			A.push_back(pb);
			time += q;
		}
	}
}


Measured memory_bytes: 6288
# ABC162D - RGB Triplets

import numpy as np
from numba import njit

def main():
    n=int(input())
    s=np.zeros(n,dtype=np.int64)
    a=input()
    for i in range(n):
        s[i]=ord(a[i])%3
    ans=0
    d=np.zeros((3,n),dtype=np.int64)
    m=np.zeros((3,n),dtype=np.int64)
    l=np.array([[0,2,1],[2,1,0],[1,0,2]])
    #print(s.dtype,d.dtype,m.dtype)

    for i in range(n):
        d[s[i],i]=1
        m[s[i],i]=1

    for j in range(3):
        for i in range(n-1,0,-1):
            m[j,i-1]+=m[j,i]

    print(f(n,s,m,d,l))

@njit
def f(n,s,m,d,l):
    ans=0
    for i in range(n-2):
        for j in range(i+1,n-1):
            if s[i]==s[j]:
                continue
            ans+=m[l[s[i]][s[j]],j+1]
            if (j*2-i)<n:
                ans-=d[l[s[i]][s[j]],j*2-i]
    return ans
        
main()


Measured memory_bytes: 111376
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<stdio.h>
#include<set>
#include<vector>
using namespace std;
int main(){
    int n;
    int en;
    cin>>n;
    int x[n],y[n],h[n];
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>h[i];
        if(h[i]!=0){
            en=i;
    }
    }

    int ansx=0,ansy=0;
    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            int HH;
        /*    for(int u=0;u<n;u++){
                if(h[u]!=0){
                    HH=h[u]+abs(x[u]-i)+abs(y[u]-j);
                    break;
                }*/
            HH=h[en]+abs(x[en]-i)+abs(y[en]-j);
            for(int u=0;u<n;u++){
                    int H=HH-abs(x[u]-i)-abs(y[u]-j);
                    if(max(H,0)!=h[u]){//HH!H
                        break;
                    }else{
                        if(u==n-1){
                            ansx=i;ansy=j;
                            break;
                        }
                    }
                }
            }
    }
    int ansh=h[en]+abs(x[en]-ansx)+abs(y[en]-ansy);
    cout<<ansx<<" "<<ansy<<" "<<ansh<<endl;
    
    
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
/* テンプレートここまで */

int main() {
  int N;  cin >> N;
  vector<ll> a(N); REP(i, N) cin >> a[i];
  vector<ll> b(N); REP(i, N) cin >> b[i];

  ll lack = 0;
  ll ans = 0;
  vector<ll> c(N); REP(i, N){
    c[i] = a[i] - b[i];
    if(c[i] < 0) {
      lack += c[i];
      ans++;
    }
  }

  sort(ALL(c), greater<ll>());

  for(int i=0; c[i] > 0 && lack < 0; i++){
    ans++;
    lack += c[i];
  }

  if(lack < 0){
    ans = -1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, K, A[2222];

  long long C = 0;

  std::cin >> N >> K;

  for (int i = 0; i < N; i ++)
    std::cin >> A[i];

  for (int i = 0; i < N; i ++)
    for (int j = i + 1; j < N; j ++)
      if (A[i] > A[j])
        (C += K) %= MOD;

  for (int i = 0; i < N; i ++)
    for (int j = 0; j < N; j ++)
      if (A[j] > A[i])
        (C += 1LL * K * (K - 1) / 2) %= MOD;

  std::cout << C << std::endl;

  return 0;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) coutl<<ans<<endl;
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;}
const int INF = 1e9;
const ll LINF = 1e18;
// clang-format on

void solve(long long N, std::vector<long long> a) {
  ll ans = 0;
  for (ll I = 1;; I += 1) {
    // rep1(I, N) {
    auto it = find(a.begin() + I - 1, a.end(), I);
    auto idx = distance(a.begin(), it);
    if (it == a.end()) {
      if (I > 1) {
        if (I - 1 < a.size()) {
          ans += a.size() - (I - 1);
        }
        ANS(ans);
      } else {
        ANS(-1);
      }
      return;
    }
    ll brk = idx - (I - 1);
    ans += brk;
    a.erase(a.begin() + (I - 1), a.begin() + (I - 1) + brk);
  }
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  solve(N, std::move(a));
  return 0;
}


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

#define int long long
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define pii pair<int, int>

const int N = 2e5;
const int mod = 1e9 + 7;
int n;
vector<int> g[N], tmp[N];
vector<bool> visited(N, 0);
vector<vector<int> > dp(N, vector<int> (2, -1));

int solve(int v, bool w){
    if(dp[v][w] != -1){
        return dp[v][w];
    }
    int ans = 1;
    if(w){
        for(auto u : g[v]){
            ans *= solve(u, 0) + solve(u, 1);
            ans %= mod;
        }
    }else{
        for(auto u : g[v]){
            ans *= solve(u, 1);
            ans %= mod;
        }
    }
    return dp[v][w] = ans;
}

void dfs(int v){
    visited[v] = true;
    for(auto u : tmp[v]){
        if(visited[u]){continue;}
        g[v].push_back(u);
        dfs(u);
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i = 1;i < n;i++){
        int u, v;
        cin >> u >> v;
        u-- , v--;
        tmp[u].push_back(v);
        tmp[v].push_back(u);
    }
    dfs(0);
    cout << (solve(0, 0) + solve(0, 1)) % mod << "\n";
}

Measured memory_bytes: 33792
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

/* --------------------------------------- */

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, m;
	cin >> n >> m;
	ll q;
	cin >> q;
	vector<ll> a(q);
	REP(i, q) cin >> a[i];
	REP(i, q) a[i]--;
	vector<ll> cnt(m, 0);
	map<ll, ll> dict;
	vector<ll> idx(m, -1);
	ll ite = 0;
	for(ll i = q - 1; i >= 0; i--) {
		if(dict.count(a[i])) {
			ll pos = dict[a[i]];
			if(cnt[pos] == n) continue;
			if(pos != 0 && cnt[pos - 1] <= cnt[pos]) continue;
			cnt[pos]++;
		} else {
			dict[a[i]] = ite;
			idx[ite] = a[i];
			cnt[ite]++;
			ite++;
		}
	}
	vector<ll> not_comp;
	REP(i, m) if(!dict.count(i) || cnt[dict[i]] != n) not_comp.pb(i);
	sort(ALL(not_comp));
	ll tmp = 0;
	REP(i, m) {
		if(cnt[i] == 0 || cnt[i] == n) continue;
		if(idx[i] != not_comp[tmp]) {
			cout << "No" << endl;
			return 0;
		}
		tmp++;
	}
	cout << "Yes" << endl;
	return 0;
}

/* --------------------------------------- */



Measured memory_bytes: 9980
use std::io;

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

    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    let q = line.trim().parse::<i32>().unwrap();

    for _ in 0..q {
        let mut line = String::new();
        io::stdin().read_line(&mut line).ok();
        let mut iter = line.split_whitespace();
        let command = iter.next().unwrap();

        match command {
            "print" => {
                let a = iter.next().unwrap().parse::<usize>().unwrap();
                let b = iter.next().unwrap().parse::<usize>().unwrap();
                println!("{}", &s[a..b+1]);
            }
            "reverse" => {
                let a = iter.next().unwrap().parse::<usize>().unwrap();
                let b = iter.next().unwrap().parse::<usize>().unwrap();
                let rev = s.drain(a..b+1).rev().collect::<String>();
                s.insert_str(a, &rev);
            },
            "replace" => {
                let a = iter.next().unwrap().parse::<usize>().unwrap();
                let b = iter.next().unwrap().parse::<usize>().unwrap();
                let p = iter.next().unwrap();
                s.drain(a..b+1);
                s.insert_str(a, p);
            },
            _ => {},
        }
    }
}



Measured memory_bytes: 5052
#include <queue>
#include <cstdio>
#include <vector>
#pragma warning(disable : 4996)
using namespace std;
struct edge { int to; long long cost; };
bool operator<(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}
int N, M, C, a, b, c;
int main() {
	scanf("%d%d%d", &N, &M, &C);
	long long sum = 0;
	vector<vector<edge> > G(N);
	for (int i = 0; i < M; i++) {
		scanf("%d%d%d", &a, &b, &c); a--, b--;
		G[a].push_back(edge{ b, c });
		G[b].push_back(edge{ a, c });
		sum += c;
	}
	long long ret = sum;
	vector<bool> vis(N);
	vector<long long> d(N, 1LL << 60); d[0] = 0;
	priority_queue<edge> que; que.push({ 0, 0 });
	while (!que.empty()) {
		edge u = que.top(); que.pop();
		if (!vis[u.to]) {
			vis[u.to] = true;
			for (edge e : G[u.to]) {
				if (vis[e.to]) sum -= e.cost;
			}
			ret = min(ret, C * d[u.to] + sum);
		}
		for (edge e : G[u.to]) {
			if (d[e.to] > d[u.to] + e.cost) {
				d[e.to] = d[u.to] + e.cost;
				que.push(edge{ e.to, -d[e.to] });
			}
		}
	}
	printf("%lld\n", ret);
	return 0;
}

Measured memory_bytes: 16860
#include <stdio.h>
#define N 100000

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

int main(){
  int i,h;
  int A[N+1];
  scanf("%d",&h);
  for(i=1;i<=h;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=h;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i)>=1)  printf("parent key = %d, ",A[parent(i)]);
    if(left(i)<=h)  printf("left key = %d, ",A[left(i)]);
    if(right(i)<=h) printf("right key = %d, ",A[right(i)]);
    printf("\n");
  } 
  return 0;
}

Measured memory_bytes: 608
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
class Simple {
    int N, M;
    int[] a, b;
    int[,] G;
    void Solve() {
        //input
        N = io.Int;
        M = io.Int;
        a = new int[M];
        b = new int[M];
        for (int i = 0; i < M;++i){
            a[i] = io.Int-1;
            b[i] = io.Int-1;
        }
        var ans = 0;
        //グラフの隣接行列化
        G = new int[N, N];
        for (int i = 0; i < M;++i){
            G[a[i], b[i]] = 1;
            G[b[i], a[i]] = 1;
        }
        //dfsでi番目の辺を除いたときに連結グラフが成り立つか調べる
        for (int i = 0; i < M;++i){
            G[a[i], b[i]] = 0;
            G[b[i], a[i]] = 0;
            var isVisited = new bool[N];
            isVisited[0] = true;
            ans+=(dfs(0, isVisited)?0:1);
            G[a[i], b[i]] = 1;
            G[b[i], a[i]] = 1;
        }
        //ret
        Console.WriteLine(ans);
    }
    bool dfs(int i,bool[]vis){                
        for (int j = 0; j < N;++j){
            if(G[i,j]==1&&!vis[j]){                
                vis[j] = true;
                dfs(j, vis);
            }
        }
        //連結グラフであるか非連結グラフであるか
        return vis.All(f => f);
    }

    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) { new Simple().Stream(); }
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] { ' ' };
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if (BufferCnt < nextBuffer.Length)
            return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while (st == "")
            st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}

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

int cal(int Bh,int Bw,int Sh,int Sw){
	int Bt=Bh*Bh+Bw*Bw;
	int St=Sh*Sh+Sw*Sw;
	
	if(Bt>St)return 1;
	if(Bt<St)return 0;
	
	if(Bh>Sh)return 1;
	return 0;
	
}


int main(){
	int W,H;
	
	
	while(cin>>H>>W,H){
		int Ah=999,Aw=999;
		
		for(int h=1;h<=150;h++){
			for(int w=h+1;w<=150;w++){
				if(cal(h,w,H,W)){
					if(cal(Ah,Aw,h,w)){
						Ah=h;
						Aw=w;
					}
					
				}
			}
		}
		
		
		cout<<Ah<<" "<<Aw<<endl;
	}
	
	
}


Measured memory_bytes: 1160
import java.util.*;

public class Main {
	public static void main(String[] args) {
	// TODO Auto-generated method stub
	Scanner sc = new Scanner(System.in);

	int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    int E = sc.nextInt();
    int F = 0;

    for(int i = 1; C > i ; i++) {
        int G = sc.nextInt();
        int H = sc.nextInt();

        if((D > G && E < H) || (D < G && E > H)) {
            F = F + Math.abs(D - G) + Math.abs(E - H);
	    }else{
	         F = F + Math.max(Math.abs(D - G), Math.abs(E - H));
	    }
	    D = G;
	    E = H;
	}
    System.out.println(F);
    sc.close();
}
}

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

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  int n; cin >> n;
  for(int i=n;;i++){
  	int cnt = 0;
  	for(int j=2;j*j<=i;j++){
  		if(i%j == 0) cnt++;
	}
	if(cnt == 0){
		cout << i << "\n";
		break;
	}
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#define ll long long 
#define pb push_back
#define pf push_front

using namespace std;

void solve(){
    ll int n; cin>>n;
    int r; vector<char>v; char c;
    while(n>0){
        r=n%26; if(r!=0) c = r-1+'a'; else c='z';
        if(r==0) r=26;
        v.pb(c);
        n-=r;
        n/=26;
    }
    for(int i=v.size()-1; i>=0; i--) cout<<v[i];
    cout<<endl;

}

int main(){
	int t=1; //cin>>t;
	while(t--){
		solve();
	}

return 0;
}

Measured memory_bytes: 3648
import math

N = int(input())
XY = []
for i in range(N):
  XY.append([int(i) for i in input().split()])

XY_dict = {}

for i in range(0,N):
  for j in range(i+1,N):
    key = str(i) + str(j)
    XY_dict[key] = math.sqrt( (XY[i][0] - XY[j][0])**2 + (XY[i][1] - XY[j][1])**2 )

ans = 0
for xy in XY_dict.values():
  ans += xy

ans = (ans * 2)/N

print(ans)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include <set>

#define DIV 1000000007
using namespace std;
using ll = long long;

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

    int num = pow(2, N);
    vector<int> cost(num, 1e9);
    cost[0] = 0;
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        vector<int> key(N);
        for (int j = 0; j < b; j++) {
            int c;
            cin >> c;
            key[c - 1] = 1;
        }

        for (int k = 0; k < num; k++) {
            vector<int> bit(N);
            int temp = k;
            int sa = 0;
            for (int h = 0; h < N; h++) {
                bit[h] = temp % 2;
                temp /= 2;
                if (key[h] == 0 && bit[h] == 1) {
                    sa += pow(2, h);
                }
            }
            
            cost[k] = min(cost[k], cost[sa] + a);
           
        }
    }

    if (cost[num-1] == 1e9)
        cout << -1 << endl;
    else
        cout << cost[num-1] << endl;

}


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


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

string s="abcdefghijklmnopqrstuvwxyz";

    ll n;
    cin>>n;
   ll r=n;
   ll cnt=0;
   ll arr[12];
   int l=0;
   while(r>0){
    int x=r%26;
    if(x==0){
        x=26;
    }
    arr[l]=x;
    r=r-x;
    r=r/26;
    cnt++;
    l++;
   }

    for(int i=l-1;i>=0;i--){
    cout<<s[arr[i]-1];
   }




}




Measured memory_bytes: 3656
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque




def main():
    a = input()
    flg = 0
    for ele in a:
        if flg == 0 and ele == 'C':
            flg += 1
        if flg == 1 and ele == 'F':
            flg += 1
    if flg == 2:
        print('Yes')

    else:
        print('No')







if __name__ == '__main__':
    main()



Measured memory_bytes: 38416
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE long long
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;
int inf=1<<30;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct
int main(void){
    int n,s,a,c,m=256,i,l[256],r,o[256],x,y,z;
    double h,ansh;
    while(n=in()){
        rep(i,n)l[i]=in();
        x=y=z=0;
        ansh=10000000.0;
        rep(s,16)rep(a,16)rep(c,16){
            r=s;
            h=0;
            MEMSET(o);
            rep(i,n){
                r=(a*r+c)%m;
                o[(l[i]+r)%m]++;
            }
            rep(i,256){
                if(o[i])h-=(o[i]/(double)n*log(o[i]/(double)n));
            }
            if(ansh-h>EPS){
                ansh=h;
                x=s;
                y=a;
                z=c;
            }
        }
        printf("%d %d %d\n",x,y,z);
    }
    return 0;
}


Measured memory_bytes: 2036
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <cstring>
#include <map>
#include <iomanip>
#include <ctime>
#include <complex>
using namespace std;
typedef long long ll;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tiii tuple<int, int, int>
#define Tlll tuple<ll, ll, ll>



int main() {
    int n, m;
    cin >> n >> m;

    int a[n + 5];
    priority_queue<Tlll> pq;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        pq.push(Tlll(a[i], a[i], 1));
    }

    for (int i = 0; i < m && !pq.empty(); i++) {
        Tiii q = pq.top();
        int x = get<0>(q), y = get<1>(q), z = get<2>(q);
        pq.pop();
        z *= 2;
        if (y / z != 0) {
            pq.push(Tlll(y / z, y, z));
        }
    }

    ll ans = 0;
    while (!pq.empty()) {
        Tiii q = pq.top();
        ans += get<0>(q);
        pq.pop();
    }
    cout << ans << endl;


}


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

long long k;
int main() {
	int a , b , c;
	cin >> a >> b >> c;
	map < int , int > arr;
	arr[a]++;
	arr[b]++;
	arr[c]++;
	for(auto j : arr){
		if(j.first == 5) {
			if(j.second != 2){
				cout << "NO" << endl;
				return 0;
			}
		}
		else if (j.first ==  7){
			if(j.second != 1){
				cout << "NO" << endl;
				return 0;
			}
		}
		else{
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import Counter

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

d = Counter(a)

dict1 = {}
dict2 = {}
for key in d:
  m = d[key]
  if m == 1:
    dict1[key] = 0
    dict2[key] = 0
  elif m == 2:
    dict1[key] = 1
    dict2[key] = 0
  else:
    dict1[key] = m*(m-1)//2
    dict2[key] = (m-1)*(m-2)//2

s = sum(dict1.values())
for each in a:
  tmp = s - dict1[each] + dict2[each]
  print(tmp)

Measured memory_bytes: 38736
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>

using namespace std;

int main(void){

  char c[3];
  int value=700;

  cin >> c[0];
  cin >> c[1];
  cin >> c[2];

  for(int i=0;i<3;i++){
    if(c[i] == 'o') value+=100;
  }

  cout << value << endl;
  
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var w = input[0];
        var h = input[1];
        var n = input[2];

        int[] x = new int[n];
        int[] y = new int[n];
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
        {
            input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            x[i] = input[0];
            y[i] = input[1];
            a[i] = input[2];
        }

        var ans1 = 0;
        var ans2 = w;
        var ans3 = 0;
        var ans4 = h;
        for (int i = 0; i < n; i++)
        {
            switch (a[i])
            {
                case 1:
                    if (ans1 < x[i]) ans1 = x[i];
                    break;
                case 2:
                    if (ans2 > x[i]) ans2 = x[i];
                    break;
                case 3:
                    if (ans3 < y[i]) ans3 = y[i];
                    break;
                case 4:
                    if (ans4 > y[i]) ans4 = y[i];
                    break;
            }
        }

        var ans = (ans2 - ans1) * (ans4 - ans3);
        if (ans2 - ans1 < 0 || ans4 - ans3 < 0) ans = 0;
        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13396
N, Q =  map(int, (input().split(' ')))
S = ' '+str(input())
lr = [tuple(map(int, input().split(' '))) for _ in range(Q)]
save = ''
#i = 0
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, h, x):
        while h <= self.size:
            self.tree[h] += x
            h += h & -h

bit = Bit(N)     # 要素数を与えてインスタンス化
i = 1
while i < len(S)-1:
    if S[i] == "A":
        if S[i+1] == "C":
            bit.add(i, 1)    # a2に10を加える
        else:
            pass
    i += 1

for left, right in lr:
    print(bit.sum(right-1) - bit.sum(left-1)) # a1～a6の合計を返す => 9





Measured memory_bytes: 18340
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n,c[500],f[500],s[500];
int main(){
  
  cin>>n;
  rep(i,n-1) cin>>c[i]>>s[i]>>f[i];
  rep(i,n){
    ll t=0;
    for(ll j=i;j<n-1;j++){
      if(t<s[j]){
        t=s[j];
      }else if(t%f[j]==0){
      }else{
        t=t+f[j]-t%f[j];
      }
      t+=c[j];
    }
    cout<<t<<endl;
  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <fstream>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <queue>
#include <random>
#include <map>
#include <set>

#pragma warning(disable:4996)

using namespace std;

int n, m;


int main(){
  int k;
  cin >> n >> m >> k;
  vector<char> map(1, m*n);
  if (n*m == k) {
    cout << "Yes" << endl;
  }
  else {
    for (int x = 0; x < 1000; ++x) {
      for (int y = 0; y < 1000; ++y) {
        if (n - y >= 0 && m - x >= 0) {
          if ((n - y)*x + (m - x)*y == k) {
            cout << "Yes" << endl;
            return 0;
          }
        }
      }
    }
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> l(n);
  int i=0;
  while(cin>>l[i])i++;
  
  sort(l.begin(),l.end(),greater<int>());

  int ans=0;
  for(i=0;i<k;i++){
    ans+=l[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;



int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS

    int d,t,s;
    cin >> d >> t >> s;

    if(s*t >= d)
    {
    	cout << "Yes";
    }
    else
    {
    	cout << "No";
    }







    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <vector>

typedef long long ll;

#define rep(i,n) for(int i = 0; i < n; i++)
#define debug(x) cerr << #x << ": " << x << "\n";

using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

string S;
int P = 2019;

long long solve() {
    vector<long long> val(P, 0);
    long long tenfactor = 1;
    long long cur = 0;
    val[cur]++;
    for (int i = 0; i < S.size(); ++i) {
      cur = (cur + (S[S.size()-i-1]-'0') * tenfactor) % P;
      tenfactor = (tenfactor * 10) % P;
      val[cur]++;
    }
    long long res = 0;
    for (int p = 0; p < P; ++p) res += val[p] * (val[p] - 1) / 2;
    return res;
}

int main() {
    cin >> S;
    cout << solve() << endl;
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
int a[26]; 
bool OK = true; 
string w;
int main(){

    string w;
    cin >> w;
    int length = w.size();


    for(int i = 0 ; i < length ; i++){
        a[w[i] - 'a']++;
    }

    for(int i = 0 ; i < 26; i++){
        if(a[i] % 2 != 0){
            OK = false;
            cout << "No";
            break;
        }
    }
    
    if(OK == true){
        cout << "Yes";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <vector>
#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    string s;
    cin >> s;
    if(s[s.size()-1]=='s'){
        cout << s << "es" << endl;
    }else{
        cout << s << "s" << endl;
    }

    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))


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

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

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

int main(){

    int n;
    cin >> n;
    string s[60];
    vector<char> output;
    int min = 1000;
    int min_index;

    for(int i=0; i<n; i++){
        cin >> s[i];
        int st_size = s[i].size();
        if(min > st_size){
            min = st_size;
            min_index = i;
        }
    }

    int roop = n-1;

    for(int k=0; k<s[min_index].size(); k++){
        bool flag = true;
        while(roop >= 0){
            if(roop == min_index) {
                roop--;
                continue;
            }

            int bas = s[roop].find(s[min_index][k]);
            //他の文字列のいずれのときでも見つからないとき(例えば入力で言えばb,d)
            if(bas == -1) {flag = false;}
            else{
                //見つかったとき
                s[roop].replace(bas, 1, "-");
            }

            //次の文字列へ
            roop--;
        }

        if(flag) {
            output.push_back(s[min_index][k]);

        }

        //再度設定
        roop = n - 1;
    }


    if(output.size() == 0){
    }else{
        vector<char>::iterator ite;
        sort(output.begin(), output.end());
        for(ite = output.begin(); ite != output.end(); ite++) cout << *ite;
    }

    cout << endl;

}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int a , b;

int main()
{
    _FastIO;
    cin >> a >> b;
    int ans = max(a * b , max(a + b , a - b));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.InputMismatchException;

public class Main {
	void run() {
		MyScanner sc = new MyScanner();

		int MAX = 300001;

		boolean[] prime = new boolean[MAX];
		for (int i = 7; i < MAX; i += 7) {
			if (i - 1 < MAX) prime[i - 1] = true;
			if (i + 1 < MAX) prime[i + 1] = true;
		}

		for (int i = 0; i < MAX; i++) {
			if (prime[i]) {
				for (int j = i + i; j < MAX; j += i) {
					prime[j] = false;
				}
			}
		}

		int id = 0;
		int[] div = new int[300000];
		for (int i = 0; i < MAX; i++) {
			if (prime[i]) {
				div[id++] = i;
			}
		}

		while (true) {
			int n = sc.nextInt();
			if (n == 1) {
				break;
			}

			System.out.print(n + ":");
			int idx = 0;
			while (idx < id) {
				if (n % div[idx] == 0) {
					System.out.print(" " + div[idx]);
				}
				idx++;
			}
			System.out.println();
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}
		System.out.println("----------------------------" + '\n');
	}

	class MyScanner {
		int read() {
			try {
				return System.in.read();
			} catch (IOException e) {
				throw new InputMismatchException();
			}
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

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

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

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

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();
			return array;
		}

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

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();
			return array;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

static const ll INF = 1e15;

const ll mod = 1000000007;

ll mpow(ll x, ll n) {
	ll ans = 1; x %= mod;
	while (n != 0) {
		if (n & 1) ans = ans * x % mod;
		x = x * x % mod;
		n = n >> 1;
	}
	return ans;
}

ll inv_mod(ll a) { return mpow(a, mod - 2); }

class Factorial {
private:
	vector<ll> fac;
	vector<ll> ifac;
public:

	Factorial(ll N) {
		fac.push_back(1);
		for (int i = 0; i < N; i++) fac.push_back(fac[i] * (i + 1) % mod);
		ifac.resize(N + 1);
		ifac[N] = inv_mod(fac[N]);
		for (int i = 0; i < N; i++) ifac[N - 1 - i] = (ifac[N - i] * (N - i)) % mod;
	}

	ll fact(ll a) { return fac[a]; }
	ll ifact(ll a) { return ifac[a]; }

	ll cmb(ll a, ll b) {
		if (a == 0 && b == 0) return 1;
		if (a < b || a < 0 || b < 0) return 0;
		ll tmp = ifact(a - b) * ifact(b) % mod;
		return tmp * fac[a] % mod;
	}
	ll per(ll a, ll b) {
		if (a == 0 && b == 0) return 1;
		if (a < b || a < 0 || b < 0) return 0;
		return fac[a] * ifac[a - b] % mod;
	}
};

int main(void)
{
	ll n, k;
	cin >> n >> k;
	if (n > k) {
		cout << 0 << endl;
		return 0;
	}
	ll sum = 1;
	for (int i = 0; i < n; i++) {
		sum *= (k - i);
		sum %= mod;
	}
	cout << sum << endl;
	return 0;
}



Measured memory_bytes: 3112
#include<cstdio>
#include<iostream>
using namespace std;
int n,k;
int a[300010];
int main() {
	scanf("%d%d",&k,&n);
	if(k&1) {
		for(int i=1; i<=n; i++)
			a[i]=(k+1)/2;
		int last=n;
		for(int i=1; i<=n/2; i++)
			if(a[last]==1) last--;
			else {
				a[last]--;
				for(int j=last+1; j<=n; j++)
					a[j]=k;
				last=n;
			}
		for(int i=1; i<=last; i++)
			printf("%d ",a[i]);
	} else {
		printf("%d ",k/2);
		for(int i=2; i<=n; i++)
			printf("%d ",k);
	}
	return 0;
}

Measured memory_bytes: 3456
import java.util.*;

public class Main {

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

    if (a+b >=24) {
      System.out.println(a+b-24);
    } else {
      System.out.println(a+b);
    }
  }

}


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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937_64 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());

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

    string S, T;
    cin >> S >> T;

    vi prefS(S.size() + 1);
    prefS[0] = 0;
    for (int i = 0; i < S.size(); i++) {
        prefS[i+1] = prefS[i] + (S[i] == 'A' ? 1 : 2);
    }

    vi prefT(T.size() + 1);
    prefT[0] = 0;
    for (int i = 0; i < T.size(); i++) {
        prefT[i+1] = prefT[i] + (T[i] == 'A' ? 1 : 2);
    }

    int Q;
    cin >> Q;
    for (int q = 0; q < Q; q++) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--, b--, c--, d--;

        int sumS = (prefS[b+1] - prefS[a]) % 3;
        int sumT = (prefT[d+1] - prefT[c]) % 3;
        cout << (sumS == sumT ? "YES\n" : "NO\n");
    }

    return 0;
}



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

int main()
{
    string s;
    cin >> s;
    bool ans = false;
    rep(i,2){
        if(s[i] != s[i+1]) ans=true;
    }

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

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

int main()
{
	int arr[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	cin>>k;
	cout<<arr[k-1]<<endl;
	return 0;
}


Measured memory_bytes: 256
num = int(input())
s = list(input())

red_index = [i for i in range(1,len(s)+1) if s[i-1] == 'R']
gre_index = [i for i in range(1,len(s)+1) if s[i-1] == 'G']
blu_index = [i for i in range(1,len(s)+1) if s[i-1] == 'B']
ans = len(red_index) * len(gre_index) * len(blu_index)

delete = 0
for i in range(1,(num // 2) + 1):
  for st in range(num):
    if st+2*i <= num -1:
      check = [s[st], s[st + i], s[st + 2*i]]
      if len(set(check)) == 3:
        delete += 1
print(ans-delete)

Measured memory_bytes: 68580
#include <iostream>

using namespace std;

int main() {
    int k, a, b;
    cin >> k;
    cin >> a >> b;

    for (int i = a; i <= b; i++) {
        if (i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
signed main() {
	ll n, a;
	cin >> n; long double z; cin >> z; a = n * z;
	cout << a << endl;
	return 0;
}

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

public class Main {
    public static void main(String[] args) {
        System.out.println(run());
    }

    private static ArrayList<Integer> nScan(Scanner sc, int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            al.add(sc.nextInt());
        }
        return al;
    }

    private static Object run() {
        try (Scanner sc = new Scanner(System.in);) {
            long h = sc.nextLong(), result = 0;
            for (long i = 1; h != 0; i *= 2) {
                result += i;
                h = (long) Math.floor(h / 2);
            }
            return result;
        }
    }
}

Measured memory_bytes: 27140
#include"iostream"
#include"vector"
#include"algorithm"
using namespace std;

int main()
{
	int h, w;
	cin >> h >> w;
  
	int c[10][10];
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			cin >> c[i][j];
		}
	}

	for (int z = 0; z < 11; z++)
	{
		for (int i = 0; i < 10; i++)
		{
			for (int j = 0; j < 10; j++)
			{
				for (int k = 0; k < 10; k++)
				{
					c[i][j] = min({ c[i][j],c[i][k] + c[k][j] });
				}
			}
		}
	}

	int a[200][200];
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			cin >> a[i][j];
		}
	}

	int ans = 0;
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			if (a[i][j] != -1)
			{
				ans += c[(a[i][j])][1];
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 384